@readium/shared 2.2.0 → 2.2.1

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
@@ -8,7 +8,7 @@ class ei {
8
8
  throw Error("This is an empty fetcher");
9
9
  }
10
10
  }
11
- class er {
11
+ class ir {
12
12
  constructor(t, e) {
13
13
  this.client = t || window.fetch.bind(window), this.baseUrl = e;
14
14
  }
@@ -88,12 +88,12 @@ class ii {
88
88
  );
89
89
  }
90
90
  }
91
- class ir {
91
+ class sr {
92
92
  constructor(t, e) {
93
93
  this.start = t, this.endInclusive = e;
94
94
  }
95
95
  }
96
- class sr {
96
+ class rr {
97
97
  readAsString() {
98
98
  return this.read().then((t) => t === void 0 ? t : new TextDecoder().decode(t));
99
99
  }
@@ -194,7 +194,7 @@ class Pt {
194
194
  return this.certifiedBy && (t.certifiedBy = this.certifiedBy), this.credential && (t.credential = this.credential), this.report && (t.report = this.report), t;
195
195
  }
196
196
  }
197
- const y = class y {
197
+ const w = class w {
198
198
  constructor(t) {
199
199
  this.value = t;
200
200
  }
@@ -203,7 +203,7 @@ const y = class y {
203
203
  */
204
204
  static deserialize(t) {
205
205
  if (!(!t || typeof t != "string"))
206
- return new y(t);
206
+ return new w(t);
207
207
  }
208
208
  /**
209
209
  * Serializes an [AccessMode] to its RWPM JSON representation.
@@ -212,17 +212,17 @@ const y = class y {
212
212
  return this.value;
213
213
  }
214
214
  };
215
- y.AUDITORY = new y("auditory"), y.CHART_ON_VISUAL = new y("chartOnVisual"), y.CHEM_ON_VISUAL = new y("chemOnVisual"), y.COLOR_DEPENDENT = new y("colorDependent"), y.DIAGRAM_ON_VISUAL = new y("diagramOnVisual"), y.MATH_ON_VISUAL = new y("mathOnVisual"), y.MUSIC_ON_VISUAL = new y("musicOnVisual"), y.TACTILE = new y("tactile"), y.TEXT_ON_VISUAL = new y("textOnVisual"), y.TEXTUAL = new y("textual"), y.VISUAL = new y("visual");
216
- let R = y;
217
- const x = class x {
215
+ w.AUDITORY = new w("auditory"), w.CHART_ON_VISUAL = new w("chartOnVisual"), w.CHEM_ON_VISUAL = new w("chemOnVisual"), w.COLOR_DEPENDENT = new w("colorDependent"), w.DIAGRAM_ON_VISUAL = new w("diagramOnVisual"), w.MATH_ON_VISUAL = new w("mathOnVisual"), w.MUSIC_ON_VISUAL = new w("musicOnVisual"), w.TACTILE = new w("tactile"), w.TEXT_ON_VISUAL = new w("textOnVisual"), w.TEXTUAL = new w("textual"), w.VISUAL = new w("visual");
216
+ let R = w;
217
+ const N = class N {
218
218
  constructor(t) {
219
219
  if (typeof t == "string") {
220
- if (!x.VALID_MODES.has(t.toLowerCase()))
220
+ if (!N.VALID_MODES.has(t.toLowerCase()))
221
221
  return;
222
222
  this.value = t.toLowerCase();
223
223
  } else {
224
224
  const e = t.filter(
225
- (i) => x.VALID_MODES.has(i.toLowerCase())
225
+ (i) => N.VALID_MODES.has(i.toLowerCase())
226
226
  );
227
227
  if (e.length === 0)
228
228
  return;
@@ -235,11 +235,11 @@ const x = class x {
235
235
  static deserialize(t) {
236
236
  if (!t) return;
237
237
  if (typeof t == "string")
238
- return new x(t);
238
+ return new N(t);
239
239
  if (!Array.isArray(t)) return;
240
- const e = t.filter((i) => i ? x.VALID_MODES.has(i.toLowerCase()) : !1);
240
+ const e = t.filter((i) => i ? N.VALID_MODES.has(i.toLowerCase()) : !1);
241
241
  if (e.length !== 0)
242
- return new x(e);
242
+ return new N(e);
243
243
  }
244
244
  /**
245
245
  * Serializes a [PrimaryAccessMode] to its RWPM JSON representation.
@@ -248,8 +248,8 @@ const x = class x {
248
248
  return this.value;
249
249
  }
250
250
  };
251
- x.VALID_MODES = /* @__PURE__ */ new Set(["auditory", "tactile", "textual", "visual"]), x.AUDITORY = new x("auditory"), x.TACTILE = new x("tactile"), x.TEXTUAL = new x("textual"), x.VISUAL = new x("visual");
252
- let xt = x;
251
+ N.VALID_MODES = /* @__PURE__ */ new Set(["auditory", "tactile", "textual", "visual"]), N.AUDITORY = new N("auditory"), N.TACTILE = new N("tactile"), N.TEXTUAL = new N("textual"), N.VISUAL = new N("visual");
252
+ let xt = N;
253
253
  const h = class h {
254
254
  constructor(t) {
255
255
  this.value = t;
@@ -270,7 +270,7 @@ const h = class h {
270
270
  };
271
271
  h.NONE = new h("none"), h.ANNOTATIONS = new h("annotations"), h.ARIA = new h("ARIA"), h.INDEX = new h("index"), h.PAGE_BREAK_MARKERS = new h("pageBreakMarkers"), h.PAGE_NAVIGATION = new h("pageNavigation"), h.PRINT_PAGE_NUMBERS = new h("printPageNumbers"), h.READING_ORDER = new h("readingOrder"), h.STRUCTURAL_NAVIGATION = new h("structuralNavigation"), h.TABLE_OF_CONTENTS = new h("tableOfContents"), h.TAGGED_PDF = new h("taggedPDF"), h.ALTERNATIVE_TEXT = new h("alternativeText"), h.AUDIO_DESCRIPTION = new h("audioDescription"), h.CAPTIONS = new h("captions"), h.CLOSED_CAPTIONS = new h("closedCaptions"), h.DESCRIBED_MATH = new h("describedMath"), h.LONG_DESCRIPTION = new h("longDescription"), h.OPEN_CAPTIONS = new h("openCaptions"), h.SIGN_LANGUAGE = new h("signLanguage"), h.TRANSCRIPT = new h("transcript"), h.DISPLAY_TRANSFORMABILITY = new h("displayTransformability"), h.SYNCHRONIZED_AUDIO_TEXT = new h("synchronizedAudioText"), h.TIMING_CONTROL = new h("timingControl"), h.UNLOCKED = new h("unlocked"), h.CHEM_ML = new h("ChemML"), h.LATEX = new h("latex"), h.LATEX_CHEMISTRY = new h("latex-chemistry"), h.MATH_ML = new h("MathML"), h.MATH_ML_CHEMISTRY = new h("MathML-chemistry"), h.TTS_MARKUP = new h("ttsMarkup"), h.HIGH_CONTRAST_AUDIO = new h("highContrastAudio"), h.HIGH_CONTRAST_DISPLAY = new h("highContrastDisplay"), h.LARGE_PRINT = new h("largePrint"), h.BRAILLE = new h("braille"), h.TACTILE_GRAPHIC = new h("tactileGraphic"), h.TACTILE_OBJECT = new h("tactileObject"), h.FULL_RUBY_ANNOTATIONS = new h("fullRubyAnnotations"), h.HORIZONTAL_WRITING = new h("horizontalWriting"), h.RUBY_ANNOTATIONS = new h("rubyAnnotations"), h.VERTICAL_WRITING = new h("verticalWriting"), h.WITH_ADDITIONAL_WORD_SEGMENTATION = new h("withAdditionalWordSegmentation"), h.WITHOUT_ADDITIONAL_WORD_SEGMENTATION = new h("withoutAdditionalWordSegmentation");
272
272
  let v = h;
273
- const w = class w {
273
+ const y = class y {
274
274
  constructor(t) {
275
275
  this.value = t;
276
276
  }
@@ -279,7 +279,7 @@ const w = class w {
279
279
  */
280
280
  static deserialize(t) {
281
281
  if (!(!t || typeof t != "string"))
282
- return new w(t);
282
+ return new y(t);
283
283
  }
284
284
  /**
285
285
  * Serializes a [Hazard] to its RWPM JSON representation.
@@ -288,8 +288,8 @@ const w = class w {
288
288
  return this.value;
289
289
  }
290
290
  };
291
- w.FLASHING = new w("flashing"), w.NO_FLASHING_HAZARD = new w("noFlashingHazard"), w.UNKNOWN_FLASHING_HAZARD = new w("unknownFlashingHazard"), w.MOTION_SIMULATION = new w("motionSimulation"), w.NO_MOTION_SIMULATION_HAZARD = new w("noMotionSimulationHazard"), w.UNKNOWN_MOTION_SIMULATION_HAZARD = new w("unknownMotionSimulationHazard"), w.SOUND = new w("sound"), w.NO_SOUND_HAZARD = new w("noSoundHazard"), w.UNKNOWN_SOUND_HAZARD = new w("unknownSoundHazard"), w.UNKNOWN = new w("unknown"), w.NONE = new w("none");
292
- let P = w;
291
+ y.FLASHING = new y("flashing"), y.NO_FLASHING_HAZARD = new y("noFlashingHazard"), y.UNKNOWN_FLASHING_HAZARD = new y("unknownFlashingHazard"), y.MOTION_SIMULATION = new y("motionSimulation"), y.NO_MOTION_SIMULATION_HAZARD = new y("noMotionSimulationHazard"), y.UNKNOWN_MOTION_SIMULATION_HAZARD = new y("unknownMotionSimulationHazard"), y.SOUND = new y("sound"), y.NO_SOUND_HAZARD = new y("noSoundHazard"), y.UNKNOWN_SOUND_HAZARD = new y("unknownSoundHazard"), y.UNKNOWN = new y("unknown"), y.NONE = new y("none");
292
+ let P = y;
293
293
  const S = class S {
294
294
  constructor(t) {
295
295
  this.value = t;
@@ -401,7 +401,7 @@ class $ {
401
401
  }
402
402
  }
403
403
  const f = $.getInstance();
404
- var X = /* @__PURE__ */ ((s) => (s.reflowable = "reflowable", s.fixed = "fixed", s.scrolled = "scrolled", s))(X || {}), ni = /* @__PURE__ */ ((s) => (s.Unknown = "unknown", s.Modifiable = "modifiable", s.Unmodifiable = "unmodifiable", s))(ni || {}), ai = /* @__PURE__ */ ((s) => (s.NoMetadata = "noMetadata", s.Readable = "readable", s.NotFully = "notFully", s.Unreadable = "unreadable", s))(ai || {}), oi = /* @__PURE__ */ ((s) => (s.NoMetadata = "noMetadata", s.Synchronized = "synchronized", s.AudioOnly = "audioOnly", s.AudioComplementary = "audioComplementary", s))(oi || {});
404
+ var K = /* @__PURE__ */ ((s) => (s.reflowable = "reflowable", s.fixed = "fixed", s.scrolled = "scrolled", s))(K || {}), ni = /* @__PURE__ */ ((s) => (s.Unknown = "unknown", s.Modifiable = "modifiable", s.Unmodifiable = "unmodifiable", s))(ni || {}), ai = /* @__PURE__ */ ((s) => (s.NoMetadata = "noMetadata", s.Readable = "readable", s.NotFully = "notFully", s.Unreadable = "unreadable", s))(ai || {}), oi = /* @__PURE__ */ ((s) => (s.NoMetadata = "noMetadata", s.Synchronized = "synchronized", s.AudioOnly = "audioOnly", s.AudioComplementary = "audioComplementary", s))(oi || {});
405
405
  class Dt {
406
406
  constructor(t = "unknown", e = "noMetadata", i = !1, r = "noMetadata") {
407
407
  this.id = "ways-of-reading.title", this.visualAdjustments = t, this.nonvisualReading = e, this.nonvisualReadingAltText = i, this.prerecordedAudio = r, this.shouldDisplay = !0;
@@ -438,7 +438,7 @@ class Dt {
438
438
  });
439
439
  }
440
440
  static fromPublication(t) {
441
- const e = t.metadata.accessibility ?? new V(), i = e.feature ?? [], r = t.metadata.layout === X.fixed, n = i.some((d) => d.value === v.DISPLAY_TRANSFORMABILITY.value) ? "modifiable" : r ? "unmodifiable" : "unknown", a = e.accessMode ?? [], o = e.accessModeSufficient ?? [], l = a.length > 0 && a.every((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
441
+ const e = t.metadata.accessibility ?? new V(), i = e.feature ?? [], r = t.metadata.layout === K.fixed, n = i.some((d) => d.value === v.DISPLAY_TRANSFORMABILITY.value) ? "modifiable" : r ? "unmodifiable" : "unknown", a = e.accessMode ?? [], o = e.accessModeSufficient ?? [], l = a.length > 0 && a.every((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
442
442
  const I = d.value;
443
443
  return Array.isArray(I) ? I.every((G) => G === R.TEXTUAL.value) : I === R.TEXTUAL.value;
444
444
  }), p = a.some((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
@@ -953,7 +953,7 @@ class Ft {
953
953
  return new Ft(t);
954
954
  }
955
955
  }
956
- class rr {
956
+ class nr {
957
957
  constructor(t) {
958
958
  this.waysOfReading = Dt.fromPublication(t), this.navigation = Ut.fromPublication(t), this.richContent = Mt.fromPublication(t), this.additionalInformation = Bt.fromPublication(t), this.hazards = Gt.fromPublication(t), this.conformance = Wt.fromPublication(t), this.legal = Ht.fromPublication(t), this.accessibilitySummary = Ft.fromPublication(t), this.fields = [
959
959
  this.waysOfReading,
@@ -995,7 +995,7 @@ class _t {
995
995
  return this.compression !== void 0 && (t.compression = this.compression), this.originalLength !== void 0 && (t.originalLength = this.originalLength), this.profile !== void 0 && (t.profile = this.profile), this.scheme !== void 0 && (t.scheme = this.scheme), t;
996
996
  }
997
997
  }
998
- var Lt = /* @__PURE__ */ ((s) => (s.left = "left", s.right = "right", s.center = "center", s))(Lt || {});
998
+ var Ot = /* @__PURE__ */ ((s) => (s.left = "left", s.right = "right", s.center = "center", s))(Ot || {});
999
999
  class U {
1000
1000
  constructor(t) {
1001
1001
  this.otherProperties = t;
@@ -1717,8 +1717,8 @@ class M {
1717
1717
  duration: L(t.duration),
1718
1718
  bitrate: L(t.bitrate),
1719
1719
  languages: _(t.language),
1720
- alternates: O.deserialize(t.alternate),
1721
- children: O.deserialize(t.children)
1720
+ alternates: x.deserialize(t.alternate),
1721
+ children: x.deserialize(t.children)
1722
1722
  });
1723
1723
  }
1724
1724
  /**
@@ -1776,7 +1776,7 @@ class M {
1776
1776
  });
1777
1777
  }
1778
1778
  }
1779
- class O {
1779
+ class x {
1780
1780
  /**
1781
1781
  * Creates a [Links].
1782
1782
  */
@@ -1788,7 +1788,7 @@ class O {
1788
1788
  */
1789
1789
  static deserialize(t) {
1790
1790
  if (t && Array.isArray(t))
1791
- return new O(
1791
+ return new x(
1792
1792
  t.map((e) => M.deserialize(e)).filter((e) => e !== void 0)
1793
1793
  );
1794
1794
  }
@@ -1941,7 +1941,7 @@ class dt {
1941
1941
  identifier: t.identifier,
1942
1942
  altIdentifiers: t.altIdentifier ? Array.isArray(t.altIdentifier) ? new Set(t.altIdentifier.map((e) => J.deserialize(e)).filter((e) => e !== void 0)) : new Set([J.deserialize(t.altIdentifier)].filter((e) => e !== void 0)) : void 0,
1943
1943
  roles: t.role ? new Set(_(t.role)) : void 0,
1944
- links: O.deserialize(t.links),
1944
+ links: x.deserialize(t.links),
1945
1945
  position: Z(t.position)
1946
1946
  }) : void 0;
1947
1947
  }
@@ -1953,7 +1953,7 @@ class dt {
1953
1953
  return this.sortAs !== void 0 && (t.sortAs = this.sortAs.serialize()), this.identifier !== void 0 && (t.identifier = this.identifier), this.altIdentifiers && (t.altIdentifier = ht(this.altIdentifiers).map((e) => e.serialize())), this.roles && (t.role = ht(this.roles)), this.links && (t.links = this.links.serialize()), this.position !== void 0 && (t.position = this.position), t;
1954
1954
  }
1955
1955
  }
1956
- class N {
1956
+ class O {
1957
1957
  /**
1958
1958
  * Creates a [Contributors] object.
1959
1959
  */
@@ -1967,7 +1967,7 @@ class N {
1967
1967
  static deserialize(t) {
1968
1968
  if (!t) return;
1969
1969
  const e = Array.isArray(t) ? t : [t];
1970
- return new N(
1970
+ return new O(
1971
1971
  e.map((i) => dt.deserialize(i)).filter((i) => i !== void 0)
1972
1972
  );
1973
1973
  }
@@ -1990,7 +1990,7 @@ class Q {
1990
1990
  if (!(t && typeof t == "object")) return;
1991
1991
  const e = /* @__PURE__ */ new Map();
1992
1992
  return Object.entries(t).forEach(([i, r]) => {
1993
- const n = N.deserialize(r);
1993
+ const n = O.deserialize(r);
1994
1994
  n && n.items.length > 0 && e.set(i, n);
1995
1995
  }), new Q({ items: e });
1996
1996
  }
@@ -2005,8 +2005,8 @@ class Q {
2005
2005
  }
2006
2006
  }
2007
2007
  var q = /* @__PURE__ */ ((s) => (s.EPUB = "https://readium.org/webpub-manifest/profiles/epub", s.AUDIOBOOK = "https://readium.org/webpub-manifest/profiles/audiobook", s.DIVINA = "https://readium.org/webpub-manifest/profiles/divina", s.PDF = "https://readium.org/webpub-manifest/profiles/pdf", s))(q || {}), F = /* @__PURE__ */ ((s) => (s.ltr = "ltr", s.rtl = "rtl", s))(F || {});
2008
- function nr(s) {
2009
- return s === "rtl" ? Lt.right : Lt.left;
2008
+ function ar(s) {
2009
+ return s === "rtl" ? Ot.right : Ot.left;
2010
2010
  }
2011
2011
  class ft {
2012
2012
  /** Creates a [Subject]. */
@@ -2027,7 +2027,7 @@ class ft {
2027
2027
  sortAs: t.sortAs ? B.deserialize(t.sortAs) : void 0,
2028
2028
  code: t.code,
2029
2029
  scheme: t.scheme,
2030
- links: O.deserialize(t.links)
2030
+ links: x.deserialize(t.links)
2031
2031
  }) : void 0;
2032
2032
  }
2033
2033
  /**
@@ -2096,7 +2096,7 @@ const et = class et {
2096
2096
  */
2097
2097
  static deserialize(t) {
2098
2098
  if (!(t && t.title)) return;
2099
- const e = B.deserialize(t.title), i = t["@type"], r = _(t.conformsTo), n = t.identifier, a = J.deserialize(t.altIdentifier), o = B.deserialize(t.subtitle), l = B.deserialize(t.sortAs), p = N.deserialize(t.artist), m = N.deserialize(t.author), u = N.deserialize(t.colorist), g = N.deserialize(t.contributor), A = N.deserialize(t.editor), k = N.deserialize(t.illustrator), d = N.deserialize(t.inker), I = N.deserialize(t.letterer), G = N.deserialize(t.narrator), Be = N.deserialize(t.penciler), Ge = N.deserialize(t.translator), We = _(t.language), He = t.description, Fe = N.deserialize(t.publisher), _e = N.deserialize(t.imprint), Ve = lt(t.published), Ye = lt(t.modified), $e = Yt.deserialize(t.subject), Xe = Q.deserialize(t.belongsTo), Ke = V.deserialize(t.accessibility), Ze = t.layout, Je = t.readingProgression, qe = L(t.duration), Qe = L(t.numberOfPages), je = $t.deserialize(t.tdm);
2099
+ const e = B.deserialize(t.title), i = t["@type"], r = _(t.conformsTo), n = t.identifier, a = J.deserialize(t.altIdentifier), o = B.deserialize(t.subtitle), l = B.deserialize(t.sortAs), p = O.deserialize(t.artist), m = O.deserialize(t.author), u = O.deserialize(t.colorist), g = O.deserialize(t.contributor), A = O.deserialize(t.editor), k = O.deserialize(t.illustrator), d = O.deserialize(t.inker), I = O.deserialize(t.letterer), G = O.deserialize(t.narrator), Be = O.deserialize(t.penciler), Ge = O.deserialize(t.translator), We = _(t.language), He = t.description, Fe = O.deserialize(t.publisher), _e = O.deserialize(t.imprint), Ve = lt(t.published), Ye = lt(t.modified), $e = Yt.deserialize(t.subject), Ke = Q.deserialize(t.belongsTo), Xe = V.deserialize(t.accessibility), Ze = t.layout, Je = t.readingProgression, qe = L(t.duration), Qe = L(t.numberOfPages), je = $t.deserialize(t.tdm);
2100
2100
  let ot = Object.assign({}, t);
2101
2101
  return et.mappedProperties.forEach((ti) => delete ot[ti]), Object.keys(ot).length === 0 && (ot = void 0), new et({
2102
2102
  title: e,
@@ -2124,12 +2124,12 @@ const et = class et {
2124
2124
  published: Ve,
2125
2125
  modified: Ye,
2126
2126
  subjects: $e,
2127
- belongsTo: Xe,
2127
+ belongsTo: Ke,
2128
2128
  layout: Ze,
2129
2129
  readingProgression: Je,
2130
2130
  duration: qe,
2131
2131
  numberOfPages: Qe,
2132
- accessibility: Ke,
2132
+ accessibility: Xe,
2133
2133
  tdm: je,
2134
2134
  otherMetadata: ot
2135
2135
  });
@@ -2162,9 +2162,9 @@ const et = class et {
2162
2162
  for (const t of this.conformsTo)
2163
2163
  switch (t) {
2164
2164
  case q.EPUB:
2165
- return this.layout || X.reflowable;
2165
+ return this.layout || K.reflowable;
2166
2166
  case q.DIVINA:
2167
- return this.layout === X.reflowable ? X.fixed : this.layout || X.fixed;
2167
+ return this.layout === K.reflowable ? K.fixed : this.layout || K.fixed;
2168
2168
  case q.AUDIOBOOK:
2169
2169
  case q.PDF:
2170
2170
  return null;
@@ -2239,15 +2239,15 @@ pt.prototype.getMediaOverlay = function() {
2239
2239
  U.prototype.getContains = function() {
2240
2240
  return new Set(this.otherProperties.contains || []);
2241
2241
  };
2242
- class Xt {
2242
+ class Kt {
2243
2243
  constructor(t) {
2244
2244
  this.links = t.links, this.guided = t.guided;
2245
2245
  }
2246
2246
  static deserialize(t) {
2247
2247
  if (t)
2248
- return new Xt({
2249
- links: O.deserialize(t.links),
2250
- guided: K.deserializeArray(t.guided)
2248
+ return new Kt({
2249
+ links: x.deserialize(t.links),
2250
+ guided: X.deserializeArray(t.guided)
2251
2251
  });
2252
2252
  }
2253
2253
  serialize() {
@@ -2282,7 +2282,7 @@ class mt {
2282
2282
  return this.plain !== void 0 && (t.plain = this.plain), this.ssml !== void 0 && (t.ssml = this.ssml), this.language !== void 0 && (t.language = this.language), Object.keys(t).length > 0 ? t : void 0;
2283
2283
  }
2284
2284
  }
2285
- class K {
2285
+ class X {
2286
2286
  /**
2287
2287
  * Creates a [GuidedNavigation] object.
2288
2288
  */
@@ -2313,15 +2313,15 @@ class K {
2313
2313
  */
2314
2314
  static deserialize(t) {
2315
2315
  if (t)
2316
- return new K({
2316
+ return new X({
2317
2317
  audioref: t.audioref,
2318
- children: K.deserializeArray(t.children),
2318
+ children: X.deserializeArray(t.children),
2319
2319
  imgref: t.imgref,
2320
2320
  role: t.role ? new Set(_(t.role)) : void 0,
2321
2321
  level: typeof t.level == "number" ? t.level : void 0,
2322
2322
  text: mt.deserialize(t.text),
2323
2323
  textref: t.textref,
2324
- description: K.deserialize(t.description)
2324
+ description: X.deserialize(t.description)
2325
2325
  });
2326
2326
  }
2327
2327
  /**
@@ -2329,7 +2329,7 @@ class K {
2329
2329
  */
2330
2330
  static deserializeArray(t) {
2331
2331
  if (Array.isArray(t))
2332
- return t.map((e) => K.deserialize(e)).filter((e) => e !== void 0);
2332
+ return t.map((e) => X.deserialize(e)).filter((e) => e !== void 0);
2333
2333
  }
2334
2334
  /**
2335
2335
  * Serializes a [GuidedNavigationObject] to its RWPM JSON representation.
@@ -2379,7 +2379,7 @@ function di(s, t) {
2379
2379
  function fi(s, t) {
2380
2380
  return s.slice(s.length - t.length) === t;
2381
2381
  }
2382
- const wt = {
2382
+ const yt = {
2383
2383
  endsWith: fi,
2384
2384
  endsWithChar: di
2385
2385
  }, pi = [
@@ -2475,7 +2475,7 @@ const wt = {
2475
2475
  "Sat"
2476
2476
  ];
2477
2477
  function fe(s) {
2478
- return /^[A-Z][a-z].*/.test(s) || Ot(s);
2478
+ return /^[A-Z][a-z].*/.test(s) || Lt(s);
2479
2479
  }
2480
2480
  function mi(s) {
2481
2481
  return fe(s) || /``|"|'/.test(s.substring(0, 2));
@@ -2498,7 +2498,7 @@ function ne(s) {
2498
2498
  function ae(s) {
2499
2499
  return s.length <= 3 ? !0 : fe(s);
2500
2500
  }
2501
- function Ot(s, t) {
2501
+ function Lt(s, t) {
2502
2502
  return t && (s = s.slice(t - 1, t + 2)), !isNaN(Number(s));
2503
2503
  }
2504
2504
  function vi(s) {
@@ -2507,7 +2507,7 @@ function vi(s) {
2507
2507
  function Ai(s) {
2508
2508
  return s.match(/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/);
2509
2509
  }
2510
- function yi(s) {
2510
+ function wi(s) {
2511
2511
  var t = 0;
2512
2512
  if ((t = s.indexOf(".")) > -1 || (t = s.indexOf("!")) > -1 || (t = s.indexOf("?")) > -1) {
2513
2513
  var e = s.charAt(t + 1);
@@ -2516,7 +2516,7 @@ function yi(s) {
2516
2516
  }
2517
2517
  return !1;
2518
2518
  }
2519
- function wi(s) {
2519
+ function yi(s) {
2520
2520
  return s === "." || s === "!" || s === "?";
2521
2521
  }
2522
2522
  function Si(s, t) {
@@ -2533,22 +2533,22 @@ function Si(s, t) {
2533
2533
  return !e.test(k.value);
2534
2534
  });
2535
2535
  if (i === `
2536
- ` && t.newlineBoundary || wi(i) || wt.endsWithChar(i, "?!"))
2536
+ ` && t.newlineBoundary || yi(i) || yt.endsWithChar(i, "?!"))
2537
2537
  return m;
2538
- if (wt.endsWithChar(i, ".")) {
2538
+ if (yt.endsWithChar(i, ".")) {
2539
2539
  if (g) {
2540
2540
  if (i.length === 2 && isNaN(i.charAt(0)) && i.match(/[a-zA-Z]/) || gi(i))
2541
2541
  return u;
2542
2542
  if (mi(g.value)) {
2543
- if (bi(i, g.value) || Ot(g.value) && ae(i))
2543
+ if (bi(i, g.value) || Lt(g.value) && ae(i))
2544
2544
  return u;
2545
- } else if (wt.endsWith(i, "..") || ne(i) || ae(i))
2545
+ } else if (yt.endsWith(i, "..") || ne(i) || ae(i))
2546
2546
  return u;
2547
2547
  }
2548
2548
  return m;
2549
2549
  }
2550
2550
  let A;
2551
- return (A = i.indexOf(".")) > -1 && (Ot(i, A) || ne(i) || Ai(i) || vi(i)) ? u : (p = yi(i)) ? [
2551
+ return (A = i.indexOf(".")) > -1 && (Lt(i, A) || ne(i) || Ai(i) || vi(i)) ? u : (p = wi(i)) ? [
2552
2552
  p[0] + p[1],
2553
2553
  null,
2554
2554
  p[2]
@@ -2590,7 +2590,7 @@ function Ni(s, t) {
2590
2590
  }), typeof i == "object" && (i.index = i.index || 0, e = e + i.index + i.offset, i.index = s.index + i.index, i.offset = i.offset || i.value.length), i);
2591
2591
  });
2592
2592
  }
2593
- function Li(s, t) {
2593
+ function Oi(s, t) {
2594
2594
  if (s.length == 0) return null;
2595
2595
  var e = "", i = 0, r = s[0]?.index;
2596
2596
  return s.forEach(function(n, a) {
@@ -2611,10 +2611,10 @@ const j = {
2611
2611
  tokensId: Ii,
2612
2612
  normalize: Ni,
2613
2613
  properties: xi,
2614
- merge: Li
2614
+ merge: Oi
2615
2615
  };
2616
- var Oi = ' \r\n  !"#$%&()*+,-.\\/:;<=>?@[\\]^_`{|}~', zi = new RegExp(
2617
- "([^" + Oi + "]+)"
2616
+ var Li = ' \r\n  !"#$%&()*+,-.\\/:;<=>?@[\\]^_`{|}~', zi = new RegExp(
2617
+ "([^" + Li + "]+)"
2618
2618
  );
2619
2619
  function z(s) {
2620
2620
  if (!(this instanceof z)) return new z(s);
@@ -3075,7 +3075,7 @@ class Y {
3075
3075
  }
3076
3076
  }
3077
3077
  async positionsFromManifest() {
3078
- const t = this.manifest.links.findWithMediaType(
3078
+ const t = this.manifest.links?.findWithMediaType(
3079
3079
  "application/vnd.readium.position-list+json"
3080
3080
  );
3081
3081
  if (t === void 0) return [];
@@ -3093,7 +3093,7 @@ class Y {
3093
3093
  const a = this.linkWithHref(t.href);
3094
3094
  a !== void 0 && (i = e(a));
3095
3095
  }
3096
- if (i || (i = this.manifest.links.findWithMediaType(
3096
+ if (i || (i = this.manifest.links?.findWithMediaType(
3097
3097
  "application/guided-navigation+json"
3098
3098
  )), !i) return;
3099
3099
  let r = i.href;
@@ -3104,7 +3104,7 @@ class Y {
3104
3104
  const n = await this.get(new M({
3105
3105
  href: r
3106
3106
  })).readAsJSON();
3107
- return Xt.deserialize(n);
3107
+ return Kt.deserialize(n);
3108
3108
  }
3109
3109
  /**
3110
3110
  * Returns the resource targeted by the given non-templated [link].
@@ -3163,7 +3163,7 @@ class gt {
3163
3163
  return this.charOffset !== void 0 && (t.charOffset = this.charOffset), t;
3164
3164
  }
3165
3165
  }
3166
- class Kt {
3166
+ class Xt {
3167
3167
  /**
3168
3168
  * Creates a [DomRange].
3169
3169
  */
@@ -3177,7 +3177,7 @@ class Kt {
3177
3177
  if (!t) return;
3178
3178
  let e = gt.deserialize(t.start);
3179
3179
  if (e)
3180
- return new Kt({
3180
+ return new Xt({
3181
3181
  start: e,
3182
3182
  end: gt.deserialize(t.end)
3183
3183
  });
@@ -3197,7 +3197,7 @@ T.prototype.getPartialCfi = function() {
3197
3197
  return this.otherLocations?.get("partialCfi");
3198
3198
  };
3199
3199
  T.prototype.getDomRange = function() {
3200
- return Kt.deserialize(this.otherLocations?.get("domRange"));
3200
+ return Xt.deserialize(this.otherLocations?.get("domRange"));
3201
3201
  };
3202
3202
  T.prototype.fragmentParameters = function() {
3203
3203
  return new Map(
@@ -3379,7 +3379,7 @@ U.prototype.getAuthenticate = function() {
3379
3379
  Y.prototype.getImages = function() {
3380
3380
  return this.linksWithRole("images");
3381
3381
  };
3382
- class ar {
3382
+ class or {
3383
3383
  /**
3384
3384
  * Extracts the full raw text, or returns null if no text content can be found.
3385
3385
  * @param separator Separator to use between individual elements. Defaults to newline.
@@ -3438,7 +3438,7 @@ class ge extends me {
3438
3438
  super(e), this.locator = t;
3439
3439
  }
3440
3440
  }
3441
- class yt extends ge {
3441
+ class wt extends ge {
3442
3442
  /**
3443
3443
  * Human-readable text representation for this element.
3444
3444
  */
@@ -3446,17 +3446,17 @@ class yt extends ge {
3446
3446
  return this.accessibilityLabel;
3447
3447
  }
3448
3448
  }
3449
- class Mi extends yt {
3449
+ class Mi extends wt {
3450
3450
  constructor(t, e, i = []) {
3451
3451
  super(t, i), this.embeddedLink = e;
3452
3452
  }
3453
3453
  }
3454
- class Bi extends yt {
3454
+ class Bi extends wt {
3455
3455
  constructor(t, e, i = []) {
3456
3456
  super(t, i), this.embeddedLink = e;
3457
3457
  }
3458
3458
  }
3459
- class Gi extends yt {
3459
+ class Gi extends wt {
3460
3460
  constructor(t, e, i, r = []) {
3461
3461
  super(t, r), this.embeddedLink = e, this.caption = i;
3462
3462
  }
@@ -3469,7 +3469,7 @@ class be extends me {
3469
3469
  super(i), this.locator = t, this.text = e;
3470
3470
  }
3471
3471
  }
3472
- class Ct extends yt {
3472
+ class Ct extends wt {
3473
3473
  constructor(t, e, i, r = []) {
3474
3474
  super(t, r), this.role = e, this.segments = i;
3475
3475
  }
@@ -3495,7 +3495,7 @@ class _i {
3495
3495
  this.referenceUrl = t, this.referenceTitle = e, this.role = "quote";
3496
3496
  }
3497
3497
  }
3498
- class or {
3498
+ class cr {
3499
3499
  /**
3500
3500
  *
3501
3501
  * @param defaultLanguage The default assumed language
@@ -3556,12 +3556,20 @@ class jt {
3556
3556
  return await this.hasPrevious() ? this.previous() : null;
3557
3557
  }
3558
3558
  }
3559
- let Vi = class {
3559
+ class Vi {
3560
+ constructor(t, e) {
3561
+ this.index = t, this.iterator = e;
3562
+ }
3563
+ async nextContentIn(t) {
3564
+ return t === 1 ? this.iterator.nextOrNull() : this.iterator.previousOrNull();
3565
+ }
3566
+ }
3567
+ let Yi = class {
3560
3568
  constructor(t, e) {
3561
3569
  this.element = t, this.direction = e;
3562
3570
  }
3563
3571
  };
3564
- class lr extends jt {
3572
+ class hr extends jt {
3565
3573
  constructor(t, e, i) {
3566
3574
  super(), this.publication = t, this.startLocator = e, this.resourceContentIteratorFactories = i, this._currentIterator = null, this.currentElement = null;
3567
3575
  }
@@ -3593,7 +3601,7 @@ class lr extends jt {
3593
3601
  const r = this.nextIteratorIn(t, e.index);
3594
3602
  return r ? (this._currentIterator = r, this.nextIn(t)) : null;
3595
3603
  }
3596
- return new Vi(i, t);
3604
+ return new Yi(i, t);
3597
3605
  }
3598
3606
  /**
3599
3607
  * Returns the [Iterator] for the current [Resource] in the reading order.
@@ -3627,8 +3635,10 @@ class lr extends jt {
3627
3635
  }) : e;
3628
3636
  if (!r) return null;
3629
3637
  const n = this.publication.get(i);
3630
- for (const a of this.resourceContentIteratorFactories)
3631
- a(n, r);
3638
+ for (const a of this.resourceContentIteratorFactories) {
3639
+ const o = a(n, r);
3640
+ if (o) return new Vi(t, o);
3641
+ }
3632
3642
  return null;
3633
3643
  }
3634
3644
  }
@@ -3645,7 +3655,7 @@ class ce {
3645
3655
  this.element = t, this.direction = e;
3646
3656
  }
3647
3657
  }
3648
- class hr extends jt {
3658
+ class ur extends jt {
3649
3659
  constructor(t, e) {
3650
3660
  super(), this.pageContent = t, this.startLocator = e, this.pageContentFiltered = [], this.currentElement = null, this.currentProgression = 0, this.currentElementIndex = 0;
3651
3661
  const i = this.pageContent.filter(
@@ -3717,7 +3727,7 @@ class hr extends jt {
3717
3727
  return this.currentProgression === 0 ? 0 : this.currentProgression < 0 || this.currentProgression >= 100 ? null : Math.floor(this.currentProgression * this.pageContentFiltered.length / 100);
3718
3728
  }
3719
3729
  }
3720
- const Yi = [
3730
+ const $i = [
3721
3731
  "OBJECT",
3722
3732
  "BASE",
3723
3733
  "FONT",
@@ -3786,7 +3796,7 @@ const Yi = [
3786
3796
  "RB"
3787
3797
  ];
3788
3798
  function le(s) {
3789
- return Yi.includes(s.nodeName.toUpperCase());
3799
+ return $i.includes(s.nodeName.toUpperCase());
3790
3800
  }
3791
3801
  function Et(s, t) {
3792
3802
  const e = s.getAttribute("src");
@@ -3797,15 +3807,15 @@ function Et(s, t) {
3797
3807
  return e;
3798
3808
  }
3799
3809
  }
3800
- const st = "[\\s\\u0085\\u00A0\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]", $i = new RegExp(`^${st}+$`, "g"), Xi = new RegExp(`^${st}+|${st}+$/g`, "g"), ve = new RegExp(`^${st}+`, "g"), Ae = new RegExp(`${st}+$`, "g"), ct = (s) => (
3810
+ const st = "[\\s\\u0085\\u00A0\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]", Ki = new RegExp(`^${st}+$`, "g"), Xi = new RegExp(`^${st}+|${st}+$/g`, "g"), ve = new RegExp(`^${st}+`, "g"), Ae = new RegExp(`${st}+$`, "g"), ct = (s) => (
3801
3811
  // Normal spaces, \t, \n, \v, \f, \r, U+0085, U+00A0, U+2000 to U+200A, U+2028, U+2029, U+202F, U+205F, U+3000
3802
- s?.length ? $i.test(s) : !0
3803
- ), ye = (s) => s.replace(Xi, ""), Ki = (s) => s.replace(ve, ""), Zi = (s) => s.replace(Ae, ""), he = (s, t = "") => new nt({
3812
+ s?.length ? Ki.test(s) : !0
3813
+ ), we = (s) => s.replace(Xi, ""), Zi = (s) => s.replace(ve, ""), Ji = (s) => s.replace(Ae, ""), he = (s, t = "") => new nt({
3804
3814
  before: t + (ve.exec(s)?.[0] ?? ""),
3805
- highlight: ye(s),
3815
+ highlight: we(s),
3806
3816
  after: Ae.exec(s)?.[0] ?? ""
3807
3817
  });
3808
- function Ji(s) {
3818
+ function qi(s) {
3809
3819
  for (; s; ) {
3810
3820
  let t = s.getAttribute("lang") || s.getAttributeNS("http://www.w3.org/1999/xhtml", "lang") || s.getAttributeNS("http://www.w3.org/XML/1998/namespace", "lang");
3811
3821
  if (t) return t;
@@ -3813,7 +3823,7 @@ function Ji(s) {
3813
3823
  }
3814
3824
  return null;
3815
3825
  }
3816
- function qi(s, t) {
3826
+ function Qi(s, t) {
3817
3827
  const e = s.length > 0 && s[s.length - 1] === " ";
3818
3828
  let i = !1, r = !1;
3819
3829
  for (let n = 0; n < t.length; n++)
@@ -3827,7 +3837,7 @@ function qi(s, t) {
3827
3837
  }
3828
3838
  return s;
3829
3839
  }
3830
- function we(s) {
3840
+ function ye(s) {
3831
3841
  return typeof s == "object" && s !== null && s.nodeType === Node.ELEMENT_NODE;
3832
3842
  }
3833
3843
  const bt = {
@@ -3842,14 +3852,14 @@ const bt = {
3842
3852
  nthchild: "nthchild",
3843
3853
  nthoftype: "nthoftype"
3844
3854
  };
3845
- function Qi(s, t) {
3855
+ function ji(s, t) {
3846
3856
  return Object.values(s).includes(t);
3847
3857
  }
3848
- const ji = "CssSelectorGenerator";
3858
+ const ts = "CssSelectorGenerator";
3849
3859
  function vt(s = "unknown problem", ...t) {
3850
- console.warn(`${ji}: ${s}`, ...t);
3860
+ console.warn(`${ts}: ${s}`, ...t);
3851
3861
  }
3852
- const ts = {
3862
+ const es = {
3853
3863
  selectors: [
3854
3864
  E.id,
3855
3865
  E.class,
@@ -3867,19 +3877,19 @@ const ts = {
3867
3877
  maxCandidates: Number.POSITIVE_INFINITY,
3868
3878
  useScope: !1
3869
3879
  };
3870
- function es(s) {
3871
- return Array.isArray(s) ? s.filter((t) => Qi(E, t)) : [];
3880
+ function is(s) {
3881
+ return Array.isArray(s) ? s.filter((t) => ji(E, t)) : [];
3872
3882
  }
3873
3883
  function Se(s) {
3874
3884
  return s instanceof RegExp;
3875
3885
  }
3876
- function is(s) {
3886
+ function ss(s) {
3877
3887
  return ["string", "function"].includes(typeof s) || Se(s);
3878
3888
  }
3879
3889
  function ue(s) {
3880
- return Array.isArray(s) ? s.filter(is) : [];
3890
+ return Array.isArray(s) ? s.filter(ss) : [];
3881
3891
  }
3882
- function ss(s) {
3892
+ function rs(s) {
3883
3893
  return s instanceof Node;
3884
3894
  }
3885
3895
  function de(s) {
@@ -3889,7 +3899,7 @@ function de(s) {
3889
3899
  // this includes Shadow DOM root
3890
3900
  Node.ELEMENT_NODE
3891
3901
  ];
3892
- return ss(s) && t.includes(s.nodeType);
3902
+ return rs(s) && t.includes(s.nodeType);
3893
3903
  }
3894
3904
  function Ee(s, t) {
3895
3905
  if (de(s))
@@ -3900,10 +3910,10 @@ function Ee(s, t) {
3900
3910
  function Tt(s) {
3901
3911
  return typeof s == "number" ? s : Number.POSITIVE_INFINITY;
3902
3912
  }
3903
- function rs(s, t = {}) {
3904
- const e = Object.assign(Object.assign({}, ts), t);
3913
+ function ns(s, t = {}) {
3914
+ const e = Object.assign(Object.assign({}, es), t);
3905
3915
  return {
3906
- selectors: es(e.selectors),
3916
+ selectors: is(e.selectors),
3907
3917
  whitelist: ue(e.whitelist),
3908
3918
  blacklist: ue(e.blacklist),
3909
3919
  root: Ee(e.root, s),
@@ -3920,10 +3930,10 @@ function at(s = []) {
3920
3930
  const [t = [], ...e] = s;
3921
3931
  return e.length === 0 ? t : e.reduce((i, r) => i.filter((n) => r.includes(n)), t);
3922
3932
  }
3923
- function ns(s) {
3933
+ function as(s) {
3924
3934
  return [].concat(...s);
3925
3935
  }
3926
- function as(s) {
3936
+ function os(s) {
3927
3937
  return s.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
3928
3938
  }
3929
3939
  function Rt(s) {
@@ -3936,7 +3946,7 @@ function Rt(s) {
3936
3946
  return typeof r != "boolean" ? (vt("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : r;
3937
3947
  };
3938
3948
  if (typeof e == "string") {
3939
- const i = new RegExp("^" + as(e) + "$");
3949
+ const i = new RegExp("^" + os(e) + "$");
3940
3950
  return (r) => i.test(r);
3941
3951
  }
3942
3952
  return vt("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
@@ -3951,22 +3961,22 @@ function Te(s, t) {
3951
3961
  t = t ?? ee(s);
3952
3962
  const e = [];
3953
3963
  let i = s;
3954
- for (; we(i) && i !== t; )
3964
+ for (; ye(i) && i !== t; )
3955
3965
  e.push(i), i = i.parentElement;
3956
3966
  return e;
3957
3967
  }
3958
- function os(s, t) {
3968
+ function cs(s, t) {
3959
3969
  return at(s.map((e) => Te(e, t)));
3960
3970
  }
3961
3971
  function ee(s) {
3962
3972
  return s.ownerDocument.querySelector(":root");
3963
3973
  }
3964
- const Ie = ", ", cs = new RegExp([
3974
+ const Ie = ", ", ls = new RegExp([
3965
3975
  "^$",
3966
3976
  // empty or not set
3967
3977
  "\\s"
3968
3978
  // contains whitespace
3969
- ].join("|")), ls = new RegExp([
3979
+ ].join("|")), hs = new RegExp([
3970
3980
  "^$"
3971
3981
  // empty or not set
3972
3982
  ].join("|")), xe = [
@@ -3976,54 +3986,54 @@ const Ie = ", ", cs = new RegExp([
3976
3986
  E.class,
3977
3987
  E.attribute,
3978
3988
  E.nthchild
3979
- ], hs = Rt([
3989
+ ], us = Rt([
3980
3990
  "class",
3981
3991
  "id",
3982
3992
  // Angular attributes
3983
3993
  "ng-*"
3984
3994
  ]);
3985
- function us({ name: s }) {
3995
+ function ds({ name: s }) {
3986
3996
  return `[${s}]`;
3987
3997
  }
3988
- function ds({ name: s, value: t }) {
3998
+ function fs({ name: s, value: t }) {
3989
3999
  return `[${s}='${t}']`;
3990
4000
  }
3991
- function fs({ nodeName: s, nodeValue: t }, e) {
4001
+ function ps({ nodeName: s, nodeValue: t }, e) {
3992
4002
  const i = e.tagName.toLowerCase();
3993
- return ["input", "option"].includes(i) && s === "value" || s === "src" && t?.startsWith("data:") ? !1 : !hs(s);
4003
+ return ["input", "option"].includes(i) && s === "value" || s === "src" && t?.startsWith("data:") ? !1 : !us(s);
3994
4004
  }
3995
- function ps({ nodeName: s, nodeValue: t }) {
4005
+ function ms({ nodeName: s, nodeValue: t }) {
3996
4006
  return {
3997
4007
  name: rt(s),
3998
4008
  value: rt(t ?? void 0)
3999
4009
  };
4000
4010
  }
4001
4011
  function Ne(s) {
4002
- const t = Array.from(s.attributes).filter((e) => fs(e, s)).map(ps);
4012
+ const t = Array.from(s.attributes).filter((e) => ps(e, s)).map(ms);
4003
4013
  return [
4004
- ...t.map(us),
4005
- ...t.map(ds)
4014
+ ...t.map(ds),
4015
+ ...t.map(fs)
4006
4016
  ];
4007
4017
  }
4008
- function ms(s) {
4018
+ function gs(s) {
4009
4019
  const t = s.map(Ne);
4010
4020
  return at(t);
4011
4021
  }
4012
- function Le(s) {
4022
+ function Oe(s) {
4013
4023
  var t;
4014
- return ((t = s.getAttribute("class")) !== null && t !== void 0 ? t : "").trim().split(/\s+/).filter((e) => !ls.test(e)).map((e) => `.${rt(e)}`);
4024
+ return ((t = s.getAttribute("class")) !== null && t !== void 0 ? t : "").trim().split(/\s+/).filter((e) => !hs.test(e)).map((e) => `.${rt(e)}`);
4015
4025
  }
4016
- function gs(s) {
4017
- const t = s.map(Le);
4026
+ function bs(s) {
4027
+ const t = s.map(Oe);
4018
4028
  return at(t);
4019
4029
  }
4020
- function Oe(s) {
4030
+ function Le(s) {
4021
4031
  var t;
4022
4032
  const e = (t = s.getAttribute("id")) !== null && t !== void 0 ? t : "", i = `#${rt(e)}`, r = s.getRootNode({ composed: !1 });
4023
- return !cs.test(e) && te([s], i, r) ? [i] : [];
4033
+ return !ls.test(e) && te([s], i, r) ? [i] : [];
4024
4034
  }
4025
- function bs(s) {
4026
- return s.length === 0 || s.length > 1 ? [] : Oe(s[0]);
4035
+ function vs(s) {
4036
+ return s.length === 0 || s.length > 1 ? [] : Le(s[0]);
4027
4037
  }
4028
4038
  function ze(s) {
4029
4039
  var t;
@@ -4035,7 +4045,7 @@ function ze(s) {
4035
4045
  }
4036
4046
  return [];
4037
4047
  }
4038
- function vs(s) {
4048
+ function As(s) {
4039
4049
  return at(s.map(ze));
4040
4050
  }
4041
4051
  function Ce(s) {
@@ -4045,7 +4055,7 @@ function Ce(s) {
4045
4055
  }
4046
4056
  function Re(s) {
4047
4057
  const t = [
4048
- ...new Set(ns(s.map(Ce)))
4058
+ ...new Set(as(s.map(Ce)))
4049
4059
  ];
4050
4060
  return t.length === 0 || t.length > 1 ? [] : [t[0]];
4051
4061
  }
@@ -4060,18 +4070,18 @@ function ke(s) {
4060
4070
  }
4061
4071
  return [];
4062
4072
  }
4063
- function As(s) {
4073
+ function ws(s) {
4064
4074
  return at(s.map(ke));
4065
4075
  }
4066
4076
  function* Pe(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
4067
4077
  let e = 0, i = kt(1);
4068
4078
  for (; i.length <= s.length && e < t; )
4069
- e += 1, yield i.map((n) => s[n]), i = ws(i, s.length - 1);
4079
+ e += 1, yield i.map((n) => s[n]), i = Ss(i, s.length - 1);
4070
4080
  }
4071
4081
  function ys(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
4072
4082
  return Array.from(Pe(s, { maxResults: t }));
4073
4083
  }
4074
- function ws(s = [], t = 0) {
4084
+ function Ss(s = [], t = 0) {
4075
4085
  const e = s.length;
4076
4086
  if (e === 0)
4077
4087
  return [];
@@ -4088,7 +4098,7 @@ function ws(s = [], t = 0) {
4088
4098
  function kt(s = 1) {
4089
4099
  return Array.from(Array(s).keys());
4090
4100
  }
4091
- function* Ss(s = {}) {
4101
+ function* Es(s = {}) {
4092
4102
  const t = Object.entries(s);
4093
4103
  if (t.length === 0)
4094
4104
  return;
@@ -4112,124 +4122,124 @@ function* Ss(s = {}) {
4112
4122
  });
4113
4123
  }
4114
4124
  }
4115
- const Es = "3a".toUpperCase(), Ts = /[ !"#$%&'()\[\]{|}<>*+,./;=?@^`~\\]/;
4125
+ const Ts = "3a".toUpperCase(), Is = /[ !"#$%&'()\[\]{|}<>*+,./;=?@^`~\\]/;
4116
4126
  function rt(s = "") {
4117
- return CSS ? CSS.escape(s) : Is(s);
4127
+ return CSS ? CSS.escape(s) : xs(s);
4118
4128
  }
4119
- function Is(s = "") {
4120
- return s.split("").map((t) => t === ":" ? `\\${Es} ` : Ts.test(t) ? `\\${t}` : escape(t).replace(/%/g, "\\")).join("");
4129
+ function xs(s = "") {
4130
+ return s.split("").map((t) => t === ":" ? `\\${Ts} ` : Is.test(t) ? `\\${t}` : escape(t).replace(/%/g, "\\")).join("");
4121
4131
  }
4122
- const xs = {
4132
+ const Ns = {
4123
4133
  tag: Re,
4124
- id: bs,
4125
- class: gs,
4126
- attribute: ms,
4127
- nthchild: vs,
4128
- nthoftype: As
4129
- }, Ns = {
4134
+ id: vs,
4135
+ class: bs,
4136
+ attribute: gs,
4137
+ nthchild: As,
4138
+ nthoftype: ws
4139
+ }, Os = {
4130
4140
  tag: Ce,
4131
- id: Oe,
4132
- class: Le,
4141
+ id: Le,
4142
+ class: Oe,
4133
4143
  attribute: Ne,
4134
4144
  nthchild: ze,
4135
4145
  nthoftype: ke
4136
4146
  };
4137
4147
  function Ls(s, t) {
4138
- return Ns[t](s);
4148
+ return Os[t](s);
4139
4149
  }
4140
- function Os(s, t) {
4141
- const e = xs[t];
4150
+ function zs(s, t) {
4151
+ const e = Ns[t];
4142
4152
  return e(s);
4143
4153
  }
4144
- function zs(s = [], t, e) {
4154
+ function Cs(s = [], t, e) {
4145
4155
  return s.filter((i) => e(i) || !t(i));
4146
4156
  }
4147
- function Cs(s = [], t) {
4157
+ function Rs(s = [], t) {
4148
4158
  return s.sort((e, i) => {
4149
4159
  const r = t(e), n = t(i);
4150
4160
  return r && !n ? -1 : !r && n ? 1 : 0;
4151
4161
  });
4152
4162
  }
4153
- function* Rs(s, t) {
4154
- const e = /* @__PURE__ */ new Set(), i = ks(s, t);
4155
- for (const r of Ms(i, t))
4163
+ function* ks(s, t) {
4164
+ const e = /* @__PURE__ */ new Set(), i = Ps(s, t);
4165
+ for (const r of Bs(i, t))
4156
4166
  e.has(r) || (e.add(r), yield r);
4157
4167
  }
4158
- function ks(s, t) {
4168
+ function Ps(s, t) {
4159
4169
  const { blacklist: e, whitelist: i, combineWithinSelector: r, maxCombinations: n } = t, a = Rt(e), o = Rt(i), l = (p, m) => {
4160
- const u = Os(s, m), g = zs(u, a, o), A = Cs(g, o);
4170
+ const u = zs(s, m), g = Cs(u, a, o), A = Rs(g, o);
4161
4171
  return p[m] = r ? Array.from(Pe(A, { maxResults: n })) : A.map((k) => [k]), p;
4162
4172
  };
4163
- return Ps(t).reduce(l, {});
4173
+ return Ds(t).reduce(l, {});
4164
4174
  }
4165
- function Ps(s) {
4175
+ function Ds(s) {
4166
4176
  const { selectors: t, includeTag: e } = s, i = [...t];
4167
4177
  return e && !i.includes("tag") && i.push("tag"), i;
4168
4178
  }
4169
- function Ds(s) {
4179
+ function Us(s) {
4170
4180
  return s.includes(E.tag) || s.includes(E.nthoftype) ? [...s] : [...s, E.tag];
4171
4181
  }
4172
- function Us(s) {
4182
+ function Ms(s) {
4173
4183
  const { selectors: t, combineBetweenSelectors: e, includeTag: i, maxCandidates: r } = s, n = e ? ys(t, { maxResults: r }) : t.map((a) => [a]);
4174
- return i ? n.map(Ds) : n;
4175
- }
4176
- function* Ms(s, t) {
4177
- for (const e of Us(t))
4178
- yield* Bs(e, s);
4184
+ return i ? n.map(Us) : n;
4179
4185
  }
4180
4186
  function* Bs(s, t) {
4187
+ for (const e of Ms(t))
4188
+ yield* Gs(e, s);
4189
+ }
4190
+ function* Gs(s, t) {
4181
4191
  const e = {};
4182
4192
  for (const i of s) {
4183
4193
  const r = t[i];
4184
4194
  r && r.length > 0 && (e[i] = r);
4185
4195
  }
4186
- for (const i of Ss(e))
4187
- yield Ws(i);
4196
+ for (const i of Es(e))
4197
+ yield Hs(i);
4188
4198
  }
4189
- function Gs(s, t) {
4199
+ function Ws(s, t) {
4190
4200
  return t[s] ? t[s].join("") : "";
4191
4201
  }
4192
- function Ws(s = {}) {
4202
+ function Hs(s = {}) {
4193
4203
  const t = [...xe];
4194
- return s[E.tag] && s[E.nthoftype] && t.splice(t.indexOf(E.tag), 1), t.map((e) => Gs(e, s)).join("");
4204
+ return s[E.tag] && s[E.nthoftype] && t.splice(t.indexOf(E.tag), 1), t.map((e) => Ws(e, s)).join("");
4195
4205
  }
4196
- function Hs(s, t) {
4206
+ function Fs(s, t) {
4197
4207
  return [
4198
4208
  ...s.map((e) => t + bt.DESCENDANT + e),
4199
4209
  ...s.map((e) => t + bt.CHILD + e)
4200
4210
  ];
4201
4211
  }
4202
- function* Fs(s, t) {
4212
+ function* _s(s, t) {
4203
4213
  if (t === "")
4204
4214
  yield* s;
4205
4215
  else
4206
4216
  for (const e of s)
4207
- yield* Hs([e], t);
4217
+ yield* Fs([e], t);
4208
4218
  }
4209
- function* _s(s, t, e = "", i) {
4210
- const r = Rs(s, i);
4211
- for (const n of Fs(r, e))
4219
+ function* Vs(s, t, e = "", i) {
4220
+ const r = ks(s, i);
4221
+ for (const n of _s(r, e))
4212
4222
  te(s, n, t) && (yield n);
4213
4223
  }
4214
- function* Vs(s, t, e = "", i) {
4224
+ function* Ys(s, t, e = "", i) {
4215
4225
  if (s.length === 0)
4216
4226
  return null;
4217
4227
  const r = [
4218
4228
  s.length > 1 ? s : [],
4219
- ...os(s, t).map((n) => [n])
4229
+ ...cs(s, t).map((n) => [n])
4220
4230
  ];
4221
4231
  for (const n of r)
4222
- for (const a of _s(n, t, e, i))
4232
+ for (const a of Vs(n, t, e, i))
4223
4233
  yield {
4224
4234
  foundElements: n,
4225
4235
  selector: a
4226
4236
  };
4227
4237
  }
4228
- function* Ys({ elements: s, root: t, rootSelector: e = "", options: i }) {
4238
+ function* $s({ elements: s, root: t, rootSelector: e = "", options: i }) {
4229
4239
  let r = t, n = e, a = !0;
4230
4240
  for (; a; ) {
4231
4241
  let o = !1;
4232
- for (const l of Vs(s, r, n, i)) {
4242
+ for (const l of Ys(s, r, n, i)) {
4233
4243
  const { foundElements: p, selector: m } = l;
4234
4244
  if (o = !0, te(s, m, t))
4235
4245
  yield m;
@@ -4241,9 +4251,9 @@ function* Ys({ elements: s, root: t, rootSelector: e = "", options: i }) {
4241
4251
  o || (a = !1);
4242
4252
  }
4243
4253
  }
4244
- function $s(s) {
4254
+ function Ks(s) {
4245
4255
  (s instanceof NodeList || s instanceof HTMLCollection) && (s = Array.from(s));
4246
- const t = (Array.isArray(s) ? s : [s]).filter(we);
4256
+ const t = (Array.isArray(s) ? s : [s]).filter(ye);
4247
4257
  return [...new Set(t)];
4248
4258
  }
4249
4259
  function Xs(s) {
@@ -4252,7 +4262,7 @@ function Xs(s) {
4252
4262
  include: !1
4253
4263
  };
4254
4264
  }
4255
- function Ks(s, t, e = bt.NONE) {
4265
+ function Zs(s, t, e = bt.NONE) {
4256
4266
  const i = {};
4257
4267
  return t.forEach((r) => {
4258
4268
  Reflect.set(i, r, Ls(s, r).map(Xs));
@@ -4262,7 +4272,7 @@ function Ks(s, t, e = bt.NONE) {
4262
4272
  selectors: i
4263
4273
  };
4264
4274
  }
4265
- function Zs({ selectors: s, operator: t }) {
4275
+ function Js({ selectors: s, operator: t }) {
4266
4276
  let e = [...xe];
4267
4277
  s[E.tag] && s[E.nthoftype] && (e = e.filter((r) => r !== E.tag));
4268
4278
  let i = "";
@@ -4273,31 +4283,31 @@ function Zs({ selectors: s, operator: t }) {
4273
4283
  });
4274
4284
  }), t + i;
4275
4285
  }
4276
- function Js(s, t) {
4286
+ function qs(s, t) {
4277
4287
  const i = Te(s, t).reverse().map((r) => {
4278
4288
  var n;
4279
- const a = Ks(r, [E.nthchild], bt.CHILD);
4289
+ const a = Zs(r, [E.nthchild], bt.CHILD);
4280
4290
  return ((n = a.selectors.nthchild) !== null && n !== void 0 ? n : []).forEach((o) => {
4281
4291
  o.include = !0;
4282
4292
  }), a;
4283
4293
  });
4284
4294
  return [
4285
4295
  t ? ":scope" : ":root",
4286
- ...i.map(Zs)
4296
+ ...i.map(Js)
4287
4297
  ].join("");
4288
4298
  }
4289
- function qs(s, t) {
4290
- return s.map((e) => Js(e, t)).join(Ie);
4299
+ function Qs(s, t) {
4300
+ return s.map((e) => qs(e, t)).join(Ie);
4291
4301
  }
4292
4302
  function De(s, t = {}) {
4293
4303
  const e = Object.assign(Object.assign({}, t), { maxResults: 1 });
4294
- return Qs(s, e).next().value;
4304
+ return js(s, e).next().value;
4295
4305
  }
4296
- function* Qs(s, t = {}) {
4306
+ function* js(s, t = {}) {
4297
4307
  var e;
4298
- const i = $s(s), r = rs(i[0], t), n = (e = r.root) !== null && e !== void 0 ? e : ee(i[0]);
4308
+ const i = Ks(s), r = ns(i[0], t), n = (e = r.root) !== null && e !== void 0 ? e : ee(i[0]);
4299
4309
  let a = 0;
4300
- for (const o of Ys({
4310
+ for (const o of $s({
4301
4311
  elements: i,
4302
4312
  options: r,
4303
4313
  root: n,
@@ -4305,9 +4315,9 @@ function* Qs(s, t = {}) {
4305
4315
  }))
4306
4316
  if (yield o, a++, a >= r.maxResults)
4307
4317
  return;
4308
- i.length > 1 && (yield i.map((o) => De(o, r)).join(Ie), a++, a >= r.maxResults) || (yield qs(i, r.useScope ? n : void 0));
4318
+ i.length > 1 && (yield i.map((o) => De(o, r)).join(Ie), a++, a >= r.maxResults) || (yield Qs(i, r.useScope ? n : void 0));
4309
4319
  }
4310
- class ur extends jt {
4320
+ class dr extends jt {
4311
4321
  constructor(t, e, i = 50) {
4312
4322
  super(), this.resource = t, this.locator = e, this.beforeMaxLength = i, this.currentElement = null, this.currentIndex = null, this.parsedElementRecipes = null, this.parser = null;
4313
4323
  }
@@ -4342,15 +4352,15 @@ class ur extends jt {
4342
4352
  }
4343
4353
  async parseElements() {
4344
4354
  const t = await this.resource.readAsString(), e = new DOMParser().parseFromString(t, this.locator.type);
4345
- return this.parser = new tr(
4355
+ return this.parser = new er(
4346
4356
  e,
4347
4357
  this.locator,
4348
4358
  this.locator.locations.getCssSelector() ? e.querySelector(this.locator.locations.getCssSelector()) : null,
4349
4359
  this.beforeMaxLength
4350
- ), js(this.parser, e.body), this.parser.result();
4360
+ ), tr(this.parser, e.body), this.parser.result();
4351
4361
  }
4352
4362
  }
4353
- function js(s, t) {
4363
+ function tr(s, t) {
4354
4364
  let e = t, i = 0;
4355
4365
  for (; e != null; )
4356
4366
  if (s.head(e, i), e.firstChild != null)
@@ -4363,7 +4373,7 @@ function js(s, t) {
4363
4373
  e = e?.nextSibling || null;
4364
4374
  }
4365
4375
  }
4366
- class tr {
4376
+ class er {
4367
4377
  constructor(t, e, i, r) {
4368
4378
  this.doc = t, this.baseLocator = e, this.startElement = i, this.beforeMaxLength = r, this.elementRecipes = [], this.startIndex = 0, this.segmentRecipesAcc = [], this.textAcc = "", this.wholeRawTextAcc = null, this.elementRawTextAcc = "", this.rawTextAcc = "", this.currentLanguage = null, this.breadcrumbs = [], this.recipeCssSelectorCache = /* @__PURE__ */ new WeakMap();
4369
4379
  }
@@ -4509,7 +4519,7 @@ class tr {
4509
4519
  l.length > 0 && (o = new M({
4510
4520
  href: l[0].href,
4511
4521
  type: l[0].type,
4512
- alternates: l.length > 1 ? new O(l.slice(1)) : void 0
4522
+ alternates: l.length > 1 ? new x(l.slice(1)) : void 0
4513
4523
  }));
4514
4524
  }
4515
4525
  o && (r === "AUDIO" ? this.elementRecipes.push({
@@ -4532,8 +4542,8 @@ class tr {
4532
4542
  // Implements NodeTraversor
4533
4543
  tail(t, e) {
4534
4544
  if (t.nodeType === Node.TEXT_NODE && !ct(t.textContent)) {
4535
- const i = Ji(t.parentElement);
4536
- this.currentLanguage !== i && (this.flushSegment(), this.currentLanguage = i), this.rawTextAcc += t.textContent, this.textAcc = qi(this.textAcc, t.textContent);
4545
+ const i = qi(t.parentElement);
4546
+ this.currentLanguage !== i && (this.flushSegment(), this.currentLanguage = i), this.rawTextAcc += t.textContent, this.textAcc = Qi(this.textAcc, t.textContent);
4537
4547
  } else if (t.nodeType === Node.ELEMENT_NODE && !le(t)) {
4538
4548
  if (!this.breadcrumbs.length || this.breadcrumbs.at(-1) !== t) throw new Error("HTMLContentIterator: breadcrumbs mismatch");
4539
4549
  this.flushText(), this.breadcrumbs.pop();
@@ -4541,7 +4551,7 @@ class tr {
4541
4551
  }
4542
4552
  flushText() {
4543
4553
  if (this.flushSegment(), this.startIndex === 0 && this.startElement && this.breadcrumbs.length && this.breadcrumbs.at(-1) === this.startElement && (this.startIndex = this.elementRecipes.length), !this.segmentRecipesAcc.length) return;
4544
- this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text = Zi(
4554
+ this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text = Ji(
4545
4555
  this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text
4546
4556
  );
4547
4557
  let t = Hi;
@@ -4580,10 +4590,10 @@ class tr {
4580
4590
  }
4581
4591
  flushSegment() {
4582
4592
  let t = this.textAcc;
4583
- const e = ye(t);
4593
+ const e = we(t);
4584
4594
  if (!ct(e)) {
4585
4595
  if (!this.segmentRecipesAcc.length) {
4586
- t = Ki(t);
4596
+ t = Zi(t);
4587
4597
  const i = t.length && ct(t[t.length - 1]) ? t[t.length - 1] : "";
4588
4598
  t = e + i;
4589
4599
  }
@@ -4634,7 +4644,7 @@ class Ue {
4634
4644
  * Creates a [LocatorCollection].
4635
4645
  */
4636
4646
  constructor(t) {
4637
- this.metadata = t.metadata ?? new At({}), this.links = t.links ?? new O([]), this.locators = t.locators ?? [];
4647
+ this.metadata = t.metadata ?? new At({}), this.links = t.links ?? new x([]), this.locators = t.locators ?? [];
4638
4648
  }
4639
4649
  /**
4640
4650
  * Parses a [LocatorCollection] from its RWPM JSON representation.
@@ -4644,7 +4654,7 @@ class Ue {
4644
4654
  let e, i = t.locators;
4645
4655
  return i && Array.isArray(i) && (e = i.map((r) => D.deserialize(r)).filter((r) => r !== void 0)), new Ue({
4646
4656
  metadata: At.deserialize(t.metadata),
4647
- links: O.deserialize(t.links),
4657
+ links: x.deserialize(t.links),
4648
4658
  locators: e
4649
4659
  });
4650
4660
  }
@@ -4674,9 +4684,9 @@ class H {
4674
4684
  if (!t) return;
4675
4685
  let e, i, r;
4676
4686
  if (Array.isArray(t))
4677
- e = O.deserialize(t);
4687
+ e = x.deserialize(t);
4678
4688
  else if (typeof t == "object")
4679
- e = O.deserialize(t.links), i = /* @__PURE__ */ new Map(), t.metadata && Object.entries(t.metadata).forEach(([n, a]) => {
4689
+ e = x.deserialize(t.links), i = /* @__PURE__ */ new Map(), t.metadata && Object.entries(t.metadata).forEach(([n, a]) => {
4680
4690
  i?.set(n, a);
4681
4691
  }), r = H.deserializeCollections(t);
4682
4692
  else
@@ -4741,35 +4751,34 @@ class Me {
4741
4751
  if (!t) return;
4742
4752
  const e = pt.deserialize(t.metadata);
4743
4753
  if (!e) return;
4744
- const i = O.deserialize(t.links);
4745
- if (!i) return;
4746
- const r = O.deserialize(
4754
+ const i = x.deserialize(t.links), r = x.deserialize(
4747
4755
  t.readingOrder ? t.readingOrder : t.spine
4748
4756
  );
4749
- if (r)
4750
- return new Me({
4751
- context: _(t["@context"]),
4752
- metadata: e,
4753
- links: i,
4754
- readingOrder: r,
4755
- resources: O.deserialize(t.resources),
4756
- toc: O.deserialize(t.toc),
4757
- subcollections: H.deserializeCollections({
4758
- sub: t.sub
4759
- })
4760
- });
4757
+ if (!r) return;
4758
+ const n = /* @__PURE__ */ new Set(["@context", "metadata", "links", "readingOrder", "spine", "resources", "toc"]), a = {};
4759
+ return Object.keys(t).forEach((o) => {
4760
+ n.has(o) || (a[o] = t[o]);
4761
+ }), new Me({
4762
+ context: _(t["@context"]),
4763
+ metadata: e,
4764
+ links: i,
4765
+ readingOrder: r,
4766
+ resources: x.deserialize(t.resources),
4767
+ toc: x.deserialize(t.toc),
4768
+ subcollections: H.deserializeCollections(a)
4769
+ });
4761
4770
  }
4762
4771
  /**
4763
4772
  * Serializes a [Publication] to its RWPM JSON representation.
4764
4773
  */
4765
4774
  serialize() {
4766
4775
  const t = {};
4767
- return this.context !== void 0 && (t["@context"] = this.context), t.metadata = this.metadata.serialize(), t.links = this.links.serialize(), t.readingOrder = this.readingOrder.serialize(), this.resources && (t.resources = this.resources.serialize()), this.toc && (t.toc = this.toc.serialize()), H.serializeCollection(t, this.subcollections), t;
4776
+ return this.context !== void 0 && (t["@context"] = this.context), t.metadata = this.metadata.serialize(), this.links !== void 0 && (t.links = this.links.serialize()), t.readingOrder = this.readingOrder.serialize(), this.resources && (t.resources = this.resources.serialize()), this.toc && (t.toc = this.toc.serialize()), H.serializeCollection(t, this.subcollections), t;
4768
4777
  }
4769
4778
  /** Finds the first link with the given relation in the manifest's links. */
4770
4779
  linkWithRel(t) {
4771
4780
  const e = new Array();
4772
- e.push(this.readingOrder), this.resources && e.push(this.resources), e.push(this.links);
4781
+ e.push(this.readingOrder), this.resources && e.push(this.resources), this.links && e.push(this.links);
4773
4782
  let i;
4774
4783
  for (const r of e)
4775
4784
  if (i = r.findWithRel(t), i !== void 0)
@@ -4779,7 +4788,7 @@ class Me {
4779
4788
  /** Finds all the links with the given relation in the manifest's links. */
4780
4789
  linksWithRel(t) {
4781
4790
  const e = [];
4782
- return e.push(this.readingOrder.filterByRel(t)), this.resources && e.push(this.resources.filterByRel(t)), e.push(this.links.filterByRel(t)), e.reduce((i, r) => i.concat(r), []);
4791
+ return e.push(this.readingOrder.filterByRel(t)), this.resources && e.push(this.resources.filterByRel(t)), this.links && e.push(this.links.filterByRel(t)), e.reduce((i, r) => i.concat(r), []);
4783
4792
  }
4784
4793
  /**
4785
4794
  * Creates a new [Locator] object from a [Link] to a resource of this manifest.
@@ -4816,7 +4825,7 @@ class Me {
4816
4825
  p.push(...u);
4817
4826
  }), p.length > 0 && (l = e(p)), l;
4818
4827
  }, i = [];
4819
- i.push(this.readingOrder), this.resources && i.push(this.resources), i.push(this.links);
4828
+ i.push(this.readingOrder), this.resources && i.push(this.resources), this.links && i.push(this.links);
4820
4829
  const r = e(i);
4821
4830
  if (r !== void 0)
4822
4831
  return r;
@@ -4829,7 +4838,7 @@ class Me {
4829
4838
  * e.g. https://provider.com/pub1293/manifest.json gives https://provider.com/pub1293/
4830
4839
  */
4831
4840
  get baseURL() {
4832
- const t = this.links.items.find(
4841
+ const t = this.links?.items.find(
4833
4842
  (e) => e.rels && e.rels.has("self")
4834
4843
  );
4835
4844
  if (t) {
@@ -4845,7 +4854,7 @@ class Me {
4845
4854
  * Sets the URL where this [Publication]'s RWPM manifest is served.
4846
4855
  */
4847
4856
  setSelfLink(t) {
4848
- this.links.items = this.links.items.filter(
4857
+ this.links || (this.links = new x([])), this.links.items = this.links.items.filter(
4849
4858
  (e) => e.rels === void 0 || !e.rels?.has("self")
4850
4859
  ), this.links.items.push(
4851
4860
  new M({
@@ -4859,7 +4868,7 @@ class Me {
4859
4868
  export {
4860
4869
  R as AccessMode,
4861
4870
  V as Accessibility,
4862
- rr as AccessibilityMetadataDisplayGuide,
4871
+ nr as AccessibilityMetadataDisplayGuide,
4863
4872
  It as AccessibilityProfile,
4864
4873
  Ft as AccessibilitySummary,
4865
4874
  tt as Acquisition,
@@ -4875,38 +4884,38 @@ export {
4875
4884
  Hi as Body,
4876
4885
  Pt as Certification,
4877
4886
  Wt as Conformance,
4878
- ar as Content,
4887
+ or as Content,
4879
4888
  ge as ContentElement,
4880
4889
  dt as Contributor,
4881
- N as Contributors,
4890
+ O as Contributors,
4882
4891
  qt as Copies,
4883
4892
  Ri as DefaultTextContentTokenizer,
4884
- Kt as DomRange,
4893
+ Xt as DomRange,
4885
4894
  gt as DomRangePoint,
4886
4895
  ei as EmptyFetcher,
4887
4896
  _t as Encryption,
4888
4897
  Nt as Exemption,
4889
4898
  v as Feature,
4890
4899
  Fi as Footnote,
4891
- Xt as GuidedNavigationDocument,
4892
- K as GuidedNavigationObject,
4900
+ Kt as GuidedNavigationDocument,
4901
+ X as GuidedNavigationObject,
4893
4902
  mt as GuidedNavigationText,
4894
- ur as HTMLResourceContentIterator,
4903
+ dr as HTMLResourceContentIterator,
4895
4904
  P as Hazard,
4896
4905
  li as HazardType,
4897
4906
  Gt as Hazards,
4898
4907
  Wi as Heading,
4899
4908
  Jt as Holds,
4900
- er as HttpFetcher,
4909
+ ir as HttpFetcher,
4901
4910
  ii as HttpResource,
4902
4911
  it as IllegalStateError,
4903
4912
  Gi as ImageElement,
4904
4913
  ki as IntlTextTokenizer,
4905
4914
  jt as Iterator,
4906
- X as Layout,
4915
+ K as Layout,
4907
4916
  Ht as Legal,
4908
4917
  M as Link,
4909
- O as Links,
4918
+ x as Links,
4910
4919
  f as Localization,
4911
4920
  B as LocalizedString,
4912
4921
  D as Locator,
@@ -4921,10 +4930,10 @@ export {
4921
4930
  Pi as NaiveTextTokenizer,
4922
4931
  Ut as Navigation,
4923
4932
  ai as NonvisualReading,
4924
- ir as NumberRange,
4933
+ sr as NumberRange,
4925
4934
  St as PDFContentElement,
4926
- Lt as Page,
4927
- hr as PageContentIteratorPDF,
4935
+ Ot as Page,
4936
+ ur as PageContentIteratorPDF,
4928
4937
  oi as PrerecordedAudio,
4929
4938
  Zt as Price,
4930
4939
  xt as PrimaryAccessMode,
@@ -4932,21 +4941,21 @@ export {
4932
4941
  U as Properties,
4933
4942
  Y as Publication,
4934
4943
  H as PublicationCollection,
4935
- lr as PublicationContentIterator,
4944
+ hr as PublicationContentIterator,
4936
4945
  F as ReadingProgression,
4937
- sr as Resource,
4946
+ rr as Resource,
4938
4947
  Mt as RichContent,
4939
4948
  ci as RichContentType,
4940
4949
  ft as Subject,
4941
4950
  Yt as Subjects,
4942
4951
  $t as TDM,
4943
4952
  ui as TDMReservation,
4944
- or as TextContentTokenizer,
4953
+ cr as TextContentTokenizer,
4945
4954
  Ct as TextElement,
4946
4955
  _i as TextQuote,
4947
4956
  be as TextSegment,
4948
4957
  Ci as TextUnit,
4949
- yt as TextualElement,
4958
+ wt as TextualElement,
4950
4959
  C as Timeline,
4951
4960
  ut as URITemplate,
4952
4961
  Bi as VideoElement,
@@ -4955,7 +4964,7 @@ export {
4955
4964
  hi as arrayfromJSON,
4956
4965
  _ as arrayfromJSONorString,
4957
4966
  lt as datefromJSON,
4958
- nr as leadingPage,
4967
+ ar as leadingPage,
4959
4968
  Z as numberfromJSON,
4960
4969
  L as positiveNumberfromJSON,
4961
4970
  ht as setToArray,