@readium/navigator-html-injectables 2.4.2-beta.1 → 2.4.2-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -36,13 +36,13 @@ class Be {
36
36
  }
37
37
  register(t, e, i) {
38
38
  Array.isArray(t) || (t = [t]), t.forEach((s) => {
39
- const n = this.registrar.get(s);
40
- if (n && n.length >= 0) {
41
- if (n.find((a) => a.module === e)) throw new Error(`Trying to register another callback for combination of event ${s} and module ${e}`);
42
- n.push({
39
+ const r = this.registrar.get(s);
40
+ if (r && r.length >= 0) {
41
+ if (r.find((a) => a.module === e)) throw new Error(`Trying to register another callback for combination of event ${s} and module ${e}`);
42
+ r.push({
43
43
  cb: i,
44
44
  module: e
45
- }), this.registrar.set(s, n);
45
+ }), this.registrar.set(s, r);
46
46
  } else
47
47
  this.registrar.set(s, [{
48
48
  cb: i,
@@ -53,7 +53,7 @@ class Be {
53
53
  unregister(t, e) {
54
54
  Array.isArray(t) || (t = [t]), t.forEach((i) => {
55
55
  const s = this.registrar.get(i);
56
- !s || s.length === 0 || s.splice(s.findIndex((n) => n.module === e), 1);
56
+ !s || s.length === 0 || s.splice(s.findIndex((r) => r.module === e), 1);
57
57
  });
58
58
  }
59
59
  unregisterAll(t) {
@@ -70,7 +70,7 @@ class Be {
70
70
  }
71
71
  send(t, e, i = void 0, s = []) {
72
72
  if (!this.destination) throw Error("Attempted to send comms message before destination has been initialized");
73
- const n = {
73
+ const r = {
74
74
  _readium: Z,
75
75
  _channel: this.channelId,
76
76
  id: i ?? Ue(),
@@ -79,13 +79,13 @@ class Be {
79
79
  data: e
80
80
  };
81
81
  try {
82
- this.destination.postMessage(n, {
82
+ this.destination.postMessage(r, {
83
83
  targetOrigin: this.origin,
84
84
  transfer: s
85
85
  });
86
86
  } catch (o) {
87
87
  if (s.length > 0) throw o;
88
- this.destination.postMessage(n, this.origin, s);
88
+ this.destination.postMessage(r, this.origin, s);
89
89
  }
90
90
  }
91
91
  }
@@ -316,10 +316,10 @@ class $ {
316
316
  getNestedValue(t, e) {
317
317
  const i = e.split(".");
318
318
  let s = t;
319
- for (const n of i) {
319
+ for (const r of i) {
320
320
  if (s == null)
321
321
  return;
322
- s = s[n];
322
+ s = s[r];
323
323
  }
324
324
  return s;
325
325
  }
@@ -397,32 +397,32 @@ Object.defineProperty(R.prototype, "encryption", {
397
397
  return kt.deserialize(this.otherProperties.encrypted);
398
398
  }
399
399
  });
400
- function Ve(r) {
401
- return r && Array.isArray(r) ? r : void 0;
400
+ function Ve(n) {
401
+ return n && Array.isArray(n) ? n : void 0;
402
402
  }
403
- function Ce(r) {
404
- return r && typeof r == "string" ? [r] : Ve(r);
403
+ function Ce(n) {
404
+ return n && typeof n == "string" ? [n] : Ve(n);
405
405
  }
406
- function ie(r) {
407
- return typeof r == "string" ? new Date(r) : void 0;
406
+ function ie(n) {
407
+ return typeof n == "string" ? new Date(n) : void 0;
408
408
  }
409
- function ht(r) {
410
- return isNaN(r) ? void 0 : r;
409
+ function ht(n) {
410
+ return isNaN(n) ? void 0 : n;
411
411
  }
412
- function O(r) {
413
- return ht(r) !== void 0 && Math.sign(r) >= 0 ? r : void 0;
412
+ function O(n) {
413
+ return ht(n) !== void 0 && Math.sign(n) >= 0 ? n : void 0;
414
414
  }
415
- function Fe(r) {
415
+ function Fe(n) {
416
416
  const t = new Array();
417
- return r.forEach((e) => t.push(e)), t;
417
+ return n.forEach((e) => t.push(e)), t;
418
418
  }
419
- class c {
419
+ class l {
420
420
  /** Creates a MediaType object. */
421
421
  constructor(t) {
422
422
  let e, i, s = t.mediaType.replace(/\s/g, "").split(";");
423
- const n = s[0].split("/");
424
- if (n.length === 2) {
425
- if (e = n[0].toLowerCase().trim(), i = n[1].toLowerCase().trim(), e.length === 0 || i.length === 0)
423
+ const r = s[0].split("/");
424
+ if (r.length === 2) {
425
+ if (e = r[0].toLowerCase().trim(), i = r[1].toLowerCase().trim(), e.length === 0 || i.length === 0)
426
426
  throw new Error("Invalid media type");
427
427
  } else
428
428
  throw new Error("Invalid media type");
@@ -434,8 +434,8 @@ class c {
434
434
  o[g] = m;
435
435
  }
436
436
  }
437
- const a = {}, l = Object.keys(o);
438
- l.sort((p, v) => p.localeCompare(v)), l.forEach((p) => a[p] = o[p]);
437
+ const a = {}, c = Object.keys(o);
438
+ c.sort((p, v) => p.localeCompare(v)), c.forEach((p) => a[p] = o[p]);
439
439
  let u = "";
440
440
  for (const p in a) {
441
441
  const v = a[p];
@@ -445,7 +445,7 @@ class c {
445
445
  this.string = d, this.type = e, this.subtype = i, this.parameters = a, this.encoding = f, this.name = t.name, this.fileExtension = t.fileExtension;
446
446
  }
447
447
  static parse(t) {
448
- return new c(t);
448
+ return new l(t);
449
449
  }
450
450
  /** Structured syntax suffix, e.g. `+zip` in `application/epub+zip`.
451
451
  * Gives a hint on the underlying structure of this media type.
@@ -475,16 +475,16 @@ class c {
475
475
  * - Wildcards are supported, meaning that `image/*` contains `image/png`
476
476
  */
477
477
  contains(t) {
478
- const e = typeof t == "string" ? c.parse({ mediaType: t }) : t;
478
+ const e = typeof t == "string" ? l.parse({ mediaType: t }) : t;
479
479
  if (!((this.type === "*" || this.type === e.type) && (this.subtype === "*" || this.subtype === e.subtype)))
480
480
  return !1;
481
481
  const i = new Set(
482
- Object.entries(this.parameters).map(([n, o]) => `${n}=${o}`)
482
+ Object.entries(this.parameters).map(([r, o]) => `${r}=${o}`)
483
483
  ), s = new Set(
484
- Object.entries(e.parameters).map(([n, o]) => `${n}=${o}`)
484
+ Object.entries(e.parameters).map(([r, o]) => `${r}=${o}`)
485
485
  );
486
- for (const n of Array.from(i.values()))
487
- if (!s.has(n))
486
+ for (const r of Array.from(i.values()))
487
+ if (!s.has(r))
488
488
  return !1;
489
489
  return !0;
490
490
  }
@@ -494,7 +494,7 @@ class c {
494
494
  * doesn't. This is basically like `contains`, but working in both direction.
495
495
  */
496
496
  matches(t) {
497
- const e = typeof t == "string" ? c.parse({ mediaType: t }) : t;
497
+ const e = typeof t == "string" ? l.parse({ mediaType: t }) : t;
498
498
  return this.contains(e) || e.contains(this);
499
499
  }
500
500
  /**
@@ -513,39 +513,39 @@ class c {
513
513
  /** Returns whether this media type is structured as a ZIP archive. */
514
514
  get isZIP() {
515
515
  return this.matchesAny(
516
- c.ZIP,
517
- c.LCP_PROTECTED_AUDIOBOOK,
518
- c.LCP_PROTECTED_PDF
516
+ l.ZIP,
517
+ l.LCP_PROTECTED_AUDIOBOOK,
518
+ l.LCP_PROTECTED_PDF
519
519
  ) || this.structuredSyntaxSuffix === "+zip";
520
520
  }
521
521
  /** Returns whether this media type is structured as a JSON file. */
522
522
  get isJSON() {
523
- return this.matchesAny(c.JSON) || this.structuredSyntaxSuffix === "+json";
523
+ return this.matchesAny(l.JSON) || this.structuredSyntaxSuffix === "+json";
524
524
  }
525
525
  /** Returns whether this media type is of an OPDS feed. */
526
526
  get isOPDS() {
527
527
  return this.matchesAny(
528
- c.OPDS1,
529
- c.OPDS1_ENTRY,
530
- c.OPDS2,
531
- c.OPDS2_PUBLICATION,
532
- c.OPDS_AUTHENTICATION
528
+ l.OPDS1,
529
+ l.OPDS1_ENTRY,
530
+ l.OPDS2,
531
+ l.OPDS2_PUBLICATION,
532
+ l.OPDS_AUTHENTICATION
533
533
  ) || this.structuredSyntaxSuffix === "+json";
534
534
  }
535
535
  /** Returns whether this media type is of an HTML document. */
536
536
  get isHTML() {
537
- return this.matchesAny(c.HTML, c.XHTML);
537
+ return this.matchesAny(l.HTML, l.XHTML);
538
538
  }
539
539
  /** Returns whether this media type is of a bitmap image, so excluding vectorial formats. */
540
540
  get isBitmap() {
541
541
  return this.matchesAny(
542
- c.AVIF,
543
- c.BMP,
544
- c.GIF,
545
- c.JPEG,
546
- c.PNG,
547
- c.TIFF,
548
- c.WEBP
542
+ l.AVIF,
543
+ l.BMP,
544
+ l.GIF,
545
+ l.JPEG,
546
+ l.PNG,
547
+ l.TIFF,
548
+ l.WEBP
549
549
  );
550
550
  }
551
551
  /** Returns whether this media type is of an audio clip. */
@@ -559,317 +559,317 @@ class c {
559
559
  /** Returns whether this media type is of a Readium Web Publication Manifest. */
560
560
  get isRWPM() {
561
561
  return this.matchesAny(
562
- c.READIUM_AUDIOBOOK_MANIFEST,
563
- c.DIVINA_MANIFEST,
564
- c.READIUM_WEBPUB_MANIFEST
562
+ l.READIUM_AUDIOBOOK_MANIFEST,
563
+ l.DIVINA_MANIFEST,
564
+ l.READIUM_WEBPUB_MANIFEST
565
565
  );
566
566
  }
567
567
  /** Returns whether this media type is of a publication file. */
568
568
  get isPublication() {
569
569
  return this.matchesAny(
570
- c.READIUM_AUDIOBOOK,
571
- c.READIUM_AUDIOBOOK_MANIFEST,
572
- c.CBZ,
573
- c.DIVINA,
574
- c.DIVINA_MANIFEST,
575
- c.EPUB,
576
- c.LCP_PROTECTED_AUDIOBOOK,
577
- c.LCP_PROTECTED_PDF,
578
- c.LPF,
579
- c.PDF,
580
- c.W3C_WPUB_MANIFEST,
581
- c.READIUM_WEBPUB,
582
- c.READIUM_WEBPUB_MANIFEST,
583
- c.ZAB
570
+ l.READIUM_AUDIOBOOK,
571
+ l.READIUM_AUDIOBOOK_MANIFEST,
572
+ l.CBZ,
573
+ l.DIVINA,
574
+ l.DIVINA_MANIFEST,
575
+ l.EPUB,
576
+ l.LCP_PROTECTED_AUDIOBOOK,
577
+ l.LCP_PROTECTED_PDF,
578
+ l.LPF,
579
+ l.PDF,
580
+ l.W3C_WPUB_MANIFEST,
581
+ l.READIUM_WEBPUB,
582
+ l.READIUM_WEBPUB_MANIFEST,
583
+ l.ZAB
584
584
  );
585
585
  }
586
586
  // Known Media Types
587
587
  static get AAC() {
588
- return c.parse({ mediaType: "audio/aac", fileExtension: "aac" });
588
+ return l.parse({ mediaType: "audio/aac", fileExtension: "aac" });
589
589
  }
590
590
  static get ACSM() {
591
- return c.parse({
591
+ return l.parse({
592
592
  mediaType: "application/vnd.adobe.adept+xml",
593
593
  name: "Adobe Content Server Message",
594
594
  fileExtension: "acsm"
595
595
  });
596
596
  }
597
597
  static get AIFF() {
598
- return c.parse({ mediaType: "audio/aiff", fileExtension: "aiff" });
598
+ return l.parse({ mediaType: "audio/aiff", fileExtension: "aiff" });
599
599
  }
600
600
  static get AVI() {
601
- return c.parse({
601
+ return l.parse({
602
602
  mediaType: "video/x-msvideo",
603
603
  fileExtension: "avi"
604
604
  });
605
605
  }
606
606
  static get AVIF() {
607
- return c.parse({ mediaType: "image/avif", fileExtension: "avif" });
607
+ return l.parse({ mediaType: "image/avif", fileExtension: "avif" });
608
608
  }
609
609
  static get BINARY() {
610
- return c.parse({ mediaType: "application/octet-stream" });
610
+ return l.parse({ mediaType: "application/octet-stream" });
611
611
  }
612
612
  static get BMP() {
613
- return c.parse({ mediaType: "image/bmp", fileExtension: "bmp" });
613
+ return l.parse({ mediaType: "image/bmp", fileExtension: "bmp" });
614
614
  }
615
615
  static get CBZ() {
616
- return c.parse({
616
+ return l.parse({
617
617
  mediaType: "application/vnd.comicbook+zip",
618
618
  name: "Comic Book Archive",
619
619
  fileExtension: "cbz"
620
620
  });
621
621
  }
622
622
  static get CSS() {
623
- return c.parse({ mediaType: "text/css", fileExtension: "css" });
623
+ return l.parse({ mediaType: "text/css", fileExtension: "css" });
624
624
  }
625
625
  static get DIVINA() {
626
- return c.parse({
626
+ return l.parse({
627
627
  mediaType: "application/divina+zip",
628
628
  name: "Digital Visual Narratives",
629
629
  fileExtension: "divina"
630
630
  });
631
631
  }
632
632
  static get DIVINA_MANIFEST() {
633
- return c.parse({
633
+ return l.parse({
634
634
  mediaType: "application/divina+json",
635
635
  name: "Digital Visual Narratives",
636
636
  fileExtension: "json"
637
637
  });
638
638
  }
639
639
  static get EPUB() {
640
- return c.parse({
640
+ return l.parse({
641
641
  mediaType: "application/epub+zip",
642
642
  name: "EPUB",
643
643
  fileExtension: "epub"
644
644
  });
645
645
  }
646
646
  static get GIF() {
647
- return c.parse({ mediaType: "image/gif", fileExtension: "gif" });
647
+ return l.parse({ mediaType: "image/gif", fileExtension: "gif" });
648
648
  }
649
649
  static get GZ() {
650
- return c.parse({
650
+ return l.parse({
651
651
  mediaType: "application/gzip",
652
652
  fileExtension: "gz"
653
653
  });
654
654
  }
655
655
  static get HTML() {
656
- return c.parse({ mediaType: "text/html", fileExtension: "html" });
656
+ return l.parse({ mediaType: "text/html", fileExtension: "html" });
657
657
  }
658
658
  static get JAVASCRIPT() {
659
- return c.parse({
659
+ return l.parse({
660
660
  mediaType: "text/javascript",
661
661
  fileExtension: "js"
662
662
  });
663
663
  }
664
664
  static get JPEG() {
665
- return c.parse({ mediaType: "image/jpeg", fileExtension: "jpeg" });
665
+ return l.parse({ mediaType: "image/jpeg", fileExtension: "jpeg" });
666
666
  }
667
667
  static get JSON() {
668
- return c.parse({ mediaType: "application/json" });
668
+ return l.parse({ mediaType: "application/json" });
669
669
  }
670
670
  static get LCP_LICENSE_DOCUMENT() {
671
- return c.parse({
671
+ return l.parse({
672
672
  mediaType: "application/vnd.readium.lcp.license.v1.0+json",
673
673
  name: "LCP License",
674
674
  fileExtension: "lcpl"
675
675
  });
676
676
  }
677
677
  static get LCP_PROTECTED_AUDIOBOOK() {
678
- return c.parse({
678
+ return l.parse({
679
679
  mediaType: "application/audiobook+lcp",
680
680
  name: "LCP Protected Audiobook",
681
681
  fileExtension: "lcpa"
682
682
  });
683
683
  }
684
684
  static get LCP_PROTECTED_PDF() {
685
- return c.parse({
685
+ return l.parse({
686
686
  mediaType: "application/pdf+lcp",
687
687
  name: "LCP Protected PDF",
688
688
  fileExtension: "lcpdf"
689
689
  });
690
690
  }
691
691
  static get LCP_STATUS_DOCUMENT() {
692
- return c.parse({
692
+ return l.parse({
693
693
  mediaType: "application/vnd.readium.license.status.v1.0+json"
694
694
  });
695
695
  }
696
696
  static get LPF() {
697
- return c.parse({
697
+ return l.parse({
698
698
  mediaType: "application/lpf+zip",
699
699
  fileExtension: "lpf"
700
700
  });
701
701
  }
702
702
  static get MP3() {
703
- return c.parse({ mediaType: "audio/mpeg", fileExtension: "mp3" });
703
+ return l.parse({ mediaType: "audio/mpeg", fileExtension: "mp3" });
704
704
  }
705
705
  static get MPEG() {
706
- return c.parse({ mediaType: "video/mpeg", fileExtension: "mpeg" });
706
+ return l.parse({ mediaType: "video/mpeg", fileExtension: "mpeg" });
707
707
  }
708
708
  static get NCX() {
709
- return c.parse({
709
+ return l.parse({
710
710
  mediaType: "application/x-dtbncx+xml",
711
711
  fileExtension: "ncx"
712
712
  });
713
713
  }
714
714
  static get OGG() {
715
- return c.parse({ mediaType: "audio/ogg", fileExtension: "oga" });
715
+ return l.parse({ mediaType: "audio/ogg", fileExtension: "oga" });
716
716
  }
717
717
  static get OGV() {
718
- return c.parse({ mediaType: "video/ogg", fileExtension: "ogv" });
718
+ return l.parse({ mediaType: "video/ogg", fileExtension: "ogv" });
719
719
  }
720
720
  static get OPDS1() {
721
- return c.parse({
721
+ return l.parse({
722
722
  mediaType: "application/atom+xml;profile=opds-catalog"
723
723
  });
724
724
  }
725
725
  static get OPDS1_ENTRY() {
726
- return c.parse({
726
+ return l.parse({
727
727
  mediaType: "application/atom+xml;type=entry;profile=opds-catalog"
728
728
  });
729
729
  }
730
730
  static get OPDS2() {
731
- return c.parse({ mediaType: "application/opds+json" });
731
+ return l.parse({ mediaType: "application/opds+json" });
732
732
  }
733
733
  static get OPDS2_PUBLICATION() {
734
- return c.parse({ mediaType: "application/opds-publication+json" });
734
+ return l.parse({ mediaType: "application/opds-publication+json" });
735
735
  }
736
736
  static get OPDS_AUTHENTICATION() {
737
- return c.parse({
737
+ return l.parse({
738
738
  mediaType: "application/opds-authentication+json"
739
739
  });
740
740
  }
741
741
  static get OPUS() {
742
- return c.parse({ mediaType: "audio/opus", fileExtension: "opus" });
742
+ return l.parse({ mediaType: "audio/opus", fileExtension: "opus" });
743
743
  }
744
744
  static get OTF() {
745
- return c.parse({ mediaType: "font/otf", fileExtension: "otf" });
745
+ return l.parse({ mediaType: "font/otf", fileExtension: "otf" });
746
746
  }
747
747
  static get PDF() {
748
- return c.parse({
748
+ return l.parse({
749
749
  mediaType: "application/pdf",
750
750
  name: "PDF",
751
751
  fileExtension: "pdf"
752
752
  });
753
753
  }
754
754
  static get PNG() {
755
- return c.parse({ mediaType: "image/png", fileExtension: "png" });
755
+ return l.parse({ mediaType: "image/png", fileExtension: "png" });
756
756
  }
757
757
  static get READIUM_AUDIOBOOK() {
758
- return c.parse({
758
+ return l.parse({
759
759
  mediaType: "application/audiobook+zip",
760
760
  name: "Readium Audiobook",
761
761
  fileExtension: "audiobook"
762
762
  });
763
763
  }
764
764
  static get READIUM_AUDIOBOOK_MANIFEST() {
765
- return c.parse({
765
+ return l.parse({
766
766
  mediaType: "application/audiobook+json",
767
767
  name: "Readium Audiobook",
768
768
  fileExtension: "json"
769
769
  });
770
770
  }
771
771
  static get READIUM_CONTENT_DOCUMENT() {
772
- return c.parse({
772
+ return l.parse({
773
773
  mediaType: "application/vnd.readium.content+json",
774
774
  name: "Readium Content Document",
775
775
  fileExtension: "json"
776
776
  });
777
777
  }
778
778
  static get READIUM_GUIDED_NAVIGATION_DOCUMENT() {
779
- return c.parse({
779
+ return l.parse({
780
780
  mediaType: "application/guided-navigation+json",
781
781
  name: "Readium Guided Navigation Document",
782
782
  fileExtension: "json"
783
783
  });
784
784
  }
785
785
  static get READIUM_POSITION_LIST() {
786
- return c.parse({
786
+ return l.parse({
787
787
  mediaType: "application/vnd.readium.position-list+json",
788
788
  name: "Readium Position List",
789
789
  fileExtension: "json"
790
790
  });
791
791
  }
792
792
  static get READIUM_WEBPUB() {
793
- return c.parse({
793
+ return l.parse({
794
794
  mediaType: "application/webpub+zip",
795
795
  name: "Readium Web Publication",
796
796
  fileExtension: "webpub"
797
797
  });
798
798
  }
799
799
  static get READIUM_WEBPUB_MANIFEST() {
800
- return c.parse({
800
+ return l.parse({
801
801
  mediaType: "application/webpub+json",
802
802
  name: "Readium Web Publication",
803
803
  fileExtension: "json"
804
804
  });
805
805
  }
806
806
  static get SMIL() {
807
- return c.parse({
807
+ return l.parse({
808
808
  mediaType: "application/smil+xml",
809
809
  fileExtension: "smil"
810
810
  });
811
811
  }
812
812
  static get SVG() {
813
- return c.parse({
813
+ return l.parse({
814
814
  mediaType: "image/svg+xml",
815
815
  fileExtension: "svg"
816
816
  });
817
817
  }
818
818
  static get TEXT() {
819
- return c.parse({ mediaType: "text/plain", fileExtension: "txt" });
819
+ return l.parse({ mediaType: "text/plain", fileExtension: "txt" });
820
820
  }
821
821
  static get TIFF() {
822
- return c.parse({ mediaType: "image/tiff", fileExtension: "tiff" });
822
+ return l.parse({ mediaType: "image/tiff", fileExtension: "tiff" });
823
823
  }
824
824
  static get TTF() {
825
- return c.parse({ mediaType: "font/ttf", fileExtension: "ttf" });
825
+ return l.parse({ mediaType: "font/ttf", fileExtension: "ttf" });
826
826
  }
827
827
  static get W3C_WPUB_MANIFEST() {
828
- return c.parse({
828
+ return l.parse({
829
829
  mediaType: "application/x.readium.w3c.wpub+json",
830
830
  name: "Web Publication",
831
831
  fileExtension: "json"
832
832
  });
833
833
  }
834
834
  static get WAV() {
835
- return c.parse({ mediaType: "audio/wav", fileExtension: "wav" });
835
+ return l.parse({ mediaType: "audio/wav", fileExtension: "wav" });
836
836
  }
837
837
  static get WEBM_AUDIO() {
838
- return c.parse({ mediaType: "audio/webm", fileExtension: "webm" });
838
+ return l.parse({ mediaType: "audio/webm", fileExtension: "webm" });
839
839
  }
840
840
  static get WEBM_VIDEO() {
841
- return c.parse({ mediaType: "video/webm", fileExtension: "webm" });
841
+ return l.parse({ mediaType: "video/webm", fileExtension: "webm" });
842
842
  }
843
843
  static get WEBP() {
844
- return c.parse({ mediaType: "image/webp", fileExtension: "webp" });
844
+ return l.parse({ mediaType: "image/webp", fileExtension: "webp" });
845
845
  }
846
846
  static get WOFF() {
847
- return c.parse({ mediaType: "font/woff", fileExtension: "woff" });
847
+ return l.parse({ mediaType: "font/woff", fileExtension: "woff" });
848
848
  }
849
849
  static get WOFF2() {
850
- return c.parse({ mediaType: "font/woff2", fileExtension: "woff2" });
850
+ return l.parse({ mediaType: "font/woff2", fileExtension: "woff2" });
851
851
  }
852
852
  static get XHTML() {
853
- return c.parse({
853
+ return l.parse({
854
854
  mediaType: "application/xhtml+xml",
855
855
  fileExtension: "xhtml"
856
856
  });
857
857
  }
858
858
  static get XML() {
859
- return c.parse({
859
+ return l.parse({
860
860
  mediaType: "application/xml",
861
861
  fileExtension: "xml"
862
862
  });
863
863
  }
864
864
  static get ZAB() {
865
- return c.parse({
865
+ return l.parse({
866
866
  mediaType: "application/x.readium.zab+zip",
867
867
  name: "Zipped Audio Book",
868
868
  fileExtension: "zab"
869
869
  });
870
870
  }
871
871
  static get ZIP() {
872
- return c.parse({
872
+ return l.parse({
873
873
  mediaType: "application/zip",
874
874
  fileExtension: "zip"
875
875
  });
@@ -893,11 +893,11 @@ class se {
893
893
  * See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
894
894
  */
895
895
  expand(t) {
896
- const e = (s) => s.split(",").map((n) => {
897
- const o = t[n];
896
+ const e = (s) => s.split(",").map((r) => {
897
+ const o = t[r];
898
898
  return o ? encodeURIComponent(o) : "";
899
- }).join(","), i = (s) => "?" + s.split(",").map((n) => {
900
- const o = n.split("=")[0], a = t[o];
899
+ }).join(","), i = (s) => "?" + s.split(",").map((r) => {
900
+ const o = r.split("=")[0], a = t[o];
901
901
  return a ? `${o}=${encodeURIComponent(a)}` : "";
902
902
  }).join("&");
903
903
  return this.uri.replace(/\{(\??)([^}]+)\}/g, (...s) => s[1] ? i(s[2]) : e(s[2]));
@@ -915,21 +915,21 @@ class C {
915
915
  */
916
916
  static deserialize(t) {
917
917
  if (!t) return;
918
- const e = ht(t.progression), i = ht(t.totalProgression), s = ht(t.position), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
918
+ const e = ht(t.progression), i = ht(t.totalProgression), s = ht(t.position), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
919
919
  "fragment",
920
920
  "fragments",
921
921
  "progression",
922
922
  "totalProgression",
923
923
  "position"
924
924
  ]);
925
- return Object.entries(t).forEach(([a, l]) => {
926
- o.has(a) || n.set(a, l);
925
+ return Object.entries(t).forEach(([a, c]) => {
926
+ o.has(a) || r.set(a, c);
927
927
  }), new C({
928
928
  fragments: Ce(t.fragments || t.fragment),
929
929
  progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
930
930
  totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
931
931
  position: s !== void 0 && s > 0 ? s : void 0,
932
- otherLocations: n.size === 0 ? void 0 : n
932
+ otherLocations: r.size === 0 ? void 0 : r
933
933
  });
934
934
  }
935
935
  /**
@@ -1044,7 +1044,7 @@ class q {
1044
1044
  }
1045
1045
  /** MediaType of the linked resource. */
1046
1046
  get mediaType() {
1047
- return this.type !== void 0 ? c.parse({ mediaType: this.type }) : c.BINARY;
1047
+ return this.type !== void 0 ? l.parse({ mediaType: this.type }) : l.BINARY;
1048
1048
  }
1049
1049
  /** Computes an absolute URL to the link, relative to the given `baseURL`.
1050
1050
  * If the link's `href` is already absolute, the `baseURL` is ignored.
@@ -1257,33 +1257,33 @@ C.prototype.getDomRange = function() {
1257
1257
  };
1258
1258
  C.prototype.fragmentParameters = function() {
1259
1259
  return new Map(
1260
- this.fragments.map((r) => r.startsWith("#") ? r.slice(1) : r).join("&").split("&").filter((r) => !r.startsWith("#")).map((r) => r.split("=")).filter((r) => r.length === 2).map((r) => [
1261
- r[0].trim().toLowerCase(),
1262
- r[1].trim()
1260
+ this.fragments.map((n) => n.startsWith("#") ? n.slice(1) : n).join("&").split("&").filter((n) => !n.startsWith("#")).map((n) => n.split("=")).filter((n) => n.length === 2).map((n) => [
1261
+ n[0].trim().toLowerCase(),
1262
+ n[1].trim()
1263
1263
  ])
1264
1264
  );
1265
1265
  };
1266
1266
  C.prototype.htmlId = function() {
1267
1267
  if (!this.fragments.length) return;
1268
- let r = this.fragments.find((t) => t.length && !t.includes("="));
1269
- if (!r) {
1268
+ let n = this.fragments.find((t) => t.length && !t.includes("="));
1269
+ if (!n) {
1270
1270
  const t = this.fragmentParameters();
1271
- t.has("id") ? r = t.get("id") : t.has("name") && (r = t.get("name"));
1271
+ t.has("id") ? n = t.get("id") : t.has("name") && (n = t.get("name"));
1272
1272
  }
1273
- return r?.startsWith("#") ? r.slice(1) : r;
1273
+ return n?.startsWith("#") ? n.slice(1) : n;
1274
1274
  };
1275
1275
  C.prototype.page = function() {
1276
- const r = parseInt(this.fragmentParameters().get("page"));
1277
- if (!isNaN(r) && r >= 0) return r;
1276
+ const n = parseInt(this.fragmentParameters().get("page"));
1277
+ if (!isNaN(n) && n >= 0) return n;
1278
1278
  };
1279
1279
  C.prototype.time = function() {
1280
- const r = parseInt(this.fragmentParameters().get("t"));
1281
- if (!isNaN(r)) return r;
1280
+ const n = parseInt(this.fragmentParameters().get("t"));
1281
+ if (!isNaN(n)) return n;
1282
1282
  };
1283
1283
  C.prototype.space = function() {
1284
- const r = this.fragmentParameters();
1285
- if (!r.has("xywh")) return;
1286
- const t = r.get("xywh").split(",").map((e) => parseInt(e));
1284
+ const n = this.fragmentParameters();
1285
+ if (!n.has("xywh")) return;
1286
+ const t = n.get("xywh").split(",").map((e) => parseInt(e));
1287
1287
  if (t.length === 4 && !t.some(isNaN))
1288
1288
  return t;
1289
1289
  };
@@ -1415,9 +1415,9 @@ R.prototype.getPrice = function() {
1415
1415
  return Ut.deserialize(this.otherProperties.price);
1416
1416
  };
1417
1417
  R.prototype.getIndirectAcquisitions = function() {
1418
- const r = this.otherProperties.indirectAcquisition;
1419
- if (r && Array.isArray(r))
1420
- return r.map((t) => Q.deserialize(t)).filter((t) => t !== void 0);
1418
+ const n = this.otherProperties.indirectAcquisition;
1419
+ if (n && Array.isArray(n))
1420
+ return n.map((t) => Q.deserialize(t)).filter((t) => t !== void 0);
1421
1421
  };
1422
1422
  R.prototype.getHolds = function() {
1423
1423
  return Bt.deserialize(this.otherProperties.holds);
@@ -1432,29 +1432,29 @@ R.prototype.getAuthenticate = function() {
1432
1432
  return q.deserialize(this.otherProperties.authenticate);
1433
1433
  };
1434
1434
  const Ge = "CssSelectorGenerator";
1435
- function ne(r = "unknown problem", ...t) {
1436
- console.warn(`${Ge}: ${r}`, ...t);
1435
+ function re(n = "unknown problem", ...t) {
1436
+ console.warn(`${Ge}: ${n}`, ...t);
1437
1437
  }
1438
- function $e(r) {
1439
- return r instanceof RegExp;
1438
+ function $e(n) {
1439
+ return n instanceof RegExp;
1440
1440
  }
1441
- function Ye(r) {
1442
- return r.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
1441
+ function Ye(n) {
1442
+ return n.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
1443
1443
  }
1444
- function qe(r) {
1445
- const t = r.map((e) => {
1444
+ function qe(n) {
1445
+ const t = n.map((e) => {
1446
1446
  if ($e(e))
1447
1447
  return (i) => e.test(i);
1448
1448
  if (typeof e == "function")
1449
1449
  return (i) => {
1450
1450
  const s = e(i);
1451
- return typeof s != "boolean" ? (ne("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : s;
1451
+ return typeof s != "boolean" ? (re("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : s;
1452
1452
  };
1453
1453
  if (typeof e == "string") {
1454
1454
  const i = new RegExp("^" + Ye(e) + "$");
1455
1455
  return (s) => i.test(s);
1456
1456
  }
1457
- return ne("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
1457
+ return re("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
1458
1458
  });
1459
1459
  return (e) => t.some((i) => i(e));
1460
1460
  }
@@ -1466,50 +1466,50 @@ qe([
1466
1466
  ]);
1467
1467
  class K {
1468
1468
  }
1469
- function re(r) {
1470
- return r.split("").reverse().join("");
1469
+ function ne(n) {
1470
+ return n.split("").reverse().join("");
1471
1471
  }
1472
- function Xe(r, t, e) {
1473
- const i = re(t);
1472
+ function Xe(n, t, e) {
1473
+ const i = ne(t);
1474
1474
  return e.map((s) => {
1475
- const n = Math.max(0, s.end - t.length - s.errors), o = re(r.slice(n, s.end));
1475
+ const r = Math.max(0, s.end - t.length - s.errors), o = ne(n.slice(r, s.end));
1476
1476
  return {
1477
- start: xe(o, i, s.errors).reduce((l, u) => s.end - u.end < l ? s.end - u.end : l, s.end),
1477
+ start: xe(o, i, s.errors).reduce((c, u) => s.end - u.end < c ? s.end - u.end : c, s.end),
1478
1478
  end: s.end,
1479
1479
  errors: s.errors
1480
1480
  };
1481
1481
  });
1482
1482
  }
1483
- function vt(r) {
1484
- return (r | -r) >> 31 & 1;
1483
+ function vt(n) {
1484
+ return (n | -n) >> 31 & 1;
1485
1485
  }
1486
- function oe(r, t, e, i) {
1487
- let s = r.P[e], n = r.M[e];
1488
- const o = i >>> 31, a = t[e] | o, l = a | n, u = (a & s) + s ^ s | a;
1489
- let d = n | ~(u | s), f = s & u;
1490
- const p = vt(d & r.lastRowMask[e]) - vt(f & r.lastRowMask[e]);
1491
- return d <<= 1, f <<= 1, f |= o, d |= vt(i) - o, s = f | ~(l | d), n = d & l, r.P[e] = s, r.M[e] = n, p;
1486
+ function oe(n, t, e, i) {
1487
+ let s = n.P[e], r = n.M[e];
1488
+ const o = i >>> 31, a = t[e] | o, c = a | r, u = (a & s) + s ^ s | a;
1489
+ let d = r | ~(u | s), f = s & u;
1490
+ const p = vt(d & n.lastRowMask[e]) - vt(f & n.lastRowMask[e]);
1491
+ return d <<= 1, f <<= 1, f |= o, d |= vt(i) - o, s = f | ~(c | d), r = d & c, n.P[e] = s, n.M[e] = r, p;
1492
1492
  }
1493
- function xe(r, t, e) {
1493
+ function xe(n, t, e) {
1494
1494
  if (t.length === 0)
1495
1495
  return [];
1496
1496
  e = Math.min(e, t.length);
1497
- const i = [], s = 32, n = Math.ceil(t.length / s) - 1, o = {
1498
- P: new Uint32Array(n + 1),
1499
- M: new Uint32Array(n + 1),
1500
- lastRowMask: new Uint32Array(n + 1)
1497
+ const i = [], s = 32, r = Math.ceil(t.length / s) - 1, o = {
1498
+ P: new Uint32Array(r + 1),
1499
+ M: new Uint32Array(r + 1),
1500
+ lastRowMask: new Uint32Array(r + 1)
1501
1501
  };
1502
- o.lastRowMask.fill(1 << 31), o.lastRowMask[n] = 1 << (t.length - 1) % s;
1503
- const a = new Uint32Array(n + 1), l = /* @__PURE__ */ new Map(), u = [];
1502
+ o.lastRowMask.fill(1 << 31), o.lastRowMask[r] = 1 << (t.length - 1) % s;
1503
+ const a = new Uint32Array(r + 1), c = /* @__PURE__ */ new Map(), u = [];
1504
1504
  for (let p = 0; p < 256; p++)
1505
1505
  u.push(a);
1506
1506
  for (let p = 0; p < t.length; p += 1) {
1507
1507
  const v = t.charCodeAt(p);
1508
- if (l.has(v))
1508
+ if (c.has(v))
1509
1509
  continue;
1510
- const g = new Uint32Array(n + 1);
1511
- l.set(v, g), v < u.length && (u[v] = g);
1512
- for (let m = 0; m <= n; m += 1) {
1510
+ const g = new Uint32Array(r + 1);
1511
+ c.set(v, g), v < u.length && (u[v] = g);
1512
+ for (let m = 0; m <= r; m += 1) {
1513
1513
  g[m] = 0;
1514
1514
  for (let b = 0; b < s; b += 1) {
1515
1515
  const D = m * s + b;
@@ -1520,23 +1520,23 @@ function xe(r, t, e) {
1520
1520
  }
1521
1521
  }
1522
1522
  let d = Math.max(0, Math.ceil(e / s) - 1);
1523
- const f = new Uint32Array(n + 1);
1523
+ const f = new Uint32Array(r + 1);
1524
1524
  for (let p = 0; p <= d; p += 1)
1525
1525
  f[p] = (p + 1) * s;
1526
- f[n] = t.length;
1526
+ f[r] = t.length;
1527
1527
  for (let p = 0; p <= d; p += 1)
1528
1528
  o.P[p] = -1, o.M[p] = 0;
1529
- for (let p = 0; p < r.length; p += 1) {
1530
- const v = r.charCodeAt(p);
1529
+ for (let p = 0; p < n.length; p += 1) {
1530
+ const v = n.charCodeAt(p);
1531
1531
  let g;
1532
- v < u.length ? g = u[v] : (g = l.get(v), typeof g > "u" && (g = a));
1532
+ v < u.length ? g = u[v] : (g = c.get(v), typeof g > "u" && (g = a));
1533
1533
  let m = 0;
1534
1534
  for (let b = 0; b <= d; b += 1)
1535
1535
  m = oe(o, g, b, m), f[b] += m;
1536
- if (f[d] - m <= e && d < n && (g[d + 1] & 1 || m < 0)) {
1536
+ if (f[d] - m <= e && d < r && (g[d + 1] & 1 || m < 0)) {
1537
1537
  d += 1, o.P[d] = -1, o.M[d] = 0;
1538
1538
  let b;
1539
- if (d === n) {
1539
+ if (d === r) {
1540
1540
  const D = t.length % s;
1541
1541
  b = D === 0 ? s : D;
1542
1542
  } else
@@ -1545,7 +1545,7 @@ function xe(r, t, e) {
1545
1545
  } else
1546
1546
  for (; d > 0 && f[d] >= e + s; )
1547
1547
  d -= 1;
1548
- d === n && f[d] <= e && (f[d] < e && i.splice(0, i.length), i.push({
1548
+ d === r && f[d] <= e && (f[d] < e && i.splice(0, i.length), i.push({
1549
1549
  start: -1,
1550
1550
  end: p + 1,
1551
1551
  errors: f[d]
@@ -1553,149 +1553,149 @@ function xe(r, t, e) {
1553
1553
  }
1554
1554
  return i;
1555
1555
  }
1556
- function Ke(r, t, e) {
1557
- const i = xe(r, t, e);
1558
- return Xe(r, t, i);
1556
+ function Ke(n, t, e) {
1557
+ const i = xe(n, t, e);
1558
+ return Xe(n, t, i);
1559
1559
  }
1560
- function Te(r, t, e) {
1560
+ function Te(n, t, e) {
1561
1561
  let i = 0;
1562
1562
  const s = [];
1563
1563
  for (; i !== -1; )
1564
- i = r.indexOf(t, i), i !== -1 && (s.push({
1564
+ i = n.indexOf(t, i), i !== -1 && (s.push({
1565
1565
  start: i,
1566
1566
  end: i + t.length,
1567
1567
  errors: 0
1568
1568
  }), i += 1);
1569
- return s.length > 0 ? s : Ke(r, t, e);
1569
+ return s.length > 0 ? s : Ke(n, t, e);
1570
1570
  }
1571
- function ae(r, t) {
1572
- return t.length === 0 || r.length === 0 ? 0 : 1 - Te(r, t, t.length)[0].errors / t.length;
1571
+ function ae(n, t) {
1572
+ return t.length === 0 || n.length === 0 ? 0 : 1 - Te(n, t, t.length)[0].errors / t.length;
1573
1573
  }
1574
- function Ze(r, t, e = {}) {
1574
+ function Ze(n, t, e = {}) {
1575
1575
  if (t.length === 0)
1576
1576
  return null;
1577
- const i = Math.min(256, t.length / 2), s = Te(r, t, i);
1577
+ const i = Math.min(256, t.length / 2), s = Te(n, t, i);
1578
1578
  if (s.length === 0)
1579
1579
  return null;
1580
- const n = (a) => {
1580
+ const r = (a) => {
1581
1581
  const p = 1 - a.errors / t.length, v = e.prefix ? ae(
1582
- r.slice(
1582
+ n.slice(
1583
1583
  Math.max(0, a.start - e.prefix.length),
1584
1584
  a.start
1585
1585
  ),
1586
1586
  e.prefix
1587
1587
  ) : 1, g = e.suffix ? ae(
1588
- r.slice(a.end, a.end + e.suffix.length),
1588
+ n.slice(a.end, a.end + e.suffix.length),
1589
1589
  e.suffix
1590
1590
  ) : 1;
1591
1591
  let m = 1;
1592
- return typeof e.hint == "number" && (m = 1 - Math.abs(a.start - e.hint) / r.length), (50 * p + 20 * v + 20 * g + 2 * m) / 92;
1592
+ return typeof e.hint == "number" && (m = 1 - Math.abs(a.start - e.hint) / n.length), (50 * p + 20 * v + 20 * g + 2 * m) / 92;
1593
1593
  }, o = s.map((a) => ({
1594
1594
  start: a.start,
1595
1595
  end: a.end,
1596
- score: n(a)
1596
+ score: r(a)
1597
1597
  }));
1598
- return o.sort((a, l) => l.score - a.score), o[0];
1598
+ return o.sort((a, c) => c.score - a.score), o[0];
1599
1599
  }
1600
- function At(r, t, e) {
1600
+ function At(n, t, e) {
1601
1601
  const i = e === 1 ? t : t - 1;
1602
- if (r.charAt(i).trim() !== "")
1602
+ if (n.charAt(i).trim() !== "")
1603
1603
  return t;
1604
- let s, n;
1605
- if (e === 2 ? (s = r.substring(0, t), n = s.trimEnd()) : (s = r.substring(t), n = s.trimStart()), !n.length)
1604
+ let s, r;
1605
+ if (e === 2 ? (s = n.substring(0, t), r = s.trimEnd()) : (s = n.substring(t), r = s.trimStart()), !r.length)
1606
1606
  return -1;
1607
- const o = s.length - n.length;
1607
+ const o = s.length - r.length;
1608
1608
  return e === 2 ? t - o : t + o;
1609
1609
  }
1610
- function le(r, t) {
1611
- const e = r.commonAncestorContainer.ownerDocument.createNodeIterator(
1612
- r.commonAncestorContainer,
1610
+ function le(n, t) {
1611
+ const e = n.commonAncestorContainer.ownerDocument.createNodeIterator(
1612
+ n.commonAncestorContainer,
1613
1613
  NodeFilter.SHOW_TEXT
1614
- ), i = t === 1 ? r.startContainer : r.endContainer, s = t === 1 ? r.endContainer : r.startContainer;
1615
- let n = e.nextNode();
1616
- for (; n && n !== i; )
1617
- n = e.nextNode();
1618
- t === 2 && (n = e.previousNode());
1614
+ ), i = t === 1 ? n.startContainer : n.endContainer, s = t === 1 ? n.endContainer : n.startContainer;
1615
+ let r = e.nextNode();
1616
+ for (; r && r !== i; )
1617
+ r = e.nextNode();
1618
+ t === 2 && (r = e.previousNode());
1619
1619
  let o = -1;
1620
1620
  const a = () => {
1621
- if (n = t === 1 ? e.nextNode() : e.previousNode(), n) {
1622
- const l = n.textContent, u = t === 1 ? 0 : l.length;
1623
- o = At(l, u, t);
1621
+ if (r = t === 1 ? e.nextNode() : e.previousNode(), r) {
1622
+ const c = r.textContent, u = t === 1 ? 0 : c.length;
1623
+ o = At(c, u, t);
1624
1624
  }
1625
1625
  };
1626
- for (; n && o === -1 && n !== s; )
1626
+ for (; r && o === -1 && r !== s; )
1627
1627
  a();
1628
- if (n && o >= 0)
1629
- return { node: n, offset: o };
1628
+ if (r && o >= 0)
1629
+ return { node: r, offset: o };
1630
1630
  throw new RangeError("No text nodes with non-whitespace text found in range");
1631
1631
  }
1632
- function Je(r) {
1633
- if (!r.toString().trim().length)
1632
+ function Je(n) {
1633
+ if (!n.toString().trim().length)
1634
1634
  throw new RangeError("Range contains no non-whitespace text");
1635
- if (r.startContainer.nodeType !== Node.TEXT_NODE)
1635
+ if (n.startContainer.nodeType !== Node.TEXT_NODE)
1636
1636
  throw new RangeError("Range startContainer is not a text node");
1637
- if (r.endContainer.nodeType !== Node.TEXT_NODE)
1637
+ if (n.endContainer.nodeType !== Node.TEXT_NODE)
1638
1638
  throw new RangeError("Range endContainer is not a text node");
1639
- const t = r.cloneRange();
1639
+ const t = n.cloneRange();
1640
1640
  let e = !1, i = !1;
1641
1641
  const s = {
1642
1642
  start: At(
1643
- r.startContainer.textContent,
1644
- r.startOffset,
1643
+ n.startContainer.textContent,
1644
+ n.startOffset,
1645
1645
  1
1646
1646
  /* Forwards */
1647
1647
  ),
1648
1648
  end: At(
1649
- r.endContainer.textContent,
1650
- r.endOffset,
1649
+ n.endContainer.textContent,
1650
+ n.endOffset,
1651
1651
  2
1652
1652
  /* Backwards */
1653
1653
  )
1654
1654
  };
1655
- if (s.start >= 0 && (t.setStart(r.startContainer, s.start), e = !0), s.end > 0 && (t.setEnd(r.endContainer, s.end), i = !0), e && i)
1655
+ if (s.start >= 0 && (t.setStart(n.startContainer, s.start), e = !0), s.end > 0 && (t.setEnd(n.endContainer, s.end), i = !0), e && i)
1656
1656
  return t;
1657
1657
  if (!e) {
1658
- const { node: n, offset: o } = le(
1658
+ const { node: r, offset: o } = le(
1659
1659
  t,
1660
1660
  1
1661
1661
  /* Forwards */
1662
1662
  );
1663
- n && o >= 0 && t.setStart(n, o);
1663
+ r && o >= 0 && t.setStart(r, o);
1664
1664
  }
1665
1665
  if (!i) {
1666
- const { node: n, offset: o } = le(
1666
+ const { node: r, offset: o } = le(
1667
1667
  t,
1668
1668
  2
1669
1669
  /* Backwards */
1670
1670
  );
1671
- n && o > 0 && t.setEnd(n, o);
1671
+ r && o > 0 && t.setEnd(r, o);
1672
1672
  }
1673
1673
  return t;
1674
1674
  }
1675
- function Pe(r) {
1676
- switch (r.nodeType) {
1675
+ function Pe(n) {
1676
+ switch (n.nodeType) {
1677
1677
  case Node.ELEMENT_NODE:
1678
1678
  case Node.TEXT_NODE:
1679
- return r.textContent?.length ?? 0;
1679
+ return n.textContent?.length ?? 0;
1680
1680
  default:
1681
1681
  return 0;
1682
1682
  }
1683
1683
  }
1684
- function ce(r) {
1685
- let t = r.previousSibling, e = 0;
1684
+ function ce(n) {
1685
+ let t = n.previousSibling, e = 0;
1686
1686
  for (; t; )
1687
1687
  e += Pe(t), t = t.previousSibling;
1688
1688
  return e;
1689
1689
  }
1690
- function Ne(r, ...t) {
1690
+ function Ne(n, ...t) {
1691
1691
  let e = t.shift();
1692
- const i = r.ownerDocument.createNodeIterator(
1693
- r,
1692
+ const i = n.ownerDocument.createNodeIterator(
1693
+ n,
1694
1694
  NodeFilter.SHOW_TEXT
1695
1695
  ), s = [];
1696
- let n = i.nextNode(), o, a = 0;
1697
- for (; e !== void 0 && n; )
1698
- o = n, a + o.data.length > e ? (s.push({ node: o, offset: e - a }), e = t.shift()) : (n = i.nextNode(), a += o.data.length);
1696
+ let r = i.nextNode(), o, a = 0;
1697
+ for (; e !== void 0 && r; )
1698
+ o = r, a + o.data.length > e ? (s.push({ node: o, offset: e - a }), e = t.shift()) : (r = i.nextNode(), a += o.data.length);
1699
1699
  for (; e !== void 0 && o && a === e; )
1700
1700
  s.push({ node: o, offset: o.data.length }), e = t.shift();
1701
1701
  if (e !== void 0)
@@ -1749,10 +1749,10 @@ class M {
1749
1749
  NodeFilter.SHOW_TEXT
1750
1750
  );
1751
1751
  i.currentNode = this.element;
1752
- const s = t.direction === 1, n = s ? i.nextNode() : i.previousNode();
1753
- if (!n)
1752
+ const s = t.direction === 1, r = s ? i.nextNode() : i.previousNode();
1753
+ if (!r)
1754
1754
  throw e;
1755
- return { node: n, offset: s ? 0 : n.data.length };
1755
+ return { node: r, offset: s ? 0 : r.data.length };
1756
1756
  } else
1757
1757
  throw e;
1758
1758
  }
@@ -1907,9 +1907,9 @@ class mt {
1907
1907
  * Will throw if `range` does not contain any text nodes.
1908
1908
  */
1909
1909
  static fromRange(t, e) {
1910
- const i = t.textContent, s = B.fromRange(e).relativeTo(t), n = s.start.offset, o = s.end.offset, a = 32;
1911
- return new mt(t, i.slice(n, o), {
1912
- prefix: i.slice(Math.max(0, n - a), n),
1910
+ const i = t.textContent, s = B.fromRange(e).relativeTo(t), r = s.start.offset, o = s.end.offset, a = 32;
1911
+ return new mt(t, i.slice(r, o), {
1912
+ prefix: i.slice(Math.max(0, r - a), r),
1913
1913
  suffix: i.slice(o, Math.min(i.length, o + a))
1914
1914
  });
1915
1915
  }
@@ -1938,36 +1938,36 @@ class mt {
1938
1938
  return new pt(this.root, i.start, i.end);
1939
1939
  }
1940
1940
  }
1941
- function Qe(r) {
1942
- const t = r.tagName.toUpperCase();
1941
+ function Qe(n) {
1942
+ const t = n.tagName.toUpperCase();
1943
1943
  return t === "IMG" || t === "VIDEO" || t === "AUDIO" || t === "IFRAME" || t === "OBJECT" || t === "EMBED" || t === "CANVAS";
1944
1944
  }
1945
- function nt(r, t) {
1945
+ function rt(n, t) {
1946
1946
  try {
1947
1947
  const e = t.locations, i = t.text;
1948
1948
  if (i && i.highlight) {
1949
1949
  let s;
1950
- e && e.getCssSelector() && (s = r.querySelector(e.getCssSelector())), s || (s = r.body);
1951
- const n = new mt(s, i.highlight, {
1950
+ e && e.getCssSelector() && (s = n.querySelector(e.getCssSelector())), s || (s = n.body);
1951
+ const r = new mt(s, i.highlight, {
1952
1952
  prefix: i.before,
1953
1953
  suffix: i.after
1954
1954
  });
1955
1955
  try {
1956
- return n.toRange();
1956
+ return r.toRange();
1957
1957
  } catch {
1958
- return console.warn("Quote not found:", n), null;
1958
+ return console.warn("Quote not found:", r), null;
1959
1959
  }
1960
1960
  }
1961
1961
  if (e) {
1962
1962
  let s = null;
1963
- if (!s && e.getCssSelector() && (s = r.querySelector(e.getCssSelector())), !s && e.fragments) {
1964
- for (const n of e.fragments)
1965
- if (s = r.getElementById(n), s)
1963
+ if (!s && e.getCssSelector() && (s = n.querySelector(e.getCssSelector())), !s && e.fragments) {
1964
+ for (const r of e.fragments)
1965
+ if (s = n.getElementById(r), s)
1966
1966
  break;
1967
1967
  }
1968
1968
  if (s) {
1969
- const n = r.createRange();
1970
- return s.childNodes.length === 0 || Qe(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
1969
+ const r = n.createRange();
1970
+ return s.childNodes.length === 0 || Qe(s) ? (r.selectNode(s), r) : (r.setStartBefore(s), r.setEndAfter(s), r);
1971
1971
  }
1972
1972
  }
1973
1973
  } catch (e) {
@@ -1975,9 +1975,9 @@ function nt(r, t) {
1975
1975
  }
1976
1976
  return null;
1977
1977
  }
1978
- function je(r, t) {
1979
- let e = r.getClientRects();
1980
- e.length || r.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (e = r.commonAncestorContainer.getClientRects());
1978
+ function je(n, t) {
1979
+ let e = n.getClientRects();
1980
+ e.length || n.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (e = n.commonAncestorContainer.getClientRects());
1981
1981
  const i = 1, s = [];
1982
1982
  for (const u of e)
1983
1983
  s.push({
@@ -1988,13 +1988,13 @@ function je(r, t) {
1988
1988
  top: u.top,
1989
1989
  width: u.width
1990
1990
  });
1991
- const n = Le(
1991
+ const r = Le(
1992
1992
  s,
1993
1993
  i
1994
- ), o = ei(n, i), a = Oe(o), l = 4;
1994
+ ), o = ei(r, i), a = Oe(o), c = 4;
1995
1995
  for (let u = a.length - 1; u >= 0; u--) {
1996
1996
  const d = a[u];
1997
- if (!(d.width * d.height > l))
1997
+ if (!(d.width * d.height > c))
1998
1998
  if (a.length > 1)
1999
1999
  a.splice(u, 1);
2000
2000
  else
@@ -2002,86 +2002,86 @@ function je(r, t) {
2002
2002
  }
2003
2003
  return a;
2004
2004
  }
2005
- function Le(r, t, e) {
2006
- for (let i = 0; i < r.length; i++)
2007
- for (let s = i + 1; s < r.length; s++) {
2008
- const n = r[i], o = r[s];
2009
- if (n === o)
2005
+ function Le(n, t, e) {
2006
+ for (let i = 0; i < n.length; i++)
2007
+ for (let s = i + 1; s < n.length; s++) {
2008
+ const r = n[i], o = n[s];
2009
+ if (r === o)
2010
2010
  continue;
2011
- const a = I(n.top, o.top, t) && I(n.bottom, o.bottom, t), l = I(n.left, o.left, t) && I(n.right, o.right, t);
2012
- if (a && !l && Re(n, o, t)) {
2013
- const f = r.filter((v) => v !== n && v !== o), p = ti(n, o);
2011
+ const a = I(r.top, o.top, t) && I(r.bottom, o.bottom, t), c = I(r.left, o.left, t) && I(r.right, o.right, t);
2012
+ if (a && !c && Re(r, o, t)) {
2013
+ const f = n.filter((v) => v !== r && v !== o), p = ti(r, o);
2014
2014
  return f.push(p), Le(
2015
2015
  f,
2016
2016
  t
2017
2017
  );
2018
2018
  }
2019
2019
  }
2020
- return r;
2020
+ return n;
2021
2021
  }
2022
- function ti(r, t) {
2023
- const e = Math.min(r.left, t.left), i = Math.max(r.right, t.right), s = Math.min(r.top, t.top), n = Math.max(r.bottom, t.bottom);
2022
+ function ti(n, t) {
2023
+ const e = Math.min(n.left, t.left), i = Math.max(n.right, t.right), s = Math.min(n.top, t.top), r = Math.max(n.bottom, t.bottom);
2024
2024
  return {
2025
- bottom: n,
2026
- height: n - s,
2025
+ bottom: r,
2026
+ height: r - s,
2027
2027
  left: e,
2028
2028
  right: i,
2029
2029
  top: s,
2030
2030
  width: i - e
2031
2031
  };
2032
2032
  }
2033
- function ei(r, t) {
2034
- const e = new Set(r);
2035
- for (const i of r) {
2033
+ function ei(n, t) {
2034
+ const e = new Set(n);
2035
+ for (const i of n) {
2036
2036
  if (!(i.width > 1 && i.height > 1)) {
2037
2037
  e.delete(i);
2038
2038
  continue;
2039
2039
  }
2040
- for (const n of r)
2041
- if (i !== n && e.has(n) && ii(n, i, t)) {
2040
+ for (const r of n)
2041
+ if (i !== r && e.has(r) && ii(r, i, t)) {
2042
2042
  e.delete(i);
2043
2043
  break;
2044
2044
  }
2045
2045
  }
2046
2046
  return Array.from(e);
2047
2047
  }
2048
- function ii(r, t, e) {
2049
- return at(r, t.left, t.top, e) && at(r, t.right, t.top, e) && at(r, t.left, t.bottom, e) && at(r, t.right, t.bottom, e);
2048
+ function ii(n, t, e) {
2049
+ return at(n, t.left, t.top, e) && at(n, t.right, t.top, e) && at(n, t.left, t.bottom, e) && at(n, t.right, t.bottom, e);
2050
2050
  }
2051
- function at(r, t, e, i) {
2052
- return (r.left < t || I(r.left, t, i)) && (r.right > t || I(r.right, t, i)) && (r.top < e || I(r.top, e, i)) && (r.bottom > e || I(r.bottom, e, i));
2051
+ function at(n, t, e, i) {
2052
+ return (n.left < t || I(n.left, t, i)) && (n.right > t || I(n.right, t, i)) && (n.top < e || I(n.top, e, i)) && (n.bottom > e || I(n.bottom, e, i));
2053
2053
  }
2054
- function Oe(r) {
2055
- for (let t = 0; t < r.length; t++)
2056
- for (let e = t + 1; e < r.length; e++) {
2057
- const i = r[t], s = r[e];
2054
+ function Oe(n) {
2055
+ for (let t = 0; t < n.length; t++)
2056
+ for (let e = t + 1; e < n.length; e++) {
2057
+ const i = n[t], s = n[e];
2058
2058
  if (i !== s && Re(i, s, -1)) {
2059
- let n = [], o;
2059
+ let r = [], o;
2060
2060
  const a = he(i, s);
2061
2061
  if (a.length === 1)
2062
- n = a, o = i;
2062
+ r = a, o = i;
2063
2063
  else {
2064
2064
  const u = he(s, i);
2065
- a.length < u.length ? (n = a, o = i) : (n = u, o = s);
2065
+ a.length < u.length ? (r = a, o = i) : (r = u, o = s);
2066
2066
  }
2067
- const l = r.filter((u) => u !== o);
2068
- return Array.prototype.push.apply(l, n), Oe(l);
2067
+ const c = n.filter((u) => u !== o);
2068
+ return Array.prototype.push.apply(c, r), Oe(c);
2069
2069
  }
2070
2070
  }
2071
- return r;
2071
+ return n;
2072
2072
  }
2073
- function he(r, t) {
2074
- const e = si(t, r);
2073
+ function he(n, t) {
2074
+ const e = si(t, n);
2075
2075
  if (e.height === 0 || e.width === 0)
2076
- return [r];
2076
+ return [n];
2077
2077
  const i = [];
2078
2078
  {
2079
2079
  const s = {
2080
- bottom: r.bottom,
2080
+ bottom: n.bottom,
2081
2081
  height: 0,
2082
- left: r.left,
2082
+ left: n.left,
2083
2083
  right: e.left,
2084
- top: r.top,
2084
+ top: n.top,
2085
2085
  width: 0
2086
2086
  };
2087
2087
  s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
@@ -2092,14 +2092,14 @@ function he(r, t) {
2092
2092
  height: 0,
2093
2093
  left: e.left,
2094
2094
  right: e.right,
2095
- top: r.top,
2095
+ top: n.top,
2096
2096
  width: 0
2097
2097
  };
2098
2098
  s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
2099
2099
  }
2100
2100
  {
2101
2101
  const s = {
2102
- bottom: r.bottom,
2102
+ bottom: n.bottom,
2103
2103
  height: 0,
2104
2104
  left: e.left,
2105
2105
  right: e.right,
@@ -2110,59 +2110,59 @@ function he(r, t) {
2110
2110
  }
2111
2111
  {
2112
2112
  const s = {
2113
- bottom: r.bottom,
2113
+ bottom: n.bottom,
2114
2114
  height: 0,
2115
2115
  left: e.right,
2116
- right: r.right,
2117
- top: r.top,
2116
+ right: n.right,
2117
+ top: n.top,
2118
2118
  width: 0
2119
2119
  };
2120
2120
  s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
2121
2121
  }
2122
2122
  return i;
2123
2123
  }
2124
- function si(r, t) {
2125
- const e = Math.max(r.left, t.left), i = Math.min(r.right, t.right), s = Math.max(r.top, t.top), n = Math.min(r.bottom, t.bottom);
2124
+ function si(n, t) {
2125
+ const e = Math.max(n.left, t.left), i = Math.min(n.right, t.right), s = Math.max(n.top, t.top), r = Math.min(n.bottom, t.bottom);
2126
2126
  return {
2127
- bottom: n,
2128
- height: Math.max(0, n - s),
2127
+ bottom: r,
2128
+ height: Math.max(0, r - s),
2129
2129
  left: e,
2130
2130
  right: i,
2131
2131
  top: s,
2132
2132
  width: Math.max(0, i - e)
2133
2133
  };
2134
2134
  }
2135
- function Re(r, t, e) {
2136
- return (r.left < t.right || e >= 0 && I(r.left, t.right, e)) && (t.left < r.right || e >= 0 && I(t.left, r.right, e)) && (r.top < t.bottom || e >= 0 && I(r.top, t.bottom, e)) && (t.top < r.bottom || e >= 0 && I(t.top, r.bottom, e));
2135
+ function Re(n, t, e) {
2136
+ return (n.left < t.right || e >= 0 && I(n.left, t.right, e)) && (t.left < n.right || e >= 0 && I(t.left, n.right, e)) && (n.top < t.bottom || e >= 0 && I(n.top, t.bottom, e)) && (t.top < n.bottom || e >= 0 && I(t.top, n.bottom, e));
2137
2137
  }
2138
- function I(r, t, e) {
2139
- return Math.abs(r - t) <= e;
2138
+ function I(n, t, e) {
2139
+ return Math.abs(n - t) <= e;
2140
2140
  }
2141
- function Vt(r) {
2142
- const t = {}, e = r.document.documentElement.style;
2143
- for (const i in r.document.documentElement.style)
2141
+ function Vt(n) {
2142
+ const t = {}, e = n.document.documentElement.style;
2143
+ for (const i in n.document.documentElement.style)
2144
2144
  Object.hasOwn(e, i) && !Number.isNaN(Number.parseInt(i)) && (t[e[i]] = e.getPropertyValue(e[i]));
2145
2145
  return t;
2146
2146
  }
2147
- function De(r, t) {
2148
- const e = Vt(r);
2147
+ function De(n, t) {
2148
+ const e = Vt(n);
2149
2149
  Object.keys(e).forEach((i) => {
2150
- t.hasOwnProperty(i) || gt(r, i);
2150
+ t.hasOwnProperty(i) || gt(n, i);
2151
2151
  }), Object.entries(t).forEach(([i, s]) => {
2152
- e[i] !== s && st(r, i, s);
2152
+ e[i] !== s && st(n, i, s);
2153
2153
  });
2154
2154
  }
2155
- function wt(r, t) {
2156
- return r.document.documentElement.style.getPropertyValue(t);
2155
+ function wt(n, t) {
2156
+ return n.document.documentElement.style.getPropertyValue(t);
2157
2157
  }
2158
- function st(r, t, e) {
2159
- r.document.documentElement.style.setProperty(t, e);
2158
+ function st(n, t, e) {
2159
+ n.document.documentElement.style.setProperty(t, e);
2160
2160
  }
2161
- function gt(r, t) {
2162
- r.document.documentElement.style.removeProperty(t);
2161
+ function gt(n, t) {
2162
+ n.document.documentElement.style.removeProperty(t);
2163
2163
  }
2164
2164
  let lt = null, St = null, J = 0;
2165
- const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(), ni = () => {
2165
+ const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(), ri = () => {
2166
2166
  if (!lt)
2167
2167
  if (typeof OffscreenCanvas < "u")
2168
2168
  lt = new OffscreenCanvas(5, 5), St = lt.getContext("2d", {
@@ -2170,16 +2170,16 @@ const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(), ni =
2170
2170
  desynchronized: !0
2171
2171
  });
2172
2172
  else {
2173
- const r = document.createElement("canvas");
2174
- r.width = 5, r.height = 5, lt = r, St = r.getContext("2d", {
2173
+ const n = document.createElement("canvas");
2174
+ n.width = 5, n.height = 5, lt = n, St = n.getContext("2d", {
2175
2175
  willReadFrequently: !0,
2176
2176
  desynchronized: !0
2177
2177
  });
2178
2178
  }
2179
2179
  return St;
2180
- }, ri = (r) => {
2181
- if (!r) return !0;
2182
- const t = r.trim().toLowerCase();
2180
+ }, ni = (n) => {
2181
+ if (!n) return !0;
2182
+ const t = n.trim().toLowerCase();
2183
2183
  return t.startsWith("var(") || [
2184
2184
  "transparent",
2185
2185
  "currentcolor",
@@ -2196,47 +2196,47 @@ const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(), ni =
2196
2196
  "repeating-radial-gradient",
2197
2197
  "repeating-conic-gradient"
2198
2198
  ].some((s) => t.includes(s));
2199
- }, ct = (r, t) => {
2199
+ }, ct = (n, t) => {
2200
2200
  console.warn(
2201
- `[Decorator] Could not parse color: "${r}". ${t} Falling back to ${JSON.stringify(G)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`
2201
+ `[Decorator] Could not parse color: "${n}". ${t} Falling back to ${JSON.stringify(G)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`
2202
2202
  );
2203
- }, Ct = (r, t = null) => {
2204
- const e = t ? `${r}|${t}` : r, i = F.get(e);
2203
+ }, Ct = (n, t = null) => {
2204
+ const e = t ? `${n}|${t}` : n, i = F.get(e);
2205
2205
  if (i !== void 0)
2206
2206
  return i ?? G;
2207
- if (ri(r))
2208
- return ct(r, "Unsupported color format or special value."), F.set(e, null), G;
2209
- const s = ni();
2207
+ if (ni(n))
2208
+ return ct(n, "Unsupported color format or special value."), F.set(e, null), G;
2209
+ const s = ri();
2210
2210
  if (!s)
2211
- return ct(r, "Could not get canvas context."), F.set(e, null), G;
2211
+ return ct(n, "Could not get canvas context."), F.set(e, null), G;
2212
2212
  try {
2213
2213
  J === 0 && s.clearRect(0, 0, 5, 5);
2214
- const n = J % 5, o = Math.floor(J / 5);
2215
- s.clearRect(n, o, 1, 1), t && (s.fillStyle = t, s.fillRect(n, o, 1, 1)), s.fillStyle = r, s.fillRect(n, o, 1, 1);
2216
- const a = s.getImageData(n, o, 1, 1);
2214
+ const r = J % 5, o = Math.floor(J / 5);
2215
+ s.clearRect(r, o, 1, 1), t && (s.fillStyle = t, s.fillRect(r, o, 1, 1)), s.fillStyle = n, s.fillRect(r, o, 1, 1);
2216
+ const a = s.getImageData(r, o, 1, 1);
2217
2217
  J = (J + 1) % 25;
2218
- const [l, u, d, f] = a.data;
2218
+ const [c, u, d, f] = a.data;
2219
2219
  if (f === 0)
2220
- return ct(r, "Fully transparent color."), F.set(e, null), G;
2221
- const p = { r: l, g: u, b: d, a: f / 255 };
2220
+ return ct(n, "Fully transparent color."), F.set(e, null), G;
2221
+ const p = { r: c, g: u, b: d, a: f / 255 };
2222
2222
  return F.set(e, p), p;
2223
- } catch (n) {
2224
- return ct(r, `Error: ${n instanceof Error ? n.message : String(n)}`), F.set(e, null), G;
2223
+ } catch (r) {
2224
+ return ct(n, `Error: ${r instanceof Error ? r.message : String(r)}`), F.set(e, null), G;
2225
2225
  }
2226
- }, Et = (r) => {
2227
- const t = r / 255;
2226
+ }, Et = (n) => {
2227
+ const t = n / 255;
2228
2228
  return t <= 0.03928 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4);
2229
- }, de = (r) => {
2230
- const t = Et(r.r), e = Et(r.g), i = Et(r.b);
2229
+ }, de = (n) => {
2230
+ const t = Et(n.r), e = Et(n.g), i = Et(n.b);
2231
2231
  return 0.2126 * t + 0.7152 * e + 0.0722 * i;
2232
- }, ue = (r, t) => {
2233
- const e = typeof r == "string" ? Ct(r) : r, i = typeof t == "string" ? Ct(t) : t, s = de(e), n = de(i), o = Math.max(s, n), a = Math.min(s, n);
2232
+ }, ue = (n, t) => {
2233
+ const e = typeof n == "string" ? Ct(n) : n, i = typeof t == "string" ? Ct(t) : t, s = de(e), r = de(i), o = Math.max(s, r), a = Math.min(s, r);
2234
2234
  return (o + 0.05) / (a + 0.05);
2235
- }, xt = (r, t = null) => {
2236
- const e = Ct(r, t), i = ue(e, { r: 255, g: 255, b: 255, a: 1 }), s = ue(e, { r: 0, g: 0, b: 0, a: 1 });
2235
+ }, xt = (n, t = null) => {
2236
+ const e = Ct(n, t), i = ue(e, { r: 255, g: 255, b: 255, a: 1 }), s = ue(e, { r: 0, g: 0, b: 0, a: 1 });
2237
2237
  return i > s;
2238
- }, oi = (r, t = null) => xt(r, t) ? "white" : "black", pe = "#FFFF00";
2239
- var ai = /* @__PURE__ */ ((r) => (r.Wrap = "wrap", r.Viewport = "viewport", r.Bounds = "bounds", r.Page = "page", r))(ai || {}), li = /* @__PURE__ */ ((r) => (r.Boxes = "boxes", r.Bounds = "bounds", r))(li || {});
2238
+ }, oi = (n, t = null) => xt(n, t) ? "white" : "black", pe = "#FFFF00";
2239
+ var ai = /* @__PURE__ */ ((n) => (n.Wrap = "wrap", n.Viewport = "viewport", n.Bounds = "bounds", n.Page = "page", n))(ai || {}), li = /* @__PURE__ */ ((n) => (n.Boxes = "boxes", n.Bounds = "bounds", n))(li || {});
2240
2240
  const ci = () => "Highlight" in window, me = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
2241
2241
  class hi {
2242
2242
  /**
@@ -2258,19 +2258,19 @@ class hi {
2258
2258
  * @param decoration Decoration to add
2259
2259
  */
2260
2260
  add(t) {
2261
- const e = `${this.id}-${this.lastItemId++}`, i = nt(this.wnd.document, t.locator);
2261
+ const e = `${this.id}-${this.lastItemId++}`, i = rt(this.wnd.document, t.locator);
2262
2262
  if (!i) {
2263
2263
  this.comms.log("Can't locate DOM range for decoration", t);
2264
2264
  return;
2265
2265
  }
2266
2266
  const s = i.commonAncestorContainer;
2267
2267
  s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (me.includes(s.nodeName.toUpperCase()) && this.notTextFlag?.set(e, !0), i.cloneContents().querySelector(me.join(", ").toLowerCase()) && this.notTextFlag?.set(e, !0), (s.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(e, !0));
2268
- const n = {
2268
+ const r = {
2269
2269
  decoration: t,
2270
2270
  id: e,
2271
2271
  range: i
2272
2272
  };
2273
- this.items.push(n), this.layout(n), this.renderLayout([n]);
2273
+ this.items.push(r), this.layout(r), this.renderLayout([r]);
2274
2274
  }
2275
2275
  /**
2276
2276
  * Removes the decoration with given ID from the group.
@@ -2305,11 +2305,11 @@ class hi {
2305
2305
  experimentalLayout(t) {
2306
2306
  const [e, i] = this.requireContainer(!0);
2307
2307
  i.add(t.range);
2308
- const s = wt(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"), n = t.decoration?.style?.tint ?? pe;
2308
+ const s = wt(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"), r = t.decoration?.style?.tint ?? pe;
2309
2309
  e.innerHTML = `
2310
2310
  ::highlight(${this.id}) {
2311
- color: ${oi(n, s)};
2312
- background-color: ${n};
2311
+ color: ${oi(r, s)};
2312
+ background-color: ${r};
2313
2313
  }`;
2314
2314
  }
2315
2315
  /**
@@ -2325,19 +2325,19 @@ class hi {
2325
2325
  getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
2326
2326
  "column-count"
2327
2327
  )
2328
- ), n = i / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, l = o.scrollTop, u = (g, m, b) => {
2328
+ ), r = i / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, c = o.scrollTop, u = (g, m, b) => {
2329
2329
  if (g.style.position = "absolute", t.decoration?.style?.width === "viewport") {
2330
2330
  g.style.width = `${i}px`, g.style.height = `${m.height}px`;
2331
2331
  let D = Math.floor(m.left / i) * i;
2332
- g.style.left = `${D + a}px`, g.style.top = `${m.top + l}px`;
2332
+ g.style.left = `${D + a}px`, g.style.top = `${m.top + c}px`;
2333
2333
  } else if (t.decoration?.style?.width === "bounds")
2334
- g.style.width = `${b.width}px`, g.style.height = `${m.height}px`, g.style.left = `${b.left + a}px`, g.style.top = `${m.top + l}px`;
2334
+ g.style.width = `${b.width}px`, g.style.height = `${m.height}px`, g.style.left = `${b.left + a}px`, g.style.top = `${m.top + c}px`;
2335
2335
  else if (t.decoration?.style?.width === "page") {
2336
- g.style.width = `${n}px`, g.style.height = `${m.height}px`;
2337
- let D = Math.floor(m.left / n) * n;
2338
- g.style.left = `${D + a}px`, g.style.top = `${m.top + l}px`;
2336
+ g.style.width = `${r}px`, g.style.height = `${m.height}px`;
2337
+ let D = Math.floor(m.left / r) * r;
2338
+ g.style.left = `${D + a}px`, g.style.top = `${m.top + c}px`;
2339
2339
  } else
2340
- g.style.width = `${m.width}px`, g.style.height = `${m.height}px`, g.style.left = `${m.left + a}px`, g.style.top = `${m.top + l}px`;
2340
+ g.style.width = `${m.width}px`, g.style.height = `${m.height}px`, g.style.left = `${m.left + a}px`, g.style.top = `${m.top + c}px`;
2341
2341
  }, d = t.range.getBoundingClientRect();
2342
2342
  let f = this.wnd.document.createElement("template");
2343
2343
  const p = this.getCurrentDarkMode();
@@ -2428,33 +2428,33 @@ const j = class j extends K {
2428
2428
  }
2429
2429
  mount(t, e) {
2430
2430
  return this.wnd = t, e.register("decorate", j.moduleName, (i, s) => {
2431
- const n = i;
2432
- n.decoration && n.decoration.locator && (n.decoration.locator = k.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new hi(
2431
+ const r = i;
2432
+ r.decoration && r.decoration.locator && (r.decoration.locator = k.deserialize(r.decoration.locator)), this.groups.has(r.group) || this.groups.set(r.group, new hi(
2433
2433
  t,
2434
2434
  e,
2435
2435
  `readium-decoration-${this.lastGroupId++}`,
2436
- n.group
2436
+ r.group
2437
2437
  ));
2438
- const o = this.groups.get(n.group);
2439
- switch (n.action) {
2438
+ const o = this.groups.get(r.group);
2439
+ switch (r.action) {
2440
2440
  case "add":
2441
- o?.add(n.decoration);
2441
+ o?.add(r.decoration);
2442
2442
  break;
2443
2443
  case "remove":
2444
- o?.remove(n.decoration.id);
2444
+ o?.remove(r.decoration.id);
2445
2445
  break;
2446
2446
  case "clear":
2447
2447
  o?.clear();
2448
2448
  break;
2449
2449
  case "update":
2450
- o?.update(n.decoration);
2450
+ o?.update(r.decoration);
2451
2451
  break;
2452
2452
  }
2453
2453
  s(!0);
2454
2454
  }), this.resizeObserver = new ResizeObserver(() => t.requestAnimationFrame(() => this.handleResize())), this.resizeObserver.observe(t.document.body), t.addEventListener("orientationchange", this.handleResizer), t.addEventListener("resize", this.handleResizer), this.backgroundObserver = new MutationObserver((i) => {
2455
- i.some((n) => {
2456
- if (n.type === "attributes" && n.attributeName === "style") {
2457
- const o = n.target, a = n.oldValue, l = o.getAttribute("style"), u = this.extractCustomProperty(a, "--USER__appearance"), d = this.extractCustomProperty(l, "--USER__appearance"), f = this.extractCustomProperty(a, "--USER__backgroundColor"), p = this.extractCustomProperty(l, "--USER__backgroundColor");
2455
+ i.some((r) => {
2456
+ if (r.type === "attributes" && r.attributeName === "style") {
2457
+ const o = r.target, a = r.oldValue, c = o.getAttribute("style"), u = this.extractCustomProperty(a, "--USER__appearance"), d = this.extractCustomProperty(c, "--USER__appearance"), f = this.extractCustomProperty(a, "--USER__backgroundColor"), p = this.extractCustomProperty(c, "--USER__backgroundColor");
2458
2458
  return u !== d || f !== p;
2459
2459
  }
2460
2460
  return !1;
@@ -2485,10 +2485,10 @@ const fe = "readium-snapper-style", tt = class tt extends K {
2485
2485
  }
2486
2486
  mount(t, e) {
2487
2487
  const i = t.document.createElement("style");
2488
- return i.dataset.readium = "true", i.id = fe, i.textContent = this.buildStyles(), t.document.head.appendChild(i), e.register("protect", tt.moduleName, (s, n) => {
2489
- this.protected = !0, i.textContent = this.buildStyles(), n(!0);
2490
- }), e.register("unprotect", tt.moduleName, (s, n) => {
2491
- this.protected = !1, i.textContent = this.buildStyles(), n(!0);
2488
+ return i.dataset.readium = "true", i.id = fe, i.textContent = this.buildStyles(), t.document.head.appendChild(i), e.register("protect", tt.moduleName, (s, r) => {
2489
+ this.protected = !0, i.textContent = this.buildStyles(), r(!0);
2490
+ }), e.register("unprotect", tt.moduleName, (s, r) => {
2491
+ this.protected = !1, i.textContent = this.buildStyles(), r(!0);
2492
2492
  }), e.log("Snapper Mounted"), !0;
2493
2493
  }
2494
2494
  unmount(t, e) {
@@ -2497,47 +2497,47 @@ const fe = "readium-snapper-style", tt = class tt extends K {
2497
2497
  };
2498
2498
  tt.moduleName = "snapper";
2499
2499
  let X = tt;
2500
- function di(r) {
2501
- return (r.document.documentElement.dir || r.document.body.dir).toLowerCase() === "rtl";
2500
+ function di(n) {
2501
+ return (n.document.documentElement.dir || n.document.body.dir).toLowerCase() === "rtl";
2502
2502
  }
2503
- function ui(r) {
2504
- return (r.getComputedStyle(r.document.documentElement).writingMode || r.getComputedStyle(r.document.body).writingMode) === "vertical-lr";
2503
+ function ui(n) {
2504
+ return (n.getComputedStyle(n.document.documentElement).writingMode || n.getComputedStyle(n.document.body).writingMode) === "vertical-lr";
2505
2505
  }
2506
- function Ie(r) {
2506
+ function Ie(n) {
2507
2507
  return parseInt(
2508
- r.getComputedStyle(
2509
- r.document.documentElement
2508
+ n.getComputedStyle(
2509
+ n.document.documentElement
2510
2510
  ).getPropertyValue("column-count")
2511
2511
  );
2512
2512
  }
2513
- function ge(r) {
2514
- const t = getComputedStyle(r), e = parseFloat(t.paddingTop || "0"), i = parseFloat(t.paddingBottom || "0");
2515
- return r.clientHeight - e - i;
2513
+ function ge(n) {
2514
+ const t = getComputedStyle(n), e = parseFloat(t.paddingTop || "0"), i = parseFloat(t.paddingBottom || "0");
2515
+ return n.clientHeight - e - i;
2516
2516
  }
2517
- function ye(r) {
2518
- const t = Ie(r);
2517
+ function ye(n) {
2518
+ const t = Ie(n);
2519
2519
  if (!t)
2520
2520
  return !1;
2521
- const e = r.document.querySelectorAll("div[id^='readium-virtual-page']");
2521
+ const e = n.document.querySelectorAll("div[id^='readium-virtual-page']");
2522
2522
  for (const u of e)
2523
2523
  u.remove();
2524
- const i = e.length, s = r.document.scrollingElement.scrollWidth, n = r.visualViewport.width, a = Math.round(s / n * t) % t, l = t === 1 || a === 0 ? 0 : t - a;
2525
- if (l > 0)
2526
- for (let u = 0; u < l; u++) {
2527
- const d = r.document.createElement("div");
2528
- d.setAttribute("id", `readium-virtual-page-${u}`), d.dataset.readium = "true", CSS.supports("break-before", "column") ? d.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (d.style.breakInside = "avoid-column"), d.style.height = ge(r.document.documentElement) + "px"), d.innerHTML = "&#8203;", r.document.body.appendChild(d);
2524
+ const i = e.length, s = n.document.scrollingElement.scrollWidth, r = n.visualViewport.width, a = Math.round(s / r * t) % t, c = t === 1 || a === 0 ? 0 : t - a;
2525
+ if (c > 0)
2526
+ for (let u = 0; u < c; u++) {
2527
+ const d = n.document.createElement("div");
2528
+ d.setAttribute("id", `readium-virtual-page-${u}`), d.dataset.readium = "true", CSS.supports("break-before", "column") ? d.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (d.style.breakInside = "avoid-column"), d.style.height = ge(n.document.documentElement) + "px"), d.innerHTML = "&#8203;", n.document.body.appendChild(d);
2529
2529
  }
2530
- return i !== l;
2530
+ return i !== c;
2531
2531
  }
2532
- function Ft(r) {
2533
- const t = r.document.createElement("style");
2534
- t.appendChild(r.document.createTextNode("*{}")), r.document.body.appendChild(t), r.document.body.removeChild(t);
2532
+ function Ft(n) {
2533
+ const t = n.document.createElement("style");
2534
+ t.appendChild(n.document.createTextNode("*{}")), n.document.body.appendChild(t), n.document.body.removeChild(t);
2535
2535
  }
2536
- function pi(r) {
2537
- return r < 0.5 ? 2 * r * r : -1 + (4 - 2 * r) * r;
2536
+ function pi(n) {
2537
+ return n < 0.5 ? 2 * n * n : -1 + (4 - 2 * n) * n;
2538
2538
  }
2539
- function A(r) {
2540
- const t = r.getSelection();
2539
+ function A(n) {
2540
+ const t = n.getSelection();
2541
2541
  t && t.removeAllRanges();
2542
2542
  }
2543
2543
  const mi = [
@@ -2555,17 +2555,17 @@ const mi = [
2555
2555
  "textarea",
2556
2556
  "video"
2557
2557
  ], fi = ["dialog", "radiogroup", "radio", "menu", "menuitem"];
2558
- function Gt(r) {
2559
- return gi(r) ? null : ze(r) ? r : r.parentElement ? Gt(r.parentElement) : null;
2558
+ function Gt(n) {
2559
+ return gi(n) ? null : ze(n) ? n : n.parentElement ? Gt(n.parentElement) : null;
2560
2560
  }
2561
- function gi(r) {
2562
- return r ? r.closest("[inert]") !== null || r.hasAttribute("disabled") : !0;
2561
+ function gi(n) {
2562
+ return n ? n.closest("[inert]") !== null || n.hasAttribute("disabled") : !0;
2563
2563
  }
2564
- function ze(r) {
2565
- return r ? r.role && fi.includes(r.role) || r.tabIndex >= 0 ? !0 : mi.includes(r.nodeName.toLowerCase()) || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" : !1;
2564
+ function ze(n) {
2565
+ return n ? n.role && fi.includes(n.role) || n.tabIndex >= 0 ? !0 : mi.includes(n.nodeName.toLowerCase()) || n.hasAttribute("contenteditable") && n.getAttribute("contenteditable")?.toLowerCase() !== "false" : !1;
2566
2566
  }
2567
- function yt(r, t) {
2568
- const e = Me(r, r.document.body, t), i = r._readium_cssSelectorGenerator.getCssSelector(e, {
2567
+ function yt(n, t) {
2568
+ const e = Me(n, n.document.body, t), i = n._readium_cssSelectorGenerator.getCssSelector(e, {
2569
2569
  selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
2570
2570
  });
2571
2571
  return new k({
@@ -2581,28 +2581,28 @@ function yt(r, t) {
2581
2581
  })
2582
2582
  });
2583
2583
  }
2584
- function Me(r, t, e) {
2584
+ function Me(n, t, e) {
2585
2585
  for (var i = 0; i < t.children.length; i++) {
2586
2586
  const s = t.children[i];
2587
- if (!vi(s) && yi(r, s, e))
2588
- return bi(r, s) ? s : Me(r, s, e);
2587
+ if (!vi(s) && yi(n, s, e))
2588
+ return bi(n, s) ? s : Me(n, s, e);
2589
2589
  }
2590
2590
  return t;
2591
2591
  }
2592
- function yi(r, t, e) {
2592
+ function yi(n, t, e) {
2593
2593
  if (t === document.body || t === document.documentElement)
2594
2594
  return !0;
2595
2595
  if (!document || !document.documentElement || !document.body)
2596
2596
  return !1;
2597
2597
  const i = t.getBoundingClientRect();
2598
- return e ? i.bottom > 0 && i.top < r.innerHeight : i.right > 0 && i.left < r.innerWidth;
2598
+ return e ? i.bottom > 0 && i.top < n.innerHeight : i.right > 0 && i.left < n.innerWidth;
2599
2599
  }
2600
- function bi(r, t) {
2600
+ function bi(n, t) {
2601
2601
  const e = t.getBoundingClientRect();
2602
- return e.top >= 0 && e.left >= 0 && e.bottom <= r.innerHeight && e.right <= r.innerWidth;
2602
+ return e.top >= 0 && e.left >= 0 && e.bottom <= n.innerHeight && e.right <= n.innerWidth;
2603
2603
  }
2604
- function vi(r) {
2605
- const t = getComputedStyle(r);
2604
+ function vi(n) {
2605
+ const t = getComputedStyle(n);
2606
2606
  if (t) {
2607
2607
  const e = t.getPropertyValue("display");
2608
2608
  if (e != "block" && e != "list-item" || t.getPropertyValue("opacity") === "0")
@@ -2649,16 +2649,16 @@ class bt {
2649
2649
  }
2650
2650
  analyze(t, e, i) {
2651
2651
  if (i <= 0) return !1;
2652
- const s = Math.abs(e) / i, n = Date.now();
2652
+ const s = Math.abs(e) / i, r = Date.now();
2653
2653
  if (this.history.push({
2654
- timestamp: n,
2654
+ timestamp: r,
2655
2655
  direction: t,
2656
2656
  velocity: s,
2657
2657
  distance: Math.abs(e)
2658
- }), this.history = this.history.filter((m) => n - m.timestamp < 2e3).slice(-(this.options.historySize || 20)), this.history.length < 3) return !1;
2658
+ }), this.history = this.history.filter((m) => r - m.timestamp < 2e3).slice(-(this.options.historySize || 20)), this.history.length < 3) return !1;
2659
2659
  if (s > this.options.maxVelocity)
2660
2660
  return this.resetAfterDetection(), !0;
2661
- const o = this.history.map((m) => m.velocity), a = this.history.map((m) => m.distance), l = o.reduce((m, b) => m + b, 0) / o.length, u = a.reduce((m, b) => m + b, 0) / a.length, d = o.reduce((m, b) => m + Math.pow(b - l, 2), 0) / o.length, f = a.reduce((m, b) => m + Math.pow(b - u, 2), 0) / a.length;
2661
+ const o = this.history.map((m) => m.velocity), a = this.history.map((m) => m.distance), c = o.reduce((m, b) => m + b, 0) / o.length, u = a.reduce((m, b) => m + b, 0) / a.length, d = o.reduce((m, b) => m + Math.pow(b - c, 2), 0) / o.length, f = a.reduce((m, b) => m + Math.pow(b - u, 2), 0) / a.length;
2662
2662
  if (d < this.options.minVariance && f < u * 0.1) {
2663
2663
  if (this.consistentScrollCount++, this.consistentScrollCount >= (this.options.maxConsistentScrolls || 10))
2664
2664
  return this.resetAfterDetection(), !0;
@@ -2709,9 +2709,9 @@ const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
2709
2709
  return this.rtl ? Math.abs(t) : Math.max(0, this.wnd.scrollX > 0 ? this.wnd.scrollX : t);
2710
2710
  }
2711
2711
  reportProgress() {
2712
- const t = this.cachedScrollWidth, e = this.wnd.innerWidth, i = this.normScroll(), s = Math.max(1, t - e), n = Math.max(0, Math.min(1, i / s)), o = Math.max(0, Math.min(1, (i + e) / t));
2712
+ const t = this.cachedScrollWidth, e = this.wnd.innerWidth, i = this.normScroll(), s = Math.max(1, t - e), r = Math.max(0, Math.min(1, i / s)), o = Math.max(0, Math.min(1, (i + e) / t));
2713
2713
  this.comms.send("progress", {
2714
- start: n,
2714
+ start: r,
2715
2715
  end: o
2716
2716
  });
2717
2717
  }
@@ -2732,16 +2732,16 @@ const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
2732
2732
  }
2733
2733
  // Snaps the current offset to the page width.
2734
2734
  snapCurrentOffset(t = !1, e = !1) {
2735
- const i = this.doc(), s = Ie(this.wnd), n = this.cachedScrollWidth - this.wnd.innerWidth, o = Math.min(Math.max(0, this.normScroll()), n), a = this.dragOffset(), l = this.rtl ? -a : a, u = this.wnd.innerWidth / 3 * (l > 0 ? 2 : 1), d = Math.min(n, Math.max(0, this.snapNormOffset(o + u))), f = this.rtl ? -d : d, p = this.rtl ? -o : o, v = f > p ? "right" : "left";
2735
+ const i = this.doc(), s = Ie(this.wnd), r = this.cachedScrollWidth - this.wnd.innerWidth, o = Math.min(Math.max(0, this.normScroll()), r), a = this.dragOffset(), c = this.rtl ? -a : a, u = this.wnd.innerWidth / 3 * (c > 0 ? 2 : 1), d = Math.min(r, Math.max(0, this.snapNormOffset(o + u))), f = this.rtl ? -d : d, p = this.rtl ? -o : o, v = f > p ? "right" : "left";
2736
2736
  if (this.checkSuspiciousSnap(v, Math.abs(f - p)), t && f !== p) {
2737
2737
  this.snappingCancelled = !1;
2738
- const g = (_, V, rt, ot) => rt > ot ? V : _ + (V - _) * pi(rt / ot), m = Ei * s;
2738
+ const g = (_, V, nt, ot) => nt > ot ? V : _ + (V - _) * pi(nt / ot), m = Ei * s;
2739
2739
  let b;
2740
2740
  const D = (_) => {
2741
2741
  if (this.snappingCancelled) return;
2742
2742
  b || (b = _);
2743
- const V = _ - b, rt = g(this.overscroll, 0, V, m), ot = g(p, f, V, m);
2744
- i.scrollLeft = ot, this.overscroll !== 0 && (i.style.transform = `translate3d(${-rt}px, 0px, 0px)`), V < m ? this.wnd.requestAnimationFrame(D) : (this.clearTouches(), i.style.removeProperty("transform"), i.scrollLeft = f, e || this.reportProgress());
2743
+ const V = _ - b, nt = g(this.overscroll, 0, V, m), ot = g(p, f, V, m);
2744
+ i.scrollLeft = ot, this.overscroll !== 0 && (i.style.transform = `translate3d(${-nt}px, 0px, 0px)`), V < m ? this.wnd.requestAnimationFrame(D) : (this.clearTouches(), i.style.removeProperty("transform"), i.scrollLeft = f, e || this.reportProgress());
2745
2745
  };
2746
2746
  this.wnd.requestAnimationFrame(D);
2747
2747
  } else
@@ -2771,8 +2771,8 @@ const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
2771
2771
  }
2772
2772
  onTouchEnd(t) {
2773
2773
  if (this.touchState === 2) {
2774
- const e = this.dragOffset(), i = this.normScroll(), s = this.cachedScrollWidth - this.wnd.innerWidth, n = this.rtl ? -e : e;
2775
- this.cachedScrollWidth <= this.wnd.innerWidth ? (this.reportProgress(), n > 5 && this.comms.send("no_more", void 0), n < -5 && this.comms.send("no_less", void 0)) : i < 5 && n < 5 ? (this.alreadyScrollLeft = 0, this.comms.send("no_less", void 0)) : s - i < 5 && n > 5 && (this.alreadyScrollLeft = this.rtl ? -s : s, this.comms.send("no_more", void 0)), this.snapCurrentOffset(!0), this.comms.send("swipe", e);
2774
+ const e = this.dragOffset(), i = this.normScroll(), s = this.cachedScrollWidth - this.wnd.innerWidth, r = this.rtl ? -e : e;
2775
+ this.cachedScrollWidth <= this.wnd.innerWidth ? (this.reportProgress(), r > 5 && this.comms.send("no_more", void 0), r < -5 && this.comms.send("no_less", void 0)) : i < 5 && r < 5 ? (this.alreadyScrollLeft = 0, this.comms.send("no_less", void 0)) : s - i < 5 && r > 5 && (this.alreadyScrollLeft = this.rtl ? -s : s, this.comms.send("no_more", void 0)), this.snapCurrentOffset(!0), this.comms.send("swipe", e);
2776
2776
  }
2777
2777
  this.touchState = 0;
2778
2778
  }
@@ -2782,8 +2782,8 @@ const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
2782
2782
  onTouchMove(t) {
2783
2783
  if (this.touchState === 0) return;
2784
2784
  this.touchState === 1 && (this.touchState = 2, A(this.wnd)), this.endingX = t.touches[0].clientX;
2785
- const e = this.dragOffset(), i = this.alreadyScrollLeft + e, s = this.rtl ? -(this.cachedScrollWidth - this.wnd.innerWidth) : 0, n = this.rtl ? 0 : this.cachedScrollWidth - this.wnd.innerWidth;
2786
- i < s ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`) : i > n ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-i}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = i);
2785
+ const e = this.dragOffset(), i = this.alreadyScrollLeft + e, s = this.rtl ? -(this.cachedScrollWidth - this.wnd.innerWidth) : 0, r = this.rtl ? 0 : this.cachedScrollWidth - this.wnd.innerWidth;
2786
+ i < s ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`) : i > r ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-i}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = i);
2787
2787
  }
2788
2788
  enableSnapProtection() {
2789
2789
  this.patternAnalyzer || (this.patternAnalyzer = new bt({
@@ -2853,7 +2853,7 @@ const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
2853
2853
  }), this.resizeObserver.observe(t.document.body), this.mutationObserver = new MutationObserver((o) => {
2854
2854
  for (const a of o)
2855
2855
  if (a.target === this.wnd.document.documentElement) {
2856
- const l = a.oldValue, u = a.target.getAttribute("style"), d = /transform\s*:\s*([^;]+)/, f = l?.match(d), p = u?.match(d);
2856
+ const c = a.oldValue, u = a.target.getAttribute("style"), d = /transform\s*:\s*([^;]+)/, f = c?.match(d), p = u?.match(d);
2857
2857
  (!f && !p || f && !p || f && p && f[1] !== p[1]) && (t.requestAnimationFrame(() => {
2858
2858
  t && ye(t);
2859
2859
  }), this.onWidthChange());
@@ -2865,13 +2865,13 @@ const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
2865
2865
  const s = (o) => {
2866
2866
  const a = this.doc().scrollLeft;
2867
2867
  return this.doc().scrollLeft = this.snapOffset(o), a !== this.doc().scrollLeft;
2868
- }, n = (o) => {
2869
- const a = this.doc().scrollLeft, l = this.snapNormOffset(Math.max(0, Math.min(this.cachedScrollWidth - t.innerWidth, o)));
2870
- return this.doc().scrollLeft = -l, a !== this.doc().scrollLeft;
2868
+ }, r = (o) => {
2869
+ const a = this.doc().scrollLeft, c = this.snapNormOffset(Math.max(0, Math.min(this.cachedScrollWidth - t.innerWidth, o)));
2870
+ return this.doc().scrollLeft = -c, a !== this.doc().scrollLeft;
2871
2871
  };
2872
2872
  return t.addEventListener("orientationchange", this.onWidthChanger), t.addEventListener("resize", this.onWidthChanger), t.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth), e.register("go_progression", T.moduleName, (o, a) => {
2873
- const l = o;
2874
- if (l < 0 || l > 1) {
2873
+ const c = o;
2874
+ if (c < 0 || c > 1) {
2875
2875
  e.send("error", {
2876
2876
  message: "go_progression must be given a position from 0.0 to 1.0"
2877
2877
  }), a(!1);
@@ -2879,28 +2879,28 @@ const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
2879
2879
  }
2880
2880
  this.wnd.requestAnimationFrame(() => {
2881
2881
  this.cachedScrollWidth = this.doc().scrollWidth;
2882
- const d = (this.cachedScrollWidth - t.innerWidth) * l;
2882
+ const d = (this.cachedScrollWidth - t.innerWidth) * c;
2883
2883
  this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(d) : this.doc().scrollLeft = this.snapOffset(d), this.reportProgress(), A(this.wnd), a(!0);
2884
2884
  });
2885
2885
  }), e.register("go_id", T.moduleName, (o, a) => {
2886
- const l = t.document.getElementById(o);
2887
- if (!l) {
2886
+ const c = t.document.getElementById(o);
2887
+ if (!c) {
2888
2888
  a(!1);
2889
2889
  return;
2890
2890
  }
2891
2891
  this.wnd.requestAnimationFrame(() => {
2892
- this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(l.getBoundingClientRect().left + t.scrollX) : this.doc().scrollLeft = this.snapOffset(l.getBoundingClientRect().left + t.scrollX), this.reportProgress(), A(this.wnd), a(!0);
2892
+ this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(c.getBoundingClientRect().left + t.scrollX) : this.doc().scrollLeft = this.snapOffset(c.getBoundingClientRect().left + t.scrollX), this.reportProgress(), A(this.wnd), a(!0);
2893
2893
  });
2894
2894
  }), e.register("go_text", T.moduleName, (o, a) => {
2895
- let l;
2896
- Array.isArray(o) && (o.length > 1 && (l = o[1]), o = o[0]);
2897
- const u = H.deserialize(o), d = nt(this.wnd.document, new k({
2895
+ let c;
2896
+ Array.isArray(o) && (o.length > 1 && (c = o[1]), o = o[0]);
2897
+ const u = H.deserialize(o), d = rt(this.wnd.document, new k({
2898
2898
  href: t.location.href,
2899
2899
  type: "text/html",
2900
2900
  text: u,
2901
- locations: l ? new C({
2901
+ locations: c ? new C({
2902
2902
  otherLocations: /* @__PURE__ */ new Map([
2903
- ["cssSelector", l]
2903
+ ["cssSelector", c]
2904
2904
  ])
2905
2905
  }) : void 0
2906
2906
  }));
@@ -2914,9 +2914,9 @@ const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
2914
2914
  }), e.register("go_end", T.moduleName, (o, a) => {
2915
2915
  this.wnd.requestAnimationFrame(() => {
2916
2916
  this.cachedScrollWidth = this.doc().scrollWidth;
2917
- let l;
2918
- if (this.rtl ? l = -this.snapNormOffset(this.cachedScrollWidth - t.innerWidth) : l = this.snapOffset(this.cachedScrollWidth), this.doc().scrollLeft === l) return a(!1);
2919
- this.doc().scrollLeft = l, this.reportProgress(), A(this.wnd), a(!0);
2917
+ let c;
2918
+ if (this.rtl ? c = -this.snapNormOffset(this.cachedScrollWidth - t.innerWidth) : c = this.snapOffset(this.cachedScrollWidth), this.doc().scrollLeft === c) return a(!1);
2919
+ this.doc().scrollLeft = c, this.reportProgress(), A(this.wnd), a(!0);
2920
2920
  });
2921
2921
  }), e.register("go_start", T.moduleName, (o, a) => {
2922
2922
  this.wnd.requestAnimationFrame(() => {
@@ -2926,14 +2926,14 @@ const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
2926
2926
  }), e.register("go_prev", T.moduleName, (o, a) => {
2927
2927
  this.wnd.requestAnimationFrame(() => {
2928
2928
  this.cachedScrollWidth = this.doc().scrollWidth;
2929
- let l;
2930
- this.rtl ? l = n(this.normScroll() - t.innerWidth) : l = s(t.scrollX - t.innerWidth), this.reportProgress(), l && (A(this.wnd), this.checkSuspiciousSnap("left", this.wnd.innerWidth)), a(l);
2929
+ let c;
2930
+ this.rtl ? c = r(this.normScroll() - t.innerWidth) : c = s(t.scrollX - t.innerWidth), this.reportProgress(), c && (A(this.wnd), this.checkSuspiciousSnap("left", this.wnd.innerWidth)), a(c);
2931
2931
  });
2932
2932
  }), e.register("go_next", T.moduleName, (o, a) => {
2933
2933
  this.wnd.requestAnimationFrame(() => {
2934
2934
  this.cachedScrollWidth = this.doc().scrollWidth;
2935
- let l;
2936
- this.rtl ? l = n(this.normScroll() + t.innerWidth) : l = s(t.scrollX + t.innerWidth), this.reportProgress(), l && (A(this.wnd), this.checkSuspiciousSnap("right", this.wnd.innerWidth)), a(l);
2935
+ let c;
2936
+ this.rtl ? c = r(this.normScroll() + t.innerWidth) : c = s(t.scrollX + t.innerWidth), this.reportProgress(), c && (A(this.wnd), this.checkSuspiciousSnap("right", this.wnd.innerWidth)), a(c);
2937
2937
  });
2938
2938
  }), e.register("unfocus", T.moduleName, (o, a) => {
2939
2939
  this.snappingCancelled = !0, A(this.wnd), a(!0);
@@ -2944,8 +2944,8 @@ const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
2944
2944
  this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), a(!0);
2945
2945
  });
2946
2946
  }), e.register("first_visible_locator", T.moduleName, (o, a) => {
2947
- const l = yt(t, !1);
2948
- this.comms.send("first_visible_locator", l.serialize()), a(!0);
2947
+ const c = yt(t, !1);
2948
+ this.comms.send("first_visible_locator", c.serialize()), a(!0);
2949
2949
  }), t.addEventListener("touchstart", this.onTouchStarter, { passive: !0 }), t.addEventListener("touchend", this.onTouchEnder, { passive: !0 }), t.addEventListener("touchmove", this.onTouchMover, { passive: !0 }), t.document.addEventListener("touchstart", () => {
2950
2950
  }), e.log("ColumnSnapper Mounted"), !0;
2951
2951
  }
@@ -2967,11 +2967,11 @@ const ve = "readium-scroll-snapper-style", P = class P extends X {
2967
2967
  this.reportProgress();
2968
2968
  const e = this.doc().scrollTop, i = e - this.lastScrollTop;
2969
2969
  if (this.lastScrollTop = e, this.isScrollProtectionEnabled && Math.abs(i) > 5) {
2970
- const s = Date.now(), n = s - (this.lastScrollTime || s);
2970
+ const s = Date.now(), r = s - (this.lastScrollTime || s);
2971
2971
  if (this.patternAnalyzer && this.patternAnalyzer.analyze(
2972
2972
  i > 0 ? "down" : "up",
2973
2973
  Math.abs(i),
2974
- n
2974
+ r
2975
2975
  )) {
2976
2976
  const a = t.target && "tagName" in t.target ? { tagName: t.target.tagName } : null;
2977
2977
  this.comms?.send("content_protection", {
@@ -2994,10 +2994,10 @@ const ve = "readium-scroll-snapper-style", P = class P extends X {
2994
2994
  }
2995
2995
  reportProgress() {
2996
2996
  if (!this.comms.ready) return;
2997
- const t = Math.ceil(this.doc().scrollTop), e = this.doc().scrollHeight, i = this.wnd.innerHeight, s = Math.max(0, Math.min(1, t / e)), n = Math.max(0, Math.min(1, (t + i) / e));
2997
+ const t = Math.ceil(this.doc().scrollTop), e = this.doc().scrollHeight, i = this.wnd.innerHeight, s = Math.max(0, Math.min(1, t / e)), r = Math.max(0, Math.min(1, (t + i) / e));
2998
2998
  this.comms.send("progress", {
2999
2999
  start: s,
3000
- end: n
3000
+ end: r
3001
3001
  });
3002
3002
  }
3003
3003
  enableScrollProtection() {
@@ -3022,30 +3022,30 @@ const ve = "readium-scroll-snapper-style", P = class P extends X {
3022
3022
  Ft(this.wnd);
3023
3023
  const s = this.doc().scrollTop;
3024
3024
  s > 1 ? this.doc().scrollTop = s - 1 : this.doc().scrollTop = s + 1, this.doc().scrollTop = s;
3025
- }), e.register("go_progression", P.moduleName, (s, n) => {
3025
+ }), e.register("go_progression", P.moduleName, (s, r) => {
3026
3026
  const o = s;
3027
3027
  if (o < 0 || o > 1) {
3028
3028
  e.send("error", {
3029
3029
  message: "go_progression must be given a position from 0.0 to 1.0"
3030
- }), n(!1);
3030
+ }), r(!1);
3031
3031
  return;
3032
3032
  }
3033
3033
  this.wnd.requestAnimationFrame(() => {
3034
- this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(), A(this.wnd), n(!0);
3034
+ this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(), A(this.wnd), r(!0);
3035
3035
  });
3036
- }), e.register("go_id", P.moduleName, (s, n) => {
3036
+ }), e.register("go_id", P.moduleName, (s, r) => {
3037
3037
  const o = t.document.getElementById(s);
3038
3038
  if (!o) {
3039
- n(!1);
3039
+ r(!1);
3040
3040
  return;
3041
3041
  }
3042
3042
  this.wnd.requestAnimationFrame(() => {
3043
- this.doc().scrollTop = o.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), n(!0);
3043
+ this.doc().scrollTop = o.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), r(!0);
3044
3044
  });
3045
- }), e.register("go_text", P.moduleName, (s, n) => {
3045
+ }), e.register("go_text", P.moduleName, (s, r) => {
3046
3046
  let o;
3047
3047
  Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
3048
- const a = H.deserialize(s), l = nt(this.wnd.document, new k({
3048
+ const a = H.deserialize(s), c = rt(this.wnd.document, new k({
3049
3049
  href: t.location.href,
3050
3050
  type: "text/html",
3051
3051
  text: a,
@@ -3055,31 +3055,31 @@ const ve = "readium-scroll-snapper-style", P = class P extends X {
3055
3055
  ])
3056
3056
  }) : void 0
3057
3057
  }));
3058
- if (!l) {
3059
- n(!1);
3058
+ if (!c) {
3059
+ r(!1);
3060
3060
  return;
3061
3061
  }
3062
3062
  this.wnd.requestAnimationFrame(() => {
3063
- this.doc().scrollTop = l.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), n(!0);
3063
+ this.doc().scrollTop = c.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), r(!0);
3064
3064
  });
3065
- }), e.register("go_start", P.moduleName, (s, n) => {
3066
- if (this.doc().scrollTop === 0) return n(!1);
3067
- this.doc().scrollTop = 0, this.reportProgress(), n(!0);
3068
- }), e.register("go_end", P.moduleName, (s, n) => {
3069
- if (this.doc().scrollTop === this.doc().scrollHeight - this.doc().offsetHeight) return n(!1);
3070
- this.doc().scrollTop = this.doc().scrollHeight - this.doc().offsetHeight, this.reportProgress(), n(!0);
3071
- }), e.register("unfocus", P.moduleName, (s, n) => {
3072
- A(this.wnd), n(!0);
3073
- }), e.register("scroll_protection", P.moduleName, (s, n) => {
3074
- this.enableScrollProtection(), n(!0);
3065
+ }), e.register("go_start", P.moduleName, (s, r) => {
3066
+ if (this.doc().scrollTop === 0) return r(!1);
3067
+ this.doc().scrollTop = 0, this.reportProgress(), r(!0);
3068
+ }), e.register("go_end", P.moduleName, (s, r) => {
3069
+ if (this.doc().scrollTop === this.doc().scrollHeight - this.doc().offsetHeight) return r(!1);
3070
+ this.doc().scrollTop = this.doc().scrollHeight - this.doc().offsetHeight, this.reportProgress(), r(!0);
3071
+ }), e.register("unfocus", P.moduleName, (s, r) => {
3072
+ A(this.wnd), r(!0);
3073
+ }), e.register("scroll_protection", P.moduleName, (s, r) => {
3074
+ this.enableScrollProtection(), r(!0);
3075
3075
  }), e.register([
3076
3076
  "go_next",
3077
3077
  "go_prev"
3078
- ], P.moduleName, (s, n) => n(!1)), e.register("focus", P.moduleName, (s, n) => {
3079
- this.reportProgress(), n(!0);
3080
- }), e.register("first_visible_locator", P.moduleName, (s, n) => {
3078
+ ], P.moduleName, (s, r) => r(!1)), e.register("focus", P.moduleName, (s, r) => {
3079
+ this.reportProgress(), r(!0);
3080
+ }), e.register("first_visible_locator", P.moduleName, (s, r) => {
3081
3081
  const o = yt(t, !0);
3082
- this.comms.send("first_visible_locator", o.serialize()), n(!0);
3082
+ this.comms.send("first_visible_locator", o.serialize()), r(!0);
3083
3083
  }), e.log("ScrollSnapper Mounted"), !0;
3084
3084
  }
3085
3085
  unmount(t, e) {
@@ -3100,11 +3100,11 @@ const N = class N extends X {
3100
3100
  this.reportProgress();
3101
3101
  const e = this.doc().scrollTop, i = e - this.lastScrollTop;
3102
3102
  if (this.lastScrollTop = e, this.isScrollProtectionEnabled && Math.abs(i) > 5) {
3103
- const s = Date.now(), n = s - (this.lastScrollTime || s);
3103
+ const s = Date.now(), r = s - (this.lastScrollTime || s);
3104
3104
  if (this.patternAnalyzer && this.patternAnalyzer.analyze(
3105
3105
  i > 0 ? "down" : "up",
3106
3106
  Math.abs(i),
3107
- n
3107
+ r
3108
3108
  )) {
3109
3109
  const a = t.target && "tagName" in t.target ? { tagName: t.target.tagName } : null;
3110
3110
  this.comms?.send("content_protection", {
@@ -3127,10 +3127,10 @@ const N = class N extends X {
3127
3127
  }
3128
3128
  reportProgress() {
3129
3129
  if (!this.comms.ready) return;
3130
- const t = Math.ceil(this.doc().scrollTop), e = this.doc().scrollHeight, i = this.wnd.innerHeight, s = Math.max(0, Math.min(1, t / e)), n = Math.max(0, Math.min(1, (t + i) / e));
3130
+ const t = Math.ceil(this.doc().scrollTop), e = this.doc().scrollHeight, i = this.wnd.innerHeight, s = Math.max(0, Math.min(1, t / e)), r = Math.max(0, Math.min(1, (t + i) / e));
3131
3131
  this.comms.send("progress", {
3132
3132
  start: s,
3133
- end: n
3133
+ end: r
3134
3134
  });
3135
3135
  }
3136
3136
  enableScrollProtection() {
@@ -3146,35 +3146,35 @@ const N = class N extends X {
3146
3146
  const i = this.doc().scrollTop;
3147
3147
  i > 1 ? this.doc().scrollTop = i - 1 : this.doc().scrollTop = i + 1, this.doc().scrollTop = i;
3148
3148
  }), e.register("go_progression", N.moduleName, (i, s) => {
3149
- const n = i;
3150
- if (n < 0 || n > 1) {
3149
+ const r = i;
3150
+ if (r < 0 || r > 1) {
3151
3151
  e.send("error", {
3152
3152
  message: "go_progression must be given a position from 0.0 to 1.0"
3153
3153
  }), s(!1);
3154
3154
  return;
3155
3155
  }
3156
3156
  this.wnd.requestAnimationFrame(() => {
3157
- this.doc().scrollTop = this.doc().offsetHeight * n, this.reportProgress(), A(this.wnd), s(!0);
3157
+ this.doc().scrollTop = this.doc().offsetHeight * r, this.reportProgress(), A(this.wnd), s(!0);
3158
3158
  });
3159
3159
  }), e.register("go_id", N.moduleName, (i, s) => {
3160
- const n = t.document.getElementById(i);
3161
- if (!n) {
3160
+ const r = t.document.getElementById(i);
3161
+ if (!r) {
3162
3162
  s(!1);
3163
3163
  return;
3164
3164
  }
3165
3165
  this.wnd.requestAnimationFrame(() => {
3166
- this.doc().scrollTop = n.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), s(!0);
3166
+ this.doc().scrollTop = r.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), s(!0);
3167
3167
  });
3168
3168
  }), e.register("go_text", N.moduleName, (i, s) => {
3169
- let n;
3170
- Array.isArray(i) && (i.length > 1 && (n = i[1]), i = i[0]);
3171
- const o = H.deserialize(i), a = nt(this.wnd.document, new k({
3169
+ let r;
3170
+ Array.isArray(i) && (i.length > 1 && (r = i[1]), i = i[0]);
3171
+ const o = H.deserialize(i), a = rt(this.wnd.document, new k({
3172
3172
  href: t.location.href,
3173
3173
  type: "text/html",
3174
3174
  text: o,
3175
- locations: n ? new C({
3175
+ locations: r ? new C({
3176
3176
  otherLocations: /* @__PURE__ */ new Map([
3177
- ["cssSelector", n]
3177
+ ["cssSelector", r]
3178
3178
  ])
3179
3179
  }) : void 0
3180
3180
  }));
@@ -3201,8 +3201,8 @@ const N = class N extends X {
3201
3201
  ], N.moduleName, (i, s) => s(!1)), e.register("focus", N.moduleName, (i, s) => {
3202
3202
  this.reportProgress(), s(!0);
3203
3203
  }), e.register("first_visible_locator", N.moduleName, (i, s) => {
3204
- const n = yt(t, !0);
3205
- e.send("first_visible_locator", n.serialize()), s(!0);
3204
+ const r = yt(t, !0);
3205
+ e.send("first_visible_locator", r.serialize()), s(!0);
3206
3206
  }), e.log("WebPubSnapper Mounted"), !0;
3207
3207
  }
3208
3208
  unmount(t, e) {
@@ -3224,23 +3224,23 @@ class Ai {
3224
3224
  return this.copyHistory.length < 3 ? !1 : this.copyHistory.filter(
3225
3225
  (s) => t - s.timestamp < 2e3
3226
3226
  // Last 2 seconds
3227
- ).length >= 3 ? !0 : this.copyHistory.slice().sort((s, n) => s.timestamp - n.timestamp).every((s, n, o) => n === 0 ? !0 : s.length > o[n - 1].length * 1.5);
3227
+ ).length >= 3 ? !0 : this.copyHistory.slice().sort((s, r) => s.timestamp - r.timestamp).every((s, r, o) => r === 0 ? !0 : s.length > o[r - 1].length * 1.5);
3228
3228
  }
3229
3229
  shouldAllowCopy(t) {
3230
3230
  if (!this.options.enabled) return !0;
3231
3231
  const e = this.window.getSelection();
3232
3232
  if (!e) return !0;
3233
- const s = e.toString().length, n = this.window.document.body.innerText.length, o = Date.now();
3233
+ const s = e.toString().length, r = this.window.document.body.innerText.length, o = Date.now();
3234
3234
  if (this.cleanupOldHistory(o), s < this.options.minThreshold)
3235
3235
  return this.copyHistory.push({
3236
3236
  timestamp: o,
3237
3237
  length: s,
3238
3238
  wasBlocked: !1
3239
3239
  }), !0;
3240
- const l = o - this.lastSelectionTime < 100 && s > this.lastSelectionLength * 1.5, u = Math.min(
3241
- n * this.options.maxSelectionPercent,
3240
+ const c = o - this.lastSelectionTime < 100 && s > this.lastSelectionLength * 1.5, u = Math.min(
3241
+ r * this.options.maxSelectionPercent,
3242
3242
  this.options.absoluteMaxChars
3243
- ), d = this.isSuspiciousPattern(o), f = s > u || l || d;
3243
+ ), d = this.isSuspiciousPattern(o), f = s > u || c || d;
3244
3244
  return this.copyHistory.push({
3245
3245
  timestamp: o,
3246
3246
  length: s,
@@ -3271,15 +3271,15 @@ class Ci {
3271
3271
  if (i - this.selectionStartTime < 500)
3272
3272
  return !1;
3273
3273
  i - this.lastSelectionTime > 1e3 && (this.lastSelectionTime = i), this.selectionStartTime === 0 && (this.selectionStartTime = i), this.lastSelectedText = e;
3274
- const n = this.analyzeSelectionPattern(t, i);
3275
- return this.cleanup(i), n;
3274
+ const r = this.analyzeSelectionPattern(t, i);
3275
+ return this.cleanup(i), r;
3276
3276
  }
3277
3277
  analyzeSelectionPattern(t, e) {
3278
3278
  if (!t.rangeCount) return !1;
3279
- const i = t.getRangeAt(0), s = i.toString(), n = (e - this.selectionStartTime) / 1e3;
3280
- if (s.length / Math.max(1, n) > this.options.maxSelectionsPerSecond) return !0;
3281
- const a = i.startOffset, l = Math.abs(a - this.lastSelectionPosition);
3282
- return this.selectionPatterns.push(l), this.selectionPatterns.length > this.options.historySize && (this.selectionPatterns.shift(), this.calculateVariance(this.selectionPatterns) < this.options.minVariance) ? !0 : (this.lastSelectionPosition = a, !1);
3279
+ const i = t.getRangeAt(0), s = i.toString(), r = (e - this.selectionStartTime) / 1e3;
3280
+ if (s.length / Math.max(1, r) > this.options.maxSelectionsPerSecond) return !0;
3281
+ const a = i.startOffset, c = Math.abs(a - this.lastSelectionPosition);
3282
+ return this.selectionPatterns.push(c), this.selectionPatterns.length > this.options.historySize && (this.selectionPatterns.shift(), this.calculateVariance(this.selectionPatterns) < this.options.minVariance) ? !0 : (this.lastSelectionPosition = a, !1);
3283
3283
  }
3284
3284
  calculateVariance(t) {
3285
3285
  if (t.length === 0) return 0;
@@ -3298,13 +3298,17 @@ class xi {
3298
3298
  * Checks if the given keyboard event matches any of the provided key combinations
3299
3299
  */
3300
3300
  match(t, e) {
3301
- for (const i of e) {
3302
- const s = t.keyCode === i.keyCode, n = i.ctrl === void 0 || t.ctrlKey === i.ctrl, o = i.shift === void 0 || t.shiftKey === i.shift, a = i.alt === void 0 || t.altKey === i.alt, l = i.meta === void 0 || t.metaKey === i.meta;
3303
- if (s && n && o && a && l)
3301
+ for (const i of e)
3302
+ if (this.matchesCombo(t, i))
3304
3303
  return !0;
3305
- }
3306
3304
  return !1;
3307
3305
  }
3306
+ matchesCombo(t, e) {
3307
+ return t.keyCode === e.keyCode && this.matchesModifier(t.ctrlKey, e.ctrl) && this.matchesModifier(t.shiftKey, e.shift) && this.matchesModifier(t.altKey, e.alt) && this.matchesModifier(t.metaKey, e.meta);
3308
+ }
3309
+ matchesModifier(t, e) {
3310
+ return e === void 0 ? !t : t === e;
3311
+ }
3308
3312
  /**
3309
3313
  * Creates an event handler that will call the provided handler when any of the key combinations match
3310
3314
  */
@@ -3317,11 +3321,11 @@ class xi {
3317
3321
  * Creates a standardized activity event for keyboard shortcuts
3318
3322
  */
3319
3323
  createActivityEvent(t, e, i, s) {
3320
- let n, o;
3324
+ let r, o;
3321
3325
  if (s) {
3322
- const a = s.getSelection(), l = a?.toString() || "", d = (l && a?.rangeCount ? a.getRangeAt(0)?.getClientRects() : null)?.[0];
3323
- d && l && (n = {
3324
- text: l,
3326
+ const a = s.getSelection(), c = a?.toString() || "", d = (c && a?.rangeCount ? a.getRangeAt(0)?.getClientRects() : null)?.[0];
3327
+ d && c && (r = {
3328
+ text: c,
3325
3329
  x: d.x,
3326
3330
  y: d.y,
3327
3331
  width: d.width,
@@ -3341,7 +3345,7 @@ class xi {
3341
3345
  shiftKey: t.shiftKey,
3342
3346
  metaKey: t.metaKey,
3343
3347
  targetFrameSrc: i,
3344
- selectedText: n,
3348
+ selectedText: r,
3345
3349
  interactiveElement: o
3346
3350
  };
3347
3351
  }
@@ -3349,29 +3353,29 @@ class xi {
3349
3353
  * Creates handlers for keyboard shortcuts with centralized activity event dispatch
3350
3354
  */
3351
3355
  createKeyboardHandlers(t, e, i, s) {
3352
- const n = [];
3356
+ const r = [];
3353
3357
  return e.forEach((o) => {
3354
- n.push(...o.keyCombos.map((a) => ({
3358
+ r.push(...o.keyCombos.map((a) => ({
3355
3359
  ...a,
3356
- handler: (l) => {
3357
- const u = o.type, d = this.createActivityEvent(l, u, t, s);
3360
+ handler: (c) => {
3361
+ const u = o.type, d = this.createActivityEvent(c, u, t, s);
3358
3362
  i(d);
3359
3363
  }
3360
3364
  })));
3361
- }), n;
3365
+ }), r;
3362
3366
  }
3363
3367
  /**
3364
3368
  * Creates a unified keyboard event handler that processes all shortcuts
3365
3369
  */
3366
3370
  createUnifiedHandler(t, e, i, s) {
3367
- const n = this.createKeyboardHandlers(t, e, i, s);
3371
+ const r = this.createKeyboardHandlers(t, e, i, s);
3368
3372
  return (o) => {
3369
- for (const a of n)
3373
+ for (const a of r)
3370
3374
  if (this.match(o, [a])) {
3371
- const l = a.suppressOnInteractiveElement;
3372
- if (l) {
3373
- const u = document.activeElement;
3374
- if (Array.isArray(l) ? l.some((d) => u?.matches(d)) : ze(u)) return;
3375
+ const c = a.suppressOnInteractiveElement;
3376
+ if (c) {
3377
+ const u = (s?.document ?? document).activeElement;
3378
+ if (Array.isArray(c) ? c.some((d) => u?.matches(d)) : ze(u)) return;
3375
3379
  }
3376
3380
  o.preventDefault(), o.stopPropagation(), a.handler(o);
3377
3381
  return;
@@ -3386,16 +3390,16 @@ const Y = class Y extends K {
3386
3390
  return !0;
3387
3391
  if (!this.bulkCopyProtector.shouldAllowCopy(t)) {
3388
3392
  t.preventDefault();
3389
- const e = this.wnd.getSelection(), i = e?.toString() || "", n = (i ? e?.getRangeAt(0)?.getClientRects() : null)?.[0], o = {
3393
+ const e = this.wnd.getSelection(), i = e?.toString() || "", r = (i ? e?.getRangeAt(0)?.getClientRects() : null)?.[0], o = {
3390
3394
  type: "bulk_copy",
3391
3395
  timestamp: Date.now(),
3392
3396
  clipboardTypes: t.clipboardData?.types ? [...t.clipboardData.types] : [],
3393
- selectedText: n ? {
3397
+ selectedText: r ? {
3394
3398
  text: i,
3395
- x: n.x,
3396
- y: n.y,
3397
- width: n.width,
3398
- height: n.height
3399
+ x: r.x,
3400
+ y: r.y,
3401
+ width: r.width,
3402
+ height: r.height
3399
3403
  } : void 0,
3400
3404
  selectionLength: i.length,
3401
3405
  targetFrameSrc: this.wnd.location.href
@@ -3409,12 +3413,12 @@ const Y = class Y extends K {
3409
3413
  const e = this.wnd.getSelection();
3410
3414
  if (e) {
3411
3415
  if (this.currentSelection = e.toString(), this.selectionAnalyzer.analyze(e) && this.currentSelection) {
3412
- const s = this.wnd.getSelection(), n = s?.toString() || "", a = (n && s?.rangeCount ? s.getRangeAt(0)?.getClientRects() : null)?.[0], l = {
3416
+ const s = this.wnd.getSelection(), r = s?.toString() || "", a = (r && s?.rangeCount ? s.getRangeAt(0)?.getClientRects() : null)?.[0], c = {
3413
3417
  type: "suspicious_selection",
3414
3418
  timestamp: Date.now(),
3415
- selectionLength: n.length,
3419
+ selectionLength: r.length,
3416
3420
  selectedText: {
3417
- text: n,
3421
+ text: r,
3418
3422
  x: a?.x ?? 0,
3419
3423
  y: a?.y ?? 0,
3420
3424
  width: a?.width ?? 0,
@@ -3423,7 +3427,7 @@ const Y = class Y extends K {
3423
3427
  eventType: t?.type || "selectionchange",
3424
3428
  targetFrameSrc: this.wnd.location.href
3425
3429
  };
3426
- this.comms?.send("content_protection", l);
3430
+ this.comms?.send("content_protection", c);
3427
3431
  }
3428
3432
  } else
3429
3433
  this.currentSelection = null;
@@ -3457,17 +3461,17 @@ const Y = class Y extends K {
3457
3461
  }, this.onContext = (t) => {
3458
3462
  if (this.isContextMenuEnabled) {
3459
3463
  t.preventDefault();
3460
- const e = this.wnd.getSelection(), i = e?.toString() || "", n = (i && e?.rangeCount ? e.getRangeAt(0)?.getClientRects() : null)?.[0], o = {
3464
+ const e = this.wnd.getSelection(), i = e?.toString() || "", r = (i && e?.rangeCount ? e.getRangeAt(0)?.getClientRects() : null)?.[0], o = {
3461
3465
  timestamp: Date.now(),
3462
3466
  clientX: t.clientX,
3463
3467
  clientY: t.clientY,
3464
- ...n && {
3468
+ ...r && {
3465
3469
  selectedText: {
3466
3470
  text: i,
3467
- x: n.x,
3468
- y: n.y,
3469
- width: n.width,
3470
- height: n.height
3471
+ x: r.x,
3472
+ y: r.y,
3473
+ width: r.width,
3474
+ height: r.height
3471
3475
  }
3472
3476
  },
3473
3477
  targetFrameSrc: this.wnd.location.href
@@ -3524,12 +3528,12 @@ const Y = class Y extends K {
3524
3528
  const s = e.getRangeAt(0)?.getClientRects();
3525
3529
  if (!s || s.length === 0)
3526
3530
  return;
3527
- const n = s[0], o = {
3531
+ const r = s[0], o = {
3528
3532
  text: e.toString(),
3529
- x: n.x,
3530
- y: n.y,
3531
- width: n.width,
3532
- height: n.height,
3533
+ x: r.x,
3534
+ y: r.y,
3535
+ width: r.width,
3536
+ height: r.height,
3533
3537
  targetFrameSrc: this.wnd?.location?.href
3534
3538
  };
3535
3539
  this.comms.send("text_selected", o);
@@ -3627,11 +3631,11 @@ const et = class et extends K {
3627
3631
  case 1:
3628
3632
  const i = e[1], s = e[2];
3629
3633
  t.removeEventListener(i.type, t._readium_eventBlocker, !0);
3630
- const n = new Event(i.type, {
3634
+ const r = new Event(i.type, {
3631
3635
  bubbles: i.bubbles,
3632
3636
  cancelable: i.cancelable
3633
3637
  });
3634
- s ? s.dispatchEvent(n) : t.dispatchEvent(n);
3638
+ s ? s.dispatchEvent(r) : t.dispatchEvent(r);
3635
3639
  break;
3636
3640
  }
3637
3641
  }
@@ -3655,8 +3659,8 @@ const et = class et extends K {
3655
3659
  ), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
3656
3660
  value: {
3657
3661
  name: "readium-ts-toolkit",
3658
- version: "2.4.2-beta.1",
3659
- hasFeature: (s, n = "") => {
3662
+ version: "2.4.2-beta.3",
3663
+ hasFeature: (s, r = "") => {
3660
3664
  switch (s) {
3661
3665
  case "dom-manipulation":
3662
3666
  return !0;
@@ -3680,19 +3684,19 @@ const et = class et extends K {
3680
3684
  writable: !1
3681
3685
  }), "getAnimations" in t.document && t.document.getAnimations().forEach((s) => {
3682
3686
  s.cancel(), this.allAnimations.add(s);
3683
- }), e.register("activate", et.moduleName, (s, n) => {
3687
+ }), e.register("activate", et.moduleName, (s, r) => {
3684
3688
  this.allAnimations.forEach((o) => {
3685
3689
  o.cancel(), o.play();
3686
- }), n(!0);
3687
- }), e.register("unfocus", et.moduleName, (s, n) => {
3688
- this.pauseAllMedia(t), this.allAnimations.forEach((o) => o.pause()), n(!0);
3690
+ }), r(!0);
3691
+ }), e.register("unfocus", et.moduleName, (s, r) => {
3692
+ this.pauseAllMedia(t), this.allAnimations.forEach((o) => o.pause()), r(!0);
3689
3693
  });
3690
3694
  const i = t.document.querySelectorAll("audio,video");
3691
3695
  for (let s = 0; s < i.length; s++) {
3692
- const n = i[s];
3693
- n.addEventListener("play", this.onMediaPlayEvent, {
3696
+ const r = i[s];
3697
+ r.addEventListener("play", this.onMediaPlayEvent, {
3694
3698
  passive: !0
3695
- }), n.addEventListener("pause", this.onMediaPauseEvent, {
3699
+ }), r.addEventListener("pause", this.onMediaPauseEvent, {
3696
3700
  passive: !0
3697
3701
  });
3698
3702
  }
@@ -3717,17 +3721,17 @@ const we = "readium-viewport", W = class W extends ft {
3717
3721
  "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
3718
3722
  ), t.document.head.appendChild(i), t.addEventListener("orientationchange", this.onViewportWidthChanged), t.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
3719
3723
  target: t
3720
- }), e.register("get_properties", W.moduleName, (s, n) => {
3721
- Vt(t), n(!0);
3722
- }), e.register("update_properties", W.moduleName, (s, n) => {
3723
- s["--RS__viewportWidth"] = `${t.innerWidth}px`, De(t, s), n(!0);
3724
- }), e.register("set_property", W.moduleName, (s, n) => {
3724
+ }), e.register("get_properties", W.moduleName, (s, r) => {
3725
+ Vt(t), r(!0);
3726
+ }), e.register("update_properties", W.moduleName, (s, r) => {
3727
+ s["--RS__viewportWidth"] = `${t.innerWidth}px`, De(t, s), r(!0);
3728
+ }), e.register("set_property", W.moduleName, (s, r) => {
3725
3729
  const o = s;
3726
- st(t, o[0], o[1]), n(!0);
3727
- }), e.register("remove_property", W.moduleName, (s, n) => {
3728
- gt(t, s), n(!0);
3729
- }), e.register("activate", W.moduleName, (s, n) => {
3730
- this.unblock(t), n(!0);
3730
+ st(t, o[0], o[1]), r(!0);
3731
+ }), e.register("remove_property", W.moduleName, (s, r) => {
3732
+ gt(t, s), r(!0);
3733
+ }), e.register("activate", W.moduleName, (s, r) => {
3734
+ this.unblock(t), r(!0);
3731
3735
  }), e.log("ReflowableSetup Mounted"), !0;
3732
3736
  }
3733
3737
  unmount(t, e) {
@@ -3753,13 +3757,13 @@ const Se = "readium-fixed-style", z = class z extends ft {
3753
3757
  min-height: 100%;
3754
3758
 
3755
3759
  /*cursor: var() TODO*/
3756
- }`, t.document.head.appendChild(i), e.register("set_property", z.moduleName, (s, n) => {
3760
+ }`, t.document.head.appendChild(i), e.register("set_property", z.moduleName, (s, r) => {
3757
3761
  const o = s;
3758
- st(t, o[0], o[1]), n(!0);
3759
- }), e.register("remove_property", z.moduleName, (s, n) => {
3760
- gt(t, s), n(!0);
3761
- }), e.register("first_visible_locator", z.moduleName, (s, n) => n(!1)), e.register("unfocus", z.moduleName, (s, n) => {
3762
- A(t), n(!0);
3762
+ st(t, o[0], o[1]), r(!0);
3763
+ }), e.register("remove_property", z.moduleName, (s, r) => {
3764
+ gt(t, s), r(!0);
3765
+ }), e.register("first_visible_locator", z.moduleName, (s, r) => r(!1)), e.register("unfocus", z.moduleName, (s, r) => {
3766
+ A(t), r(!0);
3763
3767
  }), e.register([
3764
3768
  "focus",
3765
3769
  "go_next",
@@ -3769,8 +3773,8 @@ const Se = "readium-fixed-style", z = class z extends ft {
3769
3773
  "go_start",
3770
3774
  "go_text",
3771
3775
  "go_progression"
3772
- ], z.moduleName, (s, n) => n(!0)), e.register("activate", z.moduleName, (s, n) => {
3773
- this.unblock(t), n(!0);
3776
+ ], z.moduleName, (s, r) => r(!0)), e.register("activate", z.moduleName, (s, r) => {
3777
+ this.unblock(t), r(!0);
3774
3778
  }), e.log("FixedSetup Mounted"), !0;
3775
3779
  }
3776
3780
  unmount(t, e) {
@@ -3798,8 +3802,8 @@ const U = class U extends K {
3798
3802
  }), e.register("update_properties", U.moduleName, (i, s) => {
3799
3803
  De(t, i), s(!0);
3800
3804
  }), e.register("set_property", U.moduleName, (i, s) => {
3801
- const n = i;
3802
- st(t, n[0], n[1]), s(!0);
3805
+ const r = i;
3806
+ st(t, r[0], r[1]), s(!0);
3803
3807
  }), e.register("remove_property", U.moduleName, (i, s) => {
3804
3808
  gt(t, i), s(!0);
3805
3809
  }), e.register("activate", U.moduleName, (i, s) => {
@@ -3862,13 +3866,13 @@ const Ee = "readium-cjk-vertical-snapper-style", L = class L extends X {
3862
3866
  this.reportProgress();
3863
3867
  const e = Math.abs(this.doc().scrollLeft), i = e - this.lastScrollLeft;
3864
3868
  if (this.lastScrollLeft = e, this.isScrollProtectionEnabled && Math.abs(i) > 5) {
3865
- const s = Date.now(), n = s - (this.lastScrollTime || s);
3869
+ const s = Date.now(), r = s - (this.lastScrollTime || s);
3866
3870
  if (this.patternAnalyzer && this.patternAnalyzer.analyze(
3867
3871
  // In vertical-rl, norm increases when scrolling forward (toward left/end),
3868
3872
  // so deltaX > 0 = going forward.
3869
3873
  i > 0 ? "down" : "up",
3870
3874
  Math.abs(i),
3871
- n
3875
+ r
3872
3876
  )) {
3873
3877
  const a = t.target && "tagName" in t.target ? { tagName: t.target.tagName } : null;
3874
3878
  this.comms?.send("content_protection", {
@@ -3895,9 +3899,9 @@ const Ee = "readium-cjk-vertical-snapper-style", L = class L extends X {
3895
3899
  }
3896
3900
  reportProgress() {
3897
3901
  if (!this.comms.ready) return;
3898
- const t = this.doc().scrollWidth, e = this.wnd.innerWidth, i = Math.max(1, t - e), s = Math.abs(this.doc().scrollLeft), n = Math.max(0, Math.min(1, s / i)), o = Math.max(0, Math.min(1, (s + e) / t));
3902
+ const t = this.doc().scrollWidth, e = this.wnd.innerWidth, i = Math.max(1, t - e), s = Math.abs(this.doc().scrollLeft), r = Math.max(0, Math.min(1, s / i)), o = Math.max(0, Math.min(1, (s + e) / t));
3899
3903
  this.comms.send("progress", {
3900
- start: n,
3904
+ start: r,
3901
3905
  end: o
3902
3906
  });
3903
3907
  }
@@ -3926,31 +3930,31 @@ const Ee = "readium-cjk-vertical-snapper-style", L = class L extends X {
3926
3930
  Ft(this.wnd);
3927
3931
  const s = this.doc().scrollLeft;
3928
3932
  this.verticalLR ? this.doc().scrollLeft = s > 1 ? s - 1 : s + 1 : this.doc().scrollLeft = s < -1 ? s + 1 : s - 1, this.doc().scrollLeft = s;
3929
- }), e.register("go_progression", L.moduleName, (s, n) => {
3933
+ }), e.register("go_progression", L.moduleName, (s, r) => {
3930
3934
  const o = s;
3931
3935
  if (o < 0 || o > 1) {
3932
3936
  e.send("error", {
3933
3937
  message: "go_progression must be given a position from 0.0 to 1.0"
3934
- }), n(!1);
3938
+ }), r(!1);
3935
3939
  return;
3936
3940
  }
3937
3941
  this.wnd.requestAnimationFrame(() => {
3938
3942
  const a = this.scrollable() * o;
3939
- this.doc().scrollLeft = this.verticalLR ? a : -a, this.reportProgress(), A(this.wnd), n(!0);
3943
+ this.doc().scrollLeft = this.verticalLR ? a : -a, this.reportProgress(), A(this.wnd), r(!0);
3940
3944
  });
3941
- }), e.register("go_id", L.moduleName, (s, n) => {
3945
+ }), e.register("go_id", L.moduleName, (s, r) => {
3942
3946
  const o = t.document.getElementById(s);
3943
3947
  if (!o) {
3944
- n(!1);
3948
+ r(!1);
3945
3949
  return;
3946
3950
  }
3947
3951
  this.wnd.requestAnimationFrame(() => {
3948
- this.doc().scrollLeft += o.getBoundingClientRect().left - t.innerWidth / 2, this.reportProgress(), A(this.wnd), n(!0);
3952
+ this.doc().scrollLeft += o.getBoundingClientRect().left - t.innerWidth / 2, this.reportProgress(), A(this.wnd), r(!0);
3949
3953
  });
3950
- }), e.register("go_text", L.moduleName, (s, n) => {
3954
+ }), e.register("go_text", L.moduleName, (s, r) => {
3951
3955
  let o;
3952
3956
  Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
3953
- const a = H.deserialize(s), l = nt(this.wnd.document, new k({
3957
+ const a = H.deserialize(s), c = rt(this.wnd.document, new k({
3954
3958
  href: t.location.href,
3955
3959
  type: "text/html",
3956
3960
  text: a,
@@ -3958,31 +3962,31 @@ const Ee = "readium-cjk-vertical-snapper-style", L = class L extends X {
3958
3962
  otherLocations: /* @__PURE__ */ new Map([["cssSelector", o]])
3959
3963
  }) : void 0
3960
3964
  }));
3961
- if (!l) {
3962
- n(!1);
3965
+ if (!c) {
3966
+ r(!1);
3963
3967
  return;
3964
3968
  }
3965
3969
  this.wnd.requestAnimationFrame(() => {
3966
- this.doc().scrollLeft += l.getBoundingClientRect().left - t.innerWidth / 2, this.reportProgress(), A(this.wnd), n(!0);
3970
+ this.doc().scrollLeft += c.getBoundingClientRect().left - t.innerWidth / 2, this.reportProgress(), A(this.wnd), r(!0);
3967
3971
  });
3968
- }), e.register("go_start", L.moduleName, (s, n) => {
3969
- if (this.doc().scrollLeft === 0) return n(!1);
3970
- this.doc().scrollLeft = 0, this.reportProgress(), n(!0);
3971
- }), e.register("go_end", L.moduleName, (s, n) => {
3972
- if (Math.abs(this.doc().scrollLeft) === this.scrollable()) return n(!1);
3973
- this.doc().scrollLeft = this.verticalLR ? this.scrollable() : -this.scrollable(), this.reportProgress(), n(!0);
3972
+ }), e.register("go_start", L.moduleName, (s, r) => {
3973
+ if (this.doc().scrollLeft === 0) return r(!1);
3974
+ this.doc().scrollLeft = 0, this.reportProgress(), r(!0);
3975
+ }), e.register("go_end", L.moduleName, (s, r) => {
3976
+ if (Math.abs(this.doc().scrollLeft) === this.scrollable()) return r(!1);
3977
+ this.doc().scrollLeft = this.verticalLR ? this.scrollable() : -this.scrollable(), this.reportProgress(), r(!0);
3974
3978
  }), e.register([
3975
3979
  "go_next",
3976
3980
  "go_prev"
3977
- ], L.moduleName, (s, n) => n(!1)), e.register("unfocus", L.moduleName, (s, n) => {
3978
- A(this.wnd), n(!0);
3979
- }), e.register("scroll_protection", L.moduleName, (s, n) => {
3980
- this.enableScrollProtection(), n(!0);
3981
- }), e.register("focus", L.moduleName, (s, n) => {
3982
- this.reportProgress(), n(!0);
3983
- }), e.register("first_visible_locator", L.moduleName, (s, n) => {
3981
+ ], L.moduleName, (s, r) => r(!1)), e.register("unfocus", L.moduleName, (s, r) => {
3982
+ A(this.wnd), r(!0);
3983
+ }), e.register("scroll_protection", L.moduleName, (s, r) => {
3984
+ this.enableScrollProtection(), r(!0);
3985
+ }), e.register("focus", L.moduleName, (s, r) => {
3986
+ this.reportProgress(), r(!0);
3987
+ }), e.register("first_visible_locator", L.moduleName, (s, r) => {
3984
3988
  const o = yt(t, !0);
3985
- this.comms.send("first_visible_locator", o.serialize()), n(!0);
3989
+ this.comms.send("first_visible_locator", o.serialize()), r(!0);
3986
3990
  }), e.log("CJKVerticalSnapper Mounted"), !0;
3987
3991
  }
3988
3992
  unmount(t, e) {
@@ -4022,7 +4026,7 @@ const Ti = [
4022
4026
  Nt,
4023
4027
  Mt,
4024
4028
  zt
4025
- ].map((r) => [r.moduleName, r]));
4029
+ ].map((n) => [n.moduleName, n]));
4026
4030
  class Li {
4027
4031
  /**
4028
4032
  * @param wnd Window instance to operate on
@@ -4035,9 +4039,9 @@ class Li {
4035
4039
  if (typeof t > "u")
4036
4040
  throw Error("Loader is not in a web browser");
4037
4041
  t.parent !== t && this.comms.log("Loader is probably in a frame"), this.loadedModules = i.map((s) => {
4038
- const n = this.loadModule(s);
4039
- if (n)
4040
- return n.mount(this.wnd, this.comms), n;
4042
+ const r = this.loadModule(s);
4043
+ if (r)
4044
+ return r.mount(this.wnd, this.comms), r;
4041
4045
  }).filter((s) => s !== void 0);
4042
4046
  }
4043
4047
  }