@readium/navigator 2.5.4 → 2.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const v = class v {
1
+ const S = class S {
2
2
  constructor(t) {
3
3
  this.uri = t;
4
4
  }
@@ -7,7 +7,7 @@ const v = class v {
7
7
  */
8
8
  static deserialize(t) {
9
9
  if (!(!t || typeof t != "string"))
10
- return new v(t);
10
+ return new S(t);
11
11
  }
12
12
  /**
13
13
  * Serializes an [AccessibilityProfile] to its RWPM JSON representation.
@@ -19,23 +19,23 @@ const v = class v {
19
19
  * Returns true if the profile is a WCAG Level A profile.
20
20
  */
21
21
  get isWCAGLevelA() {
22
- return this === v.EPUB_A11Y_10_WCAG_20_A || this === v.EPUB_A11Y_11_WCAG_20_A || this === v.EPUB_A11Y_11_WCAG_21_A || this === v.EPUB_A11Y_11_WCAG_22_A;
22
+ return this === S.EPUB_A11Y_10_WCAG_20_A || this === S.EPUB_A11Y_11_WCAG_20_A || this === S.EPUB_A11Y_11_WCAG_21_A || this === S.EPUB_A11Y_11_WCAG_22_A;
23
23
  }
24
24
  /**
25
25
  * Returns true if the profile is a WCAG Level AA profile.
26
26
  */
27
27
  get isWCAGLevelAA() {
28
- return this === v.EPUB_A11Y_10_WCAG_20_AA || this === v.EPUB_A11Y_11_WCAG_20_AA || this === v.EPUB_A11Y_11_WCAG_21_AA || this === v.EPUB_A11Y_11_WCAG_22_AA;
28
+ return this === S.EPUB_A11Y_10_WCAG_20_AA || this === S.EPUB_A11Y_11_WCAG_20_AA || this === S.EPUB_A11Y_11_WCAG_21_AA || this === S.EPUB_A11Y_11_WCAG_22_AA;
29
29
  }
30
30
  /**
31
31
  * Returns true if the profile is a WCAG Level AAA profile.
32
32
  */
33
33
  get isWCAGLevelAAA() {
34
- return this === v.EPUB_A11Y_10_WCAG_20_AAA || this === v.EPUB_A11Y_11_WCAG_20_AAA || this === v.EPUB_A11Y_11_WCAG_21_AAA || this === v.EPUB_A11Y_11_WCAG_22_AAA;
34
+ return this === S.EPUB_A11Y_10_WCAG_20_AAA || this === S.EPUB_A11Y_11_WCAG_20_AAA || this === S.EPUB_A11Y_11_WCAG_21_AAA || this === S.EPUB_A11Y_11_WCAG_22_AAA;
35
35
  }
36
36
  };
37
- v.EPUB_A11Y_10_WCAG_20_A = new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), v.EPUB_A11Y_10_WCAG_20_AA = new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), v.EPUB_A11Y_10_WCAG_20_AAA = new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), v.EPUB_A11Y_11_WCAG_20_A = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), v.EPUB_A11Y_11_WCAG_20_AA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), v.EPUB_A11Y_11_WCAG_20_AAA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), v.EPUB_A11Y_11_WCAG_21_A = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), v.EPUB_A11Y_11_WCAG_21_AA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), v.EPUB_A11Y_11_WCAG_21_AAA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), v.EPUB_A11Y_11_WCAG_22_A = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), v.EPUB_A11Y_11_WCAG_22_AA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), v.EPUB_A11Y_11_WCAG_22_AAA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
38
- let Qe = v;
37
+ S.EPUB_A11Y_10_WCAG_20_A = new S("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), S.EPUB_A11Y_10_WCAG_20_AA = new S("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), S.EPUB_A11Y_10_WCAG_20_AAA = new S("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), S.EPUB_A11Y_11_WCAG_20_A = new S("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), S.EPUB_A11Y_11_WCAG_20_AA = new S("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), S.EPUB_A11Y_11_WCAG_20_AAA = new S("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), S.EPUB_A11Y_11_WCAG_21_A = new S("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), S.EPUB_A11Y_11_WCAG_21_AA = new S("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), S.EPUB_A11Y_11_WCAG_21_AAA = new S("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), S.EPUB_A11Y_11_WCAG_22_A = new S("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), S.EPUB_A11Y_11_WCAG_22_AA = new S("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), S.EPUB_A11Y_11_WCAG_22_AAA = new S("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
38
+ let Qe = S;
39
39
  const _ = class _ {
40
40
  constructor(t) {
41
41
  this.value = t;
@@ -166,12 +166,12 @@ const si = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], kn = /* @__PURE__ */ J
166
166
  // 'tr': () => import('@edrlab/thorium-locales/publication-metadata/tr.json'),
167
167
  // 'uk': () => import('@edrlab/thorium-locales/publication-metadata/uk.json')
168
168
  }, oi = On?.publication?.metadata?.accessibility?.["display-guide"] || {};
169
- class gt {
169
+ class yt {
170
170
  constructor() {
171
171
  this.currentLocaleCode = "en", this.locale = oi, this.loadedLocales = {}, this.loadedLocales.en = oi;
172
172
  }
173
173
  static getInstance() {
174
- return gt.instance || (gt.instance = new gt()), gt.instance;
174
+ return yt.instance || (yt.instance = new yt()), yt.instance;
175
175
  }
176
176
  /**
177
177
  * Loads a locale dynamically
@@ -242,7 +242,7 @@ class gt {
242
242
  return e === void 0 && this.currentLocaleCode !== "en" && (e = this.getNestedValue(this.loadedLocales.en, t)), e !== void 0 ? typeof e == "string" ? { compact: e, descriptive: e } : e : (console.warn(`Missing localization for key: ${t}`), { compact: "", descriptive: "" });
243
243
  }
244
244
  }
245
- gt.getInstance();
245
+ yt.getInstance();
246
246
  var b = /* @__PURE__ */ ((r) => (r.reflowable = "reflowable", r.fixed = "fixed", r.scrolled = "scrolled", r))(b || {});
247
247
  class Fe {
248
248
  /**
@@ -327,7 +327,7 @@ function An(r) {
327
327
  const t = new Array();
328
328
  return r.forEach((e) => t.push(e)), t;
329
329
  }
330
- class m {
330
+ class g {
331
331
  /** Creates a MediaType object. */
332
332
  constructor(t) {
333
333
  let e, i, n = t.mediaType.replace(/\s/g, "").split(";");
@@ -339,24 +339,24 @@ class m {
339
339
  throw new Error("Invalid media type");
340
340
  const o = {};
341
341
  for (let p = 1; p < n.length; p++) {
342
- const g = n[p].split("=");
343
- if (g.length === 2) {
344
- const d = g[0].toLocaleLowerCase(), f = d === "charset" ? g[1].toUpperCase() : g[1];
342
+ const m = n[p].split("=");
343
+ if (m.length === 2) {
344
+ const d = m[0].toLocaleLowerCase(), f = d === "charset" ? m[1].toUpperCase() : m[1];
345
345
  o[d] = f;
346
346
  }
347
347
  }
348
348
  const a = {}, l = Object.keys(o);
349
- l.sort((p, g) => p.localeCompare(g)), l.forEach((p) => a[p] = o[p]);
349
+ l.sort((p, m) => p.localeCompare(m)), l.forEach((p) => a[p] = o[p]);
350
350
  let h = "";
351
351
  for (const p in a) {
352
- const g = a[p];
353
- h += `;${p}=${g}`;
352
+ const m = a[p];
353
+ h += `;${p}=${m}`;
354
354
  }
355
355
  const c = `${e}/${i}${h}`, u = a.encoding;
356
356
  this.string = c, this.type = e, this.subtype = i, this.parameters = a, this.encoding = u, this.name = t.name, this.fileExtension = t.fileExtension;
357
357
  }
358
358
  static parse(t) {
359
- return new m(t);
359
+ return new g(t);
360
360
  }
361
361
  /** Structured syntax suffix, e.g. `+zip` in `application/epub+zip`.
362
362
  * Gives a hint on the underlying structure of this media type.
@@ -386,7 +386,7 @@ class m {
386
386
  * - Wildcards are supported, meaning that `image/*` contains `image/png`
387
387
  */
388
388
  contains(t) {
389
- const e = typeof t == "string" ? m.parse({ mediaType: t }) : t;
389
+ const e = typeof t == "string" ? g.parse({ mediaType: t }) : t;
390
390
  if (!((this.type === "*" || this.type === e.type) && (this.subtype === "*" || this.subtype === e.subtype)))
391
391
  return !1;
392
392
  const i = new Set(
@@ -405,7 +405,7 @@ class m {
405
405
  * doesn't. This is basically like `contains`, but working in both direction.
406
406
  */
407
407
  matches(t) {
408
- const e = typeof t == "string" ? m.parse({ mediaType: t }) : t;
408
+ const e = typeof t == "string" ? g.parse({ mediaType: t }) : t;
409
409
  return this.contains(e) || e.contains(this);
410
410
  }
411
411
  /**
@@ -424,39 +424,39 @@ class m {
424
424
  /** Returns whether this media type is structured as a ZIP archive. */
425
425
  get isZIP() {
426
426
  return this.matchesAny(
427
- m.ZIP,
428
- m.LCP_PROTECTED_AUDIOBOOK,
429
- m.LCP_PROTECTED_PDF
427
+ g.ZIP,
428
+ g.LCP_PROTECTED_AUDIOBOOK,
429
+ g.LCP_PROTECTED_PDF
430
430
  ) || this.structuredSyntaxSuffix === "+zip";
431
431
  }
432
432
  /** Returns whether this media type is structured as a JSON file. */
433
433
  get isJSON() {
434
- return this.matchesAny(m.JSON) || this.structuredSyntaxSuffix === "+json";
434
+ return this.matchesAny(g.JSON) || this.structuredSyntaxSuffix === "+json";
435
435
  }
436
436
  /** Returns whether this media type is of an OPDS feed. */
437
437
  get isOPDS() {
438
438
  return this.matchesAny(
439
- m.OPDS1,
440
- m.OPDS1_ENTRY,
441
- m.OPDS2,
442
- m.OPDS2_PUBLICATION,
443
- m.OPDS_AUTHENTICATION
439
+ g.OPDS1,
440
+ g.OPDS1_ENTRY,
441
+ g.OPDS2,
442
+ g.OPDS2_PUBLICATION,
443
+ g.OPDS_AUTHENTICATION
444
444
  ) || this.structuredSyntaxSuffix === "+json";
445
445
  }
446
446
  /** Returns whether this media type is of an HTML document. */
447
447
  get isHTML() {
448
- return this.matchesAny(m.HTML, m.XHTML);
448
+ return this.matchesAny(g.HTML, g.XHTML);
449
449
  }
450
450
  /** Returns whether this media type is of a bitmap image, so excluding vectorial formats. */
451
451
  get isBitmap() {
452
452
  return this.matchesAny(
453
- m.AVIF,
454
- m.BMP,
455
- m.GIF,
456
- m.JPEG,
457
- m.PNG,
458
- m.TIFF,
459
- m.WEBP
453
+ g.AVIF,
454
+ g.BMP,
455
+ g.GIF,
456
+ g.JPEG,
457
+ g.PNG,
458
+ g.TIFF,
459
+ g.WEBP
460
460
  );
461
461
  }
462
462
  /** Returns whether this media type is of an audio clip. */
@@ -470,317 +470,317 @@ class m {
470
470
  /** Returns whether this media type is of a Readium Web Publication Manifest. */
471
471
  get isRWPM() {
472
472
  return this.matchesAny(
473
- m.READIUM_AUDIOBOOK_MANIFEST,
474
- m.DIVINA_MANIFEST,
475
- m.READIUM_WEBPUB_MANIFEST
473
+ g.READIUM_AUDIOBOOK_MANIFEST,
474
+ g.DIVINA_MANIFEST,
475
+ g.READIUM_WEBPUB_MANIFEST
476
476
  );
477
477
  }
478
478
  /** Returns whether this media type is of a publication file. */
479
479
  get isPublication() {
480
480
  return this.matchesAny(
481
- m.READIUM_AUDIOBOOK,
482
- m.READIUM_AUDIOBOOK_MANIFEST,
483
- m.CBZ,
484
- m.DIVINA,
485
- m.DIVINA_MANIFEST,
486
- m.EPUB,
487
- m.LCP_PROTECTED_AUDIOBOOK,
488
- m.LCP_PROTECTED_PDF,
489
- m.LPF,
490
- m.PDF,
491
- m.W3C_WPUB_MANIFEST,
492
- m.READIUM_WEBPUB,
493
- m.READIUM_WEBPUB_MANIFEST,
494
- m.ZAB
481
+ g.READIUM_AUDIOBOOK,
482
+ g.READIUM_AUDIOBOOK_MANIFEST,
483
+ g.CBZ,
484
+ g.DIVINA,
485
+ g.DIVINA_MANIFEST,
486
+ g.EPUB,
487
+ g.LCP_PROTECTED_AUDIOBOOK,
488
+ g.LCP_PROTECTED_PDF,
489
+ g.LPF,
490
+ g.PDF,
491
+ g.W3C_WPUB_MANIFEST,
492
+ g.READIUM_WEBPUB,
493
+ g.READIUM_WEBPUB_MANIFEST,
494
+ g.ZAB
495
495
  );
496
496
  }
497
497
  // Known Media Types
498
498
  static get AAC() {
499
- return m.parse({ mediaType: "audio/aac", fileExtension: "aac" });
499
+ return g.parse({ mediaType: "audio/aac", fileExtension: "aac" });
500
500
  }
501
501
  static get ACSM() {
502
- return m.parse({
502
+ return g.parse({
503
503
  mediaType: "application/vnd.adobe.adept+xml",
504
504
  name: "Adobe Content Server Message",
505
505
  fileExtension: "acsm"
506
506
  });
507
507
  }
508
508
  static get AIFF() {
509
- return m.parse({ mediaType: "audio/aiff", fileExtension: "aiff" });
509
+ return g.parse({ mediaType: "audio/aiff", fileExtension: "aiff" });
510
510
  }
511
511
  static get AVI() {
512
- return m.parse({
512
+ return g.parse({
513
513
  mediaType: "video/x-msvideo",
514
514
  fileExtension: "avi"
515
515
  });
516
516
  }
517
517
  static get AVIF() {
518
- return m.parse({ mediaType: "image/avif", fileExtension: "avif" });
518
+ return g.parse({ mediaType: "image/avif", fileExtension: "avif" });
519
519
  }
520
520
  static get BINARY() {
521
- return m.parse({ mediaType: "application/octet-stream" });
521
+ return g.parse({ mediaType: "application/octet-stream" });
522
522
  }
523
523
  static get BMP() {
524
- return m.parse({ mediaType: "image/bmp", fileExtension: "bmp" });
524
+ return g.parse({ mediaType: "image/bmp", fileExtension: "bmp" });
525
525
  }
526
526
  static get CBZ() {
527
- return m.parse({
527
+ return g.parse({
528
528
  mediaType: "application/vnd.comicbook+zip",
529
529
  name: "Comic Book Archive",
530
530
  fileExtension: "cbz"
531
531
  });
532
532
  }
533
533
  static get CSS() {
534
- return m.parse({ mediaType: "text/css", fileExtension: "css" });
534
+ return g.parse({ mediaType: "text/css", fileExtension: "css" });
535
535
  }
536
536
  static get DIVINA() {
537
- return m.parse({
537
+ return g.parse({
538
538
  mediaType: "application/divina+zip",
539
539
  name: "Digital Visual Narratives",
540
540
  fileExtension: "divina"
541
541
  });
542
542
  }
543
543
  static get DIVINA_MANIFEST() {
544
- return m.parse({
544
+ return g.parse({
545
545
  mediaType: "application/divina+json",
546
546
  name: "Digital Visual Narratives",
547
547
  fileExtension: "json"
548
548
  });
549
549
  }
550
550
  static get EPUB() {
551
- return m.parse({
551
+ return g.parse({
552
552
  mediaType: "application/epub+zip",
553
553
  name: "EPUB",
554
554
  fileExtension: "epub"
555
555
  });
556
556
  }
557
557
  static get GIF() {
558
- return m.parse({ mediaType: "image/gif", fileExtension: "gif" });
558
+ return g.parse({ mediaType: "image/gif", fileExtension: "gif" });
559
559
  }
560
560
  static get GZ() {
561
- return m.parse({
561
+ return g.parse({
562
562
  mediaType: "application/gzip",
563
563
  fileExtension: "gz"
564
564
  });
565
565
  }
566
566
  static get HTML() {
567
- return m.parse({ mediaType: "text/html", fileExtension: "html" });
567
+ return g.parse({ mediaType: "text/html", fileExtension: "html" });
568
568
  }
569
569
  static get JAVASCRIPT() {
570
- return m.parse({
570
+ return g.parse({
571
571
  mediaType: "text/javascript",
572
572
  fileExtension: "js"
573
573
  });
574
574
  }
575
575
  static get JPEG() {
576
- return m.parse({ mediaType: "image/jpeg", fileExtension: "jpeg" });
576
+ return g.parse({ mediaType: "image/jpeg", fileExtension: "jpeg" });
577
577
  }
578
578
  static get JSON() {
579
- return m.parse({ mediaType: "application/json" });
579
+ return g.parse({ mediaType: "application/json" });
580
580
  }
581
581
  static get LCP_LICENSE_DOCUMENT() {
582
- return m.parse({
582
+ return g.parse({
583
583
  mediaType: "application/vnd.readium.lcp.license.v1.0+json",
584
584
  name: "LCP License",
585
585
  fileExtension: "lcpl"
586
586
  });
587
587
  }
588
588
  static get LCP_PROTECTED_AUDIOBOOK() {
589
- return m.parse({
589
+ return g.parse({
590
590
  mediaType: "application/audiobook+lcp",
591
591
  name: "LCP Protected Audiobook",
592
592
  fileExtension: "lcpa"
593
593
  });
594
594
  }
595
595
  static get LCP_PROTECTED_PDF() {
596
- return m.parse({
596
+ return g.parse({
597
597
  mediaType: "application/pdf+lcp",
598
598
  name: "LCP Protected PDF",
599
599
  fileExtension: "lcpdf"
600
600
  });
601
601
  }
602
602
  static get LCP_STATUS_DOCUMENT() {
603
- return m.parse({
603
+ return g.parse({
604
604
  mediaType: "application/vnd.readium.license.status.v1.0+json"
605
605
  });
606
606
  }
607
607
  static get LPF() {
608
- return m.parse({
608
+ return g.parse({
609
609
  mediaType: "application/lpf+zip",
610
610
  fileExtension: "lpf"
611
611
  });
612
612
  }
613
613
  static get MP3() {
614
- return m.parse({ mediaType: "audio/mpeg", fileExtension: "mp3" });
614
+ return g.parse({ mediaType: "audio/mpeg", fileExtension: "mp3" });
615
615
  }
616
616
  static get MPEG() {
617
- return m.parse({ mediaType: "video/mpeg", fileExtension: "mpeg" });
617
+ return g.parse({ mediaType: "video/mpeg", fileExtension: "mpeg" });
618
618
  }
619
619
  static get NCX() {
620
- return m.parse({
620
+ return g.parse({
621
621
  mediaType: "application/x-dtbncx+xml",
622
622
  fileExtension: "ncx"
623
623
  });
624
624
  }
625
625
  static get OGG() {
626
- return m.parse({ mediaType: "audio/ogg", fileExtension: "oga" });
626
+ return g.parse({ mediaType: "audio/ogg", fileExtension: "oga" });
627
627
  }
628
628
  static get OGV() {
629
- return m.parse({ mediaType: "video/ogg", fileExtension: "ogv" });
629
+ return g.parse({ mediaType: "video/ogg", fileExtension: "ogv" });
630
630
  }
631
631
  static get OPDS1() {
632
- return m.parse({
632
+ return g.parse({
633
633
  mediaType: "application/atom+xml;profile=opds-catalog"
634
634
  });
635
635
  }
636
636
  static get OPDS1_ENTRY() {
637
- return m.parse({
637
+ return g.parse({
638
638
  mediaType: "application/atom+xml;type=entry;profile=opds-catalog"
639
639
  });
640
640
  }
641
641
  static get OPDS2() {
642
- return m.parse({ mediaType: "application/opds+json" });
642
+ return g.parse({ mediaType: "application/opds+json" });
643
643
  }
644
644
  static get OPDS2_PUBLICATION() {
645
- return m.parse({ mediaType: "application/opds-publication+json" });
645
+ return g.parse({ mediaType: "application/opds-publication+json" });
646
646
  }
647
647
  static get OPDS_AUTHENTICATION() {
648
- return m.parse({
648
+ return g.parse({
649
649
  mediaType: "application/opds-authentication+json"
650
650
  });
651
651
  }
652
652
  static get OPUS() {
653
- return m.parse({ mediaType: "audio/opus", fileExtension: "opus" });
653
+ return g.parse({ mediaType: "audio/opus", fileExtension: "opus" });
654
654
  }
655
655
  static get OTF() {
656
- return m.parse({ mediaType: "font/otf", fileExtension: "otf" });
656
+ return g.parse({ mediaType: "font/otf", fileExtension: "otf" });
657
657
  }
658
658
  static get PDF() {
659
- return m.parse({
659
+ return g.parse({
660
660
  mediaType: "application/pdf",
661
661
  name: "PDF",
662
662
  fileExtension: "pdf"
663
663
  });
664
664
  }
665
665
  static get PNG() {
666
- return m.parse({ mediaType: "image/png", fileExtension: "png" });
666
+ return g.parse({ mediaType: "image/png", fileExtension: "png" });
667
667
  }
668
668
  static get READIUM_AUDIOBOOK() {
669
- return m.parse({
669
+ return g.parse({
670
670
  mediaType: "application/audiobook+zip",
671
671
  name: "Readium Audiobook",
672
672
  fileExtension: "audiobook"
673
673
  });
674
674
  }
675
675
  static get READIUM_AUDIOBOOK_MANIFEST() {
676
- return m.parse({
676
+ return g.parse({
677
677
  mediaType: "application/audiobook+json",
678
678
  name: "Readium Audiobook",
679
679
  fileExtension: "json"
680
680
  });
681
681
  }
682
682
  static get READIUM_CONTENT_DOCUMENT() {
683
- return m.parse({
683
+ return g.parse({
684
684
  mediaType: "application/vnd.readium.content+json",
685
685
  name: "Readium Content Document",
686
686
  fileExtension: "json"
687
687
  });
688
688
  }
689
689
  static get READIUM_GUIDED_NAVIGATION_DOCUMENT() {
690
- return m.parse({
690
+ return g.parse({
691
691
  mediaType: "application/guided-navigation+json",
692
692
  name: "Readium Guided Navigation Document",
693
693
  fileExtension: "json"
694
694
  });
695
695
  }
696
696
  static get READIUM_POSITION_LIST() {
697
- return m.parse({
697
+ return g.parse({
698
698
  mediaType: "application/vnd.readium.position-list+json",
699
699
  name: "Readium Position List",
700
700
  fileExtension: "json"
701
701
  });
702
702
  }
703
703
  static get READIUM_WEBPUB() {
704
- return m.parse({
704
+ return g.parse({
705
705
  mediaType: "application/webpub+zip",
706
706
  name: "Readium Web Publication",
707
707
  fileExtension: "webpub"
708
708
  });
709
709
  }
710
710
  static get READIUM_WEBPUB_MANIFEST() {
711
- return m.parse({
711
+ return g.parse({
712
712
  mediaType: "application/webpub+json",
713
713
  name: "Readium Web Publication",
714
714
  fileExtension: "json"
715
715
  });
716
716
  }
717
717
  static get SMIL() {
718
- return m.parse({
718
+ return g.parse({
719
719
  mediaType: "application/smil+xml",
720
720
  fileExtension: "smil"
721
721
  });
722
722
  }
723
723
  static get SVG() {
724
- return m.parse({
724
+ return g.parse({
725
725
  mediaType: "image/svg+xml",
726
726
  fileExtension: "svg"
727
727
  });
728
728
  }
729
729
  static get TEXT() {
730
- return m.parse({ mediaType: "text/plain", fileExtension: "txt" });
730
+ return g.parse({ mediaType: "text/plain", fileExtension: "txt" });
731
731
  }
732
732
  static get TIFF() {
733
- return m.parse({ mediaType: "image/tiff", fileExtension: "tiff" });
733
+ return g.parse({ mediaType: "image/tiff", fileExtension: "tiff" });
734
734
  }
735
735
  static get TTF() {
736
- return m.parse({ mediaType: "font/ttf", fileExtension: "ttf" });
736
+ return g.parse({ mediaType: "font/ttf", fileExtension: "ttf" });
737
737
  }
738
738
  static get W3C_WPUB_MANIFEST() {
739
- return m.parse({
739
+ return g.parse({
740
740
  mediaType: "application/x.readium.w3c.wpub+json",
741
741
  name: "Web Publication",
742
742
  fileExtension: "json"
743
743
  });
744
744
  }
745
745
  static get WAV() {
746
- return m.parse({ mediaType: "audio/wav", fileExtension: "wav" });
746
+ return g.parse({ mediaType: "audio/wav", fileExtension: "wav" });
747
747
  }
748
748
  static get WEBM_AUDIO() {
749
- return m.parse({ mediaType: "audio/webm", fileExtension: "webm" });
749
+ return g.parse({ mediaType: "audio/webm", fileExtension: "webm" });
750
750
  }
751
751
  static get WEBM_VIDEO() {
752
- return m.parse({ mediaType: "video/webm", fileExtension: "webm" });
752
+ return g.parse({ mediaType: "video/webm", fileExtension: "webm" });
753
753
  }
754
754
  static get WEBP() {
755
- return m.parse({ mediaType: "image/webp", fileExtension: "webp" });
755
+ return g.parse({ mediaType: "image/webp", fileExtension: "webp" });
756
756
  }
757
757
  static get WOFF() {
758
- return m.parse({ mediaType: "font/woff", fileExtension: "woff" });
758
+ return g.parse({ mediaType: "font/woff", fileExtension: "woff" });
759
759
  }
760
760
  static get WOFF2() {
761
- return m.parse({ mediaType: "font/woff2", fileExtension: "woff2" });
761
+ return g.parse({ mediaType: "font/woff2", fileExtension: "woff2" });
762
762
  }
763
763
  static get XHTML() {
764
- return m.parse({
764
+ return g.parse({
765
765
  mediaType: "application/xhtml+xml",
766
766
  fileExtension: "xhtml"
767
767
  });
768
768
  }
769
769
  static get XML() {
770
- return m.parse({
770
+ return g.parse({
771
771
  mediaType: "application/xml",
772
772
  fileExtension: "xml"
773
773
  });
774
774
  }
775
775
  static get ZAB() {
776
- return m.parse({
776
+ return g.parse({
777
777
  mediaType: "application/x.readium.zab+zip",
778
778
  name: "Zipped Audio Book",
779
779
  fileExtension: "zab"
780
780
  });
781
781
  }
782
782
  static get ZIP() {
783
- return m.parse({
783
+ return g.parse({
784
784
  mediaType: "application/zip",
785
785
  fileExtension: "zip"
786
786
  });
@@ -955,7 +955,7 @@ class $ {
955
955
  }
956
956
  /** MediaType of the linked resource. */
957
957
  get mediaType() {
958
- return this.type !== void 0 ? m.parse({ mediaType: this.type }) : m.BINARY;
958
+ return this.type !== void 0 ? g.parse({ mediaType: this.type }) : g.BINARY;
959
959
  }
960
960
  /** Computes an absolute URL to the link, relative to the given `baseURL`.
961
961
  * If the link's `href` is already absolute, the `baseURL` is ignored.
@@ -1376,7 +1376,7 @@ Fn([
1376
1376
  // Angular attributes
1377
1377
  "ng-*"
1378
1378
  ]);
1379
- const In = Math.pow(2, 32), ci = () => Math.round(Math.random() * In).toString(36), we = () => `${Math.round(performance.now())}-${ci()}-${ci()}`, ft = 1;
1379
+ const In = Math.pow(2, 32), ci = () => Math.round(Math.random() * In).toString(36), we = () => `${Math.round(performance.now())}-${ci()}-${ci()}`, gt = 1;
1380
1380
  class zn {
1381
1381
  constructor(t) {
1382
1382
  this.destination = null, this.registrar = /* @__PURE__ */ new Map(), this.origin = "", this.channelId = "", this.receiver = this.receive.bind(this), this.preLog = [], this.wnd = t, t.addEventListener("message", this.receiver);
@@ -1388,8 +1388,8 @@ class zn {
1388
1388
  if (!(!("_readium" in e) || !e._readium || e._readium <= 0)) {
1389
1389
  if (e.key === "_ping") {
1390
1390
  if (!this.destination) {
1391
- if (this.destination = t.source, this.origin = t.origin, this.channelId = e._channel, e._readium !== ft) {
1392
- e._readium > ft ? this.send("error", `received comms version ${e._readium} higher than ${ft}`) : this.send("error", `received comms version ${e._readium} lower than ${ft}`), this.destination = null, this.origin = "", this.channelId = "";
1391
+ if (this.destination = t.source, this.origin = t.origin, this.channelId = e._channel, e._readium !== gt) {
1392
+ e._readium > gt ? this.send("error", `received comms version ${e._readium} higher than ${gt}`) : this.send("error", `received comms version ${e._readium} lower than ${gt}`), this.destination = null, this.origin = "", this.channelId = "";
1393
1393
  return;
1394
1394
  }
1395
1395
  this.send("_pong", void 0), this.preLog.forEach((i) => this.send("log", i)), this.preLog = [];
@@ -1449,7 +1449,7 @@ class zn {
1449
1449
  send(t, e, i = void 0, n = []) {
1450
1450
  if (!this.destination) throw Error("Attempted to send comms message before destination has been initialized");
1451
1451
  const s = {
1452
- _readium: ft,
1452
+ _readium: gt,
1453
1453
  _channel: this.channelId,
1454
1454
  id: i ?? we(),
1455
1455
  // scrict,
@@ -1507,18 +1507,18 @@ function Ki(r, t, e) {
1507
1507
  for (let p = 0; p < 256; p++)
1508
1508
  h.push(a);
1509
1509
  for (let p = 0; p < t.length; p += 1) {
1510
- const g = t.charCodeAt(p);
1511
- if (l.has(g))
1510
+ const m = t.charCodeAt(p);
1511
+ if (l.has(m))
1512
1512
  continue;
1513
1513
  const d = new Uint32Array(s + 1);
1514
- l.set(g, d), g < h.length && (h[g] = d);
1514
+ l.set(m, d), m < h.length && (h[m] = d);
1515
1515
  for (let f = 0; f <= s; f += 1) {
1516
1516
  d[f] = 0;
1517
1517
  for (let w = 0; w < n; w += 1) {
1518
1518
  const P = f * n + w;
1519
1519
  if (P >= t.length)
1520
1520
  continue;
1521
- t.charCodeAt(P) === g && (d[f] |= 1 << w);
1521
+ t.charCodeAt(P) === m && (d[f] |= 1 << w);
1522
1522
  }
1523
1523
  }
1524
1524
  }
@@ -1530,9 +1530,9 @@ function Ki(r, t, e) {
1530
1530
  for (let p = 0; p <= c; p += 1)
1531
1531
  o.P[p] = -1, o.M[p] = 0;
1532
1532
  for (let p = 0; p < r.length; p += 1) {
1533
- const g = r.charCodeAt(p);
1533
+ const m = r.charCodeAt(p);
1534
1534
  let d;
1535
- g < h.length ? d = h[g] : (d = l.get(g), typeof d > "u" && (d = a));
1535
+ m < h.length ? d = h[m] : (d = l.get(m), typeof d > "u" && (d = a));
1536
1536
  let f = 0;
1537
1537
  for (let w = 0; w <= c; w += 1)
1538
1538
  f = ui(o, d, w, f), u[w] += f;
@@ -1581,7 +1581,7 @@ function Un(r, t, e = {}) {
1581
1581
  if (n.length === 0)
1582
1582
  return null;
1583
1583
  const s = (a) => {
1584
- const p = 1 - a.errors / t.length, g = e.prefix ? pi(
1584
+ const p = 1 - a.errors / t.length, m = e.prefix ? pi(
1585
1585
  r.slice(
1586
1586
  Math.max(0, a.start - e.prefix.length),
1587
1587
  a.start
@@ -1592,7 +1592,7 @@ function Un(r, t, e = {}) {
1592
1592
  e.suffix
1593
1593
  ) : 1;
1594
1594
  let f = 1;
1595
- return typeof e.hint == "number" && (f = 1 - Math.abs(a.start - e.hint) / r.length), (50 * p + 20 * g + 20 * d + 2 * f) / 92;
1595
+ return typeof e.hint == "number" && (f = 1 - Math.abs(a.start - e.hint) / r.length), (50 * p + 20 * m + 20 * d + 2 * f) / 92;
1596
1596
  }, o = n.map((a) => ({
1597
1597
  start: a.start,
1598
1598
  end: a.end,
@@ -1600,7 +1600,7 @@ function Un(r, t, e = {}) {
1600
1600
  }));
1601
1601
  return o.sort((a, l) => l.score - a.score), o[0];
1602
1602
  }
1603
- function Se(r, t, e) {
1603
+ function ve(r, t, e) {
1604
1604
  const i = e === 1 ? t : t - 1;
1605
1605
  if (r.charAt(i).trim() !== "")
1606
1606
  return t;
@@ -1623,7 +1623,7 @@ function fi(r, t) {
1623
1623
  const a = () => {
1624
1624
  if (s = t === 1 ? e.nextNode() : e.previousNode(), s) {
1625
1625
  const l = s.textContent, h = t === 1 ? 0 : l.length;
1626
- o = Se(l, h, t);
1626
+ o = ve(l, h, t);
1627
1627
  }
1628
1628
  };
1629
1629
  for (; s && o === -1 && s !== n; )
@@ -1642,13 +1642,13 @@ function Hn(r) {
1642
1642
  const t = r.cloneRange();
1643
1643
  let e = !1, i = !1;
1644
1644
  const n = {
1645
- start: Se(
1645
+ start: ve(
1646
1646
  r.startContainer.textContent,
1647
1647
  r.startOffset,
1648
1648
  1
1649
1649
  /* Forwards */
1650
1650
  ),
1651
- end: Se(
1651
+ end: ve(
1652
1652
  r.endContainer.textContent,
1653
1653
  r.endOffset,
1654
1654
  2
@@ -1684,7 +1684,7 @@ function Zi(r) {
1684
1684
  return 0;
1685
1685
  }
1686
1686
  }
1687
- function mi(r) {
1687
+ function gi(r) {
1688
1688
  let t = r.previousSibling, e = 0;
1689
1689
  for (; t; )
1690
1690
  e += Zi(t), t = t.previousSibling;
@@ -1722,7 +1722,7 @@ class K {
1722
1722
  throw new Error("Parent is not an ancestor of current element");
1723
1723
  let e = this.element, i = this.offset;
1724
1724
  for (; e !== t; )
1725
- i += mi(e), e = e.parentElement;
1725
+ i += gi(e), e = e.parentElement;
1726
1726
  return new K(e, i);
1727
1727
  }
1728
1728
  /**
@@ -1787,7 +1787,7 @@ class K {
1787
1787
  throw new Error("Text node offset is out of range");
1788
1788
  if (!t.parentElement)
1789
1789
  throw new Error("Text node has no parent");
1790
- const i = mi(t) + e;
1790
+ const i = gi(t) + e;
1791
1791
  return new K(t.parentElement, i);
1792
1792
  }
1793
1793
  case Node.ELEMENT_NODE: {
@@ -2013,7 +2013,7 @@ function tn(r, t, e) {
2013
2013
  continue;
2014
2014
  const a = j(s.top, o.top, t) && j(s.bottom, o.bottom, t), l = j(s.left, o.left, t) && j(s.right, o.right, t);
2015
2015
  if (a && !l && nn(s, o, t)) {
2016
- const u = r.filter((g) => g !== s && g !== o), p = jn(s, o);
2016
+ const u = r.filter((m) => m !== s && m !== o), p = jn(s, o);
2017
2017
  return u.push(p), tn(
2018
2018
  u,
2019
2019
  t
@@ -2060,11 +2060,11 @@ function en(r) {
2060
2060
  const i = r[t], n = r[e];
2061
2061
  if (i !== n && nn(i, n, -1)) {
2062
2062
  let s = [], o;
2063
- const a = gi(i, n);
2063
+ const a = mi(i, n);
2064
2064
  if (a.length === 1)
2065
2065
  s = a, o = i;
2066
2066
  else {
2067
- const h = gi(n, i);
2067
+ const h = mi(n, i);
2068
2068
  a.length < h.length ? (s = a, o = i) : (s = h, o = n);
2069
2069
  }
2070
2070
  const l = r.filter((h) => h !== o);
@@ -2073,7 +2073,7 @@ function en(r) {
2073
2073
  }
2074
2074
  return r;
2075
2075
  }
2076
- function gi(r, t) {
2076
+ function mi(r, t) {
2077
2077
  const e = Xn(t, r);
2078
2078
  if (e.height === 0 || e.width === 0)
2079
2079
  return [r];
@@ -2165,7 +2165,7 @@ function re(r, t) {
2165
2165
  r.document.documentElement.style.removeProperty(t);
2166
2166
  }
2167
2167
  let Dt = null, pe = null, Ct = 0;
2168
- const mt = { r: 255, g: 255, b: 255, a: 1 }, ct = /* @__PURE__ */ new Map(), Yn = () => {
2168
+ const mt = { r: 255, g: 255, b: 255, a: 1 }, dt = /* @__PURE__ */ new Map(), Yn = () => {
2169
2169
  if (!Dt)
2170
2170
  if (typeof OffscreenCanvas < "u")
2171
2171
  Dt = new OffscreenCanvas(5, 5), pe = Dt.getContext("2d", {
@@ -2203,15 +2203,15 @@ const mt = { r: 255, g: 255, b: 255, a: 1 }, ct = /* @__PURE__ */ new Map(), Yn
2203
2203
  console.warn(
2204
2204
  `[Decorator] Could not parse color: "${r}". ${t} Falling back to ${JSON.stringify(mt)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`
2205
2205
  );
2206
- }, ve = (r, t = null) => {
2207
- const e = t ? `${r}|${t}` : r, i = ct.get(e);
2206
+ }, Se = (r, t = null) => {
2207
+ const e = t ? `${r}|${t}` : r, i = dt.get(e);
2208
2208
  if (i !== void 0)
2209
2209
  return i ?? mt;
2210
2210
  if (qn(r))
2211
- return Wt(r, "Unsupported color format or special value."), ct.set(e, null), mt;
2211
+ return Wt(r, "Unsupported color format or special value."), dt.set(e, null), mt;
2212
2212
  const n = Yn();
2213
2213
  if (!n)
2214
- return Wt(r, "Could not get canvas context."), ct.set(e, null), mt;
2214
+ return Wt(r, "Could not get canvas context."), dt.set(e, null), mt;
2215
2215
  try {
2216
2216
  Ct === 0 && n.clearRect(0, 0, 5, 5);
2217
2217
  const s = Ct % 5, o = Math.floor(Ct / 5);
@@ -2220,11 +2220,11 @@ const mt = { r: 255, g: 255, b: 255, a: 1 }, ct = /* @__PURE__ */ new Map(), Yn
2220
2220
  Ct = (Ct + 1) % 25;
2221
2221
  const [l, h, c, u] = a.data;
2222
2222
  if (u === 0)
2223
- return Wt(r, "Fully transparent color."), ct.set(e, null), mt;
2223
+ return Wt(r, "Fully transparent color."), dt.set(e, null), mt;
2224
2224
  const p = { r: l, g: h, b: c, a: u / 255 };
2225
- return ct.set(e, p), p;
2225
+ return dt.set(e, p), p;
2226
2226
  } catch (s) {
2227
- return Wt(r, `Error: ${s instanceof Error ? s.message : String(s)}`), ct.set(e, null), mt;
2227
+ return Wt(r, `Error: ${s instanceof Error ? s.message : String(s)}`), dt.set(e, null), mt;
2228
2228
  }
2229
2229
  }, fe = (r) => {
2230
2230
  const t = r / 255;
@@ -2233,12 +2233,12 @@ const mt = { r: 255, g: 255, b: 255, a: 1 }, ct = /* @__PURE__ */ new Map(), Yn
2233
2233
  const t = fe(r.r), e = fe(r.g), i = fe(r.b);
2234
2234
  return 0.2126 * t + 0.7152 * e + 0.0722 * i;
2235
2235
  }, bi = (r, t) => {
2236
- const e = typeof r == "string" ? ve(r) : r, i = typeof t == "string" ? ve(t) : t, n = yi(e), s = yi(i), o = Math.max(n, s), a = Math.min(n, s);
2236
+ const e = typeof r == "string" ? Se(r) : r, i = typeof t == "string" ? Se(t) : t, n = yi(e), s = yi(i), o = Math.max(n, s), a = Math.min(n, s);
2237
2237
  return (o + 0.05) / (a + 0.05);
2238
2238
  }, Pe = (r, t = null) => {
2239
- const e = ve(r, t), i = bi(e, { r: 255, g: 255, b: 255, a: 1 }), n = bi(e, { r: 0, g: 0, b: 0, a: 1 });
2239
+ const e = Se(r, t), i = bi(e, { r: 255, g: 255, b: 255, a: 1 }), n = bi(e, { r: 0, g: 0, b: 0, a: 1 });
2240
2240
  return i > n;
2241
- }, Kn = (r, t = null) => Pe(r, t) ? "white" : "black", wi = "#FFFF00", Jn = () => "Highlight" in window, Si = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
2241
+ }, Kn = (r, t = null) => Pe(r, t) ? "white" : "black", wi = "#FFFF00", Jn = () => "Highlight" in window, vi = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
2242
2242
  class Zn {
2243
2243
  /**
2244
2244
  * Creates a DecorationGroup object
@@ -2265,7 +2265,7 @@ class Zn {
2265
2265
  return;
2266
2266
  }
2267
2267
  const n = i.commonAncestorContainer;
2268
- n.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Si.includes(n.nodeName.toUpperCase()) && this.notTextFlag?.set(e, !0), i.cloneContents().querySelector(Si.join(", ").toLowerCase()) && this.notTextFlag?.set(e, !0), (n.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(e, !0));
2268
+ n.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (vi.includes(n.nodeName.toUpperCase()) && this.notTextFlag?.set(e, !0), i.cloneContents().querySelector(vi.join(", ").toLowerCase()) && this.notTextFlag?.set(e, !0), (n.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(e, !0));
2269
2269
  const s = {
2270
2270
  decoration: t,
2271
2271
  id: e,
@@ -2356,9 +2356,9 @@ class Zn {
2356
2356
  >
2357
2357
  </div>
2358
2358
  `.trim();
2359
- const g = u.content.firstElementChild;
2359
+ const m = u.content.firstElementChild;
2360
2360
  if (t.decoration?.style?.layout === "bounds") {
2361
- const d = g.cloneNode(!0);
2361
+ const d = m.cloneNode(!0);
2362
2362
  d.style.setProperty("pointer-events", "none"), h(d, c, c), e.append(d);
2363
2363
  } else {
2364
2364
  let d = Vn(
@@ -2366,7 +2366,7 @@ class Zn {
2366
2366
  );
2367
2367
  d = d.sort((f, w) => f.top < w.top ? -1 : f.top > w.top ? 1 : 0);
2368
2368
  for (let f of d) {
2369
- const w = g.cloneNode(!0);
2369
+ const w = m.cloneNode(!0);
2370
2370
  w.style.setProperty("pointer-events", "none"), h(w, f, c), e.append(w);
2371
2371
  }
2372
2372
  }
@@ -2473,7 +2473,7 @@ const Ot = class Ot extends Et {
2473
2473
  };
2474
2474
  Ot.moduleName = "decorator";
2475
2475
  let Ee = Ot;
2476
- const vi = "readium-snapper-style", Rt = class Rt extends Et {
2476
+ const Si = "readium-snapper-style", Rt = class Rt extends Et {
2477
2477
  constructor() {
2478
2478
  super(...arguments), this.protected = !1;
2479
2479
  }
@@ -2486,18 +2486,18 @@ const vi = "readium-snapper-style", Rt = class Rt extends Et {
2486
2486
  }
2487
2487
  mount(t, e) {
2488
2488
  const i = t.document.createElement("style");
2489
- return i.dataset.readium = "true", i.id = vi, i.textContent = this.buildStyles(), t.document.head.appendChild(i), e.register("protect", Rt.moduleName, (n, s) => {
2489
+ return i.dataset.readium = "true", i.id = Si, i.textContent = this.buildStyles(), t.document.head.appendChild(i), e.register("protect", Rt.moduleName, (n, s) => {
2490
2490
  this.protected = !0, i.textContent = this.buildStyles(), s(!0);
2491
2491
  }), e.register("unprotect", Rt.moduleName, (n, s) => {
2492
2492
  this.protected = !1, i.textContent = this.buildStyles(), s(!0);
2493
2493
  }), e.log("Snapper Mounted"), !0;
2494
2494
  }
2495
2495
  unmount(t, e) {
2496
- return t.document.getElementById(vi)?.remove(), e.log("Snapper Unmounted"), !0;
2496
+ return t.document.getElementById(Si)?.remove(), e.log("Snapper Unmounted"), !0;
2497
2497
  }
2498
2498
  };
2499
2499
  Rt.moduleName = "snapper";
2500
- let vt = Rt;
2500
+ let St = Rt;
2501
2501
  function Qn(r) {
2502
2502
  return (r.document.documentElement.dir || r.document.body.dir).toLowerCase() === "rtl";
2503
2503
  }
@@ -2563,7 +2563,7 @@ function ss(r) {
2563
2563
  return r ? r.closest("[inert]") !== null || r.hasAttribute("disabled") : !0;
2564
2564
  }
2565
2565
  function on(r) {
2566
- return r ? r.role && ns.includes(r.role) || r.tabIndex >= 0 ? !0 : is.includes(r.nodeName.toLowerCase()) || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" : !1;
2566
+ return r ? r.role && ns.includes(r.role) ? !0 : r.tagName.toLowerCase() === "iframe" ? !1 : r.tabIndex >= 0 ? !0 : is.includes(r.nodeName.toLowerCase()) || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" : !1;
2567
2567
  }
2568
2568
  function oe(r, t) {
2569
2569
  const e = an(r, r.document.body, t), i = r._readium_cssSelectorGenerator.getCssSelector(e, {
@@ -2665,9 +2665,9 @@ class ae {
2665
2665
  return this.resetAfterDetection(), !0;
2666
2666
  } else
2667
2667
  this.consistentScrollCount = Math.max(0, this.consistentScrollCount - 1);
2668
- let p = 0, g = this.history[0].direction;
2668
+ let p = 0, m = this.history[0].direction;
2669
2669
  for (let f = 1; f < this.history.length; f++)
2670
- this.history[f].direction !== g && (p++, g = this.history[f].direction);
2670
+ this.history[f].direction !== m && (p++, m = this.history[f].direction);
2671
2671
  return p / this.history.length > (this.options.minDirectionChanges || 0.3) ? (this.resetAfterDetection(), !0) : !1;
2672
2672
  }
2673
2673
  resetAfterDetection() {
@@ -2677,7 +2677,7 @@ class ae {
2677
2677
  this.history = [], this.consistentScrollCount = 0;
2678
2678
  }
2679
2679
  }
2680
- const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2680
+ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends St {
2681
2681
  constructor() {
2682
2682
  super(...arguments), this.isSnapProtectionEnabled = !1, this.patternAnalyzer = null, this.lastTurnTime = 0, this.rtl = !1, this.shakeTimeout = 0, this.snappingCancelled = !1, this.alreadyScrollLeft = 0, this.overscroll = 0, this.cachedScrollWidth = 0, this.touchState = 0, this.startingX = void 0, this.endingX = void 0, this.onTouchStarter = this.onTouchStart.bind(this), this.onTouchEnder = this.onTouchEnd.bind(this), this.onWidthChanger = this.onWidthChange.bind(this), this.onTouchMover = this.onTouchMove.bind(this);
2683
2683
  }
@@ -2733,16 +2733,16 @@ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2733
2733
  }
2734
2734
  // Snaps the current offset to the page width.
2735
2735
  snapCurrentOffset(t = !1, e = !1) {
2736
- const i = this.doc(), n = rn(this.wnd), s = this.cachedScrollWidth - this.wnd.innerWidth, o = Math.min(Math.max(0, this.normScroll()), s), a = this.dragOffset(), l = this.rtl ? -a : a, h = this.wnd.innerWidth / 3 * (l > 0 ? 2 : 1), c = Math.min(s, Math.max(0, this.snapNormOffset(o + h))), u = this.rtl ? -c : c, p = this.rtl ? -o : o, g = u > p ? "right" : "left";
2737
- if (this.checkSuspiciousSnap(g, Math.abs(u - p)), t && u !== p) {
2736
+ const i = this.doc(), n = rn(this.wnd), s = this.cachedScrollWidth - this.wnd.innerWidth, o = Math.min(Math.max(0, this.normScroll()), s), a = this.dragOffset(), l = this.rtl ? -a : a, h = this.wnd.innerWidth / 3 * (l > 0 ? 2 : 1), c = Math.min(s, Math.max(0, this.snapNormOffset(o + h))), u = this.rtl ? -c : c, p = this.rtl ? -o : o, m = u > p ? "right" : "left";
2737
+ if (this.checkSuspiciousSnap(m, Math.abs(u - p)), t && u !== p) {
2738
2738
  this.snappingCancelled = !1;
2739
- const d = (R, Y, lt, ht) => lt > ht ? Y : R + (Y - R) * es(lt / ht), f = cs * n;
2739
+ const d = (R, Y, ht, ct) => ht > ct ? Y : R + (Y - R) * es(ht / ct), f = cs * n;
2740
2740
  let w;
2741
2741
  const P = (R) => {
2742
2742
  if (this.snappingCancelled) return;
2743
2743
  w || (w = R);
2744
- const Y = R - w, lt = d(this.overscroll, 0, Y, f), ht = d(p, u, Y, f);
2745
- i.scrollLeft = ht, this.overscroll !== 0 && (i.style.transform = `translate3d(${-lt}px, 0px, 0px)`), Y < f ? this.wnd.requestAnimationFrame(P) : (this.clearTouches(), i.style.removeProperty("transform"), i.scrollLeft = u, e || this.reportProgress());
2744
+ const Y = R - w, ht = d(this.overscroll, 0, Y, f), ct = d(p, u, Y, f);
2745
+ i.scrollLeft = ct, this.overscroll !== 0 && (i.style.transform = `translate3d(${-ht}px, 0px, 0px)`), Y < f ? this.wnd.requestAnimationFrame(P) : (this.clearTouches(), i.style.removeProperty("transform"), i.scrollLeft = u, e || this.reportProgress());
2746
2746
  };
2747
2747
  this.wnd.requestAnimationFrame(P);
2748
2748
  } else
@@ -2956,7 +2956,7 @@ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2956
2956
  };
2957
2957
  D.moduleName = "column_snapper";
2958
2958
  let Ce = D;
2959
- const _i = "readium-scroll-snapper-style", U = class U extends vt {
2959
+ const _i = "readium-scroll-snapper-style", U = class U extends St {
2960
2960
  constructor() {
2961
2961
  super(...arguments), this.patternAnalyzer = null, this.lastScrollTime = 0, this.isScrollProtectionEnabled = !1, this.initialScrollHandled = !1, this.isScrolling = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce = null, this.handleScroll = (t) => {
2962
2962
  if (this.comms.ready && !this.isResizing) {
@@ -3089,7 +3089,7 @@ const _i = "readium-scroll-snapper-style", U = class U extends vt {
3089
3089
  };
3090
3090
  U.moduleName = "scroll_snapper";
3091
3091
  let _e = U;
3092
- const H = class H extends vt {
3092
+ const H = class H extends St {
3093
3093
  constructor() {
3094
3094
  super(...arguments), this.patternAnalyzer = null, this.lastScrollTime = 0, this.isScrollProtectionEnabled = !1, this.initialScrollHandled = !1, this.isScrolling = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce = null, this.handleScroll = (t) => {
3095
3095
  if (this.comms.ready && !this.isResizing) {
@@ -3384,7 +3384,7 @@ class hn {
3384
3384
  };
3385
3385
  }
3386
3386
  }
3387
- const yt = class yt extends Et {
3387
+ const ot = class ot extends Et {
3388
3388
  constructor() {
3389
3389
  super(...arguments), this.configApplied = !1, this.cleanupCallbacks = [], this.pointerMoved = !1, this.isContextMenuEnabled = !1, this.isDragAndDropEnabled = !1, this.isSelectionMonitoringEnabled = !1, this.isBulkCopyProtectionEnabled = !1, this.selectionAnalyzer = null, this.currentSelection = null, this.bulkCopyProtector = null, this.keyManager = new hn(), this.keyDownHandler = null, this.preventBulkCopy = (t) => {
3390
3390
  if (!this.isBulkCopyProtectionEnabled || !this.bulkCopyProtector)
@@ -3578,7 +3578,7 @@ const yt = class yt extends Et {
3578
3578
  }
3579
3579
  }
3580
3580
  registerProtectionHandlers() {
3581
- this.comms?.register("peripherals_protection", yt.moduleName, (t, e) => {
3581
+ this.comms?.register("peripherals_protection", ot.moduleName, (t, e) => {
3582
3582
  const i = t;
3583
3583
  if (!this.configApplied) {
3584
3584
  if (this.configApplied = !0, i.monitorSelection) {
@@ -3596,7 +3596,9 @@ const yt = class yt extends Et {
3596
3596
  }), this.comms?.log("Copy protection enabled")), i.disableContextMenu && (this.addContextMenuPrevention(), this.comms?.log("Context menu protection enabled")), i.disableDragAndDrop && (this.addDragAndDropPrevention(), this.comms?.log("Drag and drop protection enabled"));
3597
3597
  }
3598
3598
  e(!0);
3599
- }), this.comms?.register("keyboard_peripherals", yt.moduleName, (t, e) => {
3599
+ }), this.comms?.register("unfocus", ot.moduleName, (t, e) => {
3600
+ this.disableKeyboardPeripherals(), e(!0);
3601
+ }), this.comms?.register("keyboard_peripherals", ot.moduleName, (t, e) => {
3600
3602
  const i = t;
3601
3603
  i && i.length > 0 && (this.enableKeyboardPeripherals(i), this.comms?.log(`Keyboard peripherals enabled: ${i.map((n) => n.type).join(", ")}`)), e(!0);
3602
3604
  });
@@ -3605,11 +3607,11 @@ const yt = class yt extends Et {
3605
3607
  return this.wnd = t, this.comms = e, this.registerProtectionHandlers(), t.document.addEventListener("pointerdown", this.onPointerDown), t.document.addEventListener("pointerup", this.onPointerUp), t.document.addEventListener("pointermove", this.onPointerMove), t.document.addEventListener("click", this.onClicker), e.log("Peripherals Mounted"), !0;
3606
3608
  }
3607
3609
  unmount(t, e) {
3608
- return this.removeBulkCopyProtection(), this.removeSelectionMonitoring(), this.removeContextMenuPrevention(), this.removeDragAndDropPrevention(), this.disableKeyboardPeripherals(), this.cleanupCallbacks.forEach((i) => i()), this.cleanupCallbacks = [], t.document.removeEventListener("pointerdown", this.onPointerDown), t.document.removeEventListener("pointerup", this.onPointerUp), t.document.removeEventListener("pointermove", this.onPointerMove), t.document.removeEventListener("click", this.onClicker), e.unregisterAll(yt.moduleName), this.configApplied = !1, e.log("Peripherals Unmounted"), !0;
3610
+ return this.removeBulkCopyProtection(), this.removeSelectionMonitoring(), this.removeContextMenuPrevention(), this.removeDragAndDropPrevention(), this.disableKeyboardPeripherals(), this.cleanupCallbacks.forEach((i) => i()), this.cleanupCallbacks = [], t.document.removeEventListener("pointerdown", this.onPointerDown), t.document.removeEventListener("pointerup", this.onPointerUp), t.document.removeEventListener("pointermove", this.onPointerMove), t.document.removeEventListener("click", this.onClicker), e.unregisterAll(ot.moduleName), this.configApplied = !1, e.log("Peripherals Unmounted"), !0;
3609
3611
  }
3610
3612
  };
3611
- yt.moduleName = "peripherals";
3612
- let xe = yt;
3613
+ ot.moduleName = "peripherals";
3614
+ let xe = ot;
3613
3615
  const At = class At extends Et {
3614
3616
  constructor() {
3615
3617
  super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
@@ -3660,7 +3662,7 @@ const At = class At extends Et {
3660
3662
  ), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
3661
3663
  value: {
3662
3664
  name: "readium-ts-toolkit",
3663
- version: "2.5.4",
3665
+ version: "2.5.6",
3664
3666
  hasFeature: (n, s = "") => {
3665
3667
  switch (n) {
3666
3668
  case "dom-manipulation":
@@ -3854,7 +3856,7 @@ let ps = (nt = class extends Et {
3854
3856
  return this.beforePrintHandler && (t.removeEventListener("beforeprint", this.beforePrintHandler), this.beforePrintHandler = null), this.styleElement?.parentNode && (this.styleElement.parentNode.removeChild(this.styleElement), this.styleElement = null), this.comms?.unregisterAll(nt.moduleName), this.configApplied = !1, !0;
3855
3857
  }
3856
3858
  }, nt.moduleName = "print_protection", nt);
3857
- const ki = "readium-cjk-vertical-snapper-style", B = class B extends vt {
3859
+ const ki = "readium-cjk-vertical-snapper-style", B = class B extends St {
3858
3860
  constructor() {
3859
3861
  super(...arguments), this.patternAnalyzer = null, this.lastScrollTime = 0, this.isScrollProtectionEnabled = !1, this.initialScrollHandled = !1, this.isScrolling = !1, this.lastScrollLeft = 0, this.isResizing = !1, this.resizeDebounce = null, this.verticalLR = !1, this.handleScroll = (t) => {
3860
3862
  if (this.comms.ready && !this.isResizing) {
@@ -4000,7 +4002,7 @@ const fs = [
4000
4002
  "decorator",
4001
4003
  "peripherals",
4002
4004
  "print_protection"
4003
- ], ms = [
4005
+ ], gs = [
4004
4006
  "reflowable_setup",
4005
4007
  "decorator",
4006
4008
  "peripherals",
@@ -4008,7 +4010,7 @@ const fs = [
4008
4010
  "scroll_snapper",
4009
4011
  "cjk_vertical_snapper",
4010
4012
  "print_protection"
4011
- ], gs = [
4013
+ ], ms = [
4012
4014
  "webpub_setup",
4013
4015
  "webpub_snapper",
4014
4016
  "decorator",
@@ -4135,7 +4137,7 @@ const ys = {
4135
4137
  { keyCode: 80, ctrl: !0, alt: !0 }
4136
4138
  // Ctrl+Alt+P
4137
4139
  ]
4138
- }, Ss = {
4140
+ }, vs = {
4139
4141
  type: "save",
4140
4142
  keyCombos: [
4141
4143
  { keyCode: 83, meta: !0 },
@@ -4153,7 +4155,7 @@ class cn {
4153
4155
  const i = [], n = e.filter(
4154
4156
  (s) => !["developer_tools", "select_all", "print", "save"].includes(s.type)
4155
4157
  );
4156
- t.disableSelectAll && i.push(bs), t.disableSave && i.push(Ss), t.monitorDevTools && i.push(ys), t.protectPrinting?.disable && i.push(ws);
4158
+ t.disableSelectAll && i.push(bs), t.disableSave && i.push(vs), t.monitorDevTools && i.push(ys), t.protectPrinting?.disable && i.push(ws);
4157
4159
  for (const s of n) {
4158
4160
  const o = s.keyCombos.filter(
4159
4161
  (a) => !i.some(
@@ -4184,7 +4186,7 @@ class dn extends cn {
4184
4186
  this.readingProgression === M.ltr ? this.goForward(t, e) : this.readingProgression === M.rtl && this.goBackward(t, e);
4185
4187
  }
4186
4188
  }
4187
- class vs extends cn {
4189
+ class Ss extends cn {
4188
4190
  }
4189
4191
  class Ps {
4190
4192
  constructor(t, e, i, n) {
@@ -4303,7 +4305,7 @@ class Nt {
4303
4305
  key: t
4304
4306
  }), this.wnd.postMessage(
4305
4307
  {
4306
- _readium: ft,
4308
+ _readium: gt,
4307
4309
  _channel: this.channelId,
4308
4310
  id: o,
4309
4311
  data: e,
@@ -4640,8 +4642,8 @@ class Os {
4640
4642
  } catch (d) {
4641
4643
  h(d);
4642
4644
  }
4643
- const g = this.pool.get(o);
4644
- g?.source !== this._currentFrame?.source && (await this._currentFrame?.hide(), g && await g.load(i), g && await g.show(e.locations.progression), this._currentFrame = g), l();
4645
+ const m = this.pool.get(o);
4646
+ m?.source !== this._currentFrame?.source && (await this._currentFrame?.hide(), m && await m.load(i), m && await m.show(e.locations.progression), this._currentFrame = m), l();
4645
4647
  });
4646
4648
  this.inprogress.set(o, a), await a, this.inprogress.delete(o);
4647
4649
  }
@@ -4686,9 +4688,9 @@ class Os {
4686
4688
  }), t;
4687
4689
  }
4688
4690
  }
4689
- var me, Ri;
4691
+ var ge, Ri;
4690
4692
  function Rs() {
4691
- if (Ri) return me;
4693
+ if (Ri) return ge;
4692
4694
  Ri = 1;
4693
4695
  function r(n) {
4694
4696
  if (typeof n != "string")
@@ -4761,14 +4763,14 @@ function Rs() {
4761
4763
  ;
4762
4764
  for (var l = s.length, h = l - a, c = 1; c < o.length && o.charCodeAt(c) === 47; ++c)
4763
4765
  ;
4764
- for (var u = o.length, p = u - c, g = h < p ? h : p, d = -1, f = 0; f <= g; ++f) {
4765
- if (f === g) {
4766
- if (p > g) {
4766
+ for (var u = o.length, p = u - c, m = h < p ? h : p, d = -1, f = 0; f <= m; ++f) {
4767
+ if (f === m) {
4768
+ if (p > m) {
4767
4769
  if (o.charCodeAt(c + f) === 47)
4768
4770
  return o.slice(c + f + 1);
4769
4771
  if (f === 0)
4770
4772
  return o.slice(c + f);
4771
- } else h > g && (s.charCodeAt(a + f) === 47 ? d = f : f === 0 && (d = 0));
4773
+ } else h > m && (s.charCodeAt(a + f) === 47 ? d = f : f === 0 && (d = 0));
4772
4774
  break;
4773
4775
  }
4774
4776
  var w = s.charCodeAt(a + f), P = o.charCodeAt(c + f);
@@ -4804,14 +4806,14 @@ function Rs() {
4804
4806
  if (o.length === s.length && o === s) return "";
4805
4807
  var u = o.length - 1, p = -1;
4806
4808
  for (c = s.length - 1; c >= 0; --c) {
4807
- var g = s.charCodeAt(c);
4808
- if (g === 47) {
4809
+ var m = s.charCodeAt(c);
4810
+ if (m === 47) {
4809
4811
  if (!h) {
4810
4812
  a = c + 1;
4811
4813
  break;
4812
4814
  }
4813
4815
  } else
4814
- p === -1 && (h = !1, p = c + 1), u >= 0 && (g === o.charCodeAt(u) ? --u === -1 && (l = c) : (u = -1, l = p));
4816
+ p === -1 && (h = !1, p = c + 1), u >= 0 && (m === o.charCodeAt(u) ? --u === -1 && (l = c) : (u = -1, l = p));
4815
4817
  }
4816
4818
  return a === l ? l = p : l === -1 && (l = s.length), s.slice(a, l);
4817
4819
  } else {
@@ -4853,15 +4855,15 @@ function Rs() {
4853
4855
  if (s.length === 0) return o;
4854
4856
  var a = s.charCodeAt(0), l = a === 47, h;
4855
4857
  l ? (o.root = "/", h = 1) : h = 0;
4856
- for (var c = -1, u = 0, p = -1, g = !0, d = s.length - 1, f = 0; d >= h; --d) {
4858
+ for (var c = -1, u = 0, p = -1, m = !0, d = s.length - 1, f = 0; d >= h; --d) {
4857
4859
  if (a = s.charCodeAt(d), a === 47) {
4858
- if (!g) {
4860
+ if (!m) {
4859
4861
  u = d + 1;
4860
4862
  break;
4861
4863
  }
4862
4864
  continue;
4863
4865
  }
4864
- p === -1 && (g = !1, p = d + 1), a === 46 ? c === -1 ? c = d : f !== 1 && (f = 1) : c !== -1 && (f = -1);
4866
+ p === -1 && (m = !1, p = d + 1), a === 46 ? c === -1 ? c = d : f !== 1 && (f = 1) : c !== -1 && (f = -1);
4865
4867
  }
4866
4868
  return c === -1 || p === -1 || // We saw a non-dot character immediately before the dot
4867
4869
  f === 0 || // The (right-most) trimmed path component is exactly '..'
@@ -4872,7 +4874,7 @@ function Rs() {
4872
4874
  win32: null,
4873
4875
  posix: null
4874
4876
  };
4875
- return i.posix = i, me = i, me;
4877
+ return i.posix = i, ge = i, ge;
4876
4878
  }
4877
4879
  var Xt = Rs();
4878
4880
  const As = { description: "Attempts to filter out paragraphs that are implicitly headings or part of headers", scope: "RS", value: "readium-experimentalHeaderFiltering-on" }, Ts = { description: "Attempts to filter out elements that are sized using viewport units and should not be scaled directly e.g. tables, images, iframes, etc.", scope: "RS", value: "readium-experimentalZoom-on" }, Ns = {
@@ -4912,9 +4914,9 @@ const As = { description: "Attempts to filter out paragraphs that are implicitly
4912
4914
  "zh-Hant": { baseFontFamily: "'方體', 'PingFang TC', '黑體', 'Heiti TC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK TC', sans-serif", lineHeightCompensation: 1.167 },
4913
4915
  "zh-TW": { baseFontFamily: "'方體', 'PingFang TC', '黑體', 'Heiti TC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK TC', sans-serif", lineHeightCompensation: 1.167 },
4914
4916
  "zh-HK": { baseFontFamily: "'方體', 'PingFang HK', '方體', 'PingFang TC', '黑體', 'Heiti TC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK TC', sans-serif", lineHeightCompensation: 1.167 }
4915
- }, Ge = Ns, fo = Is, mo = lr;
4917
+ }, Ge = Ns, fo = Is, go = lr;
4916
4918
  var tt = /* @__PURE__ */ ((r) => (r.start = "start", r.left = "left", r.right = "right", r.justify = "justify", r))(tt || {});
4917
- const dt = {
4919
+ const ut = {
4918
4920
  range: [0, 100],
4919
4921
  step: 1
4920
4922
  }, Yt = {
@@ -4932,7 +4934,7 @@ const dt = {
4932
4934
  }, Jt = {
4933
4935
  range: [1, 2.5],
4934
4936
  step: 0.1
4935
- }, ut = {
4937
+ }, pt = {
4936
4938
  range: [20, 100],
4937
4939
  step: 1
4938
4940
  }, Zt = {
@@ -4984,7 +4986,7 @@ class le {
4984
4986
  return `${t}rem`;
4985
4987
  }
4986
4988
  }
4987
- class mn extends le {
4989
+ class gn extends le {
4988
4990
  constructor(t) {
4989
4991
  super(), this.a11yNormalize = t.a11yNormalize ?? null, this.bodyHyphens = t.bodyHyphens ?? null, this.fontFamily = t.fontFamily ?? null, this.fontWeight = t.fontWeight ?? null, this.iOSPatch = t.iOSPatch ?? null, this.iPadOSPatch = t.iPadOSPatch ?? null, this.letterSpacing = t.letterSpacing ?? null, this.ligatures = t.ligatures ?? null, this.lineHeight = t.lineHeight ?? null, this.noRuby = t.noRuby ?? null, this.paraIndent = t.paraIndent ?? null, this.paraSpacing = t.paraSpacing ?? null, this.textAlign = t.textAlign ?? null, this.wordSpacing = t.wordSpacing ?? null, this.zoom = t.zoom ?? null;
4990
4992
  }
@@ -5027,7 +5029,7 @@ class cr {
5027
5029
  wordSpacing: t.wordSpacing,
5028
5030
  zoom: t.zoom
5029
5031
  };
5030
- this.userProperties = new mn(e);
5032
+ this.userProperties = new gn(e);
5031
5033
  }
5032
5034
  }
5033
5035
  function dr(r, t) {
@@ -5049,7 +5051,7 @@ function he(r, t) {
5049
5051
  function wt(r) {
5050
5052
  return typeof r == "boolean" || typeof r == "number" && r >= 0 ? r : r === null ? null : void 0;
5051
5053
  }
5052
- function S(r) {
5054
+ function v(r) {
5053
5055
  if (r !== void 0)
5054
5056
  return r === null ? null : r < 0 ? void 0 : r;
5055
5057
  }
@@ -5061,16 +5063,16 @@ function F(r, t) {
5061
5063
  const e = Math.min(...t), i = Math.max(...t);
5062
5064
  return r >= e && r <= i ? r : void 0;
5063
5065
  }
5064
- function ge(r, t) {
5066
+ function me(r, t) {
5065
5067
  return r === void 0 ? t : r;
5066
5068
  }
5067
- function gn(r) {
5069
+ function mn(r) {
5068
5070
  if (r !== void 0)
5069
5071
  return r === null ? null : r.filter((t) => t in Ge);
5070
5072
  }
5071
5073
  class Mt {
5072
5074
  constructor(t = {}) {
5073
- this.fontFamily = W(t.fontFamily), this.fontWeight = F(t.fontWeight, st.range), this.hyphens = E(t.hyphens), this.iOSPatch = E(t.iOSPatch), this.iPadOSPatch = E(t.iPadOSPatch), this.letterSpacing = S(t.letterSpacing), this.ligatures = E(t.ligatures), this.lineHeight = S(t.lineHeight), this.noRuby = E(t.noRuby), this.paragraphIndent = S(t.paragraphIndent), this.paragraphSpacing = S(t.paragraphSpacing), this.textAlign = he(t.textAlign, tt), this.textNormalization = E(t.textNormalization), this.wordSpacing = S(t.wordSpacing), this.zoom = F(t.zoom, ee.range);
5075
+ this.fontFamily = W(t.fontFamily), this.fontWeight = F(t.fontWeight, st.range), this.hyphens = E(t.hyphens), this.iOSPatch = E(t.iOSPatch), this.iPadOSPatch = E(t.iPadOSPatch), this.letterSpacing = v(t.letterSpacing), this.ligatures = E(t.ligatures), this.lineHeight = v(t.lineHeight), this.noRuby = E(t.noRuby), this.paragraphIndent = v(t.paragraphIndent), this.paragraphSpacing = v(t.paragraphSpacing), this.textAlign = he(t.textAlign, tt), this.textNormalization = E(t.textNormalization), this.wordSpacing = v(t.wordSpacing), this.zoom = F(t.zoom, ee.range);
5074
5076
  }
5075
5077
  static serialize(t) {
5076
5078
  const { ...e } = t;
@@ -5093,7 +5095,7 @@ class Mt {
5093
5095
  }
5094
5096
  class pr {
5095
5097
  constructor(t) {
5096
- this.fontFamily = W(t.fontFamily) || null, this.fontWeight = F(t.fontWeight, st.range) || null, this.hyphens = E(t.hyphens) ?? null, this.iOSPatch = t.iOSPatch === !1 ? !1 : (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : T.OS.iPadOS && T.iOSRequest === "desktop", this.letterSpacing = S(t.letterSpacing) || null, this.ligatures = E(t.ligatures) ?? null, this.lineHeight = S(t.lineHeight) || null, this.noRuby = E(t.noRuby) ?? !1, this.paragraphIndent = S(t.paragraphIndent) ?? null, this.paragraphSpacing = S(t.paragraphSpacing) ?? null, this.textAlign = he(t.textAlign, tt) || null, this.textNormalization = E(t.textNormalization) ?? !1, this.wordSpacing = S(t.wordSpacing) || null, this.zoom = F(t.zoom, ee.range) || 1, this.experiments = gn(t.experiments) ?? null;
5098
+ this.fontFamily = W(t.fontFamily) || null, this.fontWeight = F(t.fontWeight, st.range) || null, this.hyphens = E(t.hyphens) ?? null, this.iOSPatch = t.iOSPatch === !1 ? !1 : (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : T.OS.iPadOS && T.iOSRequest === "desktop", this.letterSpacing = v(t.letterSpacing) || null, this.ligatures = E(t.ligatures) ?? null, this.lineHeight = v(t.lineHeight) || null, this.noRuby = E(t.noRuby) ?? !1, this.paragraphIndent = v(t.paragraphIndent) ?? null, this.paragraphSpacing = v(t.paragraphSpacing) ?? null, this.textAlign = he(t.textAlign, tt) || null, this.textNormalization = E(t.textNormalization) ?? !1, this.wordSpacing = v(t.wordSpacing) || null, this.zoom = F(t.zoom, ee.range) || 1, this.experiments = mn(t.experiments) ?? null;
5097
5099
  }
5098
5100
  }
5099
5101
  class Ai {
@@ -5433,7 +5435,7 @@ const bn = (r) => {
5433
5435
  const n = t.type || bn(t);
5434
5436
  return n && (i.type = n), wn(i, t), i.href = e, i;
5435
5437
  };
5436
- class Sn {
5438
+ class vn {
5437
5439
  constructor(t) {
5438
5440
  this.blobStore = /* @__PURE__ */ new Map(), this.createdBlobUrls = /* @__PURE__ */ new Set(), this.allowedDomains = [], this.injectableIdCounter = 0, this.allowedDomains = (t.allowedDomains || []).map((e) => {
5439
5441
  try {
@@ -5578,7 +5580,7 @@ class Sn {
5578
5580
  }
5579
5581
  }
5580
5582
  }
5581
- const St = (r) => r.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/\n/g, "").replace(/\s+/g, " "), _t = (r) => r.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " "), mr = `/*!
5583
+ const vt = (r) => r.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/\n/g, "").replace(/\s+/g, " "), _t = (r) => r.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " "), gr = `/*!
5582
5584
  * Readium CSS v.2.0.5
5583
5585
  * Copyright (c) 2017–2026. Readium Foundation. All rights reserved.
5584
5586
  * Use of this source code is governed by a BSD-style license which is detailed in the
@@ -5851,7 +5853,7 @@ const St = (r) => r.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").repl
5851
5853
 
5852
5854
  :root[style*="readium-iPadOSPatch-on"] p:not(:has(b, cite, em, i, q, s, small, span, strong)):first-line{
5853
5855
  -webkit-text-zoom:normal;
5854
- }`, vn = '!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports._readium_cssSelectorGenerator=e():t._readium_cssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return"object"==typeof t&&null!==t&&t.nodeType===Node.ELEMENT_NODE}t.r(e),t.d(e,{_readium_cssSelectorGenerator:()=>Z,default:()=>tt,getCssSelector:()=>X});const o={NONE:"",DESCENDANT:" ",CHILD:" > "},r={id:"id",class:"class",tag:"tag",attribute:"attribute",nthchild:"nthchild",nthoftype:"nthoftype"},i="_readium_cssSelectorGenerator";function c(t="unknown problem",...e){console.warn(`${i}: ${t}`,...e)}const s={selectors:[r.id,r.class,r.tag,r.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY,useScope:!1};function u(t){return t instanceof RegExp}function l(t){return["string","function"].includes(typeof t)||u(t)}function a(t){return Array.isArray(t)?t.filter(l):[]}function f(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function d(t,e){if(f(t))return t.contains(e)||c("element root mismatch","Provided root does not contain the element. This will most likely result in producing a fallback selector using element\'s real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended."),t;const n=e.getRootNode({composed:!1});return f(n)?(n!==document&&c("shadow root inferred","You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."),n):S(e)}function m(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function p(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function g(t){const e=t.map((t=>{if(u(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(c("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return c("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function h(t,e,n){const o=Array.from(d(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function y(t,e){e=null!=e?e:S(t);const o=[];let r=t;for(;n(r)&&r!==e;)o.push(r),r=r.parentElement;return o}function b(t,e){return p(t.map((t=>y(t,e))))}function S(t){return t.ownerDocument.querySelector(":root")}const N=", ",v=new RegExp(["^$","\\\\s"].join("|")),E=new RegExp(["^$"].join("|")),x=[r.nthoftype,r.tag,r.id,r.class,r.attribute,r.nthchild],w=g(["class","id","ng-*"]);function I({name:t}){return`[${t}]`}function T({name:t,value:e}){return`[${t}=\'${e}\']`}function O({nodeName:t,nodeValue:e}){return{name:F(t),value:F(null!=e?e:void 0)}}function C(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t,nodeValue:e},n){const o=n.tagName.toLowerCase();return!(["input","option"].includes(o)&&"value"===t||"src"===t&&(null==e?void 0:e.startsWith("data:"))||w(t))}(e,t))).map(O);return[...e.map(I),...e.map(T)]}function j(t){var e;return(null!==(e=t.getAttribute("class"))&&void 0!==e?e:"").trim().split(/\\s+/).filter((t=>!E.test(t))).map((t=>`.${F(t)}`))}function A(t){var e;const n=null!==(e=t.getAttribute("id"))&&void 0!==e?e:"",o=`#${F(n)}`,r=t.getRootNode({composed:!1});return!v.test(n)&&h([t],o,r)?[o]:[]}function R(t){var e;const n=null===(e=t.parentElement)||void 0===e?void 0:e.children;if(n)for(let e=0;e<n.length;e++)if(n[e]===t)return[`:nth-child(${String(e+1)})`];return[]}function $(t){return[F(t.tagName.toLowerCase())]}function D(t){const e=[...new Set((n=t.map($),[].concat(...n)))];var n;return 0===e.length||e.length>1?[]:[e[0]]}function k(t){const e=D([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${String(r+1)})`]}return[]}function*P(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){let n=0,o=L(1);for(;o.length<=t.length&&n<e;){n+=1;const e=o.map((e=>t[e]));yield e,o=_(o,t.length-1)}}function _(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return L(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?L(n+1):o}function L(t=1){return Array.from(Array(t).keys())}const M=":".charCodeAt(0).toString(16).toUpperCase(),V=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function F(t=""){return CSS?CSS.escape(t):function(t=""){return t.split("").map((t=>":"===t?`\\\\${M} `:V.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const Y={tag:D,id:function(t){return 0===t.length||t.length>1?[]:A(t[0])},class:function(t){return p(t.map(j))},attribute:function(t){return p(t.map(C))},nthchild:function(t){return p(t.map(R))},nthoftype:function(t){return p(t.map(k))}},G={tag:$,id:A,class:j,attribute:C,nthchild:R,nthoftype:k};function W(t){return t.includes(r.tag)||t.includes(r.nthoftype)?[...t]:[...t,r.tag]}function*q(t,e){const n={};for(const o of t){const t=e[o];t&&t.length>0&&(n[o]=t)}for(const t of function*(t={}){const e=Object.entries(t);if(0===e.length)return;const n=[{index:e.length-1,partial:{}}];for(;n.length>0;){const t=n.pop();if(!t)break;const{index:o,partial:r}=t;if(o<0){yield r;continue}const[i,c]=e[o];for(let t=c.length-1;t>=0;t--)n.push({index:o-1,partial:Object.assign(Object.assign({},r),{[i]:c[t]})})}}(n))yield B(t)}function B(t={}){const e=[...x];return t[r.tag]&&t[r.nthoftype]&&e.splice(e.indexOf(r.tag),1),e.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function H(t,e){return[...t.map((t=>e+o.DESCENDANT+t)),...t.map((t=>e+o.CHILD+t))]}function*U(t,e,n="",o){const r=function*(t,e){const n=new Set,o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=g(n),s=g(o);return function(t){const{selectors:e,includeTag:n}=t,o=[...e];return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){return(0,Y[e])(t)}(t,n),u=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,s),l=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(u,s);return e[n]=r?Array.from(P(l,{maxResults:i})):l.map((t=>[t])),e}),{})}(t,e);for(const t of function*(t,e){for(const n of function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?function(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){return Array.from(P(t,{maxResults:e}))}(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(W):i}(e))yield*q(n,t)}(o,e))n.has(t)||(n.add(t),yield t)}(t,o);for(const o of function*(t,e){if(""===e)yield*t;else for(const n of t)yield*H([n],e)}(r,n))h(t,o,e)&&(yield o)}function*z(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...b(t,e).map((t=>[t]))];for(const t of r)for(const r of U(t,e,n,o))yield{foundElements:t,selector:r}}function J(t){return{value:t,include:!1}}function K({selectors:t,operator:e}){let n=[...x];t[r.tag]&&t[r.nthoftype]&&(n=n.filter((t=>t!==r.tag)));let o="";return n.forEach((e=>{var n;(null!==(n=t[e])&&void 0!==n?n:[]).forEach((({value:t,include:e})=>{e&&(o+=t)}))})),e+o}function Q(t,e){return t.map((t=>function(t,e){return[e?":scope":":root",...y(t,e).reverse().map((t=>{var e;const n=function(t,e,n=o.NONE){const r={};return e.forEach((e=>{Reflect.set(r,e,function(t,e){return G[e](t)}(t,e).map(J))})),{element:t,operator:n,selectors:r}}(t,[r.nthchild],o.CHILD);return(null!==(e=n.selectors.nthchild)&&void 0!==e?e:[]).forEach((t=>{t.include=!0})),n})).map(K)].join("")}(t,e))).join(N)}function X(t,e={}){return Z(t,Object.assign(Object.assign({},e),{maxResults:1})).next().value}function*Z(t,e={}){var o;const i=function(t){(t instanceof NodeList||t instanceof HTMLCollection)&&(t=Array.from(t));const e=(Array.isArray(t)?t:[t]).filter(n);return[...new Set(e)]}(t),c=function(t,e={}){const n=Object.assign(Object.assign({},s),e);return{selectors:(o=n.selectors,Array.isArray(o)?o.filter((t=>{return e=r,n=t,Object.values(e).includes(n);var e,n})):[]),whitelist:a(n.whitelist),blacklist:a(n.blacklist),root:d(n.root,t),combineWithinSelector:!!n.combineWithinSelector,combineBetweenSelectors:!!n.combineBetweenSelectors,includeTag:!!n.includeTag,maxCombinations:m(n.maxCombinations),maxCandidates:m(n.maxCandidates),useScope:!!n.useScope,maxResults:m(n.maxResults)};var o}(i[0],e),u=null!==(o=c.root)&&void 0!==o?o:S(i[0]);let l=0;for(const t of function*({elements:t,root:e,rootSelector:n="",options:o}){let r=e,i=n,c=!0;for(;c;){let n=!1;for(const c of z(t,r,i,o)){const{foundElements:o,selector:s}=c;if(n=!0,!h(t,s,e)){r=o[0],i=s;break}yield s}n||(c=!1)}}({elements:i,options:c,root:u,rootSelector:""}))if(yield t,l++,l>=c.maxResults)return;i.length>1&&(yield i.map((t=>X(t,c))).join(N),l++,l>=c.maxResults)||(yield Q(i,c.useScope?u:void 0))}const tt=X;return e})()));', gr = `// WebPub-specific setup - no execution blocking needed
5856
+ }`, Sn = '!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports._readium_cssSelectorGenerator=e():t._readium_cssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return"object"==typeof t&&null!==t&&t.nodeType===Node.ELEMENT_NODE}t.r(e),t.d(e,{_readium_cssSelectorGenerator:()=>Z,default:()=>tt,getCssSelector:()=>X});const o={NONE:"",DESCENDANT:" ",CHILD:" > "},r={id:"id",class:"class",tag:"tag",attribute:"attribute",nthchild:"nthchild",nthoftype:"nthoftype"},i="_readium_cssSelectorGenerator";function c(t="unknown problem",...e){console.warn(`${i}: ${t}`,...e)}const s={selectors:[r.id,r.class,r.tag,r.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY,useScope:!1};function u(t){return t instanceof RegExp}function l(t){return["string","function"].includes(typeof t)||u(t)}function a(t){return Array.isArray(t)?t.filter(l):[]}function f(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function d(t,e){if(f(t))return t.contains(e)||c("element root mismatch","Provided root does not contain the element. This will most likely result in producing a fallback selector using element\'s real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended."),t;const n=e.getRootNode({composed:!1});return f(n)?(n!==document&&c("shadow root inferred","You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."),n):S(e)}function m(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function p(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function g(t){const e=t.map((t=>{if(u(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(c("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return c("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function h(t,e,n){const o=Array.from(d(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function y(t,e){e=null!=e?e:S(t);const o=[];let r=t;for(;n(r)&&r!==e;)o.push(r),r=r.parentElement;return o}function b(t,e){return p(t.map((t=>y(t,e))))}function S(t){return t.ownerDocument.querySelector(":root")}const N=", ",v=new RegExp(["^$","\\\\s"].join("|")),E=new RegExp(["^$"].join("|")),x=[r.nthoftype,r.tag,r.id,r.class,r.attribute,r.nthchild],w=g(["class","id","ng-*"]);function I({name:t}){return`[${t}]`}function T({name:t,value:e}){return`[${t}=\'${e}\']`}function O({nodeName:t,nodeValue:e}){return{name:F(t),value:F(null!=e?e:void 0)}}function C(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t,nodeValue:e},n){const o=n.tagName.toLowerCase();return!(["input","option"].includes(o)&&"value"===t||"src"===t&&(null==e?void 0:e.startsWith("data:"))||w(t))}(e,t))).map(O);return[...e.map(I),...e.map(T)]}function j(t){var e;return(null!==(e=t.getAttribute("class"))&&void 0!==e?e:"").trim().split(/\\s+/).filter((t=>!E.test(t))).map((t=>`.${F(t)}`))}function A(t){var e;const n=null!==(e=t.getAttribute("id"))&&void 0!==e?e:"",o=`#${F(n)}`,r=t.getRootNode({composed:!1});return!v.test(n)&&h([t],o,r)?[o]:[]}function R(t){var e;const n=null===(e=t.parentElement)||void 0===e?void 0:e.children;if(n)for(let e=0;e<n.length;e++)if(n[e]===t)return[`:nth-child(${String(e+1)})`];return[]}function $(t){return[F(t.tagName.toLowerCase())]}function D(t){const e=[...new Set((n=t.map($),[].concat(...n)))];var n;return 0===e.length||e.length>1?[]:[e[0]]}function k(t){const e=D([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${String(r+1)})`]}return[]}function*P(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){let n=0,o=L(1);for(;o.length<=t.length&&n<e;){n+=1;const e=o.map((e=>t[e]));yield e,o=_(o,t.length-1)}}function _(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return L(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?L(n+1):o}function L(t=1){return Array.from(Array(t).keys())}const M=":".charCodeAt(0).toString(16).toUpperCase(),V=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function F(t=""){return CSS?CSS.escape(t):function(t=""){return t.split("").map((t=>":"===t?`\\\\${M} `:V.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const Y={tag:D,id:function(t){return 0===t.length||t.length>1?[]:A(t[0])},class:function(t){return p(t.map(j))},attribute:function(t){return p(t.map(C))},nthchild:function(t){return p(t.map(R))},nthoftype:function(t){return p(t.map(k))}},G={tag:$,id:A,class:j,attribute:C,nthchild:R,nthoftype:k};function W(t){return t.includes(r.tag)||t.includes(r.nthoftype)?[...t]:[...t,r.tag]}function*q(t,e){const n={};for(const o of t){const t=e[o];t&&t.length>0&&(n[o]=t)}for(const t of function*(t={}){const e=Object.entries(t);if(0===e.length)return;const n=[{index:e.length-1,partial:{}}];for(;n.length>0;){const t=n.pop();if(!t)break;const{index:o,partial:r}=t;if(o<0){yield r;continue}const[i,c]=e[o];for(let t=c.length-1;t>=0;t--)n.push({index:o-1,partial:Object.assign(Object.assign({},r),{[i]:c[t]})})}}(n))yield B(t)}function B(t={}){const e=[...x];return t[r.tag]&&t[r.nthoftype]&&e.splice(e.indexOf(r.tag),1),e.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function H(t,e){return[...t.map((t=>e+o.DESCENDANT+t)),...t.map((t=>e+o.CHILD+t))]}function*U(t,e,n="",o){const r=function*(t,e){const n=new Set,o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=g(n),s=g(o);return function(t){const{selectors:e,includeTag:n}=t,o=[...e];return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){return(0,Y[e])(t)}(t,n),u=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,s),l=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(u,s);return e[n]=r?Array.from(P(l,{maxResults:i})):l.map((t=>[t])),e}),{})}(t,e);for(const t of function*(t,e){for(const n of function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?function(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){return Array.from(P(t,{maxResults:e}))}(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(W):i}(e))yield*q(n,t)}(o,e))n.has(t)||(n.add(t),yield t)}(t,o);for(const o of function*(t,e){if(""===e)yield*t;else for(const n of t)yield*H([n],e)}(r,n))h(t,o,e)&&(yield o)}function*z(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...b(t,e).map((t=>[t]))];for(const t of r)for(const r of U(t,e,n,o))yield{foundElements:t,selector:r}}function J(t){return{value:t,include:!1}}function K({selectors:t,operator:e}){let n=[...x];t[r.tag]&&t[r.nthoftype]&&(n=n.filter((t=>t!==r.tag)));let o="";return n.forEach((e=>{var n;(null!==(n=t[e])&&void 0!==n?n:[]).forEach((({value:t,include:e})=>{e&&(o+=t)}))})),e+o}function Q(t,e){return t.map((t=>function(t,e){return[e?":scope":":root",...y(t,e).reverse().map((t=>{var e;const n=function(t,e,n=o.NONE){const r={};return e.forEach((e=>{Reflect.set(r,e,function(t,e){return G[e](t)}(t,e).map(J))})),{element:t,operator:n,selectors:r}}(t,[r.nthchild],o.CHILD);return(null!==(e=n.selectors.nthchild)&&void 0!==e?e:[]).forEach((t=>{t.include=!0})),n})).map(K)].join("")}(t,e))).join(N)}function X(t,e={}){return Z(t,Object.assign(Object.assign({},e),{maxResults:1})).next().value}function*Z(t,e={}){var o;const i=function(t){(t instanceof NodeList||t instanceof HTMLCollection)&&(t=Array.from(t));const e=(Array.isArray(t)?t:[t]).filter(n);return[...new Set(e)]}(t),c=function(t,e={}){const n=Object.assign(Object.assign({},s),e);return{selectors:(o=n.selectors,Array.isArray(o)?o.filter((t=>{return e=r,n=t,Object.values(e).includes(n);var e,n})):[]),whitelist:a(n.whitelist),blacklist:a(n.blacklist),root:d(n.root,t),combineWithinSelector:!!n.combineWithinSelector,combineBetweenSelectors:!!n.combineBetweenSelectors,includeTag:!!n.includeTag,maxCombinations:m(n.maxCombinations),maxCandidates:m(n.maxCandidates),useScope:!!n.useScope,maxResults:m(n.maxResults)};var o}(i[0],e),u=null!==(o=c.root)&&void 0!==o?o:S(i[0]);let l=0;for(const t of function*({elements:t,root:e,rootSelector:n="",options:o}){let r=e,i=n,c=!0;for(;c;){let n=!1;for(const c of z(t,r,i,o)){const{foundElements:o,selector:s}=c;if(n=!0,!h(t,s,e)){r=o[0],i=s;break}yield s}n||(c=!1)}}({elements:i,options:c,root:u,rootSelector:""}))if(yield t,l++,l>=c.maxResults)return;i.length>1&&(yield i.map((t=>X(t,c))).join(N),l++,l>=c.maxResults)||(yield Q(i,c.useScope?u:void 0))}const tt=X;return e})()));', mr = `// WebPub-specific setup - no execution blocking needed
5855
5857
  window._readium_blockedEvents = [];
5856
5858
  window._readium_blockEvents = false; // WebPub doesn't need event blocking
5857
5859
  window._readium_eventBlocker = null;
@@ -5876,14 +5878,14 @@ function yr(r) {
5876
5878
  id: "css-selector-generator",
5877
5879
  as: "script",
5878
5880
  target: "head",
5879
- blob: new Blob([St(vn)], { type: "text/javascript" })
5881
+ blob: new Blob([vt(Sn)], { type: "text/javascript" })
5880
5882
  },
5881
5883
  // WebPub Execution - always injected (sets up event blocking to false)
5882
5884
  {
5883
5885
  id: "webpub-execution",
5884
5886
  as: "script",
5885
5887
  target: "head",
5886
- blob: new Blob([St(gr)], { type: "text/javascript" })
5888
+ blob: new Blob([vt(mr)], { type: "text/javascript" })
5887
5889
  }
5888
5890
  ], n = [
5889
5891
  // Onload Proxy - conditional (has executable scripts)
@@ -5891,7 +5893,7 @@ function yr(r) {
5891
5893
  id: "onload-proxy",
5892
5894
  as: "script",
5893
5895
  target: "head",
5894
- blob: new Blob([St(Pn)], { type: "text/javascript" }),
5896
+ blob: new Blob([vt(Pn)], { type: "text/javascript" }),
5895
5897
  condition: (s) => !!(s.querySelector("script") || s.querySelector("body[onload]:not(body[onload=''])"))
5896
5898
  },
5897
5899
  // Readium CSS WebPub - always injected
@@ -5899,7 +5901,7 @@ function yr(r) {
5899
5901
  id: "readium-css-webpub",
5900
5902
  as: "link",
5901
5903
  target: "head",
5902
- blob: new Blob([_t(mr)], { type: "text/css" }),
5904
+ blob: new Blob([_t(gr)], { type: "text/css" }),
5903
5905
  rel: "stylesheet"
5904
5906
  }
5905
5907
  ];
@@ -5944,10 +5946,10 @@ class br {
5944
5946
  }
5945
5947
  }
5946
5948
  let wr = 0;
5947
- function Sr() {
5949
+ function vr() {
5948
5950
  return ++wr;
5949
5951
  }
5950
- const vr = `
5952
+ const Sr = `
5951
5953
  onmessage = function(event) {
5952
5954
  var action = event.data;
5953
5955
  var startTime = performance.now()
@@ -5968,7 +5970,7 @@ onmessage = function(event) {
5968
5970
  }, this.log = (...i) => this.send("log", ...i), this.table = (...i) => this.send("table", ...i), this.clear = (...i) => this.send("clear", ...i);
5969
5971
  }
5970
5972
  async send(t, ...e) {
5971
- const i = Sr();
5973
+ const i = vr();
5972
5974
  return new Promise((n, s) => {
5973
5975
  this.callbacks.set(i, n), this.worker.postMessage({
5974
5976
  id: i,
@@ -5983,7 +5985,7 @@ onmessage = function(event) {
5983
5985
  this.worker.terminate(), URL.revokeObjectURL(this.blobUrl);
5984
5986
  }
5985
5987
  };
5986
- Je.workerScript = vr;
5988
+ Je.workerScript = Sr;
5987
5989
  let se = Je;
5988
5990
  function Xe(r) {
5989
5991
  return typeof window < "u" && console ? console[r] : (...t) => {
@@ -6232,10 +6234,10 @@ class kr {
6232
6234
  this.contextMenuHandler && (document.removeEventListener("contextmenu", this.contextMenuHandler, !0), this.contextMenuHandler = void 0);
6233
6235
  }
6234
6236
  }
6235
- const ot = "readium:navigator:suspiciousActivity";
6237
+ const at = "readium:navigator:suspiciousActivity";
6236
6238
  class Ye {
6237
6239
  dispatchSuspiciousActivity(t, e) {
6238
- const i = new CustomEvent(ot, {
6240
+ const i = new CustomEvent(at, {
6239
6241
  detail: {
6240
6242
  type: t,
6241
6243
  timestamp: Date.now(),
@@ -6281,7 +6283,7 @@ class Ye {
6281
6283
  this.automationDetector?.destroy(), this.devToolsDetector?.destroy(), this.iframeEmbeddingDetector?.destroy(), this.printProtector?.destroy(), this.contextMenuProtector?.destroy();
6282
6284
  }
6283
6285
  }
6284
- const at = "readium:navigator:keyboardPeripheral";
6286
+ const lt = "readium:navigator:keyboardPeripheral";
6285
6287
  class qe {
6286
6288
  constructor(t = {}) {
6287
6289
  this.keyManager = new hn(), this.setupKeyboardPeripherals(t.keyboardPeripherals || []);
@@ -6289,7 +6291,7 @@ class qe {
6289
6291
  setupKeyboardPeripherals(t) {
6290
6292
  if (t.length > 0) {
6291
6293
  const e = (i) => {
6292
- const n = new CustomEvent(at, {
6294
+ const n = new CustomEvent(lt, {
6293
6295
  detail: i
6294
6296
  });
6295
6297
  window.dispatchEvent(n);
@@ -6332,16 +6334,16 @@ const Or = (r) => ({
6332
6334
  });
6333
6335
  class Rr extends dn {
6334
6336
  constructor(t, e, i, n = void 0, s = { preferences: {}, defaults: {} }) {
6335
- super(), this.currentIndex = 0, this._preferencesEditor = null, this._injector = null, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this.webViewport = {
6337
+ super(), this.currentIndex = 0, this._preferencesEditor = null, this._injector = null, this._isNavigating = !1, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this.webViewport = {
6336
6338
  readingOrder: [],
6337
6339
  progressions: /* @__PURE__ */ new Map(),
6338
6340
  positions: null
6339
6341
  }, this.pub = e, this.container = t, this.listeners = Or(i), this._preferences = new Mt(s.preferences), this._defaults = new pr(s.defaults), this._settings = new Ai(this._preferences, this._defaults, this.hasDisplayTransformability), this._css = new cr({
6340
6342
  rsProperties: new hr({ experiments: this._settings.experiments || null }),
6341
- userProperties: new mn({ zoom: this._settings.zoom })
6343
+ userProperties: new gn({ zoom: this._settings.zoom })
6342
6344
  });
6343
6345
  const o = yr(e.readingOrder.items), a = s.injectables || { rules: [], allowedDomains: [] };
6344
- if (this._injector = new Sn({
6346
+ if (this._injector = new vn({
6345
6347
  rules: [...o, ...a.rules],
6346
6348
  allowedDomains: a.allowedDomains
6347
6349
  }), this._contentProtection = s.contentProtection || {}, this._keyboardPeripherals = this.mergeKeyboardPeripherals(
@@ -6350,12 +6352,12 @@ class Rr extends dn {
6350
6352
  ), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new Ye(this._contentProtection), this._suspiciousActivityListener = (l) => {
6351
6353
  const { type: h, ...c } = l.detail;
6352
6354
  h === "context_menu" ? this.listeners.contextMenu(c) : this.listeners.contentProtection(h, c);
6353
- }, window.addEventListener(ot, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new qe({
6355
+ }, window.addEventListener(at, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new qe({
6354
6356
  keyboardPeripherals: this._keyboardPeripherals
6355
6357
  }), this._keyboardPeripheralListener = (l) => {
6356
6358
  const h = l.detail;
6357
6359
  this.listeners.peripheral(h);
6358
- }, window.addEventListener(at, this._keyboardPeripheralListener)), n && typeof n.copyWithLocations == "function") {
6360
+ }, window.addEventListener(lt, this._keyboardPeripheralListener)), n && typeof n.copyWithLocations == "function") {
6359
6361
  this.currentLocation = n;
6360
6362
  const l = this.pub.readingOrder.findIndexWithHref(n.href);
6361
6363
  l >= 0 && (this.currentIndex = l);
@@ -6506,7 +6508,7 @@ class Rr extends dn {
6506
6508
  }
6507
6509
  }
6508
6510
  determineModules() {
6509
- const t = gs.slice(), e = bt(this.pub.metadata);
6511
+ const t = ms.slice(), e = bt(this.pub.metadata);
6510
6512
  return e === "cjk-vertical" || e === "mongolian-vertical" ? t.map((i) => i === "webpub_snapper" ? "cjk_vertical_snapper" : i) : t;
6511
6513
  }
6512
6514
  attachListener() {
@@ -6519,7 +6521,7 @@ class Rr extends dn {
6519
6521
  throw Error("Link for " + this.currentLocation.href + " not found!");
6520
6522
  }
6521
6523
  async destroy() {
6522
- this._suspiciousActivityListener && window.removeEventListener(ot, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(at, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), await this.framePool?.destroy();
6524
+ this._suspiciousActivityListener && window.removeEventListener(at, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(lt, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), await this.framePool?.destroy();
6523
6525
  }
6524
6526
  async changeResource(t) {
6525
6527
  if (t === 0) return !1;
@@ -6539,13 +6541,21 @@ class Rr extends dn {
6539
6541
  })), this.updateViewport(e), this.listeners.positionChanged(this.currentLocation), await this.framePool.update(this.pub, this.currentLocation, this.determineModules());
6540
6542
  }
6541
6543
  goBackward(t, e) {
6542
- this.changeResource(-1).then((i) => {
6543
- e(i);
6544
+ if (this._isNavigating) {
6545
+ e(!1);
6546
+ return;
6547
+ }
6548
+ this._isNavigating = !0, this.changeResource(-1).then((i) => {
6549
+ this._isNavigating = !1, e(i);
6544
6550
  });
6545
6551
  }
6546
6552
  goForward(t, e) {
6547
- this.changeResource(1).then((i) => {
6548
- e(i);
6553
+ if (this._isNavigating) {
6554
+ e(!1);
6555
+ return;
6556
+ }
6557
+ this._isNavigating = !0, this.changeResource(1).then((i) => {
6558
+ this._isNavigating = !1, e(i);
6549
6559
  });
6550
6560
  }
6551
6561
  get currentLocator() {
@@ -6620,7 +6630,13 @@ class Rr extends dn {
6620
6630
  if (!this.pub.readingOrder.findWithHref(n))
6621
6631
  return i(this.listeners.handleLocator(t));
6622
6632
  const o = this.pub.readingOrder.findIndexWithHref(n);
6623
- o >= 0 && (this.currentIndex = o), this.currentLocation = this.createCurrentLocator(), this.apply().then(() => this.loadLocator(t, (a) => i(a))).then(() => {
6633
+ if (o >= 0 && (this.currentIndex = o), this._isNavigating) {
6634
+ i(!1);
6635
+ return;
6636
+ }
6637
+ this._isNavigating = !0, this.currentLocation = this.createCurrentLocator(), this.apply().then(() => this.loadLocator(t, (a) => {
6638
+ this._isNavigating = !1, i(a);
6639
+ })).then(() => {
6624
6640
  this.attachListener();
6625
6641
  });
6626
6642
  }
@@ -6645,7 +6661,7 @@ class Rr extends dn {
6645
6661
  });
6646
6662
  }
6647
6663
  }
6648
- const go = Rr, Ar = (r) => {
6664
+ const mo = Rr, Ar = (r) => {
6649
6665
  const t = r.join(" ");
6650
6666
  return [
6651
6667
  // 'self' is useless because the document is loaded from a blob: URL
@@ -6677,7 +6693,7 @@ class En {
6677
6693
  async build(t = !1) {
6678
6694
  if (this.item.mediaType.isHTML)
6679
6695
  return await this.buildHtmlFrame(t);
6680
- if (this.item.mediaType.isBitmap || this.item.mediaType.equals(m.SVG))
6696
+ if (this.item.mediaType.isBitmap || this.item.mediaType.equals(g.SVG))
6681
6697
  return this.buildImageFrame();
6682
6698
  throw Error("Unsupported frame mediatype " + this.item.mediaType.string);
6683
6699
  }
@@ -6714,10 +6730,10 @@ class En {
6714
6730
  u.setAttribute("fetchpriority", "high");
6715
6731
  }), n.isHTML && this.pub.metadata.languages?.[0]) {
6716
6732
  const u = this.pub.metadata.languages[0];
6717
- if (n === m.XHTML) {
6718
- const p = t.documentElement.lang || t.documentElement.getAttribute("xml:lang"), g = t.body.lang || t.body.getAttribute("xml:lang");
6719
- g && !p ? (t.documentElement.lang = g, t.documentElement.setAttribute("xml:lang", g), t.body.removeAttribute("xml:lang"), t.body.removeAttribute("lang")) : p || (t.documentElement.lang = u, t.documentElement.setAttribute("xml:lang", u));
6720
- } else n === m.HTML && !t.documentElement.lang && (t.documentElement.lang = u);
6733
+ if (n === g.XHTML) {
6734
+ const p = t.documentElement.lang || t.documentElement.getAttribute("xml:lang"), m = t.body.lang || t.body.getAttribute("xml:lang");
6735
+ m && !p ? (t.documentElement.lang = m, t.documentElement.setAttribute("xml:lang", m), t.body.removeAttribute("xml:lang"), t.body.removeAttribute("lang")) : p || (t.documentElement.lang = u, t.documentElement.setAttribute("xml:lang", u));
6736
+ } else n === g.HTML && !t.documentElement.lang && (t.documentElement.lang = u);
6721
6737
  }
6722
6738
  if (bt(this.pub.metadata) === "rtl" && !t.documentElement.dir && !t.body.dir && (t.documentElement.dir = M.rtl), i !== void 0) {
6723
6739
  const u = t.createElement("base");
@@ -6782,7 +6798,7 @@ class Cn {
6782
6798
  }
6783
6799
  async hide() {
6784
6800
  if (!this.destroyed) {
6785
- if (this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.opacity = "0", this.frame.style.pointerEvents = "none", this.hidden = !0, this.frame.parentElement)
6801
+ if (this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.opacity = "0", this.frame.style.pointerEvents = "none", this.hidden = !0, this.frame.blur(), this.frame.parentElement)
6786
6802
  return this.comms === void 0 || !this.comms.ready ? void 0 : new Promise((t, e) => {
6787
6803
  this.comms?.send("unfocus", void 0, (i) => {
6788
6804
  this.comms?.halt(), t();
@@ -6909,8 +6925,8 @@ class Tr {
6909
6925
  } catch (d) {
6910
6926
  h(d);
6911
6927
  }
6912
- const g = this.pool.get(o);
6913
- (g?.source !== this._currentFrame?.source || n) && (await this._currentFrame?.hide(), g && await g.load(i), g && await g.show(e.locations.progression), this._currentFrame = g), l();
6928
+ const m = this.pool.get(o);
6929
+ (m?.source !== this._currentFrame?.source || n) && (await this._currentFrame?.hide(), m && await m.load(i), m && await m.show(e.locations.progression), this._currentFrame = m), l();
6914
6930
  });
6915
6931
  this.inprogress.set(o, a), await a, this.inprogress.delete(o);
6916
6932
  }
@@ -7051,11 +7067,11 @@ class Nr {
7051
7067
  }
7052
7068
  async unfocus() {
7053
7069
  if (this.frame.parentElement)
7054
- return this.comms === void 0 ? void 0 : new Promise((t, e) => {
7070
+ return this.comms === void 0 ? void 0 : (this.frame.blur(), new Promise((t, e) => {
7055
7071
  this.comms?.send("unfocus", void 0, (i) => {
7056
7072
  this.comms?.halt(), this.showPromise = void 0, t();
7057
7073
  });
7058
- });
7074
+ }));
7059
7075
  this.comms?.halt();
7060
7076
  }
7061
7077
  applyContentProtection() {
@@ -7345,8 +7361,8 @@ class Dr {
7345
7361
  const l = this.coordinator.getTouchCenter(t);
7346
7362
  if (this.debugger?.show) {
7347
7363
  this.debugger.DOM.center.style.top = `${l.Y - 5}px`, this.debugger.DOM.center.style.left = `${l.X - 5}px`, this.debugger.DOM.center.innerText = `${l.X.toFixed(2)},${l.Y.toFixed(2)}`;
7348
- const g = this.coordinator.getBibiEventCoord(t, 1);
7349
- this.debugger.DOM.touch2.style.top = `${g.Y - 10}px`, this.debugger.DOM.touch2.style.left = `${g.X - 10}px`, this.debugger.DOM.touch2.innerText = `${g.X.toFixed(2)},${g.Y.toFixed(2)}`;
7364
+ const m = this.coordinator.getBibiEventCoord(t, 1);
7365
+ this.debugger.DOM.touch2.style.top = `${m.Y - 10}px`, this.debugger.DOM.touch2.style.left = `${m.X - 10}px`, this.debugger.DOM.touch2.innerText = `${m.X.toFixed(2)},${m.Y.toFixed(2)}`;
7350
7366
  }
7351
7367
  l.X -= this.manager.width / 2, l.Y -= this.manager.height / 2;
7352
7368
  let h = -l.X / s;
@@ -7698,14 +7714,14 @@ class $r {
7698
7714
  }
7699
7715
  this.delayedShow.has(d) || this.delayedShow.set(d, new Promise((P, R) => {
7700
7716
  let Y = !1;
7701
- const lt = window.setTimeout(async () => {
7717
+ const ht = window.setTimeout(async () => {
7702
7718
  this.delayedTimeout.set(d, 0);
7703
- const ht = this.makeSpread(this.reAlign(f)), xn = this.spreadPosition(ht, w), Ze = this.pool.get(d);
7719
+ const ct = this.makeSpread(this.reAlign(f)), xn = this.spreadPosition(ct, w), Ze = this.pool.get(d);
7704
7720
  await Ze.load(i, this.blobs.get(d)), this.peripherals.isScaled || await Ze.show(xn), this.delayedShow.delete(d), Y = !0, P();
7705
7721
  }, Ur);
7706
7722
  setTimeout(() => {
7707
7723
  !Y && this.delayedShow.has(d) && R(`Offscreen load timeout: ${d}`);
7708
- }, Hr), this.delayedTimeout.set(d, lt);
7724
+ }, Hr), this.delayedTimeout.set(d, ht);
7709
7725
  }));
7710
7726
  }
7711
7727
  };
@@ -7714,16 +7730,16 @@ class $r {
7714
7730
  } catch (d) {
7715
7731
  h(d);
7716
7732
  }
7717
- const g = [];
7733
+ const m = [];
7718
7734
  for (const d of o) {
7719
7735
  const f = this.pool.get(d.href), w = this.blobs.get(d.href);
7720
- w && (this.cancelShowing(d.href), await f.load(i, w), await f.show(this.spreadPosition(o, d)), this.previousFrames.push(f), await f.activate(), g.push(f));
7736
+ w && (this.cancelShowing(d.href), await f.load(i, w), await f.show(this.spreadPosition(o, d)), this.previousFrames.push(f), await f.activate(), m.push(f));
7721
7737
  }
7722
7738
  for (; this.previousFrames.length > 0; ) {
7723
7739
  const d = this.previousFrames.shift();
7724
- d && !g.includes(d) && await d.unfocus();
7740
+ d && !m.includes(d) && await d.unfocus();
7725
7741
  }
7726
- this.previousFrames = g, l();
7742
+ this.previousFrames = m, l();
7727
7743
  });
7728
7744
  for (const l of o)
7729
7745
  this.inprogress.set(l.href, a);
@@ -7783,7 +7799,7 @@ class $r {
7783
7799
  }
7784
7800
  class Ft {
7785
7801
  constructor(t = {}) {
7786
- this.backgroundColor = W(t.backgroundColor), this.blendFilter = E(t.blendFilter), this.constraint = S(t.constraint), this.columnCount = S(t.columnCount), this.darkenFilter = wt(t.darkenFilter), this.deprecatedFontSize = E(t.deprecatedFontSize), this.fontFamily = W(t.fontFamily), this.fontSize = F(t.fontSize, Yt.range), this.fontSizeNormalize = E(t.fontSizeNormalize), this.fontOpticalSizing = E(t.fontOpticalSizing), this.fontWeight = F(t.fontWeight, st.range), this.fontWidth = F(t.fontWidth, qt.range), this.hyphens = E(t.hyphens), this.invertFilter = wt(t.invertFilter), this.invertGaijiFilter = wt(t.invertGaijiFilter), this.iOSPatch = E(t.iOSPatch), this.iPadOSPatch = E(t.iPadOSPatch), this.letterSpacing = S(t.letterSpacing), this.ligatures = E(t.ligatures), this.lineHeight = S(t.lineHeight), this.linkColor = W(t.linkColor), this.noRuby = E(t.noRuby), this.pageGutter = S(t.pageGutter), this.paragraphIndent = S(t.paragraphIndent), this.paragraphSpacing = S(t.paragraphSpacing), this.scroll = E(t.scroll), this.scrollPaddingTop = S(t.scrollPaddingTop), this.scrollPaddingBottom = S(t.scrollPaddingBottom), this.scrollPaddingLeft = S(t.scrollPaddingLeft), this.scrollPaddingRight = S(t.scrollPaddingRight), this.selectionBackgroundColor = W(t.selectionBackgroundColor), this.selectionTextColor = W(t.selectionTextColor), this.textAlign = he(t.textAlign, tt), this.textColor = W(t.textColor), this.textNormalization = E(t.textNormalization), this.visitedColor = W(t.visitedColor), this.wordSpacing = S(t.wordSpacing), this.optimalLineLength = S(t.optimalLineLength), this.maximalLineLength = S(t.maximalLineLength), this.minimalLineLength = S(t.minimalLineLength);
7802
+ this.backgroundColor = W(t.backgroundColor), this.blendFilter = E(t.blendFilter), this.constraint = v(t.constraint), this.columnCount = v(t.columnCount), this.darkenFilter = wt(t.darkenFilter), this.deprecatedFontSize = E(t.deprecatedFontSize), this.fontFamily = W(t.fontFamily), this.fontSize = F(t.fontSize, Yt.range), this.fontSizeNormalize = E(t.fontSizeNormalize), this.fontOpticalSizing = E(t.fontOpticalSizing), this.fontWeight = F(t.fontWeight, st.range), this.fontWidth = F(t.fontWidth, qt.range), this.hyphens = E(t.hyphens), this.invertFilter = wt(t.invertFilter), this.invertGaijiFilter = wt(t.invertGaijiFilter), this.iOSPatch = E(t.iOSPatch), this.iPadOSPatch = E(t.iPadOSPatch), this.letterSpacing = v(t.letterSpacing), this.ligatures = E(t.ligatures), this.lineHeight = v(t.lineHeight), this.linkColor = W(t.linkColor), this.noRuby = E(t.noRuby), this.pageGutter = v(t.pageGutter), this.paragraphIndent = v(t.paragraphIndent), this.paragraphSpacing = v(t.paragraphSpacing), this.scroll = E(t.scroll), this.scrollPaddingTop = v(t.scrollPaddingTop), this.scrollPaddingBottom = v(t.scrollPaddingBottom), this.scrollPaddingLeft = v(t.scrollPaddingLeft), this.scrollPaddingRight = v(t.scrollPaddingRight), this.selectionBackgroundColor = W(t.selectionBackgroundColor), this.selectionTextColor = W(t.selectionTextColor), this.textAlign = he(t.textAlign, tt), this.textColor = W(t.textColor), this.textNormalization = E(t.textNormalization), this.visitedColor = W(t.visitedColor), this.wordSpacing = v(t.wordSpacing), this.optimalLineLength = v(t.optimalLineLength), this.maximalLineLength = v(t.maximalLineLength), this.minimalLineLength = v(t.minimalLineLength);
7787
7803
  }
7788
7804
  static serialize(t) {
7789
7805
  const { ...e } = t;
@@ -7806,10 +7822,10 @@ class Ft {
7806
7822
  }
7807
7823
  class Gr {
7808
7824
  constructor(t) {
7809
- this.backgroundColor = W(t.backgroundColor) || null, this.blendFilter = E(t.blendFilter) ?? !1, this.constraint = S(t.constraint) || 0, this.columnCount = S(t.columnCount) || null, this.darkenFilter = wt(t.darkenFilter) ?? !1, this.deprecatedFontSize = E(t.deprecatedFontSize), (this.deprecatedFontSize === !1 || this.deprecatedFontSize === null) && (this.deprecatedFontSize = !CSS.supports("zoom", "1")), this.fontFamily = W(t.fontFamily) || null, this.fontSize = F(t.fontSize, Yt.range) || 1, this.fontSizeNormalize = E(t.fontSizeNormalize) ?? !1, this.fontOpticalSizing = E(t.fontOpticalSizing) ?? null, this.fontWeight = F(t.fontWeight, st.range) || null, this.fontWidth = F(t.fontWidth, qt.range) || null, this.hyphens = E(t.hyphens) ?? null, this.invertFilter = wt(t.invertFilter) ?? !1, this.invertGaijiFilter = wt(t.invertGaijiFilter) ?? !1, this.iOSPatch = t.iOSPatch === !1 ? !1 : (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : T.OS.iPadOS && T.iOSRequest === "desktop", this.letterSpacing = S(t.letterSpacing) || null, this.ligatures = E(t.ligatures) ?? null, this.lineHeight = S(t.lineHeight) || null, this.linkColor = W(t.linkColor) || null, this.noRuby = E(t.noRuby) ?? !1, this.pageGutter = ge(S(t.pageGutter), 20), this.paragraphIndent = S(t.paragraphIndent) ?? null, this.paragraphSpacing = S(t.paragraphSpacing) ?? null, this.scroll = E(t.scroll) ?? !1, this.scrollPaddingTop = S(t.scrollPaddingTop) ?? null, this.scrollPaddingBottom = S(t.scrollPaddingBottom) ?? null, this.scrollPaddingLeft = S(t.scrollPaddingLeft) ?? null, this.scrollPaddingRight = S(t.scrollPaddingRight) ?? null, this.selectionBackgroundColor = W(t.selectionBackgroundColor) || null, this.selectionTextColor = W(t.selectionTextColor) || null, this.textAlign = he(t.textAlign, tt) || null, this.textColor = W(t.textColor) || null, this.textNormalization = E(t.textNormalization) ?? !1, this.visitedColor = W(t.visitedColor) || null, this.wordSpacing = S(t.wordSpacing) || null, this.optimalLineLength = S(t.optimalLineLength) || 65, this.maximalLineLength = ge(ur(t.maximalLineLength, this.optimalLineLength), 80), this.minimalLineLength = ge(dr(t.minimalLineLength, this.optimalLineLength), 40), this.experiments = gn(t.experiments) || null;
7825
+ this.backgroundColor = W(t.backgroundColor) || null, this.blendFilter = E(t.blendFilter) ?? !1, this.constraint = v(t.constraint) || 0, this.columnCount = v(t.columnCount) || null, this.darkenFilter = wt(t.darkenFilter) ?? !1, this.deprecatedFontSize = E(t.deprecatedFontSize), (this.deprecatedFontSize === !1 || this.deprecatedFontSize === null) && (this.deprecatedFontSize = !CSS.supports("zoom", "1")), this.fontFamily = W(t.fontFamily) || null, this.fontSize = F(t.fontSize, Yt.range) || 1, this.fontSizeNormalize = E(t.fontSizeNormalize) ?? !1, this.fontOpticalSizing = E(t.fontOpticalSizing) ?? null, this.fontWeight = F(t.fontWeight, st.range) || null, this.fontWidth = F(t.fontWidth, qt.range) || null, this.hyphens = E(t.hyphens) ?? null, this.invertFilter = wt(t.invertFilter) ?? !1, this.invertGaijiFilter = wt(t.invertGaijiFilter) ?? !1, this.iOSPatch = t.iOSPatch === !1 ? !1 : (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : T.OS.iPadOS && T.iOSRequest === "desktop", this.letterSpacing = v(t.letterSpacing) || null, this.ligatures = E(t.ligatures) ?? null, this.lineHeight = v(t.lineHeight) || null, this.linkColor = W(t.linkColor) || null, this.noRuby = E(t.noRuby) ?? !1, this.pageGutter = me(v(t.pageGutter), 20), this.paragraphIndent = v(t.paragraphIndent) ?? null, this.paragraphSpacing = v(t.paragraphSpacing) ?? null, this.scroll = E(t.scroll) ?? !1, this.scrollPaddingTop = v(t.scrollPaddingTop) ?? null, this.scrollPaddingBottom = v(t.scrollPaddingBottom) ?? null, this.scrollPaddingLeft = v(t.scrollPaddingLeft) ?? null, this.scrollPaddingRight = v(t.scrollPaddingRight) ?? null, this.selectionBackgroundColor = W(t.selectionBackgroundColor) || null, this.selectionTextColor = W(t.selectionTextColor) || null, this.textAlign = he(t.textAlign, tt) || null, this.textColor = W(t.textColor) || null, this.textNormalization = E(t.textNormalization) ?? !1, this.visitedColor = W(t.visitedColor) || null, this.wordSpacing = v(t.wordSpacing) || null, this.optimalLineLength = v(t.optimalLineLength) || 65, this.maximalLineLength = me(ur(t.maximalLineLength, this.optimalLineLength), 80), this.minimalLineLength = me(dr(t.minimalLineLength, this.optimalLineLength), 40), this.experiments = mn(t.experiments) || null;
7810
7826
  }
7811
7827
  }
7812
- const Xr = "#FFFFFF", Yr = "#121212", qr = "#0000EE", Kr = "#551A8B", Jr = "#b4d8fe", Zr = "inherit", pt = {
7828
+ const Xr = "#FFFFFF", Yr = "#121212", qr = "#0000EE", Kr = "#551A8B", Jr = "#b4d8fe", Zr = "inherit", ft = {
7813
7829
  backgroundColor: Xr,
7814
7830
  textColor: Yr,
7815
7831
  linkColor: qr,
@@ -7830,7 +7846,7 @@ class Bi {
7830
7846
  get backgroundColor() {
7831
7847
  return new N({
7832
7848
  initialValue: this.preferences.backgroundColor,
7833
- effectiveValue: this.settings.backgroundColor || pt.backgroundColor,
7849
+ effectiveValue: this.settings.backgroundColor || ft.backgroundColor,
7834
7850
  isEffective: this.preferences.backgroundColor !== null,
7835
7851
  onChange: (t) => {
7836
7852
  this.updatePreference("backgroundColor", t ?? null);
@@ -7875,8 +7891,8 @@ class Bi {
7875
7891
  onChange: (t) => {
7876
7892
  this.updatePreference("darkenFilter", t ?? null);
7877
7893
  },
7878
- supportedRange: dt.range,
7879
- step: dt.step
7894
+ supportedRange: ut.range,
7895
+ step: ut.step
7880
7896
  });
7881
7897
  }
7882
7898
  get deprecatedFontSize() {
@@ -7973,8 +7989,8 @@ class Bi {
7973
7989
  onChange: (t) => {
7974
7990
  this.updatePreference("invertFilter", t ?? null);
7975
7991
  },
7976
- supportedRange: dt.range,
7977
- step: dt.step
7992
+ supportedRange: ut.range,
7993
+ step: ut.step
7978
7994
  });
7979
7995
  }
7980
7996
  get invertGaijiFilter() {
@@ -7985,8 +8001,8 @@ class Bi {
7985
8001
  onChange: (t) => {
7986
8002
  this.updatePreference("invertGaijiFilter", t ?? null);
7987
8003
  },
7988
- supportedRange: dt.range,
7989
- step: dt.step
8004
+ supportedRange: ut.range,
8005
+ step: ut.step
7990
8006
  });
7991
8007
  }
7992
8008
  get iOSPatch() {
@@ -8051,7 +8067,7 @@ class Bi {
8051
8067
  get linkColor() {
8052
8068
  return new N({
8053
8069
  initialValue: this.preferences.linkColor,
8054
- effectiveValue: this.settings.linkColor || pt.linkColor,
8070
+ effectiveValue: this.settings.linkColor || ft.linkColor,
8055
8071
  isEffective: this.layout !== b.fixed && this.preferences.linkColor !== null,
8056
8072
  onChange: (t) => {
8057
8073
  this.updatePreference("linkColor", t ?? null);
@@ -8066,8 +8082,8 @@ class Bi {
8066
8082
  onChange: (t) => {
8067
8083
  this.updatePreference("maximalLineLength", t);
8068
8084
  },
8069
- supportedRange: ut.range,
8070
- step: ut.step
8085
+ supportedRange: pt.range,
8086
+ step: pt.step
8071
8087
  });
8072
8088
  }
8073
8089
  get minimalLineLength() {
@@ -8078,8 +8094,8 @@ class Bi {
8078
8094
  onChange: (t) => {
8079
8095
  this.updatePreference("minimalLineLength", t);
8080
8096
  },
8081
- supportedRange: ut.range,
8082
- step: ut.step
8097
+ supportedRange: pt.range,
8098
+ step: pt.step
8083
8099
  });
8084
8100
  }
8085
8101
  get noRuby() {
@@ -8100,8 +8116,8 @@ class Bi {
8100
8116
  onChange: (t) => {
8101
8117
  this.updatePreference("optimalLineLength", t);
8102
8118
  },
8103
- supportedRange: ut.range,
8104
- step: ut.step
8119
+ supportedRange: pt.range,
8120
+ step: pt.step
8105
8121
  });
8106
8122
  }
8107
8123
  get pageGutter() {
@@ -8191,7 +8207,7 @@ class Bi {
8191
8207
  get selectionBackgroundColor() {
8192
8208
  return new N({
8193
8209
  initialValue: this.preferences.selectionBackgroundColor,
8194
- effectiveValue: this.settings.selectionBackgroundColor || pt.selectionBackgroundColor,
8210
+ effectiveValue: this.settings.selectionBackgroundColor || ft.selectionBackgroundColor,
8195
8211
  isEffective: this.layout !== b.fixed && this.preferences.selectionBackgroundColor !== null,
8196
8212
  onChange: (t) => {
8197
8213
  this.updatePreference("selectionBackgroundColor", t ?? null);
@@ -8201,7 +8217,7 @@ class Bi {
8201
8217
  get selectionTextColor() {
8202
8218
  return new N({
8203
8219
  initialValue: this.preferences.selectionTextColor,
8204
- effectiveValue: this.settings.selectionTextColor || pt.selectionTextColor,
8220
+ effectiveValue: this.settings.selectionTextColor || ft.selectionTextColor,
8205
8221
  isEffective: this.layout !== b.fixed && this.preferences.selectionTextColor !== null,
8206
8222
  onChange: (t) => {
8207
8223
  this.updatePreference("selectionTextColor", t ?? null);
@@ -8222,7 +8238,7 @@ class Bi {
8222
8238
  get textColor() {
8223
8239
  return new N({
8224
8240
  initialValue: this.preferences.textColor,
8225
- effectiveValue: this.settings.textColor || pt.textColor,
8241
+ effectiveValue: this.settings.textColor || ft.textColor,
8226
8242
  isEffective: this.layout !== b.fixed && this.preferences.textColor !== null,
8227
8243
  onChange: (t) => {
8228
8244
  this.updatePreference("textColor", t ?? null);
@@ -8242,7 +8258,7 @@ class Bi {
8242
8258
  get visitedColor() {
8243
8259
  return new N({
8244
8260
  initialValue: this.preferences.visitedColor,
8245
- effectiveValue: this.settings.visitedColor || pt.visitedColor,
8261
+ effectiveValue: this.settings.visitedColor || ft.visitedColor,
8246
8262
  isEffective: this.layout !== b.fixed && this.preferences.visitedColor !== null,
8247
8263
  onChange: (t) => {
8248
8264
  this.updatePreference("visitedColor", t ?? null);
@@ -8375,13 +8391,13 @@ class eo {
8375
8391
  if (i === null)
8376
8392
  if (n >= a && h !== null) {
8377
8393
  u = Math.floor(n / a);
8378
- const g = Math.round(u * (h * o));
8379
- p = Math.min(g, n);
8394
+ const m = Math.round(u * (h * o));
8395
+ p = Math.min(m, n);
8380
8396
  } else
8381
8397
  p = c();
8382
8398
  else if (i > 1) {
8383
- const g = Math.round(i * (l !== null ? l : a));
8384
- if (n >= g)
8399
+ const m = Math.round(i * (l !== null ? l : a));
8400
+ if (n >= m)
8385
8401
  if (u = i, h === null)
8386
8402
  p = n;
8387
8403
  else {
@@ -8509,14 +8525,14 @@ async function no(r, t) {
8509
8525
  id: "css-selector-generator",
8510
8526
  as: "script",
8511
8527
  target: "head",
8512
- blob: new Blob([St(vn)], { type: "text/javascript" })
8528
+ blob: new Blob([vt(Sn)], { type: "text/javascript" })
8513
8529
  },
8514
8530
  // Execution Prevention - conditional (has executable scripts)
8515
8531
  {
8516
8532
  id: "execution-prevention",
8517
8533
  as: "script",
8518
8534
  target: "head",
8519
- blob: new Blob([St(io)], { type: "text/javascript" }),
8535
+ blob: new Blob([vt(io)], { type: "text/javascript" }),
8520
8536
  condition: (a) => !!(a.querySelector("script") || a.querySelector("body[onload]:not(body[onload=''])"))
8521
8537
  }
8522
8538
  ], o = [
@@ -8525,7 +8541,7 @@ async function no(r, t) {
8525
8541
  id: "onload-proxy",
8526
8542
  as: "script",
8527
8543
  target: "head",
8528
- blob: new Blob([St(Pn)], { type: "text/javascript" }),
8544
+ blob: new Blob([vt(Pn)], { type: "text/javascript" }),
8529
8545
  condition: (a) => !!(a.querySelector("script") || a.querySelector("body[onload]:not(body[onload=''])"))
8530
8546
  }
8531
8547
  ];
@@ -8534,21 +8550,21 @@ async function no(r, t) {
8534
8550
  let l, h, c;
8535
8551
  switch (a) {
8536
8552
  case "rtl": {
8537
- const [u, p, g] = await Promise.all([
8553
+ const [u, p, m] = await Promise.all([
8538
8554
  import("./ReadiumCSS-before-DwBLxUVH.js"),
8539
8555
  import("./ReadiumCSS-default-BhdLiyWp.js"),
8540
8556
  import("./ReadiumCSS-after-d5mC4cme.js")
8541
8557
  ]);
8542
- l = u.default, h = p.default, c = g.default;
8558
+ l = u.default, h = p.default, c = m.default;
8543
8559
  break;
8544
8560
  }
8545
8561
  case "cjk-horizontal": {
8546
- const [u, p, g] = await Promise.all([
8562
+ const [u, p, m] = await Promise.all([
8547
8563
  import("./ReadiumCSS-before-CG-KmDa3.js"),
8548
8564
  import("./ReadiumCSS-default-N65xNiIp.js"),
8549
8565
  import("./ReadiumCSS-after-XUKPAxfT.js")
8550
8566
  ]);
8551
- l = u.default, h = p.default, c = g.default;
8567
+ l = u.default, h = p.default, c = m.default;
8552
8568
  break;
8553
8569
  }
8554
8570
  case "cjk-vertical":
@@ -8556,21 +8572,21 @@ async function no(r, t) {
8556
8572
  // layout as CJK vertical-rl — it is an outlier handled by the
8557
8573
  // same stylesheet set per the Readium CSS spec.
8558
8574
  case "mongolian-vertical": {
8559
- const [u, p, g] = await Promise.all([
8575
+ const [u, p, m] = await Promise.all([
8560
8576
  import("./ReadiumCSS-before-BNTwR8Qm.js"),
8561
8577
  import("./ReadiumCSS-default-BesyZHRU.js"),
8562
8578
  import("./ReadiumCSS-after-ClF4TBzj.js")
8563
8579
  ]);
8564
- l = u.default, h = p.default, c = g.default;
8580
+ l = u.default, h = p.default, c = m.default;
8565
8581
  break;
8566
8582
  }
8567
8583
  default: {
8568
- const [u, p, g] = await Promise.all([
8584
+ const [u, p, m] = await Promise.all([
8569
8585
  import("./ReadiumCSS-before-8FMq19-x.js"),
8570
8586
  import("./ReadiumCSS-default-AIAk8uwU.js"),
8571
8587
  import("./ReadiumCSS-after-D7unrNI9.js")
8572
8588
  ]);
8573
- l = u.default, h = p.default, c = g.default;
8589
+ l = u.default, h = p.default, c = m.default;
8574
8590
  break;
8575
8591
  }
8576
8592
  }
@@ -8644,7 +8660,7 @@ const so = (r) => ({
8644
8660
  });
8645
8661
  class Ln extends dn {
8646
8662
  constructor(t, e, i, n = [], s = void 0, o = { preferences: {}, defaults: {} }) {
8647
- super(), this._preferencesEditor = null, this._injector = null, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this.reflowViewport = {
8663
+ super(), this._preferencesEditor = null, this._injector = null, this._isNavigating = !1, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this.reflowViewport = {
8648
8664
  readingOrder: [],
8649
8665
  progressions: /* @__PURE__ */ new Map(),
8650
8666
  positions: null
@@ -8670,15 +8686,15 @@ class Ln extends dn {
8670
8686
  }), this._layout = Ln.determineLayout(e, !!this._settings.scroll), this.currentProgression = e.metadata.effectiveReadingProgression, this._injectablesConfig = o.injectables || { rules: [], allowedDomains: [] }, this._readiumRulesPromise = no(e.metadata, e.readingOrder.items), this._contentProtection = o.contentProtection || {}, this._keyboardPeripherals = this.mergeKeyboardPeripherals(
8671
8687
  this._contentProtection,
8672
8688
  o.keyboardPeripherals || []
8673
- ), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new Ye(this._contentProtection), this._suspiciousActivityListener = (g) => {
8674
- const { type: d, ...f } = g.detail;
8689
+ ), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new Ye(this._contentProtection), this._suspiciousActivityListener = (m) => {
8690
+ const { type: d, ...f } = m.detail;
8675
8691
  d === "context_menu" ? this.listeners.contextMenu(f) : this.listeners.contentProtection(d, f);
8676
- }, window.addEventListener(ot, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new qe({
8692
+ }, window.addEventListener(at, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new qe({
8677
8693
  keyboardPeripherals: this._keyboardPeripherals
8678
- }), this._keyboardPeripheralListener = (g) => {
8679
- const d = g.detail;
8694
+ }), this._keyboardPeripheralListener = (m) => {
8695
+ const d = m.detail;
8680
8696
  this.listeners.peripheral(d);
8681
- }, window.addEventListener(at, this._keyboardPeripheralListener)), this.resizeObserver = new ResizeObserver(() => this.ownerWindow.requestAnimationFrame(async () => await this.resizeHandler())), this.resizeObserver.observe(this.container.parentElement || document.documentElement);
8697
+ }, window.addEventListener(lt, this._keyboardPeripheralListener)), this.resizeObserver = new ResizeObserver(() => this.ownerWindow.requestAnimationFrame(async () => await this.resizeHandler())), this.resizeObserver.observe(this.container.parentElement || document.documentElement);
8682
8698
  }
8683
8699
  static determineLayout(t, e) {
8684
8700
  const i = t.metadata.effectiveLayout;
@@ -8692,7 +8708,7 @@ class Ln extends dn {
8692
8708
  async load() {
8693
8709
  if (this.positions?.length || (this.positions = await this.pub.positionsFromManifest()), !this._injector) {
8694
8710
  const t = await this._readiumRulesPromise;
8695
- this._injector = new Sn({
8711
+ this._injector = new vn({
8696
8712
  rules: [...t, ...this._injectablesConfig.rules],
8697
8713
  allowedDomains: this._injectablesConfig.allowedDomains
8698
8714
  });
@@ -8903,7 +8919,7 @@ class Ln extends dn {
8903
8919
  let t = Array.from(Te.keys());
8904
8920
  if (this._layout === b.fixed)
8905
8921
  return t.filter((n) => fs.includes(n));
8906
- t = t.filter((n) => ms.includes(n));
8922
+ t = t.filter((n) => gs.includes(n));
8907
8923
  const e = bt(this.pub.metadata);
8908
8924
  if (e === "cjk-vertical" || e === "mongolian-vertical")
8909
8925
  return t.filter((n) => n !== "column_snapper" && n !== "scroll_snapper");
@@ -8925,7 +8941,7 @@ class Ln extends dn {
8925
8941
  throw Error("Link for " + this.currentLocation.href + " not found!");
8926
8942
  }
8927
8943
  async destroy() {
8928
- this._suspiciousActivityListener && window.removeEventListener(ot, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(at, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), await this.framePool?.destroy();
8944
+ this._suspiciousActivityListener && window.removeEventListener(at, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(lt, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), await this.framePool?.destroy();
8929
8945
  }
8930
8946
  async changeResource(t) {
8931
8947
  if (t === 0) return !1;
@@ -8953,7 +8969,7 @@ class Ln extends dn {
8953
8969
  break;
8954
8970
  }
8955
8971
  }
8956
- return await this.apply(), !0;
8972
+ return await this.apply(), this.listeners.positionChanged(this.currentLocation), !0;
8957
8973
  }
8958
8974
  const e = this.pub.readingOrder.findIndexWithHref(this.currentLocation.href), i = Math.max(
8959
8975
  0,
@@ -9008,13 +9024,35 @@ class Ln extends dn {
9008
9024
  }), this.lastLocationInView = i.last, this.updateViewport(e), this.listeners.positionChanged(this.currentLocation), await this.framePool.update(this.pub, this.currentLocation, this.determineModules());
9009
9025
  }
9010
9026
  goBackward(t, e) {
9011
- this._layout === b.fixed ? (this.changeResource(-1), e(!0)) : this._cframes[0]?.msg?.send("go_prev", void 0, async (i) => {
9012
- e(i ? !0 : await this.changeResource(-1));
9027
+ if (this._isNavigating) {
9028
+ e(!1);
9029
+ return;
9030
+ }
9031
+ this._isNavigating = !0, this._layout === b.fixed ? this.changeResource(-1).then((i) => {
9032
+ this._isNavigating = !1, e(i);
9033
+ }) : this._cframes[0]?.msg?.send("go_prev", void 0, async (i) => {
9034
+ if (i)
9035
+ this._isNavigating = !1, e(!0);
9036
+ else {
9037
+ const n = await this.changeResource(-1);
9038
+ this._isNavigating = !1, e(n);
9039
+ }
9013
9040
  });
9014
9041
  }
9015
9042
  goForward(t, e) {
9016
- this._layout === b.fixed ? (this.changeResource(1), e(!0)) : this._cframes[0]?.msg?.send("go_next", void 0, async (i) => {
9017
- e(i ? !0 : await this.changeResource(1));
9043
+ if (this._isNavigating) {
9044
+ e(!1);
9045
+ return;
9046
+ }
9047
+ this._isNavigating = !0, this._layout === b.fixed ? this.changeResource(1).then((i) => {
9048
+ this._isNavigating = !1, e(i);
9049
+ }) : this._cframes[0]?.msg?.send("go_next", void 0, async (i) => {
9050
+ if (i)
9051
+ this._isNavigating = !1, e(!0);
9052
+ else {
9053
+ const n = await this.changeResource(1);
9054
+ this._isNavigating = !1, e(n);
9055
+ }
9018
9056
  });
9019
9057
  }
9020
9058
  get currentLocator() {
@@ -9093,7 +9131,13 @@ class Ln extends dn {
9093
9131
  let s = this.pub.readingOrder.findWithHref(n);
9094
9132
  if (!s)
9095
9133
  return i(this.listeners.handleLocator(t));
9096
- this.currentLocation = this.positions.find((o) => o.href === s.href), this.apply().then(() => this.loadLocator(t, (o) => i(o))).then(() => {
9134
+ if (this._isNavigating) {
9135
+ i(!1);
9136
+ return;
9137
+ }
9138
+ this._isNavigating = !0, this.currentLocation = this.positions.find((o) => o.href === s.href), this.apply().then(() => this.loadLocator(t, (o) => {
9139
+ this._isNavigating = !1, i(o);
9140
+ })).then(() => {
9097
9141
  this.attachListener();
9098
9142
  });
9099
9143
  }
@@ -9614,7 +9658,7 @@ class oo {
9614
9658
  }
9615
9659
  class ce {
9616
9660
  constructor(t = {}) {
9617
- this.volume = F(t.volume, ie.range), this.playbackRate = F(t.playbackRate, ne.range), this.preservePitch = E(t.preservePitch), this.skipBackwardInterval = F(t.skipBackwardInterval, it.range), this.skipForwardInterval = F(t.skipForwardInterval, it.range), this.pollInterval = S(t.pollInterval), this.autoPlay = E(t.autoPlay), this.enableMediaSession = E(t.enableMediaSession);
9661
+ this.volume = F(t.volume, ie.range), this.playbackRate = F(t.playbackRate, ne.range), this.preservePitch = E(t.preservePitch), this.skipBackwardInterval = F(t.skipBackwardInterval, it.range), this.skipForwardInterval = F(t.skipForwardInterval, it.range), this.pollInterval = v(t.pollInterval), this.autoPlay = E(t.autoPlay), this.enableMediaSession = E(t.enableMediaSession);
9618
9662
  }
9619
9663
  merging(t) {
9620
9664
  const e = { ...this };
@@ -9625,7 +9669,7 @@ class ce {
9625
9669
  }
9626
9670
  class ao {
9627
9671
  constructor(t = {}) {
9628
- this.volume = F(t.volume, ie.range) ?? 1, this.playbackRate = F(t.playbackRate, ne.range) ?? 1, this.preservePitch = E(t.preservePitch) ?? !0, this.skipBackwardInterval = F(t.skipBackwardInterval, it.range) ?? 10, this.skipForwardInterval = F(t.skipForwardInterval, it.range) ?? 10, this.pollInterval = S(t.pollInterval) ?? 1e3, this.autoPlay = E(t.autoPlay) ?? !0, this.enableMediaSession = E(t.enableMediaSession) ?? !0;
9672
+ this.volume = F(t.volume, ie.range) ?? 1, this.playbackRate = F(t.playbackRate, ne.range) ?? 1, this.preservePitch = E(t.preservePitch) ?? !0, this.skipBackwardInterval = F(t.skipBackwardInterval, it.range) ?? 10, this.skipForwardInterval = F(t.skipForwardInterval, it.range) ?? 10, this.pollInterval = v(t.pollInterval) ?? 1e3, this.autoPlay = E(t.autoPlay) ?? !0, this.enableMediaSession = E(t.enableMediaSession) ?? !0;
9629
9673
  }
9630
9674
  }
9631
9675
  class ji {
@@ -9887,7 +9931,7 @@ const po = (r) => ({
9887
9931
  remotePlaybackStateChanged: r.remotePlaybackStateChanged ?? (() => {
9888
9932
  })
9889
9933
  });
9890
- class yo extends vs {
9934
+ class yo extends Ss {
9891
9935
  constructor(t, e, i, n = {
9892
9936
  preferences: {},
9893
9937
  defaults: {}
@@ -9931,11 +9975,11 @@ class yo extends vs {
9931
9975
  n.keyboardPeripherals || []
9932
9976
  );
9933
9977
  (h.disableContextMenu || h.checkAutomation || h.checkIFrameEmbedding || h.monitorDevTools || h.protectPrinting?.disable || h.disableDragAndDrop || h.protectCopy) && (this._navigatorProtector = new uo(h), this._suspiciousActivityListener = (u) => {
9934
- const { type: p, ...g } = u.detail;
9935
- p === "context_menu" ? this.listeners.contextMenu(g) : this.listeners.contentProtection(p, g);
9936
- }, window.addEventListener(ot, this._suspiciousActivityListener)), c.length > 0 && (this._keyboardPeripheralsManager = new qe({ keyboardPeripherals: c }), this._keyboardPeripheralListener = (u) => {
9978
+ const { type: p, ...m } = u.detail;
9979
+ p === "context_menu" ? this.listeners.contextMenu(m) : this.listeners.contentProtection(p, m);
9980
+ }, window.addEventListener(at, this._suspiciousActivityListener)), c.length > 0 && (this._keyboardPeripheralsManager = new qe({ keyboardPeripherals: c }), this._keyboardPeripheralListener = (u) => {
9937
9981
  this.listeners.peripheral(u.detail);
9938
- }, window.addEventListener(at, this._keyboardPeripheralListener)), this.setupEventListeners(), this._isNavigating = !0, this.pool.setCurrentAudio(o, "forward"), this.applyPreferences(), this.waitForLoadedAndSeeked(a).then(() => {
9982
+ }, window.addEventListener(lt, this._keyboardPeripheralListener)), this.setupEventListeners(), this._isNavigating = !0, this.pool.setCurrentAudio(o, "forward"), this.applyPreferences(), this.waitForLoadedAndSeeked(a).then(() => {
9939
9983
  this._isNavigating = !1, this.listeners.trackLoaded(this.pool.audioEngine.getMediaElement()), this._notifyTimelineChange(this.currentLocator), this.listeners.positionChanged(this.currentLocator), this._setupRemotePlayback();
9940
9984
  }).catch(() => {
9941
9985
  this._isNavigating = !1;
@@ -10243,7 +10287,7 @@ class yo extends vs {
10243
10287
  "mediaSession" in navigator && (navigator.mediaSession.metadata = null, navigator.mediaSession.setActionHandler("play", null), navigator.mediaSession.setActionHandler("pause", null), navigator.mediaSession.setActionHandler("previoustrack", null), navigator.mediaSession.setActionHandler("nexttrack", null), navigator.mediaSession.setActionHandler("seekbackward", null), navigator.mediaSession.setActionHandler("seekforward", null));
10244
10288
  }
10245
10289
  destroy() {
10246
- this.stopPositionPolling(), this._stopStalledWatchdog(), this.destroyMediaSession(), this._suspiciousActivityListener && window.removeEventListener(ot, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(at, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), this.pool.destroy();
10290
+ this.stopPositionPolling(), this._stopStalledWatchdog(), this.destroyMediaSession(), this._suspiciousActivityListener && window.removeEventListener(at, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(lt, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), this.pool.destroy();
10247
10291
  }
10248
10292
  }
10249
10293
  export {
@@ -10259,7 +10303,7 @@ export {
10259
10303
  Ft as EpubPreferences,
10260
10304
  Bi as EpubPreferencesEditor,
10261
10305
  Vi as EpubSettings,
10262
- go as ExperimentalWebPubNavigator,
10306
+ mo as ExperimentalWebPubNavigator,
10263
10307
  Ir as FXLCoordinator,
10264
10308
  Nr as FXLFrameManager,
10265
10309
  $r as FXLFramePoolManager,
@@ -10269,9 +10313,9 @@ export {
10269
10313
  Cn as FrameManager,
10270
10314
  Tr as FramePoolManager,
10271
10315
  Mr as HorizontalThird,
10272
- Sn as Injector,
10316
+ vn as Injector,
10273
10317
  kt as LineLengths,
10274
- vs as MediaNavigator,
10318
+ Ss as MediaNavigator,
10275
10319
  cn as Navigator,
10276
10320
  Ne as Orientation,
10277
10321
  N as Preference,
@@ -10295,26 +10339,26 @@ export {
10295
10339
  Ti as WebPubPreferencesEditor,
10296
10340
  Ai as WebPubSettings,
10297
10341
  hr as WebRSProperties,
10298
- mn as WebUserProperties,
10342
+ gn as WebUserProperties,
10299
10343
  E as ensureBoolean,
10300
10344
  he as ensureEnumValue,
10301
- gn as ensureExperiment,
10345
+ mn as ensureExperiment,
10302
10346
  wt as ensureFilter,
10303
10347
  dr as ensureLessThanOrEqual,
10304
10348
  ur as ensureMoreThanOrEqual,
10305
- S as ensureNonNegative,
10349
+ v as ensureNonNegative,
10306
10350
  W as ensureString,
10307
10351
  F as ensureValueInRange,
10308
10352
  Ge as experiments,
10309
- dt as filterRangeConfig,
10353
+ ut as filterRangeConfig,
10310
10354
  Yt as fontSizeRangeConfig,
10311
10355
  st as fontWeightRangeConfig,
10312
10356
  qt as fontWidthRangeConfig,
10313
10357
  bt as getScriptMode,
10314
- mo as i18n,
10358
+ go as i18n,
10315
10359
  Kt as letterSpacingRangeConfig,
10316
10360
  Jt as lineHeightRangeConfig,
10317
- ut as lineLengthRangeConfig,
10361
+ pt as lineLengthRangeConfig,
10318
10362
  Zt as paragraphIndentRangeConfig,
10319
10363
  Qt as paragraphSpacingRangeConfig,
10320
10364
  ne as playbackRateRangeConfig,
@@ -10323,7 +10367,7 @@ export {
10323
10367
  fo as settings,
10324
10368
  it as skipIntervalRangeConfig,
10325
10369
  ie as volumeRangeConfig,
10326
- ge as withFallback,
10370
+ me as withFallback,
10327
10371
  te as wordSpacingRangeConfig,
10328
10372
  ee as zoomRangeConfig
10329
10373
  };