@readium/shared 2.2.0-beta.3 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +391 -377
- package/dist/index.umd.cjs +3 -3
- package/package.json +1 -1
- package/src/fetcher/Fetcher.ts +2 -2
- package/src/fetcher/HttpFetcher.ts +3 -3
- package/src/fetcher/Resource.ts +1 -1
- package/src/fetcher/index.ts +3 -3
- package/src/index.ts +4 -4
- package/src/opds/Availability.ts +1 -1
- package/src/opds/Copies.ts +1 -1
- package/src/opds/Holds.ts +1 -1
- package/src/opds/Price.ts +1 -1
- package/src/opds/index.ts +5 -5
- package/src/publication/BelongsTo.ts +1 -1
- package/src/publication/Contributor.ts +4 -4
- package/src/publication/GuidedNavigation.ts +19 -19
- package/src/publication/Link.ts +6 -6
- package/src/publication/Locator.ts +1 -1
- package/src/publication/LocatorCollection.ts +4 -4
- package/src/publication/Manifest.ts +29 -20
- package/src/publication/Metadata.ts +13 -13
- package/src/publication/Publication.ts +15 -17
- package/src/publication/PublicationCollection.ts +1 -1
- package/src/publication/ReadingProgression.ts +1 -1
- package/src/publication/Subject.ts +2 -2
- package/src/publication/accessibility/AccessibilityMetadataDisplayGuide.ts +20 -20
- package/src/publication/accessibility/Localization.ts +15 -15
- package/src/publication/accessibility/index.ts +3 -3
- package/src/publication/encryption/Properties.ts +2 -2
- package/src/publication/encryption/index.ts +2 -2
- package/src/publication/epub/Metadata.ts +3 -3
- package/src/publication/epub/Properties.ts +1 -1
- package/src/publication/epub/Publication.ts +2 -2
- package/src/publication/epub/index.ts +4 -4
- package/src/publication/html/DomRange.ts +1 -1
- package/src/publication/html/DomRangePoint.ts +1 -1
- package/src/publication/html/Locations.ts +3 -3
- package/src/publication/html/index.ts +3 -3
- package/src/publication/index.ts +24 -24
- package/src/publication/opds/Properties.ts +4 -4
- package/src/publication/opds/Publication.ts +2 -2
- package/src/publication/opds/index.ts +2 -2
- package/src/publication/services/content/Content.ts +3 -3
- package/src/publication/services/content/ContentTokenizer.ts +6 -6
- package/src/publication/services/content/Iterator.ts +2 -2
- package/src/publication/services/content/element/attributes.ts +2 -2
- package/src/publication/services/content/element/element.ts +5 -5
- package/src/publication/services/content/element/index.ts +3 -3
- package/src/publication/services/content/index.ts +5 -5
- package/src/publication/services/content/iterators/HTMLResourceContentIterator.ts +8 -8
- package/src/publication/services/content/iterators/PDFTextContentIterator.ts +21 -21
- package/src/publication/services/content/iterators/PublicationContentIterator.ts +7 -7
- package/src/publication/services/content/iterators/helpers.ts +1 -1
- package/src/publication/services/content/iterators/index.ts +3 -3
- package/src/publication/services/index.ts +2 -2
- package/src/publication/services/timeline/Timeline.ts +52 -29
- package/src/publication/services/timeline/index.ts +2 -2
- package/src/util/index.ts +5 -5
- package/src/util/mediatype/index.ts +1 -1
- package/src/util/tokenizer/TextTokenizer.ts +5 -5
- package/src/util/tokenizer/index.ts +2 -2
- package/types/src/fetcher/Fetcher.d.ts +2 -2
- package/types/src/fetcher/HttpFetcher.d.ts +3 -3
- package/types/src/fetcher/Resource.d.ts +1 -1
- package/types/src/fetcher/index.d.ts +3 -3
- package/types/src/index.d.ts +4 -4
- package/types/src/opds/index.d.ts +5 -5
- package/types/src/publication/BelongsTo.d.ts +1 -1
- package/types/src/publication/Contributor.d.ts +3 -3
- package/types/src/publication/GuidedNavigation.d.ts +1 -1
- package/types/src/publication/Link.d.ts +3 -3
- package/types/src/publication/LocatorCollection.d.ts +3 -3
- package/types/src/publication/Manifest.d.ts +6 -6
- package/types/src/publication/Metadata.d.ts +10 -10
- package/types/src/publication/Publication.d.ts +12 -13
- package/types/src/publication/PublicationCollection.d.ts +1 -1
- package/types/src/publication/ReadingProgression.d.ts +1 -1
- package/types/src/publication/Subject.d.ts +2 -2
- package/types/src/publication/accessibility/AccessibilityMetadataDisplayGuide.d.ts +2 -2
- package/types/src/publication/accessibility/index.d.ts +3 -3
- package/types/src/publication/encryption/Properties.d.ts +1 -1
- package/types/src/publication/encryption/index.d.ts +2 -2
- package/types/src/publication/epub/Metadata.d.ts +1 -1
- package/types/src/publication/epub/Publication.d.ts +1 -1
- package/types/src/publication/epub/index.d.ts +4 -4
- package/types/src/publication/html/DomRange.d.ts +1 -1
- package/types/src/publication/html/Locations.d.ts +1 -1
- package/types/src/publication/html/index.d.ts +3 -3
- package/types/src/publication/index.d.ts +24 -24
- package/types/src/publication/opds/Properties.d.ts +2 -2
- package/types/src/publication/opds/Publication.d.ts +1 -1
- package/types/src/publication/opds/index.d.ts +2 -2
- package/types/src/publication/services/content/Content.d.ts +2 -2
- package/types/src/publication/services/content/ContentTokenizer.d.ts +2 -2
- package/types/src/publication/services/content/Iterator.d.ts +1 -1
- package/types/src/publication/services/content/element/attributes.d.ts +1 -1
- package/types/src/publication/services/content/element/element.d.ts +4 -4
- package/types/src/publication/services/content/element/index.d.ts +3 -3
- package/types/src/publication/services/content/index.d.ts +5 -5
- package/types/src/publication/services/content/iterators/HTMLResourceContentIterator.d.ts +4 -4
- package/types/src/publication/services/content/iterators/PDFTextContentIterator.d.ts +3 -3
- package/types/src/publication/services/content/iterators/PublicationContentIterator.d.ts +5 -5
- package/types/src/publication/services/content/iterators/helpers.d.ts +1 -1
- package/types/src/publication/services/content/iterators/index.d.ts +3 -3
- package/types/src/publication/services/index.d.ts +2 -2
- package/types/src/publication/services/timeline/Timeline.d.ts +9 -6
- package/types/src/publication/services/timeline/index.d.ts +2 -2
- package/types/src/util/index.d.ts +5 -5
- package/types/src/util/mediatype/index.d.ts +1 -1
- package/types/src/util/tokenizer/TextTokenizer.d.ts +2 -2
- package/types/src/util/tokenizer/index.d.ts +2 -2
- package/types/test/AltIdentifier.test.d.ts +0 -1
- package/types/test/Contributor.test.d.ts +0 -1
- package/types/test/GuidedNavigation.test.d.ts +0 -1
- package/types/test/Link.test.d.ts +0 -1
- package/types/test/LocalizedString.test.d.ts +0 -1
- package/types/test/Locator.test.d.ts +0 -1
- package/types/test/LocatorCollection.test.d.ts +0 -1
- package/types/test/Manifest.test.d.ts +0 -1
- package/types/test/Metadata.test.d.ts +0 -1
- package/types/test/Properties.test.d.ts +0 -1
- package/types/test/Publication.test.d.ts +0 -1
- package/types/test/PublicationCollection.test.d.ts +0 -1
- package/types/test/Subject.test.d.ts +0 -1
- package/types/test/TDM.test.d.ts +0 -1
- package/types/test/Timeline.test.d.ts +0 -1
- package/types/test/accessibility/Accessibility.test.d.ts +0 -1
- package/types/test/accessibility/AccessibilityMetadataDisplayGuide.test.d.ts +0 -1
- package/types/test/accessibility/Localization.test.d.ts +0 -1
- package/types/test/encryption/Encryption.test.d.ts +0 -1
- package/types/test/encryption/Properties.test.d.ts +0 -1
- package/types/test/epub/MediaOverlay.test.d.ts +0 -1
- package/types/test/epub/Metadata.test.d.ts +0 -1
- package/types/test/epub/PropertiesTest.test.d.ts +0 -1
- package/types/test/epub/PublicationTest.test.d.ts +0 -1
- package/types/test/html/DomRange.test.d.ts +0 -1
- package/types/test/html/Locator.test.d.ts +0 -1
- package/types/test/opds/PropertiesTest.test.d.ts +0 -1
- package/types/test/opds/PublicationTest.test.d.ts +0 -1
- package/types/test/util/URITemplate.test.d.ts +0 -1
- package/types/test/util/mediatype/MediaType.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ class ei {
|
|
|
8
8
|
throw Error("This is an empty fetcher");
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
class
|
|
11
|
+
class ir {
|
|
12
12
|
constructor(t, e) {
|
|
13
13
|
this.client = t || window.fetch.bind(window), this.baseUrl = e;
|
|
14
14
|
}
|
|
@@ -88,12 +88,12 @@ class ii {
|
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
class
|
|
91
|
+
class sr {
|
|
92
92
|
constructor(t, e) {
|
|
93
93
|
this.start = t, this.endInclusive = e;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
class
|
|
96
|
+
class rr {
|
|
97
97
|
readAsString() {
|
|
98
98
|
return this.read().then((t) => t === void 0 ? t : new TextDecoder().decode(t));
|
|
99
99
|
}
|
|
@@ -116,12 +116,12 @@ class V {
|
|
|
116
116
|
const e = t;
|
|
117
117
|
return new V({
|
|
118
118
|
conformsTo: e.conformsTo ? e.conformsTo.map((i) => It.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
119
|
-
certification: e.certification ?
|
|
119
|
+
certification: e.certification ? Pt.deserialize(e.certification) : void 0,
|
|
120
120
|
summary: e.summary,
|
|
121
121
|
accessMode: e.accessMode ? e.accessMode.map((i) => R.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
122
122
|
accessModeSufficient: e.accessModeSufficient ? e.accessModeSufficient.map((i) => xt.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
123
123
|
feature: e.feature ? e.feature.map((i) => v.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
124
|
-
hazard: e.hazard ? e.hazard.map((i) =>
|
|
124
|
+
hazard: e.hazard ? e.hazard.map((i) => P.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
125
125
|
exemption: e.exemption ? e.exemption.map((i) => Nt.deserialize(i)).filter((i) => i !== void 0) : void 0
|
|
126
126
|
});
|
|
127
127
|
}
|
|
@@ -171,7 +171,7 @@ const b = class b {
|
|
|
171
171
|
};
|
|
172
172
|
b.EPUB_A11Y_10_WCAG_20_A = new b("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), b.EPUB_A11Y_10_WCAG_20_AA = new b("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), b.EPUB_A11Y_10_WCAG_20_AAA = new b("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), b.EPUB_A11Y_11_WCAG_20_A = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), b.EPUB_A11Y_11_WCAG_20_AA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), b.EPUB_A11Y_11_WCAG_20_AAA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), b.EPUB_A11Y_11_WCAG_21_A = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), b.EPUB_A11Y_11_WCAG_21_AA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), b.EPUB_A11Y_11_WCAG_21_AAA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), b.EPUB_A11Y_11_WCAG_22_A = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), b.EPUB_A11Y_11_WCAG_22_AA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), b.EPUB_A11Y_11_WCAG_22_AAA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
|
|
173
173
|
let It = b;
|
|
174
|
-
class
|
|
174
|
+
class Pt {
|
|
175
175
|
constructor(t = null, e = null, i = null) {
|
|
176
176
|
this.certifiedBy = t, this.credential = e, this.report = i;
|
|
177
177
|
}
|
|
@@ -180,7 +180,7 @@ class kt {
|
|
|
180
180
|
*/
|
|
181
181
|
static deserialize(t) {
|
|
182
182
|
if (!(!t || typeof t != "object"))
|
|
183
|
-
return new
|
|
183
|
+
return new Pt(
|
|
184
184
|
t.certifiedBy,
|
|
185
185
|
t.credential,
|
|
186
186
|
t.report
|
|
@@ -194,7 +194,7 @@ class kt {
|
|
|
194
194
|
return this.certifiedBy && (t.certifiedBy = this.certifiedBy), this.credential && (t.credential = this.credential), this.report && (t.report = this.report), t;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
const
|
|
197
|
+
const w = class w {
|
|
198
198
|
constructor(t) {
|
|
199
199
|
this.value = t;
|
|
200
200
|
}
|
|
@@ -203,7 +203,7 @@ const y = class y {
|
|
|
203
203
|
*/
|
|
204
204
|
static deserialize(t) {
|
|
205
205
|
if (!(!t || typeof t != "string"))
|
|
206
|
-
return new
|
|
206
|
+
return new w(t);
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
209
209
|
* Serializes an [AccessMode] to its RWPM JSON representation.
|
|
@@ -212,8 +212,8 @@ const y = class y {
|
|
|
212
212
|
return this.value;
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
|
-
|
|
216
|
-
let R =
|
|
215
|
+
w.AUDITORY = new w("auditory"), w.CHART_ON_VISUAL = new w("chartOnVisual"), w.CHEM_ON_VISUAL = new w("chemOnVisual"), w.COLOR_DEPENDENT = new w("colorDependent"), w.DIAGRAM_ON_VISUAL = new w("diagramOnVisual"), w.MATH_ON_VISUAL = new w("mathOnVisual"), w.MUSIC_ON_VISUAL = new w("musicOnVisual"), w.TACTILE = new w("tactile"), w.TEXT_ON_VISUAL = new w("textOnVisual"), w.TEXTUAL = new w("textual"), w.VISUAL = new w("visual");
|
|
216
|
+
let R = w;
|
|
217
217
|
const N = class N {
|
|
218
218
|
constructor(t) {
|
|
219
219
|
if (typeof t == "string") {
|
|
@@ -250,7 +250,7 @@ const N = class N {
|
|
|
250
250
|
};
|
|
251
251
|
N.VALID_MODES = /* @__PURE__ */ new Set(["auditory", "tactile", "textual", "visual"]), N.AUDITORY = new N("auditory"), N.TACTILE = new N("tactile"), N.TEXTUAL = new N("textual"), N.VISUAL = new N("visual");
|
|
252
252
|
let xt = N;
|
|
253
|
-
const
|
|
253
|
+
const h = class h {
|
|
254
254
|
constructor(t) {
|
|
255
255
|
this.value = t;
|
|
256
256
|
}
|
|
@@ -259,7 +259,7 @@ const l = class l {
|
|
|
259
259
|
*/
|
|
260
260
|
static deserialize(t) {
|
|
261
261
|
if (!(!t || typeof t != "string"))
|
|
262
|
-
return new
|
|
262
|
+
return new h(t);
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
265
265
|
* Serializes a [Feature] to its RWPM JSON representation.
|
|
@@ -268,9 +268,9 @@ const l = class l {
|
|
|
268
268
|
return this.value;
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
|
-
|
|
272
|
-
let v =
|
|
273
|
-
const
|
|
271
|
+
h.NONE = new h("none"), h.ANNOTATIONS = new h("annotations"), h.ARIA = new h("ARIA"), h.INDEX = new h("index"), h.PAGE_BREAK_MARKERS = new h("pageBreakMarkers"), h.PAGE_NAVIGATION = new h("pageNavigation"), h.PRINT_PAGE_NUMBERS = new h("printPageNumbers"), h.READING_ORDER = new h("readingOrder"), h.STRUCTURAL_NAVIGATION = new h("structuralNavigation"), h.TABLE_OF_CONTENTS = new h("tableOfContents"), h.TAGGED_PDF = new h("taggedPDF"), h.ALTERNATIVE_TEXT = new h("alternativeText"), h.AUDIO_DESCRIPTION = new h("audioDescription"), h.CAPTIONS = new h("captions"), h.CLOSED_CAPTIONS = new h("closedCaptions"), h.DESCRIBED_MATH = new h("describedMath"), h.LONG_DESCRIPTION = new h("longDescription"), h.OPEN_CAPTIONS = new h("openCaptions"), h.SIGN_LANGUAGE = new h("signLanguage"), h.TRANSCRIPT = new h("transcript"), h.DISPLAY_TRANSFORMABILITY = new h("displayTransformability"), h.SYNCHRONIZED_AUDIO_TEXT = new h("synchronizedAudioText"), h.TIMING_CONTROL = new h("timingControl"), h.UNLOCKED = new h("unlocked"), h.CHEM_ML = new h("ChemML"), h.LATEX = new h("latex"), h.LATEX_CHEMISTRY = new h("latex-chemistry"), h.MATH_ML = new h("MathML"), h.MATH_ML_CHEMISTRY = new h("MathML-chemistry"), h.TTS_MARKUP = new h("ttsMarkup"), h.HIGH_CONTRAST_AUDIO = new h("highContrastAudio"), h.HIGH_CONTRAST_DISPLAY = new h("highContrastDisplay"), h.LARGE_PRINT = new h("largePrint"), h.BRAILLE = new h("braille"), h.TACTILE_GRAPHIC = new h("tactileGraphic"), h.TACTILE_OBJECT = new h("tactileObject"), h.FULL_RUBY_ANNOTATIONS = new h("fullRubyAnnotations"), h.HORIZONTAL_WRITING = new h("horizontalWriting"), h.RUBY_ANNOTATIONS = new h("rubyAnnotations"), h.VERTICAL_WRITING = new h("verticalWriting"), h.WITH_ADDITIONAL_WORD_SEGMENTATION = new h("withAdditionalWordSegmentation"), h.WITHOUT_ADDITIONAL_WORD_SEGMENTATION = new h("withoutAdditionalWordSegmentation");
|
|
272
|
+
let v = h;
|
|
273
|
+
const y = class y {
|
|
274
274
|
constructor(t) {
|
|
275
275
|
this.value = t;
|
|
276
276
|
}
|
|
@@ -279,7 +279,7 @@ const w = class w {
|
|
|
279
279
|
*/
|
|
280
280
|
static deserialize(t) {
|
|
281
281
|
if (!(!t || typeof t != "string"))
|
|
282
|
-
return new
|
|
282
|
+
return new y(t);
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* Serializes a [Hazard] to its RWPM JSON representation.
|
|
@@ -288,8 +288,8 @@ const w = class w {
|
|
|
288
288
|
return this.value;
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
|
-
|
|
292
|
-
let
|
|
291
|
+
y.FLASHING = new y("flashing"), y.NO_FLASHING_HAZARD = new y("noFlashingHazard"), y.UNKNOWN_FLASHING_HAZARD = new y("unknownFlashingHazard"), y.MOTION_SIMULATION = new y("motionSimulation"), y.NO_MOTION_SIMULATION_HAZARD = new y("noMotionSimulationHazard"), y.UNKNOWN_MOTION_SIMULATION_HAZARD = new y("unknownMotionSimulationHazard"), y.SOUND = new y("sound"), y.NO_SOUND_HAZARD = new y("noSoundHazard"), y.UNKNOWN_SOUND_HAZARD = new y("unknownSoundHazard"), y.UNKNOWN = new y("unknown"), y.NONE = new y("none");
|
|
292
|
+
let P = y;
|
|
293
293
|
const S = class S {
|
|
294
294
|
constructor(t) {
|
|
295
295
|
this.value = t;
|
|
@@ -401,7 +401,7 @@ class $ {
|
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
const f = $.getInstance();
|
|
404
|
-
var
|
|
404
|
+
var K = /* @__PURE__ */ ((s) => (s.reflowable = "reflowable", s.fixed = "fixed", s.scrolled = "scrolled", s))(K || {}), ni = /* @__PURE__ */ ((s) => (s.Unknown = "unknown", s.Modifiable = "modifiable", s.Unmodifiable = "unmodifiable", s))(ni || {}), ai = /* @__PURE__ */ ((s) => (s.NoMetadata = "noMetadata", s.Readable = "readable", s.NotFully = "notFully", s.Unreadable = "unreadable", s))(ai || {}), oi = /* @__PURE__ */ ((s) => (s.NoMetadata = "noMetadata", s.Synchronized = "synchronized", s.AudioOnly = "audioOnly", s.AudioComplementary = "audioComplementary", s))(oi || {});
|
|
405
405
|
class Dt {
|
|
406
406
|
constructor(t = "unknown", e = "noMetadata", i = !1, r = "noMetadata") {
|
|
407
407
|
this.id = "ways-of-reading.title", this.visualAdjustments = t, this.nonvisualReading = e, this.nonvisualReadingAltText = i, this.prerecordedAudio = r, this.shouldDisplay = !0;
|
|
@@ -413,11 +413,11 @@ class Dt {
|
|
|
413
413
|
compactString: o.compact,
|
|
414
414
|
descriptiveString: o.descriptive
|
|
415
415
|
});
|
|
416
|
-
let
|
|
417
|
-
e === "readable" ?
|
|
418
|
-
const p = f.getString(
|
|
416
|
+
let l = "";
|
|
417
|
+
e === "readable" ? l = "ways-of-reading.nonvisual-reading.readable" : e === "notFully" ? l = "ways-of-reading.nonvisual-reading.not-fully" : e === "unreadable" ? l = "ways-of-reading.nonvisual-reading.none" : e === "noMetadata" && (l = "ways-of-reading.nonvisual-reading.no-metadata");
|
|
418
|
+
const p = f.getString(l);
|
|
419
419
|
if (this.statements.push({
|
|
420
|
-
id:
|
|
420
|
+
id: l,
|
|
421
421
|
compactString: p.compact,
|
|
422
422
|
descriptiveString: p.descriptive
|
|
423
423
|
}), i) {
|
|
@@ -438,7 +438,7 @@ class Dt {
|
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
440
|
static fromPublication(t) {
|
|
441
|
-
const e = t.metadata.accessibility ?? new V(), i = e.feature ?? [], r = t.metadata.layout ===
|
|
441
|
+
const e = t.metadata.accessibility ?? new V(), i = e.feature ?? [], r = t.metadata.layout === K.fixed, n = i.some((d) => d.value === v.DISPLAY_TRANSFORMABILITY.value) ? "modifiable" : r ? "unmodifiable" : "unknown", a = e.accessMode ?? [], o = e.accessModeSufficient ?? [], l = a.length > 0 && a.every((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
|
|
442
442
|
const I = d.value;
|
|
443
443
|
return Array.isArray(I) ? I.every((G) => G === R.TEXTUAL.value) : I === R.TEXTUAL.value;
|
|
444
444
|
}), p = a.some((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
|
|
@@ -452,7 +452,7 @@ class Dt {
|
|
|
452
452
|
v.ALTERNATIVE_TEXT.value,
|
|
453
453
|
v.DESCRIBED_MATH.value,
|
|
454
454
|
v.TRANSCRIPT.value
|
|
455
|
-
].includes(d.value)), g =
|
|
455
|
+
].includes(d.value)), g = l ? "readable" : p || u ? "notFully" : m ? "unreadable" : "noMetadata", A = u, k = i.some((d) => d.value === v.SYNCHRONIZED_AUDIO_TEXT.value) ? "synchronized" : o.some((d) => {
|
|
456
456
|
const I = d.value;
|
|
457
457
|
return Array.isArray(I) ? I.some((G) => G === R.AUDITORY.value) : I === R.AUDITORY.value;
|
|
458
458
|
}) ? "audioOnly" : a.some((d) => d.value === R.AUDITORY.value) ? "audioComplementary" : "noMetadata";
|
|
@@ -460,7 +460,7 @@ class Dt {
|
|
|
460
460
|
n,
|
|
461
461
|
g,
|
|
462
462
|
A,
|
|
463
|
-
|
|
463
|
+
k
|
|
464
464
|
);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
@@ -521,8 +521,8 @@ class Ut {
|
|
|
521
521
|
}
|
|
522
522
|
var ci = /* @__PURE__ */ ((s) => (s.Math = "math", s.Chemistry = "chemistry", s.Music = "music", s.Diagram = "diagram", s.Chart = "chart", s.Graph = "graph", s.Table = "table", s.Image = "image", s))(ci || {});
|
|
523
523
|
class Mt {
|
|
524
|
-
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1,
|
|
525
|
-
this.id = "rich-content.title", this.extendedAltTextDescriptions = t, this.mathFormula = e, this.mathFormulaAsMathML = i, this.mathFormulaAsLaTeX = r, this.chemicalFormulaAsMathML = n, this.chemicalFormulaAsLaTeX = a, this.closedCaptions = o, this.openCaptions =
|
|
524
|
+
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, l = !1, p = !1) {
|
|
525
|
+
this.id = "rich-content.title", this.extendedAltTextDescriptions = t, this.mathFormula = e, this.mathFormulaAsMathML = i, this.mathFormulaAsLaTeX = r, this.chemicalFormulaAsMathML = n, this.chemicalFormulaAsLaTeX = a, this.closedCaptions = o, this.openCaptions = l, this.transcript = p, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !l && !p, this.shouldDisplay = !this.noMetadata;
|
|
526
526
|
const m = f.getString(this.id);
|
|
527
527
|
if (this.title = m.compact, this.statements = [], t) {
|
|
528
528
|
const u = f.getString("rich-content.extended-descriptions");
|
|
@@ -580,7 +580,7 @@ class Mt {
|
|
|
580
580
|
descriptiveString: u.descriptive
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
|
-
if (
|
|
583
|
+
if (l) {
|
|
584
584
|
const u = f.getString("rich-content.open-captions");
|
|
585
585
|
this.statements.push({
|
|
586
586
|
id: "rich-content.open-captions",
|
|
@@ -621,10 +621,10 @@ class Mt {
|
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
class Bt {
|
|
624
|
-
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1,
|
|
625
|
-
this.id = "additional-accessibility-information.title", this.pageBreakMarkers = t, this.aria = e, this.audioDescriptions = i, this.braille = r, this.rubyAnnotations = n, this.fullRubyAnnotations = a, this.highAudioContrast = o, this.highDisplayContrast =
|
|
626
|
-
const
|
|
627
|
-
if (this.title =
|
|
624
|
+
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, l = !1, p = !1, m = !1, u = !1, g = !1, A = !1) {
|
|
625
|
+
this.id = "additional-accessibility-information.title", this.pageBreakMarkers = t, this.aria = e, this.audioDescriptions = i, this.braille = r, this.rubyAnnotations = n, this.fullRubyAnnotations = a, this.highAudioContrast = o, this.highDisplayContrast = l, this.largePrint = p, this.signLanguage = m, this.tactileGraphics = u, this.tactileObjects = g, this.textToSpeechHinting = A, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !l && !p && !m && !u && !g && !A, this.shouldDisplay = !this.noMetadata;
|
|
626
|
+
const k = f.getString(this.id);
|
|
627
|
+
if (this.title = k.compact, this.statements = [], t) {
|
|
628
628
|
const d = f.getString("additional-accessibility-information.page-breaks");
|
|
629
629
|
this.statements.push({
|
|
630
630
|
id: "additional-accessibility-information.page-breaks",
|
|
@@ -680,7 +680,7 @@ class Bt {
|
|
|
680
680
|
descriptiveString: d.descriptive
|
|
681
681
|
});
|
|
682
682
|
}
|
|
683
|
-
if (
|
|
683
|
+
if (l) {
|
|
684
684
|
const d = f.getString("additional-accessibility-information.high-contrast-between-text-and-background");
|
|
685
685
|
this.statements.push({
|
|
686
686
|
id: "additional-accessibility-information.high-contrast-between-text-and-background",
|
|
@@ -846,13 +846,13 @@ class Gt {
|
|
|
846
846
|
static fromPublication(t) {
|
|
847
847
|
const e = t.metadata.accessibility?.hazard ?? [];
|
|
848
848
|
let i;
|
|
849
|
-
e.some((o) => o.value ===
|
|
849
|
+
e.some((o) => o.value === P.NONE.value) ? i = "no" : e.some((o) => o.value === P.UNKNOWN.value) ? i = "unknown" : i = "noMetadata";
|
|
850
850
|
let r;
|
|
851
|
-
e.some((o) => o.value ===
|
|
851
|
+
e.some((o) => o.value === P.FLASHING.value) ? r = "yes" : e.some((o) => o.value === P.NO_FLASHING_HAZARD.value) ? r = "no" : e.some((o) => o.value === P.UNKNOWN_FLASHING_HAZARD.value) ? r = "unknown" : r = i;
|
|
852
852
|
let n;
|
|
853
|
-
e.some((o) => o.value ===
|
|
853
|
+
e.some((o) => o.value === P.MOTION_SIMULATION.value) ? n = "yes" : e.some((o) => o.value === P.NO_MOTION_SIMULATION_HAZARD.value) ? n = "no" : e.some((o) => o.value === P.UNKNOWN_MOTION_SIMULATION_HAZARD.value) ? n = "unknown" : n = i;
|
|
854
854
|
let a;
|
|
855
|
-
return e.some((o) => o.value ===
|
|
855
|
+
return e.some((o) => o.value === P.SOUND.value) ? a = "yes" : e.some((o) => o.value === P.NO_SOUND_HAZARD.value) ? a = "no" : e.some((o) => o.value === P.UNKNOWN_SOUND_HAZARD.value) ? a = "unknown" : a = i, new Gt(r, n, a);
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
858
|
class Wt {
|
|
@@ -953,7 +953,7 @@ class Ft {
|
|
|
953
953
|
return new Ft(t);
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
|
-
class
|
|
956
|
+
class nr {
|
|
957
957
|
constructor(t) {
|
|
958
958
|
this.waysOfReading = Dt.fromPublication(t), this.navigation = Ut.fromPublication(t), this.richContent = Mt.fromPublication(t), this.additionalInformation = Bt.fromPublication(t), this.hazards = Gt.fromPublication(t), this.conformance = Wt.fromPublication(t), this.legal = Ht.fromPublication(t), this.accessibilitySummary = Ft.fromPublication(t), this.fields = [
|
|
959
959
|
this.waysOfReading,
|
|
@@ -1116,12 +1116,12 @@ class c {
|
|
|
1116
1116
|
for (let g = 1; g < r.length; g++) {
|
|
1117
1117
|
const A = r[g].split("=");
|
|
1118
1118
|
if (A.length === 2) {
|
|
1119
|
-
const
|
|
1120
|
-
a[
|
|
1119
|
+
const k = A[0].toLocaleLowerCase(), d = k === "charset" ? A[1].toUpperCase() : A[1];
|
|
1120
|
+
a[k] = d;
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
|
-
const o = {},
|
|
1124
|
-
|
|
1123
|
+
const o = {}, l = Object.keys(a);
|
|
1124
|
+
l.sort((g, A) => g.localeCompare(A)), l.forEach((g) => o[g] = a[g]);
|
|
1125
1125
|
let p = "";
|
|
1126
1126
|
for (const g in o) {
|
|
1127
1127
|
const A = o[g];
|
|
@@ -1608,8 +1608,8 @@ class T {
|
|
|
1608
1608
|
"totalProgression",
|
|
1609
1609
|
"position"
|
|
1610
1610
|
]);
|
|
1611
|
-
return Object.entries(t).forEach(([o,
|
|
1612
|
-
a.has(o) || n.set(o,
|
|
1611
|
+
return Object.entries(t).forEach(([o, l]) => {
|
|
1612
|
+
a.has(o) || n.set(o, l);
|
|
1613
1613
|
}), new T({
|
|
1614
1614
|
fragments: _(t.fragments || t.fragment),
|
|
1615
1615
|
progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
|
|
@@ -1717,8 +1717,8 @@ class M {
|
|
|
1717
1717
|
duration: L(t.duration),
|
|
1718
1718
|
bitrate: L(t.bitrate),
|
|
1719
1719
|
languages: _(t.language),
|
|
1720
|
-
alternates:
|
|
1721
|
-
children:
|
|
1720
|
+
alternates: x.deserialize(t.alternate),
|
|
1721
|
+
children: x.deserialize(t.children)
|
|
1722
1722
|
});
|
|
1723
1723
|
}
|
|
1724
1724
|
/**
|
|
@@ -1776,7 +1776,7 @@ class M {
|
|
|
1776
1776
|
});
|
|
1777
1777
|
}
|
|
1778
1778
|
}
|
|
1779
|
-
class
|
|
1779
|
+
class x {
|
|
1780
1780
|
/**
|
|
1781
1781
|
* Creates a [Links].
|
|
1782
1782
|
*/
|
|
@@ -1788,7 +1788,7 @@ class z {
|
|
|
1788
1788
|
*/
|
|
1789
1789
|
static deserialize(t) {
|
|
1790
1790
|
if (t && Array.isArray(t))
|
|
1791
|
-
return new
|
|
1791
|
+
return new x(
|
|
1792
1792
|
t.map((e) => M.deserialize(e)).filter((e) => e !== void 0)
|
|
1793
1793
|
);
|
|
1794
1794
|
}
|
|
@@ -1941,7 +1941,7 @@ class dt {
|
|
|
1941
1941
|
identifier: t.identifier,
|
|
1942
1942
|
altIdentifiers: t.altIdentifier ? Array.isArray(t.altIdentifier) ? new Set(t.altIdentifier.map((e) => J.deserialize(e)).filter((e) => e !== void 0)) : new Set([J.deserialize(t.altIdentifier)].filter((e) => e !== void 0)) : void 0,
|
|
1943
1943
|
roles: t.role ? new Set(_(t.role)) : void 0,
|
|
1944
|
-
links:
|
|
1944
|
+
links: x.deserialize(t.links),
|
|
1945
1945
|
position: Z(t.position)
|
|
1946
1946
|
}) : void 0;
|
|
1947
1947
|
}
|
|
@@ -2005,7 +2005,7 @@ class Q {
|
|
|
2005
2005
|
}
|
|
2006
2006
|
}
|
|
2007
2007
|
var q = /* @__PURE__ */ ((s) => (s.EPUB = "https://readium.org/webpub-manifest/profiles/epub", s.AUDIOBOOK = "https://readium.org/webpub-manifest/profiles/audiobook", s.DIVINA = "https://readium.org/webpub-manifest/profiles/divina", s.PDF = "https://readium.org/webpub-manifest/profiles/pdf", s))(q || {}), F = /* @__PURE__ */ ((s) => (s.ltr = "ltr", s.rtl = "rtl", s))(F || {});
|
|
2008
|
-
function
|
|
2008
|
+
function ar(s) {
|
|
2009
2009
|
return s === "rtl" ? Ot.right : Ot.left;
|
|
2010
2010
|
}
|
|
2011
2011
|
class ft {
|
|
@@ -2027,7 +2027,7 @@ class ft {
|
|
|
2027
2027
|
sortAs: t.sortAs ? B.deserialize(t.sortAs) : void 0,
|
|
2028
2028
|
code: t.code,
|
|
2029
2029
|
scheme: t.scheme,
|
|
2030
|
-
links:
|
|
2030
|
+
links: x.deserialize(t.links)
|
|
2031
2031
|
}) : void 0;
|
|
2032
2032
|
}
|
|
2033
2033
|
/**
|
|
@@ -2096,7 +2096,7 @@ const et = class et {
|
|
|
2096
2096
|
*/
|
|
2097
2097
|
static deserialize(t) {
|
|
2098
2098
|
if (!(t && t.title)) return;
|
|
2099
|
-
const e = B.deserialize(t.title), i = t["@type"], r = _(t.conformsTo), n = t.identifier, a = J.deserialize(t.altIdentifier), o = B.deserialize(t.subtitle),
|
|
2099
|
+
const e = B.deserialize(t.title), i = t["@type"], r = _(t.conformsTo), n = t.identifier, a = J.deserialize(t.altIdentifier), o = B.deserialize(t.subtitle), l = B.deserialize(t.sortAs), p = O.deserialize(t.artist), m = O.deserialize(t.author), u = O.deserialize(t.colorist), g = O.deserialize(t.contributor), A = O.deserialize(t.editor), k = O.deserialize(t.illustrator), d = O.deserialize(t.inker), I = O.deserialize(t.letterer), G = O.deserialize(t.narrator), Be = O.deserialize(t.penciler), Ge = O.deserialize(t.translator), We = _(t.language), He = t.description, Fe = O.deserialize(t.publisher), _e = O.deserialize(t.imprint), Ve = lt(t.published), Ye = lt(t.modified), $e = Yt.deserialize(t.subject), Ke = Q.deserialize(t.belongsTo), Xe = V.deserialize(t.accessibility), Ze = t.layout, Je = t.readingProgression, qe = L(t.duration), Qe = L(t.numberOfPages), je = $t.deserialize(t.tdm);
|
|
2100
2100
|
let ot = Object.assign({}, t);
|
|
2101
2101
|
return et.mappedProperties.forEach((ti) => delete ot[ti]), Object.keys(ot).length === 0 && (ot = void 0), new et({
|
|
2102
2102
|
title: e,
|
|
@@ -2105,13 +2105,13 @@ const et = class et {
|
|
|
2105
2105
|
identifier: n,
|
|
2106
2106
|
altIdentifier: a,
|
|
2107
2107
|
subtitle: o,
|
|
2108
|
-
sortAs:
|
|
2108
|
+
sortAs: l,
|
|
2109
2109
|
artists: p,
|
|
2110
2110
|
authors: m,
|
|
2111
2111
|
colorists: u,
|
|
2112
2112
|
contributors: g,
|
|
2113
2113
|
editors: A,
|
|
2114
|
-
illustrators:
|
|
2114
|
+
illustrators: k,
|
|
2115
2115
|
inkers: d,
|
|
2116
2116
|
letterers: I,
|
|
2117
2117
|
narrators: G,
|
|
@@ -2124,12 +2124,12 @@ const et = class et {
|
|
|
2124
2124
|
published: Ve,
|
|
2125
2125
|
modified: Ye,
|
|
2126
2126
|
subjects: $e,
|
|
2127
|
-
belongsTo:
|
|
2127
|
+
belongsTo: Ke,
|
|
2128
2128
|
layout: Ze,
|
|
2129
2129
|
readingProgression: Je,
|
|
2130
2130
|
duration: qe,
|
|
2131
2131
|
numberOfPages: Qe,
|
|
2132
|
-
accessibility:
|
|
2132
|
+
accessibility: Xe,
|
|
2133
2133
|
tdm: je,
|
|
2134
2134
|
otherMetadata: ot
|
|
2135
2135
|
});
|
|
@@ -2147,13 +2147,13 @@ const et = class et {
|
|
|
2147
2147
|
}
|
|
2148
2148
|
/**
|
|
2149
2149
|
* Computes a [Layout] using the [conformsTo] profile and layout property.
|
|
2150
|
-
*
|
|
2150
|
+
*
|
|
2151
2151
|
* Special cases:
|
|
2152
2152
|
* - EPUB profile defaults to reflowable if layout is not present
|
|
2153
2153
|
* - Divina profile defaults to fixed if layout is not present
|
|
2154
2154
|
* - Layout is ignored for audiobook and PDF profiles
|
|
2155
2155
|
* - Layout is ignored if set to reflowable on a Divina profile
|
|
2156
|
-
*
|
|
2156
|
+
*
|
|
2157
2157
|
* Note: Stops at the first matching profile.
|
|
2158
2158
|
*/
|
|
2159
2159
|
get effectiveLayout() {
|
|
@@ -2162,9 +2162,9 @@ const et = class et {
|
|
|
2162
2162
|
for (const t of this.conformsTo)
|
|
2163
2163
|
switch (t) {
|
|
2164
2164
|
case q.EPUB:
|
|
2165
|
-
return this.layout ||
|
|
2165
|
+
return this.layout || K.reflowable;
|
|
2166
2166
|
case q.DIVINA:
|
|
2167
|
-
return this.layout ===
|
|
2167
|
+
return this.layout === K.reflowable ? K.fixed : this.layout || K.fixed;
|
|
2168
2168
|
case q.AUDIOBOOK:
|
|
2169
2169
|
case q.PDF:
|
|
2170
2170
|
return null;
|
|
@@ -2239,15 +2239,15 @@ pt.prototype.getMediaOverlay = function() {
|
|
|
2239
2239
|
U.prototype.getContains = function() {
|
|
2240
2240
|
return new Set(this.otherProperties.contains || []);
|
|
2241
2241
|
};
|
|
2242
|
-
class
|
|
2242
|
+
class Kt {
|
|
2243
2243
|
constructor(t) {
|
|
2244
2244
|
this.links = t.links, this.guided = t.guided;
|
|
2245
2245
|
}
|
|
2246
2246
|
static deserialize(t) {
|
|
2247
2247
|
if (t)
|
|
2248
|
-
return new
|
|
2249
|
-
links:
|
|
2250
|
-
guided:
|
|
2248
|
+
return new Kt({
|
|
2249
|
+
links: x.deserialize(t.links),
|
|
2250
|
+
guided: X.deserializeArray(t.guided)
|
|
2251
2251
|
});
|
|
2252
2252
|
}
|
|
2253
2253
|
serialize() {
|
|
@@ -2282,7 +2282,7 @@ class mt {
|
|
|
2282
2282
|
return this.plain !== void 0 && (t.plain = this.plain), this.ssml !== void 0 && (t.ssml = this.ssml), this.language !== void 0 && (t.language = this.language), Object.keys(t).length > 0 ? t : void 0;
|
|
2283
2283
|
}
|
|
2284
2284
|
}
|
|
2285
|
-
class
|
|
2285
|
+
class X {
|
|
2286
2286
|
/**
|
|
2287
2287
|
* Creates a [GuidedNavigation] object.
|
|
2288
2288
|
*/
|
|
@@ -2313,23 +2313,23 @@ class K {
|
|
|
2313
2313
|
*/
|
|
2314
2314
|
static deserialize(t) {
|
|
2315
2315
|
if (t)
|
|
2316
|
-
return new
|
|
2316
|
+
return new X({
|
|
2317
2317
|
audioref: t.audioref,
|
|
2318
|
-
children:
|
|
2318
|
+
children: X.deserializeArray(t.children),
|
|
2319
2319
|
imgref: t.imgref,
|
|
2320
2320
|
role: t.role ? new Set(_(t.role)) : void 0,
|
|
2321
2321
|
level: typeof t.level == "number" ? t.level : void 0,
|
|
2322
2322
|
text: mt.deserialize(t.text),
|
|
2323
2323
|
textref: t.textref,
|
|
2324
|
-
description:
|
|
2324
|
+
description: X.deserialize(t.description)
|
|
2325
2325
|
});
|
|
2326
2326
|
}
|
|
2327
|
-
/**
|
|
2327
|
+
/**
|
|
2328
2328
|
* Parses a [GuidedNavigationObject] array from its RWPM JSON representation.
|
|
2329
2329
|
*/
|
|
2330
2330
|
static deserializeArray(t) {
|
|
2331
2331
|
if (Array.isArray(t))
|
|
2332
|
-
return t.map((e) =>
|
|
2332
|
+
return t.map((e) => X.deserialize(e)).filter((e) => e !== void 0);
|
|
2333
2333
|
}
|
|
2334
2334
|
/**
|
|
2335
2335
|
* Serializes a [GuidedNavigationObject] to its RWPM JSON representation.
|
|
@@ -2379,7 +2379,7 @@ function di(s, t) {
|
|
|
2379
2379
|
function fi(s, t) {
|
|
2380
2380
|
return s.slice(s.length - t.length) === t;
|
|
2381
2381
|
}
|
|
2382
|
-
const
|
|
2382
|
+
const yt = {
|
|
2383
2383
|
endsWith: fi,
|
|
2384
2384
|
endsWithChar: di
|
|
2385
2385
|
}, pi = [
|
|
@@ -2507,7 +2507,7 @@ function vi(s) {
|
|
|
2507
2507
|
function Ai(s) {
|
|
2508
2508
|
return s.match(/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/);
|
|
2509
2509
|
}
|
|
2510
|
-
function
|
|
2510
|
+
function wi(s) {
|
|
2511
2511
|
var t = 0;
|
|
2512
2512
|
if ((t = s.indexOf(".")) > -1 || (t = s.indexOf("!")) > -1 || (t = s.indexOf("?")) > -1) {
|
|
2513
2513
|
var e = s.charAt(t + 1);
|
|
@@ -2516,7 +2516,7 @@ function yi(s) {
|
|
|
2516
2516
|
}
|
|
2517
2517
|
return !1;
|
|
2518
2518
|
}
|
|
2519
|
-
function
|
|
2519
|
+
function yi(s) {
|
|
2520
2520
|
return s === "." || s === "!" || s === "?";
|
|
2521
2521
|
}
|
|
2522
2522
|
function Si(s, t) {
|
|
@@ -2528,27 +2528,27 @@ function Si(s, t) {
|
|
|
2528
2528
|
// Split into words
|
|
2529
2529
|
s.re(e, { split: !0 }),
|
|
2530
2530
|
// Merge words as sentences
|
|
2531
|
-
s.splitAndMerge(function(i, r, n, a, o,
|
|
2532
|
-
var p, m = [i, null], u = i, g =
|
|
2533
|
-
return !e.test(
|
|
2531
|
+
s.splitAndMerge(function(i, r, n, a, o, l) {
|
|
2532
|
+
var p, m = [i, null], u = i, g = l.slice(o + 1).find(function(k) {
|
|
2533
|
+
return !e.test(k.value);
|
|
2534
2534
|
});
|
|
2535
2535
|
if (i === `
|
|
2536
|
-
` && t.newlineBoundary ||
|
|
2536
|
+
` && t.newlineBoundary || yi(i) || yt.endsWithChar(i, "?!"))
|
|
2537
2537
|
return m;
|
|
2538
|
-
if (
|
|
2538
|
+
if (yt.endsWithChar(i, ".")) {
|
|
2539
2539
|
if (g) {
|
|
2540
2540
|
if (i.length === 2 && isNaN(i.charAt(0)) && i.match(/[a-zA-Z]/) || gi(i))
|
|
2541
2541
|
return u;
|
|
2542
2542
|
if (mi(g.value)) {
|
|
2543
2543
|
if (bi(i, g.value) || Lt(g.value) && ae(i))
|
|
2544
2544
|
return u;
|
|
2545
|
-
} else if (
|
|
2545
|
+
} else if (yt.endsWith(i, "..") || ne(i) || ae(i))
|
|
2546
2546
|
return u;
|
|
2547
2547
|
}
|
|
2548
2548
|
return m;
|
|
2549
2549
|
}
|
|
2550
2550
|
let A;
|
|
2551
|
-
return (A = i.indexOf(".")) > -1 && (Lt(i, A) || ne(i) || Ai(i) || vi(i)) ? u : (p =
|
|
2551
|
+
return (A = i.indexOf(".")) > -1 && (Lt(i, A) || ne(i) || Ai(i) || vi(i)) ? u : (p = wi(i)) ? [
|
|
2552
2552
|
p[0] + p[1],
|
|
2553
2553
|
null,
|
|
2554
2554
|
p[2]
|
|
@@ -2596,8 +2596,8 @@ function Oi(s, t) {
|
|
|
2596
2596
|
return s.forEach(function(n, a) {
|
|
2597
2597
|
var o = s[a - 1];
|
|
2598
2598
|
s[a + 1];
|
|
2599
|
-
var
|
|
2600
|
-
e = e + new Array(
|
|
2599
|
+
var l = o ? n.index + 1 - (o.index + o.offset) : 0;
|
|
2600
|
+
e = e + new Array(l).join(t) + n.value;
|
|
2601
2601
|
var p = n.index - r + n.offset;
|
|
2602
2602
|
p > i && (i = p);
|
|
2603
2603
|
}), {
|
|
@@ -2616,8 +2616,8 @@ const j = {
|
|
|
2616
2616
|
var Li = ' \r\n !"#$%&()*+,-.\\/:;<=>?@[\\]^_`{|}~', zi = new RegExp(
|
|
2617
2617
|
"([^" + Li + "]+)"
|
|
2618
2618
|
);
|
|
2619
|
-
function
|
|
2620
|
-
if (!(this instanceof
|
|
2619
|
+
function z(s) {
|
|
2620
|
+
if (!(this instanceof z)) return new z(s);
|
|
2621
2621
|
this.opts = Object.assign({
|
|
2622
2622
|
cacheGet: function(t) {
|
|
2623
2623
|
return null;
|
|
@@ -2626,18 +2626,18 @@ function C(s) {
|
|
|
2626
2626
|
}
|
|
2627
2627
|
}, s);
|
|
2628
2628
|
}
|
|
2629
|
-
|
|
2629
|
+
z.prototype.split = function(t, e = {}) {
|
|
2630
2630
|
var i = this;
|
|
2631
2631
|
return e = Object.assign({ preserveProperties: !0, cache: () => null }, e), function(r, n) {
|
|
2632
2632
|
if (arguments.length === 6) return t.apply(null, arguments);
|
|
2633
|
-
var a, o,
|
|
2633
|
+
var a, o, l;
|
|
2634
2634
|
if (r === void 0) return [];
|
|
2635
2635
|
if (typeof r == "string" ? r = [{
|
|
2636
2636
|
value: r,
|
|
2637
2637
|
index: 0,
|
|
2638
2638
|
offset: r.length
|
|
2639
|
-
}] : Array.isArray(r) || (r = [r]), o = j.tokensId(r, e.cache()), o && (
|
|
2640
|
-
return
|
|
2639
|
+
}] : Array.isArray(r) || (r = [r]), o = j.tokensId(r, e.cache()), o && (l = i.opts.cacheGet(o), l))
|
|
2640
|
+
return l;
|
|
2641
2641
|
var p = r.map(function(m, u) {
|
|
2642
2642
|
var g = r[u + 1], A = t(
|
|
2643
2643
|
m.value,
|
|
@@ -2648,9 +2648,9 @@ C.prototype.split = function(t, e = {}) {
|
|
|
2648
2648
|
r
|
|
2649
2649
|
) || [];
|
|
2650
2650
|
if (A = j.normalize(m, A), e.preserveProperties) {
|
|
2651
|
-
var
|
|
2651
|
+
var k = j.properties(m);
|
|
2652
2652
|
A = A.map(function(d) {
|
|
2653
|
-
return Object.assign({}, d,
|
|
2653
|
+
return Object.assign({}, d, k);
|
|
2654
2654
|
});
|
|
2655
2655
|
}
|
|
2656
2656
|
return a = m, A;
|
|
@@ -2658,15 +2658,15 @@ C.prototype.split = function(t, e = {}) {
|
|
|
2658
2658
|
return o && i.opts.cacheSet(o, p), p;
|
|
2659
2659
|
};
|
|
2660
2660
|
};
|
|
2661
|
-
|
|
2661
|
+
z.prototype.re = function(t, e = {}) {
|
|
2662
2662
|
return e = Object.assign({ split: !1 }, e), this.split(function(i, r) {
|
|
2663
|
-
for (var n = i, a = [], o,
|
|
2664
|
-
var p = o.index, m =
|
|
2665
|
-
if (e.split &&
|
|
2666
|
-
var A = n.slice(
|
|
2663
|
+
for (var n = i, a = [], o, l = 0; o = t.exec(i); ) {
|
|
2664
|
+
var p = o.index, m = l + p, u = o[0] || "", g = u.length;
|
|
2665
|
+
if (e.split && l < m) {
|
|
2666
|
+
var A = n.slice(l, m);
|
|
2667
2667
|
a.push({
|
|
2668
2668
|
value: A,
|
|
2669
|
-
index:
|
|
2669
|
+
index: l,
|
|
2670
2670
|
offset: A.length
|
|
2671
2671
|
});
|
|
2672
2672
|
}
|
|
@@ -2675,11 +2675,11 @@ C.prototype.re = function(t, e = {}) {
|
|
|
2675
2675
|
index: m,
|
|
2676
2676
|
offset: g,
|
|
2677
2677
|
match: o
|
|
2678
|
-
}), i = i.slice(p + g),
|
|
2678
|
+
}), i = i.slice(p + g), l = m + g;
|
|
2679
2679
|
}
|
|
2680
2680
|
return e.split && i && a.push({
|
|
2681
2681
|
value: i,
|
|
2682
|
-
index:
|
|
2682
|
+
index: l,
|
|
2683
2683
|
offset: i.length
|
|
2684
2684
|
}), a;
|
|
2685
2685
|
}, {
|
|
@@ -2688,17 +2688,17 @@ C.prototype.re = function(t, e = {}) {
|
|
|
2688
2688
|
}
|
|
2689
2689
|
});
|
|
2690
2690
|
};
|
|
2691
|
-
|
|
2691
|
+
z.prototype.splitAndMerge = function(t, e = {}) {
|
|
2692
2692
|
var i = this;
|
|
2693
2693
|
return e = Object.assign({ mergeWith: "" }, e), function(r) {
|
|
2694
2694
|
var n = [], a = [];
|
|
2695
2695
|
function o() {
|
|
2696
2696
|
if (a.length != 0) {
|
|
2697
|
-
var
|
|
2698
|
-
n.push(
|
|
2697
|
+
var l = j.merge(a, e.mergeWith);
|
|
2698
|
+
n.push(l), a = [];
|
|
2699
2699
|
}
|
|
2700
2700
|
}
|
|
2701
|
-
return i.split(function(
|
|
2701
|
+
return i.split(function(l, p) {
|
|
2702
2702
|
var m = t.apply(null, arguments);
|
|
2703
2703
|
m = j.normalize(p, m), m.forEach(function(u) {
|
|
2704
2704
|
u === null ? o() : a.push(u);
|
|
@@ -2706,7 +2706,7 @@ C.prototype.splitAndMerge = function(t, e = {}) {
|
|
|
2706
2706
|
})(r), o(), n;
|
|
2707
2707
|
};
|
|
2708
2708
|
};
|
|
2709
|
-
|
|
2709
|
+
z.prototype.filter = function(t) {
|
|
2710
2710
|
return this.split(function(e, i) {
|
|
2711
2711
|
if (t.apply(null, arguments))
|
|
2712
2712
|
return {
|
|
@@ -2716,7 +2716,7 @@ C.prototype.filter = function(t) {
|
|
|
2716
2716
|
};
|
|
2717
2717
|
});
|
|
2718
2718
|
};
|
|
2719
|
-
|
|
2719
|
+
z.prototype.extend = function(t) {
|
|
2720
2720
|
return this.split(function(e, i) {
|
|
2721
2721
|
var r = typeof t == "function" ? t.apply(null, arguments) : t;
|
|
2722
2722
|
return Object.assign({
|
|
@@ -2726,7 +2726,7 @@ C.prototype.extend = function(t) {
|
|
|
2726
2726
|
}, r);
|
|
2727
2727
|
});
|
|
2728
2728
|
};
|
|
2729
|
-
|
|
2729
|
+
z.prototype.ifthen = function(s, t) {
|
|
2730
2730
|
return this.split(function(e, i) {
|
|
2731
2731
|
if (s.apply(null, arguments))
|
|
2732
2732
|
return t.apply(null, arguments);
|
|
@@ -2734,35 +2734,35 @@ C.prototype.ifthen = function(s, t) {
|
|
|
2734
2734
|
return n;
|
|
2735
2735
|
});
|
|
2736
2736
|
};
|
|
2737
|
-
|
|
2737
|
+
z.prototype.test = function(t) {
|
|
2738
2738
|
return this.filter(function(e, i) {
|
|
2739
2739
|
return t.test(e);
|
|
2740
2740
|
}, {
|
|
2741
2741
|
cache: t.toString()
|
|
2742
2742
|
});
|
|
2743
2743
|
};
|
|
2744
|
-
|
|
2744
|
+
z.prototype.flow = function(...t) {
|
|
2745
2745
|
const e = t.reduce((i, r) => (...n) => r(i(...n)));
|
|
2746
2746
|
return this.split(e);
|
|
2747
2747
|
};
|
|
2748
|
-
|
|
2748
|
+
z.prototype.serie = function(...t) {
|
|
2749
2749
|
return t.reduce((e, i) => (...r) => i(e(...r)));
|
|
2750
2750
|
};
|
|
2751
|
-
|
|
2751
|
+
z.prototype.merge = function() {
|
|
2752
2752
|
return this.splitAndMerge((s) => [s]);
|
|
2753
2753
|
};
|
|
2754
|
-
|
|
2754
|
+
z.prototype.sections = function() {
|
|
2755
2755
|
return this.re(/([^\n\.,;!?]+)/i, { split: !1 });
|
|
2756
2756
|
};
|
|
2757
|
-
|
|
2757
|
+
z.prototype.words = function() {
|
|
2758
2758
|
return this.re(zi);
|
|
2759
2759
|
};
|
|
2760
|
-
|
|
2760
|
+
z.prototype.characters = function() {
|
|
2761
2761
|
return this.re(/[^\s]/);
|
|
2762
2762
|
};
|
|
2763
2763
|
var Ci = /* @__PURE__ */ ((s) => (s.Word = "word", s.Sentence = "sentence", s.Paragraph = "paragraph", s))(Ci || {});
|
|
2764
|
-
const Ri = (s, t) => "Segmenter" in Intl ? new
|
|
2765
|
-
class
|
|
2764
|
+
const Ri = (s, t) => "Segmenter" in Intl ? new ki(s, t) : new Pi(s, t);
|
|
2765
|
+
class ki {
|
|
2766
2766
|
constructor(t, e) {
|
|
2767
2767
|
if (this.unit = e, t = t ?? navigator?.language, !("Segmenter" in Intl)) throw new Error("Intl.Segmenter is not supported in this environment");
|
|
2768
2768
|
if (e === "paragraph") throw new Error("IntlTextTokenizer does not handle TextUnit.Paragraph");
|
|
@@ -2780,10 +2780,10 @@ class Pi {
|
|
|
2780
2780
|
return i;
|
|
2781
2781
|
}
|
|
2782
2782
|
}
|
|
2783
|
-
class
|
|
2783
|
+
class Pi {
|
|
2784
2784
|
constructor(t, e) {
|
|
2785
2785
|
if (this.unit = e, t = t ?? navigator?.language, this.isEnglish = t.toLowerCase().split("-")[0] === "en", e === "paragraph") throw new Error("NaiveTextTokenizer does not handle TextUnit.Paragraph");
|
|
2786
|
-
this.tokenizer = new
|
|
2786
|
+
this.tokenizer = new z();
|
|
2787
2787
|
}
|
|
2788
2788
|
tokenize(t) {
|
|
2789
2789
|
let e = [];
|
|
@@ -2810,21 +2810,21 @@ const Di = new RegExp("[\\p{L}\\p{N}]+", "u"), pe = (s) => {
|
|
|
2810
2810
|
const t = s.trimEnd();
|
|
2811
2811
|
return t.length === 0 || t.match(Di) === null ? null : t;
|
|
2812
2812
|
};
|
|
2813
|
-
class
|
|
2813
|
+
class C {
|
|
2814
2814
|
constructor(t, e) {
|
|
2815
|
-
this._allItems = t, this.linkMap = e;
|
|
2815
|
+
this._trimmedLinkMap = /* @__PURE__ */ new Map(), this._allItems = t, this.linkMap = e;
|
|
2816
2816
|
}
|
|
2817
2817
|
static build(t, e = {}) {
|
|
2818
2818
|
const i = t.toc?.items ?? [], r = t.readingOrder.items, { depth: n } = e, a = /* @__PURE__ */ new Map(), o = [];
|
|
2819
|
-
for (let
|
|
2820
|
-
const p = r[
|
|
2819
|
+
for (let l = 0; l < r.length; l++) {
|
|
2820
|
+
const p = r[l], m = C.bareHref(p.href), u = p.title ?? C.findTitleInToc(i, m, n) ?? `Resource ${l + 1}`, g = C.collectChildrenFromToc(i, m, n, 1, a), A = {
|
|
2821
2821
|
title: u,
|
|
2822
2822
|
references: [p.href],
|
|
2823
2823
|
children: g.length > 0 ? g : void 0
|
|
2824
2824
|
};
|
|
2825
2825
|
a.set(A, p), o.push(A);
|
|
2826
2826
|
}
|
|
2827
|
-
return new
|
|
2827
|
+
return new C(o, a);
|
|
2828
2828
|
}
|
|
2829
2829
|
/**
|
|
2830
2830
|
* The active depth limit for TOC traversal (title resolution and child
|
|
@@ -2839,14 +2839,18 @@ class x {
|
|
|
2839
2839
|
}
|
|
2840
2840
|
/** Top-level timeline items. Cached; invalidated when `depth` changes. */
|
|
2841
2841
|
get items() {
|
|
2842
|
-
return this._items || (this.
|
|
2842
|
+
return this._items || (this._depth !== void 0 ? (this._trimmedLinkMap = /* @__PURE__ */ new Map(), this._items = C.trimToDepth(this._allItems, this._depth, this.linkMap, this._trimmedLinkMap)) : this._items = this._allItems), this._items;
|
|
2843
2843
|
}
|
|
2844
2844
|
locate(t) {
|
|
2845
2845
|
const e = t.href.split("#")[0], i = t.locations?.time();
|
|
2846
2846
|
let r;
|
|
2847
|
-
if (i !== void 0)
|
|
2848
|
-
|
|
2849
|
-
|
|
2847
|
+
if (i !== void 0) {
|
|
2848
|
+
let n = -1 / 0;
|
|
2849
|
+
for (const a of this.flat) {
|
|
2850
|
+
const o = this.itemStartTime(a, e);
|
|
2851
|
+
o !== void 0 && o <= i && o > n && (n = o, r = a);
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2850
2854
|
return r || (r = this.flat.find((n) => this.bareHrefFromItem(n) === e)), r;
|
|
2851
2855
|
}
|
|
2852
2856
|
adjacentTo(t) {
|
|
@@ -2866,13 +2870,12 @@ class x {
|
|
|
2866
2870
|
if (!n.children?.length) return n;
|
|
2867
2871
|
if (i !== void 0) {
|
|
2868
2872
|
const o = e * i;
|
|
2869
|
-
let
|
|
2870
|
-
for (const
|
|
2871
|
-
const
|
|
2872
|
-
|
|
2873
|
-
h = p;
|
|
2873
|
+
let l = n, p = -1 / 0;
|
|
2874
|
+
for (const m of n.children) {
|
|
2875
|
+
const u = this.timeFromItem(m);
|
|
2876
|
+
u !== void 0 && u <= o && u > p && (p = u, l = m);
|
|
2874
2877
|
}
|
|
2875
|
-
return
|
|
2878
|
+
return l;
|
|
2876
2879
|
}
|
|
2877
2880
|
const a = Math.min(Math.floor(e * n.children.length), n.children.length - 1);
|
|
2878
2881
|
return n.children[a];
|
|
@@ -2881,7 +2884,7 @@ class x {
|
|
|
2881
2884
|
return this.ancestorPath(this.items, t) ?? [];
|
|
2882
2885
|
}
|
|
2883
2886
|
linkFor(t) {
|
|
2884
|
-
return this.linkMap.get(t);
|
|
2887
|
+
return this.linkMap.get(t) ?? this._trimmedLinkMap.get(t);
|
|
2885
2888
|
}
|
|
2886
2889
|
get flat() {
|
|
2887
2890
|
return this._flat || (this._flat = this.flattenItems(this.items)), this._flat;
|
|
@@ -2897,7 +2900,7 @@ class x {
|
|
|
2897
2900
|
* 3. Multiple fragment entries — ambiguous, returns `undefined`.
|
|
2898
2901
|
*/
|
|
2899
2902
|
static findTitleInToc(t, e, i) {
|
|
2900
|
-
const { atStart: r, fragments: n } =
|
|
2903
|
+
const { atStart: r, fragments: n } = C.collectTocCandidates(t, e, i, 1);
|
|
2901
2904
|
if (r.length > 0) return r[0].title;
|
|
2902
2905
|
if (n.length === 1) return n[0].title;
|
|
2903
2906
|
}
|
|
@@ -2911,11 +2914,11 @@ class x {
|
|
|
2911
2914
|
if (i !== void 0 && r > i) return [];
|
|
2912
2915
|
const a = [];
|
|
2913
2916
|
for (const o of t) {
|
|
2914
|
-
if (
|
|
2915
|
-
const
|
|
2916
|
-
n.set(
|
|
2917
|
+
if (C.bareHref(o.href) === e && o.title && !C.isStartOfResource(o.href)) {
|
|
2918
|
+
const l = { title: o.title, references: [o.href] };
|
|
2919
|
+
n.set(l, o), a.push(l);
|
|
2917
2920
|
}
|
|
2918
|
-
o.children?.items?.length && a.push(...
|
|
2921
|
+
o.children?.items?.length && a.push(...C.collectChildrenFromToc(
|
|
2919
2922
|
o.children.items,
|
|
2920
2923
|
e,
|
|
2921
2924
|
i,
|
|
@@ -2935,33 +2938,40 @@ class x {
|
|
|
2935
2938
|
return { atStart: [], fragments: [] };
|
|
2936
2939
|
const n = [], a = [];
|
|
2937
2940
|
for (const o of t)
|
|
2938
|
-
if (
|
|
2939
|
-
const
|
|
2941
|
+
if (C.bareHref(o.href) === e && o.title && (C.isStartOfResource(o.href) ? n.push(o) : a.push(o)), o.children?.items?.length) {
|
|
2942
|
+
const l = C.collectTocCandidates(
|
|
2940
2943
|
o.children.items,
|
|
2941
2944
|
e,
|
|
2942
2945
|
i,
|
|
2943
2946
|
r + 1
|
|
2944
2947
|
);
|
|
2945
|
-
n.push(...
|
|
2948
|
+
n.push(...l.atStart), a.push(...l.fragments);
|
|
2946
2949
|
}
|
|
2947
2950
|
return { atStart: n, fragments: a };
|
|
2948
2951
|
}
|
|
2949
2952
|
/**
|
|
2950
2953
|
* A TOC href points to the start of its resource when it has no fragment,
|
|
2951
|
-
* or when the fragment
|
|
2954
|
+
* or when the fragment contains a parsable `t=` value of 0 (audio: explicit
|
|
2955
|
+
* beginning of the file). Accepts decimals and extra params, e.g. `t=0.0`
|
|
2956
|
+
* or `foo=bar&t=0`.
|
|
2952
2957
|
*/
|
|
2953
2958
|
static isStartOfResource(t) {
|
|
2954
2959
|
const e = t.split("#")[1];
|
|
2955
|
-
|
|
2960
|
+
if (!e) return !0;
|
|
2961
|
+
const i = e.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
2962
|
+
return i !== null && parseFloat(i[1]) === 0;
|
|
2956
2963
|
}
|
|
2957
2964
|
// -------------------------------------------------------------------------
|
|
2958
2965
|
// Shared utilities
|
|
2959
2966
|
// -------------------------------------------------------------------------
|
|
2960
|
-
static trimToDepth(t, e) {
|
|
2961
|
-
return t.map((
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2967
|
+
static trimToDepth(t, e, i, r) {
|
|
2968
|
+
return t.map((n) => {
|
|
2969
|
+
const a = {
|
|
2970
|
+
...n,
|
|
2971
|
+
children: e > 1 && n.children?.length ? C.trimToDepth(n.children, e - 1, i, r) : void 0
|
|
2972
|
+
}, o = i.get(n);
|
|
2973
|
+
return o && r.set(a, o), a;
|
|
2974
|
+
});
|
|
2965
2975
|
}
|
|
2966
2976
|
flattenItems(t) {
|
|
2967
2977
|
const e = [];
|
|
@@ -2969,18 +2979,14 @@ class x {
|
|
|
2969
2979
|
e.push(i), i.children && e.push(...this.flattenItems(i.children));
|
|
2970
2980
|
return e;
|
|
2971
2981
|
}
|
|
2972
|
-
|
|
2973
|
-
for (const
|
|
2974
|
-
const
|
|
2975
|
-
if ((
|
|
2976
|
-
|
|
2982
|
+
itemStartTime(t, e) {
|
|
2983
|
+
for (const i of t.references) {
|
|
2984
|
+
const r = i.indexOf("#"), n = r >= 0 ? i.slice(0, r) : i, a = r >= 0 ? i.slice(r + 1) : void 0;
|
|
2985
|
+
if ((n || this.bareHrefFromItem(t)) !== e) continue;
|
|
2986
|
+
if (!a) return;
|
|
2987
|
+
const l = a.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
2988
|
+
return l ? parseFloat(l[1]) : void 0;
|
|
2977
2989
|
}
|
|
2978
|
-
return !1;
|
|
2979
|
-
}
|
|
2980
|
-
static parseTimeFragment(t) {
|
|
2981
|
-
if (!t) return 0;
|
|
2982
|
-
const e = t.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
2983
|
-
return e ? parseFloat(e[1]) : 0;
|
|
2984
2990
|
}
|
|
2985
2991
|
bareHrefFromItem(t) {
|
|
2986
2992
|
return (t.references[0] ?? "").split("#")[0];
|
|
@@ -3013,11 +3019,10 @@ class Y {
|
|
|
3013
3019
|
}
|
|
3014
3020
|
/**
|
|
3015
3021
|
* Returns the publication's timeline, built from its reading order and table of contents.
|
|
3016
|
-
*
|
|
3017
|
-
* with a specific configuration (e.g. a depth limit).
|
|
3022
|
+
* The result is cached after the first call.
|
|
3018
3023
|
*/
|
|
3019
3024
|
get timeline() {
|
|
3020
|
-
return this._timeline || (this._timeline =
|
|
3025
|
+
return this._timeline || (this._timeline = C.build(this)), this._timeline;
|
|
3021
3026
|
}
|
|
3022
3027
|
/** The URL where this publication is served, computed from the `Link` with `self` relation.
|
|
3023
3028
|
* e.g. https://provider.com/pub1293/manifest.json gives https://provider.com/pub1293/
|
|
@@ -3050,7 +3055,7 @@ class Y {
|
|
|
3050
3055
|
/**
|
|
3051
3056
|
* Gets the cover image for the publication.
|
|
3052
3057
|
* First looks for rel='cover' in links/resources/readingOrder,
|
|
3053
|
-
* then falls back to any image (JPEG, PNG, GIF, AVIF, SVG)
|
|
3058
|
+
* then falls back to any image (JPEG, PNG, GIF, AVIF, SVG).
|
|
3054
3059
|
*/
|
|
3055
3060
|
getCover() {
|
|
3056
3061
|
const t = [
|
|
@@ -3070,7 +3075,7 @@ class Y {
|
|
|
3070
3075
|
}
|
|
3071
3076
|
}
|
|
3072
3077
|
async positionsFromManifest() {
|
|
3073
|
-
const t = this.manifest.links
|
|
3078
|
+
const t = this.manifest.links?.findWithMediaType(
|
|
3074
3079
|
"application/vnd.readium.position-list+json"
|
|
3075
3080
|
);
|
|
3076
3081
|
if (t === void 0) return [];
|
|
@@ -3088,7 +3093,7 @@ class Y {
|
|
|
3088
3093
|
const a = this.linkWithHref(t.href);
|
|
3089
3094
|
a !== void 0 && (i = e(a));
|
|
3090
3095
|
}
|
|
3091
|
-
if (i || (i = this.manifest.links
|
|
3096
|
+
if (i || (i = this.manifest.links?.findWithMediaType(
|
|
3092
3097
|
"application/guided-navigation+json"
|
|
3093
3098
|
)), !i) return;
|
|
3094
3099
|
let r = i.href;
|
|
@@ -3099,7 +3104,7 @@ class Y {
|
|
|
3099
3104
|
const n = await this.get(new M({
|
|
3100
3105
|
href: r
|
|
3101
3106
|
})).readAsJSON();
|
|
3102
|
-
return
|
|
3107
|
+
return Kt.deserialize(n);
|
|
3103
3108
|
}
|
|
3104
3109
|
/**
|
|
3105
3110
|
* Returns the resource targeted by the given non-templated [link].
|
|
@@ -3158,7 +3163,7 @@ class gt {
|
|
|
3158
3163
|
return this.charOffset !== void 0 && (t.charOffset = this.charOffset), t;
|
|
3159
3164
|
}
|
|
3160
3165
|
}
|
|
3161
|
-
class
|
|
3166
|
+
class Xt {
|
|
3162
3167
|
/**
|
|
3163
3168
|
* Creates a [DomRange].
|
|
3164
3169
|
*/
|
|
@@ -3172,7 +3177,7 @@ class Kt {
|
|
|
3172
3177
|
if (!t) return;
|
|
3173
3178
|
let e = gt.deserialize(t.start);
|
|
3174
3179
|
if (e)
|
|
3175
|
-
return new
|
|
3180
|
+
return new Xt({
|
|
3176
3181
|
start: e,
|
|
3177
3182
|
end: gt.deserialize(t.end)
|
|
3178
3183
|
});
|
|
@@ -3192,7 +3197,7 @@ T.prototype.getPartialCfi = function() {
|
|
|
3192
3197
|
return this.otherLocations?.get("partialCfi");
|
|
3193
3198
|
};
|
|
3194
3199
|
T.prototype.getDomRange = function() {
|
|
3195
|
-
return
|
|
3200
|
+
return Xt.deserialize(this.otherLocations?.get("domRange"));
|
|
3196
3201
|
};
|
|
3197
3202
|
T.prototype.fragmentParameters = function() {
|
|
3198
3203
|
return new Map(
|
|
@@ -3374,7 +3379,7 @@ U.prototype.getAuthenticate = function() {
|
|
|
3374
3379
|
Y.prototype.getImages = function() {
|
|
3375
3380
|
return this.linksWithRole("images");
|
|
3376
3381
|
};
|
|
3377
|
-
class
|
|
3382
|
+
class or {
|
|
3378
3383
|
/**
|
|
3379
3384
|
* Extracts the full raw text, or returns null if no text content can be found.
|
|
3380
3385
|
* @param separator Separator to use between individual elements. Defaults to newline.
|
|
@@ -3433,7 +3438,7 @@ class ge extends me {
|
|
|
3433
3438
|
super(e), this.locator = t;
|
|
3434
3439
|
}
|
|
3435
3440
|
}
|
|
3436
|
-
class
|
|
3441
|
+
class wt extends ge {
|
|
3437
3442
|
/**
|
|
3438
3443
|
* Human-readable text representation for this element.
|
|
3439
3444
|
*/
|
|
@@ -3441,17 +3446,17 @@ class yt extends ge {
|
|
|
3441
3446
|
return this.accessibilityLabel;
|
|
3442
3447
|
}
|
|
3443
3448
|
}
|
|
3444
|
-
class Mi extends
|
|
3449
|
+
class Mi extends wt {
|
|
3445
3450
|
constructor(t, e, i = []) {
|
|
3446
3451
|
super(t, i), this.embeddedLink = e;
|
|
3447
3452
|
}
|
|
3448
3453
|
}
|
|
3449
|
-
class Bi extends
|
|
3454
|
+
class Bi extends wt {
|
|
3450
3455
|
constructor(t, e, i = []) {
|
|
3451
3456
|
super(t, i), this.embeddedLink = e;
|
|
3452
3457
|
}
|
|
3453
3458
|
}
|
|
3454
|
-
class Gi extends
|
|
3459
|
+
class Gi extends wt {
|
|
3455
3460
|
constructor(t, e, i, r = []) {
|
|
3456
3461
|
super(t, r), this.embeddedLink = e, this.caption = i;
|
|
3457
3462
|
}
|
|
@@ -3464,7 +3469,7 @@ class be extends me {
|
|
|
3464
3469
|
super(i), this.locator = t, this.text = e;
|
|
3465
3470
|
}
|
|
3466
3471
|
}
|
|
3467
|
-
class Ct extends
|
|
3472
|
+
class Ct extends wt {
|
|
3468
3473
|
constructor(t, e, i, r = []) {
|
|
3469
3474
|
super(t, r), this.role = e, this.segments = i;
|
|
3470
3475
|
}
|
|
@@ -3490,9 +3495,9 @@ class _i {
|
|
|
3490
3495
|
this.referenceUrl = t, this.referenceTitle = e, this.role = "quote";
|
|
3491
3496
|
}
|
|
3492
3497
|
}
|
|
3493
|
-
class
|
|
3498
|
+
class cr {
|
|
3494
3499
|
/**
|
|
3495
|
-
*
|
|
3500
|
+
*
|
|
3496
3501
|
* @param defaultLanguage The default assumed language
|
|
3497
3502
|
* @param unit The unit of the produced [Locator]s.
|
|
3498
3503
|
* @param contextSnippetLength Length of `before` and `after` snippets in the produced [Locator]s.
|
|
@@ -3551,12 +3556,20 @@ class jt {
|
|
|
3551
3556
|
return await this.hasPrevious() ? this.previous() : null;
|
|
3552
3557
|
}
|
|
3553
3558
|
}
|
|
3554
|
-
|
|
3559
|
+
class Vi {
|
|
3560
|
+
constructor(t, e) {
|
|
3561
|
+
this.index = t, this.iterator = e;
|
|
3562
|
+
}
|
|
3563
|
+
async nextContentIn(t) {
|
|
3564
|
+
return t === 1 ? this.iterator.nextOrNull() : this.iterator.previousOrNull();
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
let Yi = class {
|
|
3555
3568
|
constructor(t, e) {
|
|
3556
3569
|
this.element = t, this.direction = e;
|
|
3557
3570
|
}
|
|
3558
3571
|
};
|
|
3559
|
-
class
|
|
3572
|
+
class hr extends jt {
|
|
3560
3573
|
constructor(t, e, i) {
|
|
3561
3574
|
super(), this.publication = t, this.startLocator = e, this.resourceContentIteratorFactories = i, this._currentIterator = null, this.currentElement = null;
|
|
3562
3575
|
}
|
|
@@ -3588,7 +3601,7 @@ class lr extends jt {
|
|
|
3588
3601
|
const r = this.nextIteratorIn(t, e.index);
|
|
3589
3602
|
return r ? (this._currentIterator = r, this.nextIn(t)) : null;
|
|
3590
3603
|
}
|
|
3591
|
-
return new
|
|
3604
|
+
return new Yi(i, t);
|
|
3592
3605
|
}
|
|
3593
3606
|
/**
|
|
3594
3607
|
* Returns the [Iterator] for the current [Resource] in the reading order.
|
|
@@ -3622,8 +3635,10 @@ class lr extends jt {
|
|
|
3622
3635
|
}) : e;
|
|
3623
3636
|
if (!r) return null;
|
|
3624
3637
|
const n = this.publication.get(i);
|
|
3625
|
-
for (const a of this.resourceContentIteratorFactories)
|
|
3626
|
-
a(n, r);
|
|
3638
|
+
for (const a of this.resourceContentIteratorFactories) {
|
|
3639
|
+
const o = a(n, r);
|
|
3640
|
+
if (o) return new Vi(t, o);
|
|
3641
|
+
}
|
|
3627
3642
|
return null;
|
|
3628
3643
|
}
|
|
3629
3644
|
}
|
|
@@ -3640,7 +3655,7 @@ class ce {
|
|
|
3640
3655
|
this.element = t, this.direction = e;
|
|
3641
3656
|
}
|
|
3642
3657
|
}
|
|
3643
|
-
class
|
|
3658
|
+
class ur extends jt {
|
|
3644
3659
|
constructor(t, e) {
|
|
3645
3660
|
super(), this.pageContent = t, this.startLocator = e, this.pageContentFiltered = [], this.currentElement = null, this.currentProgression = 0, this.currentElementIndex = 0;
|
|
3646
3661
|
const i = this.pageContent.filter(
|
|
@@ -3712,7 +3727,7 @@ class hr extends jt {
|
|
|
3712
3727
|
return this.currentProgression === 0 ? 0 : this.currentProgression < 0 || this.currentProgression >= 100 ? null : Math.floor(this.currentProgression * this.pageContentFiltered.length / 100);
|
|
3713
3728
|
}
|
|
3714
3729
|
}
|
|
3715
|
-
const
|
|
3730
|
+
const $i = [
|
|
3716
3731
|
"OBJECT",
|
|
3717
3732
|
"BASE",
|
|
3718
3733
|
"FONT",
|
|
@@ -3781,7 +3796,7 @@ const Yi = [
|
|
|
3781
3796
|
"RB"
|
|
3782
3797
|
];
|
|
3783
3798
|
function le(s) {
|
|
3784
|
-
return
|
|
3799
|
+
return $i.includes(s.nodeName.toUpperCase());
|
|
3785
3800
|
}
|
|
3786
3801
|
function Et(s, t) {
|
|
3787
3802
|
const e = s.getAttribute("src");
|
|
@@ -3792,15 +3807,15 @@ function Et(s, t) {
|
|
|
3792
3807
|
return e;
|
|
3793
3808
|
}
|
|
3794
3809
|
}
|
|
3795
|
-
const st = "[\\s\\u0085\\u00A0\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]",
|
|
3810
|
+
const st = "[\\s\\u0085\\u00A0\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]", Ki = new RegExp(`^${st}+$`, "g"), Xi = new RegExp(`^${st}+|${st}+$/g`, "g"), ve = new RegExp(`^${st}+`, "g"), Ae = new RegExp(`${st}+$`, "g"), ct = (s) => (
|
|
3796
3811
|
// Normal spaces, \t, \n, \v, \f, \r, U+0085, U+00A0, U+2000 to U+200A, U+2028, U+2029, U+202F, U+205F, U+3000
|
|
3797
|
-
s?.length ?
|
|
3798
|
-
),
|
|
3812
|
+
s?.length ? Ki.test(s) : !0
|
|
3813
|
+
), we = (s) => s.replace(Xi, ""), Zi = (s) => s.replace(ve, ""), Ji = (s) => s.replace(Ae, ""), he = (s, t = "") => new nt({
|
|
3799
3814
|
before: t + (ve.exec(s)?.[0] ?? ""),
|
|
3800
|
-
highlight:
|
|
3815
|
+
highlight: we(s),
|
|
3801
3816
|
after: Ae.exec(s)?.[0] ?? ""
|
|
3802
3817
|
});
|
|
3803
|
-
function
|
|
3818
|
+
function qi(s) {
|
|
3804
3819
|
for (; s; ) {
|
|
3805
3820
|
let t = s.getAttribute("lang") || s.getAttributeNS("http://www.w3.org/1999/xhtml", "lang") || s.getAttributeNS("http://www.w3.org/XML/1998/namespace", "lang");
|
|
3806
3821
|
if (t) return t;
|
|
@@ -3808,7 +3823,7 @@ function Ji(s) {
|
|
|
3808
3823
|
}
|
|
3809
3824
|
return null;
|
|
3810
3825
|
}
|
|
3811
|
-
function
|
|
3826
|
+
function Qi(s, t) {
|
|
3812
3827
|
const e = s.length > 0 && s[s.length - 1] === " ";
|
|
3813
3828
|
let i = !1, r = !1;
|
|
3814
3829
|
for (let n = 0; n < t.length; n++)
|
|
@@ -3822,7 +3837,7 @@ function qi(s, t) {
|
|
|
3822
3837
|
}
|
|
3823
3838
|
return s;
|
|
3824
3839
|
}
|
|
3825
|
-
function
|
|
3840
|
+
function ye(s) {
|
|
3826
3841
|
return typeof s == "object" && s !== null && s.nodeType === Node.ELEMENT_NODE;
|
|
3827
3842
|
}
|
|
3828
3843
|
const bt = {
|
|
@@ -3837,14 +3852,14 @@ const bt = {
|
|
|
3837
3852
|
nthchild: "nthchild",
|
|
3838
3853
|
nthoftype: "nthoftype"
|
|
3839
3854
|
};
|
|
3840
|
-
function
|
|
3855
|
+
function ji(s, t) {
|
|
3841
3856
|
return Object.values(s).includes(t);
|
|
3842
3857
|
}
|
|
3843
|
-
const
|
|
3858
|
+
const ts = "CssSelectorGenerator";
|
|
3844
3859
|
function vt(s = "unknown problem", ...t) {
|
|
3845
|
-
console.warn(`${
|
|
3860
|
+
console.warn(`${ts}: ${s}`, ...t);
|
|
3846
3861
|
}
|
|
3847
|
-
const
|
|
3862
|
+
const es = {
|
|
3848
3863
|
selectors: [
|
|
3849
3864
|
E.id,
|
|
3850
3865
|
E.class,
|
|
@@ -3862,19 +3877,19 @@ const ts = {
|
|
|
3862
3877
|
maxCandidates: Number.POSITIVE_INFINITY,
|
|
3863
3878
|
useScope: !1
|
|
3864
3879
|
};
|
|
3865
|
-
function
|
|
3866
|
-
return Array.isArray(s) ? s.filter((t) =>
|
|
3880
|
+
function is(s) {
|
|
3881
|
+
return Array.isArray(s) ? s.filter((t) => ji(E, t)) : [];
|
|
3867
3882
|
}
|
|
3868
3883
|
function Se(s) {
|
|
3869
3884
|
return s instanceof RegExp;
|
|
3870
3885
|
}
|
|
3871
|
-
function
|
|
3886
|
+
function ss(s) {
|
|
3872
3887
|
return ["string", "function"].includes(typeof s) || Se(s);
|
|
3873
3888
|
}
|
|
3874
3889
|
function ue(s) {
|
|
3875
|
-
return Array.isArray(s) ? s.filter(
|
|
3890
|
+
return Array.isArray(s) ? s.filter(ss) : [];
|
|
3876
3891
|
}
|
|
3877
|
-
function
|
|
3892
|
+
function rs(s) {
|
|
3878
3893
|
return s instanceof Node;
|
|
3879
3894
|
}
|
|
3880
3895
|
function de(s) {
|
|
@@ -3884,7 +3899,7 @@ function de(s) {
|
|
|
3884
3899
|
// this includes Shadow DOM root
|
|
3885
3900
|
Node.ELEMENT_NODE
|
|
3886
3901
|
];
|
|
3887
|
-
return
|
|
3902
|
+
return rs(s) && t.includes(s.nodeType);
|
|
3888
3903
|
}
|
|
3889
3904
|
function Ee(s, t) {
|
|
3890
3905
|
if (de(s))
|
|
@@ -3895,10 +3910,10 @@ function Ee(s, t) {
|
|
|
3895
3910
|
function Tt(s) {
|
|
3896
3911
|
return typeof s == "number" ? s : Number.POSITIVE_INFINITY;
|
|
3897
3912
|
}
|
|
3898
|
-
function
|
|
3899
|
-
const e = Object.assign(Object.assign({},
|
|
3913
|
+
function ns(s, t = {}) {
|
|
3914
|
+
const e = Object.assign(Object.assign({}, es), t);
|
|
3900
3915
|
return {
|
|
3901
|
-
selectors:
|
|
3916
|
+
selectors: is(e.selectors),
|
|
3902
3917
|
whitelist: ue(e.whitelist),
|
|
3903
3918
|
blacklist: ue(e.blacklist),
|
|
3904
3919
|
root: Ee(e.root, s),
|
|
@@ -3915,10 +3930,10 @@ function at(s = []) {
|
|
|
3915
3930
|
const [t = [], ...e] = s;
|
|
3916
3931
|
return e.length === 0 ? t : e.reduce((i, r) => i.filter((n) => r.includes(n)), t);
|
|
3917
3932
|
}
|
|
3918
|
-
function
|
|
3933
|
+
function as(s) {
|
|
3919
3934
|
return [].concat(...s);
|
|
3920
3935
|
}
|
|
3921
|
-
function
|
|
3936
|
+
function os(s) {
|
|
3922
3937
|
return s.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
|
|
3923
3938
|
}
|
|
3924
3939
|
function Rt(s) {
|
|
@@ -3931,7 +3946,7 @@ function Rt(s) {
|
|
|
3931
3946
|
return typeof r != "boolean" ? (vt("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : r;
|
|
3932
3947
|
};
|
|
3933
3948
|
if (typeof e == "string") {
|
|
3934
|
-
const i = new RegExp("^" +
|
|
3949
|
+
const i = new RegExp("^" + os(e) + "$");
|
|
3935
3950
|
return (r) => i.test(r);
|
|
3936
3951
|
}
|
|
3937
3952
|
return vt("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
|
|
@@ -3946,22 +3961,22 @@ function Te(s, t) {
|
|
|
3946
3961
|
t = t ?? ee(s);
|
|
3947
3962
|
const e = [];
|
|
3948
3963
|
let i = s;
|
|
3949
|
-
for (;
|
|
3964
|
+
for (; ye(i) && i !== t; )
|
|
3950
3965
|
e.push(i), i = i.parentElement;
|
|
3951
3966
|
return e;
|
|
3952
3967
|
}
|
|
3953
|
-
function
|
|
3968
|
+
function cs(s, t) {
|
|
3954
3969
|
return at(s.map((e) => Te(e, t)));
|
|
3955
3970
|
}
|
|
3956
3971
|
function ee(s) {
|
|
3957
3972
|
return s.ownerDocument.querySelector(":root");
|
|
3958
3973
|
}
|
|
3959
|
-
const Ie = ", ",
|
|
3974
|
+
const Ie = ", ", ls = new RegExp([
|
|
3960
3975
|
"^$",
|
|
3961
3976
|
// empty or not set
|
|
3962
3977
|
"\\s"
|
|
3963
3978
|
// contains whitespace
|
|
3964
|
-
].join("|")),
|
|
3979
|
+
].join("|")), hs = new RegExp([
|
|
3965
3980
|
"^$"
|
|
3966
3981
|
// empty or not set
|
|
3967
3982
|
].join("|")), xe = [
|
|
@@ -3971,53 +3986,53 @@ const Ie = ", ", cs = new RegExp([
|
|
|
3971
3986
|
E.class,
|
|
3972
3987
|
E.attribute,
|
|
3973
3988
|
E.nthchild
|
|
3974
|
-
],
|
|
3989
|
+
], us = Rt([
|
|
3975
3990
|
"class",
|
|
3976
3991
|
"id",
|
|
3977
3992
|
// Angular attributes
|
|
3978
3993
|
"ng-*"
|
|
3979
3994
|
]);
|
|
3980
|
-
function
|
|
3995
|
+
function ds({ name: s }) {
|
|
3981
3996
|
return `[${s}]`;
|
|
3982
3997
|
}
|
|
3983
|
-
function
|
|
3998
|
+
function fs({ name: s, value: t }) {
|
|
3984
3999
|
return `[${s}='${t}']`;
|
|
3985
4000
|
}
|
|
3986
|
-
function
|
|
4001
|
+
function ps({ nodeName: s, nodeValue: t }, e) {
|
|
3987
4002
|
const i = e.tagName.toLowerCase();
|
|
3988
|
-
return ["input", "option"].includes(i) && s === "value" || s === "src" && t?.startsWith("data:") ? !1 : !
|
|
4003
|
+
return ["input", "option"].includes(i) && s === "value" || s === "src" && t?.startsWith("data:") ? !1 : !us(s);
|
|
3989
4004
|
}
|
|
3990
|
-
function
|
|
4005
|
+
function ms({ nodeName: s, nodeValue: t }) {
|
|
3991
4006
|
return {
|
|
3992
4007
|
name: rt(s),
|
|
3993
4008
|
value: rt(t ?? void 0)
|
|
3994
4009
|
};
|
|
3995
4010
|
}
|
|
3996
4011
|
function Ne(s) {
|
|
3997
|
-
const t = Array.from(s.attributes).filter((e) =>
|
|
4012
|
+
const t = Array.from(s.attributes).filter((e) => ps(e, s)).map(ms);
|
|
3998
4013
|
return [
|
|
3999
|
-
...t.map(
|
|
4000
|
-
...t.map(
|
|
4014
|
+
...t.map(ds),
|
|
4015
|
+
...t.map(fs)
|
|
4001
4016
|
];
|
|
4002
4017
|
}
|
|
4003
|
-
function
|
|
4018
|
+
function gs(s) {
|
|
4004
4019
|
const t = s.map(Ne);
|
|
4005
4020
|
return at(t);
|
|
4006
4021
|
}
|
|
4007
4022
|
function Oe(s) {
|
|
4008
4023
|
var t;
|
|
4009
|
-
return ((t = s.getAttribute("class")) !== null && t !== void 0 ? t : "").trim().split(/\s+/).filter((e) => !
|
|
4024
|
+
return ((t = s.getAttribute("class")) !== null && t !== void 0 ? t : "").trim().split(/\s+/).filter((e) => !hs.test(e)).map((e) => `.${rt(e)}`);
|
|
4010
4025
|
}
|
|
4011
|
-
function
|
|
4026
|
+
function bs(s) {
|
|
4012
4027
|
const t = s.map(Oe);
|
|
4013
4028
|
return at(t);
|
|
4014
4029
|
}
|
|
4015
4030
|
function Le(s) {
|
|
4016
4031
|
var t;
|
|
4017
4032
|
const e = (t = s.getAttribute("id")) !== null && t !== void 0 ? t : "", i = `#${rt(e)}`, r = s.getRootNode({ composed: !1 });
|
|
4018
|
-
return !
|
|
4033
|
+
return !ls.test(e) && te([s], i, r) ? [i] : [];
|
|
4019
4034
|
}
|
|
4020
|
-
function
|
|
4035
|
+
function vs(s) {
|
|
4021
4036
|
return s.length === 0 || s.length > 1 ? [] : Le(s[0]);
|
|
4022
4037
|
}
|
|
4023
4038
|
function ze(s) {
|
|
@@ -4030,7 +4045,7 @@ function ze(s) {
|
|
|
4030
4045
|
}
|
|
4031
4046
|
return [];
|
|
4032
4047
|
}
|
|
4033
|
-
function
|
|
4048
|
+
function As(s) {
|
|
4034
4049
|
return at(s.map(ze));
|
|
4035
4050
|
}
|
|
4036
4051
|
function Ce(s) {
|
|
@@ -4040,11 +4055,11 @@ function Ce(s) {
|
|
|
4040
4055
|
}
|
|
4041
4056
|
function Re(s) {
|
|
4042
4057
|
const t = [
|
|
4043
|
-
...new Set(
|
|
4058
|
+
...new Set(as(s.map(Ce)))
|
|
4044
4059
|
];
|
|
4045
4060
|
return t.length === 0 || t.length > 1 ? [] : [t[0]];
|
|
4046
4061
|
}
|
|
4047
|
-
function
|
|
4062
|
+
function ke(s) {
|
|
4048
4063
|
const t = Re([s])[0], e = s.parentElement;
|
|
4049
4064
|
if (e) {
|
|
4050
4065
|
const r = Array.from(e.children).filter((n) => n.tagName.toLowerCase() === t).indexOf(s);
|
|
@@ -4055,18 +4070,18 @@ function Pe(s) {
|
|
|
4055
4070
|
}
|
|
4056
4071
|
return [];
|
|
4057
4072
|
}
|
|
4058
|
-
function
|
|
4059
|
-
return at(s.map(
|
|
4073
|
+
function ws(s) {
|
|
4074
|
+
return at(s.map(ke));
|
|
4060
4075
|
}
|
|
4061
|
-
function*
|
|
4062
|
-
let e = 0, i =
|
|
4076
|
+
function* Pe(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
|
|
4077
|
+
let e = 0, i = kt(1);
|
|
4063
4078
|
for (; i.length <= s.length && e < t; )
|
|
4064
|
-
e += 1, yield i.map((n) => s[n]), i =
|
|
4079
|
+
e += 1, yield i.map((n) => s[n]), i = Ss(i, s.length - 1);
|
|
4065
4080
|
}
|
|
4066
4081
|
function ys(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
|
|
4067
|
-
return Array.from(
|
|
4082
|
+
return Array.from(Pe(s, { maxResults: t }));
|
|
4068
4083
|
}
|
|
4069
|
-
function
|
|
4084
|
+
function Ss(s = [], t = 0) {
|
|
4070
4085
|
const e = s.length;
|
|
4071
4086
|
if (e === 0)
|
|
4072
4087
|
return [];
|
|
@@ -4075,15 +4090,15 @@ function ws(s = [], t = 0) {
|
|
|
4075
4090
|
for (let r = e - 1; r >= 0; r--)
|
|
4076
4091
|
if (i[r] > t) {
|
|
4077
4092
|
if (r === 0)
|
|
4078
|
-
return
|
|
4093
|
+
return kt(e + 1);
|
|
4079
4094
|
i[r - 1]++, i[r] = i[r - 1] + 1;
|
|
4080
4095
|
}
|
|
4081
|
-
return i[e - 1] > t ?
|
|
4096
|
+
return i[e - 1] > t ? kt(e + 1) : i;
|
|
4082
4097
|
}
|
|
4083
|
-
function
|
|
4098
|
+
function kt(s = 1) {
|
|
4084
4099
|
return Array.from(Array(s).keys());
|
|
4085
4100
|
}
|
|
4086
|
-
function*
|
|
4101
|
+
function* Es(s = {}) {
|
|
4087
4102
|
const t = Object.entries(s);
|
|
4088
4103
|
if (t.length === 0)
|
|
4089
4104
|
return;
|
|
@@ -4100,132 +4115,132 @@ function* Ss(s = {}) {
|
|
|
4100
4115
|
continue;
|
|
4101
4116
|
}
|
|
4102
4117
|
const [a, o] = t[r];
|
|
4103
|
-
for (let
|
|
4118
|
+
for (let l = o.length - 1; l >= 0; l--)
|
|
4104
4119
|
e.push({
|
|
4105
4120
|
index: r - 1,
|
|
4106
|
-
partial: Object.assign(Object.assign({}, n), { [a]: o[
|
|
4121
|
+
partial: Object.assign(Object.assign({}, n), { [a]: o[l] })
|
|
4107
4122
|
});
|
|
4108
4123
|
}
|
|
4109
4124
|
}
|
|
4110
|
-
const
|
|
4125
|
+
const Ts = "3a".toUpperCase(), Is = /[ !"#$%&'()\[\]{|}<>*+,./;=?@^`~\\]/;
|
|
4111
4126
|
function rt(s = "") {
|
|
4112
|
-
return CSS ? CSS.escape(s) :
|
|
4127
|
+
return CSS ? CSS.escape(s) : xs(s);
|
|
4113
4128
|
}
|
|
4114
|
-
function
|
|
4115
|
-
return s.split("").map((t) => t === ":" ? `\\${
|
|
4129
|
+
function xs(s = "") {
|
|
4130
|
+
return s.split("").map((t) => t === ":" ? `\\${Ts} ` : Is.test(t) ? `\\${t}` : escape(t).replace(/%/g, "\\")).join("");
|
|
4116
4131
|
}
|
|
4117
|
-
const
|
|
4132
|
+
const Ns = {
|
|
4118
4133
|
tag: Re,
|
|
4119
|
-
id:
|
|
4120
|
-
class:
|
|
4121
|
-
attribute:
|
|
4122
|
-
nthchild:
|
|
4123
|
-
nthoftype:
|
|
4124
|
-
},
|
|
4134
|
+
id: vs,
|
|
4135
|
+
class: bs,
|
|
4136
|
+
attribute: gs,
|
|
4137
|
+
nthchild: As,
|
|
4138
|
+
nthoftype: ws
|
|
4139
|
+
}, Os = {
|
|
4125
4140
|
tag: Ce,
|
|
4126
4141
|
id: Le,
|
|
4127
4142
|
class: Oe,
|
|
4128
4143
|
attribute: Ne,
|
|
4129
4144
|
nthchild: ze,
|
|
4130
|
-
nthoftype:
|
|
4145
|
+
nthoftype: ke
|
|
4131
4146
|
};
|
|
4132
|
-
function Os(s, t) {
|
|
4133
|
-
return Ns[t](s);
|
|
4134
|
-
}
|
|
4135
4147
|
function Ls(s, t) {
|
|
4136
|
-
|
|
4148
|
+
return Os[t](s);
|
|
4149
|
+
}
|
|
4150
|
+
function zs(s, t) {
|
|
4151
|
+
const e = Ns[t];
|
|
4137
4152
|
return e(s);
|
|
4138
4153
|
}
|
|
4139
|
-
function
|
|
4154
|
+
function Cs(s = [], t, e) {
|
|
4140
4155
|
return s.filter((i) => e(i) || !t(i));
|
|
4141
4156
|
}
|
|
4142
|
-
function
|
|
4157
|
+
function Rs(s = [], t) {
|
|
4143
4158
|
return s.sort((e, i) => {
|
|
4144
4159
|
const r = t(e), n = t(i);
|
|
4145
4160
|
return r && !n ? -1 : !r && n ? 1 : 0;
|
|
4146
4161
|
});
|
|
4147
4162
|
}
|
|
4148
|
-
function*
|
|
4163
|
+
function* ks(s, t) {
|
|
4149
4164
|
const e = /* @__PURE__ */ new Set(), i = Ps(s, t);
|
|
4150
|
-
for (const r of
|
|
4165
|
+
for (const r of Bs(i, t))
|
|
4151
4166
|
e.has(r) || (e.add(r), yield r);
|
|
4152
4167
|
}
|
|
4153
4168
|
function Ps(s, t) {
|
|
4154
|
-
const { blacklist: e, whitelist: i, combineWithinSelector: r, maxCombinations: n } = t, a = Rt(e), o = Rt(i),
|
|
4155
|
-
const u =
|
|
4156
|
-
return p[m] = r ? Array.from(
|
|
4169
|
+
const { blacklist: e, whitelist: i, combineWithinSelector: r, maxCombinations: n } = t, a = Rt(e), o = Rt(i), l = (p, m) => {
|
|
4170
|
+
const u = zs(s, m), g = Cs(u, a, o), A = Rs(g, o);
|
|
4171
|
+
return p[m] = r ? Array.from(Pe(A, { maxResults: n })) : A.map((k) => [k]), p;
|
|
4157
4172
|
};
|
|
4158
|
-
return
|
|
4173
|
+
return Ds(t).reduce(l, {});
|
|
4159
4174
|
}
|
|
4160
|
-
function
|
|
4175
|
+
function Ds(s) {
|
|
4161
4176
|
const { selectors: t, includeTag: e } = s, i = [...t];
|
|
4162
4177
|
return e && !i.includes("tag") && i.push("tag"), i;
|
|
4163
4178
|
}
|
|
4164
|
-
function
|
|
4179
|
+
function Us(s) {
|
|
4165
4180
|
return s.includes(E.tag) || s.includes(E.nthoftype) ? [...s] : [...s, E.tag];
|
|
4166
4181
|
}
|
|
4167
|
-
function
|
|
4182
|
+
function Ms(s) {
|
|
4168
4183
|
const { selectors: t, combineBetweenSelectors: e, includeTag: i, maxCandidates: r } = s, n = e ? ys(t, { maxResults: r }) : t.map((a) => [a]);
|
|
4169
|
-
return i ? n.map(
|
|
4170
|
-
}
|
|
4171
|
-
function* Ms(s, t) {
|
|
4172
|
-
for (const e of Us(t))
|
|
4173
|
-
yield* Bs(e, s);
|
|
4184
|
+
return i ? n.map(Us) : n;
|
|
4174
4185
|
}
|
|
4175
4186
|
function* Bs(s, t) {
|
|
4187
|
+
for (const e of Ms(t))
|
|
4188
|
+
yield* Gs(e, s);
|
|
4189
|
+
}
|
|
4190
|
+
function* Gs(s, t) {
|
|
4176
4191
|
const e = {};
|
|
4177
4192
|
for (const i of s) {
|
|
4178
4193
|
const r = t[i];
|
|
4179
4194
|
r && r.length > 0 && (e[i] = r);
|
|
4180
4195
|
}
|
|
4181
|
-
for (const i of
|
|
4182
|
-
yield
|
|
4196
|
+
for (const i of Es(e))
|
|
4197
|
+
yield Hs(i);
|
|
4183
4198
|
}
|
|
4184
|
-
function
|
|
4199
|
+
function Ws(s, t) {
|
|
4185
4200
|
return t[s] ? t[s].join("") : "";
|
|
4186
4201
|
}
|
|
4187
|
-
function
|
|
4202
|
+
function Hs(s = {}) {
|
|
4188
4203
|
const t = [...xe];
|
|
4189
|
-
return s[E.tag] && s[E.nthoftype] && t.splice(t.indexOf(E.tag), 1), t.map((e) =>
|
|
4204
|
+
return s[E.tag] && s[E.nthoftype] && t.splice(t.indexOf(E.tag), 1), t.map((e) => Ws(e, s)).join("");
|
|
4190
4205
|
}
|
|
4191
|
-
function
|
|
4206
|
+
function Fs(s, t) {
|
|
4192
4207
|
return [
|
|
4193
4208
|
...s.map((e) => t + bt.DESCENDANT + e),
|
|
4194
4209
|
...s.map((e) => t + bt.CHILD + e)
|
|
4195
4210
|
];
|
|
4196
4211
|
}
|
|
4197
|
-
function*
|
|
4212
|
+
function* _s(s, t) {
|
|
4198
4213
|
if (t === "")
|
|
4199
4214
|
yield* s;
|
|
4200
4215
|
else
|
|
4201
4216
|
for (const e of s)
|
|
4202
|
-
yield*
|
|
4217
|
+
yield* Fs([e], t);
|
|
4203
4218
|
}
|
|
4204
|
-
function*
|
|
4205
|
-
const r =
|
|
4206
|
-
for (const n of
|
|
4219
|
+
function* Vs(s, t, e = "", i) {
|
|
4220
|
+
const r = ks(s, i);
|
|
4221
|
+
for (const n of _s(r, e))
|
|
4207
4222
|
te(s, n, t) && (yield n);
|
|
4208
4223
|
}
|
|
4209
|
-
function*
|
|
4224
|
+
function* Ys(s, t, e = "", i) {
|
|
4210
4225
|
if (s.length === 0)
|
|
4211
4226
|
return null;
|
|
4212
4227
|
const r = [
|
|
4213
4228
|
s.length > 1 ? s : [],
|
|
4214
|
-
...
|
|
4229
|
+
...cs(s, t).map((n) => [n])
|
|
4215
4230
|
];
|
|
4216
4231
|
for (const n of r)
|
|
4217
|
-
for (const a of
|
|
4232
|
+
for (const a of Vs(n, t, e, i))
|
|
4218
4233
|
yield {
|
|
4219
4234
|
foundElements: n,
|
|
4220
4235
|
selector: a
|
|
4221
4236
|
};
|
|
4222
4237
|
}
|
|
4223
|
-
function*
|
|
4238
|
+
function* $s({ elements: s, root: t, rootSelector: e = "", options: i }) {
|
|
4224
4239
|
let r = t, n = e, a = !0;
|
|
4225
4240
|
for (; a; ) {
|
|
4226
4241
|
let o = !1;
|
|
4227
|
-
for (const
|
|
4228
|
-
const { foundElements: p, selector: m } =
|
|
4242
|
+
for (const l of Ys(s, r, n, i)) {
|
|
4243
|
+
const { foundElements: p, selector: m } = l;
|
|
4229
4244
|
if (o = !0, te(s, m, t))
|
|
4230
4245
|
yield m;
|
|
4231
4246
|
else {
|
|
@@ -4236,9 +4251,9 @@ function* Ys({ elements: s, root: t, rootSelector: e = "", options: i }) {
|
|
|
4236
4251
|
o || (a = !1);
|
|
4237
4252
|
}
|
|
4238
4253
|
}
|
|
4239
|
-
function
|
|
4254
|
+
function Ks(s) {
|
|
4240
4255
|
(s instanceof NodeList || s instanceof HTMLCollection) && (s = Array.from(s));
|
|
4241
|
-
const t = (Array.isArray(s) ? s : [s]).filter(
|
|
4256
|
+
const t = (Array.isArray(s) ? s : [s]).filter(ye);
|
|
4242
4257
|
return [...new Set(t)];
|
|
4243
4258
|
}
|
|
4244
4259
|
function Xs(s) {
|
|
@@ -4247,52 +4262,52 @@ function Xs(s) {
|
|
|
4247
4262
|
include: !1
|
|
4248
4263
|
};
|
|
4249
4264
|
}
|
|
4250
|
-
function
|
|
4265
|
+
function Zs(s, t, e = bt.NONE) {
|
|
4251
4266
|
const i = {};
|
|
4252
4267
|
return t.forEach((r) => {
|
|
4253
|
-
Reflect.set(i, r,
|
|
4268
|
+
Reflect.set(i, r, Ls(s, r).map(Xs));
|
|
4254
4269
|
}), {
|
|
4255
4270
|
element: s,
|
|
4256
4271
|
operator: e,
|
|
4257
4272
|
selectors: i
|
|
4258
4273
|
};
|
|
4259
4274
|
}
|
|
4260
|
-
function
|
|
4275
|
+
function Js({ selectors: s, operator: t }) {
|
|
4261
4276
|
let e = [...xe];
|
|
4262
4277
|
s[E.tag] && s[E.nthoftype] && (e = e.filter((r) => r !== E.tag));
|
|
4263
4278
|
let i = "";
|
|
4264
4279
|
return e.forEach((r) => {
|
|
4265
4280
|
var n;
|
|
4266
|
-
((n = s[r]) !== null && n !== void 0 ? n : []).forEach(({ value: o, include:
|
|
4267
|
-
|
|
4281
|
+
((n = s[r]) !== null && n !== void 0 ? n : []).forEach(({ value: o, include: l }) => {
|
|
4282
|
+
l && (i += o);
|
|
4268
4283
|
});
|
|
4269
4284
|
}), t + i;
|
|
4270
4285
|
}
|
|
4271
|
-
function
|
|
4286
|
+
function qs(s, t) {
|
|
4272
4287
|
const i = Te(s, t).reverse().map((r) => {
|
|
4273
4288
|
var n;
|
|
4274
|
-
const a =
|
|
4289
|
+
const a = Zs(r, [E.nthchild], bt.CHILD);
|
|
4275
4290
|
return ((n = a.selectors.nthchild) !== null && n !== void 0 ? n : []).forEach((o) => {
|
|
4276
4291
|
o.include = !0;
|
|
4277
4292
|
}), a;
|
|
4278
4293
|
});
|
|
4279
4294
|
return [
|
|
4280
4295
|
t ? ":scope" : ":root",
|
|
4281
|
-
...i.map(
|
|
4296
|
+
...i.map(Js)
|
|
4282
4297
|
].join("");
|
|
4283
4298
|
}
|
|
4284
|
-
function
|
|
4285
|
-
return s.map((e) =>
|
|
4299
|
+
function Qs(s, t) {
|
|
4300
|
+
return s.map((e) => qs(e, t)).join(Ie);
|
|
4286
4301
|
}
|
|
4287
4302
|
function De(s, t = {}) {
|
|
4288
4303
|
const e = Object.assign(Object.assign({}, t), { maxResults: 1 });
|
|
4289
|
-
return
|
|
4304
|
+
return js(s, e).next().value;
|
|
4290
4305
|
}
|
|
4291
|
-
function*
|
|
4306
|
+
function* js(s, t = {}) {
|
|
4292
4307
|
var e;
|
|
4293
|
-
const i =
|
|
4308
|
+
const i = Ks(s), r = ns(i[0], t), n = (e = r.root) !== null && e !== void 0 ? e : ee(i[0]);
|
|
4294
4309
|
let a = 0;
|
|
4295
|
-
for (const o of
|
|
4310
|
+
for (const o of $s({
|
|
4296
4311
|
elements: i,
|
|
4297
4312
|
options: r,
|
|
4298
4313
|
root: n,
|
|
@@ -4300,9 +4315,9 @@ function* Qs(s, t = {}) {
|
|
|
4300
4315
|
}))
|
|
4301
4316
|
if (yield o, a++, a >= r.maxResults)
|
|
4302
4317
|
return;
|
|
4303
|
-
i.length > 1 && (yield i.map((o) => De(o, r)).join(Ie), a++, a >= r.maxResults) || (yield
|
|
4318
|
+
i.length > 1 && (yield i.map((o) => De(o, r)).join(Ie), a++, a >= r.maxResults) || (yield Qs(i, r.useScope ? n : void 0));
|
|
4304
4319
|
}
|
|
4305
|
-
class
|
|
4320
|
+
class dr extends jt {
|
|
4306
4321
|
constructor(t, e, i = 50) {
|
|
4307
4322
|
super(), this.resource = t, this.locator = e, this.beforeMaxLength = i, this.currentElement = null, this.currentIndex = null, this.parsedElementRecipes = null, this.parser = null;
|
|
4308
4323
|
}
|
|
@@ -4337,15 +4352,15 @@ class ur extends jt {
|
|
|
4337
4352
|
}
|
|
4338
4353
|
async parseElements() {
|
|
4339
4354
|
const t = await this.resource.readAsString(), e = new DOMParser().parseFromString(t, this.locator.type);
|
|
4340
|
-
return this.parser = new
|
|
4355
|
+
return this.parser = new er(
|
|
4341
4356
|
e,
|
|
4342
4357
|
this.locator,
|
|
4343
4358
|
this.locator.locations.getCssSelector() ? e.querySelector(this.locator.locations.getCssSelector()) : null,
|
|
4344
4359
|
this.beforeMaxLength
|
|
4345
|
-
),
|
|
4360
|
+
), tr(this.parser, e.body), this.parser.result();
|
|
4346
4361
|
}
|
|
4347
4362
|
}
|
|
4348
|
-
function
|
|
4363
|
+
function tr(s, t) {
|
|
4349
4364
|
let e = t, i = 0;
|
|
4350
4365
|
for (; e != null; )
|
|
4351
4366
|
if (s.head(e, i), e.firstChild != null)
|
|
@@ -4358,7 +4373,7 @@ function js(s, t) {
|
|
|
4358
4373
|
e = e?.nextSibling || null;
|
|
4359
4374
|
}
|
|
4360
4375
|
}
|
|
4361
|
-
class
|
|
4376
|
+
class er {
|
|
4362
4377
|
constructor(t, e, i, r) {
|
|
4363
4378
|
this.doc = t, this.baseLocator = e, this.startElement = i, this.beforeMaxLength = r, this.elementRecipes = [], this.startIndex = 0, this.segmentRecipesAcc = [], this.textAcc = "", this.wholeRawTextAcc = null, this.elementRawTextAcc = "", this.rawTextAcc = "", this.currentLanguage = null, this.breadcrumbs = [], this.recipeCssSelectorCache = /* @__PURE__ */ new WeakMap();
|
|
4364
4379
|
}
|
|
@@ -4451,15 +4466,15 @@ class tr {
|
|
|
4451
4466
|
let n = e;
|
|
4452
4467
|
for (; n && n !== this.doc.body; ) {
|
|
4453
4468
|
for (let o = 0; o < n.attributes.length; o++) {
|
|
4454
|
-
const
|
|
4455
|
-
|
|
4469
|
+
const l = n.attributes[o];
|
|
4470
|
+
l.prefix && (r.has(n) ? r.set(n, r.get(n).concat([l])) : r.set(n, [l]), n.attributes.removeNamedItem(l.name));
|
|
4456
4471
|
}
|
|
4457
4472
|
n = n.parentElement;
|
|
4458
4473
|
}
|
|
4459
4474
|
const a = De(e, {
|
|
4460
4475
|
root: this.doc
|
|
4461
4476
|
});
|
|
4462
|
-
return r.forEach((o,
|
|
4477
|
+
return r.forEach((o, l) => o.forEach((p) => l.attributes.setNamedItem(p))), this.recipeCssSelectorCache.set(e, a), a;
|
|
4463
4478
|
}
|
|
4464
4479
|
// Implements NodeTraversor
|
|
4465
4480
|
head(t, e) {
|
|
@@ -4494,17 +4509,17 @@ class tr {
|
|
|
4494
4509
|
href: a
|
|
4495
4510
|
});
|
|
4496
4511
|
else {
|
|
4497
|
-
const
|
|
4512
|
+
const l = [...n.getElementsByTagName("source")].map((p) => {
|
|
4498
4513
|
const m = Et(p, this.baseLocator.href);
|
|
4499
4514
|
return m ? new M({
|
|
4500
4515
|
href: m,
|
|
4501
4516
|
type: p.getAttribute("type") || void 0
|
|
4502
4517
|
}) : null;
|
|
4503
4518
|
}).filter((p) => !!p);
|
|
4504
|
-
|
|
4505
|
-
href:
|
|
4506
|
-
type:
|
|
4507
|
-
alternates:
|
|
4519
|
+
l.length > 0 && (o = new M({
|
|
4520
|
+
href: l[0].href,
|
|
4521
|
+
type: l[0].type,
|
|
4522
|
+
alternates: l.length > 1 ? new x(l.slice(1)) : void 0
|
|
4508
4523
|
}));
|
|
4509
4524
|
}
|
|
4510
4525
|
o && (r === "AUDIO" ? this.elementRecipes.push({
|
|
@@ -4527,8 +4542,8 @@ class tr {
|
|
|
4527
4542
|
// Implements NodeTraversor
|
|
4528
4543
|
tail(t, e) {
|
|
4529
4544
|
if (t.nodeType === Node.TEXT_NODE && !ct(t.textContent)) {
|
|
4530
|
-
const i =
|
|
4531
|
-
this.currentLanguage !== i && (this.flushSegment(), this.currentLanguage = i), this.rawTextAcc += t.textContent, this.textAcc =
|
|
4545
|
+
const i = qi(t.parentElement);
|
|
4546
|
+
this.currentLanguage !== i && (this.flushSegment(), this.currentLanguage = i), this.rawTextAcc += t.textContent, this.textAcc = Qi(this.textAcc, t.textContent);
|
|
4532
4547
|
} else if (t.nodeType === Node.ELEMENT_NODE && !le(t)) {
|
|
4533
4548
|
if (!this.breadcrumbs.length || this.breadcrumbs.at(-1) !== t) throw new Error("HTMLContentIterator: breadcrumbs mismatch");
|
|
4534
4549
|
this.flushText(), this.breadcrumbs.pop();
|
|
@@ -4536,7 +4551,7 @@ class tr {
|
|
|
4536
4551
|
}
|
|
4537
4552
|
flushText() {
|
|
4538
4553
|
if (this.flushSegment(), this.startIndex === 0 && this.startElement && this.breadcrumbs.length && this.breadcrumbs.at(-1) === this.startElement && (this.startIndex = this.elementRecipes.length), !this.segmentRecipesAcc.length) return;
|
|
4539
|
-
this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text =
|
|
4554
|
+
this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text = Ji(
|
|
4540
4555
|
this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text
|
|
4541
4556
|
);
|
|
4542
4557
|
let t = Hi;
|
|
@@ -4575,10 +4590,10 @@ class tr {
|
|
|
4575
4590
|
}
|
|
4576
4591
|
flushSegment() {
|
|
4577
4592
|
let t = this.textAcc;
|
|
4578
|
-
const e =
|
|
4593
|
+
const e = we(t);
|
|
4579
4594
|
if (!ct(e)) {
|
|
4580
4595
|
if (!this.segmentRecipesAcc.length) {
|
|
4581
|
-
t =
|
|
4596
|
+
t = Zi(t);
|
|
4582
4597
|
const i = t.length && ct(t[t.length - 1]) ? t[t.length - 1] : "";
|
|
4583
4598
|
t = e + i;
|
|
4584
4599
|
}
|
|
@@ -4629,7 +4644,7 @@ class Ue {
|
|
|
4629
4644
|
* Creates a [LocatorCollection].
|
|
4630
4645
|
*/
|
|
4631
4646
|
constructor(t) {
|
|
4632
|
-
this.metadata = t.metadata ?? new At({}), this.links = t.links ?? new
|
|
4647
|
+
this.metadata = t.metadata ?? new At({}), this.links = t.links ?? new x([]), this.locators = t.locators ?? [];
|
|
4633
4648
|
}
|
|
4634
4649
|
/**
|
|
4635
4650
|
* Parses a [LocatorCollection] from its RWPM JSON representation.
|
|
@@ -4639,7 +4654,7 @@ class Ue {
|
|
|
4639
4654
|
let e, i = t.locators;
|
|
4640
4655
|
return i && Array.isArray(i) && (e = i.map((r) => D.deserialize(r)).filter((r) => r !== void 0)), new Ue({
|
|
4641
4656
|
metadata: At.deserialize(t.metadata),
|
|
4642
|
-
links:
|
|
4657
|
+
links: x.deserialize(t.links),
|
|
4643
4658
|
locators: e
|
|
4644
4659
|
});
|
|
4645
4660
|
}
|
|
@@ -4669,9 +4684,9 @@ class H {
|
|
|
4669
4684
|
if (!t) return;
|
|
4670
4685
|
let e, i, r;
|
|
4671
4686
|
if (Array.isArray(t))
|
|
4672
|
-
e =
|
|
4687
|
+
e = x.deserialize(t);
|
|
4673
4688
|
else if (typeof t == "object")
|
|
4674
|
-
e =
|
|
4689
|
+
e = x.deserialize(t.links), i = /* @__PURE__ */ new Map(), t.metadata && Object.entries(t.metadata).forEach(([n, a]) => {
|
|
4675
4690
|
i?.set(n, a);
|
|
4676
4691
|
}), r = H.deserializeCollections(t);
|
|
4677
4692
|
else
|
|
@@ -4736,35 +4751,34 @@ class Me {
|
|
|
4736
4751
|
if (!t) return;
|
|
4737
4752
|
const e = pt.deserialize(t.metadata);
|
|
4738
4753
|
if (!e) return;
|
|
4739
|
-
const i =
|
|
4740
|
-
if (!i) return;
|
|
4741
|
-
const r = z.deserialize(
|
|
4754
|
+
const i = x.deserialize(t.links), r = x.deserialize(
|
|
4742
4755
|
t.readingOrder ? t.readingOrder : t.spine
|
|
4743
4756
|
);
|
|
4744
|
-
if (r)
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4757
|
+
if (!r) return;
|
|
4758
|
+
const n = /* @__PURE__ */ new Set(["@context", "metadata", "links", "readingOrder", "spine", "resources", "toc"]), a = {};
|
|
4759
|
+
return Object.keys(t).forEach((o) => {
|
|
4760
|
+
n.has(o) || (a[o] = t[o]);
|
|
4761
|
+
}), new Me({
|
|
4762
|
+
context: _(t["@context"]),
|
|
4763
|
+
metadata: e,
|
|
4764
|
+
links: i,
|
|
4765
|
+
readingOrder: r,
|
|
4766
|
+
resources: x.deserialize(t.resources),
|
|
4767
|
+
toc: x.deserialize(t.toc),
|
|
4768
|
+
subcollections: H.deserializeCollections(a)
|
|
4769
|
+
});
|
|
4756
4770
|
}
|
|
4757
4771
|
/**
|
|
4758
4772
|
* Serializes a [Publication] to its RWPM JSON representation.
|
|
4759
4773
|
*/
|
|
4760
4774
|
serialize() {
|
|
4761
4775
|
const t = {};
|
|
4762
|
-
return this.context !== void 0 && (t["@context"] = this.context), t.metadata = this.metadata.serialize(), t.links = this.links.serialize(), t.readingOrder = this.readingOrder.serialize(), this.resources && (t.resources = this.resources.serialize()), this.toc && (t.toc = this.toc.serialize()), H.serializeCollection(t, this.subcollections), t;
|
|
4776
|
+
return this.context !== void 0 && (t["@context"] = this.context), t.metadata = this.metadata.serialize(), this.links !== void 0 && (t.links = this.links.serialize()), t.readingOrder = this.readingOrder.serialize(), this.resources && (t.resources = this.resources.serialize()), this.toc && (t.toc = this.toc.serialize()), H.serializeCollection(t, this.subcollections), t;
|
|
4763
4777
|
}
|
|
4764
4778
|
/** Finds the first link with the given relation in the manifest's links. */
|
|
4765
4779
|
linkWithRel(t) {
|
|
4766
4780
|
const e = new Array();
|
|
4767
|
-
e.push(this.readingOrder), this.resources && e.push(this.resources), e.push(this.links);
|
|
4781
|
+
e.push(this.readingOrder), this.resources && e.push(this.resources), this.links && e.push(this.links);
|
|
4768
4782
|
let i;
|
|
4769
4783
|
for (const r of e)
|
|
4770
4784
|
if (i = r.findWithRel(t), i !== void 0)
|
|
@@ -4774,7 +4788,7 @@ class Me {
|
|
|
4774
4788
|
/** Finds all the links with the given relation in the manifest's links. */
|
|
4775
4789
|
linksWithRel(t) {
|
|
4776
4790
|
const e = [];
|
|
4777
|
-
return e.push(this.readingOrder.filterByRel(t)), this.resources && e.push(this.resources.filterByRel(t)), e.push(this.links.filterByRel(t)), e.reduce((i, r) => i.concat(r), []);
|
|
4791
|
+
return e.push(this.readingOrder.filterByRel(t)), this.resources && e.push(this.resources.filterByRel(t)), this.links && e.push(this.links.filterByRel(t)), e.reduce((i, r) => i.concat(r), []);
|
|
4778
4792
|
}
|
|
4779
4793
|
/**
|
|
4780
4794
|
* Creates a new [Locator] object from a [Link] to a resource of this manifest.
|
|
@@ -4799,19 +4813,19 @@ class Me {
|
|
|
4799
4813
|
/** Finds the first Link having the given `href` in the publication's links. */
|
|
4800
4814
|
linkWithHref(t) {
|
|
4801
4815
|
const e = (o) => {
|
|
4802
|
-
let
|
|
4816
|
+
let l;
|
|
4803
4817
|
for (const m of o)
|
|
4804
|
-
if (
|
|
4805
|
-
return
|
|
4818
|
+
if (l = m.findWithHref(t), l !== void 0)
|
|
4819
|
+
return l;
|
|
4806
4820
|
const p = new Array();
|
|
4807
4821
|
return o.forEach((m) => {
|
|
4808
4822
|
const u = [];
|
|
4809
4823
|
for (const g of m.items)
|
|
4810
4824
|
g.alternates && u.push(g.alternates), g.children && u.push(g.children);
|
|
4811
4825
|
p.push(...u);
|
|
4812
|
-
}), p.length > 0 && (
|
|
4826
|
+
}), p.length > 0 && (l = e(p)), l;
|
|
4813
4827
|
}, i = [];
|
|
4814
|
-
i.push(this.readingOrder), this.resources && i.push(this.resources), i.push(this.links);
|
|
4828
|
+
i.push(this.readingOrder), this.resources && i.push(this.resources), this.links && i.push(this.links);
|
|
4815
4829
|
const r = e(i);
|
|
4816
4830
|
if (r !== void 0)
|
|
4817
4831
|
return r;
|
|
@@ -4824,7 +4838,7 @@ class Me {
|
|
|
4824
4838
|
* e.g. https://provider.com/pub1293/manifest.json gives https://provider.com/pub1293/
|
|
4825
4839
|
*/
|
|
4826
4840
|
get baseURL() {
|
|
4827
|
-
const t = this.links
|
|
4841
|
+
const t = this.links?.items.find(
|
|
4828
4842
|
(e) => e.rels && e.rels.has("self")
|
|
4829
4843
|
);
|
|
4830
4844
|
if (t) {
|
|
@@ -4840,7 +4854,7 @@ class Me {
|
|
|
4840
4854
|
* Sets the URL where this [Publication]'s RWPM manifest is served.
|
|
4841
4855
|
*/
|
|
4842
4856
|
setSelfLink(t) {
|
|
4843
|
-
this.links.items = this.links.items.filter(
|
|
4857
|
+
this.links || (this.links = new x([])), this.links.items = this.links.items.filter(
|
|
4844
4858
|
(e) => e.rels === void 0 || !e.rels?.has("self")
|
|
4845
4859
|
), this.links.items.push(
|
|
4846
4860
|
new M({
|
|
@@ -4854,7 +4868,7 @@ class Me {
|
|
|
4854
4868
|
export {
|
|
4855
4869
|
R as AccessMode,
|
|
4856
4870
|
V as Accessibility,
|
|
4857
|
-
|
|
4871
|
+
nr as AccessibilityMetadataDisplayGuide,
|
|
4858
4872
|
It as AccessibilityProfile,
|
|
4859
4873
|
Ft as AccessibilitySummary,
|
|
4860
4874
|
tt as Acquisition,
|
|
@@ -4868,40 +4882,40 @@ export {
|
|
|
4868
4882
|
Ui as AvailabilityStatus,
|
|
4869
4883
|
Q as BelongsTo,
|
|
4870
4884
|
Hi as Body,
|
|
4871
|
-
|
|
4885
|
+
Pt as Certification,
|
|
4872
4886
|
Wt as Conformance,
|
|
4873
|
-
|
|
4887
|
+
or as Content,
|
|
4874
4888
|
ge as ContentElement,
|
|
4875
4889
|
dt as Contributor,
|
|
4876
4890
|
O as Contributors,
|
|
4877
4891
|
qt as Copies,
|
|
4878
4892
|
Ri as DefaultTextContentTokenizer,
|
|
4879
|
-
|
|
4893
|
+
Xt as DomRange,
|
|
4880
4894
|
gt as DomRangePoint,
|
|
4881
4895
|
ei as EmptyFetcher,
|
|
4882
4896
|
_t as Encryption,
|
|
4883
4897
|
Nt as Exemption,
|
|
4884
4898
|
v as Feature,
|
|
4885
4899
|
Fi as Footnote,
|
|
4886
|
-
|
|
4887
|
-
|
|
4900
|
+
Kt as GuidedNavigationDocument,
|
|
4901
|
+
X as GuidedNavigationObject,
|
|
4888
4902
|
mt as GuidedNavigationText,
|
|
4889
|
-
|
|
4890
|
-
|
|
4903
|
+
dr as HTMLResourceContentIterator,
|
|
4904
|
+
P as Hazard,
|
|
4891
4905
|
li as HazardType,
|
|
4892
4906
|
Gt as Hazards,
|
|
4893
4907
|
Wi as Heading,
|
|
4894
4908
|
Jt as Holds,
|
|
4895
|
-
|
|
4909
|
+
ir as HttpFetcher,
|
|
4896
4910
|
ii as HttpResource,
|
|
4897
4911
|
it as IllegalStateError,
|
|
4898
4912
|
Gi as ImageElement,
|
|
4899
|
-
|
|
4913
|
+
ki as IntlTextTokenizer,
|
|
4900
4914
|
jt as Iterator,
|
|
4901
|
-
|
|
4915
|
+
K as Layout,
|
|
4902
4916
|
Ht as Legal,
|
|
4903
4917
|
M as Link,
|
|
4904
|
-
|
|
4918
|
+
x as Links,
|
|
4905
4919
|
f as Localization,
|
|
4906
4920
|
B as LocalizedString,
|
|
4907
4921
|
D as Locator,
|
|
@@ -4913,13 +4927,13 @@ export {
|
|
|
4913
4927
|
Vt as MediaOverlay,
|
|
4914
4928
|
c as MediaType,
|
|
4915
4929
|
pt as Metadata,
|
|
4916
|
-
|
|
4930
|
+
Pi as NaiveTextTokenizer,
|
|
4917
4931
|
Ut as Navigation,
|
|
4918
4932
|
ai as NonvisualReading,
|
|
4919
|
-
|
|
4933
|
+
sr as NumberRange,
|
|
4920
4934
|
St as PDFContentElement,
|
|
4921
4935
|
Ot as Page,
|
|
4922
|
-
|
|
4936
|
+
ur as PageContentIteratorPDF,
|
|
4923
4937
|
oi as PrerecordedAudio,
|
|
4924
4938
|
Zt as Price,
|
|
4925
4939
|
xt as PrimaryAccessMode,
|
|
@@ -4927,22 +4941,22 @@ export {
|
|
|
4927
4941
|
U as Properties,
|
|
4928
4942
|
Y as Publication,
|
|
4929
4943
|
H as PublicationCollection,
|
|
4930
|
-
|
|
4944
|
+
hr as PublicationContentIterator,
|
|
4931
4945
|
F as ReadingProgression,
|
|
4932
|
-
|
|
4946
|
+
rr as Resource,
|
|
4933
4947
|
Mt as RichContent,
|
|
4934
4948
|
ci as RichContentType,
|
|
4935
4949
|
ft as Subject,
|
|
4936
4950
|
Yt as Subjects,
|
|
4937
4951
|
$t as TDM,
|
|
4938
4952
|
ui as TDMReservation,
|
|
4939
|
-
|
|
4953
|
+
cr as TextContentTokenizer,
|
|
4940
4954
|
Ct as TextElement,
|
|
4941
4955
|
_i as TextQuote,
|
|
4942
4956
|
be as TextSegment,
|
|
4943
4957
|
Ci as TextUnit,
|
|
4944
|
-
|
|
4945
|
-
|
|
4958
|
+
wt as TextualElement,
|
|
4959
|
+
C as Timeline,
|
|
4946
4960
|
ut as URITemplate,
|
|
4947
4961
|
Bi as VideoElement,
|
|
4948
4962
|
ni as VisualAdjustments,
|
|
@@ -4950,7 +4964,7 @@ export {
|
|
|
4950
4964
|
hi as arrayfromJSON,
|
|
4951
4965
|
_ as arrayfromJSONorString,
|
|
4952
4966
|
lt as datefromJSON,
|
|
4953
|
-
|
|
4967
|
+
ar as leadingPage,
|
|
4954
4968
|
Z as numberfromJSON,
|
|
4955
4969
|
L as positiveNumberfromJSON,
|
|
4956
4970
|
ht as setToArray,
|