@readium/shared 2.1.2 → 2.1.3

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.
@@ -1,3 +1,3 @@
1
- (function(o,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(o=typeof globalThis<"u"?globalThis:o||self,Z(o.shared={}))})(this,(function(o){"use strict";class Z{close(){}links(){return[]}get(t){throw Error("This is an empty fetcher")}}class ni{constructor(t,e){this.client=t||window.fetch.bind(window),this.baseUrl=e}links(){return[]}get(t){const e=t.toURL(this.baseUrl);if(e===void 0)throw Error(`Invalid HREF: ${t.href}`);return new ue(this.client,t,e)}close(){}}class ue{constructor(t,e,i){this.client=t||window.fetch.bind(window),this._link=e,this.url=i}async headResponse(){if(this._headResponse)return this._headResponse;const t=await this.client(this.url,{method:"HEAD"});if(!t.ok)throw new Error(`http HEAD request for ${this.url} failed with HTTP status code ${t.status}`);return this._headResponse=t,t}close(){}async link(){return this._link}async read(t){if(t)throw new Error("http read range not implemented!");const e=await this.client(this.url);if(!e.ok)throw new Error(`http GET request for ${this.url} failed with HTTP status code ${e.status}`);return new Uint8Array(await e.arrayBuffer())}async length(){const e=(await this.headResponse()).headers.get("content-length");if(e===null||e==="")throw new Error("length for resource unavailable");return parseInt(e)}async readAsJSON(){const t=await this.client(this.url);if(!t.ok)throw new Error(`http GET request for ${this.url} failed with HTTP status code ${t.status}`);return await t.json()}async readAsString(){const t=await this.client(this.url);if(!t.ok)throw new Error(`http GET request for ${this.url} failed with HTTP status code ${t.status}`);return await t.text()}async readAsXML(){const t=await this.client(this.url);if(!t.ok)throw new Error(`http GET request for ${this.url} failed with HTTP status code ${t.status}`);return new DOMParser().parseFromString(await t.text(),"application/xml")}}class ri{constructor(t,e){this.start=t,this.endInclusive=e}}class ai{readAsString(){return this.read().then(t=>t===void 0?t:new TextDecoder().decode(t))}readAsJSON(){return this.readAsString().then(t=>t===void 0?t:JSON.parse(t))}readAsXML(){return this.readAsString().then(t=>t===void 0?t:new DOMParser().parseFromString(t,"text/xml"))}}class F{constructor(t={}){this.conformsTo=t.conformsTo??[],this.certification=t.certification??null,this.summary=t.summary??null,this.accessMode=t.accessMode??[],this.accessModeSufficient=t.accessModeSufficient??[],this.feature=t.feature??[],this.hazard=t.hazard??[],this.exemption=t.exemption??[]}static deserialize(t){if(!t||typeof t!="object")return;const e=t;return new F({conformsTo:e.conformsTo?e.conformsTo.map(i=>vt.deserialize(i)).filter(i=>i!==void 0):void 0,certification:e.certification?At.deserialize(e.certification):void 0,summary:e.summary,accessMode:e.accessMode?e.accessMode.map(i=>z.deserialize(i)).filter(i=>i!==void 0):void 0,accessModeSufficient:e.accessModeSufficient?e.accessModeSufficient.map(i=>yt.deserialize(i)).filter(i=>i!==void 0):void 0,feature:e.feature?e.feature.map(i=>A.deserialize(i)).filter(i=>i!==void 0):void 0,hazard:e.hazard?e.hazard.map(i=>P.deserialize(i)).filter(i=>i!==void 0):void 0,exemption:e.exemption?e.exemption.map(i=>wt.deserialize(i)).filter(i=>i!==void 0):void 0})}serialize(){const t={};return this.conformsTo?.length>0&&(t.conformsTo=this.conformsTo.map(e=>e.serialize())),this.certification!==void 0&&this.certification!==null&&(t.certification=this.certification.serialize()),this.summary!==void 0&&this.summary!==null&&(t.summary=this.summary),this.accessMode?.length>0&&(t.accessMode=this.accessMode.map(e=>e.serialize())),this.accessModeSufficient?.length>0&&(t.accessModeSufficient=this.accessModeSufficient.map(e=>e.serialize())),this.feature?.length>0&&(t.feature=this.feature.map(e=>e.serialize())),this.hazard?.length>0&&(t.hazard=this.hazard.map(e=>e.serialize())),this.exemption?.length>0&&(t.exemption=this.exemption.map(e=>e.serialize())),t}}const v=class v{constructor(t){this.uri=t}static deserialize(t){if(!(!t||typeof t!="string"))return new v(t)}serialize(){return this.uri}get isWCAGLevelA(){return this===v.EPUB_A11Y_10_WCAG_20_A||this===v.EPUB_A11Y_11_WCAG_20_A||this===v.EPUB_A11Y_11_WCAG_21_A||this===v.EPUB_A11Y_11_WCAG_22_A}get isWCAGLevelAA(){return this===v.EPUB_A11Y_10_WCAG_20_AA||this===v.EPUB_A11Y_11_WCAG_20_AA||this===v.EPUB_A11Y_11_WCAG_21_AA||this===v.EPUB_A11Y_11_WCAG_22_AA}get isWCAGLevelAAA(){return this===v.EPUB_A11Y_10_WCAG_20_AAA||this===v.EPUB_A11Y_11_WCAG_20_AAA||this===v.EPUB_A11Y_11_WCAG_21_AAA||this===v.EPUB_A11Y_11_WCAG_22_AAA}};v.EPUB_A11Y_10_WCAG_20_A=new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"),v.EPUB_A11Y_10_WCAG_20_AA=new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"),v.EPUB_A11Y_10_WCAG_20_AAA=new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"),v.EPUB_A11Y_11_WCAG_20_A=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"),v.EPUB_A11Y_11_WCAG_20_AA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"),v.EPUB_A11Y_11_WCAG_20_AAA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"),v.EPUB_A11Y_11_WCAG_21_A=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"),v.EPUB_A11Y_11_WCAG_21_AA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"),v.EPUB_A11Y_11_WCAG_21_AAA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"),v.EPUB_A11Y_11_WCAG_22_A=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"),v.EPUB_A11Y_11_WCAG_22_AA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"),v.EPUB_A11Y_11_WCAG_22_AAA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");let vt=v;class At{constructor(t=null,e=null,i=null){this.certifiedBy=t,this.credential=e,this.report=i}static deserialize(t){if(!(!t||typeof t!="object"))return new At(t.certifiedBy,t.credential,t.report)}serialize(){const t={};return this.certifiedBy&&(t.certifiedBy=this.certifiedBy),this.credential&&(t.credential=this.credential),this.report&&(t.report=this.report),t}}const w=class w{constructor(t){this.value=t}static deserialize(t){if(!(!t||typeof t!="string"))return new w(t)}serialize(){return this.value}};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");let z=w;const R=class R{constructor(t){if(typeof t=="string"){if(!R.VALID_MODES.has(t.toLowerCase()))return;this.value=t.toLowerCase()}else{const e=t.filter(i=>R.VALID_MODES.has(i.toLowerCase()));if(e.length===0)return;this.value=Array.from(new Set(e))}}static deserialize(t){if(!t)return;if(typeof t=="string")return new R(t);if(!Array.isArray(t))return;const e=t.filter(i=>i?R.VALID_MODES.has(i.toLowerCase()):!1);if(e.length!==0)return new R(e)}serialize(){return this.value}};R.VALID_MODES=new Set(["auditory","tactile","textual","visual"]),R.AUDITORY=new R("auditory"),R.TACTILE=new R("tactile"),R.TEXTUAL=new R("textual"),R.VISUAL=new R("visual");let yt=R;const u=class u{constructor(t){this.value=t}static deserialize(t){if(!(!t||typeof t!="string"))return new u(t)}serialize(){return this.value}};u.NONE=new u("none"),u.ANNOTATIONS=new u("annotations"),u.ARIA=new u("ARIA"),u.INDEX=new u("index"),u.PAGE_BREAK_MARKERS=new u("pageBreakMarkers"),u.PAGE_NAVIGATION=new u("pageNavigation"),u.PRINT_PAGE_NUMBERS=new u("printPageNumbers"),u.READING_ORDER=new u("readingOrder"),u.STRUCTURAL_NAVIGATION=new u("structuralNavigation"),u.TABLE_OF_CONTENTS=new u("tableOfContents"),u.TAGGED_PDF=new u("taggedPDF"),u.ALTERNATIVE_TEXT=new u("alternativeText"),u.AUDIO_DESCRIPTION=new u("audioDescription"),u.CAPTIONS=new u("captions"),u.CLOSED_CAPTIONS=new u("closedCaptions"),u.DESCRIBED_MATH=new u("describedMath"),u.LONG_DESCRIPTION=new u("longDescription"),u.OPEN_CAPTIONS=new u("openCaptions"),u.SIGN_LANGUAGE=new u("signLanguage"),u.TRANSCRIPT=new u("transcript"),u.DISPLAY_TRANSFORMABILITY=new u("displayTransformability"),u.SYNCHRONIZED_AUDIO_TEXT=new u("synchronizedAudioText"),u.TIMING_CONTROL=new u("timingControl"),u.UNLOCKED=new u("unlocked"),u.CHEM_ML=new u("ChemML"),u.LATEX=new u("latex"),u.LATEX_CHEMISTRY=new u("latex-chemistry"),u.MATH_ML=new u("MathML"),u.MATH_ML_CHEMISTRY=new u("MathML-chemistry"),u.TTS_MARKUP=new u("ttsMarkup"),u.HIGH_CONTRAST_AUDIO=new u("highContrastAudio"),u.HIGH_CONTRAST_DISPLAY=new u("highContrastDisplay"),u.LARGE_PRINT=new u("largePrint"),u.BRAILLE=new u("braille"),u.TACTILE_GRAPHIC=new u("tactileGraphic"),u.TACTILE_OBJECT=new u("tactileObject"),u.FULL_RUBY_ANNOTATIONS=new u("fullRubyAnnotations"),u.HORIZONTAL_WRITING=new u("horizontalWriting"),u.RUBY_ANNOTATIONS=new u("rubyAnnotations"),u.VERTICAL_WRITING=new u("verticalWriting"),u.WITH_ADDITIONAL_WORD_SEGMENTATION=new u("withAdditionalWordSegmentation"),u.WITHOUT_ADDITIONAL_WORD_SEGMENTATION=new u("withoutAdditionalWordSegmentation");let A=u;const S=class S{constructor(t){this.value=t}static deserialize(t){if(!(!t||typeof t!="string"))return new S(t)}serialize(){return this.value}};S.FLASHING=new S("flashing"),S.NO_FLASHING_HAZARD=new S("noFlashingHazard"),S.UNKNOWN_FLASHING_HAZARD=new S("unknownFlashingHazard"),S.MOTION_SIMULATION=new S("motionSimulation"),S.NO_MOTION_SIMULATION_HAZARD=new S("noMotionSimulationHazard"),S.UNKNOWN_MOTION_SIMULATION_HAZARD=new S("unknownMotionSimulationHazard"),S.SOUND=new S("sound"),S.NO_SOUND_HAZARD=new S("noSoundHazard"),S.UNKNOWN_SOUND_HAZARD=new S("unknownSoundHazard"),S.UNKNOWN=new S("unknown"),S.NONE=new S("none");let P=S;const E=class E{constructor(t){this.value=t}static deserialize(t){if(!(!t||typeof t!="string"))return new E(t)}serialize(){return this.value}};E.NONE=new E("none"),E.DOCUMENTED=new E("documented"),E.LEGAL=new E("legal"),E.TEMPORARY=new E("temporary"),E.TECHNICAL=new E("technical"),E.EAA_DISPROPORTIONATE_BURDEN=new E("eaa-disproportionate-burden"),E.EAA_FUNDAMENTAL_ALTERATION=new E("eaa-fundamental-alteration"),E.EAA_MICROENTERPRISE=new E("eaa-microenterprise"),E.EAA_TECHNICAL_IMPOSSIBILITY=new E("eaa-technical-impossibility"),E.EAA_TEMPORARY=new E("eaa-temporary");let wt=E;const he={"ways-of-reading":{title:"Ways of reading","nonvisual-reading":{"alt-text":{compact:"Has alternative text",descriptive:"Has alternative text descriptions for images"},"no-metadata":"No information about nonvisual reading is available",none:{compact:"Not readable in read aloud or dynamic braille",descriptive:"The content is not readable as read aloud speech or dynamic braille"},"not-fully":{compact:"Not fully readable in read aloud or dynamic braille",descriptive:"Not all of the content will be readable as read aloud speech or dynamic braille"},readable:{compact:"Readable in read aloud or dynamic braille",descriptive:"All content can be read as read aloud speech or dynamic braille"}},"prerecorded-audio":{complementary:{compact:"Prerecorded audio clips",descriptive:"Prerecorded audio clips are embedded in the content"},"no-metadata":"No information about prerecorded audio is available",only:{compact:"Prerecorded audio only",descriptive:"Audiobook with no text alternative"},synchronized:{compact:"Prerecorded audio synchronized with text",descriptive:"All the content is available as prerecorded audio synchronized with text"}},"visual-adjustments":{modifiable:{compact:"Appearance can be modified",descriptive:"Appearance of the text and page layout can be modified according to the capabilities of the reading system (font family and font size, spaces between paragraphs, sentences, words, and letters, as well as color of background and text)"},unknown:"No information about appearance modifiability is available",unmodifiable:{compact:"Appearance cannot be modified",descriptive:"Text and page layout cannot be modified as the reading experience is close to a print version, but reading systems can still provide zooming options"}}},conformance:{title:"Conformance","details-title":"Detailed conformance information",a:{compact:"This publication meets minimum accessibility standards",descriptive:"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level A standard"},aa:{compact:"This publication meets accepted accessibility standards",descriptive:"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AA standard"},aaa:{compact:"This publication exceeds accepted accessibility standards",descriptive:"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AAA standard"},no:"No information is available","unknown-standard":"Conformance to accepted standards for accessibility of this publication cannot be determined",certifier:"The publication was certified by ","certifier-credentials":"The certifier's credential is ",details:{"certification-info":"The publication was certified on ","certifier-report":"For more information refer to the certifier's report",claim:"This publication claims to meet","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Level A","level-aa":"Level AA","level-aaa":"Level AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.2"}}},navigation:{title:"Navigation",index:{compact:"Index",descriptive:"Index with links to referenced entries"},"no-metadata":"No information is available","page-navigation":{compact:"Go to page",descriptive:"Page list to go to pages from the print source version"},structural:{compact:"Headings",descriptive:"Elements such as headings, tables, etc for structured navigation"},toc:{compact:"Table of contents",descriptive:"Table of contents to all chapters of the text via links"}},"rich-content":{title:"Rich content","accessible-chemistry-as-latex":{compact:"Chemical formulas in LaTeX",descriptive:"Chemical formulas in accessible format (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"Chemical formulas in MathML",descriptive:"Chemical formulas in accessible format (MathML)"},"accessible-math-as-latex":{compact:"Math as LaTeX",descriptive:"Math formulas in accessible format (LaTeX)"},"math-as-mathml":{compact:"Math as MathML",descriptive:"Math formulas in accessible format (MathML)"},"accessible-math-described":"Text descriptions of math are provided","closed-captions":{compact:"Videos have closed captions",descriptive:"Videos included in publications have closed captions"},"extended-descriptions":"Information-rich images are described by extended descriptions","open-captions":{compact:"Videos have open captions",descriptive:"Videos included in publications have open captions"},transcript:"Transcript(s) provided",unknown:"No information is available"},hazards:{title:"Hazards",flashing:{compact:"Flashing content",descriptive:"The publication contains flashing content that can cause photosensitive seizures"},"flashing-none":{compact:"No flashing hazards",descriptive:"The publication does not contain flashing content that can cause photosensitive seizures"},"flashing-unknown":{compact:"Flashing hazards not known",descriptive:"The presence of flashing content that can cause photosensitive seizures could not be determined"},motion:{compact:"Motion simulation",descriptive:"The publication contains motion simulations that can cause motion sickness"},"motion-none":{compact:"No motion simulation hazards",descriptive:"The publication does not contain motion simulations that can cause motion sickness"},"motion-unknown":{compact:"Motion simulation hazards not known",descriptive:"The presence of motion simulations that can cause motion sickness could not be determined"},"no-metadata":"No information is available",none:{compact:"No hazards",descriptive:"The publication contains no hazards"},sound:{compact:"Sounds",descriptive:"The publication contains sounds that can cause sensitivity issues"},"sound-none":{compact:"No sound hazards",descriptive:"The publication does not contain sounds that can cause sensitivity issues"},"sound-unknown":{compact:"Sound hazards not known",descriptive:"The presence of sounds that can cause sensitivity issues could not be determined"},unknown:"The presence of hazards is unknown"},"accessibility-summary":{title:"Accessibility summary","no-metadata":"No information is available","publisher-contact":"For more information about the accessibility of this product, please contact the publisher: "},"legal-considerations":{title:"Legal considerations",exempt:{compact:"Claims an accessibility exemption in some jurisdictions",descriptive:"This publication claims an accessibility exemption in some jurisdictions"},"no-metadata":"No information is available"},"additional-accessibility-information":{title:"Additional accessibility information",aria:{compact:"ARIA roles included",descriptive:"Content is enhanced with ARIA roles to optimize organization and facilitate navigation"},"audio-descriptions":"Audio descriptions",braille:"Braille","color-not-sole-means-of-conveying-information":"Color is not the sole means of conveying information","dyslexia-readability":"Dyslexia readability","full-ruby-annotations":"Full ruby annotations","high-contrast-between-foreground-and-background-audio":"High contrast between foreground and background audio","high-contrast-between-text-and-background":"High contrast between foreground text and background","large-print":"Large print","page-breaks":{compact:"Page breaks included",descriptive:"Page breaks included from the original print source"},"ruby-annotations":"Some Ruby annotations","sign-language":"Sign language","tactile-graphics":{compact:"Tactile graphics included",descriptive:"Tactile graphics have been integrated to facilitate access to visual elements for blind people"},"tactile-objects":"Tactile 3D objects","text-to-speech-hinting":"Text-to-speech hinting provided","ultra-high-contrast-between-text-and-background":"Ultra high contrast between text and background","visible-page-numbering":"Visible page numbering","without-background-sounds":"Without background sounds"}},oi={"ways-of-reading":{title:"Lisibilité","nonvisual-reading":{"alt-text":{compact:"Images décrites",descriptive:"Les images sont décrites par un texte"},"no-metadata":"Aucune information pour la lecture en voix de synthèse ou en braille",none:{compact:"Non lisible en voix de synthèse ou en braille",descriptive:"Le contenu n'est pas lisible en voix de synthèse ou en braille"},"not-fully":{compact:"Pas entièrement lisible en voix de synthèse ou en braille",descriptive:"Tous les contenus ne pourront pas être lus à haute voix ou en braille"},readable:{compact:"Entièrement lisible en voix de synthèse ou en braille",descriptive:"Tous les contenus peuvent être lus en voix de synthèse ou en braille"}},"prerecorded-audio":{complementary:{compact:"Clips audio préenregistrés",descriptive:"Des clips audio préenregistrés sont intégrés au contenu"},"no-metadata":"Aucune information sur les enregistrements audio",only:{compact:"Audio préenregistré uniquement",descriptive:"Livre audio sans texte alternatif"},synchronized:{compact:"Audio préenregistré synchronisé avec du texte",descriptive:"Tous les contenus sont disponibles comme audio préenregistrés synchronisés avec le texte"}},"visual-adjustments":{modifiable:{compact:"L'affichage peut être adapté",descriptive:"L'apparence du texte et la mise en page peuvent être modifiées en fonction des capacités du système de lecture (famille et taille des polices, espaces entre les paragraphes, les phrases, les mots et les lettres, ainsi que la couleur de l'arrière-plan et du texte)"},unknown:"Aucune information sur les possibilités d'adaptation de l'affichage",unmodifiable:{compact:"L'affichage ne peut pas être adapté",descriptive:"Le texte et la mise en page ne peuvent pas être adaptés étant donné que l'expérience de lecture est proche de celle de la version imprimée, mais l'application de lecture peut tout de même proposer la capacité de zoomer"}}},conformance:{title:"Règles d'accessibilité","details-title":"Information détaillée",a:{compact:"Cette publication répond aux règles minimales d'accessibilité",descriptive:"La publication indique qu'elle respecte les règles d'accessibilité EPUB et WCAG 2 niveau A"},aa:{compact:"Cette publication répond aux règles d'accessibilité reconnues",descriptive:"La publication indique qu'elle respecte les règles d'accessibilité EPUB et WCAG 2 niveau AA"},aaa:{compact:"Cette publication dépasse les règles d'accessibilité reconnues",descriptive:"La publication indique qu'elle respecte les règles d'accessibilité EPUB et WCAG 2 niveau AAA"},no:"Aucune information disponible","unknown-standard":"Aucune indication concernant les normes d'accessibilité",certifier:"Accessibilité évaluée par ","certifier-credentials":"L'évaluateur est accrédité par ",details:{"certification-info":"Cette publication a été certifié le","certifier-report":"Pour plus d'information, veuillez consulter le rapport de certification",claim:"Cette publication indique respecter","epub-accessibility-1-0":"EPUB Accessibilité 1.0","epub-accessibility-1-1":"EPUB Accessibilité 1.1","level-a":"Niveau A","level-aa":"Niveau AA","level-aaa":"Niveau AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"Règles pour l’accessibilité des contenus Web (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"Règles pour l’accessibilité des contenus Web (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"Règles pour l’accessibilité des contenus Web (WCAG) 2.2"}}},navigation:{title:"Points de repère",index:{compact:"Index",descriptive:"Index comportant des liens vers les entrées référencées"},"no-metadata":"Aucune information disponible","page-navigation":{compact:"Aller à la page",descriptive:"Permet d'accéder aux pages de la version source imprimée"},structural:{compact:"Titres",descriptive:"Contient des titres pour une navigation structurée"},toc:{compact:"Table des matières",descriptive:"Table des matières"}},"rich-content":{title:"Contenus spécifiques","accessible-chemistry-as-latex":{compact:"Formules chimiques en LaTeX",descriptive:"Formules chimiques en format accessible (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"Formules chimiques en MathML",descriptive:"Formules chimiques en format accessible (MathML)"},"accessible-math-as-latex":{compact:"Mathématiques en LaTeX",descriptive:"Formules mathématiques en format accessible (LaTeX)"},"math-as-mathml":{compact:"Mathématiques en MathML",descriptive:"Formules mathématiques en format accessible (MathML)"},"accessible-math-described":"Des descriptions textuelles des formules mathématiques sont fournies","closed-captions":{compact:"Sous-titres disponibles pour les vidéos",descriptive:"Des sous titres sont disponibles pour les vidéos"},"extended-descriptions":"Les images porteuses d'informations complexes sont décrites par des descriptions longues","open-captions":{compact:"Sous-titres incrustés",descriptive:"Des sous titres sont incrustés pour les vidéos"},transcript:"Transcriptions fournies",unknown:"Aucune information disponible"},hazards:{title:"Points d'attention",flashing:{compact:"Flashs lumineux",descriptive:"La publication contient des flashs lumineux qui peuvent provoquer des crises d’épilepsie"},"flashing-none":{compact:"Pas de flashs lumineux",descriptive:"La publication ne contient pas de flashs lumineux susceptibles de provoquer des crises d’épilepsie"},"flashing-unknown":{compact:"Pas d'information concernant la présence de flashs lumineux",descriptive:"La présence de flashs lumineux susceptibles de provoquer des crises d’épilepsie n'a pas pu être déterminée"},motion:{compact:"Sensations de mouvement",descriptive:"La publication contient des images en mouvement qui peuvent provoquer des nausées, des vertiges et des maux de tête"},"motion-none":{compact:"Pas de sensations de mouvement",descriptive:"La publication ne contient pas d'images en mouvement qui pourraient provoquer des nausées, des vertiges et des maux de tête"},"motion-unknown":{compact:"Pas d'information concernant la présence d'images en mouvement",descriptive:"La présence d'images en mouvement susceptibles de provoquer des nausées, des vertiges et des maux de tête n'a pas pu être déterminée"},"no-metadata":"Aucune information disponible",none:{compact:"Aucun points d'attention",descriptive:"La publication ne présente aucun risque lié à la présence de flashs lumineux, de sensations de mouvement ou de sons"},sound:{compact:"Sons",descriptive:"La publication contient des sons qui peuvent causer des troubles de la sensibilité"},"sound-none":{compact:"Pas de risques sonores",descriptive:"La publication ne contient pas de sons susceptibles de provoquer des troubles de la sensibilité"},"sound-unknown":{compact:"Pas d'information concernant la présence de sons",descriptive:"La présence de sons susceptibles de causer des troubles de sensibilité n'a pas pu être déterminée"},unknown:"La présence de risques est inconnue"},"accessibility-summary":{title:"Informations d'accessibilité supplémentaires fournies par l'éditeur","no-metadata":"Aucune information disponible","publisher-contact":"Pour plus d'information à propos de l'accessibilité de cette publication, veuillez contacter l'éditeur : "},"legal-considerations":{title:"Considérations légales",exempt:{compact:"Déclare être sous le coup d'une exemption dans certaines juridictions",descriptive:"Cette publication dééclare être sous le coup d'une exemption dans certaines juridictions"},"no-metadata":"Aucune information disponible"},"additional-accessibility-information":{title:"Informations complémentaires sur l'accessibilité",aria:{compact:"Information enrichie pour les technologies d'assistances",descriptive:"La structure est enrichi de rôles ARIA afin d'optimiser l'organisation et de faciliter la navigation via les technologies d'assistances"},"audio-descriptions":"Description audio",braille:"Braille","color-not-sole-means-of-conveying-information":"La couleur n'est pas la seule manière de communiquer de l'information","dyslexia-readability":"Lisibilité adapté aux publics dys","full-ruby-annotations":"Annotations complètes au format ruby (langues asiatiques)","high-contrast-between-foreground-and-background-audio":"Contraste sonore amélioré entre les différents plans","high-contrast-between-text-and-background":"Contraste élevé entre le texte et l'arrière-plan","large-print":"Grands caractères","page-breaks":{compact:"Pagination identique à l'imprimé",descriptive:"Contient une pagination identique à la version imprimée"},"ruby-annotations":"Annotations partielles au format ruby (langues asiatiques)","sign-language":"Langue des signes","tactile-graphics":{compact:"Graphiques tactiles",descriptive:"Des graphiques tactiles ont été intégrés pour faciliter l'accès des personnes aveugles aux éléments visuels"},"tactile-objects":"Objets 3D ou tactiles","text-to-speech-hinting":"Prononciation améliorée pour la synthèse vocale","ultra-high-contrast-between-text-and-background":"Contraste très élevé entre le texte et l'arrière-plan","visible-page-numbering":"Numérotation de page visible","without-background-sounds":"Aucun bruit de fond"}};class _{constructor(){this.currentLocaleCode="en",this.locale=he,this.availableLocales={en:he,fr:oi}}static getInstance(){return _.instance||(_.instance=new _),_.instance}registerLocale(t,e){if(!t||typeof t!="string")throw new Error("Locale code must be a non-empty string");this.availableLocales[t]=e}setLocale(t){return t in this.availableLocales?(this.locale=this.availableLocales[t],this.currentLocaleCode=t,!0):(console.warn(`Locale '${t}' is not available`),!1)}getCurrentLocale(){return this.currentLocaleCode}getAvailableLocales(){return Object.keys(this.availableLocales)}getNestedValue(t,e){const i=e.split(".");let n=t;for(const r of i){if(n==null)return;n=n[r]}return n}getString(t){let e=this.getNestedValue(this.locale,t);return e===void 0&&this.currentLocaleCode!=="en"&&(e=this.getNestedValue(this.availableLocales.en,t)),e!==void 0?typeof e=="string"?{compact:e,descriptive:e}:e:(console.warn(`Missing localization for key: ${t}`),{compact:"",descriptive:""})}}const f=_.getInstance();var q=(s=>(s.reflowable="reflowable",s.fixed="fixed",s.scrolled="scrolled",s))(q||{}),de=(s=>(s.Unknown="unknown",s.Modifiable="modifiable",s.Unmodifiable="unmodifiable",s))(de||{}),pe=(s=>(s.NoMetadata="noMetadata",s.Readable="readable",s.NotFully="notFully",s.Unreadable="unreadable",s))(pe||{}),fe=(s=>(s.NoMetadata="noMetadata",s.Synchronized="synchronized",s.AudioOnly="audioOnly",s.AudioComplementary="audioComplementary",s))(fe||{});class St{constructor(t="unknown",e="noMetadata",i=!1,n="noMetadata"){this.id="ways-of-reading.title",this.visualAdjustments=t,this.nonvisualReading=e,this.nonvisualReadingAltText=i,this.prerecordedAudio=n,this.shouldDisplay=!0;const r=f.getString(this.id);this.title=r.compact,this.statements=[];const a=t==="modifiable"?"ways-of-reading.visual-adjustments.modifiable":t==="unmodifiable"?"ways-of-reading.visual-adjustments.unmodifiable":"ways-of-reading.visual-adjustments.unknown",c=f.getString(a);this.statements.push({id:a,compactString:c.compact,descriptiveString:c.descriptive});let d="";e==="readable"?d="ways-of-reading.nonvisual-reading.readable":e==="notFully"?d="ways-of-reading.nonvisual-reading.not-fully":e==="unreadable"?d="ways-of-reading.nonvisual-reading.none":e==="noMetadata"&&(d="ways-of-reading.nonvisual-reading.no-metadata");const m=f.getString(d);if(this.statements.push({id:d,compactString:m.compact,descriptiveString:m.descriptive}),i){const b=f.getString("ways-of-reading.nonvisual-reading.alt-text");this.statements.push({id:"ways-of-reading.nonvisual-reading.alt-text",compactString:b.compact,descriptiveString:b.descriptive})}let g="";n==="synchronized"?g="ways-of-reading.prerecorded-audio.synchronized":n==="audioOnly"?g="ways-of-reading.prerecorded-audio.only":n==="audioComplementary"?g="ways-of-reading.prerecorded-audio.complementary":n==="noMetadata"&&(g="ways-of-reading.prerecorded-audio.no-metadata");const h=f.getString(g);this.statements.push({id:g,compactString:h.compact,descriptiveString:h.descriptive})}static fromPublication(t){const e=t.metadata.accessibility??new F,i=e.feature??[],n=t.metadata.layout===q.fixed,r=i.some(p=>p.value===A.DISPLAY_TRANSFORMABILITY.value)?"modifiable":n?"unmodifiable":"unknown",a=e.accessMode??[],c=e.accessModeSufficient??[],d=a.length>0&&a.every(p=>p.value===z.TEXTUAL.value)||c.some(p=>{const O=p.value;return Array.isArray(O)?O.every(H=>H===z.TEXTUAL.value):O===z.TEXTUAL.value}),m=a.some(p=>p.value===z.TEXTUAL.value)||c.some(p=>{const O=p.value;return Array.isArray(O)?O.some(H=>H===z.TEXTUAL.value):O===z.TEXTUAL.value}),g=!(a.length===0&&c.length===0)&&!a.some(p=>p.value===z.TEXTUAL.value)&&!c.some(p=>{const O=p.value;return Array.isArray(O)?O.some(H=>H===z.TEXTUAL.value):O===z.TEXTUAL.value}),h=i.some(p=>[A.LONG_DESCRIPTION.value,A.ALTERNATIVE_TEXT.value,A.DESCRIBED_MATH.value,A.TRANSCRIPT.value].includes(p.value)),b=d?"readable":m||h?"notFully":g?"unreadable":"noMetadata",y=h,U=i.some(p=>p.value===A.SYNCHRONIZED_AUDIO_TEXT.value)?"synchronized":c.some(p=>{const O=p.value;return Array.isArray(O)?O.some(H=>H===z.AUDITORY.value):O===z.AUDITORY.value})?"audioOnly":a.some(p=>p.value===z.AUDITORY.value)?"audioComplementary":"noMetadata";return new St(r,b,y,U)}}class Et{constructor(t=!1,e=!1,i=!1,n=!1){this.id="navigation.title",this.tableOfContents=t,this.index=e,this.headings=i,this.page=n,this.noMetadata=!t&&!e&&!i&&!n;const r=f.getString(this.id);if(this.title=r.compact,this.shouldDisplay=!this.noMetadata,this.statements=[],t){const a=f.getString("navigation.toc");this.statements.push({id:"navigation.toc",compactString:a.compact,descriptiveString:a.descriptive})}if(e){const a=f.getString("navigation.index");this.statements.push({id:"navigation.index",compactString:a.compact,descriptiveString:a.descriptive})}if(i){const a=f.getString("navigation.structural");this.statements.push({id:"navigation.structural",compactString:a.compact,descriptiveString:a.descriptive})}if(n){const a=f.getString("navigation.page-navigation");this.statements.push({id:"navigation.page-navigation",compactString:a.compact,descriptiveString:a.descriptive})}if(this.statements.length===0){const a=f.getString("navigation.no-metadata");this.statements.push({id:"navigation.no-metadata",compactString:a.compact,descriptiveString:a.descriptive})}}static fromPublication(t){const i=(t.metadata.accessibility??new F).feature??[];return new Et(i.some(n=>n.value===A.TABLE_OF_CONTENTS.value),i.some(n=>n.value===A.INDEX.value),i.some(n=>n.value===A.STRUCTURAL_NAVIGATION.value),i.some(n=>n.value===A.PAGE_NAVIGATION.value))}}var me=(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))(me||{});class Tt{constructor(t=!1,e=!1,i=!1,n=!1,r=!1,a=!1,c=!1,d=!1,m=!1){this.id="rich-content.title",this.extendedAltTextDescriptions=t,this.mathFormula=e,this.mathFormulaAsMathML=i,this.mathFormulaAsLaTeX=n,this.chemicalFormulaAsMathML=r,this.chemicalFormulaAsLaTeX=a,this.closedCaptions=c,this.openCaptions=d,this.transcript=m,this.noMetadata=!t&&!e&&!i&&!n&&!r&&!a&&!c&&!d&&!m,this.shouldDisplay=!this.noMetadata;const g=f.getString(this.id);if(this.title=g.compact,this.statements=[],t){const h=f.getString("rich-content.extended-descriptions");this.statements.push({id:"rich-content.extended-descriptions",compactString:h.compact,descriptiveString:h.descriptive})}if(e){const h=f.getString("rich-content.accessible-math-described");this.statements.push({id:"rich-content.accessible-math-described",compactString:h.compact,descriptiveString:h.descriptive})}if(i){const h=f.getString("rich-content.math-as-mathml");this.statements.push({id:"rich-content.math-as-mathml",compactString:h.compact,descriptiveString:h.descriptive})}if(n){const h=f.getString("rich-content.accessible-math-as-latex");this.statements.push({id:"rich-content.accessible-math-as-latex",compactString:h.compact,descriptiveString:h.descriptive})}if(r){const h=f.getString("rich-content.accessible-chemistry-as-mathml");this.statements.push({id:"rich-content.accessible-chemistry-as-mathml",compactString:h.compact,descriptiveString:h.descriptive})}if(a){const h=f.getString("rich-content.accessible-chemistry-as-latex");this.statements.push({id:"rich-content.accessible-chemistry-as-latex",compactString:h.compact,descriptiveString:h.descriptive})}if(c){const h=f.getString("rich-content.closed-captions");this.statements.push({id:"rich-content.closed-captions",compactString:h.compact,descriptiveString:h.descriptive})}if(d){const h=f.getString("rich-content.open-captions");this.statements.push({id:"rich-content.open-captions",compactString:h.compact,descriptiveString:h.descriptive})}if(m){const h=f.getString("rich-content.transcript");this.statements.push({id:"rich-content.transcript",compactString:h.compact,descriptiveString:h.descriptive})}if(this.statements.length===0){const h=f.getString("rich-content.unknown");this.statements.push({id:"rich-content.unknown",compactString:h.compact,descriptiveString:h.descriptive})}}static fromPublication(t){const i=(t.metadata.accessibility??new F).feature??[];return new Tt(i.some(n=>n.value===A.LONG_DESCRIPTION.value),i.some(n=>n.value===A.DESCRIBED_MATH.value),i.some(n=>n.value===A.MATH_ML.value),i.some(n=>n.value===A.LATEX.value),i.some(n=>n.value===A.MATH_ML_CHEMISTRY.value),i.some(n=>n.value===A.LATEX_CHEMISTRY.value),i.some(n=>n.value===A.CLOSED_CAPTIONS.value),i.some(n=>n.value===A.OPEN_CAPTIONS.value),i.some(n=>n.value===A.TRANSCRIPT.value))}}class It{constructor(t=!1,e=!1,i=!1,n=!1,r=!1,a=!1,c=!1,d=!1,m=!1,g=!1,h=!1,b=!1,y=!1){this.id="additional-accessibility-information.title",this.pageBreakMarkers=t,this.aria=e,this.audioDescriptions=i,this.braille=n,this.rubyAnnotations=r,this.fullRubyAnnotations=a,this.highAudioContrast=c,this.highDisplayContrast=d,this.largePrint=m,this.signLanguage=g,this.tactileGraphics=h,this.tactileObjects=b,this.textToSpeechHinting=y,this.noMetadata=!t&&!e&&!i&&!n&&!r&&!a&&!c&&!d&&!m&&!g&&!h&&!b&&!y,this.shouldDisplay=!this.noMetadata;const U=f.getString(this.id);if(this.title=U.compact,this.statements=[],t){const p=f.getString("additional-accessibility-information.page-breaks");this.statements.push({id:"additional-accessibility-information.page-breaks",compactString:p.compact,descriptiveString:p.descriptive})}if(e){const p=f.getString("additional-accessibility-information.aria");this.statements.push({id:"additional-accessibility-information.aria",compactString:p.compact,descriptiveString:p.descriptive})}if(i){const p=f.getString("additional-accessibility-information.audio-descriptions");this.statements.push({id:"additional-accessibility-information.audio-descriptions",compactString:p.compact,descriptiveString:p.descriptive})}if(n){const p=f.getString("additional-accessibility-information.braille");this.statements.push({id:"additional-accessibility-information.braille",compactString:p.compact,descriptiveString:p.descriptive})}if(r){const p=f.getString("additional-accessibility-information.ruby-annotations");this.statements.push({id:"additional-accessibility-information.ruby-annotations",compactString:p.compact,descriptiveString:p.descriptive})}if(a){const p=f.getString("additional-accessibility-information.full-ruby-annotations");this.statements.push({id:"additional-accessibility-information.full-ruby-annotations",compactString:p.compact,descriptiveString:p.descriptive})}if(c){const p=f.getString("additional-accessibility-information.high-contrast-between-foreground-and-background-audio");this.statements.push({id:"additional-accessibility-information.high-contrast-between-foreground-and-background-audio",compactString:p.compact,descriptiveString:p.descriptive})}if(d){const p=f.getString("additional-accessibility-information.high-contrast-between-text-and-background");this.statements.push({id:"additional-accessibility-information.high-contrast-between-text-and-background",compactString:p.compact,descriptiveString:p.descriptive})}if(m){const p=f.getString("additional-accessibility-information.large-print");this.statements.push({id:"additional-accessibility-information.large-print",compactString:p.compact,descriptiveString:p.descriptive})}if(g){const p=f.getString("additional-accessibility-information.sign-language");this.statements.push({id:"additional-accessibility-information.sign-language",compactString:p.compact,descriptiveString:p.descriptive})}if(h){const p=f.getString("additional-accessibility-information.tactile-graphics");this.statements.push({id:"additional-accessibility-information.tactile-graphics",compactString:p.compact,descriptiveString:p.descriptive})}if(b){const p=f.getString("additional-accessibility-information.tactile-objects");this.statements.push({id:"additional-accessibility-information.tactile-objects",compactString:p.compact,descriptiveString:p.descriptive})}if(y){const p=f.getString("additional-accessibility-information.text-to-speech-hinting");this.statements.push({id:"additional-accessibility-information.text-to-speech-hinting",compactString:p.compact,descriptiveString:p.descriptive})}}static fromPublication(t){const i=(t.metadata.accessibility??new F).feature??[];return new It(i.some(n=>n.value===A.PAGE_BREAK_MARKERS.value||n.value===A.PRINT_PAGE_NUMBERS.value),i.some(n=>n.value===A.ARIA.value),i.some(n=>n.value===A.AUDIO_DESCRIPTION.value),i.some(n=>n.value===A.BRAILLE.value),i.some(n=>n.value===A.RUBY_ANNOTATIONS.value),i.some(n=>n.value===A.FULL_RUBY_ANNOTATIONS.value),i.some(n=>n.value===A.HIGH_CONTRAST_AUDIO.value),i.some(n=>n.value===A.HIGH_CONTRAST_DISPLAY.value),i.some(n=>n.value===A.LARGE_PRINT.value),i.some(n=>n.value===A.SIGN_LANGUAGE.value),i.some(n=>n.value===A.TACTILE_GRAPHIC.value),i.some(n=>n.value===A.TACTILE_OBJECT.value),i.some(n=>n.value===A.TTS_MARKUP.value))}}var ge=(s=>(s.yes="yes",s.no="no",s.unknown="unknown",s.noMetadata="noMetadata",s))(ge||{});class Nt{constructor(t="unknown",e="unknown",i="unknown"){this.id="hazards.title",this.flashing=t,this.motion=e,this.sound=i;const n=f.getString(this.id);if(this.title=n.compact,this.noMetadata=t==="noMetadata"&&e==="noMetadata"&&i==="noMetadata",this.noHazards=t==="no"&&e==="no"&&i==="no",this.unknown=t==="unknown"&&e==="unknown"&&i==="unknown",this.shouldDisplay=!this.noMetadata,this.statements=[],this.noHazards){const r=f.getString("hazards.none");this.statements.push({id:"hazards.none",compactString:r.compact,descriptiveString:r.descriptive})}else if(this.unknown){const r=f.getString("hazards.unknown");this.statements.push({id:"hazards.unknown",compactString:r.compact,descriptiveString:r.descriptive})}else if(this.noMetadata){const r=f.getString("hazards.no-metadata");this.statements.push({id:"hazards.no-metadata",compactString:r.compact,descriptiveString:r.descriptive})}else{if(t==="yes"){const r=f.getString("hazards.flashing");this.statements.push({id:"hazards.flashing",compactString:r.compact,descriptiveString:r.descriptive})}else if(t==="unknown"){const r=f.getString("hazards.flashing-unknown");this.statements.push({id:"hazards.flashing-unknown",compactString:r.compact,descriptiveString:r.descriptive})}else if(t==="no"){const r=f.getString("hazards.flashing-none");this.statements.push({id:"hazards.flashing-none",compactString:r.compact,descriptiveString:r.descriptive})}if(e==="yes"){const r=f.getString("hazards.motion");this.statements.push({id:"hazards.motion",compactString:r.compact,descriptiveString:r.descriptive})}else if(e==="unknown"){const r=f.getString("hazards.motion-unknown");this.statements.push({id:"hazards.motion-unknown",compactString:r.compact,descriptiveString:r.descriptive})}else if(e==="no"){const r=f.getString("hazards.motion-none");this.statements.push({id:"hazards.motion-none",compactString:r.compact,descriptiveString:r.descriptive})}if(i==="yes"){const r=f.getString("hazards.sound");this.statements.push({id:"hazards.sound",compactString:r.compact,descriptiveString:r.descriptive})}else if(i==="unknown"){const r=f.getString("hazards.sound-unknown");this.statements.push({id:"hazards.sound-unknown",compactString:r.compact,descriptiveString:r.descriptive})}else if(i==="no"){const r=f.getString("hazards.sound-none");this.statements.push({id:"hazards.sound-none",compactString:r.compact,descriptiveString:r.descriptive})}}}static fromPublication(t){const e=t.metadata.accessibility?.hazard??[];let i;e.some(c=>c.value===P.NONE.value)?i="no":e.some(c=>c.value===P.UNKNOWN.value)?i="unknown":i="noMetadata";let n;e.some(c=>c.value===P.FLASHING.value)?n="yes":e.some(c=>c.value===P.NO_FLASHING_HAZARD.value)?n="no":e.some(c=>c.value===P.UNKNOWN_FLASHING_HAZARD.value)?n="unknown":n=i;let r;e.some(c=>c.value===P.MOTION_SIMULATION.value)?r="yes":e.some(c=>c.value===P.NO_MOTION_SIMULATION_HAZARD.value)?r="no":e.some(c=>c.value===P.UNKNOWN_MOTION_SIMULATION_HAZARD.value)?r="unknown":r=i;let a;return e.some(c=>c.value===P.SOUND.value)?a="yes":e.some(c=>c.value===P.NO_SOUND_HAZARD.value)?a="no":e.some(c=>c.value===P.UNKNOWN_SOUND_HAZARD.value)?a="unknown":a=i,new Nt(n,r,a)}}class Lt{constructor(t=[]){this.id="conformance.title",this.profiles=t,this.shouldDisplay=!0;const e=f.getString(this.id);if(this.title=e.compact,this.statements=[],t.length===0){const i=f.getString("conformance.no");this.statements.push({id:"conformance.no",compactString:i.compact,descriptiveString:i.descriptive});return}if(t.some(i=>i.isWCAGLevelAAA)){const i=f.getString("conformance.aaa");this.statements.push({id:"conformance.aaa",compactString:i.compact,descriptiveString:i.descriptive})}else if(t.some(i=>i.isWCAGLevelAA)){const i=f.getString("conformance.aa");this.statements.push({id:"conformance.aa",compactString:i.compact,descriptiveString:i.descriptive})}else if(t.some(i=>i.isWCAGLevelA)){const i=f.getString("conformance.a");this.statements.push({id:"conformance.a",compactString:i.compact,descriptiveString:i.descriptive})}else{const i=f.getString("conformance.unknown-standard");this.statements.push({id:"conformance.unknown-standard",compactString:i.compact,descriptiveString:i.descriptive})}}static fromPublication(t){const e=t.metadata.accessibility?.conformsTo??[];return new Lt(e)}}class xt{constructor(t=!1){this.id="legal-considerations.title",this.exemption=t,this.shouldDisplay=this.exemption;const e=f.getString(this.id);if(this.title=e.compact,this.statements=[],t){const i=f.getString("legal-considerations.exempt");this.statements.push({id:"legal-considerations.exempt",compactString:i.compact,descriptiveString:i.descriptive})}else{const i=f.getString("legal-considerations.no-metadata");this.statements.push({id:"legal-considerations.no-metadata",compactString:i.compact,descriptiveString:i.descriptive})}}static fromPublication(t){const i=(t.metadata.accessibility?.exemption??[]).length>0;return new xt(i)}}class Ot{constructor(t){this.id="accessibility-summary.title",this.shouldDisplay=!0;const e=f.getString(this.id);this.title=e.compact;const i=t.metadata.accessibility?.summary;if(this.statements=[],this.shouldDisplay&&i)this.statements.push({id:"accessibility-summary.summary",compactString:i,descriptiveString:i});else{const n=f.getString("accessibility-summary.no-metadata");this.statements.push({id:"accessibility-summary.no-metadata",compactString:n.compact,descriptiveString:n.descriptive})}}static fromPublication(t){return new Ot(t)}}class ci{constructor(t){this.waysOfReading=St.fromPublication(t),this.navigation=Et.fromPublication(t),this.richContent=Tt.fromPublication(t),this.additionalInformation=It.fromPublication(t),this.hazards=Nt.fromPublication(t),this.conformance=Lt.fromPublication(t),this.legal=xt.fromPublication(t),this.accessibilitySummary=Ot.fromPublication(t),this.fields=[this.waysOfReading,this.navigation,this.richContent,this.additionalInformation,this.hazards,this.conformance,this.legal,this.accessibilitySummary]}}class zt{constructor(t){this.algorithm=t.algorithm,this.compression=t.compression,this.originalLength=t.originalLength,this.profile=t.profile,this.scheme=t.scheme}static deserialize(t){if(t&&t.algorithm)return new zt({algorithm:t.algorithm,compression:t.compression,originalLength:t.originalLength,profile:t.profile,scheme:t.scheme})}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 Ct=(s=>(s.left="left",s.right="right",s.center="center",s))(Ct||{});class k{constructor(t){this.otherProperties=t}get page(){return this.otherProperties.page}static deserialize(t){if(t)return new k(t)}serialize(){return this.otherProperties}add(t){const e=Object.assign({},this.otherProperties);for(const i in t)e[i]=t[i];return new k(e)}}Object.defineProperty(k.prototype,"encryption",{get:function(){return zt.deserialize(this.otherProperties.encrypted)}});class Rt{constructor(t){this.activeClass=t.activeClass,this.playbackActiveClass=t.playbackActiveClass}static deserialize(t){if(t)return new Rt({activeClass:t.activeClass,playbackActiveClass:t.playbackActiveClass})}serialize(){const t={};return this.activeClass&&(t.activeClass=this.activeClass),this.playbackActiveClass&&(t.playbackActiveClass=this.playbackActiveClass),t}}function be(s){return s&&Array.isArray(s)?s:void 0}function V(s){return s&&typeof s=="string"?[s]:be(s)}function st(s){return typeof s=="string"?new Date(s):void 0}function X(s){return isNaN(s)?void 0:s}function N(s){return X(s)!==void 0&&Math.sign(s)>=0?s:void 0}function nt(s){const t=new Array;return s.forEach(e=>t.push(e)),t}class K{constructor(t){this.value=t.value,this.scheme=t.scheme}static deserialize(t){if(t){if(typeof t=="string")return new K({value:t});if(typeof t=="object"&&t.value)return new K({value:t.value,scheme:t.scheme})}}serialize(){return this.scheme?{value:this.value,scheme:this.scheme}:this.value}}class l{constructor(t){let e,i,n=t.mediaType.replace(/\s/g,"").split(";");const r=n[0].split("/");if(r.length===2){if(e=r[0].toLowerCase().trim(),i=r[1].toLowerCase().trim(),e.length===0||i.length===0)throw new Error("Invalid media type")}else throw new Error("Invalid media type");const a={};for(let b=1;b<n.length;b++){const y=n[b].split("=");if(y.length===2){const U=y[0].toLocaleLowerCase(),p=U==="charset"?y[1].toUpperCase():y[1];a[U]=p}}const c={},d=Object.keys(a);d.sort((b,y)=>b.localeCompare(y)),d.forEach(b=>c[b]=a[b]);let m="";for(const b in c){const y=c[b];m+=`;${b}=${y}`}const g=`${e}/${i}${m}`,h=c.encoding;this.string=g,this.type=e,this.subtype=i,this.parameters=c,this.encoding=h,this.name=t.name,this.fileExtension=t.fileExtension}static parse(t){return new l(t)}get structuredSyntaxSuffix(){const t=this.subtype.split("+");return t.length>1?`+${t[t.length-1]}`:void 0}get charset(){return this.parameters.charset}contains(t){const e=typeof t=="string"?l.parse({mediaType:t}):t;if(!((this.type==="*"||this.type===e.type)&&(this.subtype==="*"||this.subtype===e.subtype)))return!1;const i=new Set(Object.entries(this.parameters).map(([r,a])=>`${r}=${a}`)),n=new Set(Object.entries(e.parameters).map(([r,a])=>`${r}=${a}`));for(const r of Array.from(i.values()))if(!n.has(r))return!1;return!0}matches(t){const e=typeof t=="string"?l.parse({mediaType:t}):t;return this.contains(e)||e.contains(this)}matchesAny(...t){for(const e of t)if(this.matches(e))return!0;return!1}equals(t){return this.string===t.string}get isZIP(){return this.matchesAny(l.ZIP,l.LCP_PROTECTED_AUDIOBOOK,l.LCP_PROTECTED_PDF)||this.structuredSyntaxSuffix==="+zip"}get isJSON(){return this.matchesAny(l.JSON)||this.structuredSyntaxSuffix==="+json"}get isOPDS(){return this.matchesAny(l.OPDS1,l.OPDS1_ENTRY,l.OPDS2,l.OPDS2_PUBLICATION,l.OPDS_AUTHENTICATION)||this.structuredSyntaxSuffix==="+json"}get isHTML(){return this.matchesAny(l.HTML,l.XHTML)}get isBitmap(){return this.matchesAny(l.BMP,l.GIF,l.JPEG,l.PNG,l.TIFF,l.WEBP)}get isAudio(){return this.type==="audio"}get isVideo(){return this.type==="video"}get isRWPM(){return this.matchesAny(l.READIUM_AUDIOBOOK_MANIFEST,l.DIVINA_MANIFEST,l.READIUM_WEBPUB_MANIFEST)}get isPublication(){return this.matchesAny(l.READIUM_AUDIOBOOK,l.READIUM_AUDIOBOOK_MANIFEST,l.CBZ,l.DIVINA,l.DIVINA_MANIFEST,l.EPUB,l.LCP_PROTECTED_AUDIOBOOK,l.LCP_PROTECTED_PDF,l.LPF,l.PDF,l.W3C_WPUB_MANIFEST,l.READIUM_WEBPUB,l.READIUM_WEBPUB_MANIFEST,l.ZAB)}static get AAC(){return l.parse({mediaType:"audio/aac",fileExtension:"aac"})}static get ACSM(){return l.parse({mediaType:"application/vnd.adobe.adept+xml",name:"Adobe Content Server Message",fileExtension:"acsm"})}static get AIFF(){return l.parse({mediaType:"audio/aiff",fileExtension:"aiff"})}static get AVI(){return l.parse({mediaType:"video/x-msvideo",fileExtension:"avi"})}static get BINARY(){return l.parse({mediaType:"application/octet-stream"})}static get BMP(){return l.parse({mediaType:"image/bmp",fileExtension:"bmp"})}static get CBZ(){return l.parse({mediaType:"application/vnd.comicbook+zip",name:"Comic Book Archive",fileExtension:"cbz"})}static get CSS(){return l.parse({mediaType:"text/css",fileExtension:"css"})}static get DIVINA(){return l.parse({mediaType:"application/divina+zip",name:"Digital Visual Narratives",fileExtension:"divina"})}static get DIVINA_MANIFEST(){return l.parse({mediaType:"application/divina+json",name:"Digital Visual Narratives",fileExtension:"json"})}static get EPUB(){return l.parse({mediaType:"application/epub+zip",name:"EPUB",fileExtension:"epub"})}static get GIF(){return l.parse({mediaType:"image/gif",fileExtension:"gif"})}static get GZ(){return l.parse({mediaType:"application/gzip",fileExtension:"gz"})}static get HTML(){return l.parse({mediaType:"text/html",fileExtension:"html"})}static get JAVASCRIPT(){return l.parse({mediaType:"text/javascript",fileExtension:"js"})}static get JPEG(){return l.parse({mediaType:"image/jpeg",fileExtension:"jpeg"})}static get JSON(){return l.parse({mediaType:"application/json"})}static get LCP_LICENSE_DOCUMENT(){return l.parse({mediaType:"application/vnd.readium.lcp.license.v1.0+json",name:"LCP License",fileExtension:"lcpl"})}static get LCP_PROTECTED_AUDIOBOOK(){return l.parse({mediaType:"application/audiobook+lcp",name:"LCP Protected Audiobook",fileExtension:"lcpa"})}static get LCP_PROTECTED_PDF(){return l.parse({mediaType:"application/pdf+lcp",name:"LCP Protected PDF",fileExtension:"lcpdf"})}static get LCP_STATUS_DOCUMENT(){return l.parse({mediaType:"application/vnd.readium.license.status.v1.0+json"})}static get LPF(){return l.parse({mediaType:"application/lpf+zip",fileExtension:"lpf"})}static get MP3(){return l.parse({mediaType:"audio/mpeg",fileExtension:"mp3"})}static get MPEG(){return l.parse({mediaType:"video/mpeg",fileExtension:"mpeg"})}static get NCX(){return l.parse({mediaType:"application/x-dtbncx+xml",fileExtension:"ncx"})}static get OGG(){return l.parse({mediaType:"audio/ogg",fileExtension:"oga"})}static get OGV(){return l.parse({mediaType:"video/ogg",fileExtension:"ogv"})}static get OPDS1(){return l.parse({mediaType:"application/atom+xml;profile=opds-catalog"})}static get OPDS1_ENTRY(){return l.parse({mediaType:"application/atom+xml;type=entry;profile=opds-catalog"})}static get OPDS2(){return l.parse({mediaType:"application/opds+json"})}static get OPDS2_PUBLICATION(){return l.parse({mediaType:"application/opds-publication+json"})}static get OPDS_AUTHENTICATION(){return l.parse({mediaType:"application/opds-authentication+json"})}static get OPUS(){return l.parse({mediaType:"audio/opus",fileExtension:"opus"})}static get OTF(){return l.parse({mediaType:"font/otf",fileExtension:"otf"})}static get PDF(){return l.parse({mediaType:"application/pdf",name:"PDF",fileExtension:"pdf"})}static get PNG(){return l.parse({mediaType:"image/png",fileExtension:"png"})}static get READIUM_AUDIOBOOK(){return l.parse({mediaType:"application/audiobook+zip",name:"Readium Audiobook",fileExtension:"audiobook"})}static get READIUM_AUDIOBOOK_MANIFEST(){return l.parse({mediaType:"application/audiobook+json",name:"Readium Audiobook",fileExtension:"json"})}static get READIUM_CONTENT_DOCUMENT(){return l.parse({mediaType:"application/vnd.readium.content+json",name:"Readium Content Document",fileExtension:"json"})}static get READIUM_GUIDED_NAVIGATION_DOCUMENT(){return l.parse({mediaType:"application/guided-navigation+json",name:"Readium Guided Navigation Document",fileExtension:"json"})}static get READIUM_POSITION_LIST(){return l.parse({mediaType:"application/vnd.readium.position-list+json",name:"Readium Position List",fileExtension:"json"})}static get READIUM_WEBPUB(){return l.parse({mediaType:"application/webpub+zip",name:"Readium Web Publication",fileExtension:"webpub"})}static get READIUM_WEBPUB_MANIFEST(){return l.parse({mediaType:"application/webpub+json",name:"Readium Web Publication",fileExtension:"json"})}static get SMIL(){return l.parse({mediaType:"application/smil+xml",fileExtension:"smil"})}static get SVG(){return l.parse({mediaType:"image/svg+xml",fileExtension:"svg"})}static get TEXT(){return l.parse({mediaType:"text/plain",fileExtension:"txt"})}static get TIFF(){return l.parse({mediaType:"image/tiff",fileExtension:"tiff"})}static get TTF(){return l.parse({mediaType:"font/ttf",fileExtension:"ttf"})}static get W3C_WPUB_MANIFEST(){return l.parse({mediaType:"application/x.readium.w3c.wpub+json",name:"Web Publication",fileExtension:"json"})}static get WAV(){return l.parse({mediaType:"audio/wav",fileExtension:"wav"})}static get WEBM_AUDIO(){return l.parse({mediaType:"audio/webm",fileExtension:"webm"})}static get WEBM_VIDEO(){return l.parse({mediaType:"video/webm",fileExtension:"webm"})}static get WEBP(){return l.parse({mediaType:"image/webp",fileExtension:"webp"})}static get WOFF(){return l.parse({mediaType:"font/woff",fileExtension:"woff"})}static get WOFF2(){return l.parse({mediaType:"font/woff2",fileExtension:"woff2"})}static get XHTML(){return l.parse({mediaType:"application/xhtml+xml",fileExtension:"xhtml"})}static get XML(){return l.parse({mediaType:"application/xml",fileExtension:"xml"})}static get ZAB(){return l.parse({mediaType:"application/x.readium.zab+zip",name:"Zipped Audio Book",fileExtension:"zab"})}static get ZIP(){return l.parse({mediaType:"application/zip",fileExtension:"zip"})}}class rt{constructor(t){this.uri=t,this.parameters=this.getParameters(t)}getParameters(t){const e=/\{\??([^}]+)\}/g,i=t.match(e);return i?new Set(i.join(",").replace(e,"$1").split(",").map(n=>n.trim())):new Set}expand(t){const e=n=>n.split(",").map(r=>{const a=t[r];return a?encodeURIComponent(a):""}).join(","),i=n=>"?"+n.split(",").map(r=>{const a=r.split("=")[0],c=t[a];return c?`${a}=${encodeURIComponent(c)}`:""}).join("&");return this.uri.replace(/\{(\??)([^}]+)\}/g,(...n)=>n[1]?i(n[2]):e(n[2]))}}class I{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}static deserialize(t){if(!t)return;const e=X(t.progression),i=X(t.totalProgression),n=X(t.position),r=new Map,a=new Set(["fragment","fragments","progression","totalProgression","position"]);return Object.entries(t).forEach(([c,d])=>{a.has(c)||r.set(c,d)}),new I({fragments:V(t.fragments||t.fragment),progression:e!==void 0&&e>=0&&e<=1?e:void 0,totalProgression:i!==void 0&&i>=0&&i<=1?i:void 0,position:n!==void 0&&n>0?n:void 0,otherLocations:r.size===0?void 0:r})}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,i)=>t[i]=e),t}}class Q{constructor(t){this.after=t.after,this.before=t.before,this.highlight=t.highlight}static deserialize(t){if(t)return new Q({after:t.after,before:t.before,highlight:t.highlight})}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}}class D{constructor(t){this.href=t.href,this.type=t.type,this.title=t.title,this.locations=t.locations?t.locations:new I({}),this.text=t.text}static deserialize(t){if(t&&t.href&&t.type)return new D({href:t.href,type:t.type,title:t.title,locations:I.deserialize(t.locations),text:Q.deserialize(t.text)})}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}copyWithLocations(t){return new D({href:this.href,type:this.type,title:this.title,text:this.text,locations:new I({...this.locations,...t})})}}class M{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}static deserialize(t){if(!(!t||typeof t.href!="string"))return new M({href:t.href,templated:t.templated,type:t.type,title:t.title,rels:t.rel?Array.isArray(t.rel)?new Set(t.rel):new Set([t.rel]):void 0,properties:k.deserialize(t.properties),height:N(t.height),width:N(t.width),size:N(t.size),duration:N(t.duration),bitrate:N(t.bitrate),languages:V(t.language),alternates:L.deserialize(t.alternate),children:L.deserialize(t.children)})}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=nt(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}get mediaType(){return this.type!==void 0?l.parse({mediaType:this.type}):l.BINARY}toURL(t){const e=this.href.replace(/^(\/)/,"");if(e.length===0)return;let i=t||"/";return i.startsWith("/")&&(i="file://"+i),new URL(e,i).href.replace(/^(file:\/\/)/,"")}get templateParameters(){return this.templated?new rt(this.href).parameters:new Set}expandTemplate(t){return new M({href:new rt(this.href).expand(t),templated:!1})}addProperties(t){const e=M.deserialize(this.serialize());return e.properties=e.properties?e.properties?.add(t):new k(t),e}get locator(){let t=this.href.split("#");return new D({href:t.length>0&&t[0]!==void 0?t[0]:this.href,type:this.type??"",title:this.title,locations:new I({fragments:t.length>1&&t[1]!==void 0?[t[1]]:[]})})}}class L{constructor(t){this.items=t}static deserialize(t){if(t&&Array.isArray(t))return new L(t.map(e=>M.deserialize(e)).filter(e=>e!==void 0))}serialize(){return this.items.map(t=>t.serialize())}findWithRel(t){const e=i=>i.rels&&i.rels.has(t);return this.items.find(e)}filterByRel(t){const e=i=>i.rels&&i.rels.has(t);return this.items.filter(e)}findWithHref(t){const e=i=>i.href===t;return this.items.find(e)}findIndexWithHref(t){const e=i=>i.href===t;return this.items.findIndex(e)}findWithMediaType(t){const e=i=>i.mediaType.matches(t);return this.items.find(e)}filterByMediaType(t){const e=i=>i.mediaType.matches(t);return this.items.filter(e)}filterByMediaTypes(t){const e=i=>{for(const n of t)if(i.mediaType.matches(n))return!0;return!1};return this.items.filter(e)}everyIsAudio(){const t=e=>e.mediaType.isAudio;return this.items.length>0&&this.items.every(t)}everyIsBitmap(){const t=e=>e.mediaType.isBitmap;return this.items.length>0&&this.items.every(t)}everyIsHTML(){const t=e=>e.mediaType.isHTML;return this.items.length>0&&this.items.every(t)}everyIsVideo(){const t=e=>e.mediaType.isVideo;return this.items.length>0&&this.items.every(t)}everyMatchesMediaType(t){return Array.isArray(t)?this.items.length>0&&this.items.every(e=>{for(const i of t)return e.mediaType.matches(i);return!1}):this.items.length>0&&this.items.every(e=>e.mediaType.matches(t))}filterLinksHasType(){return this.items.filter(t=>t.type)}}const G=class G{constructor(t){this.translations=typeof t=="string"?{[G.UNDEFINED_LANGUAGE]:t}:t}static deserialize(t){if(t&&(typeof t=="string"||t.constructor===Object))return new G(t)}serialize(){return this.translations}getTranslation(t){return this.translations[t||G.UNDEFINED_LANGUAGE]||this.translations[G.UNDEFINED_LANGUAGE]||this.translations[G.LANGUAGE_EN]||(Object.values(this.translations).length===0?"":Object.values(this.translations)[0])}};G.UNDEFINED_LANGUAGE="undefined",G.LANGUAGE_EN="en";let B=G;class at{constructor(t){this.name=t.name,this.sortAs=t.sortAs,this.identifier=t.identifier,this.altIdentifiers=t.altIdentifiers,this.roles=t.roles,this.links=t.links,this.position=t.position}static deserialize(t){if(t)return typeof t=="string"?new at({name:B.deserialize(t)}):t.name?new at({name:B.deserialize(t.name),sortAs:B.deserialize(t.sortAs),identifier:t.identifier,altIdentifiers:t.altIdentifier?Array.isArray(t.altIdentifier)?new Set(t.altIdentifier.map(e=>K.deserialize(e)).filter(e=>e!==void 0)):new Set([K.deserialize(t.altIdentifier)].filter(e=>e!==void 0)):void 0,roles:t.role?new Set(V(t.role)):void 0,links:L.deserialize(t.links),position:X(t.position)}):void 0}serialize(){const t={name:this.name.serialize()};return this.sortAs!==void 0&&(t.sortAs=this.sortAs.serialize()),this.identifier!==void 0&&(t.identifier=this.identifier),this.altIdentifiers&&(t.altIdentifier=nt(this.altIdentifiers).map(e=>e.serialize())),this.roles&&(t.role=nt(this.roles)),this.links&&(t.links=this.links.serialize()),this.position!==void 0&&(t.position=this.position),t}}class x{constructor(t){this.items=t}static deserialize(t){if(!t)return;const e=Array.isArray(t)?t:[t];return new x(e.map(i=>at.deserialize(i)).filter(i=>i!==void 0))}serialize(){return this.items.map(t=>t.serialize())}}class j{constructor(t){this.items=t&&t.items?t.items:new Map}static deserialize(t){if(!(t&&typeof t=="object"))return;const e=new Map;return Object.entries(t).forEach(([i,n])=>{const r=x.deserialize(n);r&&r.items.length>0&&e.set(i,r)}),new j({items:e})}serialize(){const t={};return this.items.forEach((e,i)=>t[i]=e.serialize()),t}}var tt=(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))(tt||{}),Y=(s=>(s.ltr="ltr",s.rtl="rtl",s))(Y||{});function li(s){return s==="rtl"?Ct.right:Ct.left}class ot{constructor(t){this.name=t.name,this.sortAs=t.sortAs,this.code=t.code,this.scheme=t.scheme,this.links=t.links}static deserialize(t){if(t)return typeof t=="string"?new ot({name:B.deserialize(t)}):t.name?new ot({name:B.deserialize(t.name),sortAs:t.sortAs?B.deserialize(t.sortAs):void 0,code:t.code,scheme:t.scheme,links:L.deserialize(t.links)}):void 0}serialize(){const t={name:this.name.serialize()};return this.sortAs!==void 0&&(t.sortAs=this.sortAs.serialize()),this.code!==void 0&&(t.code=this.code),this.scheme!==void 0&&(t.scheme=this.scheme),this.links&&(t.links=this.links.serialize()),t}}class Pt{constructor(t){this.items=t}static deserialize(t){if(!t)return;const e=Array.isArray(t)?t:[t];return new Pt(e.map(i=>ot.deserialize(i)).filter(i=>i!==void 0))}serialize(){return this.items.map(t=>t.serialize())}}var ve=(s=>(s.all="all",s.none="none",s))(ve||{});class kt{constructor(t){this.reservation=t.reservation,this.policy=t.policy}static deserialize(t){if(t)return new kt({reservation:t.reservation,policy:t.policy})}serialize(){const t={};return this.reservation!==void 0&&(t.reservation=this.reservation),this.policy!==void 0&&(t.policy=this.policy),t}}const bt=class bt{constructor(t){this.title=t.title,this.typeUri=t.typeUri,this.conformsTo=t.conformsTo,this.identifier=t.identifier,this.altIdentifier=t.altIdentifier,this.subtitle=t.subtitle,this.sortAs=t.sortAs,this.artists=t.artists,this.authors=t.authors,this.colorists=t.colorists,this.contributors=t.contributors,this.editors=t.editors,this.illustrators=t.illustrators,this.inkers=t.inkers,this.letterers=t.letterers,this.narrators=t.narrators,this.pencilers=t.pencilers,this.translators=t.translators,this.languages=t.languages,this.description=t.description,this.publishers=t.publishers,this.imprints=t.imprints,this.published=t.published,this.modified=t.modified,this.subjects=t.subjects,this.belongsTo=t.belongsTo,this.belongsToCollections=t.belongsToCollections,this.belongsToSeries=t.belongsToSeries,this.belongsToCollections&&this.belongsToCollections.items.length>0&&(this.belongsTo||(this.belongsTo=new j),this.belongsTo.items.set("collection",this.belongsToCollections)),this.belongsToSeries&&this.belongsToSeries.items.length>0&&(this.belongsTo||(this.belongsTo=new j),this.belongsTo.items.set("series",this.belongsToSeries)),this.layout=t.layout,this.readingProgression=t.readingProgression,this.duration=t.duration,this.numberOfPages=t.numberOfPages,this.accessibility=t.accessibility,this.tdm=t.tdm,this.otherMetadata=t.otherMetadata}static deserialize(t){if(!(t&&t.title))return;const e=B.deserialize(t.title),i=t["@type"],n=V(t.conformsTo),r=t.identifier,a=K.deserialize(t.altIdentifier),c=B.deserialize(t.subtitle),d=B.deserialize(t.sortAs),m=x.deserialize(t.artist),g=x.deserialize(t.author),h=x.deserialize(t.colorist),b=x.deserialize(t.contributor),y=x.deserialize(t.editor),U=x.deserialize(t.illustrator),p=x.deserialize(t.inker),O=x.deserialize(t.letterer),H=x.deserialize(t.narrator),Vs=x.deserialize(t.penciler),Ys=x.deserialize(t.translator),$s=V(t.language),qs=t.description,Xs=x.deserialize(t.publisher),Ks=x.deserialize(t.imprint),Js=st(t.published),Zs=st(t.modified),_s=Pt.deserialize(t.subject),Qs=j.deserialize(t.belongsTo),js=F.deserialize(t.accessibility),tn=t.layout,en=t.readingProgression,sn=N(t.duration),nn=N(t.numberOfPages),rn=kt.deserialize(t.tdm);let Kt=Object.assign({},t);return bt.mappedProperties.forEach(an=>delete Kt[an]),Object.keys(Kt).length===0&&(Kt=void 0),new bt({title:e,typeUri:i,conformsTo:n,identifier:r,altIdentifier:a,subtitle:c,sortAs:d,artists:m,authors:g,colorists:h,contributors:b,editors:y,illustrators:U,inkers:p,letterers:O,narrators:H,pencilers:Vs,translators:Ys,languages:$s,description:qs,publishers:Xs,imprints:Ks,published:Js,modified:Zs,subjects:_s,belongsTo:Qs,layout:tn,readingProgression:en,duration:sn,numberOfPages:nn,accessibility:js,tdm:rn,otherMetadata:Kt})}serialize(){const t={title:this.title.serialize()};if(this.typeUri!==void 0&&(t["@type"]=this.typeUri),this.conformsTo&&(t.conformsTo=this.conformsTo),this.identifier!==void 0&&(t.identifier=this.identifier),this.altIdentifier&&(t.altIdentifier=this.altIdentifier.serialize()),this.subtitle&&(t.subtitle=this.subtitle.serialize()),this.sortAs&&(t.sortAs=this.sortAs.serialize()),this.editors&&(t.editor=this.editors.serialize()),this.artists&&(t.artist=this.artists.serialize()),this.authors&&(t.author=this.authors.serialize()),this.colorists&&(t.colorist=this.colorists.serialize()),this.contributors&&(t.contributor=this.contributors.serialize()),this.illustrators&&(t.illustrator=this.illustrators.serialize()),this.letterers&&(t.letterer=this.letterers.serialize()),this.narrators&&(t.narrator=this.narrators.serialize()),this.pencilers&&(t.penciler=this.pencilers.serialize()),this.translators&&(t.translator=this.translators.serialize()),this.inkers&&(t.inker=this.inkers.serialize()),this.languages&&(t.language=this.languages),this.description!==void 0&&(t.description=this.description),this.publishers&&(t.publisher=this.publishers.serialize()),this.imprints&&(t.imprint=this.imprints.serialize()),this.published!==void 0&&(t.published=this.published.toISOString()),this.modified!==void 0&&(t.modified=this.modified.toISOString()),this.subjects&&(t.subject=this.subjects.serialize()),this.belongsTo&&(t.belongsTo=this.belongsTo.serialize()),this.layout&&(t.layout=this.layout),this.readingProgression&&(t.readingProgression=this.readingProgression),this.duration!==void 0&&(t.duration=this.duration),this.numberOfPages!==void 0&&(t.numberOfPages=this.numberOfPages),this.accessibility&&(t.accessibility=this.accessibility.serialize()),this.tdm&&(t.tdm=this.tdm.serialize()),this.otherMetadata){const e=this.otherMetadata;Object.keys(e).forEach(i=>t[i]=e[i])}return t}get effectiveLayout(){if(!this.conformsTo)return null;for(const t of this.conformsTo)switch(t){case tt.EPUB:return this.layout||q.reflowable;case tt.DIVINA:return this.layout===q.reflowable?q.fixed:this.layout||q.fixed;case tt.AUDIOBOOK:case tt.PDF:return null}return null}get effectiveReadingProgression(){if(this.readingProgression)return this.readingProgression;if(this.languages?.length!==1)return Y.ltr;const t=this.languages[0].toLowerCase();if(t==="zh-hant"||t==="zh-tw")return Y.rtl;switch(t.split("-")[0]){case"ar":return Y.rtl;case"fa":return Y.rtl;case"he":return Y.rtl;default:return Y.ltr}}};bt.mappedProperties=["title","@type","conformsTo","identifier","altIdentifier","subtitle","sortAs","artist","author","colorist","contributor","editor","illustrator","inker","letterer","narrator","penciler","translator","language","description","publisher","imprint","published","modified","subject","belongsTo","layout","readingProgression","duration","numberOfPages","accessibility","tdm"];let ct=bt;ct.prototype.getMediaOverlay=function(){const s=this.otherMetadata?.mediaOverlay;if(s)return Rt.deserialize(s)},k.prototype.getContains=function(){return new Set(this.otherProperties.contains||[])};class Dt{constructor(t){this.links=t.links,this.guided=t.guided}static deserialize(t){if(t)return new Dt({links:L.deserialize(t.links),guided:J.deserializeArray(t.guided)})}serialize(){const t={};return this.links!==void 0&&(t.links=this.links.serialize()),this.guided!==void 0&&(t.guided=this.guided.map(e=>e.serialize())),t}}class lt{constructor(t){this.plain=t.plain,this.ssml=t.ssml,this.language=t.language}static deserialize(t){if(t!=null){if(typeof t=="string")return new lt({plain:t});if(t.plain||t.ssml||t.language)return new lt({plain:t.plain,ssml:t.ssml,language:t.language})}}serialize(){const t={};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}}class J{constructor(t){this.audioref=t.audioref,this.children=t.children,this.imgref=t.imgref,this.role=t.role,this.level=t.level!==void 0?Math.min(6,Math.max(1,t.level)):void 0,this.text=t.text,this.textref=t.textref,this.description=t.description}get plainText(){return this.text?.plain}get ssmlText(){return this.text?.ssml}get textLanguage(){return this.text?.language}static deserialize(t){if(t)return new J({audioref:t.audioref,children:J.deserializeArray(t.children),imgref:t.imgref,role:t.role?new Set(V(t.role)):void 0,level:typeof t.level=="number"?t.level:void 0,text:lt.deserialize(t.text),textref:t.textref,description:J.deserialize(t.description)})}static deserializeArray(t){if(Array.isArray(t))return t.map(e=>J.deserialize(e)).filter(e=>e!==void 0)}serialize(){const t={};if(this.audioref!==void 0&&(t.audioref=this.audioref),this.children!==void 0&&(t.children=this.children.map(e=>e.serialize())),this.imgref!==void 0&&(t.imgref=this.imgref),this.role!==void 0&&(t.role=nt(this.role)),this.level!==void 0&&(t.level=this.level),this.text!==void 0){const e=this.text.serialize();e!==void 0&&(t.text=e)}return this.textref!==void 0&&(t.textref=this.textref),this.description&&(t.description=this.description.serialize()),t}get audioFile(){return this.audioref?.split("#")[0]}get audioTime(){if(this.audioref?.includes("#"))return this.audioref.split("#",2)[1]}get textFile(){return this.textref?.split("#")[0]}get fragmentId(){if(this.textref?.includes("#"))return this.textref.split("#",2)[1]}get clip(){const t=this.audioFile;if(!t)return;const e=this.audioTime,i={audioResource:t,fragmentId:this.fragmentId};if(!e)return i;const n=this.parseTimer(e);return i.start=n[0],i.end=n[1],i}parseTimer(t){if(!t||!t.startsWith("t="))return[void 0,void 0];const e=t.substring(2).split(",").map(i=>parseFloat(i));return e.length===1?[isNaN(e[0])?void 0:e[0],void 0]:e.length>2?[void 0,void 0]:[isNaN(e[0])?void 0:e[0],isNaN(e[1])?void 0:e[1]]}}function ui(s,t){return t.length>1?t.indexOf(s.slice(-1))>-1:s.slice(-1)===t}function hi(s,t){return s.slice(s.length-t.length)===t}const Jt={endsWith:hi,endsWithChar:ui},di=["ie","eg","ext","Fig","fig","Figs","figs","et al","Co","Corp","Ave","Inc","Ex","Viz","vs","Vs","repr","Rep","Dem","trans","Vol","pp","rev","est","Ref","Refs","Eq","Eqs","Ch","Sec","Secs","mi","Dept","Univ","Nos","No","Mol","Cell","Miss","Mrs","Mr","Ms","Prof","Dr","Sgt","Col","Gen","Rep","Sen","Gov","Lt","Maj","Capt","St","Sr","Jr","jr","Rev","PhD","MD","BA","MA","MM","BSc","MSc","Jan","Feb","Mar","Apr","Jun","Jul","Aug","Sep","Sept","Oct","Nov","Dec","Sun","Mon","Tu","Tue","Tues","Wed","Th","Thu","Thur","Thurs","Fri","Sat"];function Ae(s){return/^[A-Z][a-z].*/.test(s)||Zt(s)}function pi(s){return Ae(s)||/``|"|'/.test(s.substring(0,2))}function fi(s){return~di.indexOf(s.replace(/\W+/g,""))}function mi(s,t){if(s==="a.m."||s==="p.m."){var e=t.replace(/\W+/g,"").slice(-3).toLowerCase();if(e==="day")return!0}return!1}function ye(s){var t=s.replace(/[\(\)\[\]\{\}]/g,"").match(/(.\.)*/);return t&&t[0].length>0}function we(s){return s.length<=3?!0:Ae(s)}function Zt(s,t){return t&&(s=s.slice(t-1,t+2)),!isNaN(Number(s))}function gi(s){return s.match(/^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$/)}function bi(s){return s.match(/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/)}function vi(s){var t=0;if((t=s.indexOf("."))>-1||(t=s.indexOf("!"))>-1||(t=s.indexOf("?"))>-1){var e=s.charAt(t+1);if(e.match(/[a-zA-Z].*/))return[s.slice(0,t),s.charAt(t),s.slice(t+1)]}return!1}function Ai(s){return s==="."||s==="!"||s==="?"}function yi(s,t){t=Object.assign(t||{},{newlineBoundary:t&&t.newlineBoundary||!0});var e=/\s/;return s.serie(s.re(e,{split:!0}),s.splitAndMerge(function(i,n,r,a,c,d){var m,g=[i,null],h=i,b=d.slice(c+1).find(function(U){return!e.test(U.value)});if(i===`
2
- `&&t.newlineBoundary||Ai(i)||Jt.endsWithChar(i,"?!"))return g;if(Jt.endsWithChar(i,".")){if(b){if(i.length===2&&isNaN(i.charAt(0))&&i.match(/[a-zA-Z]/)||fi(i))return h;if(pi(b.value)){if(mi(i,b.value)||Zt(b.value)&&we(i))return h}else if(Jt.endsWith(i,"..")||ye(i)||we(i))return h}return g}let y;return(y=i.indexOf("."))>-1&&(Zt(i,y)||ye(i)||bi(i)||gi(i))?h:(m=vi(i))?[m[0]+m[1],null,m[2]]:h}),s.filter(function(i){return i.trim()!=""}))}const wi=(s,...t)=>(...e)=>s(...t,...e);function Si(s){return{sentences:wi(yi,s)}}function Ei(s,t){return t?s.reduce(function(e,i){var n=[i.index,i.offset,i.value].join("-");return[e,n].join(":")},t):null}function Ti(s){const{index:t,offset:e,value:i,...n}=s;return n}function Ii(s,t){var e=0;return Array.isArray(t)||(t=[t]),t.map(function(i){return i===null?null:(typeof i=="string"&&(i={value:i,index:e,offset:i.length}),typeof i=="object"&&(i.index=i.index||0,e=e+i.index+i.offset,i.index=s.index+i.index,i.offset=i.offset||i.value.length),i)})}function Ni(s,t){if(s.length==0)return null;var e="",i=0,n=s[0]?.index;return s.forEach(function(r,a){var c=s[a-1];s[a+1];var d=c?r.index+1-(c.index+c.offset):0;e=e+new Array(d).join(t)+r.value;var m=r.index-n+r.offset;m>i&&(i=m)}),{index:n,value:e,offset:Math.max(i,e.length)}}const ut={tokensId:Ei,normalize:Ii,properties:Ti,merge:Ni};var Li=' \r\n  !"#$%&()*+,-.\\/:;<=>?@[\\]^_`{|}~',xi=new RegExp("([^"+Li+"]+)");function C(s){if(!(this instanceof C))return new C(s);this.opts=Object.assign({cacheGet:function(t){return null},cacheSet:function(t,e){}},s)}C.prototype.split=function(t,e={}){var i=this;return e=Object.assign({preserveProperties:!0,cache:()=>null},e),function(n,r){if(arguments.length===6)return t.apply(null,arguments);var a,c,d;if(n===void 0)return[];if(typeof n=="string"?n=[{value:n,index:0,offset:n.length}]:Array.isArray(n)||(n=[n]),c=ut.tokensId(n,e.cache()),c&&(d=i.opts.cacheGet(c),d))return d;var m=n.map(function(g,h){var b=n[h+1],y=t(g.value,Object.assign({},g),a?Object.assign({},a):null,b?Object.assign({},b):null,h,n)||[];if(y=ut.normalize(g,y),e.preserveProperties){var U=ut.properties(g);y=y.map(function(p){return Object.assign({},p,U)})}return a=g,y}).filter(Boolean).flat();return c&&i.opts.cacheSet(c,m),m}},C.prototype.re=function(t,e={}){return e=Object.assign({split:!1},e),this.split(function(i,n){for(var r=i,a=[],c,d=0;c=t.exec(i);){var m=c.index,g=d+m,h=c[0]||"",b=h.length;if(e.split&&d<g){var y=r.slice(d,g);a.push({value:y,index:d,offset:y.length})}a.push({value:h,index:g,offset:b,match:c}),i=i.slice(m+b),d=g+b}return e.split&&i&&a.push({value:i,index:d,offset:i.length}),a},{cache:function(){return t.toString()}})},C.prototype.splitAndMerge=function(t,e={}){var i=this;return e=Object.assign({mergeWith:""},e),function(n){var r=[],a=[];function c(){if(a.length!=0){var d=ut.merge(a,e.mergeWith);r.push(d),a=[]}}return i.split(function(d,m){var g=t.apply(null,arguments);g=ut.normalize(m,g),g.forEach(function(h){h===null?c():a.push(h)})})(n),c(),r}},C.prototype.filter=function(t){return this.split(function(e,i){if(t.apply(null,arguments))return{value:i.value,index:0,offset:i.offset}})},C.prototype.extend=function(t){return this.split(function(e,i){var n=typeof t=="function"?t.apply(null,arguments):t;return Object.assign({value:i.value,index:0,offset:i.offset},n)})},C.prototype.ifthen=function(s,t){return this.split(function(e,i){if(s.apply(null,arguments))return t.apply(null,arguments);const{index:n,...r}=i;return r})},C.prototype.test=function(t){return this.filter(function(e,i){return t.test(e)},{cache:t.toString()})},C.prototype.flow=function(...t){const e=t.reduce((i,n)=>(...r)=>n(i(...r)));return this.split(e)},C.prototype.serie=function(...t){return t.reduce((e,i)=>(...n)=>i(e(...n)))},C.prototype.merge=function(){return this.splitAndMerge(s=>[s])},C.prototype.sections=function(){return this.re(/([^\n\.,;!?]+)/i,{split:!1})},C.prototype.words=function(){return this.re(xi)},C.prototype.characters=function(){return this.re(/[^\s]/)};var Se=(s=>(s.Word="word",s.Sentence="sentence",s.Paragraph="paragraph",s))(Se||{});const Ee=(s,t)=>"Segmenter"in Intl?new Te(s,t):new Ie(s,t);class Te{constructor(t,e){if(this.unit=e,t=t??navigator?.language,!("Segmenter"in Intl))throw new Error("Intl.Segmenter is not supported in this environment");if(e==="paragraph")throw new Error("IntlTextTokenizer does not handle TextUnit.Paragraph");this.segmenter=new Intl.Segmenter(t,{granularity:e})}tokenize(t){const e=this.segmenter.segment(t),i=[];for(let n of e){if(this.unit==="word"&&n.isWordLike===!1)continue;const r=_t(n.segment);r!==null&&i.push([n.index,n.index+r.length])}return i}}class Ie{constructor(t,e){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");this.tokenizer=new C}tokenize(t){let e=[];switch(this.unit){case"word":e=this.tokenizer.words()(t);break;case"sentence":this.isEnglish?e=Si(this.tokenizer).sentences()(t):e=this.tokenizer.sections()(t);break;default:e=[]}if(!e)return[];const i=[];return e.forEach(n=>{if(n.value.length===0)return;const r=_t(n.value);r!==null&&i.push([n.index,n.index+r.length])}),i}}const Oi=new RegExp("[\\p{L}\\p{N}]+","u"),_t=s=>{const t=s.trimEnd();return t.length===0||t.match(Oi)===null?null:t};class ${constructor(t){this.fetcher=new Z,t.fetcher&&(this.fetcher=t.fetcher),this.manifest=t.manifest,this.context=t.manifest.context,this.metadata=t.manifest.metadata,this.links=t.manifest.links,this.readingOrder=t.manifest.readingOrder,this.resources=t.manifest.resources,this.toc=t.manifest.toc,this.subcollections=t.manifest.subcollections}get baseURL(){return this.manifest.baseURL}linkWithHref(t){return this.manifest.linkWithHref(t)}linksWithRole(t){const e=this.subcollections?.get(t);return e&&e.length>0?e[0].links:void 0}linksWithRel(t){return this.manifest.linksWithRel(t)}linkWithRel(t){return this.manifest.linkWithRel(t)}async positionsFromManifest(){const t=this.manifest.links.findWithMediaType("application/vnd.readium.position-list+json");if(t===void 0)return[];const e=await this.get(t).readAsJSON();return e.total?e.positions.map(i=>D.deserialize(i)).filter(i=>i!==void 0):[]}async guideForLink(t){const e=a=>a.alternates?.findWithMediaType("application/guided-navigation+json");let i=e(t);if(!i){const a=this.linkWithHref(t.href);a!==void 0&&(i=e(a))}if(i||(i=this.manifest.links.findWithMediaType("application/guided-navigation+json")),!i)return;let n=i.href;if(i.templated){const a=new rt(n),c={};a.parameters.has("ref")&&(c.ref=t.href),n=new rt(n).expand(c)}const r=await this.get(new M({href:n})).readAsJSON();return Dt.deserialize(r)}get(t){return this.fetcher.get(t)}}$.prototype.getPageList=function(){return this.linksWithRole("pageList")},$.prototype.getLandmarks=function(){return this.linksWithRole("landmarks")},$.prototype.getListOfAudioClips=function(){return this.linksWithRole("loa")},$.prototype.getListOfIllustrations=function(){return this.linksWithRole("loi")},$.prototype.getListOfTables=function(){return this.linksWithRole("lot")},$.prototype.getListOfVideoClips=function(){return this.linksWithRole("lov")};class ht{constructor(t){this.cssSelector=t.cssSelector,this.textNodeIndex=t.textNodeIndex,this.charOffset=t.charOffset}static deserialize(t){if(!(t&&t.cssSelector))return;let e=N(t.textNodeIndex);if(e===void 0)return;let i=N(t.charOffset);return i===void 0&&(i=N(t.offset)),new ht({cssSelector:t.cssSelector,textNodeIndex:e,charOffset:i})}serialize(){const t={cssSelector:this.cssSelector,textNodeIndex:this.textNodeIndex};return this.charOffset!==void 0&&(t.charOffset=this.charOffset),t}}class Ut{constructor(t){this.start=t.start,this.end=t.end}static deserialize(t){if(!t)return;let e=ht.deserialize(t.start);if(e)return new Ut({start:e,end:ht.deserialize(t.end)})}serialize(){const t={start:this.start.serialize()};return this.end&&(t.end=this.end.serialize()),t}}I.prototype.getCssSelector=function(){return this.otherLocations?.get("cssSelector")},I.prototype.getPartialCfi=function(){return this.otherLocations?.get("partialCfi")},I.prototype.getDomRange=function(){return Ut.deserialize(this.otherLocations?.get("domRange"))},I.prototype.fragmentParameters=function(){return new Map(this.fragments.map(s=>s.startsWith("#")?s.slice(1):s).join("&").split("&").filter(s=>!s.startsWith("#")).map(s=>s.split("=")).filter(s=>s.length===2).map(s=>[s[0].trim().toLowerCase(),s[1].trim()]))},I.prototype.htmlId=function(){if(!this.fragments.length)return;let s=this.fragments.find(t=>t.length&&!t.includes("="));if(!s){const t=this.fragmentParameters();t.has("id")?s=t.get("id"):t.has("name")&&(s=t.get("name"))}return s?.startsWith("#")?s.slice(1):s},I.prototype.page=function(){const s=parseInt(this.fragmentParameters().get("page"));if(!isNaN(s)&&s>=0)return s},I.prototype.time=function(){const s=parseInt(this.fragmentParameters().get("t"));if(!isNaN(s))return s},I.prototype.space=function(){const s=this.fragmentParameters();if(!s.has("xywh"))return;const t=s.get("xywh").split(",").map(e=>parseInt(e));if(t.length===4&&!t.some(isNaN))return t};class Mt{constructor(t){this.currency=t.currency,this.value=t.value}static deserialize(t){if(!t)return;let e=t.currency;if(!(e&&typeof e=="string"&&e.length>0))return;let i=N(t.value);if(i!==void 0)return new Mt({currency:e,value:i})}serialize(){return{currency:this.currency,value:this.value}}}class et{constructor(t){this.type=t.type,this.children=t.children}static deserialize(t){if(t&&t.type)return new et({type:t.type,children:et.deserializeArray(t.children)})}static deserializeArray(t){if(Array.isArray(t))return t.map(e=>et.deserialize(e)).filter(e=>e!==void 0)}serialize(){const t={type:this.type};return this.children&&(t.children=this.children.map(e=>e.serialize())),t}}class Bt{constructor(t){this.total=t.total,this.position=t.position}static deserialize(t){if(t)return new Bt({total:N(t.total),position:N(t.position)})}serialize(){const t={};return this.total!==void 0&&(t.total=this.total),this.position!==void 0&&(t.position=this.position),t}}class Wt{constructor(t){this.total=t.total,this.available=t.available}static deserialize(t){if(t)return new Wt({total:N(t.total),available:N(t.available)})}serialize(){const t={};return this.total!==void 0&&(t.total=this.total),this.available!==void 0&&(t.available=this.available),t}}var Ne=(s=>(s.available="available",s.reserved="reserved",s.ready="ready",s))(Ne||{});class Gt{constructor(t){this.state=t.state,this.since=t.since,this.until=t.until}static deserialize(t){if(t&&t.state)return new Gt({state:t.state,since:st(t.since),until:st(t.until)})}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}}k.prototype.getNumberOfItems=function(){return N(this.otherProperties.numberOfItems)},k.prototype.getPrice=function(){return Mt.deserialize(this.otherProperties.price)},k.prototype.getIndirectAcquisitions=function(){const s=this.otherProperties.indirectAcquisition;if(s&&Array.isArray(s))return s.map(t=>et.deserialize(t)).filter(t=>t!==void 0)},k.prototype.getHolds=function(){return Bt.deserialize(this.otherProperties.holds)},k.prototype.getCopies=function(){return Wt.deserialize(this.otherProperties.copies)},k.prototype.getAvailability=function(){return Gt.deserialize(this.otherProperties.availability)},k.prototype.getAuthenticate=function(){return M.deserialize(this.otherProperties.authenticate)},$.prototype.getImages=function(){return this.linksWithRole("images")};class zi{text(t=`
3
- `){return this.elements().map(e=>e?.text).filter(e=>e!==void 0&&e.length>0).join(t)}elements(){const t=[],e=this.iterator();for(;e.hasNext();)t.push(e.next());return t}}class Qt{constructor(t,e){this.key=t,this.value=e}}var Ht=(s=>(s.ACCESSIBILITY_LABEL="accessibilityLabel",s.LANGUAGE="language",s))(Ht||{});class jt{constructor(t=[]){this._attributes=t}get language(){return this.attribute("language")}get accessibilityLabel(){return this.attribute("accessibilityLabel")}attribute(t){return this._attributes.find(e=>e.key===t)?.value}attributes(t){return this._attributes.filter(e=>e.key===t).map(e=>e.value)}}class te extends jt{constructor(t,e=[]){super(e),this.locator=t}}class dt extends te{get text(){return this.accessibilityLabel}}class Le extends dt{constructor(t,e,i=[]){super(t,i),this.embeddedLink=e}}class xe extends dt{constructor(t,e,i=[]){super(t,i),this.embeddedLink=e}}class Oe extends dt{constructor(t,e,i,n=[]){super(t,n),this.embeddedLink=e,this.caption=i}get text(){return(this.caption?.length||0)>0?this.caption:super.text}}class ee extends jt{constructor(t,e,i=[]){super(i),this.locator=t,this.text=e}}class Ft extends dt{constructor(t,e,i,n=[]){super(t,n),this.role=e,this.segments=i}get text(){return this.segments.map(t=>t.text).join("")}}class ze{constructor(t){this.level=t}get role(){return`heading-${this.level}`}}const Ce={role:"body"},Re={role:"footnote"};class Pe{constructor(t,e){this.referenceUrl=t,this.referenceTitle=e,this.role="quote"}}class Ci{constructor(t,e,i=50,n=r=>Ee(r,e)){this.defaultLanguage=t,this.contextSnippetLength=i,this.textTokenizerFactory=n}tokenize(t){return t instanceof Ft?[new Ft(t.locator,t.role,t.segments.map(e=>this.tokenizeSegment(e)).flat())]:[t]}tokenizeSegment(t){return this.textTokenizerFactory(t.language??this.defaultLanguage).tokenize(t.text).map(e=>new ee(new D({href:t.locator.href,type:t.locator.type,title:t.locator.title,locations:t.locator.locations,text:this.extractTextContextIn(t.text,e)}),t.text.substring(e[0],e[1]),t._attributes))}extractTextContextIn(t,e){const i=t.substring(e[1],e[1]+this.contextSnippetLength),n=t.substring(e[0]-this.contextSnippetLength,e[0]);return new Q({after:i.length>0?i:void 0,before:n.length>0?n:void 0,highlight:t.substring(e[0],e[1])})}}class it extends Error{constructor(t){super(t)}}class Vt{async nextOrNull(){return await this.hasNext()?this.next():null}async previousOrNull(){return await this.hasPrevious()?this.previous():null}}let Ri=class{constructor(t,e){this.element=t,this.direction=e}};class Pi extends Vt{constructor(t,e,i){super(),this.publication=t,this.startLocator=e,this.resourceContentIteratorFactories=i,this._currentIterator=null,this.currentElement=null}async hasPrevious(){return this.currentElement=await this.nextIn(-1),this.currentElement!==null}previous(){if(this.currentElement?.direction!==-1)throw new it("Called previous() without a successful call to hasPrevious() first");return this.currentElement.element}async hasNext(){return this.currentElement=await this.nextIn(1),this.currentElement!==null}next(){if(this.currentElement?.direction!==1)throw new it("Called next() without a successful call to hasNext() first");return this.currentElement.element}async nextIn(t){const e=this.currentIterator;if(!e)return null;const i=await e.nextContentIn(t);if(!i){const n=this.nextIteratorIn(t,e.index);return n?(this._currentIterator=n,this.nextIn(t)):null}return new Ri(i,t)}get currentIterator(){return this._currentIterator||(this._currentIterator=this.initialIterator()),this._currentIterator}initialIterator(){const t=this.startLocator?this.publication.readingOrder.findIndexWithHref(this.startLocator.href):0,e=this.startLocator||0;return this.loadIteratorAt(t,e)??this.nextIteratorIn(1,t)}nextIteratorIn(t,e){const i=e+t;if(i<0||i>=this.publication.manifest.readingOrder.items.length)return null;const n=t===1?0:1;return this.loadIteratorAt(i,n)??this.nextIteratorIn(t,i)}loadIteratorAt(t,e){const i=this.publication.readingOrder.items[t],n=typeof e=="number"?this.publication.manifest.locatorFromLink(i)?.copyWithLocations({progression:e}):e;if(!n)return null;const r=this.publication.get(i);for(const a of this.resourceContentIteratorFactories)a(r,n);return null}}class Yt extends te{constructor(t,e,i=[]){super(t,i),this.element=e}get text(){return this.element.text}}class ke{constructor(t,e){this.element=t,this.direction=e}}class ki extends Vt{constructor(t,e){super(),this.pageContent=t,this.startLocator=e,this.pageContentFiltered=[],this.currentElement=null,this.currentProgression=0,this.currentElementIndex=0;const i=this.pageContent.filter(n=>n?.str!==" "&&n?.str!=="");if(this.pageContentFiltered=i.map(n=>new Yt(n.locator,{index:i.indexOf(n),text:n.str,readingDirection:n.dir})),this.startLocator&&(this.currentProgression=this.startLocator?.locations?.progression||0,this.updateElementIndex()),this.pageContentFiltered.length>0){const n=this.currentElementIndex;(n||n===0)&&(this.currentElement=new ke(this.pageContentFiltered[n],1))}}current(){return this.currentElement?this.currentElement.element:null}async hasPrevious(){return this.currentElement?.direction,this.nextIn(-1)!==null}previous(){if(!this.currentElement)throw new it("Called next() without a successful call to hasNext() first");if(this.currentElement=this.nextIn(-1),this.currentElementIndex&&this.currentElementIndex>0){const t=this.currentElementIndex-1;this.currentProgression=t/this.pageContentFiltered.length*100,this.currentElementIndex=t}return this.currentElement?this.currentElement.element:new Yt(new D({href:"",type:""}),{index:-1,text:""})}async hasNext(){return this.currentElement?.direction,this.nextIn(1)!==null}next(){this.currentElement=this.nextIn(1);const t=this.currentElementIndex;if(t!==null&&t>=0&&t<this.pageContentFiltered.length-1){const e=t+1;this.currentProgression=e/this.pageContentFiltered.length*100,this.currentElementIndex=e}return this.currentElement?this.currentElement.element:new Yt(new D({href:"",type:""}),{index:-1,text:""})}nextIn(t){const e=this.currentElementIndex;if(e===null||e===this.pageContentFiltered.length-1&&t===1||e===0&&t===-1)return null;const i=this.pageContentFiltered[e+t];return i?new ke(i,t):null}updateElementIndex(){return this.currentProgression===0?0:this.currentProgression<0||this.currentProgression>=100?null:Math.floor(this.currentProgression*this.pageContentFiltered.length/100)}}const Di=["OBJECT","BASE","FONT","TT","I","B","U","BIG","SMALL","EM","STRONG","DFN","CODE","SAMP","KBD","VAR","CITE","ABBR","TIME","ACRONYM","MARK","RUBY","RT","RP","RTC","A","IMG","BR","WBR","MAP","Q","SUB","SUP","BDO","IFRAME","EMBED","SPAN","INPUT","SELECT","TEXTAREA","LABEL","BUTTON","OPTGROUP","OPTION","LEGEND","DATALIST","KEYGEN","OUTPUT","PROGRESS","METER","AREA","PARAM","SOURCE","TRACK","SUMMARY","COMMAND","DEVICE","BASEFONT","BGSOUND","MENUITEM","DATA","BDI","S","STRIKE","NOBR","RB"];function De(s){return Di.includes(s.nodeName.toUpperCase())}function ie(s,t){const e=s.getAttribute("src");if(!e?.length)return null;try{return new URL(e,t).toString()}catch{return e}}const pt="[\\s\\u0085\\u00A0\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]",Ui=new RegExp(`^${pt}+$`,"g"),Mi=new RegExp(`^${pt}+|${pt}+$/g`,"g"),Ue=new RegExp(`^${pt}+`,"g"),Me=new RegExp(`${pt}+$`,"g"),$t=s=>s?.length?Ui.test(s):!0,Be=s=>s.replace(Mi,""),Bi=s=>s.replace(Ue,""),Wi=s=>s.replace(Me,""),We=(s,t="")=>new Q({before:t+(Ue.exec(s)?.[0]??""),highlight:Be(s),after:Me.exec(s)?.[0]??""});function Gi(s){for(;s;){let t=s.getAttribute("lang")||s.getAttributeNS("http://www.w3.org/1999/xhtml","lang")||s.getAttributeNS("http://www.w3.org/XML/1998/namespace","lang");if(t)return t;s=s.parentElement}return null}function Hi(s,t){const e=s.length>0&&s[s.length-1]===" ";let i=!1,n=!1;for(let r=0;r<t.length;r++)if($t(t[r])){if(e&&!n||i)continue;s+=" ",i=!0}else{const a=t.charCodeAt(r);a!==8203&&a!==173&&(s+=t[r],i=!1,n=!0)}return s}function se(s){return typeof s=="object"&&s!==null&&s.nodeType===Node.ELEMENT_NODE}const qt={NONE:"",DESCENDANT:" ",CHILD:" > "},T={id:"id",class:"class",tag:"tag",attribute:"attribute",nthchild:"nthchild",nthoftype:"nthoftype"};function Fi(s,t){return Object.values(s).includes(t)}const Vi="CssSelectorGenerator";function Xt(s="unknown problem",...t){console.warn(`${Vi}: ${s}`,...t)}const Yi={selectors:[T.id,T.class,T.tag,T.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY};function $i(s){return Array.isArray(s)?s.filter(t=>Fi(T,t)):[]}function Ge(s){return s instanceof RegExp}function qi(s){return["string","function"].includes(typeof s)||Ge(s)}function He(s){return Array.isArray(s)?s.filter(qi):[]}function Xi(s){return s instanceof Node}function Fe(s){const t=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return Xi(s)&&t.includes(s.nodeType)}function Ve(s,t){if(Fe(s))return s.contains(t)||Xt("element root mismatch","Provided root does not contain the element. This will most likely result in producing a fallback selector using element's real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended."),s;const e=t.getRootNode({composed:!1});return Fe(e)?(e!==document&&Xt("shadow root inferred","You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."),e):ae(t)}function Ye(s){return typeof s=="number"?s:Number.POSITIVE_INFINITY}function Ki(s,t={}){const e=Object.assign(Object.assign({},Yi),t);return{selectors:$i(e.selectors),whitelist:He(e.whitelist),blacklist:He(e.blacklist),root:Ve(e.root,s),combineWithinSelector:!!e.combineWithinSelector,combineBetweenSelectors:!!e.combineBetweenSelectors,includeTag:!!e.includeTag,maxCombinations:Ye(e.maxCombinations),maxCandidates:Ye(e.maxCandidates)}}function ft(s=[]){const[t=[],...e]=s;return e.length===0?t:e.reduce((i,n)=>i.filter(r=>n.includes(r)),t)}function $e(s){return[].concat(...s)}function Ji(s){return s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".+")}function ne(s){const t=s.map(e=>{if(Ge(e))return i=>e.test(i);if(typeof e=="function")return i=>{const n=e(i);return typeof n!="boolean"?(Xt("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 i=new RegExp("^"+Ji(e)+"$");return n=>i.test(n)}return Xt("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(i=>i(e))}function re(s,t,e){const i=Array.from(Ve(e,s[0]).querySelectorAll(t));return i.length===s.length&&s.every(n=>i.includes(n))}function qe(s,t){t=t??ae(s);const e=[];let i=s;for(;se(i)&&i!==t;)e.push(i),i=i.parentElement;return e}function Zi(s,t){return ft(s.map(e=>qe(e,t)))}function ae(s){return s.ownerDocument.querySelector(":root")}const Xe=", ",_i=new RegExp(["^$","\\s"].join("|")),Qi=new RegExp(["^$"].join("|")),Ke=[T.nthoftype,T.tag,T.id,T.class,T.attribute,T.nthchild],ji=ne(["class","id","ng-*"]);function ts({name:s}){return`[${s}]`}function es({name:s,value:t}){return`[${s}='${t}']`}function is({nodeName:s,nodeValue:t},e){const i=e.tagName.toLowerCase();return["input","option"].includes(i)&&s==="value"||s==="src"&&t?.startsWith("data:")?!1:!ji(s)}function ss({nodeName:s,nodeValue:t}){return{name:mt(s),value:mt(t??void 0)}}function Je(s){const t=Array.from(s.attributes).filter(e=>is(e,s)).map(ss);return[...t.map(ts),...t.map(es)]}function ns(s){const t=s.map(Je);return ft(t)}function Ze(s){var t;return((t=s.getAttribute("class"))!==null&&t!==void 0?t:"").trim().split(/\s+/).filter(e=>!Qi.test(e)).map(e=>`.${mt(e)}`)}function rs(s){const t=s.map(Ze);return ft(t)}function _e(s){var t;const e=(t=s.getAttribute("id"))!==null&&t!==void 0?t:"",i=`#${mt(e)}`,n=s.getRootNode({composed:!1});return!_i.test(e)&&re([s],i,n)?[i]:[]}function as(s){return s.length===0||s.length>1?[]:_e(s[0])}function Qe(s){const t=s.parentNode;if(t){const i=Array.from(t.childNodes).filter(se).indexOf(s);if(i>-1)return[`:nth-child(${String(i+1)})`]}return[]}function os(s){return ft(s.map(Qe))}function je(s){return[mt(s.tagName.toLowerCase())]}function ti(s){const t=[...new Set($e(s.map(je)))];return t.length===0||t.length>1?[]:[t[0]]}function ei(s){const t=ti([s])[0],e=s.parentElement;if(e){const n=Array.from(e.children).filter(r=>r.tagName.toLowerCase()===t).indexOf(s);if(n>-1)return[`${t}:nth-of-type(${String(n+1)})`]}return[]}function cs(s){return ft(s.map(ei))}function*ls(s=[],{maxResults:t=Number.POSITIVE_INFINITY}={}){let e=0,i=oe(1);for(;i.length<=s.length&&e<t;)e+=1,yield i.map(r=>s[r]),i=us(i,s.length-1)}function ii(s=[],{maxResults:t=Number.POSITIVE_INFINITY}={}){return Array.from(ls(s,{maxResults:t}))}function us(s=[],t=0){const e=s.length;if(e===0)return[];const i=[...s];i[e-1]+=1;for(let n=e-1;n>=0;n--)if(i[n]>t){if(n===0)return oe(e+1);i[n-1]++,i[n]=i[n-1]+1}return i[e-1]>t?oe(e+1):i}function oe(s=1){return Array.from(Array(s).keys())}function hs(s={}){let t=[];return Object.entries(s).forEach(([e,i])=>{t=i.flatMap(n=>t.length===0?[{[e]:n}]:t.map(r=>Object.assign(Object.assign({},r),{[e]:n})))}),t}const ds="3a".toUpperCase(),ps=/[ !"#$%&'()\[\]{|}<>*+,./;=?@^`~\\]/;function mt(s=""){return CSS?CSS.escape(s):fs(s)}function fs(s=""){return s.split("").map(t=>t===":"?`\\${ds} `:ps.test(t)?`\\${t}`:escape(t).replace(/%/g,"\\")).join("")}const ms={tag:ti,id:as,class:rs,attribute:ns,nthchild:os,nthoftype:cs},gs={tag:je,id:_e,class:Ze,attribute:Je,nthchild:Qe,nthoftype:ei};function bs(s,t){return gs[t](s)}function vs(s,t){const e=ms[t];return e(s)}function As(s=[],t,e){return s.filter(i=>e(i)||!t(i))}function ys(s=[],t){return s.sort((e,i)=>{const n=t(e),r=t(i);return n&&!r?-1:!n&&r?1:0})}function ws(s,t,e){const i=Ss(s,e),n=Ns(i,e),r=$e(n);return[...new Set(r)]}function Ss(s,t){const{blacklist:e,whitelist:i,combineWithinSelector:n,maxCombinations:r}=t,a=ne(e),c=ne(i),d=(m,g)=>{const h=vs(s,g),b=As(h,a,c),y=ys(b,c);return m[g]=n?ii(y,{maxResults:r}):y.map(U=>[U]),m};return Es(t).reduce(d,{})}function Es(s){const{selectors:t,includeTag:e}=s,i=[...t];return e&&!i.includes("tag")&&i.push("tag"),i}function Ts(s){return s.includes(T.tag)||s.includes(T.nthoftype)?[...s]:[...s,T.tag]}function Is(s){const{selectors:t,combineBetweenSelectors:e,includeTag:i,maxCandidates:n}=s,r=e?ii(t,{maxResults:n}):t.map(a=>[a]);return i?r.map(Ts):r}function Ns(s,t){return Is(t).map(e=>Ls(e,s)).filter(e=>e.length>0)}function Ls(s,t){const e={};return s.forEach(n=>{const r=t[n];r&&r.length>0&&(e[n]=r)}),hs(e).map(Os)}function xs(s,t){return t[s]?t[s].join(""):""}function Os(s={}){const t=[...Ke];return s[T.tag]&&s[T.nthoftype]&&t.splice(t.indexOf(T.tag),1),t.map(e=>xs(e,s)).join("")}function zs(s,t){return[...s.map(e=>t+qt.DESCENDANT+e),...s.map(e=>t+qt.CHILD+e)]}function Cs(s,t){return t===""?s:zs(s,t)}function Rs(s,t,e="",i){const n=ws(s,t,i),r=Cs(n,e);for(const a of r)if(re(s,a,t))return a;return null}function Ps(s,t,e="",i){if(s.length===0)return null;const n=[s.length>1?s:[],...Zi(s,t).map(r=>[r])];for(const r of n){const a=Rs(r,t,e,i);if(a)return{foundElements:r,selector:a}}return null}function ks(s){(s instanceof NodeList||s instanceof HTMLCollection)&&(s=Array.from(s));const t=(Array.isArray(s)?s:[s]).filter(se);return[...new Set(t)]}function Ds(s){return{value:s,include:!1}}function Us(s,t,e=qt.NONE){const i={};return t.forEach(n=>{Reflect.set(i,n,bs(s,n).map(Ds))}),{element:s,operator:e,selectors:i}}function Ms({selectors:s,operator:t}){let e=[...Ke];s[T.tag]&&s[T.nthoftype]&&(e=e.filter(n=>n!==T.tag));let i="";return e.forEach(n=>{var r;((r=s[n])!==null&&r!==void 0?r:[]).forEach(({value:c,include:d})=>{d&&(i+=c)})}),t+i}function Bs(s){return[":root",...qe(s).reverse().map(i=>{const n=Us(i,[T.nthchild],qt.CHILD);return n.selectors.nthchild.forEach(r=>{r.include=!0}),n}).map(Ms)].join("")}function Ws(s){return s.map(Bs).join(Xe)}function si(s,t={}){var e;const i=ks(s),n=Ki(i[0],t),r=(e=n.root)!==null&&e!==void 0?e:ae(i[0]);let a="",c=r;function d(){return Ps(i,c,a,n)}let m=d();for(;m;){const{foundElements:g,selector:h}=m;if(re(i,h,r))return h;c=g[0],a=h,m=d()}return i.length>1?i.map(g=>si(g,n)).join(Xe):Ws(i)}class Gs extends Vt{constructor(t,e,i=50){super(),this.resource=t,this.locator=e,this.beforeMaxLength=i,this.currentElement=null,this.currentIndex=null,this.parsedElementRecipes=null,this.parser=null}async hasPrevious(){if(this.currentElement?.delta===-1)return!0;const t=await this.elements(),e=(this.currentIndex??t.startIndex)-1,i=t.elements.at(e);return i?(this.currentIndex=e,this.currentElement={delta:-1,element:this.parser.executeRecipe(i)},!0):!1}previous(){if(!this.currentElement||this.currentElement.delta!==-1)throw new it("Called previous() without a successful call to hasPrevious() first");const t=this.currentElement.element;return this.currentElement=null,t}async hasNext(){if(this.currentElement?.delta===1)return!0;const t=await this.elements(),e=(this.currentIndex??t.startIndex-1)+1,i=t.elements.at(e);return i?(this.currentIndex=e,this.currentElement={delta:1,element:this.parser.executeRecipe(i)},!0):!1}next(){if(!this.currentElement||this.currentElement.delta!==1)throw new it("Called next() without a successful call to hasNext() first");const t=this.currentElement.element;return this.currentElement=null,t}async elements(){return this.parsedElementRecipes??=await this.parseElements(),this.parsedElementRecipes}async parseElements(){const t=await this.resource.readAsString(),e=new DOMParser().parseFromString(t,this.locator.type);return this.parser=new Fs(e,this.locator,this.locator.locations.getCssSelector()?e.querySelector(this.locator.locations.getCssSelector()):null,this.beforeMaxLength),Hs(this.parser,e.body),this.parser.result()}}function Hs(s,t){let e=t,i=0;for(;e!=null;)if(s.head(e,i),e.firstChild!=null)e=e.firstChild,i++;else{for(;e?.nextSibling==null&&i>0;)e&&s.tail(e,i),e=e?.parentNode||null,i--;if(e&&s.tail(e,i),e===t)break;e=e?.nextSibling||null}}class Fs{constructor(t,e,i,n){this.doc=t,this.baseLocator=e,this.startElement=i,this.beforeMaxLength=n,this.elementRecipes=[],this.startIndex=0,this.segmentRecipesAcc=[],this.textAcc="",this.wholeRawTextAcc=null,this.elementRawTextAcc="",this.rawTextAcc="",this.currentLanguage=null,this.breadcrumbs=[],this.recipeCssSelectorCache=new WeakMap}result(){return{elements:this.elementRecipes,startIndex:this.baseLocator.locations.progression===1?this.elementRecipes.length:this.startIndex}}executeRecipe(t){const e=t.recipe.cssSelectorNode?this.cssSelector(t.recipe.cssSelectorNode):null;if(t.type===1){const i=t.recipe;return new Oe(new D({href:this.baseLocator.href,type:this.baseLocator.type,title:this.baseLocator.title,locations:new I(e?{otherLocations:new Map([["cssSelector",e]])}:{})}),new M({href:i.href}),i.caption,i.attributes)}else if(t.type===2||t.type===3){const i=new D({href:this.baseLocator.href,type:this.baseLocator.type,title:this.baseLocator.title,locations:new I(e?{otherLocations:new Map([["cssSelector",e]])}:{})}),n=t.recipe;return t.type===3?new xe(i,n.link):new Le(i,n.link)}else if(t.type===0){const i=t.recipe,n=i.segments.map(r=>{const a=r.cssSelectorNode?this.cssSelector(r.cssSelectorNode):null;return new ee(new D({href:this.baseLocator.href,type:this.baseLocator.type,title:this.baseLocator.title,text:We(r.text,this.wholeRawTextAcc?.substring(r.beforeRange[0],r.beforeRange[1])),locations:new I(a?{otherLocations:new Map([["cssSelector",a]])}:{})}),r.text,r.attributes)});return new Ft(new D({href:this.baseLocator.href,type:this.baseLocator.type,title:this.baseLocator.title,text:We(i.text,n.length&&n[0].locator.text?.before||""),locations:new I(e?{otherLocations:new Map([["cssSelector",e]])}:{})}),i.role,n)}else throw new Error("Unknown recipe type")}cssSelector(t){const e=t,i=this.recipeCssSelectorCache.get(e);if(i)return i;const n=new Map;let r=e;for(;r&&r!==this.doc.body;){for(let c=0;c<r.attributes.length;c++){const d=r.attributes[c];d.prefix&&(n.has(r)?n.set(r,n.get(r).concat([d])):n.set(r,[d]),r.attributes.removeNamedItem(d.name))}r=r.parentElement}const a=si(e,{root:this.doc});return n.forEach((c,d)=>c.forEach(m=>d.attributes.setNamedItem(m))),this.recipeCssSelectorCache.set(e,a),a}head(t,e){if(t.nodeType==Node.ELEMENT_NODE){const i=!De(t);i&&(this.flushText(),this.breadcrumbs.push(t));const n=t.nodeName.toUpperCase();if(n==="BR")this.flushText();else if(n==="IMG"||n==="AUDIO"||n==="VIDEO")if(this.flushText(),n==="IMG"){const r=t,a=ie(r,this.baseLocator.href);let c=r.getAttribute("alt");c?.length||(c=r.getAttribute("title")),a!=null&&this.elementRecipes.push({type:1,recipe:{href:a,caption:void 0,cssSelectorNode:t,attributes:c?.length?[new Qt(Ht.ACCESSIBILITY_LABEL,c)]:[]}})}else{const r=t,a=ie(r,this.baseLocator.href);let c;if(a!=null)c=new M({href:a});else{const d=[...r.getElementsByTagName("source")].map(m=>{const g=ie(m,this.baseLocator.href);return g?new M({href:g,type:m.getAttribute("type")||void 0}):null}).filter(m=>!!m);d.length>0&&(c=new M({href:d[0].href,type:d[0].type,alternates:d.length>1?new L(d.slice(1)):void 0}))}c&&(n==="AUDIO"?this.elementRecipes.push({type:2,recipe:{cssSelectorNode:t,link:c}}):n==="VIDEO"&&this.elementRecipes.push({type:3,recipe:{cssSelectorNode:t,link:c}}))}i&&this.flushText()}}tail(t,e){if(t.nodeType===Node.TEXT_NODE&&!$t(t.textContent)){const i=Gi(t.parentElement);this.currentLanguage!==i&&(this.flushSegment(),this.currentLanguage=i),this.rawTextAcc+=t.textContent,this.textAcc=Hi(this.textAcc,t.textContent)}else if(t.nodeType===Node.ELEMENT_NODE&&!De(t)){if(!this.breadcrumbs.length||this.breadcrumbs.at(-1)!==t)throw new Error("HTMLContentIterator: breadcrumbs mismatch");this.flushText(),this.breadcrumbs.pop()}}flushText(){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;this.segmentRecipesAcc[this.segmentRecipesAcc.length-1].text=Wi(this.segmentRecipesAcc[this.segmentRecipesAcc.length-1].text);let t=Ce;if(this.breadcrumbs.length>0){const e=this.breadcrumbs.at(-1);if(e.getAttributeNS("http://www.idpf.org/2007/ops","type")==="footnote")t=Re;else switch(e.nodeName.toUpperCase()){case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":t=new ze(parseInt(e.nodeName[1]));break;case"BLOCKQUOTE":case"Q":t=new Pe(e.getAttribute("cite")?.length?new URL(e.getAttribute("cite")):void 0,e.getAttribute("title")||void 0);break}}this.elementRecipes.push({type:0,recipe:{text:this.elementRawTextAcc,role:t,segments:[...this.segmentRecipesAcc],cssSelectorNode:this.breadcrumbs.at(-1)}}),this.elementRawTextAcc="",this.segmentRecipesAcc=[]}flushSegment(){let t=this.textAcc;const e=Be(t);if(!$t(e)){if(!this.segmentRecipesAcc.length){t=Bi(t);const i=t.length&&$t(t[t.length-1])?t[t.length-1]:"";t=e+i}this.segmentRecipesAcc.push({text:t,attributes:this.currentLanguage?[new Qt(Ht.LANGUAGE,this.currentLanguage)]:[],beforeRange:this.wholeRawTextAcc?[this.wholeRawTextAcc.length-this.beforeMaxLength,this.wholeRawTextAcc.length]:[0,0],cssSelectorNode:this.breadcrumbs.at(-1)})}this.rawTextAcc.length&&(this.wholeRawTextAcc=(this.wholeRawTextAcc||"")+this.rawTextAcc,this.elementRawTextAcc+=this.rawTextAcc),this.rawTextAcc="",this.textAcc=""}}class gt{constructor(t){this.title=t.title,this.numberOfItems=t.numberOfItems,this.otherMetadata=t.otherMetadata}static deserialize(t){if(!t)return;const e=new Map,i=new Set(["title","numberOfItems"]);return Object.entries(t).forEach(([n,r])=>{i.has(n)||e.set(n,r)}),new gt({title:B.deserialize(t.title),numberOfItems:X(t.numberOfItems),otherMetadata:e.size===0?void 0:e})}serialize(){const t={};return this.title&&(t.title=this.title.serialize()),this.numberOfItems!==void 0&&(t.numberOfItems=this.numberOfItems),this.otherMetadata&&this.otherMetadata.forEach((e,i)=>t[i]=e),t}}class ce{constructor(t){this.metadata=t.metadata??new gt({}),this.links=t.links??new L([]),this.locators=t.locators??[]}static deserialize(t){if(!t)return;let e,i=t.locators;return i&&Array.isArray(i)&&(e=i.map(n=>D.deserialize(n)).filter(n=>n!==void 0)),new ce({metadata:gt.deserialize(t.metadata),links:L.deserialize(t.links),locators:e})}serialize(){const t={};if(this.metadata){let e=this.metadata.serialize();e&&Object.keys(e).length>0&&(t.metadata=e)}return this.links&&this.links.items.length>0&&(t.links=this.links.serialize()),this.locators&&(t.locators=this.locators.map(e=>e.serialize())),t}}class W{constructor(t){this.metadata=t.metadata,this.links=t.links,this.subcollections=t.subcollections}static deserialize(t){if(!t)return;let e,i,n;if(Array.isArray(t))e=L.deserialize(t);else if(typeof t=="object")e=L.deserialize(t.links),i=new Map,t.metadata&&Object.entries(t.metadata).forEach(([r,a])=>{i?.set(r,a)}),n=W.deserializeCollections(t);else return;if(!(!e||e.items.length===0))return new W({metadata:i?.size?i:void 0,links:e,subcollections:n?.size?n:void 0})}static deserializeCollections(t){if(!t)return;const e=new Map;return Object.entries(t).forEach(([i,n])=>{if(i!=="links"&&i!=="metadata"){const r=W.deserialize(n);if(r){const a=new Array;a.push(r),e.set(i,a)}else if(Array.isArray(n)){const a=n.map(c=>W.deserialize(c)).filter(c=>c!==void 0);e.set(i,a)}}}),e.size?e:void 0}serialize(){const t={};return this.metadata&&(t.metadata={},this.metadata.forEach((e,i)=>t.metadata[i]=e)),this.links.items.length&&(t.links=this.links.serialize()),W.serializeCollection(t,this.subcollections),t}static serializeCollection(t,e){e&&e.size>0&&e.forEach((i,n)=>{i.length===1?t[n]=i[0].serialize():t[n]=i.map(r=>r.serialize())})}}class le{constructor(t){this.context=t.context,this.metadata=t.metadata,this.links=t.links,this.readingOrder=t.readingOrder,this.resources=t.resources,this.toc=t.toc,this.subcollections=t.subcollections}static deserialize(t){if(!t)return;const e=ct.deserialize(t.metadata);if(!e)return;const i=L.deserialize(t.links);if(!i)return;const n=L.deserialize(t.readingOrder?t.readingOrder:t.spine);if(n)return new le({context:V(t["@context"]),metadata:e,links:i,readingOrder:n,resources:L.deserialize(t.resources),toc:L.deserialize(t.toc),subcollections:W.deserializeCollections({sub:t.sub})})}serialize(){const t={};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()),W.serializeCollection(t,this.subcollections),t}linkWithRel(t){const e=new Array;e.push(this.readingOrder),this.resources&&e.push(this.resources),e.push(this.links);let i;for(const n of e)if(i=n.findWithRel(t),i!==void 0)return i;return i}linksWithRel(t){const e=[];return e.push(this.readingOrder.filterByRel(t)),this.resources&&e.push(this.resources.filterByRel(t)),e.push(this.links.filterByRel(t)),e.reduce((i,n)=>i.concat(n),[])}locatorFromLink(t){const e=t.href.split("#"),i=e.length==2?e[0]:t.href,n=this.linkWithHref(i);if(!n)return;const r=n.type;if(!r)return;const a=e.length==2?e[1]:void 0;return new D({href:i,type:r,title:n.title??t.title,locations:new I({fragments:a?[a]:void 0,progression:a?void 0:0})})}linkWithHref(t){const e=c=>{let d;for(const g of c)if(d=g.findWithHref(t),d!==void 0)return d;const m=new Array;return c.forEach(g=>{const h=[];for(const b of g.items)b.alternates&&h.push(b.alternates),b.children&&h.push(b.children);m.push(...h)}),m.length>0&&(d=e(m)),d},i=[];i.push(this.readingOrder),this.resources&&i.push(this.resources),i.push(this.links);const n=e(i);if(n!==void 0)return n;const r=t.split(/[#]/);if(r.length<2)return;const a=r[0];return this.linkWithHref(a)}get baseURL(){const t=this.links.items.find(e=>e.rels&&e.rels.has("self"));if(t){let e=t.href;if(e){const i=e.lastIndexOf("/"),n=i===-1?void 0:e.substring(i+1);e=e.replace(new RegExp("/?$query$"),""),e=e.replace(new RegExp("//$"),""),n&&(e=e.replace(new RegExp(n+"$"),""))}return e}}setSelfLink(t){this.links.items=this.links.items.filter(e=>e.rels===void 0||!e.rels?.has("self")),this.links.items.push(new M({href:t,type:l.READIUM_WEBPUB_MANIFEST.string,rels:new Set(["self"])}))}}o.AccessMode=z,o.Accessibility=F,o.AccessibilityMetadataDisplayGuide=ci,o.AccessibilityProfile=vt,o.AccessibilitySummary=Ot,o.Acquisition=et,o.AdditionalInformation=It,o.AltIdentifier=K,o.Attribute=Qt,o.AttributeKeys=Ht,o.AttributesHolder=jt,o.AudioElement=Le,o.Availability=Gt,o.AvailabilityStatus=Ne,o.BelongsTo=j,o.Body=Ce,o.Certification=At,o.Conformance=Lt,o.Content=zi,o.ContentElement=te,o.Contributor=at,o.Contributors=x,o.Copies=Wt,o.DefaultTextContentTokenizer=Ee,o.DomRange=Ut,o.DomRangePoint=ht,o.EmptyFetcher=Z,o.Encryption=zt,o.Exemption=wt,o.Feature=A,o.Footnote=Re,o.GuidedNavigationDocument=Dt,o.GuidedNavigationObject=J,o.GuidedNavigationText=lt,o.HTMLResourceContentIterator=Gs,o.Hazard=P,o.HazardType=ge,o.Hazards=Nt,o.Heading=ze,o.Holds=Bt,o.HttpFetcher=ni,o.HttpResource=ue,o.IllegalStateError=it,o.ImageElement=Oe,o.IntlTextTokenizer=Te,o.Iterator=Vt,o.Layout=q,o.Legal=xt,o.Link=M,o.Links=L,o.Localization=f,o.LocalizedString=B,o.Locator=D,o.LocatorCollection=ce,o.LocatorCollectionMetadata=gt,o.LocatorLocations=I,o.LocatorText=Q,o.Manifest=le,o.MediaOverlay=Rt,o.MediaType=l,o.Metadata=ct,o.NaiveTextTokenizer=Ie,o.Navigation=Et,o.NonvisualReading=pe,o.NumberRange=ri,o.PDFContentElement=Yt,o.Page=Ct,o.PageContentIteratorPDF=ki,o.PrerecordedAudio=fe,o.Price=Mt,o.PrimaryAccessMode=yt,o.Profile=tt,o.Properties=k,o.Publication=$,o.PublicationCollection=W,o.PublicationContentIterator=Pi,o.ReadingProgression=Y,o.Resource=ai,o.RichContent=Tt,o.RichContentType=me,o.Subject=ot,o.Subjects=Pt,o.TDM=kt,o.TDMReservation=ve,o.TextContentTokenizer=Ci,o.TextElement=Ft,o.TextQuote=Pe,o.TextSegment=ee,o.TextUnit=Se,o.TextualElement=dt,o.URITemplate=rt,o.VideoElement=xe,o.VisualAdjustments=de,o.WaysOfReading=St,o.arrayfromJSON=be,o.arrayfromJSONorString=V,o.datefromJSON=st,o.leadingPage=li,o.numberfromJSON=X,o.positiveNumberfromJSON=N,o.setToArray=nt,o.speakableToken=_t,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(c,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(c=typeof globalThis<"u"?globalThis:c||self,Z(c.shared={}))})(this,(function(c){"use strict";class Z{close(){}links(){return[]}get(t){throw Error("This is an empty fetcher")}}class si{constructor(t,e){this.client=t||window.fetch.bind(window),this.baseUrl=e}links(){return[]}get(t){const e=t.toURL(this.baseUrl);if(e===void 0)throw Error(`Invalid HREF: ${t.href}`);return new ue(this.client,t,e)}close(){}}class ue{constructor(t,e,i){this.client=t||window.fetch.bind(window),this._link=e,this.url=i}async headResponse(){if(this._headResponse)return this._headResponse;const t=await this.client(this.url,{method:"HEAD"});if(!t.ok)throw new Error(`http HEAD request for ${this.url} failed with HTTP status code ${t.status}`);return this._headResponse=t,t}close(){}async link(){return this._link}async read(t){if(t)throw new Error("http read range not implemented!");const e=await this.client(this.url);if(!e.ok)throw new Error(`http GET request for ${this.url} failed with HTTP status code ${e.status}`);return new Uint8Array(await e.arrayBuffer())}async length(){const e=(await this.headResponse()).headers.get("content-length");if(e===null||e==="")throw new Error("length for resource unavailable");return parseInt(e)}async readAsJSON(){const t=await this.client(this.url);if(!t.ok)throw new Error(`http GET request for ${this.url} failed with HTTP status code ${t.status}`);return await t.json()}async readAsString(){const t=await this.client(this.url);if(!t.ok)throw new Error(`http GET request for ${this.url} failed with HTTP status code ${t.status}`);return await t.text()}async readAsXML(){const t=await this.client(this.url);if(!t.ok)throw new Error(`http GET request for ${this.url} failed with HTTP status code ${t.status}`);return new DOMParser().parseFromString(await t.text(),"application/xml")}}class ni{constructor(t,e){this.start=t,this.endInclusive=e}}class ri{readAsString(){return this.read().then(t=>t===void 0?t:new TextDecoder().decode(t))}readAsJSON(){return this.readAsString().then(t=>t===void 0?t:JSON.parse(t))}readAsXML(){return this.readAsString().then(t=>t===void 0?t:new DOMParser().parseFromString(t,"text/xml"))}}class F{constructor(t={}){this.conformsTo=t.conformsTo??[],this.certification=t.certification??null,this.summary=t.summary??null,this.accessMode=t.accessMode??[],this.accessModeSufficient=t.accessModeSufficient??[],this.feature=t.feature??[],this.hazard=t.hazard??[],this.exemption=t.exemption??[]}static deserialize(t){if(!t||typeof t!="object")return;const e=t;return new F({conformsTo:e.conformsTo?e.conformsTo.map(i=>vt.deserialize(i)).filter(i=>i!==void 0):void 0,certification:e.certification?At.deserialize(e.certification):void 0,summary:e.summary,accessMode:e.accessMode?e.accessMode.map(i=>z.deserialize(i)).filter(i=>i!==void 0):void 0,accessModeSufficient:e.accessModeSufficient?e.accessModeSufficient.map(i=>yt.deserialize(i)).filter(i=>i!==void 0):void 0,feature:e.feature?e.feature.map(i=>A.deserialize(i)).filter(i=>i!==void 0):void 0,hazard:e.hazard?e.hazard.map(i=>P.deserialize(i)).filter(i=>i!==void 0):void 0,exemption:e.exemption?e.exemption.map(i=>wt.deserialize(i)).filter(i=>i!==void 0):void 0})}serialize(){const t={};return this.conformsTo?.length>0&&(t.conformsTo=this.conformsTo.map(e=>e.serialize())),this.certification!==void 0&&this.certification!==null&&(t.certification=this.certification.serialize()),this.summary!==void 0&&this.summary!==null&&(t.summary=this.summary),this.accessMode?.length>0&&(t.accessMode=this.accessMode.map(e=>e.serialize())),this.accessModeSufficient?.length>0&&(t.accessModeSufficient=this.accessModeSufficient.map(e=>e.serialize())),this.feature?.length>0&&(t.feature=this.feature.map(e=>e.serialize())),this.hazard?.length>0&&(t.hazard=this.hazard.map(e=>e.serialize())),this.exemption?.length>0&&(t.exemption=this.exemption.map(e=>e.serialize())),t}}const v=class v{constructor(t){this.uri=t}static deserialize(t){if(!(!t||typeof t!="string"))return new v(t)}serialize(){return this.uri}get isWCAGLevelA(){return this===v.EPUB_A11Y_10_WCAG_20_A||this===v.EPUB_A11Y_11_WCAG_20_A||this===v.EPUB_A11Y_11_WCAG_21_A||this===v.EPUB_A11Y_11_WCAG_22_A}get isWCAGLevelAA(){return this===v.EPUB_A11Y_10_WCAG_20_AA||this===v.EPUB_A11Y_11_WCAG_20_AA||this===v.EPUB_A11Y_11_WCAG_21_AA||this===v.EPUB_A11Y_11_WCAG_22_AA}get isWCAGLevelAAA(){return this===v.EPUB_A11Y_10_WCAG_20_AAA||this===v.EPUB_A11Y_11_WCAG_20_AAA||this===v.EPUB_A11Y_11_WCAG_21_AAA||this===v.EPUB_A11Y_11_WCAG_22_AAA}};v.EPUB_A11Y_10_WCAG_20_A=new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"),v.EPUB_A11Y_10_WCAG_20_AA=new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"),v.EPUB_A11Y_10_WCAG_20_AAA=new v("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"),v.EPUB_A11Y_11_WCAG_20_A=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"),v.EPUB_A11Y_11_WCAG_20_AA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"),v.EPUB_A11Y_11_WCAG_20_AAA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"),v.EPUB_A11Y_11_WCAG_21_A=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"),v.EPUB_A11Y_11_WCAG_21_AA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"),v.EPUB_A11Y_11_WCAG_21_AAA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"),v.EPUB_A11Y_11_WCAG_22_A=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"),v.EPUB_A11Y_11_WCAG_22_AA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"),v.EPUB_A11Y_11_WCAG_22_AAA=new v("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");let vt=v;class At{constructor(t=null,e=null,i=null){this.certifiedBy=t,this.credential=e,this.report=i}static deserialize(t){if(!(!t||typeof t!="object"))return new At(t.certifiedBy,t.credential,t.report)}serialize(){const t={};return this.certifiedBy&&(t.certifiedBy=this.certifiedBy),this.credential&&(t.credential=this.credential),this.report&&(t.report=this.report),t}}const w=class w{constructor(t){this.value=t}static deserialize(t){if(!(!t||typeof t!="string"))return new w(t)}serialize(){return this.value}};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");let z=w;const R=class R{constructor(t){if(typeof t=="string"){if(!R.VALID_MODES.has(t.toLowerCase()))return;this.value=t.toLowerCase()}else{const e=t.filter(i=>R.VALID_MODES.has(i.toLowerCase()));if(e.length===0)return;this.value=Array.from(new Set(e))}}static deserialize(t){if(!t)return;if(typeof t=="string")return new R(t);if(!Array.isArray(t))return;const e=t.filter(i=>i?R.VALID_MODES.has(i.toLowerCase()):!1);if(e.length!==0)return new R(e)}serialize(){return this.value}};R.VALID_MODES=new Set(["auditory","tactile","textual","visual"]),R.AUDITORY=new R("auditory"),R.TACTILE=new R("tactile"),R.TEXTUAL=new R("textual"),R.VISUAL=new R("visual");let yt=R;const u=class u{constructor(t){this.value=t}static deserialize(t){if(!(!t||typeof t!="string"))return new u(t)}serialize(){return this.value}};u.NONE=new u("none"),u.ANNOTATIONS=new u("annotations"),u.ARIA=new u("ARIA"),u.INDEX=new u("index"),u.PAGE_BREAK_MARKERS=new u("pageBreakMarkers"),u.PAGE_NAVIGATION=new u("pageNavigation"),u.PRINT_PAGE_NUMBERS=new u("printPageNumbers"),u.READING_ORDER=new u("readingOrder"),u.STRUCTURAL_NAVIGATION=new u("structuralNavigation"),u.TABLE_OF_CONTENTS=new u("tableOfContents"),u.TAGGED_PDF=new u("taggedPDF"),u.ALTERNATIVE_TEXT=new u("alternativeText"),u.AUDIO_DESCRIPTION=new u("audioDescription"),u.CAPTIONS=new u("captions"),u.CLOSED_CAPTIONS=new u("closedCaptions"),u.DESCRIBED_MATH=new u("describedMath"),u.LONG_DESCRIPTION=new u("longDescription"),u.OPEN_CAPTIONS=new u("openCaptions"),u.SIGN_LANGUAGE=new u("signLanguage"),u.TRANSCRIPT=new u("transcript"),u.DISPLAY_TRANSFORMABILITY=new u("displayTransformability"),u.SYNCHRONIZED_AUDIO_TEXT=new u("synchronizedAudioText"),u.TIMING_CONTROL=new u("timingControl"),u.UNLOCKED=new u("unlocked"),u.CHEM_ML=new u("ChemML"),u.LATEX=new u("latex"),u.LATEX_CHEMISTRY=new u("latex-chemistry"),u.MATH_ML=new u("MathML"),u.MATH_ML_CHEMISTRY=new u("MathML-chemistry"),u.TTS_MARKUP=new u("ttsMarkup"),u.HIGH_CONTRAST_AUDIO=new u("highContrastAudio"),u.HIGH_CONTRAST_DISPLAY=new u("highContrastDisplay"),u.LARGE_PRINT=new u("largePrint"),u.BRAILLE=new u("braille"),u.TACTILE_GRAPHIC=new u("tactileGraphic"),u.TACTILE_OBJECT=new u("tactileObject"),u.FULL_RUBY_ANNOTATIONS=new u("fullRubyAnnotations"),u.HORIZONTAL_WRITING=new u("horizontalWriting"),u.RUBY_ANNOTATIONS=new u("rubyAnnotations"),u.VERTICAL_WRITING=new u("verticalWriting"),u.WITH_ADDITIONAL_WORD_SEGMENTATION=new u("withAdditionalWordSegmentation"),u.WITHOUT_ADDITIONAL_WORD_SEGMENTATION=new u("withoutAdditionalWordSegmentation");let A=u;const S=class S{constructor(t){this.value=t}static deserialize(t){if(!(!t||typeof t!="string"))return new S(t)}serialize(){return this.value}};S.FLASHING=new S("flashing"),S.NO_FLASHING_HAZARD=new S("noFlashingHazard"),S.UNKNOWN_FLASHING_HAZARD=new S("unknownFlashingHazard"),S.MOTION_SIMULATION=new S("motionSimulation"),S.NO_MOTION_SIMULATION_HAZARD=new S("noMotionSimulationHazard"),S.UNKNOWN_MOTION_SIMULATION_HAZARD=new S("unknownMotionSimulationHazard"),S.SOUND=new S("sound"),S.NO_SOUND_HAZARD=new S("noSoundHazard"),S.UNKNOWN_SOUND_HAZARD=new S("unknownSoundHazard"),S.UNKNOWN=new S("unknown"),S.NONE=new S("none");let P=S;const E=class E{constructor(t){this.value=t}static deserialize(t){if(!(!t||typeof t!="string"))return new E(t)}serialize(){return this.value}};E.NONE=new E("none"),E.DOCUMENTED=new E("documented"),E.LEGAL=new E("legal"),E.TEMPORARY=new E("temporary"),E.TECHNICAL=new E("technical"),E.EAA_DISPROPORTIONATE_BURDEN=new E("eaa-disproportionate-burden"),E.EAA_FUNDAMENTAL_ALTERATION=new E("eaa-fundamental-alteration"),E.EAA_MICROENTERPRISE=new E("eaa-microenterprise"),E.EAA_TECHNICAL_IMPOSSIBILITY=new E("eaa-technical-impossibility"),E.EAA_TEMPORARY=new E("eaa-temporary");let wt=E;const he={"ways-of-reading":{title:"Ways of reading","nonvisual-reading":{"alt-text":{compact:"Has alternative text",descriptive:"Has alternative text descriptions for images"},"no-metadata":"No information about nonvisual reading is available",none:{compact:"Not readable in read aloud or dynamic braille",descriptive:"The content is not readable as read aloud speech or dynamic braille"},"not-fully":{compact:"Not fully readable in read aloud or dynamic braille",descriptive:"Not all of the content will be readable as read aloud speech or dynamic braille"},readable:{compact:"Readable in read aloud or dynamic braille",descriptive:"All content can be read as read aloud speech or dynamic braille"}},"prerecorded-audio":{complementary:{compact:"Prerecorded audio clips",descriptive:"Prerecorded audio clips are embedded in the content"},"no-metadata":"No information about prerecorded audio is available",only:{compact:"Prerecorded audio only",descriptive:"Audiobook with no text alternative"},synchronized:{compact:"Prerecorded audio synchronized with text",descriptive:"All the content is available as prerecorded audio synchronized with text"}},"visual-adjustments":{modifiable:{compact:"Appearance can be modified",descriptive:"Appearance of the text and page layout can be modified according to the capabilities of the reading system (font family and font size, spaces between paragraphs, sentences, words, and letters, as well as color of background and text)"},unknown:"No information about appearance modifiability is available",unmodifiable:{compact:"Appearance cannot be modified",descriptive:"Text and page layout cannot be modified as the reading experience is close to a print version, but reading systems can still provide zooming options"}}},conformance:{title:"Conformance","details-title":"Detailed conformance information",a:{compact:"This publication meets minimum accessibility standards",descriptive:"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level A standard"},aa:{compact:"This publication meets accepted accessibility standards",descriptive:"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AA standard"},aaa:{compact:"This publication exceeds accepted accessibility standards",descriptive:"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AAA standard"},no:"No information is available","unknown-standard":"Conformance to accepted standards for accessibility of this publication cannot be determined",certifier:"The publication was certified by ","certifier-credentials":"The certifier's credential is ",details:{"certification-info":"The publication was certified on ","certifier-report":"For more information refer to the certifier's report",claim:"This publication claims to meet","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Level A","level-aa":"Level AA","level-aaa":"Level AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.2"}}},navigation:{title:"Navigation",index:{compact:"Index",descriptive:"Index with links to referenced entries"},"no-metadata":"No information is available","page-navigation":{compact:"Go to page",descriptive:"Page list to go to pages from the print source version"},structural:{compact:"Headings",descriptive:"Elements such as headings, tables, etc for structured navigation"},toc:{compact:"Table of contents",descriptive:"Table of contents to all chapters of the text via links"}},"rich-content":{title:"Rich content","accessible-chemistry-as-latex":{compact:"Chemical formulas in LaTeX",descriptive:"Chemical formulas in accessible format (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"Chemical formulas in MathML",descriptive:"Chemical formulas in accessible format (MathML)"},"accessible-math-as-latex":{compact:"Math as LaTeX",descriptive:"Math formulas in accessible format (LaTeX)"},"math-as-mathml":{compact:"Math as MathML",descriptive:"Math formulas in accessible format (MathML)"},"accessible-math-described":"Text descriptions of math are provided","closed-captions":{compact:"Videos have closed captions",descriptive:"Videos included in publications have closed captions"},"extended-descriptions":"Information-rich images are described by extended descriptions","open-captions":{compact:"Videos have open captions",descriptive:"Videos included in publications have open captions"},transcript:"Transcript(s) provided",unknown:"No information is available"},hazards:{title:"Hazards",flashing:{compact:"Flashing content",descriptive:"The publication contains flashing content that can cause photosensitive seizures"},"flashing-none":{compact:"No flashing hazards",descriptive:"The publication does not contain flashing content that can cause photosensitive seizures"},"flashing-unknown":{compact:"Flashing hazards not known",descriptive:"The presence of flashing content that can cause photosensitive seizures could not be determined"},motion:{compact:"Motion simulation",descriptive:"The publication contains motion simulations that can cause motion sickness"},"motion-none":{compact:"No motion simulation hazards",descriptive:"The publication does not contain motion simulations that can cause motion sickness"},"motion-unknown":{compact:"Motion simulation hazards not known",descriptive:"The presence of motion simulations that can cause motion sickness could not be determined"},"no-metadata":"No information is available",none:{compact:"No hazards",descriptive:"The publication contains no hazards"},sound:{compact:"Sounds",descriptive:"The publication contains sounds that can cause sensitivity issues"},"sound-none":{compact:"No sound hazards",descriptive:"The publication does not contain sounds that can cause sensitivity issues"},"sound-unknown":{compact:"Sound hazards not known",descriptive:"The presence of sounds that can cause sensitivity issues could not be determined"},unknown:"The presence of hazards is unknown"},"accessibility-summary":{title:"Accessibility summary","no-metadata":"No information is available","publisher-contact":"For more information about the accessibility of this product, please contact the publisher: "},"legal-considerations":{title:"Legal considerations",exempt:{compact:"Claims an accessibility exemption in some jurisdictions",descriptive:"This publication claims an accessibility exemption in some jurisdictions"},"no-metadata":"No information is available"},"additional-accessibility-information":{title:"Additional accessibility information",aria:{compact:"ARIA roles included",descriptive:"Content is enhanced with ARIA roles to optimize organization and facilitate navigation"},"audio-descriptions":"Audio descriptions",braille:"Braille","color-not-sole-means-of-conveying-information":"Color is not the sole means of conveying information","dyslexia-readability":"Dyslexia readability","full-ruby-annotations":"Full ruby annotations","high-contrast-between-foreground-and-background-audio":"High contrast between foreground and background audio","high-contrast-between-text-and-background":"High contrast between foreground text and background","large-print":"Large print","page-breaks":{compact:"Page breaks included",descriptive:"Page breaks included from the original print source"},"ruby-annotations":"Some Ruby annotations","sign-language":"Sign language","tactile-graphics":{compact:"Tactile graphics included",descriptive:"Tactile graphics have been integrated to facilitate access to visual elements for blind people"},"tactile-objects":"Tactile 3D objects","text-to-speech-hinting":"Text-to-speech hinting provided","ultra-high-contrast-between-text-and-background":"Ultra high contrast between text and background","visible-page-numbering":"Visible page numbering","without-background-sounds":"Without background sounds"}},ai={"ways-of-reading":{title:"Lisibilité","nonvisual-reading":{"alt-text":{compact:"Images décrites",descriptive:"Les images sont décrites par un texte"},"no-metadata":"Aucune information pour la lecture en voix de synthèse ou en braille",none:{compact:"Non lisible en voix de synthèse ou en braille",descriptive:"Le contenu n'est pas lisible en voix de synthèse ou en braille"},"not-fully":{compact:"Pas entièrement lisible en voix de synthèse ou en braille",descriptive:"Tous les contenus ne pourront pas être lus à haute voix ou en braille"},readable:{compact:"Entièrement lisible en voix de synthèse ou en braille",descriptive:"Tous les contenus peuvent être lus en voix de synthèse ou en braille"}},"prerecorded-audio":{complementary:{compact:"Clips audio préenregistrés",descriptive:"Des clips audio préenregistrés sont intégrés au contenu"},"no-metadata":"Aucune information sur les enregistrements audio",only:{compact:"Audio préenregistré uniquement",descriptive:"Livre audio sans texte alternatif"},synchronized:{compact:"Audio préenregistré synchronisé avec du texte",descriptive:"Tous les contenus sont disponibles comme audio préenregistrés synchronisés avec le texte"}},"visual-adjustments":{modifiable:{compact:"L'affichage peut être adapté",descriptive:"L'apparence du texte et la mise en page peuvent être modifiées en fonction des capacités du système de lecture (famille et taille des polices, espaces entre les paragraphes, les phrases, les mots et les lettres, ainsi que la couleur de l'arrière-plan et du texte)"},unknown:"Aucune information sur les possibilités d'adaptation de l'affichage",unmodifiable:{compact:"L'affichage ne peut pas être adapté",descriptive:"Le texte et la mise en page ne peuvent pas être adaptés étant donné que l'expérience de lecture est proche de celle de la version imprimée, mais l'application de lecture peut tout de même proposer la capacité de zoomer"}}},conformance:{title:"Règles d'accessibilité","details-title":"Information détaillée",a:{compact:"Cette publication répond aux règles minimales d'accessibilité",descriptive:"La publication indique qu'elle respecte les règles d'accessibilité EPUB et WCAG 2 niveau A"},aa:{compact:"Cette publication répond aux règles d'accessibilité reconnues",descriptive:"La publication indique qu'elle respecte les règles d'accessibilité EPUB et WCAG 2 niveau AA"},aaa:{compact:"Cette publication dépasse les règles d'accessibilité reconnues",descriptive:"La publication indique qu'elle respecte les règles d'accessibilité EPUB et WCAG 2 niveau AAA"},no:"Aucune information disponible","unknown-standard":"Aucune indication concernant les normes d'accessibilité",certifier:"Accessibilité évaluée par ","certifier-credentials":"L'évaluateur est accrédité par ",details:{"certification-info":"Cette publication a été certifié le","certifier-report":"Pour plus d'information, veuillez consulter le rapport de certification",claim:"Cette publication indique respecter","epub-accessibility-1-0":"EPUB Accessibilité 1.0","epub-accessibility-1-1":"EPUB Accessibilité 1.1","level-a":"Niveau A","level-aa":"Niveau AA","level-aaa":"Niveau AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"Règles pour l’accessibilité des contenus Web (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"Règles pour l’accessibilité des contenus Web (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"Règles pour l’accessibilité des contenus Web (WCAG) 2.2"}}},navigation:{title:"Points de repère",index:{compact:"Index",descriptive:"Index comportant des liens vers les entrées référencées"},"no-metadata":"Aucune information disponible","page-navigation":{compact:"Aller à la page",descriptive:"Permet d'accéder aux pages de la version source imprimée"},structural:{compact:"Titres",descriptive:"Contient des titres pour une navigation structurée"},toc:{compact:"Table des matières",descriptive:"Table des matières"}},"rich-content":{title:"Contenus spécifiques","accessible-chemistry-as-latex":{compact:"Formules chimiques en LaTeX",descriptive:"Formules chimiques en format accessible (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"Formules chimiques en MathML",descriptive:"Formules chimiques en format accessible (MathML)"},"accessible-math-as-latex":{compact:"Mathématiques en LaTeX",descriptive:"Formules mathématiques en format accessible (LaTeX)"},"math-as-mathml":{compact:"Mathématiques en MathML",descriptive:"Formules mathématiques en format accessible (MathML)"},"accessible-math-described":"Des descriptions textuelles des formules mathématiques sont fournies","closed-captions":{compact:"Sous-titres disponibles pour les vidéos",descriptive:"Des sous titres sont disponibles pour les vidéos"},"extended-descriptions":"Les images porteuses d'informations complexes sont décrites par des descriptions longues","open-captions":{compact:"Sous-titres incrustés",descriptive:"Des sous titres sont incrustés pour les vidéos"},transcript:"Transcriptions fournies",unknown:"Aucune information disponible"},hazards:{title:"Points d'attention",flashing:{compact:"Flashs lumineux",descriptive:"La publication contient des flashs lumineux qui peuvent provoquer des crises d’épilepsie"},"flashing-none":{compact:"Pas de flashs lumineux",descriptive:"La publication ne contient pas de flashs lumineux susceptibles de provoquer des crises d’épilepsie"},"flashing-unknown":{compact:"Pas d'information concernant la présence de flashs lumineux",descriptive:"La présence de flashs lumineux susceptibles de provoquer des crises d’épilepsie n'a pas pu être déterminée"},motion:{compact:"Sensations de mouvement",descriptive:"La publication contient des images en mouvement qui peuvent provoquer des nausées, des vertiges et des maux de tête"},"motion-none":{compact:"Pas de sensations de mouvement",descriptive:"La publication ne contient pas d'images en mouvement qui pourraient provoquer des nausées, des vertiges et des maux de tête"},"motion-unknown":{compact:"Pas d'information concernant la présence d'images en mouvement",descriptive:"La présence d'images en mouvement susceptibles de provoquer des nausées, des vertiges et des maux de tête n'a pas pu être déterminée"},"no-metadata":"Aucune information disponible",none:{compact:"Aucun points d'attention",descriptive:"La publication ne présente aucun risque lié à la présence de flashs lumineux, de sensations de mouvement ou de sons"},sound:{compact:"Sons",descriptive:"La publication contient des sons qui peuvent causer des troubles de la sensibilité"},"sound-none":{compact:"Pas de risques sonores",descriptive:"La publication ne contient pas de sons susceptibles de provoquer des troubles de la sensibilité"},"sound-unknown":{compact:"Pas d'information concernant la présence de sons",descriptive:"La présence de sons susceptibles de causer des troubles de sensibilité n'a pas pu être déterminée"},unknown:"La présence de risques est inconnue"},"accessibility-summary":{title:"Informations d'accessibilité supplémentaires fournies par l'éditeur","no-metadata":"Aucune information disponible","publisher-contact":"Pour plus d'information à propos de l'accessibilité de cette publication, veuillez contacter l'éditeur : "},"legal-considerations":{title:"Considérations légales",exempt:{compact:"Déclare être sous le coup d'une exemption dans certaines juridictions",descriptive:"Cette publication dééclare être sous le coup d'une exemption dans certaines juridictions"},"no-metadata":"Aucune information disponible"},"additional-accessibility-information":{title:"Informations complémentaires sur l'accessibilité",aria:{compact:"Information enrichie pour les technologies d'assistances",descriptive:"La structure est enrichi de rôles ARIA afin d'optimiser l'organisation et de faciliter la navigation via les technologies d'assistances"},"audio-descriptions":"Description audio",braille:"Braille","color-not-sole-means-of-conveying-information":"La couleur n'est pas la seule manière de communiquer de l'information","dyslexia-readability":"Lisibilité adapté aux publics dys","full-ruby-annotations":"Annotations complètes au format ruby (langues asiatiques)","high-contrast-between-foreground-and-background-audio":"Contraste sonore amélioré entre les différents plans","high-contrast-between-text-and-background":"Contraste élevé entre le texte et l'arrière-plan","large-print":"Grands caractères","page-breaks":{compact:"Pagination identique à l'imprimé",descriptive:"Contient une pagination identique à la version imprimée"},"ruby-annotations":"Annotations partielles au format ruby (langues asiatiques)","sign-language":"Langue des signes","tactile-graphics":{compact:"Graphiques tactiles",descriptive:"Des graphiques tactiles ont été intégrés pour faciliter l'accès des personnes aveugles aux éléments visuels"},"tactile-objects":"Objets 3D ou tactiles","text-to-speech-hinting":"Prononciation améliorée pour la synthèse vocale","ultra-high-contrast-between-text-and-background":"Contraste très élevé entre le texte et l'arrière-plan","visible-page-numbering":"Numérotation de page visible","without-background-sounds":"Aucun bruit de fond"}};class _{constructor(){this.currentLocaleCode="en",this.locale=he,this.availableLocales={en:he,fr:ai}}static getInstance(){return _.instance||(_.instance=new _),_.instance}registerLocale(t,e){if(!t||typeof t!="string")throw new Error("Locale code must be a non-empty string");this.availableLocales[t]=e}setLocale(t){return t in this.availableLocales?(this.locale=this.availableLocales[t],this.currentLocaleCode=t,!0):(console.warn(`Locale '${t}' is not available`),!1)}getCurrentLocale(){return this.currentLocaleCode}getAvailableLocales(){return Object.keys(this.availableLocales)}getNestedValue(t,e){const i=e.split(".");let n=t;for(const r of i){if(n==null)return;n=n[r]}return n}getString(t){let e=this.getNestedValue(this.locale,t);return e===void 0&&this.currentLocaleCode!=="en"&&(e=this.getNestedValue(this.availableLocales.en,t)),e!==void 0?typeof e=="string"?{compact:e,descriptive:e}:e:(console.warn(`Missing localization for key: ${t}`),{compact:"",descriptive:""})}}const p=_.getInstance();var q=(s=>(s.reflowable="reflowable",s.fixed="fixed",s.scrolled="scrolled",s))(q||{}),de=(s=>(s.Unknown="unknown",s.Modifiable="modifiable",s.Unmodifiable="unmodifiable",s))(de||{}),fe=(s=>(s.NoMetadata="noMetadata",s.Readable="readable",s.NotFully="notFully",s.Unreadable="unreadable",s))(fe||{}),pe=(s=>(s.NoMetadata="noMetadata",s.Synchronized="synchronized",s.AudioOnly="audioOnly",s.AudioComplementary="audioComplementary",s))(pe||{});class St{constructor(t="unknown",e="noMetadata",i=!1,n="noMetadata"){this.id="ways-of-reading.title",this.visualAdjustments=t,this.nonvisualReading=e,this.nonvisualReadingAltText=i,this.prerecordedAudio=n,this.shouldDisplay=!0;const r=p.getString(this.id);this.title=r.compact,this.statements=[];const a=t==="modifiable"?"ways-of-reading.visual-adjustments.modifiable":t==="unmodifiable"?"ways-of-reading.visual-adjustments.unmodifiable":"ways-of-reading.visual-adjustments.unknown",o=p.getString(a);this.statements.push({id:a,compactString:o.compact,descriptiveString:o.descriptive});let h="";e==="readable"?h="ways-of-reading.nonvisual-reading.readable":e==="notFully"?h="ways-of-reading.nonvisual-reading.not-fully":e==="unreadable"?h="ways-of-reading.nonvisual-reading.none":e==="noMetadata"&&(h="ways-of-reading.nonvisual-reading.no-metadata");const g=p.getString(h);if(this.statements.push({id:h,compactString:g.compact,descriptiveString:g.descriptive}),i){const b=p.getString("ways-of-reading.nonvisual-reading.alt-text");this.statements.push({id:"ways-of-reading.nonvisual-reading.alt-text",compactString:b.compact,descriptiveString:b.descriptive})}let m="";n==="synchronized"?m="ways-of-reading.prerecorded-audio.synchronized":n==="audioOnly"?m="ways-of-reading.prerecorded-audio.only":n==="audioComplementary"?m="ways-of-reading.prerecorded-audio.complementary":n==="noMetadata"&&(m="ways-of-reading.prerecorded-audio.no-metadata");const d=p.getString(m);this.statements.push({id:m,compactString:d.compact,descriptiveString:d.descriptive})}static fromPublication(t){const e=t.metadata.accessibility??new F,i=e.feature??[],n=t.metadata.layout===q.fixed,r=i.some(f=>f.value===A.DISPLAY_TRANSFORMABILITY.value)?"modifiable":n?"unmodifiable":"unknown",a=e.accessMode??[],o=e.accessModeSufficient??[],h=a.length>0&&a.every(f=>f.value===z.TEXTUAL.value)||o.some(f=>{const O=f.value;return Array.isArray(O)?O.every(H=>H===z.TEXTUAL.value):O===z.TEXTUAL.value}),g=a.some(f=>f.value===z.TEXTUAL.value)||o.some(f=>{const O=f.value;return Array.isArray(O)?O.some(H=>H===z.TEXTUAL.value):O===z.TEXTUAL.value}),m=!(a.length===0&&o.length===0)&&!a.some(f=>f.value===z.TEXTUAL.value)&&!o.some(f=>{const O=f.value;return Array.isArray(O)?O.some(H=>H===z.TEXTUAL.value):O===z.TEXTUAL.value}),d=i.some(f=>[A.LONG_DESCRIPTION.value,A.ALTERNATIVE_TEXT.value,A.DESCRIBED_MATH.value,A.TRANSCRIPT.value].includes(f.value)),b=h?"readable":g||d?"notFully":m?"unreadable":"noMetadata",y=d,U=i.some(f=>f.value===A.SYNCHRONIZED_AUDIO_TEXT.value)?"synchronized":o.some(f=>{const O=f.value;return Array.isArray(O)?O.some(H=>H===z.AUDITORY.value):O===z.AUDITORY.value})?"audioOnly":a.some(f=>f.value===z.AUDITORY.value)?"audioComplementary":"noMetadata";return new St(r,b,y,U)}}class Et{constructor(t=!1,e=!1,i=!1,n=!1){this.id="navigation.title",this.tableOfContents=t,this.index=e,this.headings=i,this.page=n,this.noMetadata=!t&&!e&&!i&&!n;const r=p.getString(this.id);if(this.title=r.compact,this.shouldDisplay=!this.noMetadata,this.statements=[],t){const a=p.getString("navigation.toc");this.statements.push({id:"navigation.toc",compactString:a.compact,descriptiveString:a.descriptive})}if(e){const a=p.getString("navigation.index");this.statements.push({id:"navigation.index",compactString:a.compact,descriptiveString:a.descriptive})}if(i){const a=p.getString("navigation.structural");this.statements.push({id:"navigation.structural",compactString:a.compact,descriptiveString:a.descriptive})}if(n){const a=p.getString("navigation.page-navigation");this.statements.push({id:"navigation.page-navigation",compactString:a.compact,descriptiveString:a.descriptive})}if(this.statements.length===0){const a=p.getString("navigation.no-metadata");this.statements.push({id:"navigation.no-metadata",compactString:a.compact,descriptiveString:a.descriptive})}}static fromPublication(t){const i=(t.metadata.accessibility??new F).feature??[];return new Et(i.some(n=>n.value===A.TABLE_OF_CONTENTS.value),i.some(n=>n.value===A.INDEX.value),i.some(n=>n.value===A.STRUCTURAL_NAVIGATION.value),i.some(n=>n.value===A.PAGE_NAVIGATION.value))}}var me=(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))(me||{});class Tt{constructor(t=!1,e=!1,i=!1,n=!1,r=!1,a=!1,o=!1,h=!1,g=!1){this.id="rich-content.title",this.extendedAltTextDescriptions=t,this.mathFormula=e,this.mathFormulaAsMathML=i,this.mathFormulaAsLaTeX=n,this.chemicalFormulaAsMathML=r,this.chemicalFormulaAsLaTeX=a,this.closedCaptions=o,this.openCaptions=h,this.transcript=g,this.noMetadata=!t&&!e&&!i&&!n&&!r&&!a&&!o&&!h&&!g,this.shouldDisplay=!this.noMetadata;const m=p.getString(this.id);if(this.title=m.compact,this.statements=[],t){const d=p.getString("rich-content.extended-descriptions");this.statements.push({id:"rich-content.extended-descriptions",compactString:d.compact,descriptiveString:d.descriptive})}if(e){const d=p.getString("rich-content.accessible-math-described");this.statements.push({id:"rich-content.accessible-math-described",compactString:d.compact,descriptiveString:d.descriptive})}if(i){const d=p.getString("rich-content.math-as-mathml");this.statements.push({id:"rich-content.math-as-mathml",compactString:d.compact,descriptiveString:d.descriptive})}if(n){const d=p.getString("rich-content.accessible-math-as-latex");this.statements.push({id:"rich-content.accessible-math-as-latex",compactString:d.compact,descriptiveString:d.descriptive})}if(r){const d=p.getString("rich-content.accessible-chemistry-as-mathml");this.statements.push({id:"rich-content.accessible-chemistry-as-mathml",compactString:d.compact,descriptiveString:d.descriptive})}if(a){const d=p.getString("rich-content.accessible-chemistry-as-latex");this.statements.push({id:"rich-content.accessible-chemistry-as-latex",compactString:d.compact,descriptiveString:d.descriptive})}if(o){const d=p.getString("rich-content.closed-captions");this.statements.push({id:"rich-content.closed-captions",compactString:d.compact,descriptiveString:d.descriptive})}if(h){const d=p.getString("rich-content.open-captions");this.statements.push({id:"rich-content.open-captions",compactString:d.compact,descriptiveString:d.descriptive})}if(g){const d=p.getString("rich-content.transcript");this.statements.push({id:"rich-content.transcript",compactString:d.compact,descriptiveString:d.descriptive})}if(this.statements.length===0){const d=p.getString("rich-content.unknown");this.statements.push({id:"rich-content.unknown",compactString:d.compact,descriptiveString:d.descriptive})}}static fromPublication(t){const i=(t.metadata.accessibility??new F).feature??[];return new Tt(i.some(n=>n.value===A.LONG_DESCRIPTION.value),i.some(n=>n.value===A.DESCRIBED_MATH.value),i.some(n=>n.value===A.MATH_ML.value),i.some(n=>n.value===A.LATEX.value),i.some(n=>n.value===A.MATH_ML_CHEMISTRY.value),i.some(n=>n.value===A.LATEX_CHEMISTRY.value),i.some(n=>n.value===A.CLOSED_CAPTIONS.value),i.some(n=>n.value===A.OPEN_CAPTIONS.value),i.some(n=>n.value===A.TRANSCRIPT.value))}}class It{constructor(t=!1,e=!1,i=!1,n=!1,r=!1,a=!1,o=!1,h=!1,g=!1,m=!1,d=!1,b=!1,y=!1){this.id="additional-accessibility-information.title",this.pageBreakMarkers=t,this.aria=e,this.audioDescriptions=i,this.braille=n,this.rubyAnnotations=r,this.fullRubyAnnotations=a,this.highAudioContrast=o,this.highDisplayContrast=h,this.largePrint=g,this.signLanguage=m,this.tactileGraphics=d,this.tactileObjects=b,this.textToSpeechHinting=y,this.noMetadata=!t&&!e&&!i&&!n&&!r&&!a&&!o&&!h&&!g&&!m&&!d&&!b&&!y,this.shouldDisplay=!this.noMetadata;const U=p.getString(this.id);if(this.title=U.compact,this.statements=[],t){const f=p.getString("additional-accessibility-information.page-breaks");this.statements.push({id:"additional-accessibility-information.page-breaks",compactString:f.compact,descriptiveString:f.descriptive})}if(e){const f=p.getString("additional-accessibility-information.aria");this.statements.push({id:"additional-accessibility-information.aria",compactString:f.compact,descriptiveString:f.descriptive})}if(i){const f=p.getString("additional-accessibility-information.audio-descriptions");this.statements.push({id:"additional-accessibility-information.audio-descriptions",compactString:f.compact,descriptiveString:f.descriptive})}if(n){const f=p.getString("additional-accessibility-information.braille");this.statements.push({id:"additional-accessibility-information.braille",compactString:f.compact,descriptiveString:f.descriptive})}if(r){const f=p.getString("additional-accessibility-information.ruby-annotations");this.statements.push({id:"additional-accessibility-information.ruby-annotations",compactString:f.compact,descriptiveString:f.descriptive})}if(a){const f=p.getString("additional-accessibility-information.full-ruby-annotations");this.statements.push({id:"additional-accessibility-information.full-ruby-annotations",compactString:f.compact,descriptiveString:f.descriptive})}if(o){const f=p.getString("additional-accessibility-information.high-contrast-between-foreground-and-background-audio");this.statements.push({id:"additional-accessibility-information.high-contrast-between-foreground-and-background-audio",compactString:f.compact,descriptiveString:f.descriptive})}if(h){const f=p.getString("additional-accessibility-information.high-contrast-between-text-and-background");this.statements.push({id:"additional-accessibility-information.high-contrast-between-text-and-background",compactString:f.compact,descriptiveString:f.descriptive})}if(g){const f=p.getString("additional-accessibility-information.large-print");this.statements.push({id:"additional-accessibility-information.large-print",compactString:f.compact,descriptiveString:f.descriptive})}if(m){const f=p.getString("additional-accessibility-information.sign-language");this.statements.push({id:"additional-accessibility-information.sign-language",compactString:f.compact,descriptiveString:f.descriptive})}if(d){const f=p.getString("additional-accessibility-information.tactile-graphics");this.statements.push({id:"additional-accessibility-information.tactile-graphics",compactString:f.compact,descriptiveString:f.descriptive})}if(b){const f=p.getString("additional-accessibility-information.tactile-objects");this.statements.push({id:"additional-accessibility-information.tactile-objects",compactString:f.compact,descriptiveString:f.descriptive})}if(y){const f=p.getString("additional-accessibility-information.text-to-speech-hinting");this.statements.push({id:"additional-accessibility-information.text-to-speech-hinting",compactString:f.compact,descriptiveString:f.descriptive})}}static fromPublication(t){const i=(t.metadata.accessibility??new F).feature??[];return new It(i.some(n=>n.value===A.PAGE_BREAK_MARKERS.value||n.value===A.PRINT_PAGE_NUMBERS.value),i.some(n=>n.value===A.ARIA.value),i.some(n=>n.value===A.AUDIO_DESCRIPTION.value),i.some(n=>n.value===A.BRAILLE.value),i.some(n=>n.value===A.RUBY_ANNOTATIONS.value),i.some(n=>n.value===A.FULL_RUBY_ANNOTATIONS.value),i.some(n=>n.value===A.HIGH_CONTRAST_AUDIO.value),i.some(n=>n.value===A.HIGH_CONTRAST_DISPLAY.value),i.some(n=>n.value===A.LARGE_PRINT.value),i.some(n=>n.value===A.SIGN_LANGUAGE.value),i.some(n=>n.value===A.TACTILE_GRAPHIC.value),i.some(n=>n.value===A.TACTILE_OBJECT.value),i.some(n=>n.value===A.TTS_MARKUP.value))}}var ge=(s=>(s.yes="yes",s.no="no",s.unknown="unknown",s.noMetadata="noMetadata",s))(ge||{});class Nt{constructor(t="unknown",e="unknown",i="unknown"){this.id="hazards.title",this.flashing=t,this.motion=e,this.sound=i;const n=p.getString(this.id);if(this.title=n.compact,this.noMetadata=t==="noMetadata"&&e==="noMetadata"&&i==="noMetadata",this.noHazards=t==="no"&&e==="no"&&i==="no",this.unknown=t==="unknown"&&e==="unknown"&&i==="unknown",this.shouldDisplay=!this.noMetadata,this.statements=[],this.noHazards){const r=p.getString("hazards.none");this.statements.push({id:"hazards.none",compactString:r.compact,descriptiveString:r.descriptive})}else if(this.unknown){const r=p.getString("hazards.unknown");this.statements.push({id:"hazards.unknown",compactString:r.compact,descriptiveString:r.descriptive})}else if(this.noMetadata){const r=p.getString("hazards.no-metadata");this.statements.push({id:"hazards.no-metadata",compactString:r.compact,descriptiveString:r.descriptive})}else{if(t==="yes"){const r=p.getString("hazards.flashing");this.statements.push({id:"hazards.flashing",compactString:r.compact,descriptiveString:r.descriptive})}else if(t==="unknown"){const r=p.getString("hazards.flashing-unknown");this.statements.push({id:"hazards.flashing-unknown",compactString:r.compact,descriptiveString:r.descriptive})}else if(t==="no"){const r=p.getString("hazards.flashing-none");this.statements.push({id:"hazards.flashing-none",compactString:r.compact,descriptiveString:r.descriptive})}if(e==="yes"){const r=p.getString("hazards.motion");this.statements.push({id:"hazards.motion",compactString:r.compact,descriptiveString:r.descriptive})}else if(e==="unknown"){const r=p.getString("hazards.motion-unknown");this.statements.push({id:"hazards.motion-unknown",compactString:r.compact,descriptiveString:r.descriptive})}else if(e==="no"){const r=p.getString("hazards.motion-none");this.statements.push({id:"hazards.motion-none",compactString:r.compact,descriptiveString:r.descriptive})}if(i==="yes"){const r=p.getString("hazards.sound");this.statements.push({id:"hazards.sound",compactString:r.compact,descriptiveString:r.descriptive})}else if(i==="unknown"){const r=p.getString("hazards.sound-unknown");this.statements.push({id:"hazards.sound-unknown",compactString:r.compact,descriptiveString:r.descriptive})}else if(i==="no"){const r=p.getString("hazards.sound-none");this.statements.push({id:"hazards.sound-none",compactString:r.compact,descriptiveString:r.descriptive})}}}static fromPublication(t){const e=t.metadata.accessibility?.hazard??[];let i;e.some(o=>o.value===P.NONE.value)?i="no":e.some(o=>o.value===P.UNKNOWN.value)?i="unknown":i="noMetadata";let n;e.some(o=>o.value===P.FLASHING.value)?n="yes":e.some(o=>o.value===P.NO_FLASHING_HAZARD.value)?n="no":e.some(o=>o.value===P.UNKNOWN_FLASHING_HAZARD.value)?n="unknown":n=i;let r;e.some(o=>o.value===P.MOTION_SIMULATION.value)?r="yes":e.some(o=>o.value===P.NO_MOTION_SIMULATION_HAZARD.value)?r="no":e.some(o=>o.value===P.UNKNOWN_MOTION_SIMULATION_HAZARD.value)?r="unknown":r=i;let a;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 Nt(n,r,a)}}class Lt{constructor(t=[]){this.id="conformance.title",this.profiles=t,this.shouldDisplay=!0;const e=p.getString(this.id);if(this.title=e.compact,this.statements=[],t.length===0){const i=p.getString("conformance.no");this.statements.push({id:"conformance.no",compactString:i.compact,descriptiveString:i.descriptive});return}if(t.some(i=>i.isWCAGLevelAAA)){const i=p.getString("conformance.aaa");this.statements.push({id:"conformance.aaa",compactString:i.compact,descriptiveString:i.descriptive})}else if(t.some(i=>i.isWCAGLevelAA)){const i=p.getString("conformance.aa");this.statements.push({id:"conformance.aa",compactString:i.compact,descriptiveString:i.descriptive})}else if(t.some(i=>i.isWCAGLevelA)){const i=p.getString("conformance.a");this.statements.push({id:"conformance.a",compactString:i.compact,descriptiveString:i.descriptive})}else{const i=p.getString("conformance.unknown-standard");this.statements.push({id:"conformance.unknown-standard",compactString:i.compact,descriptiveString:i.descriptive})}}static fromPublication(t){const e=t.metadata.accessibility?.conformsTo??[];return new Lt(e)}}class xt{constructor(t=!1){this.id="legal-considerations.title",this.exemption=t,this.shouldDisplay=this.exemption;const e=p.getString(this.id);if(this.title=e.compact,this.statements=[],t){const i=p.getString("legal-considerations.exempt");this.statements.push({id:"legal-considerations.exempt",compactString:i.compact,descriptiveString:i.descriptive})}else{const i=p.getString("legal-considerations.no-metadata");this.statements.push({id:"legal-considerations.no-metadata",compactString:i.compact,descriptiveString:i.descriptive})}}static fromPublication(t){const i=(t.metadata.accessibility?.exemption??[]).length>0;return new xt(i)}}class Ot{constructor(t){this.id="accessibility-summary.title",this.shouldDisplay=!0;const e=p.getString(this.id);this.title=e.compact;const i=t.metadata.accessibility?.summary;if(this.statements=[],this.shouldDisplay&&i)this.statements.push({id:"accessibility-summary.summary",compactString:i,descriptiveString:i});else{const n=p.getString("accessibility-summary.no-metadata");this.statements.push({id:"accessibility-summary.no-metadata",compactString:n.compact,descriptiveString:n.descriptive})}}static fromPublication(t){return new Ot(t)}}class oi{constructor(t){this.waysOfReading=St.fromPublication(t),this.navigation=Et.fromPublication(t),this.richContent=Tt.fromPublication(t),this.additionalInformation=It.fromPublication(t),this.hazards=Nt.fromPublication(t),this.conformance=Lt.fromPublication(t),this.legal=xt.fromPublication(t),this.accessibilitySummary=Ot.fromPublication(t),this.fields=[this.waysOfReading,this.navigation,this.richContent,this.additionalInformation,this.hazards,this.conformance,this.legal,this.accessibilitySummary]}}class zt{constructor(t){this.algorithm=t.algorithm,this.compression=t.compression,this.originalLength=t.originalLength,this.profile=t.profile,this.scheme=t.scheme}static deserialize(t){if(t&&t.algorithm)return new zt({algorithm:t.algorithm,compression:t.compression,originalLength:t.originalLength,profile:t.profile,scheme:t.scheme})}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 Ct=(s=>(s.left="left",s.right="right",s.center="center",s))(Ct||{});class k{constructor(t){this.otherProperties=t}get page(){return this.otherProperties.page}static deserialize(t){if(t)return new k(t)}serialize(){return this.otherProperties}add(t){const e=Object.assign({},this.otherProperties);for(const i in t)e[i]=t[i];return new k(e)}}Object.defineProperty(k.prototype,"encryption",{get:function(){return zt.deserialize(this.otherProperties.encrypted)}});class Rt{constructor(t){this.activeClass=t.activeClass,this.playbackActiveClass=t.playbackActiveClass}static deserialize(t){if(t)return new Rt({activeClass:t.activeClass,playbackActiveClass:t.playbackActiveClass})}serialize(){const t={};return this.activeClass&&(t.activeClass=this.activeClass),this.playbackActiveClass&&(t.playbackActiveClass=this.playbackActiveClass),t}}function be(s){return s&&Array.isArray(s)?s:void 0}function V(s){return s&&typeof s=="string"?[s]:be(s)}function st(s){return typeof s=="string"?new Date(s):void 0}function X(s){return isNaN(s)?void 0:s}function N(s){return X(s)!==void 0&&Math.sign(s)>=0?s:void 0}function nt(s){const t=new Array;return s.forEach(e=>t.push(e)),t}class K{constructor(t){this.value=t.value,this.scheme=t.scheme}static deserialize(t){if(t){if(typeof t=="string")return new K({value:t});if(typeof t=="object"&&t.value)return new K({value:t.value,scheme:t.scheme})}}serialize(){return this.scheme?{value:this.value,scheme:this.scheme}:this.value}}class l{constructor(t){let e,i,n=t.mediaType.replace(/\s/g,"").split(";");const r=n[0].split("/");if(r.length===2){if(e=r[0].toLowerCase().trim(),i=r[1].toLowerCase().trim(),e.length===0||i.length===0)throw new Error("Invalid media type")}else throw new Error("Invalid media type");const a={};for(let b=1;b<n.length;b++){const y=n[b].split("=");if(y.length===2){const U=y[0].toLocaleLowerCase(),f=U==="charset"?y[1].toUpperCase():y[1];a[U]=f}}const o={},h=Object.keys(a);h.sort((b,y)=>b.localeCompare(y)),h.forEach(b=>o[b]=a[b]);let g="";for(const b in o){const y=o[b];g+=`;${b}=${y}`}const m=`${e}/${i}${g}`,d=o.encoding;this.string=m,this.type=e,this.subtype=i,this.parameters=o,this.encoding=d,this.name=t.name,this.fileExtension=t.fileExtension}static parse(t){return new l(t)}get structuredSyntaxSuffix(){const t=this.subtype.split("+");return t.length>1?`+${t[t.length-1]}`:void 0}get charset(){return this.parameters.charset}contains(t){const e=typeof t=="string"?l.parse({mediaType:t}):t;if(!((this.type==="*"||this.type===e.type)&&(this.subtype==="*"||this.subtype===e.subtype)))return!1;const i=new Set(Object.entries(this.parameters).map(([r,a])=>`${r}=${a}`)),n=new Set(Object.entries(e.parameters).map(([r,a])=>`${r}=${a}`));for(const r of Array.from(i.values()))if(!n.has(r))return!1;return!0}matches(t){const e=typeof t=="string"?l.parse({mediaType:t}):t;return this.contains(e)||e.contains(this)}matchesAny(...t){for(const e of t)if(this.matches(e))return!0;return!1}equals(t){return this.string===t.string}get isZIP(){return this.matchesAny(l.ZIP,l.LCP_PROTECTED_AUDIOBOOK,l.LCP_PROTECTED_PDF)||this.structuredSyntaxSuffix==="+zip"}get isJSON(){return this.matchesAny(l.JSON)||this.structuredSyntaxSuffix==="+json"}get isOPDS(){return this.matchesAny(l.OPDS1,l.OPDS1_ENTRY,l.OPDS2,l.OPDS2_PUBLICATION,l.OPDS_AUTHENTICATION)||this.structuredSyntaxSuffix==="+json"}get isHTML(){return this.matchesAny(l.HTML,l.XHTML)}get isBitmap(){return this.matchesAny(l.BMP,l.GIF,l.JPEG,l.PNG,l.TIFF,l.WEBP)}get isAudio(){return this.type==="audio"}get isVideo(){return this.type==="video"}get isRWPM(){return this.matchesAny(l.READIUM_AUDIOBOOK_MANIFEST,l.DIVINA_MANIFEST,l.READIUM_WEBPUB_MANIFEST)}get isPublication(){return this.matchesAny(l.READIUM_AUDIOBOOK,l.READIUM_AUDIOBOOK_MANIFEST,l.CBZ,l.DIVINA,l.DIVINA_MANIFEST,l.EPUB,l.LCP_PROTECTED_AUDIOBOOK,l.LCP_PROTECTED_PDF,l.LPF,l.PDF,l.W3C_WPUB_MANIFEST,l.READIUM_WEBPUB,l.READIUM_WEBPUB_MANIFEST,l.ZAB)}static get AAC(){return l.parse({mediaType:"audio/aac",fileExtension:"aac"})}static get ACSM(){return l.parse({mediaType:"application/vnd.adobe.adept+xml",name:"Adobe Content Server Message",fileExtension:"acsm"})}static get AIFF(){return l.parse({mediaType:"audio/aiff",fileExtension:"aiff"})}static get AVI(){return l.parse({mediaType:"video/x-msvideo",fileExtension:"avi"})}static get BINARY(){return l.parse({mediaType:"application/octet-stream"})}static get BMP(){return l.parse({mediaType:"image/bmp",fileExtension:"bmp"})}static get CBZ(){return l.parse({mediaType:"application/vnd.comicbook+zip",name:"Comic Book Archive",fileExtension:"cbz"})}static get CSS(){return l.parse({mediaType:"text/css",fileExtension:"css"})}static get DIVINA(){return l.parse({mediaType:"application/divina+zip",name:"Digital Visual Narratives",fileExtension:"divina"})}static get DIVINA_MANIFEST(){return l.parse({mediaType:"application/divina+json",name:"Digital Visual Narratives",fileExtension:"json"})}static get EPUB(){return l.parse({mediaType:"application/epub+zip",name:"EPUB",fileExtension:"epub"})}static get GIF(){return l.parse({mediaType:"image/gif",fileExtension:"gif"})}static get GZ(){return l.parse({mediaType:"application/gzip",fileExtension:"gz"})}static get HTML(){return l.parse({mediaType:"text/html",fileExtension:"html"})}static get JAVASCRIPT(){return l.parse({mediaType:"text/javascript",fileExtension:"js"})}static get JPEG(){return l.parse({mediaType:"image/jpeg",fileExtension:"jpeg"})}static get JSON(){return l.parse({mediaType:"application/json"})}static get LCP_LICENSE_DOCUMENT(){return l.parse({mediaType:"application/vnd.readium.lcp.license.v1.0+json",name:"LCP License",fileExtension:"lcpl"})}static get LCP_PROTECTED_AUDIOBOOK(){return l.parse({mediaType:"application/audiobook+lcp",name:"LCP Protected Audiobook",fileExtension:"lcpa"})}static get LCP_PROTECTED_PDF(){return l.parse({mediaType:"application/pdf+lcp",name:"LCP Protected PDF",fileExtension:"lcpdf"})}static get LCP_STATUS_DOCUMENT(){return l.parse({mediaType:"application/vnd.readium.license.status.v1.0+json"})}static get LPF(){return l.parse({mediaType:"application/lpf+zip",fileExtension:"lpf"})}static get MP3(){return l.parse({mediaType:"audio/mpeg",fileExtension:"mp3"})}static get MPEG(){return l.parse({mediaType:"video/mpeg",fileExtension:"mpeg"})}static get NCX(){return l.parse({mediaType:"application/x-dtbncx+xml",fileExtension:"ncx"})}static get OGG(){return l.parse({mediaType:"audio/ogg",fileExtension:"oga"})}static get OGV(){return l.parse({mediaType:"video/ogg",fileExtension:"ogv"})}static get OPDS1(){return l.parse({mediaType:"application/atom+xml;profile=opds-catalog"})}static get OPDS1_ENTRY(){return l.parse({mediaType:"application/atom+xml;type=entry;profile=opds-catalog"})}static get OPDS2(){return l.parse({mediaType:"application/opds+json"})}static get OPDS2_PUBLICATION(){return l.parse({mediaType:"application/opds-publication+json"})}static get OPDS_AUTHENTICATION(){return l.parse({mediaType:"application/opds-authentication+json"})}static get OPUS(){return l.parse({mediaType:"audio/opus",fileExtension:"opus"})}static get OTF(){return l.parse({mediaType:"font/otf",fileExtension:"otf"})}static get PDF(){return l.parse({mediaType:"application/pdf",name:"PDF",fileExtension:"pdf"})}static get PNG(){return l.parse({mediaType:"image/png",fileExtension:"png"})}static get READIUM_AUDIOBOOK(){return l.parse({mediaType:"application/audiobook+zip",name:"Readium Audiobook",fileExtension:"audiobook"})}static get READIUM_AUDIOBOOK_MANIFEST(){return l.parse({mediaType:"application/audiobook+json",name:"Readium Audiobook",fileExtension:"json"})}static get READIUM_CONTENT_DOCUMENT(){return l.parse({mediaType:"application/vnd.readium.content+json",name:"Readium Content Document",fileExtension:"json"})}static get READIUM_GUIDED_NAVIGATION_DOCUMENT(){return l.parse({mediaType:"application/guided-navigation+json",name:"Readium Guided Navigation Document",fileExtension:"json"})}static get READIUM_POSITION_LIST(){return l.parse({mediaType:"application/vnd.readium.position-list+json",name:"Readium Position List",fileExtension:"json"})}static get READIUM_WEBPUB(){return l.parse({mediaType:"application/webpub+zip",name:"Readium Web Publication",fileExtension:"webpub"})}static get READIUM_WEBPUB_MANIFEST(){return l.parse({mediaType:"application/webpub+json",name:"Readium Web Publication",fileExtension:"json"})}static get SMIL(){return l.parse({mediaType:"application/smil+xml",fileExtension:"smil"})}static get SVG(){return l.parse({mediaType:"image/svg+xml",fileExtension:"svg"})}static get TEXT(){return l.parse({mediaType:"text/plain",fileExtension:"txt"})}static get TIFF(){return l.parse({mediaType:"image/tiff",fileExtension:"tiff"})}static get TTF(){return l.parse({mediaType:"font/ttf",fileExtension:"ttf"})}static get W3C_WPUB_MANIFEST(){return l.parse({mediaType:"application/x.readium.w3c.wpub+json",name:"Web Publication",fileExtension:"json"})}static get WAV(){return l.parse({mediaType:"audio/wav",fileExtension:"wav"})}static get WEBM_AUDIO(){return l.parse({mediaType:"audio/webm",fileExtension:"webm"})}static get WEBM_VIDEO(){return l.parse({mediaType:"video/webm",fileExtension:"webm"})}static get WEBP(){return l.parse({mediaType:"image/webp",fileExtension:"webp"})}static get WOFF(){return l.parse({mediaType:"font/woff",fileExtension:"woff"})}static get WOFF2(){return l.parse({mediaType:"font/woff2",fileExtension:"woff2"})}static get XHTML(){return l.parse({mediaType:"application/xhtml+xml",fileExtension:"xhtml"})}static get XML(){return l.parse({mediaType:"application/xml",fileExtension:"xml"})}static get ZAB(){return l.parse({mediaType:"application/x.readium.zab+zip",name:"Zipped Audio Book",fileExtension:"zab"})}static get ZIP(){return l.parse({mediaType:"application/zip",fileExtension:"zip"})}}class rt{constructor(t){this.uri=t,this.parameters=this.getParameters(t)}getParameters(t){const e=/\{\??([^}]+)\}/g,i=t.match(e);return i?new Set(i.join(",").replace(e,"$1").split(",").map(n=>n.trim())):new Set}expand(t){const e=n=>n.split(",").map(r=>{const a=t[r];return a?encodeURIComponent(a):""}).join(","),i=n=>"?"+n.split(",").map(r=>{const a=r.split("=")[0],o=t[a];return o?`${a}=${encodeURIComponent(o)}`:""}).join("&");return this.uri.replace(/\{(\??)([^}]+)\}/g,(...n)=>n[1]?i(n[2]):e(n[2]))}}class I{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}static deserialize(t){if(!t)return;const e=X(t.progression),i=X(t.totalProgression),n=X(t.position),r=new Map,a=new Set(["fragment","fragments","progression","totalProgression","position"]);return Object.entries(t).forEach(([o,h])=>{a.has(o)||r.set(o,h)}),new I({fragments:V(t.fragments||t.fragment),progression:e!==void 0&&e>=0&&e<=1?e:void 0,totalProgression:i!==void 0&&i>=0&&i<=1?i:void 0,position:n!==void 0&&n>0?n:void 0,otherLocations:r.size===0?void 0:r})}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,i)=>t[i]=e),t}}class Q{constructor(t){this.after=t.after,this.before=t.before,this.highlight=t.highlight}static deserialize(t){if(t)return new Q({after:t.after,before:t.before,highlight:t.highlight})}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}}class D{constructor(t){this.href=t.href,this.type=t.type,this.title=t.title,this.locations=t.locations?t.locations:new I({}),this.text=t.text}static deserialize(t){if(t&&t.href&&t.type)return new D({href:t.href,type:t.type,title:t.title,locations:I.deserialize(t.locations),text:Q.deserialize(t.text)})}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}copyWithLocations(t){return new D({href:this.href,type:this.type,title:this.title,text:this.text,locations:new I({...this.locations,...t})})}}class M{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}static deserialize(t){if(!(!t||typeof t.href!="string"))return new M({href:t.href,templated:t.templated,type:t.type,title:t.title,rels:t.rel?Array.isArray(t.rel)?new Set(t.rel):new Set([t.rel]):void 0,properties:k.deserialize(t.properties),height:N(t.height),width:N(t.width),size:N(t.size),duration:N(t.duration),bitrate:N(t.bitrate),languages:V(t.language),alternates:L.deserialize(t.alternate),children:L.deserialize(t.children)})}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=nt(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}get mediaType(){return this.type!==void 0?l.parse({mediaType:this.type}):l.BINARY}toURL(t){const e=this.href.replace(/^(\/)/,"");if(e.length===0)return;let i=t||"/";return i.startsWith("/")&&(i="file://"+i),new URL(e,i).href.replace(/^(file:\/\/)/,"")}get templateParameters(){return this.templated?new rt(this.href).parameters:new Set}expandTemplate(t){return new M({href:new rt(this.href).expand(t),templated:!1})}addProperties(t){const e=M.deserialize(this.serialize());return e.properties=e.properties?e.properties?.add(t):new k(t),e}get locator(){let t=this.href.split("#");return new D({href:t.length>0&&t[0]!==void 0?t[0]:this.href,type:this.type??"",title:this.title,locations:new I({fragments:t.length>1&&t[1]!==void 0?[t[1]]:[]})})}}class L{constructor(t){this.items=t}static deserialize(t){if(t&&Array.isArray(t))return new L(t.map(e=>M.deserialize(e)).filter(e=>e!==void 0))}serialize(){return this.items.map(t=>t.serialize())}findWithRel(t){const e=i=>i.rels&&i.rels.has(t);return this.items.find(e)}filterByRel(t){const e=i=>i.rels&&i.rels.has(t);return this.items.filter(e)}findWithHref(t){const e=i=>i.href===t;return this.items.find(e)}findIndexWithHref(t){const e=i=>i.href===t;return this.items.findIndex(e)}findWithMediaType(t){const e=i=>i.mediaType.matches(t);return this.items.find(e)}filterByMediaType(t){const e=i=>i.mediaType.matches(t);return this.items.filter(e)}filterByMediaTypes(t){const e=i=>{for(const n of t)if(i.mediaType.matches(n))return!0;return!1};return this.items.filter(e)}everyIsAudio(){const t=e=>e.mediaType.isAudio;return this.items.length>0&&this.items.every(t)}everyIsBitmap(){const t=e=>e.mediaType.isBitmap;return this.items.length>0&&this.items.every(t)}everyIsHTML(){const t=e=>e.mediaType.isHTML;return this.items.length>0&&this.items.every(t)}everyIsVideo(){const t=e=>e.mediaType.isVideo;return this.items.length>0&&this.items.every(t)}everyMatchesMediaType(t){return Array.isArray(t)?this.items.length>0&&this.items.every(e=>{for(const i of t)return e.mediaType.matches(i);return!1}):this.items.length>0&&this.items.every(e=>e.mediaType.matches(t))}filterLinksHasType(){return this.items.filter(t=>t.type)}}const W=class W{constructor(t){this.translations=typeof t=="string"?{[W.UNDEFINED_LANGUAGE]:t}:t}static deserialize(t){if(t&&(typeof t=="string"||t.constructor===Object))return new W(t)}serialize(){return this.translations}getTranslation(t){return this.translations[t||W.UNDEFINED_LANGUAGE]||this.translations[W.UNDEFINED_LANGUAGE]||this.translations[W.LANGUAGE_EN]||(Object.values(this.translations).length===0?"":Object.values(this.translations)[0])}};W.UNDEFINED_LANGUAGE="und",W.LANGUAGE_EN="en";let B=W;class at{constructor(t){this.name=t.name,this.sortAs=t.sortAs,this.identifier=t.identifier,this.altIdentifiers=t.altIdentifiers,this.roles=t.roles,this.links=t.links,this.position=t.position}static deserialize(t){if(t)return typeof t=="string"?new at({name:B.deserialize(t)}):t.name?new at({name:B.deserialize(t.name),sortAs:B.deserialize(t.sortAs),identifier:t.identifier,altIdentifiers:t.altIdentifier?Array.isArray(t.altIdentifier)?new Set(t.altIdentifier.map(e=>K.deserialize(e)).filter(e=>e!==void 0)):new Set([K.deserialize(t.altIdentifier)].filter(e=>e!==void 0)):void 0,roles:t.role?new Set(V(t.role)):void 0,links:L.deserialize(t.links),position:X(t.position)}):void 0}serialize(){const t={name:this.name.serialize()};return this.sortAs!==void 0&&(t.sortAs=this.sortAs.serialize()),this.identifier!==void 0&&(t.identifier=this.identifier),this.altIdentifiers&&(t.altIdentifier=nt(this.altIdentifiers).map(e=>e.serialize())),this.roles&&(t.role=nt(this.roles)),this.links&&(t.links=this.links.serialize()),this.position!==void 0&&(t.position=this.position),t}}class x{constructor(t){this.items=t}static deserialize(t){if(!t)return;const e=Array.isArray(t)?t:[t];return new x(e.map(i=>at.deserialize(i)).filter(i=>i!==void 0))}serialize(){return this.items.map(t=>t.serialize())}}class j{constructor(t){this.items=t&&t.items?t.items:new Map}static deserialize(t){if(!(t&&typeof t=="object"))return;const e=new Map;return Object.entries(t).forEach(([i,n])=>{const r=x.deserialize(n);r&&r.items.length>0&&e.set(i,r)}),new j({items:e})}serialize(){const t={};return this.items.forEach((e,i)=>t[i]=e.serialize()),t}}var tt=(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))(tt||{}),Y=(s=>(s.ltr="ltr",s.rtl="rtl",s))(Y||{});function ci(s){return s==="rtl"?Ct.right:Ct.left}class ot{constructor(t){this.name=t.name,this.sortAs=t.sortAs,this.code=t.code,this.scheme=t.scheme,this.links=t.links}static deserialize(t){if(t)return typeof t=="string"?new ot({name:B.deserialize(t)}):t.name?new ot({name:B.deserialize(t.name),sortAs:t.sortAs?B.deserialize(t.sortAs):void 0,code:t.code,scheme:t.scheme,links:L.deserialize(t.links)}):void 0}serialize(){const t={name:this.name.serialize()};return this.sortAs!==void 0&&(t.sortAs=this.sortAs.serialize()),this.code!==void 0&&(t.code=this.code),this.scheme!==void 0&&(t.scheme=this.scheme),this.links&&(t.links=this.links.serialize()),t}}class Pt{constructor(t){this.items=t}static deserialize(t){if(!t)return;const e=Array.isArray(t)?t:[t];return new Pt(e.map(i=>ot.deserialize(i)).filter(i=>i!==void 0))}serialize(){return this.items.map(t=>t.serialize())}}var ve=(s=>(s.all="all",s.none="none",s))(ve||{});class kt{constructor(t){this.reservation=t.reservation,this.policy=t.policy}static deserialize(t){if(t)return new kt({reservation:t.reservation,policy:t.policy})}serialize(){const t={};return this.reservation!==void 0&&(t.reservation=this.reservation),this.policy!==void 0&&(t.policy=this.policy),t}}const bt=class bt{constructor(t){this.title=t.title,this.typeUri=t.typeUri,this.conformsTo=t.conformsTo,this.identifier=t.identifier,this.altIdentifier=t.altIdentifier,this.subtitle=t.subtitle,this.sortAs=t.sortAs,this.artists=t.artists,this.authors=t.authors,this.colorists=t.colorists,this.contributors=t.contributors,this.editors=t.editors,this.illustrators=t.illustrators,this.inkers=t.inkers,this.letterers=t.letterers,this.narrators=t.narrators,this.pencilers=t.pencilers,this.translators=t.translators,this.languages=t.languages,this.description=t.description,this.publishers=t.publishers,this.imprints=t.imprints,this.published=t.published,this.modified=t.modified,this.subjects=t.subjects,this.belongsTo=t.belongsTo,this.belongsToCollections=t.belongsToCollections,this.belongsToSeries=t.belongsToSeries,this.belongsToCollections&&this.belongsToCollections.items.length>0&&(this.belongsTo||(this.belongsTo=new j),this.belongsTo.items.set("collection",this.belongsToCollections)),this.belongsToSeries&&this.belongsToSeries.items.length>0&&(this.belongsTo||(this.belongsTo=new j),this.belongsTo.items.set("series",this.belongsToSeries)),this.layout=t.layout,this.readingProgression=t.readingProgression,this.duration=t.duration,this.numberOfPages=t.numberOfPages,this.accessibility=t.accessibility,this.tdm=t.tdm,this.otherMetadata=t.otherMetadata}static deserialize(t){if(!(t&&t.title))return;const e=B.deserialize(t.title),i=t["@type"],n=V(t.conformsTo),r=t.identifier,a=K.deserialize(t.altIdentifier),o=B.deserialize(t.subtitle),h=B.deserialize(t.sortAs),g=x.deserialize(t.artist),m=x.deserialize(t.author),d=x.deserialize(t.colorist),b=x.deserialize(t.contributor),y=x.deserialize(t.editor),U=x.deserialize(t.illustrator),f=x.deserialize(t.inker),O=x.deserialize(t.letterer),H=x.deserialize(t.narrator),$s=x.deserialize(t.penciler),qs=x.deserialize(t.translator),Xs=V(t.language),Ks=t.description,Js=x.deserialize(t.publisher),Zs=x.deserialize(t.imprint),_s=st(t.published),Qs=st(t.modified),js=Pt.deserialize(t.subject),tn=j.deserialize(t.belongsTo),en=F.deserialize(t.accessibility),sn=t.layout,nn=t.readingProgression,rn=N(t.duration),an=N(t.numberOfPages),on=kt.deserialize(t.tdm);let Kt=Object.assign({},t);return bt.mappedProperties.forEach(cn=>delete Kt[cn]),Object.keys(Kt).length===0&&(Kt=void 0),new bt({title:e,typeUri:i,conformsTo:n,identifier:r,altIdentifier:a,subtitle:o,sortAs:h,artists:g,authors:m,colorists:d,contributors:b,editors:y,illustrators:U,inkers:f,letterers:O,narrators:H,pencilers:$s,translators:qs,languages:Xs,description:Ks,publishers:Js,imprints:Zs,published:_s,modified:Qs,subjects:js,belongsTo:tn,layout:sn,readingProgression:nn,duration:rn,numberOfPages:an,accessibility:en,tdm:on,otherMetadata:Kt})}serialize(){const t={title:this.title.serialize()};if(this.typeUri!==void 0&&(t["@type"]=this.typeUri),this.conformsTo&&(t.conformsTo=this.conformsTo),this.identifier!==void 0&&(t.identifier=this.identifier),this.altIdentifier&&(t.altIdentifier=this.altIdentifier.serialize()),this.subtitle&&(t.subtitle=this.subtitle.serialize()),this.sortAs&&(t.sortAs=this.sortAs.serialize()),this.editors&&(t.editor=this.editors.serialize()),this.artists&&(t.artist=this.artists.serialize()),this.authors&&(t.author=this.authors.serialize()),this.colorists&&(t.colorist=this.colorists.serialize()),this.contributors&&(t.contributor=this.contributors.serialize()),this.illustrators&&(t.illustrator=this.illustrators.serialize()),this.letterers&&(t.letterer=this.letterers.serialize()),this.narrators&&(t.narrator=this.narrators.serialize()),this.pencilers&&(t.penciler=this.pencilers.serialize()),this.translators&&(t.translator=this.translators.serialize()),this.inkers&&(t.inker=this.inkers.serialize()),this.languages&&(t.language=this.languages),this.description!==void 0&&(t.description=this.description),this.publishers&&(t.publisher=this.publishers.serialize()),this.imprints&&(t.imprint=this.imprints.serialize()),this.published!==void 0&&(t.published=this.published.toISOString()),this.modified!==void 0&&(t.modified=this.modified.toISOString()),this.subjects&&(t.subject=this.subjects.serialize()),this.belongsTo&&(t.belongsTo=this.belongsTo.serialize()),this.layout&&(t.layout=this.layout),this.readingProgression&&(t.readingProgression=this.readingProgression),this.duration!==void 0&&(t.duration=this.duration),this.numberOfPages!==void 0&&(t.numberOfPages=this.numberOfPages),this.accessibility&&(t.accessibility=this.accessibility.serialize()),this.tdm&&(t.tdm=this.tdm.serialize()),this.otherMetadata){const e=this.otherMetadata;Object.keys(e).forEach(i=>t[i]=e[i])}return t}get effectiveLayout(){if(!this.conformsTo)return null;for(const t of this.conformsTo)switch(t){case tt.EPUB:return this.layout||q.reflowable;case tt.DIVINA:return this.layout===q.reflowable?q.fixed:this.layout||q.fixed;case tt.AUDIOBOOK:case tt.PDF:return null}return null}get effectiveReadingProgression(){if(this.readingProgression)return this.readingProgression;if(this.languages?.length!==1)return Y.ltr;const t=this.languages[0].toLowerCase();if(t==="zh-hant"||t==="zh-tw")return Y.rtl;switch(t.split("-")[0]){case"ar":return Y.rtl;case"fa":return Y.rtl;case"he":return Y.rtl;default:return Y.ltr}}};bt.mappedProperties=["title","@type","conformsTo","identifier","altIdentifier","subtitle","sortAs","artist","author","colorist","contributor","editor","illustrator","inker","letterer","narrator","penciler","translator","language","description","publisher","imprint","published","modified","subject","belongsTo","layout","readingProgression","duration","numberOfPages","accessibility","tdm"];let ct=bt;ct.prototype.getMediaOverlay=function(){const s=this.otherMetadata?.mediaOverlay;if(s)return Rt.deserialize(s)},k.prototype.getContains=function(){return new Set(this.otherProperties.contains||[])};class Dt{constructor(t){this.links=t.links,this.guided=t.guided}static deserialize(t){if(t)return new Dt({links:L.deserialize(t.links),guided:J.deserializeArray(t.guided)})}serialize(){const t={};return this.links!==void 0&&(t.links=this.links.serialize()),this.guided!==void 0&&(t.guided=this.guided.map(e=>e.serialize())),t}}class lt{constructor(t){this.plain=t.plain,this.ssml=t.ssml,this.language=t.language}static deserialize(t){if(t!=null){if(typeof t=="string")return new lt({plain:t});if(t.plain||t.ssml||t.language)return new lt({plain:t.plain,ssml:t.ssml,language:t.language})}}serialize(){const t={};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}}class J{constructor(t){this.audioref=t.audioref,this.children=t.children,this.imgref=t.imgref,this.role=t.role,this.level=t.level!==void 0?Math.min(6,Math.max(1,t.level)):void 0,this.text=t.text,this.textref=t.textref,this.description=t.description}get plainText(){return this.text?.plain}get ssmlText(){return this.text?.ssml}get textLanguage(){return this.text?.language}static deserialize(t){if(t)return new J({audioref:t.audioref,children:J.deserializeArray(t.children),imgref:t.imgref,role:t.role?new Set(V(t.role)):void 0,level:typeof t.level=="number"?t.level:void 0,text:lt.deserialize(t.text),textref:t.textref,description:J.deserialize(t.description)})}static deserializeArray(t){if(Array.isArray(t))return t.map(e=>J.deserialize(e)).filter(e=>e!==void 0)}serialize(){const t={};if(this.audioref!==void 0&&(t.audioref=this.audioref),this.children!==void 0&&(t.children=this.children.map(e=>e.serialize())),this.imgref!==void 0&&(t.imgref=this.imgref),this.role!==void 0&&(t.role=nt(this.role)),this.level!==void 0&&(t.level=this.level),this.text!==void 0){const e=this.text.serialize();e!==void 0&&(t.text=e)}return this.textref!==void 0&&(t.textref=this.textref),this.description&&(t.description=this.description.serialize()),t}get audioFile(){return this.audioref?.split("#")[0]}get audioTime(){if(this.audioref?.includes("#"))return this.audioref.split("#",2)[1]}get textFile(){return this.textref?.split("#")[0]}get fragmentId(){if(this.textref?.includes("#"))return this.textref.split("#",2)[1]}get clip(){const t=this.audioFile;if(!t)return;const e=this.audioTime,i={audioResource:t,fragmentId:this.fragmentId};if(!e)return i;const n=this.parseTimer(e);return i.start=n[0],i.end=n[1],i}parseTimer(t){if(!t||!t.startsWith("t="))return[void 0,void 0];const e=t.substring(2).split(",").map(i=>parseFloat(i));return e.length===1?[isNaN(e[0])?void 0:e[0],void 0]:e.length>2?[void 0,void 0]:[isNaN(e[0])?void 0:e[0],isNaN(e[1])?void 0:e[1]]}}function li(s,t){return t.length>1?t.indexOf(s.slice(-1))>-1:s.slice(-1)===t}function ui(s,t){return s.slice(s.length-t.length)===t}const Jt={endsWith:ui,endsWithChar:li},hi=["ie","eg","ext","Fig","fig","Figs","figs","et al","Co","Corp","Ave","Inc","Ex","Viz","vs","Vs","repr","Rep","Dem","trans","Vol","pp","rev","est","Ref","Refs","Eq","Eqs","Ch","Sec","Secs","mi","Dept","Univ","Nos","No","Mol","Cell","Miss","Mrs","Mr","Ms","Prof","Dr","Sgt","Col","Gen","Rep","Sen","Gov","Lt","Maj","Capt","St","Sr","Jr","jr","Rev","PhD","MD","BA","MA","MM","BSc","MSc","Jan","Feb","Mar","Apr","Jun","Jul","Aug","Sep","Sept","Oct","Nov","Dec","Sun","Mon","Tu","Tue","Tues","Wed","Th","Thu","Thur","Thurs","Fri","Sat"];function Ae(s){return/^[A-Z][a-z].*/.test(s)||Zt(s)}function di(s){return Ae(s)||/``|"|'/.test(s.substring(0,2))}function fi(s){return~hi.indexOf(s.replace(/\W+/g,""))}function pi(s,t){if(s==="a.m."||s==="p.m."){var e=t.replace(/\W+/g,"").slice(-3).toLowerCase();if(e==="day")return!0}return!1}function ye(s){var t=s.replace(/[\(\)\[\]\{\}]/g,"").match(/(.\.)*/);return t&&t[0].length>0}function we(s){return s.length<=3?!0:Ae(s)}function Zt(s,t){return t&&(s=s.slice(t-1,t+2)),!isNaN(Number(s))}function mi(s){return s.match(/^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$/)}function gi(s){return s.match(/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/)}function bi(s){var t=0;if((t=s.indexOf("."))>-1||(t=s.indexOf("!"))>-1||(t=s.indexOf("?"))>-1){var e=s.charAt(t+1);if(e.match(/[a-zA-Z].*/))return[s.slice(0,t),s.charAt(t),s.slice(t+1)]}return!1}function vi(s){return s==="."||s==="!"||s==="?"}function Ai(s,t){t=Object.assign(t||{},{newlineBoundary:t&&t.newlineBoundary||!0});var e=/\s/;return s.serie(s.re(e,{split:!0}),s.splitAndMerge(function(i,n,r,a,o,h){var g,m=[i,null],d=i,b=h.slice(o+1).find(function(U){return!e.test(U.value)});if(i===`
2
+ `&&t.newlineBoundary||vi(i)||Jt.endsWithChar(i,"?!"))return m;if(Jt.endsWithChar(i,".")){if(b){if(i.length===2&&isNaN(i.charAt(0))&&i.match(/[a-zA-Z]/)||fi(i))return d;if(di(b.value)){if(pi(i,b.value)||Zt(b.value)&&we(i))return d}else if(Jt.endsWith(i,"..")||ye(i)||we(i))return d}return m}let y;return(y=i.indexOf("."))>-1&&(Zt(i,y)||ye(i)||gi(i)||mi(i))?d:(g=bi(i))?[g[0]+g[1],null,g[2]]:d}),s.filter(function(i){return i.trim()!=""}))}const yi=(s,...t)=>(...e)=>s(...t,...e);function wi(s){return{sentences:yi(Ai,s)}}function Si(s,t){return t?s.reduce(function(e,i){var n=[i.index,i.offset,i.value].join("-");return[e,n].join(":")},t):null}function Ei(s){const{index:t,offset:e,value:i,...n}=s;return n}function Ti(s,t){var e=0;return Array.isArray(t)||(t=[t]),t.map(function(i){return i===null?null:(typeof i=="string"&&(i={value:i,index:e,offset:i.length}),typeof i=="object"&&(i.index=i.index||0,e=e+i.index+i.offset,i.index=s.index+i.index,i.offset=i.offset||i.value.length),i)})}function Ii(s,t){if(s.length==0)return null;var e="",i=0,n=s[0]?.index;return s.forEach(function(r,a){var o=s[a-1];s[a+1];var h=o?r.index+1-(o.index+o.offset):0;e=e+new Array(h).join(t)+r.value;var g=r.index-n+r.offset;g>i&&(i=g)}),{index:n,value:e,offset:Math.max(i,e.length)}}const ut={tokensId:Si,normalize:Ti,properties:Ei,merge:Ii};var Ni=' \r\n  !"#$%&()*+,-.\\/:;<=>?@[\\]^_`{|}~',Li=new RegExp("([^"+Ni+"]+)");function C(s){if(!(this instanceof C))return new C(s);this.opts=Object.assign({cacheGet:function(t){return null},cacheSet:function(t,e){}},s)}C.prototype.split=function(t,e={}){var i=this;return e=Object.assign({preserveProperties:!0,cache:()=>null},e),function(n,r){if(arguments.length===6)return t.apply(null,arguments);var a,o,h;if(n===void 0)return[];if(typeof n=="string"?n=[{value:n,index:0,offset:n.length}]:Array.isArray(n)||(n=[n]),o=ut.tokensId(n,e.cache()),o&&(h=i.opts.cacheGet(o),h))return h;var g=n.map(function(m,d){var b=n[d+1],y=t(m.value,Object.assign({},m),a?Object.assign({},a):null,b?Object.assign({},b):null,d,n)||[];if(y=ut.normalize(m,y),e.preserveProperties){var U=ut.properties(m);y=y.map(function(f){return Object.assign({},f,U)})}return a=m,y}).filter(Boolean).flat();return o&&i.opts.cacheSet(o,g),g}},C.prototype.re=function(t,e={}){return e=Object.assign({split:!1},e),this.split(function(i,n){for(var r=i,a=[],o,h=0;o=t.exec(i);){var g=o.index,m=h+g,d=o[0]||"",b=d.length;if(e.split&&h<m){var y=r.slice(h,m);a.push({value:y,index:h,offset:y.length})}a.push({value:d,index:m,offset:b,match:o}),i=i.slice(g+b),h=m+b}return e.split&&i&&a.push({value:i,index:h,offset:i.length}),a},{cache:function(){return t.toString()}})},C.prototype.splitAndMerge=function(t,e={}){var i=this;return e=Object.assign({mergeWith:""},e),function(n){var r=[],a=[];function o(){if(a.length!=0){var h=ut.merge(a,e.mergeWith);r.push(h),a=[]}}return i.split(function(h,g){var m=t.apply(null,arguments);m=ut.normalize(g,m),m.forEach(function(d){d===null?o():a.push(d)})})(n),o(),r}},C.prototype.filter=function(t){return this.split(function(e,i){if(t.apply(null,arguments))return{value:i.value,index:0,offset:i.offset}})},C.prototype.extend=function(t){return this.split(function(e,i){var n=typeof t=="function"?t.apply(null,arguments):t;return Object.assign({value:i.value,index:0,offset:i.offset},n)})},C.prototype.ifthen=function(s,t){return this.split(function(e,i){if(s.apply(null,arguments))return t.apply(null,arguments);const{index:n,...r}=i;return r})},C.prototype.test=function(t){return this.filter(function(e,i){return t.test(e)},{cache:t.toString()})},C.prototype.flow=function(...t){const e=t.reduce((i,n)=>(...r)=>n(i(...r)));return this.split(e)},C.prototype.serie=function(...t){return t.reduce((e,i)=>(...n)=>i(e(...n)))},C.prototype.merge=function(){return this.splitAndMerge(s=>[s])},C.prototype.sections=function(){return this.re(/([^\n\.,;!?]+)/i,{split:!1})},C.prototype.words=function(){return this.re(Li)},C.prototype.characters=function(){return this.re(/[^\s]/)};var Se=(s=>(s.Word="word",s.Sentence="sentence",s.Paragraph="paragraph",s))(Se||{});const Ee=(s,t)=>"Segmenter"in Intl?new Te(s,t):new Ie(s,t);class Te{constructor(t,e){if(this.unit=e,t=t??navigator?.language,!("Segmenter"in Intl))throw new Error("Intl.Segmenter is not supported in this environment");if(e==="paragraph")throw new Error("IntlTextTokenizer does not handle TextUnit.Paragraph");this.segmenter=new Intl.Segmenter(t,{granularity:e})}tokenize(t){const e=this.segmenter.segment(t),i=[];for(let n of e){if(this.unit==="word"&&n.isWordLike===!1)continue;const r=_t(n.segment);r!==null&&i.push([n.index,n.index+r.length])}return i}}class Ie{constructor(t,e){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");this.tokenizer=new C}tokenize(t){let e=[];switch(this.unit){case"word":e=this.tokenizer.words()(t);break;case"sentence":this.isEnglish?e=wi(this.tokenizer).sentences()(t):e=this.tokenizer.sections()(t);break;default:e=[]}if(!e)return[];const i=[];return e.forEach(n=>{if(n.value.length===0)return;const r=_t(n.value);r!==null&&i.push([n.index,n.index+r.length])}),i}}const xi=new RegExp("[\\p{L}\\p{N}]+","u"),_t=s=>{const t=s.trimEnd();return t.length===0||t.match(xi)===null?null:t};class ${constructor(t){this.fetcher=new Z,t.fetcher&&(this.fetcher=t.fetcher),this.manifest=t.manifest,this.context=t.manifest.context,this.metadata=t.manifest.metadata,this.links=t.manifest.links,this.readingOrder=t.manifest.readingOrder,this.resources=t.manifest.resources,this.toc=t.manifest.toc,this.subcollections=t.manifest.subcollections}get baseURL(){return this.manifest.baseURL}linkWithHref(t){return this.manifest.linkWithHref(t)}linksWithRole(t){const e=this.subcollections?.get(t);return e&&e.length>0?e[0].links:void 0}linksWithRel(t){return this.manifest.linksWithRel(t)}linkWithRel(t){return this.manifest.linkWithRel(t)}async positionsFromManifest(){const t=this.manifest.links.findWithMediaType("application/vnd.readium.position-list+json");if(t===void 0)return[];const e=await this.get(t).readAsJSON();return e.total?e.positions.map(i=>D.deserialize(i)).filter(i=>i!==void 0):[]}async guideForLink(t){const e=a=>a.alternates?.findWithMediaType("application/guided-navigation+json");let i=e(t);if(!i){const a=this.linkWithHref(t.href);a!==void 0&&(i=e(a))}if(i||(i=this.manifest.links.findWithMediaType("application/guided-navigation+json")),!i)return;let n=i.href;if(i.templated){const a=new rt(n),o={};a.parameters.has("ref")&&(o.ref=t.href),n=new rt(n).expand(o)}const r=await this.get(new M({href:n})).readAsJSON();return Dt.deserialize(r)}get(t){return this.fetcher.get(t)}}$.prototype.getPageList=function(){return this.linksWithRole("pageList")},$.prototype.getLandmarks=function(){return this.linksWithRole("landmarks")},$.prototype.getListOfAudioClips=function(){return this.linksWithRole("loa")},$.prototype.getListOfIllustrations=function(){return this.linksWithRole("loi")},$.prototype.getListOfTables=function(){return this.linksWithRole("lot")},$.prototype.getListOfVideoClips=function(){return this.linksWithRole("lov")};class ht{constructor(t){this.cssSelector=t.cssSelector,this.textNodeIndex=t.textNodeIndex,this.charOffset=t.charOffset}static deserialize(t){if(!(t&&t.cssSelector))return;let e=N(t.textNodeIndex);if(e===void 0)return;let i=N(t.charOffset);return i===void 0&&(i=N(t.offset)),new ht({cssSelector:t.cssSelector,textNodeIndex:e,charOffset:i})}serialize(){const t={cssSelector:this.cssSelector,textNodeIndex:this.textNodeIndex};return this.charOffset!==void 0&&(t.charOffset=this.charOffset),t}}class Ut{constructor(t){this.start=t.start,this.end=t.end}static deserialize(t){if(!t)return;let e=ht.deserialize(t.start);if(e)return new Ut({start:e,end:ht.deserialize(t.end)})}serialize(){const t={start:this.start.serialize()};return this.end&&(t.end=this.end.serialize()),t}}I.prototype.getCssSelector=function(){return this.otherLocations?.get("cssSelector")},I.prototype.getPartialCfi=function(){return this.otherLocations?.get("partialCfi")},I.prototype.getDomRange=function(){return Ut.deserialize(this.otherLocations?.get("domRange"))},I.prototype.fragmentParameters=function(){return new Map(this.fragments.map(s=>s.startsWith("#")?s.slice(1):s).join("&").split("&").filter(s=>!s.startsWith("#")).map(s=>s.split("=")).filter(s=>s.length===2).map(s=>[s[0].trim().toLowerCase(),s[1].trim()]))},I.prototype.htmlId=function(){if(!this.fragments.length)return;let s=this.fragments.find(t=>t.length&&!t.includes("="));if(!s){const t=this.fragmentParameters();t.has("id")?s=t.get("id"):t.has("name")&&(s=t.get("name"))}return s?.startsWith("#")?s.slice(1):s},I.prototype.page=function(){const s=parseInt(this.fragmentParameters().get("page"));if(!isNaN(s)&&s>=0)return s},I.prototype.time=function(){const s=parseInt(this.fragmentParameters().get("t"));if(!isNaN(s))return s},I.prototype.space=function(){const s=this.fragmentParameters();if(!s.has("xywh"))return;const t=s.get("xywh").split(",").map(e=>parseInt(e));if(t.length===4&&!t.some(isNaN))return t};class Mt{constructor(t){this.currency=t.currency,this.value=t.value}static deserialize(t){if(!t)return;let e=t.currency;if(!(e&&typeof e=="string"&&e.length>0))return;let i=N(t.value);if(i!==void 0)return new Mt({currency:e,value:i})}serialize(){return{currency:this.currency,value:this.value}}}class et{constructor(t){this.type=t.type,this.children=t.children}static deserialize(t){if(t&&t.type)return new et({type:t.type,children:et.deserializeArray(t.children)})}static deserializeArray(t){if(Array.isArray(t))return t.map(e=>et.deserialize(e)).filter(e=>e!==void 0)}serialize(){const t={type:this.type};return this.children&&(t.children=this.children.map(e=>e.serialize())),t}}class Bt{constructor(t){this.total=t.total,this.position=t.position}static deserialize(t){if(t)return new Bt({total:N(t.total),position:N(t.position)})}serialize(){const t={};return this.total!==void 0&&(t.total=this.total),this.position!==void 0&&(t.position=this.position),t}}class Gt{constructor(t){this.total=t.total,this.available=t.available}static deserialize(t){if(t)return new Gt({total:N(t.total),available:N(t.available)})}serialize(){const t={};return this.total!==void 0&&(t.total=this.total),this.available!==void 0&&(t.available=this.available),t}}var Ne=(s=>(s.available="available",s.reserved="reserved",s.ready="ready",s))(Ne||{});class Wt{constructor(t){this.state=t.state,this.since=t.since,this.until=t.until}static deserialize(t){if(t&&t.state)return new Wt({state:t.state,since:st(t.since),until:st(t.until)})}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}}k.prototype.getNumberOfItems=function(){return N(this.otherProperties.numberOfItems)},k.prototype.getPrice=function(){return Mt.deserialize(this.otherProperties.price)},k.prototype.getIndirectAcquisitions=function(){const s=this.otherProperties.indirectAcquisition;if(s&&Array.isArray(s))return s.map(t=>et.deserialize(t)).filter(t=>t!==void 0)},k.prototype.getHolds=function(){return Bt.deserialize(this.otherProperties.holds)},k.prototype.getCopies=function(){return Gt.deserialize(this.otherProperties.copies)},k.prototype.getAvailability=function(){return Wt.deserialize(this.otherProperties.availability)},k.prototype.getAuthenticate=function(){return M.deserialize(this.otherProperties.authenticate)},$.prototype.getImages=function(){return this.linksWithRole("images")};class Oi{text(t=`
3
+ `){return this.elements().map(e=>e?.text).filter(e=>e!==void 0&&e.length>0).join(t)}elements(){const t=[],e=this.iterator();for(;e.hasNext();)t.push(e.next());return t}}class Qt{constructor(t,e){this.key=t,this.value=e}}var Ht=(s=>(s.ACCESSIBILITY_LABEL="accessibilityLabel",s.LANGUAGE="language",s))(Ht||{});class jt{constructor(t=[]){this._attributes=t}get language(){return this.attribute("language")}get accessibilityLabel(){return this.attribute("accessibilityLabel")}attribute(t){return this._attributes.find(e=>e.key===t)?.value}attributes(t){return this._attributes.filter(e=>e.key===t).map(e=>e.value)}}class te extends jt{constructor(t,e=[]){super(e),this.locator=t}}class dt extends te{get text(){return this.accessibilityLabel}}class Le extends dt{constructor(t,e,i=[]){super(t,i),this.embeddedLink=e}}class xe extends dt{constructor(t,e,i=[]){super(t,i),this.embeddedLink=e}}class Oe extends dt{constructor(t,e,i,n=[]){super(t,n),this.embeddedLink=e,this.caption=i}get text(){return(this.caption?.length||0)>0?this.caption:super.text}}class ee extends jt{constructor(t,e,i=[]){super(i),this.locator=t,this.text=e}}class Ft extends dt{constructor(t,e,i,n=[]){super(t,n),this.role=e,this.segments=i}get text(){return this.segments.map(t=>t.text).join("")}}class ze{constructor(t){this.level=t}get role(){return`heading-${this.level}`}}const Ce={role:"body"},Re={role:"footnote"};class Pe{constructor(t,e){this.referenceUrl=t,this.referenceTitle=e,this.role="quote"}}class zi{constructor(t,e,i=50,n=r=>Ee(r,e)){this.defaultLanguage=t,this.contextSnippetLength=i,this.textTokenizerFactory=n}tokenize(t){return t instanceof Ft?[new Ft(t.locator,t.role,t.segments.map(e=>this.tokenizeSegment(e)).flat())]:[t]}tokenizeSegment(t){return this.textTokenizerFactory(t.language??this.defaultLanguage).tokenize(t.text).map(e=>new ee(new D({href:t.locator.href,type:t.locator.type,title:t.locator.title,locations:t.locator.locations,text:this.extractTextContextIn(t.text,e)}),t.text.substring(e[0],e[1]),t._attributes))}extractTextContextIn(t,e){const i=t.substring(e[1],e[1]+this.contextSnippetLength),n=t.substring(e[0]-this.contextSnippetLength,e[0]);return new Q({after:i.length>0?i:void 0,before:n.length>0?n:void 0,highlight:t.substring(e[0],e[1])})}}class it extends Error{constructor(t){super(t)}}class Vt{async nextOrNull(){return await this.hasNext()?this.next():null}async previousOrNull(){return await this.hasPrevious()?this.previous():null}}let Ci=class{constructor(t,e){this.element=t,this.direction=e}};class Ri extends Vt{constructor(t,e,i){super(),this.publication=t,this.startLocator=e,this.resourceContentIteratorFactories=i,this._currentIterator=null,this.currentElement=null}async hasPrevious(){return this.currentElement=await this.nextIn(-1),this.currentElement!==null}previous(){if(this.currentElement?.direction!==-1)throw new it("Called previous() without a successful call to hasPrevious() first");return this.currentElement.element}async hasNext(){return this.currentElement=await this.nextIn(1),this.currentElement!==null}next(){if(this.currentElement?.direction!==1)throw new it("Called next() without a successful call to hasNext() first");return this.currentElement.element}async nextIn(t){const e=this.currentIterator;if(!e)return null;const i=await e.nextContentIn(t);if(!i){const n=this.nextIteratorIn(t,e.index);return n?(this._currentIterator=n,this.nextIn(t)):null}return new Ci(i,t)}get currentIterator(){return this._currentIterator||(this._currentIterator=this.initialIterator()),this._currentIterator}initialIterator(){const t=this.startLocator?this.publication.readingOrder.findIndexWithHref(this.startLocator.href):0,e=this.startLocator||0;return this.loadIteratorAt(t,e)??this.nextIteratorIn(1,t)}nextIteratorIn(t,e){const i=e+t;if(i<0||i>=this.publication.manifest.readingOrder.items.length)return null;const n=t===1?0:1;return this.loadIteratorAt(i,n)??this.nextIteratorIn(t,i)}loadIteratorAt(t,e){const i=this.publication.readingOrder.items[t],n=typeof e=="number"?this.publication.manifest.locatorFromLink(i)?.copyWithLocations({progression:e}):e;if(!n)return null;const r=this.publication.get(i);for(const a of this.resourceContentIteratorFactories)a(r,n);return null}}class Yt extends te{constructor(t,e,i=[]){super(t,i),this.element=e}get text(){return this.element.text}}class ke{constructor(t,e){this.element=t,this.direction=e}}class Pi extends Vt{constructor(t,e){super(),this.pageContent=t,this.startLocator=e,this.pageContentFiltered=[],this.currentElement=null,this.currentProgression=0,this.currentElementIndex=0;const i=this.pageContent.filter(n=>n?.str!==" "&&n?.str!=="");if(this.pageContentFiltered=i.map(n=>new Yt(n.locator,{index:i.indexOf(n),text:n.str,readingDirection:n.dir})),this.startLocator&&(this.currentProgression=this.startLocator?.locations?.progression||0,this.updateElementIndex()),this.pageContentFiltered.length>0){const n=this.currentElementIndex;(n||n===0)&&(this.currentElement=new ke(this.pageContentFiltered[n],1))}}current(){return this.currentElement?this.currentElement.element:null}async hasPrevious(){return this.currentElement?.direction,this.nextIn(-1)!==null}previous(){if(!this.currentElement)throw new it("Called next() without a successful call to hasNext() first");if(this.currentElement=this.nextIn(-1),this.currentElementIndex&&this.currentElementIndex>0){const t=this.currentElementIndex-1;this.currentProgression=t/this.pageContentFiltered.length*100,this.currentElementIndex=t}return this.currentElement?this.currentElement.element:new Yt(new D({href:"",type:""}),{index:-1,text:""})}async hasNext(){return this.currentElement?.direction,this.nextIn(1)!==null}next(){this.currentElement=this.nextIn(1);const t=this.currentElementIndex;if(t!==null&&t>=0&&t<this.pageContentFiltered.length-1){const e=t+1;this.currentProgression=e/this.pageContentFiltered.length*100,this.currentElementIndex=e}return this.currentElement?this.currentElement.element:new Yt(new D({href:"",type:""}),{index:-1,text:""})}nextIn(t){const e=this.currentElementIndex;if(e===null||e===this.pageContentFiltered.length-1&&t===1||e===0&&t===-1)return null;const i=this.pageContentFiltered[e+t];return i?new ke(i,t):null}updateElementIndex(){return this.currentProgression===0?0:this.currentProgression<0||this.currentProgression>=100?null:Math.floor(this.currentProgression*this.pageContentFiltered.length/100)}}const ki=["OBJECT","BASE","FONT","TT","I","B","U","BIG","SMALL","EM","STRONG","DFN","CODE","SAMP","KBD","VAR","CITE","ABBR","TIME","ACRONYM","MARK","RUBY","RT","RP","RTC","A","IMG","BR","WBR","MAP","Q","SUB","SUP","BDO","IFRAME","EMBED","SPAN","INPUT","SELECT","TEXTAREA","LABEL","BUTTON","OPTGROUP","OPTION","LEGEND","DATALIST","KEYGEN","OUTPUT","PROGRESS","METER","AREA","PARAM","SOURCE","TRACK","SUMMARY","COMMAND","DEVICE","BASEFONT","BGSOUND","MENUITEM","DATA","BDI","S","STRIKE","NOBR","RB"];function De(s){return ki.includes(s.nodeName.toUpperCase())}function ie(s,t){const e=s.getAttribute("src");if(!e?.length)return null;try{return new URL(e,t).toString()}catch{return e}}const ft="[\\s\\u0085\\u00A0\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]",Di=new RegExp(`^${ft}+$`,"g"),Ui=new RegExp(`^${ft}+|${ft}+$/g`,"g"),Ue=new RegExp(`^${ft}+`,"g"),Me=new RegExp(`${ft}+$`,"g"),$t=s=>s?.length?Di.test(s):!0,Be=s=>s.replace(Ui,""),Mi=s=>s.replace(Ue,""),Bi=s=>s.replace(Me,""),Ge=(s,t="")=>new Q({before:t+(Ue.exec(s)?.[0]??""),highlight:Be(s),after:Me.exec(s)?.[0]??""});function Gi(s){for(;s;){let t=s.getAttribute("lang")||s.getAttributeNS("http://www.w3.org/1999/xhtml","lang")||s.getAttributeNS("http://www.w3.org/XML/1998/namespace","lang");if(t)return t;s=s.parentElement}return null}function Wi(s,t){const e=s.length>0&&s[s.length-1]===" ";let i=!1,n=!1;for(let r=0;r<t.length;r++)if($t(t[r])){if(e&&!n||i)continue;s+=" ",i=!0}else{const a=t.charCodeAt(r);a!==8203&&a!==173&&(s+=t[r],i=!1,n=!0)}return s}function We(s){return typeof s=="object"&&s!==null&&s.nodeType===Node.ELEMENT_NODE}const qt={NONE:"",DESCENDANT:" ",CHILD:" > "},T={id:"id",class:"class",tag:"tag",attribute:"attribute",nthchild:"nthchild",nthoftype:"nthoftype"};function Hi(s,t){return Object.values(s).includes(t)}const Fi="CssSelectorGenerator";function Xt(s="unknown problem",...t){console.warn(`${Fi}: ${s}`,...t)}const Vi={selectors:[T.id,T.class,T.tag,T.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY,useScope:!1};function Yi(s){return Array.isArray(s)?s.filter(t=>Hi(T,t)):[]}function He(s){return s instanceof RegExp}function $i(s){return["string","function"].includes(typeof s)||He(s)}function Fe(s){return Array.isArray(s)?s.filter($i):[]}function qi(s){return s instanceof Node}function Ve(s){const t=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return qi(s)&&t.includes(s.nodeType)}function Ye(s,t){if(Ve(s))return s.contains(t)||Xt("element root mismatch","Provided root does not contain the element. This will most likely result in producing a fallback selector using element's real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended."),s;const e=t.getRootNode({composed:!1});return Ve(e)?(e!==document&&Xt("shadow root inferred","You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."),e):ae(t)}function se(s){return typeof s=="number"?s:Number.POSITIVE_INFINITY}function Xi(s,t={}){const e=Object.assign(Object.assign({},Vi),t);return{selectors:Yi(e.selectors),whitelist:Fe(e.whitelist),blacklist:Fe(e.blacklist),root:Ye(e.root,s),combineWithinSelector:!!e.combineWithinSelector,combineBetweenSelectors:!!e.combineBetweenSelectors,includeTag:!!e.includeTag,maxCombinations:se(e.maxCombinations),maxCandidates:se(e.maxCandidates),useScope:!!e.useScope,maxResults:se(e.maxResults)}}function pt(s=[]){const[t=[],...e]=s;return e.length===0?t:e.reduce((i,n)=>i.filter(r=>n.includes(r)),t)}function Ki(s){return[].concat(...s)}function Ji(s){return s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".+")}function ne(s){const t=s.map(e=>{if(He(e))return i=>e.test(i);if(typeof e=="function")return i=>{const n=e(i);return typeof n!="boolean"?(Xt("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 i=new RegExp("^"+Ji(e)+"$");return n=>i.test(n)}return Xt("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(i=>i(e))}function re(s,t,e){const i=Array.from(Ye(e,s[0]).querySelectorAll(t));return i.length===s.length&&s.every(n=>i.includes(n))}function $e(s,t){t=t??ae(s);const e=[];let i=s;for(;We(i)&&i!==t;)e.push(i),i=i.parentElement;return e}function Zi(s,t){return pt(s.map(e=>$e(e,t)))}function ae(s){return s.ownerDocument.querySelector(":root")}const qe=", ",_i=new RegExp(["^$","\\s"].join("|")),Qi=new RegExp(["^$"].join("|")),Xe=[T.nthoftype,T.tag,T.id,T.class,T.attribute,T.nthchild],ji=ne(["class","id","ng-*"]);function ts({name:s}){return`[${s}]`}function es({name:s,value:t}){return`[${s}='${t}']`}function is({nodeName:s,nodeValue:t},e){const i=e.tagName.toLowerCase();return["input","option"].includes(i)&&s==="value"||s==="src"&&t?.startsWith("data:")?!1:!ji(s)}function ss({nodeName:s,nodeValue:t}){return{name:mt(s),value:mt(t??void 0)}}function Ke(s){const t=Array.from(s.attributes).filter(e=>is(e,s)).map(ss);return[...t.map(ts),...t.map(es)]}function ns(s){const t=s.map(Ke);return pt(t)}function Je(s){var t;return((t=s.getAttribute("class"))!==null&&t!==void 0?t:"").trim().split(/\s+/).filter(e=>!Qi.test(e)).map(e=>`.${mt(e)}`)}function rs(s){const t=s.map(Je);return pt(t)}function Ze(s){var t;const e=(t=s.getAttribute("id"))!==null&&t!==void 0?t:"",i=`#${mt(e)}`,n=s.getRootNode({composed:!1});return!_i.test(e)&&re([s],i,n)?[i]:[]}function as(s){return s.length===0||s.length>1?[]:Ze(s[0])}function _e(s){var t;const e=(t=s.parentElement)===null||t===void 0?void 0:t.children;if(e){for(let i=0;i<e.length;i++)if(e[i]===s)return[`:nth-child(${String(i+1)})`]}return[]}function os(s){return pt(s.map(_e))}function Qe(s){return[mt(s.tagName.toLowerCase())]}function je(s){const t=[...new Set(Ki(s.map(Qe)))];return t.length===0||t.length>1?[]:[t[0]]}function ti(s){const t=je([s])[0],e=s.parentElement;if(e){const n=Array.from(e.children).filter(r=>r.tagName.toLowerCase()===t).indexOf(s);if(n>-1)return[`${t}:nth-of-type(${String(n+1)})`]}return[]}function cs(s){return pt(s.map(ti))}function*ei(s=[],{maxResults:t=Number.POSITIVE_INFINITY}={}){let e=0,i=oe(1);for(;i.length<=s.length&&e<t;)e+=1,yield i.map(r=>s[r]),i=us(i,s.length-1)}function ls(s=[],{maxResults:t=Number.POSITIVE_INFINITY}={}){return Array.from(ei(s,{maxResults:t}))}function us(s=[],t=0){const e=s.length;if(e===0)return[];const i=[...s];i[e-1]+=1;for(let n=e-1;n>=0;n--)if(i[n]>t){if(n===0)return oe(e+1);i[n-1]++,i[n]=i[n-1]+1}return i[e-1]>t?oe(e+1):i}function oe(s=1){return Array.from(Array(s).keys())}function*hs(s={}){const t=Object.entries(s);if(t.length===0)return;const e=[{index:t.length-1,partial:{}}];for(;e.length>0;){const i=e.pop();if(!i)break;const{index:n,partial:r}=i;if(n<0){yield r;continue}const[a,o]=t[n];for(let h=o.length-1;h>=0;h--)e.push({index:n-1,partial:Object.assign(Object.assign({},r),{[a]:o[h]})})}}const ds="3a".toUpperCase(),fs=/[ !"#$%&'()\[\]{|}<>*+,./;=?@^`~\\]/;function mt(s=""){return CSS?CSS.escape(s):ps(s)}function ps(s=""){return s.split("").map(t=>t===":"?`\\${ds} `:fs.test(t)?`\\${t}`:escape(t).replace(/%/g,"\\")).join("")}const ms={tag:je,id:as,class:rs,attribute:ns,nthchild:os,nthoftype:cs},gs={tag:Qe,id:Ze,class:Je,attribute:Ke,nthchild:_e,nthoftype:ti};function bs(s,t){return gs[t](s)}function vs(s,t){const e=ms[t];return e(s)}function As(s=[],t,e){return s.filter(i=>e(i)||!t(i))}function ys(s=[],t){return s.sort((e,i)=>{const n=t(e),r=t(i);return n&&!r?-1:!n&&r?1:0})}function*ws(s,t){const e=new Set,i=Ss(s,t);for(const n of Ns(i,t))e.has(n)||(e.add(n),yield n)}function Ss(s,t){const{blacklist:e,whitelist:i,combineWithinSelector:n,maxCombinations:r}=t,a=ne(e),o=ne(i),h=(g,m)=>{const d=vs(s,m),b=As(d,a,o),y=ys(b,o);return g[m]=n?Array.from(ei(y,{maxResults:r})):y.map(U=>[U]),g};return Es(t).reduce(h,{})}function Es(s){const{selectors:t,includeTag:e}=s,i=[...t];return e&&!i.includes("tag")&&i.push("tag"),i}function Ts(s){return s.includes(T.tag)||s.includes(T.nthoftype)?[...s]:[...s,T.tag]}function Is(s){const{selectors:t,combineBetweenSelectors:e,includeTag:i,maxCandidates:n}=s,r=e?ls(t,{maxResults:n}):t.map(a=>[a]);return i?r.map(Ts):r}function*Ns(s,t){for(const e of Is(t))yield*Ls(e,s)}function*Ls(s,t){const e={};for(const i of s){const n=t[i];n&&n.length>0&&(e[i]=n)}for(const i of hs(e))yield Os(i)}function xs(s,t){return t[s]?t[s].join(""):""}function Os(s={}){const t=[...Xe];return s[T.tag]&&s[T.nthoftype]&&t.splice(t.indexOf(T.tag),1),t.map(e=>xs(e,s)).join("")}function zs(s,t){return[...s.map(e=>t+qt.DESCENDANT+e),...s.map(e=>t+qt.CHILD+e)]}function*Cs(s,t){if(t==="")yield*s;else for(const e of s)yield*zs([e],t)}function*Rs(s,t,e="",i){const n=ws(s,i);for(const r of Cs(n,e))re(s,r,t)&&(yield r)}function*Ps(s,t,e="",i){if(s.length===0)return null;const n=[s.length>1?s:[],...Zi(s,t).map(r=>[r])];for(const r of n)for(const a of Rs(r,t,e,i))yield{foundElements:r,selector:a}}function*ks({elements:s,root:t,rootSelector:e="",options:i}){let n=t,r=e,a=!0;for(;a;){let o=!1;for(const h of Ps(s,n,r,i)){const{foundElements:g,selector:m}=h;if(o=!0,re(s,m,t))yield m;else{n=g[0],r=m;break}}o||(a=!1)}}function Ds(s){(s instanceof NodeList||s instanceof HTMLCollection)&&(s=Array.from(s));const t=(Array.isArray(s)?s:[s]).filter(We);return[...new Set(t)]}function Us(s){return{value:s,include:!1}}function Ms(s,t,e=qt.NONE){const i={};return t.forEach(n=>{Reflect.set(i,n,bs(s,n).map(Us))}),{element:s,operator:e,selectors:i}}function Bs({selectors:s,operator:t}){let e=[...Xe];s[T.tag]&&s[T.nthoftype]&&(e=e.filter(n=>n!==T.tag));let i="";return e.forEach(n=>{var r;((r=s[n])!==null&&r!==void 0?r:[]).forEach(({value:o,include:h})=>{h&&(i+=o)})}),t+i}function Gs(s,t){const i=$e(s,t).reverse().map(n=>{var r;const a=Ms(n,[T.nthchild],qt.CHILD);return((r=a.selectors.nthchild)!==null&&r!==void 0?r:[]).forEach(o=>{o.include=!0}),a});return[t?":scope":":root",...i.map(Bs)].join("")}function Ws(s,t){return s.map(e=>Gs(e,t)).join(qe)}function ii(s,t={}){const e=Object.assign(Object.assign({},t),{maxResults:1});return Hs(s,e).next().value}function*Hs(s,t={}){var e;const i=Ds(s),n=Xi(i[0],t),r=(e=n.root)!==null&&e!==void 0?e:ae(i[0]);let a=0;for(const o of ks({elements:i,options:n,root:r,rootSelector:""}))if(yield o,a++,a>=n.maxResults)return;i.length>1&&(yield i.map(o=>ii(o,n)).join(qe),a++,a>=n.maxResults)||(yield Ws(i,n.useScope?r:void 0))}class Fs extends Vt{constructor(t,e,i=50){super(),this.resource=t,this.locator=e,this.beforeMaxLength=i,this.currentElement=null,this.currentIndex=null,this.parsedElementRecipes=null,this.parser=null}async hasPrevious(){if(this.currentElement?.delta===-1)return!0;const t=await this.elements(),e=(this.currentIndex??t.startIndex)-1,i=t.elements.at(e);return i?(this.currentIndex=e,this.currentElement={delta:-1,element:this.parser.executeRecipe(i)},!0):!1}previous(){if(!this.currentElement||this.currentElement.delta!==-1)throw new it("Called previous() without a successful call to hasPrevious() first");const t=this.currentElement.element;return this.currentElement=null,t}async hasNext(){if(this.currentElement?.delta===1)return!0;const t=await this.elements(),e=(this.currentIndex??t.startIndex-1)+1,i=t.elements.at(e);return i?(this.currentIndex=e,this.currentElement={delta:1,element:this.parser.executeRecipe(i)},!0):!1}next(){if(!this.currentElement||this.currentElement.delta!==1)throw new it("Called next() without a successful call to hasNext() first");const t=this.currentElement.element;return this.currentElement=null,t}async elements(){return this.parsedElementRecipes??=await this.parseElements(),this.parsedElementRecipes}async parseElements(){const t=await this.resource.readAsString(),e=new DOMParser().parseFromString(t,this.locator.type);return this.parser=new Ys(e,this.locator,this.locator.locations.getCssSelector()?e.querySelector(this.locator.locations.getCssSelector()):null,this.beforeMaxLength),Vs(this.parser,e.body),this.parser.result()}}function Vs(s,t){let e=t,i=0;for(;e!=null;)if(s.head(e,i),e.firstChild!=null)e=e.firstChild,i++;else{for(;e?.nextSibling==null&&i>0;)e&&s.tail(e,i),e=e?.parentNode||null,i--;if(e&&s.tail(e,i),e===t)break;e=e?.nextSibling||null}}class Ys{constructor(t,e,i,n){this.doc=t,this.baseLocator=e,this.startElement=i,this.beforeMaxLength=n,this.elementRecipes=[],this.startIndex=0,this.segmentRecipesAcc=[],this.textAcc="",this.wholeRawTextAcc=null,this.elementRawTextAcc="",this.rawTextAcc="",this.currentLanguage=null,this.breadcrumbs=[],this.recipeCssSelectorCache=new WeakMap}result(){return{elements:this.elementRecipes,startIndex:this.baseLocator.locations.progression===1?this.elementRecipes.length:this.startIndex}}executeRecipe(t){const e=t.recipe.cssSelectorNode?this.cssSelector(t.recipe.cssSelectorNode):null;if(t.type===1){const i=t.recipe;return new Oe(new D({href:this.baseLocator.href,type:this.baseLocator.type,title:this.baseLocator.title,locations:new I(e?{otherLocations:new Map([["cssSelector",e]])}:{})}),new M({href:i.href}),i.caption,i.attributes)}else if(t.type===2||t.type===3){const i=new D({href:this.baseLocator.href,type:this.baseLocator.type,title:this.baseLocator.title,locations:new I(e?{otherLocations:new Map([["cssSelector",e]])}:{})}),n=t.recipe;return t.type===3?new xe(i,n.link):new Le(i,n.link)}else if(t.type===0){const i=t.recipe,n=i.segments.map(r=>{const a=r.cssSelectorNode?this.cssSelector(r.cssSelectorNode):null;return new ee(new D({href:this.baseLocator.href,type:this.baseLocator.type,title:this.baseLocator.title,text:Ge(r.text,this.wholeRawTextAcc?.substring(r.beforeRange[0],r.beforeRange[1])),locations:new I(a?{otherLocations:new Map([["cssSelector",a]])}:{})}),r.text,r.attributes)});return new Ft(new D({href:this.baseLocator.href,type:this.baseLocator.type,title:this.baseLocator.title,text:Ge(i.text,n.length&&n[0].locator.text?.before||""),locations:new I(e?{otherLocations:new Map([["cssSelector",e]])}:{})}),i.role,n)}else throw new Error("Unknown recipe type")}cssSelector(t){const e=t,i=this.recipeCssSelectorCache.get(e);if(i)return i;const n=new Map;let r=e;for(;r&&r!==this.doc.body;){for(let o=0;o<r.attributes.length;o++){const h=r.attributes[o];h.prefix&&(n.has(r)?n.set(r,n.get(r).concat([h])):n.set(r,[h]),r.attributes.removeNamedItem(h.name))}r=r.parentElement}const a=ii(e,{root:this.doc});return n.forEach((o,h)=>o.forEach(g=>h.attributes.setNamedItem(g))),this.recipeCssSelectorCache.set(e,a),a}head(t,e){if(t.nodeType==Node.ELEMENT_NODE){const i=!De(t);i&&(this.flushText(),this.breadcrumbs.push(t));const n=t.nodeName.toUpperCase();if(n==="BR")this.flushText();else if(n==="IMG"||n==="AUDIO"||n==="VIDEO")if(this.flushText(),n==="IMG"){const r=t,a=ie(r,this.baseLocator.href);let o=r.getAttribute("alt");o?.length||(o=r.getAttribute("title")),a!=null&&this.elementRecipes.push({type:1,recipe:{href:a,caption:void 0,cssSelectorNode:t,attributes:o?.length?[new Qt(Ht.ACCESSIBILITY_LABEL,o)]:[]}})}else{const r=t,a=ie(r,this.baseLocator.href);let o;if(a!=null)o=new M({href:a});else{const h=[...r.getElementsByTagName("source")].map(g=>{const m=ie(g,this.baseLocator.href);return m?new M({href:m,type:g.getAttribute("type")||void 0}):null}).filter(g=>!!g);h.length>0&&(o=new M({href:h[0].href,type:h[0].type,alternates:h.length>1?new L(h.slice(1)):void 0}))}o&&(n==="AUDIO"?this.elementRecipes.push({type:2,recipe:{cssSelectorNode:t,link:o}}):n==="VIDEO"&&this.elementRecipes.push({type:3,recipe:{cssSelectorNode:t,link:o}}))}i&&this.flushText()}}tail(t,e){if(t.nodeType===Node.TEXT_NODE&&!$t(t.textContent)){const i=Gi(t.parentElement);this.currentLanguage!==i&&(this.flushSegment(),this.currentLanguage=i),this.rawTextAcc+=t.textContent,this.textAcc=Wi(this.textAcc,t.textContent)}else if(t.nodeType===Node.ELEMENT_NODE&&!De(t)){if(!this.breadcrumbs.length||this.breadcrumbs.at(-1)!==t)throw new Error("HTMLContentIterator: breadcrumbs mismatch");this.flushText(),this.breadcrumbs.pop()}}flushText(){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;this.segmentRecipesAcc[this.segmentRecipesAcc.length-1].text=Bi(this.segmentRecipesAcc[this.segmentRecipesAcc.length-1].text);let t=Ce;if(this.breadcrumbs.length>0){const e=this.breadcrumbs.at(-1);if(e.getAttributeNS("http://www.idpf.org/2007/ops","type")==="footnote")t=Re;else switch(e.nodeName.toUpperCase()){case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":t=new ze(parseInt(e.nodeName[1]));break;case"BLOCKQUOTE":case"Q":t=new Pe(e.getAttribute("cite")?.length?new URL(e.getAttribute("cite")):void 0,e.getAttribute("title")||void 0);break}}this.elementRecipes.push({type:0,recipe:{text:this.elementRawTextAcc,role:t,segments:[...this.segmentRecipesAcc],cssSelectorNode:this.breadcrumbs.at(-1)}}),this.elementRawTextAcc="",this.segmentRecipesAcc=[]}flushSegment(){let t=this.textAcc;const e=Be(t);if(!$t(e)){if(!this.segmentRecipesAcc.length){t=Mi(t);const i=t.length&&$t(t[t.length-1])?t[t.length-1]:"";t=e+i}this.segmentRecipesAcc.push({text:t,attributes:this.currentLanguage?[new Qt(Ht.LANGUAGE,this.currentLanguage)]:[],beforeRange:this.wholeRawTextAcc?[this.wholeRawTextAcc.length-this.beforeMaxLength,this.wholeRawTextAcc.length]:[0,0],cssSelectorNode:this.breadcrumbs.at(-1)})}this.rawTextAcc.length&&(this.wholeRawTextAcc=(this.wholeRawTextAcc||"")+this.rawTextAcc,this.elementRawTextAcc+=this.rawTextAcc),this.rawTextAcc="",this.textAcc=""}}class gt{constructor(t){this.title=t.title,this.numberOfItems=t.numberOfItems,this.otherMetadata=t.otherMetadata}static deserialize(t){if(!t)return;const e=new Map,i=new Set(["title","numberOfItems"]);return Object.entries(t).forEach(([n,r])=>{i.has(n)||e.set(n,r)}),new gt({title:B.deserialize(t.title),numberOfItems:X(t.numberOfItems),otherMetadata:e.size===0?void 0:e})}serialize(){const t={};return this.title&&(t.title=this.title.serialize()),this.numberOfItems!==void 0&&(t.numberOfItems=this.numberOfItems),this.otherMetadata&&this.otherMetadata.forEach((e,i)=>t[i]=e),t}}class ce{constructor(t){this.metadata=t.metadata??new gt({}),this.links=t.links??new L([]),this.locators=t.locators??[]}static deserialize(t){if(!t)return;let e,i=t.locators;return i&&Array.isArray(i)&&(e=i.map(n=>D.deserialize(n)).filter(n=>n!==void 0)),new ce({metadata:gt.deserialize(t.metadata),links:L.deserialize(t.links),locators:e})}serialize(){const t={};if(this.metadata){let e=this.metadata.serialize();e&&Object.keys(e).length>0&&(t.metadata=e)}return this.links&&this.links.items.length>0&&(t.links=this.links.serialize()),this.locators&&(t.locators=this.locators.map(e=>e.serialize())),t}}class G{constructor(t){this.metadata=t.metadata,this.links=t.links,this.subcollections=t.subcollections}static deserialize(t){if(!t)return;let e,i,n;if(Array.isArray(t))e=L.deserialize(t);else if(typeof t=="object")e=L.deserialize(t.links),i=new Map,t.metadata&&Object.entries(t.metadata).forEach(([r,a])=>{i?.set(r,a)}),n=G.deserializeCollections(t);else return;if(!(!e||e.items.length===0))return new G({metadata:i?.size?i:void 0,links:e,subcollections:n?.size?n:void 0})}static deserializeCollections(t){if(!t)return;const e=new Map;return Object.entries(t).forEach(([i,n])=>{if(i!=="links"&&i!=="metadata"){const r=G.deserialize(n);if(r){const a=new Array;a.push(r),e.set(i,a)}else if(Array.isArray(n)){const a=n.map(o=>G.deserialize(o)).filter(o=>o!==void 0);e.set(i,a)}}}),e.size?e:void 0}serialize(){const t={};return this.metadata&&(t.metadata={},this.metadata.forEach((e,i)=>t.metadata[i]=e)),this.links.items.length&&(t.links=this.links.serialize()),G.serializeCollection(t,this.subcollections),t}static serializeCollection(t,e){e&&e.size>0&&e.forEach((i,n)=>{i.length===1?t[n]=i[0].serialize():t[n]=i.map(r=>r.serialize())})}}class le{constructor(t){this.context=t.context,this.metadata=t.metadata,this.links=t.links,this.readingOrder=t.readingOrder,this.resources=t.resources,this.toc=t.toc,this.subcollections=t.subcollections}static deserialize(t){if(!t)return;const e=ct.deserialize(t.metadata);if(!e)return;const i=L.deserialize(t.links);if(!i)return;const n=L.deserialize(t.readingOrder?t.readingOrder:t.spine);if(n)return new le({context:V(t["@context"]),metadata:e,links:i,readingOrder:n,resources:L.deserialize(t.resources),toc:L.deserialize(t.toc),subcollections:G.deserializeCollections({sub:t.sub})})}serialize(){const t={};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()),G.serializeCollection(t,this.subcollections),t}linkWithRel(t){const e=new Array;e.push(this.readingOrder),this.resources&&e.push(this.resources),e.push(this.links);let i;for(const n of e)if(i=n.findWithRel(t),i!==void 0)return i;return i}linksWithRel(t){const e=[];return e.push(this.readingOrder.filterByRel(t)),this.resources&&e.push(this.resources.filterByRel(t)),e.push(this.links.filterByRel(t)),e.reduce((i,n)=>i.concat(n),[])}locatorFromLink(t){const e=t.href.split("#"),i=e.length==2?e[0]:t.href,n=this.linkWithHref(i);if(!n)return;const r=n.type;if(!r)return;const a=e.length==2?e[1]:void 0;return new D({href:i,type:r,title:n.title??t.title,locations:new I({fragments:a?[a]:void 0,progression:a?void 0:0})})}linkWithHref(t){const e=o=>{let h;for(const m of o)if(h=m.findWithHref(t),h!==void 0)return h;const g=new Array;return o.forEach(m=>{const d=[];for(const b of m.items)b.alternates&&d.push(b.alternates),b.children&&d.push(b.children);g.push(...d)}),g.length>0&&(h=e(g)),h},i=[];i.push(this.readingOrder),this.resources&&i.push(this.resources),i.push(this.links);const n=e(i);if(n!==void 0)return n;const r=t.split(/[#]/);if(r.length<2)return;const a=r[0];return this.linkWithHref(a)}get baseURL(){const t=this.links.items.find(e=>e.rels&&e.rels.has("self"));if(t){let e=t.href;if(e){const i=e.lastIndexOf("/"),n=i===-1?void 0:e.substring(i+1);e=e.replace(new RegExp("/?$query$"),""),e=e.replace(new RegExp("//$"),""),n&&(e=e.replace(new RegExp(n+"$"),""))}return e}}setSelfLink(t){this.links.items=this.links.items.filter(e=>e.rels===void 0||!e.rels?.has("self")),this.links.items.push(new M({href:t,type:l.READIUM_WEBPUB_MANIFEST.string,rels:new Set(["self"])}))}}c.AccessMode=z,c.Accessibility=F,c.AccessibilityMetadataDisplayGuide=oi,c.AccessibilityProfile=vt,c.AccessibilitySummary=Ot,c.Acquisition=et,c.AdditionalInformation=It,c.AltIdentifier=K,c.Attribute=Qt,c.AttributeKeys=Ht,c.AttributesHolder=jt,c.AudioElement=Le,c.Availability=Wt,c.AvailabilityStatus=Ne,c.BelongsTo=j,c.Body=Ce,c.Certification=At,c.Conformance=Lt,c.Content=Oi,c.ContentElement=te,c.Contributor=at,c.Contributors=x,c.Copies=Gt,c.DefaultTextContentTokenizer=Ee,c.DomRange=Ut,c.DomRangePoint=ht,c.EmptyFetcher=Z,c.Encryption=zt,c.Exemption=wt,c.Feature=A,c.Footnote=Re,c.GuidedNavigationDocument=Dt,c.GuidedNavigationObject=J,c.GuidedNavigationText=lt,c.HTMLResourceContentIterator=Fs,c.Hazard=P,c.HazardType=ge,c.Hazards=Nt,c.Heading=ze,c.Holds=Bt,c.HttpFetcher=si,c.HttpResource=ue,c.IllegalStateError=it,c.ImageElement=Oe,c.IntlTextTokenizer=Te,c.Iterator=Vt,c.Layout=q,c.Legal=xt,c.Link=M,c.Links=L,c.Localization=p,c.LocalizedString=B,c.Locator=D,c.LocatorCollection=ce,c.LocatorCollectionMetadata=gt,c.LocatorLocations=I,c.LocatorText=Q,c.Manifest=le,c.MediaOverlay=Rt,c.MediaType=l,c.Metadata=ct,c.NaiveTextTokenizer=Ie,c.Navigation=Et,c.NonvisualReading=fe,c.NumberRange=ni,c.PDFContentElement=Yt,c.Page=Ct,c.PageContentIteratorPDF=Pi,c.PrerecordedAudio=pe,c.Price=Mt,c.PrimaryAccessMode=yt,c.Profile=tt,c.Properties=k,c.Publication=$,c.PublicationCollection=G,c.PublicationContentIterator=Ri,c.ReadingProgression=Y,c.Resource=ri,c.RichContent=Tt,c.RichContentType=me,c.Subject=ot,c.Subjects=Pt,c.TDM=kt,c.TDMReservation=ve,c.TextContentTokenizer=zi,c.TextElement=Ft,c.TextQuote=Pe,c.TextSegment=ee,c.TextUnit=Se,c.TextualElement=dt,c.URITemplate=rt,c.VideoElement=xe,c.VisualAdjustments=de,c.WaysOfReading=St,c.arrayfromJSON=be,c.arrayfromJSONorString=V,c.datefromJSON=st,c.leadingPage=ci,c.numberfromJSON=X,c.positiveNumberfromJSON=N,c.setToArray=nt,c.speakableToken=_t,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));