@readium/navigator-html-injectables 2.4.1 → 2.4.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +401 -386
- package/dist/index.umd.cjs +11 -11
- package/package.json +1 -1
- package/src/helpers/dom.ts +30 -9
- package/src/index.ts +1 -0
- package/src/{protection → keyboard}/KeyCombinationManager.ts +17 -3
- package/src/{protection → keyboard}/KeyboardCombinations.ts +1 -0
- package/src/keyboard/index.ts +2 -0
- package/src/modules/Peripherals.ts +3 -8
- package/src/protection/index.ts +1 -3
- package/types/src/helpers/dom.d.ts +2 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/{protection → keyboard}/KeyboardCombinations.d.ts +1 -0
- package/types/src/keyboard/index.d.ts +2 -0
- package/types/src/modules/Peripherals.d.ts +2 -1
- package/types/src/protection/index.d.ts +0 -2
- /package/types/src/{protection → keyboard}/KeyCombinationManager.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
1
|
+
const We = Math.pow(2, 32), Yt = () => Math.round(Math.random() * We).toString(36), Ue = () => `${Math.round(performance.now())}-${Yt()}-${Yt()}`, Z = 1;
|
|
2
|
+
class Be {
|
|
3
3
|
constructor(t) {
|
|
4
4
|
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);
|
|
5
5
|
}
|
|
@@ -73,7 +73,7 @@ class Ue {
|
|
|
73
73
|
const n = {
|
|
74
74
|
_readium: Z,
|
|
75
75
|
_channel: this.channelId,
|
|
76
|
-
id: i ??
|
|
76
|
+
id: i ?? Ue(),
|
|
77
77
|
// scrict,
|
|
78
78
|
key: t,
|
|
79
79
|
data: e
|
|
@@ -126,7 +126,7 @@ const y = class y {
|
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
y.EPUB_A11Y_10_WCAG_20_A = new y("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), y.EPUB_A11Y_10_WCAG_20_AA = new y("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), y.EPUB_A11Y_10_WCAG_20_AAA = new y("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), y.EPUB_A11Y_11_WCAG_20_A = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), y.EPUB_A11Y_11_WCAG_20_AA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), y.EPUB_A11Y_11_WCAG_20_AAA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), y.EPUB_A11Y_11_WCAG_21_A = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), y.EPUB_A11Y_11_WCAG_21_AA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), y.EPUB_A11Y_11_WCAG_21_AAA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), y.EPUB_A11Y_11_WCAG_22_A = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), y.EPUB_A11Y_11_WCAG_22_AA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), y.EPUB_A11Y_11_WCAG_22_AAA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
|
|
129
|
-
let
|
|
129
|
+
let qt = y;
|
|
130
130
|
const w = class w {
|
|
131
131
|
constructor(t) {
|
|
132
132
|
this.value = t;
|
|
@@ -146,7 +146,7 @@ const w = class w {
|
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
148
|
w.AUDITORY = new w("auditory"), w.CHART_ON_VISUAL = new w("chartOnVisual"), w.CHEM_ON_VISUAL = new w("chemOnVisual"), w.COLOR_DEPENDENT = new w("colorDependent"), w.DIAGRAM_ON_VISUAL = new w("diagramOnVisual"), w.MATH_ON_VISUAL = new w("mathOnVisual"), w.MUSIC_ON_VISUAL = new w("musicOnVisual"), w.TACTILE = new w("tactile"), w.TEXT_ON_VISUAL = new w("textOnVisual"), w.TEXTUAL = new w("textual"), w.VISUAL = new w("visual");
|
|
149
|
-
let
|
|
149
|
+
let Xt = w;
|
|
150
150
|
const x = class x {
|
|
151
151
|
constructor(t) {
|
|
152
152
|
if (typeof t == "string") {
|
|
@@ -182,7 +182,7 @@ const x = class x {
|
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
x.VALID_MODES = /* @__PURE__ */ new Set(["auditory", "tactile", "textual", "visual"]), x.AUDITORY = new x("auditory"), x.TACTILE = new x("tactile"), x.TEXTUAL = new x("textual"), x.VISUAL = new x("visual");
|
|
185
|
-
let
|
|
185
|
+
let Kt = x;
|
|
186
186
|
const h = class h {
|
|
187
187
|
constructor(t) {
|
|
188
188
|
this.value = t;
|
|
@@ -202,7 +202,7 @@ const h = class h {
|
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
h.NONE = new h("none"), h.ANNOTATIONS = new h("annotations"), h.ARIA = new h("ARIA"), h.INDEX = new h("index"), h.PAGE_BREAK_MARKERS = new h("pageBreakMarkers"), h.PAGE_NAVIGATION = new h("pageNavigation"), h.PRINT_PAGE_NUMBERS = new h("printPageNumbers"), h.READING_ORDER = new h("readingOrder"), h.STRUCTURAL_NAVIGATION = new h("structuralNavigation"), h.TABLE_OF_CONTENTS = new h("tableOfContents"), h.TAGGED_PDF = new h("taggedPDF"), h.ALTERNATIVE_TEXT = new h("alternativeText"), h.AUDIO_DESCRIPTION = new h("audioDescription"), h.CAPTIONS = new h("captions"), h.CLOSED_CAPTIONS = new h("closedCaptions"), h.DESCRIBED_MATH = new h("describedMath"), h.LONG_DESCRIPTION = new h("longDescription"), h.OPEN_CAPTIONS = new h("openCaptions"), h.SIGN_LANGUAGE = new h("signLanguage"), h.TRANSCRIPT = new h("transcript"), h.DISPLAY_TRANSFORMABILITY = new h("displayTransformability"), h.SYNCHRONIZED_AUDIO_TEXT = new h("synchronizedAudioText"), h.TIMING_CONTROL = new h("timingControl"), h.UNLOCKED = new h("unlocked"), h.CHEM_ML = new h("ChemML"), h.LATEX = new h("latex"), h.LATEX_CHEMISTRY = new h("latex-chemistry"), h.MATH_ML = new h("MathML"), h.MATH_ML_CHEMISTRY = new h("MathML-chemistry"), h.TTS_MARKUP = new h("ttsMarkup"), h.HIGH_CONTRAST_AUDIO = new h("highContrastAudio"), h.HIGH_CONTRAST_DISPLAY = new h("highContrastDisplay"), h.LARGE_PRINT = new h("largePrint"), h.BRAILLE = new h("braille"), h.TACTILE_GRAPHIC = new h("tactileGraphic"), h.TACTILE_OBJECT = new h("tactileObject"), h.FULL_RUBY_ANNOTATIONS = new h("fullRubyAnnotations"), h.HORIZONTAL_WRITING = new h("horizontalWriting"), h.RUBY_ANNOTATIONS = new h("rubyAnnotations"), h.VERTICAL_WRITING = new h("verticalWriting"), h.WITH_ADDITIONAL_WORD_SEGMENTATION = new h("withAdditionalWordSegmentation"), h.WITHOUT_ADDITIONAL_WORD_SEGMENTATION = new h("withoutAdditionalWordSegmentation");
|
|
205
|
-
let
|
|
205
|
+
let Zt = h;
|
|
206
206
|
const S = class S {
|
|
207
207
|
constructor(t) {
|
|
208
208
|
this.value = t;
|
|
@@ -222,7 +222,7 @@ const S = class S {
|
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
224
|
S.FLASHING = new S("flashing"), S.NO_FLASHING_HAZARD = new S("noFlashingHazard"), S.UNKNOWN_FLASHING_HAZARD = new S("unknownFlashingHazard"), S.MOTION_SIMULATION = new S("motionSimulation"), S.NO_MOTION_SIMULATION_HAZARD = new S("noMotionSimulationHazard"), S.UNKNOWN_MOTION_SIMULATION_HAZARD = new S("unknownMotionSimulationHazard"), S.SOUND = new S("sound"), S.NO_SOUND_HAZARD = new S("noSoundHazard"), S.UNKNOWN_SOUND_HAZARD = new S("unknownSoundHazard"), S.UNKNOWN = new S("unknown"), S.NONE = new S("none");
|
|
225
|
-
let
|
|
225
|
+
let Jt = S;
|
|
226
226
|
const E = class E {
|
|
227
227
|
constructor(t) {
|
|
228
228
|
this.value = t;
|
|
@@ -242,10 +242,10 @@ const E = class E {
|
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
244
|
E.NONE = new E("none"), E.DOCUMENTED = new E("documented"), E.LEGAL = new E("legal"), E.TEMPORARY = new E("temporary"), E.TECHNICAL = new E("technical"), E.EAA_DISPROPORTIONATE_BURDEN = new E("eaa-disproportionate-burden"), E.EAA_FUNDAMENTAL_ALTERATION = new E("eaa-fundamental-alteration"), E.EAA_MICROENTERPRISE = new E("eaa-microenterprise"), E.EAA_TECHNICAL_IMPOSSIBILITY = new E("eaa-technical-impossibility"), E.EAA_TEMPORARY = new E("eaa-temporary");
|
|
245
|
-
let
|
|
246
|
-
const Qt = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], Be = /* @__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"}}`), He = {
|
|
247
|
-
publication:
|
|
248
|
-
},
|
|
245
|
+
let Qt = E;
|
|
246
|
+
const jt = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], He = /* @__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"}}`), _e = {
|
|
247
|
+
publication: He
|
|
248
|
+
}, te = {
|
|
249
249
|
fr: () => import("./fr-C5HEel98.js"),
|
|
250
250
|
ar: () => import("./ar-DyHX_uy2.js"),
|
|
251
251
|
da: () => import("./da-Dct0PS3E.js"),
|
|
@@ -256,10 +256,10 @@ const Qt = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], Be = /* @__PURE__ */ J
|
|
|
256
256
|
sv: () => import("./sv-BfzAFsVN.js")
|
|
257
257
|
// 'tr': () => import('@edrlab/thorium-locales/publication-metadata/tr.json'),
|
|
258
258
|
// 'uk': () => import('@edrlab/thorium-locales/publication-metadata/uk.json')
|
|
259
|
-
},
|
|
259
|
+
}, ee = _e?.publication?.metadata?.accessibility?.["display-guide"] || {};
|
|
260
260
|
class $ {
|
|
261
261
|
constructor() {
|
|
262
|
-
this.currentLocaleCode = "en", this.locale =
|
|
262
|
+
this.currentLocaleCode = "en", this.locale = ee, this.loadedLocales = {}, this.loadedLocales.en = ee;
|
|
263
263
|
}
|
|
264
264
|
static getInstance() {
|
|
265
265
|
return $.instance || ($.instance = new $()), $.instance;
|
|
@@ -270,14 +270,14 @@ class $ {
|
|
|
270
270
|
* @returns Promise indicating if the locale was loaded successfully
|
|
271
271
|
*/
|
|
272
272
|
async loadLocale(t) {
|
|
273
|
-
if (!
|
|
273
|
+
if (!jt.includes(t))
|
|
274
274
|
return console.warn(`Locale '${t}' is not enabled`), !1;
|
|
275
275
|
if (t in this.loadedLocales)
|
|
276
276
|
return !0;
|
|
277
277
|
try {
|
|
278
|
-
if (!(t in
|
|
278
|
+
if (!(t in te))
|
|
279
279
|
return console.warn(`Locale file not found for: ${t}`), !1;
|
|
280
|
-
const s = (await
|
|
280
|
+
const s = (await te[t]()).default?.publication?.metadata?.accessibility?.["display-guide"];
|
|
281
281
|
return s ? (this.loadedLocales[t] = s, !0) : (console.warn(`No accessibility strings found in locale ${t}`), !1);
|
|
282
282
|
} catch (e) {
|
|
283
283
|
return console.warn(`Failed to load locale ${t}:`, e), !1;
|
|
@@ -311,7 +311,7 @@ class $ {
|
|
|
311
311
|
* Gets a list of available locale codes
|
|
312
312
|
*/
|
|
313
313
|
getAvailableLocales() {
|
|
314
|
-
return
|
|
314
|
+
return jt;
|
|
315
315
|
}
|
|
316
316
|
getNestedValue(t, e) {
|
|
317
317
|
const i = e.split(".");
|
|
@@ -397,13 +397,13 @@ Object.defineProperty(R.prototype, "encryption", {
|
|
|
397
397
|
return kt.deserialize(this.otherProperties.encrypted);
|
|
398
398
|
}
|
|
399
399
|
});
|
|
400
|
-
function
|
|
400
|
+
function Ve(r) {
|
|
401
401
|
return r && Array.isArray(r) ? r : void 0;
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
return r && typeof r == "string" ? [r] :
|
|
403
|
+
function Ce(r) {
|
|
404
|
+
return r && typeof r == "string" ? [r] : Ve(r);
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function ie(r) {
|
|
407
407
|
return typeof r == "string" ? new Date(r) : void 0;
|
|
408
408
|
}
|
|
409
409
|
function ht(r) {
|
|
@@ -412,11 +412,11 @@ function ht(r) {
|
|
|
412
412
|
function O(r) {
|
|
413
413
|
return ht(r) !== void 0 && Math.sign(r) >= 0 ? r : void 0;
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function Fe(r) {
|
|
416
416
|
const t = new Array();
|
|
417
417
|
return r.forEach((e) => t.push(e)), t;
|
|
418
418
|
}
|
|
419
|
-
class
|
|
419
|
+
class c {
|
|
420
420
|
/** Creates a MediaType object. */
|
|
421
421
|
constructor(t) {
|
|
422
422
|
let e, i, s = t.mediaType.replace(/\s/g, "").split(";");
|
|
@@ -434,8 +434,8 @@ class l {
|
|
|
434
434
|
o[g] = m;
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
const a = {},
|
|
438
|
-
|
|
437
|
+
const a = {}, l = Object.keys(o);
|
|
438
|
+
l.sort((p, v) => p.localeCompare(v)), l.forEach((p) => a[p] = o[p]);
|
|
439
439
|
let u = "";
|
|
440
440
|
for (const p in a) {
|
|
441
441
|
const v = a[p];
|
|
@@ -445,7 +445,7 @@ class l {
|
|
|
445
445
|
this.string = d, this.type = e, this.subtype = i, this.parameters = a, this.encoding = f, this.name = t.name, this.fileExtension = t.fileExtension;
|
|
446
446
|
}
|
|
447
447
|
static parse(t) {
|
|
448
|
-
return new
|
|
448
|
+
return new c(t);
|
|
449
449
|
}
|
|
450
450
|
/** Structured syntax suffix, e.g. `+zip` in `application/epub+zip`.
|
|
451
451
|
* Gives a hint on the underlying structure of this media type.
|
|
@@ -475,7 +475,7 @@ class l {
|
|
|
475
475
|
* - Wildcards are supported, meaning that `image/*` contains `image/png`
|
|
476
476
|
*/
|
|
477
477
|
contains(t) {
|
|
478
|
-
const e = typeof t == "string" ?
|
|
478
|
+
const e = typeof t == "string" ? c.parse({ mediaType: t }) : t;
|
|
479
479
|
if (!((this.type === "*" || this.type === e.type) && (this.subtype === "*" || this.subtype === e.subtype)))
|
|
480
480
|
return !1;
|
|
481
481
|
const i = new Set(
|
|
@@ -494,7 +494,7 @@ class l {
|
|
|
494
494
|
* doesn't. This is basically like `contains`, but working in both direction.
|
|
495
495
|
*/
|
|
496
496
|
matches(t) {
|
|
497
|
-
const e = typeof t == "string" ?
|
|
497
|
+
const e = typeof t == "string" ? c.parse({ mediaType: t }) : t;
|
|
498
498
|
return this.contains(e) || e.contains(this);
|
|
499
499
|
}
|
|
500
500
|
/**
|
|
@@ -513,39 +513,39 @@ class l {
|
|
|
513
513
|
/** Returns whether this media type is structured as a ZIP archive. */
|
|
514
514
|
get isZIP() {
|
|
515
515
|
return this.matchesAny(
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
516
|
+
c.ZIP,
|
|
517
|
+
c.LCP_PROTECTED_AUDIOBOOK,
|
|
518
|
+
c.LCP_PROTECTED_PDF
|
|
519
519
|
) || this.structuredSyntaxSuffix === "+zip";
|
|
520
520
|
}
|
|
521
521
|
/** Returns whether this media type is structured as a JSON file. */
|
|
522
522
|
get isJSON() {
|
|
523
|
-
return this.matchesAny(
|
|
523
|
+
return this.matchesAny(c.JSON) || this.structuredSyntaxSuffix === "+json";
|
|
524
524
|
}
|
|
525
525
|
/** Returns whether this media type is of an OPDS feed. */
|
|
526
526
|
get isOPDS() {
|
|
527
527
|
return this.matchesAny(
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
528
|
+
c.OPDS1,
|
|
529
|
+
c.OPDS1_ENTRY,
|
|
530
|
+
c.OPDS2,
|
|
531
|
+
c.OPDS2_PUBLICATION,
|
|
532
|
+
c.OPDS_AUTHENTICATION
|
|
533
533
|
) || this.structuredSyntaxSuffix === "+json";
|
|
534
534
|
}
|
|
535
535
|
/** Returns whether this media type is of an HTML document. */
|
|
536
536
|
get isHTML() {
|
|
537
|
-
return this.matchesAny(
|
|
537
|
+
return this.matchesAny(c.HTML, c.XHTML);
|
|
538
538
|
}
|
|
539
539
|
/** Returns whether this media type is of a bitmap image, so excluding vectorial formats. */
|
|
540
540
|
get isBitmap() {
|
|
541
541
|
return this.matchesAny(
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
542
|
+
c.AVIF,
|
|
543
|
+
c.BMP,
|
|
544
|
+
c.GIF,
|
|
545
|
+
c.JPEG,
|
|
546
|
+
c.PNG,
|
|
547
|
+
c.TIFF,
|
|
548
|
+
c.WEBP
|
|
549
549
|
);
|
|
550
550
|
}
|
|
551
551
|
/** Returns whether this media type is of an audio clip. */
|
|
@@ -559,323 +559,323 @@ class l {
|
|
|
559
559
|
/** Returns whether this media type is of a Readium Web Publication Manifest. */
|
|
560
560
|
get isRWPM() {
|
|
561
561
|
return this.matchesAny(
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
562
|
+
c.READIUM_AUDIOBOOK_MANIFEST,
|
|
563
|
+
c.DIVINA_MANIFEST,
|
|
564
|
+
c.READIUM_WEBPUB_MANIFEST
|
|
565
565
|
);
|
|
566
566
|
}
|
|
567
567
|
/** Returns whether this media type is of a publication file. */
|
|
568
568
|
get isPublication() {
|
|
569
569
|
return this.matchesAny(
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
570
|
+
c.READIUM_AUDIOBOOK,
|
|
571
|
+
c.READIUM_AUDIOBOOK_MANIFEST,
|
|
572
|
+
c.CBZ,
|
|
573
|
+
c.DIVINA,
|
|
574
|
+
c.DIVINA_MANIFEST,
|
|
575
|
+
c.EPUB,
|
|
576
|
+
c.LCP_PROTECTED_AUDIOBOOK,
|
|
577
|
+
c.LCP_PROTECTED_PDF,
|
|
578
|
+
c.LPF,
|
|
579
|
+
c.PDF,
|
|
580
|
+
c.W3C_WPUB_MANIFEST,
|
|
581
|
+
c.READIUM_WEBPUB,
|
|
582
|
+
c.READIUM_WEBPUB_MANIFEST,
|
|
583
|
+
c.ZAB
|
|
584
584
|
);
|
|
585
585
|
}
|
|
586
586
|
// Known Media Types
|
|
587
587
|
static get AAC() {
|
|
588
|
-
return
|
|
588
|
+
return c.parse({ mediaType: "audio/aac", fileExtension: "aac" });
|
|
589
589
|
}
|
|
590
590
|
static get ACSM() {
|
|
591
|
-
return
|
|
591
|
+
return c.parse({
|
|
592
592
|
mediaType: "application/vnd.adobe.adept+xml",
|
|
593
593
|
name: "Adobe Content Server Message",
|
|
594
594
|
fileExtension: "acsm"
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
static get AIFF() {
|
|
598
|
-
return
|
|
598
|
+
return c.parse({ mediaType: "audio/aiff", fileExtension: "aiff" });
|
|
599
599
|
}
|
|
600
600
|
static get AVI() {
|
|
601
|
-
return
|
|
601
|
+
return c.parse({
|
|
602
602
|
mediaType: "video/x-msvideo",
|
|
603
603
|
fileExtension: "avi"
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
606
|
static get AVIF() {
|
|
607
|
-
return
|
|
607
|
+
return c.parse({ mediaType: "image/avif", fileExtension: "avif" });
|
|
608
608
|
}
|
|
609
609
|
static get BINARY() {
|
|
610
|
-
return
|
|
610
|
+
return c.parse({ mediaType: "application/octet-stream" });
|
|
611
611
|
}
|
|
612
612
|
static get BMP() {
|
|
613
|
-
return
|
|
613
|
+
return c.parse({ mediaType: "image/bmp", fileExtension: "bmp" });
|
|
614
614
|
}
|
|
615
615
|
static get CBZ() {
|
|
616
|
-
return
|
|
616
|
+
return c.parse({
|
|
617
617
|
mediaType: "application/vnd.comicbook+zip",
|
|
618
618
|
name: "Comic Book Archive",
|
|
619
619
|
fileExtension: "cbz"
|
|
620
620
|
});
|
|
621
621
|
}
|
|
622
622
|
static get CSS() {
|
|
623
|
-
return
|
|
623
|
+
return c.parse({ mediaType: "text/css", fileExtension: "css" });
|
|
624
624
|
}
|
|
625
625
|
static get DIVINA() {
|
|
626
|
-
return
|
|
626
|
+
return c.parse({
|
|
627
627
|
mediaType: "application/divina+zip",
|
|
628
628
|
name: "Digital Visual Narratives",
|
|
629
629
|
fileExtension: "divina"
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
632
|
static get DIVINA_MANIFEST() {
|
|
633
|
-
return
|
|
633
|
+
return c.parse({
|
|
634
634
|
mediaType: "application/divina+json",
|
|
635
635
|
name: "Digital Visual Narratives",
|
|
636
636
|
fileExtension: "json"
|
|
637
637
|
});
|
|
638
638
|
}
|
|
639
639
|
static get EPUB() {
|
|
640
|
-
return
|
|
640
|
+
return c.parse({
|
|
641
641
|
mediaType: "application/epub+zip",
|
|
642
642
|
name: "EPUB",
|
|
643
643
|
fileExtension: "epub"
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
646
|
static get GIF() {
|
|
647
|
-
return
|
|
647
|
+
return c.parse({ mediaType: "image/gif", fileExtension: "gif" });
|
|
648
648
|
}
|
|
649
649
|
static get GZ() {
|
|
650
|
-
return
|
|
650
|
+
return c.parse({
|
|
651
651
|
mediaType: "application/gzip",
|
|
652
652
|
fileExtension: "gz"
|
|
653
653
|
});
|
|
654
654
|
}
|
|
655
655
|
static get HTML() {
|
|
656
|
-
return
|
|
656
|
+
return c.parse({ mediaType: "text/html", fileExtension: "html" });
|
|
657
657
|
}
|
|
658
658
|
static get JAVASCRIPT() {
|
|
659
|
-
return
|
|
659
|
+
return c.parse({
|
|
660
660
|
mediaType: "text/javascript",
|
|
661
661
|
fileExtension: "js"
|
|
662
662
|
});
|
|
663
663
|
}
|
|
664
664
|
static get JPEG() {
|
|
665
|
-
return
|
|
665
|
+
return c.parse({ mediaType: "image/jpeg", fileExtension: "jpeg" });
|
|
666
666
|
}
|
|
667
667
|
static get JSON() {
|
|
668
|
-
return
|
|
668
|
+
return c.parse({ mediaType: "application/json" });
|
|
669
669
|
}
|
|
670
670
|
static get LCP_LICENSE_DOCUMENT() {
|
|
671
|
-
return
|
|
671
|
+
return c.parse({
|
|
672
672
|
mediaType: "application/vnd.readium.lcp.license.v1.0+json",
|
|
673
673
|
name: "LCP License",
|
|
674
674
|
fileExtension: "lcpl"
|
|
675
675
|
});
|
|
676
676
|
}
|
|
677
677
|
static get LCP_PROTECTED_AUDIOBOOK() {
|
|
678
|
-
return
|
|
678
|
+
return c.parse({
|
|
679
679
|
mediaType: "application/audiobook+lcp",
|
|
680
680
|
name: "LCP Protected Audiobook",
|
|
681
681
|
fileExtension: "lcpa"
|
|
682
682
|
});
|
|
683
683
|
}
|
|
684
684
|
static get LCP_PROTECTED_PDF() {
|
|
685
|
-
return
|
|
685
|
+
return c.parse({
|
|
686
686
|
mediaType: "application/pdf+lcp",
|
|
687
687
|
name: "LCP Protected PDF",
|
|
688
688
|
fileExtension: "lcpdf"
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
691
|
static get LCP_STATUS_DOCUMENT() {
|
|
692
|
-
return
|
|
692
|
+
return c.parse({
|
|
693
693
|
mediaType: "application/vnd.readium.license.status.v1.0+json"
|
|
694
694
|
});
|
|
695
695
|
}
|
|
696
696
|
static get LPF() {
|
|
697
|
-
return
|
|
697
|
+
return c.parse({
|
|
698
698
|
mediaType: "application/lpf+zip",
|
|
699
699
|
fileExtension: "lpf"
|
|
700
700
|
});
|
|
701
701
|
}
|
|
702
702
|
static get MP3() {
|
|
703
|
-
return
|
|
703
|
+
return c.parse({ mediaType: "audio/mpeg", fileExtension: "mp3" });
|
|
704
704
|
}
|
|
705
705
|
static get MPEG() {
|
|
706
|
-
return
|
|
706
|
+
return c.parse({ mediaType: "video/mpeg", fileExtension: "mpeg" });
|
|
707
707
|
}
|
|
708
708
|
static get NCX() {
|
|
709
|
-
return
|
|
709
|
+
return c.parse({
|
|
710
710
|
mediaType: "application/x-dtbncx+xml",
|
|
711
711
|
fileExtension: "ncx"
|
|
712
712
|
});
|
|
713
713
|
}
|
|
714
714
|
static get OGG() {
|
|
715
|
-
return
|
|
715
|
+
return c.parse({ mediaType: "audio/ogg", fileExtension: "oga" });
|
|
716
716
|
}
|
|
717
717
|
static get OGV() {
|
|
718
|
-
return
|
|
718
|
+
return c.parse({ mediaType: "video/ogg", fileExtension: "ogv" });
|
|
719
719
|
}
|
|
720
720
|
static get OPDS1() {
|
|
721
|
-
return
|
|
721
|
+
return c.parse({
|
|
722
722
|
mediaType: "application/atom+xml;profile=opds-catalog"
|
|
723
723
|
});
|
|
724
724
|
}
|
|
725
725
|
static get OPDS1_ENTRY() {
|
|
726
|
-
return
|
|
726
|
+
return c.parse({
|
|
727
727
|
mediaType: "application/atom+xml;type=entry;profile=opds-catalog"
|
|
728
728
|
});
|
|
729
729
|
}
|
|
730
730
|
static get OPDS2() {
|
|
731
|
-
return
|
|
731
|
+
return c.parse({ mediaType: "application/opds+json" });
|
|
732
732
|
}
|
|
733
733
|
static get OPDS2_PUBLICATION() {
|
|
734
|
-
return
|
|
734
|
+
return c.parse({ mediaType: "application/opds-publication+json" });
|
|
735
735
|
}
|
|
736
736
|
static get OPDS_AUTHENTICATION() {
|
|
737
|
-
return
|
|
737
|
+
return c.parse({
|
|
738
738
|
mediaType: "application/opds-authentication+json"
|
|
739
739
|
});
|
|
740
740
|
}
|
|
741
741
|
static get OPUS() {
|
|
742
|
-
return
|
|
742
|
+
return c.parse({ mediaType: "audio/opus", fileExtension: "opus" });
|
|
743
743
|
}
|
|
744
744
|
static get OTF() {
|
|
745
|
-
return
|
|
745
|
+
return c.parse({ mediaType: "font/otf", fileExtension: "otf" });
|
|
746
746
|
}
|
|
747
747
|
static get PDF() {
|
|
748
|
-
return
|
|
748
|
+
return c.parse({
|
|
749
749
|
mediaType: "application/pdf",
|
|
750
750
|
name: "PDF",
|
|
751
751
|
fileExtension: "pdf"
|
|
752
752
|
});
|
|
753
753
|
}
|
|
754
754
|
static get PNG() {
|
|
755
|
-
return
|
|
755
|
+
return c.parse({ mediaType: "image/png", fileExtension: "png" });
|
|
756
756
|
}
|
|
757
757
|
static get READIUM_AUDIOBOOK() {
|
|
758
|
-
return
|
|
758
|
+
return c.parse({
|
|
759
759
|
mediaType: "application/audiobook+zip",
|
|
760
760
|
name: "Readium Audiobook",
|
|
761
761
|
fileExtension: "audiobook"
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
static get READIUM_AUDIOBOOK_MANIFEST() {
|
|
765
|
-
return
|
|
765
|
+
return c.parse({
|
|
766
766
|
mediaType: "application/audiobook+json",
|
|
767
767
|
name: "Readium Audiobook",
|
|
768
768
|
fileExtension: "json"
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
static get READIUM_CONTENT_DOCUMENT() {
|
|
772
|
-
return
|
|
772
|
+
return c.parse({
|
|
773
773
|
mediaType: "application/vnd.readium.content+json",
|
|
774
774
|
name: "Readium Content Document",
|
|
775
775
|
fileExtension: "json"
|
|
776
776
|
});
|
|
777
777
|
}
|
|
778
778
|
static get READIUM_GUIDED_NAVIGATION_DOCUMENT() {
|
|
779
|
-
return
|
|
779
|
+
return c.parse({
|
|
780
780
|
mediaType: "application/guided-navigation+json",
|
|
781
781
|
name: "Readium Guided Navigation Document",
|
|
782
782
|
fileExtension: "json"
|
|
783
783
|
});
|
|
784
784
|
}
|
|
785
785
|
static get READIUM_POSITION_LIST() {
|
|
786
|
-
return
|
|
786
|
+
return c.parse({
|
|
787
787
|
mediaType: "application/vnd.readium.position-list+json",
|
|
788
788
|
name: "Readium Position List",
|
|
789
789
|
fileExtension: "json"
|
|
790
790
|
});
|
|
791
791
|
}
|
|
792
792
|
static get READIUM_WEBPUB() {
|
|
793
|
-
return
|
|
793
|
+
return c.parse({
|
|
794
794
|
mediaType: "application/webpub+zip",
|
|
795
795
|
name: "Readium Web Publication",
|
|
796
796
|
fileExtension: "webpub"
|
|
797
797
|
});
|
|
798
798
|
}
|
|
799
799
|
static get READIUM_WEBPUB_MANIFEST() {
|
|
800
|
-
return
|
|
800
|
+
return c.parse({
|
|
801
801
|
mediaType: "application/webpub+json",
|
|
802
802
|
name: "Readium Web Publication",
|
|
803
803
|
fileExtension: "json"
|
|
804
804
|
});
|
|
805
805
|
}
|
|
806
806
|
static get SMIL() {
|
|
807
|
-
return
|
|
807
|
+
return c.parse({
|
|
808
808
|
mediaType: "application/smil+xml",
|
|
809
809
|
fileExtension: "smil"
|
|
810
810
|
});
|
|
811
811
|
}
|
|
812
812
|
static get SVG() {
|
|
813
|
-
return
|
|
813
|
+
return c.parse({
|
|
814
814
|
mediaType: "image/svg+xml",
|
|
815
815
|
fileExtension: "svg"
|
|
816
816
|
});
|
|
817
817
|
}
|
|
818
818
|
static get TEXT() {
|
|
819
|
-
return
|
|
819
|
+
return c.parse({ mediaType: "text/plain", fileExtension: "txt" });
|
|
820
820
|
}
|
|
821
821
|
static get TIFF() {
|
|
822
|
-
return
|
|
822
|
+
return c.parse({ mediaType: "image/tiff", fileExtension: "tiff" });
|
|
823
823
|
}
|
|
824
824
|
static get TTF() {
|
|
825
|
-
return
|
|
825
|
+
return c.parse({ mediaType: "font/ttf", fileExtension: "ttf" });
|
|
826
826
|
}
|
|
827
827
|
static get W3C_WPUB_MANIFEST() {
|
|
828
|
-
return
|
|
828
|
+
return c.parse({
|
|
829
829
|
mediaType: "application/x.readium.w3c.wpub+json",
|
|
830
830
|
name: "Web Publication",
|
|
831
831
|
fileExtension: "json"
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
834
|
static get WAV() {
|
|
835
|
-
return
|
|
835
|
+
return c.parse({ mediaType: "audio/wav", fileExtension: "wav" });
|
|
836
836
|
}
|
|
837
837
|
static get WEBM_AUDIO() {
|
|
838
|
-
return
|
|
838
|
+
return c.parse({ mediaType: "audio/webm", fileExtension: "webm" });
|
|
839
839
|
}
|
|
840
840
|
static get WEBM_VIDEO() {
|
|
841
|
-
return
|
|
841
|
+
return c.parse({ mediaType: "video/webm", fileExtension: "webm" });
|
|
842
842
|
}
|
|
843
843
|
static get WEBP() {
|
|
844
|
-
return
|
|
844
|
+
return c.parse({ mediaType: "image/webp", fileExtension: "webp" });
|
|
845
845
|
}
|
|
846
846
|
static get WOFF() {
|
|
847
|
-
return
|
|
847
|
+
return c.parse({ mediaType: "font/woff", fileExtension: "woff" });
|
|
848
848
|
}
|
|
849
849
|
static get WOFF2() {
|
|
850
|
-
return
|
|
850
|
+
return c.parse({ mediaType: "font/woff2", fileExtension: "woff2" });
|
|
851
851
|
}
|
|
852
852
|
static get XHTML() {
|
|
853
|
-
return
|
|
853
|
+
return c.parse({
|
|
854
854
|
mediaType: "application/xhtml+xml",
|
|
855
855
|
fileExtension: "xhtml"
|
|
856
856
|
});
|
|
857
857
|
}
|
|
858
858
|
static get XML() {
|
|
859
|
-
return
|
|
859
|
+
return c.parse({
|
|
860
860
|
mediaType: "application/xml",
|
|
861
861
|
fileExtension: "xml"
|
|
862
862
|
});
|
|
863
863
|
}
|
|
864
864
|
static get ZAB() {
|
|
865
|
-
return
|
|
865
|
+
return c.parse({
|
|
866
866
|
mediaType: "application/x.readium.zab+zip",
|
|
867
867
|
name: "Zipped Audio Book",
|
|
868
868
|
fileExtension: "zab"
|
|
869
869
|
});
|
|
870
870
|
}
|
|
871
871
|
static get ZIP() {
|
|
872
|
-
return
|
|
872
|
+
return c.parse({
|
|
873
873
|
mediaType: "application/zip",
|
|
874
874
|
fileExtension: "zip"
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
|
-
class
|
|
878
|
+
class se {
|
|
879
879
|
constructor(t) {
|
|
880
880
|
this.uri = t, this.parameters = this.getParameters(t);
|
|
881
881
|
}
|
|
@@ -922,10 +922,10 @@ class C {
|
|
|
922
922
|
"totalProgression",
|
|
923
923
|
"position"
|
|
924
924
|
]);
|
|
925
|
-
return Object.entries(t).forEach(([a,
|
|
926
|
-
o.has(a) || n.set(a,
|
|
925
|
+
return Object.entries(t).forEach(([a, l]) => {
|
|
926
|
+
o.has(a) || n.set(a, l);
|
|
927
927
|
}), new C({
|
|
928
|
-
fragments:
|
|
928
|
+
fragments: Ce(t.fragments || t.fragment),
|
|
929
929
|
progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
|
|
930
930
|
totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
|
|
931
931
|
position: s !== void 0 && s > 0 ? s : void 0,
|
|
@@ -1030,7 +1030,7 @@ class q {
|
|
|
1030
1030
|
size: O(t.size),
|
|
1031
1031
|
duration: O(t.duration),
|
|
1032
1032
|
bitrate: O(t.bitrate),
|
|
1033
|
-
languages:
|
|
1033
|
+
languages: Ce(t.language),
|
|
1034
1034
|
alternates: dt.deserialize(t.alternate),
|
|
1035
1035
|
children: dt.deserialize(t.children)
|
|
1036
1036
|
});
|
|
@@ -1040,11 +1040,11 @@ class q {
|
|
|
1040
1040
|
*/
|
|
1041
1041
|
serialize() {
|
|
1042
1042
|
const t = { href: this.href };
|
|
1043
|
-
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 =
|
|
1043
|
+
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 = Fe(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;
|
|
1044
1044
|
}
|
|
1045
1045
|
/** MediaType of the linked resource. */
|
|
1046
1046
|
get mediaType() {
|
|
1047
|
-
return this.type !== void 0 ?
|
|
1047
|
+
return this.type !== void 0 ? c.parse({ mediaType: this.type }) : c.BINARY;
|
|
1048
1048
|
}
|
|
1049
1049
|
/** Computes an absolute URL to the link, relative to the given `baseURL`.
|
|
1050
1050
|
* If the link's `href` is already absolute, the `baseURL` is ignored.
|
|
@@ -1057,14 +1057,14 @@ class q {
|
|
|
1057
1057
|
}
|
|
1058
1058
|
/** List of URI template parameter keys, if the `Link` is templated. */
|
|
1059
1059
|
get templateParameters() {
|
|
1060
|
-
return this.templated ? new
|
|
1060
|
+
return this.templated ? new se(this.href).parameters : /* @__PURE__ */ new Set();
|
|
1061
1061
|
}
|
|
1062
1062
|
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
|
|
1063
1063
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
1064
1064
|
*/
|
|
1065
1065
|
expandTemplate(t) {
|
|
1066
1066
|
return new q({
|
|
1067
|
-
href: new
|
|
1067
|
+
href: new se(this.href).expand(t),
|
|
1068
1068
|
templated: !1
|
|
1069
1069
|
});
|
|
1070
1070
|
}
|
|
@@ -1396,8 +1396,8 @@ class _t {
|
|
|
1396
1396
|
if (t && t.state)
|
|
1397
1397
|
return new _t({
|
|
1398
1398
|
state: t.state,
|
|
1399
|
-
since:
|
|
1400
|
-
until:
|
|
1399
|
+
since: ie(t.since),
|
|
1400
|
+
until: ie(t.until)
|
|
1401
1401
|
});
|
|
1402
1402
|
}
|
|
1403
1403
|
/**
|
|
@@ -1431,34 +1431,34 @@ R.prototype.getAvailability = function() {
|
|
|
1431
1431
|
R.prototype.getAuthenticate = function() {
|
|
1432
1432
|
return q.deserialize(this.otherProperties.authenticate);
|
|
1433
1433
|
};
|
|
1434
|
-
const
|
|
1435
|
-
function
|
|
1436
|
-
console.warn(`${
|
|
1434
|
+
const Ge = "CssSelectorGenerator";
|
|
1435
|
+
function ne(r = "unknown problem", ...t) {
|
|
1436
|
+
console.warn(`${Ge}: ${r}`, ...t);
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function $e(r) {
|
|
1439
1439
|
return r instanceof RegExp;
|
|
1440
1440
|
}
|
|
1441
|
-
function
|
|
1441
|
+
function Ye(r) {
|
|
1442
1442
|
return r.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function qe(r) {
|
|
1445
1445
|
const t = r.map((e) => {
|
|
1446
|
-
if (
|
|
1446
|
+
if ($e(e))
|
|
1447
1447
|
return (i) => e.test(i);
|
|
1448
1448
|
if (typeof e == "function")
|
|
1449
1449
|
return (i) => {
|
|
1450
1450
|
const s = e(i);
|
|
1451
|
-
return typeof s != "boolean" ? (
|
|
1451
|
+
return typeof s != "boolean" ? (ne("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : s;
|
|
1452
1452
|
};
|
|
1453
1453
|
if (typeof e == "string") {
|
|
1454
|
-
const i = new RegExp("^" +
|
|
1454
|
+
const i = new RegExp("^" + Ye(e) + "$");
|
|
1455
1455
|
return (s) => i.test(s);
|
|
1456
1456
|
}
|
|
1457
|
-
return
|
|
1457
|
+
return ne("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
|
|
1458
1458
|
});
|
|
1459
1459
|
return (e) => t.some((i) => i(e));
|
|
1460
1460
|
}
|
|
1461
|
-
|
|
1461
|
+
qe([
|
|
1462
1462
|
"class",
|
|
1463
1463
|
"id",
|
|
1464
1464
|
// Angular attributes
|
|
@@ -1466,15 +1466,15 @@ Ye([
|
|
|
1466
1466
|
]);
|
|
1467
1467
|
class K {
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1469
|
+
function re(r) {
|
|
1470
1470
|
return r.split("").reverse().join("");
|
|
1471
1471
|
}
|
|
1472
|
-
function
|
|
1473
|
-
const i =
|
|
1472
|
+
function Xe(r, t, e) {
|
|
1473
|
+
const i = re(t);
|
|
1474
1474
|
return e.map((s) => {
|
|
1475
|
-
const n = Math.max(0, s.end - t.length - s.errors), o =
|
|
1475
|
+
const n = Math.max(0, s.end - t.length - s.errors), o = re(r.slice(n, s.end));
|
|
1476
1476
|
return {
|
|
1477
|
-
start:
|
|
1477
|
+
start: xe(o, i, s.errors).reduce((l, u) => s.end - u.end < l ? s.end - u.end : l, s.end),
|
|
1478
1478
|
end: s.end,
|
|
1479
1479
|
errors: s.errors
|
|
1480
1480
|
};
|
|
@@ -1483,14 +1483,14 @@ function qe(r, t, e) {
|
|
|
1483
1483
|
function vt(r) {
|
|
1484
1484
|
return (r | -r) >> 31 & 1;
|
|
1485
1485
|
}
|
|
1486
|
-
function
|
|
1486
|
+
function oe(r, t, e, i) {
|
|
1487
1487
|
let s = r.P[e], n = r.M[e];
|
|
1488
|
-
const o = i >>> 31, a = t[e] | o,
|
|
1488
|
+
const o = i >>> 31, a = t[e] | o, l = a | n, u = (a & s) + s ^ s | a;
|
|
1489
1489
|
let d = n | ~(u | s), f = s & u;
|
|
1490
1490
|
const p = vt(d & r.lastRowMask[e]) - vt(f & r.lastRowMask[e]);
|
|
1491
|
-
return d <<= 1, f <<= 1, f |= o, d |= vt(i) - o, s = f | ~(
|
|
1491
|
+
return d <<= 1, f <<= 1, f |= o, d |= vt(i) - o, s = f | ~(l | d), n = d & l, r.P[e] = s, r.M[e] = n, p;
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function xe(r, t, e) {
|
|
1494
1494
|
if (t.length === 0)
|
|
1495
1495
|
return [];
|
|
1496
1496
|
e = Math.min(e, t.length);
|
|
@@ -1500,15 +1500,15 @@ function Ce(r, t, e) {
|
|
|
1500
1500
|
lastRowMask: new Uint32Array(n + 1)
|
|
1501
1501
|
};
|
|
1502
1502
|
o.lastRowMask.fill(1 << 31), o.lastRowMask[n] = 1 << (t.length - 1) % s;
|
|
1503
|
-
const a = new Uint32Array(n + 1),
|
|
1503
|
+
const a = new Uint32Array(n + 1), l = /* @__PURE__ */ new Map(), u = [];
|
|
1504
1504
|
for (let p = 0; p < 256; p++)
|
|
1505
1505
|
u.push(a);
|
|
1506
1506
|
for (let p = 0; p < t.length; p += 1) {
|
|
1507
1507
|
const v = t.charCodeAt(p);
|
|
1508
|
-
if (
|
|
1508
|
+
if (l.has(v))
|
|
1509
1509
|
continue;
|
|
1510
1510
|
const g = new Uint32Array(n + 1);
|
|
1511
|
-
|
|
1511
|
+
l.set(v, g), v < u.length && (u[v] = g);
|
|
1512
1512
|
for (let m = 0; m <= n; m += 1) {
|
|
1513
1513
|
g[m] = 0;
|
|
1514
1514
|
for (let b = 0; b < s; b += 1) {
|
|
@@ -1529,10 +1529,10 @@ function Ce(r, t, e) {
|
|
|
1529
1529
|
for (let p = 0; p < r.length; p += 1) {
|
|
1530
1530
|
const v = r.charCodeAt(p);
|
|
1531
1531
|
let g;
|
|
1532
|
-
v < u.length ? g = u[v] : (g =
|
|
1532
|
+
v < u.length ? g = u[v] : (g = l.get(v), typeof g > "u" && (g = a));
|
|
1533
1533
|
let m = 0;
|
|
1534
1534
|
for (let b = 0; b <= d; b += 1)
|
|
1535
|
-
m =
|
|
1535
|
+
m = oe(o, g, b, m), f[b] += m;
|
|
1536
1536
|
if (f[d] - m <= e && d < n && (g[d + 1] & 1 || m < 0)) {
|
|
1537
1537
|
d += 1, o.P[d] = -1, o.M[d] = 0;
|
|
1538
1538
|
let b;
|
|
@@ -1541,7 +1541,7 @@ function Ce(r, t, e) {
|
|
|
1541
1541
|
b = D === 0 ? s : D;
|
|
1542
1542
|
} else
|
|
1543
1543
|
b = s;
|
|
1544
|
-
f[d] = f[d - 1] + b - m +
|
|
1544
|
+
f[d] = f[d - 1] + b - m + oe(o, g, d, m);
|
|
1545
1545
|
} else
|
|
1546
1546
|
for (; d > 0 && f[d] >= e + s; )
|
|
1547
1547
|
d -= 1;
|
|
@@ -1553,11 +1553,11 @@ function Ce(r, t, e) {
|
|
|
1553
1553
|
}
|
|
1554
1554
|
return i;
|
|
1555
1555
|
}
|
|
1556
|
-
function
|
|
1557
|
-
const i =
|
|
1558
|
-
return
|
|
1556
|
+
function Ke(r, t, e) {
|
|
1557
|
+
const i = xe(r, t, e);
|
|
1558
|
+
return Xe(r, t, i);
|
|
1559
1559
|
}
|
|
1560
|
-
function
|
|
1560
|
+
function Te(r, t, e) {
|
|
1561
1561
|
let i = 0;
|
|
1562
1562
|
const s = [];
|
|
1563
1563
|
for (; i !== -1; )
|
|
@@ -1566,25 +1566,25 @@ function xe(r, t, e) {
|
|
|
1566
1566
|
end: i + t.length,
|
|
1567
1567
|
errors: 0
|
|
1568
1568
|
}), i += 1);
|
|
1569
|
-
return s.length > 0 ? s :
|
|
1569
|
+
return s.length > 0 ? s : Ke(r, t, e);
|
|
1570
1570
|
}
|
|
1571
|
-
function
|
|
1572
|
-
return t.length === 0 || r.length === 0 ? 0 : 1 -
|
|
1571
|
+
function ae(r, t) {
|
|
1572
|
+
return t.length === 0 || r.length === 0 ? 0 : 1 - Te(r, t, t.length)[0].errors / t.length;
|
|
1573
1573
|
}
|
|
1574
|
-
function
|
|
1574
|
+
function Ze(r, t, e = {}) {
|
|
1575
1575
|
if (t.length === 0)
|
|
1576
1576
|
return null;
|
|
1577
|
-
const i = Math.min(256, t.length / 2), s =
|
|
1577
|
+
const i = Math.min(256, t.length / 2), s = Te(r, t, i);
|
|
1578
1578
|
if (s.length === 0)
|
|
1579
1579
|
return null;
|
|
1580
1580
|
const n = (a) => {
|
|
1581
|
-
const p = 1 - a.errors / t.length, v = e.prefix ?
|
|
1581
|
+
const p = 1 - a.errors / t.length, v = e.prefix ? ae(
|
|
1582
1582
|
r.slice(
|
|
1583
1583
|
Math.max(0, a.start - e.prefix.length),
|
|
1584
1584
|
a.start
|
|
1585
1585
|
),
|
|
1586
1586
|
e.prefix
|
|
1587
|
-
) : 1, g = e.suffix ?
|
|
1587
|
+
) : 1, g = e.suffix ? ae(
|
|
1588
1588
|
r.slice(a.end, a.end + e.suffix.length),
|
|
1589
1589
|
e.suffix
|
|
1590
1590
|
) : 1;
|
|
@@ -1595,7 +1595,7 @@ function Ke(r, t, e = {}) {
|
|
|
1595
1595
|
end: a.end,
|
|
1596
1596
|
score: n(a)
|
|
1597
1597
|
}));
|
|
1598
|
-
return o.sort((a,
|
|
1598
|
+
return o.sort((a, l) => l.score - a.score), o[0];
|
|
1599
1599
|
}
|
|
1600
1600
|
function At(r, t, e) {
|
|
1601
1601
|
const i = e === 1 ? t : t - 1;
|
|
@@ -1607,7 +1607,7 @@ function At(r, t, e) {
|
|
|
1607
1607
|
const o = s.length - n.length;
|
|
1608
1608
|
return e === 2 ? t - o : t + o;
|
|
1609
1609
|
}
|
|
1610
|
-
function
|
|
1610
|
+
function le(r, t) {
|
|
1611
1611
|
const e = r.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1612
1612
|
r.commonAncestorContainer,
|
|
1613
1613
|
NodeFilter.SHOW_TEXT
|
|
@@ -1619,8 +1619,8 @@ function ae(r, t) {
|
|
|
1619
1619
|
let o = -1;
|
|
1620
1620
|
const a = () => {
|
|
1621
1621
|
if (n = t === 1 ? e.nextNode() : e.previousNode(), n) {
|
|
1622
|
-
const
|
|
1623
|
-
o = At(
|
|
1622
|
+
const l = n.textContent, u = t === 1 ? 0 : l.length;
|
|
1623
|
+
o = At(l, u, t);
|
|
1624
1624
|
}
|
|
1625
1625
|
};
|
|
1626
1626
|
for (; n && o === -1 && n !== s; )
|
|
@@ -1629,7 +1629,7 @@ function ae(r, t) {
|
|
|
1629
1629
|
return { node: n, offset: o };
|
|
1630
1630
|
throw new RangeError("No text nodes with non-whitespace text found in range");
|
|
1631
1631
|
}
|
|
1632
|
-
function
|
|
1632
|
+
function Je(r) {
|
|
1633
1633
|
if (!r.toString().trim().length)
|
|
1634
1634
|
throw new RangeError("Range contains no non-whitespace text");
|
|
1635
1635
|
if (r.startContainer.nodeType !== Node.TEXT_NODE)
|
|
@@ -1655,7 +1655,7 @@ function Ze(r) {
|
|
|
1655
1655
|
if (s.start >= 0 && (t.setStart(r.startContainer, s.start), e = !0), s.end > 0 && (t.setEnd(r.endContainer, s.end), i = !0), e && i)
|
|
1656
1656
|
return t;
|
|
1657
1657
|
if (!e) {
|
|
1658
|
-
const { node: n, offset: o } =
|
|
1658
|
+
const { node: n, offset: o } = le(
|
|
1659
1659
|
t,
|
|
1660
1660
|
1
|
|
1661
1661
|
/* Forwards */
|
|
@@ -1663,7 +1663,7 @@ function Ze(r) {
|
|
|
1663
1663
|
n && o >= 0 && t.setStart(n, o);
|
|
1664
1664
|
}
|
|
1665
1665
|
if (!i) {
|
|
1666
|
-
const { node: n, offset: o } =
|
|
1666
|
+
const { node: n, offset: o } = le(
|
|
1667
1667
|
t,
|
|
1668
1668
|
2
|
|
1669
1669
|
/* Backwards */
|
|
@@ -1672,7 +1672,7 @@ function Ze(r) {
|
|
|
1672
1672
|
}
|
|
1673
1673
|
return t;
|
|
1674
1674
|
}
|
|
1675
|
-
function
|
|
1675
|
+
function Pe(r) {
|
|
1676
1676
|
switch (r.nodeType) {
|
|
1677
1677
|
case Node.ELEMENT_NODE:
|
|
1678
1678
|
case Node.TEXT_NODE:
|
|
@@ -1681,13 +1681,13 @@ function Te(r) {
|
|
|
1681
1681
|
return 0;
|
|
1682
1682
|
}
|
|
1683
1683
|
}
|
|
1684
|
-
function
|
|
1684
|
+
function ce(r) {
|
|
1685
1685
|
let t = r.previousSibling, e = 0;
|
|
1686
1686
|
for (; t; )
|
|
1687
|
-
e +=
|
|
1687
|
+
e += Pe(t), t = t.previousSibling;
|
|
1688
1688
|
return e;
|
|
1689
1689
|
}
|
|
1690
|
-
function
|
|
1690
|
+
function Ne(r, ...t) {
|
|
1691
1691
|
let e = t.shift();
|
|
1692
1692
|
const i = r.ownerDocument.createNodeIterator(
|
|
1693
1693
|
r,
|
|
@@ -1719,7 +1719,7 @@ class M {
|
|
|
1719
1719
|
throw new Error("Parent is not an ancestor of current element");
|
|
1720
1720
|
let e = this.element, i = this.offset;
|
|
1721
1721
|
for (; e !== t; )
|
|
1722
|
-
i +=
|
|
1722
|
+
i += ce(e), e = e.parentElement;
|
|
1723
1723
|
return new M(e, i);
|
|
1724
1724
|
}
|
|
1725
1725
|
/**
|
|
@@ -1741,7 +1741,7 @@ class M {
|
|
|
1741
1741
|
*/
|
|
1742
1742
|
resolve(t = {}) {
|
|
1743
1743
|
try {
|
|
1744
|
-
return
|
|
1744
|
+
return Ne(this.element, this.offset)[0];
|
|
1745
1745
|
} catch (e) {
|
|
1746
1746
|
if (this.offset === 0 && t.direction !== void 0) {
|
|
1747
1747
|
const i = document.createTreeWalker(
|
|
@@ -1784,7 +1784,7 @@ class M {
|
|
|
1784
1784
|
throw new Error("Text node offset is out of range");
|
|
1785
1785
|
if (!t.parentElement)
|
|
1786
1786
|
throw new Error("Text node has no parent");
|
|
1787
|
-
const i =
|
|
1787
|
+
const i = ce(t) + e;
|
|
1788
1788
|
return new M(t.parentElement, i);
|
|
1789
1789
|
}
|
|
1790
1790
|
case Node.ELEMENT_NODE: {
|
|
@@ -1792,7 +1792,7 @@ class M {
|
|
|
1792
1792
|
throw new Error("Child node offset is out of range");
|
|
1793
1793
|
let i = 0;
|
|
1794
1794
|
for (let s = 0; s < e; s++)
|
|
1795
|
-
i +=
|
|
1795
|
+
i += Pe(t.childNodes[s]);
|
|
1796
1796
|
return new M(t, i);
|
|
1797
1797
|
}
|
|
1798
1798
|
default:
|
|
@@ -1826,7 +1826,7 @@ class B {
|
|
|
1826
1826
|
*/
|
|
1827
1827
|
toRange() {
|
|
1828
1828
|
let t, e;
|
|
1829
|
-
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [t, e] =
|
|
1829
|
+
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [t, e] = Ne(
|
|
1830
1830
|
this.start.element,
|
|
1831
1831
|
this.start.offset,
|
|
1832
1832
|
this.end.offset
|
|
@@ -1865,7 +1865,7 @@ class B {
|
|
|
1865
1865
|
* whitespace
|
|
1866
1866
|
*/
|
|
1867
1867
|
static trimmedRange(t) {
|
|
1868
|
-
return
|
|
1868
|
+
return Je(B.fromRange(t).toRange());
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
1871
|
class pt {
|
|
@@ -1929,7 +1929,7 @@ class mt {
|
|
|
1929
1929
|
return this.toPositionAnchor(t).toRange();
|
|
1930
1930
|
}
|
|
1931
1931
|
toPositionAnchor(t = {}) {
|
|
1932
|
-
const e = this.root.textContent, i =
|
|
1932
|
+
const e = this.root.textContent, i = Ze(e, this.exact, {
|
|
1933
1933
|
...this.context,
|
|
1934
1934
|
hint: t.hint
|
|
1935
1935
|
});
|
|
@@ -1938,7 +1938,7 @@ class mt {
|
|
|
1938
1938
|
return new pt(this.root, i.start, i.end);
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function Qe(r) {
|
|
1942
1942
|
const t = r.tagName.toUpperCase();
|
|
1943
1943
|
return t === "IMG" || t === "VIDEO" || t === "AUDIO" || t === "IFRAME" || t === "OBJECT" || t === "EMBED" || t === "CANVAS";
|
|
1944
1944
|
}
|
|
@@ -1967,7 +1967,7 @@ function nt(r, t) {
|
|
|
1967
1967
|
}
|
|
1968
1968
|
if (s) {
|
|
1969
1969
|
const n = r.createRange();
|
|
1970
|
-
return s.childNodes.length === 0 ||
|
|
1970
|
+
return s.childNodes.length === 0 || Qe(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
|
|
1971
1971
|
}
|
|
1972
1972
|
}
|
|
1973
1973
|
} catch (e) {
|
|
@@ -1975,7 +1975,7 @@ function nt(r, t) {
|
|
|
1975
1975
|
}
|
|
1976
1976
|
return null;
|
|
1977
1977
|
}
|
|
1978
|
-
function
|
|
1978
|
+
function je(r, t) {
|
|
1979
1979
|
let e = r.getClientRects();
|
|
1980
1980
|
e.length || r.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (e = r.commonAncestorContainer.getClientRects());
|
|
1981
1981
|
const i = 1, s = [];
|
|
@@ -1988,13 +1988,13 @@ function Qe(r, t) {
|
|
|
1988
1988
|
top: u.top,
|
|
1989
1989
|
width: u.width
|
|
1990
1990
|
});
|
|
1991
|
-
const n =
|
|
1991
|
+
const n = Le(
|
|
1992
1992
|
s,
|
|
1993
1993
|
i
|
|
1994
|
-
), o =
|
|
1994
|
+
), o = ei(n, i), a = Oe(o), l = 4;
|
|
1995
1995
|
for (let u = a.length - 1; u >= 0; u--) {
|
|
1996
1996
|
const d = a[u];
|
|
1997
|
-
if (!(d.width * d.height >
|
|
1997
|
+
if (!(d.width * d.height > l))
|
|
1998
1998
|
if (a.length > 1)
|
|
1999
1999
|
a.splice(u, 1);
|
|
2000
2000
|
else
|
|
@@ -2002,16 +2002,16 @@ function Qe(r, t) {
|
|
|
2002
2002
|
}
|
|
2003
2003
|
return a;
|
|
2004
2004
|
}
|
|
2005
|
-
function
|
|
2005
|
+
function Le(r, t, e) {
|
|
2006
2006
|
for (let i = 0; i < r.length; i++)
|
|
2007
2007
|
for (let s = i + 1; s < r.length; s++) {
|
|
2008
2008
|
const n = r[i], o = r[s];
|
|
2009
2009
|
if (n === o)
|
|
2010
2010
|
continue;
|
|
2011
|
-
const a = I(n.top, o.top, t) && I(n.bottom, o.bottom, t),
|
|
2012
|
-
if (a && !
|
|
2013
|
-
const f = r.filter((v) => v !== n && v !== o), p =
|
|
2014
|
-
return f.push(p),
|
|
2011
|
+
const a = I(n.top, o.top, t) && I(n.bottom, o.bottom, t), l = I(n.left, o.left, t) && I(n.right, o.right, t);
|
|
2012
|
+
if (a && !l && Re(n, o, t)) {
|
|
2013
|
+
const f = r.filter((v) => v !== n && v !== o), p = ti(n, o);
|
|
2014
|
+
return f.push(p), Le(
|
|
2015
2015
|
f,
|
|
2016
2016
|
t
|
|
2017
2017
|
);
|
|
@@ -2019,7 +2019,7 @@ function Ne(r, t, e) {
|
|
|
2019
2019
|
}
|
|
2020
2020
|
return r;
|
|
2021
2021
|
}
|
|
2022
|
-
function
|
|
2022
|
+
function ti(r, t) {
|
|
2023
2023
|
const e = Math.min(r.left, t.left), i = Math.max(r.right, t.right), s = Math.min(r.top, t.top), n = Math.max(r.bottom, t.bottom);
|
|
2024
2024
|
return {
|
|
2025
2025
|
bottom: n,
|
|
@@ -2030,7 +2030,7 @@ function je(r, t) {
|
|
|
2030
2030
|
width: i - e
|
|
2031
2031
|
};
|
|
2032
2032
|
}
|
|
2033
|
-
function
|
|
2033
|
+
function ei(r, t) {
|
|
2034
2034
|
const e = new Set(r);
|
|
2035
2035
|
for (const i of r) {
|
|
2036
2036
|
if (!(i.width > 1 && i.height > 1)) {
|
|
@@ -2038,40 +2038,40 @@ function ti(r, t) {
|
|
|
2038
2038
|
continue;
|
|
2039
2039
|
}
|
|
2040
2040
|
for (const n of r)
|
|
2041
|
-
if (i !== n && e.has(n) &&
|
|
2041
|
+
if (i !== n && e.has(n) && ii(n, i, t)) {
|
|
2042
2042
|
e.delete(i);
|
|
2043
2043
|
break;
|
|
2044
2044
|
}
|
|
2045
2045
|
}
|
|
2046
2046
|
return Array.from(e);
|
|
2047
2047
|
}
|
|
2048
|
-
function
|
|
2048
|
+
function ii(r, t, e) {
|
|
2049
2049
|
return at(r, t.left, t.top, e) && at(r, t.right, t.top, e) && at(r, t.left, t.bottom, e) && at(r, t.right, t.bottom, e);
|
|
2050
2050
|
}
|
|
2051
2051
|
function at(r, t, e, i) {
|
|
2052
2052
|
return (r.left < t || I(r.left, t, i)) && (r.right > t || I(r.right, t, i)) && (r.top < e || I(r.top, e, i)) && (r.bottom > e || I(r.bottom, e, i));
|
|
2053
2053
|
}
|
|
2054
|
-
function
|
|
2054
|
+
function Oe(r) {
|
|
2055
2055
|
for (let t = 0; t < r.length; t++)
|
|
2056
2056
|
for (let e = t + 1; e < r.length; e++) {
|
|
2057
2057
|
const i = r[t], s = r[e];
|
|
2058
|
-
if (i !== s &&
|
|
2058
|
+
if (i !== s && Re(i, s, -1)) {
|
|
2059
2059
|
let n = [], o;
|
|
2060
|
-
const a =
|
|
2060
|
+
const a = he(i, s);
|
|
2061
2061
|
if (a.length === 1)
|
|
2062
2062
|
n = a, o = i;
|
|
2063
2063
|
else {
|
|
2064
|
-
const u =
|
|
2064
|
+
const u = he(s, i);
|
|
2065
2065
|
a.length < u.length ? (n = a, o = i) : (n = u, o = s);
|
|
2066
2066
|
}
|
|
2067
|
-
const
|
|
2068
|
-
return Array.prototype.push.apply(
|
|
2067
|
+
const l = r.filter((u) => u !== o);
|
|
2068
|
+
return Array.prototype.push.apply(l, n), Oe(l);
|
|
2069
2069
|
}
|
|
2070
2070
|
}
|
|
2071
2071
|
return r;
|
|
2072
2072
|
}
|
|
2073
|
-
function
|
|
2074
|
-
const e =
|
|
2073
|
+
function he(r, t) {
|
|
2074
|
+
const e = si(t, r);
|
|
2075
2075
|
if (e.height === 0 || e.width === 0)
|
|
2076
2076
|
return [r];
|
|
2077
2077
|
const i = [];
|
|
@@ -2121,7 +2121,7 @@ function ce(r, t) {
|
|
|
2121
2121
|
}
|
|
2122
2122
|
return i;
|
|
2123
2123
|
}
|
|
2124
|
-
function
|
|
2124
|
+
function si(r, t) {
|
|
2125
2125
|
const e = Math.max(r.left, t.left), i = Math.min(r.right, t.right), s = Math.max(r.top, t.top), n = Math.min(r.bottom, t.bottom);
|
|
2126
2126
|
return {
|
|
2127
2127
|
bottom: n,
|
|
@@ -2132,7 +2132,7 @@ function ii(r, t) {
|
|
|
2132
2132
|
width: Math.max(0, i - e)
|
|
2133
2133
|
};
|
|
2134
2134
|
}
|
|
2135
|
-
function
|
|
2135
|
+
function Re(r, t, e) {
|
|
2136
2136
|
return (r.left < t.right || e >= 0 && I(r.left, t.right, e)) && (t.left < r.right || e >= 0 && I(t.left, r.right, e)) && (r.top < t.bottom || e >= 0 && I(r.top, t.bottom, e)) && (t.top < r.bottom || e >= 0 && I(t.top, r.bottom, e));
|
|
2137
2137
|
}
|
|
2138
2138
|
function I(r, t, e) {
|
|
@@ -2144,7 +2144,7 @@ function Vt(r) {
|
|
|
2144
2144
|
Object.hasOwn(e, i) && !Number.isNaN(Number.parseInt(i)) && (t[e[i]] = e.getPropertyValue(e[i]));
|
|
2145
2145
|
return t;
|
|
2146
2146
|
}
|
|
2147
|
-
function
|
|
2147
|
+
function De(r, t) {
|
|
2148
2148
|
const e = Vt(r);
|
|
2149
2149
|
Object.keys(e).forEach((i) => {
|
|
2150
2150
|
t.hasOwnProperty(i) || gt(r, i);
|
|
@@ -2162,7 +2162,7 @@ function gt(r, t) {
|
|
|
2162
2162
|
r.document.documentElement.style.removeProperty(t);
|
|
2163
2163
|
}
|
|
2164
2164
|
let lt = null, St = null, J = 0;
|
|
2165
|
-
const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(),
|
|
2165
|
+
const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(), ni = () => {
|
|
2166
2166
|
if (!lt)
|
|
2167
2167
|
if (typeof OffscreenCanvas < "u")
|
|
2168
2168
|
lt = new OffscreenCanvas(5, 5), St = lt.getContext("2d", {
|
|
@@ -2177,7 +2177,7 @@ const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(), si =
|
|
|
2177
2177
|
});
|
|
2178
2178
|
}
|
|
2179
2179
|
return St;
|
|
2180
|
-
},
|
|
2180
|
+
}, ri = (r) => {
|
|
2181
2181
|
if (!r) return !0;
|
|
2182
2182
|
const t = r.trim().toLowerCase();
|
|
2183
2183
|
return t.startsWith("var(") || [
|
|
@@ -2204,9 +2204,9 @@ const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(), si =
|
|
|
2204
2204
|
const e = t ? `${r}|${t}` : r, i = F.get(e);
|
|
2205
2205
|
if (i !== void 0)
|
|
2206
2206
|
return i ?? G;
|
|
2207
|
-
if (
|
|
2207
|
+
if (ri(r))
|
|
2208
2208
|
return ct(r, "Unsupported color format or special value."), F.set(e, null), G;
|
|
2209
|
-
const s =
|
|
2209
|
+
const s = ni();
|
|
2210
2210
|
if (!s)
|
|
2211
2211
|
return ct(r, "Could not get canvas context."), F.set(e, null), G;
|
|
2212
2212
|
try {
|
|
@@ -2215,10 +2215,10 @@ const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(), si =
|
|
|
2215
2215
|
s.clearRect(n, o, 1, 1), t && (s.fillStyle = t, s.fillRect(n, o, 1, 1)), s.fillStyle = r, s.fillRect(n, o, 1, 1);
|
|
2216
2216
|
const a = s.getImageData(n, o, 1, 1);
|
|
2217
2217
|
J = (J + 1) % 25;
|
|
2218
|
-
const [
|
|
2218
|
+
const [l, u, d, f] = a.data;
|
|
2219
2219
|
if (f === 0)
|
|
2220
2220
|
return ct(r, "Fully transparent color."), F.set(e, null), G;
|
|
2221
|
-
const p = { r:
|
|
2221
|
+
const p = { r: l, g: u, b: d, a: f / 255 };
|
|
2222
2222
|
return F.set(e, p), p;
|
|
2223
2223
|
} catch (n) {
|
|
2224
2224
|
return ct(r, `Error: ${n instanceof Error ? n.message : String(n)}`), F.set(e, null), G;
|
|
@@ -2226,26 +2226,26 @@ const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(), si =
|
|
|
2226
2226
|
}, Et = (r) => {
|
|
2227
2227
|
const t = r / 255;
|
|
2228
2228
|
return t <= 0.03928 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4);
|
|
2229
|
-
},
|
|
2229
|
+
}, de = (r) => {
|
|
2230
2230
|
const t = Et(r.r), e = Et(r.g), i = Et(r.b);
|
|
2231
2231
|
return 0.2126 * t + 0.7152 * e + 0.0722 * i;
|
|
2232
|
-
},
|
|
2233
|
-
const e = typeof r == "string" ? Ct(r) : r, i = typeof t == "string" ? Ct(t) : t, s =
|
|
2232
|
+
}, ue = (r, t) => {
|
|
2233
|
+
const e = typeof r == "string" ? Ct(r) : r, i = typeof t == "string" ? Ct(t) : t, s = de(e), n = de(i), o = Math.max(s, n), a = Math.min(s, n);
|
|
2234
2234
|
return (o + 0.05) / (a + 0.05);
|
|
2235
2235
|
}, xt = (r, t = null) => {
|
|
2236
|
-
const e = Ct(r, t), i =
|
|
2236
|
+
const e = Ct(r, t), i = ue(e, { r: 255, g: 255, b: 255, a: 1 }), s = ue(e, { r: 0, g: 0, b: 0, a: 1 });
|
|
2237
2237
|
return i > s;
|
|
2238
|
-
},
|
|
2239
|
-
var
|
|
2240
|
-
const
|
|
2241
|
-
class
|
|
2238
|
+
}, oi = (r, t = null) => xt(r, t) ? "white" : "black", pe = "#FFFF00";
|
|
2239
|
+
var ai = /* @__PURE__ */ ((r) => (r.Wrap = "wrap", r.Viewport = "viewport", r.Bounds = "bounds", r.Page = "page", r))(ai || {}), li = /* @__PURE__ */ ((r) => (r.Boxes = "boxes", r.Bounds = "bounds", r))(li || {});
|
|
2240
|
+
const ci = () => "Highlight" in window, me = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2241
|
+
class hi {
|
|
2242
2242
|
/**
|
|
2243
2243
|
* Creates a DecorationGroup object
|
|
2244
2244
|
* @param id Unique HTML ID-adhering name of the group
|
|
2245
2245
|
* @param name Human-readable name of the group
|
|
2246
2246
|
*/
|
|
2247
2247
|
constructor(t, e, i, s) {
|
|
2248
|
-
this.wnd = t, this.comms = e, this.id = i, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0,
|
|
2248
|
+
this.wnd = t, this.comms = e, this.id = i, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, ci() && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
|
|
2249
2249
|
}
|
|
2250
2250
|
get activeable() {
|
|
2251
2251
|
return this.activateable;
|
|
@@ -2264,7 +2264,7 @@ class ci {
|
|
|
2264
2264
|
return;
|
|
2265
2265
|
}
|
|
2266
2266
|
const s = i.commonAncestorContainer;
|
|
2267
|
-
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (
|
|
2267
|
+
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (me.includes(s.nodeName.toUpperCase()) && this.notTextFlag?.set(e, !0), i.cloneContents().querySelector(me.join(", ").toLowerCase()) && this.notTextFlag?.set(e, !0), (s.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(e, !0));
|
|
2268
2268
|
const n = {
|
|
2269
2269
|
decoration: t,
|
|
2270
2270
|
id: e,
|
|
@@ -2305,10 +2305,10 @@ class ci {
|
|
|
2305
2305
|
experimentalLayout(t) {
|
|
2306
2306
|
const [e, i] = this.requireContainer(!0);
|
|
2307
2307
|
i.add(t.range);
|
|
2308
|
-
const s = wt(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"), n = t.decoration?.style?.tint ??
|
|
2308
|
+
const s = wt(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"), n = t.decoration?.style?.tint ?? pe;
|
|
2309
2309
|
e.innerHTML = `
|
|
2310
2310
|
::highlight(${this.id}) {
|
|
2311
|
-
color: ${
|
|
2311
|
+
color: ${oi(n, s)};
|
|
2312
2312
|
background-color: ${n};
|
|
2313
2313
|
}`;
|
|
2314
2314
|
}
|
|
@@ -2325,19 +2325,19 @@ class ci {
|
|
|
2325
2325
|
getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
|
|
2326
2326
|
"column-count"
|
|
2327
2327
|
)
|
|
2328
|
-
), n = i / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft,
|
|
2328
|
+
), n = i / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, l = o.scrollTop, u = (g, m, b) => {
|
|
2329
2329
|
if (g.style.position = "absolute", t.decoration?.style?.width === "viewport") {
|
|
2330
2330
|
g.style.width = `${i}px`, g.style.height = `${m.height}px`;
|
|
2331
2331
|
let D = Math.floor(m.left / i) * i;
|
|
2332
|
-
g.style.left = `${D + a}px`, g.style.top = `${m.top +
|
|
2332
|
+
g.style.left = `${D + a}px`, g.style.top = `${m.top + l}px`;
|
|
2333
2333
|
} else if (t.decoration?.style?.width === "bounds")
|
|
2334
|
-
g.style.width = `${b.width}px`, g.style.height = `${m.height}px`, g.style.left = `${b.left + a}px`, g.style.top = `${m.top +
|
|
2334
|
+
g.style.width = `${b.width}px`, g.style.height = `${m.height}px`, g.style.left = `${b.left + a}px`, g.style.top = `${m.top + l}px`;
|
|
2335
2335
|
else if (t.decoration?.style?.width === "page") {
|
|
2336
2336
|
g.style.width = `${n}px`, g.style.height = `${m.height}px`;
|
|
2337
2337
|
let D = Math.floor(m.left / n) * n;
|
|
2338
|
-
g.style.left = `${D + a}px`, g.style.top = `${m.top +
|
|
2338
|
+
g.style.left = `${D + a}px`, g.style.top = `${m.top + l}px`;
|
|
2339
2339
|
} else
|
|
2340
|
-
g.style.width = `${m.width}px`, g.style.height = `${m.height}px`, g.style.left = `${m.left + a}px`, g.style.top = `${m.top +
|
|
2340
|
+
g.style.width = `${m.width}px`, g.style.height = `${m.height}px`, g.style.left = `${m.left + a}px`, g.style.top = `${m.top + l}px`;
|
|
2341
2341
|
}, d = t.range.getBoundingClientRect();
|
|
2342
2342
|
let f = this.wnd.document.createElement("template");
|
|
2343
2343
|
const p = this.getCurrentDarkMode();
|
|
@@ -2346,7 +2346,7 @@ class ci {
|
|
|
2346
2346
|
data-readium="true"
|
|
2347
2347
|
class="readium-highlight"
|
|
2348
2348
|
style="${[
|
|
2349
|
-
`background-color: ${t.decoration?.style?.tint ??
|
|
2349
|
+
`background-color: ${t.decoration?.style?.tint ?? pe} !important`,
|
|
2350
2350
|
//"opacity: 0.3 !important",
|
|
2351
2351
|
`mix-blend-mode: ${p ? "exclusion" : "multiply"} !important`,
|
|
2352
2352
|
"opacity: 1 !important",
|
|
@@ -2360,7 +2360,7 @@ class ci {
|
|
|
2360
2360
|
const g = v.cloneNode(!0);
|
|
2361
2361
|
g.style.setProperty("pointer-events", "none"), u(g, d, d), e.append(g);
|
|
2362
2362
|
} else {
|
|
2363
|
-
let g =
|
|
2363
|
+
let g = je(
|
|
2364
2364
|
t.range
|
|
2365
2365
|
);
|
|
2366
2366
|
g = g.sort((m, b) => m.top < b.top ? -1 : m.top > b.top ? 1 : 0);
|
|
@@ -2429,7 +2429,7 @@ const j = class j extends K {
|
|
|
2429
2429
|
mount(t, e) {
|
|
2430
2430
|
return this.wnd = t, e.register("decorate", j.moduleName, (i, s) => {
|
|
2431
2431
|
const n = i;
|
|
2432
|
-
n.decoration && n.decoration.locator && (n.decoration.locator = k.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new
|
|
2432
|
+
n.decoration && n.decoration.locator && (n.decoration.locator = k.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new hi(
|
|
2433
2433
|
t,
|
|
2434
2434
|
e,
|
|
2435
2435
|
`readium-decoration-${this.lastGroupId++}`,
|
|
@@ -2454,7 +2454,7 @@ const j = class j extends K {
|
|
|
2454
2454
|
}), this.resizeObserver = new ResizeObserver(() => t.requestAnimationFrame(() => this.handleResize())), this.resizeObserver.observe(t.document.body), t.addEventListener("orientationchange", this.handleResizer), t.addEventListener("resize", this.handleResizer), this.backgroundObserver = new MutationObserver((i) => {
|
|
2455
2455
|
i.some((n) => {
|
|
2456
2456
|
if (n.type === "attributes" && n.attributeName === "style") {
|
|
2457
|
-
const o = n.target, a = n.oldValue,
|
|
2457
|
+
const o = n.target, a = n.oldValue, l = o.getAttribute("style"), u = this.extractCustomProperty(a, "--USER__appearance"), d = this.extractCustomProperty(l, "--USER__appearance"), f = this.extractCustomProperty(a, "--USER__backgroundColor"), p = this.extractCustomProperty(l, "--USER__backgroundColor");
|
|
2458
2458
|
return u !== d || f !== p;
|
|
2459
2459
|
}
|
|
2460
2460
|
return !1;
|
|
@@ -2472,7 +2472,7 @@ const j = class j extends K {
|
|
|
2472
2472
|
};
|
|
2473
2473
|
j.moduleName = "decorator";
|
|
2474
2474
|
let Tt = j;
|
|
2475
|
-
const
|
|
2475
|
+
const fe = "readium-snapper-style", tt = class tt extends K {
|
|
2476
2476
|
constructor() {
|
|
2477
2477
|
super(...arguments), this.protected = !1;
|
|
2478
2478
|
}
|
|
@@ -2485,63 +2485,64 @@ const me = "readium-snapper-style", tt = class tt extends K {
|
|
|
2485
2485
|
}
|
|
2486
2486
|
mount(t, e) {
|
|
2487
2487
|
const i = t.document.createElement("style");
|
|
2488
|
-
return i.dataset.readium = "true", i.id =
|
|
2488
|
+
return i.dataset.readium = "true", i.id = fe, i.textContent = this.buildStyles(), t.document.head.appendChild(i), e.register("protect", tt.moduleName, (s, n) => {
|
|
2489
2489
|
this.protected = !0, i.textContent = this.buildStyles(), n(!0);
|
|
2490
2490
|
}), e.register("unprotect", tt.moduleName, (s, n) => {
|
|
2491
2491
|
this.protected = !1, i.textContent = this.buildStyles(), n(!0);
|
|
2492
2492
|
}), e.log("Snapper Mounted"), !0;
|
|
2493
2493
|
}
|
|
2494
2494
|
unmount(t, e) {
|
|
2495
|
-
return t.document.getElementById(
|
|
2495
|
+
return t.document.getElementById(fe)?.remove(), e.log("Snapper Unmounted"), !0;
|
|
2496
2496
|
}
|
|
2497
2497
|
};
|
|
2498
2498
|
tt.moduleName = "snapper";
|
|
2499
2499
|
let X = tt;
|
|
2500
|
-
function
|
|
2500
|
+
function di(r) {
|
|
2501
2501
|
return (r.document.documentElement.dir || r.document.body.dir).toLowerCase() === "rtl";
|
|
2502
2502
|
}
|
|
2503
|
-
function
|
|
2503
|
+
function ui(r) {
|
|
2504
2504
|
return (r.getComputedStyle(r.document.documentElement).writingMode || r.getComputedStyle(r.document.body).writingMode) === "vertical-lr";
|
|
2505
2505
|
}
|
|
2506
|
-
function
|
|
2506
|
+
function Ie(r) {
|
|
2507
2507
|
return parseInt(
|
|
2508
2508
|
r.getComputedStyle(
|
|
2509
2509
|
r.document.documentElement
|
|
2510
2510
|
).getPropertyValue("column-count")
|
|
2511
2511
|
);
|
|
2512
2512
|
}
|
|
2513
|
-
function
|
|
2513
|
+
function ge(r) {
|
|
2514
2514
|
const t = getComputedStyle(r), e = parseFloat(t.paddingTop || "0"), i = parseFloat(t.paddingBottom || "0");
|
|
2515
2515
|
return r.clientHeight - e - i;
|
|
2516
2516
|
}
|
|
2517
|
-
function
|
|
2518
|
-
const t =
|
|
2517
|
+
function ye(r) {
|
|
2518
|
+
const t = Ie(r);
|
|
2519
2519
|
if (!t)
|
|
2520
2520
|
return !1;
|
|
2521
2521
|
const e = r.document.querySelectorAll("div[id^='readium-virtual-page']");
|
|
2522
2522
|
for (const u of e)
|
|
2523
2523
|
u.remove();
|
|
2524
|
-
const i = e.length, s = r.document.scrollingElement.scrollWidth, n = r.visualViewport.width, a = Math.round(s / n * t) % t,
|
|
2525
|
-
if (
|
|
2526
|
-
for (let u = 0; u <
|
|
2524
|
+
const i = e.length, s = r.document.scrollingElement.scrollWidth, n = r.visualViewport.width, a = Math.round(s / n * t) % t, l = t === 1 || a === 0 ? 0 : t - a;
|
|
2525
|
+
if (l > 0)
|
|
2526
|
+
for (let u = 0; u < l; u++) {
|
|
2527
2527
|
const d = r.document.createElement("div");
|
|
2528
|
-
d.setAttribute("id", `readium-virtual-page-${u}`), d.dataset.readium = "true", CSS.supports("break-before", "column") ? d.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (d.style.breakInside = "avoid-column"), d.style.height =
|
|
2528
|
+
d.setAttribute("id", `readium-virtual-page-${u}`), d.dataset.readium = "true", CSS.supports("break-before", "column") ? d.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (d.style.breakInside = "avoid-column"), d.style.height = ge(r.document.documentElement) + "px"), d.innerHTML = "​", r.document.body.appendChild(d);
|
|
2529
2529
|
}
|
|
2530
|
-
return i !==
|
|
2530
|
+
return i !== l;
|
|
2531
2531
|
}
|
|
2532
2532
|
function Ft(r) {
|
|
2533
2533
|
const t = r.document.createElement("style");
|
|
2534
2534
|
t.appendChild(r.document.createTextNode("*{}")), r.document.body.appendChild(t), r.document.body.removeChild(t);
|
|
2535
2535
|
}
|
|
2536
|
-
function
|
|
2536
|
+
function pi(r) {
|
|
2537
2537
|
return r < 0.5 ? 2 * r * r : -1 + (4 - 2 * r) * r;
|
|
2538
2538
|
}
|
|
2539
2539
|
function A(r) {
|
|
2540
2540
|
const t = r.getSelection();
|
|
2541
2541
|
t && t.removeAllRanges();
|
|
2542
2542
|
}
|
|
2543
|
-
const
|
|
2543
|
+
const mi = [
|
|
2544
2544
|
"a",
|
|
2545
|
+
"area",
|
|
2545
2546
|
"audio",
|
|
2546
2547
|
"button",
|
|
2547
2548
|
"canvas",
|
|
@@ -2553,12 +2554,18 @@ const pi = [
|
|
|
2553
2554
|
"submit",
|
|
2554
2555
|
"textarea",
|
|
2555
2556
|
"video"
|
|
2556
|
-
];
|
|
2557
|
-
function
|
|
2558
|
-
return
|
|
2557
|
+
], fi = ["dialog", "radiogroup", "radio", "menu", "menuitem"];
|
|
2558
|
+
function Gt(r) {
|
|
2559
|
+
return gi(r) ? null : ze(r) ? r : r.parentElement ? Gt(r.parentElement) : null;
|
|
2560
|
+
}
|
|
2561
|
+
function gi(r) {
|
|
2562
|
+
return r ? r.closest("[inert]") !== null || r.hasAttribute("disabled") : !0;
|
|
2563
|
+
}
|
|
2564
|
+
function ze(r) {
|
|
2565
|
+
return r ? r.role && fi.includes(r.role) || r.tabIndex >= 0 ? !0 : mi.includes(r.nodeName.toLowerCase()) || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" : !1;
|
|
2559
2566
|
}
|
|
2560
2567
|
function yt(r, t) {
|
|
2561
|
-
const e =
|
|
2568
|
+
const e = Me(r, r.document.body, t), i = r._readium_cssSelectorGenerator.getCssSelector(e, {
|
|
2562
2569
|
selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
|
|
2563
2570
|
});
|
|
2564
2571
|
return new k({
|
|
@@ -2574,15 +2581,15 @@ function yt(r, t) {
|
|
|
2574
2581
|
})
|
|
2575
2582
|
});
|
|
2576
2583
|
}
|
|
2577
|
-
function
|
|
2584
|
+
function Me(r, t, e) {
|
|
2578
2585
|
for (var i = 0; i < t.children.length; i++) {
|
|
2579
2586
|
const s = t.children[i];
|
|
2580
|
-
if (!
|
|
2581
|
-
return
|
|
2587
|
+
if (!vi(s) && yi(r, s, e))
|
|
2588
|
+
return bi(r, s) ? s : Me(r, s, e);
|
|
2582
2589
|
}
|
|
2583
2590
|
return t;
|
|
2584
2591
|
}
|
|
2585
|
-
function
|
|
2592
|
+
function yi(r, t, e) {
|
|
2586
2593
|
if (t === document.body || t === document.documentElement)
|
|
2587
2594
|
return !0;
|
|
2588
2595
|
if (!document || !document.documentElement || !document.body)
|
|
@@ -2590,11 +2597,11 @@ function mi(r, t, e) {
|
|
|
2590
2597
|
const i = t.getBoundingClientRect();
|
|
2591
2598
|
return e ? i.bottom > 0 && i.top < r.innerHeight : i.right > 0 && i.left < r.innerWidth;
|
|
2592
2599
|
}
|
|
2593
|
-
function
|
|
2600
|
+
function bi(r, t) {
|
|
2594
2601
|
const e = t.getBoundingClientRect();
|
|
2595
2602
|
return e.top >= 0 && e.left >= 0 && e.bottom <= r.innerHeight && e.right <= r.innerWidth;
|
|
2596
2603
|
}
|
|
2597
|
-
function
|
|
2604
|
+
function vi(r) {
|
|
2598
2605
|
const t = getComputedStyle(r);
|
|
2599
2606
|
if (t) {
|
|
2600
2607
|
const e = t.getPropertyValue("display");
|
|
@@ -2603,7 +2610,7 @@ function gi(r) {
|
|
|
2603
2610
|
}
|
|
2604
2611
|
return !1;
|
|
2605
2612
|
}
|
|
2606
|
-
const
|
|
2613
|
+
const wi = {
|
|
2607
2614
|
maxVelocity: 200,
|
|
2608
2615
|
// Reasonable default for human-like scrolling (pixels/ms)
|
|
2609
2616
|
minVariance: 0.01,
|
|
@@ -2614,7 +2621,7 @@ const yi = {
|
|
|
2614
2621
|
// Reasonable default for detecting patterns
|
|
2615
2622
|
maxConsistentScrolls: 15
|
|
2616
2623
|
// Balanced threshold for flagging
|
|
2617
|
-
},
|
|
2624
|
+
}, $t = {
|
|
2618
2625
|
maxVelocity: 200,
|
|
2619
2626
|
// Extremely fast scrolling (pixels/ms)
|
|
2620
2627
|
minVariance: 1e-5,
|
|
@@ -2625,11 +2632,11 @@ const yi = {
|
|
|
2625
2632
|
// Only trigger on near-perfect patterns
|
|
2626
2633
|
maxConsistentScrolls: 20
|
|
2627
2634
|
// Need many consistent scrolls
|
|
2628
|
-
},
|
|
2635
|
+
}, ke = {
|
|
2629
2636
|
maxSelectionsPerSecond: 500,
|
|
2630
2637
|
minVariance: 50,
|
|
2631
2638
|
historySize: 20
|
|
2632
|
-
},
|
|
2639
|
+
}, Si = {
|
|
2633
2640
|
enabled: !0,
|
|
2634
2641
|
maxSelectionPercent: 0.1,
|
|
2635
2642
|
minThreshold: 100,
|
|
@@ -2638,7 +2645,7 @@ const yi = {
|
|
|
2638
2645
|
};
|
|
2639
2646
|
class bt {
|
|
2640
2647
|
constructor(t = {}) {
|
|
2641
|
-
this.history = [], this.consistentScrollCount = 0, this.options = { ...
|
|
2648
|
+
this.history = [], this.consistentScrollCount = 0, this.options = { ...wi, ...t };
|
|
2642
2649
|
}
|
|
2643
2650
|
analyze(t, e, i) {
|
|
2644
2651
|
if (i <= 0) return !1;
|
|
@@ -2651,7 +2658,7 @@ class bt {
|
|
|
2651
2658
|
}), this.history = this.history.filter((m) => n - m.timestamp < 2e3).slice(-(this.options.historySize || 20)), this.history.length < 3) return !1;
|
|
2652
2659
|
if (s > this.options.maxVelocity)
|
|
2653
2660
|
return this.resetAfterDetection(), !0;
|
|
2654
|
-
const o = this.history.map((m) => m.velocity), a = this.history.map((m) => m.distance),
|
|
2661
|
+
const o = this.history.map((m) => m.velocity), a = this.history.map((m) => m.distance), l = o.reduce((m, b) => m + b, 0) / o.length, u = a.reduce((m, b) => m + b, 0) / a.length, d = o.reduce((m, b) => m + Math.pow(b - l, 2), 0) / o.length, f = a.reduce((m, b) => m + Math.pow(b - u, 2), 0) / a.length;
|
|
2655
2662
|
if (d < this.options.minVariance && f < u * 0.1) {
|
|
2656
2663
|
if (this.consistentScrollCount++, this.consistentScrollCount >= (this.options.maxConsistentScrolls || 10))
|
|
2657
2664
|
return this.resetAfterDetection(), !0;
|
|
@@ -2669,7 +2676,7 @@ class bt {
|
|
|
2669
2676
|
this.history = [], this.consistentScrollCount = 0;
|
|
2670
2677
|
}
|
|
2671
2678
|
}
|
|
2672
|
-
const
|
|
2679
|
+
const be = "readium-column-snapper-style", Ei = 200, T = class T extends X {
|
|
2673
2680
|
constructor() {
|
|
2674
2681
|
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);
|
|
2675
2682
|
}
|
|
@@ -2725,10 +2732,10 @@ const ye = "readium-column-snapper-style", vi = 200, T = class T extends X {
|
|
|
2725
2732
|
}
|
|
2726
2733
|
// Snaps the current offset to the page width.
|
|
2727
2734
|
snapCurrentOffset(t = !1, e = !1) {
|
|
2728
|
-
const i = this.doc(), s =
|
|
2735
|
+
const i = this.doc(), s = Ie(this.wnd), n = this.cachedScrollWidth - this.wnd.innerWidth, o = Math.min(Math.max(0, this.normScroll()), n), a = this.dragOffset(), l = this.rtl ? -a : a, u = this.wnd.innerWidth / 3 * (l > 0 ? 2 : 1), d = Math.min(n, Math.max(0, this.snapNormOffset(o + u))), f = this.rtl ? -d : d, p = this.rtl ? -o : o, v = f > p ? "right" : "left";
|
|
2729
2736
|
if (this.checkSuspiciousSnap(v, Math.abs(f - p)), t && f !== p) {
|
|
2730
2737
|
this.snappingCancelled = !1;
|
|
2731
|
-
const g = (_, V, rt, ot) => rt > ot ? V : _ + (V - _) *
|
|
2738
|
+
const g = (_, V, rt, ot) => rt > ot ? V : _ + (V - _) * pi(rt / ot), m = Ei * s;
|
|
2732
2739
|
let b;
|
|
2733
2740
|
const D = (_) => {
|
|
2734
2741
|
if (this.snappingCancelled) return;
|
|
@@ -2802,10 +2809,10 @@ const ye = "readium-column-snapper-style", vi = 200, T = class T extends X {
|
|
|
2802
2809
|
});
|
|
2803
2810
|
}
|
|
2804
2811
|
mount(t, e) {
|
|
2805
|
-
if (this.wnd = t, this.comms = e, this.rtl =
|
|
2812
|
+
if (this.wnd = t, this.comms = e, this.rtl = di(t), !super.mount(t, e)) return !1;
|
|
2806
2813
|
t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "paginated");
|
|
2807
2814
|
const i = t.document.createElement("style");
|
|
2808
|
-
i.dataset.readium = "true", i.id =
|
|
2815
|
+
i.dataset.readium = "true", i.id = be, i.textContent = `
|
|
2809
2816
|
@keyframes readium-bounce-l-animation {
|
|
2810
2817
|
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2811
2818
|
50% {transform: translate3d(-50px, 0, 0);}
|
|
@@ -2841,14 +2848,14 @@ const ye = "readium-column-snapper-style", vi = 200, T = class T extends X {
|
|
|
2841
2848
|
}
|
|
2842
2849
|
`, t.document.head.appendChild(i), this.resizeObserver = new ResizeObserver(() => {
|
|
2843
2850
|
t.requestAnimationFrame(() => {
|
|
2844
|
-
t &&
|
|
2851
|
+
t && ye(t);
|
|
2845
2852
|
}), this.onWidthChange();
|
|
2846
2853
|
}), this.resizeObserver.observe(t.document.body), this.mutationObserver = new MutationObserver((o) => {
|
|
2847
2854
|
for (const a of o)
|
|
2848
2855
|
if (a.target === this.wnd.document.documentElement) {
|
|
2849
|
-
const
|
|
2856
|
+
const l = a.oldValue, u = a.target.getAttribute("style"), d = /transform\s*:\s*([^;]+)/, f = l?.match(d), p = u?.match(d);
|
|
2850
2857
|
(!f && !p || f && !p || f && p && f[1] !== p[1]) && (t.requestAnimationFrame(() => {
|
|
2851
|
-
t &&
|
|
2858
|
+
t && ye(t);
|
|
2852
2859
|
}), this.onWidthChange());
|
|
2853
2860
|
} else
|
|
2854
2861
|
t.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
@@ -2859,12 +2866,12 @@ const ye = "readium-column-snapper-style", vi = 200, T = class T extends X {
|
|
|
2859
2866
|
const a = this.doc().scrollLeft;
|
|
2860
2867
|
return this.doc().scrollLeft = this.snapOffset(o), a !== this.doc().scrollLeft;
|
|
2861
2868
|
}, n = (o) => {
|
|
2862
|
-
const a = this.doc().scrollLeft,
|
|
2863
|
-
return this.doc().scrollLeft = -
|
|
2869
|
+
const a = this.doc().scrollLeft, l = this.snapNormOffset(Math.max(0, Math.min(this.cachedScrollWidth - t.innerWidth, o)));
|
|
2870
|
+
return this.doc().scrollLeft = -l, a !== this.doc().scrollLeft;
|
|
2864
2871
|
};
|
|
2865
2872
|
return t.addEventListener("orientationchange", this.onWidthChanger), t.addEventListener("resize", this.onWidthChanger), t.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth), e.register("go_progression", T.moduleName, (o, a) => {
|
|
2866
|
-
const
|
|
2867
|
-
if (
|
|
2873
|
+
const l = o;
|
|
2874
|
+
if (l < 0 || l > 1) {
|
|
2868
2875
|
e.send("error", {
|
|
2869
2876
|
message: "go_progression must be given a position from 0.0 to 1.0"
|
|
2870
2877
|
}), a(!1);
|
|
@@ -2872,28 +2879,28 @@ const ye = "readium-column-snapper-style", vi = 200, T = class T extends X {
|
|
|
2872
2879
|
}
|
|
2873
2880
|
this.wnd.requestAnimationFrame(() => {
|
|
2874
2881
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2875
|
-
const d = (this.cachedScrollWidth - t.innerWidth) *
|
|
2882
|
+
const d = (this.cachedScrollWidth - t.innerWidth) * l;
|
|
2876
2883
|
this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(d) : this.doc().scrollLeft = this.snapOffset(d), this.reportProgress(), A(this.wnd), a(!0);
|
|
2877
2884
|
});
|
|
2878
2885
|
}), e.register("go_id", T.moduleName, (o, a) => {
|
|
2879
|
-
const
|
|
2880
|
-
if (!
|
|
2886
|
+
const l = t.document.getElementById(o);
|
|
2887
|
+
if (!l) {
|
|
2881
2888
|
a(!1);
|
|
2882
2889
|
return;
|
|
2883
2890
|
}
|
|
2884
2891
|
this.wnd.requestAnimationFrame(() => {
|
|
2885
|
-
this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(
|
|
2892
|
+
this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(l.getBoundingClientRect().left + t.scrollX) : this.doc().scrollLeft = this.snapOffset(l.getBoundingClientRect().left + t.scrollX), this.reportProgress(), A(this.wnd), a(!0);
|
|
2886
2893
|
});
|
|
2887
2894
|
}), e.register("go_text", T.moduleName, (o, a) => {
|
|
2888
|
-
let
|
|
2889
|
-
Array.isArray(o) && (o.length > 1 && (
|
|
2895
|
+
let l;
|
|
2896
|
+
Array.isArray(o) && (o.length > 1 && (l = o[1]), o = o[0]);
|
|
2890
2897
|
const u = H.deserialize(o), d = nt(this.wnd.document, new k({
|
|
2891
2898
|
href: t.location.href,
|
|
2892
2899
|
type: "text/html",
|
|
2893
2900
|
text: u,
|
|
2894
|
-
locations:
|
|
2901
|
+
locations: l ? new C({
|
|
2895
2902
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2896
|
-
["cssSelector",
|
|
2903
|
+
["cssSelector", l]
|
|
2897
2904
|
])
|
|
2898
2905
|
}) : void 0
|
|
2899
2906
|
}));
|
|
@@ -2907,9 +2914,9 @@ const ye = "readium-column-snapper-style", vi = 200, T = class T extends X {
|
|
|
2907
2914
|
}), e.register("go_end", T.moduleName, (o, a) => {
|
|
2908
2915
|
this.wnd.requestAnimationFrame(() => {
|
|
2909
2916
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2910
|
-
let
|
|
2911
|
-
if (this.rtl ?
|
|
2912
|
-
this.doc().scrollLeft =
|
|
2917
|
+
let l;
|
|
2918
|
+
if (this.rtl ? l = -this.snapNormOffset(this.cachedScrollWidth - t.innerWidth) : l = this.snapOffset(this.cachedScrollWidth), this.doc().scrollLeft === l) return a(!1);
|
|
2919
|
+
this.doc().scrollLeft = l, this.reportProgress(), A(this.wnd), a(!0);
|
|
2913
2920
|
});
|
|
2914
2921
|
}), e.register("go_start", T.moduleName, (o, a) => {
|
|
2915
2922
|
this.wnd.requestAnimationFrame(() => {
|
|
@@ -2919,14 +2926,14 @@ const ye = "readium-column-snapper-style", vi = 200, T = class T extends X {
|
|
|
2919
2926
|
}), e.register("go_prev", T.moduleName, (o, a) => {
|
|
2920
2927
|
this.wnd.requestAnimationFrame(() => {
|
|
2921
2928
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2922
|
-
let
|
|
2923
|
-
this.rtl ?
|
|
2929
|
+
let l;
|
|
2930
|
+
this.rtl ? l = n(this.normScroll() - t.innerWidth) : l = s(t.scrollX - t.innerWidth), this.reportProgress(), l && (A(this.wnd), this.checkSuspiciousSnap("left", this.wnd.innerWidth)), a(l);
|
|
2924
2931
|
});
|
|
2925
2932
|
}), e.register("go_next", T.moduleName, (o, a) => {
|
|
2926
2933
|
this.wnd.requestAnimationFrame(() => {
|
|
2927
2934
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2928
|
-
let
|
|
2929
|
-
this.rtl ?
|
|
2935
|
+
let l;
|
|
2936
|
+
this.rtl ? l = n(this.normScroll() + t.innerWidth) : l = s(t.scrollX + t.innerWidth), this.reportProgress(), l && (A(this.wnd), this.checkSuspiciousSnap("right", this.wnd.innerWidth)), a(l);
|
|
2930
2937
|
});
|
|
2931
2938
|
}), e.register("unfocus", T.moduleName, (o, a) => {
|
|
2932
2939
|
this.snappingCancelled = !0, A(this.wnd), a(!0);
|
|
@@ -2937,18 +2944,18 @@ const ye = "readium-column-snapper-style", vi = 200, T = class T extends X {
|
|
|
2937
2944
|
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), a(!0);
|
|
2938
2945
|
});
|
|
2939
2946
|
}), e.register("first_visible_locator", T.moduleName, (o, a) => {
|
|
2940
|
-
const
|
|
2941
|
-
this.comms.send("first_visible_locator",
|
|
2947
|
+
const l = yt(t, !1);
|
|
2948
|
+
this.comms.send("first_visible_locator", l.serialize()), a(!0);
|
|
2942
2949
|
}), t.addEventListener("touchstart", this.onTouchStarter, { passive: !0 }), t.addEventListener("touchend", this.onTouchEnder, { passive: !0 }), t.addEventListener("touchmove", this.onTouchMover, { passive: !0 }), t.document.addEventListener("touchstart", () => {
|
|
2943
2950
|
}), e.log("ColumnSnapper Mounted"), !0;
|
|
2944
2951
|
}
|
|
2945
2952
|
unmount(t, e) {
|
|
2946
|
-
return this.snappingCancelled = !0, e.unregisterAll(T.moduleName), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), this.patternAnalyzer && (this.patternAnalyzer.clear(), this.patternAnalyzer = null, this.isSnapProtectionEnabled = !1), t.removeEventListener("touchstart", this.onTouchStarter), t.removeEventListener("touchend", this.onTouchEnder), t.removeEventListener("touchmove", this.onTouchMover), t.removeEventListener("orientationchange", this.onWidthChanger), t.removeEventListener("resize", this.onWidthChanger), t.document.getElementById(
|
|
2953
|
+
return this.snappingCancelled = !0, e.unregisterAll(T.moduleName), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), this.patternAnalyzer && (this.patternAnalyzer.clear(), this.patternAnalyzer = null, this.isSnapProtectionEnabled = !1), t.removeEventListener("touchstart", this.onTouchStarter), t.removeEventListener("touchend", this.onTouchEnder), t.removeEventListener("touchmove", this.onTouchMover), t.removeEventListener("orientationchange", this.onWidthChanger), t.removeEventListener("resize", this.onWidthChanger), t.document.getElementById(be)?.remove(), e.log("ColumnSnapper Unmounted"), super.unmount(t, e);
|
|
2947
2954
|
}
|
|
2948
2955
|
};
|
|
2949
2956
|
T.moduleName = "column_snapper";
|
|
2950
2957
|
let Pt = T;
|
|
2951
|
-
const
|
|
2958
|
+
const ve = "readium-scroll-snapper-style", P = class P extends X {
|
|
2952
2959
|
constructor() {
|
|
2953
2960
|
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) => {
|
|
2954
2961
|
if (this.comms.ready && !this.isResizing) {
|
|
@@ -2994,12 +3001,12 @@ const be = "readium-scroll-snapper-style", P = class P extends X {
|
|
|
2994
3001
|
});
|
|
2995
3002
|
}
|
|
2996
3003
|
enableScrollProtection() {
|
|
2997
|
-
this.patternAnalyzer || (this.patternAnalyzer = new bt(
|
|
3004
|
+
this.patternAnalyzer || (this.patternAnalyzer = new bt($t), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
2998
3005
|
}
|
|
2999
3006
|
mount(t, e) {
|
|
3000
3007
|
this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "scrolling");
|
|
3001
3008
|
const i = t.document.createElement("style");
|
|
3002
|
-
return i.dataset.readium = "true", i.id =
|
|
3009
|
+
return i.dataset.readium = "true", i.id = ve, i.textContent = `
|
|
3003
3010
|
* {
|
|
3004
3011
|
scrollbar-width: none; /* for Firefox */
|
|
3005
3012
|
}
|
|
@@ -3038,7 +3045,7 @@ const be = "readium-scroll-snapper-style", P = class P extends X {
|
|
|
3038
3045
|
}), e.register("go_text", P.moduleName, (s, n) => {
|
|
3039
3046
|
let o;
|
|
3040
3047
|
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
3041
|
-
const a = H.deserialize(s),
|
|
3048
|
+
const a = H.deserialize(s), l = nt(this.wnd.document, new k({
|
|
3042
3049
|
href: t.location.href,
|
|
3043
3050
|
type: "text/html",
|
|
3044
3051
|
text: a,
|
|
@@ -3048,12 +3055,12 @@ const be = "readium-scroll-snapper-style", P = class P extends X {
|
|
|
3048
3055
|
])
|
|
3049
3056
|
}) : void 0
|
|
3050
3057
|
}));
|
|
3051
|
-
if (!
|
|
3058
|
+
if (!l) {
|
|
3052
3059
|
n(!1);
|
|
3053
3060
|
return;
|
|
3054
3061
|
}
|
|
3055
3062
|
this.wnd.requestAnimationFrame(() => {
|
|
3056
|
-
this.doc().scrollTop =
|
|
3063
|
+
this.doc().scrollTop = l.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), n(!0);
|
|
3057
3064
|
});
|
|
3058
3065
|
}), e.register("go_start", P.moduleName, (s, n) => {
|
|
3059
3066
|
if (this.doc().scrollTop === 0) return n(!1);
|
|
@@ -3076,7 +3083,7 @@ const be = "readium-scroll-snapper-style", P = class P extends X {
|
|
|
3076
3083
|
}), e.log("ScrollSnapper Mounted"), !0;
|
|
3077
3084
|
}
|
|
3078
3085
|
unmount(t, e) {
|
|
3079
|
-
return e.unregisterAll(P.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(
|
|
3086
|
+
return e.unregisterAll(P.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(ve)?.remove(), this.patternAnalyzer && (this.patternAnalyzer.clear(), this.patternAnalyzer = null, this.isScrollProtectionEnabled = !1), e.log("ScrollSnapper Unmounted"), !0;
|
|
3080
3087
|
}
|
|
3081
3088
|
};
|
|
3082
3089
|
P.moduleName = "scroll_snapper";
|
|
@@ -3127,7 +3134,7 @@ const N = class N extends X {
|
|
|
3127
3134
|
});
|
|
3128
3135
|
}
|
|
3129
3136
|
enableScrollProtection() {
|
|
3130
|
-
this.patternAnalyzer || (this.patternAnalyzer = new bt(
|
|
3137
|
+
this.patternAnalyzer || (this.patternAnalyzer = new bt($t), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
3131
3138
|
}
|
|
3132
3139
|
mount(t, e) {
|
|
3133
3140
|
return this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), this.resizeObserver = new ResizeObserver(() => {
|
|
@@ -3204,7 +3211,7 @@ const N = class N extends X {
|
|
|
3204
3211
|
};
|
|
3205
3212
|
N.moduleName = "webpub_snapper";
|
|
3206
3213
|
let Lt = N;
|
|
3207
|
-
class
|
|
3214
|
+
class Ai {
|
|
3208
3215
|
constructor(t, e) {
|
|
3209
3216
|
this.window = t, this.copyHistory = [], this.lastSelectionLength = 0, this.lastSelectionTime = 0, this.options = e;
|
|
3210
3217
|
}
|
|
@@ -3230,10 +3237,10 @@ class wi {
|
|
|
3230
3237
|
length: s,
|
|
3231
3238
|
wasBlocked: !1
|
|
3232
3239
|
}), !0;
|
|
3233
|
-
const
|
|
3240
|
+
const l = o - this.lastSelectionTime < 100 && s > this.lastSelectionLength * 1.5, u = Math.min(
|
|
3234
3241
|
n * this.options.maxSelectionPercent,
|
|
3235
3242
|
this.options.absoluteMaxChars
|
|
3236
|
-
), d = this.isSuspiciousPattern(o), f = s > u ||
|
|
3243
|
+
), d = this.isSuspiciousPattern(o), f = s > u || l || d;
|
|
3237
3244
|
return this.copyHistory.push({
|
|
3238
3245
|
timestamp: o,
|
|
3239
3246
|
length: s,
|
|
@@ -3244,8 +3251,8 @@ class wi {
|
|
|
3244
3251
|
this.lastSelectionLength = 0, this.lastSelectionTime = 0, this.copyHistory = [], this.options.enabled = !1;
|
|
3245
3252
|
}
|
|
3246
3253
|
}
|
|
3247
|
-
class
|
|
3248
|
-
constructor(t =
|
|
3254
|
+
class Ci {
|
|
3255
|
+
constructor(t = ke) {
|
|
3249
3256
|
this.options = t, this.events = [], this.selectionStartTime = 0, this.lastSelectionTime = 0, this.lastSelectionPosition = 0, this.selectionPatterns = [], this.lastSelectedText = "";
|
|
3250
3257
|
}
|
|
3251
3258
|
analyze(t) {
|
|
@@ -3271,8 +3278,8 @@ class Si {
|
|
|
3271
3278
|
if (!t.rangeCount) return !1;
|
|
3272
3279
|
const i = t.getRangeAt(0), s = i.toString(), n = (e - this.selectionStartTime) / 1e3;
|
|
3273
3280
|
if (s.length / Math.max(1, n) > this.options.maxSelectionsPerSecond) return !0;
|
|
3274
|
-
const a = i.startOffset,
|
|
3275
|
-
return this.selectionPatterns.push(
|
|
3281
|
+
const a = i.startOffset, l = Math.abs(a - this.lastSelectionPosition);
|
|
3282
|
+
return this.selectionPatterns.push(l), this.selectionPatterns.length > this.options.historySize && (this.selectionPatterns.shift(), this.calculateVariance(this.selectionPatterns) < this.options.minVariance) ? !0 : (this.lastSelectionPosition = a, !1);
|
|
3276
3283
|
}
|
|
3277
3284
|
calculateVariance(t) {
|
|
3278
3285
|
if (t.length === 0) return 0;
|
|
@@ -3286,14 +3293,14 @@ class Si {
|
|
|
3286
3293
|
this.events = [], this.selectionStartTime = 0, this.lastSelectionTime = 0, this.lastSelectionPosition = 0, this.selectionPatterns = [], this.lastSelectedText = "";
|
|
3287
3294
|
}
|
|
3288
3295
|
}
|
|
3289
|
-
class
|
|
3296
|
+
class xi {
|
|
3290
3297
|
/**
|
|
3291
3298
|
* Checks if the given keyboard event matches any of the provided key combinations
|
|
3292
3299
|
*/
|
|
3293
3300
|
match(t, e) {
|
|
3294
3301
|
for (const i of e) {
|
|
3295
|
-
const s = t.keyCode === i.keyCode, n = i.ctrl === void 0 || t.ctrlKey === i.ctrl, o = i.shift === void 0 || t.shiftKey === i.shift, a = i.alt === void 0 || t.altKey === i.alt,
|
|
3296
|
-
if (s && n && o && a &&
|
|
3302
|
+
const s = t.keyCode === i.keyCode, n = i.ctrl === void 0 || t.ctrlKey === i.ctrl, o = i.shift === void 0 || t.shiftKey === i.shift, a = i.alt === void 0 || t.altKey === i.alt, l = i.meta === void 0 || t.metaKey === i.meta;
|
|
3303
|
+
if (s && n && o && a && l)
|
|
3297
3304
|
return !0;
|
|
3298
3305
|
}
|
|
3299
3306
|
return !1;
|
|
@@ -3310,16 +3317,18 @@ class Ei {
|
|
|
3310
3317
|
* Creates a standardized activity event for keyboard shortcuts
|
|
3311
3318
|
*/
|
|
3312
3319
|
createActivityEvent(t, e, i, s) {
|
|
3313
|
-
let n;
|
|
3320
|
+
let n, o;
|
|
3314
3321
|
if (s) {
|
|
3315
|
-
const
|
|
3316
|
-
|
|
3317
|
-
text:
|
|
3318
|
-
x:
|
|
3319
|
-
y:
|
|
3320
|
-
width:
|
|
3321
|
-
height:
|
|
3322
|
+
const a = s.getSelection(), l = a?.toString() || "", d = (l && a?.rangeCount ? a.getRangeAt(0)?.getClientRects() : null)?.[0];
|
|
3323
|
+
d && l && (n = {
|
|
3324
|
+
text: l,
|
|
3325
|
+
x: d.x,
|
|
3326
|
+
y: d.y,
|
|
3327
|
+
width: d.width,
|
|
3328
|
+
height: d.height
|
|
3322
3329
|
});
|
|
3330
|
+
const f = s.document.activeElement;
|
|
3331
|
+
f && f !== s.document.body && (o = Gt(f)?.outerHTML);
|
|
3323
3332
|
}
|
|
3324
3333
|
return {
|
|
3325
3334
|
type: e,
|
|
@@ -3332,7 +3341,8 @@ class Ei {
|
|
|
3332
3341
|
shiftKey: t.shiftKey,
|
|
3333
3342
|
metaKey: t.metaKey,
|
|
3334
3343
|
targetFrameSrc: i,
|
|
3335
|
-
selectedText: n
|
|
3344
|
+
selectedText: n,
|
|
3345
|
+
interactiveElement: o
|
|
3336
3346
|
};
|
|
3337
3347
|
}
|
|
3338
3348
|
/**
|
|
@@ -3343,8 +3353,8 @@ class Ei {
|
|
|
3343
3353
|
return e.forEach((o) => {
|
|
3344
3354
|
n.push(...o.keyCombos.map((a) => ({
|
|
3345
3355
|
...a,
|
|
3346
|
-
handler: (
|
|
3347
|
-
const u = o.type, d = this.createActivityEvent(
|
|
3356
|
+
handler: (l) => {
|
|
3357
|
+
const u = o.type, d = this.createActivityEvent(l, u, t, s);
|
|
3348
3358
|
i(d);
|
|
3349
3359
|
}
|
|
3350
3360
|
})));
|
|
@@ -3358,6 +3368,11 @@ class Ei {
|
|
|
3358
3368
|
return (o) => {
|
|
3359
3369
|
for (const a of n)
|
|
3360
3370
|
if (this.match(o, [a])) {
|
|
3371
|
+
const l = a.suppressOnInteractiveElement;
|
|
3372
|
+
if (l) {
|
|
3373
|
+
const u = document.activeElement;
|
|
3374
|
+
if (Array.isArray(l) ? l.some((d) => u?.matches(d)) : ze(u)) return;
|
|
3375
|
+
}
|
|
3361
3376
|
o.preventDefault(), o.stopPropagation(), a.handler(o);
|
|
3362
3377
|
return;
|
|
3363
3378
|
}
|
|
@@ -3366,7 +3381,7 @@ class Ei {
|
|
|
3366
3381
|
}
|
|
3367
3382
|
const Y = class Y extends K {
|
|
3368
3383
|
constructor() {
|
|
3369
|
-
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
|
|
3384
|
+
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 xi(), this.keyDownHandler = null, this.preventBulkCopy = (t) => {
|
|
3370
3385
|
if (!this.isBulkCopyProtectionEnabled || !this.bulkCopyProtector)
|
|
3371
3386
|
return !0;
|
|
3372
3387
|
if (!this.bulkCopyProtector.shouldAllowCopy(t)) {
|
|
@@ -3394,7 +3409,7 @@ const Y = class Y extends K {
|
|
|
3394
3409
|
const e = this.wnd.getSelection();
|
|
3395
3410
|
if (e) {
|
|
3396
3411
|
if (this.currentSelection = e.toString(), this.selectionAnalyzer.analyze(e) && this.currentSelection) {
|
|
3397
|
-
const s = this.wnd.getSelection(), n = s?.toString() || "", a = (n && s?.rangeCount ? s.getRangeAt(0)?.getClientRects() : null)?.[0],
|
|
3412
|
+
const s = this.wnd.getSelection(), n = s?.toString() || "", a = (n && s?.rangeCount ? s.getRangeAt(0)?.getClientRects() : null)?.[0], l = {
|
|
3398
3413
|
type: "suspicious_selection",
|
|
3399
3414
|
timestamp: Date.now(),
|
|
3400
3415
|
selectionLength: n.length,
|
|
@@ -3408,7 +3423,7 @@ const Y = class Y extends K {
|
|
|
3408
3423
|
eventType: t?.type || "selectionchange",
|
|
3409
3424
|
targetFrameSrc: this.wnd.location.href
|
|
3410
3425
|
};
|
|
3411
|
-
this.comms?.send("content_protection",
|
|
3426
|
+
this.comms?.send("content_protection", l);
|
|
3412
3427
|
}
|
|
3413
3428
|
} else
|
|
3414
3429
|
this.currentSelection = null;
|
|
@@ -3489,16 +3504,16 @@ const Y = class Y extends K {
|
|
|
3489
3504
|
}
|
|
3490
3505
|
addBulkCopyProtection(t = {}) {
|
|
3491
3506
|
if (this.isBulkCopyProtectionEnabled || !this.wnd) return;
|
|
3492
|
-
const e =
|
|
3493
|
-
this.bulkCopyProtector = new
|
|
3507
|
+
const e = Si, i = t ? { ...e, ...t } : e;
|
|
3508
|
+
this.bulkCopyProtector = new Ai(this.wnd, i), this.wnd.document.addEventListener("copy", this.preventBulkCopy, !0), this.wnd.document.addEventListener("cut", this.preventBulkCopy, !0), this.isBulkCopyProtectionEnabled = !0;
|
|
3494
3509
|
}
|
|
3495
3510
|
removeBulkCopyProtection() {
|
|
3496
3511
|
!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);
|
|
3497
3512
|
}
|
|
3498
3513
|
addSelectionMonitoring(t) {
|
|
3499
3514
|
if (this.isSelectionMonitoringEnabled || !this.wnd) return;
|
|
3500
|
-
const e = t ||
|
|
3501
|
-
this.selectionAnalyzer = new
|
|
3515
|
+
const e = t || ke;
|
|
3516
|
+
this.selectionAnalyzer = new Ci(e), this.wnd.document.addEventListener("selectionchange", this.handleSelection), this.isSelectionMonitoringEnabled = !0;
|
|
3502
3517
|
}
|
|
3503
3518
|
removeSelectionMonitoring() {
|
|
3504
3519
|
!this.isSelectionMonitoringEnabled || !this.wnd || (this.wnd.document.removeEventListener("selectionchange", this.handleSelection), this.selectionAnalyzer?.clear(), this.selectionAnalyzer = null, this.isSelectionMonitoringEnabled = !1);
|
|
@@ -3531,7 +3546,7 @@ const Y = class Y extends K {
|
|
|
3531
3546
|
y: t.clientY * i,
|
|
3532
3547
|
targetFrameSrc: this.wnd.location.href,
|
|
3533
3548
|
targetElement: t.target.outerHTML,
|
|
3534
|
-
interactiveElement:
|
|
3549
|
+
interactiveElement: Gt(t.target)?.outerHTML,
|
|
3535
3550
|
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(t.target)
|
|
3536
3551
|
}), this.pointerMoved = !1;
|
|
3537
3552
|
}
|
|
@@ -3640,7 +3655,7 @@ const et = class et extends K {
|
|
|
3640
3655
|
), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
|
|
3641
3656
|
value: {
|
|
3642
3657
|
name: "readium-ts-toolkit",
|
|
3643
|
-
version: "2.4.1",
|
|
3658
|
+
version: "2.4.2-beta.1",
|
|
3644
3659
|
hasFeature: (s, n = "") => {
|
|
3645
3660
|
switch (s) {
|
|
3646
3661
|
case "dom-manipulation":
|
|
@@ -3689,7 +3704,7 @@ const et = class et extends K {
|
|
|
3689
3704
|
};
|
|
3690
3705
|
et.moduleName = "setup";
|
|
3691
3706
|
let ft = et;
|
|
3692
|
-
const
|
|
3707
|
+
const we = "readium-viewport", W = class W extends ft {
|
|
3693
3708
|
onViewportWidthChanged(t) {
|
|
3694
3709
|
const e = t.target;
|
|
3695
3710
|
st(e, "--RS__viewportWidth", `${e.innerWidth}px`);
|
|
@@ -3697,7 +3712,7 @@ const ve = "readium-viewport", W = class W extends ft {
|
|
|
3697
3712
|
mount(t, e) {
|
|
3698
3713
|
if (!super.mount(t, e)) return !1;
|
|
3699
3714
|
const i = t.document.createElement("meta");
|
|
3700
|
-
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id",
|
|
3715
|
+
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id", we), i.setAttribute(
|
|
3701
3716
|
"content",
|
|
3702
3717
|
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
3703
3718
|
), t.document.head.appendChild(i), t.addEventListener("orientationchange", this.onViewportWidthChanged), t.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
@@ -3705,7 +3720,7 @@ const ve = "readium-viewport", W = class W extends ft {
|
|
|
3705
3720
|
}), e.register("get_properties", W.moduleName, (s, n) => {
|
|
3706
3721
|
Vt(t), n(!0);
|
|
3707
3722
|
}), e.register("update_properties", W.moduleName, (s, n) => {
|
|
3708
|
-
s["--RS__viewportWidth"] = `${t.innerWidth}px`,
|
|
3723
|
+
s["--RS__viewportWidth"] = `${t.innerWidth}px`, De(t, s), n(!0);
|
|
3709
3724
|
}), e.register("set_property", W.moduleName, (s, n) => {
|
|
3710
3725
|
const o = s;
|
|
3711
3726
|
st(t, o[0], o[1]), n(!0);
|
|
@@ -3716,17 +3731,17 @@ const ve = "readium-viewport", W = class W extends ft {
|
|
|
3716
3731
|
}), e.log("ReflowableSetup Mounted"), !0;
|
|
3717
3732
|
}
|
|
3718
3733
|
unmount(t, e) {
|
|
3719
|
-
return e.unregisterAll(W.moduleName), t.document.head.querySelector(`#${
|
|
3734
|
+
return e.unregisterAll(W.moduleName), t.document.head.querySelector(`#${we}`)?.remove(), t.removeEventListener("orientationchange", this.onViewportWidthChanged), e.log("ReflowableSetup Unmounted"), super.unmount(t, e);
|
|
3720
3735
|
}
|
|
3721
3736
|
};
|
|
3722
3737
|
W.moduleName = "reflowable_setup";
|
|
3723
3738
|
let Rt = W;
|
|
3724
|
-
const
|
|
3739
|
+
const Se = "readium-fixed-style", z = class z extends ft {
|
|
3725
3740
|
mount(t, e) {
|
|
3726
3741
|
if (!super.mount(t, e)) return !1;
|
|
3727
3742
|
t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "paginated");
|
|
3728
3743
|
const i = t.document.createElement("style");
|
|
3729
|
-
return i.id =
|
|
3744
|
+
return i.id = Se, i.dataset.readium = "true", i.textContent = `
|
|
3730
3745
|
html, body {
|
|
3731
3746
|
text-size-adjust: none;
|
|
3732
3747
|
-ms-text-size-adjust: none;
|
|
@@ -3759,7 +3774,7 @@ const we = "readium-fixed-style", z = class z extends ft {
|
|
|
3759
3774
|
}), e.log("FixedSetup Mounted"), !0;
|
|
3760
3775
|
}
|
|
3761
3776
|
unmount(t, e) {
|
|
3762
|
-
return e.unregisterAll(z.moduleName), t.document.getElementById(
|
|
3777
|
+
return e.unregisterAll(z.moduleName), t.document.getElementById(Se)?.remove(), e.log("FixedSetup Unmounted"), super.unmount(t, e);
|
|
3763
3778
|
}
|
|
3764
3779
|
};
|
|
3765
3780
|
z.moduleName = "fixed_setup";
|
|
@@ -3781,7 +3796,7 @@ const U = class U extends K {
|
|
|
3781
3796
|
), e.register("get_properties", U.moduleName, (i, s) => {
|
|
3782
3797
|
Vt(t), s(!0);
|
|
3783
3798
|
}), e.register("update_properties", U.moduleName, (i, s) => {
|
|
3784
|
-
|
|
3799
|
+
De(t, i), s(!0);
|
|
3785
3800
|
}), e.register("set_property", U.moduleName, (i, s) => {
|
|
3786
3801
|
const n = i;
|
|
3787
3802
|
st(t, n[0], n[1]), s(!0);
|
|
@@ -3835,7 +3850,7 @@ const it = class it extends K {
|
|
|
3835
3850
|
};
|
|
3836
3851
|
it.moduleName = "print_protection";
|
|
3837
3852
|
let zt = it;
|
|
3838
|
-
const
|
|
3853
|
+
const Ee = "readium-cjk-vertical-snapper-style", L = class L extends X {
|
|
3839
3854
|
constructor() {
|
|
3840
3855
|
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) => {
|
|
3841
3856
|
if (this.comms.ready && !this.isResizing) {
|
|
@@ -3887,12 +3902,12 @@ const Se = "readium-cjk-vertical-snapper-style", L = class L extends X {
|
|
|
3887
3902
|
});
|
|
3888
3903
|
}
|
|
3889
3904
|
enableScrollProtection() {
|
|
3890
|
-
this.patternAnalyzer || (this.patternAnalyzer = new bt(
|
|
3905
|
+
this.patternAnalyzer || (this.patternAnalyzer = new bt($t), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
3891
3906
|
}
|
|
3892
3907
|
mount(t, e) {
|
|
3893
|
-
this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollLeft = 0, this.isResizing = !1, this.verticalLR =
|
|
3908
|
+
this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollLeft = 0, this.isResizing = !1, this.verticalLR = ui(t), this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "scrolling");
|
|
3894
3909
|
const i = t.document.createElement("style");
|
|
3895
|
-
return i.dataset.readium = "true", i.id =
|
|
3910
|
+
return i.dataset.readium = "true", i.id = Ee, i.textContent = `
|
|
3896
3911
|
* {
|
|
3897
3912
|
scrollbar-width: none;
|
|
3898
3913
|
}
|
|
@@ -3935,7 +3950,7 @@ const Se = "readium-cjk-vertical-snapper-style", L = class L extends X {
|
|
|
3935
3950
|
}), e.register("go_text", L.moduleName, (s, n) => {
|
|
3936
3951
|
let o;
|
|
3937
3952
|
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
3938
|
-
const a = H.deserialize(s),
|
|
3953
|
+
const a = H.deserialize(s), l = nt(this.wnd.document, new k({
|
|
3939
3954
|
href: t.location.href,
|
|
3940
3955
|
type: "text/html",
|
|
3941
3956
|
text: a,
|
|
@@ -3943,12 +3958,12 @@ const Se = "readium-cjk-vertical-snapper-style", L = class L extends X {
|
|
|
3943
3958
|
otherLocations: /* @__PURE__ */ new Map([["cssSelector", o]])
|
|
3944
3959
|
}) : void 0
|
|
3945
3960
|
}));
|
|
3946
|
-
if (!
|
|
3961
|
+
if (!l) {
|
|
3947
3962
|
n(!1);
|
|
3948
3963
|
return;
|
|
3949
3964
|
}
|
|
3950
3965
|
this.wnd.requestAnimationFrame(() => {
|
|
3951
|
-
this.doc().scrollLeft +=
|
|
3966
|
+
this.doc().scrollLeft += l.getBoundingClientRect().left - t.innerWidth / 2, this.reportProgress(), A(this.wnd), n(!0);
|
|
3952
3967
|
});
|
|
3953
3968
|
}), e.register("go_start", L.moduleName, (s, n) => {
|
|
3954
3969
|
if (this.doc().scrollLeft === 0) return n(!1);
|
|
@@ -3971,17 +3986,17 @@ const Se = "readium-cjk-vertical-snapper-style", L = class L extends X {
|
|
|
3971
3986
|
}), e.log("CJKVerticalSnapper Mounted"), !0;
|
|
3972
3987
|
}
|
|
3973
3988
|
unmount(t, e) {
|
|
3974
|
-
return e.unregisterAll(L.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(
|
|
3989
|
+
return e.unregisterAll(L.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(Ee)?.remove(), this.patternAnalyzer && (this.patternAnalyzer.clear(), this.patternAnalyzer = null, this.isScrollProtectionEnabled = !1), e.log("CJKVerticalSnapper Unmounted"), !0;
|
|
3975
3990
|
}
|
|
3976
3991
|
};
|
|
3977
3992
|
L.moduleName = "cjk_vertical_snapper";
|
|
3978
3993
|
let Mt = L;
|
|
3979
|
-
const
|
|
3994
|
+
const Ti = [
|
|
3980
3995
|
"fixed_setup",
|
|
3981
3996
|
"decorator",
|
|
3982
3997
|
"peripherals",
|
|
3983
3998
|
"print_protection"
|
|
3984
|
-
],
|
|
3999
|
+
], Pi = [
|
|
3985
4000
|
"reflowable_setup",
|
|
3986
4001
|
"decorator",
|
|
3987
4002
|
"peripherals",
|
|
@@ -3989,13 +4004,13 @@ const Ai = [
|
|
|
3989
4004
|
"scroll_snapper",
|
|
3990
4005
|
"cjk_vertical_snapper",
|
|
3991
4006
|
"print_protection"
|
|
3992
|
-
],
|
|
4007
|
+
], Ni = [
|
|
3993
4008
|
"webpub_setup",
|
|
3994
4009
|
"webpub_snapper",
|
|
3995
4010
|
"decorator",
|
|
3996
4011
|
"peripherals",
|
|
3997
4012
|
"print_protection"
|
|
3998
|
-
],
|
|
4013
|
+
], Ae = new Map([
|
|
3999
4014
|
// All modules go here
|
|
4000
4015
|
Dt,
|
|
4001
4016
|
Rt,
|
|
@@ -4008,13 +4023,13 @@ const Ai = [
|
|
|
4008
4023
|
Mt,
|
|
4009
4024
|
zt
|
|
4010
4025
|
].map((r) => [r.moduleName, r]));
|
|
4011
|
-
class
|
|
4026
|
+
class Li {
|
|
4012
4027
|
/**
|
|
4013
4028
|
* @param wnd Window instance to operate on
|
|
4014
4029
|
* @param initialModules List of initial modules to load
|
|
4015
4030
|
*/
|
|
4016
4031
|
constructor(t = window, e = []) {
|
|
4017
|
-
this.loadedModules = [], this.wnd = t, this.comms = new
|
|
4032
|
+
this.loadedModules = [], this.wnd = t, this.comms = new Be(t);
|
|
4018
4033
|
const i = [...new Set(e)];
|
|
4019
4034
|
if (i.length) {
|
|
4020
4035
|
if (typeof t > "u")
|
|
@@ -4027,7 +4042,7 @@ class Ti {
|
|
|
4027
4042
|
}
|
|
4028
4043
|
}
|
|
4029
4044
|
loadModule(t) {
|
|
4030
|
-
const e =
|
|
4045
|
+
const e = Ae.get(t);
|
|
4031
4046
|
return e === void 0 ? (this.comms.log(`Module "${name}" does not exist in the library`), e) : new e();
|
|
4032
4047
|
}
|
|
4033
4048
|
/**
|
|
@@ -4045,7 +4060,7 @@ class Ti {
|
|
|
4045
4060
|
* @returns Success
|
|
4046
4061
|
*/
|
|
4047
4062
|
removeModule(t) {
|
|
4048
|
-
const e =
|
|
4063
|
+
const e = Ae.get(t);
|
|
4049
4064
|
if (e === void 0)
|
|
4050
4065
|
return this.comms.log(`Module "${t}" does not exist in the library`), !1;
|
|
4051
4066
|
const i = this.loadedModules.findIndex((s) => s instanceof e);
|
|
@@ -4058,7 +4073,7 @@ class Ti {
|
|
|
4058
4073
|
this.comms.destroy(), this.loadedModules.forEach((t) => t.unmount(this.wnd, this.comms)), this.loadedModules = [];
|
|
4059
4074
|
}
|
|
4060
4075
|
}
|
|
4061
|
-
const
|
|
4076
|
+
const Oi = {
|
|
4062
4077
|
type: "developer_tools",
|
|
4063
4078
|
keyCombos: [
|
|
4064
4079
|
{ keyCode: 73, meta: !0, alt: !0 },
|
|
@@ -4092,7 +4107,7 @@ const Pi = {
|
|
|
4092
4107
|
{ keyCode: 123, meta: !0, alt: !0 }
|
|
4093
4108
|
// Cmd+Option+F12
|
|
4094
4109
|
]
|
|
4095
|
-
},
|
|
4110
|
+
}, Ri = {
|
|
4096
4111
|
type: "select_all",
|
|
4097
4112
|
keyCombos: [
|
|
4098
4113
|
{ keyCode: 65, meta: !0 },
|
|
@@ -4100,7 +4115,7 @@ const Pi = {
|
|
|
4100
4115
|
{ keyCode: 65, ctrl: !0 }
|
|
4101
4116
|
// Ctrl+A
|
|
4102
4117
|
]
|
|
4103
|
-
},
|
|
4118
|
+
}, Di = {
|
|
4104
4119
|
type: "print",
|
|
4105
4120
|
keyCombos: [
|
|
4106
4121
|
{ keyCode: 80, meta: !0 },
|
|
@@ -4116,7 +4131,7 @@ const Pi = {
|
|
|
4116
4131
|
{ keyCode: 80, ctrl: !0, alt: !0 }
|
|
4117
4132
|
// Ctrl+Alt+P
|
|
4118
4133
|
]
|
|
4119
|
-
},
|
|
4134
|
+
}, Ii = {
|
|
4120
4135
|
type: "save",
|
|
4121
4136
|
keyCombos: [
|
|
4122
4137
|
{ keyCode: 83, meta: !0 },
|
|
@@ -4126,26 +4141,26 @@ const Pi = {
|
|
|
4126
4141
|
]
|
|
4127
4142
|
};
|
|
4128
4143
|
export {
|
|
4129
|
-
|
|
4144
|
+
Ai as BulkCopyProtector,
|
|
4130
4145
|
Z as COMMS_VERSION,
|
|
4131
|
-
|
|
4132
|
-
|
|
4146
|
+
Be as Comms,
|
|
4147
|
+
Oi as DEV_TOOLS,
|
|
4133
4148
|
Tt as Decorator,
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4149
|
+
Ti as FXLModules,
|
|
4150
|
+
xi as KeyCombinationManager,
|
|
4151
|
+
li as Layout,
|
|
4152
|
+
Li as Loader,
|
|
4138
4153
|
K as Module,
|
|
4139
|
-
|
|
4140
|
-
|
|
4154
|
+
Ae as ModuleLibrary,
|
|
4155
|
+
Di as PRINT,
|
|
4141
4156
|
bt as PatternAnalyzer,
|
|
4142
4157
|
Ot as Peripherals,
|
|
4143
4158
|
zt as PrintProtector,
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4159
|
+
Pi as ReflowableModules,
|
|
4160
|
+
Ii as SAVE,
|
|
4161
|
+
Ri as SELECT_ALL,
|
|
4162
|
+
Ci as SelectionAnalyzer,
|
|
4163
|
+
Ni as WebPubModules,
|
|
4164
|
+
ai as Width,
|
|
4165
|
+
Ue as mid
|
|
4151
4166
|
};
|