@readium/navigator 2.5.5 → 2.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const v = class v {
1
+ const P = class P {
2
2
  constructor(t) {
3
3
  this.uri = t;
4
4
  }
@@ -7,7 +7,7 @@ const v = class v {
7
7
  */
8
8
  static deserialize(t) {
9
9
  if (!(!t || typeof t != "string"))
10
- return new v(t);
10
+ return new P(t);
11
11
  }
12
12
  /**
13
13
  * Serializes an [AccessibilityProfile] to its RWPM JSON representation.
@@ -19,23 +19,23 @@ const v = class v {
19
19
  * Returns true if the profile is a WCAG Level A profile.
20
20
  */
21
21
  get isWCAGLevelA() {
22
- return this === v.EPUB_A11Y_10_WCAG_20_A || this === v.EPUB_A11Y_11_WCAG_20_A || this === v.EPUB_A11Y_11_WCAG_21_A || this === v.EPUB_A11Y_11_WCAG_22_A;
22
+ return this === P.EPUB_A11Y_10_WCAG_20_A || this === P.EPUB_A11Y_11_WCAG_20_A || this === P.EPUB_A11Y_11_WCAG_21_A || this === P.EPUB_A11Y_11_WCAG_22_A;
23
23
  }
24
24
  /**
25
25
  * Returns true if the profile is a WCAG Level AA profile.
26
26
  */
27
27
  get isWCAGLevelAA() {
28
- return this === v.EPUB_A11Y_10_WCAG_20_AA || this === v.EPUB_A11Y_11_WCAG_20_AA || this === v.EPUB_A11Y_11_WCAG_21_AA || this === v.EPUB_A11Y_11_WCAG_22_AA;
28
+ return this === P.EPUB_A11Y_10_WCAG_20_AA || this === P.EPUB_A11Y_11_WCAG_20_AA || this === P.EPUB_A11Y_11_WCAG_21_AA || this === P.EPUB_A11Y_11_WCAG_22_AA;
29
29
  }
30
30
  /**
31
31
  * Returns true if the profile is a WCAG Level AAA profile.
32
32
  */
33
33
  get isWCAGLevelAAA() {
34
- return this === v.EPUB_A11Y_10_WCAG_20_AAA || this === v.EPUB_A11Y_11_WCAG_20_AAA || this === v.EPUB_A11Y_11_WCAG_21_AAA || this === v.EPUB_A11Y_11_WCAG_22_AAA;
34
+ return this === P.EPUB_A11Y_10_WCAG_20_AAA || this === P.EPUB_A11Y_11_WCAG_20_AAA || this === P.EPUB_A11Y_11_WCAG_21_AAA || this === P.EPUB_A11Y_11_WCAG_22_AAA;
35
35
  }
36
36
  };
37
- v.EPUB_A11Y_10_WCAG_20_A = new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), v.EPUB_A11Y_10_WCAG_20_AA = new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), v.EPUB_A11Y_10_WCAG_20_AAA = new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), v.EPUB_A11Y_11_WCAG_20_A = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), v.EPUB_A11Y_11_WCAG_20_AA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), v.EPUB_A11Y_11_WCAG_20_AAA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), v.EPUB_A11Y_11_WCAG_21_A = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), v.EPUB_A11Y_11_WCAG_21_AA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), v.EPUB_A11Y_11_WCAG_21_AAA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), v.EPUB_A11Y_11_WCAG_22_A = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), v.EPUB_A11Y_11_WCAG_22_AA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), v.EPUB_A11Y_11_WCAG_22_AAA = new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
38
- let Qe = v;
37
+ P.EPUB_A11Y_10_WCAG_20_A = new P("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), P.EPUB_A11Y_10_WCAG_20_AA = new P("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), P.EPUB_A11Y_10_WCAG_20_AAA = new P("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), P.EPUB_A11Y_11_WCAG_20_A = new P("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), P.EPUB_A11Y_11_WCAG_20_AA = new P("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), P.EPUB_A11Y_11_WCAG_20_AAA = new P("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), P.EPUB_A11Y_11_WCAG_21_A = new P("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), P.EPUB_A11Y_11_WCAG_21_AA = new P("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), P.EPUB_A11Y_11_WCAG_21_AAA = new P("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), P.EPUB_A11Y_11_WCAG_22_A = new P("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), P.EPUB_A11Y_11_WCAG_22_AA = new P("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), P.EPUB_A11Y_11_WCAG_22_AAA = new P("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
38
+ let Qe = P;
39
39
  const _ = class _ {
40
40
  constructor(t) {
41
41
  this.value = t;
@@ -152,8 +152,8 @@ const k = class k {
152
152
  };
153
153
  k.NONE = new k("none"), k.DOCUMENTED = new k("documented"), k.LEGAL = new k("legal"), k.TEMPORARY = new k("temporary"), k.TECHNICAL = new k("technical"), k.EAA_DISPROPORTIONATE_BURDEN = new k("eaa-disproportionate-burden"), k.EAA_FUNDAMENTAL_ALTERATION = new k("eaa-fundamental-alteration"), k.EAA_MICROENTERPRISE = new k("eaa-microenterprise"), k.EAA_TECHNICAL_IMPOSSIBILITY = new k("eaa-technical-impossibility"), k.EAA_TEMPORARY = new k("eaa-temporary");
154
154
  let ni = k;
155
- const si = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], kn = /* @__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"}}`), On = {
156
- publication: kn
155
+ const si = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], Rn = /* @__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"}}`), On = {
156
+ publication: Rn
157
157
  }, ri = {
158
158
  fr: () => import("./fr-C5HEel98.js"),
159
159
  ar: () => import("./ar-DyHX_uy2.js"),
@@ -166,12 +166,12 @@ const si = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], kn = /* @__PURE__ */ J
166
166
  // 'tr': () => import('@edrlab/thorium-locales/publication-metadata/tr.json'),
167
167
  // 'uk': () => import('@edrlab/thorium-locales/publication-metadata/uk.json')
168
168
  }, oi = On?.publication?.metadata?.accessibility?.["display-guide"] || {};
169
- class gt {
169
+ class yt {
170
170
  constructor() {
171
171
  this.currentLocaleCode = "en", this.locale = oi, this.loadedLocales = {}, this.loadedLocales.en = oi;
172
172
  }
173
173
  static getInstance() {
174
- return gt.instance || (gt.instance = new gt()), gt.instance;
174
+ return yt.instance || (yt.instance = new yt()), yt.instance;
175
175
  }
176
176
  /**
177
177
  * Loads a locale dynamically
@@ -242,8 +242,8 @@ class gt {
242
242
  return e === void 0 && this.currentLocaleCode !== "en" && (e = this.getNestedValue(this.loadedLocales.en, t)), e !== void 0 ? typeof e == "string" ? { compact: e, descriptive: e } : e : (console.warn(`Missing localization for key: ${t}`), { compact: "", descriptive: "" });
243
243
  }
244
244
  }
245
- gt.getInstance();
246
- var b = /* @__PURE__ */ ((r) => (r.reflowable = "reflowable", r.fixed = "fixed", r.scrolled = "scrolled", r))(b || {});
245
+ yt.getInstance();
246
+ var w = /* @__PURE__ */ ((r) => (r.reflowable = "reflowable", r.fixed = "fixed", r.scrolled = "scrolled", r))(w || {});
247
247
  class Fe {
248
248
  /**
249
249
  * Creates a [Encryption].
@@ -272,8 +272,8 @@ class Fe {
272
272
  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;
273
273
  }
274
274
  }
275
- var G = /* @__PURE__ */ ((r) => (r.left = "left", r.right = "right", r.center = "center", r))(G || {});
276
- let X = class be {
275
+ var X = /* @__PURE__ */ ((r) => (r.left = "left", r.right = "right", r.center = "center", r))(X || {});
276
+ let Y = class be {
277
277
  constructor(t) {
278
278
  this.otherProperties = t;
279
279
  }
@@ -303,16 +303,16 @@ let X = class be {
303
303
  return new be(e);
304
304
  }
305
305
  };
306
- Object.defineProperty(X.prototype, "encryption", {
306
+ Object.defineProperty(Y.prototype, "encryption", {
307
307
  get: function() {
308
308
  return Fe.deserialize(this.otherProperties.encrypted);
309
309
  }
310
310
  });
311
- function Rn(r) {
311
+ function An(r) {
312
312
  return r && Array.isArray(r) ? r : void 0;
313
313
  }
314
314
  function Yi(r) {
315
- return r && typeof r == "string" ? [r] : Rn(r);
315
+ return r && typeof r == "string" ? [r] : An(r);
316
316
  }
317
317
  function ai(r) {
318
318
  return typeof r == "string" ? new Date(r) : void 0;
@@ -323,7 +323,7 @@ function Ut(r) {
323
323
  function V(r) {
324
324
  return Ut(r) !== void 0 && Math.sign(r) >= 0 ? r : void 0;
325
325
  }
326
- function An(r) {
326
+ function Tn(r) {
327
327
  const t = new Array();
328
328
  return r.forEach((e) => t.push(e)), t;
329
329
  }
@@ -338,22 +338,22 @@ class m {
338
338
  } else
339
339
  throw new Error("Invalid media type");
340
340
  const o = {};
341
- for (let p = 1; p < n.length; p++) {
342
- const g = n[p].split("=");
341
+ for (let f = 1; f < n.length; f++) {
342
+ const g = n[f].split("=");
343
343
  if (g.length === 2) {
344
- const d = g[0].toLocaleLowerCase(), f = d === "charset" ? g[1].toUpperCase() : g[1];
345
- o[d] = f;
344
+ const u = g[0].toLocaleLowerCase(), p = u === "charset" ? g[1].toUpperCase() : g[1];
345
+ o[u] = p;
346
346
  }
347
347
  }
348
348
  const a = {}, l = Object.keys(o);
349
- l.sort((p, g) => p.localeCompare(g)), l.forEach((p) => a[p] = o[p]);
349
+ l.sort((f, g) => f.localeCompare(g)), l.forEach((f) => a[f] = o[f]);
350
350
  let h = "";
351
- for (const p in a) {
352
- const g = a[p];
353
- h += `;${p}=${g}`;
351
+ for (const f in a) {
352
+ const g = a[f];
353
+ h += `;${f}=${g}`;
354
354
  }
355
- const c = `${e}/${i}${h}`, u = a.encoding;
356
- this.string = c, this.type = e, this.subtype = i, this.parameters = a, this.encoding = u, this.name = t.name, this.fileExtension = t.fileExtension;
355
+ const c = `${e}/${i}${h}`, d = a.encoding;
356
+ this.string = c, this.type = e, this.subtype = i, this.parameters = a, this.encoding = d, this.name = t.name, this.fileExtension = t.fileExtension;
357
357
  }
358
358
  static parse(t) {
359
359
  return new m(t);
@@ -935,7 +935,7 @@ class $ {
935
935
  type: t.type,
936
936
  title: t.title,
937
937
  rels: t.rel ? Array.isArray(t.rel) ? new Set(t.rel) : /* @__PURE__ */ new Set([t.rel]) : void 0,
938
- properties: X.deserialize(t.properties),
938
+ properties: Y.deserialize(t.properties),
939
939
  height: V(t.height),
940
940
  width: V(t.width),
941
941
  size: V(t.size),
@@ -951,7 +951,7 @@ class $ {
951
951
  */
952
952
  serialize() {
953
953
  const t = { href: this.href };
954
- 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 = An(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;
954
+ 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 = Tn(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;
955
955
  }
956
956
  /** MediaType of the linked resource. */
957
957
  get mediaType() {
@@ -984,7 +984,7 @@ class $ {
984
984
  */
985
985
  addProperties(t) {
986
986
  const e = $.deserialize(this.serialize());
987
- return e.properties = e.properties ? e.properties?.add(t) : new X(t), e;
987
+ return e.properties = e.properties ? e.properties?.add(t) : new Y(t), e;
988
988
  }
989
989
  /**
990
990
  * Creates a [Locator] from a reading order [Link].
@@ -1096,7 +1096,7 @@ class Bt {
1096
1096
  }
1097
1097
  }
1098
1098
  var qi = /* @__PURE__ */ ((r) => (r.EPUB = "https://readium.org/webpub-manifest/profiles/epub", r.AUDIOBOOK = "https://readium.org/webpub-manifest/profiles/audiobook", r.DIVINA = "https://readium.org/webpub-manifest/profiles/divina", r.PDF = "https://readium.org/webpub-manifest/profiles/pdf", r))(qi || {}), M = /* @__PURE__ */ ((r) => (r.ltr = "ltr", r.rtl = "rtl", r))(M || {});
1099
- X.prototype.getContains = function() {
1099
+ Y.prototype.getContains = function() {
1100
1100
  return new Set(this.otherProperties.contains || []);
1101
1101
  };
1102
1102
  class Vt {
@@ -1320,42 +1320,42 @@ class Ue {
1320
1320
  return this.since !== void 0 && (t.since = this.since.toISOString()), this.until !== void 0 && (t.until = this.until.toISOString()), t;
1321
1321
  }
1322
1322
  }
1323
- X.prototype.getNumberOfItems = function() {
1323
+ Y.prototype.getNumberOfItems = function() {
1324
1324
  return V(this.otherProperties.numberOfItems);
1325
1325
  };
1326
- X.prototype.getPrice = function() {
1326
+ Y.prototype.getPrice = function() {
1327
1327
  return ze.deserialize(this.otherProperties.price);
1328
1328
  };
1329
- X.prototype.getIndirectAcquisitions = function() {
1329
+ Y.prototype.getIndirectAcquisitions = function() {
1330
1330
  const r = this.otherProperties.indirectAcquisition;
1331
1331
  if (r && Array.isArray(r))
1332
1332
  return r.map((t) => xt.deserialize(t)).filter((t) => t !== void 0);
1333
1333
  };
1334
- X.prototype.getHolds = function() {
1334
+ Y.prototype.getHolds = function() {
1335
1335
  return De.deserialize(this.otherProperties.holds);
1336
1336
  };
1337
- X.prototype.getCopies = function() {
1337
+ Y.prototype.getCopies = function() {
1338
1338
  return We.deserialize(this.otherProperties.copies);
1339
1339
  };
1340
- X.prototype.getAvailability = function() {
1340
+ Y.prototype.getAvailability = function() {
1341
1341
  return Ue.deserialize(this.otherProperties.availability);
1342
1342
  };
1343
- X.prototype.getAuthenticate = function() {
1343
+ Y.prototype.getAuthenticate = function() {
1344
1344
  return $.deserialize(this.otherProperties.authenticate);
1345
1345
  };
1346
- const Tn = "CssSelectorGenerator";
1346
+ const Nn = "CssSelectorGenerator";
1347
1347
  function hi(r = "unknown problem", ...t) {
1348
- console.warn(`${Tn}: ${r}`, ...t);
1348
+ console.warn(`${Nn}: ${r}`, ...t);
1349
1349
  }
1350
- function Nn(r) {
1350
+ function Mn(r) {
1351
1351
  return r instanceof RegExp;
1352
1352
  }
1353
- function Mn(r) {
1353
+ function Fn(r) {
1354
1354
  return r.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
1355
1355
  }
1356
- function Fn(r) {
1356
+ function In(r) {
1357
1357
  const t = r.map((e) => {
1358
- if (Nn(e))
1358
+ if (Mn(e))
1359
1359
  return (i) => e.test(i);
1360
1360
  if (typeof e == "function")
1361
1361
  return (i) => {
@@ -1363,21 +1363,21 @@ function Fn(r) {
1363
1363
  return typeof n != "boolean" ? (hi("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : n;
1364
1364
  };
1365
1365
  if (typeof e == "string") {
1366
- const i = new RegExp("^" + Mn(e) + "$");
1366
+ const i = new RegExp("^" + Fn(e) + "$");
1367
1367
  return (n) => i.test(n);
1368
1368
  }
1369
1369
  return hi("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
1370
1370
  });
1371
1371
  return (e) => t.some((i) => i(e));
1372
1372
  }
1373
- Fn([
1373
+ In([
1374
1374
  "class",
1375
1375
  "id",
1376
1376
  // Angular attributes
1377
1377
  "ng-*"
1378
1378
  ]);
1379
- const In = Math.pow(2, 32), ci = () => Math.round(Math.random() * In).toString(36), we = () => `${Math.round(performance.now())}-${ci()}-${ci()}`, ft = 1;
1380
- class zn {
1379
+ const zn = Math.pow(2, 32), ci = () => Math.round(Math.random() * zn).toString(36), we = () => `${Math.round(performance.now())}-${ci()}-${ci()}`, mt = 1;
1380
+ class Dn {
1381
1381
  constructor(t) {
1382
1382
  this.destination = null, this.registrar = /* @__PURE__ */ new Map(), this.origin = "", this.channelId = "", this.receiver = this.receive.bind(this), this.preLog = [], this.wnd = t, t.addEventListener("message", this.receiver);
1383
1383
  }
@@ -1388,8 +1388,8 @@ class zn {
1388
1388
  if (!(!("_readium" in e) || !e._readium || e._readium <= 0)) {
1389
1389
  if (e.key === "_ping") {
1390
1390
  if (!this.destination) {
1391
- if (this.destination = t.source, this.origin = t.origin, this.channelId = e._channel, e._readium !== ft) {
1392
- e._readium > ft ? this.send("error", `received comms version ${e._readium} higher than ${ft}`) : this.send("error", `received comms version ${e._readium} lower than ${ft}`), this.destination = null, this.origin = "", this.channelId = "";
1391
+ if (this.destination = t.source, this.origin = t.origin, this.channelId = e._channel, e._readium !== mt) {
1392
+ e._readium > mt ? this.send("error", `received comms version ${e._readium} higher than ${mt}`) : this.send("error", `received comms version ${e._readium} lower than ${mt}`), this.destination = null, this.origin = "", this.channelId = "";
1393
1393
  return;
1394
1394
  }
1395
1395
  this.send("_pong", void 0), this.preLog.forEach((i) => this.send("log", i)), this.preLog = [];
@@ -1449,7 +1449,7 @@ class zn {
1449
1449
  send(t, e, i = void 0, n = []) {
1450
1450
  if (!this.destination) throw Error("Attempted to send comms message before destination has been initialized");
1451
1451
  const s = {
1452
- _readium: ft,
1452
+ _readium: mt,
1453
1453
  _channel: this.channelId,
1454
1454
  id: i ?? we(),
1455
1455
  // scrict,
@@ -1472,7 +1472,7 @@ class Et {
1472
1472
  function di(r) {
1473
1473
  return r.split("").reverse().join("");
1474
1474
  }
1475
- function Dn(r, t, e) {
1475
+ function Wn(r, t, e) {
1476
1476
  const i = di(t);
1477
1477
  return e.map((n) => {
1478
1478
  const s = Math.max(0, n.end - t.length - n.errors), o = di(r.slice(s, n.end));
@@ -1489,9 +1489,9 @@ function de(r) {
1489
1489
  function ui(r, t, e, i) {
1490
1490
  let n = r.P[e], s = r.M[e];
1491
1491
  const o = i >>> 31, a = t[e] | o, l = a | s, h = (a & n) + n ^ n | a;
1492
- let c = s | ~(h | n), u = n & h;
1493
- const p = de(c & r.lastRowMask[e]) - de(u & r.lastRowMask[e]);
1494
- return c <<= 1, u <<= 1, u |= o, c |= de(i) - o, n = u | ~(l | c), s = c & l, r.P[e] = n, r.M[e] = s, p;
1492
+ let c = s | ~(h | n), d = n & h;
1493
+ const f = de(c & r.lastRowMask[e]) - de(d & r.lastRowMask[e]);
1494
+ return c <<= 1, d <<= 1, d |= o, c |= de(i) - o, n = d | ~(l | c), s = c & l, r.P[e] = n, r.M[e] = s, f;
1495
1495
  }
1496
1496
  function Ki(r, t, e) {
1497
1497
  if (t.length === 0)
@@ -1504,61 +1504,61 @@ function Ki(r, t, e) {
1504
1504
  };
1505
1505
  o.lastRowMask.fill(1 << 31), o.lastRowMask[s] = 1 << (t.length - 1) % n;
1506
1506
  const a = new Uint32Array(s + 1), l = /* @__PURE__ */ new Map(), h = [];
1507
- for (let p = 0; p < 256; p++)
1507
+ for (let f = 0; f < 256; f++)
1508
1508
  h.push(a);
1509
- for (let p = 0; p < t.length; p += 1) {
1510
- const g = t.charCodeAt(p);
1509
+ for (let f = 0; f < t.length; f += 1) {
1510
+ const g = t.charCodeAt(f);
1511
1511
  if (l.has(g))
1512
1512
  continue;
1513
- const d = new Uint32Array(s + 1);
1514
- l.set(g, d), g < h.length && (h[g] = d);
1515
- for (let f = 0; f <= s; f += 1) {
1516
- d[f] = 0;
1517
- for (let w = 0; w < n; w += 1) {
1518
- const P = f * n + w;
1519
- if (P >= t.length)
1513
+ const u = new Uint32Array(s + 1);
1514
+ l.set(g, u), g < h.length && (h[g] = u);
1515
+ for (let p = 0; p <= s; p += 1) {
1516
+ u[p] = 0;
1517
+ for (let b = 0; b < n; b += 1) {
1518
+ const v = p * n + b;
1519
+ if (v >= t.length)
1520
1520
  continue;
1521
- t.charCodeAt(P) === g && (d[f] |= 1 << w);
1521
+ t.charCodeAt(v) === g && (u[p] |= 1 << b);
1522
1522
  }
1523
1523
  }
1524
1524
  }
1525
1525
  let c = Math.max(0, Math.ceil(e / n) - 1);
1526
- const u = new Uint32Array(s + 1);
1527
- for (let p = 0; p <= c; p += 1)
1528
- u[p] = (p + 1) * n;
1529
- u[s] = t.length;
1530
- for (let p = 0; p <= c; p += 1)
1531
- o.P[p] = -1, o.M[p] = 0;
1532
- for (let p = 0; p < r.length; p += 1) {
1533
- const g = r.charCodeAt(p);
1534
- let d;
1535
- g < h.length ? d = h[g] : (d = l.get(g), typeof d > "u" && (d = a));
1536
- let f = 0;
1537
- for (let w = 0; w <= c; w += 1)
1538
- f = ui(o, d, w, f), u[w] += f;
1539
- if (u[c] - f <= e && c < s && (d[c + 1] & 1 || f < 0)) {
1526
+ const d = new Uint32Array(s + 1);
1527
+ for (let f = 0; f <= c; f += 1)
1528
+ d[f] = (f + 1) * n;
1529
+ d[s] = t.length;
1530
+ for (let f = 0; f <= c; f += 1)
1531
+ o.P[f] = -1, o.M[f] = 0;
1532
+ for (let f = 0; f < r.length; f += 1) {
1533
+ const g = r.charCodeAt(f);
1534
+ let u;
1535
+ g < h.length ? u = h[g] : (u = l.get(g), typeof u > "u" && (u = a));
1536
+ let p = 0;
1537
+ for (let b = 0; b <= c; b += 1)
1538
+ p = ui(o, u, b, p), d[b] += p;
1539
+ if (d[c] - p <= e && c < s && (u[c + 1] & 1 || p < 0)) {
1540
1540
  c += 1, o.P[c] = -1, o.M[c] = 0;
1541
- let w;
1541
+ let b;
1542
1542
  if (c === s) {
1543
- const P = t.length % n;
1544
- w = P === 0 ? n : P;
1543
+ const v = t.length % n;
1544
+ b = v === 0 ? n : v;
1545
1545
  } else
1546
- w = n;
1547
- u[c] = u[c - 1] + w - f + ui(o, d, c, f);
1546
+ b = n;
1547
+ d[c] = d[c - 1] + b - p + ui(o, u, c, p);
1548
1548
  } else
1549
- for (; c > 0 && u[c] >= e + n; )
1549
+ for (; c > 0 && d[c] >= e + n; )
1550
1550
  c -= 1;
1551
- c === s && u[c] <= e && (u[c] < e && i.splice(0, i.length), i.push({
1551
+ c === s && d[c] <= e && (d[c] < e && i.splice(0, i.length), i.push({
1552
1552
  start: -1,
1553
- end: p + 1,
1554
- errors: u[c]
1555
- }), e = u[c]);
1553
+ end: f + 1,
1554
+ errors: d[c]
1555
+ }), e = d[c]);
1556
1556
  }
1557
1557
  return i;
1558
1558
  }
1559
- function Wn(r, t, e) {
1559
+ function Un(r, t, e) {
1560
1560
  const i = Ki(r, t, e);
1561
- return Dn(r, t, i);
1561
+ return Wn(r, t, i);
1562
1562
  }
1563
1563
  function Ji(r, t, e) {
1564
1564
  let i = 0;
@@ -1569,30 +1569,30 @@ function Ji(r, t, e) {
1569
1569
  end: i + t.length,
1570
1570
  errors: 0
1571
1571
  }), i += 1);
1572
- return n.length > 0 ? n : Wn(r, t, e);
1572
+ return n.length > 0 ? n : Un(r, t, e);
1573
1573
  }
1574
1574
  function pi(r, t) {
1575
1575
  return t.length === 0 || r.length === 0 ? 0 : 1 - Ji(r, t, t.length)[0].errors / t.length;
1576
1576
  }
1577
- function Un(r, t, e = {}) {
1577
+ function Hn(r, t, e = {}) {
1578
1578
  if (t.length === 0)
1579
1579
  return null;
1580
1580
  const i = Math.min(256, t.length / 2), n = Ji(r, t, i);
1581
1581
  if (n.length === 0)
1582
1582
  return null;
1583
1583
  const s = (a) => {
1584
- const p = 1 - a.errors / t.length, g = e.prefix ? pi(
1584
+ const f = 1 - a.errors / t.length, g = e.prefix ? pi(
1585
1585
  r.slice(
1586
1586
  Math.max(0, a.start - e.prefix.length),
1587
1587
  a.start
1588
1588
  ),
1589
1589
  e.prefix
1590
- ) : 1, d = e.suffix ? pi(
1590
+ ) : 1, u = e.suffix ? pi(
1591
1591
  r.slice(a.end, a.end + e.suffix.length),
1592
1592
  e.suffix
1593
1593
  ) : 1;
1594
- let f = 1;
1595
- return typeof e.hint == "number" && (f = 1 - Math.abs(a.start - e.hint) / r.length), (50 * p + 20 * g + 20 * d + 2 * f) / 92;
1594
+ let p = 1;
1595
+ return typeof e.hint == "number" && (p = 1 - Math.abs(a.start - e.hint) / r.length), (50 * f + 20 * g + 20 * u + 2 * p) / 92;
1596
1596
  }, o = n.map((a) => ({
1597
1597
  start: a.start,
1598
1598
  end: a.end,
@@ -1600,7 +1600,7 @@ function Un(r, t, e = {}) {
1600
1600
  }));
1601
1601
  return o.sort((a, l) => l.score - a.score), o[0];
1602
1602
  }
1603
- function Se(r, t, e) {
1603
+ function ve(r, t, e) {
1604
1604
  const i = e === 1 ? t : t - 1;
1605
1605
  if (r.charAt(i).trim() !== "")
1606
1606
  return t;
@@ -1623,7 +1623,7 @@ function fi(r, t) {
1623
1623
  const a = () => {
1624
1624
  if (s = t === 1 ? e.nextNode() : e.previousNode(), s) {
1625
1625
  const l = s.textContent, h = t === 1 ? 0 : l.length;
1626
- o = Se(l, h, t);
1626
+ o = ve(l, h, t);
1627
1627
  }
1628
1628
  };
1629
1629
  for (; s && o === -1 && s !== n; )
@@ -1632,7 +1632,7 @@ function fi(r, t) {
1632
1632
  return { node: s, offset: o };
1633
1633
  throw new RangeError("No text nodes with non-whitespace text found in range");
1634
1634
  }
1635
- function Hn(r) {
1635
+ function Bn(r) {
1636
1636
  if (!r.toString().trim().length)
1637
1637
  throw new RangeError("Range contains no non-whitespace text");
1638
1638
  if (r.startContainer.nodeType !== Node.TEXT_NODE)
@@ -1642,13 +1642,13 @@ function Hn(r) {
1642
1642
  const t = r.cloneRange();
1643
1643
  let e = !1, i = !1;
1644
1644
  const n = {
1645
- start: Se(
1645
+ start: ve(
1646
1646
  r.startContainer.textContent,
1647
1647
  r.startOffset,
1648
1648
  1
1649
1649
  /* Forwards */
1650
1650
  ),
1651
- end: Se(
1651
+ end: ve(
1652
1652
  r.endContainer.textContent,
1653
1653
  r.endOffset,
1654
1654
  2
@@ -1868,7 +1868,7 @@ class et {
1868
1868
  * whitespace
1869
1869
  */
1870
1870
  static trimmedRange(t) {
1871
- return Hn(et.fromRange(t).toRange());
1871
+ return Bn(et.fromRange(t).toRange());
1872
1872
  }
1873
1873
  }
1874
1874
  class jt {
@@ -1932,7 +1932,7 @@ class $t {
1932
1932
  return this.toPositionAnchor(t).toRange();
1933
1933
  }
1934
1934
  toPositionAnchor(t = {}) {
1935
- const e = this.root.textContent, i = Un(e, this.exact, {
1935
+ const e = this.root.textContent, i = Hn(e, this.exact, {
1936
1936
  ...this.context,
1937
1937
  hint: t.hint
1938
1938
  });
@@ -1941,7 +1941,7 @@ class $t {
1941
1941
  return new jt(this.root, i.start, i.end);
1942
1942
  }
1943
1943
  }
1944
- function Bn(r) {
1944
+ function Vn(r) {
1945
1945
  const t = r.tagName.toUpperCase();
1946
1946
  return t === "IMG" || t === "VIDEO" || t === "AUDIO" || t === "IFRAME" || t === "OBJECT" || t === "EMBED" || t === "CANVAS";
1947
1947
  }
@@ -1970,7 +1970,7 @@ function It(r, t) {
1970
1970
  }
1971
1971
  if (n) {
1972
1972
  const s = r.createRange();
1973
- return n.childNodes.length === 0 || Bn(n) ? (s.selectNode(n), s) : (s.setStartBefore(n), s.setEndAfter(n), s);
1973
+ return n.childNodes.length === 0 || Vn(n) ? (s.selectNode(n), s) : (s.setStartBefore(n), s.setEndAfter(n), s);
1974
1974
  }
1975
1975
  }
1976
1976
  } catch (e) {
@@ -1978,7 +1978,7 @@ function It(r, t) {
1978
1978
  }
1979
1979
  return null;
1980
1980
  }
1981
- function Vn(r, t) {
1981
+ function jn(r, t) {
1982
1982
  let e = r.getClientRects();
1983
1983
  e.length || r.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (e = r.commonAncestorContainer.getClientRects());
1984
1984
  const i = 1, n = [];
@@ -1994,7 +1994,7 @@ function Vn(r, t) {
1994
1994
  const s = tn(
1995
1995
  n,
1996
1996
  i
1997
- ), o = $n(s, i), a = en(o), l = 4;
1997
+ ), o = Gn(s, i), a = en(o), l = 4;
1998
1998
  for (let h = a.length - 1; h >= 0; h--) {
1999
1999
  const c = a[h];
2000
2000
  if (!(c.width * c.height > l))
@@ -2013,16 +2013,16 @@ function tn(r, t, e) {
2013
2013
  continue;
2014
2014
  const a = j(s.top, o.top, t) && j(s.bottom, o.bottom, t), l = j(s.left, o.left, t) && j(s.right, o.right, t);
2015
2015
  if (a && !l && nn(s, o, t)) {
2016
- const u = r.filter((g) => g !== s && g !== o), p = jn(s, o);
2017
- return u.push(p), tn(
2018
- u,
2016
+ const d = r.filter((g) => g !== s && g !== o), f = $n(s, o);
2017
+ return d.push(f), tn(
2018
+ d,
2019
2019
  t
2020
2020
  );
2021
2021
  }
2022
2022
  }
2023
2023
  return r;
2024
2024
  }
2025
- function jn(r, t) {
2025
+ function $n(r, t) {
2026
2026
  const e = Math.min(r.left, t.left), i = Math.max(r.right, t.right), n = Math.min(r.top, t.top), s = Math.max(r.bottom, t.bottom);
2027
2027
  return {
2028
2028
  bottom: s,
@@ -2033,7 +2033,7 @@ function jn(r, t) {
2033
2033
  width: i - e
2034
2034
  };
2035
2035
  }
2036
- function $n(r, t) {
2036
+ function Gn(r, t) {
2037
2037
  const e = new Set(r);
2038
2038
  for (const i of r) {
2039
2039
  if (!(i.width > 1 && i.height > 1)) {
@@ -2041,14 +2041,14 @@ function $n(r, t) {
2041
2041
  continue;
2042
2042
  }
2043
2043
  for (const s of r)
2044
- if (i !== s && e.has(s) && Gn(s, i, t)) {
2044
+ if (i !== s && e.has(s) && Xn(s, i, t)) {
2045
2045
  e.delete(i);
2046
2046
  break;
2047
2047
  }
2048
2048
  }
2049
2049
  return Array.from(e);
2050
2050
  }
2051
- function Gn(r, t, e) {
2051
+ function Xn(r, t, e) {
2052
2052
  return zt(r, t.left, t.top, e) && zt(r, t.right, t.top, e) && zt(r, t.left, t.bottom, e) && zt(r, t.right, t.bottom, e);
2053
2053
  }
2054
2054
  function zt(r, t, e, i) {
@@ -2074,7 +2074,7 @@ function en(r) {
2074
2074
  return r;
2075
2075
  }
2076
2076
  function gi(r, t) {
2077
- const e = Xn(t, r);
2077
+ const e = Yn(t, r);
2078
2078
  if (e.height === 0 || e.width === 0)
2079
2079
  return [r];
2080
2080
  const i = [];
@@ -2124,7 +2124,7 @@ function gi(r, t) {
2124
2124
  }
2125
2125
  return i;
2126
2126
  }
2127
- function Xn(r, t) {
2127
+ function Yn(r, t) {
2128
2128
  const e = Math.max(r.left, t.left), i = Math.min(r.right, t.right), n = Math.max(r.top, t.top), s = Math.min(r.bottom, t.bottom);
2129
2129
  return {
2130
2130
  bottom: s,
@@ -2165,7 +2165,7 @@ function re(r, t) {
2165
2165
  r.document.documentElement.style.removeProperty(t);
2166
2166
  }
2167
2167
  let Dt = null, pe = null, Ct = 0;
2168
- const mt = { r: 255, g: 255, b: 255, a: 1 }, ct = /* @__PURE__ */ new Map(), Yn = () => {
2168
+ const gt = { r: 255, g: 255, b: 255, a: 1 }, dt = /* @__PURE__ */ new Map(), qn = () => {
2169
2169
  if (!Dt)
2170
2170
  if (typeof OffscreenCanvas < "u")
2171
2171
  Dt = new OffscreenCanvas(5, 5), pe = Dt.getContext("2d", {
@@ -2180,7 +2180,7 @@ const mt = { r: 255, g: 255, b: 255, a: 1 }, ct = /* @__PURE__ */ new Map(), Yn
2180
2180
  });
2181
2181
  }
2182
2182
  return pe;
2183
- }, qn = (r) => {
2183
+ }, Kn = (r) => {
2184
2184
  if (!r) return !0;
2185
2185
  const t = r.trim().toLowerCase();
2186
2186
  return t.startsWith("var(") || [
@@ -2201,30 +2201,30 @@ const mt = { r: 255, g: 255, b: 255, a: 1 }, ct = /* @__PURE__ */ new Map(), Yn
2201
2201
  ].some((n) => t.includes(n));
2202
2202
  }, Wt = (r, t) => {
2203
2203
  console.warn(
2204
- `[Decorator] Could not parse color: "${r}". ${t} Falling back to ${JSON.stringify(mt)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`
2204
+ `[Decorator] Could not parse color: "${r}". ${t} Falling back to ${JSON.stringify(gt)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`
2205
2205
  );
2206
- }, ve = (r, t = null) => {
2207
- const e = t ? `${r}|${t}` : r, i = ct.get(e);
2206
+ }, Se = (r, t = null) => {
2207
+ const e = t ? `${r}|${t}` : r, i = dt.get(e);
2208
2208
  if (i !== void 0)
2209
- return i ?? mt;
2210
- if (qn(r))
2211
- return Wt(r, "Unsupported color format or special value."), ct.set(e, null), mt;
2212
- const n = Yn();
2209
+ return i ?? gt;
2210
+ if (Kn(r))
2211
+ return Wt(r, "Unsupported color format or special value."), dt.set(e, null), gt;
2212
+ const n = qn();
2213
2213
  if (!n)
2214
- return Wt(r, "Could not get canvas context."), ct.set(e, null), mt;
2214
+ return Wt(r, "Could not get canvas context."), dt.set(e, null), gt;
2215
2215
  try {
2216
2216
  Ct === 0 && n.clearRect(0, 0, 5, 5);
2217
2217
  const s = Ct % 5, o = Math.floor(Ct / 5);
2218
2218
  n.clearRect(s, o, 1, 1), t && (n.fillStyle = t, n.fillRect(s, o, 1, 1)), n.fillStyle = r, n.fillRect(s, o, 1, 1);
2219
2219
  const a = n.getImageData(s, o, 1, 1);
2220
2220
  Ct = (Ct + 1) % 25;
2221
- const [l, h, c, u] = a.data;
2222
- if (u === 0)
2223
- return Wt(r, "Fully transparent color."), ct.set(e, null), mt;
2224
- const p = { r: l, g: h, b: c, a: u / 255 };
2225
- return ct.set(e, p), p;
2221
+ const [l, h, c, d] = a.data;
2222
+ if (d === 0)
2223
+ return Wt(r, "Fully transparent color."), dt.set(e, null), gt;
2224
+ const f = { r: l, g: h, b: c, a: d / 255 };
2225
+ return dt.set(e, f), f;
2226
2226
  } catch (s) {
2227
- return Wt(r, `Error: ${s instanceof Error ? s.message : String(s)}`), ct.set(e, null), mt;
2227
+ return Wt(r, `Error: ${s instanceof Error ? s.message : String(s)}`), dt.set(e, null), gt;
2228
2228
  }
2229
2229
  }, fe = (r) => {
2230
2230
  const t = r / 255;
@@ -2233,20 +2233,20 @@ const mt = { r: 255, g: 255, b: 255, a: 1 }, ct = /* @__PURE__ */ new Map(), Yn
2233
2233
  const t = fe(r.r), e = fe(r.g), i = fe(r.b);
2234
2234
  return 0.2126 * t + 0.7152 * e + 0.0722 * i;
2235
2235
  }, bi = (r, t) => {
2236
- const e = typeof r == "string" ? ve(r) : r, i = typeof t == "string" ? ve(t) : t, n = yi(e), s = yi(i), o = Math.max(n, s), a = Math.min(n, s);
2236
+ const e = typeof r == "string" ? Se(r) : r, i = typeof t == "string" ? Se(t) : t, n = yi(e), s = yi(i), o = Math.max(n, s), a = Math.min(n, s);
2237
2237
  return (o + 0.05) / (a + 0.05);
2238
2238
  }, Pe = (r, t = null) => {
2239
- const e = ve(r, t), i = bi(e, { r: 255, g: 255, b: 255, a: 1 }), n = bi(e, { r: 0, g: 0, b: 0, a: 1 });
2239
+ const e = Se(r, t), i = bi(e, { r: 255, g: 255, b: 255, a: 1 }), n = bi(e, { r: 0, g: 0, b: 0, a: 1 });
2240
2240
  return i > n;
2241
- }, Kn = (r, t = null) => Pe(r, t) ? "white" : "black", wi = "#FFFF00", Jn = () => "Highlight" in window, Si = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
2242
- class Zn {
2241
+ }, Jn = (r, t = null) => Pe(r, t) ? "white" : "black", wi = "#FFFF00", Zn = () => "Highlight" in window, vi = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
2242
+ class Qn {
2243
2243
  /**
2244
2244
  * Creates a DecorationGroup object
2245
2245
  * @param id Unique HTML ID-adhering name of the group
2246
2246
  * @param name Human-readable name of the group
2247
2247
  */
2248
2248
  constructor(t, e, i, n) {
2249
- this.wnd = t, this.comms = e, this.id = i, this.name = n, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, Jn() && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
2249
+ this.wnd = t, this.comms = e, this.id = i, this.name = n, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, Zn() && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
2250
2250
  }
2251
2251
  get activeable() {
2252
2252
  return this.activateable;
@@ -2265,7 +2265,7 @@ class Zn {
2265
2265
  return;
2266
2266
  }
2267
2267
  const n = i.commonAncestorContainer;
2268
- n.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Si.includes(n.nodeName.toUpperCase()) && this.notTextFlag?.set(e, !0), i.cloneContents().querySelector(Si.join(", ").toLowerCase()) && this.notTextFlag?.set(e, !0), (n.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(e, !0));
2268
+ n.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (vi.includes(n.nodeName.toUpperCase()) && this.notTextFlag?.set(e, !0), i.cloneContents().querySelector(vi.join(", ").toLowerCase()) && this.notTextFlag?.set(e, !0), (n.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(e, !0));
2269
2269
  const s = {
2270
2270
  decoration: t,
2271
2271
  id: e,
@@ -2309,7 +2309,7 @@ class Zn {
2309
2309
  const n = ue(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"), s = t.decoration?.style?.tint ?? wi;
2310
2310
  e.innerHTML = `
2311
2311
  ::highlight(${this.id}) {
2312
- color: ${Kn(s, n)};
2312
+ color: ${Jn(s, n)};
2313
2313
  background-color: ${s};
2314
2314
  }`;
2315
2315
  }
@@ -2326,48 +2326,48 @@ class Zn {
2326
2326
  getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
2327
2327
  "column-count"
2328
2328
  )
2329
- ), s = i / (n || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, l = o.scrollTop, h = (d, f, w) => {
2330
- if (d.style.position = "absolute", t.decoration?.style?.width === "viewport") {
2331
- d.style.width = `${i}px`, d.style.height = `${f.height}px`;
2332
- let P = Math.floor(f.left / i) * i;
2333
- d.style.left = `${P + a}px`, d.style.top = `${f.top + l}px`;
2329
+ ), s = i / (n || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, l = o.scrollTop, h = (u, p, b) => {
2330
+ if (u.style.position = "absolute", t.decoration?.style?.width === "viewport") {
2331
+ u.style.width = `${i}px`, u.style.height = `${p.height}px`;
2332
+ let v = Math.floor(p.left / i) * i;
2333
+ u.style.left = `${v + a}px`, u.style.top = `${p.top + l}px`;
2334
2334
  } else if (t.decoration?.style?.width === "bounds")
2335
- d.style.width = `${w.width}px`, d.style.height = `${f.height}px`, d.style.left = `${w.left + a}px`, d.style.top = `${f.top + l}px`;
2335
+ u.style.width = `${b.width}px`, u.style.height = `${p.height}px`, u.style.left = `${b.left + a}px`, u.style.top = `${p.top + l}px`;
2336
2336
  else if (t.decoration?.style?.width === "page") {
2337
- d.style.width = `${s}px`, d.style.height = `${f.height}px`;
2338
- let P = Math.floor(f.left / s) * s;
2339
- d.style.left = `${P + a}px`, d.style.top = `${f.top + l}px`;
2337
+ u.style.width = `${s}px`, u.style.height = `${p.height}px`;
2338
+ let v = Math.floor(p.left / s) * s;
2339
+ u.style.left = `${v + a}px`, u.style.top = `${p.top + l}px`;
2340
2340
  } else
2341
- d.style.width = `${f.width}px`, d.style.height = `${f.height}px`, d.style.left = `${f.left + a}px`, d.style.top = `${f.top + l}px`;
2341
+ u.style.width = `${p.width}px`, u.style.height = `${p.height}px`, u.style.left = `${p.left + a}px`, u.style.top = `${p.top + l}px`;
2342
2342
  }, c = t.range.getBoundingClientRect();
2343
- let u = this.wnd.document.createElement("template");
2344
- const p = this.getCurrentDarkMode();
2345
- u.innerHTML = `
2343
+ let d = this.wnd.document.createElement("template");
2344
+ const f = this.getCurrentDarkMode();
2345
+ d.innerHTML = `
2346
2346
  <div
2347
2347
  data-readium="true"
2348
2348
  class="readium-highlight"
2349
2349
  style="${[
2350
2350
  `background-color: ${t.decoration?.style?.tint ?? wi} !important`,
2351
2351
  //"opacity: 0.3 !important",
2352
- `mix-blend-mode: ${p ? "exclusion" : "multiply"} !important`,
2352
+ `mix-blend-mode: ${f ? "exclusion" : "multiply"} !important`,
2353
2353
  "opacity: 1 !important",
2354
2354
  "box-sizing: border-box !important"
2355
2355
  ].join("; ")}"
2356
2356
  >
2357
2357
  </div>
2358
2358
  `.trim();
2359
- const g = u.content.firstElementChild;
2359
+ const g = d.content.firstElementChild;
2360
2360
  if (t.decoration?.style?.layout === "bounds") {
2361
- const d = g.cloneNode(!0);
2362
- d.style.setProperty("pointer-events", "none"), h(d, c, c), e.append(d);
2361
+ const u = g.cloneNode(!0);
2362
+ u.style.setProperty("pointer-events", "none"), h(u, c, c), e.append(u);
2363
2363
  } else {
2364
- let d = Vn(
2364
+ let u = jn(
2365
2365
  t.range
2366
2366
  );
2367
- d = d.sort((f, w) => f.top < w.top ? -1 : f.top > w.top ? 1 : 0);
2368
- for (let f of d) {
2369
- const w = g.cloneNode(!0);
2370
- w.style.setProperty("pointer-events", "none"), h(w, f, c), e.append(w);
2367
+ u = u.sort((p, b) => p.top < b.top ? -1 : p.top > b.top ? 1 : 0);
2368
+ for (let p of u) {
2369
+ const b = g.cloneNode(!0);
2370
+ b.style.setProperty("pointer-events", "none"), h(b, p, c), e.append(b);
2371
2371
  }
2372
2372
  }
2373
2373
  t.container = e, t.clickableElements = Array.from(
@@ -2403,7 +2403,7 @@ class Zn {
2403
2403
  this.experimentalHighlights && this.wnd.CSS.highlights.delete(this.id), this.container && (this.container.remove(), this.container = void 0);
2404
2404
  }
2405
2405
  }
2406
- const Ot = class Ot extends Et {
2406
+ const Rt = class Rt extends Et {
2407
2407
  constructor() {
2408
2408
  super(...arguments), this.resizeFrame = 0, this.lastGroupId = 0, this.groups = /* @__PURE__ */ new Map(), this.handleResizer = this.handleResize.bind(this);
2409
2409
  }
@@ -2428,9 +2428,9 @@ const Ot = class Ot extends Et {
2428
2428
  }, 50);
2429
2429
  }
2430
2430
  mount(t, e) {
2431
- return this.wnd = t, e.register("decorate", Ot.moduleName, (i, n) => {
2431
+ return this.wnd = t, e.register("decorate", Rt.moduleName, (i, n) => {
2432
2432
  const s = i;
2433
- s.decoration && s.decoration.locator && (s.decoration.locator = I.deserialize(s.decoration.locator)), this.groups.has(s.group) || this.groups.set(s.group, new Zn(
2433
+ s.decoration && s.decoration.locator && (s.decoration.locator = I.deserialize(s.decoration.locator)), this.groups.has(s.group) || this.groups.set(s.group, new Qn(
2434
2434
  t,
2435
2435
  e,
2436
2436
  `readium-decoration-${this.lastGroupId++}`,
@@ -2455,8 +2455,8 @@ const Ot = class Ot extends Et {
2455
2455
  }), this.resizeObserver = new ResizeObserver(() => t.requestAnimationFrame(() => this.handleResize())), this.resizeObserver.observe(t.document.body), t.addEventListener("orientationchange", this.handleResizer), t.addEventListener("resize", this.handleResizer), this.backgroundObserver = new MutationObserver((i) => {
2456
2456
  i.some((s) => {
2457
2457
  if (s.type === "attributes" && s.attributeName === "style") {
2458
- const o = s.target, a = s.oldValue, l = o.getAttribute("style"), h = this.extractCustomProperty(a, "--USER__appearance"), c = this.extractCustomProperty(l, "--USER__appearance"), u = this.extractCustomProperty(a, "--USER__backgroundColor"), p = this.extractCustomProperty(l, "--USER__backgroundColor");
2459
- return h !== c || u !== p;
2458
+ const o = s.target, a = s.oldValue, l = o.getAttribute("style"), h = this.extractCustomProperty(a, "--USER__appearance"), c = this.extractCustomProperty(l, "--USER__appearance"), d = this.extractCustomProperty(a, "--USER__backgroundColor"), f = this.extractCustomProperty(l, "--USER__backgroundColor");
2459
+ return h !== c || d !== f;
2460
2460
  }
2461
2461
  return !1;
2462
2462
  }) && this.updateHighlightStyles();
@@ -2468,12 +2468,12 @@ const Ot = class Ot extends Et {
2468
2468
  }), e.log("Decorator Mounted"), !0;
2469
2469
  }
2470
2470
  unmount(t, e) {
2471
- return t.removeEventListener("orientationchange", this.handleResizer), t.removeEventListener("resize", this.handleResizer), e.unregisterAll(Ot.moduleName), this.resizeObserver.disconnect(), this.backgroundObserver.disconnect(), this.cleanup(), e.log("Decorator Unmounted"), !0;
2471
+ return t.removeEventListener("orientationchange", this.handleResizer), t.removeEventListener("resize", this.handleResizer), e.unregisterAll(Rt.moduleName), this.resizeObserver.disconnect(), this.backgroundObserver.disconnect(), this.cleanup(), e.log("Decorator Unmounted"), !0;
2472
2472
  }
2473
2473
  };
2474
- Ot.moduleName = "decorator";
2475
- let Ee = Ot;
2476
- const vi = "readium-snapper-style", Rt = class Rt extends Et {
2474
+ Rt.moduleName = "decorator";
2475
+ let Ee = Rt;
2476
+ const Si = "readium-snapper-style", Ot = class Ot extends Et {
2477
2477
  constructor() {
2478
2478
  super(...arguments), this.protected = !1;
2479
2479
  }
@@ -2486,22 +2486,22 @@ const vi = "readium-snapper-style", Rt = class Rt extends Et {
2486
2486
  }
2487
2487
  mount(t, e) {
2488
2488
  const i = t.document.createElement("style");
2489
- return i.dataset.readium = "true", i.id = vi, i.textContent = this.buildStyles(), t.document.head.appendChild(i), e.register("protect", Rt.moduleName, (n, s) => {
2489
+ return i.dataset.readium = "true", i.id = Si, i.textContent = this.buildStyles(), t.document.head.appendChild(i), e.register("protect", Ot.moduleName, (n, s) => {
2490
2490
  this.protected = !0, i.textContent = this.buildStyles(), s(!0);
2491
- }), e.register("unprotect", Rt.moduleName, (n, s) => {
2491
+ }), e.register("unprotect", Ot.moduleName, (n, s) => {
2492
2492
  this.protected = !1, i.textContent = this.buildStyles(), s(!0);
2493
2493
  }), e.log("Snapper Mounted"), !0;
2494
2494
  }
2495
2495
  unmount(t, e) {
2496
- return t.document.getElementById(vi)?.remove(), e.log("Snapper Unmounted"), !0;
2496
+ return t.document.getElementById(Si)?.remove(), e.log("Snapper Unmounted"), !0;
2497
2497
  }
2498
2498
  };
2499
- Rt.moduleName = "snapper";
2500
- let vt = Rt;
2501
- function Qn(r) {
2499
+ Ot.moduleName = "snapper";
2500
+ let St = Ot;
2501
+ function ts(r) {
2502
2502
  return (r.document.documentElement.dir || r.document.body.dir).toLowerCase() === "rtl";
2503
2503
  }
2504
- function ts(r) {
2504
+ function es(r) {
2505
2505
  return (r.getComputedStyle(r.document.documentElement).writingMode || r.getComputedStyle(r.document.body).writingMode) === "vertical-lr";
2506
2506
  }
2507
2507
  function rn(r) {
@@ -2534,14 +2534,14 @@ function Be(r) {
2534
2534
  const t = r.document.createElement("style");
2535
2535
  t.appendChild(r.document.createTextNode("*{}")), r.document.body.appendChild(t), r.document.body.removeChild(t);
2536
2536
  }
2537
- function es(r) {
2537
+ function is(r) {
2538
2538
  return r < 0.5 ? 2 * r * r : -1 + (4 - 2 * r) * r;
2539
2539
  }
2540
- function O(r) {
2540
+ function R(r) {
2541
2541
  const t = r.getSelection();
2542
2542
  t && t.removeAllRanges();
2543
2543
  }
2544
- const is = [
2544
+ const ns = [
2545
2545
  "a",
2546
2546
  "area",
2547
2547
  "audio",
@@ -2555,15 +2555,15 @@ const is = [
2555
2555
  "submit",
2556
2556
  "textarea",
2557
2557
  "video"
2558
- ], ns = ["dialog", "radiogroup", "radio", "menu", "menuitem"];
2558
+ ], ss = ["dialog", "radiogroup", "radio", "menu", "menuitem"];
2559
2559
  function Ve(r) {
2560
- return ss(r) ? null : on(r) ? r : r.parentElement ? Ve(r.parentElement) : null;
2560
+ return rs(r) ? null : on(r) ? r : r.parentElement ? Ve(r.parentElement) : null;
2561
2561
  }
2562
- function ss(r) {
2562
+ function rs(r) {
2563
2563
  return r ? r.closest("[inert]") !== null || r.hasAttribute("disabled") : !0;
2564
2564
  }
2565
2565
  function on(r) {
2566
- return r ? r.role && ns.includes(r.role) || r.tabIndex >= 0 ? !0 : is.includes(r.nodeName.toLowerCase()) || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" : !1;
2566
+ return r ? r.role && ss.includes(r.role) ? !0 : r.tagName.toLowerCase() === "iframe" ? !1 : r.tabIndex >= 0 ? !0 : ns.includes(r.nodeName.toLowerCase()) || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" : !1;
2567
2567
  }
2568
2568
  function oe(r, t) {
2569
2569
  const e = an(r, r.document.body, t), i = r._readium_cssSelectorGenerator.getCssSelector(e, {
@@ -2585,12 +2585,12 @@ function oe(r, t) {
2585
2585
  function an(r, t, e) {
2586
2586
  for (var i = 0; i < t.children.length; i++) {
2587
2587
  const n = t.children[i];
2588
- if (!as(n) && rs(r, n, e))
2589
- return os(r, n) ? n : an(r, n, e);
2588
+ if (!ls(n) && os(r, n, e))
2589
+ return as(r, n) ? n : an(r, n, e);
2590
2590
  }
2591
2591
  return t;
2592
2592
  }
2593
- function rs(r, t, e) {
2593
+ function os(r, t, e) {
2594
2594
  if (t === document.body || t === document.documentElement)
2595
2595
  return !0;
2596
2596
  if (!document || !document.documentElement || !document.body)
@@ -2598,11 +2598,11 @@ function rs(r, t, e) {
2598
2598
  const i = t.getBoundingClientRect();
2599
2599
  return e ? i.bottom > 0 && i.top < r.innerHeight : i.right > 0 && i.left < r.innerWidth;
2600
2600
  }
2601
- function os(r, t) {
2601
+ function as(r, t) {
2602
2602
  const e = t.getBoundingClientRect();
2603
2603
  return e.top >= 0 && e.left >= 0 && e.bottom <= r.innerHeight && e.right <= r.innerWidth;
2604
2604
  }
2605
- function as(r) {
2605
+ function ls(r) {
2606
2606
  const t = getComputedStyle(r);
2607
2607
  if (t) {
2608
2608
  const e = t.getPropertyValue("display");
@@ -2611,7 +2611,7 @@ function as(r) {
2611
2611
  }
2612
2612
  return !1;
2613
2613
  }
2614
- const ls = {
2614
+ const hs = {
2615
2615
  maxVelocity: 200,
2616
2616
  // Reasonable default for human-like scrolling (pixels/ms)
2617
2617
  minVariance: 0.01,
@@ -2637,7 +2637,7 @@ const ls = {
2637
2637
  maxSelectionsPerSecond: 500,
2638
2638
  minVariance: 50,
2639
2639
  historySize: 20
2640
- }, hs = {
2640
+ }, cs = {
2641
2641
  enabled: !0,
2642
2642
  maxSelectionPercent: 0.1,
2643
2643
  minThreshold: 100,
@@ -2646,7 +2646,7 @@ const ls = {
2646
2646
  };
2647
2647
  class ae {
2648
2648
  constructor(t = {}) {
2649
- this.history = [], this.consistentScrollCount = 0, this.options = { ...ls, ...t };
2649
+ this.history = [], this.consistentScrollCount = 0, this.options = { ...hs, ...t };
2650
2650
  }
2651
2651
  analyze(t, e, i) {
2652
2652
  if (i <= 0) return !1;
@@ -2656,19 +2656,19 @@ class ae {
2656
2656
  direction: t,
2657
2657
  velocity: n,
2658
2658
  distance: Math.abs(e)
2659
- }), this.history = this.history.filter((f) => s - f.timestamp < 2e3).slice(-(this.options.historySize || 20)), this.history.length < 3) return !1;
2659
+ }), this.history = this.history.filter((p) => s - p.timestamp < 2e3).slice(-(this.options.historySize || 20)), this.history.length < 3) return !1;
2660
2660
  if (n > this.options.maxVelocity)
2661
2661
  return this.resetAfterDetection(), !0;
2662
- const o = this.history.map((f) => f.velocity), a = this.history.map((f) => f.distance), l = o.reduce((f, w) => f + w, 0) / o.length, h = a.reduce((f, w) => f + w, 0) / a.length, c = o.reduce((f, w) => f + Math.pow(w - l, 2), 0) / o.length, u = a.reduce((f, w) => f + Math.pow(w - h, 2), 0) / a.length;
2663
- if (c < this.options.minVariance && u < h * 0.1) {
2662
+ const o = this.history.map((p) => p.velocity), a = this.history.map((p) => p.distance), l = o.reduce((p, b) => p + b, 0) / o.length, h = a.reduce((p, b) => p + b, 0) / a.length, c = o.reduce((p, b) => p + Math.pow(b - l, 2), 0) / o.length, d = a.reduce((p, b) => p + Math.pow(b - h, 2), 0) / a.length;
2663
+ if (c < this.options.minVariance && d < h * 0.1) {
2664
2664
  if (this.consistentScrollCount++, this.consistentScrollCount >= (this.options.maxConsistentScrolls || 10))
2665
2665
  return this.resetAfterDetection(), !0;
2666
2666
  } else
2667
2667
  this.consistentScrollCount = Math.max(0, this.consistentScrollCount - 1);
2668
- let p = 0, g = this.history[0].direction;
2669
- for (let f = 1; f < this.history.length; f++)
2670
- this.history[f].direction !== g && (p++, g = this.history[f].direction);
2671
- return p / this.history.length > (this.options.minDirectionChanges || 0.3) ? (this.resetAfterDetection(), !0) : !1;
2668
+ let f = 0, g = this.history[0].direction;
2669
+ for (let p = 1; p < this.history.length; p++)
2670
+ this.history[p].direction !== g && (f++, g = this.history[p].direction);
2671
+ return f / this.history.length > (this.options.minDirectionChanges || 0.3) ? (this.resetAfterDetection(), !0) : !1;
2672
2672
  }
2673
2673
  resetAfterDetection() {
2674
2674
  this.history = this.history.slice(-3), this.consistentScrollCount = 0;
@@ -2677,7 +2677,7 @@ class ae {
2677
2677
  this.history = [], this.consistentScrollCount = 0;
2678
2678
  }
2679
2679
  }
2680
- const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2680
+ const Ci = "readium-column-snapper-style", ds = 200, D = class D extends St {
2681
2681
  constructor() {
2682
2682
  super(...arguments), this.isSnapProtectionEnabled = !1, this.patternAnalyzer = null, this.lastTurnTime = 0, this.rtl = !1, this.shakeTimeout = 0, this.snappingCancelled = !1, this.alreadyScrollLeft = 0, this.overscroll = 0, this.cachedScrollWidth = 0, this.touchState = 0, this.startingX = void 0, this.endingX = void 0, this.onTouchStarter = this.onTouchStart.bind(this), this.onTouchEnder = this.onTouchEnd.bind(this), this.onWidthChanger = this.onWidthChange.bind(this), this.onTouchMover = this.onTouchMove.bind(this);
2683
2683
  }
@@ -2733,21 +2733,21 @@ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2733
2733
  }
2734
2734
  // Snaps the current offset to the page width.
2735
2735
  snapCurrentOffset(t = !1, e = !1) {
2736
- const i = this.doc(), n = rn(this.wnd), s = this.cachedScrollWidth - this.wnd.innerWidth, o = Math.min(Math.max(0, this.normScroll()), s), a = this.dragOffset(), l = this.rtl ? -a : a, h = this.wnd.innerWidth / 3 * (l > 0 ? 2 : 1), c = Math.min(s, Math.max(0, this.snapNormOffset(o + h))), u = this.rtl ? -c : c, p = this.rtl ? -o : o, g = u > p ? "right" : "left";
2737
- if (this.checkSuspiciousSnap(g, Math.abs(u - p)), t && u !== p) {
2736
+ const i = this.doc(), n = rn(this.wnd), s = this.cachedScrollWidth - this.wnd.innerWidth, o = Math.min(Math.max(0, this.normScroll()), s), a = this.dragOffset(), l = this.rtl ? -a : a, h = this.wnd.innerWidth / 3 * (l > 0 ? 2 : 1), c = Math.min(s, Math.max(0, this.snapNormOffset(o + h))), d = this.rtl ? -c : c, f = this.rtl ? -o : o, g = d > f ? "right" : "left";
2737
+ if (this.checkSuspiciousSnap(g, Math.abs(d - f)), t && d !== f) {
2738
2738
  this.snappingCancelled = !1;
2739
- const d = (R, Y, lt, ht) => lt > ht ? Y : R + (Y - R) * es(lt / ht), f = cs * n;
2740
- let w;
2741
- const P = (R) => {
2739
+ const u = (O, G, ot, ct) => ot > ct ? G : O + (G - O) * is(ot / ct), p = ds * n;
2740
+ let b;
2741
+ const v = (O) => {
2742
2742
  if (this.snappingCancelled) return;
2743
- w || (w = R);
2744
- const Y = R - w, lt = d(this.overscroll, 0, Y, f), ht = d(p, u, Y, f);
2745
- i.scrollLeft = ht, this.overscroll !== 0 && (i.style.transform = `translate3d(${-lt}px, 0px, 0px)`), Y < f ? this.wnd.requestAnimationFrame(P) : (this.clearTouches(), i.style.removeProperty("transform"), i.scrollLeft = u, e || this.reportProgress());
2743
+ b || (b = O);
2744
+ const G = O - b, ot = u(this.overscroll, 0, G, p), ct = u(f, d, G, p);
2745
+ i.scrollLeft = ct, this.overscroll !== 0 && (i.style.transform = `translate3d(${-ot}px, 0px, 0px)`), G < p ? this.wnd.requestAnimationFrame(v) : (this.clearTouches(), i.style.removeProperty("transform"), i.scrollLeft = d, e || this.reportProgress());
2746
2746
  };
2747
- this.wnd.requestAnimationFrame(P);
2747
+ this.wnd.requestAnimationFrame(v);
2748
2748
  } else
2749
2749
  i.style.removeProperty("transform"), this.wnd.requestAnimationFrame(() => {
2750
- i.scrollLeft = u, this.clearTouches(), e || this.reportProgress();
2750
+ i.scrollLeft = d, this.clearTouches(), e || this.reportProgress();
2751
2751
  });
2752
2752
  }
2753
2753
  dragOffset() {
@@ -2782,7 +2782,7 @@ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2782
2782
  }
2783
2783
  onTouchMove(t) {
2784
2784
  if (this.touchState === 0) return;
2785
- this.touchState === 1 && (this.touchState = 2, O(this.wnd)), this.endingX = t.touches[0].clientX;
2785
+ this.touchState === 1 && (this.touchState = 2, R(this.wnd)), this.endingX = t.touches[0].clientX;
2786
2786
  const e = this.dragOffset(), i = this.alreadyScrollLeft + e, n = this.rtl ? -(this.cachedScrollWidth - this.wnd.innerWidth) : 0, s = this.rtl ? 0 : this.cachedScrollWidth - this.wnd.innerWidth;
2787
2787
  i < n ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`) : i > s ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-i}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = i);
2788
2788
  }
@@ -2810,7 +2810,7 @@ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2810
2810
  });
2811
2811
  }
2812
2812
  mount(t, e) {
2813
- if (this.wnd = t, this.comms = e, this.rtl = Qn(t), !super.mount(t, e)) return !1;
2813
+ if (this.wnd = t, this.comms = e, this.rtl = ts(t), !super.mount(t, e)) return !1;
2814
2814
  t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "paginated");
2815
2815
  const i = t.document.createElement("style");
2816
2816
  i.dataset.readium = "true", i.id = Ci, i.textContent = `
@@ -2854,8 +2854,8 @@ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2854
2854
  }), this.resizeObserver.observe(t.document.body), this.mutationObserver = new MutationObserver((o) => {
2855
2855
  for (const a of o)
2856
2856
  if (a.target === this.wnd.document.documentElement) {
2857
- const l = a.oldValue, h = a.target.getAttribute("style"), c = /transform\s*:\s*([^;]+)/, u = l?.match(c), p = h?.match(c);
2858
- (!u && !p || u && !p || u && p && u[1] !== p[1]) && (t.requestAnimationFrame(() => {
2857
+ const l = a.oldValue, h = a.target.getAttribute("style"), c = /transform\s*:\s*([^;]+)/, d = l?.match(c), f = h?.match(c);
2858
+ (!d && !f || d && !f || d && f && d[1] !== f[1]) && (t.requestAnimationFrame(() => {
2859
2859
  t && Ei(t);
2860
2860
  }), this.onWidthChange());
2861
2861
  } else
@@ -2881,7 +2881,7 @@ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2881
2881
  this.wnd.requestAnimationFrame(() => {
2882
2882
  this.cachedScrollWidth = this.doc().scrollWidth;
2883
2883
  const c = (this.cachedScrollWidth - t.innerWidth) * l;
2884
- this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(c) : this.doc().scrollLeft = this.snapOffset(c), this.reportProgress(), O(this.wnd), a(!0);
2884
+ this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(c) : this.doc().scrollLeft = this.snapOffset(c), this.reportProgress(), R(this.wnd), a(!0);
2885
2885
  });
2886
2886
  }), e.register("go_id", D.moduleName, (o, a) => {
2887
2887
  const l = t.document.getElementById(o);
@@ -2890,7 +2890,7 @@ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2890
2890
  return;
2891
2891
  }
2892
2892
  this.wnd.requestAnimationFrame(() => {
2893
- this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(l.getBoundingClientRect().left + t.scrollX) : this.doc().scrollLeft = this.snapOffset(l.getBoundingClientRect().left + t.scrollX), this.reportProgress(), O(this.wnd), a(!0);
2893
+ this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(l.getBoundingClientRect().left + t.scrollX) : this.doc().scrollLeft = this.snapOffset(l.getBoundingClientRect().left + t.scrollX), this.reportProgress(), R(this.wnd), a(!0);
2894
2894
  });
2895
2895
  }), e.register("go_text", D.moduleName, (o, a) => {
2896
2896
  let l;
@@ -2910,34 +2910,34 @@ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2910
2910
  return;
2911
2911
  }
2912
2912
  this.wnd.requestAnimationFrame(() => {
2913
- this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(c.getBoundingClientRect().left + t.scrollX) : this.doc().scrollLeft = this.snapOffset(c.getBoundingClientRect().left + t.scrollX), this.reportProgress(), O(this.wnd), a(!0);
2913
+ this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(c.getBoundingClientRect().left + t.scrollX) : this.doc().scrollLeft = this.snapOffset(c.getBoundingClientRect().left + t.scrollX), this.reportProgress(), R(this.wnd), a(!0);
2914
2914
  });
2915
2915
  }), e.register("go_end", D.moduleName, (o, a) => {
2916
2916
  this.wnd.requestAnimationFrame(() => {
2917
2917
  this.cachedScrollWidth = this.doc().scrollWidth;
2918
2918
  let l;
2919
2919
  if (this.rtl ? l = -this.snapNormOffset(this.cachedScrollWidth - t.innerWidth) : l = this.snapOffset(this.cachedScrollWidth), this.doc().scrollLeft === l) return a(!1);
2920
- this.doc().scrollLeft = l, this.reportProgress(), O(this.wnd), a(!0);
2920
+ this.doc().scrollLeft = l, this.reportProgress(), R(this.wnd), a(!0);
2921
2921
  });
2922
2922
  }), e.register("go_start", D.moduleName, (o, a) => {
2923
2923
  this.wnd.requestAnimationFrame(() => {
2924
2924
  if (this.doc().scrollLeft === 0) return a(!1);
2925
- this.doc().scrollLeft = 0, this.reportProgress(), O(this.wnd), a(!0);
2925
+ this.doc().scrollLeft = 0, this.reportProgress(), R(this.wnd), a(!0);
2926
2926
  });
2927
2927
  }), e.register("go_prev", D.moduleName, (o, a) => {
2928
2928
  this.wnd.requestAnimationFrame(() => {
2929
2929
  this.cachedScrollWidth = this.doc().scrollWidth;
2930
2930
  let l;
2931
- this.rtl ? l = s(this.normScroll() - t.innerWidth) : l = n(t.scrollX - t.innerWidth), this.reportProgress(), l && (O(this.wnd), this.checkSuspiciousSnap("left", this.wnd.innerWidth)), a(l);
2931
+ this.rtl ? l = s(this.normScroll() - t.innerWidth) : l = n(t.scrollX - t.innerWidth), this.reportProgress(), l && (R(this.wnd), this.checkSuspiciousSnap("left", this.wnd.innerWidth)), a(l);
2932
2932
  });
2933
2933
  }), e.register("go_next", D.moduleName, (o, a) => {
2934
2934
  this.wnd.requestAnimationFrame(() => {
2935
2935
  this.cachedScrollWidth = this.doc().scrollWidth;
2936
2936
  let l;
2937
- this.rtl ? l = s(this.normScroll() + t.innerWidth) : l = n(t.scrollX + t.innerWidth), this.reportProgress(), l && (O(this.wnd), this.checkSuspiciousSnap("right", this.wnd.innerWidth)), a(l);
2937
+ this.rtl ? l = s(this.normScroll() + t.innerWidth) : l = n(t.scrollX + t.innerWidth), this.reportProgress(), l && (R(this.wnd), this.checkSuspiciousSnap("right", this.wnd.innerWidth)), a(l);
2938
2938
  });
2939
2939
  }), e.register("unfocus", D.moduleName, (o, a) => {
2940
- this.snappingCancelled = !0, O(this.wnd), a(!0);
2940
+ this.snappingCancelled = !0, R(this.wnd), a(!0);
2941
2941
  }), e.register("shake", D.moduleName, (o, a) => {
2942
2942
  this.shake(), a(!0);
2943
2943
  }), e.register("focus", D.moduleName, (o, a) => {
@@ -2956,7 +2956,7 @@ const Ci = "readium-column-snapper-style", cs = 200, D = class D extends vt {
2956
2956
  };
2957
2957
  D.moduleName = "column_snapper";
2958
2958
  let Ce = D;
2959
- const _i = "readium-scroll-snapper-style", U = class U extends vt {
2959
+ const _i = "readium-scroll-snapper-style", U = class U extends St {
2960
2960
  constructor() {
2961
2961
  super(...arguments), this.patternAnalyzer = null, this.lastScrollTime = 0, this.isScrollProtectionEnabled = !1, this.initialScrollHandled = !1, this.isScrolling = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce = null, this.handleScroll = (t) => {
2962
2962
  if (this.comms.ready && !this.isResizing) {
@@ -3032,7 +3032,7 @@ const _i = "readium-scroll-snapper-style", U = class U extends vt {
3032
3032
  return;
3033
3033
  }
3034
3034
  this.wnd.requestAnimationFrame(() => {
3035
- this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(), O(this.wnd), s(!0);
3035
+ this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(), R(this.wnd), s(!0);
3036
3036
  });
3037
3037
  }), e.register("go_id", U.moduleName, (n, s) => {
3038
3038
  const o = t.document.getElementById(n);
@@ -3041,7 +3041,7 @@ const _i = "readium-scroll-snapper-style", U = class U extends vt {
3041
3041
  return;
3042
3042
  }
3043
3043
  this.wnd.requestAnimationFrame(() => {
3044
- this.doc().scrollTop = o.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), O(this.wnd), s(!0);
3044
+ this.doc().scrollTop = o.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), R(this.wnd), s(!0);
3045
3045
  });
3046
3046
  }), e.register("go_text", U.moduleName, (n, s) => {
3047
3047
  let o;
@@ -3061,7 +3061,7 @@ const _i = "readium-scroll-snapper-style", U = class U extends vt {
3061
3061
  return;
3062
3062
  }
3063
3063
  this.wnd.requestAnimationFrame(() => {
3064
- this.doc().scrollTop = l.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), O(this.wnd), s(!0);
3064
+ this.doc().scrollTop = l.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), R(this.wnd), s(!0);
3065
3065
  });
3066
3066
  }), e.register("go_start", U.moduleName, (n, s) => {
3067
3067
  if (this.doc().scrollTop === 0) return s(!1);
@@ -3070,7 +3070,7 @@ const _i = "readium-scroll-snapper-style", U = class U extends vt {
3070
3070
  if (this.doc().scrollTop === this.doc().scrollHeight - this.doc().offsetHeight) return s(!1);
3071
3071
  this.doc().scrollTop = this.doc().scrollHeight - this.doc().offsetHeight, this.reportProgress(), s(!0);
3072
3072
  }), e.register("unfocus", U.moduleName, (n, s) => {
3073
- O(this.wnd), s(!0);
3073
+ R(this.wnd), s(!0);
3074
3074
  }), e.register("scroll_protection", U.moduleName, (n, s) => {
3075
3075
  this.enableScrollProtection(), s(!0);
3076
3076
  }), e.register([
@@ -3089,7 +3089,7 @@ const _i = "readium-scroll-snapper-style", U = class U extends vt {
3089
3089
  };
3090
3090
  U.moduleName = "scroll_snapper";
3091
3091
  let _e = U;
3092
- const H = class H extends vt {
3092
+ const H = class H extends St {
3093
3093
  constructor() {
3094
3094
  super(...arguments), this.patternAnalyzer = null, this.lastScrollTime = 0, this.isScrollProtectionEnabled = !1, this.initialScrollHandled = !1, this.isScrolling = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce = null, this.handleScroll = (t) => {
3095
3095
  if (this.comms.ready && !this.isResizing) {
@@ -3155,7 +3155,7 @@ const H = class H extends vt {
3155
3155
  return;
3156
3156
  }
3157
3157
  this.wnd.requestAnimationFrame(() => {
3158
- this.doc().scrollTop = this.doc().offsetHeight * s, this.reportProgress(), O(this.wnd), n(!0);
3158
+ this.doc().scrollTop = this.doc().offsetHeight * s, this.reportProgress(), R(this.wnd), n(!0);
3159
3159
  });
3160
3160
  }), e.register("go_id", H.moduleName, (i, n) => {
3161
3161
  const s = t.document.getElementById(i);
@@ -3164,7 +3164,7 @@ const H = class H extends vt {
3164
3164
  return;
3165
3165
  }
3166
3166
  this.wnd.requestAnimationFrame(() => {
3167
- this.doc().scrollTop = s.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), O(this.wnd), n(!0);
3167
+ this.doc().scrollTop = s.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), R(this.wnd), n(!0);
3168
3168
  });
3169
3169
  }), e.register("go_text", H.moduleName, (i, n) => {
3170
3170
  let s;
@@ -3184,7 +3184,7 @@ const H = class H extends vt {
3184
3184
  return;
3185
3185
  }
3186
3186
  this.wnd.requestAnimationFrame(() => {
3187
- this.doc().scrollTop = a.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), O(this.wnd), n(!0);
3187
+ this.doc().scrollTop = a.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), R(this.wnd), n(!0);
3188
3188
  });
3189
3189
  }), e.register("go_start", H.moduleName, (i, n) => {
3190
3190
  if (this.doc().scrollTop === 0) return n(!1);
@@ -3193,7 +3193,7 @@ const H = class H extends vt {
3193
3193
  if (this.doc().scrollTop === this.doc().scrollHeight - this.doc().offsetHeight) return n(!1);
3194
3194
  this.doc().scrollTop = this.doc().scrollHeight - this.doc().offsetHeight, this.reportProgress(), n(!0);
3195
3195
  }), e.register("unfocus", H.moduleName, (i, n) => {
3196
- O(this.wnd), n(!0);
3196
+ R(this.wnd), n(!0);
3197
3197
  }), e.register("scroll_protection", H.moduleName, (i, n) => {
3198
3198
  this.enableScrollProtection(), n(!0);
3199
3199
  }), e.register([
@@ -3212,7 +3212,7 @@ const H = class H extends vt {
3212
3212
  };
3213
3213
  H.moduleName = "webpub_snapper";
3214
3214
  let Le = H;
3215
- class ds {
3215
+ class us {
3216
3216
  constructor(t, e) {
3217
3217
  this.window = t, this.copyHistory = [], this.lastSelectionLength = 0, this.lastSelectionTime = 0, this.options = e;
3218
3218
  }
@@ -3241,18 +3241,18 @@ class ds {
3241
3241
  const l = o - this.lastSelectionTime < 100 && n > this.lastSelectionLength * 1.5, h = Math.min(
3242
3242
  s * this.options.maxSelectionPercent,
3243
3243
  this.options.absoluteMaxChars
3244
- ), c = this.isSuspiciousPattern(o), u = n > h || l || c;
3244
+ ), c = this.isSuspiciousPattern(o), d = n > h || l || c;
3245
3245
  return this.copyHistory.push({
3246
3246
  timestamp: o,
3247
3247
  length: n,
3248
- wasBlocked: u
3249
- }), u ? (t?.preventDefault(), !1) : (this.lastSelectionLength = n, this.lastSelectionTime = o, !0);
3248
+ wasBlocked: d
3249
+ }), d ? (t?.preventDefault(), !1) : (this.lastSelectionLength = n, this.lastSelectionTime = o, !0);
3250
3250
  }
3251
3251
  destroy() {
3252
3252
  this.lastSelectionLength = 0, this.lastSelectionTime = 0, this.copyHistory = [], this.options.enabled = !1;
3253
3253
  }
3254
3254
  }
3255
- class us {
3255
+ class ps {
3256
3256
  constructor(t = ln) {
3257
3257
  this.options = t, this.events = [], this.selectionStartTime = 0, this.lastSelectionTime = 0, this.lastSelectionPosition = 0, this.selectionPatterns = [], this.lastSelectedText = "";
3258
3258
  }
@@ -3332,8 +3332,8 @@ class hn {
3332
3332
  width: c.width,
3333
3333
  height: c.height
3334
3334
  });
3335
- const u = n.document.activeElement;
3336
- u && u !== n.document.body && (o = Ve(u)?.outerHTML);
3335
+ const d = n.document.activeElement;
3336
+ d && d !== n.document.body && (o = Ve(d)?.outerHTML);
3337
3337
  }
3338
3338
  return {
3339
3339
  type: e,
@@ -3384,7 +3384,7 @@ class hn {
3384
3384
  };
3385
3385
  }
3386
3386
  }
3387
- const yt = class yt extends Et {
3387
+ const at = class at extends Et {
3388
3388
  constructor() {
3389
3389
  super(...arguments), this.configApplied = !1, this.cleanupCallbacks = [], this.pointerMoved = !1, this.isContextMenuEnabled = !1, this.isDragAndDropEnabled = !1, this.isSelectionMonitoringEnabled = !1, this.isBulkCopyProtectionEnabled = !1, this.selectionAnalyzer = null, this.currentSelection = null, this.bulkCopyProtector = null, this.keyManager = new hn(), this.keyDownHandler = null, this.preventBulkCopy = (t) => {
3390
3390
  if (!this.isBulkCopyProtectionEnabled || !this.bulkCopyProtector)
@@ -3509,8 +3509,8 @@ const yt = class yt extends Et {
3509
3509
  }
3510
3510
  addBulkCopyProtection(t = {}) {
3511
3511
  if (this.isBulkCopyProtectionEnabled || !this.wnd) return;
3512
- const e = hs, i = t ? { ...e, ...t } : e;
3513
- this.bulkCopyProtector = new ds(this.wnd, i), this.wnd.document.addEventListener("copy", this.preventBulkCopy, !0), this.wnd.document.addEventListener("cut", this.preventBulkCopy, !0), this.isBulkCopyProtectionEnabled = !0;
3512
+ const e = cs, i = t ? { ...e, ...t } : e;
3513
+ this.bulkCopyProtector = new us(this.wnd, i), this.wnd.document.addEventListener("copy", this.preventBulkCopy, !0), this.wnd.document.addEventListener("cut", this.preventBulkCopy, !0), this.isBulkCopyProtectionEnabled = !0;
3514
3514
  }
3515
3515
  removeBulkCopyProtection() {
3516
3516
  !this.isBulkCopyProtectionEnabled || !this.wnd || (this.wnd.document.removeEventListener("copy", this.preventBulkCopy, !0), this.wnd.document.removeEventListener("cut", this.preventBulkCopy, !0), this.bulkCopyProtector?.destroy(), this.bulkCopyProtector = null, this.isBulkCopyProtectionEnabled = !1);
@@ -3518,7 +3518,7 @@ const yt = class yt extends Et {
3518
3518
  addSelectionMonitoring(t) {
3519
3519
  if (this.isSelectionMonitoringEnabled || !this.wnd) return;
3520
3520
  const e = t || ln;
3521
- this.selectionAnalyzer = new us(e), this.wnd.document.addEventListener("selectionchange", this.handleSelection), this.isSelectionMonitoringEnabled = !0;
3521
+ this.selectionAnalyzer = new ps(e), this.wnd.document.addEventListener("selectionchange", this.handleSelection), this.isSelectionMonitoringEnabled = !0;
3522
3522
  }
3523
3523
  removeSelectionMonitoring() {
3524
3524
  !this.isSelectionMonitoringEnabled || !this.wnd || (this.wnd.document.removeEventListener("selectionchange", this.handleSelection), this.selectionAnalyzer?.clear(), this.selectionAnalyzer = null, this.isSelectionMonitoringEnabled = !1);
@@ -3578,7 +3578,7 @@ const yt = class yt extends Et {
3578
3578
  }
3579
3579
  }
3580
3580
  registerProtectionHandlers() {
3581
- this.comms?.register("peripherals_protection", yt.moduleName, (t, e) => {
3581
+ this.comms?.register("peripherals_protection", at.moduleName, (t, e) => {
3582
3582
  const i = t;
3583
3583
  if (!this.configApplied) {
3584
3584
  if (this.configApplied = !0, i.monitorSelection) {
@@ -3596,7 +3596,9 @@ const yt = class yt extends Et {
3596
3596
  }), this.comms?.log("Copy protection enabled")), i.disableContextMenu && (this.addContextMenuPrevention(), this.comms?.log("Context menu protection enabled")), i.disableDragAndDrop && (this.addDragAndDropPrevention(), this.comms?.log("Drag and drop protection enabled"));
3597
3597
  }
3598
3598
  e(!0);
3599
- }), this.comms?.register("keyboard_peripherals", yt.moduleName, (t, e) => {
3599
+ }), this.comms?.register("unfocus", at.moduleName, (t, e) => {
3600
+ this.disableKeyboardPeripherals(), e(!0);
3601
+ }), this.comms?.register("keyboard_peripherals", at.moduleName, (t, e) => {
3600
3602
  const i = t;
3601
3603
  i && i.length > 0 && (this.enableKeyboardPeripherals(i), this.comms?.log(`Keyboard peripherals enabled: ${i.map((n) => n.type).join(", ")}`)), e(!0);
3602
3604
  });
@@ -3605,11 +3607,11 @@ const yt = class yt extends Et {
3605
3607
  return this.wnd = t, this.comms = e, this.registerProtectionHandlers(), t.document.addEventListener("pointerdown", this.onPointerDown), t.document.addEventListener("pointerup", this.onPointerUp), t.document.addEventListener("pointermove", this.onPointerMove), t.document.addEventListener("click", this.onClicker), e.log("Peripherals Mounted"), !0;
3606
3608
  }
3607
3609
  unmount(t, e) {
3608
- return this.removeBulkCopyProtection(), this.removeSelectionMonitoring(), this.removeContextMenuPrevention(), this.removeDragAndDropPrevention(), this.disableKeyboardPeripherals(), this.cleanupCallbacks.forEach((i) => i()), this.cleanupCallbacks = [], t.document.removeEventListener("pointerdown", this.onPointerDown), t.document.removeEventListener("pointerup", this.onPointerUp), t.document.removeEventListener("pointermove", this.onPointerMove), t.document.removeEventListener("click", this.onClicker), e.unregisterAll(yt.moduleName), this.configApplied = !1, e.log("Peripherals Unmounted"), !0;
3610
+ return this.removeBulkCopyProtection(), this.removeSelectionMonitoring(), this.removeContextMenuPrevention(), this.removeDragAndDropPrevention(), this.disableKeyboardPeripherals(), this.cleanupCallbacks.forEach((i) => i()), this.cleanupCallbacks = [], t.document.removeEventListener("pointerdown", this.onPointerDown), t.document.removeEventListener("pointerup", this.onPointerUp), t.document.removeEventListener("pointermove", this.onPointerMove), t.document.removeEventListener("click", this.onClicker), e.unregisterAll(at.moduleName), this.configApplied = !1, e.log("Peripherals Unmounted"), !0;
3609
3611
  }
3610
3612
  };
3611
- yt.moduleName = "peripherals";
3612
- let xe = yt;
3613
+ at.moduleName = "peripherals";
3614
+ let xe = at;
3613
3615
  const At = class At extends Et {
3614
3616
  constructor() {
3615
3617
  super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
@@ -3660,7 +3662,7 @@ const At = class At extends Et {
3660
3662
  ), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
3661
3663
  value: {
3662
3664
  name: "readium-ts-toolkit",
3663
- version: "2.5.5",
3665
+ version: "2.5.7",
3664
3666
  hasFeature: (n, s = "") => {
3665
3667
  switch (n) {
3666
3668
  case "dom-manipulation":
@@ -3764,7 +3766,7 @@ const xi = "readium-fixed-style", q = class q extends Gt {
3764
3766
  }), e.register("remove_property", q.moduleName, (n, s) => {
3765
3767
  re(t, n), s(!0);
3766
3768
  }), e.register("first_visible_locator", q.moduleName, (n, s) => s(!1)), e.register("unfocus", q.moduleName, (n, s) => {
3767
- O(t), s(!0);
3769
+ R(t), s(!0);
3768
3770
  }), e.register([
3769
3771
  "focus",
3770
3772
  "go_next",
@@ -3783,7 +3785,7 @@ const xi = "readium-fixed-style", q = class q extends Gt {
3783
3785
  }
3784
3786
  };
3785
3787
  q.moduleName = "fixed_setup";
3786
- let Oe = q;
3788
+ let Re = q;
3787
3789
  const Q = class Q extends Et {
3788
3790
  wndOnErr(t) {
3789
3791
  this.comms?.send("error", {
@@ -3816,9 +3818,9 @@ const Q = class Q extends Et {
3816
3818
  }
3817
3819
  };
3818
3820
  Q.moduleName = "webpub_setup";
3819
- let Re = Q;
3821
+ let Oe = Q;
3820
3822
  var nt;
3821
- let ps = (nt = class extends Et {
3823
+ let fs = (nt = class extends Et {
3822
3824
  constructor() {
3823
3825
  super(...arguments), this.styleElement = null, this.beforePrintHandler = null, this.configApplied = !1;
3824
3826
  }
@@ -3854,7 +3856,7 @@ let ps = (nt = class extends Et {
3854
3856
  return this.beforePrintHandler && (t.removeEventListener("beforeprint", this.beforePrintHandler), this.beforePrintHandler = null), this.styleElement?.parentNode && (this.styleElement.parentNode.removeChild(this.styleElement), this.styleElement = null), this.comms?.unregisterAll(nt.moduleName), this.configApplied = !1, !0;
3855
3857
  }
3856
3858
  }, nt.moduleName = "print_protection", nt);
3857
- const ki = "readium-cjk-vertical-snapper-style", B = class B extends vt {
3859
+ const ki = "readium-cjk-vertical-snapper-style", B = class B extends St {
3858
3860
  constructor() {
3859
3861
  super(...arguments), this.patternAnalyzer = null, this.lastScrollTime = 0, this.isScrollProtectionEnabled = !1, this.initialScrollHandled = !1, this.isScrolling = !1, this.lastScrollLeft = 0, this.isResizing = !1, this.resizeDebounce = null, this.verticalLR = !1, this.handleScroll = (t) => {
3860
3862
  if (this.comms.ready && !this.isResizing) {
@@ -3909,7 +3911,7 @@ const ki = "readium-cjk-vertical-snapper-style", B = class B extends vt {
3909
3911
  this.patternAnalyzer || (this.patternAnalyzer = new ae(je), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
3910
3912
  }
3911
3913
  mount(t, e) {
3912
- this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollLeft = 0, this.isResizing = !1, this.verticalLR = ts(t), this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "scrolling");
3914
+ this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollLeft = 0, this.isResizing = !1, this.verticalLR = es(t), this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "scrolling");
3913
3915
  const i = t.document.createElement("style");
3914
3916
  return i.dataset.readium = "true", i.id = ki, i.textContent = `
3915
3917
  * {
@@ -3940,7 +3942,7 @@ const ki = "readium-cjk-vertical-snapper-style", B = class B extends vt {
3940
3942
  }
3941
3943
  this.wnd.requestAnimationFrame(() => {
3942
3944
  const a = this.scrollable() * o;
3943
- this.doc().scrollLeft = this.verticalLR ? a : -a, this.reportProgress(), O(this.wnd), s(!0);
3945
+ this.doc().scrollLeft = this.verticalLR ? a : -a, this.reportProgress(), R(this.wnd), s(!0);
3944
3946
  });
3945
3947
  }), e.register("go_id", B.moduleName, (n, s) => {
3946
3948
  const o = t.document.getElementById(n);
@@ -3949,7 +3951,7 @@ const ki = "readium-cjk-vertical-snapper-style", B = class B extends vt {
3949
3951
  return;
3950
3952
  }
3951
3953
  this.wnd.requestAnimationFrame(() => {
3952
- this.doc().scrollLeft += o.getBoundingClientRect().left - t.innerWidth / 2, this.reportProgress(), O(this.wnd), s(!0);
3954
+ this.doc().scrollLeft += o.getBoundingClientRect().left - t.innerWidth / 2, this.reportProgress(), R(this.wnd), s(!0);
3953
3955
  });
3954
3956
  }), e.register("go_text", B.moduleName, (n, s) => {
3955
3957
  let o;
@@ -3967,7 +3969,7 @@ const ki = "readium-cjk-vertical-snapper-style", B = class B extends vt {
3967
3969
  return;
3968
3970
  }
3969
3971
  this.wnd.requestAnimationFrame(() => {
3970
- this.doc().scrollLeft += l.getBoundingClientRect().left - t.innerWidth / 2, this.reportProgress(), O(this.wnd), s(!0);
3972
+ this.doc().scrollLeft += l.getBoundingClientRect().left - t.innerWidth / 2, this.reportProgress(), R(this.wnd), s(!0);
3971
3973
  });
3972
3974
  }), e.register("go_start", B.moduleName, (n, s) => {
3973
3975
  if (this.doc().scrollLeft === 0) return s(!1);
@@ -3979,7 +3981,7 @@ const ki = "readium-cjk-vertical-snapper-style", B = class B extends vt {
3979
3981
  "go_next",
3980
3982
  "go_prev"
3981
3983
  ], B.moduleName, (n, s) => s(!1)), e.register("unfocus", B.moduleName, (n, s) => {
3982
- O(this.wnd), s(!0);
3984
+ R(this.wnd), s(!0);
3983
3985
  }), e.register("scroll_protection", B.moduleName, (n, s) => {
3984
3986
  this.enableScrollProtection(), s(!0);
3985
3987
  }), e.register("focus", B.moduleName, (n, s) => {
@@ -3995,12 +3997,12 @@ const ki = "readium-cjk-vertical-snapper-style", B = class B extends vt {
3995
3997
  };
3996
3998
  B.moduleName = "cjk_vertical_snapper";
3997
3999
  let Ae = B;
3998
- const fs = [
4000
+ const ms = [
3999
4001
  "fixed_setup",
4000
4002
  "decorator",
4001
4003
  "peripherals",
4002
4004
  "print_protection"
4003
- ], ms = [
4005
+ ], gs = [
4004
4006
  "reflowable_setup",
4005
4007
  "decorator",
4006
4008
  "peripherals",
@@ -4008,7 +4010,7 @@ const fs = [
4008
4010
  "scroll_snapper",
4009
4011
  "cjk_vertical_snapper",
4010
4012
  "print_protection"
4011
- ], gs = [
4013
+ ], ys = [
4012
4014
  "webpub_setup",
4013
4015
  "webpub_snapper",
4014
4016
  "decorator",
@@ -4016,16 +4018,16 @@ const fs = [
4016
4018
  "print_protection"
4017
4019
  ], Te = new Map([
4018
4020
  // All modules go here
4019
- Oe,
4020
- ke,
4021
4021
  Re,
4022
+ ke,
4023
+ Oe,
4022
4024
  Le,
4023
4025
  xe,
4024
4026
  Ee,
4025
4027
  Ce,
4026
4028
  _e,
4027
4029
  Ae,
4028
- ps
4030
+ fs
4029
4031
  ].map((r) => [r.moduleName, r]));
4030
4032
  class Pt {
4031
4033
  /**
@@ -4033,7 +4035,7 @@ class Pt {
4033
4035
  * @param initialModules List of initial modules to load
4034
4036
  */
4035
4037
  constructor(t = window, e = []) {
4036
- this.loadedModules = [], this.wnd = t, this.comms = new zn(t);
4038
+ this.loadedModules = [], this.wnd = t, this.comms = new Dn(t);
4037
4039
  const i = [...new Set(e)];
4038
4040
  if (i.length) {
4039
4041
  if (typeof t > "u")
@@ -4077,7 +4079,7 @@ class Pt {
4077
4079
  this.comms.destroy(), this.loadedModules.forEach((t) => t.unmount(this.wnd, this.comms)), this.loadedModules = [];
4078
4080
  }
4079
4081
  }
4080
- const ys = {
4082
+ const bs = {
4081
4083
  type: "developer_tools",
4082
4084
  keyCombos: [
4083
4085
  { keyCode: 73, meta: !0, alt: !0 },
@@ -4111,7 +4113,7 @@ const ys = {
4111
4113
  { keyCode: 123, meta: !0, alt: !0 }
4112
4114
  // Cmd+Option+F12
4113
4115
  ]
4114
- }, bs = {
4116
+ }, ws = {
4115
4117
  type: "select_all",
4116
4118
  keyCombos: [
4117
4119
  { keyCode: 65, meta: !0 },
@@ -4119,7 +4121,7 @@ const ys = {
4119
4121
  { keyCode: 65, ctrl: !0 }
4120
4122
  // Ctrl+A
4121
4123
  ]
4122
- }, ws = {
4124
+ }, vs = {
4123
4125
  type: "print",
4124
4126
  keyCombos: [
4125
4127
  { keyCode: 80, meta: !0 },
@@ -4153,7 +4155,7 @@ class cn {
4153
4155
  const i = [], n = e.filter(
4154
4156
  (s) => !["developer_tools", "select_all", "print", "save"].includes(s.type)
4155
4157
  );
4156
- t.disableSelectAll && i.push(bs), t.disableSave && i.push(Ss), t.monitorDevTools && i.push(ys), t.protectPrinting?.disable && i.push(ws);
4158
+ t.disableSelectAll && i.push(ws), t.disableSave && i.push(Ss), t.monitorDevTools && i.push(bs), t.protectPrinting?.disable && i.push(vs);
4157
4159
  for (const s of n) {
4158
4160
  const o = s.keyCombos.filter(
4159
4161
  (a) => !i.some(
@@ -4184,9 +4186,9 @@ class dn extends cn {
4184
4186
  this.readingProgression === M.ltr ? this.goForward(t, e) : this.readingProgression === M.rtl && this.goBackward(t, e);
4185
4187
  }
4186
4188
  }
4187
- class vs extends cn {
4189
+ class Ps extends cn {
4188
4190
  }
4189
- class Ps {
4191
+ class Es {
4190
4192
  constructor(t, e, i, n) {
4191
4193
  this.injector = null, this.pub = t, this.item = i, this.burl = i.toURL(e) || "", this.cssProperties = n.cssProperties, this.injector = n.injector ?? null;
4192
4194
  }
@@ -4236,7 +4238,7 @@ class Ps {
4236
4238
  return n + o;
4237
4239
  }
4238
4240
  }
4239
- const Es = 1e4;
4241
+ const Cs = 1e4;
4240
4242
  class Nt {
4241
4243
  constructor(t, e) {
4242
4244
  this.registry = /* @__PURE__ */ new Map(), this._ready = !1, this.listenerBuffer = [], this.handler = this.handle.bind(this), this.wnd = t, this.origin = e;
@@ -4247,7 +4249,7 @@ class Nt {
4247
4249
  }
4248
4250
  this.gc = setInterval(() => {
4249
4251
  this.registry.forEach((i, n) => {
4250
- performance.now() - i.time > Es && (console.warn(n, "event for", i.key, "was never handled!"), this.registry.delete(n));
4252
+ performance.now() - i.time > Cs && (console.warn(n, "event for", i.key, "was never handled!"), this.registry.delete(n));
4251
4253
  });
4252
4254
  }, 5e3), window.addEventListener("message", this.handler), this.send("_ping", void 0);
4253
4255
  }
@@ -4303,7 +4305,7 @@ class Nt {
4303
4305
  key: t
4304
4306
  }), this.wnd.postMessage(
4305
4307
  {
4306
- _readium: ft,
4308
+ _readium: mt,
4307
4309
  _channel: this.channelId,
4308
4310
  id: o,
4309
4311
  data: e,
@@ -4316,12 +4318,12 @@ class Nt {
4316
4318
  ), o;
4317
4319
  }
4318
4320
  }
4319
- const Cs = "'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'URW Palladio L', P052, serif", _s = {
4320
- oldStyleTf: Cs
4321
- }, Ls = 16, Oi = _s.oldStyleTf;
4321
+ const _s = "'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'URW Palladio L', P052, serif", Ls = {
4322
+ oldStyleTf: _s
4323
+ }, xs = 16, Ri = Ls.oldStyleTf;
4322
4324
  class kt {
4323
4325
  constructor(t) {
4324
- this._optimalLineLength = null, this._canvas = document.createElement("canvas"), this._optimalChars = t.optimalChars, this._minChars = t.minChars, this._maxChars = t.maxChars, this._baseFontSize = t.baseFontSize || Ls, this._fontFace = t.fontFace || Oi, this._sample = t.sample || null, this._padding = t.padding ?? 0, this._letterSpacing = t.letterSpacing ? Math.round(t.letterSpacing * this._baseFontSize) : 0, this._wordSpacing = t.wordSpacing ? Math.round(t.wordSpacing * this._baseFontSize) : 0, this._isCJK = t.isCJK || !1, this._getRelative = t.getRelative || !1, this._minDivider = this._minChars && this._minChars < this._optimalChars ? this._optimalChars / this._minChars : this._minChars === null ? null : 1, this._maxMultiplier = this._maxChars && this._maxChars > this._optimalChars ? this._maxChars / this._optimalChars : this._maxChars === null ? null : 1, this._approximatedWordSpaces = kt.approximateWordSpaces(this._optimalChars, this._sample);
4326
+ this._optimalLineLength = null, this._canvas = document.createElement("canvas"), this._optimalChars = t.optimalChars, this._minChars = t.minChars, this._maxChars = t.maxChars, this._baseFontSize = t.baseFontSize || xs, this._fontFace = t.fontFace || Ri, this._sample = t.sample || null, this._padding = t.padding ?? 0, this._letterSpacing = t.letterSpacing ? Math.round(t.letterSpacing * this._baseFontSize) : 0, this._wordSpacing = t.wordSpacing ? Math.round(t.wordSpacing * this._baseFontSize) : 0, this._isCJK = t.isCJK || !1, this._getRelative = t.getRelative || !1, this._minDivider = this._minChars && this._minChars < this._optimalChars ? this._optimalChars / this._minChars : this._minChars === null ? null : 1, this._maxMultiplier = this._maxChars && this._maxChars > this._optimalChars ? this._maxChars / this._optimalChars : this._maxChars === null ? null : 1, this._approximatedWordSpaces = kt.approximateWordSpaces(this._optimalChars, this._sample);
4325
4327
  }
4326
4328
  updateMultipliers() {
4327
4329
  this._minDivider = this._minChars && this._minChars < this._optimalChars ? this._optimalChars / this._minChars : this._minChars === null ? null : 1, this._maxMultiplier = this._maxChars && this._maxChars > this._optimalChars ? this._maxChars / this._optimalChars : this._maxChars === null ? null : 1;
@@ -4330,7 +4332,7 @@ class kt {
4330
4332
  // Not filtering because pretty much everything can
4331
4333
  // trigger a recomputation anyway.
4332
4334
  update(t) {
4333
- t.optimalChars && (this._optimalChars = t.optimalChars), t.minChars !== void 0 && (this._minChars = t.minChars), t.maxChars !== void 0 && (this._maxChars = t.maxChars), t.baseFontSize && (this._baseFontSize = t.baseFontSize), t.fontFace !== void 0 && (this._fontFace = t.fontFace || Oi), t.letterSpacing && (this._letterSpacing = t.letterSpacing), t.wordSpacing && (this._wordSpacing = t.wordSpacing), t.isCJK != null && (this._isCJK = t.isCJK), t.padding !== void 0 && (this._padding = t.padding ?? 0), t.getRelative && (this._getRelative = t.getRelative), t.sample && (this._sample = t.sample, this._approximatedWordSpaces = kt.approximateWordSpaces(this._optimalChars, this._sample)), this.updateMultipliers(), this._optimalLineLength = this.getOptimalLineLength();
4335
+ t.optimalChars && (this._optimalChars = t.optimalChars), t.minChars !== void 0 && (this._minChars = t.minChars), t.maxChars !== void 0 && (this._maxChars = t.maxChars), t.baseFontSize && (this._baseFontSize = t.baseFontSize), t.fontFace !== void 0 && (this._fontFace = t.fontFace || Ri), t.letterSpacing && (this._letterSpacing = t.letterSpacing), t.wordSpacing && (this._wordSpacing = t.wordSpacing), t.isCJK != null && (this._isCJK = t.isCJK), t.padding !== void 0 && (this._padding = t.padding ?? 0), t.getRelative && (this._getRelative = t.getRelative), t.sample && (this._sample = t.sample, this._approximatedWordSpaces = kt.approximateWordSpaces(this._optimalChars, this._sample)), this.updateMultipliers(), this._optimalLineLength = this.getOptimalLineLength();
4334
4336
  }
4335
4337
  get baseFontSize() {
4336
4338
  return this._baseFontSize;
@@ -4427,7 +4429,7 @@ class fn {
4427
4429
  }, []) };
4428
4430
  }
4429
4431
  }
4430
- class xs extends fn {
4432
+ class ks extends fn {
4431
4433
  get iOSRequest() {
4432
4434
  const t = pn(), e = un();
4433
4435
  if (this.OS.iOS && !this.OS.iPadOS)
@@ -4436,7 +4438,7 @@ class xs extends fn {
4436
4438
  return /\(iPad;/.test(e) || t && /^iPad(OS)?$/.test(t.platform) ? "mobile" : "desktop";
4437
4439
  }
4438
4440
  }
4439
- const J = new fn(), T = new xs();
4441
+ const J = new fn(), T = new ks();
4440
4442
  function bt(r) {
4441
4443
  const t = r.languages?.[0]?.toLowerCase(), e = r.readingProgression;
4442
4444
  if (t) {
@@ -4474,7 +4476,7 @@ class $e {
4474
4476
  this.unsubs.forEach((t) => t()), this.unsubs = [], this.conditionValues.clear();
4475
4477
  }
4476
4478
  }
4477
- class ks {
4479
+ class Rs {
4478
4480
  constructor(t, e = {}, i = []) {
4479
4481
  this.hidden = !0, this.destroyed = !1, this.currModules = [], this.frame = document.createElement("iframe"), this.frame.classList.add("readium-navigator-iframe"), this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.opacity = "0", this.frame.style.position = "absolute", this.frame.style.pointerEvents = "none", this.frame.style.transition = "visibility 0s, opacity 0.1s linear", this.frame.style.backgroundColor = "#FFFFFF", this.source = t, this.contentProtectionConfig = { ...e }, this.keyboardPeripheralsConfig = [...i];
4480
4482
  }
@@ -4596,52 +4598,56 @@ class Os {
4596
4598
  const o = n[s].href;
4597
4599
  this.inprogress.has(o) && await this.inprogress.get(o);
4598
4600
  const a = new Promise(async (l, h) => {
4599
- const c = [], u = [];
4600
- t.readingOrder.items.forEach((d, f) => {
4601
- f !== s && f !== s - 1 && f !== s + 1 && (c.includes(d.href) || c.push(d.href)), f === s && (u.includes(d.href) || u.push(d.href));
4602
- }), c.forEach(async (d) => {
4603
- u.includes(d) || this.pool.has(d) && (await this.pool.get(d)?.destroy(), this.pool.delete(d));
4604
- }), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((d) => {
4605
- this.injector?.releaseBlobUrl?.(d), URL.revokeObjectURL(d);
4601
+ const c = [], d = [];
4602
+ t.readingOrder.items.forEach((u, p) => {
4603
+ p !== s && p !== s - 1 && p !== s + 1 && (c.includes(u.href) || c.push(u.href)), p === s && (d.includes(u.href) || d.push(u.href));
4604
+ }), c.forEach(async (u) => {
4605
+ d.includes(u) || this.pool.has(u) && (await this.pool.get(u)?.destroy(), this.pool.delete(u));
4606
+ }), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((u) => {
4607
+ this.injector?.releaseBlobUrl?.(u), URL.revokeObjectURL(u);
4606
4608
  }), this.blobs.clear()), this.currentBaseURL = t.baseURL;
4607
- const p = async (d) => {
4608
- if (this.pendingUpdates.has(d) && this.pendingUpdates.get(d)?.inPool === !1) {
4609
- const P = this.blobs.get(d);
4610
- P && (this.injector?.releaseBlobUrl?.(P), URL.revokeObjectURL(P), this.blobs.delete(d), this.pendingUpdates.delete(d));
4609
+ const f = async (u) => {
4610
+ if (this.pendingUpdates.has(u) && this.pendingUpdates.get(u)?.inPool === !1) {
4611
+ const v = this.blobs.get(u);
4612
+ v && (this.injector?.releaseBlobUrl?.(v), URL.revokeObjectURL(v), this.blobs.delete(u), this.pendingUpdates.delete(u));
4611
4613
  }
4612
- if (this.pool.has(d)) {
4613
- const P = this.pool.get(d);
4614
- if (!this.blobs.has(d))
4615
- await P.destroy(), this.pool.delete(d), this.pendingUpdates.delete(d);
4614
+ if (this.pool.has(u)) {
4615
+ const v = this.pool.get(u);
4616
+ if (!this.blobs.has(u))
4617
+ await v.destroy(), this.pool.delete(u), this.pendingUpdates.delete(u);
4616
4618
  else {
4617
- await P.load(i);
4619
+ await v.load(i);
4618
4620
  return;
4619
4621
  }
4620
4622
  }
4621
- const f = t.readingOrder.findWithHref(d);
4622
- if (!f) return;
4623
- if (!this.blobs.has(d)) {
4624
- const R = await new Ps(
4623
+ const p = t.readingOrder.findWithHref(u);
4624
+ if (!p) return;
4625
+ if (!this.blobs.has(u)) {
4626
+ const O = await new Es(
4625
4627
  t,
4626
4628
  this.currentBaseURL || "",
4627
- f,
4629
+ p,
4628
4630
  {
4629
4631
  cssProperties: this.currentCssProperties,
4630
4632
  injector: this.injector
4631
4633
  }
4632
4634
  ).build();
4633
- this.blobs.set(d, R);
4635
+ this.blobs.set(u, O);
4634
4636
  }
4635
- const w = new ks(this.blobs.get(d), this.contentProtectionConfig, this.keyboardPeripheralsConfig);
4636
- d !== o && await w.hide(), this.container.appendChild(w.iframe), await w.load(i), this.pool.set(d, w);
4637
+ const b = new Rs(this.blobs.get(u), this.contentProtectionConfig, this.keyboardPeripheralsConfig);
4638
+ u !== o && await b.hide(), this.container.appendChild(b.iframe), await b.load(i), this.pool.set(u, b);
4637
4639
  };
4638
4640
  try {
4639
- await Promise.all(u.map((d) => p(d)));
4640
- } catch (d) {
4641
- h(d);
4641
+ await Promise.all(d.map((u) => f(u)));
4642
+ } catch (u) {
4643
+ h(u);
4642
4644
  }
4643
4645
  const g = this.pool.get(o);
4644
- g?.source !== this._currentFrame?.source && (await this._currentFrame?.hide(), g && await g.load(i), g && await g.show(e.locations.progression), this._currentFrame = g), l();
4646
+ if (g?.source !== this._currentFrame?.source && (await this._currentFrame?.hide(), g && await g.load(i), g && await g.show(e.locations.progression), this._currentFrame = g, g)) {
4647
+ const u = this.container.ownerDocument.activeElement;
4648
+ u && u.tagName === "IFRAME" && u !== g.iframe && g.iframe.focus({ preventScroll: !0 });
4649
+ }
4650
+ l();
4645
4651
  });
4646
4652
  this.inprogress.set(o, a), await a, this.inprogress.delete(o);
4647
4653
  }
@@ -4686,41 +4692,41 @@ class Os {
4686
4692
  }), t;
4687
4693
  }
4688
4694
  }
4689
- var me, Ri;
4690
- function Rs() {
4691
- if (Ri) return me;
4692
- Ri = 1;
4695
+ var me, Oi;
4696
+ function As() {
4697
+ if (Oi) return me;
4698
+ Oi = 1;
4693
4699
  function r(n) {
4694
4700
  if (typeof n != "string")
4695
4701
  throw new TypeError("Path must be a string. Received " + JSON.stringify(n));
4696
4702
  }
4697
4703
  function t(n, s) {
4698
- for (var o = "", a = 0, l = -1, h = 0, c, u = 0; u <= n.length; ++u) {
4699
- if (u < n.length)
4700
- c = n.charCodeAt(u);
4704
+ for (var o = "", a = 0, l = -1, h = 0, c, d = 0; d <= n.length; ++d) {
4705
+ if (d < n.length)
4706
+ c = n.charCodeAt(d);
4701
4707
  else {
4702
4708
  if (c === 47)
4703
4709
  break;
4704
4710
  c = 47;
4705
4711
  }
4706
4712
  if (c === 47) {
4707
- if (!(l === u - 1 || h === 1)) if (l !== u - 1 && h === 2) {
4713
+ if (!(l === d - 1 || h === 1)) if (l !== d - 1 && h === 2) {
4708
4714
  if (o.length < 2 || a !== 2 || o.charCodeAt(o.length - 1) !== 46 || o.charCodeAt(o.length - 2) !== 46) {
4709
4715
  if (o.length > 2) {
4710
- var p = o.lastIndexOf("/");
4711
- if (p !== o.length - 1) {
4712
- p === -1 ? (o = "", a = 0) : (o = o.slice(0, p), a = o.length - 1 - o.lastIndexOf("/")), l = u, h = 0;
4716
+ var f = o.lastIndexOf("/");
4717
+ if (f !== o.length - 1) {
4718
+ f === -1 ? (o = "", a = 0) : (o = o.slice(0, f), a = o.length - 1 - o.lastIndexOf("/")), l = d, h = 0;
4713
4719
  continue;
4714
4720
  }
4715
4721
  } else if (o.length === 2 || o.length === 1) {
4716
- o = "", a = 0, l = u, h = 0;
4722
+ o = "", a = 0, l = d, h = 0;
4717
4723
  continue;
4718
4724
  }
4719
4725
  }
4720
4726
  s && (o.length > 0 ? o += "/.." : o = "..", a = 2);
4721
4727
  } else
4722
- o.length > 0 ? o += "/" + n.slice(l + 1, u) : o = n.slice(l + 1, u), a = u - l - 1;
4723
- l = u, h = 0;
4728
+ o.length > 0 ? o += "/" + n.slice(l + 1, d) : o = n.slice(l + 1, d), a = d - l - 1;
4729
+ l = d, h = 0;
4724
4730
  } else c === 46 && h !== -1 ? ++h : h = -1;
4725
4731
  }
4726
4732
  return o;
@@ -4761,25 +4767,25 @@ function Rs() {
4761
4767
  ;
4762
4768
  for (var l = s.length, h = l - a, c = 1; c < o.length && o.charCodeAt(c) === 47; ++c)
4763
4769
  ;
4764
- for (var u = o.length, p = u - c, g = h < p ? h : p, d = -1, f = 0; f <= g; ++f) {
4765
- if (f === g) {
4766
- if (p > g) {
4767
- if (o.charCodeAt(c + f) === 47)
4768
- return o.slice(c + f + 1);
4769
- if (f === 0)
4770
- return o.slice(c + f);
4771
- } else h > g && (s.charCodeAt(a + f) === 47 ? d = f : f === 0 && (d = 0));
4770
+ for (var d = o.length, f = d - c, g = h < f ? h : f, u = -1, p = 0; p <= g; ++p) {
4771
+ if (p === g) {
4772
+ if (f > g) {
4773
+ if (o.charCodeAt(c + p) === 47)
4774
+ return o.slice(c + p + 1);
4775
+ if (p === 0)
4776
+ return o.slice(c + p);
4777
+ } else h > g && (s.charCodeAt(a + p) === 47 ? u = p : p === 0 && (u = 0));
4772
4778
  break;
4773
4779
  }
4774
- var w = s.charCodeAt(a + f), P = o.charCodeAt(c + f);
4775
- if (w !== P)
4780
+ var b = s.charCodeAt(a + p), v = o.charCodeAt(c + p);
4781
+ if (b !== v)
4776
4782
  break;
4777
- w === 47 && (d = f);
4783
+ b === 47 && (u = p);
4778
4784
  }
4779
- var R = "";
4780
- for (f = a + d + 1; f <= l; ++f)
4781
- (f === l || s.charCodeAt(f) === 47) && (R.length === 0 ? R += ".." : R += "/..");
4782
- return R.length > 0 ? R + o.slice(c + d) : (c += d, o.charCodeAt(c) === 47 && ++c, o.slice(c));
4785
+ var O = "";
4786
+ for (p = a + u + 1; p <= l; ++p)
4787
+ (p === l || s.charCodeAt(p) === 47) && (O.length === 0 ? O += ".." : O += "/..");
4788
+ return O.length > 0 ? O + o.slice(c + u) : (c += u, o.charCodeAt(c) === 47 && ++c, o.slice(c));
4783
4789
  },
4784
4790
  _makeLong: function(s) {
4785
4791
  return s;
@@ -4802,7 +4808,7 @@ function Rs() {
4802
4808
  var a = 0, l = -1, h = !0, c;
4803
4809
  if (o !== void 0 && o.length > 0 && o.length <= s.length) {
4804
4810
  if (o.length === s.length && o === s) return "";
4805
- var u = o.length - 1, p = -1;
4811
+ var d = o.length - 1, f = -1;
4806
4812
  for (c = s.length - 1; c >= 0; --c) {
4807
4813
  var g = s.charCodeAt(c);
4808
4814
  if (g === 47) {
@@ -4811,9 +4817,9 @@ function Rs() {
4811
4817
  break;
4812
4818
  }
4813
4819
  } else
4814
- p === -1 && (h = !1, p = c + 1), u >= 0 && (g === o.charCodeAt(u) ? --u === -1 && (l = c) : (u = -1, l = p));
4820
+ f === -1 && (h = !1, f = c + 1), d >= 0 && (g === o.charCodeAt(d) ? --d === -1 && (l = c) : (d = -1, l = f));
4815
4821
  }
4816
- return a === l ? l = p : l === -1 && (l = s.length), s.slice(a, l);
4822
+ return a === l ? l = f : l === -1 && (l = s.length), s.slice(a, l);
4817
4823
  } else {
4818
4824
  for (c = s.length - 1; c >= 0; --c)
4819
4825
  if (s.charCodeAt(c) === 47) {
@@ -4827,16 +4833,16 @@ function Rs() {
4827
4833
  },
4828
4834
  extname: function(s) {
4829
4835
  r(s);
4830
- for (var o = -1, a = 0, l = -1, h = !0, c = 0, u = s.length - 1; u >= 0; --u) {
4831
- var p = s.charCodeAt(u);
4832
- if (p === 47) {
4836
+ for (var o = -1, a = 0, l = -1, h = !0, c = 0, d = s.length - 1; d >= 0; --d) {
4837
+ var f = s.charCodeAt(d);
4838
+ if (f === 47) {
4833
4839
  if (!h) {
4834
- a = u + 1;
4840
+ a = d + 1;
4835
4841
  break;
4836
4842
  }
4837
4843
  continue;
4838
4844
  }
4839
- l === -1 && (h = !1, l = u + 1), p === 46 ? o === -1 ? o = u : c !== 1 && (c = 1) : o !== -1 && (c = -1);
4845
+ l === -1 && (h = !1, l = d + 1), f === 46 ? o === -1 ? o = d : c !== 1 && (c = 1) : o !== -1 && (c = -1);
4840
4846
  }
4841
4847
  return o === -1 || l === -1 || // We saw a non-dot character immediately before the dot
4842
4848
  c === 0 || // The (right-most) trimmed path component is exactly '..'
@@ -4853,19 +4859,19 @@ function Rs() {
4853
4859
  if (s.length === 0) return o;
4854
4860
  var a = s.charCodeAt(0), l = a === 47, h;
4855
4861
  l ? (o.root = "/", h = 1) : h = 0;
4856
- for (var c = -1, u = 0, p = -1, g = !0, d = s.length - 1, f = 0; d >= h; --d) {
4857
- if (a = s.charCodeAt(d), a === 47) {
4862
+ for (var c = -1, d = 0, f = -1, g = !0, u = s.length - 1, p = 0; u >= h; --u) {
4863
+ if (a = s.charCodeAt(u), a === 47) {
4858
4864
  if (!g) {
4859
- u = d + 1;
4865
+ d = u + 1;
4860
4866
  break;
4861
4867
  }
4862
4868
  continue;
4863
4869
  }
4864
- p === -1 && (g = !1, p = d + 1), a === 46 ? c === -1 ? c = d : f !== 1 && (f = 1) : c !== -1 && (f = -1);
4870
+ f === -1 && (g = !1, f = u + 1), a === 46 ? c === -1 ? c = u : p !== 1 && (p = 1) : c !== -1 && (p = -1);
4865
4871
  }
4866
- return c === -1 || p === -1 || // We saw a non-dot character immediately before the dot
4867
- f === 0 || // The (right-most) trimmed path component is exactly '..'
4868
- f === 1 && c === p - 1 && c === u + 1 ? p !== -1 && (u === 0 && l ? o.base = o.name = s.slice(1, p) : o.base = o.name = s.slice(u, p)) : (u === 0 && l ? (o.name = s.slice(1, c), o.base = s.slice(1, p)) : (o.name = s.slice(u, c), o.base = s.slice(u, p)), o.ext = s.slice(c, p)), u > 0 ? o.dir = s.slice(0, u - 1) : l && (o.dir = "/"), o;
4872
+ return c === -1 || f === -1 || // We saw a non-dot character immediately before the dot
4873
+ p === 0 || // The (right-most) trimmed path component is exactly '..'
4874
+ p === 1 && c === f - 1 && c === d + 1 ? f !== -1 && (d === 0 && l ? o.base = o.name = s.slice(1, f) : o.base = o.name = s.slice(d, f)) : (d === 0 && l ? (o.name = s.slice(1, c), o.base = s.slice(1, f)) : (o.name = s.slice(d, c), o.base = s.slice(d, f)), o.ext = s.slice(c, f)), d > 0 ? o.dir = s.slice(0, d - 1) : l && (o.dir = "/"), o;
4869
4875
  },
4870
4876
  sep: "/",
4871
4877
  delimiter: ":",
@@ -4874,47 +4880,47 @@ function Rs() {
4874
4880
  };
4875
4881
  return i.posix = i, me = i, me;
4876
4882
  }
4877
- var Xt = Rs();
4878
- const As = { description: "Attempts to filter out paragraphs that are implicitly headings or part of headers", scope: "RS", value: "readium-experimentalHeaderFiltering-on" }, Ts = { description: "Attempts to filter out elements that are sized using viewport units and should not be scaled directly e.g. tables, images, iframes, etc.", scope: "RS", value: "readium-experimentalZoom-on" }, Ns = {
4879
- experimentalHeaderFiltering: As,
4880
- experimentalZoom: Ts
4881
- }, Ms = { disabled: [], added: [] }, Fs = { disabled: ["bodyHyphens", "a11yNormalize", "letterSpacing"], added: [] }, Is = {
4882
- ltr: Ms,
4883
- rtl: Fs,
4883
+ var Xt = As();
4884
+ const Ts = { description: "Attempts to filter out paragraphs that are implicitly headings or part of headers", scope: "RS", value: "readium-experimentalHeaderFiltering-on" }, Ns = { description: "Attempts to filter out elements that are sized using viewport units and should not be scaled directly e.g. tables, images, iframes, etc.", scope: "RS", value: "readium-experimentalZoom-on" }, Ms = {
4885
+ experimentalHeaderFiltering: Ts,
4886
+ experimentalZoom: Ns
4887
+ }, Fs = { disabled: [], added: [] }, Is = { disabled: ["bodyHyphens", "a11yNormalize", "letterSpacing"], added: [] }, zs = {
4888
+ ltr: Fs,
4889
+ rtl: Is,
4884
4890
  "cjk-horizontal": { disabled: ["textAlign", "bodyHyphens", "a11yNormalize", "ligatures", "paraIndent", "wordSpacing"], added: ["noRuby"] },
4885
4891
  "cjk-vertical": { disabled: ["colCount", "textAlign", "bodyHyphens", "a11yNormalize", "ligatures", "paraIndent", "wordSpacing"], added: ["noRuby"] }
4886
- }, zs = { baseFontFamily: "var(--RS__oldStyleTf)", lineHeightCompensation: 1 }, Ds = { baseFontFamily: "Kefa, Nyala, Roboto, Noto, 'Noto Sans Ethiopic', serif", lineHeightCompensation: 1.167 }, Ws = { baseFontFamily: "'Geeza Pro', 'Arabic Typesetting', Roboto, Noto, 'Noto Naskh Arabic', 'Times New Roman', serif" }, Us = { baseFontFamily: "'Kohinoor Bangla', 'Bangla Sangam MN', Vrinda, Roboto, Noto, 'Noto Sans Bengali', sans-serif", lineHeightCompensation: 1.067 }, Hs = { baseFontFamily: "Kailasa, 'Microsoft Himalaya', Roboto, Noto, 'Noto Sans Tibetan', sans-serif" }, Bs = { baseFontFamily: "'Plantagenet Cherokee', Roboto, Noto, 'Noto Sans Cherokee'", lineHeightCompensation: 1.167 }, Vs = { baseFontFamily: "'Geeza Pro', 'Arabic Typesetting', Roboto, Noto, 'Noto Naskh Arabic', 'Times New Roman', serif" }, js = { baseFontFamily: "'Gujarati Sangam MN', 'Nirmala UI', Shruti, Roboto, Noto, 'Noto Sans Gujarati', sans-serif", lineHeightCompensation: 1.167 }, $s = { baseFontFamily: "'New Peninim MT', 'Arial Hebrew', Gisha, 'Times New Roman', Roboto, Noto, 'Noto Sans Hebrew', sans-serif", lineHeightCompensation: 1.1 }, Gs = { baseFontFamily: "'Kohinoor Devanagari', 'Devanagari Sangam MN', Kokila, 'Nirmala UI', Roboto, Noto, 'Noto Sans Devanagari', sans-serif", lineHeightCompensation: 1.1 }, Xs = { baseFontFamily: "Mshtakan, Sylfaen, Roboto, Noto, 'Noto Serif Armenian', serif" }, Ys = { baseFontFamily: "'Euphemia UCAS', Euphemia, Roboto, Noto, 'Noto Sans Canadian Aboriginal', sans-serif" }, qs = { baseFontFamily: "YuGothic, 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo UI', 'MS Gothic', Roboto, Noto, 'Noto Sans CJK JP', sans-serif", lineHeightCompensation: 1.167 }, Ks = { baseFontFamily: "'Khmer Sangam MN', 'Leelawadee UI', 'Khmer UI', Roboto, Noto, 'Noto Sans Khmer', sans-serif", lineHeightCompensation: 1.067 }, Js = { baseFontFamily: "'Kannada Sangam MN', 'Nirmala UI', Tunga, Roboto, Noto, 'Noto Sans Kannada', sans-serif", lineHeightCompensation: 1.1 }, Zs = { baseFontFamily: "'Nanum Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', Roboto, Noto, 'Noto Sans CJK KR', sans-serif", lineHeightCompensation: 1.167 }, Qs = { baseFontFamily: "'Lao Sangam MN', 'Leelawadee UI', 'Lao UI', Roboto, Noto, 'Noto Sans Lao', sans-serif" }, tr = { baseFontFamily: "'Malayalam Sangam MN', 'Nirmala UI', Kartika, Roboto, Noto, 'Noto Sans Malayalam', sans-serif", lineHeightCompensation: 1.067 }, er = { baseFontFamily: "'Oriya Sangam MN', 'Nirmala UI', Kalinga, Roboto, Noto, 'Noto Sans Oriya', sans-serif", lineHeightCompensation: 1.167 }, ir = { baseFontFamily: "'Gurmukhi MN', 'Nirmala UI', Kartika, Roboto, Noto, 'Noto Sans Gurmukhi', sans-serif", lineHeightCompensation: 1.1 }, nr = { baseFontFamily: "'Sinhala Sangam MN', 'Nirmala UI', 'Iskoola Pota', Roboto, Noto, 'Noto Sans Sinhala', sans-serif", lineHeightCompensation: 1.167 }, sr = { baseFontFamily: "'Tamil Sangam MN', 'Nirmala UI', Latha, Roboto, Noto, 'Noto Sans Tamil', sans-serif", lineHeightCompensation: 1.067 }, rr = { baseFontFamily: "'Kohinoor Telugu', 'Telugu Sangam MN', 'Nirmala UI', Gautami, Roboto, Noto, 'Noto Sans Telugu', sans-serif" }, or = { baseFontFamily: "Thonburi, 'Leelawadee UI', 'Cordia New', Roboto, Noto, 'Noto Sans Thai', sans-serif", lineHeightCompensation: 1.067 }, ar = { baseFontFamily: "'方体', 'PingFang SC', '黑体', 'Heiti SC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK SC', sans-serif", lineHeightCompensation: 1.167 }, lr = {
4887
- latin: zs,
4888
- am: Ds,
4889
- ar: Ws,
4890
- bn: Us,
4891
- bo: Hs,
4892
- chr: Bs,
4893
- fa: Vs,
4894
- gu: js,
4895
- he: $s,
4896
- hi: Gs,
4897
- hy: Xs,
4898
- iu: Ys,
4899
- ja: qs,
4900
- km: Ks,
4901
- kn: Js,
4902
- ko: Zs,
4903
- lo: Qs,
4904
- ml: tr,
4905
- or: er,
4906
- pa: ir,
4907
- si: nr,
4908
- ta: sr,
4909
- te: rr,
4910
- th: or,
4911
- zh: ar,
4892
+ }, Ds = { baseFontFamily: "var(--RS__oldStyleTf)", lineHeightCompensation: 1 }, Ws = { baseFontFamily: "Kefa, Nyala, Roboto, Noto, 'Noto Sans Ethiopic', serif", lineHeightCompensation: 1.167 }, Us = { baseFontFamily: "'Geeza Pro', 'Arabic Typesetting', Roboto, Noto, 'Noto Naskh Arabic', 'Times New Roman', serif" }, Hs = { baseFontFamily: "'Kohinoor Bangla', 'Bangla Sangam MN', Vrinda, Roboto, Noto, 'Noto Sans Bengali', sans-serif", lineHeightCompensation: 1.067 }, Bs = { baseFontFamily: "Kailasa, 'Microsoft Himalaya', Roboto, Noto, 'Noto Sans Tibetan', sans-serif" }, Vs = { baseFontFamily: "'Plantagenet Cherokee', Roboto, Noto, 'Noto Sans Cherokee'", lineHeightCompensation: 1.167 }, js = { baseFontFamily: "'Geeza Pro', 'Arabic Typesetting', Roboto, Noto, 'Noto Naskh Arabic', 'Times New Roman', serif" }, $s = { baseFontFamily: "'Gujarati Sangam MN', 'Nirmala UI', Shruti, Roboto, Noto, 'Noto Sans Gujarati', sans-serif", lineHeightCompensation: 1.167 }, Gs = { baseFontFamily: "'New Peninim MT', 'Arial Hebrew', Gisha, 'Times New Roman', Roboto, Noto, 'Noto Sans Hebrew', sans-serif", lineHeightCompensation: 1.1 }, Xs = { baseFontFamily: "'Kohinoor Devanagari', 'Devanagari Sangam MN', Kokila, 'Nirmala UI', Roboto, Noto, 'Noto Sans Devanagari', sans-serif", lineHeightCompensation: 1.1 }, Ys = { baseFontFamily: "Mshtakan, Sylfaen, Roboto, Noto, 'Noto Serif Armenian', serif" }, qs = { baseFontFamily: "'Euphemia UCAS', Euphemia, Roboto, Noto, 'Noto Sans Canadian Aboriginal', sans-serif" }, Ks = { baseFontFamily: "YuGothic, 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo UI', 'MS Gothic', Roboto, Noto, 'Noto Sans CJK JP', sans-serif", lineHeightCompensation: 1.167 }, Js = { baseFontFamily: "'Khmer Sangam MN', 'Leelawadee UI', 'Khmer UI', Roboto, Noto, 'Noto Sans Khmer', sans-serif", lineHeightCompensation: 1.067 }, Zs = { baseFontFamily: "'Kannada Sangam MN', 'Nirmala UI', Tunga, Roboto, Noto, 'Noto Sans Kannada', sans-serif", lineHeightCompensation: 1.1 }, Qs = { baseFontFamily: "'Nanum Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', Roboto, Noto, 'Noto Sans CJK KR', sans-serif", lineHeightCompensation: 1.167 }, tr = { baseFontFamily: "'Lao Sangam MN', 'Leelawadee UI', 'Lao UI', Roboto, Noto, 'Noto Sans Lao', sans-serif" }, er = { baseFontFamily: "'Malayalam Sangam MN', 'Nirmala UI', Kartika, Roboto, Noto, 'Noto Sans Malayalam', sans-serif", lineHeightCompensation: 1.067 }, ir = { baseFontFamily: "'Oriya Sangam MN', 'Nirmala UI', Kalinga, Roboto, Noto, 'Noto Sans Oriya', sans-serif", lineHeightCompensation: 1.167 }, nr = { baseFontFamily: "'Gurmukhi MN', 'Nirmala UI', Kartika, Roboto, Noto, 'Noto Sans Gurmukhi', sans-serif", lineHeightCompensation: 1.1 }, sr = { baseFontFamily: "'Sinhala Sangam MN', 'Nirmala UI', 'Iskoola Pota', Roboto, Noto, 'Noto Sans Sinhala', sans-serif", lineHeightCompensation: 1.167 }, rr = { baseFontFamily: "'Tamil Sangam MN', 'Nirmala UI', Latha, Roboto, Noto, 'Noto Sans Tamil', sans-serif", lineHeightCompensation: 1.067 }, or = { baseFontFamily: "'Kohinoor Telugu', 'Telugu Sangam MN', 'Nirmala UI', Gautami, Roboto, Noto, 'Noto Sans Telugu', sans-serif" }, ar = { baseFontFamily: "Thonburi, 'Leelawadee UI', 'Cordia New', Roboto, Noto, 'Noto Sans Thai', sans-serif", lineHeightCompensation: 1.067 }, lr = { baseFontFamily: "'方体', 'PingFang SC', '黑体', 'Heiti SC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK SC', sans-serif", lineHeightCompensation: 1.167 }, hr = {
4893
+ latin: Ds,
4894
+ am: Ws,
4895
+ ar: Us,
4896
+ bn: Hs,
4897
+ bo: Bs,
4898
+ chr: Vs,
4899
+ fa: js,
4900
+ gu: $s,
4901
+ he: Gs,
4902
+ hi: Xs,
4903
+ hy: Ys,
4904
+ iu: qs,
4905
+ ja: Ks,
4906
+ km: Js,
4907
+ kn: Zs,
4908
+ ko: Qs,
4909
+ lo: tr,
4910
+ ml: er,
4911
+ or: ir,
4912
+ pa: nr,
4913
+ si: sr,
4914
+ ta: rr,
4915
+ te: or,
4916
+ th: ar,
4917
+ zh: lr,
4912
4918
  "zh-Hant": { baseFontFamily: "'方體', 'PingFang TC', '黑體', 'Heiti TC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK TC', sans-serif", lineHeightCompensation: 1.167 },
4913
4919
  "zh-TW": { baseFontFamily: "'方體', 'PingFang TC', '黑體', 'Heiti TC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK TC', sans-serif", lineHeightCompensation: 1.167 },
4914
4920
  "zh-HK": { baseFontFamily: "'方體', 'PingFang HK', '方體', 'PingFang TC', '黑體', 'Heiti TC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK TC', sans-serif", lineHeightCompensation: 1.167 }
4915
- }, Ge = Ns, fo = Is, mo = lr;
4921
+ }, Ge = Ms, mo = zs, go = hr;
4916
4922
  var tt = /* @__PURE__ */ ((r) => (r.start = "start", r.left = "left", r.right = "right", r.justify = "justify", r))(tt || {});
4917
- const dt = {
4923
+ const ut = {
4918
4924
  range: [0, 100],
4919
4925
  step: 1
4920
4926
  }, Yt = {
@@ -4932,7 +4938,7 @@ const dt = {
4932
4938
  }, Jt = {
4933
4939
  range: [1, 2.5],
4934
4940
  step: 0.1
4935
- }, ut = {
4941
+ }, pt = {
4936
4942
  range: [20, 100],
4937
4943
  step: 1
4938
4944
  }, Zt = {
@@ -4993,7 +4999,7 @@ class mn extends le {
4993
4999
  return this.a11yNormalize && (t["--USER__a11yNormalize"] = this.toFlag("a11y")), this.bodyHyphens && (t["--USER__bodyHyphens"] = this.bodyHyphens), this.fontFamily && (t["--USER__fontFamily"] = this.fontFamily), this.fontWeight != null && (t["--USER__fontWeight"] = this.toUnitless(this.fontWeight)), this.iOSPatch && (t["--USER__iOSPatch"] = this.toFlag("iOSPatch")), this.iPadOSPatch && (t["--USER__iPadOSPatch"] = this.toFlag("iPadOSPatch")), this.letterSpacing != null && (t["--USER__letterSpacing"] = this.toRem(this.letterSpacing)), this.ligatures && (t["--USER__ligatures"] = this.ligatures), this.lineHeight != null && (t["--USER__lineHeight"] = this.toUnitless(this.lineHeight)), this.noRuby && (t["--USER__noRuby"] = this.toFlag("noRuby")), this.paraIndent != null && (t["--USER__paraIndent"] = this.toRem(this.paraIndent)), this.paraSpacing != null && (t["--USER__paraSpacing"] = this.toRem(this.paraSpacing)), this.textAlign && (t["--USER__textAlign"] = this.textAlign), this.wordSpacing != null && (t["--USER__wordSpacing"] = this.toRem(this.wordSpacing)), this.zoom !== null && (t["--USER__zoom"] = this.toPercentage(this.zoom, !0)), t;
4994
5000
  }
4995
5001
  }
4996
- class hr extends le {
5002
+ class cr extends le {
4997
5003
  constructor(t) {
4998
5004
  super(), this.experiments = t.experiments ?? null;
4999
5005
  }
@@ -5004,7 +5010,7 @@ class hr extends le {
5004
5010
  }), t;
5005
5011
  }
5006
5012
  }
5007
- class cr {
5013
+ class dr {
5008
5014
  constructor(t) {
5009
5015
  this.rsProperties = t.rsProperties, this.userProperties = t.userProperties;
5010
5016
  }
@@ -5030,10 +5036,10 @@ class cr {
5030
5036
  this.userProperties = new mn(e);
5031
5037
  }
5032
5038
  }
5033
- function dr(r, t) {
5039
+ function ur(r, t) {
5034
5040
  return r == null || t == null || r <= t ? r : void 0;
5035
5041
  }
5036
- function ur(r, t) {
5042
+ function pr(r, t) {
5037
5043
  return r == null || t == null || r >= t ? r : void 0;
5038
5044
  }
5039
5045
  function W(r) {
@@ -5091,7 +5097,7 @@ class Mt {
5091
5097
  return new Mt(e);
5092
5098
  }
5093
5099
  }
5094
- class pr {
5100
+ class fr {
5095
5101
  constructor(t) {
5096
5102
  this.fontFamily = W(t.fontFamily) || null, this.fontWeight = F(t.fontWeight, st.range) || null, this.hyphens = E(t.hyphens) ?? null, this.iOSPatch = t.iOSPatch === !1 ? !1 : (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : T.OS.iPadOS && T.iOSRequest === "desktop", this.letterSpacing = S(t.letterSpacing) || null, this.ligatures = E(t.ligatures) ?? null, this.lineHeight = S(t.lineHeight) || null, this.noRuby = E(t.noRuby) ?? !1, this.paragraphIndent = S(t.paragraphIndent) ?? null, this.paragraphSpacing = S(t.paragraphSpacing) ?? null, this.textAlign = he(t.textAlign, tt) || null, this.textNormalization = E(t.textNormalization) ?? !1, this.wordSpacing = S(t.wordSpacing) || null, this.zoom = F(t.zoom, ee.range) || 1, this.experiments = gn(t.experiments) ?? null;
5097
5103
  }
@@ -5422,7 +5428,7 @@ const bn = (r) => {
5422
5428
  t.attributes && Object.entries(t.attributes).forEach(([e, i]) => {
5423
5429
  e === "type" || e === "rel" || e === "href" || e === "src" || i != null && (typeof i == "boolean" ? i && r.setAttribute(e, "") : r.setAttribute(e, i));
5424
5430
  });
5425
- }, fr = (r, t, e) => {
5431
+ }, mr = (r, t, e) => {
5426
5432
  const i = r.createElement("script");
5427
5433
  i.dataset.readium = "true", t.id && (i.id = t.id);
5428
5434
  const n = t.type || bn(t);
@@ -5433,7 +5439,7 @@ const bn = (r) => {
5433
5439
  const n = t.type || bn(t);
5434
5440
  return n && (i.type = n), wn(i, t), i.href = e, i;
5435
5441
  };
5436
- class Sn {
5442
+ class vn {
5437
5443
  constructor(t) {
5438
5444
  this.blobStore = /* @__PURE__ */ new Map(), this.createdBlobUrls = /* @__PURE__ */ new Set(), this.allowedDomains = [], this.injectableIdCounter = 0, this.allowedDomains = (t.allowedDomains || []).map((e) => {
5439
5445
  try {
@@ -5519,7 +5525,7 @@ class Sn {
5519
5525
  }
5520
5526
  createElement(t, e, i) {
5521
5527
  if (e.as === "script")
5522
- return fr(t, e, i);
5528
+ return mr(t, e, i);
5523
5529
  if (e.as === "link")
5524
5530
  return Ni(t, e, i);
5525
5531
  throw new Error(`Unsupported element type: ${e.as}`);
@@ -5578,7 +5584,7 @@ class Sn {
5578
5584
  }
5579
5585
  }
5580
5586
  }
5581
- const St = (r) => r.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/\n/g, "").replace(/\s+/g, " "), _t = (r) => r.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " "), mr = `/*!
5587
+ const vt = (r) => r.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/\n/g, "").replace(/\s+/g, " "), _t = (r) => r.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " "), gr = `/*!
5582
5588
  * Readium CSS v.2.0.5
5583
5589
  * Copyright (c) 2017–2026. Readium Foundation. All rights reserved.
5584
5590
  * Use of this source code is governed by a BSD-style license which is detailed in the
@@ -5851,7 +5857,7 @@ const St = (r) => r.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").repl
5851
5857
 
5852
5858
  :root[style*="readium-iPadOSPatch-on"] p:not(:has(b, cite, em, i, q, s, small, span, strong)):first-line{
5853
5859
  -webkit-text-zoom:normal;
5854
- }`, vn = '!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports._readium_cssSelectorGenerator=e():t._readium_cssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return"object"==typeof t&&null!==t&&t.nodeType===Node.ELEMENT_NODE}t.r(e),t.d(e,{_readium_cssSelectorGenerator:()=>Z,default:()=>tt,getCssSelector:()=>X});const o={NONE:"",DESCENDANT:" ",CHILD:" > "},r={id:"id",class:"class",tag:"tag",attribute:"attribute",nthchild:"nthchild",nthoftype:"nthoftype"},i="_readium_cssSelectorGenerator";function c(t="unknown problem",...e){console.warn(`${i}: ${t}`,...e)}const s={selectors:[r.id,r.class,r.tag,r.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY,useScope:!1};function u(t){return t instanceof RegExp}function l(t){return["string","function"].includes(typeof t)||u(t)}function a(t){return Array.isArray(t)?t.filter(l):[]}function f(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function d(t,e){if(f(t))return t.contains(e)||c("element root mismatch","Provided root does not contain the element. This will most likely result in producing a fallback selector using element\'s real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended."),t;const n=e.getRootNode({composed:!1});return f(n)?(n!==document&&c("shadow root inferred","You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."),n):S(e)}function m(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function p(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function g(t){const e=t.map((t=>{if(u(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(c("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return c("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function h(t,e,n){const o=Array.from(d(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function y(t,e){e=null!=e?e:S(t);const o=[];let r=t;for(;n(r)&&r!==e;)o.push(r),r=r.parentElement;return o}function b(t,e){return p(t.map((t=>y(t,e))))}function S(t){return t.ownerDocument.querySelector(":root")}const N=", ",v=new RegExp(["^$","\\\\s"].join("|")),E=new RegExp(["^$"].join("|")),x=[r.nthoftype,r.tag,r.id,r.class,r.attribute,r.nthchild],w=g(["class","id","ng-*"]);function I({name:t}){return`[${t}]`}function T({name:t,value:e}){return`[${t}=\'${e}\']`}function O({nodeName:t,nodeValue:e}){return{name:F(t),value:F(null!=e?e:void 0)}}function C(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t,nodeValue:e},n){const o=n.tagName.toLowerCase();return!(["input","option"].includes(o)&&"value"===t||"src"===t&&(null==e?void 0:e.startsWith("data:"))||w(t))}(e,t))).map(O);return[...e.map(I),...e.map(T)]}function j(t){var e;return(null!==(e=t.getAttribute("class"))&&void 0!==e?e:"").trim().split(/\\s+/).filter((t=>!E.test(t))).map((t=>`.${F(t)}`))}function A(t){var e;const n=null!==(e=t.getAttribute("id"))&&void 0!==e?e:"",o=`#${F(n)}`,r=t.getRootNode({composed:!1});return!v.test(n)&&h([t],o,r)?[o]:[]}function R(t){var e;const n=null===(e=t.parentElement)||void 0===e?void 0:e.children;if(n)for(let e=0;e<n.length;e++)if(n[e]===t)return[`:nth-child(${String(e+1)})`];return[]}function $(t){return[F(t.tagName.toLowerCase())]}function D(t){const e=[...new Set((n=t.map($),[].concat(...n)))];var n;return 0===e.length||e.length>1?[]:[e[0]]}function k(t){const e=D([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${String(r+1)})`]}return[]}function*P(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){let n=0,o=L(1);for(;o.length<=t.length&&n<e;){n+=1;const e=o.map((e=>t[e]));yield e,o=_(o,t.length-1)}}function _(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return L(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?L(n+1):o}function L(t=1){return Array.from(Array(t).keys())}const M=":".charCodeAt(0).toString(16).toUpperCase(),V=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function F(t=""){return CSS?CSS.escape(t):function(t=""){return t.split("").map((t=>":"===t?`\\\\${M} `:V.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const Y={tag:D,id:function(t){return 0===t.length||t.length>1?[]:A(t[0])},class:function(t){return p(t.map(j))},attribute:function(t){return p(t.map(C))},nthchild:function(t){return p(t.map(R))},nthoftype:function(t){return p(t.map(k))}},G={tag:$,id:A,class:j,attribute:C,nthchild:R,nthoftype:k};function W(t){return t.includes(r.tag)||t.includes(r.nthoftype)?[...t]:[...t,r.tag]}function*q(t,e){const n={};for(const o of t){const t=e[o];t&&t.length>0&&(n[o]=t)}for(const t of function*(t={}){const e=Object.entries(t);if(0===e.length)return;const n=[{index:e.length-1,partial:{}}];for(;n.length>0;){const t=n.pop();if(!t)break;const{index:o,partial:r}=t;if(o<0){yield r;continue}const[i,c]=e[o];for(let t=c.length-1;t>=0;t--)n.push({index:o-1,partial:Object.assign(Object.assign({},r),{[i]:c[t]})})}}(n))yield B(t)}function B(t={}){const e=[...x];return t[r.tag]&&t[r.nthoftype]&&e.splice(e.indexOf(r.tag),1),e.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function H(t,e){return[...t.map((t=>e+o.DESCENDANT+t)),...t.map((t=>e+o.CHILD+t))]}function*U(t,e,n="",o){const r=function*(t,e){const n=new Set,o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=g(n),s=g(o);return function(t){const{selectors:e,includeTag:n}=t,o=[...e];return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){return(0,Y[e])(t)}(t,n),u=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,s),l=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(u,s);return e[n]=r?Array.from(P(l,{maxResults:i})):l.map((t=>[t])),e}),{})}(t,e);for(const t of function*(t,e){for(const n of function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?function(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){return Array.from(P(t,{maxResults:e}))}(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(W):i}(e))yield*q(n,t)}(o,e))n.has(t)||(n.add(t),yield t)}(t,o);for(const o of function*(t,e){if(""===e)yield*t;else for(const n of t)yield*H([n],e)}(r,n))h(t,o,e)&&(yield o)}function*z(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...b(t,e).map((t=>[t]))];for(const t of r)for(const r of U(t,e,n,o))yield{foundElements:t,selector:r}}function J(t){return{value:t,include:!1}}function K({selectors:t,operator:e}){let n=[...x];t[r.tag]&&t[r.nthoftype]&&(n=n.filter((t=>t!==r.tag)));let o="";return n.forEach((e=>{var n;(null!==(n=t[e])&&void 0!==n?n:[]).forEach((({value:t,include:e})=>{e&&(o+=t)}))})),e+o}function Q(t,e){return t.map((t=>function(t,e){return[e?":scope":":root",...y(t,e).reverse().map((t=>{var e;const n=function(t,e,n=o.NONE){const r={};return e.forEach((e=>{Reflect.set(r,e,function(t,e){return G[e](t)}(t,e).map(J))})),{element:t,operator:n,selectors:r}}(t,[r.nthchild],o.CHILD);return(null!==(e=n.selectors.nthchild)&&void 0!==e?e:[]).forEach((t=>{t.include=!0})),n})).map(K)].join("")}(t,e))).join(N)}function X(t,e={}){return Z(t,Object.assign(Object.assign({},e),{maxResults:1})).next().value}function*Z(t,e={}){var o;const i=function(t){(t instanceof NodeList||t instanceof HTMLCollection)&&(t=Array.from(t));const e=(Array.isArray(t)?t:[t]).filter(n);return[...new Set(e)]}(t),c=function(t,e={}){const n=Object.assign(Object.assign({},s),e);return{selectors:(o=n.selectors,Array.isArray(o)?o.filter((t=>{return e=r,n=t,Object.values(e).includes(n);var e,n})):[]),whitelist:a(n.whitelist),blacklist:a(n.blacklist),root:d(n.root,t),combineWithinSelector:!!n.combineWithinSelector,combineBetweenSelectors:!!n.combineBetweenSelectors,includeTag:!!n.includeTag,maxCombinations:m(n.maxCombinations),maxCandidates:m(n.maxCandidates),useScope:!!n.useScope,maxResults:m(n.maxResults)};var o}(i[0],e),u=null!==(o=c.root)&&void 0!==o?o:S(i[0]);let l=0;for(const t of function*({elements:t,root:e,rootSelector:n="",options:o}){let r=e,i=n,c=!0;for(;c;){let n=!1;for(const c of z(t,r,i,o)){const{foundElements:o,selector:s}=c;if(n=!0,!h(t,s,e)){r=o[0],i=s;break}yield s}n||(c=!1)}}({elements:i,options:c,root:u,rootSelector:""}))if(yield t,l++,l>=c.maxResults)return;i.length>1&&(yield i.map((t=>X(t,c))).join(N),l++,l>=c.maxResults)||(yield Q(i,c.useScope?u:void 0))}const tt=X;return e})()));', gr = `// WebPub-specific setup - no execution blocking needed
5860
+ }`, Sn = '!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports._readium_cssSelectorGenerator=e():t._readium_cssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return"object"==typeof t&&null!==t&&t.nodeType===Node.ELEMENT_NODE}t.r(e),t.d(e,{_readium_cssSelectorGenerator:()=>Z,default:()=>tt,getCssSelector:()=>X});const o={NONE:"",DESCENDANT:" ",CHILD:" > "},r={id:"id",class:"class",tag:"tag",attribute:"attribute",nthchild:"nthchild",nthoftype:"nthoftype"},i="_readium_cssSelectorGenerator";function c(t="unknown problem",...e){console.warn(`${i}: ${t}`,...e)}const s={selectors:[r.id,r.class,r.tag,r.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY,useScope:!1};function u(t){return t instanceof RegExp}function l(t){return["string","function"].includes(typeof t)||u(t)}function a(t){return Array.isArray(t)?t.filter(l):[]}function f(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function d(t,e){if(f(t))return t.contains(e)||c("element root mismatch","Provided root does not contain the element. This will most likely result in producing a fallback selector using element\'s real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended."),t;const n=e.getRootNode({composed:!1});return f(n)?(n!==document&&c("shadow root inferred","You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."),n):S(e)}function m(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function p(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function g(t){const e=t.map((t=>{if(u(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(c("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return c("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function h(t,e,n){const o=Array.from(d(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function y(t,e){e=null!=e?e:S(t);const o=[];let r=t;for(;n(r)&&r!==e;)o.push(r),r=r.parentElement;return o}function b(t,e){return p(t.map((t=>y(t,e))))}function S(t){return t.ownerDocument.querySelector(":root")}const N=", ",v=new RegExp(["^$","\\\\s"].join("|")),E=new RegExp(["^$"].join("|")),x=[r.nthoftype,r.tag,r.id,r.class,r.attribute,r.nthchild],w=g(["class","id","ng-*"]);function I({name:t}){return`[${t}]`}function T({name:t,value:e}){return`[${t}=\'${e}\']`}function O({nodeName:t,nodeValue:e}){return{name:F(t),value:F(null!=e?e:void 0)}}function C(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t,nodeValue:e},n){const o=n.tagName.toLowerCase();return!(["input","option"].includes(o)&&"value"===t||"src"===t&&(null==e?void 0:e.startsWith("data:"))||w(t))}(e,t))).map(O);return[...e.map(I),...e.map(T)]}function j(t){var e;return(null!==(e=t.getAttribute("class"))&&void 0!==e?e:"").trim().split(/\\s+/).filter((t=>!E.test(t))).map((t=>`.${F(t)}`))}function A(t){var e;const n=null!==(e=t.getAttribute("id"))&&void 0!==e?e:"",o=`#${F(n)}`,r=t.getRootNode({composed:!1});return!v.test(n)&&h([t],o,r)?[o]:[]}function R(t){var e;const n=null===(e=t.parentElement)||void 0===e?void 0:e.children;if(n)for(let e=0;e<n.length;e++)if(n[e]===t)return[`:nth-child(${String(e+1)})`];return[]}function $(t){return[F(t.tagName.toLowerCase())]}function D(t){const e=[...new Set((n=t.map($),[].concat(...n)))];var n;return 0===e.length||e.length>1?[]:[e[0]]}function k(t){const e=D([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${String(r+1)})`]}return[]}function*P(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){let n=0,o=L(1);for(;o.length<=t.length&&n<e;){n+=1;const e=o.map((e=>t[e]));yield e,o=_(o,t.length-1)}}function _(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return L(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?L(n+1):o}function L(t=1){return Array.from(Array(t).keys())}const M=":".charCodeAt(0).toString(16).toUpperCase(),V=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function F(t=""){return CSS?CSS.escape(t):function(t=""){return t.split("").map((t=>":"===t?`\\\\${M} `:V.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const Y={tag:D,id:function(t){return 0===t.length||t.length>1?[]:A(t[0])},class:function(t){return p(t.map(j))},attribute:function(t){return p(t.map(C))},nthchild:function(t){return p(t.map(R))},nthoftype:function(t){return p(t.map(k))}},G={tag:$,id:A,class:j,attribute:C,nthchild:R,nthoftype:k};function W(t){return t.includes(r.tag)||t.includes(r.nthoftype)?[...t]:[...t,r.tag]}function*q(t,e){const n={};for(const o of t){const t=e[o];t&&t.length>0&&(n[o]=t)}for(const t of function*(t={}){const e=Object.entries(t);if(0===e.length)return;const n=[{index:e.length-1,partial:{}}];for(;n.length>0;){const t=n.pop();if(!t)break;const{index:o,partial:r}=t;if(o<0){yield r;continue}const[i,c]=e[o];for(let t=c.length-1;t>=0;t--)n.push({index:o-1,partial:Object.assign(Object.assign({},r),{[i]:c[t]})})}}(n))yield B(t)}function B(t={}){const e=[...x];return t[r.tag]&&t[r.nthoftype]&&e.splice(e.indexOf(r.tag),1),e.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function H(t,e){return[...t.map((t=>e+o.DESCENDANT+t)),...t.map((t=>e+o.CHILD+t))]}function*U(t,e,n="",o){const r=function*(t,e){const n=new Set,o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=g(n),s=g(o);return function(t){const{selectors:e,includeTag:n}=t,o=[...e];return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){return(0,Y[e])(t)}(t,n),u=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,s),l=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(u,s);return e[n]=r?Array.from(P(l,{maxResults:i})):l.map((t=>[t])),e}),{})}(t,e);for(const t of function*(t,e){for(const n of function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?function(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){return Array.from(P(t,{maxResults:e}))}(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(W):i}(e))yield*q(n,t)}(o,e))n.has(t)||(n.add(t),yield t)}(t,o);for(const o of function*(t,e){if(""===e)yield*t;else for(const n of t)yield*H([n],e)}(r,n))h(t,o,e)&&(yield o)}function*z(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...b(t,e).map((t=>[t]))];for(const t of r)for(const r of U(t,e,n,o))yield{foundElements:t,selector:r}}function J(t){return{value:t,include:!1}}function K({selectors:t,operator:e}){let n=[...x];t[r.tag]&&t[r.nthoftype]&&(n=n.filter((t=>t!==r.tag)));let o="";return n.forEach((e=>{var n;(null!==(n=t[e])&&void 0!==n?n:[]).forEach((({value:t,include:e})=>{e&&(o+=t)}))})),e+o}function Q(t,e){return t.map((t=>function(t,e){return[e?":scope":":root",...y(t,e).reverse().map((t=>{var e;const n=function(t,e,n=o.NONE){const r={};return e.forEach((e=>{Reflect.set(r,e,function(t,e){return G[e](t)}(t,e).map(J))})),{element:t,operator:n,selectors:r}}(t,[r.nthchild],o.CHILD);return(null!==(e=n.selectors.nthchild)&&void 0!==e?e:[]).forEach((t=>{t.include=!0})),n})).map(K)].join("")}(t,e))).join(N)}function X(t,e={}){return Z(t,Object.assign(Object.assign({},e),{maxResults:1})).next().value}function*Z(t,e={}){var o;const i=function(t){(t instanceof NodeList||t instanceof HTMLCollection)&&(t=Array.from(t));const e=(Array.isArray(t)?t:[t]).filter(n);return[...new Set(e)]}(t),c=function(t,e={}){const n=Object.assign(Object.assign({},s),e);return{selectors:(o=n.selectors,Array.isArray(o)?o.filter((t=>{return e=r,n=t,Object.values(e).includes(n);var e,n})):[]),whitelist:a(n.whitelist),blacklist:a(n.blacklist),root:d(n.root,t),combineWithinSelector:!!n.combineWithinSelector,combineBetweenSelectors:!!n.combineBetweenSelectors,includeTag:!!n.includeTag,maxCombinations:m(n.maxCombinations),maxCandidates:m(n.maxCandidates),useScope:!!n.useScope,maxResults:m(n.maxResults)};var o}(i[0],e),u=null!==(o=c.root)&&void 0!==o?o:S(i[0]);let l=0;for(const t of function*({elements:t,root:e,rootSelector:n="",options:o}){let r=e,i=n,c=!0;for(;c;){let n=!1;for(const c of z(t,r,i,o)){const{foundElements:o,selector:s}=c;if(n=!0,!h(t,s,e)){r=o[0],i=s;break}yield s}n||(c=!1)}}({elements:i,options:c,root:u,rootSelector:""}))if(yield t,l++,l>=c.maxResults)return;i.length>1&&(yield i.map((t=>X(t,c))).join(N),l++,l>=c.maxResults)||(yield Q(i,c.useScope?u:void 0))}const tt=X;return e})()));', yr = `// WebPub-specific setup - no execution blocking needed
5855
5861
  window._readium_blockedEvents = [];
5856
5862
  window._readium_blockEvents = false; // WebPub doesn't need event blocking
5857
5863
  window._readium_eventBlocker = null;
@@ -5869,21 +5875,21 @@ window._readium_eventBlocker = null;
5869
5875
  });
5870
5876
  })();
5871
5877
  `;
5872
- function yr(r) {
5878
+ function br(r) {
5873
5879
  const t = r.filter((s) => s.mediaType.isHTML).map((s) => s.href), e = t.length > 0 ? t : [/\.html$/, /\.xhtml$/, /\/$/], i = [
5874
5880
  // CSS Selector Generator - always injected
5875
5881
  {
5876
5882
  id: "css-selector-generator",
5877
5883
  as: "script",
5878
5884
  target: "head",
5879
- blob: new Blob([St(vn)], { type: "text/javascript" })
5885
+ blob: new Blob([vt(Sn)], { type: "text/javascript" })
5880
5886
  },
5881
5887
  // WebPub Execution - always injected (sets up event blocking to false)
5882
5888
  {
5883
5889
  id: "webpub-execution",
5884
5890
  as: "script",
5885
5891
  target: "head",
5886
- blob: new Blob([St(gr)], { type: "text/javascript" })
5892
+ blob: new Blob([vt(yr)], { type: "text/javascript" })
5887
5893
  }
5888
5894
  ], n = [
5889
5895
  // Onload Proxy - conditional (has executable scripts)
@@ -5891,7 +5897,7 @@ function yr(r) {
5891
5897
  id: "onload-proxy",
5892
5898
  as: "script",
5893
5899
  target: "head",
5894
- blob: new Blob([St(Pn)], { type: "text/javascript" }),
5900
+ blob: new Blob([vt(Pn)], { type: "text/javascript" }),
5895
5901
  condition: (s) => !!(s.querySelector("script") || s.querySelector("body[onload]:not(body[onload=''])"))
5896
5902
  },
5897
5903
  // Readium CSS WebPub - always injected
@@ -5899,7 +5905,7 @@ function yr(r) {
5899
5905
  id: "readium-css-webpub",
5900
5906
  as: "link",
5901
5907
  target: "head",
5902
- blob: new Blob([_t(mr)], { type: "text/css" }),
5908
+ blob: new Blob([_t(gr)], { type: "text/css" }),
5903
5909
  rel: "stylesheet"
5904
5910
  }
5905
5911
  ];
@@ -5911,7 +5917,7 @@ function yr(r) {
5911
5917
  }
5912
5918
  ];
5913
5919
  }
5914
- class br {
5920
+ class wr {
5915
5921
  constructor(t) {
5916
5922
  if (this.detectedTools = /* @__PURE__ */ new Set(), !t.onDetected)
5917
5923
  throw new Error("onDetected callback is required");
@@ -5943,11 +5949,11 @@ class br {
5943
5949
  this.observer?.disconnect(), this.observer = void 0, this.detectedTools.clear();
5944
5950
  }
5945
5951
  }
5946
- let wr = 0;
5952
+ let vr = 0;
5947
5953
  function Sr() {
5948
- return ++wr;
5954
+ return ++vr;
5949
5955
  }
5950
- const vr = `
5956
+ const Pr = `
5951
5957
  onmessage = function(event) {
5952
5958
  var action = event.data;
5953
5959
  var startTime = performance.now()
@@ -5983,13 +5989,13 @@ onmessage = function(event) {
5983
5989
  this.worker.terminate(), URL.revokeObjectURL(this.blobUrl);
5984
5990
  }
5985
5991
  };
5986
- Je.workerScript = vr;
5992
+ Je.workerScript = Pr;
5987
5993
  let se = Je;
5988
5994
  function Xe(r) {
5989
5995
  return typeof window < "u" && console ? console[r] : (...t) => {
5990
5996
  };
5991
5997
  }
5992
- const Pr = Xe("log"), Mi = Xe("table"), Er = Xe("clear");
5998
+ const Er = Xe("log"), Mi = Xe("table"), Cr = Xe("clear");
5993
5999
  async function Fi() {
5994
6000
  if (typeof navigator < "u" && navigator.brave && navigator.brave.isBrave)
5995
6001
  try {
@@ -6002,10 +6008,10 @@ async function Fi() {
6002
6008
  }
6003
6009
  return !1;
6004
6010
  }
6005
- function Cr(r) {
6011
+ function _r(r) {
6006
6012
  return r.excludes.some((t) => t()) ? !1 : r.includes.some((t) => t());
6007
6013
  }
6008
- class _r {
6014
+ class Lr {
6009
6015
  constructor(t = {}) {
6010
6016
  if (this.isOpen = !1, this.checkCount = 0, this.maxChecks = 10, this.maxPrintTime = 0, this.largeObjectArray = null, this.options = {
6011
6017
  onDetected: t.onDetected || (() => {
@@ -6067,14 +6073,14 @@ class _r {
6067
6073
  return (await this.workerConsole.log(t)).time;
6068
6074
  {
6069
6075
  const e = performance.now();
6070
- return Pr(t), performance.now() - e;
6076
+ return Er(t), performance.now() - e;
6071
6077
  }
6072
6078
  }
6073
6079
  /**
6074
6080
  * Check if performance-based detection is enabled for current browser
6075
6081
  */
6076
6082
  isPerformanceDetectionEnabled() {
6077
- return Cr({
6083
+ return _r({
6078
6084
  includes: [
6079
6085
  () => !!J.UA.Chrome,
6080
6086
  () => !!J.UA.Chromium,
@@ -6097,7 +6103,7 @@ class _r {
6097
6103
  if (!this.isPerformanceDetectionEnabled())
6098
6104
  return !1;
6099
6105
  const t = await this.calcTablePrintTime(), e = Math.max(await this.calcLogPrintTime(), await this.calcLogPrintTime());
6100
- return this.maxPrintTime = Math.max(this.maxPrintTime, e), this.workerConsole ? await this.workerConsole.clear() : Er(), t === 0 ? !1 : this.maxPrintTime === 0 ? !!await Fi() : t > this.maxPrintTime * 10;
6106
+ return this.maxPrintTime = Math.max(this.maxPrintTime, e), this.workerConsole ? await this.workerConsole.clear() : Cr(), t === 0 ? !1 : this.maxPrintTime === 0 ? !!await Fi() : t > this.maxPrintTime * 10;
6101
6107
  }
6102
6108
  /**
6103
6109
  * Debugger-based detection (fallback method)
@@ -6152,7 +6158,7 @@ class _r {
6152
6158
  this.intervalId && (clearInterval(this.intervalId), this.intervalId = void 0), this.workerConsole && (this.workerConsole.destroy(), this.workerConsole = void 0), this.isOpen = !1, this.checkCount = 0;
6153
6159
  }
6154
6160
  }
6155
- class Lr {
6161
+ class xr {
6156
6162
  constructor(t) {
6157
6163
  if (this.detected = !1, !t.onDetected)
6158
6164
  throw new Error("onDetected callback is required");
@@ -6187,7 +6193,7 @@ class Lr {
6187
6193
  this.observer?.disconnect(), this.observer = void 0, this.detected = !1;
6188
6194
  }
6189
6195
  }
6190
- class xr {
6196
+ class kr {
6191
6197
  constructor(t = {}) {
6192
6198
  this.styleElement = null, this.beforePrintHandler = null, this.onPrintAttempt = t.onPrintAttempt, t.disable && this.setupPrintProtection(t.watermark);
6193
6199
  }
@@ -6213,7 +6219,7 @@ class xr {
6213
6219
  this.beforePrintHandler && (window.removeEventListener("beforeprint", this.beforePrintHandler), this.beforePrintHandler = null), this.styleElement?.parentNode && (this.styleElement.parentNode.removeChild(this.styleElement), this.styleElement = null);
6214
6220
  }
6215
6221
  }
6216
- class kr {
6222
+ class Rr {
6217
6223
  constructor(t = {}) {
6218
6224
  this.onContextMenuBlocked = t.onContextMenuBlocked, this.contextMenuHandler = this.handleContextMenu.bind(this), document.addEventListener("contextmenu", this.contextMenuHandler, !0), window.addEventListener("unload", () => this.destroy());
6219
6225
  }
@@ -6232,10 +6238,10 @@ class kr {
6232
6238
  this.contextMenuHandler && (document.removeEventListener("contextmenu", this.contextMenuHandler, !0), this.contextMenuHandler = void 0);
6233
6239
  }
6234
6240
  }
6235
- const ot = "readium:navigator:suspiciousActivity";
6241
+ const lt = "readium:navigator:suspiciousActivity";
6236
6242
  class Ye {
6237
6243
  dispatchSuspiciousActivity(t, e) {
6238
- const i = new CustomEvent(ot, {
6244
+ const i = new CustomEvent(lt, {
6239
6245
  detail: {
6240
6246
  type: t,
6241
6247
  timestamp: Date.now(),
@@ -6245,7 +6251,7 @@ class Ye {
6245
6251
  window.dispatchEvent(i);
6246
6252
  }
6247
6253
  constructor(t = {}) {
6248
- t.monitorDevTools && (this.devToolsDetector = new _r({
6254
+ t.monitorDevTools && (this.devToolsDetector = new Lr({
6249
6255
  onDetected: () => {
6250
6256
  this.dispatchSuspiciousActivity("developer_tools", {
6251
6257
  targetFrameSrc: "",
@@ -6258,20 +6264,20 @@ class Ye {
6258
6264
  metaKey: !1
6259
6265
  });
6260
6266
  }
6261
- })), t.checkAutomation && (this.automationDetector = new br({
6267
+ })), t.checkAutomation && (this.automationDetector = new wr({
6262
6268
  onDetected: (e) => {
6263
6269
  this.dispatchSuspiciousActivity("automation_detected", { tool: e });
6264
6270
  }
6265
- })), t.checkIFrameEmbedding && (this.iframeEmbeddingDetector = new Lr({
6271
+ })), t.checkIFrameEmbedding && (this.iframeEmbeddingDetector = new xr({
6266
6272
  onDetected: (e) => {
6267
6273
  this.dispatchSuspiciousActivity("iframe_embedding_detected", { isCrossOrigin: e });
6268
6274
  }
6269
- })), t.protectPrinting?.disable && (this.printProtector = new xr({
6275
+ })), t.protectPrinting?.disable && (this.printProtector = new kr({
6270
6276
  ...t.protectPrinting,
6271
6277
  onPrintAttempt: () => {
6272
6278
  this.dispatchSuspiciousActivity("print", {});
6273
6279
  }
6274
- })), t.disableContextMenu && (this.contextMenuProtector = new kr({
6280
+ })), t.disableContextMenu && (this.contextMenuProtector = new Rr({
6275
6281
  onContextMenuBlocked: (e) => {
6276
6282
  this.dispatchSuspiciousActivity("context_menu", e);
6277
6283
  }
@@ -6281,7 +6287,7 @@ class Ye {
6281
6287
  this.automationDetector?.destroy(), this.devToolsDetector?.destroy(), this.iframeEmbeddingDetector?.destroy(), this.printProtector?.destroy(), this.contextMenuProtector?.destroy();
6282
6288
  }
6283
6289
  }
6284
- const at = "readium:navigator:keyboardPeripheral";
6290
+ const ht = "readium:navigator:keyboardPeripheral";
6285
6291
  class qe {
6286
6292
  constructor(t = {}) {
6287
6293
  this.keyManager = new hn(), this.setupKeyboardPeripherals(t.keyboardPeripherals || []);
@@ -6289,7 +6295,7 @@ class qe {
6289
6295
  setupKeyboardPeripherals(t) {
6290
6296
  if (t.length > 0) {
6291
6297
  const e = (i) => {
6292
- const n = new CustomEvent(at, {
6298
+ const n = new CustomEvent(ht, {
6293
6299
  detail: i
6294
6300
  });
6295
6301
  window.dispatchEvent(n);
@@ -6330,18 +6336,18 @@ const Or = (r) => ({
6330
6336
  peripheral: r.peripheral || (() => {
6331
6337
  })
6332
6338
  });
6333
- class Rr extends dn {
6339
+ class Ar extends dn {
6334
6340
  constructor(t, e, i, n = void 0, s = { preferences: {}, defaults: {} }) {
6335
- super(), this.currentIndex = 0, this._preferencesEditor = null, this._injector = null, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this.webViewport = {
6341
+ super(), this.currentIndex = 0, this._preferencesEditor = null, this._injector = null, this._isNavigating = !1, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this.webViewport = {
6336
6342
  readingOrder: [],
6337
6343
  progressions: /* @__PURE__ */ new Map(),
6338
6344
  positions: null
6339
- }, this.pub = e, this.container = t, this.listeners = Or(i), this._preferences = new Mt(s.preferences), this._defaults = new pr(s.defaults), this._settings = new Ai(this._preferences, this._defaults, this.hasDisplayTransformability), this._css = new cr({
6340
- rsProperties: new hr({ experiments: this._settings.experiments || null }),
6345
+ }, this.pub = e, this.container = t, this.listeners = Or(i), this._preferences = new Mt(s.preferences), this._defaults = new fr(s.defaults), this._settings = new Ai(this._preferences, this._defaults, this.hasDisplayTransformability), this._css = new dr({
6346
+ rsProperties: new cr({ experiments: this._settings.experiments || null }),
6341
6347
  userProperties: new mn({ zoom: this._settings.zoom })
6342
6348
  });
6343
- const o = yr(e.readingOrder.items), a = s.injectables || { rules: [], allowedDomains: [] };
6344
- if (this._injector = new Sn({
6349
+ const o = br(e.readingOrder.items), a = s.injectables || { rules: [], allowedDomains: [] };
6350
+ if (this._injector = new vn({
6345
6351
  rules: [...o, ...a.rules],
6346
6352
  allowedDomains: a.allowedDomains
6347
6353
  }), this._contentProtection = s.contentProtection || {}, this._keyboardPeripherals = this.mergeKeyboardPeripherals(
@@ -6350,12 +6356,12 @@ class Rr extends dn {
6350
6356
  ), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new Ye(this._contentProtection), this._suspiciousActivityListener = (l) => {
6351
6357
  const { type: h, ...c } = l.detail;
6352
6358
  h === "context_menu" ? this.listeners.contextMenu(c) : this.listeners.contentProtection(h, c);
6353
- }, window.addEventListener(ot, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new qe({
6359
+ }, window.addEventListener(lt, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new qe({
6354
6360
  keyboardPeripherals: this._keyboardPeripherals
6355
6361
  }), this._keyboardPeripheralListener = (l) => {
6356
6362
  const h = l.detail;
6357
6363
  this.listeners.peripheral(h);
6358
- }, window.addEventListener(at, this._keyboardPeripheralListener)), n && typeof n.copyWithLocations == "function") {
6364
+ }, window.addEventListener(ht, this._keyboardPeripheralListener)), n && typeof n.copyWithLocations == "function") {
6359
6365
  this.currentLocation = n;
6360
6366
  const l = this.pub.readingOrder.findIndexWithHref(n.href);
6361
6367
  l >= 0 && (this.currentIndex = l);
@@ -6457,12 +6463,12 @@ class Rr extends dn {
6457
6463
  if (h.startsWith("http://") || h.startsWith("https://"))
6458
6464
  c = h;
6459
6465
  else if (this.currentLocation.href.startsWith("http://") || this.currentLocation.href.startsWith("https://")) {
6460
- const p = new URL(this.currentLocation.href);
6461
- c = new URL(h, p).href;
6466
+ const f = new URL(this.currentLocation.href);
6467
+ c = new URL(h, f).href;
6462
6468
  } else
6463
6469
  c = Xt.join(Xt.dirname(this.currentLocation.href), h);
6464
- const u = this.pub.readingOrder.findWithHref(c);
6465
- u ? this.goLink(u, !1, () => {
6470
+ const d = this.pub.readingOrder.findWithHref(c);
6471
+ d ? this.goLink(d, !1, () => {
6466
6472
  }) : (console.warn(`Internal link not found in readingOrder: ${c}`), this.listeners.handleLocator(new $({
6467
6473
  href: h
6468
6474
  }).locator));
@@ -6506,7 +6512,7 @@ class Rr extends dn {
6506
6512
  }
6507
6513
  }
6508
6514
  determineModules() {
6509
- const t = gs.slice(), e = bt(this.pub.metadata);
6515
+ const t = ys.slice(), e = bt(this.pub.metadata);
6510
6516
  return e === "cjk-vertical" || e === "mongolian-vertical" ? t.map((i) => i === "webpub_snapper" ? "cjk_vertical_snapper" : i) : t;
6511
6517
  }
6512
6518
  attachListener() {
@@ -6519,7 +6525,7 @@ class Rr extends dn {
6519
6525
  throw Error("Link for " + this.currentLocation.href + " not found!");
6520
6526
  }
6521
6527
  async destroy() {
6522
- this._suspiciousActivityListener && window.removeEventListener(ot, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(at, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), await this.framePool?.destroy();
6528
+ this._suspiciousActivityListener && window.removeEventListener(lt, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(ht, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), await this.framePool?.destroy();
6523
6529
  }
6524
6530
  async changeResource(t) {
6525
6531
  if (t === 0) return !1;
@@ -6539,13 +6545,21 @@ class Rr extends dn {
6539
6545
  })), this.updateViewport(e), this.listeners.positionChanged(this.currentLocation), await this.framePool.update(this.pub, this.currentLocation, this.determineModules());
6540
6546
  }
6541
6547
  goBackward(t, e) {
6542
- this.changeResource(-1).then((i) => {
6543
- e(i);
6548
+ if (this._isNavigating) {
6549
+ e(!1);
6550
+ return;
6551
+ }
6552
+ this._isNavigating = !0, this.changeResource(-1).then((i) => {
6553
+ this._isNavigating = !1, e(i);
6544
6554
  });
6545
6555
  }
6546
6556
  goForward(t, e) {
6547
- this.changeResource(1).then((i) => {
6548
- e(i);
6557
+ if (this._isNavigating) {
6558
+ e(!1);
6559
+ return;
6560
+ }
6561
+ this._isNavigating = !0, this.changeResource(1).then((i) => {
6562
+ this._isNavigating = !1, e(i);
6549
6563
  });
6550
6564
  }
6551
6565
  get currentLocator() {
@@ -6620,7 +6634,13 @@ class Rr extends dn {
6620
6634
  if (!this.pub.readingOrder.findWithHref(n))
6621
6635
  return i(this.listeners.handleLocator(t));
6622
6636
  const o = this.pub.readingOrder.findIndexWithHref(n);
6623
- o >= 0 && (this.currentIndex = o), this.currentLocation = this.createCurrentLocator(), this.apply().then(() => this.loadLocator(t, (a) => i(a))).then(() => {
6637
+ if (o >= 0 && (this.currentIndex = o), this._isNavigating) {
6638
+ i(!1);
6639
+ return;
6640
+ }
6641
+ this._isNavigating = !0, this.currentLocation = this.createCurrentLocator(), this.apply().then(() => this.loadLocator(t, (a) => {
6642
+ this._isNavigating = !1, i(a);
6643
+ })).then(() => {
6624
6644
  this.attachListener();
6625
6645
  });
6626
6646
  }
@@ -6645,7 +6665,7 @@ class Rr extends dn {
6645
6665
  });
6646
6666
  }
6647
6667
  }
6648
- const go = Rr, Ar = (r) => {
6668
+ const yo = Ar, Tr = (r) => {
6649
6669
  const t = r.join(" ");
6650
6670
  return [
6651
6671
  // 'self' is useless because the document is loaded from a blob: URL
@@ -6710,21 +6730,21 @@ class En {
6710
6730
  ...e ? [e] : [],
6711
6731
  ...a
6712
6732
  ])].filter(Boolean);
6713
- if (o && !s && this.setProperties(o, t), t.body.querySelectorAll("img").forEach((u) => {
6714
- u.setAttribute("fetchpriority", "high");
6733
+ if (o && !s && this.setProperties(o, t), t.body.querySelectorAll("img").forEach((d) => {
6734
+ d.setAttribute("fetchpriority", "high");
6715
6735
  }), n.isHTML && this.pub.metadata.languages?.[0]) {
6716
- const u = this.pub.metadata.languages[0];
6736
+ const d = this.pub.metadata.languages[0];
6717
6737
  if (n === m.XHTML) {
6718
- const p = t.documentElement.lang || t.documentElement.getAttribute("xml:lang"), g = t.body.lang || t.body.getAttribute("xml:lang");
6719
- g && !p ? (t.documentElement.lang = g, t.documentElement.setAttribute("xml:lang", g), t.body.removeAttribute("xml:lang"), t.body.removeAttribute("lang")) : p || (t.documentElement.lang = u, t.documentElement.setAttribute("xml:lang", u));
6720
- } else n === m.HTML && !t.documentElement.lang && (t.documentElement.lang = u);
6738
+ const f = t.documentElement.lang || t.documentElement.getAttribute("xml:lang"), g = t.body.lang || t.body.getAttribute("xml:lang");
6739
+ g && !f ? (t.documentElement.lang = g, t.documentElement.setAttribute("xml:lang", g), t.body.removeAttribute("xml:lang"), t.body.removeAttribute("lang")) : f || (t.documentElement.lang = d, t.documentElement.setAttribute("xml:lang", d));
6740
+ } else n === m.HTML && !t.documentElement.lang && (t.documentElement.lang = d);
6721
6741
  }
6722
6742
  if (bt(this.pub.metadata) === "rtl" && !t.documentElement.dir && !t.body.dir && (t.documentElement.dir = M.rtl), i !== void 0) {
6723
- const u = t.createElement("base");
6724
- u.href = i, u.dataset.readium = "true", t.head.firstChild.before(u);
6743
+ const d = t.createElement("base");
6744
+ d.href = i, d.dataset.readium = "true", t.head.firstChild.before(d);
6725
6745
  }
6726
6746
  const c = t.createElement("meta");
6727
- return c.httpEquiv = "Content-Security-Policy", c.content = Ar(l), c.dataset.readium = "true", t.head.firstChild.before(c), URL.createObjectURL(
6747
+ return c.httpEquiv = "Content-Security-Policy", c.content = Tr(l), c.dataset.readium = "true", t.head.firstChild.before(c), URL.createObjectURL(
6728
6748
  new Blob([new XMLSerializer().serializeToString(t)], {
6729
6749
  type: n.isHTML ? n.string : "application/xhtml+xml"
6730
6750
  // Fallback to XHTML
@@ -6782,7 +6802,7 @@ class Cn {
6782
6802
  }
6783
6803
  async hide() {
6784
6804
  if (!this.destroyed) {
6785
- if (this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.opacity = "0", this.frame.style.pointerEvents = "none", this.hidden = !0, this.frame.parentElement)
6805
+ if (this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.opacity = "0", this.frame.style.pointerEvents = "none", this.hidden = !0, this.frame.blur(), this.frame.parentElement)
6786
6806
  return this.comms === void 0 || !this.comms.ready ? void 0 : new Promise((t, e) => {
6787
6807
  this.comms?.send("unfocus", void 0, (i) => {
6788
6808
  this.comms?.halt(), t();
@@ -6838,7 +6858,7 @@ class Cn {
6838
6858
  }
6839
6859
  }
6840
6860
  const Ii = 5, zi = 3;
6841
- class Tr {
6861
+ class Nr {
6842
6862
  constructor(t, e, i, n, s, o) {
6843
6863
  this.pool = /* @__PURE__ */ new Map(), this.blobs = /* @__PURE__ */ new Map(), this.inprogress = /* @__PURE__ */ new Map(), this.pendingUpdates = /* @__PURE__ */ new Map(), this.injector = null, this.container = t, this.positions = e, this.currentCssProperties = i, this.injector = n ?? null, this.contentProtectionConfig = s || {}, this.keyboardPeripheralsConfig = o || [];
6844
6864
  }
@@ -6863,54 +6883,58 @@ class Tr {
6863
6883
  const o = this.positions[s].href;
6864
6884
  this.inprogress.has(o) && await this.inprogress.get(o);
6865
6885
  const a = new Promise(async (l, h) => {
6866
- const c = [], u = [];
6867
- this.positions.forEach((d, f) => {
6868
- (f > s + Ii || f < s - Ii) && (c.includes(d.href) || c.push(d.href)), f < s + zi && f > s - zi && (u.includes(d.href) || u.push(d.href));
6869
- }), c.forEach(async (d) => {
6870
- u.includes(d) || this.pool.has(d) && (await this.pool.get(d)?.destroy(), this.pool.delete(d), this.pendingUpdates.has(d) && this.pendingUpdates.set(d, { inPool: !1 }));
6871
- }), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((d) => {
6872
- this.injector?.releaseBlobUrl?.(d), URL.revokeObjectURL(d);
6886
+ const c = [], d = [];
6887
+ this.positions.forEach((u, p) => {
6888
+ (p > s + Ii || p < s - Ii) && (c.includes(u.href) || c.push(u.href)), p < s + zi && p > s - zi && (d.includes(u.href) || d.push(u.href));
6889
+ }), c.forEach(async (u) => {
6890
+ d.includes(u) || this.pool.has(u) && (await this.pool.get(u)?.destroy(), this.pool.delete(u), this.pendingUpdates.has(u) && this.pendingUpdates.set(u, { inPool: !1 }));
6891
+ }), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((u) => {
6892
+ this.injector?.releaseBlobUrl?.(u), URL.revokeObjectURL(u);
6873
6893
  }), this.blobs.clear()), this.currentBaseURL = t.baseURL;
6874
- const p = async (d) => {
6875
- if (n && (this.blobs.forEach((P) => {
6876
- this.injector?.releaseBlobUrl?.(P), URL.revokeObjectURL(P);
6877
- }), this.blobs.clear(), this.pendingUpdates.clear()), this.pendingUpdates.has(d) && this.pendingUpdates.get(d)?.inPool === !1) {
6878
- const P = this.blobs.get(d);
6879
- P && (this.injector?.releaseBlobUrl?.(P), URL.revokeObjectURL(P), this.blobs.delete(d), this.pendingUpdates.delete(d));
6894
+ const f = async (u) => {
6895
+ if (n && (this.blobs.forEach((v) => {
6896
+ this.injector?.releaseBlobUrl?.(v), URL.revokeObjectURL(v);
6897
+ }), this.blobs.clear(), this.pendingUpdates.clear()), this.pendingUpdates.has(u) && this.pendingUpdates.get(u)?.inPool === !1) {
6898
+ const v = this.blobs.get(u);
6899
+ v && (this.injector?.releaseBlobUrl?.(v), URL.revokeObjectURL(v), this.blobs.delete(u), this.pendingUpdates.delete(u));
6880
6900
  }
6881
- if (this.pool.has(d)) {
6882
- const P = this.pool.get(d);
6883
- if (!this.blobs.has(d))
6884
- await P.destroy(), this.pool.delete(d), this.pendingUpdates.delete(d);
6901
+ if (this.pool.has(u)) {
6902
+ const v = this.pool.get(u);
6903
+ if (!this.blobs.has(u))
6904
+ await v.destroy(), this.pool.delete(u), this.pendingUpdates.delete(u);
6885
6905
  else {
6886
- await P.load(i);
6906
+ await v.load(i);
6887
6907
  return;
6888
6908
  }
6889
6909
  }
6890
- const f = t.readingOrder.findWithHref(d);
6891
- if (!f) return;
6892
- if (!this.blobs.has(d)) {
6893
- const R = await new En(
6910
+ const p = t.readingOrder.findWithHref(u);
6911
+ if (!p) return;
6912
+ if (!this.blobs.has(u)) {
6913
+ const O = await new En(
6894
6914
  t,
6895
6915
  this.currentBaseURL || "",
6896
- f,
6916
+ p,
6897
6917
  {
6898
6918
  cssProperties: this.currentCssProperties,
6899
6919
  injector: this.injector
6900
6920
  }
6901
6921
  ).build();
6902
- this.blobs.set(d, R);
6922
+ this.blobs.set(u, O);
6903
6923
  }
6904
- const w = new Cn(this.blobs.get(d), this.contentProtectionConfig, this.keyboardPeripheralsConfig);
6905
- d !== o && await w.hide(), this.container.appendChild(w.iframe), await w.load(i), this.pool.set(d, w);
6924
+ const b = new Cn(this.blobs.get(u), this.contentProtectionConfig, this.keyboardPeripheralsConfig);
6925
+ u !== o && await b.hide(), this.container.appendChild(b.iframe), await b.load(i), this.pool.set(u, b);
6906
6926
  };
6907
6927
  try {
6908
- await Promise.all(u.map((d) => p(d)));
6909
- } catch (d) {
6910
- h(d);
6928
+ await Promise.all(d.map((u) => f(u)));
6929
+ } catch (u) {
6930
+ h(u);
6911
6931
  }
6912
6932
  const g = this.pool.get(o);
6913
- (g?.source !== this._currentFrame?.source || n) && (await this._currentFrame?.hide(), g && await g.load(i), g && await g.show(e.locations.progression), this._currentFrame = g), l();
6933
+ if ((g?.source !== this._currentFrame?.source || n) && (await this._currentFrame?.hide(), g && await g.load(i), g && await g.show(e.locations.progression), this._currentFrame = g, g)) {
6934
+ const u = this.container.ownerDocument.activeElement;
6935
+ u && u.tagName === "IFRAME" && u !== g.iframe && g.iframe.focus({ preventScroll: !0 });
6936
+ }
6937
+ l();
6914
6938
  });
6915
6939
  this.inprogress.set(o, a), await a, this.inprogress.delete(o);
6916
6940
  }
@@ -6955,7 +6979,7 @@ class Tr {
6955
6979
  }), t;
6956
6980
  }
6957
6981
  }
6958
- class Nr {
6982
+ class Mr {
6959
6983
  constructor(t, e, i, n = {}, s = []) {
6960
6984
  this.currModules = [], this.cachedPage = void 0, this.peripherals = t, this.debugHref = i, this.contentProtectionConfig = { ...n }, this.keyboardPeripheralsConfig = [...s], this.frame = document.createElement("iframe"), this.frame.sandbox.value = "allow-same-origin allow-scripts", this.frame.classList.add("readium-navigator-iframe"), this.frame.classList.add("blank"), this.frame.scrolling = "no", this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.display = "none", this.frame.style.position = "absolute", this.frame.style.pointerEvents = "none", this.frame.style.transformOrigin = "0 0", this.frame.style.transform = "scale(1)", this.frame.style.background = "#fff", this.frame.style.touchAction = "none", this.frame.dataset.originalHref = i, this.source = "about:blank", this.wrapper = document.createElement("div"), this.wrapper.style.position = "relative", this.wrapper.style.float = this.wrapper.style.cssFloat = e === M.rtl ? "right" : "left", this.wrapper.appendChild(this.frame);
6961
6985
  }
@@ -7017,10 +7041,10 @@ class Nr {
7017
7041
  const i = Math.min(this.wrapper.clientWidth / e.width, this.wrapper.clientHeight / e.height);
7018
7042
  this.frame.style.transform = `scale(${i})`;
7019
7043
  const n = this.frame.getBoundingClientRect(), s = this.wrapper.clientHeight - n.height;
7020
- if (this.frame.style.top = `${s / 2}px`, t === G.left) {
7044
+ if (this.frame.style.top = `${s / 2}px`, t === X.left) {
7021
7045
  const o = this.wrapper.clientWidth - n.width;
7022
7046
  this.frame.style.left = `${o}px`;
7023
- } else if (t === G.center) {
7047
+ } else if (t === X.center) {
7024
7048
  const o = this.wrapper.clientWidth - n.width;
7025
7049
  this.frame.style.left = `${o / 2}px`;
7026
7050
  } else
@@ -7051,11 +7075,11 @@ class Nr {
7051
7075
  }
7052
7076
  async unfocus() {
7053
7077
  if (this.frame.parentElement)
7054
- return this.comms === void 0 ? void 0 : new Promise((t, e) => {
7078
+ return this.comms === void 0 ? void 0 : (this.frame.blur(), new Promise((t, e) => {
7055
7079
  this.comms?.send("unfocus", void 0, (i) => {
7056
7080
  this.comms?.halt(), this.showPromise = void 0, t();
7057
7081
  });
7058
- });
7082
+ }));
7059
7083
  this.comms?.halt();
7060
7084
  }
7061
7085
  applyContentProtection() {
@@ -7126,8 +7150,8 @@ class Nr {
7126
7150
  return this.loader;
7127
7151
  }
7128
7152
  }
7129
- var Mr = /* @__PURE__ */ ((r) => (r[r.Left = 0] = "Left", r[r.Center = 1] = "Center", r[r.Right = 2] = "Right", r))(Mr || {}), Fr = /* @__PURE__ */ ((r) => (r[r.Top = 0] = "Top", r[r.Middle = 1] = "Middle", r[r.Bottom = 2] = "Bottom", r))(Fr || {});
7130
- class Ir {
7153
+ var Fr = /* @__PURE__ */ ((r) => (r[r.Left = 0] = "Left", r[r.Center = 1] = "Center", r[r.Right = 2] = "Right", r))(Fr || {}), Ir = /* @__PURE__ */ ((r) => (r[r.Top = 0] = "Top", r[r.Middle = 1] = "Middle", r[r.Bottom = 2] = "Bottom", r))(Ir || {});
7154
+ class zr {
7131
7155
  constructor() {
7132
7156
  this.outerWidth = 0, this.outerHeight = 0, this.HTML = document.documentElement, this.Head = document.head, this.Body = document.body;
7133
7157
  }
@@ -7175,7 +7199,7 @@ class Ir {
7175
7199
  };
7176
7200
  }
7177
7201
  }
7178
- class zr {
7202
+ class Dr {
7179
7203
  constructor() {
7180
7204
  this._DOM = {
7181
7205
  show: !1,
@@ -7194,7 +7218,7 @@ class zr {
7194
7218
  }
7195
7219
  }
7196
7220
  const Di = 6, ye = 1.02, Wi = 50;
7197
- class Dr {
7221
+ class Wr {
7198
7222
  constructor(t, e = !1) {
7199
7223
  this.dragState = 0, this.minimumMoved = !1, this.pan = {
7200
7224
  startX: 0,
@@ -7213,7 +7237,7 @@ class Dr {
7213
7237
  target: { X: 0, Y: 0 },
7214
7238
  touchN: 0,
7215
7239
  startTranslate: { X: 0, Y: 0 }
7216
- }, this._scale = 1, this.scaleDebouncer = 0, this.frameBounds = null, this.debugger = null, this.btouchstartHandler = this.touchstartHandler.bind(this), this.btouchendHandler = this.touchendHandler.bind(this), this.btouchmoveHandler = this.touchmoveHandler.bind(this), this.bdblclickHandler = this.dblclickHandler.bind(this), this.bmousedownHandler = this.mousedownHandler.bind(this), this.bmouseupHandler = this.mouseupHandler.bind(this), this.bmousemoveHandler = this.mousemoveHandler.bind(this), this.moveFrame = 0, this.manager = t, this.coordinator = new Ir(), this.attachEvents(), e && (this.debugger = new zr());
7240
+ }, this._scale = 1, this.scaleDebouncer = 0, this.frameBounds = null, this.debugger = null, this.btouchstartHandler = this.touchstartHandler.bind(this), this.btouchendHandler = this.touchendHandler.bind(this), this.btouchmoveHandler = this.touchmoveHandler.bind(this), this.bdblclickHandler = this.dblclickHandler.bind(this), this.bmousedownHandler = this.mousedownHandler.bind(this), this.bmouseupHandler = this.mouseupHandler.bind(this), this.bmousemoveHandler = this.mousemoveHandler.bind(this), this.moveFrame = 0, this.manager = t, this.coordinator = new zr(), this.attachEvents(), e && (this.debugger = new Dr());
7217
7241
  }
7218
7242
  get scale() {
7219
7243
  return this._scale;
@@ -7353,8 +7377,8 @@ class Dr {
7353
7377
  h += l.X / this.scale, this.pinch.target.X += h, l.X += this.pinch.target.X * this.scale / this.pinch.startScale;
7354
7378
  let c = -l.Y / s;
7355
7379
  c += l.Y / this.scale, this.pinch.target.Y += c, l.Y += this.pinch.target.Y * this.scale / this.pinch.startScale;
7356
- let u = (l.X - (this.pan.startX - this.manager.width / 2)) * 1 / this.scale, p = (l.Y - (this.pan.startY - this.manager.height / 2)) * 1 / this.scale;
7357
- this.pan.translateX = u, this.pan.translateY = p, this.debugger?.show && (this.debugger.DOM.pinchTarget.style.left = `${this.pinch.target.X * this.scale / this.pinch.startScale - 5 + this.manager.width / 2}px`, this.debugger.DOM.pinchTarget.style.top = `${this.pinch.target.Y * this.scale / this.pinch.startScale - 5 + this.manager.height / 2}px`, this.debugger.DOM.pinchTarget.innerText = `${(this.pinch.target.X * this.scale / this.pinch.startScale).toFixed(2)},${(this.pinch.target.Y * this.scale / this.pinch.startScale).toFixed(2)}`);
7380
+ let d = (l.X - (this.pan.startX - this.manager.width / 2)) * 1 / this.scale, f = (l.Y - (this.pan.startY - this.manager.height / 2)) * 1 / this.scale;
7381
+ this.pan.translateX = d, this.pan.translateY = f, this.debugger?.show && (this.debugger.DOM.pinchTarget.style.left = `${this.pinch.target.X * this.scale / this.pinch.startScale - 5 + this.manager.width / 2}px`, this.debugger.DOM.pinchTarget.style.top = `${this.pinch.target.Y * this.scale / this.pinch.startScale - 5 + this.manager.height / 2}px`, this.debugger.DOM.pinchTarget.innerText = `${(this.pinch.target.X * this.scale / this.pinch.startScale).toFixed(2)},${(this.pinch.target.Y * this.scale / this.pinch.startScale).toFixed(2)}`);
7358
7382
  }
7359
7383
  const o = this.frameBounds.width / 6, a = this.frameBounds.height / 6;
7360
7384
  this.pan.translateX < -o && (this.pan.overscrollX = -(o + this.pan.translateX), this.pan.translateX = -o), this.pan.translateY < -a && (this.pan.overscrollY = -(a + this.pan.translateY), this.pan.translateY = -a), this.pan.translateX > o && (this.pan.overscrollX = o - this.pan.translateX, this.pan.translateX = o), this.pan.translateY > a && (this.pan.overscrollY = a - this.pan.translateY, this.pan.translateY = a), n = !0, this.debugger?.show && (this.debugger.DOM.stats.innerText = `TX: ${this.pan.translateX.toFixed(2)}
@@ -7415,7 +7439,7 @@ Overscroll: ${this.pan.overscrollX.toFixed(2)},${this.pan.overscrollY.toFixed(2)
7415
7439
  }
7416
7440
  }
7417
7441
  var Ne = /* @__PURE__ */ ((r) => (r.auto = "auto", r.landscape = "landscape", r.portrait = "portrait", r))(Ne || {}), Me = /* @__PURE__ */ ((r) => (r.auto = "auto", r.both = "both", r.none = "none", r.landscape = "landscape", r))(Me || {});
7418
- class Wr {
7442
+ class Ur {
7419
7443
  // TODO getter
7420
7444
  constructor(t) {
7421
7445
  this.shift = !0, this.spreads = [], this.nLandscape = 0, this.index(t), this.testShift(t), console.log(`Indexed ${this.spreads.length} spreads for ${t.readingOrder.items.length} items`);
@@ -7444,13 +7468,13 @@ class Wr {
7444
7468
  if (i.length > 1)
7445
7469
  return;
7446
7470
  const s = i[0], o = s.properties?.otherProperties.orientation;
7447
- n === 0 && (o === "landscape" || o !== "portrait" && ((s.width || 0) > (s.height || 0) || s.properties?.otherProperties.spread === "both")) && (this.shift = !1), e && s.properties?.page === G.center && this.spreads[n - 1][0].addProperties({ addBlank: !0 }), o === "portrait" && s.properties?.page !== "center" && s.properties?.otherProperties.number > 1 ? e = !0 : e = !1;
7471
+ n === 0 && (o === "landscape" || o !== "portrait" && ((s.width || 0) > (s.height || 0) || s.properties?.otherProperties.spread === "both")) && (this.shift = !1), e && s.properties?.page === X.center && this.spreads[n - 1][0].addProperties({ addBlank: !0 }), o === "portrait" && s.properties?.page !== "center" && s.properties?.otherProperties.number > 1 ? e = !0 : e = !1;
7448
7472
  }), this.shift || this.index(t, !0);
7449
7473
  }
7450
7474
  buildSpreads(t) {
7451
7475
  let e = [];
7452
7476
  t.items.forEach((i, n) => {
7453
- !n && this.shift ? this.spreads.push([i]) : i.properties?.page === G.center ? (e.length > 0 && this.spreads.push(e), this.spreads.push([i]), e = []) : e.length >= 2 ? (this.spreads.push(e), e = [i]) : e.push(i);
7477
+ !n && this.shift ? this.spreads.push([i]) : i.properties?.page === X.center ? (e.length > 0 && this.spreads.push(e), this.spreads.push([i]), e = []) : e.length >= 2 ? (this.spreads.push(e), e = [i]) : e.push(i);
7454
7478
  }), e.length > 0 && this.spreads.push(e);
7455
7479
  }
7456
7480
  currentSpread(t, e) {
@@ -7460,13 +7484,13 @@ class Wr {
7460
7484
  return this.spreads.find((e) => e.includes(t)) || void 0;
7461
7485
  }
7462
7486
  }
7463
- const Ui = 8, Hi = 5, Ur = 300, Hr = 15e3, Br = 250, Vr = 150, jr = 500;
7464
- class $r {
7487
+ const Ui = 8, Hi = 5, Hr = 300, Br = 15e3, Vr = 250, jr = 150, $r = 500;
7488
+ class Gr {
7465
7489
  constructor(t, e, i, n, s, o) {
7466
7490
  if (this.pool = /* @__PURE__ */ new Map(), this.blobs = /* @__PURE__ */ new Map(), this.inprogress = /* @__PURE__ */ new Map(), this.delayedShow = /* @__PURE__ */ new Map(), this.delayedTimeout = /* @__PURE__ */ new Map(), this.previousFrames = [], this.injector = null, this.width = 0, this.height = 0, this.transform = "", this.currentSlide = 0, this.spread = !0, this.orientationInternal = -1, this.container = t, this.positions = e, this.pub = i, this.injector = n ?? null, this.contentProtectionConfig = s || {}, this.keyboardPeripheralsConfig = o || [], this.spreadPresentation = i.metadata.otherMetadata?.spread || Me.auto, this.pub.metadata.effectiveReadingProgression !== M.rtl && this.pub.metadata.effectiveReadingProgression !== M.ltr)
7467
7491
  throw Error("Unsupported reading progression for EPUB");
7468
- this.spreader = new Wr(this.pub), this.containerHeightCached = t.clientHeight, this.bookElement = document.createElement("div"), this.bookElement.ariaLabel = "Book", this.bookElement.tabIndex = -1, this.updateBookStyle(!0), this.spineElement = document.createElement("div"), this.spineElement.ariaLabel = "Spine", this.bookElement.appendChild(this.spineElement), this.container.appendChild(this.bookElement), this.updateSpineStyle(!0), this.peripherals = new Dr(this), this.pub.readingOrder.items.forEach((a) => {
7469
- const l = new Nr(this.peripherals, this.pub.metadata.effectiveReadingProgression, a.href, this.contentProtectionConfig, this.keyboardPeripheralsConfig);
7492
+ this.spreader = new Ur(this.pub), this.containerHeightCached = t.clientHeight, this.bookElement = document.createElement("div"), this.bookElement.ariaLabel = "Book", this.bookElement.tabIndex = -1, this.updateBookStyle(!0), this.spineElement = document.createElement("div"), this.spineElement.ariaLabel = "Spine", this.bookElement.appendChild(this.spineElement), this.container.appendChild(this.bookElement), this.updateSpineStyle(!0), this.peripherals = new Wr(this), this.pub.readingOrder.items.forEach((a) => {
7493
+ const l = new Mr(this.peripherals, this.pub.metadata.effectiveReadingProgression, a.href, this.contentProtectionConfig, this.keyboardPeripheralsConfig);
7470
7494
  this.spineElement.appendChild(l.element), this.pool.set(a.href, l), l.width = 100 / this.length * (a.properties?.otherProperties.orientation === Ne.landscape || a.properties?.otherProperties.addBlank ? this.perPage : 1), l.height = this.height;
7471
7495
  });
7472
7496
  }
@@ -7491,7 +7515,7 @@ class $r {
7491
7515
  const a = this.spreader.findByLink(o);
7492
7516
  i.update(this.spreadPosition(a, o));
7493
7517
  });
7494
- }, Br);
7518
+ }, Vr);
7495
7519
  }
7496
7520
  /**
7497
7521
  * It is important that these values be cached to avoid spamming them on redraws, they are expensive.
@@ -7518,7 +7542,7 @@ class $r {
7518
7542
  let i = "0";
7519
7543
  this.updateDimensions(), this.perPage > 1 && (i = `${this.width / 2}px`);
7520
7544
  const n = {
7521
- transition: t ? `all ${e ? Vr : jr}ms ease-out` : "all 0ms ease-out",
7545
+ transition: t ? `all ${e ? jr : $r}ms ease-out` : "all 0ms ease-out",
7522
7546
  marginRight: this.rtl ? i : "0",
7523
7547
  marginLeft: this.rtl ? "0" : i,
7524
7548
  width: `${this.width / this.perPage * this.length}px`,
@@ -7653,7 +7677,7 @@ class $r {
7653
7677
  return t % 2 && !this.single && t++, t;
7654
7678
  }
7655
7679
  spreadPosition(t, e) {
7656
- return this.perPage < 2 || t.length < 2 ? G.center : e.href === t[0].href ? this.rtl ? G.right : G.left : this.rtl ? G.left : G.right;
7680
+ return this.perPage < 2 || t.length < 2 ? X.center : e.href === t[0].href ? this.rtl ? X.right : X.left : this.rtl ? X.left : X.right;
7657
7681
  }
7658
7682
  async waitForItem(t) {
7659
7683
  if (this.inprogress.has(t) && await this.inprogress.get(t), this.delayedShow.has(t)) {
@@ -7676,54 +7700,56 @@ class $r {
7676
7700
  for (const l of o)
7677
7701
  await this.waitForItem(l.href);
7678
7702
  const a = new Promise(async (l, h) => {
7679
- const c = [], u = [];
7680
- this.positions.forEach((d, f) => {
7681
- (f > s + Ui || f < s - Ui) && (c.includes(d.href) || c.push(d.href)), f < s + Hi && f > s - Hi && (u.includes(d.href) || u.push(d.href));
7682
- }), c.forEach(async (d) => {
7683
- u.includes(d) || this.pool.has(d) && (this.cancelShowing(d), await this.pool.get(d)?.unload());
7684
- }), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((d) => URL.revokeObjectURL(d)), this.blobs.clear()), this.currentBaseURL = t.baseURL;
7685
- const p = async (d) => {
7686
- const f = t.readingOrder.findIndexWithHref(d), w = t.readingOrder.items[f];
7687
- if (w) {
7688
- if (!this.blobs.has(d)) {
7689
- const R = await new En(
7703
+ const c = [], d = [];
7704
+ this.positions.forEach((p, b) => {
7705
+ (b > s + Ui || b < s - Ui) && (c.includes(p.href) || c.push(p.href)), b < s + Hi && b > s - Hi && (d.includes(p.href) || d.push(p.href));
7706
+ }), c.forEach(async (p) => {
7707
+ d.includes(p) || this.pool.has(p) && (this.cancelShowing(p), await this.pool.get(p)?.unload());
7708
+ }), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((p) => URL.revokeObjectURL(p)), this.blobs.clear()), this.currentBaseURL = t.baseURL;
7709
+ const f = async (p) => {
7710
+ const b = t.readingOrder.findIndexWithHref(p), v = t.readingOrder.items[b];
7711
+ if (v) {
7712
+ if (!this.blobs.has(p)) {
7713
+ const G = await new En(
7690
7714
  t,
7691
7715
  this.currentBaseURL || "",
7692
- w,
7716
+ v,
7693
7717
  {
7694
7718
  injector: this.injector
7695
7719
  }
7696
7720
  ).build(!0);
7697
- this.blobs.set(d, R);
7721
+ this.blobs.set(p, G);
7698
7722
  }
7699
- this.delayedShow.has(d) || this.delayedShow.set(d, new Promise((P, R) => {
7700
- let Y = !1;
7701
- const lt = window.setTimeout(async () => {
7702
- this.delayedTimeout.set(d, 0);
7703
- const ht = this.makeSpread(this.reAlign(f)), xn = this.spreadPosition(ht, w), Ze = this.pool.get(d);
7704
- await Ze.load(i, this.blobs.get(d)), this.peripherals.isScaled || await Ze.show(xn), this.delayedShow.delete(d), Y = !0, P();
7705
- }, Ur);
7723
+ this.delayedShow.has(p) || this.delayedShow.set(p, new Promise((O, G) => {
7724
+ let ot = !1;
7725
+ const ct = window.setTimeout(async () => {
7726
+ this.delayedTimeout.set(p, 0);
7727
+ const xn = this.makeSpread(this.reAlign(b)), kn = this.spreadPosition(xn, v), Ze = this.pool.get(p);
7728
+ await Ze.load(i, this.blobs.get(p)), this.peripherals.isScaled || await Ze.show(kn), this.delayedShow.delete(p), ot = !0, O();
7729
+ }, Hr);
7706
7730
  setTimeout(() => {
7707
- !Y && this.delayedShow.has(d) && R(`Offscreen load timeout: ${d}`);
7708
- }, Hr), this.delayedTimeout.set(d, lt);
7731
+ !ot && this.delayedShow.has(p) && G(`Offscreen load timeout: ${p}`);
7732
+ }, Br), this.delayedTimeout.set(p, ct);
7709
7733
  }));
7710
7734
  }
7711
7735
  };
7712
7736
  try {
7713
- await Promise.all(u.map((d) => p(d)));
7714
- } catch (d) {
7715
- h(d);
7737
+ await Promise.all(d.map((p) => f(p)));
7738
+ } catch (p) {
7739
+ h(p);
7716
7740
  }
7717
7741
  const g = [];
7718
- for (const d of o) {
7719
- const f = this.pool.get(d.href), w = this.blobs.get(d.href);
7720
- w && (this.cancelShowing(d.href), await f.load(i, w), await f.show(this.spreadPosition(o, d)), this.previousFrames.push(f), await f.activate(), g.push(f));
7742
+ for (const p of o) {
7743
+ const b = this.pool.get(p.href), v = this.blobs.get(p.href);
7744
+ v && (this.cancelShowing(p.href), await b.load(i, v), await b.show(this.spreadPosition(o, p)), this.previousFrames.push(b), await b.activate(), g.push(b));
7721
7745
  }
7722
7746
  for (; this.previousFrames.length > 0; ) {
7723
- const d = this.previousFrames.shift();
7724
- d && !g.includes(d) && await d.unfocus();
7747
+ const p = this.previousFrames.shift();
7748
+ p && !g.includes(p) && await p.unfocus();
7725
7749
  }
7726
- this.previousFrames = g, l();
7750
+ this.previousFrames = g;
7751
+ const u = this.container.ownerDocument.activeElement;
7752
+ u && u.tagName === "IFRAME" && !g.some((p) => p.iframe === u) && g[0]?.iframe.focus({ preventScroll: !0 }), l();
7727
7753
  });
7728
7754
  for (const l of o)
7729
7755
  this.inprogress.set(l.href, a);
@@ -7804,22 +7830,22 @@ class Ft {
7804
7830
  return new Ft(e);
7805
7831
  }
7806
7832
  }
7807
- class Gr {
7833
+ class Xr {
7808
7834
  constructor(t) {
7809
- this.backgroundColor = W(t.backgroundColor) || null, this.blendFilter = E(t.blendFilter) ?? !1, this.constraint = S(t.constraint) || 0, this.columnCount = S(t.columnCount) || null, this.darkenFilter = wt(t.darkenFilter) ?? !1, this.deprecatedFontSize = E(t.deprecatedFontSize), (this.deprecatedFontSize === !1 || this.deprecatedFontSize === null) && (this.deprecatedFontSize = !CSS.supports("zoom", "1")), this.fontFamily = W(t.fontFamily) || null, this.fontSize = F(t.fontSize, Yt.range) || 1, this.fontSizeNormalize = E(t.fontSizeNormalize) ?? !1, this.fontOpticalSizing = E(t.fontOpticalSizing) ?? null, this.fontWeight = F(t.fontWeight, st.range) || null, this.fontWidth = F(t.fontWidth, qt.range) || null, this.hyphens = E(t.hyphens) ?? null, this.invertFilter = wt(t.invertFilter) ?? !1, this.invertGaijiFilter = wt(t.invertGaijiFilter) ?? !1, this.iOSPatch = t.iOSPatch === !1 ? !1 : (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : T.OS.iPadOS && T.iOSRequest === "desktop", this.letterSpacing = S(t.letterSpacing) || null, this.ligatures = E(t.ligatures) ?? null, this.lineHeight = S(t.lineHeight) || null, this.linkColor = W(t.linkColor) || null, this.noRuby = E(t.noRuby) ?? !1, this.pageGutter = ge(S(t.pageGutter), 20), this.paragraphIndent = S(t.paragraphIndent) ?? null, this.paragraphSpacing = S(t.paragraphSpacing) ?? null, this.scroll = E(t.scroll) ?? !1, this.scrollPaddingTop = S(t.scrollPaddingTop) ?? null, this.scrollPaddingBottom = S(t.scrollPaddingBottom) ?? null, this.scrollPaddingLeft = S(t.scrollPaddingLeft) ?? null, this.scrollPaddingRight = S(t.scrollPaddingRight) ?? null, this.selectionBackgroundColor = W(t.selectionBackgroundColor) || null, this.selectionTextColor = W(t.selectionTextColor) || null, this.textAlign = he(t.textAlign, tt) || null, this.textColor = W(t.textColor) || null, this.textNormalization = E(t.textNormalization) ?? !1, this.visitedColor = W(t.visitedColor) || null, this.wordSpacing = S(t.wordSpacing) || null, this.optimalLineLength = S(t.optimalLineLength) || 65, this.maximalLineLength = ge(ur(t.maximalLineLength, this.optimalLineLength), 80), this.minimalLineLength = ge(dr(t.minimalLineLength, this.optimalLineLength), 40), this.experiments = gn(t.experiments) || null;
7835
+ this.backgroundColor = W(t.backgroundColor) || null, this.blendFilter = E(t.blendFilter) ?? !1, this.constraint = S(t.constraint) || 0, this.columnCount = S(t.columnCount) || null, this.darkenFilter = wt(t.darkenFilter) ?? !1, this.deprecatedFontSize = E(t.deprecatedFontSize), (this.deprecatedFontSize === !1 || this.deprecatedFontSize === null) && (this.deprecatedFontSize = !CSS.supports("zoom", "1")), this.fontFamily = W(t.fontFamily) || null, this.fontSize = F(t.fontSize, Yt.range) || 1, this.fontSizeNormalize = E(t.fontSizeNormalize) ?? !1, this.fontOpticalSizing = E(t.fontOpticalSizing) ?? null, this.fontWeight = F(t.fontWeight, st.range) || null, this.fontWidth = F(t.fontWidth, qt.range) || null, this.hyphens = E(t.hyphens) ?? null, this.invertFilter = wt(t.invertFilter) ?? !1, this.invertGaijiFilter = wt(t.invertGaijiFilter) ?? !1, this.iOSPatch = t.iOSPatch === !1 ? !1 : (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : T.OS.iPadOS && T.iOSRequest === "desktop", this.letterSpacing = S(t.letterSpacing) || null, this.ligatures = E(t.ligatures) ?? null, this.lineHeight = S(t.lineHeight) || null, this.linkColor = W(t.linkColor) || null, this.noRuby = E(t.noRuby) ?? !1, this.pageGutter = ge(S(t.pageGutter), 20), this.paragraphIndent = S(t.paragraphIndent) ?? null, this.paragraphSpacing = S(t.paragraphSpacing) ?? null, this.scroll = E(t.scroll) ?? !1, this.scrollPaddingTop = S(t.scrollPaddingTop) ?? null, this.scrollPaddingBottom = S(t.scrollPaddingBottom) ?? null, this.scrollPaddingLeft = S(t.scrollPaddingLeft) ?? null, this.scrollPaddingRight = S(t.scrollPaddingRight) ?? null, this.selectionBackgroundColor = W(t.selectionBackgroundColor) || null, this.selectionTextColor = W(t.selectionTextColor) || null, this.textAlign = he(t.textAlign, tt) || null, this.textColor = W(t.textColor) || null, this.textNormalization = E(t.textNormalization) ?? !1, this.visitedColor = W(t.visitedColor) || null, this.wordSpacing = S(t.wordSpacing) || null, this.optimalLineLength = S(t.optimalLineLength) || 65, this.maximalLineLength = ge(pr(t.maximalLineLength, this.optimalLineLength), 80), this.minimalLineLength = ge(ur(t.minimalLineLength, this.optimalLineLength), 40), this.experiments = gn(t.experiments) || null;
7810
7836
  }
7811
7837
  }
7812
- const Xr = "#FFFFFF", Yr = "#121212", qr = "#0000EE", Kr = "#551A8B", Jr = "#b4d8fe", Zr = "inherit", pt = {
7813
- backgroundColor: Xr,
7814
- textColor: Yr,
7815
- linkColor: qr,
7816
- visitedColor: Kr,
7817
- selectionBackgroundColor: Jr,
7818
- selectionTextColor: Zr
7838
+ const Yr = "#FFFFFF", qr = "#121212", Kr = "#0000EE", Jr = "#551A8B", Zr = "#b4d8fe", Qr = "inherit", ft = {
7839
+ backgroundColor: Yr,
7840
+ textColor: qr,
7841
+ linkColor: Kr,
7842
+ visitedColor: Jr,
7843
+ selectionBackgroundColor: Zr,
7844
+ selectionTextColor: Qr
7819
7845
  };
7820
7846
  class Bi {
7821
7847
  constructor(t, e, i) {
7822
- this.preferences = t, this.settings = e, this.metadata = i, this.layout = this.metadata?.effectiveLayout || b.reflowable;
7848
+ this.preferences = t, this.settings = e, this.metadata = i, this.layout = this.metadata?.effectiveLayout || w.reflowable;
7823
7849
  }
7824
7850
  clear() {
7825
7851
  this.preferences = new Ft({ optimalLineLength: 65 });
@@ -7830,7 +7856,7 @@ class Bi {
7830
7856
  get backgroundColor() {
7831
7857
  return new N({
7832
7858
  initialValue: this.preferences.backgroundColor,
7833
- effectiveValue: this.settings.backgroundColor || pt.backgroundColor,
7859
+ effectiveValue: this.settings.backgroundColor || ft.backgroundColor,
7834
7860
  isEffective: this.preferences.backgroundColor !== null,
7835
7861
  onChange: (t) => {
7836
7862
  this.updatePreference("backgroundColor", t ?? null);
@@ -7851,7 +7877,7 @@ class Bi {
7851
7877
  return new N({
7852
7878
  initialValue: this.preferences.columnCount,
7853
7879
  effectiveValue: this.settings.columnCount || null,
7854
- isEffective: this.layout !== b.fixed && !this.settings.scroll,
7880
+ isEffective: this.layout !== w.fixed && !this.settings.scroll,
7855
7881
  onChange: (t) => {
7856
7882
  this.updatePreference("columnCount", t ?? null);
7857
7883
  }
@@ -7875,15 +7901,15 @@ class Bi {
7875
7901
  onChange: (t) => {
7876
7902
  this.updatePreference("darkenFilter", t ?? null);
7877
7903
  },
7878
- supportedRange: dt.range,
7879
- step: dt.step
7904
+ supportedRange: ut.range,
7905
+ step: ut.step
7880
7906
  });
7881
7907
  }
7882
7908
  get deprecatedFontSize() {
7883
7909
  return new A({
7884
7910
  initialValue: this.preferences.deprecatedFontSize,
7885
7911
  effectiveValue: CSS.supports("zoom", "1") ? this.settings.deprecatedFontSize || !1 : !0,
7886
- isEffective: this.layout !== b.fixed,
7912
+ isEffective: this.layout !== w.fixed,
7887
7913
  onChange: (t) => {
7888
7914
  this.updatePreference("deprecatedFontSize", t ?? null);
7889
7915
  }
@@ -7893,7 +7919,7 @@ class Bi {
7893
7919
  return new N({
7894
7920
  initialValue: this.preferences.fontFamily,
7895
7921
  effectiveValue: this.settings.fontFamily || null,
7896
- isEffective: this.layout !== b.fixed,
7922
+ isEffective: this.layout !== w.fixed,
7897
7923
  onChange: (t) => {
7898
7924
  this.updatePreference("fontFamily", t ?? null);
7899
7925
  }
@@ -7903,7 +7929,7 @@ class Bi {
7903
7929
  return new x({
7904
7930
  initialValue: this.preferences.fontSize,
7905
7931
  effectiveValue: this.settings.fontSize || 1,
7906
- isEffective: this.layout !== b.fixed,
7932
+ isEffective: this.layout !== w.fixed,
7907
7933
  onChange: (t) => {
7908
7934
  this.updatePreference("fontSize", t ?? null);
7909
7935
  },
@@ -7915,7 +7941,7 @@ class Bi {
7915
7941
  return new A({
7916
7942
  initialValue: this.preferences.fontSizeNormalize,
7917
7943
  effectiveValue: this.settings.fontSizeNormalize || !1,
7918
- isEffective: this.layout !== b.fixed && this.preferences.fontSizeNormalize !== null,
7944
+ isEffective: this.layout !== w.fixed && this.preferences.fontSizeNormalize !== null,
7919
7945
  onChange: (t) => {
7920
7946
  this.updatePreference("fontSizeNormalize", t ?? null);
7921
7947
  }
@@ -7925,7 +7951,7 @@ class Bi {
7925
7951
  return new A({
7926
7952
  initialValue: this.preferences.fontOpticalSizing,
7927
7953
  effectiveValue: this.settings.fontOpticalSizing || !0,
7928
- isEffective: this.layout !== b.fixed && this.preferences.fontOpticalSizing !== null,
7954
+ isEffective: this.layout !== w.fixed && this.preferences.fontOpticalSizing !== null,
7929
7955
  onChange: (t) => {
7930
7956
  this.updatePreference("fontOpticalSizing", t ?? null);
7931
7957
  }
@@ -7935,7 +7961,7 @@ class Bi {
7935
7961
  return new x({
7936
7962
  initialValue: this.preferences.fontWeight,
7937
7963
  effectiveValue: this.settings.fontWeight || 400,
7938
- isEffective: this.layout !== b.fixed && this.preferences.fontWeight !== null,
7964
+ isEffective: this.layout !== w.fixed && this.preferences.fontWeight !== null,
7939
7965
  onChange: (t) => {
7940
7966
  this.updatePreference("fontWeight", t ?? null);
7941
7967
  },
@@ -7947,7 +7973,7 @@ class Bi {
7947
7973
  return new x({
7948
7974
  initialValue: this.preferences.fontWidth,
7949
7975
  effectiveValue: this.settings.fontWidth || 100,
7950
- isEffective: this.layout !== b.fixed && this.preferences.fontWidth !== null,
7976
+ isEffective: this.layout !== w.fixed && this.preferences.fontWidth !== null,
7951
7977
  onChange: (t) => {
7952
7978
  this.updatePreference("fontWidth", t ?? null);
7953
7979
  },
@@ -7959,7 +7985,7 @@ class Bi {
7959
7985
  return new A({
7960
7986
  initialValue: this.preferences.hyphens,
7961
7987
  effectiveValue: this.settings.hyphens || !1,
7962
- isEffective: this.layout !== b.fixed && this.metadata?.effectiveReadingProgression === M.ltr && this.preferences.hyphens !== null,
7988
+ isEffective: this.layout !== w.fixed && this.metadata?.effectiveReadingProgression === M.ltr && this.preferences.hyphens !== null,
7963
7989
  onChange: (t) => {
7964
7990
  this.updatePreference("hyphens", t ?? null);
7965
7991
  }
@@ -7973,8 +7999,8 @@ class Bi {
7973
7999
  onChange: (t) => {
7974
8000
  this.updatePreference("invertFilter", t ?? null);
7975
8001
  },
7976
- supportedRange: dt.range,
7977
- step: dt.step
8002
+ supportedRange: ut.range,
8003
+ step: ut.step
7978
8004
  });
7979
8005
  }
7980
8006
  get invertGaijiFilter() {
@@ -7985,15 +8011,15 @@ class Bi {
7985
8011
  onChange: (t) => {
7986
8012
  this.updatePreference("invertGaijiFilter", t ?? null);
7987
8013
  },
7988
- supportedRange: dt.range,
7989
- step: dt.step
8014
+ supportedRange: ut.range,
8015
+ step: ut.step
7990
8016
  });
7991
8017
  }
7992
8018
  get iOSPatch() {
7993
8019
  return new A({
7994
8020
  initialValue: this.preferences.iOSPatch,
7995
8021
  effectiveValue: this.settings.iOSPatch || !1,
7996
- isEffective: this.layout !== b.fixed,
8022
+ isEffective: this.layout !== w.fixed,
7997
8023
  onChange: (t) => {
7998
8024
  this.updatePreference("iOSPatch", t ?? null);
7999
8025
  }
@@ -8003,7 +8029,7 @@ class Bi {
8003
8029
  return new A({
8004
8030
  initialValue: this.preferences.iPadOSPatch,
8005
8031
  effectiveValue: this.settings.iPadOSPatch || !1,
8006
- isEffective: this.layout !== b.fixed,
8032
+ isEffective: this.layout !== w.fixed,
8007
8033
  onChange: (t) => {
8008
8034
  this.updatePreference("iPadOSPatch", t ?? null);
8009
8035
  }
@@ -8013,7 +8039,7 @@ class Bi {
8013
8039
  return new x({
8014
8040
  initialValue: this.preferences.letterSpacing,
8015
8041
  effectiveValue: this.settings.letterSpacing || 0,
8016
- isEffective: this.layout !== b.fixed && this.preferences.letterSpacing !== null,
8042
+ isEffective: this.layout !== w.fixed && this.preferences.letterSpacing !== null,
8017
8043
  onChange: (t) => {
8018
8044
  this.updatePreference("letterSpacing", t ?? null);
8019
8045
  },
@@ -8026,7 +8052,7 @@ class Bi {
8026
8052
  initialValue: this.preferences.ligatures,
8027
8053
  effectiveValue: this.settings.ligatures || !0,
8028
8054
  isEffective: (() => {
8029
- if (this.preferences.ligatures === null || this.layout === b.fixed)
8055
+ if (this.preferences.ligatures === null || this.layout === w.fixed)
8030
8056
  return !1;
8031
8057
  const t = this.metadata?.languages?.[0]?.toLowerCase();
8032
8058
  return !(t && ["zh", "ja", "ko", "mn-mong"].some((e) => t.startsWith(e)));
@@ -8040,7 +8066,7 @@ class Bi {
8040
8066
  return new x({
8041
8067
  initialValue: this.preferences.lineHeight,
8042
8068
  effectiveValue: this.settings.lineHeight,
8043
- isEffective: this.layout !== b.fixed && this.preferences.lineHeight !== null,
8069
+ isEffective: this.layout !== w.fixed && this.preferences.lineHeight !== null,
8044
8070
  onChange: (t) => {
8045
8071
  this.updatePreference("lineHeight", t ?? null);
8046
8072
  },
@@ -8051,8 +8077,8 @@ class Bi {
8051
8077
  get linkColor() {
8052
8078
  return new N({
8053
8079
  initialValue: this.preferences.linkColor,
8054
- effectiveValue: this.settings.linkColor || pt.linkColor,
8055
- isEffective: this.layout !== b.fixed && this.preferences.linkColor !== null,
8080
+ effectiveValue: this.settings.linkColor || ft.linkColor,
8081
+ isEffective: this.layout !== w.fixed && this.preferences.linkColor !== null,
8056
8082
  onChange: (t) => {
8057
8083
  this.updatePreference("linkColor", t ?? null);
8058
8084
  }
@@ -8062,31 +8088,31 @@ class Bi {
8062
8088
  return new x({
8063
8089
  initialValue: this.preferences.maximalLineLength,
8064
8090
  effectiveValue: this.settings.maximalLineLength,
8065
- isEffective: this.layout !== b.fixed,
8091
+ isEffective: this.layout !== w.fixed,
8066
8092
  onChange: (t) => {
8067
8093
  this.updatePreference("maximalLineLength", t);
8068
8094
  },
8069
- supportedRange: ut.range,
8070
- step: ut.step
8095
+ supportedRange: pt.range,
8096
+ step: pt.step
8071
8097
  });
8072
8098
  }
8073
8099
  get minimalLineLength() {
8074
8100
  return new x({
8075
8101
  initialValue: this.preferences.minimalLineLength,
8076
8102
  effectiveValue: this.settings.minimalLineLength,
8077
- isEffective: this.layout !== b.fixed,
8103
+ isEffective: this.layout !== w.fixed,
8078
8104
  onChange: (t) => {
8079
8105
  this.updatePreference("minimalLineLength", t);
8080
8106
  },
8081
- supportedRange: ut.range,
8082
- step: ut.step
8107
+ supportedRange: pt.range,
8108
+ step: pt.step
8083
8109
  });
8084
8110
  }
8085
8111
  get noRuby() {
8086
8112
  return new A({
8087
8113
  initialValue: this.preferences.noRuby,
8088
8114
  effectiveValue: this.settings.noRuby || !1,
8089
- isEffective: this.layout !== b.fixed && this.metadata?.languages?.includes("ja") || !1,
8115
+ isEffective: this.layout !== w.fixed && this.metadata?.languages?.includes("ja") || !1,
8090
8116
  onChange: (t) => {
8091
8117
  this.updatePreference("noRuby", t ?? null);
8092
8118
  }
@@ -8096,19 +8122,19 @@ class Bi {
8096
8122
  return new x({
8097
8123
  initialValue: this.preferences.optimalLineLength,
8098
8124
  effectiveValue: this.settings.optimalLineLength,
8099
- isEffective: this.layout !== b.fixed,
8125
+ isEffective: this.layout !== w.fixed,
8100
8126
  onChange: (t) => {
8101
8127
  this.updatePreference("optimalLineLength", t);
8102
8128
  },
8103
- supportedRange: ut.range,
8104
- step: ut.step
8129
+ supportedRange: pt.range,
8130
+ step: pt.step
8105
8131
  });
8106
8132
  }
8107
8133
  get pageGutter() {
8108
8134
  return new N({
8109
8135
  initialValue: this.preferences.pageGutter,
8110
8136
  effectiveValue: this.settings.pageGutter,
8111
- isEffective: this.layout !== b.fixed && !this.settings.scroll,
8137
+ isEffective: this.layout !== w.fixed && !this.settings.scroll,
8112
8138
  onChange: (t) => {
8113
8139
  this.updatePreference("pageGutter", t ?? null);
8114
8140
  }
@@ -8118,7 +8144,7 @@ class Bi {
8118
8144
  return new x({
8119
8145
  initialValue: this.preferences.paragraphIndent,
8120
8146
  effectiveValue: this.settings.paragraphIndent || 0,
8121
- isEffective: this.layout !== b.fixed && this.preferences.paragraphIndent !== null,
8147
+ isEffective: this.layout !== w.fixed && this.preferences.paragraphIndent !== null,
8122
8148
  onChange: (t) => {
8123
8149
  this.updatePreference("paragraphIndent", t ?? null);
8124
8150
  },
@@ -8130,7 +8156,7 @@ class Bi {
8130
8156
  return new x({
8131
8157
  initialValue: this.preferences.paragraphSpacing,
8132
8158
  effectiveValue: this.settings.paragraphSpacing || 0,
8133
- isEffective: this.layout !== b.fixed && this.preferences.paragraphSpacing !== null,
8159
+ isEffective: this.layout !== w.fixed && this.preferences.paragraphSpacing !== null,
8134
8160
  onChange: (t) => {
8135
8161
  this.updatePreference("paragraphSpacing", t ?? null);
8136
8162
  },
@@ -8142,7 +8168,7 @@ class Bi {
8142
8168
  return new A({
8143
8169
  initialValue: this.preferences.scroll,
8144
8170
  effectiveValue: this.settings.scroll || !1,
8145
- isEffective: this.layout !== b.fixed,
8171
+ isEffective: this.layout !== w.fixed,
8146
8172
  onChange: (t) => {
8147
8173
  this.updatePreference("scroll", t ?? null);
8148
8174
  }
@@ -8152,7 +8178,7 @@ class Bi {
8152
8178
  return new N({
8153
8179
  initialValue: this.preferences.scrollPaddingTop,
8154
8180
  effectiveValue: this.settings.scrollPaddingTop || 0,
8155
- isEffective: this.layout !== b.fixed && !!this.settings.scroll && this.preferences.scrollPaddingTop !== null,
8181
+ isEffective: this.layout !== w.fixed && !!this.settings.scroll && this.preferences.scrollPaddingTop !== null,
8156
8182
  onChange: (t) => {
8157
8183
  this.updatePreference("scrollPaddingTop", t ?? null);
8158
8184
  }
@@ -8162,7 +8188,7 @@ class Bi {
8162
8188
  return new N({
8163
8189
  initialValue: this.preferences.scrollPaddingBottom,
8164
8190
  effectiveValue: this.settings.scrollPaddingBottom || 0,
8165
- isEffective: this.layout !== b.fixed && !!this.settings.scroll && this.preferences.scrollPaddingBottom !== null,
8191
+ isEffective: this.layout !== w.fixed && !!this.settings.scroll && this.preferences.scrollPaddingBottom !== null,
8166
8192
  onChange: (t) => {
8167
8193
  this.updatePreference("scrollPaddingBottom", t ?? null);
8168
8194
  }
@@ -8172,7 +8198,7 @@ class Bi {
8172
8198
  return new N({
8173
8199
  initialValue: this.preferences.scrollPaddingLeft,
8174
8200
  effectiveValue: this.settings.scrollPaddingLeft || 0,
8175
- isEffective: this.layout !== b.fixed && !!this.settings.scroll && this.preferences.scrollPaddingLeft !== null,
8201
+ isEffective: this.layout !== w.fixed && !!this.settings.scroll && this.preferences.scrollPaddingLeft !== null,
8176
8202
  onChange: (t) => {
8177
8203
  this.updatePreference("scrollPaddingLeft", t ?? null);
8178
8204
  }
@@ -8182,7 +8208,7 @@ class Bi {
8182
8208
  return new N({
8183
8209
  initialValue: this.preferences.scrollPaddingRight,
8184
8210
  effectiveValue: this.settings.scrollPaddingRight || 0,
8185
- isEffective: this.layout !== b.fixed && !!this.settings.scroll && this.preferences.scrollPaddingRight !== null,
8211
+ isEffective: this.layout !== w.fixed && !!this.settings.scroll && this.preferences.scrollPaddingRight !== null,
8186
8212
  onChange: (t) => {
8187
8213
  this.updatePreference("scrollPaddingRight", t ?? null);
8188
8214
  }
@@ -8191,8 +8217,8 @@ class Bi {
8191
8217
  get selectionBackgroundColor() {
8192
8218
  return new N({
8193
8219
  initialValue: this.preferences.selectionBackgroundColor,
8194
- effectiveValue: this.settings.selectionBackgroundColor || pt.selectionBackgroundColor,
8195
- isEffective: this.layout !== b.fixed && this.preferences.selectionBackgroundColor !== null,
8220
+ effectiveValue: this.settings.selectionBackgroundColor || ft.selectionBackgroundColor,
8221
+ isEffective: this.layout !== w.fixed && this.preferences.selectionBackgroundColor !== null,
8196
8222
  onChange: (t) => {
8197
8223
  this.updatePreference("selectionBackgroundColor", t ?? null);
8198
8224
  }
@@ -8201,8 +8227,8 @@ class Bi {
8201
8227
  get selectionTextColor() {
8202
8228
  return new N({
8203
8229
  initialValue: this.preferences.selectionTextColor,
8204
- effectiveValue: this.settings.selectionTextColor || pt.selectionTextColor,
8205
- isEffective: this.layout !== b.fixed && this.preferences.selectionTextColor !== null,
8230
+ effectiveValue: this.settings.selectionTextColor || ft.selectionTextColor,
8231
+ isEffective: this.layout !== w.fixed && this.preferences.selectionTextColor !== null,
8206
8232
  onChange: (t) => {
8207
8233
  this.updatePreference("selectionTextColor", t ?? null);
8208
8234
  }
@@ -8212,7 +8238,7 @@ class Bi {
8212
8238
  return new yn({
8213
8239
  initialValue: this.preferences.textAlign,
8214
8240
  effectiveValue: this.settings.textAlign || tt.start,
8215
- isEffective: this.layout !== b.fixed && this.preferences.textAlign !== null,
8241
+ isEffective: this.layout !== w.fixed && this.preferences.textAlign !== null,
8216
8242
  onChange: (t) => {
8217
8243
  this.updatePreference("textAlign", t ?? null);
8218
8244
  },
@@ -8222,8 +8248,8 @@ class Bi {
8222
8248
  get textColor() {
8223
8249
  return new N({
8224
8250
  initialValue: this.preferences.textColor,
8225
- effectiveValue: this.settings.textColor || pt.textColor,
8226
- isEffective: this.layout !== b.fixed && this.preferences.textColor !== null,
8251
+ effectiveValue: this.settings.textColor || ft.textColor,
8252
+ isEffective: this.layout !== w.fixed && this.preferences.textColor !== null,
8227
8253
  onChange: (t) => {
8228
8254
  this.updatePreference("textColor", t ?? null);
8229
8255
  }
@@ -8233,7 +8259,7 @@ class Bi {
8233
8259
  return new A({
8234
8260
  initialValue: this.preferences.textNormalization,
8235
8261
  effectiveValue: this.settings.textNormalization || !1,
8236
- isEffective: this.layout !== b.fixed,
8262
+ isEffective: this.layout !== w.fixed,
8237
8263
  onChange: (t) => {
8238
8264
  this.updatePreference("textNormalization", t ?? null);
8239
8265
  }
@@ -8242,8 +8268,8 @@ class Bi {
8242
8268
  get visitedColor() {
8243
8269
  return new N({
8244
8270
  initialValue: this.preferences.visitedColor,
8245
- effectiveValue: this.settings.visitedColor || pt.visitedColor,
8246
- isEffective: this.layout !== b.fixed && this.preferences.visitedColor !== null,
8271
+ effectiveValue: this.settings.visitedColor || ft.visitedColor,
8272
+ isEffective: this.layout !== w.fixed && this.preferences.visitedColor !== null,
8247
8273
  onChange: (t) => {
8248
8274
  this.updatePreference("visitedColor", t ?? null);
8249
8275
  }
@@ -8253,7 +8279,7 @@ class Bi {
8253
8279
  return new x({
8254
8280
  initialValue: this.preferences.wordSpacing,
8255
8281
  effectiveValue: this.settings.wordSpacing || 0,
8256
- isEffective: this.layout !== b.fixed && this.preferences.wordSpacing !== null,
8282
+ isEffective: this.layout !== w.fixed && this.preferences.wordSpacing !== null,
8257
8283
  onChange: (t) => {
8258
8284
  this.updatePreference("wordSpacing", t ?? null);
8259
8285
  },
@@ -8271,7 +8297,7 @@ function Lt(r) {
8271
8297
  const t = getComputedStyle(r), e = parseFloat(t.paddingLeft || "0"), i = parseFloat(t.paddingRight || "0");
8272
8298
  return r.clientWidth - e - i;
8273
8299
  }
8274
- function Qr(r) {
8300
+ function to(r) {
8275
8301
  const t = getComputedStyle(r), e = parseFloat(t.paddingTop || "0"), i = parseFloat(t.paddingBottom || "0");
8276
8302
  return r.clientHeight - e - i;
8277
8303
  }
@@ -8284,7 +8310,7 @@ class _n extends le {
8284
8310
  return this.a11yNormalize && (t["--USER__a11yNormalize"] = this.toFlag("a11y")), this.backgroundColor && (t["--USER__backgroundColor"] = this.backgroundColor), this.blendFilter && (t["--USER__blendFilter"] = this.toFlag("blend")), this.bodyHyphens && (t["--USER__bodyHyphens"] = this.bodyHyphens), this.colCount && (t["--USER__colCount"] = this.toUnitless(this.colCount)), this.darkenFilter === !0 ? t["--USER__darkenFilter"] = this.toFlag("darken") : typeof this.darkenFilter == "number" && (t["--USER__darkenFilter"] = this.toPercentage(this.darkenFilter)), this.deprecatedFontSize && (t["--USER__fontSizeImplementation"] = this.toFlag("deprecatedFontSize")), this.fontFamily && (t["--USER__fontFamily"] = this.fontFamily), this.fontOpticalSizing != null && (t["--USER__fontOpticalSizing"] = this.fontOpticalSizing), this.fontSize != null && (t["--USER__fontSize"] = this.toPercentage(this.fontSize, !0)), this.fontSizeNormalize && (t["--USER__fontSizeNormalize"] = this.toFlag("normalize")), this.fontWeight != null && (t["--USER__fontWeight"] = this.toUnitless(this.fontWeight)), this.fontWidth != null && (t["--USER__fontWidth"] = typeof this.fontWidth == "string" ? this.fontWidth : this.toUnitless(this.fontWidth)), this.invertFilter === !0 ? t["--USER__invertFilter"] = this.toFlag("invert") : typeof this.invertFilter == "number" && (t["--USER__invertFilter"] = this.toPercentage(this.invertFilter)), this.invertGaijiFilter === !0 ? t["--USER__invertGaiji"] = this.toFlag("invertGaiji") : typeof this.invertGaijiFilter == "number" && (t["--USER__invertGaiji"] = this.toPercentage(this.invertGaijiFilter)), this.iOSPatch && (t["--USER__iOSPatch"] = this.toFlag("iOSPatch")), this.iPadOSPatch && (t["--USER__iPadOSPatch"] = this.toFlag("iPadOSPatch")), this.letterSpacing != null && (t["--USER__letterSpacing"] = this.toRem(this.letterSpacing)), this.ligatures && (t["--USER__ligatures"] = this.ligatures), this.lineHeight != null && (t["--USER__lineHeight"] = this.toUnitless(this.lineHeight)), this.lineLength != null && (t["--USER__lineLength"] = this.toPx(this.lineLength)), this.linkColor && (t["--USER__linkColor"] = this.linkColor), this.noRuby && (t["--USER__noRuby"] = this.toFlag("noRuby")), this.paraIndent != null && (t["--USER__paraIndent"] = this.toRem(this.paraIndent)), this.paraSpacing != null && (t["--USER__paraSpacing"] = this.toRem(this.paraSpacing)), this.selectionBackgroundColor && (t["--USER__selectionBackgroundColor"] = this.selectionBackgroundColor), this.selectionTextColor && (t["--USER__selectionTextColor"] = this.selectionTextColor), this.textAlign && (t["--USER__textAlign"] = this.textAlign), this.textColor && (t["--USER__textColor"] = this.textColor), this.view && (t["--USER__view"] = this.toFlag(this.view)), this.visitedColor && (t["--USER__visitedColor"] = this.visitedColor), this.wordSpacing != null && (t["--USER__wordSpacing"] = this.toRem(this.wordSpacing)), t;
8285
8311
  }
8286
8312
  }
8287
- class to extends le {
8313
+ class eo extends le {
8288
8314
  constructor(t) {
8289
8315
  super(), this.backgroundColor = t.backgroundColor ?? null, this.baseFontFamily = t.baseFontFamily ?? null, this.baseFontSize = t.baseFontSize ?? null, this.baseLineHeight = t.baseLineHeight ?? null, this.boxSizingMedia = t.boxSizingMedia ?? null, this.boxSizingTable = t.boxSizingTable ?? null, this.colWidth = t.colWidth ?? null, this.colCount = t.colCount ?? null, this.colGap = t.colGap ?? null, this.codeFontFamily = t.codeFontFamily ?? null, this.compFontFamily = t.compFontFamily ?? null, this.defaultLineLength = t.defaultLineLength ?? null, this.flowSpacing = t.flowSpacing ?? null, this.humanistTf = t.humanistTf ?? null, this.linkColor = t.linkColor ?? null, this.maxMediaWidth = t.maxMediaWidth ?? null, this.maxMediaHeight = t.maxMediaHeight ?? null, this.modernTf = t.modernTf ?? null, this.monospaceTf = t.monospaceTf ?? null, this.noOverflow = t.noOverflow ?? null, this.noVerticalPagination = t.noVerticalPagination ?? null, this.oldStyleTf = t.oldStyleTf ?? null, this.pageGutter = t.pageGutter ?? null, this.paraIndent = t.paraIndent ?? null, this.paraSpacing = t.paraSpacing ?? null, this.primaryColor = t.primaryColor ?? null, this.scrollPaddingBottom = t.scrollPaddingBottom ?? null, this.scrollPaddingLeft = t.scrollPaddingLeft ?? null, this.scrollPaddingRight = t.scrollPaddingRight ?? null, this.scrollPaddingTop = t.scrollPaddingTop ?? null, this.sansSerifJa = t.sansSerifJa ?? null, this.sansSerifJaV = t.sansSerifJaV ?? null, this.sansTf = t.sansTf ?? null, this.secondaryColor = t.secondaryColor ?? null, this.selectionBackgroundColor = t.selectionBackgroundColor ?? null, this.selectionTextColor = t.selectionTextColor ?? null, this.serifJa = t.serifJa ?? null, this.serifJaV = t.serifJaV ?? null, this.textColor = t.textColor ?? null, this.typeScale = t.typeScale ?? null, this.visitedColor = t.visitedColor ?? null, this.experiments = t.experiments ?? null;
8290
8316
  }
@@ -8295,7 +8321,7 @@ class to extends le {
8295
8321
  }), t;
8296
8322
  }
8297
8323
  }
8298
- class eo {
8324
+ class io {
8299
8325
  constructor(t) {
8300
8326
  this.rsProperties = t.rsProperties, this.userProperties = t.userProperties, this.lineLengths = t.lineLengths, this.container = t.container, this.containerParent = t.container.parentElement || document.documentElement, this.constraint = t.constraint, this.isCJKVertical = t.isCJKVertical ?? !1, this.cachedColCount = t.userProperties.colCount, this.effectiveContainerWidth = Lt(this.containerParent);
8301
8327
  }
@@ -8365,51 +8391,51 @@ class eo {
8365
8391
  // should be the same as uncompensated when scale >= 1
8366
8392
  paginate(t, e, i) {
8367
8393
  const n = Math.round(Lt(this.containerParent) - this.constraint), s = this.getCompensatedMetrics(t, e), { zoomCompensation: o, optimal: a, minimal: l, maximal: h } = s, c = () => n >= a && h !== null ? Math.min(Math.round(h * o), n) : n;
8368
- let u = 1, p = n;
8394
+ let d = 1, f = n;
8369
8395
  if (i === void 0)
8370
8396
  return {
8371
8397
  colCount: void 0,
8372
- effectiveContainerWidth: p,
8373
- effectiveLineLength: Math.round(p / u * o)
8398
+ effectiveContainerWidth: f,
8399
+ effectiveLineLength: Math.round(f / d * o)
8374
8400
  };
8375
8401
  if (i === null)
8376
8402
  if (n >= a && h !== null) {
8377
- u = Math.floor(n / a);
8378
- const g = Math.round(u * (h * o));
8379
- p = Math.min(g, n);
8403
+ d = Math.floor(n / a);
8404
+ const g = Math.round(d * (h * o));
8405
+ f = Math.min(g, n);
8380
8406
  } else
8381
- p = c();
8407
+ f = c();
8382
8408
  else if (i > 1) {
8383
8409
  const g = Math.round(i * (l !== null ? l : a));
8384
8410
  if (n >= g)
8385
- if (u = i, h === null)
8386
- p = n;
8411
+ if (d = i, h === null)
8412
+ f = n;
8387
8413
  else {
8388
- const d = Math.round(u * (h * o));
8389
- p = Math.min(d, n);
8414
+ const u = Math.round(d * (h * o));
8415
+ f = Math.min(u, n);
8390
8416
  }
8391
8417
  else if (l !== null && n < Math.round(i * l))
8392
- if (u = Math.floor(n / l), u <= 1)
8393
- u = 1, p = c();
8418
+ if (d = Math.floor(n / l), d <= 1)
8419
+ d = 1, f = c();
8394
8420
  else {
8395
- const d = Math.round(u * (a * o));
8396
- p = Math.min(d, n);
8421
+ const u = Math.round(d * (a * o));
8422
+ f = Math.min(u, n);
8397
8423
  }
8398
8424
  else {
8399
- u = i;
8400
- const d = Math.round(u * (a * o));
8401
- p = Math.min(d, n);
8425
+ d = i;
8426
+ const u = Math.round(d * (a * o));
8427
+ f = Math.min(u, n);
8402
8428
  }
8403
8429
  } else
8404
- u = 1, p = c();
8430
+ d = 1, f = c();
8405
8431
  return {
8406
- colCount: u,
8407
- effectiveContainerWidth: p,
8408
- effectiveLineLength: Math.round(p / u / (t && t >= 1 ? t : 1) * o)
8432
+ colCount: d,
8433
+ effectiveContainerWidth: f,
8434
+ effectiveLineLength: Math.round(f / d / (t && t >= 1 ? t : 1) * o)
8409
8435
  };
8410
8436
  }
8411
8437
  computeCJKVerticalLength(t, e) {
8412
- const i = Math.round(Lt(this.containerParent) - this.constraint), n = Math.round(Qr(this.containerParent)), s = this.getCompensatedMetrics(t, e), o = s.maximal !== null ? Math.min(Math.round(s.maximal * s.zoomCompensation), n) : n;
8438
+ const i = Math.round(Lt(this.containerParent) - this.constraint), n = Math.round(to(this.containerParent)), s = this.getCompensatedMetrics(t, e), o = s.maximal !== null ? Math.min(Math.round(s.maximal * s.zoomCompensation), n) : n;
8413
8439
  return { colCount: void 0, effectiveContainerWidth: i, effectiveLineLength: o };
8414
8440
  }
8415
8441
  // This behaves as paginate where colCount = 1
@@ -8419,8 +8445,8 @@ class eo {
8419
8445
  if (a === null)
8420
8446
  c = i;
8421
8447
  else {
8422
- const u = Math.min(Math.round(a * s), i);
8423
- c = e ? u : Math.round(u * s);
8448
+ const d = Math.min(Math.round(a * s), i);
8449
+ c = e ? d : Math.round(d * s);
8424
8450
  }
8425
8451
  return {
8426
8452
  colCount: l,
@@ -8436,7 +8462,7 @@ class eo {
8436
8462
  this.userProperties.colCount = t.colCount, this.userProperties.lineLength = t.effectiveLineLength, this.effectiveContainerWidth = t.effectiveContainerWidth, this.container.style.width = `${this.effectiveContainerWidth}px`;
8437
8463
  }
8438
8464
  }
8439
- const io = `// Note: we aren't blocking some of the events right now to try and be as nonintrusive as possible.
8465
+ const no = `// Note: we aren't blocking some of the events right now to try and be as nonintrusive as possible.
8440
8466
  // For a more comprehensive implementation, see https://github.com/hackademix/noscript/blob/3a83c0e4a506f175e38b0342dad50cdca3eae836/src/content/syncFetchPolicy.js#L142
8441
8467
  // The snippet of code at the beginning of this source is an attempt at defence against JS using persistent storage
8442
8468
  (function() {
@@ -8502,21 +8528,21 @@ const io = `// Note: we aren't blocking some of the events right now to try and
8502
8528
  window.addEventListener("load", window._readium_eventBlocker, true);
8503
8529
  })();
8504
8530
  `;
8505
- async function no(r, t) {
8506
- const e = r.effectiveLayout === b.fixed, i = t.filter((a) => a.mediaType.isHTML).map((a) => a.href), n = i.length > 0 ? i : [/\.xhtml$/, /\.html$/], s = [
8531
+ async function so(r, t) {
8532
+ const e = r.effectiveLayout === w.fixed, i = t.filter((a) => a.mediaType.isHTML).map((a) => a.href), n = i.length > 0 ? i : [/\.xhtml$/, /\.html$/], s = [
8507
8533
  // CSS Selector Generator - always injected
8508
8534
  {
8509
8535
  id: "css-selector-generator",
8510
8536
  as: "script",
8511
8537
  target: "head",
8512
- blob: new Blob([St(vn)], { type: "text/javascript" })
8538
+ blob: new Blob([vt(Sn)], { type: "text/javascript" })
8513
8539
  },
8514
8540
  // Execution Prevention - conditional (has executable scripts)
8515
8541
  {
8516
8542
  id: "execution-prevention",
8517
8543
  as: "script",
8518
8544
  target: "head",
8519
- blob: new Blob([St(io)], { type: "text/javascript" }),
8545
+ blob: new Blob([vt(no)], { type: "text/javascript" }),
8520
8546
  condition: (a) => !!(a.querySelector("script") || a.querySelector("body[onload]:not(body[onload=''])"))
8521
8547
  }
8522
8548
  ], o = [
@@ -8525,7 +8551,7 @@ async function no(r, t) {
8525
8551
  id: "onload-proxy",
8526
8552
  as: "script",
8527
8553
  target: "head",
8528
- blob: new Blob([St(Pn)], { type: "text/javascript" }),
8554
+ blob: new Blob([vt(Pn)], { type: "text/javascript" }),
8529
8555
  condition: (a) => !!(a.querySelector("script") || a.querySelector("body[onload]:not(body[onload=''])"))
8530
8556
  }
8531
8557
  ];
@@ -8534,21 +8560,21 @@ async function no(r, t) {
8534
8560
  let l, h, c;
8535
8561
  switch (a) {
8536
8562
  case "rtl": {
8537
- const [u, p, g] = await Promise.all([
8563
+ const [d, f, g] = await Promise.all([
8538
8564
  import("./ReadiumCSS-before-DwBLxUVH.js"),
8539
8565
  import("./ReadiumCSS-default-BhdLiyWp.js"),
8540
8566
  import("./ReadiumCSS-after-d5mC4cme.js")
8541
8567
  ]);
8542
- l = u.default, h = p.default, c = g.default;
8568
+ l = d.default, h = f.default, c = g.default;
8543
8569
  break;
8544
8570
  }
8545
8571
  case "cjk-horizontal": {
8546
- const [u, p, g] = await Promise.all([
8572
+ const [d, f, g] = await Promise.all([
8547
8573
  import("./ReadiumCSS-before-CG-KmDa3.js"),
8548
8574
  import("./ReadiumCSS-default-N65xNiIp.js"),
8549
8575
  import("./ReadiumCSS-after-XUKPAxfT.js")
8550
8576
  ]);
8551
- l = u.default, h = p.default, c = g.default;
8577
+ l = d.default, h = f.default, c = g.default;
8552
8578
  break;
8553
8579
  }
8554
8580
  case "cjk-vertical":
@@ -8556,21 +8582,21 @@ async function no(r, t) {
8556
8582
  // layout as CJK vertical-rl — it is an outlier handled by the
8557
8583
  // same stylesheet set per the Readium CSS spec.
8558
8584
  case "mongolian-vertical": {
8559
- const [u, p, g] = await Promise.all([
8585
+ const [d, f, g] = await Promise.all([
8560
8586
  import("./ReadiumCSS-before-BNTwR8Qm.js"),
8561
8587
  import("./ReadiumCSS-default-BesyZHRU.js"),
8562
8588
  import("./ReadiumCSS-after-ClF4TBzj.js")
8563
8589
  ]);
8564
- l = u.default, h = p.default, c = g.default;
8590
+ l = d.default, h = f.default, c = g.default;
8565
8591
  break;
8566
8592
  }
8567
8593
  default: {
8568
- const [u, p, g] = await Promise.all([
8594
+ const [d, f, g] = await Promise.all([
8569
8595
  import("./ReadiumCSS-before-8FMq19-x.js"),
8570
8596
  import("./ReadiumCSS-default-AIAk8uwU.js"),
8571
8597
  import("./ReadiumCSS-after-D7unrNI9.js")
8572
8598
  ]);
8573
- l = u.default, h = p.default, c = g.default;
8599
+ l = d.default, h = f.default, c = g.default;
8574
8600
  break;
8575
8601
  }
8576
8602
  }
@@ -8588,7 +8614,7 @@ async function no(r, t) {
8588
8614
  target: "head",
8589
8615
  blob: new Blob([_t(h)], { type: "text/css" }),
8590
8616
  rel: "stylesheet",
8591
- condition: (u) => !(u.querySelector("link[rel='stylesheet']") || u.querySelector("style") || u.querySelector("[style]:not([style=''])"))
8617
+ condition: (d) => !(d.querySelector("link[rel='stylesheet']") || d.querySelector("style") || d.querySelector("[style]:not([style=''])"))
8592
8618
  },
8593
8619
  // Readium CSS After - only for reflowable
8594
8620
  {
@@ -8599,12 +8625,12 @@ async function no(r, t) {
8599
8625
  rel: "stylesheet"
8600
8626
  }
8601
8627
  ), (a === "cjk-horizontal" || a === "cjk-vertical") && (r.description === "ebpaj-guide-1.0" || r.otherMetadata?.["ebpaj:guide-version"] !== void 0)) {
8602
- const { default: p } = await import("./ReadiumCSS-ebpaj_fonts_patch-Dt2XliTg.js");
8628
+ const { default: f } = await import("./ReadiumCSS-ebpaj_fonts_patch-Dt2XliTg.js");
8603
8629
  o.push({
8604
8630
  id: "readium-css-ebpaj",
8605
8631
  as: "link",
8606
8632
  target: "head",
8607
- blob: new Blob([_t(p)], { type: "text/css" }),
8633
+ blob: new Blob([_t(f)], { type: "text/css" }),
8608
8634
  rel: "stylesheet"
8609
8635
  });
8610
8636
  }
@@ -8617,7 +8643,7 @@ async function no(r, t) {
8617
8643
  }
8618
8644
  ];
8619
8645
  }
8620
- const so = (r) => ({
8646
+ const ro = (r) => ({
8621
8647
  frameLoaded: r.frameLoaded || (() => {
8622
8648
  }),
8623
8649
  positionChanged: r.positionChanged || (() => {
@@ -8644,14 +8670,14 @@ const so = (r) => ({
8644
8670
  });
8645
8671
  class Ln extends dn {
8646
8672
  constructor(t, e, i, n = [], s = void 0, o = { preferences: {}, defaults: {} }) {
8647
- super(), this._preferencesEditor = null, this._injector = null, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this.reflowViewport = {
8673
+ super(), this._preferencesEditor = null, this._injector = null, this._isNavigating = !1, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this.reflowViewport = {
8648
8674
  readingOrder: [],
8649
8675
  progressions: /* @__PURE__ */ new Map(),
8650
8676
  positions: null
8651
- }, this.pub = e, this.container = t, this.listeners = so(i), this.currentLocation = s, n.length && (this.positions = n), this._preferences = new Ft(o.preferences), this._defaults = new Gr(o.defaults), this._settings = new Vi(this._preferences, this._defaults);
8652
- const a = bt(e.metadata), l = a === "cjk-horizontal", h = a === "cjk-vertical", u = h || a === "mongolian-vertical", p = l || h;
8653
- this._css = new eo({
8654
- rsProperties: new to({ noVerticalPagination: u || void 0 }),
8677
+ }, this.pub = e, this.container = t, this.listeners = ro(i), this.currentLocation = s, n.length && (this.positions = n), this._preferences = new Ft(o.preferences), this._defaults = new Xr(o.defaults), this._settings = new Vi(this._preferences, this._defaults);
8678
+ const a = bt(e.metadata), l = a === "cjk-horizontal", h = a === "cjk-vertical", d = h || a === "mongolian-vertical", f = l || h;
8679
+ this._css = new io({
8680
+ rsProperties: new eo({ noVerticalPagination: d || void 0 }),
8655
8681
  userProperties: new _n({}),
8656
8682
  lineLengths: new kt({
8657
8683
  optimalChars: this._settings.optimalLineLength,
@@ -8661,44 +8687,44 @@ class Ln extends dn {
8661
8687
  fontFace: this._settings.fontFamily,
8662
8688
  letterSpacing: this._settings.letterSpacing,
8663
8689
  wordSpacing: this._settings.wordSpacing,
8664
- isCJK: p
8690
+ isCJK: f
8665
8691
  // sample: this.pub.metadata.description
8666
8692
  }),
8667
8693
  container: t,
8668
8694
  constraint: this._settings.constraint,
8669
- isCJKVertical: u
8670
- }), this._layout = Ln.determineLayout(e, !!this._settings.scroll), this.currentProgression = e.metadata.effectiveReadingProgression, this._injectablesConfig = o.injectables || { rules: [], allowedDomains: [] }, this._readiumRulesPromise = no(e.metadata, e.readingOrder.items), this._contentProtection = o.contentProtection || {}, this._keyboardPeripherals = this.mergeKeyboardPeripherals(
8695
+ isCJKVertical: d
8696
+ }), this._layout = Ln.determineLayout(e, !!this._settings.scroll), this.currentProgression = e.metadata.effectiveReadingProgression, this._injectablesConfig = o.injectables || { rules: [], allowedDomains: [] }, this._readiumRulesPromise = so(e.metadata, e.readingOrder.items), this._contentProtection = o.contentProtection || {}, this._keyboardPeripherals = this.mergeKeyboardPeripherals(
8671
8697
  this._contentProtection,
8672
8698
  o.keyboardPeripherals || []
8673
8699
  ), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new Ye(this._contentProtection), this._suspiciousActivityListener = (g) => {
8674
- const { type: d, ...f } = g.detail;
8675
- d === "context_menu" ? this.listeners.contextMenu(f) : this.listeners.contentProtection(d, f);
8676
- }, window.addEventListener(ot, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new qe({
8700
+ const { type: u, ...p } = g.detail;
8701
+ u === "context_menu" ? this.listeners.contextMenu(p) : this.listeners.contentProtection(u, p);
8702
+ }, window.addEventListener(lt, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new qe({
8677
8703
  keyboardPeripherals: this._keyboardPeripherals
8678
8704
  }), this._keyboardPeripheralListener = (g) => {
8679
- const d = g.detail;
8680
- this.listeners.peripheral(d);
8681
- }, window.addEventListener(at, this._keyboardPeripheralListener)), this.resizeObserver = new ResizeObserver(() => this.ownerWindow.requestAnimationFrame(async () => await this.resizeHandler())), this.resizeObserver.observe(this.container.parentElement || document.documentElement);
8705
+ const u = g.detail;
8706
+ this.listeners.peripheral(u);
8707
+ }, window.addEventListener(ht, this._keyboardPeripheralListener)), this.resizeObserver = new ResizeObserver(() => this.ownerWindow.requestAnimationFrame(async () => await this.resizeHandler())), this.resizeObserver.observe(this.container.parentElement || document.documentElement);
8682
8708
  }
8683
8709
  static determineLayout(t, e) {
8684
8710
  const i = t.metadata.effectiveLayout;
8685
- if (i === b.fixed || t.metadata.otherMetadata && "http://openmangaformat.org/schema/1.0#version" in t.metadata.otherMetadata || t.metadata?.conformsTo?.includes(qi.DIVINA))
8686
- return b.fixed;
8687
- if (i === b.scrolled)
8688
- return b.scrolled;
8711
+ if (i === w.fixed || t.metadata.otherMetadata && "http://openmangaformat.org/schema/1.0#version" in t.metadata.otherMetadata || t.metadata?.conformsTo?.includes(qi.DIVINA))
8712
+ return w.fixed;
8713
+ if (i === w.scrolled)
8714
+ return w.scrolled;
8689
8715
  const n = bt(t.metadata);
8690
- return n === "cjk-vertical" || n === "mongolian-vertical" || i === b.reflowable && e ? b.scrolled : b.reflowable;
8716
+ return n === "cjk-vertical" || n === "mongolian-vertical" || i === w.reflowable && e ? w.scrolled : w.reflowable;
8691
8717
  }
8692
8718
  async load() {
8693
8719
  if (this.positions?.length || (this.positions = await this.pub.positionsFromManifest()), !this._injector) {
8694
8720
  const t = await this._readiumRulesPromise;
8695
- this._injector = new Sn({
8721
+ this._injector = new vn({
8696
8722
  rules: [...t, ...this._injectablesConfig.rules],
8697
8723
  allowedDomains: this._injectablesConfig.allowedDomains
8698
8724
  });
8699
8725
  }
8700
- if (this._layout === b.fixed)
8701
- this.framePool = new $r(
8726
+ if (this._layout === w.fixed)
8727
+ this.framePool = new Gr(
8702
8728
  this.container,
8703
8729
  this.positions,
8704
8730
  this.pub,
@@ -8711,7 +8737,7 @@ class Ln extends dn {
8711
8737
  else {
8712
8738
  await this.updateCSS(!1);
8713
8739
  const t = this.compileCSSProperties(this._css);
8714
- this.framePool = new Tr(
8740
+ this.framePool = new Nr(
8715
8741
  this.container,
8716
8742
  this.positions,
8717
8743
  t,
@@ -8723,7 +8749,7 @@ class Ln extends dn {
8723
8749
  this.currentLocation === void 0 && (this.currentLocation = this.positions[0]), await this.resizeHandler(), await this.apply();
8724
8750
  }
8725
8751
  get settings() {
8726
- if (this._layout === b.fixed)
8752
+ if (this._layout === w.fixed)
8727
8753
  return Object.freeze({ ...this._settings });
8728
8754
  {
8729
8755
  const t = this._css.userProperties.colCount || this._css.rsProperties.colCount || this._settings.columnCount;
@@ -8738,7 +8764,7 @@ class Ln extends dn {
8738
8764
  }
8739
8765
  async applyPreferences() {
8740
8766
  const t = this._settings;
8741
- this._settings = new Vi(this._preferences, this._defaults), this._preferencesEditor !== null && (this._preferencesEditor = new Bi(this._preferences, this.settings, this.pub.metadata)), this._layout === b.fixed ? this.handleFXLPrefs(t, this._settings) : await this.updateCSS(!0);
8767
+ this._settings = new Vi(this._preferences, this._defaults), this._preferencesEditor !== null && (this._preferencesEditor = new Bi(this._preferences, this.settings, this.pub.metadata)), this._layout === w.fixed ? this.handleFXLPrefs(t, this._settings) : await this.updateCSS(!0);
8742
8768
  }
8743
8769
  // TODO: fit, etc.
8744
8770
  handleFXLPrefs(t, e) {
@@ -8758,11 +8784,11 @@ class Ln extends dn {
8758
8784
  async commitCSS(t) {
8759
8785
  if (!this.framePool) return;
8760
8786
  const e = this.compileCSSProperties(t);
8761
- this.framePool.setCSSProperties(e), this._css.userProperties.view === "paged" && this._layout === b.scrolled ? await this.setLayout(b.reflowable) : this._css.userProperties.view === "scroll" && this._layout === b.reflowable && await this.setLayout(b.scrolled), this._css.setContainerWidth();
8787
+ this.framePool.setCSSProperties(e), this._css.userProperties.view === "paged" && this._layout === w.scrolled ? await this.setLayout(w.reflowable) : this._css.userProperties.view === "scroll" && this._layout === w.reflowable && await this.setLayout(w.scrolled), this._css.setContainerWidth();
8762
8788
  }
8763
8789
  async resizeHandler() {
8764
8790
  const t = this.container.parentElement || document.documentElement;
8765
- if (this._layout === b.fixed) {
8791
+ if (this._layout === w.fixed) {
8766
8792
  if (this.container.style.width = `${Lt(t) - this._settings.constraint}px`, !this.framePool) return;
8767
8793
  this.framePool.resizeHandler();
8768
8794
  } else {
@@ -8846,7 +8872,7 @@ class Ln extends dn {
8846
8872
  }
8847
8873
  } else console.log("Clicked on", l);
8848
8874
  } else {
8849
- if (this._layout === b.fixed && this.framePool.doNotDisturb && (n.doNotDisturb = !0), this._layout === b.fixed && (this.currentProgression === M.rtl || this.currentProgression === M.ltr) && this.framePool.currentFrames.length > 1) {
8875
+ if (this._layout === w.fixed && this.framePool.doNotDisturb && (n.doNotDisturb = !0), this._layout === w.fixed && (this.currentProgression === M.rtl || this.currentProgression === M.ltr) && this.framePool.currentFrames.length > 1) {
8850
8876
  const c = this.framePool.currentFrames;
8851
8877
  n.targetFrameSrc === c[this.currentProgression === M.rtl ? 0 : 1]?.source && (n.x += (c[this.currentProgression === M.rtl ? 1 : 0]?.iframe.contentWindow?.innerWidth ?? 0) * window.devicePixelRatio);
8852
8878
  }
@@ -8901,14 +8927,14 @@ class Ln extends dn {
8901
8927
  }
8902
8928
  determineModules() {
8903
8929
  let t = Array.from(Te.keys());
8904
- if (this._layout === b.fixed)
8905
- return t.filter((n) => fs.includes(n));
8906
- t = t.filter((n) => ms.includes(n));
8930
+ if (this._layout === w.fixed)
8931
+ return t.filter((n) => ms.includes(n));
8932
+ t = t.filter((n) => gs.includes(n));
8907
8933
  const e = bt(this.pub.metadata);
8908
8934
  if (e === "cjk-vertical" || e === "mongolian-vertical")
8909
8935
  return t.filter((n) => n !== "column_snapper" && n !== "scroll_snapper");
8910
8936
  const i = t;
8911
- return this._layout === b.scrolled ? t = i.filter((n) => n !== "column_snapper" && n !== "cjk_vertical_snapper") : t = i.filter((n) => n !== "scroll_snapper" && n !== "cjk_vertical_snapper"), t;
8937
+ return this._layout === w.scrolled ? t = i.filter((n) => n !== "column_snapper" && n !== "cjk_vertical_snapper") : t = i.filter((n) => n !== "scroll_snapper" && n !== "cjk_vertical_snapper"), t;
8912
8938
  }
8913
8939
  // Start listening to messages from the current iframe
8914
8940
  attachListener() {
@@ -8925,11 +8951,11 @@ class Ln extends dn {
8925
8951
  throw Error("Link for " + this.currentLocation.href + " not found!");
8926
8952
  }
8927
8953
  async destroy() {
8928
- this._suspiciousActivityListener && window.removeEventListener(ot, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(at, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), await this.framePool?.destroy();
8954
+ this._suspiciousActivityListener && window.removeEventListener(lt, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(ht, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), await this.framePool?.destroy();
8929
8955
  }
8930
8956
  async changeResource(t) {
8931
8957
  if (t === 0) return !1;
8932
- if (this._layout === b.fixed) {
8958
+ if (this._layout === w.fixed) {
8933
8959
  const n = this.framePool, s = n.viewport.positions[0];
8934
8960
  if (t === 1) {
8935
8961
  if (!n.next(n.perPage)) return !1;
@@ -9008,20 +9034,42 @@ class Ln extends dn {
9008
9034
  }), this.lastLocationInView = i.last, this.updateViewport(e), this.listeners.positionChanged(this.currentLocation), await this.framePool.update(this.pub, this.currentLocation, this.determineModules());
9009
9035
  }
9010
9036
  goBackward(t, e) {
9011
- this._layout === b.fixed ? (this.changeResource(-1), e(!0)) : this._cframes[0]?.msg?.send("go_prev", void 0, async (i) => {
9012
- e(i ? !0 : await this.changeResource(-1));
9037
+ if (this._isNavigating) {
9038
+ e(!1);
9039
+ return;
9040
+ }
9041
+ this._isNavigating = !0, this._layout === w.fixed ? this.changeResource(-1).then((i) => {
9042
+ this._isNavigating = !1, e(i);
9043
+ }) : this._cframes[0]?.msg?.send("go_prev", void 0, async (i) => {
9044
+ if (i)
9045
+ this._isNavigating = !1, e(!0);
9046
+ else {
9047
+ const n = await this.changeResource(-1);
9048
+ this._isNavigating = !1, e(n);
9049
+ }
9013
9050
  });
9014
9051
  }
9015
9052
  goForward(t, e) {
9016
- this._layout === b.fixed ? (this.changeResource(1), e(!0)) : this._cframes[0]?.msg?.send("go_next", void 0, async (i) => {
9017
- e(i ? !0 : await this.changeResource(1));
9053
+ if (this._isNavigating) {
9054
+ e(!1);
9055
+ return;
9056
+ }
9057
+ this._isNavigating = !0, this._layout === w.fixed ? this.changeResource(1).then((i) => {
9058
+ this._isNavigating = !1, e(i);
9059
+ }) : this._cframes[0]?.msg?.send("go_next", void 0, async (i) => {
9060
+ if (i)
9061
+ this._isNavigating = !1, e(!0);
9062
+ else {
9063
+ const n = await this.changeResource(1);
9064
+ this._isNavigating = !1, e(n);
9065
+ }
9018
9066
  });
9019
9067
  }
9020
9068
  get currentLocator() {
9021
9069
  return this.currentLocation;
9022
9070
  }
9023
9071
  get viewport() {
9024
- return this._layout === b.fixed ? this.framePool ? this.framePool.viewport : { readingOrder: [], progressions: /* @__PURE__ */ new Map(), positions: null } : this.reflowViewport;
9072
+ return this._layout === w.fixed ? this.framePool ? this.framePool.viewport : { readingOrder: [], progressions: /* @__PURE__ */ new Map(), positions: null } : this.reflowViewport;
9025
9073
  }
9026
9074
  get isScrollStart() {
9027
9075
  const t = this.viewport.readingOrder[0];
@@ -9093,7 +9141,13 @@ class Ln extends dn {
9093
9141
  let s = this.pub.readingOrder.findWithHref(n);
9094
9142
  if (!s)
9095
9143
  return i(this.listeners.handleLocator(t));
9096
- this.currentLocation = this.positions.find((o) => o.href === s.href), this.apply().then(() => this.loadLocator(t, (o) => i(o))).then(() => {
9144
+ if (this._isNavigating) {
9145
+ i(!1);
9146
+ return;
9147
+ }
9148
+ this._isNavigating = !0, this.currentLocation = this.positions.find((o) => o.href === s.href), this.apply().then(() => this.loadLocator(t, (o) => {
9149
+ this._isNavigating = !1, i(o);
9150
+ })).then(() => {
9097
9151
  this.attachListener();
9098
9152
  });
9099
9153
  }
@@ -9101,7 +9155,7 @@ class Ln extends dn {
9101
9155
  return this.go(t.locator, e, i);
9102
9156
  }
9103
9157
  }
9104
- const ro = `// PreservePitchProcessor.js
9158
+ const oo = `// PreservePitchProcessor.js
9105
9159
  // AudioWorklet processor for pitch preservation via pitch shifting.
9106
9160
  //
9107
9161
  // Architecture:
@@ -9326,7 +9380,7 @@ class Ke {
9326
9380
  if (n)
9327
9381
  await e.audioWorklet.addModule(n);
9328
9382
  else {
9329
- const o = new Blob([ro], { type: "text/javascript" });
9383
+ const o = new Blob([oo], { type: "text/javascript" });
9330
9384
  s.url = URL.createObjectURL(o), await e.audioWorklet.addModule(s.url);
9331
9385
  }
9332
9386
  } catch (o) {
@@ -9346,7 +9400,7 @@ class Ke {
9346
9400
  this.workletNode && (this.workletNode.disconnect(), this.workletNode = null), this.url && (URL.revokeObjectURL(this.url), this.url = null);
9347
9401
  }
9348
9402
  }
9349
- class oo {
9403
+ class ao {
9350
9404
  constructor(t) {
9351
9405
  this.audioContext = null, this.sourceNode = null, this.gainNode = null, this.listeners = {}, this.isMutedValue = !1, this.isPlayingValue = !1, this.isPausedValue = !1, this.isLoadingValue = !1, this.isLoadedValue = !1, this.isEndedValue = !1, this.isStoppedValue = !1, this.worklet = null, this.webAudioActive = !1, this.boundOnCanPlayThrough = this.onCanPlayThrough.bind(this), this.boundOnTimeUpdate = this.onTimeUpdate.bind(this), this.boundOnError = this.onError.bind(this), this.boundOnEnded = this.onEnded.bind(this), this.boundOnStalled = this.onStalled.bind(this), this.boundOnEmptied = this.onEmptied.bind(this), this.boundOnSuspend = this.onSuspend.bind(this), this.boundOnWaiting = this.onWaiting.bind(this), this.boundOnLoadedMetadata = this.onLoadedMetadata.bind(this), this.boundOnSeeking = this.onSeeking.bind(this), this.boundOnSeeked = this.onSeeked.bind(this), this.boundOnPlay = this.onPlay.bind(this), this.boundOnPlaying = this.onPlaying.bind(this), this.boundOnPause = this.onPause.bind(this), this.boundOnProgress = this.onProgress.bind(this), this.playback = t.playback, this.mediaElement = document.createElement("audio"), this.mediaElement.addEventListener("canplaythrough", this.boundOnCanPlayThrough), this.mediaElement.addEventListener("timeupdate", this.boundOnTimeUpdate), this.mediaElement.addEventListener("error", this.boundOnError), this.mediaElement.addEventListener("ended", this.boundOnEnded), this.mediaElement.addEventListener("stalled", this.boundOnStalled), this.mediaElement.addEventListener("emptied", this.boundOnEmptied), this.mediaElement.addEventListener("suspend", this.boundOnSuspend), this.mediaElement.addEventListener("waiting", this.boundOnWaiting), this.mediaElement.addEventListener("loadedmetadata", this.boundOnLoadedMetadata), this.mediaElement.addEventListener("seeking", this.boundOnSeeking), this.mediaElement.addEventListener("seeked", this.boundOnSeeked), this.mediaElement.addEventListener("play", this.boundOnPlay), this.mediaElement.addEventListener("playing", this.boundOnPlaying), this.mediaElement.addEventListener("pause", this.boundOnPause), this.mediaElement.addEventListener("progress", this.boundOnProgress), this.mediaElement.currentTime = this.playback.state.currentTime;
9352
9406
  }
@@ -9623,7 +9677,7 @@ class ce {
9623
9677
  return new ce(e);
9624
9678
  }
9625
9679
  }
9626
- class ao {
9680
+ class lo {
9627
9681
  constructor(t = {}) {
9628
9682
  this.volume = F(t.volume, ie.range) ?? 1, this.playbackRate = F(t.playbackRate, ne.range) ?? 1, this.preservePitch = E(t.preservePitch) ?? !0, this.skipBackwardInterval = F(t.skipBackwardInterval, it.range) ?? 10, this.skipForwardInterval = F(t.skipForwardInterval, it.range) ?? 10, this.pollInterval = S(t.pollInterval) ?? 1e3, this.autoPlay = E(t.autoPlay) ?? !0, this.enableMediaSession = E(t.enableMediaSession) ?? !0;
9629
9683
  }
@@ -9733,7 +9787,7 @@ class $i {
9733
9787
  }
9734
9788
  }
9735
9789
  const Gi = 1, Xi = 1;
9736
- class lo {
9790
+ class ho {
9737
9791
  constructor(t, e, i = {}) {
9738
9792
  this.pool = /* @__PURE__ */ new Map(), this._audioEngine = t, this._publication = e, this._supportedAudioTypes = this.detectSupportedAudioTypes(), i.disableRemotePlayback && (this._audioEngine.getMediaElement().disableRemotePlayback = !0);
9739
9793
  }
@@ -9810,7 +9864,7 @@ class lo {
9810
9864
  this.pool.clear();
9811
9865
  }
9812
9866
  }
9813
- class ho {
9867
+ class co {
9814
9868
  constructor(t = {}) {
9815
9869
  this.dragstartHandler = (e) => {
9816
9870
  e.preventDefault(), e.stopPropagation(), t.onDragDetected?.(Array.from(e.dataTransfer?.types ?? []));
@@ -9826,7 +9880,7 @@ class ho {
9826
9880
  document.removeEventListener("dragstart", this.dragstartHandler, !0), document.removeEventListener("dragover", this.dragoverHandler, !0), document.removeEventListener("drop", this.dropHandler, !0), window.removeEventListener("unload", this.unloadHandler);
9827
9881
  }
9828
9882
  }
9829
- class co {
9883
+ class uo {
9830
9884
  constructor(t = {}) {
9831
9885
  this.copyHandler = (e) => {
9832
9886
  e.preventDefault(), e.stopPropagation(), t.onCopyBlocked?.();
@@ -9836,16 +9890,16 @@ class co {
9836
9890
  document.removeEventListener("copy", this.copyHandler, !0), window.removeEventListener("unload", this.unloadHandler);
9837
9891
  }
9838
9892
  }
9839
- class uo extends Ye {
9893
+ class po extends Ye {
9840
9894
  constructor(t = {}) {
9841
- super(t), t.disableDragAndDrop && (this.dragAndDropProtector = new ho({
9895
+ super(t), t.disableDragAndDrop && (this.dragAndDropProtector = new co({
9842
9896
  onDragDetected: (e) => {
9843
9897
  this.dispatchSuspiciousActivity("drag_detected", { dataTransferTypes: e, targetFrameSrc: "" });
9844
9898
  },
9845
9899
  onDropDetected: (e, i) => {
9846
9900
  this.dispatchSuspiciousActivity("drop_detected", { dataTransferTypes: e, fileCount: i, targetFrameSrc: "" });
9847
9901
  }
9848
- })), t.protectCopy && (this.copyProtector = new co({
9902
+ })), t.protectCopy && (this.copyProtector = new uo({
9849
9903
  onCopyBlocked: () => {
9850
9904
  this.dispatchSuspiciousActivity("bulk_copy", { targetFrameSrc: "" });
9851
9905
  }
@@ -9855,7 +9909,7 @@ class uo extends Ye {
9855
9909
  super.destroy(), this.dragAndDropProtector?.destroy(), this.copyProtector?.destroy();
9856
9910
  }
9857
9911
  }
9858
- const po = (r) => ({
9912
+ const fo = (r) => ({
9859
9913
  trackLoaded: r.trackLoaded ?? (() => {
9860
9914
  }),
9861
9915
  positionChanged: r.positionChanged ?? (() => {
@@ -9887,21 +9941,21 @@ const po = (r) => ({
9887
9941
  remotePlaybackStateChanged: r.remotePlaybackStateChanged ?? (() => {
9888
9942
  })
9889
9943
  });
9890
- class yo extends vs {
9944
+ class bo extends Ps {
9891
9945
  constructor(t, e, i, n = {
9892
9946
  preferences: {},
9893
9947
  defaults: {}
9894
9948
  }) {
9895
- if (super(), this.positionPollInterval = null, this.navigationId = 0, this._playIntent = !1, this._preferencesEditor = null, this._mediaSessionEnabled = !1, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this._isNavigating = !1, this._isStalled = !1, this._stalledWatchdog = null, this._stalledCheckTime = 0, this.pub = t, this.listeners = po(e), this._preferences = new ce(n.preferences), this._defaults = new ao(n.defaults), this._settings = new ji(this._preferences, this._defaults), t.readingOrder.items.length === 0)
9949
+ if (super(), this.positionPollInterval = null, this.navigationId = 0, this._playIntent = !1, this._preferencesEditor = null, this._mediaSessionEnabled = !1, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this._isNavigating = !1, this._isStalled = !1, this._stalledWatchdog = null, this._stalledCheckTime = 0, this.pub = t, this.listeners = fo(e), this._preferences = new ce(n.preferences), this._defaults = new lo(n.defaults), this._settings = new ji(this._preferences, this._defaults), t.readingOrder.items.length === 0)
9896
9950
  throw new Error("AudioNavigator: publication has an empty reading order");
9897
9951
  if (i)
9898
9952
  this.currentLocation = this.ensureLocatorLocations(i);
9899
9953
  else {
9900
- const u = this.pub.readingOrder.items[0];
9954
+ const d = this.pub.readingOrder.items[0];
9901
9955
  this.currentLocation = new I({
9902
- href: u.href,
9903
- type: u.type || "audio/mpeg",
9904
- title: u.title,
9956
+ href: d.href,
9957
+ type: d.type || "audio/mpeg",
9958
+ title: d.title,
9905
9959
  locations: new C({
9906
9960
  position: 1,
9907
9961
  progression: 0,
@@ -9913,7 +9967,7 @@ class yo extends vs {
9913
9967
  const s = this.currentLocation.href.split("#")[0], o = this.hrefToTrackIndex(s);
9914
9968
  if (o === -1)
9915
9969
  throw new Error(`AudioNavigator: initial href "${s}" not found in reading order`);
9916
- const a = this.currentLocation.locations?.time() || 0, l = new oo({
9970
+ const a = this.currentLocation.locations?.time() || 0, l = new ao({
9917
9971
  playback: {
9918
9972
  state: {
9919
9973
  currentTime: a,
@@ -9923,19 +9977,19 @@ class yo extends vs {
9923
9977
  index: o
9924
9978
  }
9925
9979
  });
9926
- this.pool = new lo(l, t, n.contentProtection);
9980
+ this.pool = new ho(l, t, n.contentProtection);
9927
9981
  const h = n.contentProtection || {};
9928
9982
  this._contentProtection = h;
9929
9983
  const c = this.mergeKeyboardPeripherals(
9930
9984
  h,
9931
9985
  n.keyboardPeripherals || []
9932
9986
  );
9933
- (h.disableContextMenu || h.checkAutomation || h.checkIFrameEmbedding || h.monitorDevTools || h.protectPrinting?.disable || h.disableDragAndDrop || h.protectCopy) && (this._navigatorProtector = new uo(h), this._suspiciousActivityListener = (u) => {
9934
- const { type: p, ...g } = u.detail;
9935
- p === "context_menu" ? this.listeners.contextMenu(g) : this.listeners.contentProtection(p, g);
9936
- }, window.addEventListener(ot, this._suspiciousActivityListener)), c.length > 0 && (this._keyboardPeripheralsManager = new qe({ keyboardPeripherals: c }), this._keyboardPeripheralListener = (u) => {
9937
- this.listeners.peripheral(u.detail);
9938
- }, window.addEventListener(at, this._keyboardPeripheralListener)), this.setupEventListeners(), this._isNavigating = !0, this.pool.setCurrentAudio(o, "forward"), this.applyPreferences(), this.waitForLoadedAndSeeked(a).then(() => {
9987
+ (h.disableContextMenu || h.checkAutomation || h.checkIFrameEmbedding || h.monitorDevTools || h.protectPrinting?.disable || h.disableDragAndDrop || h.protectCopy) && (this._navigatorProtector = new po(h), this._suspiciousActivityListener = (d) => {
9988
+ const { type: f, ...g } = d.detail;
9989
+ f === "context_menu" ? this.listeners.contextMenu(g) : this.listeners.contentProtection(f, g);
9990
+ }, window.addEventListener(lt, this._suspiciousActivityListener)), c.length > 0 && (this._keyboardPeripheralsManager = new qe({ keyboardPeripherals: c }), this._keyboardPeripheralListener = (d) => {
9991
+ this.listeners.peripheral(d.detail);
9992
+ }, window.addEventListener(ht, this._keyboardPeripheralListener)), this.setupEventListeners(), this._isNavigating = !0, this.pool.setCurrentAudio(o, "forward"), this.applyPreferences(), this.waitForLoadedAndSeeked(a).then(() => {
9939
9993
  this._isNavigating = !1, this.listeners.trackLoaded(this.pool.audioEngine.getMediaElement()), this._notifyTimelineChange(this.currentLocator), this.listeners.positionChanged(this.currentLocator), this._setupRemotePlayback();
9940
9994
  }).catch(() => {
9941
9995
  this._isNavigating = !1;
@@ -10243,84 +10297,84 @@ class yo extends vs {
10243
10297
  "mediaSession" in navigator && (navigator.mediaSession.metadata = null, navigator.mediaSession.setActionHandler("play", null), navigator.mediaSession.setActionHandler("pause", null), navigator.mediaSession.setActionHandler("previoustrack", null), navigator.mediaSession.setActionHandler("nexttrack", null), navigator.mediaSession.setActionHandler("seekbackward", null), navigator.mediaSession.setActionHandler("seekforward", null));
10244
10298
  }
10245
10299
  destroy() {
10246
- this.stopPositionPolling(), this._stopStalledWatchdog(), this.destroyMediaSession(), this._suspiciousActivityListener && window.removeEventListener(ot, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(at, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), this.pool.destroy();
10300
+ this.stopPositionPolling(), this._stopStalledWatchdog(), this.destroyMediaSession(), this._suspiciousActivityListener && window.removeEventListener(lt, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(ht, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), this.pool.destroy();
10247
10301
  }
10248
10302
  }
10249
10303
  export {
10250
- ao as AudioDefaults,
10251
- yo as AudioNavigator,
10304
+ lo as AudioDefaults,
10305
+ bo as AudioNavigator,
10252
10306
  ce as AudioPreferences,
10253
10307
  $i as AudioPreferencesEditor,
10254
10308
  ji as AudioSettings,
10255
10309
  A as BooleanPreference,
10256
10310
  yn as EnumPreference,
10257
- Gr as EpubDefaults,
10311
+ Xr as EpubDefaults,
10258
10312
  Ln as EpubNavigator,
10259
10313
  Ft as EpubPreferences,
10260
10314
  Bi as EpubPreferencesEditor,
10261
10315
  Vi as EpubSettings,
10262
- go as ExperimentalWebPubNavigator,
10263
- Ir as FXLCoordinator,
10264
- Nr as FXLFrameManager,
10265
- $r as FXLFramePoolManager,
10266
- Dr as FXLPeripherals,
10267
- Wr as FXLSpreader,
10316
+ yo as ExperimentalWebPubNavigator,
10317
+ zr as FXLCoordinator,
10318
+ Mr as FXLFrameManager,
10319
+ Gr as FXLFramePoolManager,
10320
+ Wr as FXLPeripherals,
10321
+ Ur as FXLSpreader,
10268
10322
  Nt as FrameComms,
10269
10323
  Cn as FrameManager,
10270
- Tr as FramePoolManager,
10271
- Mr as HorizontalThird,
10272
- Sn as Injector,
10324
+ Nr as FramePoolManager,
10325
+ Fr as HorizontalThird,
10326
+ vn as Injector,
10273
10327
  kt as LineLengths,
10274
- vs as MediaNavigator,
10328
+ Ps as MediaNavigator,
10275
10329
  cn as Navigator,
10276
10330
  Ne as Orientation,
10277
10331
  N as Preference,
10278
10332
  le as Properties,
10279
- to as RSProperties,
10333
+ eo as RSProperties,
10280
10334
  x as RangePreference,
10281
- eo as ReadiumCSS,
10335
+ io as ReadiumCSS,
10282
10336
  Me as Spread,
10283
10337
  tt as TextAlignment,
10284
10338
  _n as UserProperties,
10285
- Fr as VerticalThird,
10339
+ Ir as VerticalThird,
10286
10340
  dn as VisualNavigator,
10287
- oo as WebAudioEngine,
10288
- Ps as WebPubBlobBuilder,
10289
- cr as WebPubCSS,
10290
- pr as WebPubDefaults,
10291
- ks as WebPubFrameManager,
10341
+ ao as WebAudioEngine,
10342
+ Es as WebPubBlobBuilder,
10343
+ dr as WebPubCSS,
10344
+ fr as WebPubDefaults,
10345
+ Rs as WebPubFrameManager,
10292
10346
  Os as WebPubFramePoolManager,
10293
- Rr as WebPubNavigator,
10347
+ Ar as WebPubNavigator,
10294
10348
  Mt as WebPubPreferences,
10295
10349
  Ti as WebPubPreferencesEditor,
10296
10350
  Ai as WebPubSettings,
10297
- hr as WebRSProperties,
10351
+ cr as WebRSProperties,
10298
10352
  mn as WebUserProperties,
10299
10353
  E as ensureBoolean,
10300
10354
  he as ensureEnumValue,
10301
10355
  gn as ensureExperiment,
10302
10356
  wt as ensureFilter,
10303
- dr as ensureLessThanOrEqual,
10304
- ur as ensureMoreThanOrEqual,
10357
+ ur as ensureLessThanOrEqual,
10358
+ pr as ensureMoreThanOrEqual,
10305
10359
  S as ensureNonNegative,
10306
10360
  W as ensureString,
10307
10361
  F as ensureValueInRange,
10308
10362
  Ge as experiments,
10309
- dt as filterRangeConfig,
10363
+ ut as filterRangeConfig,
10310
10364
  Yt as fontSizeRangeConfig,
10311
10365
  st as fontWeightRangeConfig,
10312
10366
  qt as fontWidthRangeConfig,
10313
10367
  bt as getScriptMode,
10314
- mo as i18n,
10368
+ go as i18n,
10315
10369
  Kt as letterSpacingRangeConfig,
10316
10370
  Jt as lineHeightRangeConfig,
10317
- ut as lineLengthRangeConfig,
10371
+ pt as lineLengthRangeConfig,
10318
10372
  Zt as paragraphIndentRangeConfig,
10319
10373
  Qt as paragraphSpacingRangeConfig,
10320
10374
  ne as playbackRateRangeConfig,
10321
10375
  J as sML,
10322
10376
  T as sMLWithRequest,
10323
- fo as settings,
10377
+ mo as settings,
10324
10378
  it as skipIntervalRangeConfig,
10325
10379
  ie as volumeRangeConfig,
10326
10380
  ge as withFallback,