@readium/navigator
Version:
Next generation SDK for publications in Web Apps
1,166 lines • 322 kB
JavaScript
let VA = class Ke {
/**
* Creates a [Encryption].
*/
constructor(t) {
this.algorithm = t.algorithm, this.compression = t.compression, this.originalLength = t.originalLength, this.profile = t.profile, this.scheme = t.scheme;
}
/**
* Parses a [Encryption] from its RWPM JSON representation.
*/
static deserialize(t) {
if (t && t.algorithm)
return new Ke({
algorithm: t.algorithm,
compression: t.compression,
originalLength: t.originalLength,
profile: t.profile,
scheme: t.scheme
});
}
/**
* Serializes a [Encryption] to its RWPM JSON representation.
*/
serialize() {
const t = { algorithm: this.algorithm };
return this.compression !== void 0 && (t.compression = this.compression), this.originalLength !== void 0 && (t.originalLength = this.originalLength), this.profile !== void 0 && (t.profile = this.profile), this.scheme !== void 0 && (t.scheme = this.scheme), t;
}
};
var k = /* @__PURE__ */ ((i) => (i.left = "left", i.right = "right", i.center = "center", i))(k || {});
let J = class Jt {
constructor(t) {
this.otherProperties = t;
}
get page() {
return this.otherProperties.page;
}
/**
* Creates a [Properties] from its RWPM JSON representation.
*/
static deserialize(t) {
if (t)
return new Jt(t);
}
/**
* Serializes a [Properties] to its RWPM JSON representation.
*/
serialize() {
return this.otherProperties;
}
/**
* Makes a copy of this [Properties] after merging in the given additional other [properties].
*/
add(t) {
const e = Object.assign({}, this.otherProperties);
for (const A in t)
e[A] = t[A];
return new Jt(e);
}
};
Object.defineProperty(J.prototype, "encryption", {
get: function() {
return VA.deserialize(this.otherProperties.encrypted);
}
});
function DA(i) {
return i && i instanceof Array ? i : void 0;
}
function qe(i) {
return i && typeof i == "string" ? [i] : DA(i);
}
function Me(i) {
return typeof i == "string" ? new Date(i) : void 0;
}
function pt(i) {
return isNaN(i) ? void 0 : i;
}
function S(i) {
return pt(i) !== void 0 && Math.sign(i) >= 0 ? i : void 0;
}
function PA(i) {
const t = new Array();
return i.forEach((e) => t.push(e)), t;
}
let Ft = class u {
/** Creates a MediaType object. */
constructor(t) {
let e, A, n = t.mediaType.replace(/\s/g, "").split(";");
const r = n[0].split("/");
if (r.length === 2) {
if (e = r[0].toLowerCase().trim(), A = r[1].toLowerCase().trim(), e.length === 0 || A.length === 0)
throw new Error("Invalid media type");
} else
throw new Error("Invalid media type");
const s = {};
for (let g = 1; g < n.length; g++) {
const m = n[g].split("=");
if (m.length === 2) {
const M = m[0].toLocaleLowerCase(), B = M === "charset" ? m[1].toUpperCase() : m[1];
s[M] = B;
}
}
const o = {}, a = Object.keys(s);
a.sort((g, m) => g.localeCompare(m)), a.forEach((g) => o[g] = s[g]);
let l = "";
for (const g in o) {
const m = o[g];
l += `;${g}=${m}`;
}
const h = `${e}/${A}${l}`, c = o.encoding;
this.string = h, this.type = e, this.subtype = A, this.parameters = o, this.encoding = c, this.name = t.name, this.fileExtension = t.fileExtension;
}
static parse(t) {
return new u(t);
}
/** Structured syntax suffix, e.g. `+zip` in `application/epub+zip`.
* Gives a hint on the underlying structure of this media type.
* See. https://tools.ietf.org/html/rfc6838#section-4.2.8
*/
get structuredSyntaxSuffix() {
const t = this.subtype.split("+");
return t.length > 1 ? `+${t[t.length - 1]}` : void 0;
}
/** Parameter values might or might not be case-sensitive, depending on the semantics of
* the parameter name.
* https://tools.ietf.org/html/rfc2616#section-3.7
*
* The character set names may be up to 40 characters taken from the printable characters
* of US-ASCII. However, no distinction is made between use of upper and lower case
* letters.
* https://www.iana.org/assignments/character-sets/character-sets.xhtml
*/
get charset() {
return this.parameters.charset;
}
/** Returns whether the given `other` media type is included in this media type.
* For example, `text/html` contains `text/html;charset=utf-8`.
* - `other` must match the parameters in the `parameters` property, but extra parameters
* are ignored.
* - Order of parameters is ignored.
* - Wildcards are supported, meaning that `image/*` contains `image/png`
*/
contains(t) {
const e = typeof t == "string" ? u.parse({ mediaType: t }) : t;
if (!((this.type === "*" || this.type === e.type) && (this.subtype === "*" || this.subtype === e.subtype)))
return !1;
const A = new Set(
Object.entries(this.parameters).map(([r, s]) => `${r}=${s}`)
), n = new Set(
Object.entries(e.parameters).map(([r, s]) => `${r}=${s}`)
);
for (const r of Array.from(A.values()))
if (!n.has(r))
return !1;
return !0;
}
/** Returns whether this media type and `other` are the same, ignoring parameters that
* are not in both media types.
* For example, `text/html` matches `text/html;charset=utf-8`, but `text/html;charset=ascii`
* doesn't. This is basically like `contains`, but working in both direction.
*/
matches(t) {
const e = typeof t == "string" ? u.parse({ mediaType: t }) : t;
return this.contains(e) || e.contains(this);
}
/**
* Returns whether this media type matches any of the [others] media types.
*/
matchesAny(...t) {
for (const e of t)
if (this.matches(e))
return !0;
return !1;
}
/** Checks the MediaType equals another one (comparing their string) */
equals(t) {
return this.string === t.string;
}
/** Returns whether this media type is structured as a ZIP archive. */
get isZIP() {
return this.matchesAny(
u.ZIP,
u.LCP_PROTECTED_AUDIOBOOK,
u.LCP_PROTECTED_PDF
) || this.structuredSyntaxSuffix === "+zip";
}
/** Returns whether this media type is structured as a JSON file. */
get isJSON() {
return this.matchesAny(u.JSON) || this.structuredSyntaxSuffix === "+json";
}
/** Returns whether this media type is of an OPDS feed. */
get isOPDS() {
return this.matchesAny(
u.OPDS1,
u.OPDS1_ENTRY,
u.OPDS2,
u.OPDS2_PUBLICATION,
u.OPDS_AUTHENTICATION
) || this.structuredSyntaxSuffix === "+json";
}
/** Returns whether this media type is of an HTML document. */
get isHTML() {
return this.matchesAny(u.HTML, u.XHTML);
}
/** Returns whether this media type is of a bitmap image, so excluding vectorial formats. */
get isBitmap() {
return this.matchesAny(
u.BMP,
u.GIF,
u.JPEG,
u.PNG,
u.TIFF,
u.WEBP
);
}
/** Returns whether this media type is of an audio clip. */
get isAudio() {
return this.type === "audio";
}
/** Returns whether this media type is of a video clip. */
get isVideo() {
return this.type === "video";
}
/** Returns whether this media type is of a Readium Web Publication Manifest. */
get isRWPM() {
return this.matchesAny(
u.READIUM_AUDIOBOOK_MANIFEST,
u.DIVINA_MANIFEST,
u.READIUM_WEBPUB_MANIFEST
);
}
/** Returns whether this media type is of a publication file. */
get isPublication() {
return this.matchesAny(
u.READIUM_AUDIOBOOK,
u.READIUM_AUDIOBOOK_MANIFEST,
u.CBZ,
u.DIVINA,
u.DIVINA_MANIFEST,
u.EPUB,
u.LCP_PROTECTED_AUDIOBOOK,
u.LCP_PROTECTED_PDF,
u.LPF,
u.PDF,
u.W3C_WPUB_MANIFEST,
u.READIUM_WEBPUB,
u.READIUM_WEBPUB_MANIFEST,
u.ZAB
);
}
// Known Media Types
static get AAC() {
return u.parse({ mediaType: "audio/aac", fileExtension: "aac" });
}
static get ACSM() {
return u.parse({
mediaType: "application/vnd.adobe.adept+xml",
name: "Adobe Content Server Message",
fileExtension: "acsm"
});
}
static get AIFF() {
return u.parse({ mediaType: "audio/aiff", fileExtension: "aiff" });
}
static get AVI() {
return u.parse({
mediaType: "video/x-msvideo",
fileExtension: "avi"
});
}
static get BINARY() {
return u.parse({ mediaType: "application/octet-stream" });
}
static get BMP() {
return u.parse({ mediaType: "image/bmp", fileExtension: "bmp" });
}
static get CBZ() {
return u.parse({
mediaType: "application/vnd.comicbook+zip",
name: "Comic Book Archive",
fileExtension: "cbz"
});
}
static get CSS() {
return u.parse({ mediaType: "text/css", fileExtension: "css" });
}
static get DIVINA() {
return u.parse({
mediaType: "application/divina+zip",
name: "Digital Visual Narratives",
fileExtension: "divina"
});
}
static get DIVINA_MANIFEST() {
return u.parse({
mediaType: "application/divina+json",
name: "Digital Visual Narratives",
fileExtension: "json"
});
}
static get EPUB() {
return u.parse({
mediaType: "application/epub+zip",
name: "EPUB",
fileExtension: "epub"
});
}
static get GIF() {
return u.parse({ mediaType: "image/gif", fileExtension: "gif" });
}
static get GZ() {
return u.parse({
mediaType: "application/gzip",
fileExtension: "gz"
});
}
static get HTML() {
return u.parse({ mediaType: "text/html", fileExtension: "html" });
}
static get JAVASCRIPT() {
return u.parse({
mediaType: "text/javascript",
fileExtension: "js"
});
}
static get JPEG() {
return u.parse({ mediaType: "image/jpeg", fileExtension: "jpeg" });
}
static get JSON() {
return u.parse({ mediaType: "application/json" });
}
static get LCP_LICENSE_DOCUMENT() {
return u.parse({
mediaType: "application/vnd.readium.lcp.license.v1.0+json",
name: "LCP License",
fileExtension: "lcpl"
});
}
static get LCP_PROTECTED_AUDIOBOOK() {
return u.parse({
mediaType: "application/audiobook+lcp",
name: "LCP Protected Audiobook",
fileExtension: "lcpa"
});
}
static get LCP_PROTECTED_PDF() {
return u.parse({
mediaType: "application/pdf+lcp",
name: "LCP Protected PDF",
fileExtension: "lcpdf"
});
}
static get LCP_STATUS_DOCUMENT() {
return u.parse({
mediaType: "application/vnd.readium.license.status.v1.0+json"
});
}
static get LPF() {
return u.parse({
mediaType: "application/lpf+zip",
fileExtension: "lpf"
});
}
static get MP3() {
return u.parse({ mediaType: "audio/mpeg", fileExtension: "mp3" });
}
static get MPEG() {
return u.parse({ mediaType: "video/mpeg", fileExtension: "mpeg" });
}
static get NCX() {
return u.parse({
mediaType: "application/x-dtbncx+xml",
fileExtension: "ncx"
});
}
static get OGG() {
return u.parse({ mediaType: "audio/ogg", fileExtension: "oga" });
}
static get OGV() {
return u.parse({ mediaType: "video/ogg", fileExtension: "ogv" });
}
static get OPDS1() {
return u.parse({
mediaType: "application/atom+xml;profile=opds-catalog"
});
}
static get OPDS1_ENTRY() {
return u.parse({
mediaType: "application/atom+xml;type=entry;profile=opds-catalog"
});
}
static get OPDS2() {
return u.parse({ mediaType: "application/opds+json" });
}
static get OPDS2_PUBLICATION() {
return u.parse({ mediaType: "application/opds-publication+json" });
}
static get OPDS_AUTHENTICATION() {
return u.parse({
mediaType: "application/opds-authentication+json"
});
}
static get OPUS() {
return u.parse({ mediaType: "audio/opus", fileExtension: "opus" });
}
static get OTF() {
return u.parse({ mediaType: "font/otf", fileExtension: "otf" });
}
static get PDF() {
return u.parse({
mediaType: "application/pdf",
name: "PDF",
fileExtension: "pdf"
});
}
static get PNG() {
return u.parse({ mediaType: "image/png", fileExtension: "png" });
}
static get READIUM_AUDIOBOOK() {
return u.parse({
mediaType: "application/audiobook+zip",
name: "Readium Audiobook",
fileExtension: "audiobook"
});
}
static get READIUM_AUDIOBOOK_MANIFEST() {
return u.parse({
mediaType: "application/audiobook+json",
name: "Readium Audiobook",
fileExtension: "json"
});
}
static get READIUM_CONTENT_DOCUMENT() {
return u.parse({
mediaType: "application/vnd.readium.content+json",
name: "Readium Content Document",
fileExtension: "json"
});
}
static get READIUM_GUIDED_NAVIGATION_DOCUMENT() {
return u.parse({
mediaType: "application/guided-navigation+json",
name: "Readium Guided Navigation Document",
fileExtension: "json"
});
}
static get READIUM_POSITION_LIST() {
return u.parse({
mediaType: "application/vnd.readium.position-list+json",
name: "Readium Position List",
fileExtension: "json"
});
}
static get READIUM_WEBPUB() {
return u.parse({
mediaType: "application/webpub+zip",
name: "Readium Web Publication",
fileExtension: "webpub"
});
}
static get READIUM_WEBPUB_MANIFEST() {
return u.parse({
mediaType: "application/webpub+json",
name: "Readium Web Publication",
fileExtension: "json"
});
}
static get SMIL() {
return u.parse({
mediaType: "application/smil+xml",
fileExtension: "smil"
});
}
static get SVG() {
return u.parse({
mediaType: "image/svg+xml",
fileExtension: "svg"
});
}
static get TEXT() {
return u.parse({ mediaType: "text/plain", fileExtension: "txt" });
}
static get TIFF() {
return u.parse({ mediaType: "image/tiff", fileExtension: "tiff" });
}
static get TTF() {
return u.parse({ mediaType: "font/ttf", fileExtension: "ttf" });
}
static get W3C_WPUB_MANIFEST() {
return u.parse({
mediaType: "application/x.readium.w3c.wpub+json",
name: "Web Publication",
fileExtension: "json"
});
}
static get WAV() {
return u.parse({ mediaType: "audio/wav", fileExtension: "wav" });
}
static get WEBM_AUDIO() {
return u.parse({ mediaType: "audio/webm", fileExtension: "webm" });
}
static get WEBM_VIDEO() {
return u.parse({ mediaType: "video/webm", fileExtension: "webm" });
}
static get WEBP() {
return u.parse({ mediaType: "image/webp", fileExtension: "webp" });
}
static get WOFF() {
return u.parse({ mediaType: "font/woff", fileExtension: "woff" });
}
static get WOFF2() {
return u.parse({ mediaType: "font/woff2", fileExtension: "woff2" });
}
static get XHTML() {
return u.parse({
mediaType: "application/xhtml+xml",
fileExtension: "xhtml"
});
}
static get XML() {
return u.parse({
mediaType: "application/xml",
fileExtension: "xml"
});
}
static get ZAB() {
return u.parse({
mediaType: "application/x.readium.zab+zip",
name: "Zipped Audio Book",
fileExtension: "zab"
});
}
static get ZIP() {
return u.parse({
mediaType: "application/zip",
fileExtension: "zip"
});
}
}, fe = class {
constructor(t) {
this.uri = t, this.parameters = this.getParameters(t);
}
/**
* List of URI template parameter keys, if the [Link] is templated.
*/
getParameters(t) {
const e = /\{\??([^}]+)\}/g, A = t.match(e);
return A ? new Set(
A.join(",").replace(e, "$1").split(",").map((n) => n.trim())
) : /* @__PURE__ */ new Set();
}
/** Expands the URI by replacing the template variables by the given parameters.
* Any extra parameter is appended as query parameters.
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
*/
expand(t) {
const e = (n) => n.split(",").map((r) => {
const s = t[r];
return s ? encodeURIComponent(s) : "";
}).join(","), A = (n) => "?" + n.split(",").map((r) => {
const s = r.split("=")[0], o = t[s];
return o ? `${s}=${encodeURIComponent(o)}` : "";
}).join("&");
return this.uri.replace(/\{(\??)([^}]+)\}/g, (...n) => n[1] ? A(n[2]) : e(n[2]));
}
};
class T {
/**
* Creates a [Locations].
*/
constructor(t) {
this.fragments = t.fragments ? t.fragments : new Array(), this.progression = t.progression, this.totalProgression = t.totalProgression, this.position = t.position, this.otherLocations = t.otherLocations;
}
/**
* Parses a [Locations] from its RWPM JSON representation.
*/
static deserialize(t) {
if (!t)
return;
const e = pt(t.progression), A = pt(t.totalProgression), n = pt(t.position), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set([
"fragment",
"fragments",
"progression",
"totalProgression",
"position"
]);
return Object.entries(t).forEach(([o, a]) => {
s.has(o) || r.set(o, a);
}), new T({
fragments: qe(t.fragments || t.fragment),
progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
totalProgression: A !== void 0 && A >= 0 && A <= 1 ? A : void 0,
position: n !== void 0 && n > 0 ? n : void 0,
otherLocations: r.size === 0 ? void 0 : r
});
}
/**
* Serializes a [Locations] to its RWPM JSON representation.
*/
serialize() {
const t = {};
return this.fragments && (t.fragments = this.fragments), this.progression !== void 0 && (t.progression = this.progression), this.totalProgression !== void 0 && (t.totalProgression = this.totalProgression), this.position !== void 0 && (t.position = this.position), this.otherLocations && this.otherLocations.forEach((e, A) => t[A] = e), t;
}
}
let vA = class _e {
/**
* Creates a [Text].
*/
constructor(t) {
this.after = t.after, this.before = t.before, this.highlight = t.highlight;
}
/**
* Parses a [Locations] from its RWPM JSON representation.
*/
static deserialize(t) {
if (t)
return new _e({
after: t.after,
before: t.before,
highlight: t.highlight
});
}
/**
* Serializes a [Locations] to its RWPM JSON representation.
*/
serialize() {
const t = {};
return this.after !== void 0 && (t.after = this.after), this.before !== void 0 && (t.before = this.before), this.highlight !== void 0 && (t.highlight = this.highlight), t;
}
}, Wt = class Lt {
/**
* Creates a [Locator].
*/
constructor(t) {
this.href = t.href, this.type = t.type, this.title = t.title, this.locations = t.locations ? t.locations : new T({}), this.text = t.text;
}
/**
* Parses a [Link] from its RWPM JSON representation.
*/
static deserialize(t) {
if (t && t.href && t.type)
return new Lt({
href: t.href,
type: t.type,
title: t.title,
locations: T.deserialize(t.locations),
text: vA.deserialize(t.text)
});
}
/**
* Serializes a [Link] to its RWPM JSON representation.
*/
serialize() {
const t = { href: this.href, type: this.type };
return this.title !== void 0 && (t.title = this.title), this.locations && (t.locations = this.locations.serialize()), this.text && (t.text = this.text.serialize()), t;
}
/**
* Shortcut to get a copy of the [Locator] with different [Locations] sub-properties.
*/
copyWithLocations(t) {
return new Lt({
href: this.href,
type: this.type,
title: this.title,
text: this.text,
locations: new T({ ...this.locations, ...t })
});
}
};
class X {
/**
* Creates a [Link].
*/
constructor(t) {
this.href = t.href, this.templated = t.templated, this.type = t.type, this.title = t.title, this.rels = t.rels, this.properties = t.properties, this.height = t.height, this.width = t.width, this.size = t.size, this.duration = t.duration, this.bitrate = t.bitrate, this.languages = t.languages, this.alternates = t.alternates, this.children = t.children;
}
/**
* Parses a [Link] from its RWPM JSON representation.
*/
static deserialize(t) {
if (!(!t || typeof t.href != "string"))
return new X({
href: t.href,
templated: t.templated,
type: t.type,
title: t.title,
rels: t.rel ? t.rel instanceof Array ? new Set(t.rel) : /* @__PURE__ */ new Set([t.rel]) : void 0,
properties: J.deserialize(t.properties),
height: S(t.height),
width: S(t.width),
size: S(t.size),
duration: S(t.duration),
bitrate: S(t.bitrate),
languages: qe(t.language),
alternates: Ut.deserialize(t.alternate),
children: Ut.deserialize(t.children)
});
}
/**
* Serializes a [Link] to its RWPM JSON representation.
*/
serialize() {
const t = { href: this.href };
return this.templated !== void 0 && (t.templated = this.templated), this.type !== void 0 && (t.type = this.type), this.title !== void 0 && (t.title = this.title), this.rels && (t.rel = PA(this.rels)), this.properties && (t.properties = this.properties.serialize()), this.height !== void 0 && (t.height = this.height), this.width !== void 0 && (t.width = this.width), this.size !== void 0 && (t.size = this.size), this.duration !== void 0 && (t.duration = this.duration), this.bitrate !== void 0 && (t.bitrate = this.bitrate), this.languages && (t.language = this.languages), this.alternates && (t.alternate = this.alternates.serialize()), this.children && (t.children = this.children.serialize()), t;
}
/** MediaType of the linked resource. */
get mediaType() {
return this.type !== void 0 ? Ft.parse({ mediaType: this.type }) : Ft.BINARY;
}
/** Computes an absolute URL to the link, relative to the given `baseURL`.
* If the link's `href` is already absolute, the `baseURL` is ignored.
*/
toURL(t) {
const e = this.href.replace(/^(\/)/, "");
if (e.length === 0)
return;
let A = t || "/";
return A.startsWith("/") && (A = "file://" + A), new URL(e, A).href.replace(/^(file:\/\/)/, "");
}
/** List of URI template parameter keys, if the `Link` is templated. */
get templateParameters() {
return this.templated ? new fe(this.href).parameters : /* @__PURE__ */ new Set();
}
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
*/
expandTemplate(t) {
return new X({
href: new fe(this.href).expand(t),
templated: !1
});
}
/**
* Makes a copy of this [Link] after merging in the given additional other [properties].
*/
addProperties(t) {
var e;
const A = X.deserialize(this.serialize());
return A.properties = A.properties ? (e = A.properties) == null ? void 0 : e.add(t) : new J(t), A;
}
/**
* Creates a [Locator] from a reading order [Link].
*/
get locator() {
let t = this.href.split("#");
return new Wt({
href: t.length > 0 && t[0] !== void 0 ? t[0] : this.href,
type: this.type ?? "",
title: this.title,
locations: new T({
fragments: t.length > 1 && t[1] !== void 0 ? [t[1]] : []
})
});
}
}
class Ut {
/**
* Creates a [Links].
*/
constructor(t) {
this.items = t;
}
/**
* Creates a list of [Link] from its RWPM JSON representation.
*/
static deserialize(t) {
if (t && t instanceof Array)
return new Ut(
t.map((e) => X.deserialize(e)).filter((e) => e !== void 0)
);
}
/**
* Serializes an array of [Link] to its RWPM JSON representation.
*/
serialize() {
return this.items.map((t) => t.serialize());
}
/** Finds the first link with the given relation. */
findWithRel(t) {
const e = (A) => A.rels && A.rels.has(t);
return this.items.find(e);
}
/** Finds all the links with the given relation. */
filterByRel(t) {
const e = (A) => A.rels && A.rels.has(t);
return this.items.filter(e);
}
/** Finds the first link matching the given HREF. */
findWithHref(t) {
const e = (A) => A.href === t;
return this.items.find(e);
}
/** Finds the index of the first link matching the given HREF. */
findIndexWithHref(t) {
const e = (A) => A.href === t;
return this.items.findIndex(e);
}
/** Finds the first link matching the given media type. */
findWithMediaType(t) {
const e = (A) => A.mediaType.matches(t);
return this.items.find(e);
}
/** Finds all the links matching the given media type. */
filterByMediaType(t) {
const e = (A) => A.mediaType.matches(t);
return this.items.filter(e);
}
/** Finds all the links matching any of the given media types. */
filterByMediaTypes(t) {
const e = (A) => {
for (const n of t)
if (A.mediaType.matches(n))
return !0;
return !1;
};
return this.items.filter(e);
}
/** Returns whether all the resources in the collection are audio clips. */
everyIsAudio() {
const t = (e) => e.mediaType.isAudio;
return this.items.length > 0 && this.items.every(t);
}
/** Returns whether all the resources in the collection are bitmaps. */
everyIsBitmap() {
const t = (e) => e.mediaType.isBitmap;
return this.items.length > 0 && this.items.every(t);
}
/** Returns whether all the resources in the collection are HTML documents. */
everyIsHTML() {
const t = (e) => e.mediaType.isHTML;
return this.items.length > 0 && this.items.every(t);
}
/** Returns whether all the resources in the collection are video clips. */
everyIsVideo() {
const t = (e) => e.mediaType.isVideo;
return this.items.length > 0 && this.items.every(t);
}
/** Returns whether all the resources in the collection are matching any of the given media types. */
everyMatchesMediaType(t) {
return Array.isArray(t) ? this.items.length > 0 && this.items.every((e) => {
for (const A of t)
return e.mediaType.matches(A);
return !1;
}) : this.items.length > 0 && this.items.every((e) => e.mediaType.matches(t));
}
filterLinksHasType() {
return this.items.filter((t) => t.type);
}
}
var p = /* @__PURE__ */ ((i) => (i.reflowable = "reflowable", i.fixed = "fixed", i.scrolled = "scrolled", i))(p || {}), $e = /* @__PURE__ */ ((i) => (i.EPUB = "https://readium.org/webpub-manifest/profiles/epub", i.AUDIOBOOK = "https://readium.org/webpub-manifest/profiles/audiobook", i.DIVINA = "https://readium.org/webpub-manifest/profiles/divina", i.PDF = "https://readium.org/webpub-manifest/profiles/pdf", i))($e || {}), R = /* @__PURE__ */ ((i) => (i.ltr = "ltr", i.rtl = "rtl", i))(R || {});
J.prototype.getContains = function() {
return new Set(this.otherProperties.contains || []);
};
let pe = class tA {
/**
* Creates a [DomRange].
*/
constructor(t) {
this.cssSelector = t.cssSelector, this.textNodeIndex = t.textNodeIndex, this.charOffset = t.charOffset;
}
/**
* Parses a [DomRangePoint] from its RWPM JSON representation.
*/
static deserialize(t) {
if (!(t && t.cssSelector))
return;
let e = S(t.textNodeIndex);
if (e === void 0)
return;
let A = S(t.charOffset);
return A === void 0 && (A = S(t.offset)), new tA({
cssSelector: t.cssSelector,
textNodeIndex: e,
charOffset: A
});
}
/**
* Serializes a [DomRangePoint] to its RWPM JSON representation.
*/
serialize() {
const t = {
cssSelector: this.cssSelector,
textNodeIndex: this.textNodeIndex
};
return this.charOffset !== void 0 && (t.charOffset = this.charOffset), t;
}
}, bA = class eA {
/**
* Creates a [DomRange].
*/
constructor(t) {
this.start = t.start, this.end = t.end;
}
/**
* Parses a [DomRange] from its RWPM JSON representation.
*/
static deserialize(t) {
if (!t)
return;
let e = pe.deserialize(t.start);
if (e)
return new eA({
start: e,
end: pe.deserialize(t.end)
});
}
/**
* Serializes a [DomRange] to its RWPM JSON representation.
*/
serialize() {
const t = { start: this.start.serialize() };
return this.end && (t.end = this.end.serialize()), t;
}
};
T.prototype.getCssSelector = function() {
var i;
return (i = this.otherLocations) == null ? void 0 : i.get("cssSelector");
};
T.prototype.getPartialCfi = function() {
var i;
return (i = this.otherLocations) == null ? void 0 : i.get("partialCfi");
};
T.prototype.getDomRange = function() {
var i;
return bA.deserialize((i = this.otherLocations) == null ? void 0 : i.get("domRange"));
};
T.prototype.fragmentParameters = function() {
return new Map(
this.fragments.map((i) => i.startsWith("#") ? i.slice(1) : i).join("&").split("&").filter((i) => !i.startsWith("#")).map((i) => i.split("=")).filter((i) => i.length === 2).map((i) => [
i[0].trim().toLowerCase(),
i[1].trim()
])
);
};
T.prototype.htmlId = function() {
if (!this.fragments.length)
return;
let i = this.fragments.find((t) => t.length && !t.includes("="));
if (!i) {
const t = this.fragmentParameters();
t.has("id") ? i = t.get("id") : t.has("name") && (i = t.get("name"));
}
return i != null && i.startsWith("#") ? i.slice(1) : i;
};
T.prototype.page = function() {
const i = parseInt(this.fragmentParameters().get("page"));
if (!isNaN(i) && i >= 0)
return i;
};
T.prototype.time = function() {
const i = parseInt(this.fragmentParameters().get("t"));
if (!isNaN(i))
return i;
};
T.prototype.space = function() {
const i = this.fragmentParameters();
if (!i.has("xywh"))
return;
const t = i.get("xywh").split(",").map((e) => parseInt(e));
if (t.length === 4 && !t.some(isNaN))
return t;
};
let GA = class AA {
/** Creates a [Price]. */
constructor(t) {
this.currency = t.currency, this.value = t.value;
}
/**
* Parses a [Price] from its RWPM JSON representation.
*/
static deserialize(t) {
if (!t)
return;
let e = t.currency;
if (!(e && typeof e == "string" && e.length > 0))
return;
let A = S(t.value);
if (A !== void 0)
return new AA({ currency: e, value: A });
}
/**
* Serializes a [Price] to its RWPM JSON representation.
*/
serialize() {
return { currency: this.currency, value: this.value };
}
}, HA = class Bt {
/** Creates a [Acquisition]. */
constructor(t) {
this.type = t.type, this.children = t.children;
}
/**
* Parses a [Acquisition] from its RWPM JSON representation.
*/
static deserialize(t) {
if (t && t.type)
return new Bt({
type: t.type,
children: Bt.deserializeArray(t.children)
});
}
static deserializeArray(t) {
if (t instanceof Array)
return t.map((e) => Bt.deserialize(e)).filter((e) => e !== void 0);
}
/**
* Serializes a [Acquisition] to its RWPM JSON representation.
*/
serialize() {
const t = { type: this.type };
return this.children && (t.children = this.children.map((e) => e.serialize())), t;
}
}, kA = class iA {
/** Creates a [Price]. */
constructor(t) {
this.total = t.total, this.position = t.position;
}
/**
* Parses a [Holds] from its RWPM JSON representation.
*/
static deserialize(t) {
if (t)
return new iA({
total: S(t.total),
position: S(t.position)
});
}
/**
* Serializes a [Holds] to its RWPM JSON representation.
*/
serialize() {
const t = {};
return this.total !== void 0 && (t.total = this.total), this.position !== void 0 && (t.position = this.position), t;
}
};
class Ae {
/** Creates a [Copies]. */
constructor(t) {
this.total = t.total, this.available = t.available;
}
/**
* Parses a [Copies] from its RWPM JSON representation.
*/
static deserialize(t) {
if (t)
return new Ae({
total: S(t.total),
available: S(t.available)
});
}
/**
* Serializes a [Copies] to its RWPM JSON representation.
*/
serialize() {
const t = {};
return this.total !== void 0 && (t.total = this.total), this.available !== void 0 && (t.available = this.available), t;
}
}
let JA = class nA {
/** Creates a [Availability]. */
constructor(t) {
this.state = t.state, this.since = t.since, this.until = t.until;
}
/**
* Parses a [Availability] from its RWPM JSON representation.
*/
static deserialize(t) {
if (t && t.state)
return new nA({
state: t.state,
since: Me(t.since),
until: Me(t.until)
});
}
/**
* Serializes a [Availability] to its RWPM JSON representation.
*/
serialize() {
const t = { state: this.state };
return this.since !== void 0 && (t.since = this.since.toISOString()), this.until !== void 0 && (t.until = this.until.toISOString()), t;
}
};
J.prototype.getNumberOfItems = function() {
return S(this.otherProperties.numberOfItems);
};
J.prototype.getPrice = function() {
return GA.deserialize(this.otherProperties.price);
};
J.prototype.getIndirectAcquisitions = function() {
const i = this.otherProperties.indirectAcquisition;
if (i && i instanceof Array)
return i.map((t) => HA.deserialize(t)).filter((t) => t !== void 0);
};
J.prototype.getHolds = function() {
return kA.deserialize(this.otherProperties.holds);
};
J.prototype.getCopies = function() {
return Ae.deserialize(this.otherProperties.copies);
};
J.prototype.getAvailability = function() {
return JA.deserialize(this.otherProperties.availability);
};
J.prototype.getAuthenticate = function() {
return X.deserialize(this.otherProperties.authenticate);
};
var K;
(function(i) {
i.NONE = "none", i.DESCENDANT = "descendant", i.CHILD = "child";
})(K || (K = {}));
var v;
(function(i) {
i.id = "id", i.class = "class", i.tag = "tag", i.attribute = "attribute", i.nthchild = "nthchild", i.nthoftype = "nthoftype";
})(v || (v = {}));
const WA = "CssSelectorGenerator";
function Be(i = "unknown problem", ...t) {
console.warn(`${WA}: ${i}`, ...t);
}
v.id, v.class, v.tag, v.attribute, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY;
function LA(i) {
return i instanceof RegExp;
}
function OA(i) {
return i.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
}
function XA(i) {
const t = i.map((e) => {
if (LA(e))
return (A) => e.test(A);
if (typeof e == "function")
return (A) => {
const n = e(A);
return typeof n != "boolean" ? (Be("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : n;
};
if (typeof e == "string") {
const A = new RegExp("^" + OA(e) + "$");
return (n) => A.test(n);
}
return Be("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
});
return (e) => t.some((A) => A(e));
}
const ZA = "", KA = " > ", qA = " ";
K.NONE + "", K.NONE, K.DESCENDANT + "", K.DESCENDANT, K.CHILD + "", K.CHILD;
v.nthoftype, v.tag, v.id, v.class, v.attribute, v.nthchild;
XA([
"class",
"id",
// Angular attributes
"ng-*"
]);
class _A {
}
class $A extends _A {
/**
* Moves to the left content portion (eg. page) relative to the reading progression direction.
*/
goLeft(t = !1, e) {
this.readingProgression === R.ltr ? this.goBackward(t, e) : this.readingProgression === R.rtl && this.goForward(t, e);
}
/**
* Moves to the right content portion (eg. page) relative to the reading progression direction.
*/
goRight(t = !1, e) {
this.readingProgression === R.ltr ? this.goForward(t, e) : this.readingProgression === R.rtl && this.goBackward(t, e);
}
}
const ti = `@namespace url(http://www.w3.org/1999/xhtml);@namespace epub url(http://www.idpf.org/2007/ops);@namespace m url(http://www.w3.org/1998/Math/MathML);@namespace svg url(http://www.w3.org/2000/svg);:root{--RS__viewportWidth:100%;--RS__pageGutter:0;--RS__defaultLineLength:40rem;--RS__colGap:0;--RS__colCount:1;--RS__colWidth:100vw}@page{margin:0!important}:root{position:relative;-webkit-column-width:var(--RS__colWidth);-moz-column-width:var(--RS__colWidth);column-width:var(--RS__colWidth);-webkit-column-count:var(--RS__colCount);-moz-column-count:var(--RS__colCount);column-count:var(--RS__colCount);-webkit-column-gap:var(--RS__colGap);-moz-column-gap:var(--RS__colGap);column-gap:var(--RS__colGap);-moz-column-fill:auto;column-fill:auto;width:var(--RS__viewportWidth);height:100vh;max-width:var(--RS__viewportWidth);max-height:100vh;min-width:var(--RS__viewportWidth);min-height:100vh;padding:0!important;margin:0!important;font-size:1rem!important;box-sizing:border-box;-webkit-touch-callout:none}body{width:100%;max-width:var(--RS__defaultLineLength)!important;padding:0 var(--RS__pageGutter)!important;margin:0 auto!important;box-sizing:border-box}:root:not([style*=readium-noOverflow-on]) body{overflow:hidden}@supports (overflow: clip){:root:not([style*=readium-noOverflow-on]){overflow:clip}:root:not([style*=readium-noOverflow-on]) body{overflow:clip;overflow-clip-margin:content-box}}:root[style*=readium-scroll-on]{-webkit-columns:auto auto!important;-moz-columns:auto auto!important;columns:auto auto!important;width:auto!important;height:auto!important;max-width:none!important;max-height:none!important;min-width:0!important;min-height:0!important}:root[style*=readium-scroll-on] body{max-width:var(--RS__defaultLineLength)!important;box-sizing:border-box!important}:root[style*=readium-scroll-on]:not([style*=readium-noOverflow-on]) body{overflow:auto}@supports (overflow: clip){:root[style*=readium-scroll-on]:not([style*=readium-noOverflow-on]){overflow:auto}:root[style*=readium-scroll-on]:not([style*=readium-noOverflow-on]) body{overflow:clip}}:root[style*=readium-scroll-on][style*=--RS__scrollPaddingTop] body{padding-top:var(--RS__scrollPaddingTop)!important}:root[style*=readium-scroll-on][style*=--RS__scrollPaddingBottom] body{padding-bottom:var(--RS__scrollPaddingBottom)!important}:root[style*=readium-scroll-on][style*=--RS__scrollPaddingLeft] body{padding-left:var(--RS__scrollPaddingLeft)!important}:root[style*=readium-scroll-on][style*=--RS__scrollPaddingRight] body{padding-right:var(--RS__scrollPaddingRight)!important}:root[style*=readium-night-on]{--RS__selectionTextColor:inherit;--RS__selectionBackgroundColor:#b4d8fe;--RS__visitedColor:#0099E5;--RS__linkColor:#63caff;--RS__textColor:#FEFEFE;--RS__backgroundColor:#000000}:root[style*=readium-night-on] *:not(a){color:inherit!important;background-color:transparent!important;border-color:currentcolor!important}:root[style*=readium-night-on] svg text{fill:currentcolor!important;stroke:none!important}:root[style*=readium-night-on] a:link,:root[style*=readium-night-on] a:link *{color:var(--RS__linkColor)!important}:root[style*=readium-night-on] a:visited,:root[style*=readium-night-on] a:visited *{color:var(--RS__visitedColor)!important}:root[style*=readium-night-on] img[class*=gaiji],:root[style*=readium-night-on] *[epub\\:type~=titlepage] img:only-child,:root[style*=readium-night-on] *[epub|type~=titlepage] img:only-child{-webkit-filter:invert(100%);filter:invert(100%)}:root[style*=readium-sepia-on]{--RS__selectionTextColor:inherit;--RS__selectionBackgroundColor:#b4d8fe;--RS__visitedColor:#551A8B;--RS__linkColor:#0000EE;--RS__textColor:#121212;--RS__backgroundColor:#faf4e8}:root[style*=readium-sepia-on] *:not(a){color:inherit!important;background-color:transparent!important}:root[style*=readium-sepia-on] a:link,:root[style*=readium-sepia-on] a:link *{color:var(--RS__linkColor)}:root[style*=readium-sepia-on] a:visited,:root[style*=readium-sepia-on] a:visited *{color:var(--RS__visitedColor)}@media screen and (-ms-high-contrast: active){:root{color:windowText!important;background-color:window!important}:root :not(#\\#):not(#\\#):not(#\\#),:root :not(#\\#):not(#\\#):not(#\\#) :not(#\\#):not(#\\#):not(#\\#) :root :not(#\\#):not(#\\#):not(#\\#) :not(#\\#):not(#\\#):not(#\\#) :not(#\\#):not(#\\#):not(#\\#){color:inherit!important;background-color:inherit!important}.readiumCSS-mo-active-default{color:highlightText!important;background-color:highlight!important}}@media screen and (-ms-high-contrast: white-on-black){:root[style*=readium-night-on] img[class*=gaiji],:root[style*=readium-night-on] *[epub\\:type~=titlepage] img:only-child,:root[style*=readium-night-on] *[epub|type~=titlepage] img:only-child{-webkit-filter:none!important;filter:none!important}:root[style*=readium-night-on][style*=readium-invert-on] img{-webkit-filter:none!important;filter:none!important}:root[style*=readium-night-on][style*=readium-darken-on][style*=readium-invert-on] img{-webkit-filter:brightness(80%);filter:brightness(80%)}}@media screen and (inverted-colors){:root[style*=readium-night-on] img[class*=gaiji],:root[style*=readium-night-on] *[epub\\:type~=titlepage] img:only-child,:root[style*=readium-night-on] *[epub|type~=titlepage] img:only-child{-webkit-filter:none!important;filter:none!important}:root[style*=readium-night-on][style*=readium-invert-on] img{-webkit-filter:none!important;filter:none!important}:root[style*=readium-night-on][style*=readium-darken-on][style*=readium-invert-on] img{-webkit-filter:brightness(80%);filter:brightness(80%)}}:root[style*=--USER__backgroundColor]{background-color:var(--USER__backgroundColor)!important}:root[style*=--USER__backgroundColor] *{background-color:transparent!important}:root[style*=--USER__textColor]{color:var(--USER__textColor)!important}:root[style*=--USER__textColor] *:not(a){color:inherit!important;background-color:transparent!important;border-color:currentcolor!important}:root[style*=--USER__textColor] svg text{fill:currentcolor!important;stroke:none!important}:root[style*=--USER__linkColor] a:link,:root[style*=--USER__linkColor] a:link *{color:var(--USER__linkColor)!important}:root[style*=--USER__visitedColor] a:visited,:root[style*=--USER__visitedColor] a:visited *{color:var(--USER__visitedColor)!important}:root[style*=--USER__selectionBackgroundColor][style*=--USER__selectionTextColor] ::-moz-selection{color:var(--USER__selectionTextColor)!important;background-color:var(--USER__selectionBackgroundColor)!important}:root[style*=--USER__selectionBackgroundColor][style*=--USER__selectionTextColor] ::selection{color:var(--USER__selectionTextColor)!important;background-color:var(--USER__selectionBackgroundColor)!important}:root[style*=--USER__colCount]{-webkit-column-count:var(--USER__colCount);-moz-column-count:var(--USER__colCount);column-count:var(--USER__colCount);--RS__colWidth:auto}:root[style*="--USER__colCount: 0"],:root[style*="--USER__colCount:0"]{-webkit-column-count:1;-moz-column-count:1;column-count:1}:root[style*="--USER__colCount: 0"],:root[style*="--USER__colCount:0"],:root[style*="--USER__colCount: 1"],:root[style*="--USER__colCount:1"]{--RS__colWidth:100vw}:root[style*=--USER__lineLength] body{max-width:var(--USER__lineLength)!important}:root[style*=--USER__textAlign]{text-align:var(--USER__textAlign)}:root[style*=--USER__textAlign] body,:root[style*=--USER__textAlign] p:not(blockquote p):not(figcaption p):not(hgroup p),:root[style*=--USER__textAlign] li,:root[style*=--USER__textAlign] dd{text-align:var(--USER__textAlign)!important;-moz-text-align-last:auto!important;-epub-text-align-last:auto!important;text-align-last:auto!important}:root[style*=--USER__bodyHyphens]{-webkit-hyphens:var(--USER__bodyHyphens)!important;-moz-hyphens:var(--USER__bodyHyphens)!important;-ms-hyphens:var(--USER__bodyHyphens)!important;-epub-hyphens:var(--USER__bodyHyphens)!important;hyphens:var(--USER__bodyHyphens)!important}:root[style*=--USER__bodyHyphens] body,:root[style*=--USER__bodyHyphens] p,:root[style*=--USER__bodyHyphens] li,:root[style*=--USER__bodyHyphens] div,:root[style*=--USER__bodyHyphens] dd{-webkit-hyphens:inherit;-moz-hyphens:inherit;-ms-hyphens:inherit;-epub-hyphens:inherit;hyphens:inherit}:root[style*=--USER__fontFamily]{font-family:var(--USER__fontFamily)!important}:root[style*=--USER__fontFamily] *{font-family:revert!important}:root[style*=AccessibleDfA]{font-family:AccessibleDfA,Verdana,Tahoma,Trebuchet MS,sans-serif!important}:root[style*="IA Writer Duospace"]{font-family:IA Writer Duospace,Menlo,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier,monospace!important}:root[style*=AccessibleDfA],:root[style*="IA Writer Duospace"],:root[style*=readium-a11y-on]{font-style:normal!important;font-weight:400!important}:root[style*=AccessibleDfA] *:not(code):not(var):not(kbd):not(samp),:root[style*="IA Writer Duospace"] *:not(code):not(var):not(kbd):not(samp),:root[style*=readium-a11y-on] *:not(code):not(var):not(kbd):not(samp){font-family:inherit!important;font-style:inherit!important;font-weight:inherit!important}:root[style*=AccessibleDfA] *,:root[style*="IA Writer Duospace"] *,:root[style*=readium-a11y-on] *{text-decoration:none!important;font-variant-caps:normal!important;font-variant-numeric:normal!important;font-variant-position:normal!important}:root[style*=AccessibleDfA] sup,:root[style*="IA Writer Duospace"] sup,:root[style*=readium-a11y-on] sup,:root[style*=AccessibleDfA] sub,:root[style*="IA Writer Duospace"] sub,:root[style*=readium-a11y-on] sub{font-size:1rem!important;vertical-align:baseline!important}:root:not([style*=readium-deprecatedFontSize-on])[style*=--USER__fontSize] body{zoom:var(--USER__fontSize)!important}@supports not (zoom: 1){:root[style*=--USER__fontSize]{font-size:var(--USER__fontSize)!important}}:root[style*=readium-deprecatedFontSize-on][style*=--USER__fontSize]{font-size:var(--USER__fontSize)!important}:root[style*=--USER__lineHeight]{line-height:var(--USER__lineHeight)!important}:root[style*=--USER__lineHeight] body,:root[style*=--USER__lineHeight] p,:root[style*=--USER__lineHeight] li,:root[style*=--USER__lineHeight] div{line-height:inherit}:root[style*=--USER__paraSpacing] p{margin-top:var(--USER__paraSpacing)!important;margin-bottom:var(--USER__paraSpacing)!important}:root[style*=--USER__paraIndent] p{text-indent:var(--USER__paraIndent)!important}:root[style*=--USER__paraIndent] p *,:root[style*=--USER__paraIndent] p:first-letter{text-indent:0!important}:root[style*=--USER__wordSpacing] h1,:root[style*=--USER__wordSpacing] h2,:root[style*=--USER__wordSpacing] h3,:root[style*=--USER__wordSpacing] h4,:root[style*=--USER__wordSpacing] h5,:root[style*=--USER__wordSpacing] h6,:root[style*=--USER__wordSpacing] p,:root[style*=--USER__wordSpacing] li,:root[style*=--USER__wordSpacing] div,:root[style*=--USER__wordSpacing] dt,:root[style*=--USER__wordSpacing] dd{word-spacing:var(--USER__wordSpacing)}:root[style*=--USER__letterSpacing] h1,:root[style*=--USER__letterSpacing] h2,:root[style*=--USER__letterSpacing] h3,:root[style*=--USER__letterSpacing] h4,:root[style*=--USER__letterSpacing] h5,:root[style*=--USER__letterSpacing] h6,:root[style*=--USER__letterSpacing] p,:root[style*=--USER__letterSpacing] li,:root[style*=--USER__letterSpacing] div,:root[style*=--USER__letterSpacing] dt,:root[style*=--USER__letterSpacing] dd{letter-spacing:var(--USER__letterSpacing);font-variant:none}:root[style*=--USER__fontWeight] body{font-weight:var(--USER__fontWeight)!important}:root[style*=--USER__fontWeight] b,:root[style*=--USER__fontWeight] strong{font-weight:bolder}:root[style*=--USER__fontWidth] body{font-stretch:var(--USER__fontWidth)!important}:root[style*=--USER__fontOpticalSizing] body{font-optical-sizing:var(--USER__fontOpticalSizing)!important}:root[style*=readium-blend-on] svg,:root[style*=readium-blend-on] img{background-color:transparent!important;mix-blend-mode:multiply!important}:root[style*=--USER__darkenImages] img{-webkit-filter:brightness(var(--USER__darkenImages))!important;filter:brightness(var(--USER__darkenImages))!important}:root[style*=readium-darken-on] img{-webkit-filter:brightness(80%)!important;filter:brightness(80%)!important}:root[style*=--USER__invertImages] img{-webkit-filter:invert(var(--USER__invertImages))!important;filter:invert(var(--USER__invertImages))!important}:root[style*=readium-invert-on] img{-webkit-filter:invert(100%)!important;filter:invert(100%)!important}:root[style*=--USER__darkenImages][style*=--USER__invertImages] img{-webkit-filter:brightness(var(--USER__darkenImages)) invert(var(--USER__invertImages))!important;filter:brightness(var(--USER__darkenImages)) invert(var(--USER__invertImages))!important}:root[style*=readium-darken-on][style*=--USER__invertImages] img{-webkit-filter:brightness(80%) invert(var(--USER__invertImages))!important;filter:brightness(80%) invert(var(--USER__invertImages))!important}:root[style*=--USER__darkenImages][style*=readium-invert-on] img{-webkit-filter:brightness(var(--USER__darkenImages)) invert(100%)!important;filter:brightness(var(--USER__darkenImages)) invert(100%)!important}:root[style*=readium-darken-on][style*=readium-invert-on] img{-webkit-filter:brightness(80%) invert(100%)!important;filter:brightness(80%) invert(100%)!important}:root[style*=--USER__invertGaiji] img[class*=gaiji]{-webkit-filter:invert(var(--USER__invertGaiji))!important;filter:invert(var(--USER__invertGaiji))!important}:root[style*=readium-invertGaiji-on] img[class*=gaiji]{-webkit-filter:invert(100%)!important;filter:invert(100%)!important}:root[style*=readium-normalize-on]{--USER__typeScale:1.2}:root[style*=readium-normalize-on] p,:root[style*=readium-normalize-on] li,:root[style*=readium-normalize-on] div,:root[style*=readium-normalize-on] pre,:root[style*=readium-normalize-on] dd{font-size:1rem!important}:root[style*=readium-normalize-on] h1{font-size:1.75rem!important;font-size:calc(((1rem * var(--USER__typeScale)) * var(--USER__typeScale)) * var(--USER__typeScale))!important}:root[style*=readium-normalize-on] h2{font-size:1.5rem!important;font-size:calc((1rem * var(--USER__typeScale)) * var(--USER__typeScal