@readium/shared 2.2.0-beta.1 → 2.2.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/index.js +974 -768
  2. package/dist/index.umd.cjs +3 -3
  3. package/package.json +1 -1
  4. package/src/publication/Publication.ts +12 -0
  5. package/src/publication/services/index.ts +2 -1
  6. package/src/publication/services/timeline/Timeline.ts +335 -0
  7. package/src/publication/services/timeline/TimelineItem.ts +24 -0
  8. package/src/publication/services/timeline/index.ts +2 -0
  9. package/types/src/publication/Publication.d.ts +8 -0
  10. package/types/src/publication/services/index.d.ts +1 -0
  11. package/types/src/publication/services/timeline/Timeline.d.ts +89 -0
  12. package/types/src/publication/services/timeline/TimelineItem.d.ts +24 -0
  13. package/types/src/publication/services/timeline/index.d.ts +2 -0
  14. package/types/test/AltIdentifier.test.d.ts +1 -0
  15. package/types/test/Contributor.test.d.ts +1 -0
  16. package/types/test/GuidedNavigation.test.d.ts +1 -0
  17. package/types/test/Link.test.d.ts +1 -0
  18. package/types/test/LocalizedString.test.d.ts +1 -0
  19. package/types/test/Locator.test.d.ts +1 -0
  20. package/types/test/LocatorCollection.test.d.ts +1 -0
  21. package/types/test/Manifest.test.d.ts +1 -0
  22. package/types/test/Metadata.test.d.ts +1 -0
  23. package/types/test/Properties.test.d.ts +1 -0
  24. package/types/test/Publication.test.d.ts +1 -0
  25. package/types/test/PublicationCollection.test.d.ts +1 -0
  26. package/types/test/Subject.test.d.ts +1 -0
  27. package/types/test/TDM.test.d.ts +1 -0
  28. package/types/test/Timeline.test.d.ts +1 -0
  29. package/types/test/accessibility/Accessibility.test.d.ts +1 -0
  30. package/types/test/accessibility/AccessibilityMetadataDisplayGuide.test.d.ts +1 -0
  31. package/types/test/accessibility/Localization.test.d.ts +1 -0
  32. package/types/test/encryption/Encryption.test.d.ts +1 -0
  33. package/types/test/encryption/Properties.test.d.ts +1 -0
  34. package/types/test/epub/MediaOverlay.test.d.ts +1 -0
  35. package/types/test/epub/Metadata.test.d.ts +1 -0
  36. package/types/test/epub/PropertiesTest.test.d.ts +1 -0
  37. package/types/test/epub/PublicationTest.test.d.ts +1 -0
  38. package/types/test/html/DomRange.test.d.ts +1 -0
  39. package/types/test/html/Locator.test.d.ts +1 -0
  40. package/types/test/opds/PropertiesTest.test.d.ts +1 -0
  41. package/types/test/opds/PublicationTest.test.d.ts +1 -0
  42. package/types/test/util/URITemplate.test.d.ts +1 -0
  43. package/types/test/util/mediatype/MediaType.test.d.ts +1 -0
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- class ti {
1
+ class ei {
2
2
  close() {
3
3
  }
4
4
  links() {
@@ -8,7 +8,7 @@ class ti {
8
8
  throw Error("This is an empty fetcher");
9
9
  }
10
10
  }
11
- class tr {
11
+ class er {
12
12
  constructor(t, e) {
13
13
  this.client = t || window.fetch.bind(window), this.baseUrl = e;
14
14
  }
@@ -19,12 +19,12 @@ class tr {
19
19
  const e = t.toURL(this.baseUrl);
20
20
  if (e === void 0)
21
21
  throw Error(`Invalid HREF: ${t.href}`);
22
- return new ei(this.client, t, e);
22
+ return new ii(this.client, t, e);
23
23
  }
24
24
  close() {
25
25
  }
26
26
  }
27
- class ei {
27
+ class ii {
28
28
  constructor(t, e, i) {
29
29
  this.client = t || window.fetch.bind(window), this._link = e, this.url = i;
30
30
  }
@@ -88,12 +88,12 @@ class ei {
88
88
  );
89
89
  }
90
90
  }
91
- class er {
91
+ class ir {
92
92
  constructor(t, e) {
93
93
  this.start = t, this.endInclusive = e;
94
94
  }
95
95
  }
96
- class ir {
96
+ class sr {
97
97
  readAsString() {
98
98
  return this.read().then((t) => t === void 0 ? t : new TextDecoder().decode(t));
99
99
  }
@@ -115,14 +115,14 @@ class V {
115
115
  if (!t || typeof t != "object") return;
116
116
  const e = t;
117
117
  return new V({
118
- conformsTo: e.conformsTo ? e.conformsTo.map((i) => Tt.deserialize(i)).filter((i) => i !== void 0) : void 0,
119
- certification: e.certification ? Pt.deserialize(e.certification) : void 0,
118
+ conformsTo: e.conformsTo ? e.conformsTo.map((i) => It.deserialize(i)).filter((i) => i !== void 0) : void 0,
119
+ certification: e.certification ? kt.deserialize(e.certification) : void 0,
120
120
  summary: e.summary,
121
121
  accessMode: e.accessMode ? e.accessMode.map((i) => R.deserialize(i)).filter((i) => i !== void 0) : void 0,
122
- accessModeSufficient: e.accessModeSufficient ? e.accessModeSufficient.map((i) => It.deserialize(i)).filter((i) => i !== void 0) : void 0,
122
+ accessModeSufficient: e.accessModeSufficient ? e.accessModeSufficient.map((i) => xt.deserialize(i)).filter((i) => i !== void 0) : void 0,
123
123
  feature: e.feature ? e.feature.map((i) => v.deserialize(i)).filter((i) => i !== void 0) : void 0,
124
- hazard: e.hazard ? e.hazard.map((i) => P.deserialize(i)).filter((i) => i !== void 0) : void 0,
125
- exemption: e.exemption ? e.exemption.map((i) => xt.deserialize(i)).filter((i) => i !== void 0) : void 0
124
+ hazard: e.hazard ? e.hazard.map((i) => k.deserialize(i)).filter((i) => i !== void 0) : void 0,
125
+ exemption: e.exemption ? e.exemption.map((i) => Nt.deserialize(i)).filter((i) => i !== void 0) : void 0
126
126
  });
127
127
  }
128
128
  /**
@@ -170,8 +170,8 @@ const b = class b {
170
170
  }
171
171
  };
172
172
  b.EPUB_A11Y_10_WCAG_20_A = new b("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), b.EPUB_A11Y_10_WCAG_20_AA = new b("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), b.EPUB_A11Y_10_WCAG_20_AAA = new b("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), b.EPUB_A11Y_11_WCAG_20_A = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), b.EPUB_A11Y_11_WCAG_20_AA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), b.EPUB_A11Y_11_WCAG_20_AAA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), b.EPUB_A11Y_11_WCAG_21_A = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), b.EPUB_A11Y_11_WCAG_21_AA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), b.EPUB_A11Y_11_WCAG_21_AAA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), b.EPUB_A11Y_11_WCAG_22_A = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), b.EPUB_A11Y_11_WCAG_22_AA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), b.EPUB_A11Y_11_WCAG_22_AAA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
173
- let Tt = b;
174
- class Pt {
173
+ let It = b;
174
+ class kt {
175
175
  constructor(t = null, e = null, i = null) {
176
176
  this.certifiedBy = t, this.credential = e, this.report = i;
177
177
  }
@@ -180,7 +180,7 @@ class Pt {
180
180
  */
181
181
  static deserialize(t) {
182
182
  if (!(!t || typeof t != "object"))
183
- return new Pt(
183
+ return new kt(
184
184
  t.certifiedBy,
185
185
  t.credential,
186
186
  t.report
@@ -214,15 +214,15 @@ const y = class y {
214
214
  };
215
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
216
  let R = y;
217
- const x = class x {
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 It = 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 l = class l {
254
254
  constructor(t) {
255
255
  this.value = t;
@@ -289,7 +289,7 @@ const w = class w {
289
289
  }
290
290
  };
291
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;
292
+ let k = w;
293
293
  const S = class S {
294
294
  constructor(t) {
295
295
  this.value = t;
@@ -309,10 +309,10 @@ const S = class S {
309
309
  }
310
310
  };
311
311
  S.NONE = new S("none"), S.DOCUMENTED = new S("documented"), S.LEGAL = new S("legal"), S.TEMPORARY = new S("temporary"), S.TECHNICAL = new S("technical"), S.EAA_DISPROPORTIONATE_BURDEN = new S("eaa-disproportionate-burden"), S.EAA_FUNDAMENTAL_ALTERATION = new S("eaa-fundamental-alteration"), S.EAA_MICROENTERPRISE = new S("eaa-microenterprise"), S.EAA_TECHNICAL_IMPOSSIBILITY = new S("eaa-technical-impossibility"), S.EAA_TEMPORARY = new S("eaa-temporary");
312
- let xt = S;
313
- const ee = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], ii = /* @__PURE__ */ JSON.parse(`{"format":{"audiobook":"Audiobook","audiobookJSON":"Audiobook Manifest","cbz":"Comic Book Archive","divina":"Divina Publication","divinaJSON":"Divina Publication Manifest","epub":"EPUB","lcpa":"LCP Protected Audiobook","lcpdf":"LCP Protected PDF","lcpl":"LCP License Document","pdf":"PDF","rwp":"Readium Web Publication","rwpm":"Readium Web Publication Manifest","zab":"Audiobook Archive","zip":"ZIP Archive"},"kind":{"audiobook_one":"audiobook","audiobook_other":"audiobooks","book_one":"book","book_other":"books","comic_one":"comic","comic_other":"comics","document_one":"document","document_other":"documents"},"metadata":{"accessibility":{"display-guide":{"accessibility-summary":{"no-metadata":"No information is available","publisher-contact":"For more information about the accessibility of this product, please contact the publisher: ","title":"Accessibility summary"},"additional-accessibility-information":{"aria":{"compact":"ARIA roles included","descriptive":"Content is enhanced with ARIA roles to optimize organization and facilitate navigation"},"audio-descriptions":"Audio descriptions","braille":"Braille","color-not-sole-means-of-conveying-information":"Color is not the sole means of conveying information","dyslexia-readability":"Dyslexia readability","full-ruby-annotations":"Full ruby annotations","high-contrast-between-foreground-and-background-audio":"High contrast between foreground and background audio","high-contrast-between-text-and-background":"High contrast between foreground text and background","large-print":"Large print","page-breaks":{"compact":"Page breaks included","descriptive":"Page breaks included from the original print source"},"ruby-annotations":"Some Ruby annotations","sign-language":"Sign language","tactile-graphics":{"compact":"Tactile graphics included","descriptive":"Tactile graphics have been integrated to facilitate access to visual elements for blind people"},"tactile-objects":"Tactile 3D objects","text-to-speech-hinting":"Text-to-speech hinting provided","title":"Additional accessibility information","ultra-high-contrast-between-text-and-background":"Ultra high contrast between text and background","visible-page-numbering":"Visible page numbering","without-background-sounds":"Without background sounds"},"conformance":{"a":{"compact":"This publication meets minimum accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level A standard"},"aa":{"compact":"This publication meets accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AA standard"},"aaa":{"compact":"This publication exceeds accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AAA standard"},"certifier":"The publication was certified by ","certifier-credentials":"The certifier's credential is ","details":{"certification-info":"The publication was certified on ","certifier-report":"For more information refer to the certifier's report","claim":"This publication claims to meet","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Level A","level-aa":"Level AA","level-aaa":"Level AAA","wcag-2-0":{"compact":"WCAG 2.0","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.0"},"wcag-2-1":{"compact":"WCAG 2.1","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.1"},"wcag-2-2":{"compact":"WCAG 2.2","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.2"}},"details-title":"Detailed conformance information","no":"No information is available","title":"Conformance","unknown-standard":"Conformance to accepted standards for accessibility of this publication cannot be determined"},"hazards":{"flashing":{"compact":"Flashing content","descriptive":"The publication contains flashing content that can cause photosensitive seizures"},"flashing-none":{"compact":"No flashing hazards","descriptive":"The publication does not contain flashing content that can cause photosensitive seizures"},"flashing-unknown":{"compact":"Flashing hazards not known","descriptive":"The presence of flashing content that can cause photosensitive seizures could not be determined"},"motion":{"compact":"Motion simulation","descriptive":"The publication contains motion simulations that can cause motion sickness"},"motion-none":{"compact":"No motion simulation hazards","descriptive":"The publication does not contain motion simulations that can cause motion sickness"},"motion-unknown":{"compact":"Motion simulation hazards not known","descriptive":"The presence of motion simulations that can cause motion sickness could not be determined"},"no-metadata":"No information is available","none":{"compact":"No hazards","descriptive":"The publication contains no hazards"},"sound":{"compact":"Sounds","descriptive":"The publication contains sounds that can cause sensitivity issues"},"sound-none":{"compact":"No sound hazards","descriptive":"The publication does not contain sounds that can cause sensitivity issues"},"sound-unknown":{"compact":"Sound hazards not known","descriptive":"The presence of sounds that can cause sensitivity issues could not be determined"},"title":"Hazards","unknown":"The presence of hazards is unknown"},"legal-considerations":{"exempt":{"compact":"Claims an accessibility exemption in some jurisdictions","descriptive":"This publication claims an accessibility exemption in some jurisdictions"},"no-metadata":"No information is available","title":"Legal considerations"},"navigation":{"index":{"compact":"Index","descriptive":"Index with links to referenced entries"},"no-metadata":"No information is available","page-navigation":{"compact":"Go to page","descriptive":"Page list to go to pages from the print source version"},"structural":{"compact":"Headings","descriptive":"Elements such as headings, tables, etc for structured navigation"},"title":"Navigation","toc":{"compact":"Table of contents","descriptive":"Table of contents to all chapters of the text via links"}},"rich-content":{"accessible-chemistry-as-latex":{"compact":"Chemical formulas in LaTeX","descriptive":"Chemical formulas in accessible format (LaTeX)"},"accessible-chemistry-as-mathml":{"compact":"Chemical formulas in MathML","descriptive":"Chemical formulas in accessible format (MathML)"},"accessible-math-as-latex":{"compact":"Math as LaTeX","descriptive":"Math formulas in accessible format (LaTeX)"},"accessible-math-described":"Text descriptions of math are provided","closed-captions":{"compact":"Videos have closed captions","descriptive":"Videos included in publications have closed captions"},"extended-descriptions":"Information-rich images are described by extended descriptions","math-as-mathml":{"compact":"Math as MathML","descriptive":"Math formulas in accessible format (MathML)"},"open-captions":{"compact":"Videos have open captions","descriptive":"Videos included in publications have open captions"},"title":"Rich content","transcript":"Transcript(s) provided","unknown":"No information is available"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{"compact":"Has alternative text","descriptive":"Has alternative text descriptions for images"},"no-metadata":"No information about nonvisual reading is available","none":{"compact":"Not readable in read aloud or dynamic braille","descriptive":"The content is not readable as read aloud speech or dynamic braille"},"not-fully":{"compact":"Not fully readable in read aloud or dynamic braille","descriptive":"Not all of the content will be readable as read aloud speech or dynamic braille"},"readable":{"compact":"Readable in read aloud or dynamic braille","descriptive":"All content can be read as read aloud speech or dynamic braille"}},"prerecorded-audio":{"complementary":{"compact":"Prerecorded audio clips","descriptive":"Prerecorded audio clips are embedded in the content"},"no-metadata":"No information about prerecorded audio is available","only":{"compact":"Prerecorded audio only","descriptive":"Audiobook with no text alternative"},"synchronized":{"compact":"Prerecorded audio synchronized with text","descriptive":"All the content is available as prerecorded audio synchronized with text"}},"title":"Ways of reading","visual-adjustments":{"modifiable":{"compact":"Appearance can be modified","descriptive":"Appearance of the text and page layout can be modified according to the capabilities of the reading system (font family and font size, spaces between paragraphs, sentences, words, and letters, as well as color of background and text)"},"unknown":"No information about appearance modifiability is available","unmodifiable":{"compact":"Appearance cannot be modified","descriptive":"Text and page layout cannot be modified as the reading experience is close to a print version, but reading systems can still provide zooming options"}}}}},"altIdentifier_one":"alternate identifier","altIdentifier_other":"alternate identifiers","artist_one":"artist","artist_other":"artists","author_one":"author","author_other":"authors","collection_one":"editorial collection","collection_other":"editorial collections","colorist_one":"colorist","colorist_other":"colorists","contributor_one":"contributor","contributor_other":"contributors","description":"description","duration":"duration","editor_one":"editor","editor_other":"editors","identifier_one":"identifier","identifier_other":"identifiers","illustrator_one":"illustrator","illustrator_other":"illustrators","imprint_one":"imprint","imprint_other":"imprints","inker_one":"inker","inker_other":"inkers","language_one":"language","language_other":"languages","letterer_one":"letterer","letterer_other":"letterers","modified":"modification date","narrator_one":"narrator","narrator_other":"narrators","numberOfPages":"print length","penciler_one":"penciler","penciler_other":"pencilers","published":"publication date","publisher_one":"publisher","publisher_other":"publishers","series_one":"series","series_other":"series","subject_one":"subject","subject_other":"subjects","subtitle":"subtitle","title":"title","translator_one":"translator","translator_other":"translators"}}`), si = {
314
- publication: ii
315
- }, ie = {
312
+ let Nt = S;
313
+ const ie = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], si = /* @__PURE__ */ JSON.parse(`{"format":{"audiobook":"Audiobook","audiobookJSON":"Audiobook Manifest","cbz":"Comic Book Archive","divina":"Divina Publication","divinaJSON":"Divina Publication Manifest","epub":"EPUB","lcpa":"LCP Protected Audiobook","lcpdf":"LCP Protected PDF","lcpl":"LCP License Document","pdf":"PDF","rwp":"Readium Web Publication","rwpm":"Readium Web Publication Manifest","zab":"Audiobook Archive","zip":"ZIP Archive"},"kind":{"audiobook_one":"audiobook","audiobook_other":"audiobooks","book_one":"book","book_other":"books","comic_one":"comic","comic_other":"comics","document_one":"document","document_other":"documents"},"metadata":{"accessibility":{"display-guide":{"accessibility-summary":{"no-metadata":"No information is available","publisher-contact":"For more information about the accessibility of this product, please contact the publisher: ","title":"Accessibility summary"},"additional-accessibility-information":{"aria":{"compact":"ARIA roles included","descriptive":"Content is enhanced with ARIA roles to optimize organization and facilitate navigation"},"audio-descriptions":"Audio descriptions","braille":"Braille","color-not-sole-means-of-conveying-information":"Color is not the sole means of conveying information","dyslexia-readability":"Dyslexia readability","full-ruby-annotations":"Full ruby annotations","high-contrast-between-foreground-and-background-audio":"High contrast between foreground and background audio","high-contrast-between-text-and-background":"High contrast between foreground text and background","large-print":"Large print","page-breaks":{"compact":"Page breaks included","descriptive":"Page breaks included from the original print source"},"ruby-annotations":"Some Ruby annotations","sign-language":"Sign language","tactile-graphics":{"compact":"Tactile graphics included","descriptive":"Tactile graphics have been integrated to facilitate access to visual elements for blind people"},"tactile-objects":"Tactile 3D objects","text-to-speech-hinting":"Text-to-speech hinting provided","title":"Additional accessibility information","ultra-high-contrast-between-text-and-background":"Ultra high contrast between text and background","visible-page-numbering":"Visible page numbering","without-background-sounds":"Without background sounds"},"conformance":{"a":{"compact":"This publication meets minimum accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level A standard"},"aa":{"compact":"This publication meets accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AA standard"},"aaa":{"compact":"This publication exceeds accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AAA standard"},"certifier":"The publication was certified by ","certifier-credentials":"The certifier's credential is ","details":{"certification-info":"The publication was certified on ","certifier-report":"For more information refer to the certifier's report","claim":"This publication claims to meet","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Level A","level-aa":"Level AA","level-aaa":"Level AAA","wcag-2-0":{"compact":"WCAG 2.0","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.0"},"wcag-2-1":{"compact":"WCAG 2.1","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.1"},"wcag-2-2":{"compact":"WCAG 2.2","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.2"}},"details-title":"Detailed conformance information","no":"No information is available","title":"Conformance","unknown-standard":"Conformance to accepted standards for accessibility of this publication cannot be determined"},"hazards":{"flashing":{"compact":"Flashing content","descriptive":"The publication contains flashing content that can cause photosensitive seizures"},"flashing-none":{"compact":"No flashing hazards","descriptive":"The publication does not contain flashing content that can cause photosensitive seizures"},"flashing-unknown":{"compact":"Flashing hazards not known","descriptive":"The presence of flashing content that can cause photosensitive seizures could not be determined"},"motion":{"compact":"Motion simulation","descriptive":"The publication contains motion simulations that can cause motion sickness"},"motion-none":{"compact":"No motion simulation hazards","descriptive":"The publication does not contain motion simulations that can cause motion sickness"},"motion-unknown":{"compact":"Motion simulation hazards not known","descriptive":"The presence of motion simulations that can cause motion sickness could not be determined"},"no-metadata":"No information is available","none":{"compact":"No hazards","descriptive":"The publication contains no hazards"},"sound":{"compact":"Sounds","descriptive":"The publication contains sounds that can cause sensitivity issues"},"sound-none":{"compact":"No sound hazards","descriptive":"The publication does not contain sounds that can cause sensitivity issues"},"sound-unknown":{"compact":"Sound hazards not known","descriptive":"The presence of sounds that can cause sensitivity issues could not be determined"},"title":"Hazards","unknown":"The presence of hazards is unknown"},"legal-considerations":{"exempt":{"compact":"Claims an accessibility exemption in some jurisdictions","descriptive":"This publication claims an accessibility exemption in some jurisdictions"},"no-metadata":"No information is available","title":"Legal considerations"},"navigation":{"index":{"compact":"Index","descriptive":"Index with links to referenced entries"},"no-metadata":"No information is available","page-navigation":{"compact":"Go to page","descriptive":"Page list to go to pages from the print source version"},"structural":{"compact":"Headings","descriptive":"Elements such as headings, tables, etc for structured navigation"},"title":"Navigation","toc":{"compact":"Table of contents","descriptive":"Table of contents to all chapters of the text via links"}},"rich-content":{"accessible-chemistry-as-latex":{"compact":"Chemical formulas in LaTeX","descriptive":"Chemical formulas in accessible format (LaTeX)"},"accessible-chemistry-as-mathml":{"compact":"Chemical formulas in MathML","descriptive":"Chemical formulas in accessible format (MathML)"},"accessible-math-as-latex":{"compact":"Math as LaTeX","descriptive":"Math formulas in accessible format (LaTeX)"},"accessible-math-described":"Text descriptions of math are provided","closed-captions":{"compact":"Videos have closed captions","descriptive":"Videos included in publications have closed captions"},"extended-descriptions":"Information-rich images are described by extended descriptions","math-as-mathml":{"compact":"Math as MathML","descriptive":"Math formulas in accessible format (MathML)"},"open-captions":{"compact":"Videos have open captions","descriptive":"Videos included in publications have open captions"},"title":"Rich content","transcript":"Transcript(s) provided","unknown":"No information is available"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{"compact":"Has alternative text","descriptive":"Has alternative text descriptions for images"},"no-metadata":"No information about nonvisual reading is available","none":{"compact":"Not readable in read aloud or dynamic braille","descriptive":"The content is not readable as read aloud speech or dynamic braille"},"not-fully":{"compact":"Not fully readable in read aloud or dynamic braille","descriptive":"Not all of the content will be readable as read aloud speech or dynamic braille"},"readable":{"compact":"Readable in read aloud or dynamic braille","descriptive":"All content can be read as read aloud speech or dynamic braille"}},"prerecorded-audio":{"complementary":{"compact":"Prerecorded audio clips","descriptive":"Prerecorded audio clips are embedded in the content"},"no-metadata":"No information about prerecorded audio is available","only":{"compact":"Prerecorded audio only","descriptive":"Audiobook with no text alternative"},"synchronized":{"compact":"Prerecorded audio synchronized with text","descriptive":"All the content is available as prerecorded audio synchronized with text"}},"title":"Ways of reading","visual-adjustments":{"modifiable":{"compact":"Appearance can be modified","descriptive":"Appearance of the text and page layout can be modified according to the capabilities of the reading system (font family and font size, spaces between paragraphs, sentences, words, and letters, as well as color of background and text)"},"unknown":"No information about appearance modifiability is available","unmodifiable":{"compact":"Appearance cannot be modified","descriptive":"Text and page layout cannot be modified as the reading experience is close to a print version, but reading systems can still provide zooming options"}}}}},"altIdentifier_one":"alternate identifier","altIdentifier_other":"alternate identifiers","artist_one":"artist","artist_other":"artists","author_one":"author","author_other":"authors","collection_one":"editorial collection","collection_other":"editorial collections","colorist_one":"colorist","colorist_other":"colorists","contributor_one":"contributor","contributor_other":"contributors","description":"description","duration":"duration","editor_one":"editor","editor_other":"editors","identifier_one":"identifier","identifier_other":"identifiers","illustrator_one":"illustrator","illustrator_other":"illustrators","imprint_one":"imprint","imprint_other":"imprints","inker_one":"inker","inker_other":"inkers","language_one":"language","language_other":"languages","letterer_one":"letterer","letterer_other":"letterers","modified":"modification date","narrator_one":"narrator","narrator_other":"narrators","numberOfPages":"print length","penciler_one":"penciler","penciler_other":"pencilers","published":"publication date","publisher_one":"publisher","publisher_other":"publishers","series_one":"series","series_other":"series","subject_one":"subject","subject_other":"subjects","subtitle":"subtitle","title":"title","translator_one":"translator","translator_other":"translators"}}`), ri = {
314
+ publication: si
315
+ }, se = {
316
316
  fr: () => import("./fr-C5HEel98.js"),
317
317
  ar: () => import("./ar-DyHX_uy2.js"),
318
318
  da: () => import("./da-Dct0PS3E.js"),
@@ -323,13 +323,13 @@ const ee = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], ii = /* @__PURE__ */ J
323
323
  sv: () => import("./sv-BfzAFsVN.js")
324
324
  // 'tr': () => import('@edrlab/thorium-locales/publication-metadata/tr.json'),
325
325
  // 'uk': () => import('@edrlab/thorium-locales/publication-metadata/uk.json')
326
- }, se = si?.publication?.metadata?.accessibility?.["display-guide"] || {};
327
- class Y {
326
+ }, re = ri?.publication?.metadata?.accessibility?.["display-guide"] || {};
327
+ class $ {
328
328
  constructor() {
329
- this.currentLocaleCode = "en", this.locale = se, this.loadedLocales = {}, this.loadedLocales.en = se;
329
+ this.currentLocaleCode = "en", this.locale = re, this.loadedLocales = {}, this.loadedLocales.en = re;
330
330
  }
331
331
  static getInstance() {
332
- return Y.instance || (Y.instance = new Y()), Y.instance;
332
+ return $.instance || ($.instance = new $()), $.instance;
333
333
  }
334
334
  /**
335
335
  * Loads a locale dynamically
@@ -337,14 +337,14 @@ class Y {
337
337
  * @returns Promise indicating if the locale was loaded successfully
338
338
  */
339
339
  async loadLocale(t) {
340
- if (!ee.includes(t))
340
+ if (!ie.includes(t))
341
341
  return console.warn(`Locale '${t}' is not enabled`), !1;
342
342
  if (t in this.loadedLocales)
343
343
  return !0;
344
344
  try {
345
- if (!(t in ie))
345
+ if (!(t in se))
346
346
  return console.warn(`Locale file not found for: ${t}`), !1;
347
- const r = (await ie[t]()).default?.publication?.metadata?.accessibility?.["display-guide"];
347
+ const r = (await se[t]()).default?.publication?.metadata?.accessibility?.["display-guide"];
348
348
  return r ? (this.loadedLocales[t] = r, !0) : (console.warn(`No accessibility strings found in locale ${t}`), !1);
349
349
  } catch (e) {
350
350
  return console.warn(`Failed to load locale ${t}:`, e), !1;
@@ -378,7 +378,7 @@ class Y {
378
378
  * Gets a list of available locale codes
379
379
  */
380
380
  getAvailableLocales() {
381
- return ee;
381
+ return ie;
382
382
  }
383
383
  getNestedValue(t, e) {
384
384
  const i = e.split(".");
@@ -400,9 +400,9 @@ class Y {
400
400
  return e === void 0 && this.currentLocaleCode !== "en" && (e = this.getNestedValue(this.loadedLocales.en, t)), e !== void 0 ? typeof e == "string" ? { compact: e, descriptive: e } : e : (console.warn(`Missing localization for key: ${t}`), { compact: "", descriptive: "" });
401
401
  }
402
402
  }
403
- const f = Y.getInstance();
404
- var $ = /* @__PURE__ */ ((s) => (s.reflowable = "reflowable", s.fixed = "fixed", s.scrolled = "scrolled", s))($ || {}), ri = /* @__PURE__ */ ((s) => (s.Unknown = "unknown", s.Modifiable = "modifiable", s.Unmodifiable = "unmodifiable", s))(ri || {}), ni = /* @__PURE__ */ ((s) => (s.NoMetadata = "noMetadata", s.Readable = "readable", s.NotFully = "notFully", s.Unreadable = "unreadable", s))(ni || {}), ai = /* @__PURE__ */ ((s) => (s.NoMetadata = "noMetadata", s.Synchronized = "synchronized", s.AudioOnly = "audioOnly", s.AudioComplementary = "audioComplementary", s))(ai || {});
405
- class kt {
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 || {});
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;
408
408
  const n = f.getString(this.id);
@@ -415,11 +415,11 @@ class kt {
415
415
  });
416
416
  let h = "";
417
417
  e === "readable" ? h = "ways-of-reading.nonvisual-reading.readable" : e === "notFully" ? h = "ways-of-reading.nonvisual-reading.not-fully" : e === "unreadable" ? h = "ways-of-reading.nonvisual-reading.none" : e === "noMetadata" && (h = "ways-of-reading.nonvisual-reading.no-metadata");
418
- const m = f.getString(h);
418
+ const p = f.getString(h);
419
419
  if (this.statements.push({
420
420
  id: h,
421
- compactString: m.compact,
422
- descriptiveString: m.descriptive
421
+ compactString: p.compact,
422
+ descriptiveString: p.descriptive
423
423
  }), i) {
424
424
  const g = f.getString("ways-of-reading.nonvisual-reading.alt-text");
425
425
  this.statements.push({
@@ -428,43 +428,43 @@ class kt {
428
428
  descriptiveString: g.descriptive
429
429
  });
430
430
  }
431
- let p = "";
432
- r === "synchronized" ? p = "ways-of-reading.prerecorded-audio.synchronized" : r === "audioOnly" ? p = "ways-of-reading.prerecorded-audio.only" : r === "audioComplementary" ? p = "ways-of-reading.prerecorded-audio.complementary" : r === "noMetadata" && (p = "ways-of-reading.prerecorded-audio.no-metadata");
433
- const u = f.getString(p);
431
+ let m = "";
432
+ r === "synchronized" ? m = "ways-of-reading.prerecorded-audio.synchronized" : r === "audioOnly" ? m = "ways-of-reading.prerecorded-audio.only" : r === "audioComplementary" ? m = "ways-of-reading.prerecorded-audio.complementary" : r === "noMetadata" && (m = "ways-of-reading.prerecorded-audio.no-metadata");
433
+ const u = f.getString(m);
434
434
  this.statements.push({
435
- id: p,
435
+ id: m,
436
436
  compactString: u.compact,
437
437
  descriptiveString: u.descriptive
438
438
  });
439
439
  }
440
440
  static fromPublication(t) {
441
- const e = t.metadata.accessibility ?? new V(), i = e.feature ?? [], r = t.metadata.layout === $.fixed, n = i.some((d) => d.value === v.DISPLAY_TRANSFORMABILITY.value) ? "modifiable" : r ? "unmodifiable" : "unknown", a = e.accessMode ?? [], o = e.accessModeSufficient ?? [], h = 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 === X.fixed, n = i.some((d) => d.value === v.DISPLAY_TRANSFORMABILITY.value) ? "modifiable" : r ? "unmodifiable" : "unknown", a = e.accessMode ?? [], o = e.accessModeSufficient ?? [], h = a.length > 0 && a.every((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
442
442
  const I = d.value;
443
- return Array.isArray(I) ? I.every((B) => B === R.TEXTUAL.value) : I === R.TEXTUAL.value;
444
- }), m = a.some((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
443
+ return Array.isArray(I) ? I.every((G) => G === R.TEXTUAL.value) : I === R.TEXTUAL.value;
444
+ }), p = a.some((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
445
445
  const I = d.value;
446
- return Array.isArray(I) ? I.some((B) => B === R.TEXTUAL.value) : I === R.TEXTUAL.value;
447
- }), p = !(a.length === 0 && o.length === 0) && !a.some((d) => d.value === R.TEXTUAL.value) && !o.some((d) => {
446
+ return Array.isArray(I) ? I.some((G) => G === R.TEXTUAL.value) : I === R.TEXTUAL.value;
447
+ }), m = !(a.length === 0 && o.length === 0) && !a.some((d) => d.value === R.TEXTUAL.value) && !o.some((d) => {
448
448
  const I = d.value;
449
- return Array.isArray(I) ? I.some((B) => B === R.TEXTUAL.value) : I === R.TEXTUAL.value;
449
+ return Array.isArray(I) ? I.some((G) => G === R.TEXTUAL.value) : I === R.TEXTUAL.value;
450
450
  }), u = i.some((d) => [
451
451
  v.LONG_DESCRIPTION.value,
452
452
  v.ALTERNATIVE_TEXT.value,
453
453
  v.DESCRIBED_MATH.value,
454
454
  v.TRANSCRIPT.value
455
- ].includes(d.value)), g = h ? "readable" : m || u ? "notFully" : p ? "unreadable" : "noMetadata", A = u, C = i.some((d) => d.value === v.SYNCHRONIZED_AUDIO_TEXT.value) ? "synchronized" : o.some((d) => {
455
+ ].includes(d.value)), g = h ? "readable" : p || u ? "notFully" : m ? "unreadable" : "noMetadata", A = u, P = i.some((d) => d.value === v.SYNCHRONIZED_AUDIO_TEXT.value) ? "synchronized" : o.some((d) => {
456
456
  const I = d.value;
457
- return Array.isArray(I) ? I.some((B) => B === R.AUDITORY.value) : I === R.AUDITORY.value;
457
+ return Array.isArray(I) ? I.some((G) => G === R.AUDITORY.value) : I === R.AUDITORY.value;
458
458
  }) ? "audioOnly" : a.some((d) => d.value === R.AUDITORY.value) ? "audioComplementary" : "noMetadata";
459
- return new kt(
459
+ return new Dt(
460
460
  n,
461
461
  g,
462
462
  A,
463
- C
463
+ P
464
464
  );
465
465
  }
466
466
  }
467
- class Dt {
467
+ class Ut {
468
468
  constructor(t = !1, e = !1, i = !1, r = !1) {
469
469
  this.id = "navigation.title", this.tableOfContents = t, this.index = e, this.headings = i, this.page = r, this.noMetadata = !t && !e && !i && !r;
470
470
  const n = f.getString(this.id);
@@ -511,7 +511,7 @@ class Dt {
511
511
  }
512
512
  static fromPublication(t) {
513
513
  const i = (t.metadata.accessibility ?? new V()).feature ?? [];
514
- return new Dt(
514
+ return new Ut(
515
515
  i.some((r) => r.value === v.TABLE_OF_CONTENTS.value),
516
516
  i.some((r) => r.value === v.INDEX.value),
517
517
  i.some((r) => r.value === v.STRUCTURAL_NAVIGATION.value),
@@ -519,12 +519,12 @@ class Dt {
519
519
  );
520
520
  }
521
521
  }
522
- var oi = /* @__PURE__ */ ((s) => (s.Math = "math", s.Chemistry = "chemistry", s.Music = "music", s.Diagram = "diagram", s.Chart = "chart", s.Graph = "graph", s.Table = "table", s.Image = "image", s))(oi || {});
523
- class Ut {
524
- constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, h = !1, m = !1) {
525
- this.id = "rich-content.title", this.extendedAltTextDescriptions = t, this.mathFormula = e, this.mathFormulaAsMathML = i, this.mathFormulaAsLaTeX = r, this.chemicalFormulaAsMathML = n, this.chemicalFormulaAsLaTeX = a, this.closedCaptions = o, this.openCaptions = h, this.transcript = m, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !h && !m, this.shouldDisplay = !this.noMetadata;
526
- const p = f.getString(this.id);
527
- if (this.title = p.compact, this.statements = [], t) {
522
+ var ci = /* @__PURE__ */ ((s) => (s.Math = "math", s.Chemistry = "chemistry", s.Music = "music", s.Diagram = "diagram", s.Chart = "chart", s.Graph = "graph", s.Table = "table", s.Image = "image", s))(ci || {});
523
+ class Mt {
524
+ constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, h = !1, p = !1) {
525
+ this.id = "rich-content.title", this.extendedAltTextDescriptions = t, this.mathFormula = e, this.mathFormulaAsMathML = i, this.mathFormulaAsLaTeX = r, this.chemicalFormulaAsMathML = n, this.chemicalFormulaAsLaTeX = a, this.closedCaptions = o, this.openCaptions = h, this.transcript = p, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !h && !p, this.shouldDisplay = !this.noMetadata;
526
+ const m = f.getString(this.id);
527
+ if (this.title = m.compact, this.statements = [], t) {
528
528
  const u = f.getString("rich-content.extended-descriptions");
529
529
  this.statements.push({
530
530
  id: "rich-content.extended-descriptions",
@@ -588,7 +588,7 @@ class Ut {
588
588
  descriptiveString: u.descriptive
589
589
  });
590
590
  }
591
- if (m) {
591
+ if (p) {
592
592
  const u = f.getString("rich-content.transcript");
593
593
  this.statements.push({
594
594
  id: "rich-content.transcript",
@@ -607,7 +607,7 @@ class Ut {
607
607
  }
608
608
  static fromPublication(t) {
609
609
  const i = (t.metadata.accessibility ?? new V()).feature ?? [];
610
- return new Ut(
610
+ return new Mt(
611
611
  i.some((r) => r.value === v.LONG_DESCRIPTION.value),
612
612
  i.some((r) => r.value === v.DESCRIBED_MATH.value),
613
613
  i.some((r) => r.value === v.MATH_ML.value),
@@ -620,11 +620,11 @@ class Ut {
620
620
  );
621
621
  }
622
622
  }
623
- class Mt {
624
- constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, h = !1, m = !1, p = !1, u = !1, g = !1, A = !1) {
625
- this.id = "additional-accessibility-information.title", this.pageBreakMarkers = t, this.aria = e, this.audioDescriptions = i, this.braille = r, this.rubyAnnotations = n, this.fullRubyAnnotations = a, this.highAudioContrast = o, this.highDisplayContrast = h, this.largePrint = m, this.signLanguage = p, this.tactileGraphics = u, this.tactileObjects = g, this.textToSpeechHinting = A, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !h && !m && !p && !u && !g && !A, this.shouldDisplay = !this.noMetadata;
626
- const C = f.getString(this.id);
627
- if (this.title = C.compact, this.statements = [], t) {
623
+ class Bt {
624
+ constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, h = !1, p = !1, m = !1, u = !1, g = !1, A = !1) {
625
+ this.id = "additional-accessibility-information.title", this.pageBreakMarkers = t, this.aria = e, this.audioDescriptions = i, this.braille = r, this.rubyAnnotations = n, this.fullRubyAnnotations = a, this.highAudioContrast = o, this.highDisplayContrast = h, this.largePrint = p, this.signLanguage = m, this.tactileGraphics = u, this.tactileObjects = g, this.textToSpeechHinting = A, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !h && !p && !m && !u && !g && !A, this.shouldDisplay = !this.noMetadata;
626
+ const P = f.getString(this.id);
627
+ if (this.title = P.compact, this.statements = [], t) {
628
628
  const d = f.getString("additional-accessibility-information.page-breaks");
629
629
  this.statements.push({
630
630
  id: "additional-accessibility-information.page-breaks",
@@ -688,7 +688,7 @@ class Mt {
688
688
  descriptiveString: d.descriptive
689
689
  });
690
690
  }
691
- if (m) {
691
+ if (p) {
692
692
  const d = f.getString("additional-accessibility-information.large-print");
693
693
  this.statements.push({
694
694
  id: "additional-accessibility-information.large-print",
@@ -696,7 +696,7 @@ class Mt {
696
696
  descriptiveString: d.descriptive
697
697
  });
698
698
  }
699
- if (p) {
699
+ if (m) {
700
700
  const d = f.getString("additional-accessibility-information.sign-language");
701
701
  this.statements.push({
702
702
  id: "additional-accessibility-information.sign-language",
@@ -731,7 +731,7 @@ class Mt {
731
731
  }
732
732
  static fromPublication(t) {
733
733
  const i = (t.metadata.accessibility ?? new V()).feature ?? [];
734
- return new Mt(
734
+ return new Bt(
735
735
  i.some((r) => r.value === v.PAGE_BREAK_MARKERS.value || r.value === v.PRINT_PAGE_NUMBERS.value),
736
736
  i.some((r) => r.value === v.ARIA.value),
737
737
  i.some((r) => r.value === v.AUDIO_DESCRIPTION.value),
@@ -748,8 +748,8 @@ class Mt {
748
748
  );
749
749
  }
750
750
  }
751
- var ci = /* @__PURE__ */ ((s) => (s.yes = "yes", s.no = "no", s.unknown = "unknown", s.noMetadata = "noMetadata", s))(ci || {});
752
- class Bt {
751
+ var li = /* @__PURE__ */ ((s) => (s.yes = "yes", s.no = "no", s.unknown = "unknown", s.noMetadata = "noMetadata", s))(li || {});
752
+ class Gt {
753
753
  constructor(t = "unknown", e = "unknown", i = "unknown") {
754
754
  this.id = "hazards.title", this.flashing = t, this.motion = e, this.sound = i;
755
755
  const r = f.getString(this.id);
@@ -846,16 +846,16 @@ class Bt {
846
846
  static fromPublication(t) {
847
847
  const e = t.metadata.accessibility?.hazard ?? [];
848
848
  let i;
849
- e.some((o) => o.value === P.NONE.value) ? i = "no" : e.some((o) => o.value === P.UNKNOWN.value) ? i = "unknown" : i = "noMetadata";
849
+ e.some((o) => o.value === k.NONE.value) ? i = "no" : e.some((o) => o.value === k.UNKNOWN.value) ? i = "unknown" : i = "noMetadata";
850
850
  let r;
851
- e.some((o) => o.value === P.FLASHING.value) ? r = "yes" : e.some((o) => o.value === P.NO_FLASHING_HAZARD.value) ? r = "no" : e.some((o) => o.value === P.UNKNOWN_FLASHING_HAZARD.value) ? r = "unknown" : r = i;
851
+ e.some((o) => o.value === k.FLASHING.value) ? r = "yes" : e.some((o) => o.value === k.NO_FLASHING_HAZARD.value) ? r = "no" : e.some((o) => o.value === k.UNKNOWN_FLASHING_HAZARD.value) ? r = "unknown" : r = i;
852
852
  let n;
853
- e.some((o) => o.value === P.MOTION_SIMULATION.value) ? n = "yes" : e.some((o) => o.value === P.NO_MOTION_SIMULATION_HAZARD.value) ? n = "no" : e.some((o) => o.value === P.UNKNOWN_MOTION_SIMULATION_HAZARD.value) ? n = "unknown" : n = i;
853
+ e.some((o) => o.value === k.MOTION_SIMULATION.value) ? n = "yes" : e.some((o) => o.value === k.NO_MOTION_SIMULATION_HAZARD.value) ? n = "no" : e.some((o) => o.value === k.UNKNOWN_MOTION_SIMULATION_HAZARD.value) ? n = "unknown" : n = i;
854
854
  let a;
855
- return e.some((o) => o.value === P.SOUND.value) ? a = "yes" : e.some((o) => o.value === P.NO_SOUND_HAZARD.value) ? a = "no" : e.some((o) => o.value === P.UNKNOWN_SOUND_HAZARD.value) ? a = "unknown" : a = i, new Bt(r, n, a);
855
+ return e.some((o) => o.value === k.SOUND.value) ? a = "yes" : e.some((o) => o.value === k.NO_SOUND_HAZARD.value) ? a = "no" : e.some((o) => o.value === k.UNKNOWN_SOUND_HAZARD.value) ? a = "unknown" : a = i, new Gt(r, n, a);
856
856
  }
857
857
  }
858
- class Gt {
858
+ class Wt {
859
859
  constructor(t = []) {
860
860
  this.id = "conformance.title", this.profiles = t, this.shouldDisplay = !0;
861
861
  const e = f.getString(this.id);
@@ -900,10 +900,10 @@ class Gt {
900
900
  }
901
901
  static fromPublication(t) {
902
902
  const e = t.metadata.accessibility?.conformsTo ?? [];
903
- return new Gt(e);
903
+ return new Wt(e);
904
904
  }
905
905
  }
906
- class Wt {
906
+ class Ht {
907
907
  constructor(t = !1) {
908
908
  this.id = "legal-considerations.title", this.exemption = t, this.shouldDisplay = this.exemption;
909
909
  const e = f.getString(this.id);
@@ -925,10 +925,10 @@ class Wt {
925
925
  }
926
926
  static fromPublication(t) {
927
927
  const i = (t.metadata.accessibility?.exemption ?? []).length > 0;
928
- return new Wt(i);
928
+ return new Ht(i);
929
929
  }
930
930
  }
931
- class Ht {
931
+ class Ft {
932
932
  constructor(t) {
933
933
  this.id = "accessibility-summary.title", this.shouldDisplay = !0;
934
934
  const e = f.getString(this.id);
@@ -950,12 +950,12 @@ class Ht {
950
950
  }
951
951
  }
952
952
  static fromPublication(t) {
953
- return new Ht(t);
953
+ return new Ft(t);
954
954
  }
955
955
  }
956
- class sr {
956
+ class rr {
957
957
  constructor(t) {
958
- this.waysOfReading = kt.fromPublication(t), this.navigation = Dt.fromPublication(t), this.richContent = Ut.fromPublication(t), this.additionalInformation = Mt.fromPublication(t), this.hazards = Bt.fromPublication(t), this.conformance = Gt.fromPublication(t), this.legal = Wt.fromPublication(t), this.accessibilitySummary = Ht.fromPublication(t), this.fields = [
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,
960
960
  this.navigation,
961
961
  this.richContent,
@@ -967,7 +967,7 @@ class sr {
967
967
  ];
968
968
  }
969
969
  }
970
- class Ft {
970
+ class _t {
971
971
  /**
972
972
  * Creates a [Encryption].
973
973
  */
@@ -979,7 +979,7 @@ class Ft {
979
979
  */
980
980
  static deserialize(t) {
981
981
  if (t && t.algorithm)
982
- return new Ft({
982
+ return new _t({
983
983
  algorithm: t.algorithm,
984
984
  compression: t.compression,
985
985
  originalLength: t.originalLength,
@@ -995,8 +995,8 @@ class Ft {
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 Nt = /* @__PURE__ */ ((s) => (s.left = "left", s.right = "right", s.center = "center", s))(Nt || {});
999
- class D {
998
+ var Ot = /* @__PURE__ */ ((s) => (s.left = "left", s.right = "right", s.center = "center", s))(Ot || {});
999
+ class U {
1000
1000
  constructor(t) {
1001
1001
  this.otherProperties = t;
1002
1002
  }
@@ -1008,7 +1008,7 @@ class D {
1008
1008
  */
1009
1009
  static deserialize(t) {
1010
1010
  if (t)
1011
- return new D(t);
1011
+ return new U(t);
1012
1012
  }
1013
1013
  /**
1014
1014
  * Serializes a [Properties] to its RWPM JSON representation.
@@ -1023,12 +1023,12 @@ class D {
1023
1023
  const e = Object.assign({}, this.otherProperties);
1024
1024
  for (const i in t)
1025
1025
  e[i] = t[i];
1026
- return new D(e);
1026
+ return new U(e);
1027
1027
  }
1028
1028
  }
1029
- Object.defineProperty(D.prototype, "encryption", {
1029
+ Object.defineProperty(U.prototype, "encryption", {
1030
1030
  get: function() {
1031
- return Ft.deserialize(this.otherProperties.encrypted);
1031
+ return _t.deserialize(this.otherProperties.encrypted);
1032
1032
  }
1033
1033
  });
1034
1034
  class Vt {
@@ -1054,26 +1054,26 @@ class Vt {
1054
1054
  return this.activeClass && (t.activeClass = this.activeClass), this.playbackActiveClass && (t.playbackActiveClass = this.playbackActiveClass), t;
1055
1055
  }
1056
1056
  }
1057
- function li(s) {
1057
+ function hi(s) {
1058
1058
  return s && Array.isArray(s) ? s : void 0;
1059
1059
  }
1060
- function F(s) {
1061
- return s && typeof s == "string" ? [s] : li(s);
1060
+ function _(s) {
1061
+ return s && typeof s == "string" ? [s] : hi(s);
1062
1062
  }
1063
- function ct(s) {
1063
+ function lt(s) {
1064
1064
  return typeof s == "string" ? new Date(s) : void 0;
1065
1065
  }
1066
- function K(s) {
1066
+ function Z(s) {
1067
1067
  return isNaN(s) ? void 0 : s;
1068
1068
  }
1069
1069
  function L(s) {
1070
- return K(s) !== void 0 && Math.sign(s) >= 0 ? s : void 0;
1070
+ return Z(s) !== void 0 && Math.sign(s) >= 0 ? s : void 0;
1071
1071
  }
1072
- function lt(s) {
1072
+ function ht(s) {
1073
1073
  const t = new Array();
1074
1074
  return s.forEach((e) => t.push(e)), t;
1075
1075
  }
1076
- class Z {
1076
+ class J {
1077
1077
  /** Creates an AltIdentifier object */
1078
1078
  constructor(t) {
1079
1079
  this.value = t.value, this.scheme = t.scheme;
@@ -1084,9 +1084,9 @@ class Z {
1084
1084
  static deserialize(t) {
1085
1085
  if (t) {
1086
1086
  if (typeof t == "string")
1087
- return new Z({ value: t });
1087
+ return new J({ value: t });
1088
1088
  if (typeof t == "object" && t.value)
1089
- return new Z({
1089
+ return new J({
1090
1090
  value: t.value,
1091
1091
  scheme: t.scheme
1092
1092
  });
@@ -1116,19 +1116,19 @@ class c {
1116
1116
  for (let g = 1; g < r.length; g++) {
1117
1117
  const A = r[g].split("=");
1118
1118
  if (A.length === 2) {
1119
- const C = A[0].toLocaleLowerCase(), d = C === "charset" ? A[1].toUpperCase() : A[1];
1120
- a[C] = d;
1119
+ const P = A[0].toLocaleLowerCase(), d = P === "charset" ? A[1].toUpperCase() : A[1];
1120
+ a[P] = d;
1121
1121
  }
1122
1122
  }
1123
1123
  const o = {}, h = Object.keys(a);
1124
1124
  h.sort((g, A) => g.localeCompare(A)), h.forEach((g) => o[g] = a[g]);
1125
- let m = "";
1125
+ let p = "";
1126
1126
  for (const g in o) {
1127
1127
  const A = o[g];
1128
- m += `;${g}=${A}`;
1128
+ p += `;${g}=${A}`;
1129
1129
  }
1130
- const p = `${e}/${i}${m}`, u = o.encoding;
1131
- this.string = p, this.type = e, this.subtype = i, this.parameters = o, this.encoding = u, this.name = t.name, this.fileExtension = t.fileExtension;
1130
+ const m = `${e}/${i}${p}`, u = o.encoding;
1131
+ this.string = m, this.type = e, this.subtype = i, this.parameters = o, this.encoding = u, this.name = t.name, this.fileExtension = t.fileExtension;
1132
1132
  }
1133
1133
  static parse(t) {
1134
1134
  return new c(t);
@@ -1561,7 +1561,7 @@ class c {
1561
1561
  });
1562
1562
  }
1563
1563
  }
1564
- class ht {
1564
+ class ut {
1565
1565
  constructor(t) {
1566
1566
  this.uri = t, this.parameters = this.getParameters(t);
1567
1567
  }
@@ -1601,7 +1601,7 @@ class T {
1601
1601
  */
1602
1602
  static deserialize(t) {
1603
1603
  if (!t) return;
1604
- const e = K(t.progression), i = K(t.totalProgression), r = K(t.position), n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set([
1604
+ const e = Z(t.progression), i = Z(t.totalProgression), r = Z(t.position), n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set([
1605
1605
  "fragment",
1606
1606
  "fragments",
1607
1607
  "progression",
@@ -1611,7 +1611,7 @@ class T {
1611
1611
  return Object.entries(t).forEach(([o, h]) => {
1612
1612
  a.has(o) || n.set(o, h);
1613
1613
  }), new T({
1614
- fragments: F(t.fragments || t.fragment),
1614
+ fragments: _(t.fragments || t.fragment),
1615
1615
  progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
1616
1616
  totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
1617
1617
  position: r !== void 0 && r > 0 ? r : void 0,
@@ -1626,7 +1626,7 @@ class T {
1626
1626
  return this.fragments && (t.fragments = this.fragments), this.progression !== void 0 && (t.progression = this.progression), this.totalProgression !== void 0 && (t.totalProgression = this.totalProgression), this.position !== void 0 && (t.position = this.position), this.otherLocations && this.otherLocations.forEach((e, i) => t[i] = e), t;
1627
1627
  }
1628
1628
  }
1629
- class rt {
1629
+ class nt {
1630
1630
  /**
1631
1631
  * Creates a [Text].
1632
1632
  */
@@ -1638,7 +1638,7 @@ class rt {
1638
1638
  */
1639
1639
  static deserialize(t) {
1640
1640
  if (t)
1641
- return new rt({
1641
+ return new nt({
1642
1642
  after: t.after,
1643
1643
  before: t.before,
1644
1644
  highlight: t.highlight
@@ -1652,7 +1652,7 @@ class rt {
1652
1652
  return this.after !== void 0 && (t.after = this.after), this.before !== void 0 && (t.before = this.before), this.highlight !== void 0 && (t.highlight = this.highlight), t;
1653
1653
  }
1654
1654
  }
1655
- class k {
1655
+ class D {
1656
1656
  /**
1657
1657
  * Creates a [Locator].
1658
1658
  */
@@ -1664,12 +1664,12 @@ class k {
1664
1664
  */
1665
1665
  static deserialize(t) {
1666
1666
  if (t && t.href && t.type)
1667
- return new k({
1667
+ return new D({
1668
1668
  href: t.href,
1669
1669
  type: t.type,
1670
1670
  title: t.title,
1671
1671
  locations: T.deserialize(t.locations),
1672
- text: rt.deserialize(t.text)
1672
+ text: nt.deserialize(t.text)
1673
1673
  });
1674
1674
  }
1675
1675
  /**
@@ -1683,7 +1683,7 @@ class k {
1683
1683
  * Shortcut to get a copy of the [Locator] with different [Locations] sub-properties.
1684
1684
  */
1685
1685
  copyWithLocations(t) {
1686
- return new k({
1686
+ return new D({
1687
1687
  href: this.href,
1688
1688
  type: this.type,
1689
1689
  title: this.title,
@@ -1692,7 +1692,7 @@ class k {
1692
1692
  });
1693
1693
  }
1694
1694
  }
1695
- class U {
1695
+ class M {
1696
1696
  /**
1697
1697
  * Creates a [Link].
1698
1698
  */
@@ -1704,21 +1704,21 @@ class U {
1704
1704
  */
1705
1705
  static deserialize(t) {
1706
1706
  if (!(!t || typeof t.href != "string"))
1707
- return new U({
1707
+ return new M({
1708
1708
  href: t.href,
1709
1709
  templated: t.templated,
1710
1710
  type: t.type,
1711
1711
  title: t.title,
1712
1712
  rels: t.rel ? Array.isArray(t.rel) ? new Set(t.rel) : /* @__PURE__ */ new Set([t.rel]) : void 0,
1713
- properties: D.deserialize(t.properties),
1713
+ properties: U.deserialize(t.properties),
1714
1714
  height: L(t.height),
1715
1715
  width: L(t.width),
1716
1716
  size: L(t.size),
1717
1717
  duration: L(t.duration),
1718
1718
  bitrate: L(t.bitrate),
1719
- languages: F(t.language),
1720
- alternates: O.deserialize(t.alternate),
1721
- children: O.deserialize(t.children)
1719
+ languages: _(t.language),
1720
+ alternates: z.deserialize(t.alternate),
1721
+ children: z.deserialize(t.children)
1722
1722
  });
1723
1723
  }
1724
1724
  /**
@@ -1726,7 +1726,7 @@ class U {
1726
1726
  */
1727
1727
  serialize() {
1728
1728
  const t = { href: this.href };
1729
- return this.templated !== void 0 && (t.templated = this.templated), this.type !== void 0 && (t.type = this.type), this.title !== void 0 && (t.title = this.title), this.rels && (t.rel = lt(this.rels)), this.properties && (t.properties = this.properties.serialize()), this.height !== void 0 && (t.height = this.height), this.width !== void 0 && (t.width = this.width), this.size !== void 0 && (t.size = this.size), this.duration !== void 0 && (t.duration = this.duration), this.bitrate !== void 0 && (t.bitrate = this.bitrate), this.languages && (t.language = this.languages), this.alternates && (t.alternate = this.alternates.serialize()), this.children && (t.children = this.children.serialize()), t;
1729
+ return this.templated !== void 0 && (t.templated = this.templated), this.type !== void 0 && (t.type = this.type), this.title !== void 0 && (t.title = this.title), this.rels && (t.rel = ht(this.rels)), this.properties && (t.properties = this.properties.serialize()), this.height !== void 0 && (t.height = this.height), this.width !== void 0 && (t.width = this.width), this.size !== void 0 && (t.size = this.size), this.duration !== void 0 && (t.duration = this.duration), this.bitrate !== void 0 && (t.bitrate = this.bitrate), this.languages && (t.language = this.languages), this.alternates && (t.alternate = this.alternates.serialize()), this.children && (t.children = this.children.serialize()), t;
1730
1730
  }
1731
1731
  /** MediaType of the linked resource. */
1732
1732
  get mediaType() {
@@ -1743,14 +1743,14 @@ class U {
1743
1743
  }
1744
1744
  /** List of URI template parameter keys, if the `Link` is templated. */
1745
1745
  get templateParameters() {
1746
- return this.templated ? new ht(this.href).parameters : /* @__PURE__ */ new Set();
1746
+ return this.templated ? new ut(this.href).parameters : /* @__PURE__ */ new Set();
1747
1747
  }
1748
1748
  /** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
1749
1749
  * See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
1750
1750
  */
1751
1751
  expandTemplate(t) {
1752
- return new U({
1753
- href: new ht(this.href).expand(t),
1752
+ return new M({
1753
+ href: new ut(this.href).expand(t),
1754
1754
  templated: !1
1755
1755
  });
1756
1756
  }
@@ -1758,15 +1758,15 @@ class U {
1758
1758
  * Makes a copy of this [Link] after merging in the given additional other [properties].
1759
1759
  */
1760
1760
  addProperties(t) {
1761
- const e = U.deserialize(this.serialize());
1762
- return e.properties = e.properties ? e.properties?.add(t) : new D(t), e;
1761
+ const e = M.deserialize(this.serialize());
1762
+ return e.properties = e.properties ? e.properties?.add(t) : new U(t), e;
1763
1763
  }
1764
1764
  /**
1765
1765
  * Creates a [Locator] from a reading order [Link].
1766
1766
  */
1767
1767
  get locator() {
1768
1768
  let t = this.href.split("#");
1769
- return new k({
1769
+ return new D({
1770
1770
  href: t.length > 0 && t[0] !== void 0 ? t[0] : this.href,
1771
1771
  type: this.type ?? "",
1772
1772
  title: this.title,
@@ -1776,7 +1776,7 @@ class U {
1776
1776
  });
1777
1777
  }
1778
1778
  }
1779
- class O {
1779
+ class z {
1780
1780
  /**
1781
1781
  * Creates a [Links].
1782
1782
  */
@@ -1788,8 +1788,8 @@ class O {
1788
1788
  */
1789
1789
  static deserialize(t) {
1790
1790
  if (t && Array.isArray(t))
1791
- return new O(
1792
- t.map((e) => U.deserialize(e)).filter((e) => e !== void 0)
1791
+ return new z(
1792
+ t.map((e) => M.deserialize(e)).filter((e) => e !== void 0)
1793
1793
  );
1794
1794
  }
1795
1795
  /**
@@ -1870,13 +1870,13 @@ class O {
1870
1870
  return this.items.filter((t) => t.type);
1871
1871
  }
1872
1872
  }
1873
- const G = class G {
1873
+ const W = class W {
1874
1874
  /**
1875
1875
  * translations can be a string or a collection of language/translation pairs,
1876
1876
  * for a single string the language is assumed to be undefined
1877
1877
  */
1878
1878
  constructor(t) {
1879
- this.translations = typeof t == "string" ? { [G.UNDEFINED_LANGUAGE]: t } : t;
1879
+ this.translations = typeof t == "string" ? { [W.UNDEFINED_LANGUAGE]: t } : t;
1880
1880
  }
1881
1881
  /**
1882
1882
  * Parses a [LocalizedString] from its RWPM JSON representation.
@@ -1900,7 +1900,7 @@ const G = class G {
1900
1900
  */
1901
1901
  static deserialize(t) {
1902
1902
  if (t && (typeof t == "string" || t.constructor === Object))
1903
- return new G(t);
1903
+ return new W(t);
1904
1904
  }
1905
1905
  serialize() {
1906
1906
  return this.translations;
@@ -1914,12 +1914,12 @@ const G = class G {
1914
1914
  * 4. returns empty string
1915
1915
  */
1916
1916
  getTranslation(t) {
1917
- return this.translations[t || G.UNDEFINED_LANGUAGE] || this.translations[G.UNDEFINED_LANGUAGE] || this.translations[G.LANGUAGE_EN] || (Object.values(this.translations).length === 0 ? "" : Object.values(this.translations)[0]);
1917
+ return this.translations[t || W.UNDEFINED_LANGUAGE] || this.translations[W.UNDEFINED_LANGUAGE] || this.translations[W.LANGUAGE_EN] || (Object.values(this.translations).length === 0 ? "" : Object.values(this.translations)[0]);
1918
1918
  }
1919
1919
  };
1920
- G.UNDEFINED_LANGUAGE = "und", G.LANGUAGE_EN = "en";
1921
- let M = G;
1922
- class ut {
1920
+ W.UNDEFINED_LANGUAGE = "und", W.LANGUAGE_EN = "en";
1921
+ let B = W;
1922
+ class dt {
1923
1923
  /**
1924
1924
  * Creates a [Contributor] object.
1925
1925
  */
@@ -1933,16 +1933,16 @@ class ut {
1933
1933
  */
1934
1934
  static deserialize(t) {
1935
1935
  if (t)
1936
- return typeof t == "string" ? new ut({
1937
- name: M.deserialize(t)
1938
- }) : t.name ? new ut({
1939
- name: M.deserialize(t.name),
1940
- sortAs: M.deserialize(t.sortAs),
1936
+ return typeof t == "string" ? new dt({
1937
+ name: B.deserialize(t)
1938
+ }) : t.name ? new dt({
1939
+ name: B.deserialize(t.name),
1940
+ sortAs: B.deserialize(t.sortAs),
1941
1941
  identifier: t.identifier,
1942
- altIdentifiers: t.altIdentifier ? Array.isArray(t.altIdentifier) ? new Set(t.altIdentifier.map((e) => Z.deserialize(e)).filter((e) => e !== void 0)) : new Set([Z.deserialize(t.altIdentifier)].filter((e) => e !== void 0)) : void 0,
1943
- roles: t.role ? new Set(F(t.role)) : void 0,
1944
- links: O.deserialize(t.links),
1945
- position: K(t.position)
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
+ roles: t.role ? new Set(_(t.role)) : void 0,
1944
+ links: z.deserialize(t.links),
1945
+ position: Z(t.position)
1946
1946
  }) : void 0;
1947
1947
  }
1948
1948
  /**
@@ -1950,10 +1950,10 @@ class ut {
1950
1950
  */
1951
1951
  serialize() {
1952
1952
  const t = { name: this.name.serialize() };
1953
- return this.sortAs !== void 0 && (t.sortAs = this.sortAs.serialize()), this.identifier !== void 0 && (t.identifier = this.identifier), this.altIdentifiers && (t.altIdentifier = lt(this.altIdentifiers).map((e) => e.serialize())), this.roles && (t.role = lt(this.roles)), this.links && (t.links = this.links.serialize()), this.position !== void 0 && (t.position = this.position), t;
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,8 +1967,8 @@ 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(
1971
- e.map((i) => ut.deserialize(i)).filter((i) => i !== void 0)
1970
+ return new O(
1971
+ e.map((i) => dt.deserialize(i)).filter((i) => i !== void 0)
1972
1972
  );
1973
1973
  }
1974
1974
  /**
@@ -1978,7 +1978,7 @@ class N {
1978
1978
  return this.items.map((t) => t.serialize());
1979
1979
  }
1980
1980
  }
1981
- class q {
1981
+ class Q {
1982
1982
  /** Creates an Array of [Subject]. */
1983
1983
  constructor(t) {
1984
1984
  this.items = t && t.items ? t.items : /* @__PURE__ */ new Map();
@@ -1990,9 +1990,9 @@ 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
- }), new q({ items: e });
1995
+ }), new Q({ items: e });
1996
1996
  }
1997
1997
  /**
1998
1998
  * Serializes a [BelongsTo] to its RWPM JSON representation.
@@ -2004,11 +2004,11 @@ class q {
2004
2004
  ), t;
2005
2005
  }
2006
2006
  }
2007
- var J = /* @__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))(J || {}), H = /* @__PURE__ */ ((s) => (s.ltr = "ltr", s.rtl = "rtl", s))(H || {});
2008
- function rr(s) {
2009
- return s === "rtl" ? Nt.right : Nt.left;
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" ? Ot.right : Ot.left;
2010
2010
  }
2011
- class dt {
2011
+ class ft {
2012
2012
  /** Creates a [Subject]. */
2013
2013
  constructor(t) {
2014
2014
  this.name = t.name, this.sortAs = t.sortAs, this.code = t.code, this.scheme = t.scheme, this.links = t.links;
@@ -2020,14 +2020,14 @@ class dt {
2020
2020
  */
2021
2021
  static deserialize(t) {
2022
2022
  if (t)
2023
- return typeof t == "string" ? new dt({
2024
- name: M.deserialize(t)
2025
- }) : t.name ? new dt({
2026
- name: M.deserialize(t.name),
2027
- sortAs: t.sortAs ? M.deserialize(t.sortAs) : void 0,
2023
+ return typeof t == "string" ? new ft({
2024
+ name: B.deserialize(t)
2025
+ }) : t.name ? new ft({
2026
+ name: B.deserialize(t.name),
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: z.deserialize(t.links)
2031
2031
  }) : void 0;
2032
2032
  }
2033
2033
  /**
@@ -2038,7 +2038,7 @@ class dt {
2038
2038
  return this.sortAs !== void 0 && (t.sortAs = this.sortAs.serialize()), this.code !== void 0 && (t.code = this.code), this.scheme !== void 0 && (t.scheme = this.scheme), this.links && (t.links = this.links.serialize()), t;
2039
2039
  }
2040
2040
  }
2041
- class _t {
2041
+ class Yt {
2042
2042
  /** Creates an Array of [Subject]. */
2043
2043
  constructor(t) {
2044
2044
  this.items = t;
@@ -2049,8 +2049,8 @@ class _t {
2049
2049
  static deserialize(t) {
2050
2050
  if (!t) return;
2051
2051
  const e = Array.isArray(t) ? t : [t];
2052
- return new _t(
2053
- e.map((i) => dt.deserialize(i)).filter((i) => i !== void 0)
2052
+ return new Yt(
2053
+ e.map((i) => ft.deserialize(i)).filter((i) => i !== void 0)
2054
2054
  );
2055
2055
  }
2056
2056
  /**
@@ -2060,8 +2060,8 @@ class _t {
2060
2060
  return this.items.map((t) => t.serialize());
2061
2061
  }
2062
2062
  }
2063
- var hi = /* @__PURE__ */ ((s) => (s.all = "all", s.none = "none", s))(hi || {});
2064
- class Yt {
2063
+ var ui = /* @__PURE__ */ ((s) => (s.all = "all", s.none = "none", s))(ui || {});
2064
+ class $t {
2065
2065
  /** Creates a [TDM] object */
2066
2066
  constructor(t) {
2067
2067
  this.reservation = t.reservation, this.policy = t.policy;
@@ -2071,7 +2071,7 @@ class Yt {
2071
2071
  */
2072
2072
  static deserialize(t) {
2073
2073
  if (t)
2074
- return new Yt({
2074
+ return new $t({
2075
2075
  reservation: t.reservation,
2076
2076
  policy: t.policy
2077
2077
  });
@@ -2084,10 +2084,10 @@ class Yt {
2084
2084
  return this.reservation !== void 0 && (t.reservation = this.reservation), this.policy !== void 0 && (t.policy = this.policy), t;
2085
2085
  }
2086
2086
  }
2087
- const tt = class tt {
2087
+ const et = class et {
2088
2088
  /** Creates [Metadata] object */
2089
2089
  constructor(t) {
2090
- this.title = t.title, this.typeUri = t.typeUri, this.conformsTo = t.conformsTo, this.identifier = t.identifier, this.altIdentifier = t.altIdentifier, this.subtitle = t.subtitle, this.sortAs = t.sortAs, this.artists = t.artists, this.authors = t.authors, this.colorists = t.colorists, this.contributors = t.contributors, this.editors = t.editors, this.illustrators = t.illustrators, this.inkers = t.inkers, this.letterers = t.letterers, this.narrators = t.narrators, this.pencilers = t.pencilers, this.translators = t.translators, this.languages = t.languages, this.description = t.description, this.publishers = t.publishers, this.imprints = t.imprints, this.published = t.published, this.modified = t.modified, this.subjects = t.subjects, this.belongsTo = t.belongsTo, this.belongsToCollections = t.belongsToCollections, this.belongsToSeries = t.belongsToSeries, this.belongsToCollections && this.belongsToCollections.items.length > 0 && (this.belongsTo || (this.belongsTo = new q()), this.belongsTo.items.set("collection", this.belongsToCollections)), this.belongsToSeries && this.belongsToSeries.items.length > 0 && (this.belongsTo || (this.belongsTo = new q()), this.belongsTo.items.set("series", this.belongsToSeries)), this.layout = t.layout, this.readingProgression = t.readingProgression, this.duration = t.duration, this.numberOfPages = t.numberOfPages, this.accessibility = t.accessibility, this.tdm = t.tdm, this.otherMetadata = t.otherMetadata;
2090
+ this.title = t.title, this.typeUri = t.typeUri, this.conformsTo = t.conformsTo, this.identifier = t.identifier, this.altIdentifier = t.altIdentifier, this.subtitle = t.subtitle, this.sortAs = t.sortAs, this.artists = t.artists, this.authors = t.authors, this.colorists = t.colorists, this.contributors = t.contributors, this.editors = t.editors, this.illustrators = t.illustrators, this.inkers = t.inkers, this.letterers = t.letterers, this.narrators = t.narrators, this.pencilers = t.pencilers, this.translators = t.translators, this.languages = t.languages, this.description = t.description, this.publishers = t.publishers, this.imprints = t.imprints, this.published = t.published, this.modified = t.modified, this.subjects = t.subjects, this.belongsTo = t.belongsTo, this.belongsToCollections = t.belongsToCollections, this.belongsToSeries = t.belongsToSeries, this.belongsToCollections && this.belongsToCollections.items.length > 0 && (this.belongsTo || (this.belongsTo = new Q()), this.belongsTo.items.set("collection", this.belongsToCollections)), this.belongsToSeries && this.belongsToSeries.items.length > 0 && (this.belongsTo || (this.belongsTo = new Q()), this.belongsTo.items.set("series", this.belongsToSeries)), this.layout = t.layout, this.readingProgression = t.readingProgression, this.duration = t.duration, this.numberOfPages = t.numberOfPages, this.accessibility = t.accessibility, this.tdm = t.tdm, this.otherMetadata = t.otherMetadata;
2091
2091
  }
2092
2092
  /**
2093
2093
  * Parses a [Metadata] from its RWPM JSON representation.
@@ -2096,9 +2096,9 @@ const tt = class tt {
2096
2096
  */
2097
2097
  static deserialize(t) {
2098
2098
  if (!(t && t.title)) return;
2099
- const e = M.deserialize(t.title), i = t["@type"], r = F(t.conformsTo), n = t.identifier, a = Z.deserialize(t.altIdentifier), o = M.deserialize(t.subtitle), h = M.deserialize(t.sortAs), m = N.deserialize(t.artist), p = N.deserialize(t.author), u = N.deserialize(t.colorist), g = N.deserialize(t.contributor), A = N.deserialize(t.editor), C = N.deserialize(t.illustrator), d = N.deserialize(t.inker), I = N.deserialize(t.letterer), B = N.deserialize(t.narrator), Me = N.deserialize(t.penciler), Be = N.deserialize(t.translator), Ge = F(t.language), We = t.description, He = N.deserialize(t.publisher), Fe = N.deserialize(t.imprint), Ve = ct(t.published), _e = ct(t.modified), Ye = _t.deserialize(t.subject), $e = q.deserialize(t.belongsTo), Xe = V.deserialize(t.accessibility), Ke = t.layout, Ze = t.readingProgression, Je = L(t.duration), qe = L(t.numberOfPages), Qe = Yt.deserialize(t.tdm);
2100
- let at = Object.assign({}, t);
2101
- return tt.mappedProperties.forEach((je) => delete at[je]), Object.keys(at).length === 0 && (at = void 0), new tt({
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), h = 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), P = 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), 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);
2100
+ let ot = Object.assign({}, t);
2101
+ return et.mappedProperties.forEach((ti) => delete ot[ti]), Object.keys(ot).length === 0 && (ot = void 0), new et({
2102
2102
  title: e,
2103
2103
  typeUri: i,
2104
2104
  conformsTo: r,
@@ -2106,32 +2106,32 @@ const tt = class tt {
2106
2106
  altIdentifier: a,
2107
2107
  subtitle: o,
2108
2108
  sortAs: h,
2109
- artists: m,
2110
- authors: p,
2109
+ artists: p,
2110
+ authors: m,
2111
2111
  colorists: u,
2112
2112
  contributors: g,
2113
2113
  editors: A,
2114
- illustrators: C,
2114
+ illustrators: P,
2115
2115
  inkers: d,
2116
2116
  letterers: I,
2117
- narrators: B,
2118
- pencilers: Me,
2119
- translators: Be,
2120
- languages: Ge,
2121
- description: We,
2122
- publishers: He,
2123
- imprints: Fe,
2117
+ narrators: G,
2118
+ pencilers: Be,
2119
+ translators: Ge,
2120
+ languages: We,
2121
+ description: He,
2122
+ publishers: Fe,
2123
+ imprints: _e,
2124
2124
  published: Ve,
2125
- modified: _e,
2126
- subjects: Ye,
2127
- belongsTo: $e,
2128
- layout: Ke,
2129
- readingProgression: Ze,
2130
- duration: Je,
2131
- numberOfPages: qe,
2132
- accessibility: Xe,
2133
- tdm: Qe,
2134
- otherMetadata: at
2125
+ modified: Ye,
2126
+ subjects: $e,
2127
+ belongsTo: Xe,
2128
+ layout: Ze,
2129
+ readingProgression: Je,
2130
+ duration: qe,
2131
+ numberOfPages: Qe,
2132
+ accessibility: Ke,
2133
+ tdm: je,
2134
+ otherMetadata: ot
2135
2135
  });
2136
2136
  }
2137
2137
  /**
@@ -2161,12 +2161,12 @@ const tt = class tt {
2161
2161
  return null;
2162
2162
  for (const t of this.conformsTo)
2163
2163
  switch (t) {
2164
- case J.EPUB:
2165
- return this.layout || $.reflowable;
2166
- case J.DIVINA:
2167
- return this.layout === $.reflowable ? $.fixed : this.layout || $.fixed;
2168
- case J.AUDIOBOOK:
2169
- case J.PDF:
2164
+ case q.EPUB:
2165
+ return this.layout || X.reflowable;
2166
+ case q.DIVINA:
2167
+ return this.layout === X.reflowable ? X.fixed : this.layout || X.fixed;
2168
+ case q.AUDIOBOOK:
2169
+ case q.PDF:
2170
2170
  return null;
2171
2171
  }
2172
2172
  return null;
@@ -2180,23 +2180,23 @@ const tt = class tt {
2180
2180
  if (this.readingProgression)
2181
2181
  return this.readingProgression;
2182
2182
  if (this.languages?.length !== 1)
2183
- return H.ltr;
2183
+ return F.ltr;
2184
2184
  const t = this.languages[0].toLowerCase();
2185
2185
  if (t === "zh-hant" || t === "zh-tw")
2186
- return H.rtl;
2186
+ return F.rtl;
2187
2187
  switch (t.split("-")[0]) {
2188
2188
  case "ar":
2189
- return H.rtl;
2189
+ return F.rtl;
2190
2190
  case "fa":
2191
- return H.rtl;
2191
+ return F.rtl;
2192
2192
  case "he":
2193
- return H.rtl;
2193
+ return F.rtl;
2194
2194
  default:
2195
- return H.ltr;
2195
+ return F.ltr;
2196
2196
  }
2197
2197
  }
2198
2198
  };
2199
- tt.mappedProperties = [
2199
+ et.mappedProperties = [
2200
2200
  "title",
2201
2201
  "@type",
2202
2202
  "conformsTo",
@@ -2230,24 +2230,24 @@ tt.mappedProperties = [
2230
2230
  "accessibility",
2231
2231
  "tdm"
2232
2232
  ];
2233
- let ft = tt;
2234
- ft.prototype.getMediaOverlay = function() {
2233
+ let pt = et;
2234
+ pt.prototype.getMediaOverlay = function() {
2235
2235
  const s = this.otherMetadata?.mediaOverlay;
2236
2236
  if (s)
2237
2237
  return Vt.deserialize(s);
2238
2238
  };
2239
- D.prototype.getContains = function() {
2239
+ U.prototype.getContains = function() {
2240
2240
  return new Set(this.otherProperties.contains || []);
2241
2241
  };
2242
- class $t {
2242
+ class Xt {
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 $t({
2249
- links: O.deserialize(t.links),
2250
- guided: X.deserializeArray(t.guided)
2248
+ return new Xt({
2249
+ links: z.deserialize(t.links),
2250
+ guided: K.deserializeArray(t.guided)
2251
2251
  });
2252
2252
  }
2253
2253
  serialize() {
@@ -2255,7 +2255,7 @@ class $t {
2255
2255
  return this.links !== void 0 && (t.links = this.links.serialize()), this.guided !== void 0 && (t.guided = this.guided.map((e) => e.serialize())), t;
2256
2256
  }
2257
2257
  }
2258
- class pt {
2258
+ class mt {
2259
2259
  constructor(t) {
2260
2260
  this.plain = t.plain, this.ssml = t.ssml, this.language = t.language;
2261
2261
  }
@@ -2265,9 +2265,9 @@ class pt {
2265
2265
  static deserialize(t) {
2266
2266
  if (t != null) {
2267
2267
  if (typeof t == "string")
2268
- return new pt({ plain: t });
2268
+ return new mt({ plain: t });
2269
2269
  if (t.plain || t.ssml || t.language)
2270
- return new pt({
2270
+ return new mt({
2271
2271
  plain: t.plain,
2272
2272
  ssml: t.ssml,
2273
2273
  language: t.language
@@ -2282,7 +2282,7 @@ class pt {
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 X {
2285
+ class K {
2286
2286
  /**
2287
2287
  * Creates a [GuidedNavigation] object.
2288
2288
  */
@@ -2313,15 +2313,15 @@ class X {
2313
2313
  */
2314
2314
  static deserialize(t) {
2315
2315
  if (t)
2316
- return new X({
2316
+ return new K({
2317
2317
  audioref: t.audioref,
2318
- children: X.deserializeArray(t.children),
2318
+ children: K.deserializeArray(t.children),
2319
2319
  imgref: t.imgref,
2320
- role: t.role ? new Set(F(t.role)) : void 0,
2320
+ role: t.role ? new Set(_(t.role)) : void 0,
2321
2321
  level: typeof t.level == "number" ? t.level : void 0,
2322
- text: pt.deserialize(t.text),
2322
+ text: mt.deserialize(t.text),
2323
2323
  textref: t.textref,
2324
- description: X.deserialize(t.description)
2324
+ description: K.deserialize(t.description)
2325
2325
  });
2326
2326
  }
2327
2327
  /**
@@ -2329,14 +2329,14 @@ class X {
2329
2329
  */
2330
2330
  static deserializeArray(t) {
2331
2331
  if (Array.isArray(t))
2332
- return t.map((e) => X.deserialize(e)).filter((e) => e !== void 0);
2332
+ return t.map((e) => K.deserialize(e)).filter((e) => e !== void 0);
2333
2333
  }
2334
2334
  /**
2335
2335
  * Serializes a [GuidedNavigationObject] to its RWPM JSON representation.
2336
2336
  */
2337
2337
  serialize() {
2338
2338
  const t = {};
2339
- if (this.audioref !== void 0 && (t.audioref = this.audioref), this.children !== void 0 && (t.children = this.children.map((e) => e.serialize())), this.imgref !== void 0 && (t.imgref = this.imgref), this.role !== void 0 && (t.role = lt(this.role)), this.level !== void 0 && (t.level = this.level), this.text !== void 0) {
2339
+ if (this.audioref !== void 0 && (t.audioref = this.audioref), this.children !== void 0 && (t.children = this.children.map((e) => e.serialize())), this.imgref !== void 0 && (t.imgref = this.imgref), this.role !== void 0 && (t.role = ht(this.role)), this.level !== void 0 && (t.level = this.level), this.text !== void 0) {
2340
2340
  const e = this.text.serialize();
2341
2341
  e !== void 0 && (t.text = e);
2342
2342
  }
@@ -2373,16 +2373,16 @@ class X {
2373
2373
  return e.length === 1 ? [isNaN(e[0]) ? void 0 : e[0], void 0] : e.length > 2 ? [void 0, void 0] : [isNaN(e[0]) ? void 0 : e[0], isNaN(e[1]) ? void 0 : e[1]];
2374
2374
  }
2375
2375
  }
2376
- function ui(s, t) {
2376
+ function di(s, t) {
2377
2377
  return t.length > 1 ? t.indexOf(s.slice(-1)) > -1 : s.slice(-1) === t;
2378
2378
  }
2379
- function di(s, t) {
2379
+ function fi(s, t) {
2380
2380
  return s.slice(s.length - t.length) === t;
2381
2381
  }
2382
- const yt = {
2383
- endsWith: di,
2384
- endsWithChar: ui
2385
- }, fi = [
2382
+ const wt = {
2383
+ endsWith: fi,
2384
+ endsWithChar: di
2385
+ }, pi = [
2386
2386
  "ie",
2387
2387
  "eg",
2388
2388
  "ext",
@@ -2474,16 +2474,16 @@ const yt = {
2474
2474
  "Fri",
2475
2475
  "Sat"
2476
2476
  ];
2477
- function de(s) {
2477
+ function fe(s) {
2478
2478
  return /^[A-Z][a-z].*/.test(s) || Lt(s);
2479
2479
  }
2480
- function pi(s) {
2481
- return de(s) || /``|"|'/.test(s.substring(0, 2));
2482
- }
2483
2480
  function mi(s) {
2484
- return ~fi.indexOf(s.replace(/\W+/g, ""));
2481
+ return fe(s) || /``|"|'/.test(s.substring(0, 2));
2482
+ }
2483
+ function gi(s) {
2484
+ return ~pi.indexOf(s.replace(/\W+/g, ""));
2485
2485
  }
2486
- function gi(s, t) {
2486
+ function bi(s, t) {
2487
2487
  if (s === "a.m." || s === "p.m.") {
2488
2488
  var e = t.replace(/\W+/g, "").slice(-3).toLowerCase();
2489
2489
  if (e === "day")
@@ -2491,23 +2491,23 @@ function gi(s, t) {
2491
2491
  }
2492
2492
  return !1;
2493
2493
  }
2494
- function re(s) {
2494
+ function ne(s) {
2495
2495
  var t = s.replace(/[\(\)\[\]\{\}]/g, "").match(/(.\.)*/);
2496
2496
  return t && t[0].length > 0;
2497
2497
  }
2498
- function ne(s) {
2499
- return s.length <= 3 ? !0 : de(s);
2498
+ function ae(s) {
2499
+ return s.length <= 3 ? !0 : fe(s);
2500
2500
  }
2501
2501
  function Lt(s, t) {
2502
2502
  return t && (s = s.slice(t - 1, t + 2)), !isNaN(Number(s));
2503
2503
  }
2504
- function bi(s) {
2504
+ function vi(s) {
2505
2505
  return s.match(/^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$/);
2506
2506
  }
2507
- function vi(s) {
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 Ai(s) {
2510
+ function yi(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,10 +2516,10 @@ function Ai(s) {
2516
2516
  }
2517
2517
  return !1;
2518
2518
  }
2519
- function yi(s) {
2519
+ function wi(s) {
2520
2520
  return s === "." || s === "!" || s === "?";
2521
2521
  }
2522
- function wi(s, t) {
2522
+ function Si(s, t) {
2523
2523
  t = Object.assign(t || {}, {
2524
2524
  newlineBoundary: t && t.newlineBoundary || !0
2525
2525
  });
@@ -2529,29 +2529,29 @@ function wi(s, t) {
2529
2529
  s.re(e, { split: !0 }),
2530
2530
  // Merge words as sentences
2531
2531
  s.splitAndMerge(function(i, r, n, a, o, h) {
2532
- var m, p = [i, null], u = i, g = h.slice(o + 1).find(function(C) {
2533
- return !e.test(C.value);
2532
+ var p, m = [i, null], u = i, g = h.slice(o + 1).find(function(P) {
2533
+ return !e.test(P.value);
2534
2534
  });
2535
2535
  if (i === `
2536
- ` && t.newlineBoundary || yi(i) || yt.endsWithChar(i, "?!"))
2537
- return p;
2538
- if (yt.endsWithChar(i, ".")) {
2536
+ ` && t.newlineBoundary || wi(i) || wt.endsWithChar(i, "?!"))
2537
+ return m;
2538
+ if (wt.endsWithChar(i, ".")) {
2539
2539
  if (g) {
2540
- if (i.length === 2 && isNaN(i.charAt(0)) && i.match(/[a-zA-Z]/) || mi(i))
2540
+ if (i.length === 2 && isNaN(i.charAt(0)) && i.match(/[a-zA-Z]/) || gi(i))
2541
2541
  return u;
2542
- if (pi(g.value)) {
2543
- if (gi(i, g.value) || Lt(g.value) && ne(i))
2542
+ if (mi(g.value)) {
2543
+ if (bi(i, g.value) || Lt(g.value) && ae(i))
2544
2544
  return u;
2545
- } else if (yt.endsWith(i, "..") || re(i) || ne(i))
2545
+ } else if (wt.endsWith(i, "..") || ne(i) || ae(i))
2546
2546
  return u;
2547
2547
  }
2548
- return p;
2548
+ return m;
2549
2549
  }
2550
2550
  let A;
2551
- return (A = i.indexOf(".")) > -1 && (Lt(i, A) || re(i) || vi(i) || bi(i)) ? u : (m = Ai(i)) ? [
2552
- m[0] + m[1],
2551
+ return (A = i.indexOf(".")) > -1 && (Lt(i, A) || ne(i) || Ai(i) || vi(i)) ? u : (p = yi(i)) ? [
2552
+ p[0] + p[1],
2553
2553
  null,
2554
- m[2]
2554
+ p[2]
2555
2555
  ] : u;
2556
2556
  }),
2557
2557
  // Filter empty sentences
@@ -2560,13 +2560,13 @@ function wi(s, t) {
2560
2560
  })
2561
2561
  );
2562
2562
  }
2563
- const Si = (s, ...t) => (...e) => s(...t, ...e);
2564
- function Ei(s) {
2563
+ const Ei = (s, ...t) => (...e) => s(...t, ...e);
2564
+ function Ti(s) {
2565
2565
  return {
2566
- sentences: Si(wi, s)
2566
+ sentences: Ei(Si, s)
2567
2567
  };
2568
2568
  }
2569
- function Ti(s, t) {
2569
+ function Ii(s, t) {
2570
2570
  return t ? s.reduce(function(e, i) {
2571
2571
  var r = [
2572
2572
  i.index,
@@ -2576,11 +2576,11 @@ function Ti(s, t) {
2576
2576
  return [e, r].join(":");
2577
2577
  }, t) : null;
2578
2578
  }
2579
- function Ii(s) {
2579
+ function xi(s) {
2580
2580
  const { index: t, offset: e, value: i, ...r } = s;
2581
2581
  return r;
2582
2582
  }
2583
- function xi(s, t) {
2583
+ function Ni(s, t) {
2584
2584
  var e = 0;
2585
2585
  return Array.isArray(t) || (t = [t]), t.map(function(i) {
2586
2586
  return i === null ? null : (typeof i == "string" && (i = {
@@ -2590,7 +2590,7 @@ function xi(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 Ni(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) {
@@ -2598,8 +2598,8 @@ function Ni(s, t) {
2598
2598
  s[a + 1];
2599
2599
  var h = o ? n.index + 1 - (o.index + o.offset) : 0;
2600
2600
  e = e + new Array(h).join(t) + n.value;
2601
- var m = n.index - r + n.offset;
2602
- m > i && (i = m);
2601
+ var p = n.index - r + n.offset;
2602
+ p > i && (i = p);
2603
2603
  }), {
2604
2604
  // Index equal is the one from the first token
2605
2605
  index: r,
@@ -2607,17 +2607,17 @@ function Ni(s, t) {
2607
2607
  offset: Math.max(i, e.length)
2608
2608
  };
2609
2609
  }
2610
- const Q = {
2611
- tokensId: Ti,
2612
- normalize: xi,
2613
- properties: Ii,
2614
- merge: Ni
2610
+ const j = {
2611
+ tokensId: Ii,
2612
+ normalize: Ni,
2613
+ properties: xi,
2614
+ merge: Oi
2615
2615
  };
2616
- var Li = ' \r\n  !"#$%&()*+,-.\\/:;<=>?@[\\]^_`{|}~', Oi = new RegExp(
2616
+ var Li = ' \r\n  !"#$%&()*+,-.\\/:;<=>?@[\\]^_`{|}~', zi = new RegExp(
2617
2617
  "([^" + Li + "]+)"
2618
2618
  );
2619
- function z(s) {
2620
- if (!(this instanceof z)) return new z(s);
2619
+ function C(s) {
2620
+ if (!(this instanceof C)) return new C(s);
2621
2621
  this.opts = Object.assign({
2622
2622
  cacheGet: function(t) {
2623
2623
  return null;
@@ -2626,7 +2626,7 @@ function z(s) {
2626
2626
  }
2627
2627
  }, s);
2628
2628
  }
2629
- z.prototype.split = function(t, e = {}) {
2629
+ C.prototype.split = function(t, e = {}) {
2630
2630
  var i = this;
2631
2631
  return e = Object.assign({ preserveProperties: !0, cache: () => null }, e), function(r, n) {
2632
2632
  if (arguments.length === 6) return t.apply(null, arguments);
@@ -2636,34 +2636,34 @@ z.prototype.split = function(t, e = {}) {
2636
2636
  value: r,
2637
2637
  index: 0,
2638
2638
  offset: r.length
2639
- }] : Array.isArray(r) || (r = [r]), o = Q.tokensId(r, e.cache()), o && (h = i.opts.cacheGet(o), h))
2639
+ }] : Array.isArray(r) || (r = [r]), o = j.tokensId(r, e.cache()), o && (h = i.opts.cacheGet(o), h))
2640
2640
  return h;
2641
- var m = r.map(function(p, u) {
2641
+ var p = r.map(function(m, u) {
2642
2642
  var g = r[u + 1], A = t(
2643
- p.value,
2644
- Object.assign({}, p),
2643
+ m.value,
2644
+ Object.assign({}, m),
2645
2645
  a ? Object.assign({}, a) : null,
2646
2646
  g ? Object.assign({}, g) : null,
2647
2647
  u,
2648
2648
  r
2649
2649
  ) || [];
2650
- if (A = Q.normalize(p, A), e.preserveProperties) {
2651
- var C = Q.properties(p);
2650
+ if (A = j.normalize(m, A), e.preserveProperties) {
2651
+ var P = j.properties(m);
2652
2652
  A = A.map(function(d) {
2653
- return Object.assign({}, d, C);
2653
+ return Object.assign({}, d, P);
2654
2654
  });
2655
2655
  }
2656
- return a = p, A;
2656
+ return a = m, A;
2657
2657
  }).filter(Boolean).flat();
2658
- return o && i.opts.cacheSet(o, m), m;
2658
+ return o && i.opts.cacheSet(o, p), p;
2659
2659
  };
2660
2660
  };
2661
- z.prototype.re = function(t, e = {}) {
2661
+ C.prototype.re = function(t, e = {}) {
2662
2662
  return e = Object.assign({ split: !1 }, e), this.split(function(i, r) {
2663
2663
  for (var n = i, a = [], o, h = 0; o = t.exec(i); ) {
2664
- var m = o.index, p = h + m, u = o[0] || "", g = u.length;
2665
- if (e.split && h < p) {
2666
- var A = n.slice(h, p);
2664
+ var p = o.index, m = h + p, u = o[0] || "", g = u.length;
2665
+ if (e.split && h < m) {
2666
+ var A = n.slice(h, m);
2667
2667
  a.push({
2668
2668
  value: A,
2669
2669
  index: h,
@@ -2672,10 +2672,10 @@ z.prototype.re = function(t, e = {}) {
2672
2672
  }
2673
2673
  a.push({
2674
2674
  value: u,
2675
- index: p,
2675
+ index: m,
2676
2676
  offset: g,
2677
2677
  match: o
2678
- }), i = i.slice(m + g), h = p + g;
2678
+ }), i = i.slice(p + g), h = m + g;
2679
2679
  }
2680
2680
  return e.split && i && a.push({
2681
2681
  value: i,
@@ -2688,25 +2688,25 @@ z.prototype.re = function(t, e = {}) {
2688
2688
  }
2689
2689
  });
2690
2690
  };
2691
- z.prototype.splitAndMerge = function(t, e = {}) {
2691
+ C.prototype.splitAndMerge = function(t, e = {}) {
2692
2692
  var i = this;
2693
2693
  return e = Object.assign({ mergeWith: "" }, e), function(r) {
2694
2694
  var n = [], a = [];
2695
2695
  function o() {
2696
2696
  if (a.length != 0) {
2697
- var h = Q.merge(a, e.mergeWith);
2697
+ var h = j.merge(a, e.mergeWith);
2698
2698
  n.push(h), a = [];
2699
2699
  }
2700
2700
  }
2701
- return i.split(function(h, m) {
2702
- var p = t.apply(null, arguments);
2703
- p = Q.normalize(m, p), p.forEach(function(u) {
2701
+ return i.split(function(h, p) {
2702
+ var m = t.apply(null, arguments);
2703
+ m = j.normalize(p, m), m.forEach(function(u) {
2704
2704
  u === null ? o() : a.push(u);
2705
2705
  });
2706
2706
  })(r), o(), n;
2707
2707
  };
2708
2708
  };
2709
- z.prototype.filter = function(t) {
2709
+ C.prototype.filter = function(t) {
2710
2710
  return this.split(function(e, i) {
2711
2711
  if (t.apply(null, arguments))
2712
2712
  return {
@@ -2716,7 +2716,7 @@ z.prototype.filter = function(t) {
2716
2716
  };
2717
2717
  });
2718
2718
  };
2719
- z.prototype.extend = function(t) {
2719
+ C.prototype.extend = function(t) {
2720
2720
  return this.split(function(e, i) {
2721
2721
  var r = typeof t == "function" ? t.apply(null, arguments) : t;
2722
2722
  return Object.assign({
@@ -2726,7 +2726,7 @@ z.prototype.extend = function(t) {
2726
2726
  }, r);
2727
2727
  });
2728
2728
  };
2729
- z.prototype.ifthen = function(s, t) {
2729
+ C.prototype.ifthen = function(s, t) {
2730
2730
  return this.split(function(e, i) {
2731
2731
  if (s.apply(null, arguments))
2732
2732
  return t.apply(null, arguments);
@@ -2734,35 +2734,35 @@ z.prototype.ifthen = function(s, t) {
2734
2734
  return n;
2735
2735
  });
2736
2736
  };
2737
- z.prototype.test = function(t) {
2737
+ C.prototype.test = function(t) {
2738
2738
  return this.filter(function(e, i) {
2739
2739
  return t.test(e);
2740
2740
  }, {
2741
2741
  cache: t.toString()
2742
2742
  });
2743
2743
  };
2744
- z.prototype.flow = function(...t) {
2744
+ C.prototype.flow = function(...t) {
2745
2745
  const e = t.reduce((i, r) => (...n) => r(i(...n)));
2746
2746
  return this.split(e);
2747
2747
  };
2748
- z.prototype.serie = function(...t) {
2748
+ C.prototype.serie = function(...t) {
2749
2749
  return t.reduce((e, i) => (...r) => i(e(...r)));
2750
2750
  };
2751
- z.prototype.merge = function() {
2751
+ C.prototype.merge = function() {
2752
2752
  return this.splitAndMerge((s) => [s]);
2753
2753
  };
2754
- z.prototype.sections = function() {
2754
+ C.prototype.sections = function() {
2755
2755
  return this.re(/([^\n\.,;!?]+)/i, { split: !1 });
2756
2756
  };
2757
- z.prototype.words = function() {
2758
- return this.re(Oi);
2757
+ C.prototype.words = function() {
2758
+ return this.re(zi);
2759
2759
  };
2760
- z.prototype.characters = function() {
2760
+ C.prototype.characters = function() {
2761
2761
  return this.re(/[^\s]/);
2762
2762
  };
2763
- var zi = /* @__PURE__ */ ((s) => (s.Word = "word", s.Sentence = "sentence", s.Paragraph = "paragraph", s))(zi || {});
2764
- const Ri = (s, t) => "Segmenter" in Intl ? new Ci(s, t) : new Pi(s, t);
2765
- class Ci {
2763
+ var Ci = /* @__PURE__ */ ((s) => (s.Word = "word", s.Sentence = "sentence", s.Paragraph = "paragraph", s))(Ci || {});
2764
+ const Ri = (s, t) => "Segmenter" in Intl ? new Pi(s, t) : new ki(s, t);
2765
+ class Pi {
2766
2766
  constructor(t, e) {
2767
2767
  if (this.unit = e, t = t ?? navigator?.language, !("Segmenter" in Intl)) throw new Error("Intl.Segmenter is not supported in this environment");
2768
2768
  if (e === "paragraph") throw new Error("IntlTextTokenizer does not handle TextUnit.Paragraph");
@@ -2774,16 +2774,16 @@ class Ci {
2774
2774
  const e = this.segmenter.segment(t), i = [];
2775
2775
  for (let r of e) {
2776
2776
  if (this.unit === "word" && r.isWordLike === !1) continue;
2777
- const n = fe(r.segment);
2777
+ const n = pe(r.segment);
2778
2778
  n !== null && i.push([r.index, r.index + n.length]);
2779
2779
  }
2780
2780
  return i;
2781
2781
  }
2782
2782
  }
2783
- class Pi {
2783
+ class ki {
2784
2784
  constructor(t, e) {
2785
2785
  if (this.unit = e, t = t ?? navigator?.language, this.isEnglish = t.toLowerCase().split("-")[0] === "en", e === "paragraph") throw new Error("NaiveTextTokenizer does not handle TextUnit.Paragraph");
2786
- this.tokenizer = new z();
2786
+ this.tokenizer = new C();
2787
2787
  }
2788
2788
  tokenize(t) {
2789
2789
  let e = [];
@@ -2792,7 +2792,7 @@ class Pi {
2792
2792
  e = this.tokenizer.words()(t);
2793
2793
  break;
2794
2794
  case "sentence":
2795
- this.isEnglish ? e = Ei(this.tokenizer).sentences()(t) : e = this.tokenizer.sections()(t);
2795
+ this.isEnglish ? e = Ti(this.tokenizer).sentences()(t) : e = this.tokenizer.sections()(t);
2796
2796
  break;
2797
2797
  default:
2798
2798
  e = [];
@@ -2801,18 +2801,223 @@ class Pi {
2801
2801
  const i = [];
2802
2802
  return e.forEach((r) => {
2803
2803
  if (r.value.length === 0) return;
2804
- const n = fe(r.value);
2804
+ const n = pe(r.value);
2805
2805
  n !== null && i.push([r.index, r.index + n.length]);
2806
2806
  }), i;
2807
2807
  }
2808
2808
  }
2809
- const ki = new RegExp("[\\p{L}\\p{N}]+", "u"), fe = (s) => {
2809
+ const Di = new RegExp("[\\p{L}\\p{N}]+", "u"), pe = (s) => {
2810
2810
  const t = s.trimEnd();
2811
- return t.length === 0 || t.match(ki) === null ? null : t;
2811
+ return t.length === 0 || t.match(Di) === null ? null : t;
2812
2812
  };
2813
- class _ {
2813
+ class x {
2814
+ constructor(t, e) {
2815
+ this._allItems = t, this.linkMap = e;
2816
+ }
2817
+ static build(t, e = {}) {
2818
+ const i = t.toc?.items ?? [], r = t.readingOrder.items, { depth: n } = e, a = /* @__PURE__ */ new Map(), o = [];
2819
+ for (let h = 0; h < r.length; h++) {
2820
+ const p = r[h], m = x.bareHref(p.href), u = p.title ?? x.findTitleInToc(i, m, n) ?? `Resource ${h + 1}`, g = x.collectChildrenFromToc(i, m, n, 1, a), A = {
2821
+ title: u,
2822
+ references: [p.href],
2823
+ children: g.length > 0 ? g : void 0
2824
+ };
2825
+ a.set(A, p), o.push(A);
2826
+ }
2827
+ return new x(o, a);
2828
+ }
2829
+ /**
2830
+ * The active depth limit for TOC traversal (title resolution and child
2831
+ * collection). `undefined` means unlimited. Setting the same value again
2832
+ * is a no-op; a new value invalidates the cached items and flat list.
2833
+ */
2834
+ get depth() {
2835
+ return this._depth;
2836
+ }
2837
+ set depth(t) {
2838
+ this._depth !== t && (this._depth = t, this._items = void 0, this._flat = void 0);
2839
+ }
2840
+ /** Top-level timeline items. Cached; invalidated when `depth` changes. */
2841
+ get items() {
2842
+ return this._items || (this._items = this._depth !== void 0 ? x.trimToDepth(this._allItems, this._depth) : this._allItems), this._items;
2843
+ }
2844
+ locate(t) {
2845
+ const e = t.href.split("#")[0], i = t.locations?.time();
2846
+ let r;
2847
+ if (i !== void 0)
2848
+ for (const n of this.flat)
2849
+ this.itemMatchesTime(n, e, i) && (r = n);
2850
+ return r || (r = this.flat.find((n) => this.bareHrefFromItem(n) === e)), r;
2851
+ }
2852
+ adjacentTo(t) {
2853
+ const e = this.flat.indexOf(t);
2854
+ return {
2855
+ previous: e > 0 ? this.flat[e - 1] : void 0,
2856
+ next: e >= 0 && e < this.flat.length - 1 ? this.flat[e + 1] : void 0
2857
+ };
2858
+ }
2859
+ segmentsForHref(t) {
2860
+ const e = t.split("#")[0], i = this.items.find((r) => this.bareHrefFromItem(r) === e);
2861
+ return i ? i.children?.length ? i.children : [i] : [];
2862
+ }
2863
+ itemAtProgression(t, e, i) {
2864
+ const r = t.split("#")[0], n = this.items.find((o) => this.bareHrefFromItem(o) === r);
2865
+ if (!n) return;
2866
+ if (!n.children?.length) return n;
2867
+ if (i !== void 0) {
2868
+ const o = e * i;
2869
+ let h = n;
2870
+ for (const p of n.children) {
2871
+ const m = this.timeFromItem(p);
2872
+ if (m === void 0 || m > o) break;
2873
+ h = p;
2874
+ }
2875
+ return h;
2876
+ }
2877
+ const a = Math.min(Math.floor(e * n.children.length), n.children.length - 1);
2878
+ return n.children[a];
2879
+ }
2880
+ ancestors(t) {
2881
+ return this.ancestorPath(this.items, t) ?? [];
2882
+ }
2883
+ linkFor(t) {
2884
+ return this.linkMap.get(t);
2885
+ }
2886
+ get flat() {
2887
+ return this._flat || (this._flat = this.flattenItems(this.items)), this._flat;
2888
+ }
2889
+ // -------------------------------------------------------------------------
2890
+ // TOC title resolution
2891
+ // -------------------------------------------------------------------------
2892
+ /**
2893
+ * Resolve a display title for `bare` from the TOC, looking no deeper than
2894
+ * `maxDepth` levels (1 = top-level entries only). Priority:
2895
+ * 1. A start-of-resource entry: bare href or `#t=0` (audio).
2896
+ * 2. Exactly one fragment entry referencing this resource — unambiguous.
2897
+ * 3. Multiple fragment entries — ambiguous, returns `undefined`.
2898
+ */
2899
+ static findTitleInToc(t, e, i) {
2900
+ const { atStart: r, fragments: n } = x.collectTocCandidates(t, e, i, 1);
2901
+ if (r.length > 0) return r[0].title;
2902
+ if (n.length === 1) return n[0].title;
2903
+ }
2904
+ /**
2905
+ * Collect all TOC entries that reference `bare` as flat children, walking
2906
+ * up to `maxDepth` levels deep. Start-of-resource entries (#t=0 or no
2907
+ * fragment) are excluded — they contribute to title resolution, not children.
2908
+ * Order follows TOC declaration (depth-first).
2909
+ */
2910
+ static collectChildrenFromToc(t, e, i, r, n) {
2911
+ if (i !== void 0 && r > i) return [];
2912
+ const a = [];
2913
+ for (const o of t) {
2914
+ if (x.bareHref(o.href) === e && o.title && !x.isStartOfResource(o.href)) {
2915
+ const h = { title: o.title, references: [o.href] };
2916
+ n.set(h, o), a.push(h);
2917
+ }
2918
+ o.children?.items?.length && a.push(...x.collectChildrenFromToc(
2919
+ o.children.items,
2920
+ e,
2921
+ i,
2922
+ r + 1,
2923
+ n
2924
+ ));
2925
+ }
2926
+ return a;
2927
+ }
2928
+ /**
2929
+ * Walk the TOC tree up to `maxDepth` levels and collect all entries whose
2930
+ * bare href matches `bare`, split into start-of-resource entries and
2931
+ * fragment entries.
2932
+ */
2933
+ static collectTocCandidates(t, e, i, r) {
2934
+ if (i !== void 0 && r > i)
2935
+ return { atStart: [], fragments: [] };
2936
+ const n = [], a = [];
2937
+ for (const o of t)
2938
+ if (x.bareHref(o.href) === e && o.title && (x.isStartOfResource(o.href) ? n.push(o) : a.push(o)), o.children?.items?.length) {
2939
+ const h = x.collectTocCandidates(
2940
+ o.children.items,
2941
+ e,
2942
+ i,
2943
+ r + 1
2944
+ );
2945
+ n.push(...h.atStart), a.push(...h.fragments);
2946
+ }
2947
+ return { atStart: n, fragments: a };
2948
+ }
2949
+ /**
2950
+ * A TOC href points to the start of its resource when it has no fragment,
2951
+ * or when the fragment is `t=0` (audio: explicit beginning of the file).
2952
+ */
2953
+ static isStartOfResource(t) {
2954
+ const e = t.split("#")[1];
2955
+ return e ? e === "t=0" : !0;
2956
+ }
2957
+ // -------------------------------------------------------------------------
2958
+ // Shared utilities
2959
+ // -------------------------------------------------------------------------
2960
+ static trimToDepth(t, e) {
2961
+ return t.map((i) => ({
2962
+ ...i,
2963
+ children: e > 1 && i.children?.length ? x.trimToDepth(i.children, e - 1) : void 0
2964
+ }));
2965
+ }
2966
+ flattenItems(t) {
2967
+ const e = [];
2968
+ for (const i of t)
2969
+ e.push(i), i.children && e.push(...this.flattenItems(i.children));
2970
+ return e;
2971
+ }
2972
+ itemMatchesTime(t, e, i) {
2973
+ for (const r of t.references) {
2974
+ const n = r.indexOf("#"), a = n >= 0 ? r.slice(0, n) : r, o = n >= 0 ? r.slice(n + 1) : void 0;
2975
+ if ((a || e) === e && i >= x.parseTimeFragment(o))
2976
+ return !0;
2977
+ }
2978
+ return !1;
2979
+ }
2980
+ static parseTimeFragment(t) {
2981
+ if (!t) return 0;
2982
+ const e = t.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
2983
+ return e ? parseFloat(e[1]) : 0;
2984
+ }
2985
+ bareHrefFromItem(t) {
2986
+ return (t.references[0] ?? "").split("#")[0];
2987
+ }
2988
+ timeFromItem(t) {
2989
+ const e = t.references[0];
2990
+ if (!e) return;
2991
+ const i = e.split("#")[1];
2992
+ if (!i) return;
2993
+ const r = i.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
2994
+ return r ? parseFloat(r[1]) : void 0;
2995
+ }
2996
+ ancestorPath(t, e) {
2997
+ for (const i of t) {
2998
+ if (i === e) return [];
2999
+ if (i.children) {
3000
+ const r = this.ancestorPath(i.children, e);
3001
+ if (r !== null) return [i, ...r];
3002
+ }
3003
+ }
3004
+ return null;
3005
+ }
3006
+ static bareHref(t) {
3007
+ return t.split("#")[0];
3008
+ }
3009
+ }
3010
+ class Y {
2814
3011
  constructor(t) {
2815
- this.fetcher = new ti(), t.fetcher && (this.fetcher = t.fetcher), this.manifest = t.manifest, this.context = t.manifest.context, this.metadata = t.manifest.metadata, this.links = t.manifest.links, this.readingOrder = t.manifest.readingOrder, this.resources = t.manifest.resources, this.toc = t.manifest.toc, this.subcollections = t.manifest.subcollections;
3012
+ this.fetcher = new ei(), t.fetcher && (this.fetcher = t.fetcher), this.manifest = t.manifest, this.context = t.manifest.context, this.metadata = t.manifest.metadata, this.links = t.manifest.links, this.readingOrder = t.manifest.readingOrder, this.resources = t.manifest.resources, this.toc = t.manifest.toc, this.subcollections = t.manifest.subcollections;
3013
+ }
3014
+ /**
3015
+ * Returns the publication's timeline, built from its reading order and table of contents.
3016
+ * Called with no arguments, the result is cached. Pass options to build a fresh timeline
3017
+ * with a specific configuration (e.g. a depth limit).
3018
+ */
3019
+ get timeline() {
3020
+ return this._timeline || (this._timeline = x.build(this)), this._timeline;
2816
3021
  }
2817
3022
  /** The URL where this publication is served, computed from the `Link` with `self` relation.
2818
3023
  * e.g. https://provider.com/pub1293/manifest.json gives https://provider.com/pub1293/
@@ -2872,7 +3077,7 @@ class _ {
2872
3077
  const e = await this.get(
2873
3078
  t
2874
3079
  ).readAsJSON();
2875
- return e.total ? e.positions.map((i) => k.deserialize(i)).filter((i) => i !== void 0) : [];
3080
+ return e.total ? e.positions.map((i) => D.deserialize(i)).filter((i) => i !== void 0) : [];
2876
3081
  }
2877
3082
  async guideForLink(t) {
2878
3083
  const e = (a) => a.alternates?.findWithMediaType(
@@ -2888,13 +3093,13 @@ class _ {
2888
3093
  )), !i) return;
2889
3094
  let r = i.href;
2890
3095
  if (i.templated) {
2891
- const a = new ht(r), o = {};
2892
- a.parameters.has("ref") && (o.ref = t.href), r = new ht(r).expand(o);
3096
+ const a = new ut(r), o = {};
3097
+ a.parameters.has("ref") && (o.ref = t.href), r = new ut(r).expand(o);
2893
3098
  }
2894
- const n = await this.get(new U({
3099
+ const n = await this.get(new M({
2895
3100
  href: r
2896
3101
  })).readAsJSON();
2897
- return $t.deserialize(n);
3102
+ return Xt.deserialize(n);
2898
3103
  }
2899
3104
  /**
2900
3105
  * Returns the resource targeted by the given non-templated [link].
@@ -2903,25 +3108,25 @@ class _ {
2903
3108
  return this.fetcher.get(t);
2904
3109
  }
2905
3110
  }
2906
- _.prototype.getPageList = function() {
3111
+ Y.prototype.getPageList = function() {
2907
3112
  return this.linksWithRole("pageList");
2908
3113
  };
2909
- _.prototype.getLandmarks = function() {
3114
+ Y.prototype.getLandmarks = function() {
2910
3115
  return this.linksWithRole("landmarks");
2911
3116
  };
2912
- _.prototype.getListOfAudioClips = function() {
3117
+ Y.prototype.getListOfAudioClips = function() {
2913
3118
  return this.linksWithRole("loa");
2914
3119
  };
2915
- _.prototype.getListOfIllustrations = function() {
3120
+ Y.prototype.getListOfIllustrations = function() {
2916
3121
  return this.linksWithRole("loi");
2917
3122
  };
2918
- _.prototype.getListOfTables = function() {
3123
+ Y.prototype.getListOfTables = function() {
2919
3124
  return this.linksWithRole("lot");
2920
3125
  };
2921
- _.prototype.getListOfVideoClips = function() {
3126
+ Y.prototype.getListOfVideoClips = function() {
2922
3127
  return this.linksWithRole("lov");
2923
3128
  };
2924
- class mt {
3129
+ class gt {
2925
3130
  /**
2926
3131
  * Creates a [DomRange].
2927
3132
  */
@@ -2936,7 +3141,7 @@ class mt {
2936
3141
  let e = L(t.textNodeIndex);
2937
3142
  if (e === void 0) return;
2938
3143
  let i = L(t.charOffset);
2939
- return i === void 0 && (i = L(t.offset)), new mt({
3144
+ return i === void 0 && (i = L(t.offset)), new gt({
2940
3145
  cssSelector: t.cssSelector,
2941
3146
  textNodeIndex: e,
2942
3147
  charOffset: i
@@ -2953,7 +3158,7 @@ class mt {
2953
3158
  return this.charOffset !== void 0 && (t.charOffset = this.charOffset), t;
2954
3159
  }
2955
3160
  }
2956
- class Xt {
3161
+ class Kt {
2957
3162
  /**
2958
3163
  * Creates a [DomRange].
2959
3164
  */
@@ -2965,11 +3170,11 @@ class Xt {
2965
3170
  */
2966
3171
  static deserialize(t) {
2967
3172
  if (!t) return;
2968
- let e = mt.deserialize(t.start);
3173
+ let e = gt.deserialize(t.start);
2969
3174
  if (e)
2970
- return new Xt({
3175
+ return new Kt({
2971
3176
  start: e,
2972
- end: mt.deserialize(t.end)
3177
+ end: gt.deserialize(t.end)
2973
3178
  });
2974
3179
  }
2975
3180
  /**
@@ -2987,7 +3192,7 @@ T.prototype.getPartialCfi = function() {
2987
3192
  return this.otherLocations?.get("partialCfi");
2988
3193
  };
2989
3194
  T.prototype.getDomRange = function() {
2990
- return Xt.deserialize(this.otherLocations?.get("domRange"));
3195
+ return Kt.deserialize(this.otherLocations?.get("domRange"));
2991
3196
  };
2992
3197
  T.prototype.fragmentParameters = function() {
2993
3198
  return new Map(
@@ -3021,7 +3226,7 @@ T.prototype.space = function() {
3021
3226
  if (t.length === 4 && !t.some(isNaN))
3022
3227
  return t;
3023
3228
  };
3024
- class Kt {
3229
+ class Zt {
3025
3230
  /** Creates a [Price]. */
3026
3231
  constructor(t) {
3027
3232
  this.currency = t.currency, this.value = t.value;
@@ -3036,7 +3241,7 @@ class Kt {
3036
3241
  return;
3037
3242
  let i = L(t.value);
3038
3243
  if (i !== void 0)
3039
- return new Kt({ currency: e, value: i });
3244
+ return new Zt({ currency: e, value: i });
3040
3245
  }
3041
3246
  /**
3042
3247
  * Serializes a [Price] to its RWPM JSON representation.
@@ -3045,7 +3250,7 @@ class Kt {
3045
3250
  return { currency: this.currency, value: this.value };
3046
3251
  }
3047
3252
  }
3048
- class j {
3253
+ class tt {
3049
3254
  /** Creates a [Acquisition]. */
3050
3255
  constructor(t) {
3051
3256
  this.type = t.type, this.children = t.children;
@@ -3055,14 +3260,14 @@ class j {
3055
3260
  */
3056
3261
  static deserialize(t) {
3057
3262
  if (t && t.type)
3058
- return new j({
3263
+ return new tt({
3059
3264
  type: t.type,
3060
- children: j.deserializeArray(t.children)
3265
+ children: tt.deserializeArray(t.children)
3061
3266
  });
3062
3267
  }
3063
3268
  static deserializeArray(t) {
3064
3269
  if (Array.isArray(t))
3065
- return t.map((e) => j.deserialize(e)).filter((e) => e !== void 0);
3270
+ return t.map((e) => tt.deserialize(e)).filter((e) => e !== void 0);
3066
3271
  }
3067
3272
  /**
3068
3273
  * Serializes a [Acquisition] to its RWPM JSON representation.
@@ -3072,7 +3277,7 @@ class j {
3072
3277
  return this.children && (t.children = this.children.map((e) => e.serialize())), t;
3073
3278
  }
3074
3279
  }
3075
- class Zt {
3280
+ class Jt {
3076
3281
  /** Creates a [Price]. */
3077
3282
  constructor(t) {
3078
3283
  this.total = t.total, this.position = t.position;
@@ -3082,7 +3287,7 @@ class Zt {
3082
3287
  */
3083
3288
  static deserialize(t) {
3084
3289
  if (t)
3085
- return new Zt({
3290
+ return new Jt({
3086
3291
  total: L(t.total),
3087
3292
  position: L(t.position)
3088
3293
  });
@@ -3095,7 +3300,7 @@ class Zt {
3095
3300
  return this.total !== void 0 && (t.total = this.total), this.position !== void 0 && (t.position = this.position), t;
3096
3301
  }
3097
3302
  }
3098
- class Jt {
3303
+ class qt {
3099
3304
  /** Creates a [Copies]. */
3100
3305
  constructor(t) {
3101
3306
  this.total = t.total, this.available = t.available;
@@ -3105,7 +3310,7 @@ class Jt {
3105
3310
  */
3106
3311
  static deserialize(t) {
3107
3312
  if (t)
3108
- return new Jt({
3313
+ return new qt({
3109
3314
  total: L(t.total),
3110
3315
  available: L(t.available)
3111
3316
  });
@@ -3118,8 +3323,8 @@ class Jt {
3118
3323
  return this.total !== void 0 && (t.total = this.total), this.available !== void 0 && (t.available = this.available), t;
3119
3324
  }
3120
3325
  }
3121
- var Di = /* @__PURE__ */ ((s) => (s.available = "available", s.reserved = "reserved", s.ready = "ready", s))(Di || {});
3122
- class qt {
3326
+ var Ui = /* @__PURE__ */ ((s) => (s.available = "available", s.reserved = "reserved", s.ready = "ready", s))(Ui || {});
3327
+ class Qt {
3123
3328
  /** Creates a [Availability]. */
3124
3329
  constructor(t) {
3125
3330
  this.state = t.state, this.since = t.since, this.until = t.until;
@@ -3129,10 +3334,10 @@ class qt {
3129
3334
  */
3130
3335
  static deserialize(t) {
3131
3336
  if (t && t.state)
3132
- return new qt({
3337
+ return new Qt({
3133
3338
  state: t.state,
3134
- since: ct(t.since),
3135
- until: ct(t.until)
3339
+ since: lt(t.since),
3340
+ until: lt(t.until)
3136
3341
  });
3137
3342
  }
3138
3343
  /**
@@ -3143,33 +3348,33 @@ class qt {
3143
3348
  return this.since !== void 0 && (t.since = this.since.toISOString()), this.until !== void 0 && (t.until = this.until.toISOString()), t;
3144
3349
  }
3145
3350
  }
3146
- D.prototype.getNumberOfItems = function() {
3351
+ U.prototype.getNumberOfItems = function() {
3147
3352
  return L(this.otherProperties.numberOfItems);
3148
3353
  };
3149
- D.prototype.getPrice = function() {
3150
- return Kt.deserialize(this.otherProperties.price);
3354
+ U.prototype.getPrice = function() {
3355
+ return Zt.deserialize(this.otherProperties.price);
3151
3356
  };
3152
- D.prototype.getIndirectAcquisitions = function() {
3357
+ U.prototype.getIndirectAcquisitions = function() {
3153
3358
  const s = this.otherProperties.indirectAcquisition;
3154
3359
  if (s && Array.isArray(s))
3155
- return s.map((t) => j.deserialize(t)).filter((t) => t !== void 0);
3360
+ return s.map((t) => tt.deserialize(t)).filter((t) => t !== void 0);
3156
3361
  };
3157
- D.prototype.getHolds = function() {
3158
- return Zt.deserialize(this.otherProperties.holds);
3362
+ U.prototype.getHolds = function() {
3363
+ return Jt.deserialize(this.otherProperties.holds);
3159
3364
  };
3160
- D.prototype.getCopies = function() {
3161
- return Jt.deserialize(this.otherProperties.copies);
3365
+ U.prototype.getCopies = function() {
3366
+ return qt.deserialize(this.otherProperties.copies);
3162
3367
  };
3163
- D.prototype.getAvailability = function() {
3164
- return qt.deserialize(this.otherProperties.availability);
3368
+ U.prototype.getAvailability = function() {
3369
+ return Qt.deserialize(this.otherProperties.availability);
3165
3370
  };
3166
- D.prototype.getAuthenticate = function() {
3167
- return U.deserialize(this.otherProperties.authenticate);
3371
+ U.prototype.getAuthenticate = function() {
3372
+ return M.deserialize(this.otherProperties.authenticate);
3168
3373
  };
3169
- _.prototype.getImages = function() {
3374
+ Y.prototype.getImages = function() {
3170
3375
  return this.linksWithRole("images");
3171
3376
  };
3172
- class nr {
3377
+ class ar {
3173
3378
  /**
3174
3379
  * Extracts the full raw text, or returns null if no text content can be found.
3175
3380
  * @param separator Separator to use between individual elements. Defaults to newline.
@@ -3188,13 +3393,13 @@ class nr {
3188
3393
  return t;
3189
3394
  }
3190
3395
  }
3191
- class ae {
3396
+ class oe {
3192
3397
  constructor(t, e) {
3193
3398
  this.key = t, this.value = e;
3194
3399
  }
3195
3400
  }
3196
- var Ot = /* @__PURE__ */ ((s) => (s.ACCESSIBILITY_LABEL = "accessibilityLabel", s.LANGUAGE = "language", s))(Ot || {});
3197
- class pe {
3401
+ var zt = /* @__PURE__ */ ((s) => (s.ACCESSIBILITY_LABEL = "accessibilityLabel", s.LANGUAGE = "language", s))(zt || {});
3402
+ class me {
3198
3403
  constructor(t = []) {
3199
3404
  this._attributes = t;
3200
3405
  }
@@ -3223,12 +3428,12 @@ class pe {
3223
3428
  return this._attributes.filter((e) => e.key === t).map((e) => e.value);
3224
3429
  }
3225
3430
  }
3226
- class me extends pe {
3431
+ class ge extends me {
3227
3432
  constructor(t, e = []) {
3228
3433
  super(e), this.locator = t;
3229
3434
  }
3230
3435
  }
3231
- class At extends me {
3436
+ class yt extends ge {
3232
3437
  /**
3233
3438
  * Human-readable text representation for this element.
3234
3439
  */
@@ -3236,17 +3441,17 @@ class At extends me {
3236
3441
  return this.accessibilityLabel;
3237
3442
  }
3238
3443
  }
3239
- class Ui extends At {
3444
+ class Mi extends yt {
3240
3445
  constructor(t, e, i = []) {
3241
3446
  super(t, i), this.embeddedLink = e;
3242
3447
  }
3243
3448
  }
3244
- class Mi extends At {
3449
+ class Bi extends yt {
3245
3450
  constructor(t, e, i = []) {
3246
3451
  super(t, i), this.embeddedLink = e;
3247
3452
  }
3248
3453
  }
3249
- class Bi extends At {
3454
+ class Gi extends yt {
3250
3455
  constructor(t, e, i, r = []) {
3251
3456
  super(t, r), this.embeddedLink = e, this.caption = i;
3252
3457
  }
@@ -3254,12 +3459,12 @@ class Bi extends At {
3254
3459
  return (this.caption?.length || 0) > 0 ? this.caption : super.text;
3255
3460
  }
3256
3461
  }
3257
- class ge extends pe {
3462
+ class be extends me {
3258
3463
  constructor(t, e, i = []) {
3259
3464
  super(i), this.locator = t, this.text = e;
3260
3465
  }
3261
3466
  }
3262
- class zt extends At {
3467
+ class Ct extends yt {
3263
3468
  constructor(t, e, i, r = []) {
3264
3469
  super(t, r), this.role = e, this.segments = i;
3265
3470
  }
@@ -3267,7 +3472,7 @@ class zt extends At {
3267
3472
  return this.segments.map((t) => t.text).join("");
3268
3473
  }
3269
3474
  }
3270
- class Gi {
3475
+ class Wi {
3271
3476
  constructor(t) {
3272
3477
  this.level = t;
3273
3478
  }
@@ -3275,17 +3480,17 @@ class Gi {
3275
3480
  return `heading-${this.level}`;
3276
3481
  }
3277
3482
  }
3278
- const Wi = {
3483
+ const Hi = {
3279
3484
  role: "body"
3280
- }, Hi = {
3485
+ }, Fi = {
3281
3486
  role: "footnote"
3282
3487
  };
3283
- class Fi {
3488
+ class _i {
3284
3489
  constructor(t, e) {
3285
3490
  this.referenceUrl = t, this.referenceTitle = e, this.role = "quote";
3286
3491
  }
3287
3492
  }
3288
- class ar {
3493
+ class or {
3289
3494
  /**
3290
3495
  *
3291
3496
  * @param defaultLanguage The default assumed language
@@ -3297,8 +3502,8 @@ class ar {
3297
3502
  this.defaultLanguage = t, this.contextSnippetLength = i, this.textTokenizerFactory = r;
3298
3503
  }
3299
3504
  tokenize(t) {
3300
- return t instanceof zt ? [
3301
- new zt(
3505
+ return t instanceof Ct ? [
3506
+ new Ct(
3302
3507
  t.locator,
3303
3508
  t.role,
3304
3509
  t.segments.map((e) => this.tokenizeSegment(e)).flat()
@@ -3306,8 +3511,8 @@ class ar {
3306
3511
  ] : [t];
3307
3512
  }
3308
3513
  tokenizeSegment(t) {
3309
- return this.textTokenizerFactory(t.language ?? this.defaultLanguage).tokenize(t.text).map((e) => new ge(
3310
- new k({
3514
+ return this.textTokenizerFactory(t.language ?? this.defaultLanguage).tokenize(t.text).map((e) => new be(
3515
+ new D({
3311
3516
  href: t.locator.href,
3312
3517
  type: t.locator.type,
3313
3518
  title: t.locator.title,
@@ -3320,19 +3525,19 @@ class ar {
3320
3525
  }
3321
3526
  extractTextContextIn(t, e) {
3322
3527
  const i = t.substring(e[1], e[1] + this.contextSnippetLength), r = t.substring(e[0] - this.contextSnippetLength, e[0]);
3323
- return new rt({
3528
+ return new nt({
3324
3529
  after: i.length > 0 ? i : void 0,
3325
3530
  before: r.length > 0 ? r : void 0,
3326
3531
  highlight: t.substring(e[0], e[1])
3327
3532
  });
3328
3533
  }
3329
3534
  }
3330
- class et extends Error {
3535
+ class it extends Error {
3331
3536
  constructor(t) {
3332
3537
  super(t);
3333
3538
  }
3334
3539
  }
3335
- class Qt {
3540
+ class jt {
3336
3541
  /**
3337
3542
  * Advances to the next item and returns it, or null if we reached the end.
3338
3543
  */
@@ -3351,7 +3556,7 @@ let Vi = class {
3351
3556
  this.element = t, this.direction = e;
3352
3557
  }
3353
3558
  };
3354
- class cr extends Qt {
3559
+ class lr extends jt {
3355
3560
  constructor(t, e, i) {
3356
3561
  super(), this.publication = t, this.startLocator = e, this.resourceContentIteratorFactories = i, this._currentIterator = null, this.currentElement = null;
3357
3562
  }
@@ -3362,7 +3567,7 @@ class cr extends Qt {
3362
3567
  ), this.currentElement !== null;
3363
3568
  }
3364
3569
  previous() {
3365
- if (this.currentElement?.direction !== -1) throw new et("Called previous() without a successful call to hasPrevious() first");
3570
+ if (this.currentElement?.direction !== -1) throw new it("Called previous() without a successful call to hasPrevious() first");
3366
3571
  return this.currentElement.element;
3367
3572
  }
3368
3573
  async hasNext() {
@@ -3372,7 +3577,7 @@ class cr extends Qt {
3372
3577
  ), this.currentElement !== null;
3373
3578
  }
3374
3579
  next() {
3375
- if (this.currentElement?.direction !== 1) throw new et("Called next() without a successful call to hasNext() first");
3580
+ if (this.currentElement?.direction !== 1) throw new it("Called next() without a successful call to hasNext() first");
3376
3581
  return this.currentElement.element;
3377
3582
  }
3378
3583
  async nextIn(t) {
@@ -3422,7 +3627,7 @@ class cr extends Qt {
3422
3627
  return null;
3423
3628
  }
3424
3629
  }
3425
- class wt extends me {
3630
+ class St extends ge {
3426
3631
  constructor(t, e, i = []) {
3427
3632
  super(t, i), this.element = e;
3428
3633
  }
@@ -3430,24 +3635,24 @@ class wt extends me {
3430
3635
  return this.element.text;
3431
3636
  }
3432
3637
  }
3433
- class oe {
3638
+ class ce {
3434
3639
  constructor(t, e) {
3435
3640
  this.element = t, this.direction = e;
3436
3641
  }
3437
3642
  }
3438
- class lr extends Qt {
3643
+ class hr extends jt {
3439
3644
  constructor(t, e) {
3440
3645
  super(), this.pageContent = t, this.startLocator = e, this.pageContentFiltered = [], this.currentElement = null, this.currentProgression = 0, this.currentElementIndex = 0;
3441
3646
  const i = this.pageContent.filter(
3442
3647
  (r) => r?.str !== " " && r?.str !== ""
3443
3648
  );
3444
- if (this.pageContentFiltered = i.map((r) => new wt(r.locator, {
3649
+ if (this.pageContentFiltered = i.map((r) => new St(r.locator, {
3445
3650
  index: i.indexOf(r),
3446
3651
  text: r.str,
3447
3652
  readingDirection: r.dir
3448
3653
  })), this.startLocator && (this.currentProgression = this.startLocator?.locations?.progression || 0, this.updateElementIndex()), this.pageContentFiltered.length > 0) {
3449
3654
  const r = this.currentElementIndex;
3450
- (r || r === 0) && (this.currentElement = new oe(
3655
+ (r || r === 0) && (this.currentElement = new ce(
3451
3656
  this.pageContentFiltered[r],
3452
3657
  1
3453
3658
  /* Forward */
@@ -3465,7 +3670,7 @@ class lr extends Qt {
3465
3670
  ) !== null;
3466
3671
  }
3467
3672
  previous() {
3468
- if (!this.currentElement) throw new et("Called next() without a successful call to hasNext() first");
3673
+ if (!this.currentElement) throw new it("Called next() without a successful call to hasNext() first");
3469
3674
  if (this.currentElement = this.nextIn(
3470
3675
  -1
3471
3676
  /* Backward */
@@ -3473,7 +3678,7 @@ class lr extends Qt {
3473
3678
  const t = this.currentElementIndex - 1;
3474
3679
  this.currentProgression = t / this.pageContentFiltered.length * 100, this.currentElementIndex = t;
3475
3680
  }
3476
- return this.currentElement ? this.currentElement.element : new wt(new k({ href: "", type: "" }), { index: -1, text: "" });
3681
+ return this.currentElement ? this.currentElement.element : new St(new D({ href: "", type: "" }), { index: -1, text: "" });
3477
3682
  }
3478
3683
  async hasNext() {
3479
3684
  return this.currentElement?.direction, this.nextIn(
@@ -3491,13 +3696,13 @@ class lr extends Qt {
3491
3696
  const e = t + 1;
3492
3697
  this.currentProgression = e / this.pageContentFiltered.length * 100, this.currentElementIndex = e;
3493
3698
  }
3494
- return this.currentElement ? this.currentElement.element : new wt(new k({ href: "", type: "" }), { index: -1, text: "" });
3699
+ return this.currentElement ? this.currentElement.element : new St(new D({ href: "", type: "" }), { index: -1, text: "" });
3495
3700
  }
3496
3701
  nextIn(t) {
3497
3702
  const e = this.currentElementIndex;
3498
3703
  if (e === null || e === this.pageContentFiltered.length - 1 && t === 1 || e === 0 && t === -1) return null;
3499
3704
  const i = this.pageContentFiltered[e + t];
3500
- return i ? new oe(i, t) : null;
3705
+ return i ? new ce(i, t) : null;
3501
3706
  }
3502
3707
  /**
3503
3708
  * Updates the current [PDFReadableElement] position in the pageContentFiltered array
@@ -3507,7 +3712,7 @@ class lr extends Qt {
3507
3712
  return this.currentProgression === 0 ? 0 : this.currentProgression < 0 || this.currentProgression >= 100 ? null : Math.floor(this.currentProgression * this.pageContentFiltered.length / 100);
3508
3713
  }
3509
3714
  }
3510
- const _i = [
3715
+ const Yi = [
3511
3716
  "OBJECT",
3512
3717
  "BASE",
3513
3718
  "FONT",
@@ -3575,10 +3780,10 @@ const _i = [
3575
3780
  "NOBR",
3576
3781
  "RB"
3577
3782
  ];
3578
- function ce(s) {
3579
- return _i.includes(s.nodeName.toUpperCase());
3783
+ function le(s) {
3784
+ return Yi.includes(s.nodeName.toUpperCase());
3580
3785
  }
3581
- function St(s, t) {
3786
+ function Et(s, t) {
3582
3787
  const e = s.getAttribute("src");
3583
3788
  if (!e?.length) return null;
3584
3789
  try {
@@ -3587,15 +3792,15 @@ function St(s, t) {
3587
3792
  return e;
3588
3793
  }
3589
3794
  }
3590
- const it = "[\\s\\u0085\\u00A0\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]", Yi = new RegExp(`^${it}+$`, "g"), $i = new RegExp(`^${it}+|${it}+$/g`, "g"), be = new RegExp(`^${it}+`, "g"), ve = new RegExp(`${it}+$`, "g"), ot = (s) => (
3795
+ 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) => (
3591
3796
  // 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
3592
- s?.length ? Yi.test(s) : !0
3593
- ), Ae = (s) => s.replace($i, ""), Xi = (s) => s.replace(be, ""), Ki = (s) => s.replace(ve, ""), le = (s, t = "") => new rt({
3594
- before: t + (be.exec(s)?.[0] ?? ""),
3595
- highlight: Ae(s),
3596
- after: ve.exec(s)?.[0] ?? ""
3797
+ s?.length ? $i.test(s) : !0
3798
+ ), ye = (s) => s.replace(Xi, ""), Ki = (s) => s.replace(ve, ""), Zi = (s) => s.replace(Ae, ""), he = (s, t = "") => new nt({
3799
+ before: t + (ve.exec(s)?.[0] ?? ""),
3800
+ highlight: ye(s),
3801
+ after: Ae.exec(s)?.[0] ?? ""
3597
3802
  });
3598
- function Zi(s) {
3803
+ function Ji(s) {
3599
3804
  for (; s; ) {
3600
3805
  let t = s.getAttribute("lang") || s.getAttributeNS("http://www.w3.org/1999/xhtml", "lang") || s.getAttributeNS("http://www.w3.org/XML/1998/namespace", "lang");
3601
3806
  if (t) return t;
@@ -3603,11 +3808,11 @@ function Zi(s) {
3603
3808
  }
3604
3809
  return null;
3605
3810
  }
3606
- function Ji(s, t) {
3811
+ function qi(s, t) {
3607
3812
  const e = s.length > 0 && s[s.length - 1] === " ";
3608
3813
  let i = !1, r = !1;
3609
3814
  for (let n = 0; n < t.length; n++)
3610
- if (ot(t[n])) {
3815
+ if (ct(t[n])) {
3611
3816
  if (e && !r || i)
3612
3817
  continue;
3613
3818
  s += " ", i = !0;
@@ -3617,10 +3822,10 @@ function Ji(s, t) {
3617
3822
  }
3618
3823
  return s;
3619
3824
  }
3620
- function ye(s) {
3825
+ function we(s) {
3621
3826
  return typeof s == "object" && s !== null && s.nodeType === Node.ELEMENT_NODE;
3622
3827
  }
3623
- const gt = {
3828
+ const bt = {
3624
3829
  NONE: "",
3625
3830
  DESCENDANT: " ",
3626
3831
  CHILD: " > "
@@ -3632,14 +3837,14 @@ const gt = {
3632
3837
  nthchild: "nthchild",
3633
3838
  nthoftype: "nthoftype"
3634
3839
  };
3635
- function qi(s, t) {
3840
+ function Qi(s, t) {
3636
3841
  return Object.values(s).includes(t);
3637
3842
  }
3638
- const Qi = "CssSelectorGenerator";
3639
- function bt(s = "unknown problem", ...t) {
3640
- console.warn(`${Qi}: ${s}`, ...t);
3843
+ const ji = "CssSelectorGenerator";
3844
+ function vt(s = "unknown problem", ...t) {
3845
+ console.warn(`${ji}: ${s}`, ...t);
3641
3846
  }
3642
- const ji = {
3847
+ const ts = {
3643
3848
  selectors: [
3644
3849
  E.id,
3645
3850
  E.class,
@@ -3657,165 +3862,165 @@ const ji = {
3657
3862
  maxCandidates: Number.POSITIVE_INFINITY,
3658
3863
  useScope: !1
3659
3864
  };
3660
- function ts(s) {
3661
- return Array.isArray(s) ? s.filter((t) => qi(E, t)) : [];
3865
+ function es(s) {
3866
+ return Array.isArray(s) ? s.filter((t) => Qi(E, t)) : [];
3662
3867
  }
3663
- function we(s) {
3868
+ function Se(s) {
3664
3869
  return s instanceof RegExp;
3665
3870
  }
3666
- function es(s) {
3667
- return ["string", "function"].includes(typeof s) || we(s);
3871
+ function is(s) {
3872
+ return ["string", "function"].includes(typeof s) || Se(s);
3668
3873
  }
3669
- function he(s) {
3670
- return Array.isArray(s) ? s.filter(es) : [];
3874
+ function ue(s) {
3875
+ return Array.isArray(s) ? s.filter(is) : [];
3671
3876
  }
3672
- function is(s) {
3877
+ function ss(s) {
3673
3878
  return s instanceof Node;
3674
3879
  }
3675
- function ue(s) {
3880
+ function de(s) {
3676
3881
  const t = [
3677
3882
  Node.DOCUMENT_NODE,
3678
3883
  Node.DOCUMENT_FRAGMENT_NODE,
3679
3884
  // this includes Shadow DOM root
3680
3885
  Node.ELEMENT_NODE
3681
3886
  ];
3682
- return is(s) && t.includes(s.nodeType);
3887
+ return ss(s) && t.includes(s.nodeType);
3683
3888
  }
3684
- function Se(s, t) {
3685
- if (ue(s))
3686
- return s.contains(t) || bt("element root mismatch", "Provided root does not contain the element. This will most likely result in producing a fallback selector using element's real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended."), s;
3889
+ function Ee(s, t) {
3890
+ if (de(s))
3891
+ return s.contains(t) || vt("element root mismatch", "Provided root does not contain the element. This will most likely result in producing a fallback selector using element's real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended."), s;
3687
3892
  const e = t.getRootNode({ composed: !1 });
3688
- return ue(e) ? (e !== document && bt("shadow root inferred", "You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."), e) : te(t);
3893
+ return de(e) ? (e !== document && vt("shadow root inferred", "You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."), e) : ee(t);
3689
3894
  }
3690
- function Et(s) {
3895
+ function Tt(s) {
3691
3896
  return typeof s == "number" ? s : Number.POSITIVE_INFINITY;
3692
3897
  }
3693
- function ss(s, t = {}) {
3694
- const e = Object.assign(Object.assign({}, ji), t);
3898
+ function rs(s, t = {}) {
3899
+ const e = Object.assign(Object.assign({}, ts), t);
3695
3900
  return {
3696
- selectors: ts(e.selectors),
3697
- whitelist: he(e.whitelist),
3698
- blacklist: he(e.blacklist),
3699
- root: Se(e.root, s),
3901
+ selectors: es(e.selectors),
3902
+ whitelist: ue(e.whitelist),
3903
+ blacklist: ue(e.blacklist),
3904
+ root: Ee(e.root, s),
3700
3905
  combineWithinSelector: !!e.combineWithinSelector,
3701
3906
  combineBetweenSelectors: !!e.combineBetweenSelectors,
3702
3907
  includeTag: !!e.includeTag,
3703
- maxCombinations: Et(e.maxCombinations),
3704
- maxCandidates: Et(e.maxCandidates),
3908
+ maxCombinations: Tt(e.maxCombinations),
3909
+ maxCandidates: Tt(e.maxCandidates),
3705
3910
  useScope: !!e.useScope,
3706
- maxResults: Et(e.maxResults)
3911
+ maxResults: Tt(e.maxResults)
3707
3912
  };
3708
3913
  }
3709
- function nt(s = []) {
3914
+ function at(s = []) {
3710
3915
  const [t = [], ...e] = s;
3711
3916
  return e.length === 0 ? t : e.reduce((i, r) => i.filter((n) => r.includes(n)), t);
3712
3917
  }
3713
- function rs(s) {
3918
+ function ns(s) {
3714
3919
  return [].concat(...s);
3715
3920
  }
3716
- function ns(s) {
3921
+ function as(s) {
3717
3922
  return s.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
3718
3923
  }
3719
3924
  function Rt(s) {
3720
3925
  const t = s.map((e) => {
3721
- if (we(e))
3926
+ if (Se(e))
3722
3927
  return (i) => e.test(i);
3723
3928
  if (typeof e == "function")
3724
3929
  return (i) => {
3725
3930
  const r = e(i);
3726
- return typeof r != "boolean" ? (bt("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : r;
3931
+ 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;
3727
3932
  };
3728
3933
  if (typeof e == "string") {
3729
- const i = new RegExp("^" + ns(e) + "$");
3934
+ const i = new RegExp("^" + as(e) + "$");
3730
3935
  return (r) => i.test(r);
3731
3936
  }
3732
- return bt("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
3937
+ 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;
3733
3938
  });
3734
3939
  return (e) => t.some((i) => i(e));
3735
3940
  }
3736
- function jt(s, t, e) {
3737
- const i = Array.from(Se(e, s[0]).querySelectorAll(t));
3941
+ function te(s, t, e) {
3942
+ const i = Array.from(Ee(e, s[0]).querySelectorAll(t));
3738
3943
  return i.length === s.length && s.every((r) => i.includes(r));
3739
3944
  }
3740
- function Ee(s, t) {
3741
- t = t ?? te(s);
3945
+ function Te(s, t) {
3946
+ t = t ?? ee(s);
3742
3947
  const e = [];
3743
3948
  let i = s;
3744
- for (; ye(i) && i !== t; )
3949
+ for (; we(i) && i !== t; )
3745
3950
  e.push(i), i = i.parentElement;
3746
3951
  return e;
3747
3952
  }
3748
- function as(s, t) {
3749
- return nt(s.map((e) => Ee(e, t)));
3953
+ function os(s, t) {
3954
+ return at(s.map((e) => Te(e, t)));
3750
3955
  }
3751
- function te(s) {
3956
+ function ee(s) {
3752
3957
  return s.ownerDocument.querySelector(":root");
3753
3958
  }
3754
- const Te = ", ", os = new RegExp([
3959
+ const Ie = ", ", cs = new RegExp([
3755
3960
  "^$",
3756
3961
  // empty or not set
3757
3962
  "\\s"
3758
3963
  // contains whitespace
3759
- ].join("|")), cs = new RegExp([
3964
+ ].join("|")), ls = new RegExp([
3760
3965
  "^$"
3761
3966
  // empty or not set
3762
- ].join("|")), Ie = [
3967
+ ].join("|")), xe = [
3763
3968
  E.nthoftype,
3764
3969
  E.tag,
3765
3970
  E.id,
3766
3971
  E.class,
3767
3972
  E.attribute,
3768
3973
  E.nthchild
3769
- ], ls = Rt([
3974
+ ], hs = Rt([
3770
3975
  "class",
3771
3976
  "id",
3772
3977
  // Angular attributes
3773
3978
  "ng-*"
3774
3979
  ]);
3775
- function hs({ name: s }) {
3980
+ function us({ name: s }) {
3776
3981
  return `[${s}]`;
3777
3982
  }
3778
- function us({ name: s, value: t }) {
3983
+ function ds({ name: s, value: t }) {
3779
3984
  return `[${s}='${t}']`;
3780
3985
  }
3781
- function ds({ nodeName: s, nodeValue: t }, e) {
3986
+ function fs({ nodeName: s, nodeValue: t }, e) {
3782
3987
  const i = e.tagName.toLowerCase();
3783
- return ["input", "option"].includes(i) && s === "value" || s === "src" && t?.startsWith("data:") ? !1 : !ls(s);
3988
+ return ["input", "option"].includes(i) && s === "value" || s === "src" && t?.startsWith("data:") ? !1 : !hs(s);
3784
3989
  }
3785
- function fs({ nodeName: s, nodeValue: t }) {
3990
+ function ps({ nodeName: s, nodeValue: t }) {
3786
3991
  return {
3787
- name: st(s),
3788
- value: st(t ?? void 0)
3992
+ name: rt(s),
3993
+ value: rt(t ?? void 0)
3789
3994
  };
3790
3995
  }
3791
- function xe(s) {
3792
- const t = Array.from(s.attributes).filter((e) => ds(e, s)).map(fs);
3996
+ function Ne(s) {
3997
+ const t = Array.from(s.attributes).filter((e) => fs(e, s)).map(ps);
3793
3998
  return [
3794
- ...t.map(hs),
3795
- ...t.map(us)
3999
+ ...t.map(us),
4000
+ ...t.map(ds)
3796
4001
  ];
3797
4002
  }
3798
- function ps(s) {
3799
- const t = s.map(xe);
3800
- return nt(t);
4003
+ function ms(s) {
4004
+ const t = s.map(Ne);
4005
+ return at(t);
3801
4006
  }
3802
- function Ne(s) {
4007
+ function Oe(s) {
3803
4008
  var t;
3804
- return ((t = s.getAttribute("class")) !== null && t !== void 0 ? t : "").trim().split(/\s+/).filter((e) => !cs.test(e)).map((e) => `.${st(e)}`);
4009
+ return ((t = s.getAttribute("class")) !== null && t !== void 0 ? t : "").trim().split(/\s+/).filter((e) => !ls.test(e)).map((e) => `.${rt(e)}`);
3805
4010
  }
3806
- function ms(s) {
3807
- const t = s.map(Ne);
3808
- return nt(t);
4011
+ function gs(s) {
4012
+ const t = s.map(Oe);
4013
+ return at(t);
3809
4014
  }
3810
4015
  function Le(s) {
3811
4016
  var t;
3812
- const e = (t = s.getAttribute("id")) !== null && t !== void 0 ? t : "", i = `#${st(e)}`, r = s.getRootNode({ composed: !1 });
3813
- return !os.test(e) && jt([s], i, r) ? [i] : [];
4017
+ const e = (t = s.getAttribute("id")) !== null && t !== void 0 ? t : "", i = `#${rt(e)}`, r = s.getRootNode({ composed: !1 });
4018
+ return !cs.test(e) && te([s], i, r) ? [i] : [];
3814
4019
  }
3815
- function gs(s) {
4020
+ function bs(s) {
3816
4021
  return s.length === 0 || s.length > 1 ? [] : Le(s[0]);
3817
4022
  }
3818
- function Oe(s) {
4023
+ function ze(s) {
3819
4024
  var t;
3820
4025
  const e = (t = s.parentElement) === null || t === void 0 ? void 0 : t.children;
3821
4026
  if (e) {
@@ -3825,21 +4030,21 @@ function Oe(s) {
3825
4030
  }
3826
4031
  return [];
3827
4032
  }
3828
- function bs(s) {
3829
- return nt(s.map(Oe));
4033
+ function vs(s) {
4034
+ return at(s.map(ze));
3830
4035
  }
3831
- function ze(s) {
4036
+ function Ce(s) {
3832
4037
  return [
3833
- st(s.tagName.toLowerCase())
4038
+ rt(s.tagName.toLowerCase())
3834
4039
  ];
3835
4040
  }
3836
4041
  function Re(s) {
3837
4042
  const t = [
3838
- ...new Set(rs(s.map(ze)))
4043
+ ...new Set(ns(s.map(Ce)))
3839
4044
  ];
3840
4045
  return t.length === 0 || t.length > 1 ? [] : [t[0]];
3841
4046
  }
3842
- function Ce(s) {
4047
+ function Pe(s) {
3843
4048
  const t = Re([s])[0], e = s.parentElement;
3844
4049
  if (e) {
3845
4050
  const r = Array.from(e.children).filter((n) => n.tagName.toLowerCase() === t).indexOf(s);
@@ -3850,18 +4055,18 @@ function Ce(s) {
3850
4055
  }
3851
4056
  return [];
3852
4057
  }
3853
- function vs(s) {
3854
- return nt(s.map(Ce));
4058
+ function As(s) {
4059
+ return at(s.map(Pe));
3855
4060
  }
3856
- function* Pe(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
3857
- let e = 0, i = Ct(1);
4061
+ function* ke(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
4062
+ let e = 0, i = Pt(1);
3858
4063
  for (; i.length <= s.length && e < t; )
3859
- e += 1, yield i.map((n) => s[n]), i = ys(i, s.length - 1);
4064
+ e += 1, yield i.map((n) => s[n]), i = ws(i, s.length - 1);
3860
4065
  }
3861
- function As(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
3862
- return Array.from(Pe(s, { maxResults: t }));
4066
+ function ys(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
4067
+ return Array.from(ke(s, { maxResults: t }));
3863
4068
  }
3864
- function ys(s = [], t = 0) {
4069
+ function ws(s = [], t = 0) {
3865
4070
  const e = s.length;
3866
4071
  if (e === 0)
3867
4072
  return [];
@@ -3870,15 +4075,15 @@ function ys(s = [], t = 0) {
3870
4075
  for (let r = e - 1; r >= 0; r--)
3871
4076
  if (i[r] > t) {
3872
4077
  if (r === 0)
3873
- return Ct(e + 1);
4078
+ return Pt(e + 1);
3874
4079
  i[r - 1]++, i[r] = i[r - 1] + 1;
3875
4080
  }
3876
- return i[e - 1] > t ? Ct(e + 1) : i;
4081
+ return i[e - 1] > t ? Pt(e + 1) : i;
3877
4082
  }
3878
- function Ct(s = 1) {
4083
+ function Pt(s = 1) {
3879
4084
  return Array.from(Array(s).keys());
3880
4085
  }
3881
- function* ws(s = {}) {
4086
+ function* Ss(s = {}) {
3882
4087
  const t = Object.entries(s);
3883
4088
  if (t.length === 0)
3884
4089
  return;
@@ -3902,158 +4107,158 @@ function* ws(s = {}) {
3902
4107
  });
3903
4108
  }
3904
4109
  }
3905
- const Ss = "3a".toUpperCase(), Es = /[ !"#$%&'()\[\]{|}<>*+,./;=?@^`~\\]/;
3906
- function st(s = "") {
3907
- return CSS ? CSS.escape(s) : Ts(s);
4110
+ const Es = "3a".toUpperCase(), Ts = /[ !"#$%&'()\[\]{|}<>*+,./;=?@^`~\\]/;
4111
+ function rt(s = "") {
4112
+ return CSS ? CSS.escape(s) : Is(s);
3908
4113
  }
3909
- function Ts(s = "") {
3910
- return s.split("").map((t) => t === ":" ? `\\${Ss} ` : Es.test(t) ? `\\${t}` : escape(t).replace(/%/g, "\\")).join("");
4114
+ function Is(s = "") {
4115
+ return s.split("").map((t) => t === ":" ? `\\${Es} ` : Ts.test(t) ? `\\${t}` : escape(t).replace(/%/g, "\\")).join("");
3911
4116
  }
3912
- const Is = {
4117
+ const xs = {
3913
4118
  tag: Re,
3914
- id: gs,
3915
- class: ms,
3916
- attribute: ps,
3917
- nthchild: bs,
3918
- nthoftype: vs
3919
- }, xs = {
3920
- tag: ze,
4119
+ id: bs,
4120
+ class: gs,
4121
+ attribute: ms,
4122
+ nthchild: vs,
4123
+ nthoftype: As
4124
+ }, Ns = {
4125
+ tag: Ce,
3921
4126
  id: Le,
3922
- class: Ne,
3923
- attribute: xe,
3924
- nthchild: Oe,
3925
- nthoftype: Ce
4127
+ class: Oe,
4128
+ attribute: Ne,
4129
+ nthchild: ze,
4130
+ nthoftype: Pe
3926
4131
  };
3927
- function Ns(s, t) {
3928
- return xs[t](s);
4132
+ function Os(s, t) {
4133
+ return Ns[t](s);
3929
4134
  }
3930
4135
  function Ls(s, t) {
3931
- const e = Is[t];
4136
+ const e = xs[t];
3932
4137
  return e(s);
3933
4138
  }
3934
- function Os(s = [], t, e) {
4139
+ function zs(s = [], t, e) {
3935
4140
  return s.filter((i) => e(i) || !t(i));
3936
4141
  }
3937
- function zs(s = [], t) {
4142
+ function Cs(s = [], t) {
3938
4143
  return s.sort((e, i) => {
3939
4144
  const r = t(e), n = t(i);
3940
4145
  return r && !n ? -1 : !r && n ? 1 : 0;
3941
4146
  });
3942
4147
  }
3943
4148
  function* Rs(s, t) {
3944
- const e = /* @__PURE__ */ new Set(), i = Cs(s, t);
3945
- for (const r of Us(i, t))
4149
+ const e = /* @__PURE__ */ new Set(), i = Ps(s, t);
4150
+ for (const r of Ms(i, t))
3946
4151
  e.has(r) || (e.add(r), yield r);
3947
4152
  }
3948
- function Cs(s, t) {
3949
- const { blacklist: e, whitelist: i, combineWithinSelector: r, maxCombinations: n } = t, a = Rt(e), o = Rt(i), h = (m, p) => {
3950
- const u = Ls(s, p), g = Os(u, a, o), A = zs(g, o);
3951
- return m[p] = r ? Array.from(Pe(A, { maxResults: n })) : A.map((C) => [C]), m;
4153
+ function Ps(s, t) {
4154
+ const { blacklist: e, whitelist: i, combineWithinSelector: r, maxCombinations: n } = t, a = Rt(e), o = Rt(i), h = (p, m) => {
4155
+ const u = Ls(s, m), g = zs(u, a, o), A = Cs(g, o);
4156
+ return p[m] = r ? Array.from(ke(A, { maxResults: n })) : A.map((P) => [P]), p;
3952
4157
  };
3953
- return Ps(t).reduce(h, {});
4158
+ return ks(t).reduce(h, {});
3954
4159
  }
3955
- function Ps(s) {
4160
+ function ks(s) {
3956
4161
  const { selectors: t, includeTag: e } = s, i = [...t];
3957
4162
  return e && !i.includes("tag") && i.push("tag"), i;
3958
4163
  }
3959
- function ks(s) {
3960
- return s.includes(E.tag) || s.includes(E.nthoftype) ? [...s] : [...s, E.tag];
3961
- }
3962
4164
  function Ds(s) {
3963
- const { selectors: t, combineBetweenSelectors: e, includeTag: i, maxCandidates: r } = s, n = e ? As(t, { maxResults: r }) : t.map((a) => [a]);
3964
- return i ? n.map(ks) : n;
4165
+ return s.includes(E.tag) || s.includes(E.nthoftype) ? [...s] : [...s, E.tag];
3965
4166
  }
3966
- function* Us(s, t) {
3967
- for (const e of Ds(t))
3968
- yield* Ms(e, s);
4167
+ function Us(s) {
4168
+ const { selectors: t, combineBetweenSelectors: e, includeTag: i, maxCandidates: r } = s, n = e ? ys(t, { maxResults: r }) : t.map((a) => [a]);
4169
+ return i ? n.map(Ds) : n;
3969
4170
  }
3970
4171
  function* Ms(s, t) {
4172
+ for (const e of Us(t))
4173
+ yield* Bs(e, s);
4174
+ }
4175
+ function* Bs(s, t) {
3971
4176
  const e = {};
3972
4177
  for (const i of s) {
3973
4178
  const r = t[i];
3974
4179
  r && r.length > 0 && (e[i] = r);
3975
4180
  }
3976
- for (const i of ws(e))
3977
- yield Gs(i);
4181
+ for (const i of Ss(e))
4182
+ yield Ws(i);
3978
4183
  }
3979
- function Bs(s, t) {
4184
+ function Gs(s, t) {
3980
4185
  return t[s] ? t[s].join("") : "";
3981
4186
  }
3982
- function Gs(s = {}) {
3983
- const t = [...Ie];
3984
- return s[E.tag] && s[E.nthoftype] && t.splice(t.indexOf(E.tag), 1), t.map((e) => Bs(e, s)).join("");
4187
+ function Ws(s = {}) {
4188
+ const t = [...xe];
4189
+ return s[E.tag] && s[E.nthoftype] && t.splice(t.indexOf(E.tag), 1), t.map((e) => Gs(e, s)).join("");
3985
4190
  }
3986
- function Ws(s, t) {
4191
+ function Hs(s, t) {
3987
4192
  return [
3988
- ...s.map((e) => t + gt.DESCENDANT + e),
3989
- ...s.map((e) => t + gt.CHILD + e)
4193
+ ...s.map((e) => t + bt.DESCENDANT + e),
4194
+ ...s.map((e) => t + bt.CHILD + e)
3990
4195
  ];
3991
4196
  }
3992
- function* Hs(s, t) {
4197
+ function* Fs(s, t) {
3993
4198
  if (t === "")
3994
4199
  yield* s;
3995
4200
  else
3996
4201
  for (const e of s)
3997
- yield* Ws([e], t);
4202
+ yield* Hs([e], t);
3998
4203
  }
3999
- function* Fs(s, t, e = "", i) {
4204
+ function* _s(s, t, e = "", i) {
4000
4205
  const r = Rs(s, i);
4001
- for (const n of Hs(r, e))
4002
- jt(s, n, t) && (yield n);
4206
+ for (const n of Fs(r, e))
4207
+ te(s, n, t) && (yield n);
4003
4208
  }
4004
4209
  function* Vs(s, t, e = "", i) {
4005
4210
  if (s.length === 0)
4006
4211
  return null;
4007
4212
  const r = [
4008
4213
  s.length > 1 ? s : [],
4009
- ...as(s, t).map((n) => [n])
4214
+ ...os(s, t).map((n) => [n])
4010
4215
  ];
4011
4216
  for (const n of r)
4012
- for (const a of Fs(n, t, e, i))
4217
+ for (const a of _s(n, t, e, i))
4013
4218
  yield {
4014
4219
  foundElements: n,
4015
4220
  selector: a
4016
4221
  };
4017
4222
  }
4018
- function* _s({ elements: s, root: t, rootSelector: e = "", options: i }) {
4223
+ function* Ys({ elements: s, root: t, rootSelector: e = "", options: i }) {
4019
4224
  let r = t, n = e, a = !0;
4020
4225
  for (; a; ) {
4021
4226
  let o = !1;
4022
4227
  for (const h of Vs(s, r, n, i)) {
4023
- const { foundElements: m, selector: p } = h;
4024
- if (o = !0, jt(s, p, t))
4025
- yield p;
4228
+ const { foundElements: p, selector: m } = h;
4229
+ if (o = !0, te(s, m, t))
4230
+ yield m;
4026
4231
  else {
4027
- r = m[0], n = p;
4232
+ r = p[0], n = m;
4028
4233
  break;
4029
4234
  }
4030
4235
  }
4031
4236
  o || (a = !1);
4032
4237
  }
4033
4238
  }
4034
- function Ys(s) {
4239
+ function $s(s) {
4035
4240
  (s instanceof NodeList || s instanceof HTMLCollection) && (s = Array.from(s));
4036
- const t = (Array.isArray(s) ? s : [s]).filter(ye);
4241
+ const t = (Array.isArray(s) ? s : [s]).filter(we);
4037
4242
  return [...new Set(t)];
4038
4243
  }
4039
- function $s(s) {
4244
+ function Xs(s) {
4040
4245
  return {
4041
4246
  value: s,
4042
4247
  include: !1
4043
4248
  };
4044
4249
  }
4045
- function Xs(s, t, e = gt.NONE) {
4250
+ function Ks(s, t, e = bt.NONE) {
4046
4251
  const i = {};
4047
4252
  return t.forEach((r) => {
4048
- Reflect.set(i, r, Ns(s, r).map($s));
4253
+ Reflect.set(i, r, Os(s, r).map(Xs));
4049
4254
  }), {
4050
4255
  element: s,
4051
4256
  operator: e,
4052
4257
  selectors: i
4053
4258
  };
4054
4259
  }
4055
- function Ks({ selectors: s, operator: t }) {
4056
- let e = [...Ie];
4260
+ function Zs({ selectors: s, operator: t }) {
4261
+ let e = [...xe];
4057
4262
  s[E.tag] && s[E.nthoftype] && (e = e.filter((r) => r !== E.tag));
4058
4263
  let i = "";
4059
4264
  return e.forEach((r) => {
@@ -4063,31 +4268,31 @@ function Ks({ selectors: s, operator: t }) {
4063
4268
  });
4064
4269
  }), t + i;
4065
4270
  }
4066
- function Zs(s, t) {
4067
- const i = Ee(s, t).reverse().map((r) => {
4271
+ function Js(s, t) {
4272
+ const i = Te(s, t).reverse().map((r) => {
4068
4273
  var n;
4069
- const a = Xs(r, [E.nthchild], gt.CHILD);
4274
+ const a = Ks(r, [E.nthchild], bt.CHILD);
4070
4275
  return ((n = a.selectors.nthchild) !== null && n !== void 0 ? n : []).forEach((o) => {
4071
4276
  o.include = !0;
4072
4277
  }), a;
4073
4278
  });
4074
4279
  return [
4075
4280
  t ? ":scope" : ":root",
4076
- ...i.map(Ks)
4281
+ ...i.map(Zs)
4077
4282
  ].join("");
4078
4283
  }
4079
- function Js(s, t) {
4080
- return s.map((e) => Zs(e, t)).join(Te);
4284
+ function qs(s, t) {
4285
+ return s.map((e) => Js(e, t)).join(Ie);
4081
4286
  }
4082
- function ke(s, t = {}) {
4287
+ function De(s, t = {}) {
4083
4288
  const e = Object.assign(Object.assign({}, t), { maxResults: 1 });
4084
- return qs(s, e).next().value;
4289
+ return Qs(s, e).next().value;
4085
4290
  }
4086
- function* qs(s, t = {}) {
4291
+ function* Qs(s, t = {}) {
4087
4292
  var e;
4088
- const i = Ys(s), r = ss(i[0], t), n = (e = r.root) !== null && e !== void 0 ? e : te(i[0]);
4293
+ const i = $s(s), r = rs(i[0], t), n = (e = r.root) !== null && e !== void 0 ? e : ee(i[0]);
4089
4294
  let a = 0;
4090
- for (const o of _s({
4295
+ for (const o of Ys({
4091
4296
  elements: i,
4092
4297
  options: r,
4093
4298
  root: n,
@@ -4095,9 +4300,9 @@ function* qs(s, t = {}) {
4095
4300
  }))
4096
4301
  if (yield o, a++, a >= r.maxResults)
4097
4302
  return;
4098
- i.length > 1 && (yield i.map((o) => ke(o, r)).join(Te), a++, a >= r.maxResults) || (yield Js(i, r.useScope ? n : void 0));
4303
+ i.length > 1 && (yield i.map((o) => De(o, r)).join(Ie), a++, a >= r.maxResults) || (yield qs(i, r.useScope ? n : void 0));
4099
4304
  }
4100
- class hr extends Qt {
4305
+ class ur extends jt {
4101
4306
  constructor(t, e, i = 50) {
4102
4307
  super(), this.resource = t, this.locator = e, this.beforeMaxLength = i, this.currentElement = null, this.currentIndex = null, this.parsedElementRecipes = null, this.parser = null;
4103
4308
  }
@@ -4110,7 +4315,7 @@ class hr extends Qt {
4110
4315
  }, !0) : !1;
4111
4316
  }
4112
4317
  previous() {
4113
- if (!this.currentElement || this.currentElement.delta !== -1) throw new et("Called previous() without a successful call to hasPrevious() first");
4318
+ if (!this.currentElement || this.currentElement.delta !== -1) throw new it("Called previous() without a successful call to hasPrevious() first");
4114
4319
  const t = this.currentElement.element;
4115
4320
  return this.currentElement = null, t;
4116
4321
  }
@@ -4123,7 +4328,7 @@ class hr extends Qt {
4123
4328
  }, !0) : !1;
4124
4329
  }
4125
4330
  next() {
4126
- if (!this.currentElement || this.currentElement.delta !== 1) throw new et("Called next() without a successful call to hasNext() first");
4331
+ if (!this.currentElement || this.currentElement.delta !== 1) throw new it("Called next() without a successful call to hasNext() first");
4127
4332
  const t = this.currentElement.element;
4128
4333
  return this.currentElement = null, t;
4129
4334
  }
@@ -4132,15 +4337,15 @@ class hr extends Qt {
4132
4337
  }
4133
4338
  async parseElements() {
4134
4339
  const t = await this.resource.readAsString(), e = new DOMParser().parseFromString(t, this.locator.type);
4135
- return this.parser = new js(
4340
+ return this.parser = new tr(
4136
4341
  e,
4137
4342
  this.locator,
4138
4343
  this.locator.locations.getCssSelector() ? e.querySelector(this.locator.locations.getCssSelector()) : null,
4139
4344
  this.beforeMaxLength
4140
- ), Qs(this.parser, e.body), this.parser.result();
4345
+ ), js(this.parser, e.body), this.parser.result();
4141
4346
  }
4142
4347
  }
4143
- function Qs(s, t) {
4348
+ function js(s, t) {
4144
4349
  let e = t, i = 0;
4145
4350
  for (; e != null; )
4146
4351
  if (s.head(e, i), e.firstChild != null)
@@ -4153,7 +4358,7 @@ function Qs(s, t) {
4153
4358
  e = e?.nextSibling || null;
4154
4359
  }
4155
4360
  }
4156
- class js {
4361
+ class tr {
4157
4362
  constructor(t, e, i, r) {
4158
4363
  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();
4159
4364
  }
@@ -4167,8 +4372,8 @@ class js {
4167
4372
  const e = t.recipe.cssSelectorNode ? this.cssSelector(t.recipe.cssSelectorNode) : null;
4168
4373
  if (t.type === 1) {
4169
4374
  const i = t.recipe;
4170
- return new Bi(
4171
- new k({
4375
+ return new Gi(
4376
+ new D({
4172
4377
  href: this.baseLocator.href,
4173
4378
  type: this.baseLocator.type,
4174
4379
  title: this.baseLocator.title,
@@ -4178,14 +4383,14 @@ class js {
4178
4383
  ])
4179
4384
  } : {})
4180
4385
  }),
4181
- new U({
4386
+ new M({
4182
4387
  href: i.href
4183
4388
  }),
4184
4389
  i.caption,
4185
4390
  i.attributes
4186
4391
  );
4187
4392
  } else if (t.type === 2 || t.type === 3) {
4188
- const i = new k({
4393
+ const i = new D({
4189
4394
  href: this.baseLocator.href,
4190
4395
  type: this.baseLocator.type,
4191
4396
  title: this.baseLocator.title,
@@ -4195,22 +4400,22 @@ class js {
4195
4400
  ])
4196
4401
  } : {})
4197
4402
  }), r = t.recipe;
4198
- return t.type === 3 ? new Mi(
4403
+ return t.type === 3 ? new Bi(
4199
4404
  i,
4200
4405
  r.link
4201
- ) : new Ui(
4406
+ ) : new Mi(
4202
4407
  i,
4203
4408
  r.link
4204
4409
  );
4205
4410
  } else if (t.type === 0) {
4206
4411
  const i = t.recipe, r = i.segments.map((n) => {
4207
4412
  const a = n.cssSelectorNode ? this.cssSelector(n.cssSelectorNode) : null;
4208
- return new ge(
4209
- new k({
4413
+ return new be(
4414
+ new D({
4210
4415
  href: this.baseLocator.href,
4211
4416
  type: this.baseLocator.type,
4212
4417
  title: this.baseLocator.title,
4213
- text: le(n.text, this.wholeRawTextAcc?.substring(n.beforeRange[0], n.beforeRange[1])),
4418
+ text: he(n.text, this.wholeRawTextAcc?.substring(n.beforeRange[0], n.beforeRange[1])),
4214
4419
  locations: new T(a ? {
4215
4420
  otherLocations: /* @__PURE__ */ new Map([
4216
4421
  ["cssSelector", a]
@@ -4221,12 +4426,12 @@ class js {
4221
4426
  n.attributes
4222
4427
  );
4223
4428
  });
4224
- return new zt(
4225
- new k({
4429
+ return new Ct(
4430
+ new D({
4226
4431
  href: this.baseLocator.href,
4227
4432
  type: this.baseLocator.type,
4228
4433
  title: this.baseLocator.title,
4229
- text: le(i.text, r.length && r[0].locator.text?.before || ""),
4434
+ text: he(i.text, r.length && r[0].locator.text?.before || ""),
4230
4435
  locations: new T(e ? {
4231
4436
  otherLocations: /* @__PURE__ */ new Map([
4232
4437
  ["cssSelector", e]
@@ -4251,22 +4456,22 @@ class js {
4251
4456
  }
4252
4457
  n = n.parentElement;
4253
4458
  }
4254
- const a = ke(e, {
4459
+ const a = De(e, {
4255
4460
  root: this.doc
4256
4461
  });
4257
- return r.forEach((o, h) => o.forEach((m) => h.attributes.setNamedItem(m))), this.recipeCssSelectorCache.set(e, a), a;
4462
+ return r.forEach((o, h) => o.forEach((p) => h.attributes.setNamedItem(p))), this.recipeCssSelectorCache.set(e, a), a;
4258
4463
  }
4259
4464
  // Implements NodeTraversor
4260
4465
  head(t, e) {
4261
4466
  if (t.nodeType == Node.ELEMENT_NODE) {
4262
- const i = !ce(t);
4467
+ const i = !le(t);
4263
4468
  i && (this.flushText(), this.breadcrumbs.push(t));
4264
4469
  const r = t.nodeName.toUpperCase();
4265
4470
  if (r === "BR")
4266
4471
  this.flushText();
4267
4472
  else if (r === "IMG" || r === "AUDIO" || r === "VIDEO")
4268
4473
  if (this.flushText(), r === "IMG") {
4269
- const n = t, a = St(n, this.baseLocator.href);
4474
+ const n = t, a = Et(n, this.baseLocator.href);
4270
4475
  let o = n.getAttribute("alt");
4271
4476
  o?.length || (o = n.getAttribute("title")), a != null && this.elementRecipes.push({
4272
4477
  type: 1,
@@ -4275,31 +4480,31 @@ class js {
4275
4480
  caption: void 0,
4276
4481
  // FIXME: Get the caption from figcaption
4277
4482
  cssSelectorNode: t,
4278
- attributes: o?.length ? [new ae(
4279
- Ot.ACCESSIBILITY_LABEL,
4483
+ attributes: o?.length ? [new oe(
4484
+ zt.ACCESSIBILITY_LABEL,
4280
4485
  o
4281
4486
  )] : []
4282
4487
  }
4283
4488
  });
4284
4489
  } else {
4285
- const n = t, a = St(n, this.baseLocator.href);
4490
+ const n = t, a = Et(n, this.baseLocator.href);
4286
4491
  let o;
4287
4492
  if (a != null)
4288
- o = new U({
4493
+ o = new M({
4289
4494
  href: a
4290
4495
  });
4291
4496
  else {
4292
- const h = [...n.getElementsByTagName("source")].map((m) => {
4293
- const p = St(m, this.baseLocator.href);
4294
- return p ? new U({
4295
- href: p,
4296
- type: m.getAttribute("type") || void 0
4497
+ const h = [...n.getElementsByTagName("source")].map((p) => {
4498
+ const m = Et(p, this.baseLocator.href);
4499
+ return m ? new M({
4500
+ href: m,
4501
+ type: p.getAttribute("type") || void 0
4297
4502
  }) : null;
4298
- }).filter((m) => !!m);
4299
- h.length > 0 && (o = new U({
4503
+ }).filter((p) => !!p);
4504
+ h.length > 0 && (o = new M({
4300
4505
  href: h[0].href,
4301
4506
  type: h[0].type,
4302
- alternates: h.length > 1 ? new O(h.slice(1)) : void 0
4507
+ alternates: h.length > 1 ? new z(h.slice(1)) : void 0
4303
4508
  }));
4304
4509
  }
4305
4510
  o && (r === "AUDIO" ? this.elementRecipes.push({
@@ -4321,24 +4526,24 @@ class js {
4321
4526
  }
4322
4527
  // Implements NodeTraversor
4323
4528
  tail(t, e) {
4324
- if (t.nodeType === Node.TEXT_NODE && !ot(t.textContent)) {
4325
- const i = Zi(t.parentElement);
4326
- this.currentLanguage !== i && (this.flushSegment(), this.currentLanguage = i), this.rawTextAcc += t.textContent, this.textAcc = Ji(this.textAcc, t.textContent);
4327
- } else if (t.nodeType === Node.ELEMENT_NODE && !ce(t)) {
4529
+ if (t.nodeType === Node.TEXT_NODE && !ct(t.textContent)) {
4530
+ const i = Ji(t.parentElement);
4531
+ this.currentLanguage !== i && (this.flushSegment(), this.currentLanguage = i), this.rawTextAcc += t.textContent, this.textAcc = qi(this.textAcc, t.textContent);
4532
+ } else if (t.nodeType === Node.ELEMENT_NODE && !le(t)) {
4328
4533
  if (!this.breadcrumbs.length || this.breadcrumbs.at(-1) !== t) throw new Error("HTMLContentIterator: breadcrumbs mismatch");
4329
4534
  this.flushText(), this.breadcrumbs.pop();
4330
4535
  }
4331
4536
  }
4332
4537
  flushText() {
4333
4538
  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;
4334
- this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text = Ki(
4539
+ this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text = Zi(
4335
4540
  this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text
4336
4541
  );
4337
- let t = Wi;
4542
+ let t = Hi;
4338
4543
  if (this.breadcrumbs.length > 0) {
4339
4544
  const e = this.breadcrumbs.at(-1);
4340
4545
  if (e.getAttributeNS("http://www.idpf.org/2007/ops", "type") === "footnote")
4341
- t = Hi;
4546
+ t = Fi;
4342
4547
  else
4343
4548
  switch (e.nodeName.toUpperCase()) {
4344
4549
  case "H1":
@@ -4347,11 +4552,11 @@ class js {
4347
4552
  case "H4":
4348
4553
  case "H5":
4349
4554
  case "H6":
4350
- t = new Gi(parseInt(e.nodeName[1]));
4555
+ t = new Wi(parseInt(e.nodeName[1]));
4351
4556
  break;
4352
4557
  case "BLOCKQUOTE":
4353
4558
  case "Q":
4354
- t = new Fi(
4559
+ t = new _i(
4355
4560
  e.getAttribute("cite")?.length ? new URL(e.getAttribute("cite")) : void 0,
4356
4561
  e.getAttribute("title") || void 0
4357
4562
  );
@@ -4370,17 +4575,17 @@ class js {
4370
4575
  }
4371
4576
  flushSegment() {
4372
4577
  let t = this.textAcc;
4373
- const e = Ae(t);
4374
- if (!ot(e)) {
4578
+ const e = ye(t);
4579
+ if (!ct(e)) {
4375
4580
  if (!this.segmentRecipesAcc.length) {
4376
- t = Xi(t);
4377
- const i = t.length && ot(t[t.length - 1]) ? t[t.length - 1] : "";
4581
+ t = Ki(t);
4582
+ const i = t.length && ct(t[t.length - 1]) ? t[t.length - 1] : "";
4378
4583
  t = e + i;
4379
4584
  }
4380
4585
  this.segmentRecipesAcc.push({
4381
4586
  text: t,
4382
- attributes: this.currentLanguage ? [new ae(
4383
- Ot.LANGUAGE,
4587
+ attributes: this.currentLanguage ? [new oe(
4588
+ zt.LANGUAGE,
4384
4589
  this.currentLanguage
4385
4590
  )] : [],
4386
4591
  beforeRange: this.wholeRawTextAcc ? [this.wholeRawTextAcc.length - this.beforeMaxLength, this.wholeRawTextAcc.length] : [0, 0],
@@ -4390,7 +4595,7 @@ class js {
4390
4595
  this.rawTextAcc.length && (this.wholeRawTextAcc = (this.wholeRawTextAcc || "") + this.rawTextAcc, this.elementRawTextAcc += this.rawTextAcc), this.rawTextAcc = "", this.textAcc = "";
4391
4596
  }
4392
4597
  }
4393
- class vt {
4598
+ class At {
4394
4599
  /**
4395
4600
  * Creates a [LocatorMetadata].
4396
4601
  */
@@ -4405,9 +4610,9 @@ class vt {
4405
4610
  const e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(["title", "numberOfItems"]);
4406
4611
  return Object.entries(t).forEach(([r, n]) => {
4407
4612
  i.has(r) || e.set(r, n);
4408
- }), new vt({
4409
- title: M.deserialize(t.title),
4410
- numberOfItems: K(t.numberOfItems),
4613
+ }), new At({
4614
+ title: B.deserialize(t.title),
4615
+ numberOfItems: Z(t.numberOfItems),
4411
4616
  otherMetadata: e.size === 0 ? void 0 : e
4412
4617
  });
4413
4618
  }
@@ -4419,12 +4624,12 @@ class vt {
4419
4624
  return this.title && (t.title = this.title.serialize()), this.numberOfItems !== void 0 && (t.numberOfItems = this.numberOfItems), this.otherMetadata && this.otherMetadata.forEach((e, i) => t[i] = e), t;
4420
4625
  }
4421
4626
  }
4422
- class De {
4627
+ class Ue {
4423
4628
  /**
4424
4629
  * Creates a [LocatorCollection].
4425
4630
  */
4426
4631
  constructor(t) {
4427
- this.metadata = t.metadata ?? new vt({}), this.links = t.links ?? new O([]), this.locators = t.locators ?? [];
4632
+ this.metadata = t.metadata ?? new At({}), this.links = t.links ?? new z([]), this.locators = t.locators ?? [];
4428
4633
  }
4429
4634
  /**
4430
4635
  * Parses a [LocatorCollection] from its RWPM JSON representation.
@@ -4432,9 +4637,9 @@ class De {
4432
4637
  static deserialize(t) {
4433
4638
  if (!t) return;
4434
4639
  let e, i = t.locators;
4435
- return i && Array.isArray(i) && (e = i.map((r) => k.deserialize(r)).filter((r) => r !== void 0)), new De({
4436
- metadata: vt.deserialize(t.metadata),
4437
- links: O.deserialize(t.links),
4640
+ return i && Array.isArray(i) && (e = i.map((r) => D.deserialize(r)).filter((r) => r !== void 0)), new Ue({
4641
+ metadata: At.deserialize(t.metadata),
4642
+ links: z.deserialize(t.links),
4438
4643
  locators: e
4439
4644
  });
4440
4645
  }
@@ -4450,7 +4655,7 @@ class De {
4450
4655
  return this.links && this.links.items.length > 0 && (t.links = this.links.serialize()), this.locators && (t.locators = this.locators.map((e) => e.serialize())), t;
4451
4656
  }
4452
4657
  }
4453
- class W {
4658
+ class H {
4454
4659
  /**
4455
4660
  * Creates a [PublicationCollection].
4456
4661
  */
@@ -4464,15 +4669,15 @@ class W {
4464
4669
  if (!t) return;
4465
4670
  let e, i, r;
4466
4671
  if (Array.isArray(t))
4467
- e = O.deserialize(t);
4672
+ e = z.deserialize(t);
4468
4673
  else if (typeof t == "object")
4469
- e = O.deserialize(t.links), i = /* @__PURE__ */ new Map(), t.metadata && Object.entries(t.metadata).forEach(([n, a]) => {
4674
+ e = z.deserialize(t.links), i = /* @__PURE__ */ new Map(), t.metadata && Object.entries(t.metadata).forEach(([n, a]) => {
4470
4675
  i?.set(n, a);
4471
- }), r = W.deserializeCollections(t);
4676
+ }), r = H.deserializeCollections(t);
4472
4677
  else
4473
4678
  return;
4474
4679
  if (!(!e || e.items.length === 0))
4475
- return new W({
4680
+ return new H({
4476
4681
  metadata: i?.size ? i : void 0,
4477
4682
  links: e,
4478
4683
  subcollections: r?.size ? r : void 0
@@ -4487,13 +4692,13 @@ class W {
4487
4692
  const e = /* @__PURE__ */ new Map();
4488
4693
  return Object.entries(t).forEach(([i, r]) => {
4489
4694
  if (i !== "links" && i !== "metadata") {
4490
- const n = W.deserialize(r);
4695
+ const n = H.deserialize(r);
4491
4696
  if (n) {
4492
4697
  const a = new Array();
4493
4698
  a.push(n), e.set(i, a);
4494
4699
  } else if (Array.isArray(r)) {
4495
4700
  const a = r.map(
4496
- (o) => W.deserialize(o)
4701
+ (o) => H.deserialize(o)
4497
4702
  ).filter((o) => o !== void 0);
4498
4703
  e.set(i, a);
4499
4704
  }
@@ -4507,7 +4712,7 @@ class W {
4507
4712
  const t = {};
4508
4713
  return this.metadata && (t.metadata = {}, this.metadata.forEach(
4509
4714
  (e, i) => t.metadata[i] = e
4510
- )), this.links.items.length && (t.links = this.links.serialize()), W.serializeCollection(t, this.subcollections), t;
4715
+ )), this.links.items.length && (t.links = this.links.serialize()), H.serializeCollection(t, this.subcollections), t;
4511
4716
  }
4512
4717
  static serializeCollection(t, e) {
4513
4718
  e && e.size > 0 && e.forEach(
@@ -4517,7 +4722,7 @@ class W {
4517
4722
  );
4518
4723
  }
4519
4724
  }
4520
- class Ue {
4725
+ class Me {
4521
4726
  constructor(t) {
4522
4727
  this.context = t.context, this.metadata = t.metadata, this.links = t.links, this.readingOrder = t.readingOrder, this.resources = t.resources, this.toc = t.toc, this.subcollections = t.subcollections;
4523
4728
  }
@@ -4529,22 +4734,22 @@ class Ue {
4529
4734
  */
4530
4735
  static deserialize(t) {
4531
4736
  if (!t) return;
4532
- const e = ft.deserialize(t.metadata);
4737
+ const e = pt.deserialize(t.metadata);
4533
4738
  if (!e) return;
4534
- const i = O.deserialize(t.links);
4739
+ const i = z.deserialize(t.links);
4535
4740
  if (!i) return;
4536
- const r = O.deserialize(
4741
+ const r = z.deserialize(
4537
4742
  t.readingOrder ? t.readingOrder : t.spine
4538
4743
  );
4539
4744
  if (r)
4540
- return new Ue({
4541
- context: F(t["@context"]),
4745
+ return new Me({
4746
+ context: _(t["@context"]),
4542
4747
  metadata: e,
4543
4748
  links: i,
4544
4749
  readingOrder: r,
4545
- resources: O.deserialize(t.resources),
4546
- toc: O.deserialize(t.toc),
4547
- subcollections: W.deserializeCollections({
4750
+ resources: z.deserialize(t.resources),
4751
+ toc: z.deserialize(t.toc),
4752
+ subcollections: H.deserializeCollections({
4548
4753
  sub: t.sub
4549
4754
  })
4550
4755
  });
@@ -4554,7 +4759,7 @@ class Ue {
4554
4759
  */
4555
4760
  serialize() {
4556
4761
  const t = {};
4557
- 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()), W.serializeCollection(t, this.subcollections), t;
4762
+ 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;
4558
4763
  }
4559
4764
  /** Finds the first link with the given relation in the manifest's links. */
4560
4765
  linkWithRel(t) {
@@ -4581,7 +4786,7 @@ class Ue {
4581
4786
  const n = r.type;
4582
4787
  if (!n) return;
4583
4788
  const a = e.length == 2 ? e[1] : void 0;
4584
- return new k({
4789
+ return new D({
4585
4790
  href: i,
4586
4791
  type: n,
4587
4792
  title: r.title ?? t.title,
@@ -4595,16 +4800,16 @@ class Ue {
4595
4800
  linkWithHref(t) {
4596
4801
  const e = (o) => {
4597
4802
  let h;
4598
- for (const p of o)
4599
- if (h = p.findWithHref(t), h !== void 0)
4803
+ for (const m of o)
4804
+ if (h = m.findWithHref(t), h !== void 0)
4600
4805
  return h;
4601
- const m = new Array();
4602
- return o.forEach((p) => {
4806
+ const p = new Array();
4807
+ return o.forEach((m) => {
4603
4808
  const u = [];
4604
- for (const g of p.items)
4809
+ for (const g of m.items)
4605
4810
  g.alternates && u.push(g.alternates), g.children && u.push(g.children);
4606
- m.push(...u);
4607
- }), m.length > 0 && (h = e(m)), h;
4811
+ p.push(...u);
4812
+ }), p.length > 0 && (h = e(p)), h;
4608
4813
  }, i = [];
4609
4814
  i.push(this.readingOrder), this.resources && i.push(this.resources), i.push(this.links);
4610
4815
  const r = e(i);
@@ -4638,7 +4843,7 @@ class Ue {
4638
4843
  this.links.items = this.links.items.filter(
4639
4844
  (e) => e.rels === void 0 || !e.rels?.has("self")
4640
4845
  ), this.links.items.push(
4641
- new U({
4846
+ new M({
4642
4847
  href: t,
4643
4848
  type: c.READIUM_WEBPUB_MANIFEST.string,
4644
4849
  rels: /* @__PURE__ */ new Set(["self"])
@@ -4649,104 +4854,105 @@ class Ue {
4649
4854
  export {
4650
4855
  R as AccessMode,
4651
4856
  V as Accessibility,
4652
- sr as AccessibilityMetadataDisplayGuide,
4653
- Tt as AccessibilityProfile,
4654
- Ht as AccessibilitySummary,
4655
- j as Acquisition,
4656
- Mt as AdditionalInformation,
4657
- Z as AltIdentifier,
4658
- ae as Attribute,
4659
- Ot as AttributeKeys,
4660
- pe as AttributesHolder,
4661
- Ui as AudioElement,
4662
- qt as Availability,
4663
- Di as AvailabilityStatus,
4664
- q as BelongsTo,
4665
- Wi as Body,
4666
- Pt as Certification,
4667
- Gt as Conformance,
4668
- nr as Content,
4669
- me as ContentElement,
4670
- ut as Contributor,
4671
- N as Contributors,
4672
- Jt as Copies,
4857
+ rr as AccessibilityMetadataDisplayGuide,
4858
+ It as AccessibilityProfile,
4859
+ Ft as AccessibilitySummary,
4860
+ tt as Acquisition,
4861
+ Bt as AdditionalInformation,
4862
+ J as AltIdentifier,
4863
+ oe as Attribute,
4864
+ zt as AttributeKeys,
4865
+ me as AttributesHolder,
4866
+ Mi as AudioElement,
4867
+ Qt as Availability,
4868
+ Ui as AvailabilityStatus,
4869
+ Q as BelongsTo,
4870
+ Hi as Body,
4871
+ kt as Certification,
4872
+ Wt as Conformance,
4873
+ ar as Content,
4874
+ ge as ContentElement,
4875
+ dt as Contributor,
4876
+ O as Contributors,
4877
+ qt as Copies,
4673
4878
  Ri as DefaultTextContentTokenizer,
4674
- Xt as DomRange,
4675
- mt as DomRangePoint,
4676
- ti as EmptyFetcher,
4677
- Ft as Encryption,
4678
- xt as Exemption,
4879
+ Kt as DomRange,
4880
+ gt as DomRangePoint,
4881
+ ei as EmptyFetcher,
4882
+ _t as Encryption,
4883
+ Nt as Exemption,
4679
4884
  v as Feature,
4680
- Hi as Footnote,
4681
- $t as GuidedNavigationDocument,
4682
- X as GuidedNavigationObject,
4683
- pt as GuidedNavigationText,
4684
- hr as HTMLResourceContentIterator,
4685
- P as Hazard,
4686
- ci as HazardType,
4687
- Bt as Hazards,
4688
- Gi as Heading,
4689
- Zt as Holds,
4690
- tr as HttpFetcher,
4691
- ei as HttpResource,
4692
- et as IllegalStateError,
4693
- Bi as ImageElement,
4694
- Ci as IntlTextTokenizer,
4695
- Qt as Iterator,
4696
- $ as Layout,
4697
- Wt as Legal,
4698
- U as Link,
4699
- O as Links,
4885
+ Fi as Footnote,
4886
+ Xt as GuidedNavigationDocument,
4887
+ K as GuidedNavigationObject,
4888
+ mt as GuidedNavigationText,
4889
+ ur as HTMLResourceContentIterator,
4890
+ k as Hazard,
4891
+ li as HazardType,
4892
+ Gt as Hazards,
4893
+ Wi as Heading,
4894
+ Jt as Holds,
4895
+ er as HttpFetcher,
4896
+ ii as HttpResource,
4897
+ it as IllegalStateError,
4898
+ Gi as ImageElement,
4899
+ Pi as IntlTextTokenizer,
4900
+ jt as Iterator,
4901
+ X as Layout,
4902
+ Ht as Legal,
4903
+ M as Link,
4904
+ z as Links,
4700
4905
  f as Localization,
4701
- M as LocalizedString,
4702
- k as Locator,
4703
- De as LocatorCollection,
4704
- vt as LocatorCollectionMetadata,
4906
+ B as LocalizedString,
4907
+ D as Locator,
4908
+ Ue as LocatorCollection,
4909
+ At as LocatorCollectionMetadata,
4705
4910
  T as LocatorLocations,
4706
- rt as LocatorText,
4707
- Ue as Manifest,
4911
+ nt as LocatorText,
4912
+ Me as Manifest,
4708
4913
  Vt as MediaOverlay,
4709
4914
  c as MediaType,
4710
- ft as Metadata,
4711
- Pi as NaiveTextTokenizer,
4712
- Dt as Navigation,
4713
- ni as NonvisualReading,
4714
- er as NumberRange,
4715
- wt as PDFContentElement,
4716
- Nt as Page,
4717
- lr as PageContentIteratorPDF,
4718
- ai as PrerecordedAudio,
4719
- Kt as Price,
4720
- It as PrimaryAccessMode,
4721
- J as Profile,
4722
- D as Properties,
4723
- _ as Publication,
4724
- W as PublicationCollection,
4725
- cr as PublicationContentIterator,
4726
- H as ReadingProgression,
4727
- ir as Resource,
4728
- Ut as RichContent,
4729
- oi as RichContentType,
4730
- dt as Subject,
4731
- _t as Subjects,
4732
- Yt as TDM,
4733
- hi as TDMReservation,
4734
- ar as TextContentTokenizer,
4735
- zt as TextElement,
4736
- Fi as TextQuote,
4737
- ge as TextSegment,
4738
- zi as TextUnit,
4739
- At as TextualElement,
4740
- ht as URITemplate,
4741
- Mi as VideoElement,
4742
- ri as VisualAdjustments,
4743
- kt as WaysOfReading,
4744
- li as arrayfromJSON,
4745
- F as arrayfromJSONorString,
4746
- ct as datefromJSON,
4747
- rr as leadingPage,
4748
- K as numberfromJSON,
4915
+ pt as Metadata,
4916
+ ki as NaiveTextTokenizer,
4917
+ Ut as Navigation,
4918
+ ai as NonvisualReading,
4919
+ ir as NumberRange,
4920
+ St as PDFContentElement,
4921
+ Ot as Page,
4922
+ hr as PageContentIteratorPDF,
4923
+ oi as PrerecordedAudio,
4924
+ Zt as Price,
4925
+ xt as PrimaryAccessMode,
4926
+ q as Profile,
4927
+ U as Properties,
4928
+ Y as Publication,
4929
+ H as PublicationCollection,
4930
+ lr as PublicationContentIterator,
4931
+ F as ReadingProgression,
4932
+ sr as Resource,
4933
+ Mt as RichContent,
4934
+ ci as RichContentType,
4935
+ ft as Subject,
4936
+ Yt as Subjects,
4937
+ $t as TDM,
4938
+ ui as TDMReservation,
4939
+ or as TextContentTokenizer,
4940
+ Ct as TextElement,
4941
+ _i as TextQuote,
4942
+ be as TextSegment,
4943
+ Ci as TextUnit,
4944
+ yt as TextualElement,
4945
+ x as Timeline,
4946
+ ut as URITemplate,
4947
+ Bi as VideoElement,
4948
+ ni as VisualAdjustments,
4949
+ Dt as WaysOfReading,
4950
+ hi as arrayfromJSON,
4951
+ _ as arrayfromJSONorString,
4952
+ lt as datefromJSON,
4953
+ nr as leadingPage,
4954
+ Z as numberfromJSON,
4749
4955
  L as positiveNumberfromJSON,
4750
- lt as setToArray,
4751
- fe as speakableToken
4956
+ ht as setToArray,
4957
+ pe as speakableToken
4752
4958
  };