@readium/navigator-html-injectables 2.0.0-beta.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -33,22 +33,22 @@ class at {
33
33
  e.strict && this.send("_unhandled", e);
34
34
  return;
35
35
  }
36
- t.forEach((i) => i.cb(e.data, (s) => {
37
- this.send("_ack", s, e.id);
36
+ t.forEach((i) => i.cb(e.data, (r) => {
37
+ this.send("_ack", r, e.id);
38
38
  }));
39
39
  }
40
40
  register(e, t, i) {
41
- Array.isArray(e) || (e = [e]), e.forEach((s) => {
42
- const n = this.registrar.get(s);
41
+ Array.isArray(e) || (e = [e]), e.forEach((r) => {
42
+ const n = this.registrar.get(r);
43
43
  if (n && n.length >= 0) {
44
44
  if (n.find((l) => l.module === t))
45
- throw new Error(`Trying to register another callback for combination of event ${s} and module ${t}`);
45
+ throw new Error(`Trying to register another callback for combination of event ${r} and module ${t}`);
46
46
  n.push({
47
47
  cb: i,
48
48
  module: t
49
- }), this.registrar.set(s, n);
49
+ }), this.registrar.set(r, n);
50
50
  } else
51
- this.registrar.set(s, [{
51
+ this.registrar.set(r, [{
52
52
  cb: i,
53
53
  module: t
54
54
  }]);
@@ -56,12 +56,12 @@ class at {
56
56
  }
57
57
  unregister(e, t) {
58
58
  Array.isArray(e) || (e = [e]), e.forEach((i) => {
59
- const s = this.registrar.get(i);
60
- !s || s.length === 0 || s.splice(s.findIndex((n) => n.module === t), 1);
59
+ const r = this.registrar.get(i);
60
+ !r || r.length === 0 || r.splice(r.findIndex((n) => n.module === t), 1);
61
61
  });
62
62
  }
63
63
  unregisterAll(e) {
64
- this.registrar.forEach((t, i) => this.registrar.set(i, t.filter((s) => s.module !== e)));
64
+ this.registrar.forEach((t, i) => this.registrar.set(i, t.filter((r) => r.module !== e)));
65
65
  }
66
66
  log(...e) {
67
67
  this.destination ? this.send("log", e) : this.preLog.push(e);
@@ -72,7 +72,7 @@ class at {
72
72
  destroy() {
73
73
  this.destination = null, this.channelId = "", this.preLog = [], this.registrar.clear(), this.wnd.removeEventListener("message", this.receiver);
74
74
  }
75
- send(e, t, i = void 0, s = []) {
75
+ send(e, t, i = void 0, r = []) {
76
76
  if (!this.destination)
77
77
  throw Error("Attempted to send comms message before destination has been initialized");
78
78
  const n = {
@@ -86,12 +86,12 @@ class at {
86
86
  try {
87
87
  this.destination.postMessage(n, {
88
88
  targetOrigin: this.origin,
89
- transfer: s
89
+ transfer: r
90
90
  });
91
91
  } catch (o) {
92
- if (s.length > 0)
92
+ if (r.length > 0)
93
93
  throw o;
94
- this.destination.postMessage(n, this.origin, s);
94
+ this.destination.postMessage(n, this.origin, r);
95
95
  }
96
96
  }
97
97
  }
@@ -123,16 +123,19 @@ class ie {
123
123
  return this.compression !== void 0 && (e.compression = this.compression), this.originalLength !== void 0 && (e.originalLength = this.originalLength), this.profile !== void 0 && (e.profile = this.profile), this.scheme !== void 0 && (e.scheme = this.scheme), e;
124
124
  }
125
125
  }
126
- class b {
126
+ class w {
127
127
  constructor(e) {
128
128
  this.otherProperties = e;
129
129
  }
130
+ get page() {
131
+ return this.otherProperties.page;
132
+ }
130
133
  /**
131
134
  * Creates a [Properties] from its RWPM JSON representation.
132
135
  */
133
136
  static deserialize(e) {
134
137
  if (e)
135
- return new b(e);
138
+ return new w(e);
136
139
  }
137
140
  /**
138
141
  * Serializes a [Properties] to its RWPM JSON representation.
@@ -147,33 +150,46 @@ class b {
147
150
  const t = Object.assign({}, this.otherProperties);
148
151
  for (const i in e)
149
152
  t[i] = e[i];
150
- return new b(t);
153
+ return new w(t);
151
154
  }
152
155
  }
153
- Object.defineProperty(b.prototype, "encryption", {
156
+ Object.defineProperty(w.prototype, "encryption", {
154
157
  get: function() {
155
158
  return ie.deserialize(this.otherProperties.encrypted);
156
159
  }
157
160
  });
158
- b.prototype.getContains = function() {
159
- return new Set(this.otherProperties.contains || []);
160
- };
161
- b.prototype.getLayout = function() {
162
- return this.otherProperties.layout;
163
- };
161
+ function lt(s) {
162
+ return s && s instanceof Array ? s : void 0;
163
+ }
164
+ function We(s) {
165
+ return s && typeof s == "string" ? [s] : lt(s);
166
+ }
167
+ function ye(s) {
168
+ return typeof s == "string" ? new Date(s) : void 0;
169
+ }
170
+ function j(s) {
171
+ return isNaN(s) ? void 0 : s;
172
+ }
173
+ function T(s) {
174
+ return j(s) !== void 0 && Math.sign(s) >= 0 ? s : void 0;
175
+ }
176
+ function ht(s) {
177
+ const e = new Array();
178
+ return s.forEach((t) => e.push(t)), e;
179
+ }
164
180
  class a {
165
181
  /** Creates a MediaType object. */
166
182
  constructor(e) {
167
- let t, i, s = e.mediaType.replace(/\s/g, "").split(";");
168
- const n = s[0].split("/");
183
+ let t, i, r = e.mediaType.replace(/\s/g, "").split(";");
184
+ const n = r[0].split("/");
169
185
  if (n.length === 2) {
170
186
  if (t = n[0].toLowerCase().trim(), i = n[1].toLowerCase().trim(), t.length === 0 || i.length === 0)
171
187
  throw new Error("Invalid media type");
172
188
  } else
173
189
  throw new Error("Invalid media type");
174
190
  const o = {};
175
- for (let d = 1; d < s.length; d++) {
176
- const f = s[d].split("=");
191
+ for (let d = 1; d < r.length; d++) {
192
+ const f = r[d].split("=");
177
193
  if (f.length === 2) {
178
194
  const g = f[0].toLocaleLowerCase(), m = g === "charset" ? f[1].toUpperCase() : f[1];
179
195
  o[g] = m;
@@ -225,11 +241,11 @@ class a {
225
241
  return !1;
226
242
  const i = new Set(
227
243
  Object.entries(this.parameters).map(([n, o]) => `${n}=${o}`)
228
- ), s = new Set(
244
+ ), r = new Set(
229
245
  Object.entries(t.parameters).map(([n, o]) => `${n}=${o}`)
230
246
  );
231
247
  for (const n of Array.from(i.values()))
232
- if (!s.has(n))
248
+ if (!r.has(n))
233
249
  return !1;
234
250
  return !0;
235
251
  }
@@ -616,7 +632,7 @@ class a {
616
632
  });
617
633
  }
618
634
  }
619
- class ye {
635
+ class ve {
620
636
  constructor(e) {
621
637
  this.uri = e, this.parameters = this.getParameters(e);
622
638
  }
@@ -626,7 +642,7 @@ class ye {
626
642
  getParameters(e) {
627
643
  const t = /\{\??([^}]+)\}/g, i = e.match(t);
628
644
  return i ? new Set(
629
- i.join(",").replace(t, "$1").split(",").map((s) => s.trim())
645
+ i.join(",").replace(t, "$1").split(",").map((r) => r.trim())
630
646
  ) : /* @__PURE__ */ new Set();
631
647
  }
632
648
  /** Expands the URI by replacing the template variables by the given parameters.
@@ -634,36 +650,17 @@ class ye {
634
650
  * See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
635
651
  */
636
652
  expand(e) {
637
- const t = (s) => s.split(",").map((n) => {
653
+ const t = (r) => r.split(",").map((n) => {
638
654
  const o = e[n];
639
655
  return o ? encodeURIComponent(o) : "";
640
- }).join(","), i = (s) => "?" + s.split(",").map((n) => {
656
+ }).join(","), i = (r) => "?" + r.split(",").map((n) => {
641
657
  const o = n.split("=")[0], l = e[o];
642
658
  return l ? `${o}=${encodeURIComponent(l)}` : "";
643
659
  }).join("&");
644
- return this.uri.replace(/\{(\??)([^}]+)\}/g, (...s) => s[1] ? i(s[2]) : t(s[2]));
660
+ return this.uri.replace(/\{(\??)([^}]+)\}/g, (...r) => r[1] ? i(r[2]) : t(r[2]));
645
661
  }
646
662
  }
647
- function lt(r) {
648
- return r && r instanceof Array ? r : void 0;
649
- }
650
- function We(r) {
651
- return r && typeof r == "string" ? [r] : lt(r);
652
- }
653
- function ve(r) {
654
- return typeof r == "string" ? new Date(r) : void 0;
655
- }
656
- function j(r) {
657
- return isNaN(r) ? void 0 : r;
658
- }
659
- function C(r) {
660
- return j(r) !== void 0 && Math.sign(r) >= 0 ? r : void 0;
661
- }
662
- function ht(r) {
663
- const e = new Array();
664
- return r.forEach((t) => e.push(t)), e;
665
- }
666
- class x {
663
+ class E {
667
664
  /**
668
665
  * Creates a [Locations].
669
666
  */
@@ -676,7 +673,7 @@ class x {
676
673
  static deserialize(e) {
677
674
  if (!e)
678
675
  return;
679
- const t = j(e.progression), i = j(e.totalProgression), s = j(e.position), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
676
+ const t = j(e.progression), i = j(e.totalProgression), r = j(e.position), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
680
677
  "fragment",
681
678
  "fragments",
682
679
  "progression",
@@ -685,11 +682,11 @@ class x {
685
682
  ]);
686
683
  return Object.entries(e).forEach(([l, c]) => {
687
684
  o.has(l) || n.set(l, c);
688
- }), new x({
685
+ }), new E({
689
686
  fragments: We(e.fragments || e.fragment),
690
687
  progression: t !== void 0 && t >= 0 && t <= 1 ? t : void 0,
691
688
  totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
692
- position: s !== void 0 && s > 0 ? s : void 0,
689
+ position: r !== void 0 && r > 0 ? r : void 0,
693
690
  otherLocations: n.size === 0 ? void 0 : n
694
691
  });
695
692
  }
@@ -732,7 +729,7 @@ class D {
732
729
  * Creates a [Locator].
733
730
  */
734
731
  constructor(e) {
735
- this.href = e.href, this.type = e.type, this.title = e.title, this.locations = e.locations ? e.locations : new x({}), this.text = e.text;
732
+ this.href = e.href, this.type = e.type, this.title = e.title, this.locations = e.locations ? e.locations : new E({}), this.text = e.text;
736
733
  }
737
734
  /**
738
735
  * Parses a [Link] from its RWPM JSON representation.
@@ -743,7 +740,7 @@ class D {
743
740
  href: e.href,
744
741
  type: e.type,
745
742
  title: e.title,
746
- locations: x.deserialize(e.locations),
743
+ locations: E.deserialize(e.locations),
747
744
  text: U.deserialize(e.text)
748
745
  });
749
746
  }
@@ -763,7 +760,7 @@ class D {
763
760
  type: this.type,
764
761
  title: this.title,
765
762
  text: this.text,
766
- locations: new x({ ...this.locations, ...e })
763
+ locations: new E({ ...this.locations, ...e })
767
764
  });
768
765
  }
769
766
  }
@@ -772,7 +769,7 @@ class B {
772
769
  * Creates a [Link].
773
770
  */
774
771
  constructor(e) {
775
- this.href = e.href, this.templated = e.templated, this.type = e.type, this.title = e.title, this.rels = e.rels, this.properties = e.properties, this.height = e.height, this.width = e.width, this.duration = e.duration, this.bitrate = e.bitrate, this.languages = e.languages, this.alternates = e.alternates, this.children = e.children;
772
+ this.href = e.href, this.templated = e.templated, this.type = e.type, this.title = e.title, this.rels = e.rels, this.properties = e.properties, this.height = e.height, this.width = e.width, this.size = e.size, this.duration = e.duration, this.bitrate = e.bitrate, this.languages = e.languages, this.alternates = e.alternates, this.children = e.children;
776
773
  }
777
774
  /**
778
775
  * Parses a [Link] from its RWPM JSON representation.
@@ -785,11 +782,12 @@ class B {
785
782
  type: e.type,
786
783
  title: e.title,
787
784
  rels: e.rel ? e.rel instanceof Array ? new Set(e.rel) : /* @__PURE__ */ new Set([e.rel]) : void 0,
788
- properties: b.deserialize(e.properties),
789
- height: C(e.height),
790
- width: C(e.width),
791
- duration: C(e.duration),
792
- bitrate: C(e.bitrate),
785
+ properties: w.deserialize(e.properties),
786
+ height: T(e.height),
787
+ width: T(e.width),
788
+ size: T(e.size),
789
+ duration: T(e.duration),
790
+ bitrate: T(e.bitrate),
793
791
  languages: We(e.language),
794
792
  alternates: V.deserialize(e.alternate),
795
793
  children: V.deserialize(e.children)
@@ -800,7 +798,7 @@ class B {
800
798
  */
801
799
  serialize() {
802
800
  const e = { href: this.href };
803
- return this.templated !== void 0 && (e.templated = this.templated), this.type !== void 0 && (e.type = this.type), this.title !== void 0 && (e.title = this.title), this.rels && (e.rel = ht(this.rels)), this.properties && (e.properties = this.properties.serialize()), this.height !== void 0 && (e.height = this.height), this.width !== void 0 && (e.width = this.width), this.duration !== void 0 && (e.duration = this.duration), this.bitrate !== void 0 && (e.bitrate = this.bitrate), this.languages && (e.language = this.languages), this.alternates && (e.alternate = this.alternates.serialize()), this.children && (e.children = this.children.serialize()), e;
801
+ return this.templated !== void 0 && (e.templated = this.templated), this.type !== void 0 && (e.type = this.type), this.title !== void 0 && (e.title = this.title), this.rels && (e.rel = ht(this.rels)), this.properties && (e.properties = this.properties.serialize()), this.height !== void 0 && (e.height = this.height), this.width !== void 0 && (e.width = this.width), this.size !== void 0 && (e.size = this.size), this.duration !== void 0 && (e.duration = this.duration), this.bitrate !== void 0 && (e.bitrate = this.bitrate), this.languages && (e.language = this.languages), this.alternates && (e.alternate = this.alternates.serialize()), this.children && (e.children = this.children.serialize()), e;
804
802
  }
805
803
  /** MediaType of the linked resource. */
806
804
  get mediaType() {
@@ -818,14 +816,14 @@ class B {
818
816
  }
819
817
  /** List of URI template parameter keys, if the `Link` is templated. */
820
818
  get templateParameters() {
821
- return this.templated ? new ye(this.href).parameters : /* @__PURE__ */ new Set();
819
+ return this.templated ? new ve(this.href).parameters : /* @__PURE__ */ new Set();
822
820
  }
823
821
  /** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
824
822
  * See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
825
823
  */
826
824
  expandTemplate(e) {
827
825
  return new B({
828
- href: new ye(this.href).expand(e),
826
+ href: new ve(this.href).expand(e),
829
827
  templated: !1
830
828
  });
831
829
  }
@@ -835,7 +833,7 @@ class B {
835
833
  addProperties(e) {
836
834
  var t;
837
835
  const i = B.deserialize(this.serialize());
838
- return i.properties = i.properties ? (t = i.properties) == null ? void 0 : t.add(e) : new b(e), i;
836
+ return i.properties = i.properties ? (t = i.properties) == null ? void 0 : t.add(e) : new w(e), i;
839
837
  }
840
838
  /**
841
839
  * Creates a [Locator] from a reading order [Link].
@@ -846,7 +844,7 @@ class B {
846
844
  href: e.length > 0 && e[0] !== void 0 ? e[0] : this.href,
847
845
  type: this.type ?? "",
848
846
  title: this.title,
849
- locations: new x({
847
+ locations: new E({
850
848
  fragments: e.length > 1 && e[1] !== void 0 ? [e[1]] : []
851
849
  })
852
850
  });
@@ -907,8 +905,8 @@ class V {
907
905
  /** Finds all the links matching any of the given media types. */
908
906
  filterByMediaTypes(e) {
909
907
  const t = (i) => {
910
- for (const s of e)
911
- if (i.mediaType.matches(s))
908
+ for (const r of e)
909
+ if (i.mediaType.matches(r))
912
910
  return !0;
913
911
  return !1;
914
912
  };
@@ -946,6 +944,9 @@ class V {
946
944
  return this.items.filter((e) => e.type);
947
945
  }
948
946
  }
947
+ w.prototype.getContains = function() {
948
+ return new Set(this.otherProperties.contains || []);
949
+ };
949
950
  class q {
950
951
  /**
951
952
  * Creates a [DomRange].
@@ -959,11 +960,11 @@ class q {
959
960
  static deserialize(e) {
960
961
  if (!(e && e.cssSelector))
961
962
  return;
962
- let t = C(e.textNodeIndex);
963
+ let t = T(e.textNodeIndex);
963
964
  if (t === void 0)
964
965
  return;
965
- let i = C(e.charOffset);
966
- return i === void 0 && (i = C(e.offset)), new q({
966
+ let i = T(e.charOffset);
967
+ return i === void 0 && (i = T(e.offset)), new q({
967
968
  cssSelector: e.cssSelector,
968
969
  textNodeIndex: t,
969
970
  charOffset: i
@@ -980,7 +981,7 @@ class q {
980
981
  return this.charOffset !== void 0 && (e.charOffset = this.charOffset), e;
981
982
  }
982
983
  }
983
- class re {
984
+ class se {
984
985
  /**
985
986
  * Creates a [DomRange].
986
987
  */
@@ -995,7 +996,7 @@ class re {
995
996
  return;
996
997
  let t = q.deserialize(e.start);
997
998
  if (t)
998
- return new re({
999
+ return new se({
999
1000
  start: t,
1000
1001
  end: q.deserialize(e.end)
1001
1002
  });
@@ -1008,55 +1009,55 @@ class re {
1008
1009
  return this.end && (e.end = this.end.serialize()), e;
1009
1010
  }
1010
1011
  }
1011
- x.prototype.getCssSelector = function() {
1012
- var r;
1013
- return (r = this.otherLocations) == null ? void 0 : r.get("cssSelector");
1012
+ E.prototype.getCssSelector = function() {
1013
+ var s;
1014
+ return (s = this.otherLocations) == null ? void 0 : s.get("cssSelector");
1014
1015
  };
1015
- x.prototype.getPartialCfi = function() {
1016
- var r;
1017
- return (r = this.otherLocations) == null ? void 0 : r.get("partialCfi");
1016
+ E.prototype.getPartialCfi = function() {
1017
+ var s;
1018
+ return (s = this.otherLocations) == null ? void 0 : s.get("partialCfi");
1018
1019
  };
1019
- x.prototype.getDomRange = function() {
1020
- var r;
1021
- return re.deserialize((r = this.otherLocations) == null ? void 0 : r.get("domRange"));
1020
+ E.prototype.getDomRange = function() {
1021
+ var s;
1022
+ return se.deserialize((s = this.otherLocations) == null ? void 0 : s.get("domRange"));
1022
1023
  };
1023
- x.prototype.fragmentParameters = function() {
1024
+ E.prototype.fragmentParameters = function() {
1024
1025
  return new Map(
1025
- 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) => [
1026
- r[0].trim().toLowerCase(),
1027
- r[1].trim()
1026
+ this.fragments.map((s) => s.startsWith("#") ? s.slice(1) : s).join("&").split("&").filter((s) => !s.startsWith("#")).map((s) => s.split("=")).filter((s) => s.length === 2).map((s) => [
1027
+ s[0].trim().toLowerCase(),
1028
+ s[1].trim()
1028
1029
  ])
1029
1030
  );
1030
1031
  };
1031
- x.prototype.htmlId = function() {
1032
+ E.prototype.htmlId = function() {
1032
1033
  if (!this.fragments.length)
1033
1034
  return;
1034
- let r = this.fragments.find((e) => e.length && !e.includes("="));
1035
- if (!r) {
1035
+ let s = this.fragments.find((e) => e.length && !e.includes("="));
1036
+ if (!s) {
1036
1037
  const e = this.fragmentParameters();
1037
- e.has("id") ? r = e.get("id") : e.has("name") && (r = e.get("name"));
1038
+ e.has("id") ? s = e.get("id") : e.has("name") && (s = e.get("name"));
1038
1039
  }
1039
- return r != null && r.startsWith("#") ? r.slice(1) : r;
1040
+ return s != null && s.startsWith("#") ? s.slice(1) : s;
1040
1041
  };
1041
- x.prototype.page = function() {
1042
- const r = parseInt(this.fragmentParameters().get("page"));
1043
- if (!isNaN(r) && r >= 0)
1044
- return r;
1042
+ E.prototype.page = function() {
1043
+ const s = parseInt(this.fragmentParameters().get("page"));
1044
+ if (!isNaN(s) && s >= 0)
1045
+ return s;
1045
1046
  };
1046
- x.prototype.time = function() {
1047
- const r = parseInt(this.fragmentParameters().get("t"));
1048
- if (!isNaN(r))
1049
- return r;
1047
+ E.prototype.time = function() {
1048
+ const s = parseInt(this.fragmentParameters().get("t"));
1049
+ if (!isNaN(s))
1050
+ return s;
1050
1051
  };
1051
- x.prototype.space = function() {
1052
- const r = this.fragmentParameters();
1053
- if (!r.has("xywh"))
1052
+ E.prototype.space = function() {
1053
+ const s = this.fragmentParameters();
1054
+ if (!s.has("xywh"))
1054
1055
  return;
1055
- const e = r.get("xywh").split(",").map((t) => parseInt(t));
1056
+ const e = s.get("xywh").split(",").map((t) => parseInt(t));
1056
1057
  if (e.length === 4 && !e.some(isNaN))
1057
1058
  return e;
1058
1059
  };
1059
- class se {
1060
+ class re {
1060
1061
  /** Creates a [Price]. */
1061
1062
  constructor(e) {
1062
1063
  this.currency = e.currency, this.value = e.value;
@@ -1070,9 +1071,9 @@ class se {
1070
1071
  let t = e.currency;
1071
1072
  if (!(t && typeof t == "string" && t.length > 0))
1072
1073
  return;
1073
- let i = C(e.value);
1074
+ let i = T(e.value);
1074
1075
  if (i !== void 0)
1075
- return new se({ currency: t, value: i });
1076
+ return new re({ currency: t, value: i });
1076
1077
  }
1077
1078
  /**
1078
1079
  * Serializes a [Price] to its RWPM JSON representation.
@@ -1119,8 +1120,8 @@ class ne {
1119
1120
  static deserialize(e) {
1120
1121
  if (e)
1121
1122
  return new ne({
1122
- total: C(e.total),
1123
- position: C(e.position)
1123
+ total: T(e.total),
1124
+ position: T(e.position)
1124
1125
  });
1125
1126
  }
1126
1127
  /**
@@ -1142,8 +1143,8 @@ class oe {
1142
1143
  static deserialize(e) {
1143
1144
  if (e)
1144
1145
  return new oe({
1145
- total: C(e.total),
1146
- available: C(e.available)
1146
+ total: T(e.total),
1147
+ available: T(e.available)
1147
1148
  });
1148
1149
  }
1149
1150
  /**
@@ -1166,8 +1167,8 @@ class ae {
1166
1167
  if (e && e.state)
1167
1168
  return new ae({
1168
1169
  state: e.state,
1169
- since: ve(e.since),
1170
- until: ve(e.until)
1170
+ since: ye(e.since),
1171
+ until: ye(e.until)
1171
1172
  });
1172
1173
  }
1173
1174
  /**
@@ -1178,78 +1179,60 @@ class ae {
1178
1179
  return this.since !== void 0 && (e.since = this.since.toISOString()), this.until !== void 0 && (e.until = this.until.toISOString()), e;
1179
1180
  }
1180
1181
  }
1181
- b.prototype.getNumberOfItems = function() {
1182
- return C(this.otherProperties.numberOfItems);
1182
+ w.prototype.getNumberOfItems = function() {
1183
+ return T(this.otherProperties.numberOfItems);
1183
1184
  };
1184
- b.prototype.getPrice = function() {
1185
- return se.deserialize(this.otherProperties.price);
1185
+ w.prototype.getPrice = function() {
1186
+ return re.deserialize(this.otherProperties.price);
1186
1187
  };
1187
- b.prototype.getIndirectAcquisitions = function() {
1188
- const r = this.otherProperties.indirectAcquisition;
1189
- if (r && r instanceof Array)
1190
- return r.map((e) => $.deserialize(e)).filter((e) => e !== void 0);
1188
+ w.prototype.getIndirectAcquisitions = function() {
1189
+ const s = this.otherProperties.indirectAcquisition;
1190
+ if (s && s instanceof Array)
1191
+ return s.map((e) => $.deserialize(e)).filter((e) => e !== void 0);
1191
1192
  };
1192
- b.prototype.getHolds = function() {
1193
+ w.prototype.getHolds = function() {
1193
1194
  return ne.deserialize(this.otherProperties.holds);
1194
1195
  };
1195
- b.prototype.getCopies = function() {
1196
+ w.prototype.getCopies = function() {
1196
1197
  return oe.deserialize(this.otherProperties.copies);
1197
1198
  };
1198
- b.prototype.getAvailability = function() {
1199
+ w.prototype.getAvailability = function() {
1199
1200
  return ae.deserialize(this.otherProperties.availability);
1200
1201
  };
1201
- b.prototype.getAuthenticate = function() {
1202
+ w.prototype.getAuthenticate = function() {
1202
1203
  return B.deserialize(this.otherProperties.authenticate);
1203
1204
  };
1204
- b.prototype.getClipped = function() {
1205
- return this.otherProperties.clipped;
1206
- };
1207
- b.prototype.getFit = function() {
1208
- return this.otherProperties.fit;
1209
- };
1210
- b.prototype.getOrientation = function() {
1211
- return this.otherProperties.orientation;
1212
- };
1213
- b.prototype.getOverflow = function() {
1214
- return this.otherProperties.overflow;
1215
- };
1216
- b.prototype.getPage = function() {
1217
- return this.otherProperties.page || void 0;
1218
- };
1219
- b.prototype.getSpread = function() {
1220
- return this.otherProperties.spread || void 0;
1221
- };
1222
1205
  var R;
1223
- (function(r) {
1224
- r.NONE = "none", r.DESCENDANT = "descendant", r.CHILD = "child";
1206
+ (function(s) {
1207
+ s.NONE = "none", s.DESCENDANT = "descendant", s.CHILD = "child";
1225
1208
  })(R || (R = {}));
1226
1209
  var N;
1227
- (function(r) {
1228
- r.id = "id", r.class = "class", r.tag = "tag", r.attribute = "attribute", r.nthchild = "nthchild", r.nthoftype = "nthoftype";
1210
+ (function(s) {
1211
+ s.id = "id", s.class = "class", s.tag = "tag", s.attribute = "attribute", s.nthchild = "nthchild", s.nthoftype = "nthoftype";
1229
1212
  })(N || (N = {}));
1230
1213
  const ct = "CssSelectorGenerator";
1231
- function be(r = "unknown problem", ...e) {
1232
- console.warn(`${ct}: ${r}`, ...e);
1214
+ function be(s = "unknown problem", ...e) {
1215
+ console.warn(`${ct}: ${s}`, ...e);
1233
1216
  }
1234
1217
  N.id, N.class, N.tag, N.attribute, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY;
1235
- function ut(r) {
1236
- return r instanceof RegExp;
1218
+ function ut(s) {
1219
+ return s instanceof RegExp;
1237
1220
  }
1238
- function dt(r) {
1239
- return r.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
1221
+ function dt(s) {
1222
+ return s.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
1240
1223
  }
1241
- function pt(r) {
1242
- const e = r.map((t) => {
1224
+ function pt(s) {
1225
+ const e = s.map((t) => {
1243
1226
  if (ut(t))
1244
1227
  return (i) => t.test(i);
1245
1228
  if (typeof t == "function")
1246
1229
  return (i) => {
1247
- const s = t(i);
1248
- return typeof s != "boolean" ? (be("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", t), !1) : s;
1230
+ const r = t(i);
1231
+ return typeof r != "boolean" ? (be("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", t), !1) : r;
1249
1232
  };
1250
1233
  if (typeof t == "string") {
1251
1234
  const i = new RegExp("^" + dt(t) + "$");
1252
- return (s) => i.test(s);
1235
+ return (r) => i.test(r);
1253
1236
  }
1254
1237
  return be("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", t), () => !1;
1255
1238
  });
@@ -1266,40 +1249,40 @@ pt([
1266
1249
  ]);
1267
1250
  class Y {
1268
1251
  }
1269
- function Ee(r) {
1270
- return r.split("").reverse().join("");
1252
+ function Ee(s) {
1253
+ return s.split("").reverse().join("");
1271
1254
  }
1272
- function yt(r, e, t) {
1255
+ function yt(s, e, t) {
1273
1256
  const i = Ee(e);
1274
- return t.map((s) => {
1275
- const n = Math.max(0, s.end - e.length - s.errors), o = Ee(r.slice(n, s.end));
1257
+ return t.map((r) => {
1258
+ const n = Math.max(0, r.end - e.length - r.errors), o = Ee(s.slice(n, r.end));
1276
1259
  return {
1277
- start: Fe(o, i, s.errors).reduce((c, h) => s.end - h.end < c ? s.end - h.end : c, s.end),
1278
- end: s.end,
1279
- errors: s.errors
1260
+ start: Fe(o, i, r.errors).reduce((c, h) => r.end - h.end < c ? r.end - h.end : c, r.end),
1261
+ end: r.end,
1262
+ errors: r.errors
1280
1263
  };
1281
1264
  });
1282
1265
  }
1283
- function Z(r) {
1284
- return (r | -r) >> 31 & 1;
1266
+ function Z(s) {
1267
+ return (s | -s) >> 31 & 1;
1285
1268
  }
1286
- function xe(r, e, t, i) {
1287
- let s = r.P[t], n = r.M[t];
1288
- const o = i >>> 31, l = e[t] | o, c = l | n, h = (l & s) + s ^ s | l;
1289
- let u = n | ~(h | s), p = s & h;
1290
- const d = Z(u & r.lastRowMask[t]) - Z(p & r.lastRowMask[t]);
1291
- return u <<= 1, p <<= 1, p |= o, u |= Z(i) - o, s = p | ~(c | u), n = u & c, r.P[t] = s, r.M[t] = n, d;
1269
+ function xe(s, e, t, i) {
1270
+ let r = s.P[t], n = s.M[t];
1271
+ const o = i >>> 31, l = e[t] | o, c = l | n, h = (l & r) + r ^ r | l;
1272
+ let u = n | ~(h | r), p = r & h;
1273
+ const d = Z(u & s.lastRowMask[t]) - Z(p & s.lastRowMask[t]);
1274
+ return u <<= 1, p <<= 1, p |= o, u |= Z(i) - o, r = p | ~(c | u), n = u & c, s.P[t] = r, s.M[t] = n, d;
1292
1275
  }
1293
- function Fe(r, e, t) {
1276
+ function Fe(s, e, t) {
1294
1277
  if (e.length === 0)
1295
1278
  return [];
1296
1279
  t = Math.min(t, e.length);
1297
- const i = [], s = 32, n = Math.ceil(e.length / s) - 1, o = {
1280
+ const i = [], r = 32, n = Math.ceil(e.length / r) - 1, o = {
1298
1281
  P: new Uint32Array(n + 1),
1299
1282
  M: new Uint32Array(n + 1),
1300
1283
  lastRowMask: new Uint32Array(n + 1)
1301
1284
  };
1302
- o.lastRowMask.fill(1 << 31), o.lastRowMask[n] = 1 << (e.length - 1) % s;
1285
+ o.lastRowMask.fill(1 << 31), o.lastRowMask[n] = 1 << (e.length - 1) % r;
1303
1286
  const l = new Uint32Array(n + 1), c = /* @__PURE__ */ new Map(), h = [];
1304
1287
  for (let d = 0; d < 256; d++)
1305
1288
  h.push(l);
@@ -1311,23 +1294,23 @@ function Fe(r, e, t) {
1311
1294
  c.set(f, g), f < h.length && (h[f] = g);
1312
1295
  for (let m = 0; m <= n; m += 1) {
1313
1296
  g[m] = 0;
1314
- for (let v = 0; v < s; v += 1) {
1315
- const S = m * s + v;
1316
- if (S >= e.length)
1297
+ for (let v = 0; v < r; v += 1) {
1298
+ const x = m * r + v;
1299
+ if (x >= e.length)
1317
1300
  continue;
1318
- e.charCodeAt(S) === f && (g[m] |= 1 << v);
1301
+ e.charCodeAt(x) === f && (g[m] |= 1 << v);
1319
1302
  }
1320
1303
  }
1321
1304
  }
1322
- let u = Math.max(0, Math.ceil(t / s) - 1);
1305
+ let u = Math.max(0, Math.ceil(t / r) - 1);
1323
1306
  const p = new Uint32Array(n + 1);
1324
1307
  for (let d = 0; d <= u; d += 1)
1325
- p[d] = (d + 1) * s;
1308
+ p[d] = (d + 1) * r;
1326
1309
  p[n] = e.length;
1327
1310
  for (let d = 0; d <= u; d += 1)
1328
1311
  o.P[d] = -1, o.M[d] = 0;
1329
- for (let d = 0; d < r.length; d += 1) {
1330
- const f = r.charCodeAt(d);
1312
+ for (let d = 0; d < s.length; d += 1) {
1313
+ const f = s.charCodeAt(d);
1331
1314
  let g;
1332
1315
  f < h.length ? g = h[f] : (g = c.get(f), typeof g > "u" && (g = l));
1333
1316
  let m = 0;
@@ -1337,13 +1320,13 @@ function Fe(r, e, t) {
1337
1320
  u += 1, o.P[u] = -1, o.M[u] = 0;
1338
1321
  let v;
1339
1322
  if (u === n) {
1340
- const S = e.length % s;
1341
- v = S === 0 ? s : S;
1323
+ const x = e.length % r;
1324
+ v = x === 0 ? r : x;
1342
1325
  } else
1343
- v = s;
1326
+ v = r;
1344
1327
  p[u] = p[u - 1] + v - m + xe(o, g, u, m);
1345
1328
  } else
1346
- for (; u > 0 && p[u] >= t + s; )
1329
+ for (; u > 0 && p[u] >= t + r; )
1347
1330
  u -= 1;
1348
1331
  u === n && p[u] <= t && (p[u] < t && i.splice(0, i.length), i.push({
1349
1332
  start: -1,
@@ -1353,67 +1336,67 @@ function Fe(r, e, t) {
1353
1336
  }
1354
1337
  return i;
1355
1338
  }
1356
- function vt(r, e, t) {
1357
- const i = Fe(r, e, t);
1358
- return yt(r, e, i);
1339
+ function vt(s, e, t) {
1340
+ const i = Fe(s, e, t);
1341
+ return yt(s, e, i);
1359
1342
  }
1360
- function Be(r, e, t) {
1343
+ function Be(s, e, t) {
1361
1344
  let i = 0;
1362
- const s = [];
1345
+ const r = [];
1363
1346
  for (; i !== -1; )
1364
- i = r.indexOf(e, i), i !== -1 && (s.push({
1347
+ i = s.indexOf(e, i), i !== -1 && (r.push({
1365
1348
  start: i,
1366
1349
  end: i + e.length,
1367
1350
  errors: 0
1368
1351
  }), i += 1);
1369
- return s.length > 0 ? s : vt(r, e, t);
1352
+ return r.length > 0 ? r : vt(s, e, t);
1370
1353
  }
1371
- function Se(r, e) {
1372
- return e.length === 0 || r.length === 0 ? 0 : 1 - Be(r, e, e.length)[0].errors / e.length;
1354
+ function Se(s, e) {
1355
+ return e.length === 0 || s.length === 0 ? 0 : 1 - Be(s, e, e.length)[0].errors / e.length;
1373
1356
  }
1374
- function bt(r, e, t = {}) {
1357
+ function bt(s, e, t = {}) {
1375
1358
  if (e.length === 0)
1376
1359
  return null;
1377
- const i = Math.min(256, e.length / 2), s = Be(r, e, i);
1378
- if (s.length === 0)
1360
+ const i = Math.min(256, e.length / 2), r = Be(s, e, i);
1361
+ if (r.length === 0)
1379
1362
  return null;
1380
1363
  const n = (l) => {
1381
1364
  const d = 1 - l.errors / e.length, f = t.prefix ? Se(
1382
- r.slice(
1365
+ s.slice(
1383
1366
  Math.max(0, l.start - t.prefix.length),
1384
1367
  l.start
1385
1368
  ),
1386
1369
  t.prefix
1387
1370
  ) : 1, g = t.suffix ? Se(
1388
- r.slice(l.end, l.end + t.suffix.length),
1371
+ s.slice(l.end, l.end + t.suffix.length),
1389
1372
  t.suffix
1390
1373
  ) : 1;
1391
1374
  let m = 1;
1392
- typeof t.hint == "number" && (m = 1 - Math.abs(l.start - t.hint) / r.length);
1393
- const v = 50 * d + 20 * f + 20 * g + 2 * m, S = 50 + 20 + 20 + 2;
1394
- return v / S;
1395
- }, o = s.map((l) => ({
1375
+ typeof t.hint == "number" && (m = 1 - Math.abs(l.start - t.hint) / s.length);
1376
+ const v = 50 * d + 20 * f + 20 * g + 2 * m, x = 50 + 20 + 20 + 2;
1377
+ return v / x;
1378
+ }, o = r.map((l) => ({
1396
1379
  start: l.start,
1397
1380
  end: l.end,
1398
1381
  score: n(l)
1399
1382
  }));
1400
1383
  return o.sort((l, c) => c.score - l.score), o[0];
1401
1384
  }
1402
- function J(r, e, t) {
1385
+ function J(s, e, t) {
1403
1386
  const i = t === 1 ? e : e - 1;
1404
- if (r.charAt(i).trim() !== "")
1387
+ if (s.charAt(i).trim() !== "")
1405
1388
  return e;
1406
- let s, n;
1407
- if (t === 2 ? (s = r.substring(0, e), n = s.trimEnd()) : (s = r.substring(e), n = s.trimStart()), !n.length)
1389
+ let r, n;
1390
+ if (t === 2 ? (r = s.substring(0, e), n = r.trimEnd()) : (r = s.substring(e), n = r.trimStart()), !n.length)
1408
1391
  return -1;
1409
- const o = s.length - n.length;
1392
+ const o = r.length - n.length;
1410
1393
  return t === 2 ? e - o : e + o;
1411
1394
  }
1412
- function Te(r, e) {
1413
- const t = r.commonAncestorContainer.ownerDocument.createNodeIterator(
1414
- r.commonAncestorContainer,
1395
+ function Te(s, e) {
1396
+ const t = s.commonAncestorContainer.ownerDocument.createNodeIterator(
1397
+ s.commonAncestorContainer,
1415
1398
  NodeFilter.SHOW_TEXT
1416
- ), i = e === 1 ? r.startContainer : r.endContainer, s = e === 1 ? r.endContainer : r.startContainer;
1399
+ ), i = e === 1 ? s.startContainer : s.endContainer, r = e === 1 ? s.endContainer : s.startContainer;
1417
1400
  let n = t.nextNode();
1418
1401
  for (; n && n !== i; )
1419
1402
  n = t.nextNode();
@@ -1425,36 +1408,36 @@ function Te(r, e) {
1425
1408
  o = J(c, h, e);
1426
1409
  }
1427
1410
  };
1428
- for (; n && o === -1 && n !== s; )
1411
+ for (; n && o === -1 && n !== r; )
1429
1412
  l();
1430
1413
  if (n && o >= 0)
1431
1414
  return { node: n, offset: o };
1432
1415
  throw new RangeError("No text nodes with non-whitespace text found in range");
1433
1416
  }
1434
- function Et(r) {
1435
- if (!r.toString().trim().length)
1417
+ function Et(s) {
1418
+ if (!s.toString().trim().length)
1436
1419
  throw new RangeError("Range contains no non-whitespace text");
1437
- if (r.startContainer.nodeType !== Node.TEXT_NODE)
1420
+ if (s.startContainer.nodeType !== Node.TEXT_NODE)
1438
1421
  throw new RangeError("Range startContainer is not a text node");
1439
- if (r.endContainer.nodeType !== Node.TEXT_NODE)
1422
+ if (s.endContainer.nodeType !== Node.TEXT_NODE)
1440
1423
  throw new RangeError("Range endContainer is not a text node");
1441
- const e = r.cloneRange();
1424
+ const e = s.cloneRange();
1442
1425
  let t = !1, i = !1;
1443
- const s = {
1426
+ const r = {
1444
1427
  start: J(
1445
- r.startContainer.textContent,
1446
- r.startOffset,
1428
+ s.startContainer.textContent,
1429
+ s.startOffset,
1447
1430
  1
1448
1431
  /* Forwards */
1449
1432
  ),
1450
1433
  end: J(
1451
- r.endContainer.textContent,
1452
- r.endOffset,
1434
+ s.endContainer.textContent,
1435
+ s.endOffset,
1453
1436
  2
1454
1437
  /* Backwards */
1455
1438
  )
1456
1439
  };
1457
- if (s.start >= 0 && (e.setStart(r.startContainer, s.start), t = !0), s.end > 0 && (e.setEnd(r.endContainer, s.end), i = !0), t && i)
1440
+ if (r.start >= 0 && (e.setStart(s.startContainer, r.start), t = !0), r.end > 0 && (e.setEnd(s.endContainer, r.end), i = !0), t && i)
1458
1441
  return e;
1459
1442
  if (!t) {
1460
1443
  const { node: n, offset: o } = Te(
@@ -1474,36 +1457,36 @@ function Et(r) {
1474
1457
  }
1475
1458
  return e;
1476
1459
  }
1477
- function Ue(r) {
1460
+ function Ue(s) {
1478
1461
  var e;
1479
- switch (r.nodeType) {
1462
+ switch (s.nodeType) {
1480
1463
  case Node.ELEMENT_NODE:
1481
1464
  case Node.TEXT_NODE:
1482
- return ((e = r.textContent) == null ? void 0 : e.length) ?? 0;
1465
+ return ((e = s.textContent) == null ? void 0 : e.length) ?? 0;
1483
1466
  default:
1484
1467
  return 0;
1485
1468
  }
1486
1469
  }
1487
- function we(r) {
1488
- let e = r.previousSibling, t = 0;
1470
+ function we(s) {
1471
+ let e = s.previousSibling, t = 0;
1489
1472
  for (; e; )
1490
1473
  t += Ue(e), e = e.previousSibling;
1491
1474
  return t;
1492
1475
  }
1493
- function ke(r, ...e) {
1476
+ function ke(s, ...e) {
1494
1477
  let t = e.shift();
1495
- const i = r.ownerDocument.createNodeIterator(
1496
- r,
1478
+ const i = s.ownerDocument.createNodeIterator(
1479
+ s,
1497
1480
  NodeFilter.SHOW_TEXT
1498
- ), s = [];
1481
+ ), r = [];
1499
1482
  let n = i.nextNode(), o, l = 0;
1500
1483
  for (; t !== void 0 && n; )
1501
- o = n, l + o.data.length > t ? (s.push({ node: o, offset: t - l }), t = e.shift()) : (n = i.nextNode(), l += o.data.length);
1484
+ o = n, l + o.data.length > t ? (r.push({ node: o, offset: t - l }), t = e.shift()) : (n = i.nextNode(), l += o.data.length);
1502
1485
  for (; t !== void 0 && o && l === t; )
1503
- s.push({ node: o, offset: o.data.length }), t = e.shift();
1486
+ r.push({ node: o, offset: o.data.length }), t = e.shift();
1504
1487
  if (t !== void 0)
1505
1488
  throw new RangeError("Offset exceeds text length");
1506
- return s;
1489
+ return r;
1507
1490
  }
1508
1491
  class A {
1509
1492
  constructor(e, t) {
@@ -1552,10 +1535,10 @@ class A {
1552
1535
  NodeFilter.SHOW_TEXT
1553
1536
  );
1554
1537
  i.currentNode = this.element;
1555
- const s = e.direction === 1, n = s ? i.nextNode() : i.previousNode();
1538
+ const r = e.direction === 1, n = r ? i.nextNode() : i.previousNode();
1556
1539
  if (!n)
1557
1540
  throw t;
1558
- return { node: n, offset: s ? 0 : n.data.length };
1541
+ return { node: n, offset: r ? 0 : n.data.length };
1559
1542
  } else
1560
1543
  throw t;
1561
1544
  }
@@ -1594,8 +1577,8 @@ class A {
1594
1577
  if (t < 0 || t > e.childNodes.length)
1595
1578
  throw new Error("Child node offset is out of range");
1596
1579
  let i = 0;
1597
- for (let s = 0; s < t; s++)
1598
- i += Ue(e.childNodes[s]);
1580
+ for (let r = 0; r < t; r++)
1581
+ i += Ue(e.childNodes[r]);
1599
1582
  return new A(e, i);
1600
1583
  }
1601
1584
  default:
@@ -1710,15 +1693,15 @@ class X {
1710
1693
  * Will throw if `range` does not contain any text nodes.
1711
1694
  */
1712
1695
  static fromRange(e, t) {
1713
- const i = e.textContent, s = z.fromRange(t).relativeTo(e), n = s.start.offset, o = s.end.offset, l = 32;
1696
+ const i = e.textContent, r = z.fromRange(t).relativeTo(e), n = r.start.offset, o = r.end.offset, l = 32;
1714
1697
  return new X(e, i.slice(n, o), {
1715
1698
  prefix: i.slice(Math.max(0, n - l), n),
1716
1699
  suffix: i.slice(o, Math.min(i.length, o + l))
1717
1700
  });
1718
1701
  }
1719
1702
  static fromSelector(e, t) {
1720
- const { prefix: i, suffix: s } = t;
1721
- return new X(e, t.exact, { prefix: i, suffix: s });
1703
+ const { prefix: i, suffix: r } = t;
1704
+ return new X(e, t.exact, { prefix: i, suffix: r });
1722
1705
  }
1723
1706
  toSelector() {
1724
1707
  return {
@@ -1741,17 +1724,17 @@ class X {
1741
1724
  return new _(this.root, i.start, i.end);
1742
1725
  }
1743
1726
  }
1744
- function xt(r) {
1745
- const e = r.tagName.toUpperCase();
1727
+ function xt(s) {
1728
+ const e = s.tagName.toUpperCase();
1746
1729
  return e === "IMG" || e === "VIDEO" || e === "AUDIO" || e === "IFRAME" || e === "OBJECT" || e === "EMBED" || e === "CANVAS";
1747
1730
  }
1748
- function le(r, e) {
1731
+ function le(s, e) {
1749
1732
  try {
1750
1733
  const t = e.locations, i = e.text;
1751
1734
  if (i && i.highlight) {
1752
- let s;
1753
- t && t.getCssSelector() && (s = r.querySelector(t.getCssSelector())), s || (s = r.body);
1754
- const n = new X(s, i.highlight, {
1735
+ let r;
1736
+ t && t.getCssSelector() && (r = s.querySelector(t.getCssSelector())), r || (r = s.body);
1737
+ const n = new X(r, i.highlight, {
1755
1738
  prefix: i.before,
1756
1739
  suffix: i.after
1757
1740
  });
@@ -1762,15 +1745,15 @@ function le(r, e) {
1762
1745
  }
1763
1746
  }
1764
1747
  if (t) {
1765
- let s = null;
1766
- if (!s && t.getCssSelector() && (s = r.querySelector(t.getCssSelector())), !s && t.fragments) {
1748
+ let r = null;
1749
+ if (!r && t.getCssSelector() && (r = s.querySelector(t.getCssSelector())), !r && t.fragments) {
1767
1750
  for (const n of t.fragments)
1768
- if (s = r.getElementById(n), s)
1751
+ if (r = s.getElementById(n), r)
1769
1752
  break;
1770
1753
  }
1771
- if (s) {
1772
- const n = r.createRange();
1773
- return s.childNodes.length === 0 || xt(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
1754
+ if (r) {
1755
+ const n = s.createRange();
1756
+ return r.childNodes.length === 0 || xt(r) ? (n.selectNode(r), n) : (n.setStartBefore(r), n.setEndAfter(r), n);
1774
1757
  }
1775
1758
  }
1776
1759
  } catch (t) {
@@ -1778,12 +1761,12 @@ function le(r, e) {
1778
1761
  }
1779
1762
  return null;
1780
1763
  }
1781
- function St(r, e) {
1782
- let t = r.getClientRects();
1783
- t.length || r.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (t = r.commonAncestorContainer.getClientRects());
1784
- const i = 1, s = [];
1764
+ function St(s, e) {
1765
+ let t = s.getClientRects();
1766
+ t.length || s.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (t = s.commonAncestorContainer.getClientRects());
1767
+ const i = 1, r = [];
1785
1768
  for (const h of t)
1786
- s.push({
1769
+ r.push({
1787
1770
  bottom: h.bottom,
1788
1771
  height: h.height,
1789
1772
  left: h.left,
@@ -1792,7 +1775,7 @@ function St(r, e) {
1792
1775
  width: h.width
1793
1776
  });
1794
1777
  const n = $e(
1795
- s,
1778
+ r,
1796
1779
  i,
1797
1780
  e
1798
1781
  ), o = wt(n, i), l = He(o), c = 2 * 2;
@@ -1806,15 +1789,15 @@ function St(r, e) {
1806
1789
  }
1807
1790
  return l;
1808
1791
  }
1809
- function $e(r, e, t) {
1810
- for (let i = 0; i < r.length; i++)
1811
- for (let s = i + 1; s < r.length; s++) {
1812
- const n = r[i], o = r[s];
1792
+ function $e(s, e, t) {
1793
+ for (let i = 0; i < s.length; i++)
1794
+ for (let r = i + 1; r < s.length; r++) {
1795
+ const n = s[i], o = s[r];
1813
1796
  if (n === o)
1814
1797
  continue;
1815
1798
  const l = M(n.top, o.top, e) && M(n.bottom, o.bottom, e), c = M(n.left, o.left, e) && M(n.right, o.right, e);
1816
1799
  if ((c && !t || l && !c) && je(n, o, e)) {
1817
- const d = r.filter((g) => g !== n && g !== o), f = Tt(n, o);
1800
+ const d = s.filter((g) => g !== n && g !== o), f = Tt(n, o);
1818
1801
  return d.push(f), $e(
1819
1802
  d,
1820
1803
  e,
@@ -1822,27 +1805,27 @@ function $e(r, e, t) {
1822
1805
  );
1823
1806
  }
1824
1807
  }
1825
- return r;
1808
+ return s;
1826
1809
  }
1827
- function Tt(r, e) {
1828
- const t = Math.min(r.left, e.left), i = Math.max(r.right, e.right), s = Math.min(r.top, e.top), n = Math.max(r.bottom, e.bottom);
1810
+ function Tt(s, e) {
1811
+ const t = Math.min(s.left, e.left), i = Math.max(s.right, e.right), r = Math.min(s.top, e.top), n = Math.max(s.bottom, e.bottom);
1829
1812
  return {
1830
1813
  bottom: n,
1831
- height: n - s,
1814
+ height: n - r,
1832
1815
  left: t,
1833
1816
  right: i,
1834
- top: s,
1817
+ top: r,
1835
1818
  width: i - t
1836
1819
  };
1837
1820
  }
1838
- function wt(r, e) {
1839
- const t = new Set(r);
1840
- for (const i of r) {
1821
+ function wt(s, e) {
1822
+ const t = new Set(s);
1823
+ for (const i of s) {
1841
1824
  if (!(i.width > 1 && i.height > 1)) {
1842
1825
  t.delete(i);
1843
1826
  continue;
1844
1827
  }
1845
- for (const n of r)
1828
+ for (const n of s)
1846
1829
  if (i !== n && t.has(n) && Ct(n, i, e)) {
1847
1830
  t.delete(i);
1848
1831
  break;
@@ -1850,125 +1833,125 @@ function wt(r, e) {
1850
1833
  }
1851
1834
  return Array.from(t);
1852
1835
  }
1853
- function Ct(r, e, t) {
1854
- return H(r, e.left, e.top, t) && H(r, e.right, e.top, t) && H(r, e.left, e.bottom, t) && H(r, e.right, e.bottom, t);
1836
+ function Ct(s, e, t) {
1837
+ return H(s, e.left, e.top, t) && H(s, e.right, e.top, t) && H(s, e.left, e.bottom, t) && H(s, e.right, e.bottom, t);
1855
1838
  }
1856
- function H(r, e, t, i) {
1857
- return (r.left < e || M(r.left, e, i)) && (r.right > e || M(r.right, e, i)) && (r.top < t || M(r.top, t, i)) && (r.bottom > t || M(r.bottom, t, i));
1839
+ function H(s, e, t, i) {
1840
+ return (s.left < e || M(s.left, e, i)) && (s.right > e || M(s.right, e, i)) && (s.top < t || M(s.top, t, i)) && (s.bottom > t || M(s.bottom, t, i));
1858
1841
  }
1859
- function He(r) {
1860
- for (let e = 0; e < r.length; e++)
1861
- for (let t = e + 1; t < r.length; t++) {
1862
- const i = r[e], s = r[t];
1863
- if (i !== s && je(i, s, -1)) {
1842
+ function He(s) {
1843
+ for (let e = 0; e < s.length; e++)
1844
+ for (let t = e + 1; t < s.length; t++) {
1845
+ const i = s[e], r = s[t];
1846
+ if (i !== r && je(i, r, -1)) {
1864
1847
  let n = [], o;
1865
- const l = Ce(i, s);
1848
+ const l = Ce(i, r);
1866
1849
  if (l.length === 1)
1867
1850
  n = l, o = i;
1868
1851
  else {
1869
- const h = Ce(s, i);
1870
- l.length < h.length ? (n = l, o = i) : (n = h, o = s);
1852
+ const h = Ce(r, i);
1853
+ l.length < h.length ? (n = l, o = i) : (n = h, o = r);
1871
1854
  }
1872
- const c = r.filter((h) => h !== o);
1855
+ const c = s.filter((h) => h !== o);
1873
1856
  return Array.prototype.push.apply(c, n), He(c);
1874
1857
  }
1875
1858
  }
1876
- return r;
1859
+ return s;
1877
1860
  }
1878
- function Ce(r, e) {
1879
- const t = Pt(e, r);
1861
+ function Ce(s, e) {
1862
+ const t = Pt(e, s);
1880
1863
  if (t.height === 0 || t.width === 0)
1881
- return [r];
1864
+ return [s];
1882
1865
  const i = [];
1883
1866
  {
1884
- const s = {
1885
- bottom: r.bottom,
1867
+ const r = {
1868
+ bottom: s.bottom,
1886
1869
  height: 0,
1887
- left: r.left,
1870
+ left: s.left,
1888
1871
  right: t.left,
1889
- top: r.top,
1872
+ top: s.top,
1890
1873
  width: 0
1891
1874
  };
1892
- s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
1875
+ r.width = r.right - r.left, r.height = r.bottom - r.top, r.height !== 0 && r.width !== 0 && i.push(r);
1893
1876
  }
1894
1877
  {
1895
- const s = {
1878
+ const r = {
1896
1879
  bottom: t.top,
1897
1880
  height: 0,
1898
1881
  left: t.left,
1899
1882
  right: t.right,
1900
- top: r.top,
1883
+ top: s.top,
1901
1884
  width: 0
1902
1885
  };
1903
- s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
1886
+ r.width = r.right - r.left, r.height = r.bottom - r.top, r.height !== 0 && r.width !== 0 && i.push(r);
1904
1887
  }
1905
1888
  {
1906
- const s = {
1907
- bottom: r.bottom,
1889
+ const r = {
1890
+ bottom: s.bottom,
1908
1891
  height: 0,
1909
1892
  left: t.left,
1910
1893
  right: t.right,
1911
1894
  top: t.bottom,
1912
1895
  width: 0
1913
1896
  };
1914
- s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
1897
+ r.width = r.right - r.left, r.height = r.bottom - r.top, r.height !== 0 && r.width !== 0 && i.push(r);
1915
1898
  }
1916
1899
  {
1917
- const s = {
1918
- bottom: r.bottom,
1900
+ const r = {
1901
+ bottom: s.bottom,
1919
1902
  height: 0,
1920
1903
  left: t.right,
1921
- right: r.right,
1922
- top: r.top,
1904
+ right: s.right,
1905
+ top: s.top,
1923
1906
  width: 0
1924
1907
  };
1925
- s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
1908
+ r.width = r.right - r.left, r.height = r.bottom - r.top, r.height !== 0 && r.width !== 0 && i.push(r);
1926
1909
  }
1927
1910
  return i;
1928
1911
  }
1929
- function Pt(r, e) {
1930
- const t = Math.max(r.left, e.left), i = Math.min(r.right, e.right), s = Math.max(r.top, e.top), n = Math.min(r.bottom, e.bottom);
1912
+ function Pt(s, e) {
1913
+ const t = Math.max(s.left, e.left), i = Math.min(s.right, e.right), r = Math.max(s.top, e.top), n = Math.min(s.bottom, e.bottom);
1931
1914
  return {
1932
1915
  bottom: n,
1933
- height: Math.max(0, n - s),
1916
+ height: Math.max(0, n - r),
1934
1917
  left: t,
1935
1918
  right: i,
1936
- top: s,
1919
+ top: r,
1937
1920
  width: Math.max(0, i - t)
1938
1921
  };
1939
1922
  }
1940
- function je(r, e, t) {
1941
- return (r.left < e.right || t >= 0 && M(r.left, e.right, t)) && (e.left < r.right || t >= 0 && M(e.left, r.right, t)) && (r.top < e.bottom || t >= 0 && M(r.top, e.bottom, t)) && (e.top < r.bottom || t >= 0 && M(e.top, r.bottom, t));
1923
+ function je(s, e, t) {
1924
+ return (s.left < e.right || t >= 0 && M(s.left, e.right, t)) && (e.left < s.right || t >= 0 && M(e.left, s.right, t)) && (s.top < e.bottom || t >= 0 && M(s.top, e.bottom, t)) && (e.top < s.bottom || t >= 0 && M(e.top, s.bottom, t));
1942
1925
  }
1943
- function M(r, e, t) {
1944
- return Math.abs(r - e) <= t;
1926
+ function M(s, e, t) {
1927
+ return Math.abs(s - e) <= t;
1945
1928
  }
1946
- function Ve(r) {
1947
- const e = {}, t = r.document.documentElement.style;
1948
- for (const i in r.document.documentElement.style)
1929
+ function Ve(s) {
1930
+ const e = {}, t = s.document.documentElement.style;
1931
+ for (const i in s.document.documentElement.style)
1949
1932
  Object.hasOwn(t, i) && !Number.isNaN(Number.parseInt(i)) && (e[t[i]] = t.getPropertyValue(t[i]));
1950
1933
  return e;
1951
1934
  }
1952
- function Nt(r, e) {
1953
- const t = Ve(r);
1935
+ function Nt(s, e) {
1936
+ const t = Ve(s);
1954
1937
  Object.keys(t).forEach((i) => {
1955
- e.hasOwnProperty(i) || he(r, i);
1956
- }), Object.entries(e).forEach(([i, s]) => {
1957
- t[i] !== s && G(r, i, s);
1938
+ e.hasOwnProperty(i) || he(s, i);
1939
+ }), Object.entries(e).forEach(([i, r]) => {
1940
+ t[i] !== r && G(s, i, r);
1958
1941
  });
1959
1942
  }
1960
- function Pe(r, e) {
1961
- return r.document.documentElement.style.getPropertyValue(e);
1943
+ function Pe(s, e) {
1944
+ return s.document.documentElement.style.getPropertyValue(e);
1962
1945
  }
1963
- function G(r, e, t) {
1964
- r.document.documentElement.style.setProperty(e, t);
1946
+ function G(s, e, t) {
1947
+ s.document.documentElement.style.setProperty(e, t);
1965
1948
  }
1966
- function he(r, e) {
1967
- r.document.documentElement.style.removeProperty(e);
1949
+ function he(s, e) {
1950
+ s.document.documentElement.style.removeProperty(e);
1968
1951
  }
1969
- const Mt = (r) => {
1970
- if (r.startsWith("rgb")) {
1971
- const e = r.match(/rgb\((\d+),\s(\d+),\s(\d+)(?:,\s(\d+))?\)/);
1952
+ const Mt = (s) => {
1953
+ if (s.startsWith("rgb")) {
1954
+ const e = s.match(/rgb\((\d+),\s(\d+),\s(\d+)(?:,\s(\d+))?\)/);
1972
1955
  if (e)
1973
1956
  return {
1974
1957
  r: parseInt(e[1], 10),
@@ -1976,8 +1959,8 @@ const Mt = (r) => {
1976
1959
  b: parseInt(e[3], 10),
1977
1960
  a: e[4] ? parseInt(e[4], 10) / 255 : 1
1978
1961
  };
1979
- } else if (r.startsWith("#")) {
1980
- const e = r.slice(1);
1962
+ } else if (s.startsWith("#")) {
1963
+ const e = s.slice(1);
1981
1964
  if (e.length === 3 || e.length === 4)
1982
1965
  return {
1983
1966
  r: parseInt(e[0] + e[0], 16) / 255,
@@ -1994,11 +1977,11 @@ const Mt = (r) => {
1994
1977
  };
1995
1978
  }
1996
1979
  return { r: 0, g: 0, b: 0, a: 1 };
1997
- }, At = (r) => 0.2126 * r.r * r.a + 0.7152 * r.g * r.a + 0.0722 * r.b * r.a, Ot = (r) => {
1998
- const e = Mt(r);
1980
+ }, At = (s) => 0.2126 * s.r * s.a + 0.7152 * s.g * s.a + 0.0722 * s.b * s.a, Ot = (s) => {
1981
+ const e = Mt(s);
1999
1982
  return At(e) < 128;
2000
1983
  };
2001
- var It = /* @__PURE__ */ ((r) => (r.Wrap = "wrap", r.Viewport = "viewport", r.Bounds = "bounds", r.Page = "page", r))(It || {}), Lt = /* @__PURE__ */ ((r) => (r.Boxes = "boxes", r.Bounds = "bounds", r))(Lt || {});
1984
+ var It = /* @__PURE__ */ ((s) => (s.Wrap = "wrap", s.Viewport = "viewport", s.Bounds = "bounds", s.Page = "page", s))(It || {}), Lt = /* @__PURE__ */ ((s) => (s.Boxes = "boxes", s.Bounds = "bounds", s))(Lt || {});
2002
1985
  const Rt = () => "Highlight" in window, Ne = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
2003
1986
  class zt {
2004
1987
  /**
@@ -2006,8 +1989,8 @@ class zt {
2006
1989
  * @param id Unique HTML ID-adhering name of the group
2007
1990
  * @param name Human-readable name of the group
2008
1991
  */
2009
- constructor(e, t, i, s) {
2010
- this.wnd = e, this.comms = t, this.id = i, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, Rt() && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
1992
+ constructor(e, t, i, r) {
1993
+ this.wnd = e, this.comms = t, this.id = i, this.name = r, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, Rt() && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
2011
1994
  }
2012
1995
  get activeable() {
2013
1996
  return this.activateable;
@@ -2026,8 +2009,8 @@ class zt {
2026
2009
  this.comms.log("Can't locate DOM range for decoration", e);
2027
2010
  return;
2028
2011
  }
2029
- const s = i.commonAncestorContainer;
2030
- s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Ne.includes(s.nodeName.toUpperCase()) && ((o = this.notTextFlag) == null || o.set(t, !0)), s.querySelector(Ne.join(", ").toLowerCase()) && ((l = this.notTextFlag) == null || l.set(t, !0)), (((c = s.textContent) == null ? void 0 : c.trim()) || "").length === 0 && ((h = this.notTextFlag) == null || h.set(t, !0)));
2012
+ const r = i.commonAncestorContainer;
2013
+ r.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Ne.includes(r.nodeName.toUpperCase()) && ((o = this.notTextFlag) == null || o.set(t, !0)), r.querySelector(Ne.join(", ").toLowerCase()) && ((l = this.notTextFlag) == null || l.set(t, !0)), (((c = r.textContent) == null ? void 0 : c.trim()) || "").length === 0 && ((h = this.notTextFlag) == null || h.set(t, !0)));
2031
2014
  const n = {
2032
2015
  decoration: e,
2033
2016
  id: t,
@@ -2040,12 +2023,12 @@ class zt {
2040
2023
  * @param identifier ID of item to remove
2041
2024
  */
2042
2025
  remove(e) {
2043
- var s, n;
2026
+ var r, n;
2044
2027
  const t = this.items.findIndex((o) => o.decoration.id === e);
2045
2028
  if (t < 0)
2046
2029
  return;
2047
2030
  const i = this.items[t];
2048
- if (this.items.splice(t, 1), i.clickableElements = void 0, i.container && (i.container.remove(), i.container = void 0), this.experimentalHighlights && !((s = this.notTextFlag) != null && s.has(i.id))) {
2031
+ if (this.items.splice(t, 1), i.clickableElements = void 0, i.container && (i.container.remove(), i.container = void 0), this.experimentalHighlights && !((r = this.notTextFlag) != null && r.has(i.id))) {
2049
2032
  const o = this.wnd.CSS.highlights.get(this.id);
2050
2033
  o == null || o.delete(i.range);
2051
2034
  }
@@ -2073,12 +2056,12 @@ class zt {
2073
2056
  this.wnd.cancelAnimationFrame(this.currentRender), this.clearContainer(), this.items.forEach((e) => this.layout(e)), this.renderLayout(this.items);
2074
2057
  }
2075
2058
  experimentalLayout(e) {
2076
- var s, n;
2059
+ var r, n;
2077
2060
  const [t, i] = this.requireContainer(!0);
2078
2061
  i.add(e.range), t.innerHTML = `
2079
2062
  ::highlight(${this.id}) {
2080
2063
  color: black;
2081
- background-color: ${((n = (s = e.decoration) == null ? void 0 : s.style) == null ? void 0 : n.tint) ?? "yellow"};
2064
+ background-color: ${((n = (r = e.decoration) == null ? void 0 : r.style) == null ? void 0 : n.tint) ?? "yellow"};
2082
2065
  }`;
2083
2066
  }
2084
2067
  /**
@@ -2086,29 +2069,29 @@ class zt {
2086
2069
  * @param item
2087
2070
  */
2088
2071
  layout(e) {
2089
- var g, m, v, S, O;
2072
+ var g, m, v, x, O;
2090
2073
  if (this.experimentalHighlights && !((g = this.notTextFlag) != null && g.has(e.id)))
2091
2074
  return this.experimentalLayout(e);
2092
2075
  const t = this.wnd.document.createElement("div");
2093
2076
  t.setAttribute("id", e.id), t.style.setProperty("pointer-events", "none");
2094
- const i = this.wnd.innerWidth, s = parseInt(
2077
+ const i = this.wnd.innerWidth, r = parseInt(
2095
2078
  getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
2096
2079
  "column-count"
2097
2080
  )
2098
- ), n = i / (s || 1), o = this.wnd.document.scrollingElement, l = o.scrollLeft, c = o.scrollTop, h = (y, E, I) => {
2081
+ ), n = i / (r || 1), o = this.wnd.document.scrollingElement, l = o.scrollLeft, c = o.scrollTop, h = (y, b, I) => {
2099
2082
  var ce, ue, de, pe, fe, me;
2100
2083
  if (y.style.position = "absolute", ((ue = (ce = e.decoration) == null ? void 0 : ce.style) == null ? void 0 : ue.width) === "viewport") {
2101
- y.style.width = `${i}px`, y.style.height = `${E.height}px`;
2102
- let K = Math.floor(E.left / i) * i;
2103
- y.style.left = `${K + l}px`, y.style.top = `${E.top + c}px`;
2084
+ y.style.width = `${i}px`, y.style.height = `${b.height}px`;
2085
+ let K = Math.floor(b.left / i) * i;
2086
+ y.style.left = `${K + l}px`, y.style.top = `${b.top + c}px`;
2104
2087
  } else if (((pe = (de = e.decoration) == null ? void 0 : de.style) == null ? void 0 : pe.width) === "bounds")
2105
- y.style.width = `${I.width}px`, y.style.height = `${E.height}px`, y.style.left = `${I.left + l}px`, y.style.top = `${E.top + c}px`;
2088
+ y.style.width = `${I.width}px`, y.style.height = `${b.height}px`, y.style.left = `${I.left + l}px`, y.style.top = `${b.top + c}px`;
2106
2089
  else if (((me = (fe = e.decoration) == null ? void 0 : fe.style) == null ? void 0 : me.width) === "page") {
2107
- y.style.width = `${n}px`, y.style.height = `${E.height}px`;
2108
- let K = Math.floor(E.left / n) * n;
2109
- y.style.left = `${K + l}px`, y.style.top = `${E.top + c}px`;
2090
+ y.style.width = `${n}px`, y.style.height = `${b.height}px`;
2091
+ let K = Math.floor(b.left / n) * n;
2092
+ y.style.left = `${K + l}px`, y.style.top = `${b.top + c}px`;
2110
2093
  } else
2111
- y.style.width = `${E.width}px`, y.style.height = `${E.height}px`, y.style.left = `${E.left + l}px`, y.style.top = `${E.top + c}px`;
2094
+ y.style.width = `${b.width}px`, y.style.height = `${b.height}px`, y.style.left = `${b.left + l}px`, y.style.top = `${b.top + c}px`;
2112
2095
  }, u = e.range.getBoundingClientRect();
2113
2096
  let p = this.wnd.document.createElement("template");
2114
2097
  const d = Pe(this.wnd, "--USER__appearance") === "readium-night-on" || Ot(Pe(this.wnd, "--USER__backgroundColor"));
@@ -2126,7 +2109,7 @@ class zt {
2126
2109
  </div>
2127
2110
  `.trim();
2128
2111
  const f = p.content.firstElementChild;
2129
- if (((O = (S = e.decoration) == null ? void 0 : S.style) == null ? void 0 : O.layout) === "bounds") {
2112
+ if (((O = (x = e.decoration) == null ? void 0 : x.style) == null ? void 0 : O.layout) === "bounds") {
2130
2113
  const y = f.cloneNode(!0);
2131
2114
  y.style.setProperty("pointer-events", "none"), h(y, u, u), t.append(y);
2132
2115
  } else {
@@ -2135,10 +2118,10 @@ class zt {
2135
2118
  !0
2136
2119
  // doNotMergeHorizontallyAlignedRects
2137
2120
  );
2138
- y = y.sort((E, I) => E.top < I.top ? -1 : E.top > I.top ? 1 : 0);
2139
- for (let E of y) {
2121
+ y = y.sort((b, I) => b.top < I.top ? -1 : b.top > I.top ? 1 : 0);
2122
+ for (let b of y) {
2140
2123
  const I = f.cloneNode(!0);
2141
- I.style.setProperty("pointer-events", "none"), h(I, E, u), t.append(I);
2124
+ I.style.setProperty("pointer-events", "none"), h(I, b, u), t.append(I);
2142
2125
  }
2143
2126
  }
2144
2127
  e.container = t, e.clickableElements = Array.from(
@@ -2148,8 +2131,8 @@ class zt {
2148
2131
  renderLayout(e) {
2149
2132
  this.wnd.cancelAnimationFrame(this.currentRender), this.currentRender = this.wnd.requestAnimationFrame(() => {
2150
2133
  if (e = e.filter((i) => {
2151
- var s;
2152
- return !this.experimentalHighlights || !!((s = this.notTextFlag) != null && s.has(i.id));
2134
+ var r;
2135
+ return !this.experimentalHighlights || !!((r = this.notTextFlag) != null && r.has(i.id));
2153
2136
  }), !e || e.length === 0)
2154
2137
  return;
2155
2138
  this.requireContainer().append(...e.map((i) => i.container).filter((i) => !!i));
@@ -2190,7 +2173,7 @@ const qe = class Q extends Y {
2190
2173
  }, 50);
2191
2174
  }
2192
2175
  mount(e, t) {
2193
- return this.wnd = e, t.register("decorate", Q.moduleName, (i, s) => {
2176
+ return this.wnd = e, t.register("decorate", Q.moduleName, (i, r) => {
2194
2177
  const n = i;
2195
2178
  n.decoration && n.decoration.locator && (n.decoration.locator = D.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new zt(
2196
2179
  e,
@@ -2213,7 +2196,7 @@ const qe = class Q extends Y {
2213
2196
  o == null || o.update(n.decoration);
2214
2197
  break;
2215
2198
  }
2216
- s(!0);
2199
+ r(!0);
2217
2200
  }), this.resizeObserver = new ResizeObserver(() => e.requestAnimationFrame(() => this.handleResize())), this.resizeObserver.observe(e.document.body), e.addEventListener("orientationchange", this.handleResizer), e.addEventListener("resize", this.handleResizer), t.log("Decorator Mounted"), !0;
2218
2201
  }
2219
2202
  unmount(e, t) {
@@ -2235,9 +2218,9 @@ const Me = "readium-snapper-style", _e = class ee extends Y {
2235
2218
  }
2236
2219
  mount(e, t) {
2237
2220
  const i = e.document.createElement("style");
2238
- return i.dataset.readium = "true", i.id = Me, i.textContent = this.buildStyles(), e.document.head.appendChild(i), t.register("protect", ee.moduleName, (s, n) => {
2221
+ return i.dataset.readium = "true", i.id = Me, i.textContent = this.buildStyles(), e.document.head.appendChild(i), t.register("protect", ee.moduleName, (r, n) => {
2239
2222
  this.protected = !0, i.textContent = this.buildStyles(), n(!0);
2240
- }), t.register("unprotect", ee.moduleName, (s, n) => {
2223
+ }), t.register("unprotect", ee.moduleName, (r, n) => {
2241
2224
  this.protected = !1, i.textContent = this.buildStyles(), n(!0);
2242
2225
  }), t.log("Snapper Mounted"), !0;
2243
2226
  }
@@ -2248,44 +2231,44 @@ const Me = "readium-snapper-style", _e = class ee extends Y {
2248
2231
  };
2249
2232
  _e.moduleName = "snapper";
2250
2233
  let Xe = _e;
2251
- function W(r) {
2252
- return r.document.body.dir.toLowerCase() === "rtl";
2234
+ function W(s) {
2235
+ return s.document.body.dir.toLowerCase() === "rtl";
2253
2236
  }
2254
- function Ge(r) {
2237
+ function Ge(s) {
2255
2238
  return parseInt(
2256
- r.getComputedStyle(
2257
- r.document.documentElement
2239
+ s.getComputedStyle(
2240
+ s.document.documentElement
2258
2241
  ).getPropertyValue("column-count")
2259
2242
  );
2260
2243
  }
2261
- function Ae(r) {
2262
- const e = getComputedStyle(r), t = parseFloat(e.paddingTop || "0"), i = parseFloat(e.paddingBottom || "0");
2263
- return r.clientHeight - t - i;
2244
+ function Ae(s) {
2245
+ const e = getComputedStyle(s), t = parseFloat(e.paddingTop || "0"), i = parseFloat(e.paddingBottom || "0");
2246
+ return s.clientHeight - t - i;
2264
2247
  }
2265
- function Oe(r) {
2266
- const e = Ge(r);
2248
+ function Oe(s) {
2249
+ const e = Ge(s);
2267
2250
  if (!e)
2268
2251
  return !1;
2269
- const t = r.document.querySelectorAll("div[id^='readium-virtual-page']");
2252
+ const t = s.document.querySelectorAll("div[id^='readium-virtual-page']");
2270
2253
  for (const h of t)
2271
2254
  h.remove();
2272
- const i = t.length, s = r.document.scrollingElement.scrollWidth, n = r.visualViewport.width, l = Math.round(s / n * e) % e, c = e === 1 || l === 0 ? 0 : e - l;
2255
+ const i = t.length, r = s.document.scrollingElement.scrollWidth, n = s.visualViewport.width, l = Math.round(r / n * e) % e, c = e === 1 || l === 0 ? 0 : e - l;
2273
2256
  if (c > 0)
2274
2257
  for (let h = 0; h < c; h++) {
2275
- const u = r.document.createElement("div");
2276
- u.setAttribute("id", `readium-virtual-page-${h}`), u.dataset.readium = "true", CSS.supports("break-before", "column") ? u.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (u.style.breakInside = "avoid-column"), u.style.height = Ae(r.document.documentElement) + "px"), u.innerHTML = "&#8203;", r.document.body.appendChild(u);
2258
+ const u = s.document.createElement("div");
2259
+ u.setAttribute("id", `readium-virtual-page-${h}`), u.dataset.readium = "true", CSS.supports("break-before", "column") ? u.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (u.style.breakInside = "avoid-column"), u.style.height = Ae(s.document.documentElement) + "px"), u.innerHTML = "&#8203;", s.document.body.appendChild(u);
2277
2260
  }
2278
2261
  return i !== c;
2279
2262
  }
2280
- function Wt(r) {
2281
- const e = r.document.createElement("style");
2282
- e.appendChild(r.document.createTextNode("*{}")), r.document.body.appendChild(e), r.document.body.removeChild(e);
2263
+ function Wt(s) {
2264
+ const e = s.document.createElement("style");
2265
+ e.appendChild(s.document.createTextNode("*{}")), s.document.body.appendChild(e), s.document.body.removeChild(e);
2283
2266
  }
2284
- function Ft(r) {
2285
- return r < 0.5 ? 2 * r * r : -1 + (4 - 2 * r) * r;
2267
+ function Ft(s) {
2268
+ return s < 0.5 ? 2 * s * s : -1 + (4 - 2 * s) * s;
2286
2269
  }
2287
- function T(r) {
2288
- const e = r.getSelection();
2270
+ function S(s) {
2271
+ const e = s.getSelection();
2289
2272
  e && e.removeAllRanges();
2290
2273
  }
2291
2274
  const Bt = [
@@ -2302,18 +2285,18 @@ const Bt = [
2302
2285
  "textarea",
2303
2286
  "video"
2304
2287
  ];
2305
- function Ye(r) {
2288
+ function Ye(s) {
2306
2289
  var e;
2307
- return Bt.indexOf(r.nodeName.toLowerCase()) !== -1 || r.hasAttribute("contenteditable") && ((e = r.getAttribute("contenteditable")) == null ? void 0 : e.toLowerCase()) !== "false" ? r : r.parentElement ? Ye(r.parentElement) : null;
2290
+ return Bt.indexOf(s.nodeName.toLowerCase()) !== -1 || s.hasAttribute("contenteditable") && ((e = s.getAttribute("contenteditable")) == null ? void 0 : e.toLowerCase()) !== "false" ? s : s.parentElement ? Ye(s.parentElement) : null;
2308
2291
  }
2309
- function Ke(r, e) {
2310
- const t = Ze(r, r.document.body, e), i = r._readium_cssSelectorGenerator.getCssSelector(t, {
2292
+ function Ke(s, e) {
2293
+ const t = Ze(s, s.document.body, e), i = s._readium_cssSelectorGenerator.getCssSelector(t, {
2311
2294
  selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
2312
2295
  });
2313
2296
  return new D({
2314
2297
  href: "#",
2315
2298
  type: "application/xhtml+xml",
2316
- locations: new x({
2299
+ locations: new E({
2317
2300
  otherLocations: /* @__PURE__ */ new Map([
2318
2301
  ["cssSelector", i]
2319
2302
  ])
@@ -2323,28 +2306,28 @@ function Ke(r, e) {
2323
2306
  })
2324
2307
  });
2325
2308
  }
2326
- function Ze(r, e, t) {
2309
+ function Ze(s, e, t) {
2327
2310
  for (var i = 0; i < e.children.length; i++) {
2328
- const s = e.children[i];
2329
- if (!$t(s) && Ut(r, s, t))
2330
- return kt(r, s) ? s : Ze(r, s, t);
2311
+ const r = e.children[i];
2312
+ if (!$t(r) && Ut(s, r, t))
2313
+ return kt(s, r) ? r : Ze(s, r, t);
2331
2314
  }
2332
2315
  return e;
2333
2316
  }
2334
- function Ut(r, e, t) {
2317
+ function Ut(s, e, t) {
2335
2318
  if (e === document.body || e === document.documentElement)
2336
2319
  return !0;
2337
2320
  if (!document || !document.documentElement || !document.body)
2338
2321
  return !1;
2339
2322
  const i = e.getBoundingClientRect();
2340
- return t ? i.bottom > 0 && i.top < r.innerHeight : i.right > 0 && i.left < r.innerWidth;
2323
+ return t ? i.bottom > 0 && i.top < s.innerHeight : i.right > 0 && i.left < s.innerWidth;
2341
2324
  }
2342
- function kt(r, e) {
2325
+ function kt(s, e) {
2343
2326
  const t = e.getBoundingClientRect();
2344
- return t.top >= 0 && t.left >= 0 && t.bottom <= r.innerHeight && t.right <= r.innerWidth;
2327
+ return t.top >= 0 && t.left >= 0 && t.bottom <= s.innerHeight && t.right <= s.innerWidth;
2345
2328
  }
2346
- function $t(r) {
2347
- const e = getComputedStyle(r);
2329
+ function $t(s) {
2330
+ const e = getComputedStyle(s);
2348
2331
  if (e) {
2349
2332
  const t = e.getPropertyValue("display");
2350
2333
  if (t != "block" && t != "list-item" || e.getPropertyValue("opacity") === "0")
@@ -2352,7 +2335,7 @@ function $t(r) {
2352
2335
  }
2353
2336
  return !1;
2354
2337
  }
2355
- const Ie = "readium-column-snapper-style", Ht = 200, Je = class w extends Xe {
2338
+ const Ie = "readium-column-snapper-style", Ht = 200, Je = class C extends Xe {
2356
2339
  constructor() {
2357
2340
  super(...arguments), this.shakeTimeout = 0, this.snappingCancelled = !1, this.alreadyScrollLeft = 0, this.overscroll = 0, this.cachedScrollWidth = 0, this.touchState = 0, this.startingX = void 0, this.endingX = void 0, this.onTouchStarter = this.onTouchStart.bind(this), this.onTouchEnder = this.onTouchEnd.bind(this), this.onWidthChanger = this.onWidthChange.bind(this), this.onTouchMover = this.onTouchMove.bind(this);
2358
2341
  }
@@ -2367,10 +2350,10 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class w extends Xe {
2367
2350
  return t - t % this.wnd.innerWidth;
2368
2351
  }
2369
2352
  reportProgress() {
2370
- const e = this.wnd.scrollX, t = this.cachedScrollWidth, i = Math.max(0, Math.min(1, e / t)), s = Math.max(0, Math.min(1, (e + this.wnd.innerWidth) / t));
2353
+ const e = this.wnd.scrollX, t = this.cachedScrollWidth, i = Math.max(0, Math.min(1, e / t)), r = Math.max(0, Math.min(1, (e + this.wnd.innerWidth) / t));
2371
2354
  this.comms.send("progress", {
2372
2355
  start: i,
2373
- end: s
2356
+ end: r
2374
2357
  });
2375
2358
  }
2376
2359
  shake() {
@@ -2392,13 +2375,13 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class w extends Xe {
2392
2375
  }
2393
2376
  // Snaps the current offset to the page width.
2394
2377
  snapCurrentOffset(e = !1, t = !1) {
2395
- const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o = Ge(this.wnd), l = Math.min(Math.max(0, i), this.cachedScrollWidth), c = W(this.wnd) ? -1 : 1, h = (
2378
+ const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, r = this.doc(), n = this.dragOffset(), o = Ge(this.wnd), l = Math.min(Math.max(0, i), this.cachedScrollWidth), c = W(this.wnd) ? -1 : 1, h = (
2396
2379
  // The hurdle to overcome in order to change pages
2397
2380
  c * (this.wnd.innerWidth / 3) * (c * n > 0 ? 2 : 1)
2398
2381
  ), u = this.snapOffset(l + h);
2399
2382
  if (e && u !== this.scrollOffset()) {
2400
2383
  this.snappingCancelled = !1;
2401
- const p = (m, v, S, O) => S > O ? v : m + (v - m) * Ft(S / O), d = (
2384
+ const p = (m, v, x, O) => x > O ? v : m + (v - m) * Ft(x / O), d = (
2402
2385
  /*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
2403
2386
  Ht * o
2404
2387
  );
@@ -2407,13 +2390,13 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class w extends Xe {
2407
2390
  if (this.snappingCancelled)
2408
2391
  return;
2409
2392
  f || (f = m);
2410
- const v = m - f, S = p(this.overscroll, 0, v, d), O = p(i, u, v, d);
2411
- s.scrollLeft = O, this.overscroll !== 0 && (s.style.transform = `translate3d(${-S}px, 0px, 0px)`), v < d ? this.wnd.requestAnimationFrame(g) : (this.clearTouches(), s.style.removeProperty("transform"), s.scrollLeft = u, t || this.reportProgress());
2393
+ const v = m - f, x = p(this.overscroll, 0, v, d), O = p(i, u, v, d);
2394
+ r.scrollLeft = O, this.overscroll !== 0 && (r.style.transform = `translate3d(${-x}px, 0px, 0px)`), v < d ? this.wnd.requestAnimationFrame(g) : (this.clearTouches(), r.style.removeProperty("transform"), r.scrollLeft = u, t || this.reportProgress());
2412
2395
  };
2413
2396
  this.wnd.requestAnimationFrame(g);
2414
2397
  } else
2415
- s.style.removeProperty("transform"), this.wnd.requestAnimationFrame(() => {
2416
- s.scrollLeft = u, this.clearTouches(), t || this.reportProgress();
2398
+ r.style.removeProperty("transform"), this.wnd.requestAnimationFrame(() => {
2399
+ r.scrollLeft = u, this.clearTouches(), t || this.reportProgress();
2417
2400
  });
2418
2401
  }
2419
2402
  dragOffset() {
@@ -2449,7 +2432,7 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class w extends Xe {
2449
2432
  onTouchMove(e) {
2450
2433
  if (this.touchState === 0)
2451
2434
  return;
2452
- this.touchState === 1 && (this.touchState = 2, T(this.wnd)), this.endingX = e.touches[0].clientX;
2435
+ this.touchState === 1 && (this.touchState = 2, S(this.wnd)), this.endingX = e.touches[0].clientX;
2453
2436
  const t = this.dragOffset(), i = this.alreadyScrollLeft + t;
2454
2437
  i < 0 ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`) : i + this.wnd.innerWidth > this.cachedScrollWidth ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-i}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = this.alreadyScrollLeft + t);
2455
2438
  }
@@ -2506,11 +2489,11 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class w extends Xe {
2506
2489
  } else
2507
2490
  e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
2508
2491
  }), e.frameElement && this.mutationObserver.observe(e.frameElement, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(e.document, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(e.document.documentElement, { attributes: !0, attributeFilter: ["style"] });
2509
- const s = (n) => {
2492
+ const r = (n) => {
2510
2493
  const o = this.doc().scrollLeft;
2511
2494
  return this.doc().scrollLeft = this.snapOffset(n), o !== this.doc().scrollLeft;
2512
2495
  };
2513
- return e.addEventListener("orientationchange", this.onWidthChanger), e.addEventListener("resize", this.onWidthChanger), e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth), t.register("go_progression", w.moduleName, (n, o) => {
2496
+ return e.addEventListener("orientationchange", this.onWidthChanger), e.addEventListener("resize", this.onWidthChanger), e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth), t.register("go_progression", C.moduleName, (n, o) => {
2514
2497
  const l = n;
2515
2498
  if (l < 0 || l > 1) {
2516
2499
  t.send("error", {
@@ -2521,25 +2504,25 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class w extends Xe {
2521
2504
  this.wnd.requestAnimationFrame(() => {
2522
2505
  this.cachedScrollWidth = this.doc().scrollWidth;
2523
2506
  const c = this.cachedScrollWidth, h = W(e) ? -1 : 1, u = c * l * h;
2524
- this.doc().scrollLeft = this.snapOffset(u), this.reportProgress(), T(this.wnd), o(!0);
2507
+ this.doc().scrollLeft = this.snapOffset(u), this.reportProgress(), S(this.wnd), o(!0);
2525
2508
  });
2526
- }), t.register("go_id", w.moduleName, (n, o) => {
2509
+ }), t.register("go_id", C.moduleName, (n, o) => {
2527
2510
  const l = e.document.getElementById(n);
2528
2511
  if (!l) {
2529
2512
  o(!1);
2530
2513
  return;
2531
2514
  }
2532
2515
  this.wnd.requestAnimationFrame(() => {
2533
- this.doc().scrollLeft = this.snapOffset(l.getBoundingClientRect().left + e.scrollX), this.reportProgress(), T(this.wnd), o(!0);
2516
+ this.doc().scrollLeft = this.snapOffset(l.getBoundingClientRect().left + e.scrollX), this.reportProgress(), S(this.wnd), o(!0);
2534
2517
  });
2535
- }), t.register("go_text", w.moduleName, (n, o) => {
2518
+ }), t.register("go_text", C.moduleName, (n, o) => {
2536
2519
  let l;
2537
2520
  Array.isArray(n) && (n.length > 1 && (l = n[1]), n = n[0]);
2538
2521
  const c = U.deserialize(n), h = le(this.wnd.document, new D({
2539
2522
  href: e.location.href,
2540
2523
  type: "text/html",
2541
2524
  text: c,
2542
- locations: l ? new x({
2525
+ locations: l ? new E({
2543
2526
  otherLocations: /* @__PURE__ */ new Map([
2544
2527
  ["cssSelector", l]
2545
2528
  ])
@@ -2550,44 +2533,44 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class w extends Xe {
2550
2533
  return;
2551
2534
  }
2552
2535
  this.wnd.requestAnimationFrame(() => {
2553
- this.doc().scrollLeft = this.snapOffset(h.getBoundingClientRect().left + e.scrollX), this.reportProgress(), T(this.wnd), o(!0);
2536
+ this.doc().scrollLeft = this.snapOffset(h.getBoundingClientRect().left + e.scrollX), this.reportProgress(), S(this.wnd), o(!0);
2554
2537
  });
2555
- }), t.register("go_end", w.moduleName, (n, o) => {
2538
+ }), t.register("go_end", C.moduleName, (n, o) => {
2556
2539
  const l = W(e) ? -1 : 1;
2557
2540
  this.wnd.requestAnimationFrame(() => {
2558
2541
  this.cachedScrollWidth = this.doc().scrollWidth;
2559
2542
  const c = this.cachedScrollWidth * l;
2560
2543
  if (this.doc().scrollLeft === c)
2561
2544
  return o(!1);
2562
- this.doc().scrollLeft = this.snapOffset(c), this.reportProgress(), T(this.wnd), o(!0);
2545
+ this.doc().scrollLeft = this.snapOffset(c), this.reportProgress(), S(this.wnd), o(!0);
2563
2546
  });
2564
- }), t.register("go_start", w.moduleName, (n, o) => {
2547
+ }), t.register("go_start", C.moduleName, (n, o) => {
2565
2548
  this.wnd.requestAnimationFrame(() => {
2566
2549
  if (this.doc().scrollLeft === 0)
2567
2550
  return o(!1);
2568
- this.doc().scrollLeft = 0, this.reportProgress(), T(this.wnd), o(!0);
2551
+ this.doc().scrollLeft = 0, this.reportProgress(), S(this.wnd), o(!0);
2569
2552
  });
2570
- }), t.register("go_prev", w.moduleName, (n, o) => {
2553
+ }), t.register("go_prev", C.moduleName, (n, o) => {
2571
2554
  this.wnd.requestAnimationFrame(() => {
2572
2555
  this.cachedScrollWidth = this.doc().scrollWidth;
2573
- const l = e.scrollX - e.innerWidth, c = W(e) ? -(this.cachedScrollWidth - e.innerWidth) : 0, h = s(Math.max(l, c));
2574
- h && (this.reportProgress(), T(this.wnd)), o(h);
2556
+ const l = e.scrollX - e.innerWidth, c = W(e) ? -(this.cachedScrollWidth - e.innerWidth) : 0, h = r(Math.max(l, c));
2557
+ h && (this.reportProgress(), S(this.wnd)), o(h);
2575
2558
  });
2576
- }), t.register("go_next", w.moduleName, (n, o) => {
2559
+ }), t.register("go_next", C.moduleName, (n, o) => {
2577
2560
  this.wnd.requestAnimationFrame(() => {
2578
2561
  this.cachedScrollWidth = this.doc().scrollWidth;
2579
- const l = e.scrollX + e.innerWidth, c = W(e) ? 0 : this.cachedScrollWidth - e.innerWidth, h = s(Math.min(l, c));
2580
- h && (this.reportProgress(), T(this.wnd)), o(h);
2562
+ const l = e.scrollX + e.innerWidth, c = W(e) ? 0 : this.cachedScrollWidth - e.innerWidth, h = r(Math.min(l, c));
2563
+ h && (this.reportProgress(), S(this.wnd)), o(h);
2581
2564
  });
2582
- }), t.register("unfocus", w.moduleName, (n, o) => {
2583
- this.snappingCancelled = !0, T(this.wnd), o(!0);
2584
- }), t.register("shake", w.moduleName, (n, o) => {
2565
+ }), t.register("unfocus", C.moduleName, (n, o) => {
2566
+ this.snappingCancelled = !0, S(this.wnd), o(!0);
2567
+ }), t.register("shake", C.moduleName, (n, o) => {
2585
2568
  this.shake(), o(!0);
2586
- }), t.register("focus", w.moduleName, (n, o) => {
2569
+ }), t.register("focus", C.moduleName, (n, o) => {
2587
2570
  this.wnd.requestAnimationFrame(() => {
2588
2571
  this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), o(!0);
2589
2572
  });
2590
- }), t.register("first_visible_locator", w.moduleName, (n, o) => {
2573
+ }), t.register("first_visible_locator", C.moduleName, (n, o) => {
2591
2574
  const l = Ke(e, !1);
2592
2575
  this.comms.send("first_visible_locator", l.serialize()), o(!0);
2593
2576
  }), e.addEventListener("touchstart", this.onTouchStarter, { passive: !0 }), e.addEventListener("touchend", this.onTouchEnder, { passive: !0 }), e.addEventListener("touchmove", this.onTouchMover, { passive: !0 }), e.document.addEventListener("touchstart", () => {
@@ -2595,7 +2578,7 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class w extends Xe {
2595
2578
  }
2596
2579
  unmount(e, t) {
2597
2580
  var i;
2598
- return this.snappingCancelled = !0, t.unregisterAll(w.moduleName), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), e.removeEventListener("touchstart", this.onTouchStarter), e.removeEventListener("touchend", this.onTouchEnder), e.removeEventListener("touchmove", this.onTouchMover), e.removeEventListener("orientationchange", this.onWidthChanger), e.removeEventListener("resize", this.onWidthChanger), (i = e.document.getElementById(Ie)) == null || i.remove(), t.log("ColumnSnapper Unmounted"), super.unmount(e, t);
2581
+ return this.snappingCancelled = !0, t.unregisterAll(C.moduleName), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), e.removeEventListener("touchstart", this.onTouchStarter), e.removeEventListener("touchend", this.onTouchEnder), e.removeEventListener("touchmove", this.onTouchMover), e.removeEventListener("orientationchange", this.onWidthChanger), e.removeEventListener("resize", this.onWidthChanger), (i = e.document.getElementById(Ie)) == null || i.remove(), t.log("ColumnSnapper Unmounted"), super.unmount(e, t);
2599
2582
  }
2600
2583
  };
2601
2584
  Je.moduleName = "column_snapper";
@@ -2622,9 +2605,9 @@ const Le = "readium-scroll-snapper-style", Qe = class P extends Xe {
2622
2605
  reportProgress() {
2623
2606
  if (!this.comms.ready)
2624
2607
  return;
2625
- const e = Math.ceil(this.doc().scrollTop), t = this.doc().scrollHeight, i = this.wnd.innerHeight, s = Math.max(0, Math.min(1, e / t)), n = Math.max(0, Math.min(1, (e + i) / t));
2608
+ const e = Math.ceil(this.doc().scrollTop), t = this.doc().scrollHeight, i = this.wnd.innerHeight, r = Math.max(0, Math.min(1, e / t)), n = Math.max(0, Math.min(1, (e + i) / t));
2626
2609
  this.comms.send("progress", {
2627
- start: s,
2610
+ start: r,
2628
2611
  end: n
2629
2612
  });
2630
2613
  }
@@ -2645,10 +2628,10 @@ const Le = "readium-scroll-snapper-style", Qe = class P extends Xe {
2645
2628
  }, 50);
2646
2629
  }), this.resizeObserver.observe(e.document.body), e.addEventListener("scroll", this.handleScroll, { passive: !0 }), t.register("force_webkit_recalc", P.moduleName, () => {
2647
2630
  Wt(this.wnd);
2648
- const s = this.doc().scrollTop;
2649
- s > 1 ? this.doc().scrollTop = s - 1 : this.doc().scrollTop = s + 1, this.doc().scrollTop = s;
2650
- }), t.register("go_progression", P.moduleName, (s, n) => {
2651
- const o = s;
2631
+ const r = this.doc().scrollTop;
2632
+ r > 1 ? this.doc().scrollTop = r - 1 : this.doc().scrollTop = r + 1, this.doc().scrollTop = r;
2633
+ }), t.register("go_progression", P.moduleName, (r, n) => {
2634
+ const o = r;
2652
2635
  if (o < 0 || o > 1) {
2653
2636
  t.send("error", {
2654
2637
  message: "go_progression must be given a position from 0.0 to 1.0"
@@ -2656,25 +2639,25 @@ const Le = "readium-scroll-snapper-style", Qe = class P extends Xe {
2656
2639
  return;
2657
2640
  }
2658
2641
  this.wnd.requestAnimationFrame(() => {
2659
- this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(), T(this.wnd), n(!0);
2642
+ this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(), S(this.wnd), n(!0);
2660
2643
  });
2661
- }), t.register("go_id", P.moduleName, (s, n) => {
2662
- const o = e.document.getElementById(s);
2644
+ }), t.register("go_id", P.moduleName, (r, n) => {
2645
+ const o = e.document.getElementById(r);
2663
2646
  if (!o) {
2664
2647
  n(!1);
2665
2648
  return;
2666
2649
  }
2667
2650
  this.wnd.requestAnimationFrame(() => {
2668
- this.doc().scrollTop = o.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2, this.reportProgress(), T(this.wnd), n(!0);
2651
+ this.doc().scrollTop = o.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2, this.reportProgress(), S(this.wnd), n(!0);
2669
2652
  });
2670
- }), t.register("go_text", P.moduleName, (s, n) => {
2653
+ }), t.register("go_text", P.moduleName, (r, n) => {
2671
2654
  let o;
2672
- Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
2673
- const l = U.deserialize(s), c = le(this.wnd.document, new D({
2655
+ Array.isArray(r) && (r.length > 1 && (o = r[1]), r = r[0]);
2656
+ const l = U.deserialize(r), c = le(this.wnd.document, new D({
2674
2657
  href: e.location.href,
2675
2658
  type: "text/html",
2676
2659
  text: l,
2677
- locations: o ? new x({
2660
+ locations: o ? new E({
2678
2661
  otherLocations: /* @__PURE__ */ new Map([
2679
2662
  ["cssSelector", o]
2680
2663
  ])
@@ -2685,24 +2668,24 @@ const Le = "readium-scroll-snapper-style", Qe = class P extends Xe {
2685
2668
  return;
2686
2669
  }
2687
2670
  this.wnd.requestAnimationFrame(() => {
2688
- this.doc().scrollTop = c.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2, this.reportProgress(), T(this.wnd), n(!0);
2671
+ this.doc().scrollTop = c.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2, this.reportProgress(), S(this.wnd), n(!0);
2689
2672
  });
2690
- }), t.register("go_start", P.moduleName, (s, n) => {
2673
+ }), t.register("go_start", P.moduleName, (r, n) => {
2691
2674
  if (this.doc().scrollTop === 0)
2692
2675
  return n(!1);
2693
2676
  this.doc().scrollTop = 0, this.reportProgress(), n(!0);
2694
- }), t.register("go_end", P.moduleName, (s, n) => {
2677
+ }), t.register("go_end", P.moduleName, (r, n) => {
2695
2678
  if (this.doc().scrollTop === this.doc().scrollHeight - this.doc().offsetHeight)
2696
2679
  return n(!1);
2697
2680
  this.doc().scrollTop = this.doc().scrollHeight - this.doc().offsetHeight, this.reportProgress(), n(!0);
2698
- }), t.register("unfocus", P.moduleName, (s, n) => {
2699
- T(this.wnd), n(!0);
2681
+ }), t.register("unfocus", P.moduleName, (r, n) => {
2682
+ S(this.wnd), n(!0);
2700
2683
  }), t.register([
2701
2684
  "go_next",
2702
2685
  "go_prev"
2703
- ], P.moduleName, (s, n) => n(!1)), t.register("focus", P.moduleName, (s, n) => {
2686
+ ], P.moduleName, (r, n) => n(!1)), t.register("focus", P.moduleName, (r, n) => {
2704
2687
  this.reportProgress(), n(!0);
2705
- }), t.register("first_visible_locator", P.moduleName, (s, n) => {
2688
+ }), t.register("first_visible_locator", P.moduleName, (r, n) => {
2706
2689
  const o = Ke(e, !0);
2707
2690
  this.comms.send("first_visible_locator", o.serialize()), n(!0);
2708
2691
  }), t.log("ScrollSnapper Mounted"), !0;
@@ -2719,9 +2702,9 @@ class et extends Y {
2719
2702
  super(...arguments), this.pointerMoved = !1, this.onPointerUp = this.onPointUp.bind(this), this.onPointerMove = this.onPointMove.bind(this), this.onPointerDown = this.onPointDown.bind(this), this.onContextMenu = this.onContext.bind(this), this.onClicker = this.onClick.bind(this);
2720
2703
  }
2721
2704
  onPointUp(e) {
2722
- var s, n, o, l, c;
2705
+ var r, n, o, l, c;
2723
2706
  const t = this.wnd.getSelection();
2724
- if (t && ((s = t.toString()) == null ? void 0 : s.length) > 0) {
2707
+ if (t && ((r = t.toString()) == null ? void 0 : r.length) > 0) {
2725
2708
  const h = (n = t.getRangeAt(0)) == null ? void 0 : n.getClientRects();
2726
2709
  if (!h || h.length === 0)
2727
2710
  return;
@@ -2807,11 +2790,11 @@ const tt = class te extends Y {
2807
2790
  Reflect.apply(i[1], i[2], i[3]);
2808
2791
  break;
2809
2792
  case 1:
2810
- const s = i[1], n = i[2];
2811
- e.removeEventListener(s.type, e._readium_eventBlocker, !0);
2812
- const o = new Event(s.type, {
2813
- bubbles: s.bubbles,
2814
- cancelable: s.cancelable
2793
+ const r = i[1], n = i[2];
2794
+ e.removeEventListener(r.type, e._readium_eventBlocker, !0);
2795
+ const o = new Event(r.type, {
2796
+ bubbles: r.bubbles,
2797
+ cancelable: r.cancelable
2815
2798
  });
2816
2799
  n ? n.dispatchEvent(o) : e.dispatchEvent(o);
2817
2800
  break;
@@ -2839,9 +2822,9 @@ const tt = class te extends Y {
2839
2822
  ), Reflect.defineProperty(e.navigator, "epubReadingSystem", {
2840
2823
  value: {
2841
2824
  name: "readium-ts-toolkit",
2842
- version: "2.0.0-beta.7",
2843
- hasFeature: (s, n = "") => {
2844
- switch (s) {
2825
+ version: "2.0.0",
2826
+ hasFeature: (r, n = "") => {
2827
+ switch (r) {
2845
2828
  case "dom-manipulation":
2846
2829
  return !0;
2847
2830
  case "layout-changes":
@@ -2862,18 +2845,18 @@ const tt = class te extends Y {
2862
2845
  }
2863
2846
  },
2864
2847
  writable: !1
2865
- }), "getAnimations" in e.document && e.document.getAnimations().forEach((s) => {
2866
- s.cancel(), this.allAnimations.add(s);
2867
- }), t.register("activate", te.moduleName, (s, n) => {
2848
+ }), "getAnimations" in e.document && e.document.getAnimations().forEach((r) => {
2849
+ r.cancel(), this.allAnimations.add(r);
2850
+ }), t.register("activate", te.moduleName, (r, n) => {
2868
2851
  this.allAnimations.forEach((o) => {
2869
2852
  o.cancel(), o.play();
2870
2853
  }), n(!0);
2871
- }), t.register("unfocus", te.moduleName, (s, n) => {
2854
+ }), t.register("unfocus", te.moduleName, (r, n) => {
2872
2855
  this.pauseAllMedia(e), this.allAnimations.forEach((o) => o.pause()), n(!0);
2873
2856
  });
2874
2857
  const i = e.document.querySelectorAll("audio,video");
2875
- for (let s = 0; s < i.length; s++) {
2876
- const n = i[s];
2858
+ for (let r = 0; r < i.length; r++) {
2859
+ const n = i[r];
2877
2860
  n.addEventListener("play", this.onMediaPlayEvent, {
2878
2861
  passive: !0
2879
2862
  }), n.addEventListener("pause", this.onMediaPauseEvent, {
@@ -2888,7 +2871,7 @@ const tt = class te extends Y {
2888
2871
  };
2889
2872
  tt.moduleName = "setup";
2890
2873
  let it = tt;
2891
- const Re = "readium-viewport", rt = class F extends it {
2874
+ const Re = "readium-viewport", st = class F extends it {
2892
2875
  onViewportWidthChanged(e) {
2893
2876
  const t = e.target;
2894
2877
  G(t, "--RS__viewportWidth", `${t.innerWidth}px`);
@@ -2902,16 +2885,16 @@ const Re = "readium-viewport", rt = class F extends it {
2902
2885
  "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
2903
2886
  ), e.document.head.appendChild(i), e.addEventListener("orientationchange", this.onViewportWidthChanged), e.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
2904
2887
  target: e
2905
- }), t.register("get_properties", F.moduleName, (s, n) => {
2888
+ }), t.register("get_properties", F.moduleName, (r, n) => {
2906
2889
  Ve(e), n(!0);
2907
- }), t.register("update_properties", F.moduleName, (s, n) => {
2908
- s["--RS__viewportWidth"] = `${e.innerWidth}px`, Nt(e, s), n(!0);
2909
- }), t.register("set_property", F.moduleName, (s, n) => {
2910
- const o = s;
2890
+ }), t.register("update_properties", F.moduleName, (r, n) => {
2891
+ r["--RS__viewportWidth"] = `${e.innerWidth}px`, Nt(e, r), n(!0);
2892
+ }), t.register("set_property", F.moduleName, (r, n) => {
2893
+ const o = r;
2911
2894
  G(e, o[0], o[1]), n(!0);
2912
- }), t.register("remove_property", F.moduleName, (s, n) => {
2913
- he(e, s), n(!0);
2914
- }), t.register("activate", F.moduleName, (s, n) => {
2895
+ }), t.register("remove_property", F.moduleName, (r, n) => {
2896
+ he(e, r), n(!0);
2897
+ }), t.register("activate", F.moduleName, (r, n) => {
2915
2898
  this.unblock(e), n(!0);
2916
2899
  }), t.log("ReflowableSetup Mounted"), !0;
2917
2900
  }
@@ -2920,9 +2903,9 @@ const Re = "readium-viewport", rt = class F extends it {
2920
2903
  return t.unregisterAll(F.moduleName), (i = e.document.head.querySelector(`#${Re}`)) == null || i.remove(), e.removeEventListener("orientationchange", this.onViewportWidthChanged), t.log("ReflowableSetup Unmounted"), super.unmount(e, t);
2921
2904
  }
2922
2905
  };
2923
- rt.moduleName = "reflowable_setup";
2924
- let qt = rt;
2925
- const ze = "readium-fixed-style", st = class L extends it {
2906
+ st.moduleName = "reflowable_setup";
2907
+ let qt = st;
2908
+ const ze = "readium-fixed-style", rt = class L extends it {
2926
2909
  mount(e, t) {
2927
2910
  if (!super.mount(e, t))
2928
2911
  return !1;
@@ -2940,13 +2923,13 @@ const ze = "readium-fixed-style", st = class L extends it {
2940
2923
  min-height: 100%;
2941
2924
 
2942
2925
  /*cursor: var() TODO*/
2943
- }`, e.document.head.appendChild(i), t.register("set_property", L.moduleName, (s, n) => {
2944
- const o = s;
2926
+ }`, e.document.head.appendChild(i), t.register("set_property", L.moduleName, (r, n) => {
2927
+ const o = r;
2945
2928
  G(e, o[0], o[1]), n(!0);
2946
- }), t.register("remove_property", L.moduleName, (s, n) => {
2947
- he(e, s), n(!0);
2948
- }), t.register("first_visible_locator", L.moduleName, (s, n) => n(!1)), t.register("unfocus", L.moduleName, (s, n) => {
2949
- T(e), n(!0);
2929
+ }), t.register("remove_property", L.moduleName, (r, n) => {
2930
+ he(e, r), n(!0);
2931
+ }), t.register("first_visible_locator", L.moduleName, (r, n) => n(!1)), t.register("unfocus", L.moduleName, (r, n) => {
2932
+ S(e), n(!0);
2950
2933
  }), t.register([
2951
2934
  "focus",
2952
2935
  "go_next",
@@ -2956,7 +2939,7 @@ const ze = "readium-fixed-style", st = class L extends it {
2956
2939
  "go_start",
2957
2940
  "go_text",
2958
2941
  "go_progression"
2959
- ], L.moduleName, (s, n) => n(!0)), t.register("activate", L.moduleName, (s, n) => {
2942
+ ], L.moduleName, (r, n) => n(!0)), t.register("activate", L.moduleName, (r, n) => {
2960
2943
  this.unblock(e), n(!0);
2961
2944
  }), t.log("FixedSetup Mounted"), !0;
2962
2945
  }
@@ -2965,8 +2948,8 @@ const ze = "readium-fixed-style", st = class L extends it {
2965
2948
  return t.unregisterAll(L.moduleName), (i = e.document.getElementById(ze)) == null || i.remove(), t.log("FixedSetup Unmounted"), super.unmount(e, t);
2966
2949
  }
2967
2950
  };
2968
- st.moduleName = "fixed_setup";
2969
- let _t = st;
2951
+ rt.moduleName = "fixed_setup";
2952
+ let _t = rt;
2970
2953
  const Xt = [
2971
2954
  "fixed_setup",
2972
2955
  "decorator",
@@ -2985,7 +2968,7 @@ const Xt = [
2985
2968
  Dt,
2986
2969
  jt,
2987
2970
  Vt
2988
- ].map((r) => [r.moduleName, r]));
2971
+ ].map((s) => [s.moduleName, s]));
2989
2972
  class Yt {
2990
2973
  /**
2991
2974
  * @param wnd Window instance to operate on
@@ -2997,11 +2980,11 @@ class Yt {
2997
2980
  if (i.length) {
2998
2981
  if (typeof e > "u")
2999
2982
  throw Error("Loader is not in a web browser");
3000
- e.parent !== e && this.comms.log("Loader is probably in a frame"), this.loadedModules = i.map((s) => {
3001
- const n = this.loadModule(s);
2983
+ e.parent !== e && this.comms.log("Loader is probably in a frame"), this.loadedModules = i.map((r) => {
2984
+ const n = this.loadModule(r);
3002
2985
  if (n)
3003
2986
  return n.mount(this.wnd, this.comms), n;
3004
- }).filter((s) => s !== void 0);
2987
+ }).filter((r) => r !== void 0);
3005
2988
  }
3006
2989
  }
3007
2990
  loadModule(e) {
@@ -3026,7 +3009,7 @@ class Yt {
3026
3009
  const t = De.get(e);
3027
3010
  if (t === void 0)
3028
3011
  return this.comms.log(`Module "${e}" does not exist in the library`), !1;
3029
- const i = this.loadedModules.findIndex((s) => s instanceof t);
3012
+ const i = this.loadedModules.findIndex((r) => r instanceof t);
3030
3013
  return i < 0 ? !1 : (this.loadedModules[i].unmount(this.wnd, this.comms), this.loadedModules.splice(i, 1), !0);
3031
3014
  }
3032
3015
  /**