@readium/navigator-html-injectables 2.4.0-beta.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +545 -541
- package/dist/index.umd.cjs +12 -12
- package/package.json +1 -1
- package/src/helpers/document.ts +9 -3
- package/src/modules/snapper/CJKVerticalSnapper.ts +20 -9
- package/src/modules/snapper/ColumnSnapper.ts +18 -19
- package/types/src/helpers/document.d.ts +1 -0
- package/types/src/modules/snapper/CJKVerticalSnapper.d.ts +1 -0
- package/types/src/modules/snapper/ColumnSnapper.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
1
|
+
const ke = Math.pow(2, 32), $t = () => Math.round(Math.random() * ke).toString(36), We = () => `${Math.round(performance.now())}-${$t()}-${$t()}`, Z = 1;
|
|
2
|
+
class Ue {
|
|
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
|
}
|
|
@@ -10,8 +10,8 @@ class He {
|
|
|
10
10
|
if (!(!("_readium" in e) || !e._readium || e._readium <= 0)) {
|
|
11
11
|
if (e.key === "_ping") {
|
|
12
12
|
if (!this.destination) {
|
|
13
|
-
if (this.destination = t.source, this.origin = t.origin, this.channelId = e._channel, e._readium !==
|
|
14
|
-
e._readium >
|
|
13
|
+
if (this.destination = t.source, this.origin = t.origin, this.channelId = e._channel, e._readium !== Z) {
|
|
14
|
+
e._readium > Z ? this.send("error", `received comms version ${e._readium} higher than ${Z}`) : this.send("error", `received comms version ${e._readium} lower than ${Z}`), this.destination = null, this.origin = "", this.channelId = "";
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
this.send("_pong", void 0), this.preLog.forEach((i) => this.send("log", i)), this.preLog = [];
|
|
@@ -71,9 +71,9 @@ class He {
|
|
|
71
71
|
send(t, e, i = void 0, s = []) {
|
|
72
72
|
if (!this.destination) throw Error("Attempted to send comms message before destination has been initialized");
|
|
73
73
|
const n = {
|
|
74
|
-
_readium:
|
|
74
|
+
_readium: Z,
|
|
75
75
|
_channel: this.channelId,
|
|
76
|
-
id: i ??
|
|
76
|
+
id: i ?? We(),
|
|
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 Yt = 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 qt = 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 Xt = 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 Kt = 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 Zt = 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 te = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], _e = /* @__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"}}`), Ve = {
|
|
247
|
-
publication:
|
|
248
|
-
},
|
|
245
|
+
let Jt = E;
|
|
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: Be
|
|
248
|
+
}, jt = {
|
|
249
249
|
fr: () => import("./fr-C5HEel98.js"),
|
|
250
250
|
ar: () => import("./ar-DyHX_uy2.js"),
|
|
251
251
|
da: () => import("./da-Dct0PS3E.js"),
|
|
@@ -256,13 +256,13 @@ const te = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], _e = /* @__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
|
-
},
|
|
260
|
-
class
|
|
259
|
+
}, te = He?.publication?.metadata?.accessibility?.["display-guide"] || {};
|
|
260
|
+
class $ {
|
|
261
261
|
constructor() {
|
|
262
|
-
this.currentLocaleCode = "en", this.locale =
|
|
262
|
+
this.currentLocaleCode = "en", this.locale = te, this.loadedLocales = {}, this.loadedLocales.en = te;
|
|
263
263
|
}
|
|
264
264
|
static getInstance() {
|
|
265
|
-
return
|
|
265
|
+
return $.instance || ($.instance = new $()), $.instance;
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* Loads a locale dynamically
|
|
@@ -270,14 +270,14 @@ class Y {
|
|
|
270
270
|
* @returns Promise indicating if the locale was loaded successfully
|
|
271
271
|
*/
|
|
272
272
|
async loadLocale(t) {
|
|
273
|
-
if (!
|
|
273
|
+
if (!Qt.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 jt))
|
|
279
279
|
return console.warn(`Locale file not found for: ${t}`), !1;
|
|
280
|
-
const s = (await
|
|
280
|
+
const s = (await jt[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 Y {
|
|
|
311
311
|
* Gets a list of available locale codes
|
|
312
312
|
*/
|
|
313
313
|
getAvailableLocales() {
|
|
314
|
-
return
|
|
314
|
+
return Qt;
|
|
315
315
|
}
|
|
316
316
|
getNestedValue(t, e) {
|
|
317
317
|
const i = e.split(".");
|
|
@@ -333,8 +333,8 @@ class Y {
|
|
|
333
333
|
return e === void 0 && this.currentLocaleCode !== "en" && (e = this.getNestedValue(this.loadedLocales.en, t)), e !== void 0 ? typeof e == "string" ? { compact: e, descriptive: e } : e : (console.warn(`Missing localization for key: ${t}`), { compact: "", descriptive: "" });
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
|
|
337
|
-
class
|
|
336
|
+
$.getInstance();
|
|
337
|
+
class kt {
|
|
338
338
|
/**
|
|
339
339
|
* Creates a [Encryption].
|
|
340
340
|
*/
|
|
@@ -346,7 +346,7 @@ class Ut {
|
|
|
346
346
|
*/
|
|
347
347
|
static deserialize(t) {
|
|
348
348
|
if (t && t.algorithm)
|
|
349
|
-
return new
|
|
349
|
+
return new kt({
|
|
350
350
|
algorithm: t.algorithm,
|
|
351
351
|
compression: t.compression,
|
|
352
352
|
originalLength: t.originalLength,
|
|
@@ -362,7 +362,7 @@ class Ut {
|
|
|
362
362
|
return this.compression !== void 0 && (t.compression = this.compression), this.originalLength !== void 0 && (t.originalLength = this.originalLength), this.profile !== void 0 && (t.profile = this.profile), this.scheme !== void 0 && (t.scheme = this.scheme), t;
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
|
-
class
|
|
365
|
+
class R {
|
|
366
366
|
constructor(t) {
|
|
367
367
|
this.otherProperties = t;
|
|
368
368
|
}
|
|
@@ -374,7 +374,7 @@ class D {
|
|
|
374
374
|
*/
|
|
375
375
|
static deserialize(t) {
|
|
376
376
|
if (t)
|
|
377
|
-
return new
|
|
377
|
+
return new R(t);
|
|
378
378
|
}
|
|
379
379
|
/**
|
|
380
380
|
* Serializes a [Properties] to its RWPM JSON representation.
|
|
@@ -389,30 +389,30 @@ class D {
|
|
|
389
389
|
const e = Object.assign({}, this.otherProperties);
|
|
390
390
|
for (const i in t)
|
|
391
391
|
e[i] = t[i];
|
|
392
|
-
return new
|
|
392
|
+
return new R(e);
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
Object.defineProperty(
|
|
395
|
+
Object.defineProperty(R.prototype, "encryption", {
|
|
396
396
|
get: function() {
|
|
397
|
-
return
|
|
397
|
+
return kt.deserialize(this.otherProperties.encrypted);
|
|
398
398
|
}
|
|
399
399
|
});
|
|
400
|
-
function
|
|
400
|
+
function _e(r) {
|
|
401
401
|
return r && Array.isArray(r) ? r : void 0;
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
return r && typeof r == "string" ? [r] :
|
|
403
|
+
function Ae(r) {
|
|
404
|
+
return r && typeof r == "string" ? [r] : _e(r);
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function ee(r) {
|
|
407
407
|
return typeof r == "string" ? new Date(r) : void 0;
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function ht(r) {
|
|
410
410
|
return isNaN(r) ? void 0 : r;
|
|
411
411
|
}
|
|
412
|
-
function
|
|
413
|
-
return
|
|
412
|
+
function O(r) {
|
|
413
|
+
return ht(r) !== void 0 && Math.sign(r) >= 0 ? r : void 0;
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function Ve(r) {
|
|
416
416
|
const t = new Array();
|
|
417
417
|
return r.forEach((e) => t.push(e)), t;
|
|
418
418
|
}
|
|
@@ -430,19 +430,19 @@ class l {
|
|
|
430
430
|
for (let p = 1; p < s.length; p++) {
|
|
431
431
|
const v = s[p].split("=");
|
|
432
432
|
if (v.length === 2) {
|
|
433
|
-
const
|
|
434
|
-
o[
|
|
433
|
+
const g = v[0].toLocaleLowerCase(), m = g === "charset" ? v[1].toUpperCase() : v[1];
|
|
434
|
+
o[g] = m;
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
const a = {}, c = Object.keys(o);
|
|
438
438
|
c.sort((p, v) => p.localeCompare(v)), c.forEach((p) => a[p] = o[p]);
|
|
439
|
-
let
|
|
439
|
+
let u = "";
|
|
440
440
|
for (const p in a) {
|
|
441
441
|
const v = a[p];
|
|
442
|
-
|
|
442
|
+
u += `;${p}=${v}`;
|
|
443
443
|
}
|
|
444
|
-
const
|
|
445
|
-
this.string =
|
|
444
|
+
const d = `${e}/${i}${u}`, f = a.encoding;
|
|
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
448
|
return new l(t);
|
|
@@ -875,7 +875,7 @@ class l {
|
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
|
-
class
|
|
878
|
+
class ie {
|
|
879
879
|
constructor(t) {
|
|
880
880
|
this.uri = t, this.parameters = this.getParameters(t);
|
|
881
881
|
}
|
|
@@ -915,7 +915,7 @@ class C {
|
|
|
915
915
|
*/
|
|
916
916
|
static deserialize(t) {
|
|
917
917
|
if (!t) return;
|
|
918
|
-
const e =
|
|
918
|
+
const e = ht(t.progression), i = ht(t.totalProgression), s = ht(t.position), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
|
|
919
919
|
"fragment",
|
|
920
920
|
"fragments",
|
|
921
921
|
"progression",
|
|
@@ -925,7 +925,7 @@ class C {
|
|
|
925
925
|
return Object.entries(t).forEach(([a, c]) => {
|
|
926
926
|
o.has(a) || n.set(a, c);
|
|
927
927
|
}), new C({
|
|
928
|
-
fragments:
|
|
928
|
+
fragments: Ae(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,
|
|
@@ -940,7 +940,7 @@ class C {
|
|
|
940
940
|
return this.fragments && (t.fragments = this.fragments), this.progression !== void 0 && (t.progression = this.progression), this.totalProgression !== void 0 && (t.totalProgression = this.totalProgression), this.position !== void 0 && (t.position = this.position), this.otherLocations && this.otherLocations.forEach((e, i) => t[i] = e), t;
|
|
941
941
|
}
|
|
942
942
|
}
|
|
943
|
-
class
|
|
943
|
+
class H {
|
|
944
944
|
/**
|
|
945
945
|
* Creates a [Text].
|
|
946
946
|
*/
|
|
@@ -952,7 +952,7 @@ class _ {
|
|
|
952
952
|
*/
|
|
953
953
|
static deserialize(t) {
|
|
954
954
|
if (t)
|
|
955
|
-
return new
|
|
955
|
+
return new H({
|
|
956
956
|
after: t.after,
|
|
957
957
|
before: t.before,
|
|
958
958
|
highlight: t.highlight
|
|
@@ -966,7 +966,7 @@ class _ {
|
|
|
966
966
|
return this.after !== void 0 && (t.after = this.after), this.before !== void 0 && (t.before = this.before), this.highlight !== void 0 && (t.highlight = this.highlight), t;
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
|
-
class
|
|
969
|
+
class k {
|
|
970
970
|
/**
|
|
971
971
|
* Creates a [Locator].
|
|
972
972
|
*/
|
|
@@ -978,12 +978,12 @@ class W {
|
|
|
978
978
|
*/
|
|
979
979
|
static deserialize(t) {
|
|
980
980
|
if (t && t.href && t.type)
|
|
981
|
-
return new
|
|
981
|
+
return new k({
|
|
982
982
|
href: t.href,
|
|
983
983
|
type: t.type,
|
|
984
984
|
title: t.title,
|
|
985
985
|
locations: C.deserialize(t.locations),
|
|
986
|
-
text:
|
|
986
|
+
text: H.deserialize(t.text)
|
|
987
987
|
});
|
|
988
988
|
}
|
|
989
989
|
/**
|
|
@@ -997,7 +997,7 @@ class W {
|
|
|
997
997
|
* Shortcut to get a copy of the [Locator] with different [Locations] sub-properties.
|
|
998
998
|
*/
|
|
999
999
|
copyWithLocations(t) {
|
|
1000
|
-
return new
|
|
1000
|
+
return new k({
|
|
1001
1001
|
href: this.href,
|
|
1002
1002
|
type: this.type,
|
|
1003
1003
|
title: this.title,
|
|
@@ -1006,7 +1006,7 @@ class W {
|
|
|
1006
1006
|
});
|
|
1007
1007
|
}
|
|
1008
1008
|
}
|
|
1009
|
-
class
|
|
1009
|
+
class q {
|
|
1010
1010
|
/**
|
|
1011
1011
|
* Creates a [Link].
|
|
1012
1012
|
*/
|
|
@@ -1018,21 +1018,21 @@ class X {
|
|
|
1018
1018
|
*/
|
|
1019
1019
|
static deserialize(t) {
|
|
1020
1020
|
if (!(!t || typeof t.href != "string"))
|
|
1021
|
-
return new
|
|
1021
|
+
return new q({
|
|
1022
1022
|
href: t.href,
|
|
1023
1023
|
templated: t.templated,
|
|
1024
1024
|
type: t.type,
|
|
1025
1025
|
title: t.title,
|
|
1026
1026
|
rels: t.rel ? Array.isArray(t.rel) ? new Set(t.rel) : /* @__PURE__ */ new Set([t.rel]) : void 0,
|
|
1027
|
-
properties:
|
|
1028
|
-
height:
|
|
1029
|
-
width:
|
|
1030
|
-
size:
|
|
1031
|
-
duration:
|
|
1032
|
-
bitrate:
|
|
1033
|
-
languages:
|
|
1034
|
-
alternates:
|
|
1035
|
-
children:
|
|
1027
|
+
properties: R.deserialize(t.properties),
|
|
1028
|
+
height: O(t.height),
|
|
1029
|
+
width: O(t.width),
|
|
1030
|
+
size: O(t.size),
|
|
1031
|
+
duration: O(t.duration),
|
|
1032
|
+
bitrate: O(t.bitrate),
|
|
1033
|
+
languages: Ae(t.language),
|
|
1034
|
+
alternates: dt.deserialize(t.alternate),
|
|
1035
|
+
children: dt.deserialize(t.children)
|
|
1036
1036
|
});
|
|
1037
1037
|
}
|
|
1038
1038
|
/**
|
|
@@ -1040,7 +1040,7 @@ class X {
|
|
|
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 = Ve(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() {
|
|
@@ -1057,14 +1057,14 @@ class X {
|
|
|
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 ie(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
|
-
return new
|
|
1067
|
-
href: new
|
|
1066
|
+
return new q({
|
|
1067
|
+
href: new ie(this.href).expand(t),
|
|
1068
1068
|
templated: !1
|
|
1069
1069
|
});
|
|
1070
1070
|
}
|
|
@@ -1072,15 +1072,15 @@ class X {
|
|
|
1072
1072
|
* Makes a copy of this [Link] after merging in the given additional other [properties].
|
|
1073
1073
|
*/
|
|
1074
1074
|
addProperties(t) {
|
|
1075
|
-
const e =
|
|
1076
|
-
return e.properties = e.properties ? e.properties?.add(t) : new
|
|
1075
|
+
const e = q.deserialize(this.serialize());
|
|
1076
|
+
return e.properties = e.properties ? e.properties?.add(t) : new R(t), e;
|
|
1077
1077
|
}
|
|
1078
1078
|
/**
|
|
1079
1079
|
* Creates a [Locator] from a reading order [Link].
|
|
1080
1080
|
*/
|
|
1081
1081
|
get locator() {
|
|
1082
1082
|
let t = this.href.split("#");
|
|
1083
|
-
return new
|
|
1083
|
+
return new k({
|
|
1084
1084
|
href: t.length > 0 && t[0] !== void 0 ? t[0] : this.href,
|
|
1085
1085
|
type: this.type ?? "",
|
|
1086
1086
|
title: this.title,
|
|
@@ -1090,7 +1090,7 @@ class X {
|
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
|
-
class
|
|
1093
|
+
class dt {
|
|
1094
1094
|
/**
|
|
1095
1095
|
* Creates a [Links].
|
|
1096
1096
|
*/
|
|
@@ -1102,8 +1102,8 @@ class pt {
|
|
|
1102
1102
|
*/
|
|
1103
1103
|
static deserialize(t) {
|
|
1104
1104
|
if (t && Array.isArray(t))
|
|
1105
|
-
return new
|
|
1106
|
-
t.map((e) =>
|
|
1105
|
+
return new dt(
|
|
1106
|
+
t.map((e) => q.deserialize(e)).filter((e) => e !== void 0)
|
|
1107
1107
|
);
|
|
1108
1108
|
}
|
|
1109
1109
|
/**
|
|
@@ -1184,10 +1184,10 @@ class pt {
|
|
|
1184
1184
|
return this.items.filter((t) => t.type);
|
|
1185
1185
|
}
|
|
1186
1186
|
}
|
|
1187
|
-
|
|
1187
|
+
R.prototype.getContains = function() {
|
|
1188
1188
|
return new Set(this.otherProperties.contains || []);
|
|
1189
1189
|
};
|
|
1190
|
-
class
|
|
1190
|
+
class ut {
|
|
1191
1191
|
/**
|
|
1192
1192
|
* Creates a [DomRange].
|
|
1193
1193
|
*/
|
|
@@ -1199,10 +1199,10 @@ class mt {
|
|
|
1199
1199
|
*/
|
|
1200
1200
|
static deserialize(t) {
|
|
1201
1201
|
if (!(t && t.cssSelector)) return;
|
|
1202
|
-
let e =
|
|
1202
|
+
let e = O(t.textNodeIndex);
|
|
1203
1203
|
if (e === void 0) return;
|
|
1204
|
-
let i =
|
|
1205
|
-
return i === void 0 && (i =
|
|
1204
|
+
let i = O(t.charOffset);
|
|
1205
|
+
return i === void 0 && (i = O(t.offset)), new ut({
|
|
1206
1206
|
cssSelector: t.cssSelector,
|
|
1207
1207
|
textNodeIndex: e,
|
|
1208
1208
|
charOffset: i
|
|
@@ -1219,7 +1219,7 @@ class mt {
|
|
|
1219
1219
|
return this.charOffset !== void 0 && (t.charOffset = this.charOffset), t;
|
|
1220
1220
|
}
|
|
1221
1221
|
}
|
|
1222
|
-
class
|
|
1222
|
+
class Wt {
|
|
1223
1223
|
/**
|
|
1224
1224
|
* Creates a [DomRange].
|
|
1225
1225
|
*/
|
|
@@ -1231,11 +1231,11 @@ class Bt {
|
|
|
1231
1231
|
*/
|
|
1232
1232
|
static deserialize(t) {
|
|
1233
1233
|
if (!t) return;
|
|
1234
|
-
let e =
|
|
1234
|
+
let e = ut.deserialize(t.start);
|
|
1235
1235
|
if (e)
|
|
1236
|
-
return new
|
|
1236
|
+
return new Wt({
|
|
1237
1237
|
start: e,
|
|
1238
|
-
end:
|
|
1238
|
+
end: ut.deserialize(t.end)
|
|
1239
1239
|
});
|
|
1240
1240
|
}
|
|
1241
1241
|
/**
|
|
@@ -1253,7 +1253,7 @@ C.prototype.getPartialCfi = function() {
|
|
|
1253
1253
|
return this.otherLocations?.get("partialCfi");
|
|
1254
1254
|
};
|
|
1255
1255
|
C.prototype.getDomRange = function() {
|
|
1256
|
-
return
|
|
1256
|
+
return Wt.deserialize(this.otherLocations?.get("domRange"));
|
|
1257
1257
|
};
|
|
1258
1258
|
C.prototype.fragmentParameters = function() {
|
|
1259
1259
|
return new Map(
|
|
@@ -1287,7 +1287,7 @@ C.prototype.space = function() {
|
|
|
1287
1287
|
if (t.length === 4 && !t.some(isNaN))
|
|
1288
1288
|
return t;
|
|
1289
1289
|
};
|
|
1290
|
-
class
|
|
1290
|
+
class Ut {
|
|
1291
1291
|
/** Creates a [Price]. */
|
|
1292
1292
|
constructor(t) {
|
|
1293
1293
|
this.currency = t.currency, this.value = t.value;
|
|
@@ -1300,9 +1300,9 @@ class Ht {
|
|
|
1300
1300
|
let e = t.currency;
|
|
1301
1301
|
if (!(e && typeof e == "string" && e.length > 0))
|
|
1302
1302
|
return;
|
|
1303
|
-
let i =
|
|
1303
|
+
let i = O(t.value);
|
|
1304
1304
|
if (i !== void 0)
|
|
1305
|
-
return new
|
|
1305
|
+
return new Ut({ currency: e, value: i });
|
|
1306
1306
|
}
|
|
1307
1307
|
/**
|
|
1308
1308
|
* Serializes a [Price] to its RWPM JSON representation.
|
|
@@ -1311,7 +1311,7 @@ class Ht {
|
|
|
1311
1311
|
return { currency: this.currency, value: this.value };
|
|
1312
1312
|
}
|
|
1313
1313
|
}
|
|
1314
|
-
class
|
|
1314
|
+
class Q {
|
|
1315
1315
|
/** Creates a [Acquisition]. */
|
|
1316
1316
|
constructor(t) {
|
|
1317
1317
|
this.type = t.type, this.children = t.children;
|
|
@@ -1321,14 +1321,14 @@ class j {
|
|
|
1321
1321
|
*/
|
|
1322
1322
|
static deserialize(t) {
|
|
1323
1323
|
if (t && t.type)
|
|
1324
|
-
return new
|
|
1324
|
+
return new Q({
|
|
1325
1325
|
type: t.type,
|
|
1326
|
-
children:
|
|
1326
|
+
children: Q.deserializeArray(t.children)
|
|
1327
1327
|
});
|
|
1328
1328
|
}
|
|
1329
1329
|
static deserializeArray(t) {
|
|
1330
1330
|
if (Array.isArray(t))
|
|
1331
|
-
return t.map((e) =>
|
|
1331
|
+
return t.map((e) => Q.deserialize(e)).filter((e) => e !== void 0);
|
|
1332
1332
|
}
|
|
1333
1333
|
/**
|
|
1334
1334
|
* Serializes a [Acquisition] to its RWPM JSON representation.
|
|
@@ -1338,7 +1338,7 @@ class j {
|
|
|
1338
1338
|
return this.children && (t.children = this.children.map((e) => e.serialize())), t;
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
|
-
class
|
|
1341
|
+
class Bt {
|
|
1342
1342
|
/** Creates a [Price]. */
|
|
1343
1343
|
constructor(t) {
|
|
1344
1344
|
this.total = t.total, this.position = t.position;
|
|
@@ -1348,9 +1348,9 @@ class _t {
|
|
|
1348
1348
|
*/
|
|
1349
1349
|
static deserialize(t) {
|
|
1350
1350
|
if (t)
|
|
1351
|
-
return new
|
|
1352
|
-
total:
|
|
1353
|
-
position:
|
|
1351
|
+
return new Bt({
|
|
1352
|
+
total: O(t.total),
|
|
1353
|
+
position: O(t.position)
|
|
1354
1354
|
});
|
|
1355
1355
|
}
|
|
1356
1356
|
/**
|
|
@@ -1361,7 +1361,7 @@ class _t {
|
|
|
1361
1361
|
return this.total !== void 0 && (t.total = this.total), this.position !== void 0 && (t.position = this.position), t;
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
|
-
class
|
|
1364
|
+
class Ht {
|
|
1365
1365
|
/** Creates a [Copies]. */
|
|
1366
1366
|
constructor(t) {
|
|
1367
1367
|
this.total = t.total, this.available = t.available;
|
|
@@ -1371,9 +1371,9 @@ class Vt {
|
|
|
1371
1371
|
*/
|
|
1372
1372
|
static deserialize(t) {
|
|
1373
1373
|
if (t)
|
|
1374
|
-
return new
|
|
1375
|
-
total:
|
|
1376
|
-
available:
|
|
1374
|
+
return new Ht({
|
|
1375
|
+
total: O(t.total),
|
|
1376
|
+
available: O(t.available)
|
|
1377
1377
|
});
|
|
1378
1378
|
}
|
|
1379
1379
|
/**
|
|
@@ -1384,7 +1384,7 @@ class Vt {
|
|
|
1384
1384
|
return this.total !== void 0 && (t.total = this.total), this.available !== void 0 && (t.available = this.available), t;
|
|
1385
1385
|
}
|
|
1386
1386
|
}
|
|
1387
|
-
class
|
|
1387
|
+
class _t {
|
|
1388
1388
|
/** Creates a [Availability]. */
|
|
1389
1389
|
constructor(t) {
|
|
1390
1390
|
this.state = t.state, this.since = t.since, this.until = t.until;
|
|
@@ -1394,10 +1394,10 @@ class Ft {
|
|
|
1394
1394
|
*/
|
|
1395
1395
|
static deserialize(t) {
|
|
1396
1396
|
if (t && t.state)
|
|
1397
|
-
return new
|
|
1397
|
+
return new _t({
|
|
1398
1398
|
state: t.state,
|
|
1399
|
-
since:
|
|
1400
|
-
until:
|
|
1399
|
+
since: ee(t.since),
|
|
1400
|
+
until: ee(t.until)
|
|
1401
1401
|
});
|
|
1402
1402
|
}
|
|
1403
1403
|
/**
|
|
@@ -1408,89 +1408,89 @@ class Ft {
|
|
|
1408
1408
|
return this.since !== void 0 && (t.since = this.since.toISOString()), this.until !== void 0 && (t.until = this.until.toISOString()), t;
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
-
|
|
1412
|
-
return
|
|
1411
|
+
R.prototype.getNumberOfItems = function() {
|
|
1412
|
+
return O(this.otherProperties.numberOfItems);
|
|
1413
1413
|
};
|
|
1414
|
-
|
|
1415
|
-
return
|
|
1414
|
+
R.prototype.getPrice = function() {
|
|
1415
|
+
return Ut.deserialize(this.otherProperties.price);
|
|
1416
1416
|
};
|
|
1417
|
-
|
|
1417
|
+
R.prototype.getIndirectAcquisitions = function() {
|
|
1418
1418
|
const r = this.otherProperties.indirectAcquisition;
|
|
1419
1419
|
if (r && Array.isArray(r))
|
|
1420
|
-
return r.map((t) =>
|
|
1420
|
+
return r.map((t) => Q.deserialize(t)).filter((t) => t !== void 0);
|
|
1421
1421
|
};
|
|
1422
|
-
|
|
1423
|
-
return
|
|
1422
|
+
R.prototype.getHolds = function() {
|
|
1423
|
+
return Bt.deserialize(this.otherProperties.holds);
|
|
1424
1424
|
};
|
|
1425
|
-
|
|
1426
|
-
return
|
|
1425
|
+
R.prototype.getCopies = function() {
|
|
1426
|
+
return Ht.deserialize(this.otherProperties.copies);
|
|
1427
1427
|
};
|
|
1428
|
-
|
|
1429
|
-
return
|
|
1428
|
+
R.prototype.getAvailability = function() {
|
|
1429
|
+
return _t.deserialize(this.otherProperties.availability);
|
|
1430
1430
|
};
|
|
1431
|
-
|
|
1432
|
-
return
|
|
1431
|
+
R.prototype.getAuthenticate = function() {
|
|
1432
|
+
return q.deserialize(this.otherProperties.authenticate);
|
|
1433
1433
|
};
|
|
1434
|
-
const
|
|
1435
|
-
function
|
|
1436
|
-
console.warn(`${
|
|
1434
|
+
const Fe = "CssSelectorGenerator";
|
|
1435
|
+
function se(r = "unknown problem", ...t) {
|
|
1436
|
+
console.warn(`${Fe}: ${r}`, ...t);
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function Ge(r) {
|
|
1439
1439
|
return r instanceof RegExp;
|
|
1440
1440
|
}
|
|
1441
|
-
function
|
|
1441
|
+
function $e(r) {
|
|
1442
1442
|
return r.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function Ye(r) {
|
|
1445
1445
|
const t = r.map((e) => {
|
|
1446
|
-
if (
|
|
1446
|
+
if (Ge(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" ? (se("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("^" + $e(e) + "$");
|
|
1455
1455
|
return (s) => i.test(s);
|
|
1456
1456
|
}
|
|
1457
|
-
return
|
|
1457
|
+
return se("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
|
+
Ye([
|
|
1462
1462
|
"class",
|
|
1463
1463
|
"id",
|
|
1464
1464
|
// Angular attributes
|
|
1465
1465
|
"ng-*"
|
|
1466
1466
|
]);
|
|
1467
|
-
class
|
|
1467
|
+
class K {
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1469
|
+
function ne(r) {
|
|
1470
1470
|
return r.split("").reverse().join("");
|
|
1471
1471
|
}
|
|
1472
|
-
function
|
|
1473
|
-
const i =
|
|
1472
|
+
function qe(r, t, e) {
|
|
1473
|
+
const i = ne(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 = ne(r.slice(n, s.end));
|
|
1476
1476
|
return {
|
|
1477
|
-
start:
|
|
1477
|
+
start: Ce(o, i, s.errors).reduce((c, u) => s.end - u.end < c ? s.end - u.end : c, s.end),
|
|
1478
1478
|
end: s.end,
|
|
1479
1479
|
errors: s.errors
|
|
1480
1480
|
};
|
|
1481
1481
|
});
|
|
1482
1482
|
}
|
|
1483
|
-
function
|
|
1483
|
+
function vt(r) {
|
|
1484
1484
|
return (r | -r) >> 31 & 1;
|
|
1485
1485
|
}
|
|
1486
|
-
function
|
|
1486
|
+
function re(r, t, e, i) {
|
|
1487
1487
|
let s = r.P[e], n = r.M[e];
|
|
1488
|
-
const o = i >>> 31, a = t[e] | o, c = a | n,
|
|
1489
|
-
let
|
|
1490
|
-
const p =
|
|
1491
|
-
return
|
|
1488
|
+
const o = i >>> 31, a = t[e] | o, c = a | n, u = (a & s) + s ^ s | a;
|
|
1489
|
+
let d = n | ~(u | s), f = s & u;
|
|
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 | ~(c | d), n = d & c, r.P[e] = s, r.M[e] = n, p;
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function Ce(r, t, e) {
|
|
1494
1494
|
if (t.length === 0)
|
|
1495
1495
|
return [];
|
|
1496
1496
|
e = Math.min(e, t.length);
|
|
@@ -1500,64 +1500,64 @@ function Te(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), c = /* @__PURE__ */ new Map(),
|
|
1503
|
+
const a = new Uint32Array(n + 1), c = /* @__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
1508
|
if (c.has(v))
|
|
1509
1509
|
continue;
|
|
1510
|
-
const
|
|
1511
|
-
c.set(v,
|
|
1510
|
+
const g = new Uint32Array(n + 1);
|
|
1511
|
+
c.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) {
|
|
1515
|
-
const
|
|
1516
|
-
if (
|
|
1515
|
+
const D = m * s + b;
|
|
1516
|
+
if (D >= t.length)
|
|
1517
1517
|
continue;
|
|
1518
|
-
t.charCodeAt(
|
|
1518
|
+
t.charCodeAt(D) === v && (g[m] |= 1 << b);
|
|
1519
1519
|
}
|
|
1520
1520
|
}
|
|
1521
1521
|
}
|
|
1522
|
-
let
|
|
1523
|
-
const
|
|
1524
|
-
for (let p = 0; p <=
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
for (let p = 0; p <=
|
|
1522
|
+
let d = Math.max(0, Math.ceil(e / s) - 1);
|
|
1523
|
+
const f = new Uint32Array(n + 1);
|
|
1524
|
+
for (let p = 0; p <= d; p += 1)
|
|
1525
|
+
f[p] = (p + 1) * s;
|
|
1526
|
+
f[n] = t.length;
|
|
1527
|
+
for (let p = 0; p <= d; p += 1)
|
|
1528
1528
|
o.P[p] = -1, o.M[p] = 0;
|
|
1529
1529
|
for (let p = 0; p < r.length; p += 1) {
|
|
1530
1530
|
const v = r.charCodeAt(p);
|
|
1531
|
-
let
|
|
1532
|
-
v <
|
|
1531
|
+
let g;
|
|
1532
|
+
v < u.length ? g = u[v] : (g = c.get(v), typeof g > "u" && (g = a));
|
|
1533
1533
|
let m = 0;
|
|
1534
|
-
for (let b = 0; b <=
|
|
1535
|
-
m =
|
|
1536
|
-
if (
|
|
1537
|
-
|
|
1534
|
+
for (let b = 0; b <= d; b += 1)
|
|
1535
|
+
m = re(o, g, b, m), f[b] += m;
|
|
1536
|
+
if (f[d] - m <= e && d < n && (g[d + 1] & 1 || m < 0)) {
|
|
1537
|
+
d += 1, o.P[d] = -1, o.M[d] = 0;
|
|
1538
1538
|
let b;
|
|
1539
|
-
if (
|
|
1540
|
-
const
|
|
1541
|
-
b =
|
|
1539
|
+
if (d === n) {
|
|
1540
|
+
const D = t.length % s;
|
|
1541
|
+
b = D === 0 ? s : D;
|
|
1542
1542
|
} else
|
|
1543
1543
|
b = s;
|
|
1544
|
-
|
|
1544
|
+
f[d] = f[d - 1] + b - m + re(o, g, d, m);
|
|
1545
1545
|
} else
|
|
1546
|
-
for (;
|
|
1547
|
-
|
|
1548
|
-
|
|
1546
|
+
for (; d > 0 && f[d] >= e + s; )
|
|
1547
|
+
d -= 1;
|
|
1548
|
+
d === n && f[d] <= e && (f[d] < e && i.splice(0, i.length), i.push({
|
|
1549
1549
|
start: -1,
|
|
1550
1550
|
end: p + 1,
|
|
1551
|
-
errors:
|
|
1552
|
-
}), e =
|
|
1551
|
+
errors: f[d]
|
|
1552
|
+
}), e = f[d]);
|
|
1553
1553
|
}
|
|
1554
1554
|
return i;
|
|
1555
1555
|
}
|
|
1556
|
-
function
|
|
1557
|
-
const i =
|
|
1558
|
-
return
|
|
1556
|
+
function Xe(r, t, e) {
|
|
1557
|
+
const i = Ce(r, t, e);
|
|
1558
|
+
return qe(r, t, i);
|
|
1559
1559
|
}
|
|
1560
|
-
function
|
|
1560
|
+
function xe(r, t, e) {
|
|
1561
1561
|
let i = 0;
|
|
1562
1562
|
const s = [];
|
|
1563
1563
|
for (; i !== -1; )
|
|
@@ -1566,30 +1566,30 @@ function Pe(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 : Xe(r, t, e);
|
|
1570
1570
|
}
|
|
1571
|
-
function
|
|
1572
|
-
return t.length === 0 || r.length === 0 ? 0 : 1 -
|
|
1571
|
+
function oe(r, t) {
|
|
1572
|
+
return t.length === 0 || r.length === 0 ? 0 : 1 - xe(r, t, t.length)[0].errors / t.length;
|
|
1573
1573
|
}
|
|
1574
|
-
function
|
|
1574
|
+
function Ke(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 = xe(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 ? oe(
|
|
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,
|
|
1587
|
+
) : 1, g = e.suffix ? oe(
|
|
1588
1588
|
r.slice(a.end, a.end + e.suffix.length),
|
|
1589
1589
|
e.suffix
|
|
1590
1590
|
) : 1;
|
|
1591
1591
|
let m = 1;
|
|
1592
|
-
return typeof e.hint == "number" && (m = 1 - Math.abs(a.start - e.hint) / r.length), (50 * p + 20 * v + 20 *
|
|
1592
|
+
return typeof e.hint == "number" && (m = 1 - Math.abs(a.start - e.hint) / r.length), (50 * p + 20 * v + 20 * g + 2 * m) / 92;
|
|
1593
1593
|
}, o = s.map((a) => ({
|
|
1594
1594
|
start: a.start,
|
|
1595
1595
|
end: a.end,
|
|
@@ -1597,7 +1597,7 @@ function Je(r, t, e = {}) {
|
|
|
1597
1597
|
}));
|
|
1598
1598
|
return o.sort((a, c) => c.score - a.score), o[0];
|
|
1599
1599
|
}
|
|
1600
|
-
function
|
|
1600
|
+
function At(r, t, e) {
|
|
1601
1601
|
const i = e === 1 ? t : t - 1;
|
|
1602
1602
|
if (r.charAt(i).trim() !== "")
|
|
1603
1603
|
return t;
|
|
@@ -1607,7 +1607,7 @@ function xt(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 ae(r, t) {
|
|
1611
1611
|
const e = r.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1612
1612
|
r.commonAncestorContainer,
|
|
1613
1613
|
NodeFilter.SHOW_TEXT
|
|
@@ -1619,8 +1619,8 @@ function ce(r, t) {
|
|
|
1619
1619
|
let o = -1;
|
|
1620
1620
|
const a = () => {
|
|
1621
1621
|
if (n = t === 1 ? e.nextNode() : e.previousNode(), n) {
|
|
1622
|
-
const c = n.textContent,
|
|
1623
|
-
o =
|
|
1622
|
+
const c = n.textContent, u = t === 1 ? 0 : c.length;
|
|
1623
|
+
o = At(c, u, t);
|
|
1624
1624
|
}
|
|
1625
1625
|
};
|
|
1626
1626
|
for (; n && o === -1 && n !== s; )
|
|
@@ -1629,7 +1629,7 @@ function ce(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 Ze(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)
|
|
@@ -1639,13 +1639,13 @@ function Qe(r) {
|
|
|
1639
1639
|
const t = r.cloneRange();
|
|
1640
1640
|
let e = !1, i = !1;
|
|
1641
1641
|
const s = {
|
|
1642
|
-
start:
|
|
1642
|
+
start: At(
|
|
1643
1643
|
r.startContainer.textContent,
|
|
1644
1644
|
r.startOffset,
|
|
1645
1645
|
1
|
|
1646
1646
|
/* Forwards */
|
|
1647
1647
|
),
|
|
1648
|
-
end:
|
|
1648
|
+
end: At(
|
|
1649
1649
|
r.endContainer.textContent,
|
|
1650
1650
|
r.endOffset,
|
|
1651
1651
|
2
|
|
@@ -1655,7 +1655,7 @@ function Qe(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 } = ae(
|
|
1659
1659
|
t,
|
|
1660
1660
|
1
|
|
1661
1661
|
/* Forwards */
|
|
@@ -1663,7 +1663,7 @@ function Qe(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 } = ae(
|
|
1667
1667
|
t,
|
|
1668
1668
|
2
|
|
1669
1669
|
/* Backwards */
|
|
@@ -1672,7 +1672,7 @@ function Qe(r) {
|
|
|
1672
1672
|
}
|
|
1673
1673
|
return t;
|
|
1674
1674
|
}
|
|
1675
|
-
function
|
|
1675
|
+
function Te(r) {
|
|
1676
1676
|
switch (r.nodeType) {
|
|
1677
1677
|
case Node.ELEMENT_NODE:
|
|
1678
1678
|
case Node.TEXT_NODE:
|
|
@@ -1681,13 +1681,13 @@ function Ne(r) {
|
|
|
1681
1681
|
return 0;
|
|
1682
1682
|
}
|
|
1683
1683
|
}
|
|
1684
|
-
function
|
|
1684
|
+
function le(r) {
|
|
1685
1685
|
let t = r.previousSibling, e = 0;
|
|
1686
1686
|
for (; t; )
|
|
1687
|
-
e +=
|
|
1687
|
+
e += Te(t), t = t.previousSibling;
|
|
1688
1688
|
return e;
|
|
1689
1689
|
}
|
|
1690
|
-
function
|
|
1690
|
+
function Pe(r, ...t) {
|
|
1691
1691
|
let e = t.shift();
|
|
1692
1692
|
const i = r.ownerDocument.createNodeIterator(
|
|
1693
1693
|
r,
|
|
@@ -1702,7 +1702,7 @@ function Le(r, ...t) {
|
|
|
1702
1702
|
throw new RangeError("Offset exceeds text length");
|
|
1703
1703
|
return s;
|
|
1704
1704
|
}
|
|
1705
|
-
class
|
|
1705
|
+
class M {
|
|
1706
1706
|
constructor(t, e) {
|
|
1707
1707
|
if (e < 0)
|
|
1708
1708
|
throw new Error("Offset is invalid");
|
|
@@ -1719,8 +1719,8 @@ class k {
|
|
|
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 +=
|
|
1723
|
-
return new
|
|
1722
|
+
i += le(e), e = e.parentElement;
|
|
1723
|
+
return new M(e, i);
|
|
1724
1724
|
}
|
|
1725
1725
|
/**
|
|
1726
1726
|
* Resolve the position to a specific text node and offset within that node.
|
|
@@ -1741,7 +1741,7 @@ class k {
|
|
|
1741
1741
|
*/
|
|
1742
1742
|
resolve(t = {}) {
|
|
1743
1743
|
try {
|
|
1744
|
-
return
|
|
1744
|
+
return Pe(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(
|
|
@@ -1764,9 +1764,9 @@ class k {
|
|
|
1764
1764
|
static fromCharOffset(t, e) {
|
|
1765
1765
|
switch (t.nodeType) {
|
|
1766
1766
|
case Node.TEXT_NODE:
|
|
1767
|
-
return
|
|
1767
|
+
return M.fromPoint(t, e);
|
|
1768
1768
|
case Node.ELEMENT_NODE:
|
|
1769
|
-
return new
|
|
1769
|
+
return new M(t, e);
|
|
1770
1770
|
default:
|
|
1771
1771
|
throw new Error("Node is not an element or text node");
|
|
1772
1772
|
}
|
|
@@ -1784,23 +1784,23 @@ class k {
|
|
|
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 =
|
|
1788
|
-
return new
|
|
1787
|
+
const i = le(t) + e;
|
|
1788
|
+
return new M(t.parentElement, i);
|
|
1789
1789
|
}
|
|
1790
1790
|
case Node.ELEMENT_NODE: {
|
|
1791
1791
|
if (e < 0 || e > t.childNodes.length)
|
|
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 +=
|
|
1796
|
-
return new
|
|
1795
|
+
i += Te(t.childNodes[s]);
|
|
1796
|
+
return new M(t, i);
|
|
1797
1797
|
}
|
|
1798
1798
|
default:
|
|
1799
1799
|
throw new Error("Point is not in an element or text node");
|
|
1800
1800
|
}
|
|
1801
1801
|
}
|
|
1802
1802
|
}
|
|
1803
|
-
class
|
|
1803
|
+
class B {
|
|
1804
1804
|
constructor(t, e) {
|
|
1805
1805
|
this.start = t, this.end = e;
|
|
1806
1806
|
}
|
|
@@ -1810,7 +1810,7 @@ class H {
|
|
|
1810
1810
|
* `end.element`.
|
|
1811
1811
|
*/
|
|
1812
1812
|
relativeTo(t) {
|
|
1813
|
-
return new
|
|
1813
|
+
return new B(
|
|
1814
1814
|
this.start.relativeTo(t),
|
|
1815
1815
|
this.end.relativeTo(t)
|
|
1816
1816
|
);
|
|
@@ -1826,7 +1826,7 @@ class H {
|
|
|
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] = Pe(
|
|
1830
1830
|
this.start.element,
|
|
1831
1831
|
this.start.offset,
|
|
1832
1832
|
this.end.offset
|
|
@@ -1844,20 +1844,20 @@ class H {
|
|
|
1844
1844
|
* Create a TextRange from a (DOM) Range
|
|
1845
1845
|
*/
|
|
1846
1846
|
static fromRange(t) {
|
|
1847
|
-
const e =
|
|
1847
|
+
const e = M.fromPoint(
|
|
1848
1848
|
t.startContainer,
|
|
1849
1849
|
t.startOffset
|
|
1850
|
-
), i =
|
|
1851
|
-
return new
|
|
1850
|
+
), i = M.fromPoint(t.endContainer, t.endOffset);
|
|
1851
|
+
return new B(e, i);
|
|
1852
1852
|
}
|
|
1853
1853
|
/**
|
|
1854
1854
|
* Create a TextRange representing the `start`th to `end`th characters in
|
|
1855
1855
|
* `root`
|
|
1856
1856
|
*/
|
|
1857
1857
|
static fromOffsets(t, e, i) {
|
|
1858
|
-
return new
|
|
1859
|
-
new
|
|
1860
|
-
new
|
|
1858
|
+
return new B(
|
|
1859
|
+
new M(t, e),
|
|
1860
|
+
new M(t, i)
|
|
1861
1861
|
);
|
|
1862
1862
|
}
|
|
1863
1863
|
/**
|
|
@@ -1865,23 +1865,23 @@ class H {
|
|
|
1865
1865
|
* whitespace
|
|
1866
1866
|
*/
|
|
1867
1867
|
static trimmedRange(t) {
|
|
1868
|
-
return
|
|
1868
|
+
return Ze(B.fromRange(t).toRange());
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
|
-
class
|
|
1871
|
+
class pt {
|
|
1872
1872
|
constructor(t, e, i) {
|
|
1873
1873
|
this.root = t, this.start = e, this.end = i;
|
|
1874
1874
|
}
|
|
1875
1875
|
static fromRange(t, e) {
|
|
1876
|
-
const i =
|
|
1877
|
-
return new
|
|
1876
|
+
const i = B.fromRange(e).relativeTo(t);
|
|
1877
|
+
return new pt(
|
|
1878
1878
|
t,
|
|
1879
1879
|
i.start.offset,
|
|
1880
1880
|
i.end.offset
|
|
1881
1881
|
);
|
|
1882
1882
|
}
|
|
1883
1883
|
static fromSelector(t, e) {
|
|
1884
|
-
return new
|
|
1884
|
+
return new pt(t, e.start, e.end);
|
|
1885
1885
|
}
|
|
1886
1886
|
toSelector() {
|
|
1887
1887
|
return {
|
|
@@ -1891,10 +1891,10 @@ class ft {
|
|
|
1891
1891
|
};
|
|
1892
1892
|
}
|
|
1893
1893
|
toRange() {
|
|
1894
|
-
return
|
|
1894
|
+
return B.fromOffsets(this.root, this.start, this.end).toRange();
|
|
1895
1895
|
}
|
|
1896
1896
|
}
|
|
1897
|
-
class
|
|
1897
|
+
class mt {
|
|
1898
1898
|
/**
|
|
1899
1899
|
* @param root - A root element from which to anchor.
|
|
1900
1900
|
*/
|
|
@@ -1907,15 +1907,15 @@ class gt {
|
|
|
1907
1907
|
* Will throw if `range` does not contain any text nodes.
|
|
1908
1908
|
*/
|
|
1909
1909
|
static fromRange(t, e) {
|
|
1910
|
-
const i = t.textContent, s =
|
|
1911
|
-
return new
|
|
1910
|
+
const i = t.textContent, s = B.fromRange(e).relativeTo(t), n = s.start.offset, o = s.end.offset, a = 32;
|
|
1911
|
+
return new mt(t, i.slice(n, o), {
|
|
1912
1912
|
prefix: i.slice(Math.max(0, n - a), n),
|
|
1913
1913
|
suffix: i.slice(o, Math.min(i.length, o + a))
|
|
1914
1914
|
});
|
|
1915
1915
|
}
|
|
1916
1916
|
static fromSelector(t, e) {
|
|
1917
1917
|
const { prefix: i, suffix: s } = e;
|
|
1918
|
-
return new
|
|
1918
|
+
return new mt(t, e.exact, { prefix: i, suffix: s });
|
|
1919
1919
|
}
|
|
1920
1920
|
toSelector() {
|
|
1921
1921
|
return {
|
|
@@ -1929,26 +1929,26 @@ class gt {
|
|
|
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 = Ke(e, this.exact, {
|
|
1933
1933
|
...this.context,
|
|
1934
1934
|
hint: t.hint
|
|
1935
1935
|
});
|
|
1936
1936
|
if (!i)
|
|
1937
1937
|
throw new Error("Quote not found");
|
|
1938
|
-
return new
|
|
1938
|
+
return new pt(this.root, i.start, i.end);
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function Je(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
|
}
|
|
1945
|
-
function
|
|
1945
|
+
function nt(r, t) {
|
|
1946
1946
|
try {
|
|
1947
1947
|
const e = t.locations, i = t.text;
|
|
1948
1948
|
if (i && i.highlight) {
|
|
1949
1949
|
let s;
|
|
1950
1950
|
e && e.getCssSelector() && (s = r.querySelector(e.getCssSelector())), s || (s = r.body);
|
|
1951
|
-
const n = new
|
|
1951
|
+
const n = new mt(s, i.highlight, {
|
|
1952
1952
|
prefix: i.before,
|
|
1953
1953
|
suffix: i.after
|
|
1954
1954
|
});
|
|
@@ -1967,7 +1967,7 @@ function rt(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 || Je(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
|
|
1971
1971
|
}
|
|
1972
1972
|
}
|
|
1973
1973
|
} catch (e) {
|
|
@@ -1975,51 +1975,51 @@ function rt(r, t) {
|
|
|
1975
1975
|
}
|
|
1976
1976
|
return null;
|
|
1977
1977
|
}
|
|
1978
|
-
function
|
|
1978
|
+
function Qe(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 = [];
|
|
1982
|
-
for (const
|
|
1982
|
+
for (const u of e)
|
|
1983
1983
|
s.push({
|
|
1984
|
-
bottom:
|
|
1985
|
-
height:
|
|
1986
|
-
left:
|
|
1987
|
-
right:
|
|
1988
|
-
top:
|
|
1989
|
-
width:
|
|
1984
|
+
bottom: u.bottom,
|
|
1985
|
+
height: u.height,
|
|
1986
|
+
left: u.left,
|
|
1987
|
+
right: u.right,
|
|
1988
|
+
top: u.top,
|
|
1989
|
+
width: u.width
|
|
1990
1990
|
});
|
|
1991
|
-
const n =
|
|
1991
|
+
const n = Ne(
|
|
1992
1992
|
s,
|
|
1993
1993
|
i
|
|
1994
|
-
), o =
|
|
1995
|
-
for (let
|
|
1996
|
-
const
|
|
1997
|
-
if (!(
|
|
1994
|
+
), o = ti(n, i), a = Le(o), c = 4;
|
|
1995
|
+
for (let u = a.length - 1; u >= 0; u--) {
|
|
1996
|
+
const d = a[u];
|
|
1997
|
+
if (!(d.width * d.height > c))
|
|
1998
1998
|
if (a.length > 1)
|
|
1999
|
-
a.splice(
|
|
1999
|
+
a.splice(u, 1);
|
|
2000
2000
|
else
|
|
2001
2001
|
break;
|
|
2002
2002
|
}
|
|
2003
2003
|
return a;
|
|
2004
2004
|
}
|
|
2005
|
-
function
|
|
2005
|
+
function Ne(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 =
|
|
2012
|
-
if (a && !c &&
|
|
2013
|
-
const
|
|
2014
|
-
return
|
|
2015
|
-
|
|
2011
|
+
const a = I(n.top, o.top, t) && I(n.bottom, o.bottom, t), c = I(n.left, o.left, t) && I(n.right, o.right, t);
|
|
2012
|
+
if (a && !c && Oe(n, o, t)) {
|
|
2013
|
+
const f = r.filter((v) => v !== n && v !== o), p = je(n, o);
|
|
2014
|
+
return f.push(p), Ne(
|
|
2015
|
+
f,
|
|
2016
2016
|
t
|
|
2017
2017
|
);
|
|
2018
2018
|
}
|
|
2019
2019
|
}
|
|
2020
2020
|
return r;
|
|
2021
2021
|
}
|
|
2022
|
-
function
|
|
2022
|
+
function je(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 ei(r, t) {
|
|
|
2030
2030
|
width: i - e
|
|
2031
2031
|
};
|
|
2032
2032
|
}
|
|
2033
|
-
function
|
|
2033
|
+
function ti(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 ii(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) && ei(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
|
|
2049
|
-
return
|
|
2048
|
+
function ei(r, t, e) {
|
|
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
|
-
function
|
|
2052
|
-
return (r.left < t ||
|
|
2051
|
+
function at(r, t, e, i) {
|
|
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 Le(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 && Oe(i, s, -1)) {
|
|
2059
2059
|
let n = [], o;
|
|
2060
|
-
const a =
|
|
2060
|
+
const a = ce(i, s);
|
|
2061
2061
|
if (a.length === 1)
|
|
2062
2062
|
n = a, o = i;
|
|
2063
2063
|
else {
|
|
2064
|
-
const
|
|
2065
|
-
a.length <
|
|
2064
|
+
const u = ce(s, i);
|
|
2065
|
+
a.length < u.length ? (n = a, o = i) : (n = u, o = s);
|
|
2066
2066
|
}
|
|
2067
|
-
const c = r.filter((
|
|
2068
|
-
return Array.prototype.push.apply(c, n),
|
|
2067
|
+
const c = r.filter((u) => u !== o);
|
|
2068
|
+
return Array.prototype.push.apply(c, n), Le(c);
|
|
2069
2069
|
}
|
|
2070
2070
|
}
|
|
2071
2071
|
return r;
|
|
2072
2072
|
}
|
|
2073
|
-
function
|
|
2074
|
-
const e =
|
|
2073
|
+
function ce(r, t) {
|
|
2074
|
+
const e = ii(t, r);
|
|
2075
2075
|
if (e.height === 0 || e.width === 0)
|
|
2076
2076
|
return [r];
|
|
2077
2077
|
const i = [];
|
|
@@ -2121,7 +2121,7 @@ function de(r, t) {
|
|
|
2121
2121
|
}
|
|
2122
2122
|
return i;
|
|
2123
2123
|
}
|
|
2124
|
-
function
|
|
2124
|
+
function ii(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,52 +2132,52 @@ function ni(r, t) {
|
|
|
2132
2132
|
width: Math.max(0, i - e)
|
|
2133
2133
|
};
|
|
2134
2134
|
}
|
|
2135
|
-
function
|
|
2136
|
-
return (r.left < t.right || e >= 0 &&
|
|
2135
|
+
function Oe(r, t, e) {
|
|
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
|
-
function
|
|
2138
|
+
function I(r, t, e) {
|
|
2139
2139
|
return Math.abs(r - t) <= e;
|
|
2140
2140
|
}
|
|
2141
|
-
function
|
|
2141
|
+
function Vt(r) {
|
|
2142
2142
|
const t = {}, e = r.document.documentElement.style;
|
|
2143
2143
|
for (const i in r.document.documentElement.style)
|
|
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
|
|
2148
|
-
const e =
|
|
2147
|
+
function Re(r, t) {
|
|
2148
|
+
const e = Vt(r);
|
|
2149
2149
|
Object.keys(e).forEach((i) => {
|
|
2150
|
-
t.hasOwnProperty(i) ||
|
|
2150
|
+
t.hasOwnProperty(i) || gt(r, i);
|
|
2151
2151
|
}), Object.entries(t).forEach(([i, s]) => {
|
|
2152
|
-
e[i] !== s &&
|
|
2152
|
+
e[i] !== s && st(r, i, s);
|
|
2153
2153
|
});
|
|
2154
2154
|
}
|
|
2155
|
-
function
|
|
2155
|
+
function wt(r, t) {
|
|
2156
2156
|
return r.document.documentElement.style.getPropertyValue(t);
|
|
2157
2157
|
}
|
|
2158
|
-
function
|
|
2158
|
+
function st(r, t, e) {
|
|
2159
2159
|
r.document.documentElement.style.setProperty(t, e);
|
|
2160
2160
|
}
|
|
2161
|
-
function
|
|
2161
|
+
function gt(r, t) {
|
|
2162
2162
|
r.document.documentElement.style.removeProperty(t);
|
|
2163
2163
|
}
|
|
2164
|
-
let
|
|
2165
|
-
const
|
|
2166
|
-
if (!
|
|
2164
|
+
let lt = null, St = null, J = 0;
|
|
2165
|
+
const G = { r: 255, g: 255, b: 255, a: 1 }, F = /* @__PURE__ */ new Map(), si = () => {
|
|
2166
|
+
if (!lt)
|
|
2167
2167
|
if (typeof OffscreenCanvas < "u")
|
|
2168
|
-
|
|
2168
|
+
lt = new OffscreenCanvas(5, 5), St = lt.getContext("2d", {
|
|
2169
2169
|
willReadFrequently: !0,
|
|
2170
2170
|
desynchronized: !0
|
|
2171
2171
|
});
|
|
2172
2172
|
else {
|
|
2173
2173
|
const r = document.createElement("canvas");
|
|
2174
|
-
r.width = 5, r.height = 5,
|
|
2174
|
+
r.width = 5, r.height = 5, lt = r, St = r.getContext("2d", {
|
|
2175
2175
|
willReadFrequently: !0,
|
|
2176
2176
|
desynchronized: !0
|
|
2177
2177
|
});
|
|
2178
2178
|
}
|
|
2179
|
-
return
|
|
2180
|
-
},
|
|
2179
|
+
return St;
|
|
2180
|
+
}, ni = (r) => {
|
|
2181
2181
|
if (!r) return !0;
|
|
2182
2182
|
const t = r.trim().toLowerCase();
|
|
2183
2183
|
return t.startsWith("var(") || [
|
|
@@ -2196,56 +2196,56 @@ const $ = { r: 255, g: 255, b: 255, a: 1 }, G = /* @__PURE__ */ new Map(), ri =
|
|
|
2196
2196
|
"repeating-radial-gradient",
|
|
2197
2197
|
"repeating-conic-gradient"
|
|
2198
2198
|
].some((s) => t.includes(s));
|
|
2199
|
-
},
|
|
2199
|
+
}, ct = (r, t) => {
|
|
2200
2200
|
console.warn(
|
|
2201
|
-
`[Decorator] Could not parse color: "${r}". ${t} Falling back to ${JSON.stringify(
|
|
2201
|
+
`[Decorator] Could not parse color: "${r}". ${t} Falling back to ${JSON.stringify(G)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`
|
|
2202
2202
|
);
|
|
2203
|
-
},
|
|
2204
|
-
const e = t ? `${r}|${t}` : r, i =
|
|
2203
|
+
}, Ct = (r, t = null) => {
|
|
2204
|
+
const e = t ? `${r}|${t}` : r, i = F.get(e);
|
|
2205
2205
|
if (i !== void 0)
|
|
2206
|
-
return i ??
|
|
2207
|
-
if (
|
|
2208
|
-
return
|
|
2209
|
-
const s =
|
|
2206
|
+
return i ?? G;
|
|
2207
|
+
if (ni(r))
|
|
2208
|
+
return ct(r, "Unsupported color format or special value."), F.set(e, null), G;
|
|
2209
|
+
const s = si();
|
|
2210
2210
|
if (!s)
|
|
2211
|
-
return
|
|
2211
|
+
return ct(r, "Could not get canvas context."), F.set(e, null), G;
|
|
2212
2212
|
try {
|
|
2213
|
-
|
|
2214
|
-
const n =
|
|
2213
|
+
J === 0 && s.clearRect(0, 0, 5, 5);
|
|
2214
|
+
const n = J % 5, o = Math.floor(J / 5);
|
|
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
|
-
|
|
2218
|
-
const [c,
|
|
2219
|
-
if (
|
|
2220
|
-
return
|
|
2221
|
-
const p = { r: c, g:
|
|
2222
|
-
return
|
|
2217
|
+
J = (J + 1) % 25;
|
|
2218
|
+
const [c, u, d, f] = a.data;
|
|
2219
|
+
if (f === 0)
|
|
2220
|
+
return ct(r, "Fully transparent color."), F.set(e, null), G;
|
|
2221
|
+
const p = { r: c, g: u, b: d, a: f / 255 };
|
|
2222
|
+
return F.set(e, p), p;
|
|
2223
2223
|
} catch (n) {
|
|
2224
|
-
return
|
|
2224
|
+
return ct(r, `Error: ${n instanceof Error ? n.message : String(n)}`), F.set(e, null), G;
|
|
2225
2225
|
}
|
|
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
|
-
},
|
|
2230
|
-
const t =
|
|
2229
|
+
}, he = (r) => {
|
|
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" ?
|
|
2232
|
+
}, de = (r, t) => {
|
|
2233
|
+
const e = typeof r == "string" ? Ct(r) : r, i = typeof t == "string" ? Ct(t) : t, s = he(e), n = he(i), o = Math.max(s, n), a = Math.min(s, n);
|
|
2234
2234
|
return (o + 0.05) / (a + 0.05);
|
|
2235
|
-
},
|
|
2236
|
-
const e =
|
|
2235
|
+
}, xt = (r, t = null) => {
|
|
2236
|
+
const e = Ct(r, t), i = de(e, { r: 255, g: 255, b: 255, a: 1 }), s = de(e, { r: 0, g: 0, b: 0, a: 1 });
|
|
2237
2237
|
return i > s;
|
|
2238
|
-
},
|
|
2239
|
-
var
|
|
2240
|
-
const
|
|
2241
|
-
class
|
|
2238
|
+
}, ri = (r, t = null) => xt(r, t) ? "white" : "black", ue = "#FFFF00";
|
|
2239
|
+
var oi = /* @__PURE__ */ ((r) => (r.Wrap = "wrap", r.Viewport = "viewport", r.Bounds = "bounds", r.Page = "page", r))(oi || {}), ai = /* @__PURE__ */ ((r) => (r.Boxes = "boxes", r.Bounds = "bounds", r))(ai || {});
|
|
2240
|
+
const li = () => "Highlight" in window, pe = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2241
|
+
class ci {
|
|
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, li() && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
|
|
2249
2249
|
}
|
|
2250
2250
|
get activeable() {
|
|
2251
2251
|
return this.activateable;
|
|
@@ -2258,13 +2258,13 @@ class di {
|
|
|
2258
2258
|
* @param decoration Decoration to add
|
|
2259
2259
|
*/
|
|
2260
2260
|
add(t) {
|
|
2261
|
-
const e = `${this.id}-${this.lastItemId++}`, i =
|
|
2261
|
+
const e = `${this.id}-${this.lastItemId++}`, i = nt(this.wnd.document, t.locator);
|
|
2262
2262
|
if (!i) {
|
|
2263
2263
|
this.comms.log("Can't locate DOM range for decoration", t);
|
|
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 && (pe.includes(s.nodeName.toUpperCase()) && this.notTextFlag?.set(e, !0), i.cloneContents().querySelector(pe.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 di {
|
|
|
2305
2305
|
experimentalLayout(t) {
|
|
2306
2306
|
const [e, i] = this.requireContainer(!0);
|
|
2307
2307
|
i.add(t.range);
|
|
2308
|
-
const s =
|
|
2308
|
+
const s = wt(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"), n = t.decoration?.style?.tint ?? ue;
|
|
2309
2309
|
e.innerHTML = `
|
|
2310
2310
|
::highlight(${this.id}) {
|
|
2311
|
-
color: ${
|
|
2311
|
+
color: ${ri(n, s)};
|
|
2312
2312
|
background-color: ${n};
|
|
2313
2313
|
}`;
|
|
2314
2314
|
}
|
|
@@ -2325,28 +2325,28 @@ class di {
|
|
|
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, c = o.scrollTop,
|
|
2329
|
-
if (
|
|
2330
|
-
|
|
2331
|
-
let
|
|
2332
|
-
|
|
2328
|
+
), n = i / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, c = o.scrollTop, u = (g, m, b) => {
|
|
2329
|
+
if (g.style.position = "absolute", t.decoration?.style?.width === "viewport") {
|
|
2330
|
+
g.style.width = `${i}px`, g.style.height = `${m.height}px`;
|
|
2331
|
+
let D = Math.floor(m.left / i) * i;
|
|
2332
|
+
g.style.left = `${D + a}px`, g.style.top = `${m.top + c}px`;
|
|
2333
2333
|
} else if (t.decoration?.style?.width === "bounds")
|
|
2334
|
-
|
|
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 + c}px`;
|
|
2335
2335
|
else if (t.decoration?.style?.width === "page") {
|
|
2336
|
-
|
|
2337
|
-
let
|
|
2338
|
-
|
|
2336
|
+
g.style.width = `${n}px`, g.style.height = `${m.height}px`;
|
|
2337
|
+
let D = Math.floor(m.left / n) * n;
|
|
2338
|
+
g.style.left = `${D + a}px`, g.style.top = `${m.top + c}px`;
|
|
2339
2339
|
} else
|
|
2340
|
-
|
|
2341
|
-
},
|
|
2342
|
-
let
|
|
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 + c}px`;
|
|
2341
|
+
}, d = t.range.getBoundingClientRect();
|
|
2342
|
+
let f = this.wnd.document.createElement("template");
|
|
2343
2343
|
const p = this.getCurrentDarkMode();
|
|
2344
|
-
|
|
2344
|
+
f.innerHTML = `
|
|
2345
2345
|
<div
|
|
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 ?? ue} !important`,
|
|
2350
2350
|
//"opacity: 0.3 !important",
|
|
2351
2351
|
`mix-blend-mode: ${p ? "exclusion" : "multiply"} !important`,
|
|
2352
2352
|
"opacity: 1 !important",
|
|
@@ -2355,18 +2355,18 @@ class di {
|
|
|
2355
2355
|
>
|
|
2356
2356
|
</div>
|
|
2357
2357
|
`.trim();
|
|
2358
|
-
const v =
|
|
2358
|
+
const v = f.content.firstElementChild;
|
|
2359
2359
|
if (t.decoration?.style?.layout === "bounds") {
|
|
2360
|
-
const
|
|
2361
|
-
|
|
2360
|
+
const g = v.cloneNode(!0);
|
|
2361
|
+
g.style.setProperty("pointer-events", "none"), u(g, d, d), e.append(g);
|
|
2362
2362
|
} else {
|
|
2363
|
-
let
|
|
2363
|
+
let g = Qe(
|
|
2364
2364
|
t.range
|
|
2365
2365
|
);
|
|
2366
|
-
|
|
2367
|
-
for (let m of
|
|
2366
|
+
g = g.sort((m, b) => m.top < b.top ? -1 : m.top > b.top ? 1 : 0);
|
|
2367
|
+
for (let m of g) {
|
|
2368
2368
|
const b = v.cloneNode(!0);
|
|
2369
|
-
b.style.setProperty("pointer-events", "none"),
|
|
2369
|
+
b.style.setProperty("pointer-events", "none"), u(b, m, d), e.append(b);
|
|
2370
2370
|
}
|
|
2371
2371
|
}
|
|
2372
2372
|
t.container = e, t.clickableElements = Array.from(
|
|
@@ -2393,7 +2393,7 @@ class di {
|
|
|
2393
2393
|
return this.container || (this.container = this.wnd.document.createElement("div"), this.container.setAttribute("id", this.id), this.container.dataset.group = this.name, this.container.dataset.readium = "true", this.container.style.setProperty("pointer-events", "none"), this.container.style.display = "contents", this.wnd.document.body.append(this.container)), this.container;
|
|
2394
2394
|
}
|
|
2395
2395
|
getCurrentDarkMode() {
|
|
2396
|
-
return
|
|
2396
|
+
return wt(this.wnd, "--USER__appearance") === "readium-night-on" || xt(wt(this.wnd, "--USER__backgroundColor")) || xt(this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"));
|
|
2397
2397
|
}
|
|
2398
2398
|
/**
|
|
2399
2399
|
* Removes the group container.
|
|
@@ -2402,7 +2402,7 @@ class di {
|
|
|
2402
2402
|
this.experimentalHighlights && this.wnd.CSS.highlights.delete(this.id), this.container && (this.container.remove(), this.container = void 0);
|
|
2403
2403
|
}
|
|
2404
2404
|
}
|
|
2405
|
-
const
|
|
2405
|
+
const j = class j extends K {
|
|
2406
2406
|
constructor() {
|
|
2407
2407
|
super(...arguments), this.resizeFrame = 0, this.lastGroupId = 0, this.groups = /* @__PURE__ */ new Map(), this.handleResizer = this.handleResize.bind(this);
|
|
2408
2408
|
}
|
|
@@ -2427,9 +2427,9 @@ const tt = class tt extends Z {
|
|
|
2427
2427
|
}, 50);
|
|
2428
2428
|
}
|
|
2429
2429
|
mount(t, e) {
|
|
2430
|
-
return this.wnd = t, e.register("decorate",
|
|
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 =
|
|
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 ci(
|
|
2433
2433
|
t,
|
|
2434
2434
|
e,
|
|
2435
2435
|
`readium-decoration-${this.lastGroupId++}`,
|
|
@@ -2454,8 +2454,8 @@ const tt = class tt extends Z {
|
|
|
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, c = o.getAttribute("style"),
|
|
2458
|
-
return
|
|
2457
|
+
const o = n.target, a = n.oldValue, c = o.getAttribute("style"), u = this.extractCustomProperty(a, "--USER__appearance"), d = this.extractCustomProperty(c, "--USER__appearance"), f = this.extractCustomProperty(a, "--USER__backgroundColor"), p = this.extractCustomProperty(c, "--USER__backgroundColor");
|
|
2458
|
+
return u !== d || f !== p;
|
|
2459
2459
|
}
|
|
2460
2460
|
return !1;
|
|
2461
2461
|
}) && this.updateHighlightStyles();
|
|
@@ -2467,12 +2467,12 @@ const tt = class tt extends Z {
|
|
|
2467
2467
|
}), e.log("Decorator Mounted"), !0;
|
|
2468
2468
|
}
|
|
2469
2469
|
unmount(t, e) {
|
|
2470
|
-
return t.removeEventListener("orientationchange", this.handleResizer), t.removeEventListener("resize", this.handleResizer), e.unregisterAll(
|
|
2470
|
+
return t.removeEventListener("orientationchange", this.handleResizer), t.removeEventListener("resize", this.handleResizer), e.unregisterAll(j.moduleName), this.resizeObserver.disconnect(), this.backgroundObserver.disconnect(), this.cleanup(), e.log("Decorator Unmounted"), !0;
|
|
2471
2471
|
}
|
|
2472
2472
|
};
|
|
2473
|
-
|
|
2474
|
-
let
|
|
2475
|
-
const
|
|
2473
|
+
j.moduleName = "decorator";
|
|
2474
|
+
let Tt = j;
|
|
2475
|
+
const me = "readium-snapper-style", tt = class tt extends K {
|
|
2476
2476
|
constructor() {
|
|
2477
2477
|
super(...arguments), this.protected = !1;
|
|
2478
2478
|
}
|
|
@@ -2485,48 +2485,51 @@ const ge = "readium-snapper-style", et = class et extends Z {
|
|
|
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 = me, 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
|
-
}), e.register("unprotect",
|
|
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(me)?.remove(), e.log("Snapper Unmounted"), !0;
|
|
2496
2496
|
}
|
|
2497
2497
|
};
|
|
2498
|
-
|
|
2499
|
-
let
|
|
2500
|
-
function
|
|
2501
|
-
return (r.document.
|
|
2498
|
+
tt.moduleName = "snapper";
|
|
2499
|
+
let X = tt;
|
|
2500
|
+
function hi(r) {
|
|
2501
|
+
return (r.document.documentElement.dir || r.document.body.dir).toLowerCase() === "rtl";
|
|
2502
|
+
}
|
|
2503
|
+
function di(r) {
|
|
2504
|
+
return (r.getComputedStyle(r.document.documentElement).writingMode || r.getComputedStyle(r.document.body).writingMode) === "vertical-lr";
|
|
2502
2505
|
}
|
|
2503
|
-
function
|
|
2506
|
+
function De(r) {
|
|
2504
2507
|
return parseInt(
|
|
2505
2508
|
r.getComputedStyle(
|
|
2506
2509
|
r.document.documentElement
|
|
2507
2510
|
).getPropertyValue("column-count")
|
|
2508
2511
|
);
|
|
2509
2512
|
}
|
|
2510
|
-
function
|
|
2513
|
+
function fe(r) {
|
|
2511
2514
|
const t = getComputedStyle(r), e = parseFloat(t.paddingTop || "0"), i = parseFloat(t.paddingBottom || "0");
|
|
2512
2515
|
return r.clientHeight - e - i;
|
|
2513
2516
|
}
|
|
2514
|
-
function
|
|
2515
|
-
const t =
|
|
2517
|
+
function ge(r) {
|
|
2518
|
+
const t = De(r);
|
|
2516
2519
|
if (!t)
|
|
2517
2520
|
return !1;
|
|
2518
2521
|
const e = r.document.querySelectorAll("div[id^='readium-virtual-page']");
|
|
2519
|
-
for (const
|
|
2520
|
-
|
|
2522
|
+
for (const u of e)
|
|
2523
|
+
u.remove();
|
|
2521
2524
|
const i = e.length, s = r.document.scrollingElement.scrollWidth, n = r.visualViewport.width, a = Math.round(s / n * t) % t, c = t === 1 || a === 0 ? 0 : t - a;
|
|
2522
2525
|
if (c > 0)
|
|
2523
|
-
for (let
|
|
2524
|
-
const
|
|
2525
|
-
|
|
2526
|
+
for (let u = 0; u < c; u++) {
|
|
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 = fe(r.document.documentElement) + "px"), d.innerHTML = "​", r.document.body.appendChild(d);
|
|
2526
2529
|
}
|
|
2527
2530
|
return i !== c;
|
|
2528
2531
|
}
|
|
2529
|
-
function
|
|
2532
|
+
function Ft(r) {
|
|
2530
2533
|
const t = r.document.createElement("style");
|
|
2531
2534
|
t.appendChild(r.document.createTextNode("*{}")), r.document.body.appendChild(t), r.document.body.removeChild(t);
|
|
2532
2535
|
}
|
|
@@ -2551,14 +2554,14 @@ const pi = [
|
|
|
2551
2554
|
"textarea",
|
|
2552
2555
|
"video"
|
|
2553
2556
|
];
|
|
2554
|
-
function
|
|
2555
|
-
return pi.indexOf(r.nodeName.toLowerCase()) !== -1 || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" ? r : r.parentElement ?
|
|
2557
|
+
function Ie(r) {
|
|
2558
|
+
return pi.indexOf(r.nodeName.toLowerCase()) !== -1 || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" ? r : r.parentElement ? Ie(r.parentElement) : null;
|
|
2556
2559
|
}
|
|
2557
|
-
function
|
|
2558
|
-
const e =
|
|
2560
|
+
function yt(r, t) {
|
|
2561
|
+
const e = ze(r, r.document.body, t), i = r._readium_cssSelectorGenerator.getCssSelector(e, {
|
|
2559
2562
|
selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
|
|
2560
2563
|
});
|
|
2561
|
-
return new
|
|
2564
|
+
return new k({
|
|
2562
2565
|
href: "#",
|
|
2563
2566
|
type: "application/xhtml+xml",
|
|
2564
2567
|
locations: new C({
|
|
@@ -2566,16 +2569,16 @@ function vt(r, t) {
|
|
|
2566
2569
|
["cssSelector", i]
|
|
2567
2570
|
])
|
|
2568
2571
|
}),
|
|
2569
|
-
text: new
|
|
2572
|
+
text: new H({
|
|
2570
2573
|
highlight: e.textContent || void 0
|
|
2571
2574
|
})
|
|
2572
2575
|
});
|
|
2573
2576
|
}
|
|
2574
|
-
function
|
|
2577
|
+
function ze(r, t, e) {
|
|
2575
2578
|
for (var i = 0; i < t.children.length; i++) {
|
|
2576
2579
|
const s = t.children[i];
|
|
2577
2580
|
if (!gi(s) && mi(r, s, e))
|
|
2578
|
-
return fi(r, s) ? s :
|
|
2581
|
+
return fi(r, s) ? s : ze(r, s, e);
|
|
2579
2582
|
}
|
|
2580
2583
|
return t;
|
|
2581
2584
|
}
|
|
@@ -2611,7 +2614,7 @@ const yi = {
|
|
|
2611
2614
|
// Reasonable default for detecting patterns
|
|
2612
2615
|
maxConsistentScrolls: 15
|
|
2613
2616
|
// Balanced threshold for flagging
|
|
2614
|
-
},
|
|
2617
|
+
}, Gt = {
|
|
2615
2618
|
maxVelocity: 200,
|
|
2616
2619
|
// Extremely fast scrolling (pixels/ms)
|
|
2617
2620
|
minVariance: 1e-5,
|
|
@@ -2622,7 +2625,7 @@ const yi = {
|
|
|
2622
2625
|
// Only trigger on near-perfect patterns
|
|
2623
2626
|
maxConsistentScrolls: 20
|
|
2624
2627
|
// Need many consistent scrolls
|
|
2625
|
-
},
|
|
2628
|
+
}, Me = {
|
|
2626
2629
|
maxSelectionsPerSecond: 500,
|
|
2627
2630
|
minVariance: 50,
|
|
2628
2631
|
historySize: 20
|
|
@@ -2633,7 +2636,7 @@ const yi = {
|
|
|
2633
2636
|
absoluteMaxChars: 5e3,
|
|
2634
2637
|
historySize: 20
|
|
2635
2638
|
};
|
|
2636
|
-
class
|
|
2639
|
+
class bt {
|
|
2637
2640
|
constructor(t = {}) {
|
|
2638
2641
|
this.history = [], this.consistentScrollCount = 0, this.options = { ...yi, ...t };
|
|
2639
2642
|
}
|
|
@@ -2648,8 +2651,8 @@ class wt {
|
|
|
2648
2651
|
}), this.history = this.history.filter((m) => n - m.timestamp < 2e3).slice(-(this.options.historySize || 20)), this.history.length < 3) return !1;
|
|
2649
2652
|
if (s > this.options.maxVelocity)
|
|
2650
2653
|
return this.resetAfterDetection(), !0;
|
|
2651
|
-
const o = this.history.map((m) => m.velocity), a = this.history.map((m) => m.distance), c = o.reduce((m, b) => m + b, 0) / o.length,
|
|
2652
|
-
if (
|
|
2654
|
+
const o = this.history.map((m) => m.velocity), a = this.history.map((m) => m.distance), c = 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 - c, 2), 0) / o.length, f = a.reduce((m, b) => m + Math.pow(b - u, 2), 0) / a.length;
|
|
2655
|
+
if (d < this.options.minVariance && f < u * 0.1) {
|
|
2653
2656
|
if (this.consistentScrollCount++, this.consistentScrollCount >= (this.options.maxConsistentScrolls || 10))
|
|
2654
2657
|
return this.resetAfterDetection(), !0;
|
|
2655
2658
|
} else
|
|
@@ -2666,9 +2669,9 @@ class wt {
|
|
|
2666
2669
|
this.history = [], this.consistentScrollCount = 0;
|
|
2667
2670
|
}
|
|
2668
2671
|
}
|
|
2669
|
-
const
|
|
2672
|
+
const ye = "readium-column-snapper-style", vi = 200, T = class T extends X {
|
|
2670
2673
|
constructor() {
|
|
2671
|
-
super(...arguments), this.isSnapProtectionEnabled = !1, this.patternAnalyzer = null, this.lastTurnTime = 0, 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);
|
|
2674
|
+
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);
|
|
2672
2675
|
}
|
|
2673
2676
|
doc() {
|
|
2674
2677
|
return this.wnd.document.scrollingElement;
|
|
@@ -2678,7 +2681,7 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2678
2681
|
return t !== 0 ? t : this.alreadyScrollLeft;
|
|
2679
2682
|
}
|
|
2680
2683
|
snapOffset(t) {
|
|
2681
|
-
const e = t + (
|
|
2684
|
+
const e = t + (this.rtl ? -1 : 1);
|
|
2682
2685
|
return e - e % this.wnd.innerWidth;
|
|
2683
2686
|
}
|
|
2684
2687
|
/**
|
|
@@ -2695,8 +2698,8 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2695
2698
|
* scrollLeft may be negative depending on the browser — Math.abs() normalizes it.
|
|
2696
2699
|
*/
|
|
2697
2700
|
normScroll() {
|
|
2698
|
-
const t =
|
|
2699
|
-
return
|
|
2701
|
+
const t = this.doc().scrollLeft || this.alreadyScrollLeft;
|
|
2702
|
+
return this.rtl ? Math.abs(t) : Math.max(0, this.wnd.scrollX > 0 ? this.wnd.scrollX : t);
|
|
2700
2703
|
}
|
|
2701
2704
|
reportProgress() {
|
|
2702
2705
|
const t = this.cachedScrollWidth, e = this.wnd.innerWidth, i = this.normScroll(), s = Math.max(1, t - e), n = Math.max(0, Math.min(1, i / s)), o = Math.max(0, Math.min(1, (i + e) / t));
|
|
@@ -2707,7 +2710,7 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2707
2710
|
}
|
|
2708
2711
|
shake() {
|
|
2709
2712
|
if (this.overscroll !== 0 || this.shakeTimeout !== 0) return;
|
|
2710
|
-
const t = this.doc(), e = this.normScroll() < 5, i =
|
|
2713
|
+
const t = this.doc(), e = this.normScroll() < 5, i = this.rtl ? e ? "readium-bounce-r" : "readium-bounce-l" : "readium-bounce-r";
|
|
2711
2714
|
t.classList.add(i);
|
|
2712
2715
|
const s = this.scrollOffset();
|
|
2713
2716
|
this.shakeTimeout = this.wnd.setTimeout(() => {
|
|
@@ -2722,21 +2725,21 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2722
2725
|
}
|
|
2723
2726
|
// Snaps the current offset to the page width.
|
|
2724
2727
|
snapCurrentOffset(t = !1, e = !1) {
|
|
2725
|
-
const i =
|
|
2726
|
-
if (this.checkSuspiciousSnap(
|
|
2728
|
+
const i = this.doc(), s = De(this.wnd), n = this.cachedScrollWidth - this.wnd.innerWidth, o = Math.min(Math.max(0, this.normScroll()), n), a = this.dragOffset(), c = this.rtl ? -a : a, u = this.wnd.innerWidth / 3 * (c > 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
|
+
if (this.checkSuspiciousSnap(v, Math.abs(f - p)), t && f !== p) {
|
|
2727
2730
|
this.snappingCancelled = !1;
|
|
2728
|
-
const
|
|
2729
|
-
let
|
|
2730
|
-
const
|
|
2731
|
+
const g = (_, V, rt, ot) => rt > ot ? V : _ + (V - _) * ui(rt / ot), m = vi * s;
|
|
2732
|
+
let b;
|
|
2733
|
+
const D = (_) => {
|
|
2731
2734
|
if (this.snappingCancelled) return;
|
|
2732
|
-
|
|
2733
|
-
const
|
|
2734
|
-
|
|
2735
|
+
b || (b = _);
|
|
2736
|
+
const V = _ - b, rt = g(this.overscroll, 0, V, m), ot = g(p, f, V, m);
|
|
2737
|
+
i.scrollLeft = ot, this.overscroll !== 0 && (i.style.transform = `translate3d(${-rt}px, 0px, 0px)`), V < m ? this.wnd.requestAnimationFrame(D) : (this.clearTouches(), i.style.removeProperty("transform"), i.scrollLeft = f, e || this.reportProgress());
|
|
2735
2738
|
};
|
|
2736
|
-
this.wnd.requestAnimationFrame(
|
|
2739
|
+
this.wnd.requestAnimationFrame(D);
|
|
2737
2740
|
} else
|
|
2738
|
-
|
|
2739
|
-
|
|
2741
|
+
i.style.removeProperty("transform"), this.wnd.requestAnimationFrame(() => {
|
|
2742
|
+
i.scrollLeft = f, this.clearTouches(), e || this.reportProgress();
|
|
2740
2743
|
});
|
|
2741
2744
|
}
|
|
2742
2745
|
dragOffset() {
|
|
@@ -2761,8 +2764,8 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2761
2764
|
}
|
|
2762
2765
|
onTouchEnd(t) {
|
|
2763
2766
|
if (this.touchState === 2) {
|
|
2764
|
-
const e = this.dragOffset(), i =
|
|
2765
|
-
this.cachedScrollWidth <= this.wnd.innerWidth ? (this.reportProgress(),
|
|
2767
|
+
const e = this.dragOffset(), i = this.normScroll(), s = this.cachedScrollWidth - this.wnd.innerWidth, n = this.rtl ? -e : e;
|
|
2768
|
+
this.cachedScrollWidth <= this.wnd.innerWidth ? (this.reportProgress(), n > 5 && this.comms.send("no_more", void 0), n < -5 && this.comms.send("no_less", void 0)) : i < 5 && n < 5 ? (this.alreadyScrollLeft = 0, this.comms.send("no_less", void 0)) : s - i < 5 && n > 5 && (this.alreadyScrollLeft = this.rtl ? -s : s, this.comms.send("no_more", void 0)), this.snapCurrentOffset(!0), this.comms.send("swipe", e);
|
|
2766
2769
|
}
|
|
2767
2770
|
this.touchState = 0;
|
|
2768
2771
|
}
|
|
@@ -2772,11 +2775,11 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2772
2775
|
onTouchMove(t) {
|
|
2773
2776
|
if (this.touchState === 0) return;
|
|
2774
2777
|
this.touchState === 1 && (this.touchState = 2, A(this.wnd)), this.endingX = t.touches[0].clientX;
|
|
2775
|
-
const e = this.dragOffset(), i = this.alreadyScrollLeft + e, s =
|
|
2778
|
+
const e = this.dragOffset(), i = this.alreadyScrollLeft + e, s = this.rtl ? -(this.cachedScrollWidth - this.wnd.innerWidth) : 0, n = this.rtl ? 0 : this.cachedScrollWidth - this.wnd.innerWidth;
|
|
2776
2779
|
i < s ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`) : i > n ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-i}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = i);
|
|
2777
2780
|
}
|
|
2778
2781
|
enableSnapProtection() {
|
|
2779
|
-
this.patternAnalyzer || (this.patternAnalyzer = new
|
|
2782
|
+
this.patternAnalyzer || (this.patternAnalyzer = new bt({
|
|
2780
2783
|
maxVelocity: this.wnd.innerWidth,
|
|
2781
2784
|
// page width
|
|
2782
2785
|
minVariance: 0.1,
|
|
@@ -2799,10 +2802,10 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2799
2802
|
});
|
|
2800
2803
|
}
|
|
2801
2804
|
mount(t, e) {
|
|
2802
|
-
if (this.wnd = t, this.comms = e, !super.mount(t, e)) return !1;
|
|
2805
|
+
if (this.wnd = t, this.comms = e, this.rtl = hi(t), !super.mount(t, e)) return !1;
|
|
2803
2806
|
t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "paginated");
|
|
2804
2807
|
const i = t.document.createElement("style");
|
|
2805
|
-
i.dataset.readium = "true", i.id =
|
|
2808
|
+
i.dataset.readium = "true", i.id = ye, i.textContent = `
|
|
2806
2809
|
@keyframes readium-bounce-l-animation {
|
|
2807
2810
|
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2808
2811
|
50% {transform: translate3d(-50px, 0, 0);}
|
|
@@ -2838,14 +2841,14 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2838
2841
|
}
|
|
2839
2842
|
`, t.document.head.appendChild(i), this.resizeObserver = new ResizeObserver(() => {
|
|
2840
2843
|
t.requestAnimationFrame(() => {
|
|
2841
|
-
t &&
|
|
2844
|
+
t && ge(t);
|
|
2842
2845
|
}), this.onWidthChange();
|
|
2843
2846
|
}), this.resizeObserver.observe(t.document.body), this.mutationObserver = new MutationObserver((o) => {
|
|
2844
2847
|
for (const a of o)
|
|
2845
2848
|
if (a.target === this.wnd.document.documentElement) {
|
|
2846
|
-
const c = a.oldValue,
|
|
2847
|
-
(!
|
|
2848
|
-
t &&
|
|
2849
|
+
const c = a.oldValue, u = a.target.getAttribute("style"), d = /transform\s*:\s*([^;]+)/, f = c?.match(d), p = u?.match(d);
|
|
2850
|
+
(!f && !p || f && !p || f && p && f[1] !== p[1]) && (t.requestAnimationFrame(() => {
|
|
2851
|
+
t && ge(t);
|
|
2849
2852
|
}), this.onWidthChange());
|
|
2850
2853
|
} else
|
|
2851
2854
|
t.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
@@ -2869,8 +2872,8 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2869
2872
|
}
|
|
2870
2873
|
this.wnd.requestAnimationFrame(() => {
|
|
2871
2874
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2872
|
-
const
|
|
2873
|
-
|
|
2875
|
+
const d = (this.cachedScrollWidth - t.innerWidth) * c;
|
|
2876
|
+
this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(d) : this.doc().scrollLeft = this.snapOffset(d), this.reportProgress(), A(this.wnd), a(!0);
|
|
2874
2877
|
});
|
|
2875
2878
|
}), e.register("go_id", T.moduleName, (o, a) => {
|
|
2876
2879
|
const c = t.document.getElementById(o);
|
|
@@ -2879,33 +2882,33 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2879
2882
|
return;
|
|
2880
2883
|
}
|
|
2881
2884
|
this.wnd.requestAnimationFrame(() => {
|
|
2882
|
-
|
|
2885
|
+
this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(c.getBoundingClientRect().left + t.scrollX) : this.doc().scrollLeft = this.snapOffset(c.getBoundingClientRect().left + t.scrollX), this.reportProgress(), A(this.wnd), a(!0);
|
|
2883
2886
|
});
|
|
2884
2887
|
}), e.register("go_text", T.moduleName, (o, a) => {
|
|
2885
2888
|
let c;
|
|
2886
2889
|
Array.isArray(o) && (o.length > 1 && (c = o[1]), o = o[0]);
|
|
2887
|
-
const
|
|
2890
|
+
const u = H.deserialize(o), d = nt(this.wnd.document, new k({
|
|
2888
2891
|
href: t.location.href,
|
|
2889
2892
|
type: "text/html",
|
|
2890
|
-
text:
|
|
2893
|
+
text: u,
|
|
2891
2894
|
locations: c ? new C({
|
|
2892
2895
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2893
2896
|
["cssSelector", c]
|
|
2894
2897
|
])
|
|
2895
2898
|
}) : void 0
|
|
2896
2899
|
}));
|
|
2897
|
-
if (!
|
|
2900
|
+
if (!d) {
|
|
2898
2901
|
a(!1);
|
|
2899
2902
|
return;
|
|
2900
2903
|
}
|
|
2901
2904
|
this.wnd.requestAnimationFrame(() => {
|
|
2902
|
-
|
|
2905
|
+
this.rtl ? this.doc().scrollLeft = -this.snapNormOffset(d.getBoundingClientRect().left + t.scrollX) : this.doc().scrollLeft = this.snapOffset(d.getBoundingClientRect().left + t.scrollX), this.reportProgress(), A(this.wnd), a(!0);
|
|
2903
2906
|
});
|
|
2904
2907
|
}), e.register("go_end", T.moduleName, (o, a) => {
|
|
2905
2908
|
this.wnd.requestAnimationFrame(() => {
|
|
2906
2909
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2907
2910
|
let c;
|
|
2908
|
-
if (
|
|
2911
|
+
if (this.rtl ? c = -this.snapNormOffset(this.cachedScrollWidth - t.innerWidth) : c = this.snapOffset(this.cachedScrollWidth), this.doc().scrollLeft === c) return a(!1);
|
|
2909
2912
|
this.doc().scrollLeft = c, this.reportProgress(), A(this.wnd), a(!0);
|
|
2910
2913
|
});
|
|
2911
2914
|
}), e.register("go_start", T.moduleName, (o, a) => {
|
|
@@ -2917,13 +2920,13 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2917
2920
|
this.wnd.requestAnimationFrame(() => {
|
|
2918
2921
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2919
2922
|
let c;
|
|
2920
|
-
|
|
2923
|
+
this.rtl ? c = n(this.normScroll() - t.innerWidth) : c = s(t.scrollX - t.innerWidth), this.reportProgress(), c && (A(this.wnd), this.checkSuspiciousSnap("left", this.wnd.innerWidth)), a(c);
|
|
2921
2924
|
});
|
|
2922
2925
|
}), e.register("go_next", T.moduleName, (o, a) => {
|
|
2923
2926
|
this.wnd.requestAnimationFrame(() => {
|
|
2924
2927
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2925
2928
|
let c;
|
|
2926
|
-
|
|
2929
|
+
this.rtl ? c = n(this.normScroll() + t.innerWidth) : c = s(t.scrollX + t.innerWidth), this.reportProgress(), c && (A(this.wnd), this.checkSuspiciousSnap("right", this.wnd.innerWidth)), a(c);
|
|
2927
2930
|
});
|
|
2928
2931
|
}), e.register("unfocus", T.moduleName, (o, a) => {
|
|
2929
2932
|
this.snappingCancelled = !0, A(this.wnd), a(!0);
|
|
@@ -2934,18 +2937,18 @@ const ve = "readium-column-snapper-style", vi = 200, T = class T extends K {
|
|
|
2934
2937
|
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), a(!0);
|
|
2935
2938
|
});
|
|
2936
2939
|
}), e.register("first_visible_locator", T.moduleName, (o, a) => {
|
|
2937
|
-
const c =
|
|
2940
|
+
const c = yt(t, !1);
|
|
2938
2941
|
this.comms.send("first_visible_locator", c.serialize()), a(!0);
|
|
2939
2942
|
}), 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", () => {
|
|
2940
2943
|
}), e.log("ColumnSnapper Mounted"), !0;
|
|
2941
2944
|
}
|
|
2942
2945
|
unmount(t, e) {
|
|
2943
|
-
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(
|
|
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(ye)?.remove(), e.log("ColumnSnapper Unmounted"), super.unmount(t, e);
|
|
2944
2947
|
}
|
|
2945
2948
|
};
|
|
2946
2949
|
T.moduleName = "column_snapper";
|
|
2947
|
-
let
|
|
2948
|
-
const
|
|
2950
|
+
let Pt = T;
|
|
2951
|
+
const be = "readium-scroll-snapper-style", P = class P extends X {
|
|
2949
2952
|
constructor() {
|
|
2950
2953
|
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) => {
|
|
2951
2954
|
if (this.comms.ready && !this.isResizing) {
|
|
@@ -2991,12 +2994,12 @@ const we = "readium-scroll-snapper-style", P = class P extends K {
|
|
|
2991
2994
|
});
|
|
2992
2995
|
}
|
|
2993
2996
|
enableScrollProtection() {
|
|
2994
|
-
this.patternAnalyzer || (this.patternAnalyzer = new
|
|
2997
|
+
this.patternAnalyzer || (this.patternAnalyzer = new bt(Gt), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
2995
2998
|
}
|
|
2996
2999
|
mount(t, e) {
|
|
2997
3000
|
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");
|
|
2998
3001
|
const i = t.document.createElement("style");
|
|
2999
|
-
return i.dataset.readium = "true", i.id =
|
|
3002
|
+
return i.dataset.readium = "true", i.id = be, i.textContent = `
|
|
3000
3003
|
* {
|
|
3001
3004
|
scrollbar-width: none; /* for Firefox */
|
|
3002
3005
|
}
|
|
@@ -3009,7 +3012,7 @@ const we = "readium-scroll-snapper-style", P = class P extends K {
|
|
|
3009
3012
|
this.isResizing = !1, this.resizeDebounce = null, this.reportProgress();
|
|
3010
3013
|
}, 50);
|
|
3011
3014
|
}), this.resizeObserver.observe(t.document.body), t.addEventListener("scroll", this.handleScroll, { passive: !0 }), e.register("force_webkit_recalc", P.moduleName, () => {
|
|
3012
|
-
|
|
3015
|
+
Ft(this.wnd);
|
|
3013
3016
|
const s = this.doc().scrollTop;
|
|
3014
3017
|
s > 1 ? this.doc().scrollTop = s - 1 : this.doc().scrollTop = s + 1, this.doc().scrollTop = s;
|
|
3015
3018
|
}), e.register("go_progression", P.moduleName, (s, n) => {
|
|
@@ -3035,7 +3038,7 @@ const we = "readium-scroll-snapper-style", P = class P extends K {
|
|
|
3035
3038
|
}), e.register("go_text", P.moduleName, (s, n) => {
|
|
3036
3039
|
let o;
|
|
3037
3040
|
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
3038
|
-
const a =
|
|
3041
|
+
const a = H.deserialize(s), c = nt(this.wnd.document, new k({
|
|
3039
3042
|
href: t.location.href,
|
|
3040
3043
|
type: "text/html",
|
|
3041
3044
|
text: a,
|
|
@@ -3068,17 +3071,17 @@ const we = "readium-scroll-snapper-style", P = class P extends K {
|
|
|
3068
3071
|
], P.moduleName, (s, n) => n(!1)), e.register("focus", P.moduleName, (s, n) => {
|
|
3069
3072
|
this.reportProgress(), n(!0);
|
|
3070
3073
|
}), e.register("first_visible_locator", P.moduleName, (s, n) => {
|
|
3071
|
-
const o =
|
|
3074
|
+
const o = yt(t, !0);
|
|
3072
3075
|
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
3073
3076
|
}), e.log("ScrollSnapper Mounted"), !0;
|
|
3074
3077
|
}
|
|
3075
3078
|
unmount(t, e) {
|
|
3076
|
-
return e.unregisterAll(P.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(
|
|
3079
|
+
return e.unregisterAll(P.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(be)?.remove(), this.patternAnalyzer && (this.patternAnalyzer.clear(), this.patternAnalyzer = null, this.isScrollProtectionEnabled = !1), e.log("ScrollSnapper Unmounted"), !0;
|
|
3077
3080
|
}
|
|
3078
3081
|
};
|
|
3079
3082
|
P.moduleName = "scroll_snapper";
|
|
3080
|
-
let
|
|
3081
|
-
const N = class N extends
|
|
3083
|
+
let Nt = P;
|
|
3084
|
+
const N = class N extends X {
|
|
3082
3085
|
constructor() {
|
|
3083
3086
|
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) => {
|
|
3084
3087
|
if (this.comms.ready && !this.isResizing) {
|
|
@@ -3124,7 +3127,7 @@ const N = class N extends K {
|
|
|
3124
3127
|
});
|
|
3125
3128
|
}
|
|
3126
3129
|
enableScrollProtection() {
|
|
3127
|
-
this.patternAnalyzer || (this.patternAnalyzer = new
|
|
3130
|
+
this.patternAnalyzer || (this.patternAnalyzer = new bt(Gt), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
3128
3131
|
}
|
|
3129
3132
|
mount(t, e) {
|
|
3130
3133
|
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(() => {
|
|
@@ -3132,7 +3135,7 @@ const N = class N extends K {
|
|
|
3132
3135
|
this.isResizing = !1, this.resizeDebounce = null, this.reportProgress();
|
|
3133
3136
|
}, 50);
|
|
3134
3137
|
}), this.resizeObserver.observe(t.document.body), t.addEventListener("scroll", this.handleScroll, { passive: !0 }), e.register("force_webkit_recalc", N.moduleName, () => {
|
|
3135
|
-
|
|
3138
|
+
Ft(this.wnd);
|
|
3136
3139
|
const i = this.doc().scrollTop;
|
|
3137
3140
|
i > 1 ? this.doc().scrollTop = i - 1 : this.doc().scrollTop = i + 1, this.doc().scrollTop = i;
|
|
3138
3141
|
}), e.register("go_progression", N.moduleName, (i, s) => {
|
|
@@ -3158,7 +3161,7 @@ const N = class N extends K {
|
|
|
3158
3161
|
}), e.register("go_text", N.moduleName, (i, s) => {
|
|
3159
3162
|
let n;
|
|
3160
3163
|
Array.isArray(i) && (i.length > 1 && (n = i[1]), i = i[0]);
|
|
3161
|
-
const o =
|
|
3164
|
+
const o = H.deserialize(i), a = nt(this.wnd.document, new k({
|
|
3162
3165
|
href: t.location.href,
|
|
3163
3166
|
type: "text/html",
|
|
3164
3167
|
text: o,
|
|
@@ -3191,7 +3194,7 @@ const N = class N extends K {
|
|
|
3191
3194
|
], N.moduleName, (i, s) => s(!1)), e.register("focus", N.moduleName, (i, s) => {
|
|
3192
3195
|
this.reportProgress(), s(!0);
|
|
3193
3196
|
}), e.register("first_visible_locator", N.moduleName, (i, s) => {
|
|
3194
|
-
const n =
|
|
3197
|
+
const n = yt(t, !0);
|
|
3195
3198
|
e.send("first_visible_locator", n.serialize()), s(!0);
|
|
3196
3199
|
}), e.log("WebPubSnapper Mounted"), !0;
|
|
3197
3200
|
}
|
|
@@ -3200,7 +3203,7 @@ const N = class N extends K {
|
|
|
3200
3203
|
}
|
|
3201
3204
|
};
|
|
3202
3205
|
N.moduleName = "webpub_snapper";
|
|
3203
|
-
let
|
|
3206
|
+
let Lt = N;
|
|
3204
3207
|
class wi {
|
|
3205
3208
|
constructor(t, e) {
|
|
3206
3209
|
this.window = t, this.copyHistory = [], this.lastSelectionLength = 0, this.lastSelectionTime = 0, this.options = e;
|
|
@@ -3227,22 +3230,22 @@ class wi {
|
|
|
3227
3230
|
length: s,
|
|
3228
3231
|
wasBlocked: !1
|
|
3229
3232
|
}), !0;
|
|
3230
|
-
const c = o - this.lastSelectionTime < 100 && s > this.lastSelectionLength * 1.5,
|
|
3233
|
+
const c = o - this.lastSelectionTime < 100 && s > this.lastSelectionLength * 1.5, u = Math.min(
|
|
3231
3234
|
n * this.options.maxSelectionPercent,
|
|
3232
3235
|
this.options.absoluteMaxChars
|
|
3233
|
-
),
|
|
3236
|
+
), d = this.isSuspiciousPattern(o), f = s > u || c || d;
|
|
3234
3237
|
return this.copyHistory.push({
|
|
3235
3238
|
timestamp: o,
|
|
3236
3239
|
length: s,
|
|
3237
|
-
wasBlocked:
|
|
3238
|
-
}),
|
|
3240
|
+
wasBlocked: f
|
|
3241
|
+
}), f ? (t?.preventDefault(), !1) : (this.lastSelectionLength = s, this.lastSelectionTime = o, !0);
|
|
3239
3242
|
}
|
|
3240
3243
|
destroy() {
|
|
3241
3244
|
this.lastSelectionLength = 0, this.lastSelectionTime = 0, this.copyHistory = [], this.options.enabled = !1;
|
|
3242
3245
|
}
|
|
3243
3246
|
}
|
|
3244
3247
|
class Si {
|
|
3245
|
-
constructor(t =
|
|
3248
|
+
constructor(t = Me) {
|
|
3246
3249
|
this.options = t, this.events = [], this.selectionStartTime = 0, this.lastSelectionTime = 0, this.lastSelectionPosition = 0, this.selectionPatterns = [], this.lastSelectedText = "";
|
|
3247
3250
|
}
|
|
3248
3251
|
analyze(t) {
|
|
@@ -3309,13 +3312,13 @@ class Ei {
|
|
|
3309
3312
|
createActivityEvent(t, e, i, s) {
|
|
3310
3313
|
let n;
|
|
3311
3314
|
if (s) {
|
|
3312
|
-
const o = s.getSelection(), a = o?.toString() || "",
|
|
3313
|
-
|
|
3315
|
+
const o = s.getSelection(), a = o?.toString() || "", u = (a && o?.rangeCount ? o.getRangeAt(0)?.getClientRects() : null)?.[0];
|
|
3316
|
+
u && a && (n = {
|
|
3314
3317
|
text: a,
|
|
3315
|
-
x:
|
|
3316
|
-
y:
|
|
3317
|
-
width:
|
|
3318
|
-
height:
|
|
3318
|
+
x: u.x,
|
|
3319
|
+
y: u.y,
|
|
3320
|
+
width: u.width,
|
|
3321
|
+
height: u.height
|
|
3319
3322
|
});
|
|
3320
3323
|
}
|
|
3321
3324
|
return {
|
|
@@ -3341,8 +3344,8 @@ class Ei {
|
|
|
3341
3344
|
n.push(...o.keyCombos.map((a) => ({
|
|
3342
3345
|
...a,
|
|
3343
3346
|
handler: (c) => {
|
|
3344
|
-
const
|
|
3345
|
-
i(
|
|
3347
|
+
const u = o.type, d = this.createActivityEvent(c, u, t, s);
|
|
3348
|
+
i(d);
|
|
3346
3349
|
}
|
|
3347
3350
|
})));
|
|
3348
3351
|
}), n;
|
|
@@ -3361,7 +3364,7 @@ class Ei {
|
|
|
3361
3364
|
};
|
|
3362
3365
|
}
|
|
3363
3366
|
}
|
|
3364
|
-
const
|
|
3367
|
+
const Y = class Y extends K {
|
|
3365
3368
|
constructor() {
|
|
3366
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 Ei(), this.keyDownHandler = null, this.preventBulkCopy = (t) => {
|
|
3367
3370
|
if (!this.isBulkCopyProtectionEnabled || !this.bulkCopyProtector)
|
|
@@ -3494,7 +3497,7 @@ const q = class q extends Z {
|
|
|
3494
3497
|
}
|
|
3495
3498
|
addSelectionMonitoring(t) {
|
|
3496
3499
|
if (this.isSelectionMonitoringEnabled || !this.wnd) return;
|
|
3497
|
-
const e = t ||
|
|
3500
|
+
const e = t || Me;
|
|
3498
3501
|
this.selectionAnalyzer = new Si(e), this.wnd.document.addEventListener("selectionchange", this.handleSelection), this.isSelectionMonitoringEnabled = !0;
|
|
3499
3502
|
}
|
|
3500
3503
|
removeSelectionMonitoring() {
|
|
@@ -3528,7 +3531,7 @@ const q = class q extends Z {
|
|
|
3528
3531
|
y: t.clientY * i,
|
|
3529
3532
|
targetFrameSrc: this.wnd.location.href,
|
|
3530
3533
|
targetElement: t.target.outerHTML,
|
|
3531
|
-
interactiveElement:
|
|
3534
|
+
interactiveElement: Ie(t.target)?.outerHTML,
|
|
3532
3535
|
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(t.target)
|
|
3533
3536
|
}), this.pointerMoved = !1;
|
|
3534
3537
|
}
|
|
@@ -3555,7 +3558,7 @@ const q = class q extends Z {
|
|
|
3555
3558
|
}
|
|
3556
3559
|
}
|
|
3557
3560
|
registerProtectionHandlers() {
|
|
3558
|
-
this.comms?.register("peripherals_protection",
|
|
3561
|
+
this.comms?.register("peripherals_protection", Y.moduleName, (t, e) => {
|
|
3559
3562
|
const i = t;
|
|
3560
3563
|
if (!this.configApplied) {
|
|
3561
3564
|
if (this.configApplied = !0, i.monitorSelection) {
|
|
@@ -3573,7 +3576,7 @@ const q = class q extends Z {
|
|
|
3573
3576
|
}), this.comms?.log("Copy protection enabled")), i.disableContextMenu && (this.addContextMenuPrevention(), this.comms?.log("Context menu protection enabled")), i.disableDragAndDrop && (this.addDragAndDropPrevention(), this.comms?.log("Drag and drop protection enabled"));
|
|
3574
3577
|
}
|
|
3575
3578
|
e(!0);
|
|
3576
|
-
}), this.comms?.register("keyboard_peripherals",
|
|
3579
|
+
}), this.comms?.register("keyboard_peripherals", Y.moduleName, (t, e) => {
|
|
3577
3580
|
const i = t;
|
|
3578
3581
|
i && i.length > 0 && (this.enableKeyboardPeripherals(i), this.comms?.log(`Keyboard peripherals enabled: ${i.map((s) => s.type).join(", ")}`)), e(!0);
|
|
3579
3582
|
});
|
|
@@ -3582,12 +3585,12 @@ const q = class q extends Z {
|
|
|
3582
3585
|
return this.wnd = t, this.comms = e, this.registerProtectionHandlers(), t.document.addEventListener("pointerdown", this.onPointerDown), t.document.addEventListener("pointerup", this.onPointerUp), t.document.addEventListener("pointermove", this.onPointerMove), t.document.addEventListener("click", this.onClicker), e.log("Peripherals Mounted"), !0;
|
|
3583
3586
|
}
|
|
3584
3587
|
unmount(t, e) {
|
|
3585
|
-
return this.removeBulkCopyProtection(), this.removeSelectionMonitoring(), this.removeContextMenuPrevention(), this.removeDragAndDropPrevention(), this.disableKeyboardPeripherals(), this.cleanupCallbacks.forEach((i) => i()), this.cleanupCallbacks = [], t.document.removeEventListener("pointerdown", this.onPointerDown), t.document.removeEventListener("pointerup", this.onPointerUp), t.document.removeEventListener("pointermove", this.onPointerMove), t.document.removeEventListener("click", this.onClicker), e.unregisterAll(
|
|
3588
|
+
return this.removeBulkCopyProtection(), this.removeSelectionMonitoring(), this.removeContextMenuPrevention(), this.removeDragAndDropPrevention(), this.disableKeyboardPeripherals(), this.cleanupCallbacks.forEach((i) => i()), this.cleanupCallbacks = [], t.document.removeEventListener("pointerdown", this.onPointerDown), t.document.removeEventListener("pointerup", this.onPointerUp), t.document.removeEventListener("pointermove", this.onPointerMove), t.document.removeEventListener("click", this.onClicker), e.unregisterAll(Y.moduleName), this.configApplied = !1, e.log("Peripherals Unmounted"), !0;
|
|
3586
3589
|
}
|
|
3587
3590
|
};
|
|
3588
|
-
|
|
3589
|
-
let
|
|
3590
|
-
const
|
|
3591
|
+
Y.moduleName = "peripherals";
|
|
3592
|
+
let Ot = Y;
|
|
3593
|
+
const et = class et extends K {
|
|
3591
3594
|
constructor() {
|
|
3592
3595
|
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
3593
3596
|
}
|
|
@@ -3637,7 +3640,7 @@ const it = class it extends Z {
|
|
|
3637
3640
|
), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
|
|
3638
3641
|
value: {
|
|
3639
3642
|
name: "readium-ts-toolkit",
|
|
3640
|
-
version: "2.4.0
|
|
3643
|
+
version: "2.4.0",
|
|
3641
3644
|
hasFeature: (s, n = "") => {
|
|
3642
3645
|
switch (s) {
|
|
3643
3646
|
case "dom-manipulation":
|
|
@@ -3662,11 +3665,11 @@ const it = class it extends Z {
|
|
|
3662
3665
|
writable: !1
|
|
3663
3666
|
}), "getAnimations" in t.document && t.document.getAnimations().forEach((s) => {
|
|
3664
3667
|
s.cancel(), this.allAnimations.add(s);
|
|
3665
|
-
}), e.register("activate",
|
|
3668
|
+
}), e.register("activate", et.moduleName, (s, n) => {
|
|
3666
3669
|
this.allAnimations.forEach((o) => {
|
|
3667
3670
|
o.cancel(), o.play();
|
|
3668
3671
|
}), n(!0);
|
|
3669
|
-
}), e.register("unfocus",
|
|
3672
|
+
}), e.register("unfocus", et.moduleName, (s, n) => {
|
|
3670
3673
|
this.pauseAllMedia(t), this.allAnimations.forEach((o) => o.pause()), n(!0);
|
|
3671
3674
|
});
|
|
3672
3675
|
const i = t.document.querySelectorAll("audio,video");
|
|
@@ -3684,46 +3687,46 @@ const it = class it extends Z {
|
|
|
3684
3687
|
return t.removeEventListener("error", this.wndOnErr), t.removeEventListener("play", this.onMediaPlayEvent), t.removeEventListener("pause", this.onMediaPauseEvent), this.allAnimations.forEach((i) => i.cancel()), this.allAnimations.clear(), e.log("Setup Unmounted"), !0;
|
|
3685
3688
|
}
|
|
3686
3689
|
};
|
|
3687
|
-
|
|
3688
|
-
let
|
|
3689
|
-
const
|
|
3690
|
+
et.moduleName = "setup";
|
|
3691
|
+
let ft = et;
|
|
3692
|
+
const ve = "readium-viewport", W = class W extends ft {
|
|
3690
3693
|
onViewportWidthChanged(t) {
|
|
3691
3694
|
const e = t.target;
|
|
3692
|
-
|
|
3695
|
+
st(e, "--RS__viewportWidth", `${e.innerWidth}px`);
|
|
3693
3696
|
}
|
|
3694
3697
|
mount(t, e) {
|
|
3695
3698
|
if (!super.mount(t, e)) return !1;
|
|
3696
3699
|
const i = t.document.createElement("meta");
|
|
3697
|
-
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id",
|
|
3700
|
+
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id", ve), i.setAttribute(
|
|
3698
3701
|
"content",
|
|
3699
3702
|
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
3700
3703
|
), t.document.head.appendChild(i), t.addEventListener("orientationchange", this.onViewportWidthChanged), t.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
3701
3704
|
target: t
|
|
3702
|
-
}), e.register("get_properties",
|
|
3703
|
-
|
|
3704
|
-
}), e.register("update_properties",
|
|
3705
|
-
s["--RS__viewportWidth"] = `${t.innerWidth}px`,
|
|
3706
|
-
}), e.register("set_property",
|
|
3705
|
+
}), e.register("get_properties", W.moduleName, (s, n) => {
|
|
3706
|
+
Vt(t), n(!0);
|
|
3707
|
+
}), e.register("update_properties", W.moduleName, (s, n) => {
|
|
3708
|
+
s["--RS__viewportWidth"] = `${t.innerWidth}px`, Re(t, s), n(!0);
|
|
3709
|
+
}), e.register("set_property", W.moduleName, (s, n) => {
|
|
3707
3710
|
const o = s;
|
|
3708
|
-
|
|
3709
|
-
}), e.register("remove_property",
|
|
3710
|
-
|
|
3711
|
-
}), e.register("activate",
|
|
3711
|
+
st(t, o[0], o[1]), n(!0);
|
|
3712
|
+
}), e.register("remove_property", W.moduleName, (s, n) => {
|
|
3713
|
+
gt(t, s), n(!0);
|
|
3714
|
+
}), e.register("activate", W.moduleName, (s, n) => {
|
|
3712
3715
|
this.unblock(t), n(!0);
|
|
3713
3716
|
}), e.log("ReflowableSetup Mounted"), !0;
|
|
3714
3717
|
}
|
|
3715
3718
|
unmount(t, e) {
|
|
3716
|
-
return e.unregisterAll(
|
|
3719
|
+
return e.unregisterAll(W.moduleName), t.document.head.querySelector(`#${ve}`)?.remove(), t.removeEventListener("orientationchange", this.onViewportWidthChanged), e.log("ReflowableSetup Unmounted"), super.unmount(t, e);
|
|
3717
3720
|
}
|
|
3718
3721
|
};
|
|
3719
|
-
|
|
3720
|
-
let
|
|
3721
|
-
const
|
|
3722
|
+
W.moduleName = "reflowable_setup";
|
|
3723
|
+
let Rt = W;
|
|
3724
|
+
const we = "readium-fixed-style", z = class z extends ft {
|
|
3722
3725
|
mount(t, e) {
|
|
3723
3726
|
if (!super.mount(t, e)) return !1;
|
|
3724
3727
|
t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "paginated");
|
|
3725
3728
|
const i = t.document.createElement("style");
|
|
3726
|
-
return i.id =
|
|
3729
|
+
return i.id = we, i.dataset.readium = "true", i.textContent = `
|
|
3727
3730
|
html, body {
|
|
3728
3731
|
text-size-adjust: none;
|
|
3729
3732
|
-ms-text-size-adjust: none;
|
|
@@ -3735,12 +3738,12 @@ const Ee = "readium-fixed-style", M = class M extends yt {
|
|
|
3735
3738
|
min-height: 100%;
|
|
3736
3739
|
|
|
3737
3740
|
/*cursor: var() TODO*/
|
|
3738
|
-
}`, t.document.head.appendChild(i), e.register("set_property",
|
|
3741
|
+
}`, t.document.head.appendChild(i), e.register("set_property", z.moduleName, (s, n) => {
|
|
3739
3742
|
const o = s;
|
|
3740
|
-
|
|
3741
|
-
}), e.register("remove_property",
|
|
3742
|
-
|
|
3743
|
-
}), e.register("first_visible_locator",
|
|
3743
|
+
st(t, o[0], o[1]), n(!0);
|
|
3744
|
+
}), e.register("remove_property", z.moduleName, (s, n) => {
|
|
3745
|
+
gt(t, s), n(!0);
|
|
3746
|
+
}), e.register("first_visible_locator", z.moduleName, (s, n) => n(!1)), e.register("unfocus", z.moduleName, (s, n) => {
|
|
3744
3747
|
A(t), n(!0);
|
|
3745
3748
|
}), e.register([
|
|
3746
3749
|
"focus",
|
|
@@ -3751,17 +3754,17 @@ const Ee = "readium-fixed-style", M = class M extends yt {
|
|
|
3751
3754
|
"go_start",
|
|
3752
3755
|
"go_text",
|
|
3753
3756
|
"go_progression"
|
|
3754
|
-
],
|
|
3757
|
+
], z.moduleName, (s, n) => n(!0)), e.register("activate", z.moduleName, (s, n) => {
|
|
3755
3758
|
this.unblock(t), n(!0);
|
|
3756
3759
|
}), e.log("FixedSetup Mounted"), !0;
|
|
3757
3760
|
}
|
|
3758
3761
|
unmount(t, e) {
|
|
3759
|
-
return e.unregisterAll(
|
|
3762
|
+
return e.unregisterAll(z.moduleName), t.document.getElementById(we)?.remove(), e.log("FixedSetup Unmounted"), super.unmount(t, e);
|
|
3760
3763
|
}
|
|
3761
3764
|
};
|
|
3762
|
-
|
|
3763
|
-
let
|
|
3764
|
-
const
|
|
3765
|
+
z.moduleName = "fixed_setup";
|
|
3766
|
+
let Dt = z;
|
|
3767
|
+
const U = class U extends K {
|
|
3765
3768
|
wndOnErr(t) {
|
|
3766
3769
|
this.comms?.send("error", {
|
|
3767
3770
|
message: t.message,
|
|
@@ -3775,26 +3778,26 @@ const B = class B extends Z {
|
|
|
3775
3778
|
"error",
|
|
3776
3779
|
this.wndOnErr,
|
|
3777
3780
|
!1
|
|
3778
|
-
), e.register("get_properties",
|
|
3779
|
-
|
|
3780
|
-
}), e.register("update_properties",
|
|
3781
|
-
|
|
3782
|
-
}), e.register("set_property",
|
|
3781
|
+
), e.register("get_properties", U.moduleName, (i, s) => {
|
|
3782
|
+
Vt(t), s(!0);
|
|
3783
|
+
}), e.register("update_properties", U.moduleName, (i, s) => {
|
|
3784
|
+
Re(t, i), s(!0);
|
|
3785
|
+
}), e.register("set_property", U.moduleName, (i, s) => {
|
|
3783
3786
|
const n = i;
|
|
3784
|
-
|
|
3785
|
-
}), e.register("remove_property",
|
|
3786
|
-
|
|
3787
|
-
}), e.register("activate",
|
|
3787
|
+
st(t, n[0], n[1]), s(!0);
|
|
3788
|
+
}), e.register("remove_property", U.moduleName, (i, s) => {
|
|
3789
|
+
gt(t, i), s(!0);
|
|
3790
|
+
}), e.register("activate", U.moduleName, (i, s) => {
|
|
3788
3791
|
s(!0);
|
|
3789
3792
|
}), e.log("WebPubSetup Mounted"), !0;
|
|
3790
3793
|
}
|
|
3791
3794
|
unmount(t, e) {
|
|
3792
|
-
return e.unregisterAll(
|
|
3795
|
+
return e.unregisterAll(U.moduleName), t.removeEventListener("error", this.wndOnErr), e.log("WebPubSetup Unmounted"), !0;
|
|
3793
3796
|
}
|
|
3794
3797
|
};
|
|
3795
|
-
|
|
3796
|
-
let
|
|
3797
|
-
const
|
|
3798
|
+
U.moduleName = "webpub_setup";
|
|
3799
|
+
let It = U;
|
|
3800
|
+
const it = class it extends K {
|
|
3798
3801
|
constructor() {
|
|
3799
3802
|
super(...arguments), this.styleElement = null, this.beforePrintHandler = null, this.configApplied = !1;
|
|
3800
3803
|
}
|
|
@@ -3818,7 +3821,7 @@ const st = class st extends Z {
|
|
|
3818
3821
|
`, t.document.head.appendChild(i), this.styleElement = i, this.beforePrintHandler = (s) => (s.preventDefault(), !1), t.addEventListener("beforeprint", this.beforePrintHandler);
|
|
3819
3822
|
}
|
|
3820
3823
|
registerPrintHandlers() {
|
|
3821
|
-
this.comms?.register("print_protection",
|
|
3824
|
+
this.comms?.register("print_protection", it.moduleName, (t) => {
|
|
3822
3825
|
const e = t;
|
|
3823
3826
|
return this.configApplied || (this.configApplied = !0, this.setupPrintProtection(this.wnd, e), this.comms?.log("Print protection configuration applied")), !0;
|
|
3824
3827
|
});
|
|
@@ -3827,14 +3830,14 @@ const st = class st extends Z {
|
|
|
3827
3830
|
return this.wnd = t, this.comms = e, this.registerPrintHandlers(), !0;
|
|
3828
3831
|
}
|
|
3829
3832
|
unmount(t, e) {
|
|
3830
|
-
return this.beforePrintHandler && (t.removeEventListener("beforeprint", this.beforePrintHandler), this.beforePrintHandler = null), this.styleElement?.parentNode && (this.styleElement.parentNode.removeChild(this.styleElement), this.styleElement = null), this.comms?.unregisterAll(
|
|
3833
|
+
return this.beforePrintHandler && (t.removeEventListener("beforeprint", this.beforePrintHandler), this.beforePrintHandler = null), this.styleElement?.parentNode && (this.styleElement.parentNode.removeChild(this.styleElement), this.styleElement = null), this.comms?.unregisterAll(it.moduleName), this.configApplied = !1, !0;
|
|
3831
3834
|
}
|
|
3832
3835
|
};
|
|
3833
|
-
|
|
3834
|
-
let
|
|
3835
|
-
const
|
|
3836
|
+
it.moduleName = "print_protection";
|
|
3837
|
+
let zt = it;
|
|
3838
|
+
const Se = "readium-cjk-vertical-snapper-style", L = class L extends X {
|
|
3836
3839
|
constructor() {
|
|
3837
|
-
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.handleScroll = (t) => {
|
|
3840
|
+
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) => {
|
|
3838
3841
|
if (this.comms.ready && !this.isResizing) {
|
|
3839
3842
|
if (!this.initialScrollHandled) {
|
|
3840
3843
|
this.lastScrollLeft = Math.abs(this.doc().scrollLeft), this.initialScrollHandled = !0, this.reportProgress();
|
|
@@ -3884,12 +3887,12 @@ const Ae = "readium-cjk-vertical-snapper-style", L = class L extends K {
|
|
|
3884
3887
|
});
|
|
3885
3888
|
}
|
|
3886
3889
|
enableScrollProtection() {
|
|
3887
|
-
this.patternAnalyzer || (this.patternAnalyzer = new
|
|
3890
|
+
this.patternAnalyzer || (this.patternAnalyzer = new bt(Gt), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
3888
3891
|
}
|
|
3889
3892
|
mount(t, e) {
|
|
3890
|
-
this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollLeft = 0, this.isResizing = !1, this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "scrolling");
|
|
3893
|
+
this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollLeft = 0, this.isResizing = !1, this.verticalLR = di(t), this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "scrolling");
|
|
3891
3894
|
const i = t.document.createElement("style");
|
|
3892
|
-
return i.dataset.readium = "true", i.id =
|
|
3895
|
+
return i.dataset.readium = "true", i.id = Se, i.textContent = `
|
|
3893
3896
|
* {
|
|
3894
3897
|
scrollbar-width: none;
|
|
3895
3898
|
}
|
|
@@ -3905,9 +3908,9 @@ const Ae = "readium-cjk-vertical-snapper-style", L = class L extends K {
|
|
|
3905
3908
|
this.isResizing = !1, this.resizeDebounce = null, this.reportProgress();
|
|
3906
3909
|
}, 50);
|
|
3907
3910
|
}), this.resizeObserver.observe(t.document.body), t.addEventListener("scroll", this.handleScroll, { passive: !0 }), e.register("force_webkit_recalc", L.moduleName, () => {
|
|
3908
|
-
|
|
3911
|
+
Ft(this.wnd);
|
|
3909
3912
|
const s = this.doc().scrollLeft;
|
|
3910
|
-
|
|
3913
|
+
this.verticalLR ? this.doc().scrollLeft = s > 1 ? s - 1 : s + 1 : this.doc().scrollLeft = s < -1 ? s + 1 : s - 1, this.doc().scrollLeft = s;
|
|
3911
3914
|
}), e.register("go_progression", L.moduleName, (s, n) => {
|
|
3912
3915
|
const o = s;
|
|
3913
3916
|
if (o < 0 || o > 1) {
|
|
@@ -3917,7 +3920,8 @@ const Ae = "readium-cjk-vertical-snapper-style", L = class L extends K {
|
|
|
3917
3920
|
return;
|
|
3918
3921
|
}
|
|
3919
3922
|
this.wnd.requestAnimationFrame(() => {
|
|
3920
|
-
|
|
3923
|
+
const a = this.scrollable() * o;
|
|
3924
|
+
this.doc().scrollLeft = this.verticalLR ? a : -a, this.reportProgress(), A(this.wnd), n(!0);
|
|
3921
3925
|
});
|
|
3922
3926
|
}), e.register("go_id", L.moduleName, (s, n) => {
|
|
3923
3927
|
const o = t.document.getElementById(s);
|
|
@@ -3931,7 +3935,7 @@ const Ae = "readium-cjk-vertical-snapper-style", L = class L extends K {
|
|
|
3931
3935
|
}), e.register("go_text", L.moduleName, (s, n) => {
|
|
3932
3936
|
let o;
|
|
3933
3937
|
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
3934
|
-
const a =
|
|
3938
|
+
const a = H.deserialize(s), c = nt(this.wnd.document, new k({
|
|
3935
3939
|
href: t.location.href,
|
|
3936
3940
|
type: "text/html",
|
|
3937
3941
|
text: a,
|
|
@@ -3951,7 +3955,7 @@ const Ae = "readium-cjk-vertical-snapper-style", L = class L extends K {
|
|
|
3951
3955
|
this.doc().scrollLeft = 0, this.reportProgress(), n(!0);
|
|
3952
3956
|
}), e.register("go_end", L.moduleName, (s, n) => {
|
|
3953
3957
|
if (Math.abs(this.doc().scrollLeft) === this.scrollable()) return n(!1);
|
|
3954
|
-
this.doc().scrollLeft = -this.scrollable(), this.reportProgress(), n(!0);
|
|
3958
|
+
this.doc().scrollLeft = this.verticalLR ? this.scrollable() : -this.scrollable(), this.reportProgress(), n(!0);
|
|
3955
3959
|
}), e.register([
|
|
3956
3960
|
"go_next",
|
|
3957
3961
|
"go_prev"
|
|
@@ -3962,16 +3966,16 @@ const Ae = "readium-cjk-vertical-snapper-style", L = class L extends K {
|
|
|
3962
3966
|
}), e.register("focus", L.moduleName, (s, n) => {
|
|
3963
3967
|
this.reportProgress(), n(!0);
|
|
3964
3968
|
}), e.register("first_visible_locator", L.moduleName, (s, n) => {
|
|
3965
|
-
const o =
|
|
3969
|
+
const o = yt(t, !0);
|
|
3966
3970
|
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
3967
3971
|
}), e.log("CJKVerticalSnapper Mounted"), !0;
|
|
3968
3972
|
}
|
|
3969
3973
|
unmount(t, e) {
|
|
3970
|
-
return e.unregisterAll(L.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(
|
|
3974
|
+
return e.unregisterAll(L.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(Se)?.remove(), this.patternAnalyzer && (this.patternAnalyzer.clear(), this.patternAnalyzer = null, this.isScrollProtectionEnabled = !1), e.log("CJKVerticalSnapper Unmounted"), !0;
|
|
3971
3975
|
}
|
|
3972
3976
|
};
|
|
3973
3977
|
L.moduleName = "cjk_vertical_snapper";
|
|
3974
|
-
let
|
|
3978
|
+
let Mt = L;
|
|
3975
3979
|
const Ai = [
|
|
3976
3980
|
"fixed_setup",
|
|
3977
3981
|
"decorator",
|
|
@@ -3991,18 +3995,18 @@ const Ai = [
|
|
|
3991
3995
|
"decorator",
|
|
3992
3996
|
"peripherals",
|
|
3993
3997
|
"print_protection"
|
|
3994
|
-
],
|
|
3998
|
+
], Ee = new Map([
|
|
3995
3999
|
// All modules go here
|
|
3996
|
-
zt,
|
|
3997
|
-
It,
|
|
3998
|
-
Mt,
|
|
3999
|
-
Rt,
|
|
4000
4000
|
Dt,
|
|
4001
|
-
|
|
4001
|
+
Rt,
|
|
4002
|
+
It,
|
|
4002
4003
|
Lt,
|
|
4003
4004
|
Ot,
|
|
4004
|
-
|
|
4005
|
-
|
|
4005
|
+
Tt,
|
|
4006
|
+
Pt,
|
|
4007
|
+
Nt,
|
|
4008
|
+
Mt,
|
|
4009
|
+
zt
|
|
4006
4010
|
].map((r) => [r.moduleName, r]));
|
|
4007
4011
|
class Ti {
|
|
4008
4012
|
/**
|
|
@@ -4010,7 +4014,7 @@ class Ti {
|
|
|
4010
4014
|
* @param initialModules List of initial modules to load
|
|
4011
4015
|
*/
|
|
4012
4016
|
constructor(t = window, e = []) {
|
|
4013
|
-
this.loadedModules = [], this.wnd = t, this.comms = new
|
|
4017
|
+
this.loadedModules = [], this.wnd = t, this.comms = new Ue(t);
|
|
4014
4018
|
const i = [...new Set(e)];
|
|
4015
4019
|
if (i.length) {
|
|
4016
4020
|
if (typeof t > "u")
|
|
@@ -4023,7 +4027,7 @@ class Ti {
|
|
|
4023
4027
|
}
|
|
4024
4028
|
}
|
|
4025
4029
|
loadModule(t) {
|
|
4026
|
-
const e =
|
|
4030
|
+
const e = Ee.get(t);
|
|
4027
4031
|
return e === void 0 ? (this.comms.log(`Module "${name}" does not exist in the library`), e) : new e();
|
|
4028
4032
|
}
|
|
4029
4033
|
/**
|
|
@@ -4041,7 +4045,7 @@ class Ti {
|
|
|
4041
4045
|
* @returns Success
|
|
4042
4046
|
*/
|
|
4043
4047
|
removeModule(t) {
|
|
4044
|
-
const e =
|
|
4048
|
+
const e = Ee.get(t);
|
|
4045
4049
|
if (e === void 0)
|
|
4046
4050
|
return this.comms.log(`Module "${t}" does not exist in the library`), !1;
|
|
4047
4051
|
const i = this.loadedModules.findIndex((s) => s instanceof e);
|
|
@@ -4113,25 +4117,25 @@ const Pi = {
|
|
|
4113
4117
|
};
|
|
4114
4118
|
export {
|
|
4115
4119
|
wi as BulkCopyProtector,
|
|
4116
|
-
|
|
4117
|
-
|
|
4120
|
+
Z as COMMS_VERSION,
|
|
4121
|
+
Ue as Comms,
|
|
4118
4122
|
Pi as DEV_TOOLS,
|
|
4119
|
-
|
|
4123
|
+
Tt as Decorator,
|
|
4120
4124
|
Ai as FXLModules,
|
|
4121
4125
|
Ei as KeyCombinationManager,
|
|
4122
|
-
|
|
4126
|
+
ai as Layout,
|
|
4123
4127
|
Ti as Loader,
|
|
4124
|
-
|
|
4125
|
-
|
|
4128
|
+
K as Module,
|
|
4129
|
+
Ee as ModuleLibrary,
|
|
4126
4130
|
Li as PRINT,
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4131
|
+
bt as PatternAnalyzer,
|
|
4132
|
+
Ot as Peripherals,
|
|
4133
|
+
zt as PrintProtector,
|
|
4130
4134
|
Ci as ReflowableModules,
|
|
4131
4135
|
Oi as SAVE,
|
|
4132
4136
|
Ni as SELECT_ALL,
|
|
4133
4137
|
Si as SelectionAnalyzer,
|
|
4134
4138
|
xi as WebPubModules,
|
|
4135
|
-
|
|
4136
|
-
|
|
4139
|
+
oi as Width,
|
|
4140
|
+
We as mid
|
|
4137
4141
|
};
|