@readium/navigator 2.2.6 → 2.2.8

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.
Files changed (47) hide show
  1. package/dist/ar-DyHX_uy2-DyHX_uy2-DyHX_uy2.js +7 -0
  2. package/dist/ar-DyHX_uy2-DyHX_uy2.js +7 -0
  3. package/dist/da-Dct0PS3E-Dct0PS3E-Dct0PS3E.js +7 -0
  4. package/dist/da-Dct0PS3E-Dct0PS3E.js +7 -0
  5. package/dist/fr-C5HEel98-C5HEel98-C5HEel98.js +7 -0
  6. package/dist/fr-C5HEel98-C5HEel98.js +7 -0
  7. package/dist/index.js +4389 -2401
  8. package/dist/index.umd.cjs +1571 -39
  9. package/dist/it-DFOBoXGy-DFOBoXGy-DFOBoXGy.js +7 -0
  10. package/dist/it-DFOBoXGy-DFOBoXGy.js +7 -0
  11. package/dist/pt_PT-Di3sVjze-Di3sVjze-Di3sVjze.js +7 -0
  12. package/dist/pt_PT-Di3sVjze-Di3sVjze.js +7 -0
  13. package/dist/sv-BfzAFsVN-BfzAFsVN-BfzAFsVN.js +7 -0
  14. package/dist/sv-BfzAFsVN-BfzAFsVN.js +7 -0
  15. package/package.json +6 -5
  16. package/src/dom/_readium_cssSelectorGenerator.js +1 -0
  17. package/src/dom/_readium_executionCleanup.js +13 -0
  18. package/src/dom/_readium_executionPrevention.js +65 -0
  19. package/src/dom/_readium_webpubExecution.js +4 -0
  20. package/src/epub/EpubNavigator.ts +26 -2
  21. package/src/epub/frame/FrameBlobBuilder.ts +37 -130
  22. package/src/epub/frame/FramePoolManager.ts +34 -5
  23. package/src/epub/fxl/FXLFramePoolManager.ts +20 -2
  24. package/src/helpers/minify.ts +14 -0
  25. package/src/index.ts +2 -1
  26. package/src/injection/Injectable.ts +85 -0
  27. package/src/injection/Injector.ts +356 -0
  28. package/src/injection/epubInjectables.ts +90 -0
  29. package/src/injection/index.ts +2 -0
  30. package/src/injection/webpubInjectables.ts +59 -0
  31. package/src/webpub/WebPubBlobBuilder.ts +19 -76
  32. package/src/webpub/WebPubFramePoolManager.ts +29 -4
  33. package/src/webpub/WebPubNavigator.ts +15 -1
  34. package/types/src/epub/EpubNavigator.d.ts +3 -0
  35. package/types/src/epub/frame/FrameBlobBuilder.d.ts +7 -4
  36. package/types/src/epub/frame/FramePoolManager.d.ts +3 -1
  37. package/types/src/epub/fxl/FXLFramePoolManager.d.ts +3 -1
  38. package/types/src/helpers/minify.d.ts +12 -0
  39. package/types/src/index.d.ts +1 -0
  40. package/types/src/injection/Injectable.d.ts +68 -0
  41. package/types/src/injection/Injector.d.ts +22 -0
  42. package/types/src/injection/epubInjectables.d.ts +6 -0
  43. package/types/src/injection/index.d.ts +2 -0
  44. package/types/src/injection/webpubInjectables.d.ts +5 -0
  45. package/types/src/webpub/WebPubBlobBuilder.d.ts +7 -3
  46. package/types/src/webpub/WebPubFramePoolManager.d.ts +3 -1
  47. package/types/src/webpub/WebPubNavigator.d.ts +3 -0
@@ -1,33 +1,20 @@
1
- (function(B,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(B=typeof globalThis<"u"?globalThis:B||self,j(B.navigator={}))})(this,(function(B){"use strict";const j=class yt{constructor(t){if(typeof t=="string"){if(!yt.VALID_MODES.has(t.toLowerCase()))return;this.value=t.toLowerCase()}else{const e=t.filter(i=>yt.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 yt(t);if(!Array.isArray(t))return;const e=t.filter(i=>i?yt.VALID_MODES.has(i.toLowerCase()):!1);if(e.length!==0)return new yt(e)}serialize(){return this.value}};j.VALID_MODES=new Set(["auditory","tactile","textual","visual"]),j.AUDITORY=new j("auditory"),j.TACTILE=new j("tactile"),j.TEXTUAL=new j("textual"),j.VISUAL=new j("visual");const f=class QA{constructor(t){this.value=t}static deserialize(t){if(!(!t||typeof t!="string"))return new QA(t)}serialize(){return this.value}};f.NONE=new f("none"),f.ANNOTATIONS=new f("annotations"),f.ARIA=new f("ARIA"),f.INDEX=new f("index"),f.PAGE_BREAK_MARKERS=new f("pageBreakMarkers"),f.PAGE_NAVIGATION=new f("pageNavigation"),f.PRINT_PAGE_NUMBERS=new f("printPageNumbers"),f.READING_ORDER=new f("readingOrder"),f.STRUCTURAL_NAVIGATION=new f("structuralNavigation"),f.TABLE_OF_CONTENTS=new f("tableOfContents"),f.TAGGED_PDF=new f("taggedPDF"),f.ALTERNATIVE_TEXT=new f("alternativeText"),f.AUDIO_DESCRIPTION=new f("audioDescription"),f.CAPTIONS=new f("captions"),f.CLOSED_CAPTIONS=new f("closedCaptions"),f.DESCRIBED_MATH=new f("describedMath"),f.LONG_DESCRIPTION=new f("longDescription"),f.OPEN_CAPTIONS=new f("openCaptions"),f.SIGN_LANGUAGE=new f("signLanguage"),f.TRANSCRIPT=new f("transcript"),f.DISPLAY_TRANSFORMABILITY=new f("displayTransformability"),f.SYNCHRONIZED_AUDIO_TEXT=new f("synchronizedAudioText"),f.TIMING_CONTROL=new f("timingControl"),f.UNLOCKED=new f("unlocked"),f.CHEM_ML=new f("ChemML"),f.LATEX=new f("latex"),f.LATEX_CHEMISTRY=new f("latex-chemistry"),f.MATH_ML=new f("MathML"),f.MATH_ML_CHEMISTRY=new f("MathML-chemistry"),f.TTS_MARKUP=new f("ttsMarkup"),f.HIGH_CONTRAST_AUDIO=new f("highContrastAudio"),f.HIGH_CONTRAST_DISPLAY=new f("highContrastDisplay"),f.LARGE_PRINT=new f("largePrint"),f.BRAILLE=new f("braille"),f.TACTILE_GRAPHIC=new f("tactileGraphic"),f.TACTILE_OBJECT=new f("tactileObject"),f.FULL_RUBY_ANNOTATIONS=new f("fullRubyAnnotations"),f.HORIZONTAL_WRITING=new f("horizontalWriting"),f.RUBY_ANNOTATIONS=new f("rubyAnnotations"),f.VERTICAL_WRITING=new f("verticalWriting"),f.WITH_ADDITIONAL_WORD_SEGMENTATION=new f("withAdditionalWordSegmentation"),f.WITHOUT_ADDITIONAL_WORD_SEGMENTATION=new f("withoutAdditionalWordSegmentation");let Xe=f;var w=(r=>(r.reflowable="reflowable",r.fixed="fixed",r.scrolled="scrolled",r))(w||{});let jA=class YA{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 YA({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 J=(r=>(r.left="left",r.right="right",r.center="center",r))(J||{});let W=class ke{constructor(t){this.otherProperties=t}get page(){return this.otherProperties.page}static deserialize(t){if(t)return new ke(t)}serialize(){return this.otherProperties}add(t){const e=Object.assign({},this.otherProperties);for(const i in t)e[i]=t[i];return new ke(e)}};Object.defineProperty(W.prototype,"encryption",{get:function(){return jA.deserialize(this.otherProperties.encrypted)}});function VA(r){return r&&Array.isArray(r)?r:void 0}function Ze(r){return r&&typeof r=="string"?[r]:VA(r)}function Ke(r){return typeof r=="string"?new Date(r):void 0}function Vt(r){return isNaN(r)?void 0:r}function T(r){return Vt(r)!==void 0&&Math.sign(r)>=0?r:void 0}function vA(r){const t=new Array;return r.forEach(e=>t.push(e)),t}class u{constructor(t){let e,i,A=t.mediaType.replace(/\s/g,"").split(";");const n=A[0].split("/");if(n.length===2){if(e=n[0].toLowerCase().trim(),i=n[1].toLowerCase().trim(),e.length===0||i.length===0)throw new Error("Invalid media type")}else throw new Error("Invalid media type");const o={};for(let g=1;g<A.length;g++){const M=A[g].split("=");if(M.length===2){const l=M[0].toLocaleLowerCase(),p=l==="charset"?M[1].toUpperCase():M[1];o[l]=p}}const s={},a=Object.keys(o);a.sort((g,M)=>g.localeCompare(M)),a.forEach(g=>s[g]=o[g]);let h="";for(const g in s){const M=s[g];h+=`;${g}=${M}`}const c=`${e}/${i}${h}`,d=s.encoding;this.string=c,this.type=e,this.subtype=i,this.parameters=s,this.encoding=d,this.name=t.name,this.fileExtension=t.fileExtension}static parse(t){return new u(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"?u.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(([n,o])=>`${n}=${o}`)),A=new Set(Object.entries(e.parameters).map(([n,o])=>`${n}=${o}`));for(const n of Array.from(i.values()))if(!A.has(n))return!1;return!0}matches(t){const e=typeof t=="string"?u.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(u.ZIP,u.LCP_PROTECTED_AUDIOBOOK,u.LCP_PROTECTED_PDF)||this.structuredSyntaxSuffix==="+zip"}get isJSON(){return this.matchesAny(u.JSON)||this.structuredSyntaxSuffix==="+json"}get isOPDS(){return this.matchesAny(u.OPDS1,u.OPDS1_ENTRY,u.OPDS2,u.OPDS2_PUBLICATION,u.OPDS_AUTHENTICATION)||this.structuredSyntaxSuffix==="+json"}get isHTML(){return this.matchesAny(u.HTML,u.XHTML)}get isBitmap(){return this.matchesAny(u.BMP,u.GIF,u.JPEG,u.PNG,u.TIFF,u.WEBP)}get isAudio(){return this.type==="audio"}get isVideo(){return this.type==="video"}get isRWPM(){return this.matchesAny(u.READIUM_AUDIOBOOK_MANIFEST,u.DIVINA_MANIFEST,u.READIUM_WEBPUB_MANIFEST)}get isPublication(){return this.matchesAny(u.READIUM_AUDIOBOOK,u.READIUM_AUDIOBOOK_MANIFEST,u.CBZ,u.DIVINA,u.DIVINA_MANIFEST,u.EPUB,u.LCP_PROTECTED_AUDIOBOOK,u.LCP_PROTECTED_PDF,u.LPF,u.PDF,u.W3C_WPUB_MANIFEST,u.READIUM_WEBPUB,u.READIUM_WEBPUB_MANIFEST,u.ZAB)}static get AAC(){return u.parse({mediaType:"audio/aac",fileExtension:"aac"})}static get ACSM(){return u.parse({mediaType:"application/vnd.adobe.adept+xml",name:"Adobe Content Server Message",fileExtension:"acsm"})}static get AIFF(){return u.parse({mediaType:"audio/aiff",fileExtension:"aiff"})}static get AVI(){return u.parse({mediaType:"video/x-msvideo",fileExtension:"avi"})}static get BINARY(){return u.parse({mediaType:"application/octet-stream"})}static get BMP(){return u.parse({mediaType:"image/bmp",fileExtension:"bmp"})}static get CBZ(){return u.parse({mediaType:"application/vnd.comicbook+zip",name:"Comic Book Archive",fileExtension:"cbz"})}static get CSS(){return u.parse({mediaType:"text/css",fileExtension:"css"})}static get DIVINA(){return u.parse({mediaType:"application/divina+zip",name:"Digital Visual Narratives",fileExtension:"divina"})}static get DIVINA_MANIFEST(){return u.parse({mediaType:"application/divina+json",name:"Digital Visual Narratives",fileExtension:"json"})}static get EPUB(){return u.parse({mediaType:"application/epub+zip",name:"EPUB",fileExtension:"epub"})}static get GIF(){return u.parse({mediaType:"image/gif",fileExtension:"gif"})}static get GZ(){return u.parse({mediaType:"application/gzip",fileExtension:"gz"})}static get HTML(){return u.parse({mediaType:"text/html",fileExtension:"html"})}static get JAVASCRIPT(){return u.parse({mediaType:"text/javascript",fileExtension:"js"})}static get JPEG(){return u.parse({mediaType:"image/jpeg",fileExtension:"jpeg"})}static get JSON(){return u.parse({mediaType:"application/json"})}static get LCP_LICENSE_DOCUMENT(){return u.parse({mediaType:"application/vnd.readium.lcp.license.v1.0+json",name:"LCP License",fileExtension:"lcpl"})}static get LCP_PROTECTED_AUDIOBOOK(){return u.parse({mediaType:"application/audiobook+lcp",name:"LCP Protected Audiobook",fileExtension:"lcpa"})}static get LCP_PROTECTED_PDF(){return u.parse({mediaType:"application/pdf+lcp",name:"LCP Protected PDF",fileExtension:"lcpdf"})}static get LCP_STATUS_DOCUMENT(){return u.parse({mediaType:"application/vnd.readium.license.status.v1.0+json"})}static get LPF(){return u.parse({mediaType:"application/lpf+zip",fileExtension:"lpf"})}static get MP3(){return u.parse({mediaType:"audio/mpeg",fileExtension:"mp3"})}static get MPEG(){return u.parse({mediaType:"video/mpeg",fileExtension:"mpeg"})}static get NCX(){return u.parse({mediaType:"application/x-dtbncx+xml",fileExtension:"ncx"})}static get OGG(){return u.parse({mediaType:"audio/ogg",fileExtension:"oga"})}static get OGV(){return u.parse({mediaType:"video/ogg",fileExtension:"ogv"})}static get OPDS1(){return u.parse({mediaType:"application/atom+xml;profile=opds-catalog"})}static get OPDS1_ENTRY(){return u.parse({mediaType:"application/atom+xml;type=entry;profile=opds-catalog"})}static get OPDS2(){return u.parse({mediaType:"application/opds+json"})}static get OPDS2_PUBLICATION(){return u.parse({mediaType:"application/opds-publication+json"})}static get OPDS_AUTHENTICATION(){return u.parse({mediaType:"application/opds-authentication+json"})}static get OPUS(){return u.parse({mediaType:"audio/opus",fileExtension:"opus"})}static get OTF(){return u.parse({mediaType:"font/otf",fileExtension:"otf"})}static get PDF(){return u.parse({mediaType:"application/pdf",name:"PDF",fileExtension:"pdf"})}static get PNG(){return u.parse({mediaType:"image/png",fileExtension:"png"})}static get READIUM_AUDIOBOOK(){return u.parse({mediaType:"application/audiobook+zip",name:"Readium Audiobook",fileExtension:"audiobook"})}static get READIUM_AUDIOBOOK_MANIFEST(){return u.parse({mediaType:"application/audiobook+json",name:"Readium Audiobook",fileExtension:"json"})}static get READIUM_CONTENT_DOCUMENT(){return u.parse({mediaType:"application/vnd.readium.content+json",name:"Readium Content Document",fileExtension:"json"})}static get READIUM_GUIDED_NAVIGATION_DOCUMENT(){return u.parse({mediaType:"application/guided-navigation+json",name:"Readium Guided Navigation Document",fileExtension:"json"})}static get READIUM_POSITION_LIST(){return u.parse({mediaType:"application/vnd.readium.position-list+json",name:"Readium Position List",fileExtension:"json"})}static get READIUM_WEBPUB(){return u.parse({mediaType:"application/webpub+zip",name:"Readium Web Publication",fileExtension:"webpub"})}static get READIUM_WEBPUB_MANIFEST(){return u.parse({mediaType:"application/webpub+json",name:"Readium Web Publication",fileExtension:"json"})}static get SMIL(){return u.parse({mediaType:"application/smil+xml",fileExtension:"smil"})}static get SVG(){return u.parse({mediaType:"image/svg+xml",fileExtension:"svg"})}static get TEXT(){return u.parse({mediaType:"text/plain",fileExtension:"txt"})}static get TIFF(){return u.parse({mediaType:"image/tiff",fileExtension:"tiff"})}static get TTF(){return u.parse({mediaType:"font/ttf",fileExtension:"ttf"})}static get W3C_WPUB_MANIFEST(){return u.parse({mediaType:"application/x.readium.w3c.wpub+json",name:"Web Publication",fileExtension:"json"})}static get WAV(){return u.parse({mediaType:"audio/wav",fileExtension:"wav"})}static get WEBM_AUDIO(){return u.parse({mediaType:"audio/webm",fileExtension:"webm"})}static get WEBM_VIDEO(){return u.parse({mediaType:"video/webm",fileExtension:"webm"})}static get WEBP(){return u.parse({mediaType:"image/webp",fileExtension:"webp"})}static get WOFF(){return u.parse({mediaType:"font/woff",fileExtension:"woff"})}static get WOFF2(){return u.parse({mediaType:"font/woff2",fileExtension:"woff2"})}static get XHTML(){return u.parse({mediaType:"application/xhtml+xml",fileExtension:"xhtml"})}static get XML(){return u.parse({mediaType:"application/xml",fileExtension:"xml"})}static get ZAB(){return u.parse({mediaType:"application/x.readium.zab+zip",name:"Zipped Audio Book",fileExtension:"zab"})}static get ZIP(){return u.parse({mediaType:"application/zip",fileExtension:"zip"})}}let qe=class{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(A=>A.trim())):new Set}expand(t){const e=A=>A.split(",").map(n=>{const o=t[n];return o?encodeURIComponent(o):""}).join(","),i=A=>"?"+A.split(",").map(n=>{const o=n.split("=")[0],s=t[o];return s?`${o}=${encodeURIComponent(s)}`:""}).join("&");return this.uri.replace(/\{(\??)([^}]+)\}/g,(...A)=>A[1]?i(A[2]):e(A[2]))}},V=class NA{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=Vt(t.progression),i=Vt(t.totalProgression),A=Vt(t.position),n=new Map,o=new Set(["fragment","fragments","progression","totalProgression","position"]);return Object.entries(t).forEach(([s,a])=>{o.has(s)||n.set(s,a)}),new NA({fragments:Ze(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:A!==void 0&&A>0?A:void 0,otherLocations:n.size===0?void 0:n})}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}},DA=class xA{constructor(t){this.after=t.after,this.before=t.before,this.highlight=t.highlight}static deserialize(t){if(t)return new xA({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}},at=class Je{constructor(t){this.href=t.href,this.type=t.type,this.title=t.title,this.locations=t.locations?t.locations:new V({}),this.text=t.text}static deserialize(t){if(t&&t.href&&t.type)return new Je({href:t.href,type:t.type,title:t.title,locations:V.deserialize(t.locations),text:DA.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 Je({href:this.href,type:this.type,title:this.title,text:this.text,locations:new V({...this.locations,...t})})}};class D{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 D({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:W.deserialize(t.properties),height:T(t.height),width:T(t.width),size:T(t.size),duration:T(t.duration),bitrate:T(t.bitrate),languages:Ze(t.language),alternates:_e.deserialize(t.alternate),children:_e.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=vA(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?u.parse({mediaType:this.type}):u.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 qe(this.href).parameters:new Set}expandTemplate(t){return new D({href:new qe(this.href).expand(t),templated:!1})}addProperties(t){const e=D.deserialize(this.serialize());return e.properties=e.properties?e.properties?.add(t):new W(t),e}get locator(){let t=this.href.split("#");return new at({href:t.length>0&&t[0]!==void 0?t[0]:this.href,type:this.type??"",title:this.title,locations:new V({fragments:t.length>1&&t[1]!==void 0?[t[1]]:[]})})}}let _e=class TA{constructor(t){this.items=t}static deserialize(t){if(t&&Array.isArray(t))return new TA(t.map(e=>D.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 A of t)if(i.mediaType.matches(A))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)}};var $e=(r=>(r.EPUB="https://readium.org/webpub-manifest/profiles/epub",r.AUDIOBOOK="https://readium.org/webpub-manifest/profiles/audiobook",r.DIVINA="https://readium.org/webpub-manifest/profiles/divina",r.PDF="https://readium.org/webpub-manifest/profiles/pdf",r))($e||{}),x=(r=>(r.ltr="ltr",r.rtl="rtl",r))(x||{});W.prototype.getContains=function(){return new Set(this.otherProperties.contains||[])};let ti=class PA{constructor(t){this.cssSelector=t.cssSelector,this.textNodeIndex=t.textNodeIndex,this.charOffset=t.charOffset}static deserialize(t){if(!(t&&t.cssSelector))return;let e=T(t.textNodeIndex);if(e===void 0)return;let i=T(t.charOffset);return i===void 0&&(i=T(t.offset)),new PA({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 ne{constructor(t){this.start=t.start,this.end=t.end}static deserialize(t){if(!t)return;let e=ti.deserialize(t.start);if(e)return new ne({start:e,end:ti.deserialize(t.end)})}serialize(){const t={start:this.start.serialize()};return this.end&&(t.end=this.end.serialize()),t}}V.prototype.getCssSelector=function(){return this.otherLocations?.get("cssSelector")},V.prototype.getPartialCfi=function(){return this.otherLocations?.get("partialCfi")},V.prototype.getDomRange=function(){return ne.deserialize(this.otherLocations?.get("domRange"))},V.prototype.fragmentParameters=function(){return new Map(this.fragments.map(r=>r.startsWith("#")?r.slice(1):r).join("&").split("&").filter(r=>!r.startsWith("#")).map(r=>r.split("=")).filter(r=>r.length===2).map(r=>[r[0].trim().toLowerCase(),r[1].trim()]))},V.prototype.htmlId=function(){if(!this.fragments.length)return;let r=this.fragments.find(t=>t.length&&!t.includes("="));if(!r){const t=this.fragmentParameters();t.has("id")?r=t.get("id"):t.has("name")&&(r=t.get("name"))}return r?.startsWith("#")?r.slice(1):r},V.prototype.page=function(){const r=parseInt(this.fragmentParameters().get("page"));if(!isNaN(r)&&r>=0)return r},V.prototype.time=function(){const r=parseInt(this.fragmentParameters().get("t"));if(!isNaN(r))return r},V.prototype.space=function(){const r=this.fragmentParameters();if(!r.has("xywh"))return;const t=r.get("xywh").split(",").map(e=>parseInt(e));if(t.length===4&&!t.some(isNaN))return t};let HA=class bA{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=T(t.value);if(i!==void 0)return new bA({currency:e,value:i})}serialize(){return{currency:this.currency,value:this.value}}},GA=class Ae{constructor(t){this.type=t.type,this.children=t.children}static deserialize(t){if(t&&t.type)return new Ae({type:t.type,children:Ae.deserializeArray(t.children)})}static deserializeArray(t){if(Array.isArray(t))return t.map(e=>Ae.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 re{constructor(t){this.total=t.total,this.position=t.position}static deserialize(t){if(t)return new re({total:T(t.total),position:T(t.position)})}serialize(){const t={};return this.total!==void 0&&(t.total=this.total),this.position!==void 0&&(t.position=this.position),t}}class oe{constructor(t){this.total=t.total,this.available=t.available}static deserialize(t){if(t)return new oe({total:T(t.total),available:T(t.available)})}serialize(){const t={};return this.total!==void 0&&(t.total=this.total),this.available!==void 0&&(t.available=this.available),t}}class se{constructor(t){this.state=t.state,this.since=t.since,this.until=t.until}static deserialize(t){if(t&&t.state)return new se({state:t.state,since:Ke(t.since),until:Ke(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}}W.prototype.getNumberOfItems=function(){return T(this.otherProperties.numberOfItems)},W.prototype.getPrice=function(){return HA.deserialize(this.otherProperties.price)},W.prototype.getIndirectAcquisitions=function(){const r=this.otherProperties.indirectAcquisition;if(r&&Array.isArray(r))return r.map(t=>GA.deserialize(t)).filter(t=>t!==void 0)},W.prototype.getHolds=function(){return re.deserialize(this.otherProperties.holds)},W.prototype.getCopies=function(){return oe.deserialize(this.otherProperties.copies)},W.prototype.getAvailability=function(){return se.deserialize(this.otherProperties.availability)},W.prototype.getAuthenticate=function(){return D.deserialize(this.otherProperties.authenticate)};const kA="CssSelectorGenerator";function ei(r="unknown problem",...t){console.warn(`${kA}: ${r}`,...t)}function JA(r){return r instanceof RegExp}function WA(r){return r.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".+")}function OA(r){const t=r.map(e=>{if(JA(e))return i=>e.test(i);if(typeof e=="function")return i=>{const A=e(i);return typeof A!="boolean"?(ei("pattern matcher function invalid","Provided pattern matching function does not return boolean. It's result will be ignored.",e),!1):A};if(typeof e=="string"){const i=new RegExp("^"+WA(e)+"$");return A=>i.test(A)}return ei("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))}OA(["class","id","ng-*"]);class ii{}class ae extends ii{goLeft(t=!1,e){this.readingProgression===x.ltr?this.goBackward(t,e):this.readingProgression===x.rtl&&this.goForward(t,e)}goRight(t=!1,e){this.readingProgression===x.ltr?this.goForward(t,e):this.readingProgression===x.rtl&&this.goBackward(t,e)}}const LA=':root[style*=--USER__textAlign]{text-align:var(--USER__textAlign)}:root[style*=--USER__textAlign] body,:root[style*=--USER__textAlign] p:not(blockquote p,figcaption p,header p,hgroup p,:root[style*=readium-experimentalHeaderFiltering-on] p[class*=title],:root[style*=readium-experimentalHeaderFiltering-on] div:has(+*)>h1+p,:root[style*=readium-experimentalHeaderFiltering-on] div:has(+*)>p:has(+h1)),:root[style*=--USER__textAlign] li,:root[style*=--USER__textAlign] dd{text-align:var(--USER__textAlign)!important;-moz-text-align-last:auto!important;-epub-text-align-last:auto!important;text-align-last:auto!important}:root[style*=--USER__bodyHyphens]{-webkit-hyphens:var(--USER__bodyHyphens)!important;-moz-hyphens:var(--USER__bodyHyphens)!important;-ms-hyphens:var(--USER__bodyHyphens)!important;-epub-hyphens:var(--USER__bodyHyphens)!important;hyphens:var(--USER__bodyHyphens)!important}:root[style*=--USER__bodyHyphens] body,:root[style*=--USER__bodyHyphens] p,:root[style*=--USER__bodyHyphens] li,:root[style*=--USER__bodyHyphens] div,:root[style*=--USER__bodyHyphens] dd{-webkit-hyphens:inherit;-moz-hyphens:inherit;-ms-hyphens:inherit;-epub-hyphens:inherit;hyphens:inherit}:root[style*=--USER__fontFamily]{font-family:var(--USER__fontFamily)!important}:root[style*=--USER__fontFamily] *{font-family:revert!important}:root[style*=AccessibleDfA]{font-family:AccessibleDfA,Verdana,Tahoma,Trebuchet MS,sans-serif!important}:root[style*="IA Writer Duospace"]{font-family:IA Writer Duospace,Menlo,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier,monospace!important}:root[style*=AccessibleDfA],:root[style*="IA Writer Duospace"],:root[style*=readium-a11y-on]{font-style:normal!important;font-weight:400!important}:root[style*=AccessibleDfA] body *:not(code):not(var):not(kbd):not(samp),:root[style*="IA Writer Duospace"] body *:not(code):not(var):not(kbd):not(samp),:root[style*=readium-a11y-on] body *:not(code):not(var):not(kbd):not(samp){font-family:inherit!important;font-style:inherit!important;font-weight:inherit!important}:root[style*=AccessibleDfA] body *:not(a),:root[style*="IA Writer Duospace"] body *:not(a),:root[style*=readium-a11y-on] body *:not(a){text-decoration:none!important}:root[style*=AccessibleDfA] body *,:root[style*="IA Writer Duospace"] body *,:root[style*=readium-a11y-on] body *{font-variant-caps:normal!important;font-variant-numeric:normal!important;font-variant-position:normal!important}:root[style*=AccessibleDfA] sup,:root[style*="IA Writer Duospace"] sup,:root[style*=readium-a11y-on] sup,:root[style*=AccessibleDfA] sub,:root[style*="IA Writer Duospace"] sub,:root[style*=readium-a11y-on] sub{font-size:1rem!important;vertical-align:baseline!important}:root:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] body{zoom:var(--USER__zoom)!important}:root[style*=readium-iOSPatch-on][style*=--USER__zoom] body{-webkit-text-size-adjust:var(--USER__zoom)!important}@supports selector(figure:has(> img)){:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] figure:has(>img),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] figure:has(>video),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] figure:has(>svg),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] figure:has(>canvas),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] figure:has(>iframe),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] figure:has(>audio),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] div:has(>img:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] div:has(>video:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] div:has(>svg:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] div:has(>canvas:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] div:has(>iframe:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] div:has(>audio:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] table{zoom:calc(100% / var(--USER__zoom))!important}:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] figcaption,:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] caption,:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] td,:root[style*=readium-experimentalZoom-on]:not([style*=readium-iOSPatch-on])[style*=--USER__zoom] th{zoom:var(--USER__zoom)!important}}:root[style*=--USER__lineHeight]{line-height:var(--USER__lineHeight)!important}:root[style*=--USER__lineHeight] body,:root[style*=--USER__lineHeight] p,:root[style*=--USER__lineHeight] li,:root[style*=--USER__lineHeight] div{line-height:inherit}:root[style*=--USER__paraSpacing] p{margin-top:var(--USER__paraSpacing)!important;margin-bottom:var(--USER__paraSpacing)!important}:root[style*=--USER__paraIndent] p:not(blockquote p,figcaption p,header p,hgroup p,:root[style*=readium-experimentalHeaderFiltering-on] p[class*=title],:root[style*=readium-experimentalHeaderFiltering-on] div:has(+*)>h1+p,:root[style*=readium-experimentalHeaderFiltering-on] div:has(+*)>p:has(+h1)){text-indent:var(--USER__paraIndent)!important}:root[style*=--USER__paraIndent] p *,:root[style*=--USER__paraIndent] p:first-letter{text-indent:0!important}:root[style*=--USER__wordSpacing] h1,:root[style*=--USER__wordSpacing] h2,:root[style*=--USER__wordSpacing] h3,:root[style*=--USER__wordSpacing] h4,:root[style*=--USER__wordSpacing] h5,:root[style*=--USER__wordSpacing] h6,:root[style*=--USER__wordSpacing] p,:root[style*=--USER__wordSpacing] li,:root[style*=--USER__wordSpacing] div,:root[style*=--USER__wordSpacing] dt,:root[style*=--USER__wordSpacing] dd{word-spacing:var(--USER__wordSpacing)}:root[style*=--USER__letterSpacing] h1,:root[style*=--USER__letterSpacing] h2,:root[style*=--USER__letterSpacing] h3,:root[style*=--USER__letterSpacing] h4,:root[style*=--USER__letterSpacing] h5,:root[style*=--USER__letterSpacing] h6,:root[style*=--USER__letterSpacing] p,:root[style*=--USER__letterSpacing] li,:root[style*=--USER__letterSpacing] div,:root[style*=--USER__letterSpacing] dt,:root[style*=--USER__letterSpacing] dd{letter-spacing:var(--USER__letterSpacing);font-variant:none}:root[style*=--USER__fontWeight] body{font-weight:var(--USER__fontWeight)!important}:root[style*=--USER__fontWeight] b,:root[style*=--USER__fontWeight] strong{font-weight:bolder}:root[style*=--USER__fontWidth] body{font-stretch:var(--USER__fontWidth)!important}:root[style*=--USER__fontOpticalSizing] body{font-optical-sizing:var(--USER__fontOpticalSizing)!important}:root[style*=readium-noRuby-on] body rt,:root[style*=readium-noRuby-on] body rp{display:none}:root[style*=--USER__ligatures]{font-variant-ligatures:var(--USER__ligatures)!important}:root[style*=--USER__ligatures] *{font-variant-ligatures:inherit!important}:root[style*=readium-iPadOSPatch-on] body{-webkit-text-size-adjust:none}:root[style*=readium-iPadOSPatch-on] p,:root[style*=readium-iPadOSPatch-on] h1,:root[style*=readium-iPadOSPatch-on] h2,:root[style*=readium-iPadOSPatch-on] h3,:root[style*=readium-iPadOSPatch-on] h4,:root[style*=readium-iPadOSPatch-on] h5,:root[style*=readium-iPadOSPatch-on] h6,:root[style*=readium-iPadOSPatch-on] li,:root[style*=readium-iPadOSPatch-on] th,:root[style*=readium-iPadOSPatch-on] td,:root[style*=readium-iPadOSPatch-on] dt,:root[style*=readium-iPadOSPatch-on] dd,:root[style*=readium-iPadOSPatch-on] pre,:root[style*=readium-iPadOSPatch-on] address,:root[style*=readium-iPadOSPatch-on] details,:root[style*=readium-iPadOSPatch-on] summary,:root[style*=readium-iPadOSPatch-on] figcaption,:root[style*=readium-iPadOSPatch-on] div:not(:has(p,h1,h2,h3,h4,h5,h6,li,th,td,dt,dd,pre,address,aside,details,figcaption,summary)),:root[style*=readium-iPadOSPatch-on] aside:not(:has(p,h1,h2,h3,h4,h5,h6,li,th,td,dt,dd,pre,address,aside,details,figcaption,summary)){-webkit-text-zoom:reset}:root[style*=readium-iPadOSPatch-on] abbr,:root[style*=readium-iPadOSPatch-on] b,:root[style*=readium-iPadOSPatch-on] bdi,:root[style*=readium-iPadOSPatch-on] bdo,:root[style*=readium-iPadOSPatch-on] cite,:root[style*=readium-iPadOSPatch-on] code,:root[style*=readium-iPadOSPatch-on] dfn,:root[style*=readium-iPadOSPatch-on] em,:root[style*=readium-iPadOSPatch-on] i,:root[style*=readium-iPadOSPatch-on] kbd,:root[style*=readium-iPadOSPatch-on] mark,:root[style*=readium-iPadOSPatch-on] q,:root[style*=readium-iPadOSPatch-on] rp,:root[style*=readium-iPadOSPatch-on] rt,:root[style*=readium-iPadOSPatch-on] ruby,:root[style*=readium-iPadOSPatch-on] s,:root[style*=readium-iPadOSPatch-on] samp,:root[style*=readium-iPadOSPatch-on] small,:root[style*=readium-iPadOSPatch-on] span,:root[style*=readium-iPadOSPatch-on] strong,:root[style*=readium-iPadOSPatch-on] sub,:root[style*=readium-iPadOSPatch-on] sup,:root[style*=readium-iPadOSPatch-on] time,:root[style*=readium-iPadOSPatch-on] u,:root[style*=readium-iPadOSPatch-on] var{-webkit-text-zoom:normal}:root[style*=readium-iPadOSPatch-on] p:not(:has(b,cite,em,i,q,s,small,span,strong)):first-line{-webkit-text-zoom:normal}',lt=(r,t)=>URL.createObjectURL(new Blob([r],{type:t})),Ai=r=>r.replace(/\/\/.*/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/\n/g,"").replace(/\s+/g," "),XA=r=>r.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g,"").replace(/ {2,}/g," ").replace(/url\((?!(https?:)?\/\/)("?)\/([^\)]+)/g,`url($2${window.location.origin}/$3`),le=(r,t)=>{const e=r.createElement("script");return e.dataset.readium="true",e.src=t.startsWith("blob:")?t:lt(t,"text/javascript"),e},ZA=(r,t)=>{const e=r.createElement("link");return e.dataset.readium="true",e.rel="stylesheet",e.type="text/css",e.href=t.startsWith("blob:")?t:lt(t,"text/css"),e},he=new Map,vt=(r,t)=>{if(he.has(r))return he.get(r);const e=t();return he.set(r,e),e},KA=r=>le(r,vt("css-selector-generator",()=>lt('!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports._readium_cssSelectorGenerator=e():t._readium_cssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t,e,n={d:(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};function r(t){return t&&t instanceof Element}function i(t="unknown problem",...e){console.warn(`CssSelectorGenerator: ${t}`,...e)}n.r(o),n.d(o,{default:()=>z,getCssSelector:()=>U}),function(t){t.NONE="none",t.DESCENDANT="descendant",t.CHILD="child"}(t||(t={})),function(t){t.id="id",t.class="class",t.tag="tag",t.attribute="attribute",t.nthchild="nthchild",t.nthoftype="nthoftype"}(e||(e={}));const c={selectors:[e.id,e.class,e.tag,e.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY};function u(t){return t instanceof RegExp}function s(t){return["string","function"].includes(typeof t)||u(t)}function l(t){return Array.isArray(t)?t.filter(s):[]}function a(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function f(t,e){if(a(t))return t.contains(e)||i("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 nto work as intended."),t;const n=e.getRootNode({composed:!1});return a(n)?(n!==document&&i("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."),n):e.ownerDocument.querySelector(":root")}function d(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function m(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function p(t){return[].concat(...t)}function h(t){const e=t.map((t=>{if(u(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(i("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return i("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function g(t,e,n){const o=Array.from(f(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function y(t,e){e=null!=e?e:function(t){return t.ownerDocument.querySelector(":root")}(t);const n=[];let o=t;for(;r(o)&&o!==e;)n.push(o),o=o.parentElement;return n}function b(t,e){return m(t.map((t=>y(t,e))))}const N={[t.NONE]:{type:t.NONE,value:""},[t.DESCENDANT]:{type:t.DESCENDANT,value:" > "},[t.CHILD]:{type:t.CHILD,value:" "}},S=new RegExp(["^$","\\\\s"].join("|")),E=new RegExp(["^$"].join("|")),w=[e.nthoftype,e.tag,e.id,e.class,e.attribute,e.nthchild],v=h(["class","id","ng-*"]);function C({nodeName:t}){return`[${t}]`}function O({nodeName:t,nodeValue:e}){return`[${t}=\'${L(e)}\']`}function T(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t},e){const n=e.tagName.toLowerCase();return!(["input","option"].includes(n)&&"value"===t||v(t))}(e,t)));return[...e.map(C),...e.map(O)]}function I(t){return(t.getAttribute("class")||"").trim().split(/\\s+/).filter((t=>!E.test(t))).map((t=>`.${L(t)}`))}function x(t){const e=t.getAttribute("id")||"",n=`#${L(e)}`,o=t.getRootNode({composed:!1});return!S.test(e)&&g([t],n,o)?[n]:[]}function j(t){const e=t.parentNode;if(e){const n=Array.from(e.childNodes).filter(r).indexOf(t);if(n>-1)return[`:nth-child(${n+1})`]}return[]}function A(t){return[L(t.tagName.toLowerCase())]}function D(t){const e=[...new Set(p(t.map(A)))];return 0===e.length||e.length>1?[]:[e[0]]}function $(t){const e=D([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${r+1})`]}return[]}function R(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){const n=[];let o=0,r=k(1);for(;r.length<=t.length&&o<e;)o+=1,n.push(r.map((e=>t[e]))),r=P(r,t.length-1);return n}function P(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return k(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?k(n+1):o}function k(t=1){return Array.from(Array(t).keys())}const _=":".charCodeAt(0).toString(16).toUpperCase(),M=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function L(t=""){var e,n;return null!==(n=null===(e=null===CSS||void 0===CSS?void 0:CSS.escape)||void 0===e?void 0:e.call(CSS,t))&&void 0!==n?n:function(t=""){return t.split("").map((t=>":"===t?`\\\\${_} `:M.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const q={tag:D,id:function(t){return 0===t.length||t.length>1?[]:x(t[0])},class:function(t){return m(t.map(I))},attribute:function(t){return m(t.map(T))},nthchild:function(t){return m(t.map(j))},nthoftype:function(t){return m(t.map($))}},F={tag:A,id:x,class:I,attribute:T,nthchild:j,nthoftype:$};function V(t){return t.includes(e.tag)||t.includes(e.nthoftype)?[...t]:[...t,e.tag]}function Y(t={}){const n=[...w];return t[e.tag]&&t[e.nthoftype]&&n.splice(n.indexOf(e.tag),1),n.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function B(t,e,n="",o){const r=function(t,e){return""===e?t:function(t,e){return[...t.map((t=>e+" "+t)),...t.map((t=>e+" > "+t))]}(t,e)}(function(t,e,n){const o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=h(n),u=h(o);return function(t){const{selectors:e,includeTag:n}=t,o=[].concat(e);return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){var n;return(null!==(n=q[e])&&void 0!==n?n:()=>[])(t)}(t,n),s=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,u),l=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(s,u);return e[n]=r?R(l,{maxResults:i}):l.map((t=>[t])),e}),{})}(t,n),r=function(t,e){return function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?R(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(V):i}(e).map((e=>function(t,e){const n={};return t.forEach((t=>{const o=e[t];o.length>0&&(n[t]=o)})),function(t={}){let e=[];return Object.entries(t).forEach((([t,n])=>{e=n.flatMap((n=>0===e.length?[{[t]:n}]:e.map((e=>Object.assign(Object.assign({},e),{[t]:n})))))})),e}(n).map(Y)}(e,t))).filter((t=>t.length>0))}(o,n),i=p(r);return[...new Set(i)]}(t,o.root,o),n);for(const e of r)if(g(t,e,o.root))return e;return null}function G(t){return{value:t,include:!1}}function W({selectors:t,operator:n}){let o=[...w];t[e.tag]&&t[e.nthoftype]&&(o=o.filter((t=>t!==e.tag)));let r="";return o.forEach((e=>{(t[e]||[]).forEach((({value:t,include:e})=>{e&&(r+=t)}))})),n.value+r}function H(n){return[":root",...y(n).reverse().map((n=>{const o=function(e,n,o=t.NONE){const r={};return n.forEach((t=>{Reflect.set(r,t,function(t,e){return F[e](t)}(e,t).map(G))})),{element:e,operator:N[o],selectors:r}}(n,[e.nthchild],t.DESCENDANT);return o.selectors.nthchild.forEach((t=>{t.include=!0})),o})).map(W)].join("")}function U(t,n={}){const o=function(t){const e=(Array.isArray(t)?t:[t]).filter(r);return[...new Set(e)]}(t),i=function(t,n={}){const o=Object.assign(Object.assign({},c),n);return{selectors:(r=o.selectors,Array.isArray(r)?r.filter((t=>{return n=e,o=t,Object.values(n).includes(o);var n,o})):[]),whitelist:l(o.whitelist),blacklist:l(o.blacklist),root:f(o.root,t),combineWithinSelector:!!o.combineWithinSelector,combineBetweenSelectors:!!o.combineBetweenSelectors,includeTag:!!o.includeTag,maxCombinations:d(o.maxCombinations),maxCandidates:d(o.maxCandidates)};var r}(o[0],n);let u="",s=i.root;function a(){return function(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...b(t,e).map((t=>[t]))];for(const t of r){const e=B(t,0,n,o);if(e)return{foundElements:t,selector:e}}return null}(o,s,u,i)}let m=a();for(;m;){const{foundElements:t,selector:e}=m;if(g(o,e,i.root))return e;s=t[0],u=e,m=a()}return o.length>1?o.map((t=>U(t,i))).join(", "):function(t){return t.map(H).join(", ")}(o)}const z=U;return o})()));',"text/javascript"))),qA=`
2
- window._readium_blockedEvents = [];
3
- window._readium_blockEvents = false; // WebPub doesn't need event blocking
4
- window._readium_eventBlocker = null;
5
- `,_A=r=>le(r,vt("webpub-js-before",()=>lt(Ai(qA),"text/javascript"))),$A=r=>le(r,vt("webpub-js-after",()=>lt(Ai(`
6
- if(window.onload) window.onload = new Proxy(window.onload, {
7
- apply: function(target, receiver, args) {
8
- if(!window._readium_blockEvents) {
9
- Reflect.apply(target, receiver, args);
10
- return;
11
- }
12
- _readium_blockedEvents.push([0, target, receiver, args]);
13
- }
14
- });`),"text/javascript")));class ni{constructor(t,e,i,A){this.pub=t,this.item=i,this.burl=i.toURL(e)||"",this.cssProperties=A}async build(){if(!this.item.mediaType.isHTML)throw new Error(`Unsupported media type for WebPub: ${this.item.mediaType.string}`);return await this.buildHtmlFrame()}async buildHtmlFrame(){const t=await this.pub.get(this.item).readAsString();if(!t)throw new Error(`Failed reading item ${this.item.href}`);const e=new DOMParser().parseFromString(t,this.item.mediaType.string),i=e.querySelector("parsererror");if(i){const A=i.querySelector("div");throw new Error(`Failed parsing item ${this.item.href}: ${A?.textContent||i.textContent}`)}return this.finalizeDOM(e,this.burl,this.item.mediaType,t,this.cssProperties)}hasExecutable(t){return!!t.querySelector("script")||!!t.querySelector("body[onload]:not(body[onload=''])")}setProperties(t,e){for(const i in t){const A=t[i];A&&e.documentElement.style.setProperty(i,A)}}finalizeDOM(t,e,i,A,n){if(!t)return"";if(t.head.appendChild(ZA(t,vt("ReadiumCSS-webpub",()=>lt(XA(LA),"text/css")))),n&&this.setProperties(n,t),t.body.querySelectorAll("img").forEach(a=>{a.setAttribute("fetchpriority","high")}),e!==void 0){const a=t.createElement("base");a.href=e,a.dataset.readium="true",t.head.firstChild.before(a)}const o=this.hasExecutable(t);o&&t.head.firstChild.before(_A(t)),t.head.firstChild.before(KA(t)),o&&t.head.appendChild($A(t));let s;return i.string==="application/xhtml+xml"?s=new XMLSerializer().serializeToString(t):s=this.serializeAsHTML(t,A||""),URL.createObjectURL(new Blob([s],{type:i.isHTML?i.string:"application/xhtml+xml"}))}serializeAsHTML(t,e){const i=e.match(/<!DOCTYPE[^>]*>/i),A=i?i[0]+`
15
- `:"";let o=t.documentElement.outerHTML;return A+o}}const tn=Math.pow(2,32),ri=()=>Math.round(Math.random()*tn).toString(36),ce=()=>`${Math.round(performance.now())}-${ri()}-${ri()}`,ht=1;class en{constructor(t){this.destination=null,this.registrar=new Map,this.origin="",this.channelId="",this.receiver=this.receive.bind(this),this.preLog=[],this.wnd=t,t.addEventListener("message",this.receiver)}receive(t){if(t.source===null)throw Error("Event source is null");if(typeof t.data!="object")return;const e=t.data;if(!(!("_readium"in e)||!e._readium||e._readium<=0)){if(e.key==="_ping"){if(!this.destination){if(this.destination=t.source,this.origin=t.origin,this.channelId=e._channel,e._readium!==ht){e._readium>ht?this.send("error",`received comms version ${e._readium} higher than ${ht}`):this.send("error",`received comms version ${e._readium} lower than ${ht}`),this.destination=null,this.origin="",this.channelId="";return}this.send("_pong",void 0),this.preLog.forEach(i=>this.send("log",i)),this.preLog=[]}return}else if(this.channelId){if(e._channel!==this.channelId||t.origin!==this.origin)return}else return;this.handle(e)}}handle(t){const e=this.registrar.get(t.key);if(!e||e.length===0){t.strict&&this.send("_unhandled",t);return}e.forEach(i=>i.cb(t.data,A=>{this.send("_ack",A,t.id)}))}register(t,e,i){Array.isArray(t)||(t=[t]),t.forEach(A=>{const n=this.registrar.get(A);if(n&&n.length>=0){if(n.find(o=>o.module===e))throw new Error(`Trying to register another callback for combination of event ${A} and module ${e}`);n.push({cb:i,module:e}),this.registrar.set(A,n)}else this.registrar.set(A,[{cb:i,module:e}])})}unregister(t,e){Array.isArray(t)||(t=[t]),t.forEach(i=>{const A=this.registrar.get(i);!A||A.length===0||A.splice(A.findIndex(n=>n.module===e),1)})}unregisterAll(t){this.registrar.forEach((e,i)=>this.registrar.set(i,e.filter(A=>A.module!==t)))}log(...t){this.destination?this.send("log",t):this.preLog.push(t)}get ready(){return!!this.destination}destroy(){this.destination=null,this.channelId="",this.preLog=[],this.registrar.clear(),this.wnd.removeEventListener("message",this.receiver)}send(t,e,i=void 0,A=[]){if(!this.destination)throw Error("Attempted to send comms message before destination has been initialized");const n={_readium:ht,_channel:this.channelId,id:i??ce(),key:t,data:e};try{this.destination.postMessage(n,{targetOrigin:this.origin,transfer:A})}catch(o){if(A.length>0)throw o;this.destination.postMessage(n,this.origin,A)}}}const Z=class It{constructor(t){if(typeof t=="string"){if(!It.VALID_MODES.has(t.toLowerCase()))return;this.value=t.toLowerCase()}else{const e=t.filter(i=>It.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 It(t);if(!Array.isArray(t))return;const e=t.filter(i=>i?It.VALID_MODES.has(i.toLowerCase()):!1);if(e.length!==0)return new It(e)}serialize(){return this.value}};Z.VALID_MODES=new Set(["auditory","tactile","textual","visual"]),Z.AUDITORY=new Z("auditory"),Z.TACTILE=new Z("tactile"),Z.TEXTUAL=new Z("textual"),Z.VISUAL=new Z("visual");class de{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 de({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}}class P{constructor(t){this.otherProperties=t}get page(){return this.otherProperties.page}static deserialize(t){if(t)return new P(t)}serialize(){return this.otherProperties}add(t){const e=Object.assign({},this.otherProperties);for(const i in t)e[i]=t[i];return new P(e)}}Object.defineProperty(P.prototype,"encryption",{get:function(){return de.deserialize(this.otherProperties.encrypted)}});function An(r){return r&&Array.isArray(r)?r:void 0}function oi(r){return r&&typeof r=="string"?[r]:An(r)}function si(r){return typeof r=="string"?new Date(r):void 0}function Dt(r){return isNaN(r)?void 0:r}function b(r){return Dt(r)!==void 0&&Math.sign(r)>=0?r:void 0}function nn(r){const t=new Array;return r.forEach(e=>t.push(e)),t}class m{constructor(t){let e,i,A=t.mediaType.replace(/\s/g,"").split(";");const n=A[0].split("/");if(n.length===2){if(e=n[0].toLowerCase().trim(),i=n[1].toLowerCase().trim(),e.length===0||i.length===0)throw new Error("Invalid media type")}else throw new Error("Invalid media type");const o={};for(let g=1;g<A.length;g++){const M=A[g].split("=");if(M.length===2){const l=M[0].toLocaleLowerCase(),p=l==="charset"?M[1].toUpperCase():M[1];o[l]=p}}const s={},a=Object.keys(o);a.sort((g,M)=>g.localeCompare(M)),a.forEach(g=>s[g]=o[g]);let h="";for(const g in s){const M=s[g];h+=`;${g}=${M}`}const c=`${e}/${i}${h}`,d=s.encoding;this.string=c,this.type=e,this.subtype=i,this.parameters=s,this.encoding=d,this.name=t.name,this.fileExtension=t.fileExtension}static parse(t){return new m(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"?m.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(([n,o])=>`${n}=${o}`)),A=new Set(Object.entries(e.parameters).map(([n,o])=>`${n}=${o}`));for(const n of Array.from(i.values()))if(!A.has(n))return!1;return!0}matches(t){const e=typeof t=="string"?m.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(m.ZIP,m.LCP_PROTECTED_AUDIOBOOK,m.LCP_PROTECTED_PDF)||this.structuredSyntaxSuffix==="+zip"}get isJSON(){return this.matchesAny(m.JSON)||this.structuredSyntaxSuffix==="+json"}get isOPDS(){return this.matchesAny(m.OPDS1,m.OPDS1_ENTRY,m.OPDS2,m.OPDS2_PUBLICATION,m.OPDS_AUTHENTICATION)||this.structuredSyntaxSuffix==="+json"}get isHTML(){return this.matchesAny(m.HTML,m.XHTML)}get isBitmap(){return this.matchesAny(m.BMP,m.GIF,m.JPEG,m.PNG,m.TIFF,m.WEBP)}get isAudio(){return this.type==="audio"}get isVideo(){return this.type==="video"}get isRWPM(){return this.matchesAny(m.READIUM_AUDIOBOOK_MANIFEST,m.DIVINA_MANIFEST,m.READIUM_WEBPUB_MANIFEST)}get isPublication(){return this.matchesAny(m.READIUM_AUDIOBOOK,m.READIUM_AUDIOBOOK_MANIFEST,m.CBZ,m.DIVINA,m.DIVINA_MANIFEST,m.EPUB,m.LCP_PROTECTED_AUDIOBOOK,m.LCP_PROTECTED_PDF,m.LPF,m.PDF,m.W3C_WPUB_MANIFEST,m.READIUM_WEBPUB,m.READIUM_WEBPUB_MANIFEST,m.ZAB)}static get AAC(){return m.parse({mediaType:"audio/aac",fileExtension:"aac"})}static get ACSM(){return m.parse({mediaType:"application/vnd.adobe.adept+xml",name:"Adobe Content Server Message",fileExtension:"acsm"})}static get AIFF(){return m.parse({mediaType:"audio/aiff",fileExtension:"aiff"})}static get AVI(){return m.parse({mediaType:"video/x-msvideo",fileExtension:"avi"})}static get BINARY(){return m.parse({mediaType:"application/octet-stream"})}static get BMP(){return m.parse({mediaType:"image/bmp",fileExtension:"bmp"})}static get CBZ(){return m.parse({mediaType:"application/vnd.comicbook+zip",name:"Comic Book Archive",fileExtension:"cbz"})}static get CSS(){return m.parse({mediaType:"text/css",fileExtension:"css"})}static get DIVINA(){return m.parse({mediaType:"application/divina+zip",name:"Digital Visual Narratives",fileExtension:"divina"})}static get DIVINA_MANIFEST(){return m.parse({mediaType:"application/divina+json",name:"Digital Visual Narratives",fileExtension:"json"})}static get EPUB(){return m.parse({mediaType:"application/epub+zip",name:"EPUB",fileExtension:"epub"})}static get GIF(){return m.parse({mediaType:"image/gif",fileExtension:"gif"})}static get GZ(){return m.parse({mediaType:"application/gzip",fileExtension:"gz"})}static get HTML(){return m.parse({mediaType:"text/html",fileExtension:"html"})}static get JAVASCRIPT(){return m.parse({mediaType:"text/javascript",fileExtension:"js"})}static get JPEG(){return m.parse({mediaType:"image/jpeg",fileExtension:"jpeg"})}static get JSON(){return m.parse({mediaType:"application/json"})}static get LCP_LICENSE_DOCUMENT(){return m.parse({mediaType:"application/vnd.readium.lcp.license.v1.0+json",name:"LCP License",fileExtension:"lcpl"})}static get LCP_PROTECTED_AUDIOBOOK(){return m.parse({mediaType:"application/audiobook+lcp",name:"LCP Protected Audiobook",fileExtension:"lcpa"})}static get LCP_PROTECTED_PDF(){return m.parse({mediaType:"application/pdf+lcp",name:"LCP Protected PDF",fileExtension:"lcpdf"})}static get LCP_STATUS_DOCUMENT(){return m.parse({mediaType:"application/vnd.readium.license.status.v1.0+json"})}static get LPF(){return m.parse({mediaType:"application/lpf+zip",fileExtension:"lpf"})}static get MP3(){return m.parse({mediaType:"audio/mpeg",fileExtension:"mp3"})}static get MPEG(){return m.parse({mediaType:"video/mpeg",fileExtension:"mpeg"})}static get NCX(){return m.parse({mediaType:"application/x-dtbncx+xml",fileExtension:"ncx"})}static get OGG(){return m.parse({mediaType:"audio/ogg",fileExtension:"oga"})}static get OGV(){return m.parse({mediaType:"video/ogg",fileExtension:"ogv"})}static get OPDS1(){return m.parse({mediaType:"application/atom+xml;profile=opds-catalog"})}static get OPDS1_ENTRY(){return m.parse({mediaType:"application/atom+xml;type=entry;profile=opds-catalog"})}static get OPDS2(){return m.parse({mediaType:"application/opds+json"})}static get OPDS2_PUBLICATION(){return m.parse({mediaType:"application/opds-publication+json"})}static get OPDS_AUTHENTICATION(){return m.parse({mediaType:"application/opds-authentication+json"})}static get OPUS(){return m.parse({mediaType:"audio/opus",fileExtension:"opus"})}static get OTF(){return m.parse({mediaType:"font/otf",fileExtension:"otf"})}static get PDF(){return m.parse({mediaType:"application/pdf",name:"PDF",fileExtension:"pdf"})}static get PNG(){return m.parse({mediaType:"image/png",fileExtension:"png"})}static get READIUM_AUDIOBOOK(){return m.parse({mediaType:"application/audiobook+zip",name:"Readium Audiobook",fileExtension:"audiobook"})}static get READIUM_AUDIOBOOK_MANIFEST(){return m.parse({mediaType:"application/audiobook+json",name:"Readium Audiobook",fileExtension:"json"})}static get READIUM_CONTENT_DOCUMENT(){return m.parse({mediaType:"application/vnd.readium.content+json",name:"Readium Content Document",fileExtension:"json"})}static get READIUM_GUIDED_NAVIGATION_DOCUMENT(){return m.parse({mediaType:"application/guided-navigation+json",name:"Readium Guided Navigation Document",fileExtension:"json"})}static get READIUM_POSITION_LIST(){return m.parse({mediaType:"application/vnd.readium.position-list+json",name:"Readium Position List",fileExtension:"json"})}static get READIUM_WEBPUB(){return m.parse({mediaType:"application/webpub+zip",name:"Readium Web Publication",fileExtension:"webpub"})}static get READIUM_WEBPUB_MANIFEST(){return m.parse({mediaType:"application/webpub+json",name:"Readium Web Publication",fileExtension:"json"})}static get SMIL(){return m.parse({mediaType:"application/smil+xml",fileExtension:"smil"})}static get SVG(){return m.parse({mediaType:"image/svg+xml",fileExtension:"svg"})}static get TEXT(){return m.parse({mediaType:"text/plain",fileExtension:"txt"})}static get TIFF(){return m.parse({mediaType:"image/tiff",fileExtension:"tiff"})}static get TTF(){return m.parse({mediaType:"font/ttf",fileExtension:"ttf"})}static get W3C_WPUB_MANIFEST(){return m.parse({mediaType:"application/x.readium.w3c.wpub+json",name:"Web Publication",fileExtension:"json"})}static get WAV(){return m.parse({mediaType:"audio/wav",fileExtension:"wav"})}static get WEBM_AUDIO(){return m.parse({mediaType:"audio/webm",fileExtension:"webm"})}static get WEBM_VIDEO(){return m.parse({mediaType:"video/webm",fileExtension:"webm"})}static get WEBP(){return m.parse({mediaType:"image/webp",fileExtension:"webp"})}static get WOFF(){return m.parse({mediaType:"font/woff",fileExtension:"woff"})}static get WOFF2(){return m.parse({mediaType:"font/woff2",fileExtension:"woff2"})}static get XHTML(){return m.parse({mediaType:"application/xhtml+xml",fileExtension:"xhtml"})}static get XML(){return m.parse({mediaType:"application/xml",fileExtension:"xml"})}static get ZAB(){return m.parse({mediaType:"application/x.readium.zab+zip",name:"Zipped Audio Book",fileExtension:"zab"})}static get ZIP(){return m.parse({mediaType:"application/zip",fileExtension:"zip"})}}class ai{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(A=>A.trim())):new Set}expand(t){const e=A=>A.split(",").map(n=>{const o=t[n];return o?encodeURIComponent(o):""}).join(","),i=A=>"?"+A.split(",").map(n=>{const o=n.split("=")[0],s=t[o];return s?`${o}=${encodeURIComponent(s)}`:""}).join("&");return this.uri.replace(/\{(\??)([^}]+)\}/g,(...A)=>A[1]?i(A[2]):e(A[2]))}}class C{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=Dt(t.progression),i=Dt(t.totalProgression),A=Dt(t.position),n=new Map,o=new Set(["fragment","fragments","progression","totalProgression","position"]);return Object.entries(t).forEach(([s,a])=>{o.has(s)||n.set(s,a)}),new C({fragments:oi(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:A!==void 0&&A>0?A:void 0,otherLocations:n.size===0?void 0:n})}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 et{constructor(t){this.after=t.after,this.before=t.before,this.highlight=t.highlight}static deserialize(t){if(t)return new et({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 K{constructor(t){this.href=t.href,this.type=t.type,this.title=t.title,this.locations=t.locations?t.locations:new C({}),this.text=t.text}static deserialize(t){if(t&&t.href&&t.type)return new K({href:t.href,type:t.type,title:t.title,locations:C.deserialize(t.locations),text:et.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 K({href:this.href,type:this.type,title:this.title,text:this.text,locations:new C({...this.locations,...t})})}}class ct{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 ct({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:P.deserialize(t.properties),height:b(t.height),width:b(t.width),size:b(t.size),duration:b(t.duration),bitrate:b(t.bitrate),languages:oi(t.language),alternates:Ht.deserialize(t.alternate),children:Ht.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=nn(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?m.parse({mediaType:this.type}):m.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 ai(this.href).parameters:new Set}expandTemplate(t){return new ct({href:new ai(this.href).expand(t),templated:!1})}addProperties(t){const e=ct.deserialize(this.serialize());return e.properties=e.properties?e.properties?.add(t):new P(t),e}get locator(){let t=this.href.split("#");return new K({href:t.length>0&&t[0]!==void 0?t[0]:this.href,type:this.type??"",title:this.title,locations:new C({fragments:t.length>1&&t[1]!==void 0?[t[1]]:[]})})}}class Ht{constructor(t){this.items=t}static deserialize(t){if(t&&Array.isArray(t))return new Ht(t.map(e=>ct.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 A of t)if(i.mediaType.matches(A))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)}}P.prototype.getContains=function(){return new Set(this.otherProperties.contains||[])};class Gt{constructor(t){this.cssSelector=t.cssSelector,this.textNodeIndex=t.textNodeIndex,this.charOffset=t.charOffset}static deserialize(t){if(!(t&&t.cssSelector))return;let e=b(t.textNodeIndex);if(e===void 0)return;let i=b(t.charOffset);return i===void 0&&(i=b(t.offset)),new Gt({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 ge{constructor(t){this.start=t.start,this.end=t.end}static deserialize(t){if(!t)return;let e=Gt.deserialize(t.start);if(e)return new ge({start:e,end:Gt.deserialize(t.end)})}serialize(){const t={start:this.start.serialize()};return this.end&&(t.end=this.end.serialize()),t}}C.prototype.getCssSelector=function(){return this.otherLocations?.get("cssSelector")},C.prototype.getPartialCfi=function(){return this.otherLocations?.get("partialCfi")},C.prototype.getDomRange=function(){return ge.deserialize(this.otherLocations?.get("domRange"))},C.prototype.fragmentParameters=function(){return new Map(this.fragments.map(r=>r.startsWith("#")?r.slice(1):r).join("&").split("&").filter(r=>!r.startsWith("#")).map(r=>r.split("=")).filter(r=>r.length===2).map(r=>[r[0].trim().toLowerCase(),r[1].trim()]))},C.prototype.htmlId=function(){if(!this.fragments.length)return;let r=this.fragments.find(t=>t.length&&!t.includes("="));if(!r){const t=this.fragmentParameters();t.has("id")?r=t.get("id"):t.has("name")&&(r=t.get("name"))}return r?.startsWith("#")?r.slice(1):r},C.prototype.page=function(){const r=parseInt(this.fragmentParameters().get("page"));if(!isNaN(r)&&r>=0)return r},C.prototype.time=function(){const r=parseInt(this.fragmentParameters().get("t"));if(!isNaN(r))return r},C.prototype.space=function(){const r=this.fragmentParameters();if(!r.has("xywh"))return;const t=r.get("xywh").split(",").map(e=>parseInt(e));if(t.length===4&&!t.some(isNaN))return t};class ue{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=b(t.value);if(i!==void 0)return new ue({currency:e,value:i})}serialize(){return{currency:this.currency,value:this.value}}}class Ft{constructor(t){this.type=t.type,this.children=t.children}static deserialize(t){if(t&&t.type)return new Ft({type:t.type,children:Ft.deserializeArray(t.children)})}static deserializeArray(t){if(Array.isArray(t))return t.map(e=>Ft.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 me{constructor(t){this.total=t.total,this.position=t.position}static deserialize(t){if(t)return new me({total:b(t.total),position:b(t.position)})}serialize(){const t={};return this.total!==void 0&&(t.total=this.total),this.position!==void 0&&(t.position=this.position),t}}class pe{constructor(t){this.total=t.total,this.available=t.available}static deserialize(t){if(t)return new pe({total:b(t.total),available:b(t.available)})}serialize(){const t={};return this.total!==void 0&&(t.total=this.total),this.available!==void 0&&(t.available=this.available),t}}class fe{constructor(t){this.state=t.state,this.since=t.since,this.until=t.until}static deserialize(t){if(t&&t.state)return new fe({state:t.state,since:si(t.since),until:si(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}}P.prototype.getNumberOfItems=function(){return b(this.otherProperties.numberOfItems)},P.prototype.getPrice=function(){return ue.deserialize(this.otherProperties.price)},P.prototype.getIndirectAcquisitions=function(){const r=this.otherProperties.indirectAcquisition;if(r&&Array.isArray(r))return r.map(t=>Ft.deserialize(t)).filter(t=>t!==void 0)},P.prototype.getHolds=function(){return me.deserialize(this.otherProperties.holds)},P.prototype.getCopies=function(){return pe.deserialize(this.otherProperties.copies)},P.prototype.getAvailability=function(){return fe.deserialize(this.otherProperties.availability)},P.prototype.getAuthenticate=function(){return ct.deserialize(this.otherProperties.authenticate)};const rn="CssSelectorGenerator";function li(r="unknown problem",...t){console.warn(`${rn}: ${r}`,...t)}function on(r){return r instanceof RegExp}function sn(r){return r.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".+")}function an(r){const t=r.map(e=>{if(on(e))return i=>e.test(i);if(typeof e=="function")return i=>{const A=e(i);return typeof A!="boolean"?(li("pattern matcher function invalid","Provided pattern matching function does not return boolean. It's result will be ignored.",e),!1):A};if(typeof e=="string"){const i=new RegExp("^"+sn(e)+"$");return A=>i.test(A)}return li("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))}an(["class","id","ng-*"]);class Ut{}function hi(r){return r.split("").reverse().join("")}function ln(r,t,e){const i=hi(t);return e.map(A=>{const n=Math.max(0,A.end-t.length-A.errors),o=hi(r.slice(n,A.end));return{start:di(o,i,A.errors).reduce((s,a)=>A.end-a.end<s?A.end-a.end:s,A.end),end:A.end,errors:A.errors}})}function Me(r){return(r|-r)>>31&1}function ci(r,t,e,i){let A=r.P[e],n=r.M[e];const o=i>>>31,s=t[e]|o,a=s|n,h=(s&A)+A^A|s;let c=n|~(h|A),d=A&h;const g=Me(c&r.lastRowMask[e])-Me(d&r.lastRowMask[e]);return c<<=1,d<<=1,d|=o,c|=Me(i)-o,A=d|~(a|c),n=c&a,r.P[e]=A,r.M[e]=n,g}function di(r,t,e){if(t.length===0)return[];e=Math.min(e,t.length);const i=[],A=32,n=Math.ceil(t.length/A)-1,o={P:new Uint32Array(n+1),M:new Uint32Array(n+1),lastRowMask:new Uint32Array(n+1)};o.lastRowMask.fill(1<<31),o.lastRowMask[n]=1<<(t.length-1)%A;const s=new Uint32Array(n+1),a=new Map,h=[];for(let g=0;g<256;g++)h.push(s);for(let g=0;g<t.length;g+=1){const M=t.charCodeAt(g);if(a.has(M))continue;const l=new Uint32Array(n+1);a.set(M,l),M<h.length&&(h[M]=l);for(let p=0;p<=n;p+=1){l[p]=0;for(let E=0;E<A;E+=1){const I=p*A+E;I>=t.length||t.charCodeAt(I)===M&&(l[p]|=1<<E)}}}let c=Math.max(0,Math.ceil(e/A)-1);const d=new Uint32Array(n+1);for(let g=0;g<=c;g+=1)d[g]=(g+1)*A;d[n]=t.length;for(let g=0;g<=c;g+=1)o.P[g]=-1,o.M[g]=0;for(let g=0;g<r.length;g+=1){const M=r.charCodeAt(g);let l;M<h.length?l=h[M]:(l=a.get(M),typeof l>"u"&&(l=s));let p=0;for(let E=0;E<=c;E+=1)p=ci(o,l,E,p),d[E]+=p;if(d[c]-p<=e&&c<n&&(l[c+1]&1||p<0)){c+=1,o.P[c]=-1,o.M[c]=0;let E;if(c===n){const I=t.length%A;E=I===0?A:I}else E=A;d[c]=d[c-1]+E-p+ci(o,l,c,p)}else for(;c>0&&d[c]>=e+A;)c-=1;c===n&&d[c]<=e&&(d[c]<e&&i.splice(0,i.length),i.push({start:-1,end:g+1,errors:d[c]}),e=d[c])}return i}function hn(r,t,e){const i=di(r,t,e);return ln(r,t,i)}function gi(r,t,e){let i=0;const A=[];for(;i!==-1;)i=r.indexOf(t,i),i!==-1&&(A.push({start:i,end:i+t.length,errors:0}),i+=1);return A.length>0?A:hn(r,t,e)}function ui(r,t){return t.length===0||r.length===0?0:1-gi(r,t,t.length)[0].errors/t.length}function cn(r,t,e={}){if(t.length===0)return null;const i=Math.min(256,t.length/2),A=gi(r,t,i);if(A.length===0)return null;const n=s=>{const a=1-s.errors/t.length,h=e.prefix?ui(r.slice(Math.max(0,s.start-e.prefix.length),s.start),e.prefix):1,c=e.suffix?ui(r.slice(s.end,s.end+e.suffix.length),e.suffix):1;let d=1;return typeof e.hint=="number"&&(d=1-Math.abs(s.start-e.hint)/r.length),(50*a+20*h+20*c+2*d)/92},o=A.map(s=>({start:s.start,end:s.end,score:n(s)}));return o.sort((s,a)=>a.score-s.score),o[0]}function Be(r,t,e){const i=e===1?t:t-1;if(r.charAt(i).trim()!=="")return t;let A,n;if(e===2?(A=r.substring(0,t),n=A.trimEnd()):(A=r.substring(t),n=A.trimStart()),!n.length)return-1;const o=A.length-n.length;return e===2?t-o:t+o}function mi(r,t){const e=r.commonAncestorContainer.ownerDocument.createNodeIterator(r.commonAncestorContainer,NodeFilter.SHOW_TEXT),i=t===1?r.startContainer:r.endContainer,A=t===1?r.endContainer:r.startContainer;let n=e.nextNode();for(;n&&n!==i;)n=e.nextNode();t===2&&(n=e.previousNode());let o=-1;const s=()=>{if(n=t===1?e.nextNode():e.previousNode(),n){const a=n.textContent,h=t===1?0:a.length;o=Be(a,h,t)}};for(;n&&o===-1&&n!==A;)s();if(n&&o>=0)return{node:n,offset:o};throw new RangeError("No text nodes with non-whitespace text found in range")}function dn(r){if(!r.toString().trim().length)throw new RangeError("Range contains no non-whitespace text");if(r.startContainer.nodeType!==Node.TEXT_NODE)throw new RangeError("Range startContainer is not a text node");if(r.endContainer.nodeType!==Node.TEXT_NODE)throw new RangeError("Range endContainer is not a text node");const t=r.cloneRange();let e=!1,i=!1;const A={start:Be(r.startContainer.textContent,r.startOffset,1),end:Be(r.endContainer.textContent,r.endOffset,2)};if(A.start>=0&&(t.setStart(r.startContainer,A.start),e=!0),A.end>0&&(t.setEnd(r.endContainer,A.end),i=!0),e&&i)return t;if(!e){const{node:n,offset:o}=mi(t,1);n&&o>=0&&t.setStart(n,o)}if(!i){const{node:n,offset:o}=mi(t,2);n&&o>0&&t.setEnd(n,o)}return t}function pi(r){switch(r.nodeType){case Node.ELEMENT_NODE:case Node.TEXT_NODE:return r.textContent?.length??0;default:return 0}}function fi(r){let t=r.previousSibling,e=0;for(;t;)e+=pi(t),t=t.previousSibling;return e}function Mi(r,...t){let e=t.shift();const i=r.ownerDocument.createNodeIterator(r,NodeFilter.SHOW_TEXT),A=[];let n=i.nextNode(),o,s=0;for(;e!==void 0&&n;)o=n,s+o.data.length>e?(A.push({node:o,offset:e-s}),e=t.shift()):(n=i.nextNode(),s+=o.data.length);for(;e!==void 0&&o&&s===e;)A.push({node:o,offset:o.data.length}),e=t.shift();if(e!==void 0)throw new RangeError("Offset exceeds text length");return A}class L{constructor(t,e){if(e<0)throw new Error("Offset is invalid");this.element=t,this.offset=e}relativeTo(t){if(!t.contains(this.element))throw new Error("Parent is not an ancestor of current element");let e=this.element,i=this.offset;for(;e!==t;)i+=fi(e),e=e.parentElement;return new L(e,i)}resolve(t={}){try{return Mi(this.element,this.offset)[0]}catch(e){if(this.offset===0&&t.direction!==void 0){const i=document.createTreeWalker(this.element.getRootNode(),NodeFilter.SHOW_TEXT);i.currentNode=this.element;const A=t.direction===1,n=A?i.nextNode():i.previousNode();if(!n)throw e;return{node:n,offset:A?0:n.data.length}}else throw e}}static fromCharOffset(t,e){switch(t.nodeType){case Node.TEXT_NODE:return L.fromPoint(t,e);case Node.ELEMENT_NODE:return new L(t,e);default:throw new Error("Node is not an element or text node")}}static fromPoint(t,e){switch(t.nodeType){case Node.TEXT_NODE:{if(e<0||e>t.data.length)throw new Error("Text node offset is out of range");if(!t.parentElement)throw new Error("Text node has no parent");const i=fi(t)+e;return new L(t.parentElement,i)}case Node.ELEMENT_NODE:{if(e<0||e>t.childNodes.length)throw new Error("Child node offset is out of range");let i=0;for(let A=0;A<e;A++)i+=pi(t.childNodes[A]);return new L(t,i)}default:throw new Error("Point is not in an element or text node")}}}class _{constructor(t,e){this.start=t,this.end=e}relativeTo(t){return new _(this.start.relativeTo(t),this.end.relativeTo(t))}toRange(){let t,e;this.start.element===this.end.element&&this.start.offset<=this.end.offset?[t,e]=Mi(this.start.element,this.start.offset,this.end.offset):(t=this.start.resolve({direction:1}),e=this.end.resolve({direction:2}));const i=new Range;return i.setStart(t.node,t.offset),i.setEnd(e.node,e.offset),i}static fromRange(t){const e=L.fromPoint(t.startContainer,t.startOffset),i=L.fromPoint(t.endContainer,t.endOffset);return new _(e,i)}static fromOffsets(t,e,i){return new _(new L(t,e),new L(t,i))}static trimmedRange(t){return dn(_.fromRange(t).toRange())}}class kt{constructor(t,e,i){this.root=t,this.start=e,this.end=i}static fromRange(t,e){const i=_.fromRange(e).relativeTo(t);return new kt(t,i.start.offset,i.end.offset)}static fromSelector(t,e){return new kt(t,e.start,e.end)}toSelector(){return{type:"TextPositionSelector",start:this.start,end:this.end}}toRange(){return _.fromOffsets(this.root,this.start,this.end).toRange()}}class Jt{constructor(t,e,i={}){this.root=t,this.exact=e,this.context=i}static fromRange(t,e){const i=t.textContent,A=_.fromRange(e).relativeTo(t),n=A.start.offset,o=A.end.offset,s=32;return new Jt(t,i.slice(n,o),{prefix:i.slice(Math.max(0,n-s),n),suffix:i.slice(o,Math.min(i.length,o+s))})}static fromSelector(t,e){const{prefix:i,suffix:A}=e;return new Jt(t,e.exact,{prefix:i,suffix:A})}toSelector(){return{type:"TextQuoteSelector",exact:this.exact,prefix:this.context.prefix,suffix:this.context.suffix}}toRange(t={}){return this.toPositionAnchor(t).toRange()}toPositionAnchor(t={}){const e=this.root.textContent,i=cn(e,this.exact,{...this.context,hint:t.hint});if(!i)throw new Error("Quote not found");return new kt(this.root,i.start,i.end)}}function gn(r){const t=r.tagName.toUpperCase();return t==="IMG"||t==="VIDEO"||t==="AUDIO"||t==="IFRAME"||t==="OBJECT"||t==="EMBED"||t==="CANVAS"}function Wt(r,t){try{const e=t.locations,i=t.text;if(i&&i.highlight){let A;e&&e.getCssSelector()&&(A=r.querySelector(e.getCssSelector())),A||(A=r.body);const n=new Jt(A,i.highlight,{prefix:i.before,suffix:i.after});try{return n.toRange()}catch{return console.warn("Quote not found:",n),null}}if(e){let A=null;if(!A&&e.getCssSelector()&&(A=r.querySelector(e.getCssSelector())),!A&&e.fragments){for(const n of e.fragments)if(A=r.getElementById(n),A)break}if(A){const n=r.createRange();return A.childNodes.length===0||gn(A)?(n.selectNode(A),n):(n.setStartBefore(A),n.setEndAfter(A),n)}}}catch(e){console.error(e)}return null}function un(r,t){let e=r.getClientRects();e.length||r.commonAncestorContainer.nodeType===Node.ELEMENT_NODE&&(e=r.commonAncestorContainer.getClientRects());const i=1,A=[];for(const h of e)A.push({bottom:h.bottom,height:h.height,left:h.left,right:h.right,top:h.top,width:h.width});const n=Bi(A,i),o=pn(n,i),s=wi(o),a=4;for(let h=s.length-1;h>=0;h--){const c=s[h];if(!(c.width*c.height>a))if(s.length>1)s.splice(h,1);else break}return s}function Bi(r,t,e){for(let i=0;i<r.length;i++)for(let A=i+1;A<r.length;A++){const n=r[i],o=r[A];if(n===o)continue;const s=H(n.top,o.top,t)&&H(n.bottom,o.bottom,t),a=H(n.left,o.left,t)&&H(n.right,o.right,t);if(s&&!a&&yi(n,o,t)){const h=r.filter(d=>d!==n&&d!==o),c=mn(n,o);return h.push(c),Bi(h,t)}}return r}function mn(r,t){const e=Math.min(r.left,t.left),i=Math.max(r.right,t.right),A=Math.min(r.top,t.top),n=Math.max(r.bottom,t.bottom);return{bottom:n,height:n-A,left:e,right:i,top:A,width:i-e}}function pn(r,t){const e=new Set(r);for(const i of r){if(!(i.width>1&&i.height>1)){e.delete(i);continue}for(const A of r)if(i!==A&&e.has(A)&&fn(A,i,t)){e.delete(i);break}}return Array.from(e)}function fn(r,t,e){return Ot(r,t.left,t.top,e)&&Ot(r,t.right,t.top,e)&&Ot(r,t.left,t.bottom,e)&&Ot(r,t.right,t.bottom,e)}function Ot(r,t,e,i){return(r.left<t||H(r.left,t,i))&&(r.right>t||H(r.right,t,i))&&(r.top<e||H(r.top,e,i))&&(r.bottom>e||H(r.bottom,e,i))}function wi(r){for(let t=0;t<r.length;t++)for(let e=t+1;e<r.length;e++){const i=r[t],A=r[e];if(i!==A&&yi(i,A,-1)){let n=[],o;const s=Ei(i,A);if(s.length===1)n=s,o=i;else{const h=Ei(A,i);s.length<h.length?(n=s,o=i):(n=h,o=A)}const a=r.filter(h=>h!==o);return Array.prototype.push.apply(a,n),wi(a)}}return r}function Ei(r,t){const e=Mn(t,r);if(e.height===0||e.width===0)return[r];const i=[];{const A={bottom:r.bottom,height:0,left:r.left,right:e.left,top:r.top,width:0};A.width=A.right-A.left,A.height=A.bottom-A.top,A.height!==0&&A.width!==0&&i.push(A)}{const A={bottom:e.top,height:0,left:e.left,right:e.right,top:r.top,width:0};A.width=A.right-A.left,A.height=A.bottom-A.top,A.height!==0&&A.width!==0&&i.push(A)}{const A={bottom:r.bottom,height:0,left:e.left,right:e.right,top:e.bottom,width:0};A.width=A.right-A.left,A.height=A.bottom-A.top,A.height!==0&&A.width!==0&&i.push(A)}{const A={bottom:r.bottom,height:0,left:e.right,right:r.right,top:r.top,width:0};A.width=A.right-A.left,A.height=A.bottom-A.top,A.height!==0&&A.width!==0&&i.push(A)}return i}function Mn(r,t){const e=Math.max(r.left,t.left),i=Math.min(r.right,t.right),A=Math.max(r.top,t.top),n=Math.min(r.bottom,t.bottom);return{bottom:n,height:Math.max(0,n-A),left:e,right:i,top:A,width:Math.max(0,i-e)}}function yi(r,t,e){return(r.left<t.right||e>=0&&H(r.left,t.right,e))&&(t.left<r.right||e>=0&&H(t.left,r.right,e))&&(r.top<t.bottom||e>=0&&H(r.top,t.bottom,e))&&(t.top<r.bottom||e>=0&&H(t.top,r.bottom,e))}function H(r,t,e){return Math.abs(r-t)<=e}function we(r){const t={},e=r.document.documentElement.style;for(const i in r.document.documentElement.style)Object.hasOwn(e,i)&&!Number.isNaN(Number.parseInt(i))&&(t[e[i]]=e.getPropertyValue(e[i]));return t}function Ii(r,t){const e=we(r);Object.keys(e).forEach(i=>{t.hasOwnProperty(i)||Lt(r,i)}),Object.entries(t).forEach(([i,A])=>{e[i]!==A&&Rt(r,i,A)})}function Ee(r,t){return r.document.documentElement.style.getPropertyValue(t)}function Rt(r,t,e){r.document.documentElement.style.setProperty(t,e)}function Lt(r,t){r.document.documentElement.style.removeProperty(t)}let Xt=null,ye=null,Ct=0;const dt={r:255,g:255,b:255,a:1},gt=new Map,Bn=()=>{if(!Xt)if(typeof OffscreenCanvas<"u")Xt=new OffscreenCanvas(5,5),ye=Xt.getContext("2d",{willReadFrequently:!0,desynchronized:!0});else{const r=document.createElement("canvas");r.width=5,r.height=5,Xt=r,ye=r.getContext("2d",{willReadFrequently:!0,desynchronized:!0})}return ye},wn=r=>{if(!r)return!0;const t=r.trim().toLowerCase();return t.startsWith("var(")||["transparent","currentcolor","inherit","initial","revert","unset","revert-layer"].includes(t)?!0:["linear-gradient","radial-gradient","conic-gradient","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient"].some(e=>t.includes(e))},Zt=(r,t)=>{console.warn(`[Decorator] Could not parse color: "${r}". ${t} Falling back to ${JSON.stringify(dt)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`)},Ie=(r,t=null)=>{const e=t?`${r}|${t}`:r,i=gt.get(e);if(i!==void 0)return i??dt;if(wn(r))return Zt(r,"Unsupported color format or special value."),gt.set(e,null),dt;const A=Bn();if(!A)return Zt(r,"Could not get canvas context."),gt.set(e,null),dt;try{Ct===0&&A.clearRect(0,0,5,5);const n=Ct%5,o=Math.floor(Ct/5);A.clearRect(n,o,1,1),t&&(A.fillStyle=t,A.fillRect(n,o,1,1)),A.fillStyle=r,A.fillRect(n,o,1,1);const s=A.getImageData(n,o,1,1);Ct=(Ct+1)%25;const[a,h,c,d]=s.data;if(d===0)return Zt(r,"Fully transparent color."),gt.set(e,null),dt;const g={r:a,g:h,b:c,a:d/255};return gt.set(e,g),g}catch(n){return Zt(r,`Error: ${n instanceof Error?n.message:String(n)}`),gt.set(e,null),dt}},Fe=r=>{const t=r/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)},Fi=r=>{const t=Fe(r.r),e=Fe(r.g),i=Fe(r.b);return .2126*t+.7152*e+.0722*i},Ui=(r,t)=>{const e=typeof r=="string"?Ie(r):r,i=typeof t=="string"?Ie(t):t,A=Fi(e),n=Fi(i),o=Math.max(A,n),s=Math.min(A,n);return(o+.05)/(s+.05)},Ue=(r,t=null)=>{const e=Ie(r,t),i=Ui(e,{r:255,g:255,b:255,a:1}),A=Ui(e,{r:0,g:0,b:0,a:1});return i>A},En=(r,t=null)=>Ue(r,t)?"white":"black",Ri="#FFFF00",yn=()=>"Highlight"in window,Ci=["IMG","IMAGE","AUDIO","VIDEO","SVG"];class In{constructor(t,e,i,A){this.wnd=t,this.comms=e,this.id=i,this.name=A,this.items=[],this.lastItemId=0,this.container=void 0,this.activateable=!1,this.experimentalHighlights=!1,this.currentRender=0,yn()&&(this.experimentalHighlights=!0,this.notTextFlag=new Map)}get activeable(){return this.activateable}set activeable(t){this.activateable=t}add(t){const e=`${this.id}-${this.lastItemId++}`,i=Wt(this.wnd.document,t.locator);if(!i){this.comms.log("Can't locate DOM range for decoration",t);return}const A=i.commonAncestorContainer;A.nodeType!==Node.TEXT_NODE&&this.experimentalHighlights&&(Ci.includes(A.nodeName.toUpperCase())&&this.notTextFlag?.set(e,!0),i.cloneContents().querySelector(Ci.join(", ").toLowerCase())&&this.notTextFlag?.set(e,!0),(A.textContent?.trim()||"").length===0&&this.notTextFlag?.set(e,!0));const n={decoration:t,id:e,range:i};this.items.push(n),this.layout(n),this.renderLayout([n])}remove(t){const e=this.items.findIndex(A=>A.decoration.id===t);if(e<0)return;const i=this.items[e];this.items.splice(e,1),i.clickableElements=void 0,i.container&&(i.container.remove(),i.container=void 0),this.experimentalHighlights&&!this.notTextFlag?.has(i.id)&&this.wnd.CSS.highlights.get(this.id)?.delete(i.range),this.notTextFlag?.delete(i.id)}update(t){this.remove(t.id),this.add(t)}clear(){this.clearContainer(),this.items.length=0,this.notTextFlag?.clear()}requestLayout(){this.wnd.cancelAnimationFrame(this.currentRender),this.clearContainer(),this.items.forEach(t=>this.layout(t)),this.renderLayout(this.items)}experimentalLayout(t){const[e,i]=this.requireContainer(!0);i.add(t.range);const A=Ee(this.wnd,"--USER__backgroundColor")||this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"),n=t.decoration?.style?.tint??Ri;e.innerHTML=`
1
+ (function(y,N){typeof exports=="object"&&typeof module<"u"?N(exports):typeof define=="function"&&define.amd?define(["exports"],N):(y=typeof globalThis<"u"?globalThis:y||self,N(y.navigator={}))})(this,(function(y){"use strict";const N=class _e{constructor(e){if(typeof e=="string"){if(!_e.VALID_MODES.has(e.toLowerCase()))return;this.value=e.toLowerCase()}else{const t=e.filter(i=>_e.VALID_MODES.has(i.toLowerCase()));if(t.length===0)return;this.value=Array.from(new Set(t))}}static deserialize(e){if(!e)return;if(typeof e=="string")return new _e(e);if(!Array.isArray(e))return;const t=e.filter(i=>i?_e.VALID_MODES.has(i.toLowerCase()):!1);if(t.length!==0)return new _e(t)}serialize(){return this.value}};N.VALID_MODES=new Set(["auditory","tactile","textual","visual"]),N.AUDITORY=new N("auditory"),N.TACTILE=new N("tactile"),N.TEXTUAL=new N("textual"),N.VISUAL=new N("visual");const b=class Vn{constructor(e){this.value=e}static deserialize(e){if(!(!e||typeof e!="string"))return new Vn(e)}serialize(){return this.value}};b.NONE=new b("none"),b.ANNOTATIONS=new b("annotations"),b.ARIA=new b("ARIA"),b.INDEX=new b("index"),b.PAGE_BREAK_MARKERS=new b("pageBreakMarkers"),b.PAGE_NAVIGATION=new b("pageNavigation"),b.PRINT_PAGE_NUMBERS=new b("printPageNumbers"),b.READING_ORDER=new b("readingOrder"),b.STRUCTURAL_NAVIGATION=new b("structuralNavigation"),b.TABLE_OF_CONTENTS=new b("tableOfContents"),b.TAGGED_PDF=new b("taggedPDF"),b.ALTERNATIVE_TEXT=new b("alternativeText"),b.AUDIO_DESCRIPTION=new b("audioDescription"),b.CAPTIONS=new b("captions"),b.CLOSED_CAPTIONS=new b("closedCaptions"),b.DESCRIBED_MATH=new b("describedMath"),b.LONG_DESCRIPTION=new b("longDescription"),b.OPEN_CAPTIONS=new b("openCaptions"),b.SIGN_LANGUAGE=new b("signLanguage"),b.TRANSCRIPT=new b("transcript"),b.DISPLAY_TRANSFORMABILITY=new b("displayTransformability"),b.SYNCHRONIZED_AUDIO_TEXT=new b("synchronizedAudioText"),b.TIMING_CONTROL=new b("timingControl"),b.UNLOCKED=new b("unlocked"),b.CHEM_ML=new b("ChemML"),b.LATEX=new b("latex"),b.LATEX_CHEMISTRY=new b("latex-chemistry"),b.MATH_ML=new b("MathML"),b.MATH_ML_CHEMISTRY=new b("MathML-chemistry"),b.TTS_MARKUP=new b("ttsMarkup"),b.HIGH_CONTRAST_AUDIO=new b("highContrastAudio"),b.HIGH_CONTRAST_DISPLAY=new b("highContrastDisplay"),b.LARGE_PRINT=new b("largePrint"),b.BRAILLE=new b("braille"),b.TACTILE_GRAPHIC=new b("tactileGraphic"),b.TACTILE_OBJECT=new b("tactileObject"),b.FULL_RUBY_ANNOTATIONS=new b("fullRubyAnnotations"),b.HORIZONTAL_WRITING=new b("horizontalWriting"),b.RUBY_ANNOTATIONS=new b("rubyAnnotations"),b.VERTICAL_WRITING=new b("verticalWriting"),b.WITH_ADDITIONAL_WORD_SEGMENTATION=new b("withAdditionalWordSegmentation"),b.WITHOUT_ADDITIONAL_WORD_SEGMENTATION=new b("withoutAdditionalWordSegmentation");let jt=b;const Bt=["en","ar","da","fr","it","pt_PT","sv"],to=JSON.parse(`{"format":{"audiobook":"Audiobook","audiobookJSON":"Audiobook Manifest","cbz":"Comic Book Archive","divina":"Divina Publication","divinaJSON":"Divina Publication Manifest","epub":"EPUB","lcpa":"LCP Protected Audiobook","lcpdf":"LCP Protected PDF","lcpl":"LCP License Document","pdf":"PDF","rwp":"Readium Web Publication","rwpm":"Readium Web Publication Manifest","zab":"Audiobook Archive","zip":"ZIP Archive"},"kind":{"audiobook_one":"audiobook","audiobook_other":"audiobooks","book_one":"book","book_other":"books","comic_one":"comic","comic_other":"comics","document_one":"document","document_other":"documents"},"metadata":{"accessibility":{"display-guide":{"accessibility-summary":{"no-metadata":"No information is available","publisher-contact":"For more information about the accessibility of this product, please contact the publisher: ","title":"Accessibility summary"},"additional-accessibility-information":{"aria":{"compact":"ARIA roles included","descriptive":"Content is enhanced with ARIA roles to optimize organization and facilitate navigation"},"audio-descriptions":"Audio descriptions","braille":"Braille","color-not-sole-means-of-conveying-information":"Color is not the sole means of conveying information","dyslexia-readability":"Dyslexia readability","full-ruby-annotations":"Full ruby annotations","high-contrast-between-foreground-and-background-audio":"High contrast between foreground and background audio","high-contrast-between-text-and-background":"High contrast between foreground text and background","large-print":"Large print","page-breaks":{"compact":"Page breaks included","descriptive":"Page breaks included from the original print source"},"ruby-annotations":"Some Ruby annotations","sign-language":"Sign language","tactile-graphics":{"compact":"Tactile graphics included","descriptive":"Tactile graphics have been integrated to facilitate access to visual elements for blind people"},"tactile-objects":"Tactile 3D objects","text-to-speech-hinting":"Text-to-speech hinting provided","title":"Additional accessibility information","ultra-high-contrast-between-text-and-background":"Ultra high contrast between text and background","visible-page-numbering":"Visible page numbering","without-background-sounds":"Without background sounds"},"conformance":{"a":{"compact":"This publication meets minimum accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level A standard"},"aa":{"compact":"This publication meets accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AA standard"},"aaa":{"compact":"This publication exceeds accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AAA standard"},"certifier":"The publication was certified by ","certifier-credentials":"The certifier's credential is ","details":{"certification-info":"The publication was certified on ","certifier-report":"For more information refer to the certifier's report","claim":"This publication claims to meet","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Level A","level-aa":"Level AA","level-aaa":"Level AAA","wcag-2-0":{"compact":"WCAG 2.0","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.0"},"wcag-2-1":{"compact":"WCAG 2.1","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.1"},"wcag-2-2":{"compact":"WCAG 2.2","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.2"}},"details-title":"Detailed conformance information","no":"No information is available","title":"Conformance","unknown-standard":"Conformance to accepted standards for accessibility of this publication cannot be determined"},"hazards":{"flashing":{"compact":"Flashing content","descriptive":"The publication contains flashing content that can cause photosensitive seizures"},"flashing-none":{"compact":"No flashing hazards","descriptive":"The publication does not contain flashing content that can cause photosensitive seizures"},"flashing-unknown":{"compact":"Flashing hazards not known","descriptive":"The presence of flashing content that can cause photosensitive seizures could not be determined"},"motion":{"compact":"Motion simulation","descriptive":"The publication contains motion simulations that can cause motion sickness"},"motion-none":{"compact":"No motion simulation hazards","descriptive":"The publication does not contain motion simulations that can cause motion sickness"},"motion-unknown":{"compact":"Motion simulation hazards not known","descriptive":"The presence of motion simulations that can cause motion sickness could not be determined"},"no-metadata":"No information is available","none":{"compact":"No hazards","descriptive":"The publication contains no hazards"},"sound":{"compact":"Sounds","descriptive":"The publication contains sounds that can cause sensitivity issues"},"sound-none":{"compact":"No sound hazards","descriptive":"The publication does not contain sounds that can cause sensitivity issues"},"sound-unknown":{"compact":"Sound hazards not known","descriptive":"The presence of sounds that can cause sensitivity issues could not be determined"},"title":"Hazards","unknown":"The presence of hazards is unknown"},"legal-considerations":{"exempt":{"compact":"Claims an accessibility exemption in some jurisdictions","descriptive":"This publication claims an accessibility exemption in some jurisdictions"},"no-metadata":"No information is available","title":"Legal considerations"},"navigation":{"index":{"compact":"Index","descriptive":"Index with links to referenced entries"},"no-metadata":"No information is available","page-navigation":{"compact":"Go to page","descriptive":"Page list to go to pages from the print source version"},"structural":{"compact":"Headings","descriptive":"Elements such as headings, tables, etc for structured navigation"},"title":"Navigation","toc":{"compact":"Table of contents","descriptive":"Table of contents to all chapters of the text via links"}},"rich-content":{"accessible-chemistry-as-latex":{"compact":"Chemical formulas in LaTeX","descriptive":"Chemical formulas in accessible format (LaTeX)"},"accessible-chemistry-as-mathml":{"compact":"Chemical formulas in MathML","descriptive":"Chemical formulas in accessible format (MathML)"},"accessible-math-as-latex":{"compact":"Math as LaTeX","descriptive":"Math formulas in accessible format (LaTeX)"},"accessible-math-described":"Text descriptions of math are provided","closed-captions":{"compact":"Videos have closed captions","descriptive":"Videos included in publications have closed captions"},"extended-descriptions":"Information-rich images are described by extended descriptions","math-as-mathml":{"compact":"Math as MathML","descriptive":"Math formulas in accessible format (MathML)"},"open-captions":{"compact":"Videos have open captions","descriptive":"Videos included in publications have open captions"},"title":"Rich content","transcript":"Transcript(s) provided","unknown":"No information is available"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{"compact":"Has alternative text","descriptive":"Has alternative text descriptions for images"},"no-metadata":"No information about nonvisual reading is available","none":{"compact":"Not readable in read aloud or dynamic braille","descriptive":"The content is not readable as read aloud speech or dynamic braille"},"not-fully":{"compact":"Not fully readable in read aloud or dynamic braille","descriptive":"Not all of the content will be readable as read aloud speech or dynamic braille"},"readable":{"compact":"Readable in read aloud or dynamic braille","descriptive":"All content can be read as read aloud speech or dynamic braille"}},"prerecorded-audio":{"complementary":{"compact":"Prerecorded audio clips","descriptive":"Prerecorded audio clips are embedded in the content"},"no-metadata":"No information about prerecorded audio is available","only":{"compact":"Prerecorded audio only","descriptive":"Audiobook with no text alternative"},"synchronized":{"compact":"Prerecorded audio synchronized with text","descriptive":"All the content is available as prerecorded audio synchronized with text"}},"title":"Ways of reading","visual-adjustments":{"modifiable":{"compact":"Appearance can be modified","descriptive":"Appearance of the text and page layout can be modified according to the capabilities of the reading system (font family and font size, spaces between paragraphs, sentences, words, and letters, as well as color of background and text)"},"unknown":"No information about appearance modifiability is available","unmodifiable":{"compact":"Appearance cannot be modified","descriptive":"Text and page layout cannot be modified as the reading experience is close to a print version, but reading systems can still provide zooming options"}}}}},"altIdentifier_one":"alternate identifier","altIdentifier_other":"alternate identifiers","artist_one":"artist","artist_other":"artists","author_one":"author","author_other":"authors","collection_one":"editorial collection","collection_other":"editorial collections","colorist_one":"colorist","colorist_other":"colorists","contributor_one":"contributor","contributor_other":"contributors","description":"description","duration":"duration","editor_one":"editor","editor_other":"editors","identifier_one":"identifier","identifier_other":"identifiers","illustrator_one":"illustrator","illustrator_other":"illustrators","imprint_one":"imprint","imprint_other":"imprints","inker_one":"inker","inker_other":"inkers","language_one":"language","language_other":"languages","letterer_one":"letterer","letterer_other":"letterers","modified":"modification date","narrator_one":"narrator","narrator_other":"narrators","numberOfPages":"print length","penciler_one":"penciler","penciler_other":"pencilers","published":"publication date","publisher_one":"publisher","publisher_other":"publishers","series_one":"series","series_other":"series","subject_one":"subject","subject_other":"subjects","subtitle":"subtitle","title":"title","translator_one":"translator","translator_other":"translators"}}`),io={publication:to},Ht={fr:()=>Promise.resolve().then(()=>Tr),ar:()=>Promise.resolve().then(()=>zr),da:()=>Promise.resolve().then(()=>Or),it:()=>Promise.resolve().then(()=>Mr),pt_PT:()=>Promise.resolve().then(()=>Ir),sv:()=>Promise.resolve().then(()=>Fr)},Gt=io?.publication?.metadata?.accessibility?.["display-guide"]||{};(class Ne{constructor(){this.currentLocaleCode="en",this.locale=Gt,this.loadedLocales={},this.loadedLocales.en=Gt}static getInstance(){return Ne.instance||(Ne.instance=new Ne),Ne.instance}async loadLocale(e){if(!Bt.includes(e))return console.warn(`Locale '${e}' is not enabled`),!1;if(e in this.loadedLocales)return!0;try{if(!(e in Ht))return console.warn(`Locale file not found for: ${e}`),!1;const t=(await Ht[e]()).default?.publication?.metadata?.accessibility?.["display-guide"];return t?(this.loadedLocales[e]=t,!0):(console.warn(`No accessibility strings found in locale ${e}`),!1)}catch(t){return console.warn(`Failed to load locale ${e}:`,t),!1}}registerLocale(e,t){if(!e||typeof e!="string")throw new Error("Locale code must be a non-empty string");this.loadedLocales[e]=t}async setLocale(e){return e in this.loadedLocales||await this.loadLocale(e),e in this.loadedLocales?(this.locale=this.loadedLocales[e],this.currentLocaleCode=e,!0):(console.warn(`Locale '${e}' is not available`),!1)}getCurrentLocale(){return this.currentLocaleCode}getAvailableLocales(){return Bt}getNestedValue(e,t){const i=t.split(".");let n=e;for(const o of i){if(n==null)return;n=n[o]}return n}getString(e){let t=this.getNestedValue(this.locale,e);return t===void 0&&this.currentLocaleCode!=="en"&&(t=this.getNestedValue(this.loadedLocales.en,e)),t!==void 0?typeof t=="string"?{compact:t,descriptive:t}:t:(console.warn(`Missing localization for key: ${e}`),{compact:"",descriptive:""})}}).getInstance();var S=(r=>(r.reflowable="reflowable",r.fixed="fixed",r.scrolled="scrolled",r))(S||{});let no=class $n{constructor(e){this.algorithm=e.algorithm,this.compression=e.compression,this.originalLength=e.originalLength,this.profile=e.profile,this.scheme=e.scheme}static deserialize(e){if(e&&e.algorithm)return new $n({algorithm:e.algorithm,compression:e.compression,originalLength:e.originalLength,profile:e.profile,scheme:e.scheme})}serialize(){const e={algorithm:this.algorithm};return this.compression!==void 0&&(e.compression=this.compression),this.originalLength!==void 0&&(e.originalLength=this.originalLength),this.profile!==void 0&&(e.profile=this.profile),this.scheme!==void 0&&(e.scheme=this.scheme),e}};var H=(r=>(r.left="left",r.right="right",r.center="center",r))(H||{});let G=class Ft{constructor(e){this.otherProperties=e}get page(){return this.otherProperties.page}static deserialize(e){if(e)return new Ft(e)}serialize(){return this.otherProperties}add(e){const t=Object.assign({},this.otherProperties);for(const i in e)t[i]=e[i];return new Ft(t)}};Object.defineProperty(G.prototype,"encryption",{get:function(){return no.deserialize(this.otherProperties.encrypted)}});function oo(r){return r&&Array.isArray(r)?r:void 0}function Vt(r){return r&&typeof r=="string"?[r]:oo(r)}function $t(r){return typeof r=="string"?new Date(r):void 0}function Ue(r){return isNaN(r)?void 0:r}function M(r){return Ue(r)!==void 0&&Math.sign(r)>=0?r:void 0}function ro(r){const e=new Array;return r.forEach(t=>e.push(t)),e}class m{constructor(e){let t,i,n=e.mediaType.replace(/\s/g,"").split(";");const o=n[0].split("/");if(o.length===2){if(t=o[0].toLowerCase().trim(),i=o[1].toLowerCase().trim(),t.length===0||i.length===0)throw new Error("Invalid media type")}else throw new Error("Invalid media type");const s={};for(let p=1;p<n.length;p++){const v=n[p].split("=");if(v.length===2){const c=v[0].toLocaleLowerCase(),f=c==="charset"?v[1].toUpperCase():v[1];s[c]=f}}const a={},l=Object.keys(s);l.sort((p,v)=>p.localeCompare(v)),l.forEach(p=>a[p]=s[p]);let h="";for(const p in a){const v=a[p];h+=`;${p}=${v}`}const d=`${t}/${i}${h}`,u=a.encoding;this.string=d,this.type=t,this.subtype=i,this.parameters=a,this.encoding=u,this.name=e.name,this.fileExtension=e.fileExtension}static parse(e){return new m(e)}get structuredSyntaxSuffix(){const e=this.subtype.split("+");return e.length>1?`+${e[e.length-1]}`:void 0}get charset(){return this.parameters.charset}contains(e){const t=typeof e=="string"?m.parse({mediaType:e}):e;if(!((this.type==="*"||this.type===t.type)&&(this.subtype==="*"||this.subtype===t.subtype)))return!1;const i=new Set(Object.entries(this.parameters).map(([o,s])=>`${o}=${s}`)),n=new Set(Object.entries(t.parameters).map(([o,s])=>`${o}=${s}`));for(const o of Array.from(i.values()))if(!n.has(o))return!1;return!0}matches(e){const t=typeof e=="string"?m.parse({mediaType:e}):e;return this.contains(t)||t.contains(this)}matchesAny(...e){for(const t of e)if(this.matches(t))return!0;return!1}equals(e){return this.string===e.string}get isZIP(){return this.matchesAny(m.ZIP,m.LCP_PROTECTED_AUDIOBOOK,m.LCP_PROTECTED_PDF)||this.structuredSyntaxSuffix==="+zip"}get isJSON(){return this.matchesAny(m.JSON)||this.structuredSyntaxSuffix==="+json"}get isOPDS(){return this.matchesAny(m.OPDS1,m.OPDS1_ENTRY,m.OPDS2,m.OPDS2_PUBLICATION,m.OPDS_AUTHENTICATION)||this.structuredSyntaxSuffix==="+json"}get isHTML(){return this.matchesAny(m.HTML,m.XHTML)}get isBitmap(){return this.matchesAny(m.BMP,m.GIF,m.JPEG,m.PNG,m.TIFF,m.WEBP)}get isAudio(){return this.type==="audio"}get isVideo(){return this.type==="video"}get isRWPM(){return this.matchesAny(m.READIUM_AUDIOBOOK_MANIFEST,m.DIVINA_MANIFEST,m.READIUM_WEBPUB_MANIFEST)}get isPublication(){return this.matchesAny(m.READIUM_AUDIOBOOK,m.READIUM_AUDIOBOOK_MANIFEST,m.CBZ,m.DIVINA,m.DIVINA_MANIFEST,m.EPUB,m.LCP_PROTECTED_AUDIOBOOK,m.LCP_PROTECTED_PDF,m.LPF,m.PDF,m.W3C_WPUB_MANIFEST,m.READIUM_WEBPUB,m.READIUM_WEBPUB_MANIFEST,m.ZAB)}static get AAC(){return m.parse({mediaType:"audio/aac",fileExtension:"aac"})}static get ACSM(){return m.parse({mediaType:"application/vnd.adobe.adept+xml",name:"Adobe Content Server Message",fileExtension:"acsm"})}static get AIFF(){return m.parse({mediaType:"audio/aiff",fileExtension:"aiff"})}static get AVI(){return m.parse({mediaType:"video/x-msvideo",fileExtension:"avi"})}static get BINARY(){return m.parse({mediaType:"application/octet-stream"})}static get BMP(){return m.parse({mediaType:"image/bmp",fileExtension:"bmp"})}static get CBZ(){return m.parse({mediaType:"application/vnd.comicbook+zip",name:"Comic Book Archive",fileExtension:"cbz"})}static get CSS(){return m.parse({mediaType:"text/css",fileExtension:"css"})}static get DIVINA(){return m.parse({mediaType:"application/divina+zip",name:"Digital Visual Narratives",fileExtension:"divina"})}static get DIVINA_MANIFEST(){return m.parse({mediaType:"application/divina+json",name:"Digital Visual Narratives",fileExtension:"json"})}static get EPUB(){return m.parse({mediaType:"application/epub+zip",name:"EPUB",fileExtension:"epub"})}static get GIF(){return m.parse({mediaType:"image/gif",fileExtension:"gif"})}static get GZ(){return m.parse({mediaType:"application/gzip",fileExtension:"gz"})}static get HTML(){return m.parse({mediaType:"text/html",fileExtension:"html"})}static get JAVASCRIPT(){return m.parse({mediaType:"text/javascript",fileExtension:"js"})}static get JPEG(){return m.parse({mediaType:"image/jpeg",fileExtension:"jpeg"})}static get JSON(){return m.parse({mediaType:"application/json"})}static get LCP_LICENSE_DOCUMENT(){return m.parse({mediaType:"application/vnd.readium.lcp.license.v1.0+json",name:"LCP License",fileExtension:"lcpl"})}static get LCP_PROTECTED_AUDIOBOOK(){return m.parse({mediaType:"application/audiobook+lcp",name:"LCP Protected Audiobook",fileExtension:"lcpa"})}static get LCP_PROTECTED_PDF(){return m.parse({mediaType:"application/pdf+lcp",name:"LCP Protected PDF",fileExtension:"lcpdf"})}static get LCP_STATUS_DOCUMENT(){return m.parse({mediaType:"application/vnd.readium.license.status.v1.0+json"})}static get LPF(){return m.parse({mediaType:"application/lpf+zip",fileExtension:"lpf"})}static get MP3(){return m.parse({mediaType:"audio/mpeg",fileExtension:"mp3"})}static get MPEG(){return m.parse({mediaType:"video/mpeg",fileExtension:"mpeg"})}static get NCX(){return m.parse({mediaType:"application/x-dtbncx+xml",fileExtension:"ncx"})}static get OGG(){return m.parse({mediaType:"audio/ogg",fileExtension:"oga"})}static get OGV(){return m.parse({mediaType:"video/ogg",fileExtension:"ogv"})}static get OPDS1(){return m.parse({mediaType:"application/atom+xml;profile=opds-catalog"})}static get OPDS1_ENTRY(){return m.parse({mediaType:"application/atom+xml;type=entry;profile=opds-catalog"})}static get OPDS2(){return m.parse({mediaType:"application/opds+json"})}static get OPDS2_PUBLICATION(){return m.parse({mediaType:"application/opds-publication+json"})}static get OPDS_AUTHENTICATION(){return m.parse({mediaType:"application/opds-authentication+json"})}static get OPUS(){return m.parse({mediaType:"audio/opus",fileExtension:"opus"})}static get OTF(){return m.parse({mediaType:"font/otf",fileExtension:"otf"})}static get PDF(){return m.parse({mediaType:"application/pdf",name:"PDF",fileExtension:"pdf"})}static get PNG(){return m.parse({mediaType:"image/png",fileExtension:"png"})}static get READIUM_AUDIOBOOK(){return m.parse({mediaType:"application/audiobook+zip",name:"Readium Audiobook",fileExtension:"audiobook"})}static get READIUM_AUDIOBOOK_MANIFEST(){return m.parse({mediaType:"application/audiobook+json",name:"Readium Audiobook",fileExtension:"json"})}static get READIUM_CONTENT_DOCUMENT(){return m.parse({mediaType:"application/vnd.readium.content+json",name:"Readium Content Document",fileExtension:"json"})}static get READIUM_GUIDED_NAVIGATION_DOCUMENT(){return m.parse({mediaType:"application/guided-navigation+json",name:"Readium Guided Navigation Document",fileExtension:"json"})}static get READIUM_POSITION_LIST(){return m.parse({mediaType:"application/vnd.readium.position-list+json",name:"Readium Position List",fileExtension:"json"})}static get READIUM_WEBPUB(){return m.parse({mediaType:"application/webpub+zip",name:"Readium Web Publication",fileExtension:"webpub"})}static get READIUM_WEBPUB_MANIFEST(){return m.parse({mediaType:"application/webpub+json",name:"Readium Web Publication",fileExtension:"json"})}static get SMIL(){return m.parse({mediaType:"application/smil+xml",fileExtension:"smil"})}static get SVG(){return m.parse({mediaType:"image/svg+xml",fileExtension:"svg"})}static get TEXT(){return m.parse({mediaType:"text/plain",fileExtension:"txt"})}static get TIFF(){return m.parse({mediaType:"image/tiff",fileExtension:"tiff"})}static get TTF(){return m.parse({mediaType:"font/ttf",fileExtension:"ttf"})}static get W3C_WPUB_MANIFEST(){return m.parse({mediaType:"application/x.readium.w3c.wpub+json",name:"Web Publication",fileExtension:"json"})}static get WAV(){return m.parse({mediaType:"audio/wav",fileExtension:"wav"})}static get WEBM_AUDIO(){return m.parse({mediaType:"audio/webm",fileExtension:"webm"})}static get WEBM_VIDEO(){return m.parse({mediaType:"video/webm",fileExtension:"webm"})}static get WEBP(){return m.parse({mediaType:"image/webp",fileExtension:"webp"})}static get WOFF(){return m.parse({mediaType:"font/woff",fileExtension:"woff"})}static get WOFF2(){return m.parse({mediaType:"font/woff2",fileExtension:"woff2"})}static get XHTML(){return m.parse({mediaType:"application/xhtml+xml",fileExtension:"xhtml"})}static get XML(){return m.parse({mediaType:"application/xml",fileExtension:"xml"})}static get ZAB(){return m.parse({mediaType:"application/x.readium.zab+zip",name:"Zipped Audio Book",fileExtension:"zab"})}static get ZIP(){return m.parse({mediaType:"application/zip",fileExtension:"zip"})}}let Xt=class{constructor(e){this.uri=e,this.parameters=this.getParameters(e)}getParameters(e){const t=/\{\??([^}]+)\}/g,i=e.match(t);return i?new Set(i.join(",").replace(t,"$1").split(",").map(n=>n.trim())):new Set}expand(e){const t=n=>n.split(",").map(o=>{const s=e[o];return s?encodeURIComponent(s):""}).join(","),i=n=>"?"+n.split(",").map(o=>{const s=o.split("=")[0],a=e[s];return a?`${s}=${encodeURIComponent(a)}`:""}).join("&");return this.uri.replace(/\{(\??)([^}]+)\}/g,(...n)=>n[1]?i(n[2]):t(n[2]))}},U=class Xn{constructor(e){this.fragments=e.fragments?e.fragments:new Array,this.progression=e.progression,this.totalProgression=e.totalProgression,this.position=e.position,this.otherLocations=e.otherLocations}static deserialize(e){if(!e)return;const t=Ue(e.progression),i=Ue(e.totalProgression),n=Ue(e.position),o=new Map,s=new Set(["fragment","fragments","progression","totalProgression","position"]);return Object.entries(e).forEach(([a,l])=>{s.has(a)||o.set(a,l)}),new Xn({fragments:Vt(e.fragments||e.fragment),progression:t!==void 0&&t>=0&&t<=1?t:void 0,totalProgression:i!==void 0&&i>=0&&i<=1?i:void 0,position:n!==void 0&&n>0?n:void 0,otherLocations:o.size===0?void 0:o})}serialize(){const e={};return this.fragments&&(e.fragments=this.fragments),this.progression!==void 0&&(e.progression=this.progression),this.totalProgression!==void 0&&(e.totalProgression=this.totalProgression),this.position!==void 0&&(e.position=this.position),this.otherLocations&&this.otherLocations.forEach((t,i)=>e[i]=t),e}},so=class qn{constructor(e){this.after=e.after,this.before=e.before,this.highlight=e.highlight}static deserialize(e){if(e)return new qn({after:e.after,before:e.before,highlight:e.highlight})}serialize(){const e={};return this.after!==void 0&&(e.after=this.after),this.before!==void 0&&(e.before=this.before),this.highlight!==void 0&&(e.highlight=this.highlight),e}},ae=class Nt{constructor(e){this.href=e.href,this.type=e.type,this.title=e.title,this.locations=e.locations?e.locations:new U({}),this.text=e.text}static deserialize(e){if(e&&e.href&&e.type)return new Nt({href:e.href,type:e.type,title:e.title,locations:U.deserialize(e.locations),text:so.deserialize(e.text)})}serialize(){const e={href:this.href,type:this.type};return this.title!==void 0&&(e.title=this.title),this.locations&&(e.locations=this.locations.serialize()),this.text&&(e.text=this.text.serialize()),e}copyWithLocations(e){return new Nt({href:this.href,type:this.type,title:this.title,text:this.text,locations:new U({...this.locations,...e})})}},K=class nt{constructor(e){this.href=e.href,this.templated=e.templated,this.type=e.type,this.title=e.title,this.rels=e.rels,this.properties=e.properties,this.height=e.height,this.width=e.width,this.size=e.size,this.duration=e.duration,this.bitrate=e.bitrate,this.languages=e.languages,this.alternates=e.alternates,this.children=e.children}static deserialize(e){if(!(!e||typeof e.href!="string"))return new nt({href:e.href,templated:e.templated,type:e.type,title:e.title,rels:e.rel?Array.isArray(e.rel)?new Set(e.rel):new Set([e.rel]):void 0,properties:G.deserialize(e.properties),height:M(e.height),width:M(e.width),size:M(e.size),duration:M(e.duration),bitrate:M(e.bitrate),languages:Vt(e.language),alternates:qt.deserialize(e.alternate),children:qt.deserialize(e.children)})}serialize(){const e={href:this.href};return this.templated!==void 0&&(e.templated=this.templated),this.type!==void 0&&(e.type=this.type),this.title!==void 0&&(e.title=this.title),this.rels&&(e.rel=ro(this.rels)),this.properties&&(e.properties=this.properties.serialize()),this.height!==void 0&&(e.height=this.height),this.width!==void 0&&(e.width=this.width),this.size!==void 0&&(e.size=this.size),this.duration!==void 0&&(e.duration=this.duration),this.bitrate!==void 0&&(e.bitrate=this.bitrate),this.languages&&(e.language=this.languages),this.alternates&&(e.alternate=this.alternates.serialize()),this.children&&(e.children=this.children.serialize()),e}get mediaType(){return this.type!==void 0?m.parse({mediaType:this.type}):m.BINARY}toURL(e){const t=this.href.replace(/^(\/)/,"");if(t.length===0)return;let i=e||"/";return i.startsWith("/")&&(i="file://"+i),new URL(t,i).href.replace(/^(file:\/\/)/,"")}get templateParameters(){return this.templated?new Xt(this.href).parameters:new Set}expandTemplate(e){return new nt({href:new Xt(this.href).expand(e),templated:!1})}addProperties(e){const t=nt.deserialize(this.serialize());return t.properties=t.properties?t.properties?.add(e):new G(e),t}get locator(){let e=this.href.split("#");return new ae({href:e.length>0&&e[0]!==void 0?e[0]:this.href,type:this.type??"",title:this.title,locations:new U({fragments:e.length>1&&e[1]!==void 0?[e[1]]:[]})})}},qt=class Yn{constructor(e){this.items=e}static deserialize(e){if(e&&Array.isArray(e))return new Yn(e.map(t=>K.deserialize(t)).filter(t=>t!==void 0))}serialize(){return this.items.map(e=>e.serialize())}findWithRel(e){const t=i=>i.rels&&i.rels.has(e);return this.items.find(t)}filterByRel(e){const t=i=>i.rels&&i.rels.has(e);return this.items.filter(t)}findWithHref(e){const t=i=>i.href===e;return this.items.find(t)}findIndexWithHref(e){const t=i=>i.href===e;return this.items.findIndex(t)}findWithMediaType(e){const t=i=>i.mediaType.matches(e);return this.items.find(t)}filterByMediaType(e){const t=i=>i.mediaType.matches(e);return this.items.filter(t)}filterByMediaTypes(e){const t=i=>{for(const n of e)if(i.mediaType.matches(n))return!0;return!1};return this.items.filter(t)}everyIsAudio(){const e=t=>t.mediaType.isAudio;return this.items.length>0&&this.items.every(e)}everyIsBitmap(){const e=t=>t.mediaType.isBitmap;return this.items.length>0&&this.items.every(e)}everyIsHTML(){const e=t=>t.mediaType.isHTML;return this.items.length>0&&this.items.every(e)}everyIsVideo(){const e=t=>t.mediaType.isVideo;return this.items.length>0&&this.items.every(e)}everyMatchesMediaType(e){return Array.isArray(e)?this.items.length>0&&this.items.every(t=>{for(const i of e)return t.mediaType.matches(i);return!1}):this.items.length>0&&this.items.every(t=>t.mediaType.matches(e))}filterLinksHasType(){return this.items.filter(e=>e.type)}};var Yt=(r=>(r.EPUB="https://readium.org/webpub-manifest/profiles/epub",r.AUDIOBOOK="https://readium.org/webpub-manifest/profiles/audiobook",r.DIVINA="https://readium.org/webpub-manifest/profiles/divina",r.PDF="https://readium.org/webpub-manifest/profiles/pdf",r))(Yt||{}),O=(r=>(r.ltr="ltr",r.rtl="rtl",r))(O||{});G.prototype.getContains=function(){return new Set(this.otherProperties.contains||[])};let Jt=class Jn{constructor(e){this.cssSelector=e.cssSelector,this.textNodeIndex=e.textNodeIndex,this.charOffset=e.charOffset}static deserialize(e){if(!(e&&e.cssSelector))return;let t=M(e.textNodeIndex);if(t===void 0)return;let i=M(e.charOffset);return i===void 0&&(i=M(e.offset)),new Jn({cssSelector:e.cssSelector,textNodeIndex:t,charOffset:i})}serialize(){const e={cssSelector:this.cssSelector,textNodeIndex:this.textNodeIndex};return this.charOffset!==void 0&&(e.charOffset=this.charOffset),e}},ao=class Kn{constructor(e){this.start=e.start,this.end=e.end}static deserialize(e){if(!e)return;let t=Jt.deserialize(e.start);if(t)return new Kn({start:t,end:Jt.deserialize(e.end)})}serialize(){const e={start:this.start.serialize()};return this.end&&(e.end=this.end.serialize()),e}};U.prototype.getCssSelector=function(){return this.otherLocations?.get("cssSelector")},U.prototype.getPartialCfi=function(){return this.otherLocations?.get("partialCfi")},U.prototype.getDomRange=function(){return ao.deserialize(this.otherLocations?.get("domRange"))},U.prototype.fragmentParameters=function(){return new Map(this.fragments.map(r=>r.startsWith("#")?r.slice(1):r).join("&").split("&").filter(r=>!r.startsWith("#")).map(r=>r.split("=")).filter(r=>r.length===2).map(r=>[r[0].trim().toLowerCase(),r[1].trim()]))},U.prototype.htmlId=function(){if(!this.fragments.length)return;let r=this.fragments.find(e=>e.length&&!e.includes("="));if(!r){const e=this.fragmentParameters();e.has("id")?r=e.get("id"):e.has("name")&&(r=e.get("name"))}return r?.startsWith("#")?r.slice(1):r},U.prototype.page=function(){const r=parseInt(this.fragmentParameters().get("page"));if(!isNaN(r)&&r>=0)return r},U.prototype.time=function(){const r=parseInt(this.fragmentParameters().get("t"));if(!isNaN(r))return r},U.prototype.space=function(){const r=this.fragmentParameters();if(!r.has("xywh"))return;const e=r.get("xywh").split(",").map(t=>parseInt(t));if(e.length===4&&!e.some(isNaN))return e};class rt{constructor(e){this.currency=e.currency,this.value=e.value}static deserialize(e){if(!e)return;let t=e.currency;if(!(t&&typeof t=="string"&&t.length>0))return;let i=M(e.value);if(i!==void 0)return new rt({currency:t,value:i})}serialize(){return{currency:this.currency,value:this.value}}}let lo=class ot{constructor(e){this.type=e.type,this.children=e.children}static deserialize(e){if(e&&e.type)return new ot({type:e.type,children:ot.deserializeArray(e.children)})}static deserializeArray(e){if(Array.isArray(e))return e.map(t=>ot.deserialize(t)).filter(t=>t!==void 0)}serialize(){const e={type:this.type};return this.children&&(e.children=this.children.map(t=>t.serialize())),e}},co=class Zn{constructor(e){this.total=e.total,this.position=e.position}static deserialize(e){if(e)return new Zn({total:M(e.total),position:M(e.position)})}serialize(){const e={};return this.total!==void 0&&(e.total=this.total),this.position!==void 0&&(e.position=this.position),e}},ho=class Qn{constructor(e){this.total=e.total,this.available=e.available}static deserialize(e){if(e)return new Qn({total:M(e.total),available:M(e.available)})}serialize(){const e={};return this.total!==void 0&&(e.total=this.total),this.available!==void 0&&(e.available=this.available),e}},uo=class eo{constructor(e){this.state=e.state,this.since=e.since,this.until=e.until}static deserialize(e){if(e&&e.state)return new eo({state:e.state,since:$t(e.since),until:$t(e.until)})}serialize(){const e={state:this.state};return this.since!==void 0&&(e.since=this.since.toISOString()),this.until!==void 0&&(e.until=this.until.toISOString()),e}};G.prototype.getNumberOfItems=function(){return M(this.otherProperties.numberOfItems)},G.prototype.getPrice=function(){return rt.deserialize(this.otherProperties.price)},G.prototype.getIndirectAcquisitions=function(){const r=this.otherProperties.indirectAcquisition;if(r&&Array.isArray(r))return r.map(e=>lo.deserialize(e)).filter(e=>e!==void 0)},G.prototype.getHolds=function(){return co.deserialize(this.otherProperties.holds)},G.prototype.getCopies=function(){return ho.deserialize(this.otherProperties.copies)},G.prototype.getAvailability=function(){return uo.deserialize(this.otherProperties.availability)},G.prototype.getAuthenticate=function(){return K.deserialize(this.otherProperties.authenticate)};const po="CssSelectorGenerator";function Kt(r="unknown problem",...e){console.warn(`${po}: ${r}`,...e)}function mo(r){return r instanceof RegExp}function go(r){return r.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".+")}function fo(r){const e=r.map(t=>{if(mo(t))return i=>t.test(i);if(typeof t=="function")return i=>{const n=t(i);return typeof n!="boolean"?(Kt("pattern matcher function invalid","Provided pattern matching function does not return boolean. It's result will be ignored.",t),!1):n};if(typeof t=="string"){const i=new RegExp("^"+go(t)+"$");return n=>i.test(n)}return Kt("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1});return t=>e.some(i=>i(t))}fo(["class","id","ng-*"]);class Zt{}class st extends Zt{goLeft(e=!1,t){this.readingProgression===O.ltr?this.goBackward(e,t):this.readingProgression===O.rtl&&this.goForward(e,t)}goRight(e=!1,t){this.readingProgression===O.ltr?this.goForward(e,t):this.readingProgression===O.rtl&&this.goBackward(e,t)}}class Qt{constructor(e,t,i,n){this.injector=null,this.pub=e,this.item=i,this.burl=i.toURL(t)||"",this.cssProperties=n.cssProperties,this.injector=n.injector??null}async build(){if(!this.item.mediaType.isHTML)throw new Error(`Unsupported media type for WebPub: ${this.item.mediaType.string}`);return await this.buildHtmlFrame()}async buildHtmlFrame(){const e=await this.pub.get(this.item).readAsString();if(!e)throw new Error(`Failed reading item ${this.item.href}`);const t=new DOMParser().parseFromString(e,this.item.mediaType.string),i=t.querySelector("parsererror");if(i){const n=i.querySelector("div");throw new Error(`Failed parsing item ${this.item.href}: ${n?.textContent||i.textContent}`)}return this.injector&&await this.injector.injectForDocument(t,this.item),this.finalizeDOM(t,this.burl,this.item.mediaType,e,this.cssProperties)}setProperties(e,t){for(const i in e){const n=e[i];n&&t.documentElement.style.setProperty(i,n)}}finalizeDOM(e,t,i,n,o){if(!e)return"";if(o&&this.setProperties(o,e),e.body.querySelectorAll("img").forEach(a=>{a.setAttribute("fetchpriority","high")}),t!==void 0){const a=e.createElement("base");a.href=t,a.dataset.readium="true",e.head.firstChild.before(a)}let s;return i.string==="application/xhtml+xml"?s=new XMLSerializer().serializeToString(e):s=this.serializeAsHTML(e,n||""),URL.createObjectURL(new Blob([s],{type:i.isHTML?i.string:"application/xhtml+xml"}))}serializeAsHTML(e,t){const i=t.match(/<!DOCTYPE[^>]*>/i),n=i?i[0]+`
2
+ `:"";let s=e.documentElement.outerHTML;return n+s}}const bo=Math.pow(2,32),ei=()=>Math.round(Math.random()*bo).toString(36),at=()=>`${Math.round(performance.now())}-${ei()}-${ei()}`,le=1;class yo{constructor(e){this.destination=null,this.registrar=new Map,this.origin="",this.channelId="",this.receiver=this.receive.bind(this),this.preLog=[],this.wnd=e,e.addEventListener("message",this.receiver)}receive(e){if(e.source===null)throw Error("Event source is null");if(typeof e.data!="object")return;const t=e.data;if(!(!("_readium"in t)||!t._readium||t._readium<=0)){if(t.key==="_ping"){if(!this.destination){if(this.destination=e.source,this.origin=e.origin,this.channelId=t._channel,t._readium!==le){t._readium>le?this.send("error",`received comms version ${t._readium} higher than ${le}`):this.send("error",`received comms version ${t._readium} lower than ${le}`),this.destination=null,this.origin="",this.channelId="";return}this.send("_pong",void 0),this.preLog.forEach(i=>this.send("log",i)),this.preLog=[]}return}else if(this.channelId){if(t._channel!==this.channelId||e.origin!==this.origin)return}else return;this.handle(t)}}handle(e){const t=this.registrar.get(e.key);if(!t||t.length===0){e.strict&&this.send("_unhandled",e);return}t.forEach(i=>i.cb(e.data,n=>{this.send("_ack",n,e.id)}))}register(e,t,i){Array.isArray(e)||(e=[e]),e.forEach(n=>{const o=this.registrar.get(n);if(o&&o.length>=0){if(o.find(s=>s.module===t))throw new Error(`Trying to register another callback for combination of event ${n} and module ${t}`);o.push({cb:i,module:t}),this.registrar.set(n,o)}else this.registrar.set(n,[{cb:i,module:t}])})}unregister(e,t){Array.isArray(e)||(e=[e]),e.forEach(i=>{const n=this.registrar.get(i);!n||n.length===0||n.splice(n.findIndex(o=>o.module===t),1)})}unregisterAll(e){this.registrar.forEach((t,i)=>this.registrar.set(i,t.filter(n=>n.module!==e)))}log(...e){this.destination?this.send("log",e):this.preLog.push(e)}get ready(){return!!this.destination}destroy(){this.destination=null,this.channelId="",this.preLog=[],this.registrar.clear(),this.wnd.removeEventListener("message",this.receiver)}send(e,t,i=void 0,n=[]){if(!this.destination)throw Error("Attempted to send comms message before destination has been initialized");const o={_readium:le,_channel:this.channelId,id:i??at(),key:e,data:t};try{this.destination.postMessage(o,{targetOrigin:this.origin,transfer:n})}catch(s){if(n.length>0)throw s;this.destination.postMessage(o,this.origin,n)}}}const q=class we{constructor(e){if(typeof e=="string"){if(!we.VALID_MODES.has(e.toLowerCase()))return;this.value=e.toLowerCase()}else{const t=e.filter(i=>we.VALID_MODES.has(i.toLowerCase()));if(t.length===0)return;this.value=Array.from(new Set(t))}}static deserialize(e){if(!e)return;if(typeof e=="string")return new we(e);if(!Array.isArray(e))return;const t=e.filter(i=>i?we.VALID_MODES.has(i.toLowerCase()):!1);if(t.length!==0)return new we(t)}serialize(){return this.value}};q.VALID_MODES=new Set(["auditory","tactile","textual","visual"]),q.AUDITORY=new q("auditory"),q.TACTILE=new q("tactile"),q.TEXTUAL=new q("textual"),q.VISUAL=new q("visual");const ti=["en","ar","da","fr","it","pt_PT","sv"],vo=JSON.parse(`{"format":{"audiobook":"Audiobook","audiobookJSON":"Audiobook Manifest","cbz":"Comic Book Archive","divina":"Divina Publication","divinaJSON":"Divina Publication Manifest","epub":"EPUB","lcpa":"LCP Protected Audiobook","lcpdf":"LCP Protected PDF","lcpl":"LCP License Document","pdf":"PDF","rwp":"Readium Web Publication","rwpm":"Readium Web Publication Manifest","zab":"Audiobook Archive","zip":"ZIP Archive"},"kind":{"audiobook_one":"audiobook","audiobook_other":"audiobooks","book_one":"book","book_other":"books","comic_one":"comic","comic_other":"comics","document_one":"document","document_other":"documents"},"metadata":{"accessibility":{"display-guide":{"accessibility-summary":{"no-metadata":"No information is available","publisher-contact":"For more information about the accessibility of this product, please contact the publisher: ","title":"Accessibility summary"},"additional-accessibility-information":{"aria":{"compact":"ARIA roles included","descriptive":"Content is enhanced with ARIA roles to optimize organization and facilitate navigation"},"audio-descriptions":"Audio descriptions","braille":"Braille","color-not-sole-means-of-conveying-information":"Color is not the sole means of conveying information","dyslexia-readability":"Dyslexia readability","full-ruby-annotations":"Full ruby annotations","high-contrast-between-foreground-and-background-audio":"High contrast between foreground and background audio","high-contrast-between-text-and-background":"High contrast between foreground text and background","large-print":"Large print","page-breaks":{"compact":"Page breaks included","descriptive":"Page breaks included from the original print source"},"ruby-annotations":"Some Ruby annotations","sign-language":"Sign language","tactile-graphics":{"compact":"Tactile graphics included","descriptive":"Tactile graphics have been integrated to facilitate access to visual elements for blind people"},"tactile-objects":"Tactile 3D objects","text-to-speech-hinting":"Text-to-speech hinting provided","title":"Additional accessibility information","ultra-high-contrast-between-text-and-background":"Ultra high contrast between text and background","visible-page-numbering":"Visible page numbering","without-background-sounds":"Without background sounds"},"conformance":{"a":{"compact":"This publication meets minimum accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level A standard"},"aa":{"compact":"This publication meets accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AA standard"},"aaa":{"compact":"This publication exceeds accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AAA standard"},"certifier":"The publication was certified by ","certifier-credentials":"The certifier's credential is ","details":{"certification-info":"The publication was certified on ","certifier-report":"For more information refer to the certifier's report","claim":"This publication claims to meet","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Level A","level-aa":"Level AA","level-aaa":"Level AAA","wcag-2-0":{"compact":"WCAG 2.0","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.0"},"wcag-2-1":{"compact":"WCAG 2.1","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.1"},"wcag-2-2":{"compact":"WCAG 2.2","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.2"}},"details-title":"Detailed conformance information","no":"No information is available","title":"Conformance","unknown-standard":"Conformance to accepted standards for accessibility of this publication cannot be determined"},"hazards":{"flashing":{"compact":"Flashing content","descriptive":"The publication contains flashing content that can cause photosensitive seizures"},"flashing-none":{"compact":"No flashing hazards","descriptive":"The publication does not contain flashing content that can cause photosensitive seizures"},"flashing-unknown":{"compact":"Flashing hazards not known","descriptive":"The presence of flashing content that can cause photosensitive seizures could not be determined"},"motion":{"compact":"Motion simulation","descriptive":"The publication contains motion simulations that can cause motion sickness"},"motion-none":{"compact":"No motion simulation hazards","descriptive":"The publication does not contain motion simulations that can cause motion sickness"},"motion-unknown":{"compact":"Motion simulation hazards not known","descriptive":"The presence of motion simulations that can cause motion sickness could not be determined"},"no-metadata":"No information is available","none":{"compact":"No hazards","descriptive":"The publication contains no hazards"},"sound":{"compact":"Sounds","descriptive":"The publication contains sounds that can cause sensitivity issues"},"sound-none":{"compact":"No sound hazards","descriptive":"The publication does not contain sounds that can cause sensitivity issues"},"sound-unknown":{"compact":"Sound hazards not known","descriptive":"The presence of sounds that can cause sensitivity issues could not be determined"},"title":"Hazards","unknown":"The presence of hazards is unknown"},"legal-considerations":{"exempt":{"compact":"Claims an accessibility exemption in some jurisdictions","descriptive":"This publication claims an accessibility exemption in some jurisdictions"},"no-metadata":"No information is available","title":"Legal considerations"},"navigation":{"index":{"compact":"Index","descriptive":"Index with links to referenced entries"},"no-metadata":"No information is available","page-navigation":{"compact":"Go to page","descriptive":"Page list to go to pages from the print source version"},"structural":{"compact":"Headings","descriptive":"Elements such as headings, tables, etc for structured navigation"},"title":"Navigation","toc":{"compact":"Table of contents","descriptive":"Table of contents to all chapters of the text via links"}},"rich-content":{"accessible-chemistry-as-latex":{"compact":"Chemical formulas in LaTeX","descriptive":"Chemical formulas in accessible format (LaTeX)"},"accessible-chemistry-as-mathml":{"compact":"Chemical formulas in MathML","descriptive":"Chemical formulas in accessible format (MathML)"},"accessible-math-as-latex":{"compact":"Math as LaTeX","descriptive":"Math formulas in accessible format (LaTeX)"},"accessible-math-described":"Text descriptions of math are provided","closed-captions":{"compact":"Videos have closed captions","descriptive":"Videos included in publications have closed captions"},"extended-descriptions":"Information-rich images are described by extended descriptions","math-as-mathml":{"compact":"Math as MathML","descriptive":"Math formulas in accessible format (MathML)"},"open-captions":{"compact":"Videos have open captions","descriptive":"Videos included in publications have open captions"},"title":"Rich content","transcript":"Transcript(s) provided","unknown":"No information is available"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{"compact":"Has alternative text","descriptive":"Has alternative text descriptions for images"},"no-metadata":"No information about nonvisual reading is available","none":{"compact":"Not readable in read aloud or dynamic braille","descriptive":"The content is not readable as read aloud speech or dynamic braille"},"not-fully":{"compact":"Not fully readable in read aloud or dynamic braille","descriptive":"Not all of the content will be readable as read aloud speech or dynamic braille"},"readable":{"compact":"Readable in read aloud or dynamic braille","descriptive":"All content can be read as read aloud speech or dynamic braille"}},"prerecorded-audio":{"complementary":{"compact":"Prerecorded audio clips","descriptive":"Prerecorded audio clips are embedded in the content"},"no-metadata":"No information about prerecorded audio is available","only":{"compact":"Prerecorded audio only","descriptive":"Audiobook with no text alternative"},"synchronized":{"compact":"Prerecorded audio synchronized with text","descriptive":"All the content is available as prerecorded audio synchronized with text"}},"title":"Ways of reading","visual-adjustments":{"modifiable":{"compact":"Appearance can be modified","descriptive":"Appearance of the text and page layout can be modified according to the capabilities of the reading system (font family and font size, spaces between paragraphs, sentences, words, and letters, as well as color of background and text)"},"unknown":"No information about appearance modifiability is available","unmodifiable":{"compact":"Appearance cannot be modified","descriptive":"Text and page layout cannot be modified as the reading experience is close to a print version, but reading systems can still provide zooming options"}}}}},"altIdentifier_one":"alternate identifier","altIdentifier_other":"alternate identifiers","artist_one":"artist","artist_other":"artists","author_one":"author","author_other":"authors","collection_one":"editorial collection","collection_other":"editorial collections","colorist_one":"colorist","colorist_other":"colorists","contributor_one":"contributor","contributor_other":"contributors","description":"description","duration":"duration","editor_one":"editor","editor_other":"editors","identifier_one":"identifier","identifier_other":"identifiers","illustrator_one":"illustrator","illustrator_other":"illustrators","imprint_one":"imprint","imprint_other":"imprints","inker_one":"inker","inker_other":"inkers","language_one":"language","language_other":"languages","letterer_one":"letterer","letterer_other":"letterers","modified":"modification date","narrator_one":"narrator","narrator_other":"narrators","numberOfPages":"print length","penciler_one":"penciler","penciler_other":"pencilers","published":"publication date","publisher_one":"publisher","publisher_other":"publishers","series_one":"series","series_other":"series","subject_one":"subject","subject_other":"subjects","subtitle":"subtitle","title":"title","translator_one":"translator","translator_other":"translators"}}`),So={publication:vo},ii={fr:()=>Promise.resolve().then(()=>Nr),ar:()=>Promise.resolve().then(()=>Ur),da:()=>Promise.resolve().then(()=>Dr),it:()=>Promise.resolve().then(()=>Wr),pt_PT:()=>Promise.resolve().then(()=>jr),sv:()=>Promise.resolve().then(()=>Br)},ni=So?.publication?.metadata?.accessibility?.["display-guide"]||{};class ce{constructor(){this.currentLocaleCode="en",this.locale=ni,this.loadedLocales={},this.loadedLocales.en=ni}static getInstance(){return ce.instance||(ce.instance=new ce),ce.instance}async loadLocale(e){if(!ti.includes(e))return console.warn(`Locale '${e}' is not enabled`),!1;if(e in this.loadedLocales)return!0;try{if(!(e in ii))return console.warn(`Locale file not found for: ${e}`),!1;const t=(await ii[e]()).default?.publication?.metadata?.accessibility?.["display-guide"];return t?(this.loadedLocales[e]=t,!0):(console.warn(`No accessibility strings found in locale ${e}`),!1)}catch(t){return console.warn(`Failed to load locale ${e}:`,t),!1}}registerLocale(e,t){if(!e||typeof e!="string")throw new Error("Locale code must be a non-empty string");this.loadedLocales[e]=t}async setLocale(e){return e in this.loadedLocales||await this.loadLocale(e),e in this.loadedLocales?(this.locale=this.loadedLocales[e],this.currentLocaleCode=e,!0):(console.warn(`Locale '${e}' is not available`),!1)}getCurrentLocale(){return this.currentLocaleCode}getAvailableLocales(){return ti}getNestedValue(e,t){const i=t.split(".");let n=e;for(const o of i){if(n==null)return;n=n[o]}return n}getString(e){let t=this.getNestedValue(this.locale,e);return t===void 0&&this.currentLocaleCode!=="en"&&(t=this.getNestedValue(this.loadedLocales.en,e)),t!==void 0?typeof t=="string"?{compact:t,descriptive:t}:t:(console.warn(`Missing localization for key: ${e}`),{compact:"",descriptive:""})}}ce.getInstance();class lt{constructor(e){this.algorithm=e.algorithm,this.compression=e.compression,this.originalLength=e.originalLength,this.profile=e.profile,this.scheme=e.scheme}static deserialize(e){if(e&&e.algorithm)return new lt({algorithm:e.algorithm,compression:e.compression,originalLength:e.originalLength,profile:e.profile,scheme:e.scheme})}serialize(){const e={algorithm:this.algorithm};return this.compression!==void 0&&(e.compression=this.compression),this.originalLength!==void 0&&(e.originalLength=this.originalLength),this.profile!==void 0&&(e.profile=this.profile),this.scheme!==void 0&&(e.scheme=this.scheme),e}}class I{constructor(e){this.otherProperties=e}get page(){return this.otherProperties.page}static deserialize(e){if(e)return new I(e)}serialize(){return this.otherProperties}add(e){const t=Object.assign({},this.otherProperties);for(const i in e)t[i]=e[i];return new I(t)}}Object.defineProperty(I.prototype,"encryption",{get:function(){return lt.deserialize(this.otherProperties.encrypted)}});function _o(r){return r&&Array.isArray(r)?r:void 0}function oi(r){return r&&typeof r=="string"?[r]:_o(r)}function ri(r){return typeof r=="string"?new Date(r):void 0}function De(r){return isNaN(r)?void 0:r}function F(r){return De(r)!==void 0&&Math.sign(r)>=0?r:void 0}function wo(r){const e=new Array;return r.forEach(t=>e.push(t)),e}class g{constructor(e){let t,i,n=e.mediaType.replace(/\s/g,"").split(";");const o=n[0].split("/");if(o.length===2){if(t=o[0].toLowerCase().trim(),i=o[1].toLowerCase().trim(),t.length===0||i.length===0)throw new Error("Invalid media type")}else throw new Error("Invalid media type");const s={};for(let p=1;p<n.length;p++){const v=n[p].split("=");if(v.length===2){const c=v[0].toLocaleLowerCase(),f=c==="charset"?v[1].toUpperCase():v[1];s[c]=f}}const a={},l=Object.keys(s);l.sort((p,v)=>p.localeCompare(v)),l.forEach(p=>a[p]=s[p]);let h="";for(const p in a){const v=a[p];h+=`;${p}=${v}`}const d=`${t}/${i}${h}`,u=a.encoding;this.string=d,this.type=t,this.subtype=i,this.parameters=a,this.encoding=u,this.name=e.name,this.fileExtension=e.fileExtension}static parse(e){return new g(e)}get structuredSyntaxSuffix(){const e=this.subtype.split("+");return e.length>1?`+${e[e.length-1]}`:void 0}get charset(){return this.parameters.charset}contains(e){const t=typeof e=="string"?g.parse({mediaType:e}):e;if(!((this.type==="*"||this.type===t.type)&&(this.subtype==="*"||this.subtype===t.subtype)))return!1;const i=new Set(Object.entries(this.parameters).map(([o,s])=>`${o}=${s}`)),n=new Set(Object.entries(t.parameters).map(([o,s])=>`${o}=${s}`));for(const o of Array.from(i.values()))if(!n.has(o))return!1;return!0}matches(e){const t=typeof e=="string"?g.parse({mediaType:e}):e;return this.contains(t)||t.contains(this)}matchesAny(...e){for(const t of e)if(this.matches(t))return!0;return!1}equals(e){return this.string===e.string}get isZIP(){return this.matchesAny(g.ZIP,g.LCP_PROTECTED_AUDIOBOOK,g.LCP_PROTECTED_PDF)||this.structuredSyntaxSuffix==="+zip"}get isJSON(){return this.matchesAny(g.JSON)||this.structuredSyntaxSuffix==="+json"}get isOPDS(){return this.matchesAny(g.OPDS1,g.OPDS1_ENTRY,g.OPDS2,g.OPDS2_PUBLICATION,g.OPDS_AUTHENTICATION)||this.structuredSyntaxSuffix==="+json"}get isHTML(){return this.matchesAny(g.HTML,g.XHTML)}get isBitmap(){return this.matchesAny(g.BMP,g.GIF,g.JPEG,g.PNG,g.TIFF,g.WEBP)}get isAudio(){return this.type==="audio"}get isVideo(){return this.type==="video"}get isRWPM(){return this.matchesAny(g.READIUM_AUDIOBOOK_MANIFEST,g.DIVINA_MANIFEST,g.READIUM_WEBPUB_MANIFEST)}get isPublication(){return this.matchesAny(g.READIUM_AUDIOBOOK,g.READIUM_AUDIOBOOK_MANIFEST,g.CBZ,g.DIVINA,g.DIVINA_MANIFEST,g.EPUB,g.LCP_PROTECTED_AUDIOBOOK,g.LCP_PROTECTED_PDF,g.LPF,g.PDF,g.W3C_WPUB_MANIFEST,g.READIUM_WEBPUB,g.READIUM_WEBPUB_MANIFEST,g.ZAB)}static get AAC(){return g.parse({mediaType:"audio/aac",fileExtension:"aac"})}static get ACSM(){return g.parse({mediaType:"application/vnd.adobe.adept+xml",name:"Adobe Content Server Message",fileExtension:"acsm"})}static get AIFF(){return g.parse({mediaType:"audio/aiff",fileExtension:"aiff"})}static get AVI(){return g.parse({mediaType:"video/x-msvideo",fileExtension:"avi"})}static get BINARY(){return g.parse({mediaType:"application/octet-stream"})}static get BMP(){return g.parse({mediaType:"image/bmp",fileExtension:"bmp"})}static get CBZ(){return g.parse({mediaType:"application/vnd.comicbook+zip",name:"Comic Book Archive",fileExtension:"cbz"})}static get CSS(){return g.parse({mediaType:"text/css",fileExtension:"css"})}static get DIVINA(){return g.parse({mediaType:"application/divina+zip",name:"Digital Visual Narratives",fileExtension:"divina"})}static get DIVINA_MANIFEST(){return g.parse({mediaType:"application/divina+json",name:"Digital Visual Narratives",fileExtension:"json"})}static get EPUB(){return g.parse({mediaType:"application/epub+zip",name:"EPUB",fileExtension:"epub"})}static get GIF(){return g.parse({mediaType:"image/gif",fileExtension:"gif"})}static get GZ(){return g.parse({mediaType:"application/gzip",fileExtension:"gz"})}static get HTML(){return g.parse({mediaType:"text/html",fileExtension:"html"})}static get JAVASCRIPT(){return g.parse({mediaType:"text/javascript",fileExtension:"js"})}static get JPEG(){return g.parse({mediaType:"image/jpeg",fileExtension:"jpeg"})}static get JSON(){return g.parse({mediaType:"application/json"})}static get LCP_LICENSE_DOCUMENT(){return g.parse({mediaType:"application/vnd.readium.lcp.license.v1.0+json",name:"LCP License",fileExtension:"lcpl"})}static get LCP_PROTECTED_AUDIOBOOK(){return g.parse({mediaType:"application/audiobook+lcp",name:"LCP Protected Audiobook",fileExtension:"lcpa"})}static get LCP_PROTECTED_PDF(){return g.parse({mediaType:"application/pdf+lcp",name:"LCP Protected PDF",fileExtension:"lcpdf"})}static get LCP_STATUS_DOCUMENT(){return g.parse({mediaType:"application/vnd.readium.license.status.v1.0+json"})}static get LPF(){return g.parse({mediaType:"application/lpf+zip",fileExtension:"lpf"})}static get MP3(){return g.parse({mediaType:"audio/mpeg",fileExtension:"mp3"})}static get MPEG(){return g.parse({mediaType:"video/mpeg",fileExtension:"mpeg"})}static get NCX(){return g.parse({mediaType:"application/x-dtbncx+xml",fileExtension:"ncx"})}static get OGG(){return g.parse({mediaType:"audio/ogg",fileExtension:"oga"})}static get OGV(){return g.parse({mediaType:"video/ogg",fileExtension:"ogv"})}static get OPDS1(){return g.parse({mediaType:"application/atom+xml;profile=opds-catalog"})}static get OPDS1_ENTRY(){return g.parse({mediaType:"application/atom+xml;type=entry;profile=opds-catalog"})}static get OPDS2(){return g.parse({mediaType:"application/opds+json"})}static get OPDS2_PUBLICATION(){return g.parse({mediaType:"application/opds-publication+json"})}static get OPDS_AUTHENTICATION(){return g.parse({mediaType:"application/opds-authentication+json"})}static get OPUS(){return g.parse({mediaType:"audio/opus",fileExtension:"opus"})}static get OTF(){return g.parse({mediaType:"font/otf",fileExtension:"otf"})}static get PDF(){return g.parse({mediaType:"application/pdf",name:"PDF",fileExtension:"pdf"})}static get PNG(){return g.parse({mediaType:"image/png",fileExtension:"png"})}static get READIUM_AUDIOBOOK(){return g.parse({mediaType:"application/audiobook+zip",name:"Readium Audiobook",fileExtension:"audiobook"})}static get READIUM_AUDIOBOOK_MANIFEST(){return g.parse({mediaType:"application/audiobook+json",name:"Readium Audiobook",fileExtension:"json"})}static get READIUM_CONTENT_DOCUMENT(){return g.parse({mediaType:"application/vnd.readium.content+json",name:"Readium Content Document",fileExtension:"json"})}static get READIUM_GUIDED_NAVIGATION_DOCUMENT(){return g.parse({mediaType:"application/guided-navigation+json",name:"Readium Guided Navigation Document",fileExtension:"json"})}static get READIUM_POSITION_LIST(){return g.parse({mediaType:"application/vnd.readium.position-list+json",name:"Readium Position List",fileExtension:"json"})}static get READIUM_WEBPUB(){return g.parse({mediaType:"application/webpub+zip",name:"Readium Web Publication",fileExtension:"webpub"})}static get READIUM_WEBPUB_MANIFEST(){return g.parse({mediaType:"application/webpub+json",name:"Readium Web Publication",fileExtension:"json"})}static get SMIL(){return g.parse({mediaType:"application/smil+xml",fileExtension:"smil"})}static get SVG(){return g.parse({mediaType:"image/svg+xml",fileExtension:"svg"})}static get TEXT(){return g.parse({mediaType:"text/plain",fileExtension:"txt"})}static get TIFF(){return g.parse({mediaType:"image/tiff",fileExtension:"tiff"})}static get TTF(){return g.parse({mediaType:"font/ttf",fileExtension:"ttf"})}static get W3C_WPUB_MANIFEST(){return g.parse({mediaType:"application/x.readium.w3c.wpub+json",name:"Web Publication",fileExtension:"json"})}static get WAV(){return g.parse({mediaType:"audio/wav",fileExtension:"wav"})}static get WEBM_AUDIO(){return g.parse({mediaType:"audio/webm",fileExtension:"webm"})}static get WEBM_VIDEO(){return g.parse({mediaType:"video/webm",fileExtension:"webm"})}static get WEBP(){return g.parse({mediaType:"image/webp",fileExtension:"webp"})}static get WOFF(){return g.parse({mediaType:"font/woff",fileExtension:"woff"})}static get WOFF2(){return g.parse({mediaType:"font/woff2",fileExtension:"woff2"})}static get XHTML(){return g.parse({mediaType:"application/xhtml+xml",fileExtension:"xhtml"})}static get XML(){return g.parse({mediaType:"application/xml",fileExtension:"xml"})}static get ZAB(){return g.parse({mediaType:"application/x.readium.zab+zip",name:"Zipped Audio Book",fileExtension:"zab"})}static get ZIP(){return g.parse({mediaType:"application/zip",fileExtension:"zip"})}}class si{constructor(e){this.uri=e,this.parameters=this.getParameters(e)}getParameters(e){const t=/\{\??([^}]+)\}/g,i=e.match(t);return i?new Set(i.join(",").replace(t,"$1").split(",").map(n=>n.trim())):new Set}expand(e){const t=n=>n.split(",").map(o=>{const s=e[o];return s?encodeURIComponent(s):""}).join(","),i=n=>"?"+n.split(",").map(o=>{const s=o.split("=")[0],a=e[s];return a?`${s}=${encodeURIComponent(a)}`:""}).join("&");return this.uri.replace(/\{(\??)([^}]+)\}/g,(...n)=>n[1]?i(n[2]):t(n[2]))}}class C{constructor(e){this.fragments=e.fragments?e.fragments:new Array,this.progression=e.progression,this.totalProgression=e.totalProgression,this.position=e.position,this.otherLocations=e.otherLocations}static deserialize(e){if(!e)return;const t=De(e.progression),i=De(e.totalProgression),n=De(e.position),o=new Map,s=new Set(["fragment","fragments","progression","totalProgression","position"]);return Object.entries(e).forEach(([a,l])=>{s.has(a)||o.set(a,l)}),new C({fragments:oi(e.fragments||e.fragment),progression:t!==void 0&&t>=0&&t<=1?t:void 0,totalProgression:i!==void 0&&i>=0&&i<=1?i:void 0,position:n!==void 0&&n>0?n:void 0,otherLocations:o.size===0?void 0:o})}serialize(){const e={};return this.fragments&&(e.fragments=this.fragments),this.progression!==void 0&&(e.progression=this.progression),this.totalProgression!==void 0&&(e.totalProgression=this.totalProgression),this.position!==void 0&&(e.position=this.position),this.otherLocations&&this.otherLocations.forEach((t,i)=>e[i]=t),e}}class ee{constructor(e){this.after=e.after,this.before=e.before,this.highlight=e.highlight}static deserialize(e){if(e)return new ee({after:e.after,before:e.before,highlight:e.highlight})}serialize(){const e={};return this.after!==void 0&&(e.after=this.after),this.before!==void 0&&(e.before=this.before),this.highlight!==void 0&&(e.highlight=this.highlight),e}}class Y{constructor(e){this.href=e.href,this.type=e.type,this.title=e.title,this.locations=e.locations?e.locations:new C({}),this.text=e.text}static deserialize(e){if(e&&e.href&&e.type)return new Y({href:e.href,type:e.type,title:e.title,locations:C.deserialize(e.locations),text:ee.deserialize(e.text)})}serialize(){const e={href:this.href,type:this.type};return this.title!==void 0&&(e.title=this.title),this.locations&&(e.locations=this.locations.serialize()),this.text&&(e.text=this.text.serialize()),e}copyWithLocations(e){return new Y({href:this.href,type:this.type,title:this.title,text:this.text,locations:new C({...this.locations,...e})})}}class de{constructor(e){this.href=e.href,this.templated=e.templated,this.type=e.type,this.title=e.title,this.rels=e.rels,this.properties=e.properties,this.height=e.height,this.width=e.width,this.size=e.size,this.duration=e.duration,this.bitrate=e.bitrate,this.languages=e.languages,this.alternates=e.alternates,this.children=e.children}static deserialize(e){if(!(!e||typeof e.href!="string"))return new de({href:e.href,templated:e.templated,type:e.type,title:e.title,rels:e.rel?Array.isArray(e.rel)?new Set(e.rel):new Set([e.rel]):void 0,properties:I.deserialize(e.properties),height:F(e.height),width:F(e.width),size:F(e.size),duration:F(e.duration),bitrate:F(e.bitrate),languages:oi(e.language),alternates:We.deserialize(e.alternate),children:We.deserialize(e.children)})}serialize(){const e={href:this.href};return this.templated!==void 0&&(e.templated=this.templated),this.type!==void 0&&(e.type=this.type),this.title!==void 0&&(e.title=this.title),this.rels&&(e.rel=wo(this.rels)),this.properties&&(e.properties=this.properties.serialize()),this.height!==void 0&&(e.height=this.height),this.width!==void 0&&(e.width=this.width),this.size!==void 0&&(e.size=this.size),this.duration!==void 0&&(e.duration=this.duration),this.bitrate!==void 0&&(e.bitrate=this.bitrate),this.languages&&(e.language=this.languages),this.alternates&&(e.alternate=this.alternates.serialize()),this.children&&(e.children=this.children.serialize()),e}get mediaType(){return this.type!==void 0?g.parse({mediaType:this.type}):g.BINARY}toURL(e){const t=this.href.replace(/^(\/)/,"");if(t.length===0)return;let i=e||"/";return i.startsWith("/")&&(i="file://"+i),new URL(t,i).href.replace(/^(file:\/\/)/,"")}get templateParameters(){return this.templated?new si(this.href).parameters:new Set}expandTemplate(e){return new de({href:new si(this.href).expand(e),templated:!1})}addProperties(e){const t=de.deserialize(this.serialize());return t.properties=t.properties?t.properties?.add(e):new I(e),t}get locator(){let e=this.href.split("#");return new Y({href:e.length>0&&e[0]!==void 0?e[0]:this.href,type:this.type??"",title:this.title,locations:new C({fragments:e.length>1&&e[1]!==void 0?[e[1]]:[]})})}}class We{constructor(e){this.items=e}static deserialize(e){if(e&&Array.isArray(e))return new We(e.map(t=>de.deserialize(t)).filter(t=>t!==void 0))}serialize(){return this.items.map(e=>e.serialize())}findWithRel(e){const t=i=>i.rels&&i.rels.has(e);return this.items.find(t)}filterByRel(e){const t=i=>i.rels&&i.rels.has(e);return this.items.filter(t)}findWithHref(e){const t=i=>i.href===e;return this.items.find(t)}findIndexWithHref(e){const t=i=>i.href===e;return this.items.findIndex(t)}findWithMediaType(e){const t=i=>i.mediaType.matches(e);return this.items.find(t)}filterByMediaType(e){const t=i=>i.mediaType.matches(e);return this.items.filter(t)}filterByMediaTypes(e){const t=i=>{for(const n of e)if(i.mediaType.matches(n))return!0;return!1};return this.items.filter(t)}everyIsAudio(){const e=t=>t.mediaType.isAudio;return this.items.length>0&&this.items.every(e)}everyIsBitmap(){const e=t=>t.mediaType.isBitmap;return this.items.length>0&&this.items.every(e)}everyIsHTML(){const e=t=>t.mediaType.isHTML;return this.items.length>0&&this.items.every(e)}everyIsVideo(){const e=t=>t.mediaType.isVideo;return this.items.length>0&&this.items.every(e)}everyMatchesMediaType(e){return Array.isArray(e)?this.items.length>0&&this.items.every(t=>{for(const i of e)return t.mediaType.matches(i);return!1}):this.items.length>0&&this.items.every(t=>t.mediaType.matches(e))}filterLinksHasType(){return this.items.filter(e=>e.type)}}I.prototype.getContains=function(){return new Set(this.otherProperties.contains||[])};class je{constructor(e){this.cssSelector=e.cssSelector,this.textNodeIndex=e.textNodeIndex,this.charOffset=e.charOffset}static deserialize(e){if(!(e&&e.cssSelector))return;let t=F(e.textNodeIndex);if(t===void 0)return;let i=F(e.charOffset);return i===void 0&&(i=F(e.offset)),new je({cssSelector:e.cssSelector,textNodeIndex:t,charOffset:i})}serialize(){const e={cssSelector:this.cssSelector,textNodeIndex:this.textNodeIndex};return this.charOffset!==void 0&&(e.charOffset=this.charOffset),e}}class ct{constructor(e){this.start=e.start,this.end=e.end}static deserialize(e){if(!e)return;let t=je.deserialize(e.start);if(t)return new ct({start:t,end:je.deserialize(e.end)})}serialize(){const e={start:this.start.serialize()};return this.end&&(e.end=this.end.serialize()),e}}C.prototype.getCssSelector=function(){return this.otherLocations?.get("cssSelector")},C.prototype.getPartialCfi=function(){return this.otherLocations?.get("partialCfi")},C.prototype.getDomRange=function(){return ct.deserialize(this.otherLocations?.get("domRange"))},C.prototype.fragmentParameters=function(){return new Map(this.fragments.map(r=>r.startsWith("#")?r.slice(1):r).join("&").split("&").filter(r=>!r.startsWith("#")).map(r=>r.split("=")).filter(r=>r.length===2).map(r=>[r[0].trim().toLowerCase(),r[1].trim()]))},C.prototype.htmlId=function(){if(!this.fragments.length)return;let r=this.fragments.find(e=>e.length&&!e.includes("="));if(!r){const e=this.fragmentParameters();e.has("id")?r=e.get("id"):e.has("name")&&(r=e.get("name"))}return r?.startsWith("#")?r.slice(1):r},C.prototype.page=function(){const r=parseInt(this.fragmentParameters().get("page"));if(!isNaN(r)&&r>=0)return r},C.prototype.time=function(){const r=parseInt(this.fragmentParameters().get("t"));if(!isNaN(r))return r},C.prototype.space=function(){const r=this.fragmentParameters();if(!r.has("xywh"))return;const e=r.get("xywh").split(",").map(t=>parseInt(t));if(e.length===4&&!e.some(isNaN))return e};class dt{constructor(e){this.currency=e.currency,this.value=e.value}static deserialize(e){if(!e)return;let t=e.currency;if(!(t&&typeof t=="string"&&t.length>0))return;let i=F(e.value);if(i!==void 0)return new dt({currency:t,value:i})}serialize(){return{currency:this.currency,value:this.value}}}class ke{constructor(e){this.type=e.type,this.children=e.children}static deserialize(e){if(e&&e.type)return new ke({type:e.type,children:ke.deserializeArray(e.children)})}static deserializeArray(e){if(Array.isArray(e))return e.map(t=>ke.deserialize(t)).filter(t=>t!==void 0)}serialize(){const e={type:this.type};return this.children&&(e.children=this.children.map(t=>t.serialize())),e}}class ht{constructor(e){this.total=e.total,this.position=e.position}static deserialize(e){if(e)return new ht({total:F(e.total),position:F(e.position)})}serialize(){const e={};return this.total!==void 0&&(e.total=this.total),this.position!==void 0&&(e.position=this.position),e}}class ut{constructor(e){this.total=e.total,this.available=e.available}static deserialize(e){if(e)return new ut({total:F(e.total),available:F(e.available)})}serialize(){const e={};return this.total!==void 0&&(e.total=this.total),this.available!==void 0&&(e.available=this.available),e}}class pt{constructor(e){this.state=e.state,this.since=e.since,this.until=e.until}static deserialize(e){if(e&&e.state)return new pt({state:e.state,since:ri(e.since),until:ri(e.until)})}serialize(){const e={state:this.state};return this.since!==void 0&&(e.since=this.since.toISOString()),this.until!==void 0&&(e.until=this.until.toISOString()),e}}I.prototype.getNumberOfItems=function(){return F(this.otherProperties.numberOfItems)},I.prototype.getPrice=function(){return dt.deserialize(this.otherProperties.price)},I.prototype.getIndirectAcquisitions=function(){const r=this.otherProperties.indirectAcquisition;if(r&&Array.isArray(r))return r.map(e=>ke.deserialize(e)).filter(e=>e!==void 0)},I.prototype.getHolds=function(){return ht.deserialize(this.otherProperties.holds)},I.prototype.getCopies=function(){return ut.deserialize(this.otherProperties.copies)},I.prototype.getAvailability=function(){return pt.deserialize(this.otherProperties.availability)},I.prototype.getAuthenticate=function(){return de.deserialize(this.otherProperties.authenticate)};const ko="CssSelectorGenerator";function ai(r="unknown problem",...e){console.warn(`${ko}: ${r}`,...e)}function Po(r){return r instanceof RegExp}function xo(r){return r.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".+")}function Eo(r){const e=r.map(t=>{if(Po(t))return i=>t.test(i);if(typeof t=="function")return i=>{const n=t(i);return typeof n!="boolean"?(ai("pattern matcher function invalid","Provided pattern matching function does not return boolean. It's result will be ignored.",t),!1):n};if(typeof t=="string"){const i=new RegExp("^"+xo(t)+"$");return n=>i.test(n)}return ai("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1});return t=>e.some(i=>i(t))}Eo(["class","id","ng-*"]);class Pe{}function li(r){return r.split("").reverse().join("")}function Co(r,e,t){const i=li(e);return t.map(n=>{const o=Math.max(0,n.end-e.length-n.errors),s=li(r.slice(o,n.end));return{start:di(s,i,n.errors).reduce((a,l)=>n.end-l.end<a?n.end-l.end:a,n.end),end:n.end,errors:n.errors}})}function mt(r){return(r|-r)>>31&1}function ci(r,e,t,i){let n=r.P[t],o=r.M[t];const s=i>>>31,a=e[t]|s,l=a|o,h=(a&n)+n^n|a;let d=o|~(h|n),u=n&h;const p=mt(d&r.lastRowMask[t])-mt(u&r.lastRowMask[t]);return d<<=1,u<<=1,u|=s,d|=mt(i)-s,n=u|~(l|d),o=d&l,r.P[t]=n,r.M[t]=o,p}function di(r,e,t){if(e.length===0)return[];t=Math.min(t,e.length);const i=[],n=32,o=Math.ceil(e.length/n)-1,s={P:new Uint32Array(o+1),M:new Uint32Array(o+1),lastRowMask:new Uint32Array(o+1)};s.lastRowMask.fill(1<<31),s.lastRowMask[o]=1<<(e.length-1)%n;const a=new Uint32Array(o+1),l=new Map,h=[];for(let p=0;p<256;p++)h.push(a);for(let p=0;p<e.length;p+=1){const v=e.charCodeAt(p);if(l.has(v))continue;const c=new Uint32Array(o+1);l.set(v,c),v<h.length&&(h[v]=c);for(let f=0;f<=o;f+=1){c[f]=0;for(let _=0;_<n;_+=1){const w=f*n+_;w>=e.length||e.charCodeAt(w)===v&&(c[f]|=1<<_)}}}let d=Math.max(0,Math.ceil(t/n)-1);const u=new Uint32Array(o+1);for(let p=0;p<=d;p+=1)u[p]=(p+1)*n;u[o]=e.length;for(let p=0;p<=d;p+=1)s.P[p]=-1,s.M[p]=0;for(let p=0;p<r.length;p+=1){const v=r.charCodeAt(p);let c;v<h.length?c=h[v]:(c=l.get(v),typeof c>"u"&&(c=a));let f=0;for(let _=0;_<=d;_+=1)f=ci(s,c,_,f),u[_]+=f;if(u[d]-f<=t&&d<o&&(c[d+1]&1||f<0)){d+=1,s.P[d]=-1,s.M[d]=0;let _;if(d===o){const w=e.length%n;_=w===0?n:w}else _=n;u[d]=u[d-1]+_-f+ci(s,c,d,f)}else for(;d>0&&u[d]>=t+n;)d-=1;d===o&&u[d]<=t&&(u[d]<t&&i.splice(0,i.length),i.push({start:-1,end:p+1,errors:u[d]}),t=u[d])}return i}function Lo(r,e,t){const i=di(r,e,t);return Co(r,e,i)}function hi(r,e,t){let i=0;const n=[];for(;i!==-1;)i=r.indexOf(e,i),i!==-1&&(n.push({start:i,end:i+e.length,errors:0}),i+=1);return n.length>0?n:Lo(r,e,t)}function ui(r,e){return e.length===0||r.length===0?0:1-hi(r,e,e.length)[0].errors/e.length}function Ao(r,e,t={}){if(e.length===0)return null;const i=Math.min(256,e.length/2),n=hi(r,e,i);if(n.length===0)return null;const o=a=>{const l=1-a.errors/e.length,h=t.prefix?ui(r.slice(Math.max(0,a.start-t.prefix.length),a.start),t.prefix):1,d=t.suffix?ui(r.slice(a.end,a.end+t.suffix.length),t.suffix):1;let u=1;return typeof t.hint=="number"&&(u=1-Math.abs(a.start-t.hint)/r.length),(50*l+20*h+20*d+2*u)/92},s=n.map(a=>({start:a.start,end:a.end,score:o(a)}));return s.sort((a,l)=>l.score-a.score),s[0]}function gt(r,e,t){const i=t===1?e:e-1;if(r.charAt(i).trim()!=="")return e;let n,o;if(t===2?(n=r.substring(0,e),o=n.trimEnd()):(n=r.substring(e),o=n.trimStart()),!o.length)return-1;const s=n.length-o.length;return t===2?e-s:e+s}function pi(r,e){const t=r.commonAncestorContainer.ownerDocument.createNodeIterator(r.commonAncestorContainer,NodeFilter.SHOW_TEXT),i=e===1?r.startContainer:r.endContainer,n=e===1?r.endContainer:r.startContainer;let o=t.nextNode();for(;o&&o!==i;)o=t.nextNode();e===2&&(o=t.previousNode());let s=-1;const a=()=>{if(o=e===1?t.nextNode():t.previousNode(),o){const l=o.textContent,h=e===1?0:l.length;s=gt(l,h,e)}};for(;o&&s===-1&&o!==n;)a();if(o&&s>=0)return{node:o,offset:s};throw new RangeError("No text nodes with non-whitespace text found in range")}function Ro(r){if(!r.toString().trim().length)throw new RangeError("Range contains no non-whitespace text");if(r.startContainer.nodeType!==Node.TEXT_NODE)throw new RangeError("Range startContainer is not a text node");if(r.endContainer.nodeType!==Node.TEXT_NODE)throw new RangeError("Range endContainer is not a text node");const e=r.cloneRange();let t=!1,i=!1;const n={start:gt(r.startContainer.textContent,r.startOffset,1),end:gt(r.endContainer.textContent,r.endOffset,2)};if(n.start>=0&&(e.setStart(r.startContainer,n.start),t=!0),n.end>0&&(e.setEnd(r.endContainer,n.end),i=!0),t&&i)return e;if(!t){const{node:o,offset:s}=pi(e,1);o&&s>=0&&e.setStart(o,s)}if(!i){const{node:o,offset:s}=pi(e,2);o&&s>0&&e.setEnd(o,s)}return e}function mi(r){switch(r.nodeType){case Node.ELEMENT_NODE:case Node.TEXT_NODE:return r.textContent?.length??0;default:return 0}}function gi(r){let e=r.previousSibling,t=0;for(;e;)t+=mi(e),e=e.previousSibling;return t}function fi(r,...e){let t=e.shift();const i=r.ownerDocument.createNodeIterator(r,NodeFilter.SHOW_TEXT),n=[];let o=i.nextNode(),s,a=0;for(;t!==void 0&&o;)s=o,a+s.data.length>t?(n.push({node:s,offset:t-a}),t=e.shift()):(o=i.nextNode(),a+=s.data.length);for(;t!==void 0&&s&&a===t;)n.push({node:s,offset:s.data.length}),t=e.shift();if(t!==void 0)throw new RangeError("Offset exceeds text length");return n}class ${constructor(e,t){if(t<0)throw new Error("Offset is invalid");this.element=e,this.offset=t}relativeTo(e){if(!e.contains(this.element))throw new Error("Parent is not an ancestor of current element");let t=this.element,i=this.offset;for(;t!==e;)i+=gi(t),t=t.parentElement;return new $(t,i)}resolve(e={}){try{return fi(this.element,this.offset)[0]}catch(t){if(this.offset===0&&e.direction!==void 0){const i=document.createTreeWalker(this.element.getRootNode(),NodeFilter.SHOW_TEXT);i.currentNode=this.element;const n=e.direction===1,o=n?i.nextNode():i.previousNode();if(!o)throw t;return{node:o,offset:n?0:o.data.length}}else throw t}}static fromCharOffset(e,t){switch(e.nodeType){case Node.TEXT_NODE:return $.fromPoint(e,t);case Node.ELEMENT_NODE:return new $(e,t);default:throw new Error("Node is not an element or text node")}}static fromPoint(e,t){switch(e.nodeType){case Node.TEXT_NODE:{if(t<0||t>e.data.length)throw new Error("Text node offset is out of range");if(!e.parentElement)throw new Error("Text node has no parent");const i=gi(e)+t;return new $(e.parentElement,i)}case Node.ELEMENT_NODE:{if(t<0||t>e.childNodes.length)throw new Error("Child node offset is out of range");let i=0;for(let n=0;n<t;n++)i+=mi(e.childNodes[n]);return new $(e,i)}default:throw new Error("Point is not in an element or text node")}}}class Z{constructor(e,t){this.start=e,this.end=t}relativeTo(e){return new Z(this.start.relativeTo(e),this.end.relativeTo(e))}toRange(){let e,t;this.start.element===this.end.element&&this.start.offset<=this.end.offset?[e,t]=fi(this.start.element,this.start.offset,this.end.offset):(e=this.start.resolve({direction:1}),t=this.end.resolve({direction:2}));const i=new Range;return i.setStart(e.node,e.offset),i.setEnd(t.node,t.offset),i}static fromRange(e){const t=$.fromPoint(e.startContainer,e.startOffset),i=$.fromPoint(e.endContainer,e.endOffset);return new Z(t,i)}static fromOffsets(e,t,i){return new Z(new $(e,t),new $(e,i))}static trimmedRange(e){return Ro(Z.fromRange(e).toRange())}}class Be{constructor(e,t,i){this.root=e,this.start=t,this.end=i}static fromRange(e,t){const i=Z.fromRange(t).relativeTo(e);return new Be(e,i.start.offset,i.end.offset)}static fromSelector(e,t){return new Be(e,t.start,t.end)}toSelector(){return{type:"TextPositionSelector",start:this.start,end:this.end}}toRange(){return Z.fromOffsets(this.root,this.start,this.end).toRange()}}class He{constructor(e,t,i={}){this.root=e,this.exact=t,this.context=i}static fromRange(e,t){const i=e.textContent,n=Z.fromRange(t).relativeTo(e),o=n.start.offset,s=n.end.offset,a=32;return new He(e,i.slice(o,s),{prefix:i.slice(Math.max(0,o-a),o),suffix:i.slice(s,Math.min(i.length,s+a))})}static fromSelector(e,t){const{prefix:i,suffix:n}=t;return new He(e,t.exact,{prefix:i,suffix:n})}toSelector(){return{type:"TextQuoteSelector",exact:this.exact,prefix:this.context.prefix,suffix:this.context.suffix}}toRange(e={}){return this.toPositionAnchor(e).toRange()}toPositionAnchor(e={}){const t=this.root.textContent,i=Ao(t,this.exact,{...this.context,hint:e.hint});if(!i)throw new Error("Quote not found");return new Be(this.root,i.start,i.end)}}function To(r){const e=r.tagName.toUpperCase();return e==="IMG"||e==="VIDEO"||e==="AUDIO"||e==="IFRAME"||e==="OBJECT"||e==="EMBED"||e==="CANVAS"}function Ge(r,e){try{const t=e.locations,i=e.text;if(i&&i.highlight){let n;t&&t.getCssSelector()&&(n=r.querySelector(t.getCssSelector())),n||(n=r.body);const o=new He(n,i.highlight,{prefix:i.before,suffix:i.after});try{return o.toRange()}catch{return console.warn("Quote not found:",o),null}}if(t){let n=null;if(!n&&t.getCssSelector()&&(n=r.querySelector(t.getCssSelector())),!n&&t.fragments){for(const o of t.fragments)if(n=r.getElementById(o),n)break}if(n){const o=r.createRange();return n.childNodes.length===0||To(n)?(o.selectNode(n),o):(o.setStartBefore(n),o.setEndAfter(n),o)}}}catch(t){console.error(t)}return null}function zo(r,e){let t=r.getClientRects();t.length||r.commonAncestorContainer.nodeType===Node.ELEMENT_NODE&&(t=r.commonAncestorContainer.getClientRects());const i=1,n=[];for(const h of t)n.push({bottom:h.bottom,height:h.height,left:h.left,right:h.right,top:h.top,width:h.width});const o=bi(n,i),s=Mo(o,i),a=yi(s),l=4;for(let h=a.length-1;h>=0;h--){const d=a[h];if(!(d.width*d.height>l))if(a.length>1)a.splice(h,1);else break}return a}function bi(r,e,t){for(let i=0;i<r.length;i++)for(let n=i+1;n<r.length;n++){const o=r[i],s=r[n];if(o===s)continue;const a=W(o.top,s.top,e)&&W(o.bottom,s.bottom,e),l=W(o.left,s.left,e)&&W(o.right,s.right,e);if(a&&!l&&Si(o,s,e)){const h=r.filter(u=>u!==o&&u!==s),d=Oo(o,s);return h.push(d),bi(h,e)}}return r}function Oo(r,e){const t=Math.min(r.left,e.left),i=Math.max(r.right,e.right),n=Math.min(r.top,e.top),o=Math.max(r.bottom,e.bottom);return{bottom:o,height:o-n,left:t,right:i,top:n,width:i-t}}function Mo(r,e){const t=new Set(r);for(const i of r){if(!(i.width>1&&i.height>1)){t.delete(i);continue}for(const n of r)if(i!==n&&t.has(n)&&Io(n,i,e)){t.delete(i);break}}return Array.from(t)}function Io(r,e,t){return Ve(r,e.left,e.top,t)&&Ve(r,e.right,e.top,t)&&Ve(r,e.left,e.bottom,t)&&Ve(r,e.right,e.bottom,t)}function Ve(r,e,t,i){return(r.left<e||W(r.left,e,i))&&(r.right>e||W(r.right,e,i))&&(r.top<t||W(r.top,t,i))&&(r.bottom>t||W(r.bottom,t,i))}function yi(r){for(let e=0;e<r.length;e++)for(let t=e+1;t<r.length;t++){const i=r[e],n=r[t];if(i!==n&&Si(i,n,-1)){let o=[],s;const a=vi(i,n);if(a.length===1)o=a,s=i;else{const h=vi(n,i);a.length<h.length?(o=a,s=i):(o=h,s=n)}const l=r.filter(h=>h!==s);return Array.prototype.push.apply(l,o),yi(l)}}return r}function vi(r,e){const t=Fo(e,r);if(t.height===0||t.width===0)return[r];const i=[];{const n={bottom:r.bottom,height:0,left:r.left,right:t.left,top:r.top,width:0};n.width=n.right-n.left,n.height=n.bottom-n.top,n.height!==0&&n.width!==0&&i.push(n)}{const n={bottom:t.top,height:0,left:t.left,right:t.right,top:r.top,width:0};n.width=n.right-n.left,n.height=n.bottom-n.top,n.height!==0&&n.width!==0&&i.push(n)}{const n={bottom:r.bottom,height:0,left:t.left,right:t.right,top:t.bottom,width:0};n.width=n.right-n.left,n.height=n.bottom-n.top,n.height!==0&&n.width!==0&&i.push(n)}{const n={bottom:r.bottom,height:0,left:t.right,right:r.right,top:r.top,width:0};n.width=n.right-n.left,n.height=n.bottom-n.top,n.height!==0&&n.width!==0&&i.push(n)}return i}function Fo(r,e){const t=Math.max(r.left,e.left),i=Math.min(r.right,e.right),n=Math.max(r.top,e.top),o=Math.min(r.bottom,e.bottom);return{bottom:o,height:Math.max(0,o-n),left:t,right:i,top:n,width:Math.max(0,i-t)}}function Si(r,e,t){return(r.left<e.right||t>=0&&W(r.left,e.right,t))&&(e.left<r.right||t>=0&&W(e.left,r.right,t))&&(r.top<e.bottom||t>=0&&W(r.top,e.bottom,t))&&(e.top<r.bottom||t>=0&&W(e.top,r.bottom,t))}function W(r,e,t){return Math.abs(r-e)<=t}function ft(r){const e={},t=r.document.documentElement.style;for(const i in r.document.documentElement.style)Object.hasOwn(t,i)&&!Number.isNaN(Number.parseInt(i))&&(e[t[i]]=t.getPropertyValue(t[i]));return e}function _i(r,e){const t=ft(r);Object.keys(t).forEach(i=>{e.hasOwnProperty(i)||$e(r,i)}),Object.entries(e).forEach(([i,n])=>{t[i]!==n&&xe(r,i,n)})}function bt(r,e){return r.document.documentElement.style.getPropertyValue(e)}function xe(r,e,t){r.document.documentElement.style.setProperty(e,t)}function $e(r,e){r.document.documentElement.style.removeProperty(e)}let Xe=null,yt=null,Ee=0;const he={r:255,g:255,b:255,a:1},ue=new Map,No=()=>{if(!Xe)if(typeof OffscreenCanvas<"u")Xe=new OffscreenCanvas(5,5),yt=Xe.getContext("2d",{willReadFrequently:!0,desynchronized:!0});else{const r=document.createElement("canvas");r.width=5,r.height=5,Xe=r,yt=r.getContext("2d",{willReadFrequently:!0,desynchronized:!0})}return yt},Uo=r=>{if(!r)return!0;const e=r.trim().toLowerCase();return e.startsWith("var(")||["transparent","currentcolor","inherit","initial","revert","unset","revert-layer"].includes(e)?!0:["linear-gradient","radial-gradient","conic-gradient","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient"].some(t=>e.includes(t))},qe=(r,e)=>{console.warn(`[Decorator] Could not parse color: "${r}". ${e} Falling back to ${JSON.stringify(he)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`)},vt=(r,e=null)=>{const t=e?`${r}|${e}`:r,i=ue.get(t);if(i!==void 0)return i??he;if(Uo(r))return qe(r,"Unsupported color format or special value."),ue.set(t,null),he;const n=No();if(!n)return qe(r,"Could not get canvas context."),ue.set(t,null),he;try{Ee===0&&n.clearRect(0,0,5,5);const o=Ee%5,s=Math.floor(Ee/5);n.clearRect(o,s,1,1),e&&(n.fillStyle=e,n.fillRect(o,s,1,1)),n.fillStyle=r,n.fillRect(o,s,1,1);const a=n.getImageData(o,s,1,1);Ee=(Ee+1)%25;const[l,h,d,u]=a.data;if(u===0)return qe(r,"Fully transparent color."),ue.set(t,null),he;const p={r:l,g:h,b:d,a:u/255};return ue.set(t,p),p}catch(o){return qe(r,`Error: ${o instanceof Error?o.message:String(o)}`),ue.set(t,null),he}},St=r=>{const e=r/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)},wi=r=>{const e=St(r.r),t=St(r.g),i=St(r.b);return .2126*e+.7152*t+.0722*i},ki=(r,e)=>{const t=typeof r=="string"?vt(r):r,i=typeof e=="string"?vt(e):e,n=wi(t),o=wi(i),s=Math.max(n,o),a=Math.min(n,o);return(s+.05)/(a+.05)},_t=(r,e=null)=>{const t=vt(r,e),i=ki(t,{r:255,g:255,b:255,a:1}),n=ki(t,{r:0,g:0,b:0,a:1});return i>n},Do=(r,e=null)=>_t(r,e)?"white":"black",Pi="#FFFF00",Wo=()=>"Highlight"in window,xi=["IMG","IMAGE","AUDIO","VIDEO","SVG"];class jo{constructor(e,t,i,n){this.wnd=e,this.comms=t,this.id=i,this.name=n,this.items=[],this.lastItemId=0,this.container=void 0,this.activateable=!1,this.experimentalHighlights=!1,this.currentRender=0,Wo()&&(this.experimentalHighlights=!0,this.notTextFlag=new Map)}get activeable(){return this.activateable}set activeable(e){this.activateable=e}add(e){const t=`${this.id}-${this.lastItemId++}`,i=Ge(this.wnd.document,e.locator);if(!i){this.comms.log("Can't locate DOM range for decoration",e);return}const n=i.commonAncestorContainer;n.nodeType!==Node.TEXT_NODE&&this.experimentalHighlights&&(xi.includes(n.nodeName.toUpperCase())&&this.notTextFlag?.set(t,!0),i.cloneContents().querySelector(xi.join(", ").toLowerCase())&&this.notTextFlag?.set(t,!0),(n.textContent?.trim()||"").length===0&&this.notTextFlag?.set(t,!0));const o={decoration:e,id:t,range:i};this.items.push(o),this.layout(o),this.renderLayout([o])}remove(e){const t=this.items.findIndex(n=>n.decoration.id===e);if(t<0)return;const i=this.items[t];this.items.splice(t,1),i.clickableElements=void 0,i.container&&(i.container.remove(),i.container=void 0),this.experimentalHighlights&&!this.notTextFlag?.has(i.id)&&this.wnd.CSS.highlights.get(this.id)?.delete(i.range),this.notTextFlag?.delete(i.id)}update(e){this.remove(e.id),this.add(e)}clear(){this.clearContainer(),this.items.length=0,this.notTextFlag?.clear()}requestLayout(){this.wnd.cancelAnimationFrame(this.currentRender),this.clearContainer(),this.items.forEach(e=>this.layout(e)),this.renderLayout(this.items)}experimentalLayout(e){const[t,i]=this.requireContainer(!0);i.add(e.range);const n=bt(this.wnd,"--USER__backgroundColor")||this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"),o=e.decoration?.style?.tint??Pi;t.innerHTML=`
16
3
  ::highlight(${this.id}) {
17
- color: ${En(n,A)};
18
- background-color: ${n};
19
- }`}layout(t){if(this.experimentalHighlights&&!this.notTextFlag?.has(t.id))return this.experimentalLayout(t);const e=this.wnd.document.createElement("div");e.setAttribute("id",t.id),e.dataset.highlightId=t.decoration.id,e.style.setProperty("pointer-events","none");const i=this.wnd.innerWidth,A=parseInt(getComputedStyle(this.wnd.document.documentElement).getPropertyValue("column-count")),n=i/(A||1),o=this.wnd.document.scrollingElement,s=o.scrollLeft,a=o.scrollTop,h=(l,p,E)=>{if(l.style.position="absolute",t.decoration?.style?.width==="viewport"){l.style.width=`${i}px`,l.style.height=`${p.height}px`;let I=Math.floor(p.left/i)*i;l.style.left=`${I+s}px`,l.style.top=`${p.top+a}px`}else if(t.decoration?.style?.width==="bounds")l.style.width=`${E.width}px`,l.style.height=`${p.height}px`,l.style.left=`${E.left+s}px`,l.style.top=`${p.top+a}px`;else if(t.decoration?.style?.width==="page"){l.style.width=`${n}px`,l.style.height=`${p.height}px`;let I=Math.floor(p.left/n)*n;l.style.left=`${I+s}px`,l.style.top=`${p.top+a}px`}else l.style.width=`${p.width}px`,l.style.height=`${p.height}px`,l.style.left=`${p.left+s}px`,l.style.top=`${p.top+a}px`},c=t.range.getBoundingClientRect();let d=this.wnd.document.createElement("template");const g=this.getCurrentDarkMode();d.innerHTML=`
4
+ color: ${Do(o,n)};
5
+ background-color: ${o};
6
+ }`}layout(e){if(this.experimentalHighlights&&!this.notTextFlag?.has(e.id))return this.experimentalLayout(e);const t=this.wnd.document.createElement("div");t.setAttribute("id",e.id),t.dataset.highlightId=e.decoration.id,t.style.setProperty("pointer-events","none");const i=this.wnd.innerWidth,n=parseInt(getComputedStyle(this.wnd.document.documentElement).getPropertyValue("column-count")),o=i/(n||1),s=this.wnd.document.scrollingElement,a=s.scrollLeft,l=s.scrollTop,h=(c,f,_)=>{if(c.style.position="absolute",e.decoration?.style?.width==="viewport"){c.style.width=`${i}px`,c.style.height=`${f.height}px`;let w=Math.floor(f.left/i)*i;c.style.left=`${w+a}px`,c.style.top=`${f.top+l}px`}else if(e.decoration?.style?.width==="bounds")c.style.width=`${_.width}px`,c.style.height=`${f.height}px`,c.style.left=`${_.left+a}px`,c.style.top=`${f.top+l}px`;else if(e.decoration?.style?.width==="page"){c.style.width=`${o}px`,c.style.height=`${f.height}px`;let w=Math.floor(f.left/o)*o;c.style.left=`${w+a}px`,c.style.top=`${f.top+l}px`}else c.style.width=`${f.width}px`,c.style.height=`${f.height}px`,c.style.left=`${f.left+a}px`,c.style.top=`${f.top+l}px`},d=e.range.getBoundingClientRect();let u=this.wnd.document.createElement("template");const p=this.getCurrentDarkMode();u.innerHTML=`
20
7
  <div
21
8
  data-readium="true"
22
9
  class="readium-highlight"
23
- style="${[`background-color: ${t.decoration?.style?.tint??Ri} !important`,`mix-blend-mode: ${g?"exclusion":"multiply"} !important`,"opacity: 1 !important","box-sizing: border-box !important"].join("; ")}"
10
+ style="${[`background-color: ${e.decoration?.style?.tint??Pi} !important`,`mix-blend-mode: ${p?"exclusion":"multiply"} !important`,"opacity: 1 !important","box-sizing: border-box !important"].join("; ")}"
24
11
  >
25
12
  </div>
26
- `.trim();const M=d.content.firstElementChild;if(t.decoration?.style?.layout==="bounds"){const l=M.cloneNode(!0);l.style.setProperty("pointer-events","none"),h(l,c,c),e.append(l)}else{let l=un(t.range);l=l.sort((p,E)=>p.top<E.top?-1:p.top>E.top?1:0);for(let p of l){const E=M.cloneNode(!0);E.style.setProperty("pointer-events","none"),h(E,p,c),e.append(E)}}t.container=e,t.clickableElements=Array.from(e.querySelectorAll("[data-activable='1']")),t.clickableElements.length||(t.clickableElements=Array.from(e.children))}renderLayout(t){this.wnd.cancelAnimationFrame(this.currentRender),this.currentRender=this.wnd.requestAnimationFrame(()=>{t=t.filter(e=>!this.experimentalHighlights||!!this.notTextFlag?.has(e.id)),!(!t||t.length===0)&&this.requireContainer().append(...t.map(e=>e.container).filter(e=>!!e))})}requireContainer(t=!1){if(t){let e;this.wnd.document.getElementById(`${this.id}-style`)?e=this.wnd.document.getElementById(`${this.id}-style`):(e=this.wnd.document.createElement("style"),e.dataset.readium="true",e.id=`${this.id}-style`,this.wnd.document.head.appendChild(e));let i;return this.wnd.CSS.highlights.has(this.id)?i=this.wnd.CSS.highlights.get(this.id):(i=new this.wnd.Highlight,this.wnd.CSS.highlights.set(this.id,i)),[e,i]}return this.container||(this.container=this.wnd.document.createElement("div"),this.container.setAttribute("id",this.id),this.container.dataset.group=this.name,this.container.dataset.readium="true",this.container.style.setProperty("pointer-events","none"),this.container.style.display="contents",this.wnd.document.body.append(this.container)),this.container}getCurrentDarkMode(){return Ee(this.wnd,"--USER__appearance")==="readium-night-on"||Ue(Ee(this.wnd,"--USER__backgroundColor"))||Ue(this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"))}clearContainer(){this.experimentalHighlights&&this.wnd.CSS.highlights.delete(this.id),this.container&&(this.container.remove(),this.container=void 0)}}const Si=class We extends Ut{constructor(){super(...arguments),this.resizeFrame=0,this.lastGroupId=0,this.groups=new Map,this.handleResizer=this.handleResize.bind(this)}cleanup(){this.groups.forEach(t=>t.clear()),this.groups.clear()}updateHighlightStyles(){this.groups.forEach(t=>{t.requestLayout()})}extractCustomProperty(t,e){if(!t)return null;const i=t.match(new RegExp(`${e}:\\s*([^;]+)`));return i?i[1].trim():null}handleResize(){this.wnd.clearTimeout(this.resizeFrame),this.resizeFrame=this.wnd.setTimeout(()=>{this.groups.forEach(t=>{t.experimentalHighlights||t.requestLayout()})},50)}mount(t,e){return this.wnd=t,e.register("decorate",We.moduleName,(i,A)=>{const n=i;n.decoration&&n.decoration.locator&&(n.decoration.locator=K.deserialize(n.decoration.locator)),this.groups.has(n.group)||this.groups.set(n.group,new In(t,e,`readium-decoration-${this.lastGroupId++}`,n.group));const o=this.groups.get(n.group);switch(n.action){case"add":o?.add(n.decoration);break;case"remove":o?.remove(n.decoration.id);break;case"clear":o?.clear();break;case"update":o?.update(n.decoration);break}A(!0)}),this.resizeObserver=new ResizeObserver(()=>t.requestAnimationFrame(()=>this.handleResize())),this.resizeObserver.observe(t.document.body),t.addEventListener("orientationchange",this.handleResizer),t.addEventListener("resize",this.handleResizer),this.backgroundObserver=new MutationObserver(i=>{i.some(A=>{if(A.type==="attributes"&&A.attributeName==="style"){const n=A.target,o=A.oldValue,s=n.getAttribute("style"),a=this.extractCustomProperty(o,"--USER__appearance"),h=this.extractCustomProperty(s,"--USER__appearance"),c=this.extractCustomProperty(o,"--USER__backgroundColor"),d=this.extractCustomProperty(s,"--USER__backgroundColor");return a!==h||c!==d}return!1})&&this.updateHighlightStyles()}),this.backgroundObserver.observe(t.document.documentElement,{attributes:!0,attributeFilter:["style"],attributeOldValue:!0,subtree:!0}),e.log("Decorator Mounted"),!0}unmount(t,e){return t.removeEventListener("orientationchange",this.handleResizer),t.removeEventListener("resize",this.handleResizer),e.unregisterAll(We.moduleName),this.resizeObserver.disconnect(),this.backgroundObserver.disconnect(),this.cleanup(),e.log("Decorator Unmounted"),!0}};Si.moduleName="decorator";let Fn=Si;const zi="readium-snapper-style",Qi=class Oe extends Ut{constructor(){super(...arguments),this.protected=!1}buildStyles(){return`
13
+ `.trim();const v=u.content.firstElementChild;if(e.decoration?.style?.layout==="bounds"){const c=v.cloneNode(!0);c.style.setProperty("pointer-events","none"),h(c,d,d),t.append(c)}else{let c=zo(e.range);c=c.sort((f,_)=>f.top<_.top?-1:f.top>_.top?1:0);for(let f of c){const _=v.cloneNode(!0);_.style.setProperty("pointer-events","none"),h(_,f,d),t.append(_)}}e.container=t,e.clickableElements=Array.from(t.querySelectorAll("[data-activable='1']")),e.clickableElements.length||(e.clickableElements=Array.from(t.children))}renderLayout(e){this.wnd.cancelAnimationFrame(this.currentRender),this.currentRender=this.wnd.requestAnimationFrame(()=>{e=e.filter(t=>!this.experimentalHighlights||!!this.notTextFlag?.has(t.id)),!(!e||e.length===0)&&this.requireContainer().append(...e.map(t=>t.container).filter(t=>!!t))})}requireContainer(e=!1){if(e){let t;this.wnd.document.getElementById(`${this.id}-style`)?t=this.wnd.document.getElementById(`${this.id}-style`):(t=this.wnd.document.createElement("style"),t.dataset.readium="true",t.id=`${this.id}-style`,this.wnd.document.head.appendChild(t));let i;return this.wnd.CSS.highlights.has(this.id)?i=this.wnd.CSS.highlights.get(this.id):(i=new this.wnd.Highlight,this.wnd.CSS.highlights.set(this.id,i)),[t,i]}return this.container||(this.container=this.wnd.document.createElement("div"),this.container.setAttribute("id",this.id),this.container.dataset.group=this.name,this.container.dataset.readium="true",this.container.style.setProperty("pointer-events","none"),this.container.style.display="contents",this.wnd.document.body.append(this.container)),this.container}getCurrentDarkMode(){return bt(this.wnd,"--USER__appearance")==="readium-night-on"||_t(bt(this.wnd,"--USER__backgroundColor"))||_t(this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"))}clearContainer(){this.experimentalHighlights&&this.wnd.CSS.highlights.delete(this.id),this.container&&(this.container.remove(),this.container=void 0)}}const Ei=class Ut extends Pe{constructor(){super(...arguments),this.resizeFrame=0,this.lastGroupId=0,this.groups=new Map,this.handleResizer=this.handleResize.bind(this)}cleanup(){this.groups.forEach(e=>e.clear()),this.groups.clear()}updateHighlightStyles(){this.groups.forEach(e=>{e.requestLayout()})}extractCustomProperty(e,t){if(!e)return null;const i=e.match(new RegExp(`${t}:\\s*([^;]+)`));return i?i[1].trim():null}handleResize(){this.wnd.clearTimeout(this.resizeFrame),this.resizeFrame=this.wnd.setTimeout(()=>{this.groups.forEach(e=>{e.experimentalHighlights||e.requestLayout()})},50)}mount(e,t){return this.wnd=e,t.register("decorate",Ut.moduleName,(i,n)=>{const o=i;o.decoration&&o.decoration.locator&&(o.decoration.locator=Y.deserialize(o.decoration.locator)),this.groups.has(o.group)||this.groups.set(o.group,new jo(e,t,`readium-decoration-${this.lastGroupId++}`,o.group));const s=this.groups.get(o.group);switch(o.action){case"add":s?.add(o.decoration);break;case"remove":s?.remove(o.decoration.id);break;case"clear":s?.clear();break;case"update":s?.update(o.decoration);break}n(!0)}),this.resizeObserver=new ResizeObserver(()=>e.requestAnimationFrame(()=>this.handleResize())),this.resizeObserver.observe(e.document.body),e.addEventListener("orientationchange",this.handleResizer),e.addEventListener("resize",this.handleResizer),this.backgroundObserver=new MutationObserver(i=>{i.some(n=>{if(n.type==="attributes"&&n.attributeName==="style"){const o=n.target,s=n.oldValue,a=o.getAttribute("style"),l=this.extractCustomProperty(s,"--USER__appearance"),h=this.extractCustomProperty(a,"--USER__appearance"),d=this.extractCustomProperty(s,"--USER__backgroundColor"),u=this.extractCustomProperty(a,"--USER__backgroundColor");return l!==h||d!==u}return!1})&&this.updateHighlightStyles()}),this.backgroundObserver.observe(e.document.documentElement,{attributes:!0,attributeFilter:["style"],attributeOldValue:!0,subtree:!0}),t.log("Decorator Mounted"),!0}unmount(e,t){return e.removeEventListener("orientationchange",this.handleResizer),e.removeEventListener("resize",this.handleResizer),t.unregisterAll(Ut.moduleName),this.resizeObserver.disconnect(),this.backgroundObserver.disconnect(),this.cleanup(),t.log("Decorator Unmounted"),!0}};Ei.moduleName="decorator";let Bo=Ei;const Ci="readium-snapper-style",Li=class Dt extends Pe{constructor(){super(...arguments),this.protected=!1}buildStyles(){return`
27
14
  html, body {
28
15
  touch-action: manipulation;
29
16
  user-select: ${this.protected?"none":"auto"};
30
- }`}mount(t,e){const i=t.document.createElement("style");return i.dataset.readium="true",i.id=zi,i.textContent=this.buildStyles(),t.document.head.appendChild(i),e.register("protect",Oe.moduleName,(A,n)=>{this.protected=!0,i.textContent=this.buildStyles(),n(!0)}),e.register("unprotect",Oe.moduleName,(A,n)=>{this.protected=!1,i.textContent=this.buildStyles(),n(!0)}),e.log("Snapper Mounted"),!0}unmount(t,e){return t.document.getElementById(zi)?.remove(),e.log("Snapper Unmounted"),!0}};Qi.moduleName="snapper";let Re=Qi;function it(r){return r.document.body.dir.toLowerCase()==="rtl"}function Yi(r){return parseInt(r.getComputedStyle(r.document.documentElement).getPropertyValue("column-count"))}function Un(r){const t=getComputedStyle(r),e=parseFloat(t.paddingTop||"0"),i=parseFloat(t.paddingBottom||"0");return r.clientHeight-e-i}function Ni(r){const t=Yi(r);if(!t)return!1;const e=r.document.querySelectorAll("div[id^='readium-virtual-page']");for(const a of e)a.remove();const i=e.length,A=r.document.scrollingElement.scrollWidth,n=r.visualViewport.width,o=Math.round(A/n*t)%t,s=t===1||o===0?0:t-o;if(s>0)for(let a=0;a<s;a++){const h=r.document.createElement("div");h.setAttribute("id",`readium-virtual-page-${a}`),h.dataset.readium="true",CSS.supports("break-before","column")?h.style.breakBefore="column":(CSS.supports("break-inside","avoid-column")&&(h.style.breakInside="avoid-column"),h.style.height=Un(r.document.documentElement)+"px"),h.innerHTML="&#8203;",r.document.body.appendChild(h)}return i!==s}function xi(r){const t=r.document.createElement("style");t.appendChild(r.document.createTextNode("*{}")),r.document.body.appendChild(t),r.document.body.removeChild(t)}function Rn(r){return r<.5?2*r*r:-1+(4-2*r)*r}function S(r){const t=r.getSelection();t&&t.removeAllRanges()}const Cn=["a","audio","button","canvas","details","input","label","option","select","submit","textarea","video"];function Ti(r){return Cn.indexOf(r.nodeName.toLowerCase())!==-1||r.hasAttribute("contenteditable")&&r.getAttribute("contenteditable")?.toLowerCase()!=="false"?r:r.parentElement?Ti(r.parentElement):null}function Ce(r,t){const e=Pi(r,r.document.body,t),i=r._readium_cssSelectorGenerator.getCssSelector(e,{selectors:["tag","id","class","nthchild","nthoftype","attribute"]});return new K({href:"#",type:"application/xhtml+xml",locations:new C({otherLocations:new Map([["cssSelector",i]])}),text:new et({highlight:e.textContent||void 0})})}function Pi(r,t,e){for(var i=0;i<t.children.length;i++){const A=t.children[i];if(!Qn(A)&&Sn(r,A,e))return zn(r,A)?A:Pi(r,A,e)}return t}function Sn(r,t,e){if(t===document.body||t===document.documentElement)return!0;if(!document||!document.documentElement||!document.body)return!1;const i=t.getBoundingClientRect();return e?i.bottom>0&&i.top<r.innerHeight:i.right>0&&i.left<r.innerWidth}function zn(r,t){const e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=r.innerHeight&&e.right<=r.innerWidth}function Qn(r){const t=getComputedStyle(r);if(t){const e=t.getPropertyValue("display");if(e!="block"&&e!="list-item"||t.getPropertyValue("opacity")==="0")return!0}return!1}const bi="readium-column-snapper-style",Yn=200,ji=class v extends Re{constructor(){super(...arguments),this.shakeTimeout=0,this.snappingCancelled=!1,this.alreadyScrollLeft=0,this.overscroll=0,this.cachedScrollWidth=0,this.touchState=0,this.startingX=void 0,this.endingX=void 0,this.onTouchStarter=this.onTouchStart.bind(this),this.onTouchEnder=this.onTouchEnd.bind(this),this.onWidthChanger=this.onWidthChange.bind(this),this.onTouchMover=this.onTouchMove.bind(this)}doc(){return this.wnd.document.scrollingElement}scrollOffset(){return this.doc().scrollLeft>0?this.doc().scrollLeft:this.alreadyScrollLeft}snapOffset(t){const e=t+(it(this.wnd)?-1:1);return e-e%this.wnd.innerWidth}reportProgress(){const t=this.wnd.scrollX,e=this.cachedScrollWidth,i=Math.max(0,Math.min(1,t/e)),A=Math.max(0,Math.min(1,(t+this.wnd.innerWidth)/e));this.comms.send("progress",{start:i,end:A})}shake(){if(this.overscroll!==0||this.shakeTimeout!==0)return;const t=this.doc();t.classList.add(it(this.wnd)?"readium-bounce-l":"readium-bounce-r");const e=this.scrollOffset();this.shakeTimeout=this.wnd.setTimeout(()=>{t.classList.remove("readium-bounce-l"),t.classList.remove("readium-bounce-r"),this.shakeTimeout=0,this.doc().scrollLeft=e},150)}takeOverSnap(){this.snappingCancelled=!0,this.clearTouches();const t=this.doc();this.overscroll=t.style.transform?.length>12?parseFloat(t.style.transform.slice(12).split("px")[0]):0}snapCurrentOffset(t=!1,e=!1){const i=this.wnd.scrollX>0?this.wnd.scrollX:this.alreadyScrollLeft,A=this.doc(),n=this.dragOffset(),o=Yi(this.wnd),s=Math.min(Math.max(0,i),this.cachedScrollWidth),a=it(this.wnd)?-1:1,h=a*(this.wnd.innerWidth/3)*(a*n>0?2:1),c=this.snapOffset(s+h);if(t&&c!==this.scrollOffset()){this.snappingCancelled=!1;const d=(p,E,I,Q)=>I>Q?E:p+(E-p)*Rn(I/Q),g=Yn*o;let M;const l=p=>{if(this.snappingCancelled)return;M||(M=p);const E=p-M,I=d(this.overscroll,0,E,g),Q=d(i,c,E,g);A.scrollLeft=Q,this.overscroll!==0&&(A.style.transform=`translate3d(${-I}px, 0px, 0px)`),E<g?this.wnd.requestAnimationFrame(l):(this.clearTouches(),A.style.removeProperty("transform"),A.scrollLeft=c,e||this.reportProgress())};this.wnd.requestAnimationFrame(l)}else A.style.removeProperty("transform"),this.wnd.requestAnimationFrame(()=>{A.scrollLeft=c,this.clearTouches(),e||this.reportProgress()})}dragOffset(){return(this.startingX??0)-(this.endingX??0)}clearTouches(){this.startingX=void 0,this.endingX=void 0,this.overscroll=0}onTouchStart(t){switch(t.stopPropagation(),this.takeOverSnap(),t.touches.length){case 1:break;case 2:this.onTouchEnd(t);return;default:{this.onTouchEnd(t),this.comms.send("tap_more",t.touches.length);return}}this.startingX=t.touches[0].clientX,this.alreadyScrollLeft=this.doc().scrollLeft,this.touchState=1}onTouchEnd(t){if(this.touchState===2){const e=this.dragOffset(),i=this.scrollOffset();this.cachedScrollWidth<=this.wnd.innerWidth?(this.reportProgress(),e>5&&this.comms.send("no_more",void 0),e<-5&&this.comms.send("no_less",void 0)):i<5&&e<5?(this.alreadyScrollLeft=0,this.comms.send("no_less",void 0)):this.cachedScrollWidth-i-this.wnd.innerWidth<5&&e>5&&(this.alreadyScrollLeft=this.cachedScrollWidth,this.comms.send("no_more",void 0)),this.snapCurrentOffset(!0),this.comms.send("swipe",e)}this.touchState=0}onWidthChange(){this.cachedScrollWidth=this.doc().scrollWidth,this.comms.ready&&this.snapCurrentOffset()}onTouchMove(t){if(this.touchState===0)return;this.touchState===1&&(this.touchState=2,S(this.wnd)),this.endingX=t.touches[0].clientX;const e=this.dragOffset(),i=this.alreadyScrollLeft+e;i<0?(this.overscroll=i,this.doc().style.transform=`translate3d(${-this.overscroll}px, 0px, 0px)`):i+this.wnd.innerWidth>this.cachedScrollWidth?(this.overscroll=i,this.doc().style.transform=`translate3d(${-i}px, 0px, 0px)`):(this.overscroll=0,this.doc().style.removeProperty("transform"),this.doc().scrollLeft=this.alreadyScrollLeft+e)}mount(t,e){if(this.wnd=t,this.comms=e,!super.mount(t,e))return!1;t.navigator.epubReadingSystem&&(t.navigator.epubReadingSystem.layoutStyle="paginated");const i=t.document.createElement("style");i.dataset.readium="true",i.id=bi,i.textContent=`
17
+ }`}mount(e,t){const i=e.document.createElement("style");return i.dataset.readium="true",i.id=Ci,i.textContent=this.buildStyles(),e.document.head.appendChild(i),t.register("protect",Dt.moduleName,(n,o)=>{this.protected=!0,i.textContent=this.buildStyles(),o(!0)}),t.register("unprotect",Dt.moduleName,(n,o)=>{this.protected=!1,i.textContent=this.buildStyles(),o(!0)}),t.log("Snapper Mounted"),!0}unmount(e,t){return e.document.getElementById(Ci)?.remove(),t.log("Snapper Unmounted"),!0}};Li.moduleName="snapper";let wt=Li;function te(r){return r.document.body.dir.toLowerCase()==="rtl"}function Ai(r){return parseInt(r.getComputedStyle(r.document.documentElement).getPropertyValue("column-count"))}function Ho(r){const e=getComputedStyle(r),t=parseFloat(e.paddingTop||"0"),i=parseFloat(e.paddingBottom||"0");return r.clientHeight-t-i}function Ri(r){const e=Ai(r);if(!e)return!1;const t=r.document.querySelectorAll("div[id^='readium-virtual-page']");for(const l of t)l.remove();const i=t.length,n=r.document.scrollingElement.scrollWidth,o=r.visualViewport.width,s=Math.round(n/o*e)%e,a=e===1||s===0?0:e-s;if(a>0)for(let l=0;l<a;l++){const h=r.document.createElement("div");h.setAttribute("id",`readium-virtual-page-${l}`),h.dataset.readium="true",CSS.supports("break-before","column")?h.style.breakBefore="column":(CSS.supports("break-inside","avoid-column")&&(h.style.breakInside="avoid-column"),h.style.height=Ho(r.document.documentElement)+"px"),h.innerHTML="&#8203;",r.document.body.appendChild(h)}return i!==a}function Ti(r){const e=r.document.createElement("style");e.appendChild(r.document.createTextNode("*{}")),r.document.body.appendChild(e),r.document.body.removeChild(e)}function Go(r){return r<.5?2*r*r:-1+(4-2*r)*r}function L(r){const e=r.getSelection();e&&e.removeAllRanges()}const Vo=["a","audio","button","canvas","details","input","label","option","select","submit","textarea","video"];function zi(r){return Vo.indexOf(r.nodeName.toLowerCase())!==-1||r.hasAttribute("contenteditable")&&r.getAttribute("contenteditable")?.toLowerCase()!=="false"?r:r.parentElement?zi(r.parentElement):null}function kt(r,e){const t=Oi(r,r.document.body,e),i=r._readium_cssSelectorGenerator.getCssSelector(t,{selectors:["tag","id","class","nthchild","nthoftype","attribute"]});return new Y({href:"#",type:"application/xhtml+xml",locations:new C({otherLocations:new Map([["cssSelector",i]])}),text:new ee({highlight:t.textContent||void 0})})}function Oi(r,e,t){for(var i=0;i<e.children.length;i++){const n=e.children[i];if(!qo(n)&&$o(r,n,t))return Xo(r,n)?n:Oi(r,n,t)}return e}function $o(r,e,t){if(e===document.body||e===document.documentElement)return!0;if(!document||!document.documentElement||!document.body)return!1;const i=e.getBoundingClientRect();return t?i.bottom>0&&i.top<r.innerHeight:i.right>0&&i.left<r.innerWidth}function Xo(r,e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=r.innerHeight&&t.right<=r.innerWidth}function qo(r){const e=getComputedStyle(r);if(e){const t=e.getPropertyValue("display");if(t!="block"&&t!="list-item"||e.getPropertyValue("opacity")==="0")return!0}return!1}const Mi="readium-column-snapper-style",Yo=200,Ii=class D extends wt{constructor(){super(...arguments),this.shakeTimeout=0,this.snappingCancelled=!1,this.alreadyScrollLeft=0,this.overscroll=0,this.cachedScrollWidth=0,this.touchState=0,this.startingX=void 0,this.endingX=void 0,this.onTouchStarter=this.onTouchStart.bind(this),this.onTouchEnder=this.onTouchEnd.bind(this),this.onWidthChanger=this.onWidthChange.bind(this),this.onTouchMover=this.onTouchMove.bind(this)}doc(){return this.wnd.document.scrollingElement}scrollOffset(){return this.doc().scrollLeft>0?this.doc().scrollLeft:this.alreadyScrollLeft}snapOffset(e){const t=e+(te(this.wnd)?-1:1);return t-t%this.wnd.innerWidth}reportProgress(){const e=this.wnd.scrollX,t=this.cachedScrollWidth,i=Math.max(0,Math.min(1,e/t)),n=Math.max(0,Math.min(1,(e+this.wnd.innerWidth)/t));this.comms.send("progress",{start:i,end:n})}shake(){if(this.overscroll!==0||this.shakeTimeout!==0)return;const e=this.doc();e.classList.add(te(this.wnd)?"readium-bounce-l":"readium-bounce-r");const t=this.scrollOffset();this.shakeTimeout=this.wnd.setTimeout(()=>{e.classList.remove("readium-bounce-l"),e.classList.remove("readium-bounce-r"),this.shakeTimeout=0,this.doc().scrollLeft=t},150)}takeOverSnap(){this.snappingCancelled=!0,this.clearTouches();const e=this.doc();this.overscroll=e.style.transform?.length>12?parseFloat(e.style.transform.slice(12).split("px")[0]):0}snapCurrentOffset(e=!1,t=!1){const i=this.wnd.scrollX>0?this.wnd.scrollX:this.alreadyScrollLeft,n=this.doc(),o=this.dragOffset(),s=Ai(this.wnd),a=Math.min(Math.max(0,i),this.cachedScrollWidth),l=te(this.wnd)?-1:1,h=l*(this.wnd.innerWidth/3)*(l*o>0?2:1),d=this.snapOffset(a+h);if(e&&d!==this.scrollOffset()){this.snappingCancelled=!1;const u=(f,_,w,R)=>w>R?_:f+(_-f)*Go(w/R),p=Yo*s;let v;const c=f=>{if(this.snappingCancelled)return;v||(v=f);const _=f-v,w=u(this.overscroll,0,_,p),R=u(i,d,_,p);n.scrollLeft=R,this.overscroll!==0&&(n.style.transform=`translate3d(${-w}px, 0px, 0px)`),_<p?this.wnd.requestAnimationFrame(c):(this.clearTouches(),n.style.removeProperty("transform"),n.scrollLeft=d,t||this.reportProgress())};this.wnd.requestAnimationFrame(c)}else n.style.removeProperty("transform"),this.wnd.requestAnimationFrame(()=>{n.scrollLeft=d,this.clearTouches(),t||this.reportProgress()})}dragOffset(){return(this.startingX??0)-(this.endingX??0)}clearTouches(){this.startingX=void 0,this.endingX=void 0,this.overscroll=0}onTouchStart(e){switch(e.stopPropagation(),this.takeOverSnap(),e.touches.length){case 1:break;case 2:this.onTouchEnd(e);return;default:{this.onTouchEnd(e),this.comms.send("tap_more",e.touches.length);return}}this.startingX=e.touches[0].clientX,this.alreadyScrollLeft=this.doc().scrollLeft,this.touchState=1}onTouchEnd(e){if(this.touchState===2){const t=this.dragOffset(),i=this.scrollOffset();this.cachedScrollWidth<=this.wnd.innerWidth?(this.reportProgress(),t>5&&this.comms.send("no_more",void 0),t<-5&&this.comms.send("no_less",void 0)):i<5&&t<5?(this.alreadyScrollLeft=0,this.comms.send("no_less",void 0)):this.cachedScrollWidth-i-this.wnd.innerWidth<5&&t>5&&(this.alreadyScrollLeft=this.cachedScrollWidth,this.comms.send("no_more",void 0)),this.snapCurrentOffset(!0),this.comms.send("swipe",t)}this.touchState=0}onWidthChange(){this.cachedScrollWidth=this.doc().scrollWidth,this.comms.ready&&this.snapCurrentOffset()}onTouchMove(e){if(this.touchState===0)return;this.touchState===1&&(this.touchState=2,L(this.wnd)),this.endingX=e.touches[0].clientX;const t=this.dragOffset(),i=this.alreadyScrollLeft+t;i<0?(this.overscroll=i,this.doc().style.transform=`translate3d(${-this.overscroll}px, 0px, 0px)`):i+this.wnd.innerWidth>this.cachedScrollWidth?(this.overscroll=i,this.doc().style.transform=`translate3d(${-i}px, 0px, 0px)`):(this.overscroll=0,this.doc().style.removeProperty("transform"),this.doc().scrollLeft=this.alreadyScrollLeft+t)}mount(e,t){if(this.wnd=e,this.comms=t,!super.mount(e,t))return!1;e.navigator.epubReadingSystem&&(e.navigator.epubReadingSystem.layoutStyle="paginated");const i=e.document.createElement("style");i.dataset.readium="true",i.id=Mi,i.textContent=`
31
18
  @keyframes readium-bounce-l-animation {
32
19
  0%, 100% {transform: translate3d(0, 0, 0);}
33
20
  50% {transform: translate3d(-50px, 0, 0);}
@@ -61,7 +48,7 @@ if(window.onload) window.onload = new Proxy(window.onload, {
61
48
  body::-webkit-scrollbar {
62
49
  display: none; /* for Chrome, Safari, and Opera */
63
50
  }
64
- `,t.document.head.appendChild(i),this.resizeObserver=new ResizeObserver(()=>{t.requestAnimationFrame(()=>{t&&Ni(t)}),this.onWidthChange()}),this.resizeObserver.observe(t.document.body),this.mutationObserver=new MutationObserver(n=>{for(const o of n)if(o.target===this.wnd.document.documentElement){const s=o.oldValue,a=o.target.getAttribute("style"),h=/transform\s*:\s*([^;]+)/,c=s?.match(h),d=a?.match(h);(!c&&!d||c&&!d||c&&d&&c[1]!==d[1])&&(t.requestAnimationFrame(()=>{t&&Ni(t)}),this.onWidthChange())}else t.requestAnimationFrame(()=>this.cachedScrollWidth=this.doc().scrollWidth)}),t.frameElement&&this.mutationObserver.observe(t.frameElement,{attributes:!0,attributeFilter:["style"]}),this.mutationObserver.observe(t.document,{attributes:!0,attributeFilter:["style"]}),this.mutationObserver.observe(t.document.documentElement,{attributes:!0,attributeFilter:["style"]});const A=n=>{const o=this.doc().scrollLeft;return this.doc().scrollLeft=this.snapOffset(n),o!==this.doc().scrollLeft};return t.addEventListener("orientationchange",this.onWidthChanger),t.addEventListener("resize",this.onWidthChanger),t.requestAnimationFrame(()=>this.cachedScrollWidth=this.doc().scrollWidth),e.register("go_progression",v.moduleName,(n,o)=>{const s=n;if(s<0||s>1){e.send("error",{message:"go_progression must be given a position from 0.0 to 1.0"}),o(!1);return}this.wnd.requestAnimationFrame(()=>{this.cachedScrollWidth=this.doc().scrollWidth;const a=this.cachedScrollWidth,h=it(t)?-1:1,c=a*s*h;this.doc().scrollLeft=this.snapOffset(c),this.reportProgress(),S(this.wnd),o(!0)})}),e.register("go_id",v.moduleName,(n,o)=>{const s=t.document.getElementById(n);if(!s){o(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollLeft=this.snapOffset(s.getBoundingClientRect().left+t.scrollX),this.reportProgress(),S(this.wnd),o(!0)})}),e.register("go_text",v.moduleName,(n,o)=>{let s;Array.isArray(n)&&(n.length>1&&(s=n[1]),n=n[0]);const a=et.deserialize(n),h=Wt(this.wnd.document,new K({href:t.location.href,type:"text/html",text:a,locations:s?new C({otherLocations:new Map([["cssSelector",s]])}):void 0}));if(!h){o(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollLeft=this.snapOffset(h.getBoundingClientRect().left+t.scrollX),this.reportProgress(),S(this.wnd),o(!0)})}),e.register("go_end",v.moduleName,(n,o)=>{const s=it(t)?-1:1;this.wnd.requestAnimationFrame(()=>{this.cachedScrollWidth=this.doc().scrollWidth;const a=this.cachedScrollWidth*s;if(this.doc().scrollLeft===a)return o(!1);this.doc().scrollLeft=this.snapOffset(a),this.reportProgress(),S(this.wnd),o(!0)})}),e.register("go_start",v.moduleName,(n,o)=>{this.wnd.requestAnimationFrame(()=>{if(this.doc().scrollLeft===0)return o(!1);this.doc().scrollLeft=0,this.reportProgress(),S(this.wnd),o(!0)})}),e.register("go_prev",v.moduleName,(n,o)=>{this.wnd.requestAnimationFrame(()=>{this.cachedScrollWidth=this.doc().scrollWidth;const s=t.scrollX-t.innerWidth,a=it(t)?-(this.cachedScrollWidth-t.innerWidth):0,h=A(Math.max(s,a));h&&(this.reportProgress(),S(this.wnd)),o(h)})}),e.register("go_next",v.moduleName,(n,o)=>{this.wnd.requestAnimationFrame(()=>{this.cachedScrollWidth=this.doc().scrollWidth;const s=t.scrollX+t.innerWidth,a=it(t)?0:this.cachedScrollWidth-t.innerWidth,h=A(Math.min(s,a));h&&(this.reportProgress(),S(this.wnd)),o(h)})}),e.register("unfocus",v.moduleName,(n,o)=>{this.snappingCancelled=!0,S(this.wnd),o(!0)}),e.register("shake",v.moduleName,(n,o)=>{this.shake(),o(!0)}),e.register("focus",v.moduleName,(n,o)=>{this.wnd.requestAnimationFrame(()=>{this.cachedScrollWidth=this.doc().scrollWidth,this.snapCurrentOffset(!1,!0),this.reportProgress(),o(!0)})}),e.register("first_visible_locator",v.moduleName,(n,o)=>{const s=Ce(t,!1);this.comms.send("first_visible_locator",s.serialize()),o(!0)}),t.addEventListener("touchstart",this.onTouchStarter,{passive:!0}),t.addEventListener("touchend",this.onTouchEnder,{passive:!0}),t.addEventListener("touchmove",this.onTouchMover,{passive:!0}),t.document.addEventListener("touchstart",()=>{}),e.log("ColumnSnapper Mounted"),!0}unmount(t,e){return this.snappingCancelled=!0,e.unregisterAll(v.moduleName),this.resizeObserver.disconnect(),this.mutationObserver.disconnect(),t.removeEventListener("touchstart",this.onTouchStarter),t.removeEventListener("touchend",this.onTouchEnder),t.removeEventListener("touchmove",this.onTouchMover),t.removeEventListener("orientationchange",this.onWidthChanger),t.removeEventListener("resize",this.onWidthChanger),t.document.getElementById(bi)?.remove(),e.log("ColumnSnapper Unmounted"),super.unmount(t,e)}};ji.moduleName="column_snapper";let Nn=ji;const Vi="readium-scroll-snapper-style",vi=class G extends Re{constructor(){super(...arguments),this.initialScrollHandled=!1,this.isScrolling=!1,this.lastScrollTop=0,this.isResizing=!1,this.resizeDebounce=null,this.handleScroll=()=>{if(this.comms.ready&&!this.isResizing){if(!this.initialScrollHandled){this.lastScrollTop=this.doc().scrollTop,this.initialScrollHandled=!0,this.reportProgress();return}this.isScrolling||(this.isScrolling=!0,this.wnd.requestAnimationFrame(()=>{this.reportProgress();const t=this.doc().scrollTop,e=t-this.lastScrollTop;this.lastScrollTop=t,this.comms.send("scroll",e),this.isScrolling=!1}))}}}doc(){return this.wnd.document.scrollingElement}reportProgress(){if(!this.comms.ready)return;const t=Math.ceil(this.doc().scrollTop),e=this.doc().scrollHeight,i=this.wnd.innerHeight,A=Math.max(0,Math.min(1,t/e)),n=Math.max(0,Math.min(1,(t+i)/e));this.comms.send("progress",{start:A,end:n})}mount(t,e){this.wnd=t,this.comms=e,this.initialScrollHandled=!1,this.lastScrollTop=0,this.isResizing=!1,this.resizeDebounce&&(this.wnd.clearTimeout(this.resizeDebounce),this.resizeDebounce=null),t.navigator.epubReadingSystem&&(t.navigator.epubReadingSystem.layoutStyle="scrolling");const i=t.document.createElement("style");return i.dataset.readium="true",i.id=Vi,i.textContent=`
51
+ `,e.document.head.appendChild(i),this.resizeObserver=new ResizeObserver(()=>{e.requestAnimationFrame(()=>{e&&Ri(e)}),this.onWidthChange()}),this.resizeObserver.observe(e.document.body),this.mutationObserver=new MutationObserver(o=>{for(const s of o)if(s.target===this.wnd.document.documentElement){const a=s.oldValue,l=s.target.getAttribute("style"),h=/transform\s*:\s*([^;]+)/,d=a?.match(h),u=l?.match(h);(!d&&!u||d&&!u||d&&u&&d[1]!==u[1])&&(e.requestAnimationFrame(()=>{e&&Ri(e)}),this.onWidthChange())}else e.requestAnimationFrame(()=>this.cachedScrollWidth=this.doc().scrollWidth)}),e.frameElement&&this.mutationObserver.observe(e.frameElement,{attributes:!0,attributeFilter:["style"]}),this.mutationObserver.observe(e.document,{attributes:!0,attributeFilter:["style"]}),this.mutationObserver.observe(e.document.documentElement,{attributes:!0,attributeFilter:["style"]});const n=o=>{const s=this.doc().scrollLeft;return this.doc().scrollLeft=this.snapOffset(o),s!==this.doc().scrollLeft};return e.addEventListener("orientationchange",this.onWidthChanger),e.addEventListener("resize",this.onWidthChanger),e.requestAnimationFrame(()=>this.cachedScrollWidth=this.doc().scrollWidth),t.register("go_progression",D.moduleName,(o,s)=>{const a=o;if(a<0||a>1){t.send("error",{message:"go_progression must be given a position from 0.0 to 1.0"}),s(!1);return}this.wnd.requestAnimationFrame(()=>{this.cachedScrollWidth=this.doc().scrollWidth;const l=this.cachedScrollWidth,h=te(e)?-1:1,d=l*a*h;this.doc().scrollLeft=this.snapOffset(d),this.reportProgress(),L(this.wnd),s(!0)})}),t.register("go_id",D.moduleName,(o,s)=>{const a=e.document.getElementById(o);if(!a){s(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollLeft=this.snapOffset(a.getBoundingClientRect().left+e.scrollX),this.reportProgress(),L(this.wnd),s(!0)})}),t.register("go_text",D.moduleName,(o,s)=>{let a;Array.isArray(o)&&(o.length>1&&(a=o[1]),o=o[0]);const l=ee.deserialize(o),h=Ge(this.wnd.document,new Y({href:e.location.href,type:"text/html",text:l,locations:a?new C({otherLocations:new Map([["cssSelector",a]])}):void 0}));if(!h){s(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollLeft=this.snapOffset(h.getBoundingClientRect().left+e.scrollX),this.reportProgress(),L(this.wnd),s(!0)})}),t.register("go_end",D.moduleName,(o,s)=>{const a=te(e)?-1:1;this.wnd.requestAnimationFrame(()=>{this.cachedScrollWidth=this.doc().scrollWidth;const l=this.cachedScrollWidth*a;if(this.doc().scrollLeft===l)return s(!1);this.doc().scrollLeft=this.snapOffset(l),this.reportProgress(),L(this.wnd),s(!0)})}),t.register("go_start",D.moduleName,(o,s)=>{this.wnd.requestAnimationFrame(()=>{if(this.doc().scrollLeft===0)return s(!1);this.doc().scrollLeft=0,this.reportProgress(),L(this.wnd),s(!0)})}),t.register("go_prev",D.moduleName,(o,s)=>{this.wnd.requestAnimationFrame(()=>{this.cachedScrollWidth=this.doc().scrollWidth;const a=e.scrollX-e.innerWidth,l=te(e)?-(this.cachedScrollWidth-e.innerWidth):0,h=n(Math.max(a,l));h&&(this.reportProgress(),L(this.wnd)),s(h)})}),t.register("go_next",D.moduleName,(o,s)=>{this.wnd.requestAnimationFrame(()=>{this.cachedScrollWidth=this.doc().scrollWidth;const a=e.scrollX+e.innerWidth,l=te(e)?0:this.cachedScrollWidth-e.innerWidth,h=n(Math.min(a,l));h&&(this.reportProgress(),L(this.wnd)),s(h)})}),t.register("unfocus",D.moduleName,(o,s)=>{this.snappingCancelled=!0,L(this.wnd),s(!0)}),t.register("shake",D.moduleName,(o,s)=>{this.shake(),s(!0)}),t.register("focus",D.moduleName,(o,s)=>{this.wnd.requestAnimationFrame(()=>{this.cachedScrollWidth=this.doc().scrollWidth,this.snapCurrentOffset(!1,!0),this.reportProgress(),s(!0)})}),t.register("first_visible_locator",D.moduleName,(o,s)=>{const a=kt(e,!1);this.comms.send("first_visible_locator",a.serialize()),s(!0)}),e.addEventListener("touchstart",this.onTouchStarter,{passive:!0}),e.addEventListener("touchend",this.onTouchEnder,{passive:!0}),e.addEventListener("touchmove",this.onTouchMover,{passive:!0}),e.document.addEventListener("touchstart",()=>{}),t.log("ColumnSnapper Mounted"),!0}unmount(e,t){return this.snappingCancelled=!0,t.unregisterAll(D.moduleName),this.resizeObserver.disconnect(),this.mutationObserver.disconnect(),e.removeEventListener("touchstart",this.onTouchStarter),e.removeEventListener("touchend",this.onTouchEnder),e.removeEventListener("touchmove",this.onTouchMover),e.removeEventListener("orientationchange",this.onWidthChanger),e.removeEventListener("resize",this.onWidthChanger),e.document.getElementById(Mi)?.remove(),t.log("ColumnSnapper Unmounted"),super.unmount(e,t)}};Ii.moduleName="column_snapper";let Jo=Ii;const Fi="readium-scroll-snapper-style",Ni=class j extends wt{constructor(){super(...arguments),this.initialScrollHandled=!1,this.isScrolling=!1,this.lastScrollTop=0,this.isResizing=!1,this.resizeDebounce=null,this.handleScroll=()=>{if(this.comms.ready&&!this.isResizing){if(!this.initialScrollHandled){this.lastScrollTop=this.doc().scrollTop,this.initialScrollHandled=!0,this.reportProgress();return}this.isScrolling||(this.isScrolling=!0,this.wnd.requestAnimationFrame(()=>{this.reportProgress();const e=this.doc().scrollTop,t=e-this.lastScrollTop;this.lastScrollTop=e,this.comms.send("scroll",t),this.isScrolling=!1}))}}}doc(){return this.wnd.document.scrollingElement}reportProgress(){if(!this.comms.ready)return;const e=Math.ceil(this.doc().scrollTop),t=this.doc().scrollHeight,i=this.wnd.innerHeight,n=Math.max(0,Math.min(1,e/t)),o=Math.max(0,Math.min(1,(e+i)/t));this.comms.send("progress",{start:n,end:o})}mount(e,t){this.wnd=e,this.comms=t,this.initialScrollHandled=!1,this.lastScrollTop=0,this.isResizing=!1,this.resizeDebounce&&(this.wnd.clearTimeout(this.resizeDebounce),this.resizeDebounce=null),e.navigator.epubReadingSystem&&(e.navigator.epubReadingSystem.layoutStyle="scrolling");const i=e.document.createElement("style");return i.dataset.readium="true",i.id=Fi,i.textContent=`
65
52
  * {
66
53
  scrollbar-width: none; /* for Firefox */
67
54
  }
@@ -69,7 +56,7 @@ if(window.onload) window.onload = new Proxy(window.onload, {
69
56
  body::-webkit-scrollbar {
70
57
  display: none; /* for Chrome, Safari, and Opera */
71
58
  }
72
- `,t.document.head.appendChild(i),this.resizeObserver=new ResizeObserver(()=>{this.resizeDebounce&&this.wnd.clearTimeout(this.resizeDebounce),this.isResizing=!0,this.resizeDebounce=this.wnd.setTimeout(()=>{this.isResizing=!1,this.resizeDebounce=null,this.reportProgress()},50)}),this.resizeObserver.observe(t.document.body),t.addEventListener("scroll",this.handleScroll,{passive:!0}),e.register("force_webkit_recalc",G.moduleName,()=>{xi(this.wnd);const A=this.doc().scrollTop;A>1?this.doc().scrollTop=A-1:this.doc().scrollTop=A+1,this.doc().scrollTop=A}),e.register("go_progression",G.moduleName,(A,n)=>{const o=A;if(o<0||o>1){e.send("error",{message:"go_progression must be given a position from 0.0 to 1.0"}),n(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=this.doc().offsetHeight*o,this.reportProgress(),S(this.wnd),n(!0)})}),e.register("go_id",G.moduleName,(A,n)=>{const o=t.document.getElementById(A);if(!o){n(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=o.getBoundingClientRect().top+t.scrollY-t.innerHeight/2,this.reportProgress(),S(this.wnd),n(!0)})}),e.register("go_text",G.moduleName,(A,n)=>{let o;Array.isArray(A)&&(A.length>1&&(o=A[1]),A=A[0]);const s=et.deserialize(A),a=Wt(this.wnd.document,new K({href:t.location.href,type:"text/html",text:s,locations:o?new C({otherLocations:new Map([["cssSelector",o]])}):void 0}));if(!a){n(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=a.getBoundingClientRect().top+t.scrollY-t.innerHeight/2,this.reportProgress(),S(this.wnd),n(!0)})}),e.register("go_start",G.moduleName,(A,n)=>{if(this.doc().scrollTop===0)return n(!1);this.doc().scrollTop=0,this.reportProgress(),n(!0)}),e.register("go_end",G.moduleName,(A,n)=>{if(this.doc().scrollTop===this.doc().scrollHeight-this.doc().offsetHeight)return n(!1);this.doc().scrollTop=this.doc().scrollHeight-this.doc().offsetHeight,this.reportProgress(),n(!0)}),e.register("unfocus",G.moduleName,(A,n)=>{S(this.wnd),n(!0)}),e.register(["go_next","go_prev"],G.moduleName,(A,n)=>n(!1)),e.register("focus",G.moduleName,(A,n)=>{this.reportProgress(),n(!0)}),e.register("first_visible_locator",G.moduleName,(A,n)=>{const o=Ce(t,!0);this.comms.send("first_visible_locator",o.serialize()),n(!0)}),e.log("ScrollSnapper Mounted"),!0}unmount(t,e){return e.unregisterAll(G.moduleName),this.resizeObserver.disconnect(),this.handleScroll&&t.removeEventListener("scroll",this.handleScroll),t.document.getElementById(Vi)?.remove(),e.log("ScrollSnapper Unmounted"),!0}};vi.moduleName="scroll_snapper";let xn=vi;const Di=class k extends Re{constructor(){super(...arguments),this.initialScrollHandled=!1,this.isScrolling=!1,this.lastScrollTop=0,this.isResizing=!1,this.resizeDebounce=null,this.handleScroll=()=>{if(this.comms.ready&&!this.isResizing){if(!this.initialScrollHandled){this.lastScrollTop=this.doc().scrollTop,this.initialScrollHandled=!0,this.reportProgress();return}this.isScrolling||(this.isScrolling=!0,this.wnd.requestAnimationFrame(()=>{this.reportProgress();const t=this.doc().scrollTop,e=t-this.lastScrollTop;this.lastScrollTop=t,this.comms.send("scroll",e),this.isScrolling=!1}))}}}doc(){return this.wnd.document.scrollingElement}reportProgress(){if(!this.comms.ready)return;const t=Math.ceil(this.doc().scrollTop),e=this.doc().scrollHeight,i=this.wnd.innerHeight,A=Math.max(0,Math.min(1,t/e)),n=Math.max(0,Math.min(1,(t+i)/e));this.comms.send("progress",{start:A,end:n})}mount(t,e){return this.wnd=t,this.comms=e,this.initialScrollHandled=!1,this.lastScrollTop=0,this.isResizing=!1,this.resizeDebounce&&(this.wnd.clearTimeout(this.resizeDebounce),this.resizeDebounce=null),this.resizeObserver=new ResizeObserver(()=>{this.resizeDebounce&&this.wnd.clearTimeout(this.resizeDebounce),this.isResizing=!0,this.resizeDebounce=this.wnd.setTimeout(()=>{this.isResizing=!1,this.resizeDebounce=null,this.reportProgress()},50)}),this.resizeObserver.observe(t.document.body),t.addEventListener("scroll",this.handleScroll,{passive:!0}),e.register("force_webkit_recalc",k.moduleName,()=>{xi(this.wnd);const i=this.doc().scrollTop;i>1?this.doc().scrollTop=i-1:this.doc().scrollTop=i+1,this.doc().scrollTop=i}),e.register("go_progression",k.moduleName,(i,A)=>{const n=i;if(n<0||n>1){e.send("error",{message:"go_progression must be given a position from 0.0 to 1.0"}),A(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=this.doc().offsetHeight*n,this.reportProgress(),S(this.wnd),A(!0)})}),this.comms.register("go_id",k.moduleName,(i,A)=>{const n=t.document.getElementById(i);if(!n){A(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=n.getBoundingClientRect().top+t.scrollY-t.innerHeight/2,this.reportProgress(),S(this.wnd),A(!0)})}),e.register("go_text",k.moduleName,(i,A)=>{let n;Array.isArray(i)&&(i.length>1&&(n=i[1]),i=i[0]);const o=et.deserialize(i),s=Wt(this.wnd.document,new K({href:t.location.href,type:"text/html",text:o,locations:n?new C({otherLocations:new Map([["cssSelector",n]])}):void 0}));if(!s){A(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=s.getBoundingClientRect().top+t.scrollY-t.innerHeight/2,this.reportProgress(),S(this.wnd),A(!0)})}),e.register("go_start",k.moduleName,(i,A)=>{if(this.doc().scrollTop===0)return A(!1);this.doc().scrollTop=0,this.reportProgress(),A(!0)}),e.register("go_end",k.moduleName,(i,A)=>{if(this.doc().scrollTop===this.doc().scrollHeight-this.doc().offsetHeight)return A(!1);this.doc().scrollTop=this.doc().scrollHeight-this.doc().offsetHeight,this.reportProgress(),A(!0)}),e.register("unfocus",k.moduleName,(i,A)=>{S(this.wnd),A(!0)}),e.register(["go_next","go_prev"],k.moduleName,(i,A)=>A(!1)),e.register("focus",k.moduleName,(i,A)=>{this.reportProgress(),A(!0)}),e.register("first_visible_locator",k.moduleName,(i,A)=>{const n=Ce(t,!0);e.send("first_visible_locator",n.serialize()),A(!0)}),e.log("WebPubSnapper Mounted"),!0}unmount(t,e){return e.unregisterAll(k.moduleName),this.resizeObserver.disconnect(),this.handleScroll&&t.removeEventListener("scroll",this.handleScroll),e.log("WebPubSnapper Unmounted"),!0}};Di.moduleName="webpub_snapper";let Tn=Di;const Hi=class extends Ut{constructor(){super(...arguments),this.pointerMoved=!1,this.onPointerUp=this.onPointUp.bind(this),this.onPointerMove=this.onPointMove.bind(this),this.onPointerDown=this.onPointDown.bind(this),this.onContextMenu=this.onContext.bind(this),this.onClicker=this.onClick.bind(this)}onPointUp(t){const e=this.wnd.getSelection();if(e&&e.toString()?.length>0){const A=e.getRangeAt(0)?.getClientRects();if(!A||A.length===0)return;const n=A[0],o={text:e.toString(),x:n.x,y:n.y,width:n.width,height:n.height,targetFrameSrc:this.wnd?.location?.href};this.comms.send("text_selected",o)}if(this.pointerMoved){this.pointerMoved=!1;return}if(!e?.isCollapsed||!t.isPrimary)return;const i=this.wnd.devicePixelRatio;t.preventDefault(),this.comms.send(t.pointerType==="touch"?"tap":"click",{defaultPrevented:t.defaultPrevented,x:t.clientX*i,y:t.clientY*i,targetFrameSrc:this.wnd.location.href,targetElement:t.target.outerHTML,interactiveElement:Ti(t.target)?.outerHTML,cssSelector:this.wnd._readium_cssSelectorGenerator.getCssSelector(t.target)}),this.pointerMoved=!1}onPointMove(t){if(t.movementY!==void 0&&t.movementX!==void 0){(Math.abs(t.movementX)>1||Math.abs(t.movementY)>1)&&(this.pointerMoved=!0);return}this.pointerMoved=!0}onPointDown(){this.pointerMoved=!1}onContext(t){this.onPointUp(t),this.pointerMoved=!1}onClick(t){if(t.preventDefault(),!t.isTrusted){const e=new PointerEvent("pointerup",{isPrimary:!0,pointerType:"mouse",clientX:t.clientX,clientY:t.clientY});Object.defineProperty(e,"target",{writable:!1,value:t.target}),Object.defineProperty(e,"defaultPrevented",{writable:!1,value:t.defaultPrevented}),this.onPointUp(e)}}mount(t,e){return this.wnd=t,this.comms=e,t.document.addEventListener("pointerdown",this.onPointerDown),t.document.addEventListener("pointerup",this.onPointerUp),t.document.addEventListener("contextmenu",this.onContextMenu),t.document.addEventListener("pointermove",this.onPointerMove),t.document.addEventListener("click",this.onClicker),e.log("Peripherals Mounted"),!0}unmount(t,e){return t.document.removeEventListener("pointerdown",this.onPointerDown),t.document.removeEventListener("pointerup",this.onPointerUp),t.document.removeEventListener("contextmenu",this.onContextMenu),t.document.removeEventListener("pointermove",this.onPointerMove),t.document.removeEventListener("click",this.onClicker),e.log("Peripherals Unmounted"),!0}};Hi.moduleName="peripherals";let Pn=Hi;const Gi=class Le extends Ut{constructor(){super(...arguments),this.mediaPlayingCount=0,this.allAnimations=new Set}wndOnErr(t){this.comms?.send("error",{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno})}unblock(t){for(t._readium_blockEvents=!1;t._readium_blockedEvents?.length>0;){const e=t._readium_blockedEvents.shift();switch(e[0]){case 0:Reflect.apply(e[1],e[2],e[3]);break;case 1:const i=e[1],A=e[2];t.removeEventListener(i.type,t._readium_eventBlocker,!0);const n=new Event(i.type,{bubbles:i.bubbles,cancelable:i.cancelable});A?A.dispatchEvent(n):t.dispatchEvent(n);break}}}onMediaPlayEvent(){this.mediaPlayingCount++,this.comms?.send("media_play",this.mediaPlayingCount)}onMediaPauseEvent(){this.mediaPlayingCount>0&&this.mediaPlayingCount--,this.comms?.send("media_pause",this.mediaPlayingCount)}pauseAllMedia(t){const e=t.document.querySelectorAll("audio,video");for(let i=0;i<e.length;i++)e[i].pause()}mount(t,e){this.comms=e,t.addEventListener("error",this.wndOnErr,!1),Reflect.defineProperty(t.navigator,"epubReadingSystem",{value:{name:"readium-ts-toolkit",version:"2.2.3",hasFeature:(A,n="")=>{switch(A){case"dom-manipulation":return!0;case"layout-changes":return!0;case"touch-events":return!0;case"mouse-events":return!0;case"keyboard-events":return!0;case"spine-scripting":return!0;case"embedded-web-content":return!0;default:return!1}}},writable:!1}),"getAnimations"in t.document&&t.document.getAnimations().forEach(A=>{A.cancel(),this.allAnimations.add(A)}),e.register("activate",Le.moduleName,(A,n)=>{this.allAnimations.forEach(o=>{o.cancel(),o.play()}),n(!0)}),e.register("unfocus",Le.moduleName,(A,n)=>{this.pauseAllMedia(t),this.allAnimations.forEach(o=>o.pause()),n(!0)});const i=t.document.querySelectorAll("audio,video");for(let A=0;A<i.length;A++){const n=i[A];n.addEventListener("play",this.onMediaPlayEvent,{passive:!0}),n.addEventListener("pause",this.onMediaPauseEvent,{passive:!0})}return e.log("Setup Mounted"),!0}unmount(t,e){return t.removeEventListener("error",this.wndOnErr),t.removeEventListener("play",this.onMediaPlayEvent),t.removeEventListener("pause",this.onMediaPauseEvent),this.allAnimations.forEach(i=>i.cancel()),this.allAnimations.clear(),e.log("Setup Unmounted"),!0}};Gi.moduleName="setup";let ki=Gi;const Ji="readium-viewport",Wi=class ot extends ki{onViewportWidthChanged(t){const e=t.target;Rt(e,"--RS__viewportWidth",`${e.innerWidth}px`)}mount(t,e){if(!super.mount(t,e))return!1;const i=t.document.createElement("meta");return i.dataset.readium="true",i.setAttribute("name","viewport"),i.setAttribute("id",Ji),i.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"),t.document.head.appendChild(i),t.addEventListener("orientationchange",this.onViewportWidthChanged),t.addEventListener("resize",this.onViewportWidthChanged),this.onViewportWidthChanged({target:t}),e.register("get_properties",ot.moduleName,(A,n)=>{we(t),n(!0)}),e.register("update_properties",ot.moduleName,(A,n)=>{A["--RS__viewportWidth"]=`${t.innerWidth}px`,Ii(t,A),n(!0)}),e.register("set_property",ot.moduleName,(A,n)=>{const o=A;Rt(t,o[0],o[1]),n(!0)}),e.register("remove_property",ot.moduleName,(A,n)=>{Lt(t,A),n(!0)}),e.register("activate",ot.moduleName,(A,n)=>{this.unblock(t),n(!0)}),e.log("ReflowableSetup Mounted"),!0}unmount(t,e){return e.unregisterAll(ot.moduleName),t.document.head.querySelector(`#${Ji}`)?.remove(),t.removeEventListener("orientationchange",this.onViewportWidthChanged),e.log("ReflowableSetup Unmounted"),super.unmount(t,e)}};Wi.moduleName="reflowable_setup";let bn=Wi;const Oi="readium-fixed-style",Li=class tt extends ki{mount(t,e){if(!super.mount(t,e))return!1;t.navigator.epubReadingSystem&&(t.navigator.epubReadingSystem.layoutStyle="paginated");const i=t.document.createElement("style");return i.id=Oi,i.dataset.readium="true",i.textContent=`
59
+ `,e.document.head.appendChild(i),this.resizeObserver=new ResizeObserver(()=>{this.resizeDebounce&&this.wnd.clearTimeout(this.resizeDebounce),this.isResizing=!0,this.resizeDebounce=this.wnd.setTimeout(()=>{this.isResizing=!1,this.resizeDebounce=null,this.reportProgress()},50)}),this.resizeObserver.observe(e.document.body),e.addEventListener("scroll",this.handleScroll,{passive:!0}),t.register("force_webkit_recalc",j.moduleName,()=>{Ti(this.wnd);const n=this.doc().scrollTop;n>1?this.doc().scrollTop=n-1:this.doc().scrollTop=n+1,this.doc().scrollTop=n}),t.register("go_progression",j.moduleName,(n,o)=>{const s=n;if(s<0||s>1){t.send("error",{message:"go_progression must be given a position from 0.0 to 1.0"}),o(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=this.doc().offsetHeight*s,this.reportProgress(),L(this.wnd),o(!0)})}),t.register("go_id",j.moduleName,(n,o)=>{const s=e.document.getElementById(n);if(!s){o(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=s.getBoundingClientRect().top+e.scrollY-e.innerHeight/2,this.reportProgress(),L(this.wnd),o(!0)})}),t.register("go_text",j.moduleName,(n,o)=>{let s;Array.isArray(n)&&(n.length>1&&(s=n[1]),n=n[0]);const a=ee.deserialize(n),l=Ge(this.wnd.document,new Y({href:e.location.href,type:"text/html",text:a,locations:s?new C({otherLocations:new Map([["cssSelector",s]])}):void 0}));if(!l){o(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=l.getBoundingClientRect().top+e.scrollY-e.innerHeight/2,this.reportProgress(),L(this.wnd),o(!0)})}),t.register("go_start",j.moduleName,(n,o)=>{if(this.doc().scrollTop===0)return o(!1);this.doc().scrollTop=0,this.reportProgress(),o(!0)}),t.register("go_end",j.moduleName,(n,o)=>{if(this.doc().scrollTop===this.doc().scrollHeight-this.doc().offsetHeight)return o(!1);this.doc().scrollTop=this.doc().scrollHeight-this.doc().offsetHeight,this.reportProgress(),o(!0)}),t.register("unfocus",j.moduleName,(n,o)=>{L(this.wnd),o(!0)}),t.register(["go_next","go_prev"],j.moduleName,(n,o)=>o(!1)),t.register("focus",j.moduleName,(n,o)=>{this.reportProgress(),o(!0)}),t.register("first_visible_locator",j.moduleName,(n,o)=>{const s=kt(e,!0);this.comms.send("first_visible_locator",s.serialize()),o(!0)}),t.log("ScrollSnapper Mounted"),!0}unmount(e,t){return t.unregisterAll(j.moduleName),this.resizeObserver.disconnect(),this.handleScroll&&e.removeEventListener("scroll",this.handleScroll),e.document.getElementById(Fi)?.remove(),t.log("ScrollSnapper Unmounted"),!0}};Ni.moduleName="scroll_snapper";let Ko=Ni;const Ui=class B extends wt{constructor(){super(...arguments),this.initialScrollHandled=!1,this.isScrolling=!1,this.lastScrollTop=0,this.isResizing=!1,this.resizeDebounce=null,this.handleScroll=()=>{if(this.comms.ready&&!this.isResizing){if(!this.initialScrollHandled){this.lastScrollTop=this.doc().scrollTop,this.initialScrollHandled=!0,this.reportProgress();return}this.isScrolling||(this.isScrolling=!0,this.wnd.requestAnimationFrame(()=>{this.reportProgress();const e=this.doc().scrollTop,t=e-this.lastScrollTop;this.lastScrollTop=e,this.comms.send("scroll",t),this.isScrolling=!1}))}}}doc(){return this.wnd.document.scrollingElement}reportProgress(){if(!this.comms.ready)return;const e=Math.ceil(this.doc().scrollTop),t=this.doc().scrollHeight,i=this.wnd.innerHeight,n=Math.max(0,Math.min(1,e/t)),o=Math.max(0,Math.min(1,(e+i)/t));this.comms.send("progress",{start:n,end:o})}mount(e,t){return this.wnd=e,this.comms=t,this.initialScrollHandled=!1,this.lastScrollTop=0,this.isResizing=!1,this.resizeDebounce&&(this.wnd.clearTimeout(this.resizeDebounce),this.resizeDebounce=null),this.resizeObserver=new ResizeObserver(()=>{this.resizeDebounce&&this.wnd.clearTimeout(this.resizeDebounce),this.isResizing=!0,this.resizeDebounce=this.wnd.setTimeout(()=>{this.isResizing=!1,this.resizeDebounce=null,this.reportProgress()},50)}),this.resizeObserver.observe(e.document.body),e.addEventListener("scroll",this.handleScroll,{passive:!0}),t.register("force_webkit_recalc",B.moduleName,()=>{Ti(this.wnd);const i=this.doc().scrollTop;i>1?this.doc().scrollTop=i-1:this.doc().scrollTop=i+1,this.doc().scrollTop=i}),t.register("go_progression",B.moduleName,(i,n)=>{const o=i;if(o<0||o>1){t.send("error",{message:"go_progression must be given a position from 0.0 to 1.0"}),n(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=this.doc().offsetHeight*o,this.reportProgress(),L(this.wnd),n(!0)})}),this.comms.register("go_id",B.moduleName,(i,n)=>{const o=e.document.getElementById(i);if(!o){n(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=o.getBoundingClientRect().top+e.scrollY-e.innerHeight/2,this.reportProgress(),L(this.wnd),n(!0)})}),t.register("go_text",B.moduleName,(i,n)=>{let o;Array.isArray(i)&&(i.length>1&&(o=i[1]),i=i[0]);const s=ee.deserialize(i),a=Ge(this.wnd.document,new Y({href:e.location.href,type:"text/html",text:s,locations:o?new C({otherLocations:new Map([["cssSelector",o]])}):void 0}));if(!a){n(!1);return}this.wnd.requestAnimationFrame(()=>{this.doc().scrollTop=a.getBoundingClientRect().top+e.scrollY-e.innerHeight/2,this.reportProgress(),L(this.wnd),n(!0)})}),t.register("go_start",B.moduleName,(i,n)=>{if(this.doc().scrollTop===0)return n(!1);this.doc().scrollTop=0,this.reportProgress(),n(!0)}),t.register("go_end",B.moduleName,(i,n)=>{if(this.doc().scrollTop===this.doc().scrollHeight-this.doc().offsetHeight)return n(!1);this.doc().scrollTop=this.doc().scrollHeight-this.doc().offsetHeight,this.reportProgress(),n(!0)}),t.register("unfocus",B.moduleName,(i,n)=>{L(this.wnd),n(!0)}),t.register(["go_next","go_prev"],B.moduleName,(i,n)=>n(!1)),t.register("focus",B.moduleName,(i,n)=>{this.reportProgress(),n(!0)}),t.register("first_visible_locator",B.moduleName,(i,n)=>{const o=kt(e,!0);t.send("first_visible_locator",o.serialize()),n(!0)}),t.log("WebPubSnapper Mounted"),!0}unmount(e,t){return t.unregisterAll(B.moduleName),this.resizeObserver.disconnect(),this.handleScroll&&e.removeEventListener("scroll",this.handleScroll),t.log("WebPubSnapper Unmounted"),!0}};Ui.moduleName="webpub_snapper";let Zo=Ui;const Di=class extends Pe{constructor(){super(...arguments),this.pointerMoved=!1,this.onPointerUp=this.onPointUp.bind(this),this.onPointerMove=this.onPointMove.bind(this),this.onPointerDown=this.onPointDown.bind(this),this.onContextMenu=this.onContext.bind(this),this.onClicker=this.onClick.bind(this)}onPointUp(e){const t=this.wnd.getSelection();if(t&&t.toString()?.length>0){const n=t.getRangeAt(0)?.getClientRects();if(!n||n.length===0)return;const o=n[0],s={text:t.toString(),x:o.x,y:o.y,width:o.width,height:o.height,targetFrameSrc:this.wnd?.location?.href};this.comms.send("text_selected",s)}if(this.pointerMoved){this.pointerMoved=!1;return}if(!t?.isCollapsed||!e.isPrimary)return;const i=this.wnd.devicePixelRatio;e.preventDefault(),this.comms.send(e.pointerType==="touch"?"tap":"click",{defaultPrevented:e.defaultPrevented,x:e.clientX*i,y:e.clientY*i,targetFrameSrc:this.wnd.location.href,targetElement:e.target.outerHTML,interactiveElement:zi(e.target)?.outerHTML,cssSelector:this.wnd._readium_cssSelectorGenerator.getCssSelector(e.target)}),this.pointerMoved=!1}onPointMove(e){if(e.movementY!==void 0&&e.movementX!==void 0){(Math.abs(e.movementX)>1||Math.abs(e.movementY)>1)&&(this.pointerMoved=!0);return}this.pointerMoved=!0}onPointDown(){this.pointerMoved=!1}onContext(e){this.onPointUp(e),this.pointerMoved=!1}onClick(e){if(e.preventDefault(),!e.isTrusted){const t=new PointerEvent("pointerup",{isPrimary:!0,pointerType:"mouse",clientX:e.clientX,clientY:e.clientY});Object.defineProperty(t,"target",{writable:!1,value:e.target}),Object.defineProperty(t,"defaultPrevented",{writable:!1,value:e.defaultPrevented}),this.onPointUp(t)}}mount(e,t){return this.wnd=e,this.comms=t,e.document.addEventListener("pointerdown",this.onPointerDown),e.document.addEventListener("pointerup",this.onPointerUp),e.document.addEventListener("contextmenu",this.onContextMenu),e.document.addEventListener("pointermove",this.onPointerMove),e.document.addEventListener("click",this.onClicker),t.log("Peripherals Mounted"),!0}unmount(e,t){return e.document.removeEventListener("pointerdown",this.onPointerDown),e.document.removeEventListener("pointerup",this.onPointerUp),e.document.removeEventListener("contextmenu",this.onContextMenu),e.document.removeEventListener("pointermove",this.onPointerMove),e.document.removeEventListener("click",this.onClicker),t.log("Peripherals Unmounted"),!0}};Di.moduleName="peripherals";let Qo=Di;const Wi=class Wt extends Pe{constructor(){super(...arguments),this.mediaPlayingCount=0,this.allAnimations=new Set}wndOnErr(e){this.comms?.send("error",{message:e.message,filename:e.filename,lineno:e.lineno,colno:e.colno})}unblock(e){for(e._readium_blockEvents=!1;e._readium_blockedEvents?.length>0;){const t=e._readium_blockedEvents.shift();switch(t[0]){case 0:Reflect.apply(t[1],t[2],t[3]);break;case 1:const i=t[1],n=t[2];e.removeEventListener(i.type,e._readium_eventBlocker,!0);const o=new Event(i.type,{bubbles:i.bubbles,cancelable:i.cancelable});n?n.dispatchEvent(o):e.dispatchEvent(o);break}}}onMediaPlayEvent(){this.mediaPlayingCount++,this.comms?.send("media_play",this.mediaPlayingCount)}onMediaPauseEvent(){this.mediaPlayingCount>0&&this.mediaPlayingCount--,this.comms?.send("media_pause",this.mediaPlayingCount)}pauseAllMedia(e){const t=e.document.querySelectorAll("audio,video");for(let i=0;i<t.length;i++)t[i].pause()}mount(e,t){this.comms=t,e.addEventListener("error",this.wndOnErr,!1),Reflect.defineProperty(e.navigator,"epubReadingSystem",{value:{name:"readium-ts-toolkit",version:"2.2.4",hasFeature:(n,o="")=>{switch(n){case"dom-manipulation":return!0;case"layout-changes":return!0;case"touch-events":return!0;case"mouse-events":return!0;case"keyboard-events":return!0;case"spine-scripting":return!0;case"embedded-web-content":return!0;default:return!1}}},writable:!1}),"getAnimations"in e.document&&e.document.getAnimations().forEach(n=>{n.cancel(),this.allAnimations.add(n)}),t.register("activate",Wt.moduleName,(n,o)=>{this.allAnimations.forEach(s=>{s.cancel(),s.play()}),o(!0)}),t.register("unfocus",Wt.moduleName,(n,o)=>{this.pauseAllMedia(e),this.allAnimations.forEach(s=>s.pause()),o(!0)});const i=e.document.querySelectorAll("audio,video");for(let n=0;n<i.length;n++){const o=i[n];o.addEventListener("play",this.onMediaPlayEvent,{passive:!0}),o.addEventListener("pause",this.onMediaPauseEvent,{passive:!0})}return t.log("Setup Mounted"),!0}unmount(e,t){return e.removeEventListener("error",this.wndOnErr),e.removeEventListener("play",this.onMediaPlayEvent),e.removeEventListener("pause",this.onMediaPauseEvent),this.allAnimations.forEach(i=>i.cancel()),this.allAnimations.clear(),t.log("Setup Unmounted"),!0}};Wi.moduleName="setup";let ji=Wi;const Bi="readium-viewport",Hi=class re extends ji{onViewportWidthChanged(e){const t=e.target;xe(t,"--RS__viewportWidth",`${t.innerWidth}px`)}mount(e,t){if(!super.mount(e,t))return!1;const i=e.document.createElement("meta");return i.dataset.readium="true",i.setAttribute("name","viewport"),i.setAttribute("id",Bi),i.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"),e.document.head.appendChild(i),e.addEventListener("orientationchange",this.onViewportWidthChanged),e.addEventListener("resize",this.onViewportWidthChanged),this.onViewportWidthChanged({target:e}),t.register("get_properties",re.moduleName,(n,o)=>{ft(e),o(!0)}),t.register("update_properties",re.moduleName,(n,o)=>{n["--RS__viewportWidth"]=`${e.innerWidth}px`,_i(e,n),o(!0)}),t.register("set_property",re.moduleName,(n,o)=>{const s=n;xe(e,s[0],s[1]),o(!0)}),t.register("remove_property",re.moduleName,(n,o)=>{$e(e,n),o(!0)}),t.register("activate",re.moduleName,(n,o)=>{this.unblock(e),o(!0)}),t.log("ReflowableSetup Mounted"),!0}unmount(e,t){return t.unregisterAll(re.moduleName),e.document.head.querySelector(`#${Bi}`)?.remove(),e.removeEventListener("orientationchange",this.onViewportWidthChanged),t.log("ReflowableSetup Unmounted"),super.unmount(e,t)}};Hi.moduleName="reflowable_setup";let er=Hi;const Gi="readium-fixed-style",Vi=class Q extends ji{mount(e,t){if(!super.mount(e,t))return!1;e.navigator.epubReadingSystem&&(e.navigator.epubReadingSystem.layoutStyle="paginated");const i=e.document.createElement("style");return i.id=Gi,i.dataset.readium="true",i.textContent=`
73
60
  html, body {
74
61
  text-size-adjust: none;
75
62
  -ms-text-size-adjust: none;
@@ -81,21 +68,300 @@ if(window.onload) window.onload = new Proxy(window.onload, {
81
68
  min-height: 100%;
82
69
 
83
70
  /*cursor: var() TODO*/
84
- }`,t.document.head.appendChild(i),e.register("set_property",tt.moduleName,(A,n)=>{const o=A;Rt(t,o[0],o[1]),n(!0)}),e.register("remove_property",tt.moduleName,(A,n)=>{Lt(t,A),n(!0)}),e.register("first_visible_locator",tt.moduleName,(A,n)=>n(!1)),e.register("unfocus",tt.moduleName,(A,n)=>{S(t),n(!0)}),e.register(["focus","go_next","go_prev","go_id","go_end","go_start","go_text","go_progression"],tt.moduleName,(A,n)=>n(!0)),e.register("activate",tt.moduleName,(A,n)=>{this.unblock(t),n(!0)}),e.log("FixedSetup Mounted"),!0}unmount(t,e){return e.unregisterAll(tt.moduleName),t.document.getElementById(Oi)?.remove(),e.log("FixedSetup Unmounted"),super.unmount(t,e)}};Li.moduleName="fixed_setup";let jn=Li;const Xi=class st extends Ut{wndOnErr(t){this.comms?.send("error",{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno})}mount(t,e){return this.comms=e,t.addEventListener("error",this.wndOnErr,!1),e.register("get_properties",st.moduleName,(i,A)=>{we(t),A(!0)}),e.register("update_properties",st.moduleName,(i,A)=>{Ii(t,i),A(!0)}),e.register("set_property",st.moduleName,(i,A)=>{const n=i;Rt(t,n[0],n[1]),A(!0)}),e.register("remove_property",st.moduleName,(i,A)=>{Lt(t,i),A(!0)}),e.register("activate",st.moduleName,(i,A)=>{A(!0)}),e.log("WebPubSetup Mounted"),!0}unmount(t,e){return e.unregisterAll(st.moduleName),t.removeEventListener("error",this.wndOnErr),e.log("WebPubSetup Unmounted"),!0}};Xi.moduleName="webpub_setup";let Vn=Xi;const vn=["fixed_setup","decorator","peripherals"],Dn=["reflowable_setup","decorator","peripherals","column_snapper","scroll_snapper"],Hn=["webpub_setup","webpub_snapper","decorator","peripherals"],Kt=new Map([jn,bn,Vn,Tn,Pn,Fn,Nn,xn].map(r=>[r.moduleName,r]));class ut{constructor(t=window,e=[]){this.loadedModules=[],this.wnd=t,this.comms=new en(t);const i=[...new Set(e)];if(i.length){if(typeof t>"u")throw Error("Loader is not in a web browser");t.parent!==t&&this.comms.log("Loader is probably in a frame"),this.loadedModules=i.map(A=>{const n=this.loadModule(A);if(n)return n.mount(this.wnd,this.comms),n}).filter(A=>A!==void 0)}}loadModule(t){const e=Kt.get(t);return e===void 0?(this.comms.log(`Module "${name}" does not exist in the library`),e):new e}addModule(t){const e=this.loadModule(t);return!e||!e.mount(this.wnd,this.comms)?!1:(this.loadedModules.push(e),!0)}removeModule(t){const e=Kt.get(t);if(e===void 0)return this.comms.log(`Module "${t}" does not exist in the library`),!1;const i=this.loadedModules.findIndex(A=>A instanceof e);return i<0?!1:(this.loadedModules[i].unmount(this.wnd,this.comms),this.loadedModules.splice(i,1),!0)}destroy(){this.comms.destroy(),this.loadedModules.forEach(t=>t.unmount(this.wnd,this.comms)),this.loadedModules=[]}}const Gn=1e4;class mt{constructor(t,e){this.registry=new Map,this._ready=!1,this.listenerBuffer=[],this.handler=this.handle.bind(this),this.wnd=t,this.origin=e;try{this.channelId=window.crypto.randomUUID()}catch{this.channelId=ce()}this.gc=setInterval(()=>{this.registry.forEach((i,A)=>{performance.now()-i.time>Gn&&(console.warn(A,"event for",i.key,"was never handled!"),this.registry.delete(A))})},5e3),window.addEventListener("message",this.handler),this.send("_ping",void 0)}set listener(t){this.listenerBuffer.length>0&&this.listenerBuffer.forEach(e=>t(e[0],e[1])),this.listenerBuffer=[],this._listener=t}clearListener(){typeof this._listener=="function"&&(this._listener=void 0)}halt(){this._ready=!1,window.removeEventListener("message",this.handler),clearInterval(this.gc),this._listener=void 0,this.registry.clear()}resume(){window.addEventListener("message",this.handler),this._ready=!0}handle(t){const e=t.data;if(!e._readium){console.warn("Ignoring",e);return}if(e._channel===this.channelId)switch(e.key){case"_ack":{if(!e.id)return;const i=this.registry.get(e.id);if(!i)return;this.registry.delete(e.id),i.cb(!!e.data);return}case"_pong":this._ready=!0;default:{if(!this.ready)return;typeof this._listener=="function"?this._listener(e.key,e.data):this.listenerBuffer.push([e.key,e.data])}}}get ready(){return this._ready}send(t,e,i,A=!1,n=[]){const o=ce();return i&&this.registry.set(o,{cb:i,time:performance.now(),key:t}),this.wnd.postMessage({_readium:ht,_channel:this.channelId,id:o,data:e,key:t,strict:A},"/",n),o}}const kn={RS__oldStyleTf:"'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'URW Palladio L', P052, serif"},Jn=16,Zi=kn.RS__oldStyleTf;class pt{constructor(t){this._optimalLineLength=null,this._canvas=document.createElement("canvas"),this._optimalChars=t.optimalChars,this._minChars=t.minChars,this._maxChars=t.maxChars,this._baseFontSize=t.baseFontSize||Jn,this._fontFace=t.fontFace||Zi,this._sample=t.sample||null,this._pageGutter=t.pageGutter||0,this._letterSpacing=t.letterSpacing?Math.round(t.letterSpacing*this._baseFontSize):0,this._wordSpacing=t.wordSpacing?Math.round(t.wordSpacing*this._baseFontSize):0,this._isCJK=t.isCJK||!1,this._getRelative=t.getRelative||!1,this._padding=this._pageGutter*2,this._minDivider=this._minChars&&this._minChars<this._optimalChars?this._optimalChars/this._minChars:this._minChars===null?null:1,this._maxMultiplier=this._maxChars&&this._maxChars>this._optimalChars?this._maxChars/this._optimalChars:this._maxChars===null?null:1,this._approximatedWordSpaces=pt.approximateWordSpaces(this._optimalChars,this._sample)}updateMultipliers(){this._minDivider=this._minChars&&this._minChars<this._optimalChars?this._optimalChars/this._minChars:this._minChars===null?null:1,this._maxMultiplier=this._maxChars&&this._maxChars>this._optimalChars?this._maxChars/this._optimalChars:this._maxChars===null?null:1}update(t){t.optimalChars&&(this._optimalChars=t.optimalChars),t.minChars!==void 0&&(this._minChars=t.minChars),t.maxChars!==void 0&&(this._maxChars=t.maxChars),t.baseFontSize&&(this._baseFontSize=t.baseFontSize),t.fontFace!==void 0&&(this._fontFace=t.fontFace||Zi),t.letterSpacing&&(this._letterSpacing=t.letterSpacing),t.wordSpacing&&(this._wordSpacing=t.wordSpacing),t.isCJK!=null&&(this._isCJK=t.isCJK),t.pageGutter&&(this._pageGutter=t.pageGutter),t.getRelative&&(this._getRelative=t.getRelative),t.sample&&(this._sample=t.sample,this._approximatedWordSpaces=pt.approximateWordSpaces(this._optimalChars,this._sample)),this.updateMultipliers(),this._optimalLineLength=this.getOptimalLineLength()}get baseFontSize(){return this._baseFontSize}get minimalLineLength(){return this._optimalLineLength||(this._optimalLineLength=this.getOptimalLineLength()),this._minDivider!==null?Math.round(this._optimalLineLength/this._minDivider+this._padding)/(this._getRelative?this._baseFontSize:1):null}get maximalLineLength(){return this._optimalLineLength||(this._optimalLineLength=this.getOptimalLineLength()),this._maxMultiplier!==null?Math.round(this._optimalLineLength*this._maxMultiplier+this._padding)/(this._getRelative?this._baseFontSize:1):null}get optimalLineLength(){return this._optimalLineLength||(this._optimalLineLength=this.getOptimalLineLength()),Math.round(this._optimalLineLength+this._padding)/(this._getRelative?this._baseFontSize:1)}get all(){return this._optimalLineLength||(this._optimalLineLength=this.getOptimalLineLength()),{min:this.minimalLineLength,max:this.maximalLineLength,optimal:this.optimalLineLength,baseFontSize:this._baseFontSize}}static approximateWordSpaces(t,e){let i=0;if(e&&e.length>=t){const A=e.match(/([\s]+)/gi);i=(A?A.length:0)*(t/e.length)}return i}getLineLengthFallback(){const t=this._letterSpacing*(this._optimalChars-1),e=this._wordSpacing*this._approximatedWordSpaces;return this._optimalChars*(this._baseFontSize*.5)+t+e}getOptimalLineLength(){if(this._fontFace){if(typeof this._fontFace=="string")return this.measureText(this._fontFace);{const t=new FontFace(this._fontFace.name,`url(${this._fontFace.url})`);t.load().then(()=>(document.fonts.add(t),this.measureText(t.family)),e=>{})}}return this.getLineLengthFallback()}measureText(t){const e=this._canvas.getContext("2d");if(e&&t){let i=this._isCJK?"水".repeat(this._optimalChars):"0".repeat(this._optimalChars);if(e.font=`${this._baseFontSize}px ${t}`,this._sample&&this._sample.length>=this._optimalChars&&(i=this._sample.slice(0,this._optimalChars)),Object.hasOwn(e,"letterSpacing")&&Object.hasOwn(e,"wordSpacing"))return e.letterSpacing=this._letterSpacing.toString()+"px",e.wordSpacing=this._wordSpacing.toString()+"px",e.measureText(i).width;{const A=this._letterSpacing*(this._optimalChars-1),n=this._wordSpacing*pt.approximateWordSpaces(this._optimalChars,this._sample);return e.measureText(i).width+A+n}}else return this.getLineLengthFallback()}}const Ki=()=>typeof navigator>"u"?"":navigator.userAgent||"",qi=()=>typeof navigator>"u"?void 0:navigator.userAgentData||void 0;class _i{constructor(){const t=qi(),e=Ki(),i=n=>(typeof n=="string"||typeof n=="number")&&n?String(n).replace(/_/g,".").split(".").map(o=>parseInt(o)||0):[],A=(n="")=>{if(!n)return[];const o=new RegExp("^.*"+n+"[ :\\/]?(\\d+([\\._]\\d+)*).*$");return o.test(e)?i(e.replace(o,"$1")):[]};this.OS=(n=>(/(macOS|Mac OS X)/.test(e)?(/\(iP(hone|od touch);/.test(e)&&(n.iOS=A("CPU (?:iPhone )?OS ")),/\(iPad;/.test(e)?n.iOS=n.iPadOS=A("CPU (?:iPhone )?OS "):/(macOS|Mac OS X) \d/.test(e)&&(document.ontouchend!==void 0?n.iOS=n.iPadOS=A():n.macOS=A("(?:macOS|Mac OS X) "))):/Windows( NT)? \d/.test(e)?n.Windows=(o=>o[0]!==6||!o[1]?o:o[1]===1?[7]:o[1]===2?[8]:[8,1])(A("Windows(?: NT)?")):/Android \d/.test(e)?n.Android=A("Android"):/CrOS/.test(e)?n.ChromeOS=A():/X11;/.test(e)&&(n.Linux=A()),n))({}),t&&t.getHighEntropyValues(["architecture","model","platform","platformVersion","uaFullVersion"]).then(n=>(o=>{const s=n.platform,a=n.platformVersion;if(!(!s||!a)){if(/^i(OS|P(hone|od touch))$/.test(s))o.iOS=i(a);else if(/^iPad(OS)?$/.test(s))o.iOS=o.iPadOS=i(a);else if(/^(macOS|(Mac )?OS X|Mac(Intel)?)$/.test(s))document.ontouchend!==void 0?o.iOS=o.iPadOS=i():o.macOS=i(a);else if(/^(Microsoft )?Windows$/.test(s))o.Windows=i(a);else if(/^(Google )?Android$/.test(s))o.Android=i(a);else if(/^((Google )?Chrome OS|CrOS)$/.test(s))o.ChromeOS=i(a);else if(/^(Linux|Ubuntu|X11)$/.test(s))o.Linux=i(a);else return;Object.keys(this.OS).forEach(h=>delete this.OS[h]),Object.assign(this.OS,o)}})({})),this.UA=(n=>{let o=!1;if(t&&Array.isArray(t.brands)){const s=t.brands.reduce((a,h)=>(a[h.brand]=[h.version*1],a),{});s["Google Chrome"]?(o=!0,n.Blink=n.Chromium=s.Chromium||[],n.Chrome=s["Google Chrome"]):s["Microsoft Edge"]?(o=!0,n.Blink=n.Chromium=s.Chromium||[],n.Edge=s["Microsoft Edge"]):s.Opera&&(o=!0,n.Blink=n.Chromium=s.Chromium||[],n.Opera=s.Opera)}return o||(/ Gecko\/\d/.test(e)?(n.Gecko=A("rv"),/ Waterfox\/\d/.test(e)?n.Waterfox=A("Waterfox"):/ Firefox\/\d/.test(e)&&(n.Firefox=A("Firefox"))):/ Edge\/\d/.test(e)?(n.EdgeHTML=A("Edge"),n.Edge=n.EdgeHTML):/ Chrom(ium|e)\/\d/.test(e)?(n.Blink=n.Chromium=(s=>s[0]?s:A("Chrome"))(A("Chromium")),/ EdgA?\/\d/.test(e)?n.Edge=(s=>s[0]?s:A("Edg"))(A("EdgA")):/ OPR\/\d/.test(e)?n.Opera=A("OPR"):/ Vivaldi\/\d/.test(e)?n.Vivaldi=A("Vivaldi"):/ Silk\/\d/.test(e)?n.Silk=A("Silk"):/ UCBrowser\/\d/.test(e)?n.UCBrowser=A("UCBrowser"):/ Phoebe\/\d/.test(e)?n.Phoebe=A("Phoebe"):n.Chrome=(s=>s[0]?s:n.Chromium)(A("Chrome"))):/ AppleWebKit\/\d/.test(e)?(n.WebKit=A("AppleWebKit"),/ CriOS \d/.test(e)?n.Chrome=A("CriOS"):/ FxiOS \d/.test(e)?n.Firefox=A("FxiOS"):/ EdgiOS\/\d/.test(e)?n.Edge=A("EdgiOS"):/ Version\/\d/.test(e)&&(n.Safari=A("Version"))):/ Trident\/\d/.test(e)&&(n.Trident=A("Trident"),n.InternetExplorer=(s=>s[0]?s:A("MSIE"))(A("rv")))),/[\[; ]FB(AN|_IAB)\//.test(e)&&(n.Facebook=A("FBAV")),/ Line\/\d/.test(e)&&(n.LINE=A("Line")),n})({}),this.Env={get:()=>[this.OS,this.UA].reduce((n,o)=>{for(const s in o)o[s]&&n.push(s);return n},[])}}}class Wn extends _i{get iOSRequest(){const t=qi(),e=Ki();if(this.OS.iOS&&!this.OS.iPadOS)return"mobile";if(this.OS.iPadOS)return/\(iPad;/.test(e)||t&&/^iPad(OS)?$/.test(t.platform)?"mobile":"desktop"}}const ft=new _i,R=new Wn;class $i{constructor(t){this.hidden=!0,this.destroyed=!1,this.currModules=[],this.frame=document.createElement("iframe"),this.frame.classList.add("readium-navigator-iframe"),this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.position="absolute",this.frame.style.pointerEvents="none",this.frame.style.transition="visibility 0s, opacity 0.1s linear",this.frame.style.backgroundColor="#FFFFFF",this.source=t}async load(t=[]){return new Promise((e,i)=>{if(this.loader){const A=this.frame.contentWindow;if([...this.currModules].sort().join("|")===[...t].sort().join("|")){try{e(A)}catch{}return}this.comms?.halt(),this.loader.destroy(),this.loader=new ut(A,t),this.currModules=t,this.comms=void 0;try{e(A)}catch{}return}this.frame.onload=()=>{const A=this.frame.contentWindow;this.loader=new ut(A,t),this.currModules=t;try{e(A)}catch{}},this.frame.onerror=A=>{try{i(A)}catch{}},this.frame.contentWindow.location.replace(this.source)})}async destroy(){await this.hide(),this.loader?.destroy(),this.frame.remove(),this.destroyed=!0}async hide(){if(!this.destroyed){if(this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.pointerEvents="none",this.hidden=!0,this.frame.parentElement)return this.comms===void 0||!this.comms.ready?void 0:new Promise((t,e)=>{this.comms?.send("unfocus",void 0,i=>{this.comms?.halt(),t()})});this.comms?.halt()}}async show(t){if(this.destroyed)throw Error("Trying to show frame when it doesn't exist");if(!this.frame.parentElement)throw Error("Trying to show frame that is not attached to the DOM");return this.comms?this.comms.resume():this.comms=new mt(this.frame.contentWindow,this.source),new Promise((e,i)=>{this.comms?.send("activate",void 0,()=>{this.comms?.send("focus",void 0,()=>{const A=()=>{this.frame.style.removeProperty("visibility"),this.frame.style.removeProperty("aria-hidden"),this.frame.style.removeProperty("opacity"),this.frame.style.removeProperty("pointer-events"),this.hidden=!1,ft.UA.WebKit&&this.comms?.send("force_webkit_recalc",void 0),e()};t!==void 0?this.comms?.send("go_progression",t,A):A()})})})}setCSSProperties(t){this.destroyed||!this.frame.contentWindow||(this.hidden&&(this.comms?this.comms?.resume():this.comms=new mt(this.frame.contentWindow,this.source)),this.comms?.send("update_properties",t),this.hidden&&this.comms?.halt())}get iframe(){if(this.destroyed)throw Error("Trying to use frame when it doesn't exist");return this.frame}get realSize(){if(this.destroyed)throw Error("Trying to use frame client rect when it doesn't exist");return this.frame.getBoundingClientRect()}get window(){if(this.destroyed||!this.frame.contentWindow)throw Error("Trying to use frame window when it doesn't exist");return this.frame.contentWindow}get msg(){return this.comms}get ldr(){return this.loader}}class tA{constructor(t,e){this.pool=new Map,this.blobs=new Map,this.inprogress=new Map,this.pendingUpdates=new Map,this.container=t,this.currentCssProperties=e}async destroy(){let t=this.inprogress.values(),e=t.next();const i=[];for(;e.value;)i.push(e.value),e=t.next();i.length>0&&await Promise.allSettled(i),this.inprogress.clear();let A=this.pool.values(),n=A.next();for(;n.value;)await n.value.destroy(),n=A.next();this.pool.clear(),this.blobs.forEach(o=>URL.revokeObjectURL(o)),this.blobs.clear(),this.container.childNodes.forEach(o=>{(o.nodeType===Node.ELEMENT_NODE||o.nodeType===Node.TEXT_NODE)&&o.remove()})}async update(t,e,i){const A=t.readingOrder.items;let n=A.findIndex(a=>a.href===e.href);if(n<0)throw Error(`Locator not found in reading order: ${e.href}`);const o=A[n].href;this.inprogress.has(o)&&await this.inprogress.get(o);const s=new Promise(async(a,h)=>{const c=[],d=[];t.readingOrder.items.forEach((l,p)=>{p!==n&&p!==n-1&&p!==n+1&&(c.includes(l.href)||c.push(l.href)),p===n&&(d.includes(l.href)||d.push(l.href))}),c.forEach(async l=>{d.includes(l)||this.pool.has(l)&&(await this.pool.get(l)?.destroy(),this.pool.delete(l))}),this.currentBaseURL!==void 0&&t.baseURL!==this.currentBaseURL&&(this.blobs.forEach(l=>URL.revokeObjectURL(l)),this.blobs.clear()),this.currentBaseURL=t.baseURL;const g=async l=>{if(this.pendingUpdates.has(l)&&this.pendingUpdates.get(l)?.inPool===!1){const I=this.blobs.get(l);I&&(URL.revokeObjectURL(I),this.blobs.delete(l),this.pendingUpdates.delete(l))}if(this.pool.has(l)){const I=this.pool.get(l);if(!this.blobs.has(l))await I.destroy(),this.pool.delete(l),this.pendingUpdates.delete(l);else{await I.load(i);return}}const p=t.readingOrder.findWithHref(l);if(!p)return;if(!this.blobs.has(l)){const Q=await new ni(t,this.currentBaseURL||"",p,this.currentCssProperties).build();this.blobs.set(l,Q)}const E=new $i(this.blobs.get(l));l!==o&&await E.hide(),this.container.appendChild(E.iframe),await E.load(i),this.pool.set(l,E)};try{await Promise.all(d.map(l=>g(l)))}catch(l){h(l)}const M=this.pool.get(o);M?.source!==this._currentFrame?.source&&(await this._currentFrame?.hide(),M&&await M.load(i),M&&await M.show(e.locations.progression),this._currentFrame=M),a()});this.inprogress.set(o,s),await s,this.inprogress.delete(o)}setCSSProperties(t){if(!((i,A)=>{const n=Object.keys(i),o=Object.keys(A);if(n.length!==o.length)return!1;for(const s of n)if(i[s]!==A[s])return!1;return!0})(this.currentCssProperties||{},t)){this.currentCssProperties=t,this.pool.forEach(i=>{i.setCSSProperties(t)});for(const i of this.blobs.keys())this.pendingUpdates.set(i,{inPool:this.pool.has(i)})}}get currentFrames(){return[this._currentFrame]}get currentBounds(){const t={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0,toJSON(){return this}};return this.currentFrames.forEach(e=>{if(!e)return;const i=e.realSize;t.x=Math.min(t.x,i.x),t.y=Math.min(t.y,i.y),t.width+=i.width,t.height=Math.max(t.height,i.height),t.top=Math.min(t.top,i.top),t.right=Math.min(t.right,i.right),t.bottom=Math.min(t.bottom,i.bottom),t.left=Math.min(t.left,i.left)}),t}}var Se,eA;function On(){if(eA)return Se;eA=1;function r(A){if(typeof A!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(A))}function t(A,n){for(var o="",s=0,a=-1,h=0,c,d=0;d<=A.length;++d){if(d<A.length)c=A.charCodeAt(d);else{if(c===47)break;c=47}if(c===47){if(!(a===d-1||h===1))if(a!==d-1&&h===2){if(o.length<2||s!==2||o.charCodeAt(o.length-1)!==46||o.charCodeAt(o.length-2)!==46){if(o.length>2){var g=o.lastIndexOf("/");if(g!==o.length-1){g===-1?(o="",s=0):(o=o.slice(0,g),s=o.length-1-o.lastIndexOf("/")),a=d,h=0;continue}}else if(o.length===2||o.length===1){o="",s=0,a=d,h=0;continue}}n&&(o.length>0?o+="/..":o="..",s=2)}else o.length>0?o+="/"+A.slice(a+1,d):o=A.slice(a+1,d),s=d-a-1;a=d,h=0}else c===46&&h!==-1?++h:h=-1}return o}function e(A,n){var o=n.dir||n.root,s=n.base||(n.name||"")+(n.ext||"");return o?o===n.root?o+s:o+A+s:s}var i={resolve:function(){for(var n="",o=!1,s,a=arguments.length-1;a>=-1&&!o;a--){var h;a>=0?h=arguments[a]:(s===void 0&&(s=process.cwd()),h=s),r(h),h.length!==0&&(n=h+"/"+n,o=h.charCodeAt(0)===47)}return n=t(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(n){if(r(n),n.length===0)return".";var o=n.charCodeAt(0)===47,s=n.charCodeAt(n.length-1)===47;return n=t(n,!o),n.length===0&&!o&&(n="."),n.length>0&&s&&(n+="/"),o?"/"+n:n},isAbsolute:function(n){return r(n),n.length>0&&n.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var n,o=0;o<arguments.length;++o){var s=arguments[o];r(s),s.length>0&&(n===void 0?n=s:n+="/"+s)}return n===void 0?".":i.normalize(n)},relative:function(n,o){if(r(n),r(o),n===o||(n=i.resolve(n),o=i.resolve(o),n===o))return"";for(var s=1;s<n.length&&n.charCodeAt(s)===47;++s);for(var a=n.length,h=a-s,c=1;c<o.length&&o.charCodeAt(c)===47;++c);for(var d=o.length,g=d-c,M=h<g?h:g,l=-1,p=0;p<=M;++p){if(p===M){if(g>M){if(o.charCodeAt(c+p)===47)return o.slice(c+p+1);if(p===0)return o.slice(c+p)}else h>M&&(n.charCodeAt(s+p)===47?l=p:p===0&&(l=0));break}var E=n.charCodeAt(s+p),I=o.charCodeAt(c+p);if(E!==I)break;E===47&&(l=p)}var Q="";for(p=s+l+1;p<=a;++p)(p===a||n.charCodeAt(p)===47)&&(Q.length===0?Q+="..":Q+="/..");return Q.length>0?Q+o.slice(c+l):(c+=l,o.charCodeAt(c)===47&&++c,o.slice(c))},_makeLong:function(n){return n},dirname:function(n){if(r(n),n.length===0)return".";for(var o=n.charCodeAt(0),s=o===47,a=-1,h=!0,c=n.length-1;c>=1;--c)if(o=n.charCodeAt(c),o===47){if(!h){a=c;break}}else h=!1;return a===-1?s?"/":".":s&&a===1?"//":n.slice(0,a)},basename:function(n,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');r(n);var s=0,a=-1,h=!0,c;if(o!==void 0&&o.length>0&&o.length<=n.length){if(o.length===n.length&&o===n)return"";var d=o.length-1,g=-1;for(c=n.length-1;c>=0;--c){var M=n.charCodeAt(c);if(M===47){if(!h){s=c+1;break}}else g===-1&&(h=!1,g=c+1),d>=0&&(M===o.charCodeAt(d)?--d===-1&&(a=c):(d=-1,a=g))}return s===a?a=g:a===-1&&(a=n.length),n.slice(s,a)}else{for(c=n.length-1;c>=0;--c)if(n.charCodeAt(c)===47){if(!h){s=c+1;break}}else a===-1&&(h=!1,a=c+1);return a===-1?"":n.slice(s,a)}},extname:function(n){r(n);for(var o=-1,s=0,a=-1,h=!0,c=0,d=n.length-1;d>=0;--d){var g=n.charCodeAt(d);if(g===47){if(!h){s=d+1;break}continue}a===-1&&(h=!1,a=d+1),g===46?o===-1?o=d:c!==1&&(c=1):o!==-1&&(c=-1)}return o===-1||a===-1||c===0||c===1&&o===a-1&&o===s+1?"":n.slice(o,a)},format:function(n){if(n===null||typeof n!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof n);return e("/",n)},parse:function(n){r(n);var o={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return o;var s=n.charCodeAt(0),a=s===47,h;a?(o.root="/",h=1):h=0;for(var c=-1,d=0,g=-1,M=!0,l=n.length-1,p=0;l>=h;--l){if(s=n.charCodeAt(l),s===47){if(!M){d=l+1;break}continue}g===-1&&(M=!1,g=l+1),s===46?c===-1?c=l:p!==1&&(p=1):c!==-1&&(p=-1)}return c===-1||g===-1||p===0||p===1&&c===g-1&&c===d+1?g!==-1&&(d===0&&a?o.base=o.name=n.slice(1,g):o.base=o.name=n.slice(d,g)):(d===0&&a?(o.name=n.slice(1,c),o.base=n.slice(1,g)):(o.name=n.slice(d,c),o.base=n.slice(d,g)),o.ext=n.slice(c,g)),d>0?o.dir=n.slice(0,d-1):a&&(o.dir="/"),o},sep:"/",delimiter:":",win32:null,posix:null};return i.posix=i,Se=i,Se}var qt=On();const _t={experimentalHeaderFiltering:{description:"Attempts to filter out paragraphs that are implicitly headings or part of headers",scope:"RS",value:"readium-experimentalHeaderFiltering-on"},experimentalZoom:{description:"Attemps to filter out elements that are sized using viewport units and should not be scaled directly e.g. tables, images, iframes, etc.",scope:"RS",value:"readium-experimentalZoom-on"}};var X=(r=>(r.start="start",r.left="left",r.right="right",r.justify="justify",r))(X||{});const At={range:[0,100],step:1},St={range:[.7,4],step:.05},q={range:[100,1e3],step:100},zt={range:[50,250],step:10},Qt={range:[0,1],step:.125},Yt={range:[1,2],step:.1},nt={range:[20,100],step:1},Nt={range:[0,3],step:.25},xt={range:[0,3],step:.25},Tt={range:[0,2],step:.125},Pt={range:[.7,4],step:.05};class bt{constructor(){}toFlag(t){return`readium-${t}-on`}toUnitless(t){return t.toString()}toPercentage(t,e=!1){return e||t>0&&t<=1?`${Math.round(t*100)}%`:`${t}%`}toVw(t){const e=Math.round(t*100);return`${Math.min(e,100)}vw`}toVh(t){const e=Math.round(t*100);return`${Math.min(e,100)}vh`}toPx(t){return`${t}px`}toRem(t){return`${t}rem`}}class ze extends bt{constructor(t){super(),this.a11yNormalize=t.a11yNormalize??null,this.bodyHyphens=t.bodyHyphens??null,this.fontFamily=t.fontFamily??null,this.fontWeight=t.fontWeight??null,this.iOSPatch=t.iOSPatch??null,this.iPadOSPatch=t.iPadOSPatch??null,this.letterSpacing=t.letterSpacing??null,this.ligatures=t.ligatures??null,this.lineHeight=t.lineHeight??null,this.noRuby=t.noRuby??null,this.paraIndent=t.paraIndent??null,this.paraSpacing=t.paraSpacing??null,this.textAlign=t.textAlign??null,this.wordSpacing=t.wordSpacing??null,this.zoom=t.zoom??null}toCSSProperties(){const t={};return this.a11yNormalize&&(t["--USER__a11yNormalize"]=this.toFlag("a11y")),this.bodyHyphens&&(t["--USER__bodyHyphens"]=this.bodyHyphens),this.fontFamily&&(t["--USER__fontFamily"]=this.fontFamily),this.fontWeight!=null&&(t["--USER__fontWeight"]=this.toUnitless(this.fontWeight)),this.iOSPatch&&(t["--USER__iOSPatch"]=this.toFlag("iOSPatch")),this.iPadOSPatch&&(t["--USER__iPadOSPatch"]=this.toFlag("iPadOSPatch")),this.letterSpacing!=null&&(t["--USER__letterSpacing"]=this.toRem(this.letterSpacing)),this.ligatures&&(t["--USER__ligatures"]=this.ligatures),this.lineHeight!=null&&(t["--USER__lineHeight"]=this.toUnitless(this.lineHeight)),this.noRuby&&(t["--USER__noRuby"]=this.toFlag("noRuby")),this.paraIndent!=null&&(t["--USER__paraIndent"]=this.toRem(this.paraIndent)),this.paraSpacing!=null&&(t["--USER__paraSpacing"]=this.toRem(this.paraSpacing)),this.textAlign&&(t["--USER__textAlign"]=this.textAlign),this.wordSpacing!=null&&(t["--USER__wordSpacing"]=this.toRem(this.wordSpacing)),this.zoom!==null&&(t["--USER__zoom"]=this.toPercentage(this.zoom,!0)),t}}class iA extends bt{constructor(t){super(),this.experiments=t.experiments??null}toCSSProperties(){const t={};return this.experiments&&this.experiments.forEach(e=>{t["--RS__"+e]=_t[e].value}),t}}class AA{constructor(t){this.rsProperties=t.rsProperties,this.userProperties=t.userProperties}update(t){t.experiments&&(this.rsProperties.experiments=t.experiments);const e={a11yNormalize:t.textNormalization,bodyHyphens:typeof t.hyphens!="boolean"?null:t.hyphens?"auto":"none",fontFamily:t.fontFamily,fontWeight:t.fontWeight,iOSPatch:t.iOSPatch,iPadOSPatch:t.iPadOSPatch,letterSpacing:t.letterSpacing,ligatures:typeof t.ligatures!="boolean"?null:t.ligatures?"common-ligatures":"none",lineHeight:t.lineHeight,noRuby:t.noRuby,paraIndent:t.paragraphIndent,paraSpacing:t.paragraphSpacing,textAlign:t.textAlign,wordSpacing:t.wordSpacing,zoom:t.zoom};this.userProperties=new ze(e)}}function nA(r,t){return r==null||t==null||r<=t?r:void 0}function rA(r,t){return r==null||t==null||r>=t?r:void 0}function Y(r){return typeof r=="string"?r:r===null?null:void 0}function F(r){return typeof r=="boolean"||r==null?r:void 0}function jt(r,t){if(r!==void 0)return r===null?null:t[r]!==void 0?r:void 0}function rt(r){return typeof r=="boolean"||typeof r=="number"&&r>=0?r:r===null?null:void 0}function y(r){if(r!==void 0)return r===null?null:r<0?void 0:r}function O(r,t){if(r===void 0)return;if(r===null)return null;const e=Math.min(...t),i=Math.max(...t);return r>=e&&r<=i?r:void 0}function $t(r,t){return r===void 0?t:r}function Qe(r){if(r!==void 0)return r===null?null:r.filter(t=>t in _t)}class Mt{constructor(t={}){this.fontFamily=Y(t.fontFamily),this.fontWeight=O(t.fontWeight,q.range),this.hyphens=F(t.hyphens),this.iOSPatch=F(t.iOSPatch),this.iPadOSPatch=F(t.iPadOSPatch),this.letterSpacing=y(t.letterSpacing),this.ligatures=F(t.ligatures),this.lineHeight=y(t.lineHeight),this.noRuby=F(t.noRuby),this.paragraphIndent=y(t.paragraphIndent),this.paragraphSpacing=y(t.paragraphSpacing),this.textAlign=jt(t.textAlign,X),this.textNormalization=F(t.textNormalization),this.wordSpacing=y(t.wordSpacing),this.zoom=O(t.zoom,Pt.range)}static serialize(t){const{...e}=t;return JSON.stringify(e)}static deserialize(t){try{const e=JSON.parse(t);return new Mt(e)}catch(e){return console.error("Failed to deserialize preferences:",e),null}}merging(t){const e={...this};for(const i of Object.keys(t))t[i]!==void 0&&(e[i]=t[i]);return new Mt(e)}}class oA{constructor(t){this.fontFamily=Y(t.fontFamily)||null,this.fontWeight=O(t.fontWeight,q.range)||null,this.hyphens=F(t.hyphens)??null,this.iOSPatch=t.iOSPatch===!1?!1:(R.OS.iOS||R.OS.iPadOS)&&R.iOSRequest==="mobile",this.iPadOSPatch=t.iPadOSPatch===!1?!1:R.OS.iPadOS&&R.iOSRequest==="desktop",this.letterSpacing=y(t.letterSpacing)||null,this.ligatures=F(t.ligatures)??null,this.lineHeight=y(t.lineHeight)||null,this.noRuby=F(t.noRuby)??!1,this.paragraphIndent=y(t.paragraphIndent)??null,this.paragraphSpacing=y(t.paragraphSpacing)??null,this.textAlign=jt(t.textAlign,X)||null,this.textNormalization=F(t.textNormalization)??!1,this.wordSpacing=y(t.wordSpacing)||null,this.zoom=O(t.zoom,Pt.range)||1,this.experiments=Qe(t.experiments)??null}}class Ye{constructor(t,e,i){this.fontFamily=null,this.fontWeight=null,this.hyphens=null,this.iOSPatch=null,this.iPadOSPatch=null,this.letterSpacing=null,this.ligatures=null,this.lineHeight=null,this.noRuby=null,this.paragraphIndent=null,this.paragraphSpacing=null,this.textAlign=null,this.textNormalization=null,this.wordSpacing=null,i&&(this.fontFamily=t.fontFamily||e.fontFamily||null,this.fontWeight=t.fontWeight!==void 0?t.fontWeight:e.fontWeight!==void 0?e.fontWeight:null,this.hyphens=typeof t.hyphens=="boolean"?t.hyphens:e.hyphens??null,this.iOSPatch=t.iOSPatch===!1?!1:t.iOSPatch===!0?(R.OS.iOS||R.OS.iPadOS)&&R.iOSRequest==="mobile":e.iOSPatch,this.iPadOSPatch=t.iPadOSPatch===!1?!1:t.iPadOSPatch===!0?R.OS.iPadOS&&R.iOSRequest==="desktop":e.iPadOSPatch,this.letterSpacing=t.letterSpacing!==void 0?t.letterSpacing:e.letterSpacing!==void 0?e.letterSpacing:null,this.ligatures=typeof t.ligatures=="boolean"?t.ligatures:e.ligatures??null,this.lineHeight=t.lineHeight!==void 0?t.lineHeight:e.lineHeight!==void 0?e.lineHeight:null,this.noRuby=typeof t.noRuby=="boolean"?t.noRuby:e.noRuby??null,this.paragraphIndent=t.paragraphIndent!==void 0?t.paragraphIndent:e.paragraphIndent!==void 0?e.paragraphIndent:null,this.paragraphSpacing=t.paragraphSpacing!==void 0?t.paragraphSpacing:e.paragraphSpacing!==void 0?e.paragraphSpacing:null,this.textAlign=t.textAlign||e.textAlign||null,this.textNormalization=typeof t.textNormalization=="boolean"?t.textNormalization:e.textNormalization??null,this.wordSpacing=t.wordSpacing!==void 0?t.wordSpacing:e.wordSpacing!==void 0?e.wordSpacing:null),this.zoom=t.zoom!==void 0?t.zoom:e.zoom!==void 0?e.zoom:null,this.experiments=e.experiments||null}}class N{constructor({initialValue:t=null,effectiveValue:e,isEffective:i,onChange:A}){this._value=t,this._effectiveValue=e,this._isEffective=i,this._onChange=A}set value(t){this._value=t,this._onChange(this._value)}get value(){return this._value}get effectiveValue(){return this._effectiveValue}get isEffective(){return this._isEffective}clear(){this._value=null}}class z extends N{set value(t){this._value=t,this._onChange(this._value)}get value(){return this._value}get effectiveValue(){return this._effectiveValue}get isEffective(){return this._isEffective}clear(){this._value=null}toggle(){this._value=!this._value,this._onChange(this._value)}}class Ne extends N{constructor({initialValue:t=null,effectiveValue:e,isEffective:i,onChange:A,supportedValues:n}){super({initialValue:t,effectiveValue:e,isEffective:i,onChange:A}),this._supportedValues=n}set value(t){if(t&&!this._supportedValues.includes(t))throw new Error(`Value '${String(t)}' is not in the supported values for this preference.`);this._value=t,this._onChange(this._value)}get value(){return this._value}get effectiveValue(){return this._effectiveValue}get isEffective(){return this._isEffective}get supportedValues(){return this._supportedValues}clear(){this._value=null}}class U extends N{constructor({initialValue:t=null,effectiveValue:e,isEffective:i,onChange:A,supportedRange:n,step:o}){super({initialValue:t,effectiveValue:e,isEffective:i,onChange:A}),this._supportedRange=n,this._step=o,this._decimals=this._step.toString().includes(".")?this._step.toString().split(".")[1].length:0}set value(t){if(t&&(t<this._supportedRange[0]||t>this._supportedRange[1]))throw new Error(`Value '${String(t)}' is out of the supported range for this preference.`);this._value=t,this._onChange(this._value)}get value(){return this._value}get effectiveValue(){return this._effectiveValue}get isEffective(){return this._isEffective}get supportedRange(){return this._supportedRange}get step(){return this._step}increment(){this._value&&this._value<this._supportedRange[1]&&(this._value=Math.min(Math.round((this._value+this._step)*10**this._decimals)/10**this._decimals,this._supportedRange[1]),this._onChange(this._value))}decrement(){this._value&&this._value>this._supportedRange[0]&&(this._value=Math.max(Math.round((this._value-this._step)*10**this._decimals)/10**this._decimals,this._supportedRange[0]),this._onChange(this._value))}format(t){return t.toString()}clear(){this._value=null}}class xe{constructor(t,e,i){this.preferences=t,this.settings=e,this.metadata=i}clear(){this.preferences=new Mt({})}updatePreference(t,e){this.preferences[t]=e}get isDisplayTransformable(){return this.metadata?.accessibility?.feature?.some(t=>t.value===Xe.DISPLAY_TRANSFORMABILITY.value)??!1}get fontFamily(){return new N({initialValue:this.preferences.fontFamily,effectiveValue:this.settings.fontFamily||null,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("fontFamily",t||null)}})}get fontWeight(){return new U({initialValue:this.preferences.fontWeight,effectiveValue:this.settings.fontWeight||400,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("fontWeight",t||null)},supportedRange:q.range,step:q.step})}get hyphens(){return new z({initialValue:this.preferences.hyphens,effectiveValue:this.settings.hyphens||!1,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("hyphens",t||null)}})}get iOSPatch(){return new z({initialValue:this.preferences.iOSPatch,effectiveValue:this.settings.iOSPatch||!1,isEffective:!0,onChange:t=>{this.updatePreference("iOSPatch",t||null)}})}get iPadOSPatch(){return new z({initialValue:this.preferences.iPadOSPatch,effectiveValue:this.settings.iPadOSPatch||!1,isEffective:!0,onChange:t=>{this.updatePreference("iPadOSPatch",t||null)}})}get letterSpacing(){return new U({initialValue:this.preferences.letterSpacing,effectiveValue:this.settings.letterSpacing||0,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("letterSpacing",t||null)},supportedRange:Qt.range,step:Qt.step})}get ligatures(){return new z({initialValue:this.preferences.ligatures,effectiveValue:this.settings.ligatures||!0,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("ligatures",t||null)}})}get lineHeight(){return new U({initialValue:this.preferences.lineHeight,effectiveValue:this.settings.lineHeight,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("lineHeight",t||null)},supportedRange:Yt.range,step:Yt.step})}get noRuby(){return new z({initialValue:this.preferences.noRuby,effectiveValue:this.settings.noRuby||!1,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("noRuby",t||null)}})}get paragraphIndent(){return new U({initialValue:this.preferences.paragraphIndent,effectiveValue:this.settings.paragraphIndent||0,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("paragraphIndent",t||null)},supportedRange:Nt.range,step:Nt.step})}get paragraphSpacing(){return new U({initialValue:this.preferences.paragraphSpacing,effectiveValue:this.settings.paragraphSpacing||0,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("paragraphSpacing",t||null)},supportedRange:xt.range,step:xt.step})}get textAlign(){return new Ne({initialValue:this.preferences.textAlign,effectiveValue:this.settings.textAlign||X.start,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("textAlign",t||null)},supportedValues:Object.values(X)})}get textNormalization(){return new z({initialValue:this.preferences.textNormalization,effectiveValue:this.settings.textNormalization||!1,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("textNormalization",t||null)}})}get wordSpacing(){return new U({initialValue:this.preferences.wordSpacing,effectiveValue:this.settings.wordSpacing||0,isEffective:this.isDisplayTransformable,onChange:t=>{this.updatePreference("wordSpacing",t||null)},supportedRange:Tt.range,step:Tt.step})}get zoom(){return new U({initialValue:this.preferences.zoom,effectiveValue:this.settings.zoom||1,isEffective:CSS.supports("zoom","1")??!1,onChange:t=>{this.updatePreference("zoom",t||null)},supportedRange:Pt.range,step:Pt.step})}}const Ln=r=>({frameLoaded:r.frameLoaded||(()=>{}),positionChanged:r.positionChanged||(()=>{}),tap:r.tap||(()=>!1),click:r.click||(()=>!1),zoom:r.zoom||(()=>{}),scroll:r.scroll||(()=>{}),customEvent:r.customEvent||(()=>{}),handleLocator:r.handleLocator||(()=>!1),textSelected:r.textSelected||(()=>{})});class sA extends ae{constructor(t,e,i,A=void 0,n={preferences:{},defaults:{}}){if(super(),this.currentIndex=0,this._preferencesEditor=null,this.webViewport={readingOrder:[],progressions:new Map,positions:null},this.pub=e,this.container=t,this.listeners=Ln(i),this._preferences=new Mt(n.preferences),this._defaults=new oA(n.defaults),this._settings=new Ye(this._preferences,this._defaults,this.hasDisplayTransformability),this._css=new AA({rsProperties:new iA({experiments:this._settings.experiments||null}),userProperties:new ze({zoom:this._settings.zoom})}),A&&typeof A.copyWithLocations=="function"){this.currentLocation=A;const o=this.pub.readingOrder.findIndexWithHref(A.href);o>=0&&(this.currentIndex=o)}else this.currentLocation=this.createCurrentLocator()}async load(){await this.updateCSS(!1);const t=this.compileCSSProperties(this._css);this.framePool=new tA(this.container,t),await this.apply()}get settings(){return Object.freeze({...this._settings})}get preferencesEditor(){return this._preferencesEditor===null&&(this._preferencesEditor=new xe(this._preferences,this.settings,this.pub.metadata)),this._preferencesEditor}async submitPreferences(t){this._preferences=this._preferences.merging(t),await this.applyPreferences()}async applyPreferences(){this._settings=new Ye(this._preferences,this._defaults,this.hasDisplayTransformability),this._preferencesEditor!==null&&(this._preferencesEditor=new xe(this._preferences,this.settings,this.pub.metadata)),await this.updateCSS(!0)}async updateCSS(t){this._css.update(this._settings),t&&await this.commitCSS(this._css)}compileCSSProperties(t){const e={};for(const[i,A]of Object.entries(t.rsProperties.toCSSProperties()))e[i]=A;for(const[i,A]of Object.entries(t.userProperties.toCSSProperties()))e[i]=A;return e}async commitCSS(t){const e=this.compileCSSProperties(t);this.framePool.setCSSProperties(e)}get _cframes(){return this.framePool.currentFrames}get hasDisplayTransformability(){return this.pub.metadata?.accessibility?.feature?.some(t=>t.value===Xe.DISPLAY_TRANSFORMABILITY.value)??!1}eventListener(t,e){switch(t){case"_pong":this.listeners.frameLoaded(this.framePool.currentFrames[0].iframe.contentWindow),this.listeners.positionChanged(this.currentLocation);break;case"first_visible_locator":const i=at.deserialize(e);if(!i)break;this.currentLocation=new at({href:this.currentLocation.href,type:this.currentLocation.type,title:this.currentLocation.title,locations:i?.locations,text:i?.text}),this.listeners.positionChanged(this.currentLocation);break;case"text_selected":this.listeners.textSelected(e);break;case"click":case"tap":const A=e;if(A.interactiveElement){const n=new DOMParser().parseFromString(A.interactiveElement,"text/html").body.children[0];if(n.nodeType===n.ELEMENT_NODE&&n.nodeName==="A"&&n.hasAttribute("href")){const o=n.attributes.getNamedItem("href")?.value;if(o.startsWith("#"))this.go(this.currentLocation.copyWithLocations({fragments:[o.substring(1)]}),!1,()=>{});else if(o.startsWith("mailto:")||o.startsWith("tel:"))this.listeners.handleLocator(new D({href:o}).locator);else try{let s;if(o.startsWith("http://")||o.startsWith("https://"))s=o;else if(this.currentLocation.href.startsWith("http://")||this.currentLocation.href.startsWith("https://")){const h=new URL(this.currentLocation.href);s=new URL(o,h).href}else s=qt.join(qt.dirname(this.currentLocation.href),o);const a=this.pub.readingOrder.findWithHref(s);a?this.goLink(a,!1,()=>{}):(console.warn(`Internal link not found in readingOrder: ${s}`),this.listeners.handleLocator(new D({href:o}).locator))}catch(s){console.warn(`Couldn't resolve internal link for ${o}: ${s}`),this.listeners.handleLocator(new D({href:o}).locator)}}else console.log("Clicked on",n)}else if(t==="click"?this.listeners.click(A):this.listeners.tap(A))break;break;case"scroll":this.listeners.scroll(e);break;case"zoom":this.listeners.zoom(e);break;case"progress":this.syncLocation(e);break;case"log":console.log(this.framePool.currentFrames[0]?.source?.split("/")[3],...e);break;default:this.listeners.customEvent(t,e);break}}determineModules(){return Array.from(Kt.keys()).filter(e=>Hn.includes(e))}attachListener(){this.framePool.currentFrames[0]?.msg&&(this.framePool.currentFrames[0].msg.listener=(t,e)=>{this.eventListener(t,e)})}async apply(){if(await this.framePool.update(this.pub,this.currentLocation,this.determineModules()),this.attachListener(),this.pub.readingOrder.findIndexWithHref(this.currentLocation.href)<0)throw Error("Link for "+this.currentLocation.href+" not found!")}async destroy(){await this.framePool?.destroy()}async changeResource(t){if(t===0)return!1;const e=this.pub.readingOrder.findIndexWithHref(this.currentLocation.href),i=Math.max(0,Math.min(this.pub.readingOrder.items.length-1,e+t));return i===e?!1:(this.currentIndex=i,this.currentLocation=this.createCurrentLocator(),await this.apply(),!0)}updateViewport(t){this.webViewport.readingOrder=[],this.webViewport.progressions.clear(),this.webViewport.positions=null,this.currentLocation&&(this.webViewport.readingOrder.push(this.currentLocation.href),this.webViewport.progressions.set(this.currentLocation.href,t),this.currentLocation.locations?.position!==void 0&&(this.webViewport.positions=[this.currentLocation.locations.position]))}async syncLocation(t){const e=t;this.currentLocation&&(this.currentLocation=this.currentLocation.copyWithLocations({progression:e.start})),this.updateViewport(e),this.listeners.positionChanged(this.currentLocation),await this.framePool.update(this.pub,this.currentLocation,this.determineModules())}goBackward(t,e){this.changeResource(-1).then(i=>{e(i)})}goForward(t,e){this.changeResource(1).then(i=>{e(i)})}get currentLocator(){return this.currentLocation}get viewport(){return this.webViewport}get isScrollStart(){const t=this.viewport.readingOrder[0];return this.viewport.progressions.get(t)?.start===0}get isScrollEnd(){const t=this.viewport.readingOrder[this.viewport.readingOrder.length-1];return this.viewport.progressions.get(t)?.end===1}get canGoBackward(){const t=this.pub.readingOrder.items[0]?.href;return!(this.viewport.progressions.has(t)&&this.viewport.progressions.get(t)?.start===0)}get canGoForward(){const t=this.pub.readingOrder.items[this.pub.readingOrder.items.length-1]?.href;return!(this.viewport.progressions.has(t)&&this.viewport.progressions.get(t)?.end===1)}get readingProgression(){return this.pub.metadata.effectiveReadingProgression}get publication(){return this.pub}async loadLocator(t,e){let i=!1,A=typeof t.locations.getCssSelector=="function"&&t.locations.getCssSelector();if(t.text?.highlight?i=await new Promise((a,h)=>{this.framePool.currentFrames[0].msg.send("go_text",A?[t.text?.serialize(),A]:t.text?.serialize(),c=>a(c))}):A&&(i=await new Promise((a,h)=>{this.framePool.currentFrames[0].msg.send("go_text",["",A],c=>a(c))})),i){e(i);return}const n=typeof t.locations.htmlId=="function"&&t.locations.htmlId();if(n&&(i=await new Promise((a,h)=>{this.framePool.currentFrames[0].msg.send("go_id",n,c=>a(c))})),i){e(i);return}const o=t?.locations?.progression;o&&o>0?i=await new Promise((a,h)=>{this.framePool.currentFrames[0].msg.send("go_progression",o,c=>a(c))}):i=!0,e(i)}go(t,e,i){const A=t.href.split("#")[0];if(!this.pub.readingOrder.findWithHref(A))return i(this.listeners.handleLocator(t));const o=this.pub.readingOrder.findIndexWithHref(A);o>=0&&(this.currentIndex=o),this.currentLocation=this.createCurrentLocator(),this.apply().then(()=>this.loadLocator(t,s=>i(s))).then(()=>{this.attachListener()})}goLink(t,e,i){return this.go(t.locator,e,i)}createCurrentLocator(){const e=this.pub.readingOrder.items[this.currentIndex];if(!e)throw new Error("No current resource available");const A=this.currentLocation&&this.currentLocation.href===e.href&&this.currentLocation.locations.progression?this.currentLocation.locations.progression:0;return this.pub.manifest.locatorFromLink(e)||new at({href:e.href,type:e.type||"text/html",locations:new V({fragments:[],progression:A,position:this.currentIndex+1})})}}const Xn=sA,Zn='@namespace url(http://www.w3.org/1999/xhtml);@namespace epub url(http://www.idpf.org/2007/ops);@namespace m url(http://www.w3.org/1998/Math/MathML);@namespace svg url(http://www.w3.org/2000/svg);:root{--RS__viewportWidth:100%;--RS__pageGutter:0;--RS__defaultLineLength:40rem;--RS__colGap:0;--RS__colCount:1;--RS__colWidth:100vw}@page{margin:0!important}:root{position:relative;-webkit-column-width:var(--RS__colWidth);-moz-column-width:var(--RS__colWidth);column-width:var(--RS__colWidth);-webkit-column-count:var(--RS__colCount);-moz-column-count:var(--RS__colCount);column-count:var(--RS__colCount);-webkit-column-gap:var(--RS__colGap);-moz-column-gap:var(--RS__colGap);column-gap:var(--RS__colGap);-moz-column-fill:auto;column-fill:auto;width:var(--RS__viewportWidth);height:100vh;max-width:var(--RS__viewportWidth);max-height:100vh;min-width:var(--RS__viewportWidth);min-height:100vh;padding:0!important;margin:0!important;font-size:1rem!important;box-sizing:border-box;-webkit-touch-callout:none}body{width:100%;max-width:var(--RS__defaultLineLength)!important;padding:0 var(--RS__pageGutter)!important;margin:0 auto!important;box-sizing:border-box}:root:not([style*=readium-noOverflow-on]) body{overflow:hidden}@supports (overflow: clip){:root:not([style*=readium-noOverflow-on]){overflow:clip}:root:not([style*=readium-noOverflow-on]) body{overflow:clip;overflow-clip-margin:content-box}}:root[style*=readium-scroll-on]{-webkit-columns:auto auto!important;-moz-columns:auto auto!important;columns:auto auto!important;width:auto!important;height:auto!important;max-width:none!important;max-height:none!important;min-width:0!important;min-height:0!important}:root[style*=readium-scroll-on] body{max-width:var(--RS__defaultLineLength)!important;box-sizing:border-box!important}:root[style*=readium-scroll-on]:not([style*=readium-noOverflow-on]) body{overflow:auto}@supports (overflow: clip){:root[style*=readium-scroll-on]:not([style*=readium-noOverflow-on]){overflow:auto}:root[style*=readium-scroll-on]:not([style*=readium-noOverflow-on]) body{overflow:clip}}:root[style*=readium-scroll-on][style*=--RS__scrollPaddingTop] body{padding-top:var(--RS__scrollPaddingTop)!important}:root[style*=readium-scroll-on][style*=--RS__scrollPaddingBottom] body{padding-bottom:var(--RS__scrollPaddingBottom)!important}:root[style*=readium-scroll-on][style*=--RS__scrollPaddingLeft] body{padding-left:var(--RS__scrollPaddingLeft)!important}:root[style*=readium-scroll-on][style*=--RS__scrollPaddingRight] body{padding-right:var(--RS__scrollPaddingRight)!important}:root[style*=--USER__backgroundColor]{background-color:var(--USER__backgroundColor)!important}:root[style*=--USER__backgroundColor] *{background-color:transparent!important}:root[style*=--USER__textColor]{color:var(--USER__textColor)!important}:root[style*=--USER__textColor] *:not(a){color:inherit!important;background-color:transparent!important;border-color:currentcolor!important}:root[style*=--USER__textColor] svg text{fill:currentcolor!important;stroke:none!important}:root[style*=--USER__linkColor] a:link,:root[style*=--USER__linkColor] a:link *{color:var(--USER__linkColor)!important}:root[style*=--USER__visitedColor] a:visited,:root[style*=--USER__visitedColor] a:visited *{color:var(--USER__visitedColor)!important}:root[style*=--USER__selectionBackgroundColor][style*=--USER__selectionTextColor] ::-moz-selection{color:var(--USER__selectionTextColor)!important;background-color:var(--USER__selectionBackgroundColor)!important}:root[style*=--USER__selectionBackgroundColor][style*=--USER__selectionTextColor] ::selection{color:var(--USER__selectionTextColor)!important;background-color:var(--USER__selectionBackgroundColor)!important}:root[style*=--USER__colCount]{-webkit-column-count:var(--USER__colCount);-moz-column-count:var(--USER__colCount);column-count:var(--USER__colCount);--RS__colWidth:auto}:root[style*="--USER__colCount: 0"],:root[style*="--USER__colCount:0"]{-webkit-column-count:1;-moz-column-count:1;column-count:1}:root[style*="--USER__colCount: 0"],:root[style*="--USER__colCount:0"],:root[style*="--USER__colCount: 1"],:root[style*="--USER__colCount:1"]{--RS__colWidth:100vw}:root[style*=--USER__lineLength] body{max-width:var(--USER__lineLength)!important}:root[style*=--USER__textAlign]{text-align:var(--USER__textAlign)}:root[style*=--USER__textAlign] body,:root[style*=--USER__textAlign] p:not(blockquote p,figcaption p,header p,hgroup p,:root[style*=readium-experimentalHeaderFiltering-on] p[class*=title],:root[style*=readium-experimentalHeaderFiltering-on] div:has(+*)>h1+p,:root[style*=readium-experimentalHeaderFiltering-on] div:has(+*)>p:has(+h1)),:root[style*=--USER__textAlign] li,:root[style*=--USER__textAlign] dd{text-align:var(--USER__textAlign)!important;-moz-text-align-last:auto!important;-epub-text-align-last:auto!important;text-align-last:auto!important}:root[style*=--USER__bodyHyphens]{-webkit-hyphens:var(--USER__bodyHyphens)!important;-moz-hyphens:var(--USER__bodyHyphens)!important;-ms-hyphens:var(--USER__bodyHyphens)!important;-epub-hyphens:var(--USER__bodyHyphens)!important;hyphens:var(--USER__bodyHyphens)!important}:root[style*=--USER__bodyHyphens] body,:root[style*=--USER__bodyHyphens] p,:root[style*=--USER__bodyHyphens] li,:root[style*=--USER__bodyHyphens] div,:root[style*=--USER__bodyHyphens] dd{-webkit-hyphens:inherit;-moz-hyphens:inherit;-ms-hyphens:inherit;-epub-hyphens:inherit;hyphens:inherit}:root[style*=--USER__fontFamily]{font-family:var(--USER__fontFamily)!important}:root[style*=--USER__fontFamily] *{font-family:revert!important}:root[style*=AccessibleDfA]{font-family:AccessibleDfA,Verdana,Tahoma,Trebuchet MS,sans-serif!important}:root[style*="IA Writer Duospace"]{font-family:IA Writer Duospace,Menlo,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier,monospace!important}:root[style*=AccessibleDfA],:root[style*="IA Writer Duospace"],:root[style*=readium-a11y-on]{font-style:normal!important;font-weight:400!important}:root[style*=AccessibleDfA] body *:not(code):not(var):not(kbd):not(samp),:root[style*="IA Writer Duospace"] body *:not(code):not(var):not(kbd):not(samp),:root[style*=readium-a11y-on] body *:not(code):not(var):not(kbd):not(samp){font-family:inherit!important;font-style:inherit!important;font-weight:inherit!important}:root[style*=AccessibleDfA] body *:not(a),:root[style*="IA Writer Duospace"] body *:not(a),:root[style*=readium-a11y-on] body *:not(a){text-decoration:none!important}:root[style*=AccessibleDfA] body *,:root[style*="IA Writer Duospace"] body *,:root[style*=readium-a11y-on] body *{font-variant-caps:normal!important;font-variant-numeric:normal!important;font-variant-position:normal!important}:root[style*=AccessibleDfA] sup,:root[style*="IA Writer Duospace"] sup,:root[style*=readium-a11y-on] sup,:root[style*=AccessibleDfA] sub,:root[style*="IA Writer Duospace"] sub,:root[style*=readium-a11y-on] sub{font-size:1rem!important;vertical-align:baseline!important}:root:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] body{zoom:var(--USER__fontSize)!important}:root:not([style*=readium-deprecatedFontSize-on])[style*=readium-iOSPatch-on][style*=--USER__fontSize] body{-webkit-text-size-adjust:var(--USER__fontSize)!important}@supports selector(figure:has(> img)){:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] figure:has(>img),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] figure:has(>video),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] figure:has(>svg),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] figure:has(>canvas),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] figure:has(>iframe),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] figure:has(>audio),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] div:has(>img:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] div:has(>video:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] div:has(>svg:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] div:has(>canvas:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] div:has(>iframe:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] div:has(>audio:only-child),:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] table{zoom:calc(100% / var(--USER__fontSize))!important}:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] figcaption,:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] caption,:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] td,:root[style*=readium-experimentalZoom-on]:not([style*=readium-deprecatedFontSize-on]):not([style*=readium-iOSPatch-on])[style*=--USER__fontSize] th{zoom:var(--USER__fontSize)!important}}@supports not (zoom: 1){:root[style*=--USER__fontSize]{font-size:var(--USER__fontSize)!important}}:root[style*=readium-deprecatedFontSize-on][style*=--USER__fontSize]{font-size:var(--USER__fontSize)!important}:root[style*=--USER__lineHeight]{line-height:var(--USER__lineHeight)!important}:root[style*=--USER__lineHeight] body,:root[style*=--USER__lineHeight] p,:root[style*=--USER__lineHeight] li,:root[style*=--USER__lineHeight] div{line-height:inherit}:root[style*=--USER__paraSpacing] p{margin-top:var(--USER__paraSpacing)!important;margin-bottom:var(--USER__paraSpacing)!important}:root[style*=--USER__paraIndent] p:not(blockquote p,figcaption p,header p,hgroup p,:root[style*=readium-experimentalHeaderFiltering-on] p[class*=title],:root[style*=readium-experimentalHeaderFiltering-on] div:has(+*)>h1+p,:root[style*=readium-experimentalHeaderFiltering-on] div:has(+*)>p:has(+h1)){text-indent:var(--USER__paraIndent)!important}:root[style*=--USER__paraIndent] p *,:root[style*=--USER__paraIndent] p:first-letter{text-indent:0!important}:root[style*=--USER__wordSpacing] h1,:root[style*=--USER__wordSpacing] h2,:root[style*=--USER__wordSpacing] h3,:root[style*=--USER__wordSpacing] h4,:root[style*=--USER__wordSpacing] h5,:root[style*=--USER__wordSpacing] h6,:root[style*=--USER__wordSpacing] p,:root[style*=--USER__wordSpacing] li,:root[style*=--USER__wordSpacing] div,:root[style*=--USER__wordSpacing] dt,:root[style*=--USER__wordSpacing] dd{word-spacing:var(--USER__wordSpacing)}:root[style*=--USER__letterSpacing] h1,:root[style*=--USER__letterSpacing] h2,:root[style*=--USER__letterSpacing] h3,:root[style*=--USER__letterSpacing] h4,:root[style*=--USER__letterSpacing] h5,:root[style*=--USER__letterSpacing] h6,:root[style*=--USER__letterSpacing] p,:root[style*=--USER__letterSpacing] li,:root[style*=--USER__letterSpacing] div,:root[style*=--USER__letterSpacing] dt,:root[style*=--USER__letterSpacing] dd{letter-spacing:var(--USER__letterSpacing);font-variant:none}:root[style*=--USER__ligatures]{font-variant-ligatures:var(--USER__ligatures)!important}:root[style*=--USER__ligatures] *{font-variant-ligatures:inherit!important}:root[style*=--USER__fontWeight] body{font-weight:var(--USER__fontWeight)!important}:root[style*=--USER__fontWeight] b,:root[style*=--USER__fontWeight] strong{font-weight:bolder}:root[style*=--USER__fontWidth] body{font-stretch:var(--USER__fontWidth)!important}:root[style*=--USER__fontOpticalSizing] body{font-optical-sizing:var(--USER__fontOpticalSizing)!important}:root[style*=readium-blend-on] svg,:root[style*=readium-blend-on] img{background-color:transparent!important;mix-blend-mode:multiply!important}:root[style*=--USER__darkenImages] img{-webkit-filter:brightness(var(--USER__darkenImages))!important;filter:brightness(var(--USER__darkenImages))!important}:root[style*=readium-darken-on] img{-webkit-filter:brightness(80%)!important;filter:brightness(80%)!important}:root[style*=--USER__invertImages] img{-webkit-filter:invert(var(--USER__invertImages))!important;filter:invert(var(--USER__invertImages))!important}:root[style*=readium-invert-on] img{-webkit-filter:invert(100%)!important;filter:invert(100%)!important}:root[style*=--USER__darkenImages][style*=--USER__invertImages] img{-webkit-filter:brightness(var(--USER__darkenImages)) invert(var(--USER__invertImages))!important;filter:brightness(var(--USER__darkenImages)) invert(var(--USER__invertImages))!important}:root[style*=readium-darken-on][style*=--USER__invertImages] img{-webkit-filter:brightness(80%) invert(var(--USER__invertImages))!important;filter:brightness(80%) invert(var(--USER__invertImages))!important}:root[style*=--USER__darkenImages][style*=readium-invert-on] img{-webkit-filter:brightness(var(--USER__darkenImages)) invert(100%)!important;filter:brightness(var(--USER__darkenImages)) invert(100%)!important}:root[style*=readium-darken-on][style*=readium-invert-on] img{-webkit-filter:brightness(80%) invert(100%)!important;filter:brightness(80%) invert(100%)!important}:root[style*=--USER__invertGaiji] img[class*=gaiji]{-webkit-filter:invert(var(--USER__invertGaiji))!important;filter:invert(var(--USER__invertGaiji))!important}:root[style*=readium-invertGaiji-on] img[class*=gaiji]{-webkit-filter:invert(100%)!important;filter:invert(100%)!important}:root[style*=readium-normalize-on]{--USER__typeScale:1.2}:root[style*=readium-normalize-on] p,:root[style*=readium-normalize-on] li,:root[style*=readium-normalize-on] div,:root[style*=readium-normalize-on] pre,:root[style*=readium-normalize-on] dd{font-size:1rem!important}:root[style*=readium-normalize-on] h1{font-size:1.75rem!important;font-size:calc(((1rem * var(--USER__typeScale)) * var(--USER__typeScale)) * var(--USER__typeScale))!important}:root[style*=readium-normalize-on] h2{font-size:1.5rem!important;font-size:calc((1rem * var(--USER__typeScale)) * var(--USER__typeScale))!important}:root[style*=readium-normalize-on] h3{font-size:1.25rem!important;font-size:calc(1rem * var(--USER__typeScale))!important}:root[style*=readium-normalize-on] h4,:root[style*=readium-normalize-on] h5,:root[style*=readium-normalize-on] h6{font-size:1rem!important}:root[style*=readium-normalize-on] small{font-size:smaller!important}:root[style*=readium-normalize-on] sub,:root[style*=readium-normalize-on] sup{font-size:67.5%!important}:root[style*=readium-normalize-on][style*=--USER__typeScale] h1{font-size:calc(((1rem * var(--USER__typeScale)) * var(--USER__typeScale)) * var(--USER__typeScale))!important}:root[style*=readium-normalize-on][style*=--USER__typeScale] h2{font-size:calc((1rem * var(--USER__typeScale)) * var(--USER__typeScale))!important}:root[style*=readium-normalize-on][style*=--USER__typeScale] h3{font-size:calc(1rem * var(--USER__typeScale))!important}:root[style*=readium-iPadOSPatch-on] body{-webkit-text-size-adjust:none}:root[style*=readium-iPadOSPatch-on] p,:root[style*=readium-iPadOSPatch-on] h1,:root[style*=readium-iPadOSPatch-on] h2,:root[style*=readium-iPadOSPatch-on] h3,:root[style*=readium-iPadOSPatch-on] h4,:root[style*=readium-iPadOSPatch-on] h5,:root[style*=readium-iPadOSPatch-on] h6,:root[style*=readium-iPadOSPatch-on] li,:root[style*=readium-iPadOSPatch-on] th,:root[style*=readium-iPadOSPatch-on] td,:root[style*=readium-iPadOSPatch-on] dt,:root[style*=readium-iPadOSPatch-on] dd,:root[style*=readium-iPadOSPatch-on] pre,:root[style*=readium-iPadOSPatch-on] address,:root[style*=readium-iPadOSPatch-on] details,:root[style*=readium-iPadOSPatch-on] summary,:root[style*=readium-iPadOSPatch-on] figcaption,:root[style*=readium-iPadOSPatch-on] div:not(:has(p,h1,h2,h3,h4,h5,h6,li,th,td,dt,dd,pre,address,aside,details,figcaption,summary)),:root[style*=readium-iPadOSPatch-on] aside:not(:has(p,h1,h2,h3,h4,h5,h6,li,th,td,dt,dd,pre,address,aside,details,figcaption,summary)){-webkit-text-zoom:reset}:root[style*=readium-iPadOSPatch-on] abbr,:root[style*=readium-iPadOSPatch-on] b,:root[style*=readium-iPadOSPatch-on] bdi,:root[style*=readium-iPadOSPatch-on] bdo,:root[style*=readium-iPadOSPatch-on] cite,:root[style*=readium-iPadOSPatch-on] code,:root[style*=readium-iPadOSPatch-on] dfn,:root[style*=readium-iPadOSPatch-on] em,:root[style*=readium-iPadOSPatch-on] i,:root[style*=readium-iPadOSPatch-on] kbd,:root[style*=readium-iPadOSPatch-on] mark,:root[style*=readium-iPadOSPatch-on] q,:root[style*=readium-iPadOSPatch-on] rp,:root[style*=readium-iPadOSPatch-on] rt,:root[style*=readium-iPadOSPatch-on] ruby,:root[style*=readium-iPadOSPatch-on] s,:root[style*=readium-iPadOSPatch-on] samp,:root[style*=readium-iPadOSPatch-on] small,:root[style*=readium-iPadOSPatch-on] span,:root[style*=readium-iPadOSPatch-on] strong,:root[style*=readium-iPadOSPatch-on] sub,:root[style*=readium-iPadOSPatch-on] sup,:root[style*=readium-iPadOSPatch-on] time,:root[style*=readium-iPadOSPatch-on] u,:root[style*=readium-iPadOSPatch-on] var{-webkit-text-zoom:normal}:root[style*=readium-iPadOSPatch-on] p:not(:has(b,cite,em,i,q,s,small,span,strong)):first-line{-webkit-text-zoom:normal}',Kn='@namespace url(http://www.w3.org/1999/xhtml);@namespace epub url(http://www.idpf.org/2007/ops);@namespace m url(http://www.w3.org/1998/Math/MathML);@namespace svg url(http://www.w3.org/2000/svg);@-ms-viewport{width:device-width}@viewport{width:device-width;zoom:1}:root{--RS__monospaceTf:ui-monospace, "Andale Mono", "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;--RS__humanistTf:Seravek, Calibri, "Gill Sans Nova", Roboto, Ubuntu, "DejaVu Sans", source-sans-pro, sans-serif;--RS__sansTf:-ui-sans-serif, -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", "Arial Nova", "Liberation Sans", Arial, sans-serif;--RS__modernTf:Athelas, Constantia, Charter, "Bitstream Charter", Cambria, "Georgia Pro", Georgia, serif;--RS__oldStyleTf:"Iowan Old Style", Sitka, "Sitka Text", Palatino, "Book Antiqua", "URW Palladio L", P052, serif;--RS__baseFontFamily:var(--RS__oldStyleTf);--RS__lineHeightCompensation:1;--RS__baseLineHeight:calc(1.5 * var(--RS__lineHeightCompensation));--RS__selectionTextColor:inherit;--RS__selectionBackgroundColor:#b4d8fe;--RS__visitedColor:#551A8B;--RS__linkColor:#0000EE;--RS__textColor:#121212;--RS__backgroundColor:#FFFFFF;color:var(--RS__textColor)!important;background-color:var(--RS__backgroundColor)!important}::-moz-selection{color:var(--RS__selectionTextColor);background-color:var(--RS__selectionBackgroundColor)}::selection{color:var(--RS__selectionTextColor);background-color:var(--RS__selectionBackgroundColor)}html{font-family:var(--RS__baseFontFamily);line-height:1.6;line-height:var(--RS__baseLineHeight);text-rendering:optimizelegibility}h1,h2,h3{line-height:normal}:lang(ja),:lang(zh),:lang(ko){word-wrap:break-word;-webkit-line-break:strict;-epub-line-break:strict;line-break:strict}math{font-family:"Latin Modern Math","STIX Two Math","XITS Math","STIX Math","Libertinus Math","TeX Gyre Termes Math","TeX Gyre Bonum Math",TeX Gyre Schola,"DejaVu Math TeX Gyre","TeX Gyre Pagella Math","Asana Math","Cambria Math","Lucida Bright Math","Minion Math",STIXGeneral,STIXSizeOneSym,Symbol,Times New Roman,serif}:lang(am){--RS__baseFontFamily:kefa, nyala, roboto, noto, "Noto Sans Ethiopic", serif;--RS__lineHeightCompensation:1.167}:lang(ar){--RS__baseFontFamily:"Geeza Pro", "Arabic Typesetting", roboto, noto, "Noto Naskh Arabic", "Times New Roman", serif}:lang(bn){--RS__baseFontFamily:"Kohinoor Bangla", "Bangla Sangam MN", vrinda, roboto, noto, "Noto Sans Bengali", sans-serif;--RS__lineHeightCompensation:1.067}:lang(bo){--RS__baseFontFamily:kailasa, "Microsoft Himalaya", roboto, noto, "Noto Sans Tibetan", sans-serif}:lang(chr){--RS__baseFontFamily:"Plantagenet Cherokee", roboto, noto, "Noto Sans Cherokee";--RS__lineHeightCompensation:1.167}:lang(fa){--RS__baseFontFamily:"Geeza Pro", "Arabic Typesetting", roboto, noto, "Noto Naskh Arabic", "Times New Roman", serif}:lang(gu){--RS__baseFontFamily:"Gujarati Sangam MN", "Nirmala UI", shruti, roboto, noto, "Noto Sans Gujarati", sans-serif;--RS__lineHeightCompensation:1.167}:lang(he){--RS__baseFontFamily:"New Peninim MT", "Arial Hebrew", gisha, "Times New Roman", roboto, noto, "Noto Sans Hebrew" sans-serif;--RS__lineHeightCompensation:1.1}:lang(hi){--RS__baseFontFamily:"Kohinoor Devanagari", "Devanagari Sangam MN", kokila, "Nirmala UI", roboto, noto, "Noto Sans Devanagari", sans-serif;--RS__lineHeightCompensation:1.1}:lang(hy){--RS__baseFontFamily:mshtakan, sylfaen, roboto, noto, "Noto Serif Armenian", serif}:lang(iu){--RS__baseFontFamily:"Euphemia UCAS", euphemia, roboto, noto, "Noto Sans Canadian Aboriginal", sans-serif}:lang(ja){--RS__baseFontFamily:yugothic, "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo UI", "MS Gothic", roboto, noto, "Noto Sans CJK JP", sans-serif;--RS__lineHeightCompensation:1.167;--RS__serif-ja:"Hiragino Mincho ProN", "Hiragino Mincho Pro", "YuMincho", "BIZ UDPMincho", "Yu Mincho", "MS P明朝", "MS PMincho", serif;--RS__sans-serif-ja:"Hiragino Sans", "Hiragino Kaku Gothic ProN", "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ W3", "YuGothic", "Yu Gothic Medium", "BIZ UDPGothic", "Yu Gothic", "MS Pゴシック", "MS PGothic", sans-serif;--RS__serif-ja-v:"Hiragino Mincho ProN", "Hiragino Mincho Pro", "YuMincho", "BIZ UDMincho", "Yu Mincho", "MS明朝", "MS Mincho", serif;--RS__sans-serif-ja-v:"Hiragino Sans", "Hiragino Kaku Gothic ProN", "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ W3", "YuGothic", "Yu Gothic Medium", "BIZ UDGothic", "Yu Gothic", "MSゴシック", "MS Gothic", sans-serif}:lang(km){--RS__baseFontFamily:"Khmer Sangam MN", "Leelawadee UI", "Khmer UI", roboto, noto, "Noto Sans Khmer", sans-serif;--RS__lineHeightCompensation:1.067}:lang(kn){--RS__baseFontFamily:"Kannada Sangam MN", "Nirmala UI", tunga, roboto, noto, "Noto Sans Kannada", sans-serif;--RS__lineHeightCompensation:1.1}:lang(ko){--RS__baseFontFamily:"Nanum Gothic", "Apple SD Gothic Neo", "Malgun Gothic", roboto, noto, "Noto Sans CJK KR", sans-serif;--RS__lineHeightCompensation:1.167}:lang(lo){--RS__baseFontFamily:"Lao Sangam MN", "Leelawadee UI", "Lao UI", roboto, noto, "Noto Sans Lao", sans-serif}:lang(ml){--RS__baseFontFamily:"Malayalam Sangam MN", "Nirmala UI", kartika, roboto, noto, "Noto Sans Malayalam", sans-serif;--RS__lineHeightCompensation:1.067}:lang(or){--RS__baseFontFamily:"Oriya Sangam MN", "Nirmala UI", kalinga, roboto, noto, "Noto Sans Oriya", sans-serif;--RS__lineHeightCompensation:1.167}:lang(pa){--RS__baseFontFamily:"Gurmukhi MN", "Nirmala UI", kartika, roboto, noto, "Noto Sans Gurmukhi", sans-serif;--RS__lineHeightCompensation:1.1}:lang(si){--RS__baseFontFamily:"Sinhala Sangam MN", "Nirmala UI", "Iskoola Pota", roboto, noto, "Noto Sans Sinhala", sans-serif;--RS__lineHeightCompensation:1.167}:lang(ta){--RS__baseFontFamily:"Tamil Sangam MN", "Nirmala UI", latha, roboto, noto, "Noto Sans Tamil", sans-serif;--RS__lineHeightCompensation:1.067}:lang(te){--RS__baseFontFamily:"Kohinoor Telugu", "Telugu Sangam MN", "Nirmala UI", gautami, roboto, noto, "Noto Sans Telugu", sans-serif}:lang(th){--RS__baseFontFamily:"Thonburi", "Leelawadee UI", "Cordia New", roboto, noto, "Noto Sans Thai", sans-serif;--RS__lineHeightCompensation:1.067}:lang(zh){--RS__baseFontFamily:"方体", "PingFang SC", "黑体", "Heiti SC", "Microsoft JhengHei UI", "Microsoft JhengHei", roboto, noto, "Noto Sans CJK SC", sans-serif;--RS__lineHeightCompensation:1.167}:lang(zh-Hant),:lang(zh-TW){--RS__baseFontFamily:"方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", roboto, noto, "Noto Sans CJK TC", sans-serif;--RS__lineHeightCompensation:1.167}:lang(zh-HK){--RS__baseFontFamily:"方體", "PingFang HK", "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", roboto, noto, "Noto Sans CJK TC", sans-serif;--RS__lineHeightCompensation:1.167}@font-face{font-family:AccessibleDfA;font-style:normal;font-weight:400;src:local("AccessibleDfA"),url(./assets/AccessibleDfA-Regular.woff2) format("woff2"),url(./assets/AccessibleDfA-Regular.woff) format("woff")}@font-face{font-family:AccessibleDfA;font-style:normal;font-weight:700;src:local("AccessibleDfA"),url(./assets/AccessibleDfA-Bold.woff2) format("woff2")}@font-face{font-family:AccessibleDfA;font-style:italic;font-weight:400;src:local("AccessibleDfA"),url(./assets/AccessibleDfA-Italic.woff2) format("woff2")}@font-face{font-family:IA Writer Duospace;font-style:normal;font-weight:400;src:local("iAWriterDuospace-Regular"),url(./assets/iAWriterDuospace-Regular.ttf) format("truetype")}body{widows:2;orphans:2}figcaption,th,td{widows:1;orphans:1}h2,h3,h4,h5,h6,dt,hr,caption{-webkit-column-break-after:avoid;page-break-after:avoid;break-after:avoid}h1,h2,h3,h4,h5,h6,dt,figure,tr{-webkit-column-break-inside:avoid;page-break-inside:avoid;break-inside:avoid}body{-webkit-hyphenate-character:"-";-moz-hyphenate-character:"-";-ms-hyphenate-character:"-";hyphenate-character:"-";-webkit-hyphenate-limit-lines:3;-ms-hyphenate-limit-lines:3;hyphenate-limit-lines:3}h1,h2,h3,h4,h5,h6,dt,figcaption,pre,caption,address,center,code,var{-ms-hyphens:none;-moz-hyphens:none;-webkit-hyphens:none;-epub-hyphens:none;hyphens:none}body{font-variant-numeric:oldstyle-nums proportional-nums}:lang(ja) body,:lang(zh) body,:lang(ko) body{font-variant-numeric:lining-nums proportional-nums}h1,h2,h3,h4,h5,h6,dt{font-variant-numeric:lining-nums proportional-nums}table{font-variant-numeric:lining-nums tabular-nums}code,var{font-variant-ligatures:none;font-variant-numeric:lining-nums tabular-nums slashed-zero}rt{font-variant-east-asian:ruby}:lang(ar){font-variant-ligatures:common-ligatures}:lang(ko){font-kerning:normal}hr{color:inherit;border-color:currentcolor}table,th,td{border-color:currentcolor}figure,blockquote{margin:1em 5%}ul,ol{padding-left:5%}dd{margin-left:5%}pre{white-space:pre-wrap;-ms-tab-size:2;-moz-tab-size:2;-webkit-tab-size:2;tab-size:2}abbr[title],acronym[title]{text-decoration:dotted underline}nobr wbr{white-space:normal}ruby>rt,ruby>rp{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}*:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)),*:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)),*:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)),:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) cite,:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) dfn,:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) em,:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) i,:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) cite,:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) dfn,:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) em,:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) i,:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) cite,:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) dfn,:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) em,:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) i{font-style:normal}:lang(ja) a,:lang(zh) a,:lang(ko) a{text-decoration:none}:root{--RS__maxMediaWidth:100%;--RS__maxMediaHeight:95vh;--RS__boxSizingMedia:border-box;--RS__boxSizingTable:border-box}a,a span,span a,h1,h2,h3,h4,h5,h6{word-wrap:break-word}div{max-width:var(--RS__maxMediaWidth)}img,svg|svg,video{object-fit:contain;width:auto;height:auto;max-width:var(--RS__maxMediaWidth);max-height:var(--RS__maxMediaHeight)!important;box-sizing:var(--RS__boxSizingMedia);-webkit-column-break-inside:avoid;page-break-inside:avoid;break-inside:avoid}audio{max-width:100%;-webkit-column-break-inside:avoid;page-break-inside:avoid;break-inside:avoid}table{max-width:var(--RS__maxMediaWidth);box-sizing:var(--RS__boxSizingTable)}',qn="@namespace url(http://www.w3.org/1999/xhtml);@namespace epub url(http://www.idpf.org/2007/ops);@namespace m url(http://www.w3.org/1998/Math/MathML);@namespace svg url(http://www.w3.org/2000/svg);:root{--RS__compFontFamily:var(--RS__baseFontFamily);--RS__codeFontFamily:var(--RS__monospaceTf);--RS__typeScale:1.125;--RS__baseFontSize:100%;--RS__flowSpacing:1.5rem;--RS__paraSpacing:0;--RS__paraIndent:1em;--RS__linkColor:#0000EE;--RS__visitedColor:#551A8B;--RS__primaryColor:;--RS__secondaryColor:}body{font-size:var(--RS__baseFontSize)}h1,h2,h3,h4,h5,h6{font-family:var(--RS__compFontFamily)}blockquote,figure,p,pre,aside,footer,form,hr{margin-top:var(--RS__flowSpacing);margin-bottom:var(--RS__flowSpacing)}p{margin-top:var(--RS__paraSpacing);margin-bottom:var(--RS__paraSpacing);text-indent:var(--RS__paraIndent)}h1+p,h2+p,h3+p,h4+p,h5+p,h6+p,hr+p{text-indent:0}pre{font-family:var(--RS__codeFontFamily)}code,kbd,samp,tt{font-family:var(--RS__codeFontFamily)}sub,sup{position:relative;font-size:67.5%;line-height:1}sub{bottom:-.2ex}sup{bottom:0}:link{color:var(--RS__linkColor)}:visited{color:var(--RS__visitedColor)}h1{margin-top:calc(var(--RS__flowSpacing) * 2);margin-bottom:calc(var(--RS__flowSpacing) * 2);font-size:calc(((1em * var(--RS__typeScale)) * var(--RS__typeScale)) * var(--RS__typeScale))}h2{margin-top:calc(var(--RS__flowSpacing) * 2);margin-bottom:var(--RS__flowSpacing);font-size:calc((1em * var(--RS__typeScale)) * var(--RS__typeScale))}h3{margin-top:var(--RS__flowSpacing);margin-bottom:var(--RS__flowSpacing);font-size:calc(1em * var(--RS__typeScale))}h4{margin-top:var(--RS__flowSpacing);margin-bottom:var(--RS__flowSpacing);font-size:1em}h5{margin-top:var(--RS__flowSpacing);margin-bottom:var(--RS__flowSpacing);font-size:1em;font-variant:small-caps}h6{margin-top:var(--RS__flowSpacing);margin-bottom:0;font-size:1em;text-transform:lowercase;font-variant:small-caps}dl,ol,ul{margin-top:var(--RS__flowSpacing);margin-bottom:var(--RS__flowSpacing)}table{margin:var(--RS__flowSpacing) 0;border:1px solid currentcolor;border-collapse:collapse;empty-cells:show}thead,tbody,tfoot,table>tr{vertical-align:top}th{text-align:left}th,td{padding:4px;border:1px solid currentcolor}",$=(r,t)=>URL.createObjectURL(new Blob([r],{type:t})),aA=r=>r.replace(/\/\/.*/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/\n/g,"").replace(/\s+/g," "),Te=r=>r.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g,"").replace(/ {2,}/g," ").replace(/url\((?!(https?:)?\/\/)("?)\/([^\)]+)/g,`url($2${window.location.origin}/$3`),Pe=(r,t)=>{const e=r.createElement("script");return e.dataset.readium="true",e.src=t.startsWith("blob:")?t:$(t,"text/javascript"),e},be=(r,t)=>{const e=r.createElement("link");return e.dataset.readium="true",e.rel="stylesheet",e.type="text/css",e.href=t.startsWith("blob:")?t:$(t,"text/css"),e},je=new Map,Bt=(r,t)=>{if(je.has(r))return je.get(r);const e=t();return je.set(r,e),e},_n=r=>Pe(r,Bt("css-selector-generator",()=>$('!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports._readium_cssSelectorGenerator=e():t._readium_cssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t,e,n={d:(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};function r(t){return t&&t instanceof Element}function i(t="unknown problem",...e){console.warn(`CssSelectorGenerator: ${t}`,...e)}n.r(o),n.d(o,{default:()=>z,getCssSelector:()=>U}),function(t){t.NONE="none",t.DESCENDANT="descendant",t.CHILD="child"}(t||(t={})),function(t){t.id="id",t.class="class",t.tag="tag",t.attribute="attribute",t.nthchild="nthchild",t.nthoftype="nthoftype"}(e||(e={}));const c={selectors:[e.id,e.class,e.tag,e.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY};function u(t){return t instanceof RegExp}function s(t){return["string","function"].includes(typeof t)||u(t)}function l(t){return Array.isArray(t)?t.filter(s):[]}function a(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function f(t,e){if(a(t))return t.contains(e)||i("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 nto work as intended."),t;const n=e.getRootNode({composed:!1});return a(n)?(n!==document&&i("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."),n):e.ownerDocument.querySelector(":root")}function d(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function m(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function p(t){return[].concat(...t)}function h(t){const e=t.map((t=>{if(u(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(i("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return i("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function g(t,e,n){const o=Array.from(f(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function y(t,e){e=null!=e?e:function(t){return t.ownerDocument.querySelector(":root")}(t);const n=[];let o=t;for(;r(o)&&o!==e;)n.push(o),o=o.parentElement;return n}function b(t,e){return m(t.map((t=>y(t,e))))}const N={[t.NONE]:{type:t.NONE,value:""},[t.DESCENDANT]:{type:t.DESCENDANT,value:" > "},[t.CHILD]:{type:t.CHILD,value:" "}},S=new RegExp(["^$","\\\\s"].join("|")),E=new RegExp(["^$"].join("|")),w=[e.nthoftype,e.tag,e.id,e.class,e.attribute,e.nthchild],v=h(["class","id","ng-*"]);function C({nodeName:t}){return`[${t}]`}function O({nodeName:t,nodeValue:e}){return`[${t}=\'${L(e)}\']`}function T(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t},e){const n=e.tagName.toLowerCase();return!(["input","option"].includes(n)&&"value"===t||v(t))}(e,t)));return[...e.map(C),...e.map(O)]}function I(t){return(t.getAttribute("class")||"").trim().split(/\\s+/).filter((t=>!E.test(t))).map((t=>`.${L(t)}`))}function x(t){const e=t.getAttribute("id")||"",n=`#${L(e)}`,o=t.getRootNode({composed:!1});return!S.test(e)&&g([t],n,o)?[n]:[]}function j(t){const e=t.parentNode;if(e){const n=Array.from(e.childNodes).filter(r).indexOf(t);if(n>-1)return[`:nth-child(${n+1})`]}return[]}function A(t){return[L(t.tagName.toLowerCase())]}function D(t){const e=[...new Set(p(t.map(A)))];return 0===e.length||e.length>1?[]:[e[0]]}function $(t){const e=D([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${r+1})`]}return[]}function R(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){const n=[];let o=0,r=k(1);for(;r.length<=t.length&&o<e;)o+=1,n.push(r.map((e=>t[e]))),r=P(r,t.length-1);return n}function P(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return k(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?k(n+1):o}function k(t=1){return Array.from(Array(t).keys())}const _=":".charCodeAt(0).toString(16).toUpperCase(),M=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function L(t=""){var e,n;return null!==(n=null===(e=null===CSS||void 0===CSS?void 0:CSS.escape)||void 0===e?void 0:e.call(CSS,t))&&void 0!==n?n:function(t=""){return t.split("").map((t=>":"===t?`\\\\${_} `:M.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const q={tag:D,id:function(t){return 0===t.length||t.length>1?[]:x(t[0])},class:function(t){return m(t.map(I))},attribute:function(t){return m(t.map(T))},nthchild:function(t){return m(t.map(j))},nthoftype:function(t){return m(t.map($))}},F={tag:A,id:x,class:I,attribute:T,nthchild:j,nthoftype:$};function V(t){return t.includes(e.tag)||t.includes(e.nthoftype)?[...t]:[...t,e.tag]}function Y(t={}){const n=[...w];return t[e.tag]&&t[e.nthoftype]&&n.splice(n.indexOf(e.tag),1),n.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function B(t,e,n="",o){const r=function(t,e){return""===e?t:function(t,e){return[...t.map((t=>e+" "+t)),...t.map((t=>e+" > "+t))]}(t,e)}(function(t,e,n){const o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=h(n),u=h(o);return function(t){const{selectors:e,includeTag:n}=t,o=[].concat(e);return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){var n;return(null!==(n=q[e])&&void 0!==n?n:()=>[])(t)}(t,n),s=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,u),l=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(s,u);return e[n]=r?R(l,{maxResults:i}):l.map((t=>[t])),e}),{})}(t,n),r=function(t,e){return function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?R(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(V):i}(e).map((e=>function(t,e){const n={};return t.forEach((t=>{const o=e[t];o.length>0&&(n[t]=o)})),function(t={}){let e=[];return Object.entries(t).forEach((([t,n])=>{e=n.flatMap((n=>0===e.length?[{[t]:n}]:e.map((e=>Object.assign(Object.assign({},e),{[t]:n})))))})),e}(n).map(Y)}(e,t))).filter((t=>t.length>0))}(o,n),i=p(r);return[...new Set(i)]}(t,o.root,o),n);for(const e of r)if(g(t,e,o.root))return e;return null}function G(t){return{value:t,include:!1}}function W({selectors:t,operator:n}){let o=[...w];t[e.tag]&&t[e.nthoftype]&&(o=o.filter((t=>t!==e.tag)));let r="";return o.forEach((e=>{(t[e]||[]).forEach((({value:t,include:e})=>{e&&(r+=t)}))})),n.value+r}function H(n){return[":root",...y(n).reverse().map((n=>{const o=function(e,n,o=t.NONE){const r={};return n.forEach((t=>{Reflect.set(r,t,function(t,e){return F[e](t)}(e,t).map(G))})),{element:e,operator:N[o],selectors:r}}(n,[e.nthchild],t.DESCENDANT);return o.selectors.nthchild.forEach((t=>{t.include=!0})),o})).map(W)].join("")}function U(t,n={}){const o=function(t){const e=(Array.isArray(t)?t:[t]).filter(r);return[...new Set(e)]}(t),i=function(t,n={}){const o=Object.assign(Object.assign({},c),n);return{selectors:(r=o.selectors,Array.isArray(r)?r.filter((t=>{return n=e,o=t,Object.values(n).includes(o);var n,o})):[]),whitelist:l(o.whitelist),blacklist:l(o.blacklist),root:f(o.root,t),combineWithinSelector:!!o.combineWithinSelector,combineBetweenSelectors:!!o.combineBetweenSelectors,includeTag:!!o.includeTag,maxCombinations:d(o.maxCombinations),maxCandidates:d(o.maxCandidates)};var r}(o[0],n);let u="",s=i.root;function a(){return function(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...b(t,e).map((t=>[t]))];for(const t of r){const e=B(t,0,n,o);if(e)return{foundElements:t,selector:e}}return null}(o,s,u,i)}let m=a();for(;m;){const{foundElements:t,selector:e}=m;if(g(o,e,i.root))return e;s=t[0],u=e,m=a()}return o.length>1?o.map((t=>U(t,i))).join(", "):function(t){return t.map(H).join(", ")}(o)}const z=U;return o})()));',"text/javascript"))),$n=r=>Pe(r,Bt("JS-Before",()=>$(aA(`
85
- const noop=()=>{},emptyObj={},emptyPromise=()=>Promise.resolve(void 0),fakeStorage={getItem:noop,setItem:noop,removeItem:noop,clear:noop,key:noop,length:0};["localStorage","sessionStorage"].forEach((e=>Object.defineProperty(window,e,{get:()=>fakeStorage,configurable:!0}))),Object.defineProperty(document,"cookie",{get:()=>"",set:noop,configurable:!0}),Object.defineProperty(window,"indexedDB",{get:()=>{},configurable:!0}),Object.defineProperty(window,"caches",{get:()=>emptyObj,configurable:!0}),Object.defineProperty(navigator,"storage",{get:()=>({persist:emptyPromise,persisted:emptyPromise,estimate:()=>Promise.resolve({quota:0,usage:0})}),configurable:!0}),Object.defineProperty(navigator,"serviceWorker",{get:()=>({register:emptyPromise,getRegistration:emptyPromise,ready:emptyPromise()}),configurable:!0});
71
+ }`,e.document.head.appendChild(i),t.register("set_property",Q.moduleName,(n,o)=>{const s=n;xe(e,s[0],s[1]),o(!0)}),t.register("remove_property",Q.moduleName,(n,o)=>{$e(e,n),o(!0)}),t.register("first_visible_locator",Q.moduleName,(n,o)=>o(!1)),t.register("unfocus",Q.moduleName,(n,o)=>{L(e),o(!0)}),t.register(["focus","go_next","go_prev","go_id","go_end","go_start","go_text","go_progression"],Q.moduleName,(n,o)=>o(!0)),t.register("activate",Q.moduleName,(n,o)=>{this.unblock(e),o(!0)}),t.log("FixedSetup Mounted"),!0}unmount(e,t){return t.unregisterAll(Q.moduleName),e.document.getElementById(Gi)?.remove(),t.log("FixedSetup Unmounted"),super.unmount(e,t)}};Vi.moduleName="fixed_setup";let tr=Vi;const $i=class se extends Pe{wndOnErr(e){this.comms?.send("error",{message:e.message,filename:e.filename,lineno:e.lineno,colno:e.colno})}mount(e,t){return this.comms=t,e.addEventListener("error",this.wndOnErr,!1),t.register("get_properties",se.moduleName,(i,n)=>{ft(e),n(!0)}),t.register("update_properties",se.moduleName,(i,n)=>{_i(e,i),n(!0)}),t.register("set_property",se.moduleName,(i,n)=>{const o=i;xe(e,o[0],o[1]),n(!0)}),t.register("remove_property",se.moduleName,(i,n)=>{$e(e,i),n(!0)}),t.register("activate",se.moduleName,(i,n)=>{n(!0)}),t.log("WebPubSetup Mounted"),!0}unmount(e,t){return t.unregisterAll(se.moduleName),e.removeEventListener("error",this.wndOnErr),t.log("WebPubSetup Unmounted"),!0}};$i.moduleName="webpub_setup";let ir=$i;const nr=["fixed_setup","decorator","peripherals"],or=["reflowable_setup","decorator","peripherals","column_snapper","scroll_snapper"],rr=["webpub_setup","webpub_snapper","decorator","peripherals"],Ye=new Map([tr,er,ir,Zo,Qo,Bo,Jo,Ko].map(r=>[r.moduleName,r]));class pe{constructor(e=window,t=[]){this.loadedModules=[],this.wnd=e,this.comms=new yo(e);const i=[...new Set(t)];if(i.length){if(typeof e>"u")throw Error("Loader is not in a web browser");e.parent!==e&&this.comms.log("Loader is probably in a frame"),this.loadedModules=i.map(n=>{const o=this.loadModule(n);if(o)return o.mount(this.wnd,this.comms),o}).filter(n=>n!==void 0)}}loadModule(e){const t=Ye.get(e);return t===void 0?(this.comms.log(`Module "${name}" does not exist in the library`),t):new t}addModule(e){const t=this.loadModule(e);return!t||!t.mount(this.wnd,this.comms)?!1:(this.loadedModules.push(t),!0)}removeModule(e){const t=Ye.get(e);if(t===void 0)return this.comms.log(`Module "${e}" does not exist in the library`),!1;const i=this.loadedModules.findIndex(n=>n instanceof t);return i<0?!1:(this.loadedModules[i].unmount(this.wnd,this.comms),this.loadedModules.splice(i,1),!0)}destroy(){this.comms.destroy(),this.loadedModules.forEach(e=>e.unmount(this.wnd,this.comms)),this.loadedModules=[]}}const sr=1e4;class me{constructor(e,t){this.registry=new Map,this._ready=!1,this.listenerBuffer=[],this.handler=this.handle.bind(this),this.wnd=e,this.origin=t;try{this.channelId=window.crypto.randomUUID()}catch{this.channelId=at()}this.gc=setInterval(()=>{this.registry.forEach((i,n)=>{performance.now()-i.time>sr&&(console.warn(n,"event for",i.key,"was never handled!"),this.registry.delete(n))})},5e3),window.addEventListener("message",this.handler),this.send("_ping",void 0)}set listener(e){this.listenerBuffer.length>0&&this.listenerBuffer.forEach(t=>e(t[0],t[1])),this.listenerBuffer=[],this._listener=e}clearListener(){typeof this._listener=="function"&&(this._listener=void 0)}halt(){this._ready=!1,window.removeEventListener("message",this.handler),clearInterval(this.gc),this._listener=void 0,this.registry.clear()}resume(){window.addEventListener("message",this.handler),this._ready=!0}handle(e){const t=e.data;if(!t._readium){console.warn("Ignoring",t);return}if(t._channel===this.channelId)switch(t.key){case"_ack":{if(!t.id)return;const i=this.registry.get(t.id);if(!i)return;this.registry.delete(t.id),i.cb(!!t.data);return}case"_pong":this._ready=!0;default:{if(!this.ready)return;typeof this._listener=="function"?this._listener(t.key,t.data):this.listenerBuffer.push([t.key,t.data])}}}get ready(){return this._ready}send(e,t,i,n=!1,o=[]){const s=at();return i&&this.registry.set(s,{cb:i,time:performance.now(),key:e}),this.wnd.postMessage({_readium:le,_channel:this.channelId,id:s,data:t,key:e,strict:n},"/",o),s}}const ar={RS__oldStyleTf:"'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'URW Palladio L', P052, serif"},lr=16,Xi=ar.RS__oldStyleTf;class ge{constructor(e){this._optimalLineLength=null,this._canvas=document.createElement("canvas"),this._optimalChars=e.optimalChars,this._minChars=e.minChars,this._maxChars=e.maxChars,this._baseFontSize=e.baseFontSize||lr,this._fontFace=e.fontFace||Xi,this._sample=e.sample||null,this._pageGutter=e.pageGutter||0,this._letterSpacing=e.letterSpacing?Math.round(e.letterSpacing*this._baseFontSize):0,this._wordSpacing=e.wordSpacing?Math.round(e.wordSpacing*this._baseFontSize):0,this._isCJK=e.isCJK||!1,this._getRelative=e.getRelative||!1,this._padding=this._pageGutter*2,this._minDivider=this._minChars&&this._minChars<this._optimalChars?this._optimalChars/this._minChars:this._minChars===null?null:1,this._maxMultiplier=this._maxChars&&this._maxChars>this._optimalChars?this._maxChars/this._optimalChars:this._maxChars===null?null:1,this._approximatedWordSpaces=ge.approximateWordSpaces(this._optimalChars,this._sample)}updateMultipliers(){this._minDivider=this._minChars&&this._minChars<this._optimalChars?this._optimalChars/this._minChars:this._minChars===null?null:1,this._maxMultiplier=this._maxChars&&this._maxChars>this._optimalChars?this._maxChars/this._optimalChars:this._maxChars===null?null:1}update(e){e.optimalChars&&(this._optimalChars=e.optimalChars),e.minChars!==void 0&&(this._minChars=e.minChars),e.maxChars!==void 0&&(this._maxChars=e.maxChars),e.baseFontSize&&(this._baseFontSize=e.baseFontSize),e.fontFace!==void 0&&(this._fontFace=e.fontFace||Xi),e.letterSpacing&&(this._letterSpacing=e.letterSpacing),e.wordSpacing&&(this._wordSpacing=e.wordSpacing),e.isCJK!=null&&(this._isCJK=e.isCJK),e.pageGutter&&(this._pageGutter=e.pageGutter),e.getRelative&&(this._getRelative=e.getRelative),e.sample&&(this._sample=e.sample,this._approximatedWordSpaces=ge.approximateWordSpaces(this._optimalChars,this._sample)),this.updateMultipliers(),this._optimalLineLength=this.getOptimalLineLength()}get baseFontSize(){return this._baseFontSize}get minimalLineLength(){return this._optimalLineLength||(this._optimalLineLength=this.getOptimalLineLength()),this._minDivider!==null?Math.round(this._optimalLineLength/this._minDivider+this._padding)/(this._getRelative?this._baseFontSize:1):null}get maximalLineLength(){return this._optimalLineLength||(this._optimalLineLength=this.getOptimalLineLength()),this._maxMultiplier!==null?Math.round(this._optimalLineLength*this._maxMultiplier+this._padding)/(this._getRelative?this._baseFontSize:1):null}get optimalLineLength(){return this._optimalLineLength||(this._optimalLineLength=this.getOptimalLineLength()),Math.round(this._optimalLineLength+this._padding)/(this._getRelative?this._baseFontSize:1)}get all(){return this._optimalLineLength||(this._optimalLineLength=this.getOptimalLineLength()),{min:this.minimalLineLength,max:this.maximalLineLength,optimal:this.optimalLineLength,baseFontSize:this._baseFontSize}}static approximateWordSpaces(e,t){let i=0;if(t&&t.length>=e){const n=t.match(/([\s]+)/gi);i=(n?n.length:0)*(e/t.length)}return i}getLineLengthFallback(){const e=this._letterSpacing*(this._optimalChars-1),t=this._wordSpacing*this._approximatedWordSpaces;return this._optimalChars*(this._baseFontSize*.5)+e+t}getOptimalLineLength(){if(this._fontFace){if(typeof this._fontFace=="string")return this.measureText(this._fontFace);{const e=new FontFace(this._fontFace.name,`url(${this._fontFace.url})`);e.load().then(()=>(document.fonts.add(e),this.measureText(e.family)),t=>{})}}return this.getLineLengthFallback()}measureText(e){const t=this._canvas.getContext("2d");if(t&&e){let i=this._isCJK?"水".repeat(this._optimalChars):"0".repeat(this._optimalChars);if(t.font=`${this._baseFontSize}px ${e}`,this._sample&&this._sample.length>=this._optimalChars&&(i=this._sample.slice(0,this._optimalChars)),Object.hasOwn(t,"letterSpacing")&&Object.hasOwn(t,"wordSpacing"))return t.letterSpacing=this._letterSpacing.toString()+"px",t.wordSpacing=this._wordSpacing.toString()+"px",t.measureText(i).width;{const n=this._letterSpacing*(this._optimalChars-1),o=this._wordSpacing*ge.approximateWordSpaces(this._optimalChars,this._sample);return t.measureText(i).width+n+o}}else return this.getLineLengthFallback()}}const qi=()=>typeof navigator>"u"?"":navigator.userAgent||"",Yi=()=>typeof navigator>"u"?void 0:navigator.userAgentData||void 0;class Ji{constructor(){const e=Yi(),t=qi(),i=o=>(typeof o=="string"||typeof o=="number")&&o?String(o).replace(/_/g,".").split(".").map(s=>parseInt(s)||0):[],n=(o="")=>{if(!o)return[];const s=new RegExp("^.*"+o+"[ :\\/]?(\\d+([\\._]\\d+)*).*$");return s.test(t)?i(t.replace(s,"$1")):[]};this.OS=(o=>(/(macOS|Mac OS X)/.test(t)?(/\(iP(hone|od touch);/.test(t)&&(o.iOS=n("CPU (?:iPhone )?OS ")),/\(iPad;/.test(t)?o.iOS=o.iPadOS=n("CPU (?:iPhone )?OS "):/(macOS|Mac OS X) \d/.test(t)&&(document.ontouchend!==void 0?o.iOS=o.iPadOS=n():o.macOS=n("(?:macOS|Mac OS X) "))):/Windows( NT)? \d/.test(t)?o.Windows=(s=>s[0]!==6||!s[1]?s:s[1]===1?[7]:s[1]===2?[8]:[8,1])(n("Windows(?: NT)?")):/Android \d/.test(t)?o.Android=n("Android"):/CrOS/.test(t)?o.ChromeOS=n():/X11;/.test(t)&&(o.Linux=n()),o))({}),e&&e.getHighEntropyValues(["architecture","model","platform","platformVersion","uaFullVersion"]).then(o=>(s=>{const a=o.platform,l=o.platformVersion;if(!(!a||!l)){if(/^i(OS|P(hone|od touch))$/.test(a))s.iOS=i(l);else if(/^iPad(OS)?$/.test(a))s.iOS=s.iPadOS=i(l);else if(/^(macOS|(Mac )?OS X|Mac(Intel)?)$/.test(a))document.ontouchend!==void 0?s.iOS=s.iPadOS=i():s.macOS=i(l);else if(/^(Microsoft )?Windows$/.test(a))s.Windows=i(l);else if(/^(Google )?Android$/.test(a))s.Android=i(l);else if(/^((Google )?Chrome OS|CrOS)$/.test(a))s.ChromeOS=i(l);else if(/^(Linux|Ubuntu|X11)$/.test(a))s.Linux=i(l);else return;Object.keys(this.OS).forEach(h=>delete this.OS[h]),Object.assign(this.OS,s)}})({})),this.UA=(o=>{let s=!1;if(e&&Array.isArray(e.brands)){const a=e.brands.reduce((l,h)=>(l[h.brand]=[h.version*1],l),{});a["Google Chrome"]?(s=!0,o.Blink=o.Chromium=a.Chromium||[],o.Chrome=a["Google Chrome"]):a["Microsoft Edge"]?(s=!0,o.Blink=o.Chromium=a.Chromium||[],o.Edge=a["Microsoft Edge"]):a.Opera&&(s=!0,o.Blink=o.Chromium=a.Chromium||[],o.Opera=a.Opera)}return s||(/ Gecko\/\d/.test(t)?(o.Gecko=n("rv"),/ Waterfox\/\d/.test(t)?o.Waterfox=n("Waterfox"):/ Firefox\/\d/.test(t)&&(o.Firefox=n("Firefox"))):/ Edge\/\d/.test(t)?(o.EdgeHTML=n("Edge"),o.Edge=o.EdgeHTML):/ Chrom(ium|e)\/\d/.test(t)?(o.Blink=o.Chromium=(a=>a[0]?a:n("Chrome"))(n("Chromium")),/ EdgA?\/\d/.test(t)?o.Edge=(a=>a[0]?a:n("Edg"))(n("EdgA")):/ OPR\/\d/.test(t)?o.Opera=n("OPR"):/ Vivaldi\/\d/.test(t)?o.Vivaldi=n("Vivaldi"):/ Silk\/\d/.test(t)?o.Silk=n("Silk"):/ UCBrowser\/\d/.test(t)?o.UCBrowser=n("UCBrowser"):/ Phoebe\/\d/.test(t)?o.Phoebe=n("Phoebe"):o.Chrome=(a=>a[0]?a:o.Chromium)(n("Chrome"))):/ AppleWebKit\/\d/.test(t)?(o.WebKit=n("AppleWebKit"),/ CriOS \d/.test(t)?o.Chrome=n("CriOS"):/ FxiOS \d/.test(t)?o.Firefox=n("FxiOS"):/ EdgiOS\/\d/.test(t)?o.Edge=n("EdgiOS"):/ Version\/\d/.test(t)&&(o.Safari=n("Version"))):/ Trident\/\d/.test(t)&&(o.Trident=n("Trident"),o.InternetExplorer=(a=>a[0]?a:n("MSIE"))(n("rv")))),/[\[; ]FB(AN|_IAB)\//.test(t)&&(o.Facebook=n("FBAV")),/ Line\/\d/.test(t)&&(o.LINE=n("Line")),o})({}),this.Env={get:()=>[this.OS,this.UA].reduce((o,s)=>{for(const a in s)s[a]&&o.push(a);return o},[])}}}class cr extends Ji{get iOSRequest(){const e=Yi(),t=qi();if(this.OS.iOS&&!this.OS.iPadOS)return"mobile";if(this.OS.iPadOS)return/\(iPad;/.test(t)||e&&/^iPad(OS)?$/.test(e.platform)?"mobile":"desktop"}}const fe=new Ji,E=new cr;class Ki{constructor(e){this.hidden=!0,this.destroyed=!1,this.currModules=[],this.frame=document.createElement("iframe"),this.frame.classList.add("readium-navigator-iframe"),this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.position="absolute",this.frame.style.pointerEvents="none",this.frame.style.transition="visibility 0s, opacity 0.1s linear",this.frame.style.backgroundColor="#FFFFFF",this.source=e}async load(e=[]){return new Promise((t,i)=>{if(this.loader){const n=this.frame.contentWindow;if([...this.currModules].sort().join("|")===[...e].sort().join("|")){try{t(n)}catch{}return}this.comms?.halt(),this.loader.destroy(),this.loader=new pe(n,e),this.currModules=e,this.comms=void 0;try{t(n)}catch{}return}this.frame.onload=()=>{const n=this.frame.contentWindow;this.loader=new pe(n,e),this.currModules=e;try{t(n)}catch{}},this.frame.onerror=n=>{try{i(n)}catch{}},this.frame.contentWindow.location.replace(this.source)})}async destroy(){await this.hide(),this.loader?.destroy(),this.frame.remove(),this.destroyed=!0}async hide(){if(!this.destroyed){if(this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.pointerEvents="none",this.hidden=!0,this.frame.parentElement)return this.comms===void 0||!this.comms.ready?void 0:new Promise((e,t)=>{this.comms?.send("unfocus",void 0,i=>{this.comms?.halt(),e()})});this.comms?.halt()}}async show(e){if(this.destroyed)throw Error("Trying to show frame when it doesn't exist");if(!this.frame.parentElement)throw Error("Trying to show frame that is not attached to the DOM");return this.comms?this.comms.resume():this.comms=new me(this.frame.contentWindow,this.source),new Promise((t,i)=>{this.comms?.send("activate",void 0,()=>{this.comms?.send("focus",void 0,()=>{const n=()=>{this.frame.style.removeProperty("visibility"),this.frame.style.removeProperty("aria-hidden"),this.frame.style.removeProperty("opacity"),this.frame.style.removeProperty("pointer-events"),this.hidden=!1,fe.UA.WebKit&&this.comms?.send("force_webkit_recalc",void 0),t()};e!==void 0?this.comms?.send("go_progression",e,n):n()})})})}setCSSProperties(e){this.destroyed||!this.frame.contentWindow||(this.hidden&&(this.comms?this.comms?.resume():this.comms=new me(this.frame.contentWindow,this.source)),this.comms?.send("update_properties",e),this.hidden&&this.comms?.halt())}get iframe(){if(this.destroyed)throw Error("Trying to use frame when it doesn't exist");return this.frame}get realSize(){if(this.destroyed)throw Error("Trying to use frame client rect when it doesn't exist");return this.frame.getBoundingClientRect()}get window(){if(this.destroyed||!this.frame.contentWindow)throw Error("Trying to use frame window when it doesn't exist");return this.frame.contentWindow}get msg(){return this.comms}get ldr(){return this.loader}}class Zi{constructor(e,t,i){this.pool=new Map,this.blobs=new Map,this.inprogress=new Map,this.pendingUpdates=new Map,this.injector=null,this.container=e,this.currentCssProperties=t,this.injector=i}async destroy(){let e=this.inprogress.values(),t=e.next();const i=[];for(;t.value;)i.push(t.value),t=e.next();i.length>0&&await Promise.allSettled(i),this.inprogress.clear();let n=this.pool.values(),o=n.next();for(;o.value;)await o.value.destroy(),o=n.next();this.pool.clear(),this.blobs.forEach(s=>{this.injector?.releaseBlobUrl?.(s),URL.revokeObjectURL(s)}),this.blobs.clear(),this.injector?.dispose(),this.container.childNodes.forEach(s=>{(s.nodeType===Node.ELEMENT_NODE||s.nodeType===Node.TEXT_NODE)&&s.remove()})}async update(e,t,i){const n=e.readingOrder.items;let o=n.findIndex(l=>l.href===t.href);if(o<0)throw Error(`Locator not found in reading order: ${t.href}`);const s=n[o].href;this.inprogress.has(s)&&await this.inprogress.get(s);const a=new Promise(async(l,h)=>{const d=[],u=[];e.readingOrder.items.forEach((c,f)=>{f!==o&&f!==o-1&&f!==o+1&&(d.includes(c.href)||d.push(c.href)),f===o&&(u.includes(c.href)||u.push(c.href))}),d.forEach(async c=>{u.includes(c)||this.pool.has(c)&&(await this.pool.get(c)?.destroy(),this.pool.delete(c))}),this.currentBaseURL!==void 0&&e.baseURL!==this.currentBaseURL&&(this.blobs.forEach(c=>{this.injector?.releaseBlobUrl?.(c),URL.revokeObjectURL(c)}),this.blobs.clear()),this.currentBaseURL=e.baseURL;const p=async c=>{if(this.pendingUpdates.has(c)&&this.pendingUpdates.get(c)?.inPool===!1){const w=this.blobs.get(c);w&&(this.injector?.releaseBlobUrl?.(w),URL.revokeObjectURL(w),this.blobs.delete(c),this.pendingUpdates.delete(c))}if(this.pool.has(c)){const w=this.pool.get(c);if(!this.blobs.has(c))await w.destroy(),this.pool.delete(c),this.pendingUpdates.delete(c);else{await w.load(i);return}}const f=e.readingOrder.findWithHref(c);if(!f)return;if(!this.blobs.has(c)){const R=await new Qt(e,this.currentBaseURL||"",f,{cssProperties:this.currentCssProperties,injector:this.injector}).build();this.blobs.set(c,R)}const _=new Ki(this.blobs.get(c));c!==s&&await _.hide(),this.container.appendChild(_.iframe),await _.load(i),this.pool.set(c,_)};try{await Promise.all(u.map(c=>p(c)))}catch(c){h(c)}const v=this.pool.get(s);v?.source!==this._currentFrame?.source&&(await this._currentFrame?.hide(),v&&await v.load(i),v&&await v.show(t.locations.progression),this._currentFrame=v),l()});this.inprogress.set(s,a),await a,this.inprogress.delete(s)}setCSSProperties(e){if(!((i,n)=>{const o=Object.keys(i),s=Object.keys(n);if(o.length!==s.length)return!1;for(const a of o)if(i[a]!==n[a])return!1;return!0})(this.currentCssProperties||{},e)){this.currentCssProperties=e,this.pool.forEach(i=>{i.setCSSProperties(e)});for(const i of this.blobs.keys())this.pendingUpdates.set(i,{inPool:this.pool.has(i)})}}get currentFrames(){return[this._currentFrame]}get currentBounds(){const e={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0,toJSON(){return this}};return this.currentFrames.forEach(t=>{if(!t)return;const i=t.realSize;e.x=Math.min(e.x,i.x),e.y=Math.min(e.y,i.y),e.width+=i.width,e.height=Math.max(e.height,i.height),e.top=Math.min(e.top,i.top),e.right=Math.min(e.right,i.right),e.bottom=Math.min(e.bottom,i.bottom),e.left=Math.min(e.left,i.left)}),e}}var Pt,Qi;function dr(){if(Qi)return Pt;Qi=1;function r(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}function e(n,o){for(var s="",a=0,l=-1,h=0,d,u=0;u<=n.length;++u){if(u<n.length)d=n.charCodeAt(u);else{if(d===47)break;d=47}if(d===47){if(!(l===u-1||h===1))if(l!==u-1&&h===2){if(s.length<2||a!==2||s.charCodeAt(s.length-1)!==46||s.charCodeAt(s.length-2)!==46){if(s.length>2){var p=s.lastIndexOf("/");if(p!==s.length-1){p===-1?(s="",a=0):(s=s.slice(0,p),a=s.length-1-s.lastIndexOf("/")),l=u,h=0;continue}}else if(s.length===2||s.length===1){s="",a=0,l=u,h=0;continue}}o&&(s.length>0?s+="/..":s="..",a=2)}else s.length>0?s+="/"+n.slice(l+1,u):s=n.slice(l+1,u),a=u-l-1;l=u,h=0}else d===46&&h!==-1?++h:h=-1}return s}function t(n,o){var s=o.dir||o.root,a=o.base||(o.name||"")+(o.ext||"");return s?s===o.root?s+a:s+n+a:a}var i={resolve:function(){for(var o="",s=!1,a,l=arguments.length-1;l>=-1&&!s;l--){var h;l>=0?h=arguments[l]:(a===void 0&&(a=process.cwd()),h=a),r(h),h.length!==0&&(o=h+"/"+o,s=h.charCodeAt(0)===47)}return o=e(o,!s),s?o.length>0?"/"+o:"/":o.length>0?o:"."},normalize:function(o){if(r(o),o.length===0)return".";var s=o.charCodeAt(0)===47,a=o.charCodeAt(o.length-1)===47;return o=e(o,!s),o.length===0&&!s&&(o="."),o.length>0&&a&&(o+="/"),s?"/"+o:o},isAbsolute:function(o){return r(o),o.length>0&&o.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var o,s=0;s<arguments.length;++s){var a=arguments[s];r(a),a.length>0&&(o===void 0?o=a:o+="/"+a)}return o===void 0?".":i.normalize(o)},relative:function(o,s){if(r(o),r(s),o===s||(o=i.resolve(o),s=i.resolve(s),o===s))return"";for(var a=1;a<o.length&&o.charCodeAt(a)===47;++a);for(var l=o.length,h=l-a,d=1;d<s.length&&s.charCodeAt(d)===47;++d);for(var u=s.length,p=u-d,v=h<p?h:p,c=-1,f=0;f<=v;++f){if(f===v){if(p>v){if(s.charCodeAt(d+f)===47)return s.slice(d+f+1);if(f===0)return s.slice(d+f)}else h>v&&(o.charCodeAt(a+f)===47?c=f:f===0&&(c=0));break}var _=o.charCodeAt(a+f),w=s.charCodeAt(d+f);if(_!==w)break;_===47&&(c=f)}var R="";for(f=a+c+1;f<=l;++f)(f===l||o.charCodeAt(f)===47)&&(R.length===0?R+="..":R+="/..");return R.length>0?R+s.slice(d+c):(d+=c,s.charCodeAt(d)===47&&++d,s.slice(d))},_makeLong:function(o){return o},dirname:function(o){if(r(o),o.length===0)return".";for(var s=o.charCodeAt(0),a=s===47,l=-1,h=!0,d=o.length-1;d>=1;--d)if(s=o.charCodeAt(d),s===47){if(!h){l=d;break}}else h=!1;return l===-1?a?"/":".":a&&l===1?"//":o.slice(0,l)},basename:function(o,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');r(o);var a=0,l=-1,h=!0,d;if(s!==void 0&&s.length>0&&s.length<=o.length){if(s.length===o.length&&s===o)return"";var u=s.length-1,p=-1;for(d=o.length-1;d>=0;--d){var v=o.charCodeAt(d);if(v===47){if(!h){a=d+1;break}}else p===-1&&(h=!1,p=d+1),u>=0&&(v===s.charCodeAt(u)?--u===-1&&(l=d):(u=-1,l=p))}return a===l?l=p:l===-1&&(l=o.length),o.slice(a,l)}else{for(d=o.length-1;d>=0;--d)if(o.charCodeAt(d)===47){if(!h){a=d+1;break}}else l===-1&&(h=!1,l=d+1);return l===-1?"":o.slice(a,l)}},extname:function(o){r(o);for(var s=-1,a=0,l=-1,h=!0,d=0,u=o.length-1;u>=0;--u){var p=o.charCodeAt(u);if(p===47){if(!h){a=u+1;break}continue}l===-1&&(h=!1,l=u+1),p===46?s===-1?s=u:d!==1&&(d=1):s!==-1&&(d=-1)}return s===-1||l===-1||d===0||d===1&&s===l-1&&s===a+1?"":o.slice(s,l)},format:function(o){if(o===null||typeof o!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof o);return t("/",o)},parse:function(o){r(o);var s={root:"",dir:"",base:"",ext:"",name:""};if(o.length===0)return s;var a=o.charCodeAt(0),l=a===47,h;l?(s.root="/",h=1):h=0;for(var d=-1,u=0,p=-1,v=!0,c=o.length-1,f=0;c>=h;--c){if(a=o.charCodeAt(c),a===47){if(!v){u=c+1;break}continue}p===-1&&(v=!1,p=c+1),a===46?d===-1?d=c:f!==1&&(f=1):d!==-1&&(f=-1)}return d===-1||p===-1||f===0||f===1&&d===p-1&&d===u+1?p!==-1&&(u===0&&l?s.base=s.name=o.slice(1,p):s.base=s.name=o.slice(u,p)):(u===0&&l?(s.name=o.slice(1,d),s.base=o.slice(1,p)):(s.name=o.slice(u,d),s.base=o.slice(u,p)),s.ext=o.slice(d,p)),u>0?s.dir=o.slice(0,u-1):l&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};return i.posix=i,Pt=i,Pt}var Je=dr();const Ke={experimentalHeaderFiltering:{description:"Attempts to filter out paragraphs that are implicitly headings or part of headers",scope:"RS",value:"readium-experimentalHeaderFiltering-on"},experimentalZoom:{description:"Attemps to filter out elements that are sized using viewport units and should not be scaled directly e.g. tables, images, iframes, etc.",scope:"RS",value:"readium-experimentalZoom-on"}};var X=(r=>(r.start="start",r.left="left",r.right="right",r.justify="justify",r))(X||{});const ie={range:[0,100],step:1},Ce={range:[.7,4],step:.05},J={range:[100,1e3],step:100},Le={range:[50,250],step:10},Ae={range:[0,1],step:.125},Re={range:[1,2],step:.1},ne={range:[20,100],step:1},Te={range:[0,3],step:.25},ze={range:[0,3],step:.25},Oe={range:[0,2],step:.125},Me={range:[.7,4],step:.05};class Ie{constructor(){}toFlag(e){return`readium-${e}-on`}toUnitless(e){return e.toString()}toPercentage(e,t=!1){return t||e>0&&e<=1?`${Math.round(e*100)}%`:`${e}%`}toVw(e){const t=Math.round(e*100);return`${Math.min(t,100)}vw`}toVh(e){const t=Math.round(e*100);return`${Math.min(t,100)}vh`}toPx(e){return`${e}px`}toRem(e){return`${e}rem`}}class xt extends Ie{constructor(e){super(),this.a11yNormalize=e.a11yNormalize??null,this.bodyHyphens=e.bodyHyphens??null,this.fontFamily=e.fontFamily??null,this.fontWeight=e.fontWeight??null,this.iOSPatch=e.iOSPatch??null,this.iPadOSPatch=e.iPadOSPatch??null,this.letterSpacing=e.letterSpacing??null,this.ligatures=e.ligatures??null,this.lineHeight=e.lineHeight??null,this.noRuby=e.noRuby??null,this.paraIndent=e.paraIndent??null,this.paraSpacing=e.paraSpacing??null,this.textAlign=e.textAlign??null,this.wordSpacing=e.wordSpacing??null,this.zoom=e.zoom??null}toCSSProperties(){const e={};return this.a11yNormalize&&(e["--USER__a11yNormalize"]=this.toFlag("a11y")),this.bodyHyphens&&(e["--USER__bodyHyphens"]=this.bodyHyphens),this.fontFamily&&(e["--USER__fontFamily"]=this.fontFamily),this.fontWeight!=null&&(e["--USER__fontWeight"]=this.toUnitless(this.fontWeight)),this.iOSPatch&&(e["--USER__iOSPatch"]=this.toFlag("iOSPatch")),this.iPadOSPatch&&(e["--USER__iPadOSPatch"]=this.toFlag("iPadOSPatch")),this.letterSpacing!=null&&(e["--USER__letterSpacing"]=this.toRem(this.letterSpacing)),this.ligatures&&(e["--USER__ligatures"]=this.ligatures),this.lineHeight!=null&&(e["--USER__lineHeight"]=this.toUnitless(this.lineHeight)),this.noRuby&&(e["--USER__noRuby"]=this.toFlag("noRuby")),this.paraIndent!=null&&(e["--USER__paraIndent"]=this.toRem(this.paraIndent)),this.paraSpacing!=null&&(e["--USER__paraSpacing"]=this.toRem(this.paraSpacing)),this.textAlign&&(e["--USER__textAlign"]=this.textAlign),this.wordSpacing!=null&&(e["--USER__wordSpacing"]=this.toRem(this.wordSpacing)),this.zoom!==null&&(e["--USER__zoom"]=this.toPercentage(this.zoom,!0)),e}}class en extends Ie{constructor(e){super(),this.experiments=e.experiments??null}toCSSProperties(){const e={};return this.experiments&&this.experiments.forEach(t=>{e["--RS__"+t]=Ke[t].value}),e}}class tn{constructor(e){this.rsProperties=e.rsProperties,this.userProperties=e.userProperties}update(e){e.experiments&&(this.rsProperties.experiments=e.experiments);const t={a11yNormalize:e.textNormalization,bodyHyphens:typeof e.hyphens!="boolean"?null:e.hyphens?"auto":"none",fontFamily:e.fontFamily,fontWeight:e.fontWeight,iOSPatch:e.iOSPatch,iPadOSPatch:e.iPadOSPatch,letterSpacing:e.letterSpacing,ligatures:typeof e.ligatures!="boolean"?null:e.ligatures?"common-ligatures":"none",lineHeight:e.lineHeight,noRuby:e.noRuby,paraIndent:e.paragraphIndent,paraSpacing:e.paragraphSpacing,textAlign:e.textAlign,wordSpacing:e.wordSpacing,zoom:e.zoom};this.userProperties=new xt(t)}}function nn(r,e){return r==null||e==null||r<=e?r:void 0}function on(r,e){return r==null||e==null||r>=e?r:void 0}function T(r){return typeof r=="string"?r:r===null?null:void 0}function P(r){return typeof r=="boolean"||r==null?r:void 0}function Fe(r,e){if(r!==void 0)return r===null?null:e[r]!==void 0?r:void 0}function oe(r){return typeof r=="boolean"||typeof r=="number"&&r>=0?r:r===null?null:void 0}function k(r){if(r!==void 0)return r===null?null:r<0?void 0:r}function V(r,e){if(r===void 0)return;if(r===null)return null;const t=Math.min(...e),i=Math.max(...e);return r>=t&&r<=i?r:void 0}function Ze(r,e){return r===void 0?e:r}function Et(r){if(r!==void 0)return r===null?null:r.filter(e=>e in Ke)}class be{constructor(e={}){this.fontFamily=T(e.fontFamily),this.fontWeight=V(e.fontWeight,J.range),this.hyphens=P(e.hyphens),this.iOSPatch=P(e.iOSPatch),this.iPadOSPatch=P(e.iPadOSPatch),this.letterSpacing=k(e.letterSpacing),this.ligatures=P(e.ligatures),this.lineHeight=k(e.lineHeight),this.noRuby=P(e.noRuby),this.paragraphIndent=k(e.paragraphIndent),this.paragraphSpacing=k(e.paragraphSpacing),this.textAlign=Fe(e.textAlign,X),this.textNormalization=P(e.textNormalization),this.wordSpacing=k(e.wordSpacing),this.zoom=V(e.zoom,Me.range)}static serialize(e){const{...t}=e;return JSON.stringify(t)}static deserialize(e){try{const t=JSON.parse(e);return new be(t)}catch(t){return console.error("Failed to deserialize preferences:",t),null}}merging(e){const t={...this};for(const i of Object.keys(e))e[i]!==void 0&&(t[i]=e[i]);return new be(t)}}class rn{constructor(e){this.fontFamily=T(e.fontFamily)||null,this.fontWeight=V(e.fontWeight,J.range)||null,this.hyphens=P(e.hyphens)??null,this.iOSPatch=e.iOSPatch===!1?!1:(E.OS.iOS||E.OS.iPadOS)&&E.iOSRequest==="mobile",this.iPadOSPatch=e.iPadOSPatch===!1?!1:E.OS.iPadOS&&E.iOSRequest==="desktop",this.letterSpacing=k(e.letterSpacing)||null,this.ligatures=P(e.ligatures)??null,this.lineHeight=k(e.lineHeight)||null,this.noRuby=P(e.noRuby)??!1,this.paragraphIndent=k(e.paragraphIndent)??null,this.paragraphSpacing=k(e.paragraphSpacing)??null,this.textAlign=Fe(e.textAlign,X)||null,this.textNormalization=P(e.textNormalization)??!1,this.wordSpacing=k(e.wordSpacing)||null,this.zoom=V(e.zoom,Me.range)||1,this.experiments=Et(e.experiments)??null}}class Ct{constructor(e,t,i){this.fontFamily=null,this.fontWeight=null,this.hyphens=null,this.iOSPatch=null,this.iPadOSPatch=null,this.letterSpacing=null,this.ligatures=null,this.lineHeight=null,this.noRuby=null,this.paragraphIndent=null,this.paragraphSpacing=null,this.textAlign=null,this.textNormalization=null,this.wordSpacing=null,i&&(this.fontFamily=e.fontFamily||t.fontFamily||null,this.fontWeight=e.fontWeight!==void 0?e.fontWeight:t.fontWeight!==void 0?t.fontWeight:null,this.hyphens=typeof e.hyphens=="boolean"?e.hyphens:t.hyphens??null,this.iOSPatch=e.iOSPatch===!1?!1:e.iOSPatch===!0?(E.OS.iOS||E.OS.iPadOS)&&E.iOSRequest==="mobile":t.iOSPatch,this.iPadOSPatch=e.iPadOSPatch===!1?!1:e.iPadOSPatch===!0?E.OS.iPadOS&&E.iOSRequest==="desktop":t.iPadOSPatch,this.letterSpacing=e.letterSpacing!==void 0?e.letterSpacing:t.letterSpacing!==void 0?t.letterSpacing:null,this.ligatures=typeof e.ligatures=="boolean"?e.ligatures:t.ligatures??null,this.lineHeight=e.lineHeight!==void 0?e.lineHeight:t.lineHeight!==void 0?t.lineHeight:null,this.noRuby=typeof e.noRuby=="boolean"?e.noRuby:t.noRuby??null,this.paragraphIndent=e.paragraphIndent!==void 0?e.paragraphIndent:t.paragraphIndent!==void 0?t.paragraphIndent:null,this.paragraphSpacing=e.paragraphSpacing!==void 0?e.paragraphSpacing:t.paragraphSpacing!==void 0?t.paragraphSpacing:null,this.textAlign=e.textAlign||t.textAlign||null,this.textNormalization=typeof e.textNormalization=="boolean"?e.textNormalization:t.textNormalization??null,this.wordSpacing=e.wordSpacing!==void 0?e.wordSpacing:t.wordSpacing!==void 0?t.wordSpacing:null),this.zoom=e.zoom!==void 0?e.zoom:t.zoom!==void 0?t.zoom:null,this.experiments=t.experiments||null}}class z{constructor({initialValue:e=null,effectiveValue:t,isEffective:i,onChange:n}){this._value=e,this._effectiveValue=t,this._isEffective=i,this._onChange=n}set value(e){this._value=e,this._onChange(this._value)}get value(){return this._value}get effectiveValue(){return this._effectiveValue}get isEffective(){return this._isEffective}clear(){this._value=null}}class A extends z{set value(e){this._value=e,this._onChange(this._value)}get value(){return this._value}get effectiveValue(){return this._effectiveValue}get isEffective(){return this._isEffective}clear(){this._value=null}toggle(){this._value=!this._value,this._onChange(this._value)}}class Lt extends z{constructor({initialValue:e=null,effectiveValue:t,isEffective:i,onChange:n,supportedValues:o}){super({initialValue:e,effectiveValue:t,isEffective:i,onChange:n}),this._supportedValues=o}set value(e){if(e&&!this._supportedValues.includes(e))throw new Error(`Value '${String(e)}' is not in the supported values for this preference.`);this._value=e,this._onChange(this._value)}get value(){return this._value}get effectiveValue(){return this._effectiveValue}get isEffective(){return this._isEffective}get supportedValues(){return this._supportedValues}clear(){this._value=null}}class x extends z{constructor({initialValue:e=null,effectiveValue:t,isEffective:i,onChange:n,supportedRange:o,step:s}){super({initialValue:e,effectiveValue:t,isEffective:i,onChange:n}),this._supportedRange=o,this._step=s,this._decimals=this._step.toString().includes(".")?this._step.toString().split(".")[1].length:0}set value(e){if(e&&(e<this._supportedRange[0]||e>this._supportedRange[1]))throw new Error(`Value '${String(e)}' is out of the supported range for this preference.`);this._value=e,this._onChange(this._value)}get value(){return this._value}get effectiveValue(){return this._effectiveValue}get isEffective(){return this._isEffective}get supportedRange(){return this._supportedRange}get step(){return this._step}increment(){this._value&&this._value<this._supportedRange[1]&&(this._value=Math.min(Math.round((this._value+this._step)*10**this._decimals)/10**this._decimals,this._supportedRange[1]),this._onChange(this._value))}decrement(){this._value&&this._value>this._supportedRange[0]&&(this._value=Math.max(Math.round((this._value-this._step)*10**this._decimals)/10**this._decimals,this._supportedRange[0]),this._onChange(this._value))}format(e){return e.toString()}clear(){this._value=null}}class At{constructor(e,t,i){this.preferences=e,this.settings=t,this.metadata=i}clear(){this.preferences=new be({})}updatePreference(e,t){this.preferences[e]=t}get isDisplayTransformable(){return this.metadata?.accessibility?.feature?.some(e=>e.value===jt.DISPLAY_TRANSFORMABILITY.value)??!1}get fontFamily(){return new z({initialValue:this.preferences.fontFamily,effectiveValue:this.settings.fontFamily||null,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("fontFamily",e||null)}})}get fontWeight(){return new x({initialValue:this.preferences.fontWeight,effectiveValue:this.settings.fontWeight||400,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("fontWeight",e||null)},supportedRange:J.range,step:J.step})}get hyphens(){return new A({initialValue:this.preferences.hyphens,effectiveValue:this.settings.hyphens||!1,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("hyphens",e||null)}})}get iOSPatch(){return new A({initialValue:this.preferences.iOSPatch,effectiveValue:this.settings.iOSPatch||!1,isEffective:!0,onChange:e=>{this.updatePreference("iOSPatch",e||null)}})}get iPadOSPatch(){return new A({initialValue:this.preferences.iPadOSPatch,effectiveValue:this.settings.iPadOSPatch||!1,isEffective:!0,onChange:e=>{this.updatePreference("iPadOSPatch",e||null)}})}get letterSpacing(){return new x({initialValue:this.preferences.letterSpacing,effectiveValue:this.settings.letterSpacing||0,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("letterSpacing",e||null)},supportedRange:Ae.range,step:Ae.step})}get ligatures(){return new A({initialValue:this.preferences.ligatures,effectiveValue:this.settings.ligatures||!0,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("ligatures",e||null)}})}get lineHeight(){return new x({initialValue:this.preferences.lineHeight,effectiveValue:this.settings.lineHeight,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("lineHeight",e||null)},supportedRange:Re.range,step:Re.step})}get noRuby(){return new A({initialValue:this.preferences.noRuby,effectiveValue:this.settings.noRuby||!1,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("noRuby",e||null)}})}get paragraphIndent(){return new x({initialValue:this.preferences.paragraphIndent,effectiveValue:this.settings.paragraphIndent||0,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("paragraphIndent",e||null)},supportedRange:Te.range,step:Te.step})}get paragraphSpacing(){return new x({initialValue:this.preferences.paragraphSpacing,effectiveValue:this.settings.paragraphSpacing||0,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("paragraphSpacing",e||null)},supportedRange:ze.range,step:ze.step})}get textAlign(){return new Lt({initialValue:this.preferences.textAlign,effectiveValue:this.settings.textAlign||X.start,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("textAlign",e||null)},supportedValues:Object.values(X)})}get textNormalization(){return new A({initialValue:this.preferences.textNormalization,effectiveValue:this.settings.textNormalization||!1,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("textNormalization",e||null)}})}get wordSpacing(){return new x({initialValue:this.preferences.wordSpacing,effectiveValue:this.settings.wordSpacing||0,isEffective:this.isDisplayTransformable,onChange:e=>{this.updatePreference("wordSpacing",e||null)},supportedRange:Oe.range,step:Oe.step})}get zoom(){return new x({initialValue:this.preferences.zoom,effectiveValue:this.settings.zoom||1,isEffective:CSS.supports("zoom","1")??!1,onChange:e=>{this.updatePreference("zoom",e||null)},supportedRange:Me.range,step:Me.step})}}const sn=r=>{if("blob"in r&&r.blob.type)return r.blob.type;if(r.as==="script")return"text/javascript";if(r.as==="link"&&"url"in r){const e=r.url.toLowerCase();if(e.endsWith(".css"))return"text/css";if([".js",".mjs",".cjs"].some(t=>e.endsWith(t)))return"text/javascript"}},an=(r,e)=>{e.attributes&&Object.entries(e.attributes).forEach(([t,i])=>{t==="type"||t==="rel"||t==="href"||t==="src"||i!=null&&(typeof i=="boolean"?i&&r.setAttribute(t,""):r.setAttribute(t,i))})},hr=(r,e,t)=>{const i=r.createElement("script");i.dataset.readium="true",e.id&&(i.id=e.id);const n=e.type||sn(e);return n&&(i.type=n),an(i,e),i.src=t,i},ln=(r,e,t)=>{const i=r.createElement("link");i.dataset.readium="true",e.id&&(i.id=e.id),e.rel&&(i.rel=e.rel);const n=e.type||sn(e);return n&&(i.type=n),an(i,e),i.href=t,i};class Rt{constructor(e){this.blobStore=new Map,this.createdBlobUrls=new Set,this.allowedDomains=[],this.injectableIdCounter=0,this.allowedDomains=(e.allowedDomains||[]).map(t=>{try{return new URL(t),t}catch{throw new Error(`Invalid allowed domain: "${t}". Must be a valid URL (e.g., "https://fonts.googleapis.com").`)}}),this.rules=e.rules.map(t=>{const i={...t};return t.prepend&&(i.prepend=t.prepend.map(n=>({...n,id:n.id||`injectable-${this.injectableIdCounter++}`})).reverse()),t.append&&(i.append=t.append.map(n=>({...n,id:n.id||`injectable-${this.injectableIdCounter++}`}))),i})}dispose(){for(const e of this.createdBlobUrls)try{URL.revokeObjectURL(e)}catch(t){console.warn("Failed to revoke blob URL:",e,t)}this.createdBlobUrls.clear()}getAllowedDomains(){return[...this.allowedDomains]}async injectForDocument(e,t){for(const i of this.rules)this.matchesRule(i,t)&&await this.applyRule(e,i)}matchesRule(e,t){const i=t.href;return e.resources.some(n=>n instanceof RegExp?n.test(i):i===n)}async getOrCreateBlobUrl(e){const t=e.id;if(this.blobStore.has(t)){const i=this.blobStore.get(t);return i.refCount++,i.url}if("blob"in e){const i=URL.createObjectURL(e.blob);return this.blobStore.set(t,{url:i,refCount:1}),this.createdBlobUrls.add(i),i}throw new Error("Resource must have a blob property")}async releaseBlobUrl(e){if(!this.createdBlobUrls.has(e))return;const t=Array.from(this.blobStore.values()).find(i=>i.url===e);if(t&&(t.refCount--,t.refCount<=0)){URL.revokeObjectURL(e),this.createdBlobUrls.delete(e);for(const[i,n]of this.blobStore.entries())if(n.url===e){this.blobStore.delete(i);break}}}async getResourceUrl(e,t){if("url"in e){const i=new URL(e.url,t.baseURI).toString();if(!this.isValidUrl(i,t))throw new Error(`Invalid URL: Only HTTPS, data:, blob:, or localhost HTTP URLs are allowed. Got: ${e.url}`);return i}else return this.getOrCreateBlobUrl(e)}createPreloadLink(e,t,i){if(t.as!=="link"||t.rel!=="preload")return;const n={...t,rel:"preload",attributes:{...t.attributes,as:t.as}},o=ln(e,n,i);e.head.appendChild(o)}createElement(e,t,i){if(t.as==="script")return hr(e,t,i);if(t.as==="link")return ln(e,t,i);throw new Error(`Unsupported element type: ${t.as}`)}async applyRule(e,t){const i=[],n=t.prepend?t.prepend.filter(s=>!s.condition||s.condition(e)):[],o=t.append?t.append.filter(s=>!s.condition||s.condition(e)):[];try{for(const s of n)await this.processInjectable(s,e,i,"prepend");for(const s of o)await this.processInjectable(s,e,i,"append")}catch(s){for(const{element:a,url:l}of i)try{a.remove(),await this.releaseBlobUrl(l)}catch(h){console.error("Error during cleanup:",h)}throw s}}async processInjectable(e,t,i,n){const o=e.target==="body"?t.body:t.head;if(!o)return;let s=null;try{if(s=await this.getResourceUrl(e,t),e.rel==="preload"&&"url"in e)this.createPreloadLink(t,e,s);else{const a=this.createElement(t,e,s);i.push({element:a,url:s}),n==="prepend"?o.prepend(a):o.append(a)}}catch(a){throw console.error("Failed to process resource:",a),s&&"blob"in e&&await this.releaseBlobUrl(s),a}}isValidUrl(e,t){try{const i=new URL(e,t.baseURI);if(i.protocol==="data:"||i.protocol==="blob:"&&this.createdBlobUrls.has(e))return!0;if(this.allowedDomains.length>0){const n=i.origin;return this.allowedDomains.some(o=>{const s=new URL(o).origin;return n===s})}return!1}catch{return!1}}}const ye=r=>r.replace(/\/\/.*/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/\n/g,"").replace(/\s+/g," "),Qe=r=>r.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g,"").replace(/ {2,}/g," "),ur=`/*!
72
+ * Readium CSS v.2.0.0-beta.24
73
+ * Copyright (c) 2017–2025. Readium Foundation. All rights reserved.
74
+ * Use of this source code is governed by a BSD-style license which is detailed in the
75
+ * LICENSE file present in the project repository where this source code is maintained.
76
+ * Core maintainer: Jiminy Panoz <jiminy.panoz@edrlab.org>
77
+ * Contributors:
78
+ * Daniel Weck
79
+ * Hadrien Gardeur
80
+ * Innovimax
81
+ * L. Le Meur
82
+ * Mickaël Menu
83
+ * k_taka
84
+ */
86
85
 
87
- window._readium_blockedEvents = [];
88
- window._readium_blockEvents = true;
89
- window._readium_eventBlocker = (e) => {
90
- if(!window._readium_blockEvents) return;
91
- e.preventDefault();
92
- e.stopImmediatePropagation();
93
- _readium_blockedEvents.push([
94
- 1, e, e.currentTarget || e.target
95
- ]);
96
- };
97
- window.addEventListener("DOMContentLoaded", window._readium_eventBlocker, true);
98
- window.addEventListener("load", window._readium_eventBlocker, true);`),"text/javascript"))),tr=r=>Pe(r,Bt("JS-After",()=>$(aA(`
86
+ :root[style*="--USER__textAlign"]{
87
+ text-align:var(--USER__textAlign);
88
+ }
89
+
90
+ :root[style*="--USER__textAlign"] body,
91
+ :root[style*="--USER__textAlign"] p:not(
92
+ blockquote p,
93
+ figcaption p,
94
+ header p,
95
+ hgroup p,
96
+ :root[style*="readium-experimentalHeaderFiltering-on"] p[class*="title"],
97
+ :root[style*="readium-experimentalHeaderFiltering-on"] div:has(+ *) > h1 + p,
98
+ :root[style*="readium-experimentalHeaderFiltering-on"] div:has(+ *) > p:has(+ h1)
99
+ ),
100
+ :root[style*="--USER__textAlign"] li,
101
+ :root[style*="--USER__textAlign"] dd{
102
+ text-align:var(--USER__textAlign) !important;
103
+ -moz-text-align-last:auto !important;
104
+ -epub-text-align-last:auto !important;
105
+ text-align-last:auto !important;
106
+ }
107
+
108
+ :root[style*="--USER__bodyHyphens"]{
109
+ -webkit-hyphens:var(--USER__bodyHyphens) !important;
110
+ -moz-hyphens:var(--USER__bodyHyphens) !important;
111
+ -ms-hyphens:var(--USER__bodyHyphens) !important;
112
+ -epub-hyphens:var(--USER__bodyHyphens) !important;
113
+ hyphens:var(--USER__bodyHyphens) !important;
114
+ }
115
+
116
+ :root[style*="--USER__bodyHyphens"] body,
117
+ :root[style*="--USER__bodyHyphens"] p,
118
+ :root[style*="--USER__bodyHyphens"] li,
119
+ :root[style*="--USER__bodyHyphens"] div,
120
+ :root[style*="--USER__bodyHyphens"] dd{
121
+ -webkit-hyphens:inherit;
122
+ -moz-hyphens:inherit;
123
+ -ms-hyphens:inherit;
124
+ -epub-hyphens:inherit;
125
+ hyphens:inherit;
126
+ }
127
+
128
+ :root[style*="--USER__fontFamily"]{
129
+ font-family:var(--USER__fontFamily) !important;
130
+ }
131
+
132
+ :root[style*="--USER__fontFamily"] *{
133
+ font-family:revert !important;
134
+ }
135
+
136
+ :root[style*="AccessibleDfA"]{
137
+ font-family:AccessibleDfA, Verdana, Tahoma, "Trebuchet MS", sans-serif !important;
138
+ }
139
+
140
+ :root[style*="IA Writer Duospace"]{
141
+ font-family:"IA Writer Duospace", Menlo, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", Courier, monospace !important;
142
+ }
143
+
144
+ :root[style*="AccessibleDfA"],:root[style*="IA Writer Duospace"],
145
+ :root[style*="readium-a11y-on"]{
146
+ font-style:normal !important;
147
+ font-weight:normal !important;
148
+ }
149
+
150
+ :root[style*="AccessibleDfA"] body *:not(code):not(var):not(kbd):not(samp),:root[style*="IA Writer Duospace"] body *:not(code):not(var):not(kbd):not(samp),
151
+ :root[style*="readium-a11y-on"] body *:not(code):not(var):not(kbd):not(samp){
152
+ font-family:inherit !important;
153
+ font-style:inherit !important;
154
+ font-weight:inherit !important;
155
+ }
156
+
157
+ :root[style*="AccessibleDfA"] body *:not(a),:root[style*="IA Writer Duospace"] body *:not(a),
158
+ :root[style*="readium-a11y-on"] body *:not(a){
159
+ text-decoration:none !important;
160
+ }
161
+
162
+ :root[style*="AccessibleDfA"] body *,:root[style*="IA Writer Duospace"] body *,
163
+ :root[style*="readium-a11y-on"] body *{
164
+ font-variant-caps:normal !important;
165
+ font-variant-numeric:normal !important;
166
+ font-variant-position:normal !important;
167
+ }
168
+
169
+ :root[style*="AccessibleDfA"] sup,:root[style*="IA Writer Duospace"] sup,
170
+ :root[style*="readium-a11y-on"] sup,
171
+ :root[style*="AccessibleDfA"] sub,
172
+ :root[style*="IA Writer Duospace"] sub,
173
+ :root[style*="readium-a11y-on"] sub{
174
+ font-size:1rem !important;
175
+ vertical-align:baseline !important;
176
+ }
177
+
178
+ :root:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] body{
179
+ zoom:var(--USER__zoom) !important;
180
+ }
181
+
182
+ :root[style*="readium-iOSPatch-on"][style*="--USER__zoom"] body{
183
+ -webkit-text-size-adjust:var(--USER__zoom) !important;
184
+ }
185
+
186
+ @supports selector(figure:has(> img)){
187
+
188
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] figure:has(> img),
189
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] figure:has(> video),
190
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] figure:has(> svg),
191
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] figure:has(> canvas),
192
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] figure:has(> iframe),
193
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] figure:has(> audio),
194
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] div:has(> img:only-child),
195
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] div:has(> video:only-child),
196
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] div:has(> svg:only-child),
197
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] div:has(> canvas:only-child),
198
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] div:has(> iframe:only-child),
199
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] div:has(> audio:only-child),
200
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] table{
201
+ zoom:calc(100% / var(--USER__zoom)) !important;
202
+ }
203
+
204
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] figcaption,
205
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] caption,
206
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] td,
207
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-iOSPatch-on"])[style*="--USER__zoom"] th{
208
+ zoom:var(--USER__zoom) !important;
209
+ }
210
+ }
211
+
212
+ :root[style*="--USER__lineHeight"]{
213
+ line-height:var(--USER__lineHeight) !important;
214
+ }
215
+
216
+ :root[style*="--USER__lineHeight"] body,
217
+ :root[style*="--USER__lineHeight"] p,
218
+ :root[style*="--USER__lineHeight"] li,
219
+ :root[style*="--USER__lineHeight"] div{
220
+ line-height:inherit;
221
+ }
222
+
223
+ :root[style*="--USER__paraSpacing"] p{
224
+ margin-top:var(--USER__paraSpacing) !important;
225
+ margin-bottom:var(--USER__paraSpacing) !important;
226
+ }
227
+
228
+ :root[style*="--USER__paraIndent"] p:not(
229
+ blockquote p,
230
+ figcaption p,
231
+ header p,
232
+ hgroup p,
233
+ :root[style*="readium-experimentalHeaderFiltering-on"] p[class*="title"],
234
+ :root[style*="readium-experimentalHeaderFiltering-on"] div:has(+ *) > h1 + p,
235
+ :root[style*="readium-experimentalHeaderFiltering-on"] div:has(+ *) > p:has(+ h1)
236
+ ){
237
+ text-indent:var(--USER__paraIndent) !important;
238
+ }
239
+
240
+ :root[style*="--USER__paraIndent"] p *,
241
+ :root[style*="--USER__paraIndent"] p:first-letter{
242
+ text-indent:0 !important;
243
+ }
244
+
245
+ :root[style*="--USER__wordSpacing"] h1,
246
+ :root[style*="--USER__wordSpacing"] h2,
247
+ :root[style*="--USER__wordSpacing"] h3,
248
+ :root[style*="--USER__wordSpacing"] h4,
249
+ :root[style*="--USER__wordSpacing"] h5,
250
+ :root[style*="--USER__wordSpacing"] h6,
251
+ :root[style*="--USER__wordSpacing"] p,
252
+ :root[style*="--USER__wordSpacing"] li,
253
+ :root[style*="--USER__wordSpacing"] div,
254
+ :root[style*="--USER__wordSpacing"] dt,
255
+ :root[style*="--USER__wordSpacing"] dd{
256
+ word-spacing:var(--USER__wordSpacing);
257
+ }
258
+
259
+ :root[style*="--USER__letterSpacing"] h1,
260
+ :root[style*="--USER__letterSpacing"] h2,
261
+ :root[style*="--USER__letterSpacing"] h3,
262
+ :root[style*="--USER__letterSpacing"] h4,
263
+ :root[style*="--USER__letterSpacing"] h5,
264
+ :root[style*="--USER__letterSpacing"] h6,
265
+ :root[style*="--USER__letterSpacing"] p,
266
+ :root[style*="--USER__letterSpacing"] li,
267
+ :root[style*="--USER__letterSpacing"] div,
268
+ :root[style*="--USER__letterSpacing"] dt,
269
+ :root[style*="--USER__letterSpacing"] dd{
270
+ letter-spacing:var(--USER__letterSpacing);
271
+ font-variant:none;
272
+ }
273
+
274
+ :root[style*="--USER__fontWeight"] body{
275
+ font-weight:var(--USER__fontWeight) !important;
276
+ }
277
+
278
+ :root[style*="--USER__fontWeight"] b,
279
+ :root[style*="--USER__fontWeight"] strong{
280
+ font-weight:bolder;
281
+ }
282
+
283
+ :root[style*="--USER__fontWidth"] body{
284
+ font-stretch:var(--USER__fontWidth) !important;
285
+ }
286
+
287
+ :root[style*="--USER__fontOpticalSizing"] body{
288
+ font-optical-sizing:var(--USER__fontOpticalSizing) !important;
289
+ }
290
+
291
+ :root[style*="readium-noRuby-on"] body rt,
292
+ :root[style*="readium-noRuby-on"] body rp{
293
+ display:none;
294
+ }
295
+
296
+ :root[style*="--USER__ligatures"]{
297
+ font-variant-ligatures:var(--USER__ligatures) !important;
298
+ }
299
+
300
+ :root[style*="--USER__ligatures"] *{
301
+ font-variant-ligatures:inherit !important;
302
+ }
303
+
304
+ :root[style*="readium-iPadOSPatch-on"] body{
305
+ -webkit-text-size-adjust:none;
306
+ }
307
+
308
+ :root[style*="readium-iPadOSPatch-on"] p,
309
+ :root[style*="readium-iPadOSPatch-on"] h1,
310
+ :root[style*="readium-iPadOSPatch-on"] h2,
311
+ :root[style*="readium-iPadOSPatch-on"] h3,
312
+ :root[style*="readium-iPadOSPatch-on"] h4,
313
+ :root[style*="readium-iPadOSPatch-on"] h5,
314
+ :root[style*="readium-iPadOSPatch-on"] h6,
315
+ :root[style*="readium-iPadOSPatch-on"] li,
316
+ :root[style*="readium-iPadOSPatch-on"] th,
317
+ :root[style*="readium-iPadOSPatch-on"] td,
318
+ :root[style*="readium-iPadOSPatch-on"] dt,
319
+ :root[style*="readium-iPadOSPatch-on"] dd,
320
+ :root[style*="readium-iPadOSPatch-on"] pre,
321
+ :root[style*="readium-iPadOSPatch-on"] address,
322
+ :root[style*="readium-iPadOSPatch-on"] details,
323
+ :root[style*="readium-iPadOSPatch-on"] summary,
324
+ :root[style*="readium-iPadOSPatch-on"] figcaption,
325
+ :root[style*="readium-iPadOSPatch-on"] div:not(:has(p, h1, h2, h3, h4, h5, h6, li, th, td, dt, dd, pre, address, aside, details, figcaption, summary)),
326
+ :root[style*="readium-iPadOSPatch-on"] aside:not(:has(p, h1, h2, h3, h4, h5, h6, li, th, td, dt, dd, pre, address, aside, details, figcaption, summary)){
327
+ -webkit-text-zoom:reset;
328
+ }
329
+
330
+ :root[style*="readium-iPadOSPatch-on"] abbr,
331
+ :root[style*="readium-iPadOSPatch-on"] b,
332
+ :root[style*="readium-iPadOSPatch-on"] bdi,
333
+ :root[style*="readium-iPadOSPatch-on"] bdo,
334
+ :root[style*="readium-iPadOSPatch-on"] cite,
335
+ :root[style*="readium-iPadOSPatch-on"] code,
336
+ :root[style*="readium-iPadOSPatch-on"] dfn,
337
+ :root[style*="readium-iPadOSPatch-on"] em,
338
+ :root[style*="readium-iPadOSPatch-on"] i,
339
+ :root[style*="readium-iPadOSPatch-on"] kbd,
340
+ :root[style*="readium-iPadOSPatch-on"] mark,
341
+ :root[style*="readium-iPadOSPatch-on"] q,
342
+ :root[style*="readium-iPadOSPatch-on"] rp,
343
+ :root[style*="readium-iPadOSPatch-on"] rt,
344
+ :root[style*="readium-iPadOSPatch-on"] ruby,
345
+ :root[style*="readium-iPadOSPatch-on"] s,
346
+ :root[style*="readium-iPadOSPatch-on"] samp,
347
+ :root[style*="readium-iPadOSPatch-on"] small,
348
+ :root[style*="readium-iPadOSPatch-on"] span,
349
+ :root[style*="readium-iPadOSPatch-on"] strong,
350
+ :root[style*="readium-iPadOSPatch-on"] sub,
351
+ :root[style*="readium-iPadOSPatch-on"] sup,
352
+ :root[style*="readium-iPadOSPatch-on"] time,
353
+ :root[style*="readium-iPadOSPatch-on"] u,
354
+ :root[style*="readium-iPadOSPatch-on"] var{
355
+ -webkit-text-zoom:normal;
356
+ }
357
+
358
+ :root[style*="readium-iPadOSPatch-on"] p:not(:has(b, cite, em, i, q, s, small, span, strong)):first-line{
359
+ -webkit-text-zoom:normal;
360
+ }`,cn='!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports._readium_cssSelectorGenerator=e():t._readium_cssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return"object"==typeof t&&null!==t&&t.nodeType===Node.ELEMENT_NODE}t.r(e),t.d(e,{_readium_cssSelectorGenerator:()=>Z,default:()=>tt,getCssSelector:()=>X});const o={NONE:"",DESCENDANT:" ",CHILD:" > "},r={id:"id",class:"class",tag:"tag",attribute:"attribute",nthchild:"nthchild",nthoftype:"nthoftype"},i="_readium_cssSelectorGenerator";function c(t="unknown problem",...e){console.warn(`${i}: ${t}`,...e)}const s={selectors:[r.id,r.class,r.tag,r.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY,useScope:!1};function u(t){return t instanceof RegExp}function l(t){return["string","function"].includes(typeof t)||u(t)}function a(t){return Array.isArray(t)?t.filter(l):[]}function f(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function d(t,e){if(f(t))return t.contains(e)||c("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."),t;const n=e.getRootNode({composed:!1});return f(n)?(n!==document&&c("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."),n):S(e)}function m(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function p(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function g(t){const e=t.map((t=>{if(u(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(c("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return c("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function h(t,e,n){const o=Array.from(d(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function y(t,e){e=null!=e?e:S(t);const o=[];let r=t;for(;n(r)&&r!==e;)o.push(r),r=r.parentElement;return o}function b(t,e){return p(t.map((t=>y(t,e))))}function S(t){return t.ownerDocument.querySelector(":root")}const N=", ",v=new RegExp(["^$","\\\\s"].join("|")),E=new RegExp(["^$"].join("|")),x=[r.nthoftype,r.tag,r.id,r.class,r.attribute,r.nthchild],w=g(["class","id","ng-*"]);function I({name:t}){return`[${t}]`}function T({name:t,value:e}){return`[${t}=\'${e}\']`}function O({nodeName:t,nodeValue:e}){return{name:F(t),value:F(null!=e?e:void 0)}}function C(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t,nodeValue:e},n){const o=n.tagName.toLowerCase();return!(["input","option"].includes(o)&&"value"===t||"src"===t&&(null==e?void 0:e.startsWith("data:"))||w(t))}(e,t))).map(O);return[...e.map(I),...e.map(T)]}function j(t){var e;return(null!==(e=t.getAttribute("class"))&&void 0!==e?e:"").trim().split(/\\s+/).filter((t=>!E.test(t))).map((t=>`.${F(t)}`))}function A(t){var e;const n=null!==(e=t.getAttribute("id"))&&void 0!==e?e:"",o=`#${F(n)}`,r=t.getRootNode({composed:!1});return!v.test(n)&&h([t],o,r)?[o]:[]}function R(t){var e;const n=null===(e=t.parentElement)||void 0===e?void 0:e.children;if(n)for(let e=0;e<n.length;e++)if(n[e]===t)return[`:nth-child(${String(e+1)})`];return[]}function $(t){return[F(t.tagName.toLowerCase())]}function D(t){const e=[...new Set((n=t.map($),[].concat(...n)))];var n;return 0===e.length||e.length>1?[]:[e[0]]}function k(t){const e=D([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${String(r+1)})`]}return[]}function*P(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){let n=0,o=L(1);for(;o.length<=t.length&&n<e;){n+=1;const e=o.map((e=>t[e]));yield e,o=_(o,t.length-1)}}function _(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return L(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?L(n+1):o}function L(t=1){return Array.from(Array(t).keys())}const M=":".charCodeAt(0).toString(16).toUpperCase(),V=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function F(t=""){return CSS?CSS.escape(t):function(t=""){return t.split("").map((t=>":"===t?`\\\\${M} `:V.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const Y={tag:D,id:function(t){return 0===t.length||t.length>1?[]:A(t[0])},class:function(t){return p(t.map(j))},attribute:function(t){return p(t.map(C))},nthchild:function(t){return p(t.map(R))},nthoftype:function(t){return p(t.map(k))}},G={tag:$,id:A,class:j,attribute:C,nthchild:R,nthoftype:k};function W(t){return t.includes(r.tag)||t.includes(r.nthoftype)?[...t]:[...t,r.tag]}function*q(t,e){const n={};for(const o of t){const t=e[o];t&&t.length>0&&(n[o]=t)}for(const t of function*(t={}){const e=Object.entries(t);if(0===e.length)return;const n=[{index:e.length-1,partial:{}}];for(;n.length>0;){const t=n.pop();if(!t)break;const{index:o,partial:r}=t;if(o<0){yield r;continue}const[i,c]=e[o];for(let t=c.length-1;t>=0;t--)n.push({index:o-1,partial:Object.assign(Object.assign({},r),{[i]:c[t]})})}}(n))yield B(t)}function B(t={}){const e=[...x];return t[r.tag]&&t[r.nthoftype]&&e.splice(e.indexOf(r.tag),1),e.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function H(t,e){return[...t.map((t=>e+o.DESCENDANT+t)),...t.map((t=>e+o.CHILD+t))]}function*U(t,e,n="",o){const r=function*(t,e){const n=new Set,o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=g(n),s=g(o);return function(t){const{selectors:e,includeTag:n}=t,o=[...e];return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){return(0,Y[e])(t)}(t,n),u=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,s),l=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(u,s);return e[n]=r?Array.from(P(l,{maxResults:i})):l.map((t=>[t])),e}),{})}(t,e);for(const t of function*(t,e){for(const n of function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?function(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){return Array.from(P(t,{maxResults:e}))}(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(W):i}(e))yield*q(n,t)}(o,e))n.has(t)||(n.add(t),yield t)}(t,o);for(const o of function*(t,e){if(""===e)yield*t;else for(const n of t)yield*H([n],e)}(r,n))h(t,o,e)&&(yield o)}function*z(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...b(t,e).map((t=>[t]))];for(const t of r)for(const r of U(t,e,n,o))yield{foundElements:t,selector:r}}function J(t){return{value:t,include:!1}}function K({selectors:t,operator:e}){let n=[...x];t[r.tag]&&t[r.nthoftype]&&(n=n.filter((t=>t!==r.tag)));let o="";return n.forEach((e=>{var n;(null!==(n=t[e])&&void 0!==n?n:[]).forEach((({value:t,include:e})=>{e&&(o+=t)}))})),e+o}function Q(t,e){return t.map((t=>function(t,e){return[e?":scope":":root",...y(t,e).reverse().map((t=>{var e;const n=function(t,e,n=o.NONE){const r={};return e.forEach((e=>{Reflect.set(r,e,function(t,e){return G[e](t)}(t,e).map(J))})),{element:t,operator:n,selectors:r}}(t,[r.nthchild],o.CHILD);return(null!==(e=n.selectors.nthchild)&&void 0!==e?e:[]).forEach((t=>{t.include=!0})),n})).map(K)].join("")}(t,e))).join(N)}function X(t,e={}){return Z(t,Object.assign(Object.assign({},e),{maxResults:1})).next().value}function*Z(t,e={}){var o;const i=function(t){(t instanceof NodeList||t instanceof HTMLCollection)&&(t=Array.from(t));const e=(Array.isArray(t)?t:[t]).filter(n);return[...new Set(e)]}(t),c=function(t,e={}){const n=Object.assign(Object.assign({},s),e);return{selectors:(o=n.selectors,Array.isArray(o)?o.filter((t=>{return e=r,n=t,Object.values(e).includes(n);var e,n})):[]),whitelist:a(n.whitelist),blacklist:a(n.blacklist),root:d(n.root,t),combineWithinSelector:!!n.combineWithinSelector,combineBetweenSelectors:!!n.combineBetweenSelectors,includeTag:!!n.includeTag,maxCombinations:m(n.maxCombinations),maxCandidates:m(n.maxCandidates),useScope:!!n.useScope,maxResults:m(n.maxResults)};var o}(i[0],e),u=null!==(o=c.root)&&void 0!==o?o:S(i[0]);let l=0;for(const t of function*({elements:t,root:e,rootSelector:n="",options:o}){let r=e,i=n,c=!0;for(;c;){let n=!1;for(const c of z(t,r,i,o)){const{foundElements:o,selector:s}=c;if(n=!0,!h(t,s,e)){r=o[0],i=s;break}yield s}n||(c=!1)}}({elements:i,options:c,root:u,rootSelector:""}))if(yield t,l++,l>=c.maxResults)return;i.length>1&&(yield i.map((t=>X(t,c))).join(N),l++,l>=c.maxResults)||(yield Q(i,c.useScope?u:void 0))}const tt=X;return e})()));',pr=`// WebPub-specific setup - no execution blocking needed
361
+ window._readium_blockedEvents = [];
362
+ window._readium_blockEvents = false; // WebPub doesn't need event blocking
363
+ window._readium_eventBlocker = null;
364
+ `,dn=`(function() {
99
365
  if(window.onload) window.onload = new Proxy(window.onload, {
100
366
  apply: function(target, receiver, args) {
101
367
  if(!window._readium_blockEvents) {
@@ -106,7 +372,1273 @@ if(window.onload) window.onload = new Proxy(window.onload, {
106
372
  0, target, receiver, args
107
373
  ]);
108
374
  }
109
- });`),"text/javascript"))),er=r=>{const t=r.join(" ");return["upgrade-insecure-requests",`default-src ${t} blob:`,"connect-src 'none'",`script-src ${t} blob: 'unsafe-inline'`,`style-src ${t} blob: 'unsafe-inline'`,`img-src ${t} blob: data:`,`font-src ${t} blob: data:`,`object-src ${t} blob:`,`child-src ${t}`,"form-action 'none'"].join("; ")};class lA{constructor(t,e,i,A){this.pub=t,this.item=i,this.burl=i.toURL(e)||"",this.cssProperties=A}async build(t=!1){if(this.item.mediaType.isHTML)return await this.buildHtmlFrame(t);if(this.item.mediaType.isBitmap||this.item.mediaType.equals(u.SVG))return this.buildImageFrame();throw Error("Unsupported frame mediatype "+this.item.mediaType.string)}async buildHtmlFrame(t=!1){const e=await this.pub.get(this.item).readAsString();if(!e)throw new Error(`Failed reading item ${this.item.href}`);const i=new DOMParser().parseFromString(e,this.item.mediaType.string),A=i.querySelector("parsererror");if(A){const n=A.querySelector("div");throw new Error(`Failed parsing item ${this.item.href}: ${n?.textContent||A.textContent}`)}return this.finalizeDOM(i,this.pub.baseURL,this.burl,this.item.mediaType,t,this.cssProperties)}buildImageFrame(){const t=document.implementation.createHTMLDocument(this.item.title||this.item.href),e=document.createElement("img");return e.src=this.burl||"",e.alt=this.item.title||"",e.decoding="async",t.body.appendChild(e),this.finalizeDOM(t,this.pub.baseURL,this.burl,this.item.mediaType,!0)}hasExecutable(t){return!!t.querySelector("script")||!!t.querySelector("body[onload]:not(body[onload=''])")}hasStyle(t){return!!(t.querySelector("link[rel='stylesheet']")||t.querySelector("style")||t.querySelector("[style]:not([style=''])"))}setProperties(t,e){for(const i in t){const A=t[i];A&&e.documentElement.style.setProperty(i,A)}}finalizeDOM(t,e,i,A,n=!1,o){if(!t)return"";if(!n){const h=be(t,Bt("ReadiumCSS-before",()=>$(Te(Kn),"text/css")));t.head.firstChild?t.head.firstChild.before(h):t.head.appendChild(h),this.hasStyle(t)||h.after(be(t,Bt("ReadiumCSS-default",()=>$(Te(qn),"text/css")))),t.head.appendChild(be(t,Bt("ReadiumCSS-after",()=>$(Te(Zn),"text/css")))),o&&this.setProperties(o,t)}if(t.body.querySelectorAll("img").forEach(h=>{h.setAttribute("fetchpriority","high")}),A.isHTML&&this.pub.metadata.languages?.[0]){const h=this.pub.metadata.languages[0];if(A===u.XHTML){const c=document.documentElement.lang||document.documentElement.getAttribute("xml:lang"),d=document.body.lang||document.body.getAttribute("xml:lang");d&&!c?(document.documentElement.lang=d,document.documentElement.setAttribute("xml:lang",d),document.body.removeAttribute("xml:lang"),document.body.removeAttribute("lang")):c||(document.documentElement.lang=h,document.documentElement.setAttribute("xml:lang",h))}else A===u.HTML&&!document.documentElement.lang&&(document.documentElement.lang=h)}if(i!==void 0){const h=t.createElement("base");h.href=i,h.dataset.readium="true",t.head.firstChild.before(h)}const s=this.hasExecutable(t);s&&t.head.firstChild.before($n(t)),t.head.firstChild.before(_n(t)),s&&t.head.appendChild(tr(t));const a=t.createElement("meta");return a.httpEquiv="Content-Security-Policy",a.content=er(e?[e]:[]),a.dataset.readium="true",t.head.firstChild.before(a),URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(t)],{type:A.isHTML?A.string:"application/xhtml+xml"}))}}class hA{constructor(t){this.hidden=!0,this.destroyed=!1,this.currModules=[],this.frame=document.createElement("iframe"),this.frame.sandbox.value="allow-same-origin allow-scripts",this.frame.classList.add("readium-navigator-iframe"),this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.position="absolute",this.frame.style.pointerEvents="none",this.frame.style.transition="visibility 0s, opacity 0.1s linear",this.source=t}async load(t){return new Promise((e,i)=>{if(this.loader){const A=this.frame.contentWindow;if([...this.currModules].sort().join("|")===[...t].sort().join("|")){try{e(A)}catch{}return}this.comms?.halt(),this.loader.destroy(),this.loader=new ut(A,t),this.currModules=t,this.comms=void 0;try{e(A)}catch{}return}this.frame.onload=()=>{const A=this.frame.contentWindow;this.loader=new ut(A,t),this.currModules=t;try{e(A)}catch{}},this.frame.onerror=A=>{try{i(A)}catch{}},this.frame.contentWindow.location.replace(this.source)})}async destroy(){await this.hide(),this.loader?.destroy(),this.frame.remove(),this.destroyed=!0}async hide(){if(!this.destroyed){if(this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.pointerEvents="none",this.hidden=!0,this.frame.parentElement)return this.comms===void 0||!this.comms.ready?void 0:new Promise((t,e)=>{this.comms?.send("unfocus",void 0,i=>{this.comms?.halt(),t()})});this.comms?.halt()}}async show(t){if(this.destroyed)throw Error("Trying to show frame when it doesn't exist");if(!this.frame.parentElement)throw Error("Trying to show frame that is not attached to the DOM");return this.comms?this.comms.resume():this.comms=new mt(this.frame.contentWindow,this.source),new Promise((e,i)=>{this.comms?.send("activate",void 0,()=>{this.comms?.send("focus",void 0,()=>{const A=()=>{this.frame.style.removeProperty("visibility"),this.frame.style.removeProperty("aria-hidden"),this.frame.style.removeProperty("opacity"),this.frame.style.removeProperty("pointer-events"),this.hidden=!1,ft.UA.WebKit&&this.comms?.send("force_webkit_recalc",void 0),e()};t!==void 0?this.comms?.send("go_progression",t,A):A()})})})}setCSSProperties(t){this.destroyed||!this.frame.contentWindow||(this.hidden&&(this.comms?this.comms?.resume():this.comms=new mt(this.frame.contentWindow,this.source)),this.comms?.send("update_properties",t),this.hidden&&this.comms?.halt())}get iframe(){if(this.destroyed)throw Error("Trying to use frame when it doesn't exist");return this.frame}get realSize(){if(this.destroyed)throw Error("Trying to use frame client rect when it doesn't exist");return this.frame.getBoundingClientRect()}get window(){if(this.destroyed||!this.frame.contentWindow)throw Error("Trying to use frame window when it doesn't exist");return this.frame.contentWindow}get atLeft(){return this.window.scrollX<5}get atRight(){return this.window.scrollX>this.window.document.scrollingElement.scrollWidth-this.window.innerWidth-5}get msg(){return this.comms}get ldr(){return this.loader}}const cA=5,dA=3;class gA{constructor(t,e,i){this.pool=new Map,this.blobs=new Map,this.inprogress=new Map,this.pendingUpdates=new Map,this.container=t,this.positions=e,this.currentCssProperties=i}async destroy(){let t=this.inprogress.values(),e=t.next();const i=[];for(;e.value;)i.push(e.value),e=t.next();i.length>0&&await Promise.allSettled(i),this.inprogress.clear();let A=this.pool.values(),n=A.next();for(;n.value;)await n.value.destroy(),n=A.next();this.pool.clear(),this.blobs.forEach(o=>URL.revokeObjectURL(o)),this.container.childNodes.forEach(o=>{(o.nodeType===Node.ELEMENT_NODE||o.nodeType===Node.TEXT_NODE)&&o.remove()})}async update(t,e,i,A=!1){let n=this.positions.findIndex(a=>a.locations.position===e.locations.position);if(n<0)throw Error(`Locator not found in position list: ${e.locations.position} > ${this.positions.reduce((a,h)=>h.locations.position||0>a?h.locations.position||0:a,0)}`);const o=this.positions[n].href;this.inprogress.has(o)&&await this.inprogress.get(o);const s=new Promise(async(a,h)=>{const c=[],d=[];this.positions.forEach((l,p)=>{(p>n+cA||p<n-cA)&&(c.includes(l.href)||c.push(l.href)),p<n+dA&&p>n-dA&&(d.includes(l.href)||d.push(l.href))}),c.forEach(async l=>{d.includes(l)||this.pool.has(l)&&(await this.pool.get(l)?.destroy(),this.pool.delete(l),this.pendingUpdates.has(l)&&this.pendingUpdates.set(l,{inPool:!1}))}),this.currentBaseURL!==void 0&&t.baseURL!==this.currentBaseURL&&(this.blobs.forEach(l=>URL.revokeObjectURL(l)),this.blobs.clear()),this.currentBaseURL=t.baseURL;const g=async l=>{if(A&&(this.blobs.forEach(I=>URL.revokeObjectURL(I)),this.blobs.clear(),this.pendingUpdates.clear()),this.pendingUpdates.has(l)&&this.pendingUpdates.get(l)?.inPool===!1){const I=this.blobs.get(l);I&&(URL.revokeObjectURL(I),this.blobs.delete(l),this.pendingUpdates.delete(l))}if(this.pool.has(l)){const I=this.pool.get(l);if(!this.blobs.has(l))await I.destroy(),this.pool.delete(l),this.pendingUpdates.delete(l);else{await I.load(i);return}}const p=t.readingOrder.findWithHref(l);if(!p)return;if(!this.blobs.has(l)){const Q=await new lA(t,this.currentBaseURL||"",p,this.currentCssProperties).build();this.blobs.set(l,Q)}const E=new hA(this.blobs.get(l));l!==o&&await E.hide(),this.container.appendChild(E.iframe),await E.load(i),this.pool.set(l,E)};try{await Promise.all(d.map(l=>g(l)))}catch(l){h(l)}const M=this.pool.get(o);(M?.source!==this._currentFrame?.source||A)&&(await this._currentFrame?.hide(),M&&await M.load(i),M&&await M.show(e.locations.progression),this._currentFrame=M),a()});this.inprogress.set(o,s),await s,this.inprogress.delete(o)}setCSSProperties(t){if(!((i,A)=>{const n=Object.keys(i),o=Object.keys(A);if(n.length!==o.length)return!1;for(const s of n)if(i[s]!==A[s])return!1;return!0})(this.currentCssProperties||{},t)){this.currentCssProperties=t,this.pool.forEach(i=>{i.setCSSProperties(t)});for(const i of this.blobs.keys())this.pendingUpdates.set(i,{inPool:this.pool.has(i)})}}get currentFrames(){return[this._currentFrame]}get currentBounds(){const t={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0,toJSON(){return this}};return this.currentFrames.forEach(e=>{if(!e)return;const i=e.realSize;t.x=Math.min(t.x,i.x),t.y=Math.min(t.y,i.y),t.width+=i.width,t.height=Math.max(t.height,i.height),t.top=Math.min(t.top,i.top),t.right=Math.min(t.right,i.right),t.bottom=Math.min(t.bottom,i.bottom),t.left=Math.min(t.left,i.left)}),t}}class uA{constructor(t,e,i){this.currModules=[],this.cachedPage=void 0,this.peripherals=t,this.debugHref=i,this.frame=document.createElement("iframe"),this.frame.sandbox.value="allow-same-origin allow-scripts",this.frame.classList.add("readium-navigator-iframe"),this.frame.classList.add("blank"),this.frame.scrolling="no",this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.display="none",this.frame.style.position="absolute",this.frame.style.pointerEvents="none",this.frame.style.transformOrigin="0 0",this.frame.style.transform="scale(1)",this.frame.style.background="#fff",this.frame.style.touchAction="none",this.frame.dataset.originalHref=i,this.source="about:blank",this.wrapper=document.createElement("div"),this.wrapper.style.position="relative",this.wrapper.style.float=this.wrapper.style.cssFloat=e===x.rtl?"right":"left",this.wrapper.appendChild(this.frame)}async load(t,e){return this.source===e&&this.loadPromise&&[...this.currModules].sort().join("|")===[...t].sort().join("|")?this.loadPromise:(this.loaded&&this.source!==e&&this.window.stop(),this.source=e,this.loadPromise=new Promise((i,A)=>{if(this.loader&&this.loaded){const n=this.frame.contentWindow;if([...this.currModules].sort().join("|")===[...t].sort().join("|")){try{i(n),this.loadPromise=void 0}catch{}return}this.comms?.halt(),this.loader.destroy(),this.loader=new ut(n,t),this.currModules=t,this.comms=void 0;try{i(n),this.loadPromise=void 0}catch{}return}this.frame.addEventListener("load",()=>{const n=this.frame.contentWindow;this.loader=new ut(n,t),this.currModules=t,this.peripherals.observe(this.wrapper),this.peripherals.observe(n);try{i(n)}catch{}},{once:!0}),this.frame.addEventListener("error",n=>{try{A(n.error),this.loadPromise=void 0}catch{}},{once:!0}),this.frame.style.removeProperty("display"),this.frame.contentWindow.location.replace(this.source)}),this.loadPromise)}loadPageSize(){const t=this.frame.contentWindow,e=t.document.head.querySelector("meta[name=viewport]");if(e){const i=/(\w+) *= *([^\s,]+)/g;let A,n=0,o=0;for(;A=i.exec(e.content);)A[1]==="width"?n=Number.parseFloat(A[2]):A[1]==="height"&&(o=Number.parseFloat(A[2]));if(n>0&&o>0)return{width:n,height:o}}return{width:t.document.body.scrollWidth,height:t.document.body.scrollHeight}}update(t){if(!this.loaded)return;const e=this.loadPageSize();this.frame.style.height=`${e.height}px`,this.frame.style.width=`${e.width}px`;const i=Math.min(this.wrapper.clientWidth/e.width,this.wrapper.clientHeight/e.height);this.frame.style.transform=`scale(${i})`;const A=this.frame.getBoundingClientRect(),n=this.wrapper.clientHeight-A.height;if(this.frame.style.top=`${n/2}px`,t===J.left){const o=this.wrapper.clientWidth-A.width;this.frame.style.left=`${o}px`}else if(t===J.center){const o=this.wrapper.clientWidth-A.width;this.frame.style.left=`${o/2}px`}else this.frame.style.left="0px";this.frame.style.removeProperty("visibility"),this.frame.style.removeProperty("aria-hidden"),this.frame.style.removeProperty("pointer-events"),this.frame.classList.remove("blank"),this.frame.classList.add("loaded")}async destroy(){await this.unfocus(),this.loader?.destroy(),this.wrapper.remove()}async unload(){if(this.loaded)return this.deselect(),this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.pointerEvents="none",this.frame.classList.add("blank"),this.frame.classList.remove("loaded"),this.comms?.halt(),this.loader?.destroy(),this.comms=void 0,this.frame.blur(),new Promise((t,e)=>{this.frame.addEventListener("load",()=>{try{this.showPromise=void 0,t()}catch{}},{once:!0}),this.frame.addEventListener("error",i=>{try{this.showPromise=void 0,e(i.error)}catch{}},{once:!0}),this.source="about:blank",this.frame.contentWindow.location.replace("about:blank"),this.frame.style.display="none"})}deselect(){this.frame.contentWindow?.getSelection()?.removeAllRanges()}async unfocus(){if(this.frame.parentElement)return this.comms===void 0?void 0:new Promise((t,e)=>{this.comms?.send("unfocus",void 0,i=>{this.comms?.halt(),this.showPromise=void 0,t()})});this.comms?.halt()}async show(t){if(!this.frame.parentElement){console.warn("Trying to show frame that is not attached to the DOM");return}if(!this.loaded){this.showPromise=void 0;return}return this.showPromise?(this.cachedPage!==t&&(this.update(t),this.cachedPage=t),this.showPromise):(this.cachedPage=t,this.comms?this.comms.resume():this.comms=new mt(this.frame.contentWindow,this.source),this.showPromise=new Promise((e,i)=>{this.comms.send("focus",void 0,A=>{this.update(this.cachedPage),e()})}),this.showPromise)}async activate(){return new Promise((t,e)=>{if(!this.comms)return t();this.comms?.send("activate",void 0,()=>{t()})})}get element(){return this.wrapper}get iframe(){return this.frame}get realSize(){return this.frame.getBoundingClientRect()}get loaded(){return this.frame.contentWindow&&this.frame.contentWindow.location.href!=="about:blank"}set width(t){const e=`${t}%`;this.wrapper.style.width!==e&&(this.wrapper.style.width=e)}set height(t){const e=`${t}px`;this.wrapper.style.height!==e&&(this.wrapper.style.height=e)}get window(){if(!this.frame.contentWindow)throw Error("Trying to use frame window when it doesn't exist");return this.frame.contentWindow}get atLeft(){return this.window.scrollX<5}get atRight(){return this.window.scrollX>this.window.document.scrollingElement.scrollWidth-this.window.innerWidth-5}get msg(){return this.comms}get ldr(){return this.loader}}var mA=(r=>(r[r.Left=0]="Left",r[r.Center=1]="Center",r[r.Right=2]="Right",r))(mA||{}),pA=(r=>(r[r.Top=0]="Top",r[r.Middle=1]="Middle",r[r.Bottom=2]="Bottom",r))(pA||{});class fA{constructor(){this.outerWidth=0,this.outerHeight=0,this.HTML=document.documentElement,this.Head=document.head,this.Body=document.body}refreshOuterPixels(t){ft.OS.iOS||(this.outerHeight=window.outerHeight-window.innerHeight,ft.OS.Android&&ft.UA.Chrome&&window.screen.height>window.innerHeight&&(this.outerHeight=(window.screen.height-window.innerHeight)/1.5),this.outerWidth=window.outerWidth-window.innerWidth)}getBibiEventCoord(t,e=0){const i={X:0,Y:0};return/^touch/.test(t.type)?(i.X=t.touches[e].screenX,i.Y=t.touches[e].screenY):(i.X=t.screenX,i.Y=t.screenY),(t.target.ownerDocument?.documentElement||t.target.documentElement)===this.HTML&&(i.X-=this.HTML.scrollLeft+this.Body.scrollLeft,i.Y-=this.HTML.scrollTop+this.Body.scrollTop),i.X-=this.outerWidth,i.Y-=this.outerHeight,i}getTouchDistance(t){if(t.touches.length!==2)return 0;const e=t.touches[0].screenX-this.outerWidth,i=t.touches[0].screenY-this.outerHeight,A=t.touches[1].screenX-this.outerWidth,n=t.touches[1].screenY-this.outerHeight;return Math.sqrt(Math.pow(A-e,2)+Math.pow(n-i,2))}getTouchCenter(t){if(t.touches.length!==2)return null;const e=this.HTML.scrollLeft+this.Body.scrollLeft,i=this.HTML.scrollTop+this.Body.scrollTop,A=t.touches[0].screenX-this.outerWidth-e,n=t.touches[0].screenY-this.outerHeight-i,o=t.touches[1].screenX-this.outerWidth-e,s=t.touches[1].screenY-this.outerHeight-i;return{X:(A+o)/2,Y:(n+s)/2}}getBibiEvent(t){if(!t)return{Coord:null,Division:null,Ratio:null,Target:null};const e=this.getBibiEventCoord(t);let i=.3;const A={X:e.X/window.innerWidth,Y:e.Y/window.innerHeight};let n,o,s,a;s=n=i,a=o=1-i;const h={X:null,Y:null};return A.X<s?h.X=0:a<A.X?h.X=2:h.X=1,A.Y<n?h.Y=0:o<A.Y?h.Y=2:h.Y=1,{Target:t.target,Coord:e,Ratio:A,Division:h}}}class ir{constructor(){this._DOM={show:!1,pinchTarget:document.createElement("div"),touch1:document.createElement("div"),touch2:document.createElement("div"),center:document.createElement("div"),stats:document.createElement("div")},this._DOM.show=!0,this._DOM.pinchTarget.style.zIndex=this._DOM.stats.style.zIndex=this._DOM.center.style.zIndex=this._DOM.touch1.style.zIndex=this._DOM.touch2.style.zIndex="100000",this._DOM.pinchTarget.style.position=this._DOM.stats.style.position=this._DOM.center.style.position=this._DOM.touch1.style.position=this._DOM.touch2.style.position="absolute",this._DOM.pinchTarget.style.borderRadius=this._DOM.center.style.borderRadius=this._DOM.touch1.style.borderRadius=this._DOM.touch2.style.borderRadius="50%",this._DOM.pinchTarget.style.pointerEvents=this._DOM.stats.style.pointerEvents=this._DOM.center.style.pointerEvents=this._DOM.touch1.style.pointerEvents=this._DOM.touch2.style.pointerEvents="none",this._DOM.pinchTarget.style.display=this._DOM.center.style.display=this._DOM.touch1.style.display=this._DOM.touch2.style.display="none",this._DOM.pinchTarget.style.paddingTop=this._DOM.center.style.paddingTop="10px",this._DOM.pinchTarget.style.width=this._DOM.pinchTarget.style.height=this._DOM.center.style.width=this._DOM.center.style.height="10px",this._DOM.pinchTarget.style.backgroundColor="green",this._DOM.center.style.backgroundColor="red",this._DOM.touch1.style.backgroundColor=this._DOM.touch2.style.backgroundColor="blue",this._DOM.touch1.style.height=this._DOM.touch2.style.height="20px",this._DOM.touch1.style.width=this._DOM.touch2.style.width="20px",this._DOM.touch1.style.paddingTop=this._DOM.touch2.style.paddingTop="20px",this._DOM.touch1.textContent="1",this._DOM.touch2.textContent="2",this._DOM.stats.style.padding="20px",this._DOM.stats.style.backgroundColor="rgba(0,0,0,0.5)",this._DOM.stats.style.color="white",this._DOM.stats.textContent="[stats]",document.body.appendChild(this._DOM.stats),document.body.appendChild(this._DOM.center),document.body.appendChild(this._DOM.touch1),document.body.appendChild(this._DOM.touch2),document.body.appendChild(this._DOM.pinchTarget)}get show(){return this.DOM.show}get DOM(){return this._DOM}}const MA=6,Ve=1.02,BA=50;class wA{constructor(t,e=!1){this.dragState=0,this.minimumMoved=!1,this.pan={startX:0,endX:0,startY:0,overscrollX:0,overscrollY:0,letItGo:!1,preventClick:!1,translateX:0,translateY:0,touchID:0},this.pinch={startDistance:0,startScale:0,target:{X:0,Y:0},touchN:0,startTranslate:{X:0,Y:0}},this._scale=1,this.scaleDebouncer=0,this.frameBounds=null,this.debugger=null,this.btouchstartHandler=this.touchstartHandler.bind(this),this.btouchendHandler=this.touchendHandler.bind(this),this.btouchmoveHandler=this.touchmoveHandler.bind(this),this.bdblclickHandler=this.dblclickHandler.bind(this),this.bmousedownHandler=this.mousedownHandler.bind(this),this.bmouseupHandler=this.mouseupHandler.bind(this),this.bmousemoveHandler=this.mousemoveHandler.bind(this),this.moveFrame=0,this.manager=t,this.coordinator=new fA,this.attachEvents(),e&&(this.debugger=new ir)}get scale(){return this._scale}set scale(t){isNaN(t)&&(t=1),window.clearTimeout(this.scaleDebouncer),this.scaleDebouncer=window.setTimeout(()=>{this.dragState===0&&this.scale<Ve&&(this.pan.translateX=0,this.pan.translateY=0,this.clearPan(),this.manager.updateBookStyle()),this.manager.listener("zoom",t)},100),this._scale=t}attachEvents(){this.observe(this.manager.spineElement),this.pan={startX:0,startY:0,endX:0,overscrollX:0,overscrollY:0,letItGo:!1,preventClick:!1,translateX:0,translateY:0,touchID:0},this.pinch={startDistance:0,startScale:0,target:{X:0,Y:0},startTranslate:{X:0,Y:0},touchN:0}}clearPan(){this.pan.letItGo=!1,this.pan.touchID=0,this.pan.endX=0,this.pan.overscrollX=0,this.pan.overscrollY=0}clearPinch(){this.pinch={startDistance:0,startScale:this.pinch.startScale,target:{X:0,Y:0},touchN:0,startTranslate:{X:0,Y:0}}}observe(t){t.addEventListener("touchstart",this.btouchstartHandler),t.addEventListener("touchend",this.btouchendHandler),t.addEventListener("touchmove",this.btouchmoveHandler,{passive:!0}),t.addEventListener("dblclick",this.bdblclickHandler,{passive:!0}),t.addEventListener("mousedown",this.bmousedownHandler),t.addEventListener("mouseup",this.bmouseupHandler),t.addEventListener("mousemove",this.bmousemoveHandler)}clickHandler(t){}touchstartHandler(t){if(["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(t.target.nodeName)!==-1)return;switch(t.stopPropagation(),this.frameBounds=this.manager.currentBounds,this.coordinator.refreshOuterPixels(this.frameBounds),t.touches.length){case 3:return;case 2:{t.preventDefault(),this.pinch.startDistance=this.coordinator.getTouchDistance(t);const A=this.startTouch(t);this.pan.startX=A.X,this.pan.startY=A.Y,this.dragState=2,this.manager.updateBookStyle(!0),this.isScaled?(this.pinch.target.X-=this.pan.translateX*(this.pinch.startScale/this.scale),this.pinch.target.Y-=this.pan.translateY*(this.pinch.startScale/this.scale),this.pinch.target={X:0,Y:0},this.pinch.startScale=1/this.scale):(this.pinch.target={X:0,Y:0},this.pinch.startScale=this.scale),this.pinch.startTranslate={X:this.pan.translateX,Y:this.pan.translateY},this.debugger?.show&&(this.debugger.DOM.touch2.style.display="",this.debugger.DOM.center.style.display="",this.debugger.DOM.pinchTarget.style.display="");return}case 1:this.pan.touchID=t.touches[0].identifier,this.debugger?.show&&(this.debugger.DOM.touch1.style.display="");default:this.dragState<1&&(this.dragState=1),this.manager.updateBookStyle(!0)}this.manager.updateSpineStyle(!1);const i=this.startTouch(t);this.pan.startX=i.X,this.pan.startY=i.Y}startTouch(t){const e=this.coordinator.getTouchCenter(t)||this.coordinator.getBibiEventCoord(t);return{X:e.X-this.manager.width/2-this.pan.translateX*this.scale+this.manager.width/2,Y:e.Y-this.manager.height/2-this.pan.translateY*this.scale+this.manager.height/2}}touchendHandler(t){if(t.stopPropagation(),!t.touches||t.touches.length===0)this.pan.endX&&!this.isScaled?(this.pinch.touchN&&(this.pan.endX=this.pan.startX),this.updateAfterDrag()):!this.pinch.touchN&&Math.abs(this.pan.overscrollX)>BA&&Math.abs(this.pan.overscrollY)<BA/2&&(this.pan.startX=0,this.pan.endX=-this.pan.overscrollX,this.updateAfterDrag()),this.dragState=0,this.minimumMoved=!1,this.clearPinch(),this.debugger?.show&&(this.debugger.DOM.center.style.display="none",this.debugger.DOM.touch1.style.display="none",this.debugger.DOM.touch2.style.display="none");else if(t.touches.length===1){this.dragState=1,t.touches[0].identifier!==this.pan.touchID&&(this.pan.touchID=t.touches[0].identifier),this.debugger?.show&&(this.debugger.DOM.center.style.display="none",this.debugger.DOM.touch2.style.display="none",this.debugger.DOM.pinchTarget.style.display="none");const e=this.startTouch(t);this.pan.startX=e.X,this.pan.startY=e.Y}window.setTimeout(()=>{this.manager.updateBookStyle(!0),this.dragState===0&&(this.scale<Ve&&(this.pan.translateX=0,this.pan.translateY=0),this.clearPan()),this.manager.updateBookStyle(!0)},50)}touchmoveHandler(t){t.stopPropagation();const e=this.coordinator.getBibiEventCoord(t);Math.abs(this.pan.startY-e.Y)+Math.abs(this.pan.startX-e.X)>5&&(this.minimumMoved||(this.manager.deselect(),this.minimumMoved=!0),this.dragState<1&&(this.dragState=1));const i=this.coordinator?.getTouchDistance(t);let A=!1;const n=this.scale;if(this.dragState===2&&i){if(this.pinch.touchN++,this.pinch.touchN<4)return;let o=i/this.pinch.startDistance*this.scale;o>=MA&&(o=MA),o<=Ve&&(o=1),this.scale=o,this.pinch.startDistance=i,A=!0}if(this.pan.letItGo===!1&&(this.pan.letItGo=Math.abs(this.pan.startY-e.Y)<Math.abs(this.pan.startX-e.X)),this.debugger?.show&&(this.debugger.DOM.touch1.style.top=`${e.Y-10}px`,this.debugger.DOM.touch1.style.left=`${e.X-10}px`,this.debugger.DOM.touch1.innerText=`${e.X.toFixed(2)},${e.Y.toFixed(2)}`),this.dragState>0&&this.isScaled||this.dragState>1){if(this.dragState===1){const a={X:e.X-this.manager.width/2,Y:e.Y-this.manager.height/2};this.pan.translateX=(a.X-(this.pan.startX-this.manager.width/2))*1/this.scale,this.pan.translateY=(a.Y-(this.pan.startY-this.manager.height/2))*1/this.scale}else if(this.dragState===2){const a=this.coordinator.getTouchCenter(t);if(this.debugger?.show){this.debugger.DOM.center.style.top=`${a.Y-5}px`,this.debugger.DOM.center.style.left=`${a.X-5}px`,this.debugger.DOM.center.innerText=`${a.X.toFixed(2)},${a.Y.toFixed(2)}`;const M=this.coordinator.getBibiEventCoord(t,1);this.debugger.DOM.touch2.style.top=`${M.Y-10}px`,this.debugger.DOM.touch2.style.left=`${M.X-10}px`,this.debugger.DOM.touch2.innerText=`${M.X.toFixed(2)},${M.Y.toFixed(2)}`}a.X-=this.manager.width/2,a.Y-=this.manager.height/2;let h=-a.X/n;h+=a.X/this.scale,this.pinch.target.X+=h,a.X+=this.pinch.target.X*this.scale/this.pinch.startScale;let c=-a.Y/n;c+=a.Y/this.scale,this.pinch.target.Y+=c,a.Y+=this.pinch.target.Y*this.scale/this.pinch.startScale;let d=(a.X-(this.pan.startX-this.manager.width/2))*1/this.scale,g=(a.Y-(this.pan.startY-this.manager.height/2))*1/this.scale;this.pan.translateX=d,this.pan.translateY=g,this.debugger?.show&&(this.debugger.DOM.pinchTarget.style.left=`${this.pinch.target.X*this.scale/this.pinch.startScale-5+this.manager.width/2}px`,this.debugger.DOM.pinchTarget.style.top=`${this.pinch.target.Y*this.scale/this.pinch.startScale-5+this.manager.height/2}px`,this.debugger.DOM.pinchTarget.innerText=`${(this.pinch.target.X*this.scale/this.pinch.startScale).toFixed(2)},${(this.pinch.target.Y*this.scale/this.pinch.startScale).toFixed(2)}`)}const o=this.frameBounds.width/6,s=this.frameBounds.height/6;this.pan.translateX<-o&&(this.pan.overscrollX=-(o+this.pan.translateX),this.pan.translateX=-o),this.pan.translateY<-s&&(this.pan.overscrollY=-(s+this.pan.translateY),this.pan.translateY=-s),this.pan.translateX>o&&(this.pan.overscrollX=o-this.pan.translateX,this.pan.translateX=o),this.pan.translateY>s&&(this.pan.overscrollY=s-this.pan.translateY,this.pan.translateY=s),A=!0,this.debugger?.show&&(this.debugger.DOM.stats.innerText=`TX: ${this.pan.translateX.toFixed(2)}
375
+ });
376
+ })();
377
+ `;function mr(){const r=[{id:"css-selector-generator",as:"script",target:"head",blob:new Blob([ye(cn)],{type:"text/javascript"})},{id:"webpub-execution",as:"script",target:"head",blob:new Blob([ye(pr)],{type:"text/javascript"})}],e=[{id:"onload-proxy",as:"script",target:"head",blob:new Blob([ye(dn)],{type:"text/javascript"}),condition:t=>!!(t.querySelector("script")||t.querySelector("body[onload]:not(body[onload=''])"))},{id:"readium-css-webpub",as:"link",target:"head",blob:new Blob([Qe(ur)],{type:"text/css"}),rel:"stylesheet"}];return[{resources:[/\.xhtml$/,/\.html$/],prepend:r,append:e}]}const gr=r=>({frameLoaded:r.frameLoaded||(()=>{}),positionChanged:r.positionChanged||(()=>{}),tap:r.tap||(()=>!1),click:r.click||(()=>!1),zoom:r.zoom||(()=>{}),scroll:r.scroll||(()=>{}),customEvent:r.customEvent||(()=>{}),handleLocator:r.handleLocator||(()=>!1),textSelected:r.textSelected||(()=>{})});class hn extends st{constructor(e,t,i,n=void 0,o={preferences:{},defaults:{}}){super(),this.currentIndex=0,this._preferencesEditor=null,this._injector=null,this.webViewport={readingOrder:[],progressions:new Map,positions:null},this.pub=t,this.container=e,this.listeners=gr(i),this._preferences=new be(o.preferences),this._defaults=new rn(o.defaults),this._settings=new Ct(this._preferences,this._defaults,this.hasDisplayTransformability),this._css=new tn({rsProperties:new en({experiments:this._settings.experiments||null}),userProperties:new xt({zoom:this._settings.zoom})});const s=mr(),a=o.injectables||{rules:[],allowedDomains:[]};if(this._injector=new Rt({rules:[...s,...a.rules],allowedDomains:a.allowedDomains}),n&&typeof n.copyWithLocations=="function"){this.currentLocation=n;const l=this.pub.readingOrder.findIndexWithHref(n.href);l>=0&&(this.currentIndex=l)}else this.currentLocation=this.createCurrentLocator()}async load(){await this.updateCSS(!1);const e=this.compileCSSProperties(this._css);this.framePool=new Zi(this.container,e,this._injector),await this.apply()}get settings(){return Object.freeze({...this._settings})}get preferencesEditor(){return this._preferencesEditor===null&&(this._preferencesEditor=new At(this._preferences,this.settings,this.pub.metadata)),this._preferencesEditor}async submitPreferences(e){this._preferences=this._preferences.merging(e),await this.applyPreferences()}async applyPreferences(){this._settings=new Ct(this._preferences,this._defaults,this.hasDisplayTransformability),this._preferencesEditor!==null&&(this._preferencesEditor=new At(this._preferences,this.settings,this.pub.metadata)),await this.updateCSS(!0)}async updateCSS(e){this._css.update(this._settings),e&&await this.commitCSS(this._css)}compileCSSProperties(e){const t={};for(const[i,n]of Object.entries(e.rsProperties.toCSSProperties()))t[i]=n;for(const[i,n]of Object.entries(e.userProperties.toCSSProperties()))t[i]=n;return t}async commitCSS(e){const t=this.compileCSSProperties(e);this.framePool.setCSSProperties(t)}get _cframes(){return this.framePool.currentFrames}get hasDisplayTransformability(){return this.pub.metadata?.accessibility?.feature?.some(e=>e.value===jt.DISPLAY_TRANSFORMABILITY.value)??!1}eventListener(e,t){switch(e){case"_pong":this.listeners.frameLoaded(this.framePool.currentFrames[0].iframe.contentWindow),this.listeners.positionChanged(this.currentLocation);break;case"first_visible_locator":const i=ae.deserialize(t);if(!i)break;this.currentLocation=new ae({href:this.currentLocation.href,type:this.currentLocation.type,title:this.currentLocation.title,locations:i?.locations,text:i?.text}),this.listeners.positionChanged(this.currentLocation);break;case"text_selected":this.listeners.textSelected(t);break;case"click":case"tap":const n=t;if(n.interactiveElement){const o=new DOMParser().parseFromString(n.interactiveElement,"text/html").body.children[0];if(o.nodeType===o.ELEMENT_NODE&&o.nodeName==="A"&&o.hasAttribute("href")){const s=o.attributes.getNamedItem("href")?.value;if(s.startsWith("#"))this.go(this.currentLocation.copyWithLocations({fragments:[s.substring(1)]}),!1,()=>{});else if(s.startsWith("mailto:")||s.startsWith("tel:"))this.listeners.handleLocator(new K({href:s}).locator);else try{let a;if(s.startsWith("http://")||s.startsWith("https://"))a=s;else if(this.currentLocation.href.startsWith("http://")||this.currentLocation.href.startsWith("https://")){const h=new URL(this.currentLocation.href);a=new URL(s,h).href}else a=Je.join(Je.dirname(this.currentLocation.href),s);const l=this.pub.readingOrder.findWithHref(a);l?this.goLink(l,!1,()=>{}):(console.warn(`Internal link not found in readingOrder: ${a}`),this.listeners.handleLocator(new K({href:s}).locator))}catch(a){console.warn(`Couldn't resolve internal link for ${s}: ${a}`),this.listeners.handleLocator(new K({href:s}).locator)}}else console.log("Clicked on",o)}else if(e==="click"?this.listeners.click(n):this.listeners.tap(n))break;break;case"scroll":this.listeners.scroll(t);break;case"zoom":this.listeners.zoom(t);break;case"progress":this.syncLocation(t);break;case"log":console.log(this.framePool.currentFrames[0]?.source?.split("/")[3],...t);break;default:this.listeners.customEvent(e,t);break}}determineModules(){return Array.from(Ye.keys()).filter(t=>rr.includes(t))}attachListener(){this.framePool.currentFrames[0]?.msg&&(this.framePool.currentFrames[0].msg.listener=(e,t)=>{this.eventListener(e,t)})}async apply(){if(await this.framePool.update(this.pub,this.currentLocation,this.determineModules()),this.attachListener(),this.pub.readingOrder.findIndexWithHref(this.currentLocation.href)<0)throw Error("Link for "+this.currentLocation.href+" not found!")}async destroy(){await this.framePool?.destroy()}async changeResource(e){if(e===0)return!1;const t=this.pub.readingOrder.findIndexWithHref(this.currentLocation.href),i=Math.max(0,Math.min(this.pub.readingOrder.items.length-1,t+e));return i===t?!1:(this.currentIndex=i,this.currentLocation=this.createCurrentLocator(),await this.apply(),!0)}updateViewport(e){this.webViewport.readingOrder=[],this.webViewport.progressions.clear(),this.webViewport.positions=null,this.currentLocation&&(this.webViewport.readingOrder.push(this.currentLocation.href),this.webViewport.progressions.set(this.currentLocation.href,e),this.currentLocation.locations?.position!==void 0&&(this.webViewport.positions=[this.currentLocation.locations.position]))}async syncLocation(e){const t=e;this.currentLocation&&(this.currentLocation=this.currentLocation.copyWithLocations({progression:t.start})),this.updateViewport(t),this.listeners.positionChanged(this.currentLocation),await this.framePool.update(this.pub,this.currentLocation,this.determineModules())}goBackward(e,t){this.changeResource(-1).then(i=>{t(i)})}goForward(e,t){this.changeResource(1).then(i=>{t(i)})}get currentLocator(){return this.currentLocation}get viewport(){return this.webViewport}get isScrollStart(){const e=this.viewport.readingOrder[0];return this.viewport.progressions.get(e)?.start===0}get isScrollEnd(){const e=this.viewport.readingOrder[this.viewport.readingOrder.length-1];return this.viewport.progressions.get(e)?.end===1}get canGoBackward(){const e=this.pub.readingOrder.items[0]?.href;return!(this.viewport.progressions.has(e)&&this.viewport.progressions.get(e)?.start===0)}get canGoForward(){const e=this.pub.readingOrder.items[this.pub.readingOrder.items.length-1]?.href;return!(this.viewport.progressions.has(e)&&this.viewport.progressions.get(e)?.end===1)}get readingProgression(){return this.pub.metadata.effectiveReadingProgression}get publication(){return this.pub}async loadLocator(e,t){let i=!1,n=typeof e.locations.getCssSelector=="function"&&e.locations.getCssSelector();if(e.text?.highlight?i=await new Promise((l,h)=>{this.framePool.currentFrames[0].msg.send("go_text",n?[e.text?.serialize(),n]:e.text?.serialize(),d=>l(d))}):n&&(i=await new Promise((l,h)=>{this.framePool.currentFrames[0].msg.send("go_text",["",n],d=>l(d))})),i){t(i);return}const o=typeof e.locations.htmlId=="function"&&e.locations.htmlId();if(o&&(i=await new Promise((l,h)=>{this.framePool.currentFrames[0].msg.send("go_id",o,d=>l(d))})),i){t(i);return}const s=e?.locations?.progression;s&&s>0?i=await new Promise((l,h)=>{this.framePool.currentFrames[0].msg.send("go_progression",s,d=>l(d))}):i=!0,t(i)}go(e,t,i){const n=e.href.split("#")[0];if(!this.pub.readingOrder.findWithHref(n))return i(this.listeners.handleLocator(e));const s=this.pub.readingOrder.findIndexWithHref(n);s>=0&&(this.currentIndex=s),this.currentLocation=this.createCurrentLocator(),this.apply().then(()=>this.loadLocator(e,a=>i(a))).then(()=>{this.attachListener()})}goLink(e,t,i){return this.go(e.locator,t,i)}createCurrentLocator(){const t=this.pub.readingOrder.items[this.currentIndex];if(!t)throw new Error("No current resource available");const n=this.currentLocation&&this.currentLocation.href===t.href&&this.currentLocation.locations.progression?this.currentLocation.locations.progression:0;return this.pub.manifest.locatorFromLink(t)||new ae({href:t.href,type:t.type||"text/html",locations:new U({fragments:[],progression:n,position:this.currentIndex+1})})}}const fr=hn,br=r=>{const e=r.join(" ");return["upgrade-insecure-requests",`default-src ${e} blob:`,"connect-src 'none'",`script-src ${e} blob: 'unsafe-inline'`,`style-src ${e} blob: 'unsafe-inline'`,`img-src ${e} blob: data:`,`font-src ${e} blob: data:`,`object-src ${e} blob:`,`child-src ${e}`,"form-action 'none'"].join("; ")};class un{constructor(e,t,i,n){this.injector=null,this.pub=e,this.item=i,this.burl=i.toURL(t)||"",this.cssProperties=n.cssProperties,this.injector=n.injector??null}async build(e=!1){if(this.item.mediaType.isHTML)return await this.buildHtmlFrame(e);if(this.item.mediaType.isBitmap||this.item.mediaType.equals(m.SVG))return this.buildImageFrame();throw Error("Unsupported frame mediatype "+this.item.mediaType.string)}async buildHtmlFrame(e=!1){const t=await this.pub.get(this.item).readAsString();if(!t)throw new Error(`Failed reading item ${this.item.href}`);const i=new DOMParser().parseFromString(t,this.item.mediaType.string),n=i.querySelector("parsererror");if(n){const o=n.querySelector("div");throw new Error(`Failed parsing item ${this.item.href}: ${o?.textContent||n.textContent}`)}return this.injector&&await this.injector.injectForDocument(i,this.item),this.finalizeDOM(i,this.pub.baseURL,this.burl,this.item.mediaType,e,this.cssProperties)}buildImageFrame(){const e=document.implementation.createHTMLDocument(this.item.title||this.item.href),t=document.createElement("img");return t.src=this.burl||"",t.alt=this.item.title||"",t.decoding="async",e.body.appendChild(t),this.finalizeDOM(e,this.pub.baseURL,this.burl,this.item.mediaType,!0)}setProperties(e,t){for(const i in e){const n=e[i];n&&t.documentElement.style.setProperty(i,n)}}finalizeDOM(e,t,i,n,o=!1,s){if(!e)return"";const a=this.injector?.getAllowedDomains?.()||[],l=[...new Set([...t?[t]:[],...a])].filter(Boolean);if(s&&!o&&this.setProperties(s,e),e.body.querySelectorAll("img").forEach(d=>{d.setAttribute("fetchpriority","high")}),n.isHTML&&this.pub.metadata.languages?.[0]){const d=this.pub.metadata.languages[0];if(n===m.XHTML){const u=document.documentElement.lang||document.documentElement.getAttribute("xml:lang"),p=document.body.lang||document.body.getAttribute("xml:lang");p&&!u?(document.documentElement.lang=p,document.documentElement.setAttribute("xml:lang",p),document.body.removeAttribute("xml:lang"),document.body.removeAttribute("lang")):u||(document.documentElement.lang=d,document.documentElement.setAttribute("xml:lang",d))}else n===m.HTML&&!document.documentElement.lang&&(document.documentElement.lang=d)}if(i!==void 0){const d=e.createElement("base");d.href=i,d.dataset.readium="true",e.head.firstChild.before(d)}const h=e.createElement("meta");return h.httpEquiv="Content-Security-Policy",h.content=br(l),h.dataset.readium="true",e.head.firstChild.before(h),URL.createObjectURL(new Blob([new XMLSerializer().serializeToString(e)],{type:n.isHTML?n.string:"application/xhtml+xml"}))}}class pn{constructor(e){this.hidden=!0,this.destroyed=!1,this.currModules=[],this.frame=document.createElement("iframe"),this.frame.sandbox.value="allow-same-origin allow-scripts",this.frame.classList.add("readium-navigator-iframe"),this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.position="absolute",this.frame.style.pointerEvents="none",this.frame.style.transition="visibility 0s, opacity 0.1s linear",this.source=e}async load(e){return new Promise((t,i)=>{if(this.loader){const n=this.frame.contentWindow;if([...this.currModules].sort().join("|")===[...e].sort().join("|")){try{t(n)}catch{}return}this.comms?.halt(),this.loader.destroy(),this.loader=new pe(n,e),this.currModules=e,this.comms=void 0;try{t(n)}catch{}return}this.frame.onload=()=>{const n=this.frame.contentWindow;this.loader=new pe(n,e),this.currModules=e;try{t(n)}catch{}},this.frame.onerror=n=>{try{i(n)}catch{}},this.frame.contentWindow.location.replace(this.source)})}async destroy(){await this.hide(),this.loader?.destroy(),this.frame.remove(),this.destroyed=!0}async hide(){if(!this.destroyed){if(this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.opacity="0",this.frame.style.pointerEvents="none",this.hidden=!0,this.frame.parentElement)return this.comms===void 0||!this.comms.ready?void 0:new Promise((e,t)=>{this.comms?.send("unfocus",void 0,i=>{this.comms?.halt(),e()})});this.comms?.halt()}}async show(e){if(this.destroyed)throw Error("Trying to show frame when it doesn't exist");if(!this.frame.parentElement)throw Error("Trying to show frame that is not attached to the DOM");return this.comms?this.comms.resume():this.comms=new me(this.frame.contentWindow,this.source),new Promise((t,i)=>{this.comms?.send("activate",void 0,()=>{this.comms?.send("focus",void 0,()=>{const n=()=>{this.frame.style.removeProperty("visibility"),this.frame.style.removeProperty("aria-hidden"),this.frame.style.removeProperty("opacity"),this.frame.style.removeProperty("pointer-events"),this.hidden=!1,fe.UA.WebKit&&this.comms?.send("force_webkit_recalc",void 0),t()};e!==void 0?this.comms?.send("go_progression",e,n):n()})})})}setCSSProperties(e){this.destroyed||!this.frame.contentWindow||(this.hidden&&(this.comms?this.comms?.resume():this.comms=new me(this.frame.contentWindow,this.source)),this.comms?.send("update_properties",e),this.hidden&&this.comms?.halt())}get iframe(){if(this.destroyed)throw Error("Trying to use frame when it doesn't exist");return this.frame}get realSize(){if(this.destroyed)throw Error("Trying to use frame client rect when it doesn't exist");return this.frame.getBoundingClientRect()}get window(){if(this.destroyed||!this.frame.contentWindow)throw Error("Trying to use frame window when it doesn't exist");return this.frame.contentWindow}get atLeft(){return this.window.scrollX<5}get atRight(){return this.window.scrollX>this.window.document.scrollingElement.scrollWidth-this.window.innerWidth-5}get msg(){return this.comms}get ldr(){return this.loader}}const mn=5,gn=3;class fn{constructor(e,t,i,n){this.pool=new Map,this.blobs=new Map,this.inprogress=new Map,this.pendingUpdates=new Map,this.injector=null,this.container=e,this.positions=t,this.currentCssProperties=i,this.injector=n??null}async destroy(){let e=this.inprogress.values(),t=e.next();const i=[];for(;t.value;)i.push(t.value),t=e.next();i.length>0&&await Promise.allSettled(i),this.inprogress.clear();let n=this.pool.values(),o=n.next();for(;o.value;)await o.value.destroy(),o=n.next();this.pool.clear(),this.blobs.forEach(s=>{this.injector?.releaseBlobUrl?.(s),URL.revokeObjectURL(s)}),this.injector?.dispose(),this.container.childNodes.forEach(s=>{(s.nodeType===Node.ELEMENT_NODE||s.nodeType===Node.TEXT_NODE)&&s.remove()})}async update(e,t,i,n=!1){let o=this.positions.findIndex(l=>l.locations.position===t.locations.position);if(o<0)throw Error(`Locator not found in position list: ${t.locations.position} > ${this.positions.reduce((l,h)=>h.locations.position||0>l?h.locations.position||0:l,0)}`);const s=this.positions[o].href;this.inprogress.has(s)&&await this.inprogress.get(s);const a=new Promise(async(l,h)=>{const d=[],u=[];this.positions.forEach((c,f)=>{(f>o+mn||f<o-mn)&&(d.includes(c.href)||d.push(c.href)),f<o+gn&&f>o-gn&&(u.includes(c.href)||u.push(c.href))}),d.forEach(async c=>{u.includes(c)||this.pool.has(c)&&(await this.pool.get(c)?.destroy(),this.pool.delete(c),this.pendingUpdates.has(c)&&this.pendingUpdates.set(c,{inPool:!1}))}),this.currentBaseURL!==void 0&&e.baseURL!==this.currentBaseURL&&(this.blobs.forEach(c=>{this.injector?.releaseBlobUrl?.(c),URL.revokeObjectURL(c)}),this.blobs.clear()),this.currentBaseURL=e.baseURL;const p=async c=>{if(n&&(this.blobs.forEach(w=>{this.injector?.releaseBlobUrl?.(w),URL.revokeObjectURL(w)}),this.blobs.clear(),this.pendingUpdates.clear()),this.pendingUpdates.has(c)&&this.pendingUpdates.get(c)?.inPool===!1){const w=this.blobs.get(c);w&&(this.injector?.releaseBlobUrl?.(w),URL.revokeObjectURL(w),this.blobs.delete(c),this.pendingUpdates.delete(c))}if(this.pool.has(c)){const w=this.pool.get(c);if(!this.blobs.has(c))await w.destroy(),this.pool.delete(c),this.pendingUpdates.delete(c);else{await w.load(i);return}}const f=e.readingOrder.findWithHref(c);if(!f)return;if(!this.blobs.has(c)){const R=await new un(e,this.currentBaseURL||"",f,{cssProperties:this.currentCssProperties,injector:this.injector}).build();this.blobs.set(c,R)}const _=new pn(this.blobs.get(c));c!==s&&await _.hide(),this.container.appendChild(_.iframe),await _.load(i),this.pool.set(c,_)};try{await Promise.all(u.map(c=>p(c)))}catch(c){h(c)}const v=this.pool.get(s);(v?.source!==this._currentFrame?.source||n)&&(await this._currentFrame?.hide(),v&&await v.load(i),v&&await v.show(t.locations.progression),this._currentFrame=v),l()});this.inprogress.set(s,a),await a,this.inprogress.delete(s)}setCSSProperties(e){if(!((i,n)=>{const o=Object.keys(i),s=Object.keys(n);if(o.length!==s.length)return!1;for(const a of o)if(i[a]!==n[a])return!1;return!0})(this.currentCssProperties||{},e)){this.currentCssProperties=e,this.pool.forEach(i=>{i.setCSSProperties(e)});for(const i of this.blobs.keys())this.pendingUpdates.set(i,{inPool:this.pool.has(i)})}}get currentFrames(){return[this._currentFrame]}get currentBounds(){const e={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0,toJSON(){return this}};return this.currentFrames.forEach(t=>{if(!t)return;const i=t.realSize;e.x=Math.min(e.x,i.x),e.y=Math.min(e.y,i.y),e.width+=i.width,e.height=Math.max(e.height,i.height),e.top=Math.min(e.top,i.top),e.right=Math.min(e.right,i.right),e.bottom=Math.min(e.bottom,i.bottom),e.left=Math.min(e.left,i.left)}),e}}class bn{constructor(e,t,i){this.currModules=[],this.cachedPage=void 0,this.peripherals=e,this.debugHref=i,this.frame=document.createElement("iframe"),this.frame.sandbox.value="allow-same-origin allow-scripts",this.frame.classList.add("readium-navigator-iframe"),this.frame.classList.add("blank"),this.frame.scrolling="no",this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.display="none",this.frame.style.position="absolute",this.frame.style.pointerEvents="none",this.frame.style.transformOrigin="0 0",this.frame.style.transform="scale(1)",this.frame.style.background="#fff",this.frame.style.touchAction="none",this.frame.dataset.originalHref=i,this.source="about:blank",this.wrapper=document.createElement("div"),this.wrapper.style.position="relative",this.wrapper.style.float=this.wrapper.style.cssFloat=t===O.rtl?"right":"left",this.wrapper.appendChild(this.frame)}async load(e,t){return this.source===t&&this.loadPromise&&[...this.currModules].sort().join("|")===[...e].sort().join("|")?this.loadPromise:(this.loaded&&this.source!==t&&this.window.stop(),this.source=t,this.loadPromise=new Promise((i,n)=>{if(this.loader&&this.loaded){const o=this.frame.contentWindow;if([...this.currModules].sort().join("|")===[...e].sort().join("|")){try{i(o),this.loadPromise=void 0}catch{}return}this.comms?.halt(),this.loader.destroy(),this.loader=new pe(o,e),this.currModules=e,this.comms=void 0;try{i(o),this.loadPromise=void 0}catch{}return}this.frame.addEventListener("load",()=>{const o=this.frame.contentWindow;this.loader=new pe(o,e),this.currModules=e,this.peripherals.observe(this.wrapper),this.peripherals.observe(o);try{i(o)}catch{}},{once:!0}),this.frame.addEventListener("error",o=>{try{n(o.error),this.loadPromise=void 0}catch{}},{once:!0}),this.frame.style.removeProperty("display"),this.frame.contentWindow.location.replace(this.source)}),this.loadPromise)}loadPageSize(){const e=this.frame.contentWindow,t=e.document.head.querySelector("meta[name=viewport]");if(t){const i=/(\w+) *= *([^\s,]+)/g;let n,o=0,s=0;for(;n=i.exec(t.content);)n[1]==="width"?o=Number.parseFloat(n[2]):n[1]==="height"&&(s=Number.parseFloat(n[2]));if(o>0&&s>0)return{width:o,height:s}}return{width:e.document.body.scrollWidth,height:e.document.body.scrollHeight}}update(e){if(!this.loaded)return;const t=this.loadPageSize();this.frame.style.height=`${t.height}px`,this.frame.style.width=`${t.width}px`;const i=Math.min(this.wrapper.clientWidth/t.width,this.wrapper.clientHeight/t.height);this.frame.style.transform=`scale(${i})`;const n=this.frame.getBoundingClientRect(),o=this.wrapper.clientHeight-n.height;if(this.frame.style.top=`${o/2}px`,e===H.left){const s=this.wrapper.clientWidth-n.width;this.frame.style.left=`${s}px`}else if(e===H.center){const s=this.wrapper.clientWidth-n.width;this.frame.style.left=`${s/2}px`}else this.frame.style.left="0px";this.frame.style.removeProperty("visibility"),this.frame.style.removeProperty("aria-hidden"),this.frame.style.removeProperty("pointer-events"),this.frame.classList.remove("blank"),this.frame.classList.add("loaded")}async destroy(){await this.unfocus(),this.loader?.destroy(),this.wrapper.remove()}async unload(){if(this.loaded)return this.deselect(),this.frame.style.visibility="hidden",this.frame.style.setProperty("aria-hidden","true"),this.frame.style.pointerEvents="none",this.frame.classList.add("blank"),this.frame.classList.remove("loaded"),this.comms?.halt(),this.loader?.destroy(),this.comms=void 0,this.frame.blur(),new Promise((e,t)=>{this.frame.addEventListener("load",()=>{try{this.showPromise=void 0,e()}catch{}},{once:!0}),this.frame.addEventListener("error",i=>{try{this.showPromise=void 0,t(i.error)}catch{}},{once:!0}),this.source="about:blank",this.frame.contentWindow.location.replace("about:blank"),this.frame.style.display="none"})}deselect(){this.frame.contentWindow?.getSelection()?.removeAllRanges()}async unfocus(){if(this.frame.parentElement)return this.comms===void 0?void 0:new Promise((e,t)=>{this.comms?.send("unfocus",void 0,i=>{this.comms?.halt(),this.showPromise=void 0,e()})});this.comms?.halt()}async show(e){if(!this.frame.parentElement){console.warn("Trying to show frame that is not attached to the DOM");return}if(!this.loaded){this.showPromise=void 0;return}return this.showPromise?(this.cachedPage!==e&&(this.update(e),this.cachedPage=e),this.showPromise):(this.cachedPage=e,this.comms?this.comms.resume():this.comms=new me(this.frame.contentWindow,this.source),this.showPromise=new Promise((t,i)=>{this.comms.send("focus",void 0,n=>{this.update(this.cachedPage),t()})}),this.showPromise)}async activate(){return new Promise((e,t)=>{if(!this.comms)return e();this.comms?.send("activate",void 0,()=>{e()})})}get element(){return this.wrapper}get iframe(){return this.frame}get realSize(){return this.frame.getBoundingClientRect()}get loaded(){return this.frame.contentWindow&&this.frame.contentWindow.location.href!=="about:blank"}set width(e){const t=`${e}%`;this.wrapper.style.width!==t&&(this.wrapper.style.width=t)}set height(e){const t=`${e}px`;this.wrapper.style.height!==t&&(this.wrapper.style.height=t)}get window(){if(!this.frame.contentWindow)throw Error("Trying to use frame window when it doesn't exist");return this.frame.contentWindow}get atLeft(){return this.window.scrollX<5}get atRight(){return this.window.scrollX>this.window.document.scrollingElement.scrollWidth-this.window.innerWidth-5}get msg(){return this.comms}get ldr(){return this.loader}}var yn=(r=>(r[r.Left=0]="Left",r[r.Center=1]="Center",r[r.Right=2]="Right",r))(yn||{}),vn=(r=>(r[r.Top=0]="Top",r[r.Middle=1]="Middle",r[r.Bottom=2]="Bottom",r))(vn||{});class Sn{constructor(){this.outerWidth=0,this.outerHeight=0,this.HTML=document.documentElement,this.Head=document.head,this.Body=document.body}refreshOuterPixels(e){fe.OS.iOS||(this.outerHeight=window.outerHeight-window.innerHeight,fe.OS.Android&&fe.UA.Chrome&&window.screen.height>window.innerHeight&&(this.outerHeight=(window.screen.height-window.innerHeight)/1.5),this.outerWidth=window.outerWidth-window.innerWidth)}getBibiEventCoord(e,t=0){const i={X:0,Y:0};return/^touch/.test(e.type)?(i.X=e.touches[t].screenX,i.Y=e.touches[t].screenY):(i.X=e.screenX,i.Y=e.screenY),(e.target.ownerDocument?.documentElement||e.target.documentElement)===this.HTML&&(i.X-=this.HTML.scrollLeft+this.Body.scrollLeft,i.Y-=this.HTML.scrollTop+this.Body.scrollTop),i.X-=this.outerWidth,i.Y-=this.outerHeight,i}getTouchDistance(e){if(e.touches.length!==2)return 0;const t=e.touches[0].screenX-this.outerWidth,i=e.touches[0].screenY-this.outerHeight,n=e.touches[1].screenX-this.outerWidth,o=e.touches[1].screenY-this.outerHeight;return Math.sqrt(Math.pow(n-t,2)+Math.pow(o-i,2))}getTouchCenter(e){if(e.touches.length!==2)return null;const t=this.HTML.scrollLeft+this.Body.scrollLeft,i=this.HTML.scrollTop+this.Body.scrollTop,n=e.touches[0].screenX-this.outerWidth-t,o=e.touches[0].screenY-this.outerHeight-i,s=e.touches[1].screenX-this.outerWidth-t,a=e.touches[1].screenY-this.outerHeight-i;return{X:(n+s)/2,Y:(o+a)/2}}getBibiEvent(e){if(!e)return{Coord:null,Division:null,Ratio:null,Target:null};const t=this.getBibiEventCoord(e);let i=.3;const n={X:t.X/window.innerWidth,Y:t.Y/window.innerHeight};let o,s,a,l;a=o=i,l=s=1-i;const h={X:null,Y:null};return n.X<a?h.X=0:l<n.X?h.X=2:h.X=1,n.Y<o?h.Y=0:s<n.Y?h.Y=2:h.Y=1,{Target:e.target,Coord:t,Ratio:n,Division:h}}}class yr{constructor(){this._DOM={show:!1,pinchTarget:document.createElement("div"),touch1:document.createElement("div"),touch2:document.createElement("div"),center:document.createElement("div"),stats:document.createElement("div")},this._DOM.show=!0,this._DOM.pinchTarget.style.zIndex=this._DOM.stats.style.zIndex=this._DOM.center.style.zIndex=this._DOM.touch1.style.zIndex=this._DOM.touch2.style.zIndex="100000",this._DOM.pinchTarget.style.position=this._DOM.stats.style.position=this._DOM.center.style.position=this._DOM.touch1.style.position=this._DOM.touch2.style.position="absolute",this._DOM.pinchTarget.style.borderRadius=this._DOM.center.style.borderRadius=this._DOM.touch1.style.borderRadius=this._DOM.touch2.style.borderRadius="50%",this._DOM.pinchTarget.style.pointerEvents=this._DOM.stats.style.pointerEvents=this._DOM.center.style.pointerEvents=this._DOM.touch1.style.pointerEvents=this._DOM.touch2.style.pointerEvents="none",this._DOM.pinchTarget.style.display=this._DOM.center.style.display=this._DOM.touch1.style.display=this._DOM.touch2.style.display="none",this._DOM.pinchTarget.style.paddingTop=this._DOM.center.style.paddingTop="10px",this._DOM.pinchTarget.style.width=this._DOM.pinchTarget.style.height=this._DOM.center.style.width=this._DOM.center.style.height="10px",this._DOM.pinchTarget.style.backgroundColor="green",this._DOM.center.style.backgroundColor="red",this._DOM.touch1.style.backgroundColor=this._DOM.touch2.style.backgroundColor="blue",this._DOM.touch1.style.height=this._DOM.touch2.style.height="20px",this._DOM.touch1.style.width=this._DOM.touch2.style.width="20px",this._DOM.touch1.style.paddingTop=this._DOM.touch2.style.paddingTop="20px",this._DOM.touch1.textContent="1",this._DOM.touch2.textContent="2",this._DOM.stats.style.padding="20px",this._DOM.stats.style.backgroundColor="rgba(0,0,0,0.5)",this._DOM.stats.style.color="white",this._DOM.stats.textContent="[stats]",document.body.appendChild(this._DOM.stats),document.body.appendChild(this._DOM.center),document.body.appendChild(this._DOM.touch1),document.body.appendChild(this._DOM.touch2),document.body.appendChild(this._DOM.pinchTarget)}get show(){return this.DOM.show}get DOM(){return this._DOM}}const _n=6,Tt=1.02,wn=50;class kn{constructor(e,t=!1){this.dragState=0,this.minimumMoved=!1,this.pan={startX:0,endX:0,startY:0,overscrollX:0,overscrollY:0,letItGo:!1,preventClick:!1,translateX:0,translateY:0,touchID:0},this.pinch={startDistance:0,startScale:0,target:{X:0,Y:0},touchN:0,startTranslate:{X:0,Y:0}},this._scale=1,this.scaleDebouncer=0,this.frameBounds=null,this.debugger=null,this.btouchstartHandler=this.touchstartHandler.bind(this),this.btouchendHandler=this.touchendHandler.bind(this),this.btouchmoveHandler=this.touchmoveHandler.bind(this),this.bdblclickHandler=this.dblclickHandler.bind(this),this.bmousedownHandler=this.mousedownHandler.bind(this),this.bmouseupHandler=this.mouseupHandler.bind(this),this.bmousemoveHandler=this.mousemoveHandler.bind(this),this.moveFrame=0,this.manager=e,this.coordinator=new Sn,this.attachEvents(),t&&(this.debugger=new yr)}get scale(){return this._scale}set scale(e){isNaN(e)&&(e=1),window.clearTimeout(this.scaleDebouncer),this.scaleDebouncer=window.setTimeout(()=>{this.dragState===0&&this.scale<Tt&&(this.pan.translateX=0,this.pan.translateY=0,this.clearPan(),this.manager.updateBookStyle()),this.manager.listener("zoom",e)},100),this._scale=e}attachEvents(){this.observe(this.manager.spineElement),this.pan={startX:0,startY:0,endX:0,overscrollX:0,overscrollY:0,letItGo:!1,preventClick:!1,translateX:0,translateY:0,touchID:0},this.pinch={startDistance:0,startScale:0,target:{X:0,Y:0},startTranslate:{X:0,Y:0},touchN:0}}clearPan(){this.pan.letItGo=!1,this.pan.touchID=0,this.pan.endX=0,this.pan.overscrollX=0,this.pan.overscrollY=0}clearPinch(){this.pinch={startDistance:0,startScale:this.pinch.startScale,target:{X:0,Y:0},touchN:0,startTranslate:{X:0,Y:0}}}observe(e){e.addEventListener("touchstart",this.btouchstartHandler),e.addEventListener("touchend",this.btouchendHandler),e.addEventListener("touchmove",this.btouchmoveHandler,{passive:!0}),e.addEventListener("dblclick",this.bdblclickHandler,{passive:!0}),e.addEventListener("mousedown",this.bmousedownHandler),e.addEventListener("mouseup",this.bmouseupHandler),e.addEventListener("mousemove",this.bmousemoveHandler)}clickHandler(e){}touchstartHandler(e){if(["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.target.nodeName)!==-1)return;switch(e.stopPropagation(),this.frameBounds=this.manager.currentBounds,this.coordinator.refreshOuterPixels(this.frameBounds),e.touches.length){case 3:return;case 2:{e.preventDefault(),this.pinch.startDistance=this.coordinator.getTouchDistance(e);const n=this.startTouch(e);this.pan.startX=n.X,this.pan.startY=n.Y,this.dragState=2,this.manager.updateBookStyle(!0),this.isScaled?(this.pinch.target.X-=this.pan.translateX*(this.pinch.startScale/this.scale),this.pinch.target.Y-=this.pan.translateY*(this.pinch.startScale/this.scale),this.pinch.target={X:0,Y:0},this.pinch.startScale=1/this.scale):(this.pinch.target={X:0,Y:0},this.pinch.startScale=this.scale),this.pinch.startTranslate={X:this.pan.translateX,Y:this.pan.translateY},this.debugger?.show&&(this.debugger.DOM.touch2.style.display="",this.debugger.DOM.center.style.display="",this.debugger.DOM.pinchTarget.style.display="");return}case 1:this.pan.touchID=e.touches[0].identifier,this.debugger?.show&&(this.debugger.DOM.touch1.style.display="");default:this.dragState<1&&(this.dragState=1),this.manager.updateBookStyle(!0)}this.manager.updateSpineStyle(!1);const i=this.startTouch(e);this.pan.startX=i.X,this.pan.startY=i.Y}startTouch(e){const t=this.coordinator.getTouchCenter(e)||this.coordinator.getBibiEventCoord(e);return{X:t.X-this.manager.width/2-this.pan.translateX*this.scale+this.manager.width/2,Y:t.Y-this.manager.height/2-this.pan.translateY*this.scale+this.manager.height/2}}touchendHandler(e){if(e.stopPropagation(),!e.touches||e.touches.length===0)this.pan.endX&&!this.isScaled?(this.pinch.touchN&&(this.pan.endX=this.pan.startX),this.updateAfterDrag()):!this.pinch.touchN&&Math.abs(this.pan.overscrollX)>wn&&Math.abs(this.pan.overscrollY)<wn/2&&(this.pan.startX=0,this.pan.endX=-this.pan.overscrollX,this.updateAfterDrag()),this.dragState=0,this.minimumMoved=!1,this.clearPinch(),this.debugger?.show&&(this.debugger.DOM.center.style.display="none",this.debugger.DOM.touch1.style.display="none",this.debugger.DOM.touch2.style.display="none");else if(e.touches.length===1){this.dragState=1,e.touches[0].identifier!==this.pan.touchID&&(this.pan.touchID=e.touches[0].identifier),this.debugger?.show&&(this.debugger.DOM.center.style.display="none",this.debugger.DOM.touch2.style.display="none",this.debugger.DOM.pinchTarget.style.display="none");const t=this.startTouch(e);this.pan.startX=t.X,this.pan.startY=t.Y}window.setTimeout(()=>{this.manager.updateBookStyle(!0),this.dragState===0&&(this.scale<Tt&&(this.pan.translateX=0,this.pan.translateY=0),this.clearPan()),this.manager.updateBookStyle(!0)},50)}touchmoveHandler(e){e.stopPropagation();const t=this.coordinator.getBibiEventCoord(e);Math.abs(this.pan.startY-t.Y)+Math.abs(this.pan.startX-t.X)>5&&(this.minimumMoved||(this.manager.deselect(),this.minimumMoved=!0),this.dragState<1&&(this.dragState=1));const i=this.coordinator?.getTouchDistance(e);let n=!1;const o=this.scale;if(this.dragState===2&&i){if(this.pinch.touchN++,this.pinch.touchN<4)return;let s=i/this.pinch.startDistance*this.scale;s>=_n&&(s=_n),s<=Tt&&(s=1),this.scale=s,this.pinch.startDistance=i,n=!0}if(this.pan.letItGo===!1&&(this.pan.letItGo=Math.abs(this.pan.startY-t.Y)<Math.abs(this.pan.startX-t.X)),this.debugger?.show&&(this.debugger.DOM.touch1.style.top=`${t.Y-10}px`,this.debugger.DOM.touch1.style.left=`${t.X-10}px`,this.debugger.DOM.touch1.innerText=`${t.X.toFixed(2)},${t.Y.toFixed(2)}`),this.dragState>0&&this.isScaled||this.dragState>1){if(this.dragState===1){const l={X:t.X-this.manager.width/2,Y:t.Y-this.manager.height/2};this.pan.translateX=(l.X-(this.pan.startX-this.manager.width/2))*1/this.scale,this.pan.translateY=(l.Y-(this.pan.startY-this.manager.height/2))*1/this.scale}else if(this.dragState===2){const l=this.coordinator.getTouchCenter(e);if(this.debugger?.show){this.debugger.DOM.center.style.top=`${l.Y-5}px`,this.debugger.DOM.center.style.left=`${l.X-5}px`,this.debugger.DOM.center.innerText=`${l.X.toFixed(2)},${l.Y.toFixed(2)}`;const v=this.coordinator.getBibiEventCoord(e,1);this.debugger.DOM.touch2.style.top=`${v.Y-10}px`,this.debugger.DOM.touch2.style.left=`${v.X-10}px`,this.debugger.DOM.touch2.innerText=`${v.X.toFixed(2)},${v.Y.toFixed(2)}`}l.X-=this.manager.width/2,l.Y-=this.manager.height/2;let h=-l.X/o;h+=l.X/this.scale,this.pinch.target.X+=h,l.X+=this.pinch.target.X*this.scale/this.pinch.startScale;let d=-l.Y/o;d+=l.Y/this.scale,this.pinch.target.Y+=d,l.Y+=this.pinch.target.Y*this.scale/this.pinch.startScale;let u=(l.X-(this.pan.startX-this.manager.width/2))*1/this.scale,p=(l.Y-(this.pan.startY-this.manager.height/2))*1/this.scale;this.pan.translateX=u,this.pan.translateY=p,this.debugger?.show&&(this.debugger.DOM.pinchTarget.style.left=`${this.pinch.target.X*this.scale/this.pinch.startScale-5+this.manager.width/2}px`,this.debugger.DOM.pinchTarget.style.top=`${this.pinch.target.Y*this.scale/this.pinch.startScale-5+this.manager.height/2}px`,this.debugger.DOM.pinchTarget.innerText=`${(this.pinch.target.X*this.scale/this.pinch.startScale).toFixed(2)},${(this.pinch.target.Y*this.scale/this.pinch.startScale).toFixed(2)}`)}const s=this.frameBounds.width/6,a=this.frameBounds.height/6;this.pan.translateX<-s&&(this.pan.overscrollX=-(s+this.pan.translateX),this.pan.translateX=-s),this.pan.translateY<-a&&(this.pan.overscrollY=-(a+this.pan.translateY),this.pan.translateY=-a),this.pan.translateX>s&&(this.pan.overscrollX=s-this.pan.translateX,this.pan.translateX=s),this.pan.translateY>a&&(this.pan.overscrollY=a-this.pan.translateY,this.pan.translateY=a),n=!0,this.debugger?.show&&(this.debugger.DOM.stats.innerText=`TX: ${this.pan.translateX.toFixed(2)}
110
378
  TY: ${this.pan.translateY.toFixed(2)}
111
379
  Zoom: ${this.scale.toFixed(2)}
112
- Overscroll: ${this.pan.overscrollX.toFixed(2)},${this.pan.overscrollY.toFixed(2)}`)}if(A){this.manager.updateBookStyle();return}if(this.dragState>0&&this.pan.letItGo){this.pan.endX=e.X;const s=this.manager.currentSlide*(this.manager.width/this.manager.perPage),a=this.pan.endX-this.pan.startX,h=this.manager.rtl?s+a:s-a;cancelAnimationFrame(this.moveFrame),this.moveFrame=requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.manager.spineElement.style.transform=`translate3d(${(this.manager.rtl?1:-1)*h}px, 0, 0)`})})}}dblclickHandler(t){clearTimeout(this.dtimer),this.pdblclick=!0,this.dtimer=window.setTimeout(()=>this.pdblclick=!1,200),!this.disableDblClick&&this.isScaled&&(this.scale=1)}get isScaled(){return this.scale>1}addTouch(t){t.touches=[{pageX:t.pageX,pageY:t.pageY}]}mousedownHandler(t){this.isScaled&&(this.addTouch(t),this.touchstartHandler(t))}mouseupHandler(t){this.isScaled&&this.touchendHandler(t)}mousemoveHandler(t){this.isScaled&&t.buttons>0&&(t.preventDefault(),this.addTouch(t),this.touchmoveHandler(t))}updateAfterDrag(){const t=(this.manager.rtl?-1:1)*(this.pan.endX-this.pan.startX),e=Math.abs(t);t>0&&e>this.manager.threshold&&this.manager.slength>this.manager.perPage?this.manager.listener("no_less",void 0):t<0&&e>this.manager.threshold&&this.manager.slength>this.manager.perPage&&this.manager.listener("no_more",void 0),this.manager.slideToCurrent(!0,!0)}}var te=(r=>(r.auto="auto",r.landscape="landscape",r.portrait="portrait",r))(te||{}),ee=(r=>(r.auto="auto",r.both="both",r.none="none",r.landscape="landscape",r))(ee||{});class EA{constructor(t){this.shift=!0,this.spreads=[],this.nLandscape=0,this.index(t),this.testShift(t),console.log(`Indexed ${this.spreads.length} spreads for ${t.readingOrder.items.length} items`)}index(t,e=!1){this.nLandscape=0,t.readingOrder.items.forEach((i,A)=>{e||(t.readingOrder.items[A]=i.addProperties({number:A+1,isImage:i.type?.indexOf("image/")===0}));const n=i.properties?.otherProperties.orientation==="landscape";(!i.properties?.page||e)&&(i.properties=i.properties?.add({page:n?"center":((this.shift?0:1)+A-this.nLandscape)%2?t.metadata.readingProgression===x.rtl?"right":"left":t.metadata.readingProgression===x.rtl?"left":"right"})),(n||i.properties?.otherProperties.addBlank)&&this.nLandscape++}),e&&(this.spreads=[]),this.buildSpreads(t.readingOrder)}testShift(t){let e=!1;this.spreads.forEach((i,A)=>{if(i.length>1)return;const n=i[0],o=n.properties?.otherProperties.orientation;A===0&&(o==="landscape"||o!=="portrait"&&((n.width||0)>(n.height||0)||n.properties?.otherProperties.spread==="both"))&&(this.shift=!1),e&&n.properties?.page===J.center&&this.spreads[A-1][0].addProperties({addBlank:!0}),o==="portrait"&&n.properties?.page!=="center"&&n.properties?.otherProperties.number>1?e=!0:e=!1}),this.shift||this.index(t,!0)}buildSpreads(t){let e=[];t.items.forEach((i,A)=>{!A&&this.shift?this.spreads.push([i]):i.properties?.page===J.center?(e.length>0&&this.spreads.push(e),this.spreads.push([i]),e=[]):e.length>=2?(this.spreads.push(e),e=[i]):e.push(i)}),e.length>0&&this.spreads.push(e)}currentSpread(t,e){return this.spreads[Math.min(Math.floor(t/e),this.spreads.length-1)]}findByLink(t){return this.spreads.find(e=>e.includes(t))||void 0}}const yA=8,IA=5,Ar=300,nr=15e3,rr=250,or=150,sr=500;class FA{constructor(t,e,i){if(this.pool=new Map,this.blobs=new Map,this.inprogress=new Map,this.delayedShow=new Map,this.delayedTimeout=new Map,this.previousFrames=[],this.width=0,this.height=0,this.transform="",this.currentSlide=0,this.spread=!0,this.orientationInternal=-1,this.container=t,this.positions=e,this.pub=i,this.spreadPresentation=i.metadata.otherMetadata?.spread||ee.auto,this.pub.metadata.effectiveReadingProgression!==x.rtl&&this.pub.metadata.effectiveReadingProgression!==x.ltr)throw Error("Unsupported reading progression for EPUB");this.spreader=new EA(this.pub),this.containerHeightCached=t.clientHeight,this.bookElement=document.createElement("div"),this.bookElement.ariaLabel="Book",this.bookElement.tabIndex=-1,this.updateBookStyle(!0),this.spineElement=document.createElement("div"),this.spineElement.ariaLabel="Spine",this.bookElement.appendChild(this.spineElement),this.container.appendChild(this.bookElement),this.updateSpineStyle(!0),this.peripherals=new wA(this),this.pub.readingOrder.items.forEach(A=>{const n=new uA(this.peripherals,this.pub.metadata.effectiveReadingProgression,A.href);this.spineElement.appendChild(n.element),this.pool.set(A.href,n),n.width=100/this.length*(A.properties?.otherProperties.orientation===te.landscape||A.properties?.otherProperties.addBlank?this.perPage:1),n.height=this.height})}set listener(t){this._listener=t}get listener(){return this._listener}get doNotDisturb(){return this.peripherals.pan.touchID>0}resizeHandler(t=!0,e=!0){this.currentSlide+this.perPage>this.length&&(this.currentSlide=this.length<=this.perPage?0:this.length-1),this.containerHeightCached=this.container.clientHeight,this.orientationInternal=-1,this.updateSpineStyle(!0),t&&(this.currentSlide=this.reAlign(),this.slideToCurrent(!e,e)),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.pool.forEach((i,A)=>{let n=this.pub.readingOrder.items.findIndex(a=>a.href===A);const o=this.pub.readingOrder.items[n];if(i.width=100/this.length*(o.properties?.otherProperties.orientation===te.landscape||o.properties?.otherProperties.addBlank?this.perPage:1),i.height=this.height,!i.loaded)return;const s=this.spreader.findByLink(o);i.update(this.spreadPosition(s,o))})},rr)}updateDimensions(){this.width=this.bookElement.clientWidth,this.height=this.bookElement.clientHeight}get rtl(){return this.pub.metadata.effectiveReadingProgression===x.rtl}get single(){return!this.spread||this.portrait}get perPage(){return this.spread&&!this.portrait?2:1}get threshold(){return 50}get portrait(){return this.spreadPresentation===ee.none?!0:(this.orientationInternal===-1&&(this.orientationInternal=this.containerHeightCached>this.container.clientWidth?1:0),this.orientationInternal===1)}updateSpineStyle(t,e=!0){let i="0";this.updateDimensions(),this.perPage>1&&(i=`${this.width/2}px`);const A={transition:t?`all ${e?or:sr}ms ease-out`:"all 0ms ease-out",marginRight:this.rtl?i:"0",marginLeft:this.rtl?"0":i,width:`${this.width/this.perPage*this.length}px`,transform:this.transform,contain:"content"};Object.assign(this.spineElement.style,A)}updateBookStyle(t=!1){if(t){const e={overflow:"hidden",direction:this.pub.metadata.effectiveReadingProgression,cursor:"",height:"100%",width:"100%",position:"relative",outline:"none",transition:this.peripherals?.dragState?"none":"transform .15s ease-in-out",touchAction:"none"};Object.assign(this.bookElement.style,e)}this.bookElement.style.transform=`scale(${this.peripherals?.scale||1})`+(this.peripherals?` translate3d(${this.peripherals.pan.translateX}px, ${this.peripherals.pan.translateY}px, 0px)`:"")}goTo(t){if(this.slength<=this.perPage)return;t=this.reAlign(t);const e=this.currentSlide;this.currentSlide=Math.min(Math.max(t,0),this.length-1),e!==this.currentSlide&&this.slideToCurrent(!1)}onChange(){this.peripherals.scale=1,this.updateBookStyle()}get offset(){return(this.rtl?1:-1)*this.currentSlide*(this.width/this.perPage)}get length(){if(this.single)return this.slength;const t=this.slength+this.nLandscape;return this.shift&&t%2===0?t+1:t}get slength(){return this.pub.readingOrder.items.length||0}get shift(){return this.spreader.shift}get nLandscape(){return this.spreader.nLandscape}setPerPage(t){t===null?this.spread=!0:t===1?this.spread=!1:this.spread=!0,requestAnimationFrame(()=>this.resizeHandler(!0))}slideToCurrent(t,e=!0){if(this.updateDimensions(),t)requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=`translate3d(${this.offset}px, 0, 0)`;this.spineElement.style.transform!==i&&(this.transform=i,this.updateSpineStyle(!0,e),this.deselect())})});else{const i=`translate3d(${this.offset}px, 0, 0)`;if(this.spineElement.style.transform===i)return;this.transform=i,this.updateSpineStyle(!1),this.deselect()}}bounce(t=!1){requestAnimationFrame(()=>{this.transform=`translate3d(${this.offset+50*(t?1:-1)}px, 0, 0)`,this.updateSpineStyle(!0,!0),setTimeout(()=>{this.transform=`translate3d(${this.offset}px, 0, 0)`,this.updateSpineStyle(!0,!0)},100)})}next(t=1){if(this.slength<=this.perPage)return!1;const e=this.currentSlide;return this.currentSlide=Math.min(this.currentSlide+t,this.length-1),this.perPage>1&&this.currentSlide%2&&this.currentSlide--,this.currentSlide===e&&(this.currentSlide+1,this.length),e!==this.currentSlide?(this.slideToCurrent(!0),this.onChange(),!0):(this.bounce(this.rtl),!1)}prev(t=1){if(this.slength<=this.perPage)return!1;const e=this.currentSlide;return this.currentSlide=Math.max(this.currentSlide-t,0),this.perPage>1&&this.currentSlide%2&&this.currentSlide++,e!==this.currentSlide?(this.slideToCurrent(!0),this.onChange(),!0):(this.bounce(!this.rtl),!1)}get ownerWindow(){return this.container.ownerDocument.defaultView||window}async destroy(){let t=this.inprogress.values(),e=t.next();const i=[];for(;e.value;)i.push(e.value),e=t.next();i.length>0&&await Promise.allSettled(i),this.inprogress.clear();let A=this.pool.values(),n=A.next();for(;n.value;)await n.value.destroy(),n=A.next();this.pool.clear(),this.blobs.forEach(o=>URL.revokeObjectURL(o)),this.container.childNodes.forEach(o=>{(o.nodeType===Node.ELEMENT_NODE||o.nodeType===Node.TEXT_NODE)&&o.remove()})}makeSpread(t){return this.perPage<2?[this.pub.readingOrder.items[t]]:this.spreader.currentSpread(t,this.perPage)}reAlign(t=this.currentSlide){return t%2&&!this.single&&t++,t}spreadPosition(t,e){return this.perPage<2||t.length<2?J.center:e.href===t[0].href?this.rtl?J.right:J.left:this.rtl?J.left:J.right}async waitForItem(t){if(this.inprogress.has(t)&&await this.inprogress.get(t),this.delayedShow.has(t)){const e=this.delayedTimeout.get(t);e>0?clearTimeout(e):await this.delayedShow.get(t),this.delayedTimeout.set(t,0),this.delayedShow.delete(t)}}async cancelShowing(t){if(this.delayedShow.has(t)){const e=this.delayedTimeout.get(t);e>0&&clearTimeout(e),this.delayedShow.delete(t)}}async update(t,e,i,A=!1){let n=this.pub.readingOrder.items.findIndex(a=>a.href===e.href);if(n<0)throw Error("Href not found in reading order");this.currentSlide!==n&&(this.currentSlide=this.reAlign(n),this.slideToCurrent(!0));const o=this.makeSpread(this.currentSlide);this.perPage>1&&n++;for(const a of o)await this.waitForItem(a.href);const s=new Promise(async(a,h)=>{const c=[],d=[];this.positions.forEach((l,p)=>{(p>n+yA||p<n-yA)&&(c.includes(l.href)||c.push(l.href)),p<n+IA&&p>n-IA&&(d.includes(l.href)||d.push(l.href))}),c.forEach(async l=>{d.includes(l)||this.pool.has(l)&&(this.cancelShowing(l),await this.pool.get(l)?.unload())}),this.currentBaseURL!==void 0&&t.baseURL!==this.currentBaseURL&&(this.blobs.forEach(l=>URL.revokeObjectURL(l)),this.blobs.clear()),this.currentBaseURL=t.baseURL;const g=async l=>{const p=t.readingOrder.findIndexWithHref(l),E=t.readingOrder.items[p];if(E){if(!this.blobs.has(l)){const Q=await new lA(t,this.currentBaseURL||"",E).build(!0);this.blobs.set(l,Q)}this.delayedShow.has(l)||this.delayedShow.set(l,new Promise((I,Q)=>{let SA=!1;const hr=window.setTimeout(async()=>{this.delayedTimeout.set(l,0);const cr=this.makeSpread(this.reAlign(p)),dr=this.spreadPosition(cr,E),zA=this.pool.get(l);await zA.load(i,this.blobs.get(l)),this.peripherals.isScaled||await zA.show(dr),this.delayedShow.delete(l),SA=!0,I()},Ar);setTimeout(()=>{!SA&&this.delayedShow.has(l)&&Q(`Offscreen load timeout: ${l}`)},nr),this.delayedTimeout.set(l,hr)}))}};try{await Promise.all(d.map(l=>g(l)))}catch(l){h(l)}const M=[];for(const l of o){const p=this.pool.get(l.href),E=this.blobs.get(l.href);E&&(this.cancelShowing(l.href),await p.load(i,E),await p.show(this.spreadPosition(o,l)),this.previousFrames.push(p),await p.activate(),M.push(p))}for(;this.previousFrames.length>0;){const l=this.previousFrames.shift();l&&!M.includes(l)&&await l.unfocus()}this.previousFrames=M,a()});for(const a of o)this.inprogress.set(a.href,s);await s;for(const a of o)this.inprogress.delete(a.href)}get currentFrames(){if(this.perPage<2){const e=this.pub.readingOrder.items[this.currentSlide];return[this.pool.get(e.href)]}return this.spreader.currentSpread(this.currentSlide,this.perPage).map(e=>this.pool.get(e.href))}get currentBounds(){const t={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0,toJSON(){return this}};return this.currentFrames.forEach(e=>{if(!e)return;const i=e.realSize;t.x=Math.min(t.x,i.x),t.y=Math.min(t.y,i.y),t.width+=i.width,t.height=Math.max(t.height,i.height),t.top=Math.min(t.top,i.top),t.right=Math.min(t.right,i.right),t.bottom=Math.min(t.bottom,i.bottom),t.left=Math.min(t.left,i.left)}),t}get viewport(){const t={readingOrder:[],progressions:new Map,positions:null};return this.spreader.currentSpread(this.currentSlide,this.perPage).forEach(i=>{t.readingOrder.push(i.href),t.progressions.set(i.href,{start:0,end:1})}),t.positions=this.getCurrentNumbers(),t}getCurrentNumbers(){if(this.perPage<2)return[this.pub.readingOrder.items[this.currentSlide].properties?.otherProperties.number];const t=this.spreader.currentSpread(this.currentSlide,this.perPage);return t.length>1?[t[0].properties?.otherProperties.number,t[t.length-1].properties?.otherProperties.number]:[t[0].properties?.otherProperties.number]}deselect(){this.currentFrames?.forEach(t=>t?.deselect())}}class wt{constructor(t={}){this.backgroundColor=Y(t.backgroundColor),this.blendFilter=F(t.blendFilter),this.constraint=y(t.constraint),this.columnCount=y(t.columnCount),this.darkenFilter=rt(t.darkenFilter),this.deprecatedFontSize=F(t.deprecatedFontSize),this.fontFamily=Y(t.fontFamily),this.fontSize=O(t.fontSize,St.range),this.fontSizeNormalize=F(t.fontSizeNormalize),this.fontOpticalSizing=F(t.fontOpticalSizing),this.fontWeight=O(t.fontWeight,q.range),this.fontWidth=O(t.fontWidth,zt.range),this.hyphens=F(t.hyphens),this.invertFilter=rt(t.invertFilter),this.invertGaijiFilter=rt(t.invertGaijiFilter),this.iOSPatch=F(t.iOSPatch),this.iPadOSPatch=F(t.iPadOSPatch),this.letterSpacing=y(t.letterSpacing),this.ligatures=F(t.ligatures),this.lineHeight=y(t.lineHeight),this.linkColor=Y(t.linkColor),this.noRuby=F(t.noRuby),this.pageGutter=y(t.pageGutter),this.paragraphIndent=y(t.paragraphIndent),this.paragraphSpacing=y(t.paragraphSpacing),this.scroll=F(t.scroll),this.scrollPaddingTop=y(t.scrollPaddingTop),this.scrollPaddingBottom=y(t.scrollPaddingBottom),this.selectionBackgroundColor=Y(t.selectionBackgroundColor),this.selectionTextColor=Y(t.selectionTextColor),this.textAlign=jt(t.textAlign,X),this.textColor=Y(t.textColor),this.textNormalization=F(t.textNormalization),this.visitedColor=Y(t.visitedColor),this.wordSpacing=y(t.wordSpacing),this.optimalLineLength=y(t.optimalLineLength),this.maximalLineLength=y(t.maximalLineLength),this.minimalLineLength=y(t.minimalLineLength)}static serialize(t){const{...e}=t;return JSON.stringify(e)}static deserialize(t){try{const e=JSON.parse(t);return new wt(e)}catch(e){return console.error("Failed to deserialize preferences:",e),null}}merging(t){const e={...this};for(const i of Object.keys(t))t[i]!==void 0&&(i!=="maximalLineLength"||t[i]===null||t[i]>=(t.optimalLineLength??e.optimalLineLength??65))&&(i!=="minimalLineLength"||t[i]===null||t[i]<=(t.optimalLineLength??e.optimalLineLength??65))&&(e[i]=t[i]);return new wt(e)}}class UA{constructor(t){this.backgroundColor=Y(t.backgroundColor)||null,this.blendFilter=F(t.blendFilter)??!1,this.constraint=y(t.constraint)||0,this.columnCount=y(t.columnCount)||null,this.darkenFilter=rt(t.darkenFilter)??!1,this.deprecatedFontSize=F(t.deprecatedFontSize),(this.deprecatedFontSize===!1||this.deprecatedFontSize===null)&&(this.deprecatedFontSize=!CSS.supports("zoom","1")),this.fontFamily=Y(t.fontFamily)||null,this.fontSize=O(t.fontSize,St.range)||1,this.fontSizeNormalize=F(t.fontSizeNormalize)??!1,this.fontOpticalSizing=F(t.fontOpticalSizing)??null,this.fontWeight=O(t.fontWeight,q.range)||null,this.fontWidth=O(t.fontWidth,zt.range)||null,this.hyphens=F(t.hyphens)??null,this.invertFilter=rt(t.invertFilter)??!1,this.invertGaijiFilter=rt(t.invertGaijiFilter)??!1,this.iOSPatch=t.iOSPatch===!1?!1:(R.OS.iOS||R.OS.iPadOS)&&R.iOSRequest==="mobile",this.iPadOSPatch=t.iPadOSPatch===!1?!1:R.OS.iPadOS&&R.iOSRequest==="desktop",this.letterSpacing=y(t.letterSpacing)||null,this.ligatures=F(t.ligatures)??null,this.lineHeight=y(t.lineHeight)||null,this.linkColor=Y(t.linkColor)||null,this.noRuby=F(t.noRuby)??!1,this.pageGutter=$t(y(t.pageGutter),20),this.paragraphIndent=y(t.paragraphIndent)??null,this.paragraphSpacing=y(t.paragraphSpacing)??null,this.scroll=F(t.scroll)??!1,this.scrollPaddingTop=y(t.scrollPaddingTop)??null,this.scrollPaddingBottom=y(t.scrollPaddingBottom)??null,this.selectionBackgroundColor=Y(t.selectionBackgroundColor)||null,this.selectionTextColor=Y(t.selectionTextColor)||null,this.textAlign=jt(t.textAlign,X)||null,this.textColor=Y(t.textColor)||null,this.textNormalization=F(t.textNormalization)??!1,this.visitedColor=Y(t.visitedColor)||null,this.wordSpacing=y(t.wordSpacing)||null,this.optimalLineLength=y(t.optimalLineLength)||65,this.maximalLineLength=$t(rA(t.maximalLineLength,this.optimalLineLength),80),this.minimalLineLength=$t(nA(t.minimalLineLength,this.optimalLineLength),40),this.experiments=Qe(t.experiments)||null}}const Et={RS__backgroundColor:"#FFFFFF",RS__textColor:"#121212",RS__linkColor:"#0000EE",RS__visitedColor:"#551A8B",RS__selectionBackgroundColor:"#b4d8fe",RS__selectionTextColor:"inherit"};class ve{constructor(t,e,i){this.preferences=t,this.settings=e,this.metadata=i,this.layout=this.metadata?.effectiveLayout||w.reflowable}clear(){this.preferences=new wt({optimalLineLength:65})}updatePreference(t,e){this.preferences[t]=e}get backgroundColor(){return new N({initialValue:this.preferences.backgroundColor,effectiveValue:this.settings.backgroundColor||Et.RS__backgroundColor,isEffective:this.preferences.backgroundColor!==null,onChange:t=>{this.updatePreference("backgroundColor",t||null)}})}get blendFilter(){return new z({initialValue:this.preferences.blendFilter,effectiveValue:this.settings.blendFilter||!1,isEffective:this.preferences.blendFilter!==null,onChange:t=>{this.updatePreference("blendFilter",t||null)}})}get columnCount(){return new N({initialValue:this.preferences.columnCount,effectiveValue:this.settings.columnCount||null,isEffective:this.layout!==w.fixed&&!this.settings.scroll,onChange:t=>{this.updatePreference("columnCount",t||null)}})}get constraint(){return new N({initialValue:this.preferences.constraint,effectiveValue:this.preferences.constraint||0,isEffective:!0,onChange:t=>{this.updatePreference("constraint",t||null)}})}get darkenFilter(){return new U({initialValue:typeof this.preferences.darkenFilter=="boolean"?100:this.preferences.darkenFilter,effectiveValue:typeof this.settings.darkenFilter=="boolean"?100:this.settings.darkenFilter||0,isEffective:this.settings.darkenFilter!==null,onChange:t=>{this.updatePreference("darkenFilter",t||null)},supportedRange:At.range,step:At.step})}get deprecatedFontSize(){return new z({initialValue:this.preferences.deprecatedFontSize,effectiveValue:CSS.supports("zoom","1")?this.settings.deprecatedFontSize||!1:!0,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("deprecatedFontSize",t||null)}})}get fontFamily(){return new N({initialValue:this.preferences.fontFamily,effectiveValue:this.settings.fontFamily||null,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("fontFamily",t||null)}})}get fontSize(){return new U({initialValue:this.preferences.fontSize,effectiveValue:this.settings.fontSize||1,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("fontSize",t||null)},supportedRange:St.range,step:St.step})}get fontSizeNormalize(){return new z({initialValue:this.preferences.fontSizeNormalize,effectiveValue:this.settings.fontSizeNormalize||!1,isEffective:this.layout!==w.fixed&&this.preferences.fontSizeNormalize!==null,onChange:t=>{this.updatePreference("fontSizeNormalize",t||null)}})}get fontOpticalSizing(){return new z({initialValue:this.preferences.fontOpticalSizing,effectiveValue:this.settings.fontOpticalSizing||!0,isEffective:this.layout!==w.fixed&&this.preferences.fontOpticalSizing!==null,onChange:t=>{this.updatePreference("fontOpticalSizing",t||null)}})}get fontWeight(){return new U({initialValue:this.preferences.fontWeight,effectiveValue:this.settings.fontWeight||400,isEffective:this.layout!==w.fixed&&this.preferences.fontWeight!==null,onChange:t=>{this.updatePreference("fontWeight",t||null)},supportedRange:q.range,step:q.step})}get fontWidth(){return new U({initialValue:this.preferences.fontWidth,effectiveValue:this.settings.fontWidth||100,isEffective:this.layout!==w.fixed&&this.preferences.fontWidth!==null,onChange:t=>{this.updatePreference("fontWidth",t||null)},supportedRange:zt.range,step:zt.step})}get hyphens(){return new z({initialValue:this.preferences.hyphens,effectiveValue:this.settings.hyphens||!1,isEffective:this.layout!==w.fixed&&this.metadata?.effectiveReadingProgression===x.ltr&&this.preferences.hyphens!==null,onChange:t=>{this.updatePreference("hyphens",t||null)}})}get invertFilter(){return new U({initialValue:typeof this.preferences.invertFilter=="boolean"?100:this.preferences.invertFilter,effectiveValue:typeof this.settings.invertFilter=="boolean"?100:this.settings.invertFilter||0,isEffective:this.settings.invertFilter!==null,onChange:t=>{this.updatePreference("invertFilter",t||null)},supportedRange:At.range,step:At.step})}get invertGaijiFilter(){return new U({initialValue:typeof this.preferences.invertGaijiFilter=="boolean"?100:this.preferences.invertGaijiFilter,effectiveValue:typeof this.settings.invertGaijiFilter=="boolean"?100:this.settings.invertGaijiFilter||0,isEffective:this.preferences.invertGaijiFilter!==null,onChange:t=>{this.updatePreference("invertGaijiFilter",t||null)},supportedRange:At.range,step:At.step})}get iOSPatch(){return new z({initialValue:this.preferences.iOSPatch,effectiveValue:this.settings.iOSPatch||!1,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("iOSPatch",t||null)}})}get iPadOSPatch(){return new z({initialValue:this.preferences.iPadOSPatch,effectiveValue:this.settings.iPadOSPatch||!1,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("iPadOSPatch",t||null)}})}get letterSpacing(){return new U({initialValue:this.preferences.letterSpacing,effectiveValue:this.settings.letterSpacing||0,isEffective:this.layout!==w.fixed&&this.preferences.letterSpacing!==null,onChange:t=>{this.updatePreference("letterSpacing",t||null)},supportedRange:Qt.range,step:Qt.step})}get ligatures(){return new z({initialValue:this.preferences.ligatures,effectiveValue:this.settings.ligatures||!0,isEffective:(()=>{if(this.preferences.ligatures===null||this.layout===w.fixed)return!1;const t=this.metadata?.languages?.[0]?.toLowerCase();return!(t&&["zh","ja","ko","mn-mong"].some(e=>t.startsWith(e)))})(),onChange:t=>{this.updatePreference("ligatures",t||null)}})}get lineHeight(){return new U({initialValue:this.preferences.lineHeight,effectiveValue:this.settings.lineHeight,isEffective:this.layout!==w.fixed&&this.preferences.lineHeight!==null,onChange:t=>{this.updatePreference("lineHeight",t||null)},supportedRange:Yt.range,step:Yt.step})}get linkColor(){return new N({initialValue:this.preferences.linkColor,effectiveValue:this.settings.linkColor||Et.RS__linkColor,isEffective:this.layout!==w.fixed&&this.preferences.linkColor!==null,onChange:t=>{this.updatePreference("linkColor",t||null)}})}get maximalLineLength(){return new U({initialValue:this.preferences.maximalLineLength,effectiveValue:this.settings.maximalLineLength,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("maximalLineLength",t)},supportedRange:nt.range,step:nt.step})}get minimalLineLength(){return new U({initialValue:this.preferences.minimalLineLength,effectiveValue:this.settings.minimalLineLength,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("minimalLineLength",t)},supportedRange:nt.range,step:nt.step})}get noRuby(){return new z({initialValue:this.preferences.noRuby,effectiveValue:this.settings.noRuby||!1,isEffective:this.layout!==w.fixed&&this.metadata?.languages?.includes("ja")||!1,onChange:t=>{this.updatePreference("noRuby",t||null)}})}get optimalLineLength(){return new U({initialValue:this.preferences.optimalLineLength,effectiveValue:this.settings.optimalLineLength,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("optimalLineLength",t)},supportedRange:nt.range,step:nt.step})}get pageGutter(){return new N({initialValue:this.preferences.pageGutter,effectiveValue:this.settings.pageGutter,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("pageGutter",t||null)}})}get paragraphIndent(){return new U({initialValue:this.preferences.paragraphIndent,effectiveValue:this.settings.paragraphIndent||0,isEffective:this.layout!==w.fixed&&this.preferences.paragraphIndent!==null,onChange:t=>{this.updatePreference("paragraphIndent",t||null)},supportedRange:Nt.range,step:Nt.step})}get paragraphSpacing(){return new U({initialValue:this.preferences.paragraphSpacing,effectiveValue:this.settings.paragraphSpacing||0,isEffective:this.layout!==w.fixed&&this.preferences.paragraphSpacing!==null,onChange:t=>{this.updatePreference("paragraphSpacing",t||null)},supportedRange:xt.range,step:xt.step})}get scroll(){return new z({initialValue:this.preferences.scroll,effectiveValue:this.settings.scroll||!1,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("scroll",t||null)}})}get scrollPaddingTop(){return new N({initialValue:this.preferences.scrollPaddingTop,effectiveValue:this.settings.scrollPaddingTop||0,isEffective:this.layout!==w.fixed&&!!this.settings.scroll&&this.preferences.scrollPaddingTop!==null,onChange:t=>{this.updatePreference("scrollPaddingTop",t||null)}})}get scrollPaddingBottom(){return new N({initialValue:this.preferences.scrollPaddingBottom,effectiveValue:this.settings.scrollPaddingBottom||0,isEffective:this.layout!==w.fixed&&!!this.settings.scroll&&this.preferences.scrollPaddingBottom!==null,onChange:t=>{this.updatePreference("scrollPaddingBottom",t||null)}})}get selectionBackgroundColor(){return new N({initialValue:this.preferences.selectionBackgroundColor,effectiveValue:this.settings.selectionBackgroundColor||Et.RS__selectionBackgroundColor,isEffective:this.layout!==w.fixed&&this.preferences.selectionBackgroundColor!==null,onChange:t=>{this.updatePreference("selectionBackgroundColor",t||null)}})}get selectionTextColor(){return new N({initialValue:this.preferences.selectionTextColor,effectiveValue:this.settings.selectionTextColor||Et.RS__selectionTextColor,isEffective:this.layout!==w.fixed&&this.preferences.selectionTextColor!==null,onChange:t=>{this.updatePreference("selectionTextColor",t||null)}})}get textAlign(){return new Ne({initialValue:this.preferences.textAlign,effectiveValue:this.settings.textAlign||X.start,isEffective:this.layout!==w.fixed&&this.preferences.textAlign!==null,onChange:t=>{this.updatePreference("textAlign",t||null)},supportedValues:Object.values(X)})}get textColor(){return new N({initialValue:this.preferences.textColor,effectiveValue:this.settings.textColor||Et.RS__textColor,isEffective:this.layout!==w.fixed&&this.preferences.textColor!==null,onChange:t=>{this.updatePreference("textColor",t||null)}})}get textNormalization(){return new z({initialValue:this.preferences.textNormalization,effectiveValue:this.settings.textNormalization||!1,isEffective:this.layout!==w.fixed,onChange:t=>{this.updatePreference("textNormalization",t||null)}})}get visitedColor(){return new N({initialValue:this.preferences.visitedColor,effectiveValue:this.settings.visitedColor||Et.RS__visitedColor,isEffective:this.layout!==w.fixed&&this.preferences.visitedColor!==null,onChange:t=>{this.updatePreference("visitedColor",t||null)}})}get wordSpacing(){return new U({initialValue:this.preferences.wordSpacing,effectiveValue:this.settings.wordSpacing||0,isEffective:this.layout!==w.fixed&&this.preferences.wordSpacing!==null,onChange:t=>{this.updatePreference("wordSpacing",t||null)},supportedRange:Tt.range,step:Tt.step})}}class De{constructor(t,e){this.backgroundColor=t.backgroundColor||e.backgroundColor||null,this.blendFilter=typeof t.blendFilter=="boolean"?t.blendFilter:e.blendFilter??null,this.columnCount=t.columnCount!==void 0?t.columnCount:e.columnCount!==void 0?e.columnCount:null,this.constraint=t.constraint||e.constraint,this.darkenFilter=typeof t.darkenFilter=="boolean"?t.darkenFilter:e.darkenFilter??null,this.deprecatedFontSize=typeof t.deprecatedFontSize=="boolean"?t.deprecatedFontSize:e.deprecatedFontSize??null,this.fontFamily=t.fontFamily||e.fontFamily||null,this.fontSize=t.fontSize!==void 0?t.fontSize:e.fontSize!==void 0?e.fontSize:null,this.fontSizeNormalize=typeof t.fontSizeNormalize=="boolean"?t.fontSizeNormalize:e.fontSizeNormalize??null,this.fontOpticalSizing=typeof t.fontOpticalSizing=="boolean"?t.fontOpticalSizing:e.fontOpticalSizing??null,this.fontWeight=t.fontWeight!==void 0?t.fontWeight:e.fontWeight!==void 0?e.fontWeight:null,this.fontWidth=t.fontWidth!==void 0?t.fontWidth:e.fontWidth!==void 0?e.fontWidth:null,this.hyphens=typeof t.hyphens=="boolean"?t.hyphens:e.hyphens??null,this.invertFilter=typeof t.invertFilter=="boolean"?t.invertFilter:e.invertFilter??null,this.invertGaijiFilter=typeof t.invertGaijiFilter=="boolean"?t.invertGaijiFilter:e.invertGaijiFilter??null,this.iOSPatch=this.deprecatedFontSize||t.iOSPatch===!1?!1:t.iOSPatch===!0?(R.OS.iOS||R.OS.iPadOS)&&R.iOSRequest==="mobile":e.iOSPatch,this.iPadOSPatch=this.deprecatedFontSize||t.iPadOSPatch===!1?!1:t.iPadOSPatch===!0?R.OS.iPadOS&&R.iOSRequest==="desktop":e.iPadOSPatch,this.letterSpacing=t.letterSpacing!==void 0?t.letterSpacing:e.letterSpacing!==void 0?e.letterSpacing:null,this.ligatures=typeof t.ligatures=="boolean"?t.ligatures:e.ligatures??null,this.lineHeight=t.lineHeight!==void 0?t.lineHeight:e.lineHeight!==void 0?e.lineHeight:null,this.linkColor=t.linkColor||e.linkColor||null,this.maximalLineLength=t.maximalLineLength===null?null:t.maximalLineLength||e.maximalLineLength||null,this.minimalLineLength=t.minimalLineLength===null?null:t.minimalLineLength||e.minimalLineLength||null,this.noRuby=typeof t.noRuby=="boolean"?t.noRuby:e.noRuby??null,this.optimalLineLength=t.optimalLineLength||e.optimalLineLength,this.pageGutter=t.pageGutter!==void 0?t.pageGutter:e.pageGutter!==void 0?e.pageGutter:null,this.paragraphIndent=t.paragraphIndent!==void 0?t.paragraphIndent:e.paragraphIndent!==void 0?e.paragraphIndent:null,this.paragraphSpacing=t.paragraphSpacing!==void 0?t.paragraphSpacing:e.paragraphSpacing!==void 0?e.paragraphSpacing:null,this.scroll=typeof t.scroll=="boolean"?t.scroll:e.scroll??null,this.scrollPaddingTop=t.scrollPaddingTop!==void 0?t.scrollPaddingTop:e.scrollPaddingTop!==void 0?e.scrollPaddingTop:null,this.scrollPaddingBottom=t.scrollPaddingBottom!==void 0?t.scrollPaddingBottom:e.scrollPaddingBottom!==void 0?e.scrollPaddingBottom:null,this.selectionBackgroundColor=t.selectionBackgroundColor||e.selectionBackgroundColor||null,this.selectionTextColor=t.selectionTextColor||e.selectionTextColor||null,this.textAlign=t.textAlign||e.textAlign||null,this.textColor=t.textColor||e.textColor||null,this.textNormalization=typeof t.textNormalization=="boolean"?t.textNormalization:e.textNormalization??null,this.visitedColor=t.visitedColor||e.visitedColor||null,this.wordSpacing=t.wordSpacing!==void 0?t.wordSpacing:e.wordSpacing!==void 0?e.wordSpacing:null,this.experiments=e.experiments||null}}function ie(r){const t=getComputedStyle(r),e=parseFloat(t.paddingLeft||"0"),i=parseFloat(t.paddingRight||"0");return r.clientWidth-e-i}class He extends bt{constructor(t){super(),this.a11yNormalize=t.a11yNormalize??null,this.backgroundColor=t.backgroundColor??null,this.blendFilter=t.blendFilter??null,this.bodyHyphens=t.bodyHyphens??null,this.colCount=t.colCount??null,this.darkenFilter=t.darkenFilter??null,this.deprecatedFontSize=t.deprecatedFontSize??null,this.fontFamily=t.fontFamily??null,this.fontOpticalSizing=t.fontOpticalSizing??null,this.fontSize=t.fontSize??null,this.fontSizeNormalize=t.fontSizeNormalize??null,this.fontWeight=t.fontWeight??null,this.fontWidth=t.fontWidth??null,this.invertFilter=t.invertFilter??null,this.invertGaijiFilter=t.invertGaijiFilter??null,this.iOSPatch=t.iOSPatch??null,this.iPadOSPatch=t.iPadOSPatch??null,this.letterSpacing=t.letterSpacing??null,this.ligatures=t.ligatures??null,this.lineHeight=t.lineHeight??null,this.lineLength=t.lineLength??null,this.linkColor=t.linkColor??null,this.noRuby=t.noRuby??null,this.paraIndent=t.paraIndent??null,this.paraSpacing=t.paraSpacing??null,this.selectionBackgroundColor=t.selectionBackgroundColor??null,this.selectionTextColor=t.selectionTextColor??null,this.textAlign=t.textAlign??null,this.textColor=t.textColor??null,this.view=t.view??null,this.visitedColor=t.visitedColor??null,this.wordSpacing=t.wordSpacing??null}toCSSProperties(){const t={};return this.a11yNormalize&&(t["--USER__a11yNormalize"]=this.toFlag("a11y")),this.backgroundColor&&(t["--USER__backgroundColor"]=this.backgroundColor),this.blendFilter&&(t["--USER__blendFilter"]=this.toFlag("blend")),this.bodyHyphens&&(t["--USER__bodyHyphens"]=this.bodyHyphens),this.colCount&&(t["--USER__colCount"]=this.toUnitless(this.colCount)),this.darkenFilter===!0?t["--USER__darkenFilter"]=this.toFlag("darken"):typeof this.darkenFilter=="number"&&(t["--USER__darkenFilter"]=this.toPercentage(this.darkenFilter)),this.deprecatedFontSize&&(t["--USER__fontSizeImplementation"]=this.toFlag("deprecatedFontSize")),this.fontFamily&&(t["--USER__fontFamily"]=this.fontFamily),this.fontOpticalSizing!=null&&(t["--USER__fontOpticalSizing"]=this.fontOpticalSizing),this.fontSize!=null&&(t["--USER__fontSize"]=this.toPercentage(this.fontSize,!0)),this.fontSizeNormalize&&(t["--USER__fontSizeNormalize"]=this.toFlag("normalize")),this.fontWeight!=null&&(t["--USER__fontWeight"]=this.toUnitless(this.fontWeight)),this.fontWidth!=null&&(t["--USER__fontWidth"]=typeof this.fontWidth=="string"?this.fontWidth:this.toUnitless(this.fontWidth)),this.invertFilter===!0?t["--USER__invertFilter"]=this.toFlag("invert"):typeof this.invertFilter=="number"&&(t["--USER__invertFilter"]=this.toPercentage(this.invertFilter)),this.invertGaijiFilter===!0?t["--USER__invertGaiji"]=this.toFlag("invertGaiji"):typeof this.invertGaijiFilter=="number"&&(t["--USER__invertGaiji"]=this.toPercentage(this.invertGaijiFilter)),this.iOSPatch&&(t["--USER__iOSPatch"]=this.toFlag("iOSPatch")),this.iPadOSPatch&&(t["--USER__iPadOSPatch"]=this.toFlag("iPadOSPatch")),this.letterSpacing!=null&&(t["--USER__letterSpacing"]=this.toRem(this.letterSpacing)),this.ligatures&&(t["--USER__ligatures"]=this.ligatures),this.lineHeight!=null&&(t["--USER__lineHeight"]=this.toUnitless(this.lineHeight)),this.lineLength!=null&&(t["--USER__lineLength"]=this.toPx(this.lineLength)),this.linkColor&&(t["--USER__linkColor"]=this.linkColor),this.noRuby&&(t["--USER__noRuby"]=this.toFlag("noRuby")),this.paraIndent!=null&&(t["--USER__paraIndent"]=this.toRem(this.paraIndent)),this.paraSpacing!=null&&(t["--USER__paraSpacing"]=this.toRem(this.paraSpacing)),this.selectionBackgroundColor&&(t["--USER__selectionBackgroundColor"]=this.selectionBackgroundColor),this.selectionTextColor&&(t["--USER__selectionTextColor"]=this.selectionTextColor),this.textAlign&&(t["--USER__textAlign"]=this.textAlign),this.textColor&&(t["--USER__textColor"]=this.textColor),this.view&&(t["--USER__view"]=this.toFlag(this.view)),this.visitedColor&&(t["--USER__visitedColor"]=this.visitedColor),this.wordSpacing!=null&&(t["--USER__wordSpacing"]=this.toRem(this.wordSpacing)),t}}class RA extends bt{constructor(t){super(),this.backgroundColor=t.backgroundColor??null,this.baseFontFamily=t.baseFontFamily??null,this.baseFontSize=t.baseFontSize??null,this.baseLineHeight=t.baseLineHeight??null,this.boxSizingMedia=t.boxSizingMedia??null,this.boxSizingTable=t.boxSizingTable??null,this.colWidth=t.colWidth??null,this.colCount=t.colCount??null,this.colGap=t.colGap??null,this.codeFontFamily=t.codeFontFamily??null,this.compFontFamily=t.compFontFamily??null,this.defaultLineLength=t.defaultLineLength??null,this.flowSpacing=t.flowSpacing??null,this.humanistTf=t.humanistTf??null,this.linkColor=t.linkColor??null,this.maxMediaWidth=t.maxMediaWidth??null,this.maxMediaHeight=t.maxMediaHeight??null,this.modernTf=t.modernTf??null,this.monospaceTf=t.monospaceTf??null,this.noOverflow=t.noOverflow??null,this.noVerticalPagination=t.noVerticalPagination??null,this.oldStyleTf=t.oldStyleTf??null,this.pageGutter=t.pageGutter??null,this.paraIndent=t.paraIndent??null,this.paraSpacing=t.paraSpacing??null,this.primaryColor=t.primaryColor??null,this.scrollPaddingBottom=t.scrollPaddingBottom??null,this.scrollPaddingTop=t.scrollPaddingTop??null,this.sansSerifJa=t.sansSerifJa??null,this.sansSerifJaV=t.sansSerifJaV??null,this.sansTf=t.sansTf??null,this.secondaryColor=t.secondaryColor??null,this.selectionBackgroundColor=t.selectionBackgroundColor??null,this.selectionTextColor=t.selectionTextColor??null,this.serifJa=t.serifJa??null,this.serifJaV=t.serifJaV??null,this.textColor=t.textColor??null,this.typeScale=t.typeScale??null,this.visitedColor=t.visitedColor??null,this.experiments=t.experiments??null}toCSSProperties(){const t={};return this.backgroundColor&&(t["--RS__backgroundColor"]=this.backgroundColor),this.baseFontFamily&&(t["--RS__baseFontFamily"]=this.baseFontFamily),this.baseFontSize!=null&&(t["--RS__baseFontSize"]=this.toRem(this.baseFontSize)),this.baseLineHeight!=null&&(t["--RS__baseLineHeight"]=this.toUnitless(this.baseLineHeight)),this.boxSizingMedia&&(t["--RS__boxSizingMedia"]=this.boxSizingMedia),this.boxSizingTable&&(t["--RS__boxSizingTable"]=this.boxSizingTable),this.colWidth!=null&&(t["--RS__colWidth"]=this.colWidth),this.colCount!=null&&(t["--RS__colCount"]=this.toUnitless(this.colCount)),this.colGap!=null&&(t["--RS__colGap"]=this.toPx(this.colGap)),this.codeFontFamily&&(t["--RS__codeFontFamily"]=this.codeFontFamily),this.compFontFamily&&(t["--RS__compFontFamily"]=this.compFontFamily),this.defaultLineLength!=null&&(t["--RS__defaultLineLength"]=this.toPx(this.defaultLineLength)),this.flowSpacing!=null&&(t["--RS__flowSpacing"]=this.toRem(this.flowSpacing)),this.humanistTf&&(t["--RS__humanistTf"]=this.humanistTf),this.linkColor&&(t["--RS__linkColor"]=this.linkColor),this.maxMediaWidth&&(t["--RS__maxMediaWidth"]=this.toVw(this.maxMediaWidth)),this.maxMediaHeight&&(t["--RS__maxMediaHeight"]=this.toVh(this.maxMediaHeight)),this.modernTf&&(t["--RS__modernTf"]=this.modernTf),this.monospaceTf&&(t["--RS__monospaceTf"]=this.monospaceTf),this.noOverflow&&(t["--RS__disableOverflow"]=this.toFlag("noOverflow")),this.noVerticalPagination&&(t["--RS__disablePagination"]=this.toFlag("noVerticalPagination")),this.oldStyleTf&&(t["--RS__oldStyleTf"]=this.oldStyleTf),this.pageGutter!=null&&(t["--RS__pageGutter"]=this.toPx(this.pageGutter)),this.paraIndent!=null&&(t["--RS__paraIndent"]=this.toRem(this.paraIndent)),this.paraSpacing!=null&&(t["--RS__paraSpacing"]=this.toRem(this.paraSpacing)),this.primaryColor&&(t["--RS__primaryColor"]=this.primaryColor),this.sansSerifJa&&(t["--RS__sans-serif-ja"]=this.sansSerifJa),this.sansSerifJaV&&(t["--RS__sans-serif-ja-v"]=this.sansSerifJaV),this.sansTf&&(t["--RS__sansTf"]=this.sansTf),this.scrollPaddingBottom!=null&&(t["--RS__scrollPaddingBottom"]=this.toPx(this.scrollPaddingBottom)),this.scrollPaddingTop!=null&&(t["--RS__scrollPaddingTop"]=this.toPx(this.scrollPaddingTop)),this.secondaryColor&&(t["--RS__secondaryColor"]=this.secondaryColor),this.selectionBackgroundColor&&(t["--RS__selectionBackgroundColor"]=this.selectionBackgroundColor),this.selectionTextColor&&(t["--RS__selectionTextColor"]=this.selectionTextColor),this.serifJa&&(t["--RS__serif-ja"]=this.serifJa),this.serifJaV&&(t["--RS__serif-ja-v"]=this.serifJaV),this.textColor&&(t["--RS__textColor"]=this.textColor),this.typeScale&&(t["--RS__typeScale"]=this.toUnitless(this.typeScale)),this.visitedColor&&(t["--RS__visitedColor"]=this.visitedColor),this.experiments&&this.experiments.forEach(e=>{t["--RS__"+e]=_t[e].value}),t}}class CA{constructor(t){this.rsProperties=t.rsProperties,this.userProperties=t.userProperties,this.lineLengths=t.lineLengths,this.container=t.container,this.containerParent=t.container.parentElement||document.documentElement,this.constraint=t.constraint,this.cachedColCount=t.userProperties.colCount,this.effectiveContainerWidth=ie(this.containerParent)}update(t){this.cachedColCount=t.columnCount,t.constraint!==this.constraint&&(this.constraint=t.constraint),t.pageGutter!==this.rsProperties.pageGutter&&(this.rsProperties.pageGutter=t.pageGutter),t.scrollPaddingBottom!==this.rsProperties.scrollPaddingBottom&&(this.rsProperties.scrollPaddingBottom=t.scrollPaddingBottom),t.scrollPaddingTop!==this.rsProperties.scrollPaddingTop&&(this.rsProperties.scrollPaddingTop=t.scrollPaddingTop),t.experiments!==this.rsProperties.experiments&&(this.rsProperties.experiments=t.experiments),this.lineLengths.update({fontFace:t.fontFamily,letterSpacing:t.letterSpacing,pageGutter:t.pageGutter,wordSpacing:t.wordSpacing,optimalChars:t.optimalLineLength,minChars:t.minimalLineLength,maxChars:t.maximalLineLength});const e=this.updateLayout(t.fontSize,t.deprecatedFontSize||t.iOSPatch,t.scroll,t.columnCount);e?.effectiveContainerWidth&&(this.effectiveContainerWidth=e?.effectiveContainerWidth);const i={a11yNormalize:t.textNormalization,backgroundColor:t.backgroundColor,blendFilter:t.blendFilter,bodyHyphens:typeof t.hyphens!="boolean"?null:t.hyphens?"auto":"none",colCount:e?.colCount,darkenFilter:t.darkenFilter,deprecatedFontSize:t.deprecatedFontSize,fontFamily:t.fontFamily,fontOpticalSizing:typeof t.fontOpticalSizing!="boolean"?null:t.fontOpticalSizing?"auto":"none",fontSize:t.fontSize,fontSizeNormalize:t.fontSizeNormalize,fontWeight:t.fontWeight,fontWidth:t.fontWidth,invertFilter:t.invertFilter,invertGaijiFilter:t.invertGaijiFilter,iOSPatch:t.iOSPatch,iPadOSPatch:t.iPadOSPatch,letterSpacing:t.letterSpacing,ligatures:typeof t.ligatures!="boolean"?null:t.ligatures?"common-ligatures":"none",lineHeight:t.lineHeight,lineLength:e?.effectiveLineLength,linkColor:t.linkColor,noRuby:t.noRuby,paraIndent:t.paragraphIndent,paraSpacing:t.paragraphSpacing,selectionBackgroundColor:t.selectionBackgroundColor,selectionTextColor:t.selectionTextColor,textAlign:t.textAlign,textColor:t.textColor,view:typeof t.scroll!="boolean"?null:t.scroll?"scroll":"paged",visitedColor:t.visitedColor,wordSpacing:t.wordSpacing};this.userProperties=new He(i)}updateLayout(t,e,i,A){return i??this.userProperties.view==="scroll"?this.computeScrollLength(t,e):this.paginate(t,e,A)}getCompensatedMetrics(t,e){const i=t||this.userProperties.fontSize||1,A=i<1?1/i:e?i:1;return{zoomFactor:i,zoomCompensation:A,optimal:Math.round(this.lineLengths.optimalLineLength)*i,minimal:this.lineLengths.minimalLineLength!==null?Math.round(this.lineLengths.minimalLineLength*i):null,maximal:this.lineLengths.maximalLineLength!==null?Math.round(this.lineLengths.maximalLineLength*i):null}}paginate(t,e,i){const A=Math.round(ie(this.containerParent)-this.constraint),n=this.getCompensatedMetrics(t,e),{zoomCompensation:o,optimal:s,minimal:a,maximal:h}=n,c=()=>A>=s&&h!==null?Math.min(Math.round(h*o),A):A;let d=1,g=A;if(i===void 0)return{colCount:void 0,effectiveContainerWidth:g,effectiveLineLength:Math.round(g/d*o)};if(i===null)if(A>=s&&h!==null){d=Math.floor(A/s);const M=Math.round(d*(h*o));g=Math.min(M,A)}else g=c();else if(i>1){const M=Math.round(i*(a!==null?a:s));if(A>=M)if(d=i,h===null)g=A;else{const l=Math.round(d*(h*o));g=Math.min(l,A)}else if(a!==null&&A<Math.round(i*a))if(d=Math.floor(A/a),d<=1)d=1,g=c();else{const l=Math.round(d*(s*o));g=Math.min(l,A)}else{d=i;const l=Math.round(d*(s*o));g=Math.min(l,A)}}else d=1,g=c();return{colCount:d,effectiveContainerWidth:g,effectiveLineLength:Math.round(g/d/(t&&t>=1?t:1)*o)}}computeScrollLength(t,e){const i=Math.round(ie(this.containerParent)-this.constraint),A=this.getCompensatedMetrics(t&&(t<1||e)?t:1,e),n=A.zoomCompensation,o=A.optimal,s=A.maximal;let a,h=i,c=Math.round(o*n);if(s===null)c=i;else{const d=Math.min(Math.round(s*n),i);c=e?d:Math.round(d*n)}return{colCount:a,effectiveContainerWidth:h,effectiveLineLength:c}}setContainerWidth(){this.container.style.width=`${this.effectiveContainerWidth}px`}resizeHandler(){const t=this.updateLayout(this.userProperties.fontSize,this.userProperties.deprecatedFontSize||this.userProperties.iOSPatch,this.userProperties.view==="scroll",this.cachedColCount);this.userProperties.colCount=t.colCount,this.userProperties.lineLength=t.effectiveLineLength,this.effectiveContainerWidth=t.effectiveContainerWidth,this.container.style.width=`${this.effectiveContainerWidth}px`}}const ar=r=>({frameLoaded:r.frameLoaded||(()=>{}),positionChanged:r.positionChanged||(()=>{}),tap:r.tap||(()=>!1),click:r.click||(()=>!1),zoom:r.zoom||(()=>{}),miscPointer:r.miscPointer||(()=>{}),scroll:r.scroll||(()=>{}),customEvent:r.customEvent||(()=>{}),handleLocator:r.handleLocator||(()=>!1),textSelected:r.textSelected||(()=>{})});class Ge extends ae{constructor(t,e,i,A=[],n=void 0,o={preferences:{},defaults:{}}){super(),this._preferencesEditor=null,this.reflowViewport={readingOrder:[],progressions:new Map,positions:null},this.pub=e,this.container=t,this.listeners=ar(i),this.currentLocation=n,A.length&&(this.positions=A),this._preferences=new wt(o.preferences),this._defaults=new UA(o.defaults),this._settings=new De(this._preferences,this._defaults),this._css=new CA({rsProperties:new RA({}),userProperties:new He({}),lineLengths:new pt({optimalChars:this._settings.optimalLineLength,minChars:this._settings.minimalLineLength,maxChars:this._settings.maximalLineLength,pageGutter:this._settings.pageGutter,fontFace:this._settings.fontFamily,letterSpacing:this._settings.letterSpacing,wordSpacing:this._settings.wordSpacing}),container:t,constraint:this._settings.constraint}),this._layout=Ge.determineLayout(e,!!this._settings.scroll),this.currentProgression=e.metadata.effectiveReadingProgression,this.resizeObserver=new ResizeObserver(()=>this.ownerWindow.requestAnimationFrame(async()=>await this.resizeHandler())),this.resizeObserver.observe(this.container.parentElement||document.documentElement)}static determineLayout(t,e){const i=t.metadata.effectiveLayout;return i===w.fixed||t.metadata.otherMetadata&&"http://openmangaformat.org/schema/1.0#version"in t.metadata.otherMetadata||t.metadata?.conformsTo?.includes($e.DIVINA)?w.fixed:i===w.scrolled||i===w.reflowable&&e?w.scrolled:w.reflowable}async load(){if(this.positions?.length||(this.positions=await this.pub.positionsFromManifest()),this._layout===w.fixed)this.framePool=new FA(this.container,this.positions,this.pub),this.framePool.listener=(t,e)=>{this.eventListener(t,e)};else{await this.updateCSS(!1);const t=this.compileCSSProperties(this._css);this.framePool=new gA(this.container,this.positions,t)}this.currentLocation===void 0&&(this.currentLocation=this.positions[0]),await this.resizeHandler(),await this.apply()}get settings(){if(this._layout===w.fixed)return Object.freeze({...this._settings});{const t=this._css.userProperties.colCount||this._css.rsProperties.colCount||this._settings.columnCount;return Object.freeze({...this._settings,columnCount:t})}}get preferencesEditor(){return this._preferencesEditor===null&&(this._preferencesEditor=new ve(this._preferences,this.settings,this.pub.metadata)),this._preferencesEditor}async submitPreferences(t){this._preferences=this._preferences.merging(t),await this.applyPreferences()}async applyPreferences(){const t=this._settings;this._settings=new De(this._preferences,this._defaults),this._preferencesEditor!==null&&(this._preferencesEditor=new ve(this._preferences,this.settings,this.pub.metadata)),this._layout===w.fixed?this.handleFXLPrefs(t,this._settings):await this.updateCSS(!0)}handleFXLPrefs(t,e){t.columnCount!==e.columnCount&&this.framePool.setPerPage(e.columnCount)}async updateCSS(t){this._css.update(this._settings),t&&await this.commitCSS(this._css)}compileCSSProperties(t){const e={};for(const[i,A]of Object.entries(t.rsProperties.toCSSProperties()))e[i]=A;for(const[i,A]of Object.entries(t.userProperties.toCSSProperties()))e[i]=A;return e}async commitCSS(t){const e=this.compileCSSProperties(t);this.framePool.setCSSProperties(e),this._css.userProperties.view==="paged"&&this._layout===w.scrolled?await this.setLayout(w.reflowable):this._css.userProperties.view==="scroll"&&this._layout===w.reflowable&&await this.setLayout(w.scrolled),this._css.setContainerWidth()}async resizeHandler(){const t=this.container.parentElement||document.documentElement;if(this._layout===w.fixed)this.container.style.width=`${ie(t)-this._settings.constraint}px`,this.framePool.resizeHandler();else{const e=this._css.userProperties.colCount,i=this._css.userProperties.lineLength;this._css.resizeHandler(),(this._css.userProperties.view!=="scroll"&&e!==this._css.userProperties.colCount||i!==this._css.userProperties.lineLength)&&await this.commitCSS(this._css)}}get layout(){return this._layout}get ownerWindow(){return this.container.ownerDocument.defaultView||window}get _cframes(){return this.framePool.currentFrames}get pool(){return this.framePool}eventListener(t,e){switch(t){case"_pong":this.listeners.frameLoaded(this._cframes[0].iframe.contentWindow),this.listeners.positionChanged(this.currentLocation);break;case"first_visible_locator":const i=at.deserialize(e);if(!i)break;this.currentLocation=new at({href:this.currentLocation.href,type:this.currentLocation.type,title:this.currentLocation.title,locations:i?.locations,text:i?.text}),this.listeners.positionChanged(this.currentLocation);break;case"text_selected":this.listeners.textSelected(e);break;case"click":case"tap":const A=e;if(A.interactiveElement){const n=new DOMParser().parseFromString(A.interactiveElement,"text/html").body.children[0];if(n.nodeType===n.ELEMENT_NODE&&n.nodeName==="A"&&n.hasAttribute("href")){const o=n.attributes.getNamedItem("href")?.value;if(o.startsWith("#"))this.go(this.currentLocation.copyWithLocations({fragments:[o.substring(1)]}),!1,()=>{});else if(o.startsWith("http://")||o.startsWith("https://")||o.startsWith("mailto:")||o.startsWith("tel:"))this.listeners.handleLocator(new D({href:o}).locator);else try{this.goLink(new D({href:qt.join(qt.dirname(this.currentLocation.href),o)}),!1,()=>{})}catch(s){console.warn(`Couldn't go to link for ${o}: ${s}`),this.listeners.handleLocator(new D({href:o}).locator)}}else console.log("Clicked on",n)}else{if(this._layout===w.fixed&&this.framePool.doNotDisturb&&(A.doNotDisturb=!0),this._layout===w.fixed&&(this.currentProgression===x.rtl||this.currentProgression===x.ltr)&&this.framePool.currentFrames.length>1){const s=this.framePool.currentFrames;A.targetFrameSrc===s[this.currentProgression===x.rtl?0:1]?.source&&(A.x+=(s[this.currentProgression===x.rtl?1:0]?.iframe.contentWindow?.innerWidth??0)*window.devicePixelRatio)}if(t==="click"?this.listeners.click(A):this.listeners.tap(A))break;const o=(this._cframes.length===2?this._cframes[0].window.innerWidth+this._cframes[1].window.innerWidth:this._cframes[0].window.innerWidth)*window.devicePixelRatio/4;A.x>=o&&A.x<=o*3&&this.listeners.miscPointer(1),A.x<o?this.goLeft(!1,()=>{}):A.x>o*3&&this.goRight(!1,()=>{})}break;case"tap_more":this.listeners.miscPointer(e);break;case"no_more":this.changeResource(1);break;case"no_less":this.changeResource(-1);break;case"swipe":break;case"scroll":this.listeners.scroll(e);break;case"zoom":this.listeners.zoom(e);break;case"progress":this.syncLocation(e);break;case"log":console.log(this._cframes[0]?.source?.split("/")[3],...e);break;default:this.listeners.customEvent(t,e);break}}determineModules(){let t=Array.from(Kt.keys());return this._layout===w.fixed?t.filter(e=>vn.includes(e)):(t=t.filter(e=>Dn.includes(e)),this._layout===w.scrolled?t=t.filter(e=>e!=="column_snapper"):t=t.filter(e=>e!=="scroll_snapper"),t)}attachListener(){const t=this._cframes.filter(e=>!!e);if(t.length===0)throw Error("no cframe to attach listener to");t.forEach(e=>{e.msg&&(e.msg.listener=(i,A)=>{this.eventListener(i,A)})})}async apply(){if(await this.framePool.update(this.pub,this.currentLocator,this.determineModules()),this.attachListener(),this.pub.readingOrder.findIndexWithHref(this.currentLocation.href)<0)throw Error("Link for "+this.currentLocation.href+" not found!")}async destroy(){await this.framePool?.destroy()}async changeResource(t){if(t===0)return!1;if(this._layout===w.fixed){const A=this.framePool,n=A.viewport.positions[0];if(t===1){if(!A.next(A.perPage))return!1}else if(t===-1){if(!A.prev(A.perPage))return!1}else throw Error("Invalid relative value for FXL");const o=A.viewport.positions[0];if(n>o){for(let s=this.positions.length-1;s>=0;s--)if(this.positions[s].href===this.pub.readingOrder.items[o-1].href){this.currentLocation=this.positions[s].copyWithLocations({progression:.999999999999});break}}else if(n<o){for(let s=0;s<this.positions.length;s++)if(this.positions[s].href===this.pub.readingOrder.items[o-1].href){this.currentLocation=this.positions[s];break}}return await this.apply(),!0}const e=this.pub.readingOrder.findIndexWithHref(this.currentLocation.href),i=Math.max(0,Math.min(this.pub.readingOrder.items.length-1,e+t));if(i===e)return this._cframes[0]?.msg?.send("shake",void 0,async A=>{}),!1;if(e>i){for(let A=this.positions.length-1;A>=0;A--)if(this.positions[A].href===this.pub.readingOrder.items[i].href){this.currentLocation=this.positions[A].copyWithLocations({progression:.999999999999});break}}else for(let A=0;A<this.positions.length;A++)if(this.positions[A].href===this.pub.readingOrder.items[i].href){this.currentLocation=this.positions[A];break}return await this.apply(),!0}findLastPositionInProgressionRange(t,e){const i=t.findLastIndex(A=>{const n=A.locations.progression;return!!(n&&n>e.start&&n<=e.end)});return i!==-1?t[i]:void 0}findNearestPositions(t){const e=this.positions.filter(n=>n.href===this.currentLocation.href);let i=this.currentLocation,A;return e.some((n,o)=>{const s=n.locations.progression??0;if(t.start<=s){i=n;const a=e.splice(o+1,e.length);return A=this.findLastPositionInProgressionRange(a,t),!0}else return!1}),{first:i,last:A}}updateViewport(t){this.reflowViewport.readingOrder=[],this.reflowViewport.progressions.clear(),this.reflowViewport.positions=null,this.currentLocation&&(this.reflowViewport.readingOrder.push(this.currentLocation.href),this.reflowViewport.progressions.set(this.currentLocation.href,t),this.currentLocation.locations?.position!==void 0&&(this.reflowViewport.positions=[this.currentLocation.locations.position],this.lastLocationInView?.locations?.position!==void 0&&this.reflowViewport.positions.push(this.lastLocationInView.locations.position)))}async syncLocation(t){const e=t,i=this.findNearestPositions(e);this.currentLocation=i.first.copyWithLocations({progression:e.start}),this.lastLocationInView=i.last,this.updateViewport(e),this.listeners.positionChanged(this.currentLocation),await this.framePool.update(this.pub,this.currentLocation,this.determineModules())}goBackward(t,e){this._layout===w.fixed?(this.changeResource(-1),e(!0)):this._cframes[0]?.msg?.send("go_prev",void 0,async i=>{e(i?!0:await this.changeResource(-1))})}goForward(t,e){this._layout===w.fixed?(this.changeResource(1),e(!0)):this._cframes[0]?.msg?.send("go_next",void 0,async i=>{e(i?!0:await this.changeResource(1))})}get currentLocator(){return this.currentLocation}get viewport(){return this._layout===w.fixed?this.framePool.viewport:this.reflowViewport}get isScrollStart(){const t=this.viewport.readingOrder[0];return this.viewport.progressions.get(t)?.start===0}get isScrollEnd(){const t=this.viewport.readingOrder[this.viewport.readingOrder.length-1];return this.viewport.progressions.get(t)?.end===1}get canGoBackward(){const t=this.pub.readingOrder.items[0]?.href;return!(this.viewport.progressions.has(t)&&this.viewport.progressions.get(t)?.start===0)}get canGoForward(){const t=this.pub.readingOrder.items[this.pub.readingOrder.items.length-1]?.href;return!(this.viewport.progressions.has(t)&&this.viewport.progressions.get(t)?.end===1)}get readingProgression(){return this.currentProgression}async setLayout(t){this._layout!==t&&(this._layout=t,await this.framePool.update(this.pub,this.currentLocator,this.determineModules(),!0),this.attachListener())}get publication(){return this.pub}async loadLocator(t,e){let i=!1,A=typeof t.locations.getCssSelector=="function"&&t.locations.getCssSelector();if(t.text?.highlight?i=await new Promise((a,h)=>{this._cframes[0].msg.send("go_text",A?[t.text?.serialize(),A]:t.text?.serialize(),c=>a(c))}):A&&(i=await new Promise((a,h)=>{this._cframes[0].msg.send("go_text",["",A],c=>a(c))})),i){e(i);return}const n=typeof t.locations.htmlId=="function"&&t.locations.htmlId();if(n&&(i=await new Promise((a,h)=>{this._cframes[0].msg.send("go_id",n,c=>a(c))})),i){e(i);return}const o=t?.locations?.progression;o&&o>0?i=await new Promise((a,h)=>{this._cframes[0].msg.send("go_progression",o,c=>a(c))}):i=!0,e(i)}go(t,e,i){const A=t.href.split("#")[0];let n=this.pub.readingOrder.findWithHref(A);if(!n)return i(this.listeners.handleLocator(t));this.currentLocation=this.positions.find(o=>o.href===n.href),this.apply().then(()=>this.loadLocator(t,o=>i(o))).then(()=>{this.attachListener()})}goLink(t,e,i){return this.go(t.locator,e,i)}}class lr{constructor(t){this.sourceNode=null,this.listeners={},this.isMutedValue=!1,this.isPlayingValue=!1,this.isPausedValue=!1,this.isLoadingValue=!1,this.isLoadedValue=!1,this.isEndedValue=!1,this.playback=t.playback,this.audioContext=t.audioContext,this.gainNode=this.audioContext?.createGain(),this.setVolume(this.playback.state.volume),this.mediaElement=document.createElement("audio"),this.mediaElement.crossOrigin="use-credentials",this.mediaElement.addEventListener("canplaythrough",this.onCanPlayThrough.bind(this)),this.mediaElement.addEventListener("timeupdate",this.onTimeUpdate.bind(this)),this.mediaElement.addEventListener("error",this.onError.bind(this)),this.mediaElement.addEventListener("ended",this.onEnded.bind(this)),this.mediaElement.currentTime=this.playback.state.currentTime}on(t,e){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)}off(t,e){this.listeners[t]&&(this.listeners[t]=this.listeners[t].filter(i=>i!==e))}loadAudio(t){this.isLoadingValue=!0,this.mediaElement.src=t,this.mediaElement.load(),this.sourceNode||(this.sourceNode=new MediaElementAudioSourceNode(this.audioContext,{mediaElement:this.mediaElement}),this.sourceNode.connect(this.gainNode),this.gainNode.connect(this.audioContext.destination))}async ensureAudioContextRunning(){this.audioContext.state==="suspended"&&await this.audioContext.resume()}onTimeUpdate(){this.emit("timeupdate",this.mediaElement.currentTime)}onCanPlayThrough(){this.isLoadingValue=!1,this.isLoadedValue=!0,this.emit("canplaythrough",null)}onError(){console.error("Error loading media element"),this.emit("error",this.mediaElement.error)}onEnded(){this.isPlayingValue=!1,this.isPausedValue=!1,this.isEndedValue=!0,this.emit("ended",null)}emit(t,e){this.listeners[t]&&this.listeners[t].forEach(i=>i(e))}async playLocator(t,e){}async play(){if(await this.ensureAudioContextRunning(),this.isPlayingValue){this.stop(),console.error("Audio is already playing");return}try{await this.mediaElement.play(),this.isPlayingValue=!0,this.isPausedValue=!1}catch(t){console.error("error trying to play media element",t)}}pause(){this.mediaElement.pause(),this.isPlayingValue=!1,this.isPausedValue=!0}stop(){this.mediaElement.pause(),this.mediaElement.currentTime=0,this.isPlayingValue=!1,this.isPausedValue=!1}setVolume(t){if(t<0){this.gainNode.gain.value=0,this.isMutedValue=!0;return}if(t>1){this.setVolume(t/100);return}this.gainNode.gain.value=t}skip(t){if(!this.mediaElement){console.error("Audio not loaded");return}const e=this.mediaElement.currentTime+t;e<0?this.mediaElement.currentTime=0:e>this.mediaElement.duration?this.mediaElement.currentTime=this.mediaElement.duration:this.mediaElement.currentTime=e}currentTime(){return this.mediaElement.currentTime}duration(){return this.mediaElement.duration}isPlaying(){return this.isPlayingValue}isPaused(){return this.isPausedValue}isStopped(){return!1}isLoading(){return this.isLoadingValue}isLoaded(){return this.isLoadedValue}isEnded(){return this.isEndedValue}isMuted(){return this.isMutedValue}}B.BooleanPreference=z,B.EnumPreference=Ne,B.EpubDefaults=UA,B.EpubNavigator=Ge,B.EpubPreferences=wt,B.EpubPreferencesEditor=ve,B.EpubSettings=De,B.ExperimentalWebPubNavigator=Xn,B.FXLCoordinator=fA,B.FXLFrameManager=uA,B.FXLFramePoolManager=FA,B.FXLPeripherals=wA,B.FXLSpreader=EA,B.FrameComms=mt,B.FrameManager=hA,B.FramePoolManager=gA,B.HorizontalThird=mA,B.LineLengths=pt,B.Navigator=ii,B.Orientation=te,B.Preference=N,B.Properties=bt,B.RSProperties=RA,B.RangePreference=U,B.ReadiumCSS=CA,B.Spread=ee,B.TextAlignment=X,B.UserProperties=He,B.VerticalThird=pA,B.VisualNavigator=ae,B.WebAudioEngine=lr,B.WebPubBlobBuilder=ni,B.WebPubCSS=AA,B.WebPubDefaults=oA,B.WebPubFrameManager=$i,B.WebPubFramePoolManager=tA,B.WebPubNavigator=sA,B.WebPubPreferences=Mt,B.WebPubPreferencesEditor=xe,B.WebPubSettings=Ye,B.WebRSProperties=iA,B.WebUserProperties=ze,B.ensureBoolean=F,B.ensureEnumValue=jt,B.ensureExperiment=Qe,B.ensureFilter=rt,B.ensureLessThanOrEqual=nA,B.ensureMoreThanOrEqual=rA,B.ensureNonNegative=y,B.ensureString=Y,B.ensureValueInRange=O,B.experiments=_t,B.filterRangeConfig=At,B.fontSizeRangeConfig=St,B.fontWeightRangeConfig=q,B.fontWidthRangeConfig=zt,B.letterSpacingRangeConfig=Qt,B.lineHeightRangeConfig=Yt,B.lineLengthRangeConfig=nt,B.paragraphIndentRangeConfig=Nt,B.paragraphSpacingRangeConfig=xt,B.sML=ft,B.sMLWithRequest=R,B.withFallback=$t,B.wordSpacingRangeConfig=Tt,B.zoomRangeConfig=Pt,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
380
+ Overscroll: ${this.pan.overscrollX.toFixed(2)},${this.pan.overscrollY.toFixed(2)}`)}if(n){this.manager.updateBookStyle();return}if(this.dragState>0&&this.pan.letItGo){this.pan.endX=t.X;const a=this.manager.currentSlide*(this.manager.width/this.manager.perPage),l=this.pan.endX-this.pan.startX,h=this.manager.rtl?a+l:a-l;cancelAnimationFrame(this.moveFrame),this.moveFrame=requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.manager.spineElement.style.transform=`translate3d(${(this.manager.rtl?1:-1)*h}px, 0, 0)`})})}}dblclickHandler(e){clearTimeout(this.dtimer),this.pdblclick=!0,this.dtimer=window.setTimeout(()=>this.pdblclick=!1,200),!this.disableDblClick&&this.isScaled&&(this.scale=1)}get isScaled(){return this.scale>1}addTouch(e){e.touches=[{pageX:e.pageX,pageY:e.pageY}]}mousedownHandler(e){this.isScaled&&(this.addTouch(e),this.touchstartHandler(e))}mouseupHandler(e){this.isScaled&&this.touchendHandler(e)}mousemoveHandler(e){this.isScaled&&e.buttons>0&&(e.preventDefault(),this.addTouch(e),this.touchmoveHandler(e))}updateAfterDrag(){const e=(this.manager.rtl?-1:1)*(this.pan.endX-this.pan.startX),t=Math.abs(e);e>0&&t>this.manager.threshold&&this.manager.slength>this.manager.perPage?this.manager.listener("no_less",void 0):e<0&&t>this.manager.threshold&&this.manager.slength>this.manager.perPage&&this.manager.listener("no_more",void 0),this.manager.slideToCurrent(!0,!0)}}var et=(r=>(r.auto="auto",r.landscape="landscape",r.portrait="portrait",r))(et||{}),tt=(r=>(r.auto="auto",r.both="both",r.none="none",r.landscape="landscape",r))(tt||{});class Pn{constructor(e){this.shift=!0,this.spreads=[],this.nLandscape=0,this.index(e),this.testShift(e),console.log(`Indexed ${this.spreads.length} spreads for ${e.readingOrder.items.length} items`)}index(e,t=!1){this.nLandscape=0,e.readingOrder.items.forEach((i,n)=>{t||(e.readingOrder.items[n]=i.addProperties({number:n+1,isImage:i.type?.indexOf("image/")===0}));const o=i.properties?.otherProperties.orientation==="landscape";(!i.properties?.page||t)&&(i.properties=i.properties?.add({page:o?"center":((this.shift?0:1)+n-this.nLandscape)%2?e.metadata.readingProgression===O.rtl?"right":"left":e.metadata.readingProgression===O.rtl?"left":"right"})),(o||i.properties?.otherProperties.addBlank)&&this.nLandscape++}),t&&(this.spreads=[]),this.buildSpreads(e.readingOrder)}testShift(e){let t=!1;this.spreads.forEach((i,n)=>{if(i.length>1)return;const o=i[0],s=o.properties?.otherProperties.orientation;n===0&&(s==="landscape"||s!=="portrait"&&((o.width||0)>(o.height||0)||o.properties?.otherProperties.spread==="both"))&&(this.shift=!1),t&&o.properties?.page===H.center&&this.spreads[n-1][0].addProperties({addBlank:!0}),s==="portrait"&&o.properties?.page!=="center"&&o.properties?.otherProperties.number>1?t=!0:t=!1}),this.shift||this.index(e,!0)}buildSpreads(e){let t=[];e.items.forEach((i,n)=>{!n&&this.shift?this.spreads.push([i]):i.properties?.page===H.center?(t.length>0&&this.spreads.push(t),this.spreads.push([i]),t=[]):t.length>=2?(this.spreads.push(t),t=[i]):t.push(i)}),t.length>0&&this.spreads.push(t)}currentSpread(e,t){return this.spreads[Math.min(Math.floor(e/t),this.spreads.length-1)]}findByLink(e){return this.spreads.find(t=>t.includes(e))||void 0}}const xn=8,En=5,vr=300,Sr=15e3,_r=250,wr=150,kr=500;class Cn{constructor(e,t,i,n){if(this.pool=new Map,this.blobs=new Map,this.inprogress=new Map,this.delayedShow=new Map,this.delayedTimeout=new Map,this.previousFrames=[],this.injector=null,this.width=0,this.height=0,this.transform="",this.currentSlide=0,this.spread=!0,this.orientationInternal=-1,this.container=e,this.positions=t,this.pub=i,this.injector=n??null,this.spreadPresentation=i.metadata.otherMetadata?.spread||tt.auto,this.pub.metadata.effectiveReadingProgression!==O.rtl&&this.pub.metadata.effectiveReadingProgression!==O.ltr)throw Error("Unsupported reading progression for EPUB");this.spreader=new Pn(this.pub),this.containerHeightCached=e.clientHeight,this.bookElement=document.createElement("div"),this.bookElement.ariaLabel="Book",this.bookElement.tabIndex=-1,this.updateBookStyle(!0),this.spineElement=document.createElement("div"),this.spineElement.ariaLabel="Spine",this.bookElement.appendChild(this.spineElement),this.container.appendChild(this.bookElement),this.updateSpineStyle(!0),this.peripherals=new kn(this),this.pub.readingOrder.items.forEach(o=>{const s=new bn(this.peripherals,this.pub.metadata.effectiveReadingProgression,o.href);this.spineElement.appendChild(s.element),this.pool.set(o.href,s),s.width=100/this.length*(o.properties?.otherProperties.orientation===et.landscape||o.properties?.otherProperties.addBlank?this.perPage:1),s.height=this.height})}set listener(e){this._listener=e}get listener(){return this._listener}get doNotDisturb(){return this.peripherals.pan.touchID>0}resizeHandler(e=!0,t=!0){this.currentSlide+this.perPage>this.length&&(this.currentSlide=this.length<=this.perPage?0:this.length-1),this.containerHeightCached=this.container.clientHeight,this.orientationInternal=-1,this.updateSpineStyle(!0),e&&(this.currentSlide=this.reAlign(),this.slideToCurrent(!t,t)),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.pool.forEach((i,n)=>{let o=this.pub.readingOrder.items.findIndex(l=>l.href===n);const s=this.pub.readingOrder.items[o];if(i.width=100/this.length*(s.properties?.otherProperties.orientation===et.landscape||s.properties?.otherProperties.addBlank?this.perPage:1),i.height=this.height,!i.loaded)return;const a=this.spreader.findByLink(s);i.update(this.spreadPosition(a,s))})},_r)}updateDimensions(){this.width=this.bookElement.clientWidth,this.height=this.bookElement.clientHeight}get rtl(){return this.pub.metadata.effectiveReadingProgression===O.rtl}get single(){return!this.spread||this.portrait}get perPage(){return this.spread&&!this.portrait?2:1}get threshold(){return 50}get portrait(){return this.spreadPresentation===tt.none?!0:(this.orientationInternal===-1&&(this.orientationInternal=this.containerHeightCached>this.container.clientWidth?1:0),this.orientationInternal===1)}updateSpineStyle(e,t=!0){let i="0";this.updateDimensions(),this.perPage>1&&(i=`${this.width/2}px`);const n={transition:e?`all ${t?wr:kr}ms ease-out`:"all 0ms ease-out",marginRight:this.rtl?i:"0",marginLeft:this.rtl?"0":i,width:`${this.width/this.perPage*this.length}px`,transform:this.transform,contain:"content"};Object.assign(this.spineElement.style,n)}updateBookStyle(e=!1){if(e){const t={overflow:"hidden",direction:this.pub.metadata.effectiveReadingProgression,cursor:"",height:"100%",width:"100%",position:"relative",outline:"none",transition:this.peripherals?.dragState?"none":"transform .15s ease-in-out",touchAction:"none"};Object.assign(this.bookElement.style,t)}this.bookElement.style.transform=`scale(${this.peripherals?.scale||1})`+(this.peripherals?` translate3d(${this.peripherals.pan.translateX}px, ${this.peripherals.pan.translateY}px, 0px)`:"")}goTo(e){if(this.slength<=this.perPage)return;e=this.reAlign(e);const t=this.currentSlide;this.currentSlide=Math.min(Math.max(e,0),this.length-1),t!==this.currentSlide&&this.slideToCurrent(!1)}onChange(){this.peripherals.scale=1,this.updateBookStyle()}get offset(){return(this.rtl?1:-1)*this.currentSlide*(this.width/this.perPage)}get length(){if(this.single)return this.slength;const e=this.slength+this.nLandscape;return this.shift&&e%2===0?e+1:e}get slength(){return this.pub.readingOrder.items.length||0}get shift(){return this.spreader.shift}get nLandscape(){return this.spreader.nLandscape}setPerPage(e){e===null?this.spread=!0:e===1?this.spread=!1:this.spread=!0,requestAnimationFrame(()=>this.resizeHandler(!0))}slideToCurrent(e,t=!0){if(this.updateDimensions(),e)requestAnimationFrame(()=>{requestAnimationFrame(()=>{const i=`translate3d(${this.offset}px, 0, 0)`;this.spineElement.style.transform!==i&&(this.transform=i,this.updateSpineStyle(!0,t),this.deselect())})});else{const i=`translate3d(${this.offset}px, 0, 0)`;if(this.spineElement.style.transform===i)return;this.transform=i,this.updateSpineStyle(!1),this.deselect()}}bounce(e=!1){requestAnimationFrame(()=>{this.transform=`translate3d(${this.offset+50*(e?1:-1)}px, 0, 0)`,this.updateSpineStyle(!0,!0),setTimeout(()=>{this.transform=`translate3d(${this.offset}px, 0, 0)`,this.updateSpineStyle(!0,!0)},100)})}next(e=1){if(this.slength<=this.perPage)return!1;const t=this.currentSlide;return this.currentSlide=Math.min(this.currentSlide+e,this.length-1),this.perPage>1&&this.currentSlide%2&&this.currentSlide--,this.currentSlide===t&&(this.currentSlide+1,this.length),t!==this.currentSlide?(this.slideToCurrent(!0),this.onChange(),!0):(this.bounce(this.rtl),!1)}prev(e=1){if(this.slength<=this.perPage)return!1;const t=this.currentSlide;return this.currentSlide=Math.max(this.currentSlide-e,0),this.perPage>1&&this.currentSlide%2&&this.currentSlide++,t!==this.currentSlide?(this.slideToCurrent(!0),this.onChange(),!0):(this.bounce(!this.rtl),!1)}get ownerWindow(){return this.container.ownerDocument.defaultView||window}async destroy(){let e=this.inprogress.values(),t=e.next();const i=[];for(;t.value;)i.push(t.value),t=e.next();i.length>0&&await Promise.allSettled(i),this.inprogress.clear();let n=this.pool.values(),o=n.next();for(;o.value;)await o.value.destroy(),o=n.next();this.pool.clear(),this.blobs.forEach(s=>URL.revokeObjectURL(s)),this.injector?.dispose(),this.container.childNodes.forEach(s=>{(s.nodeType===Node.ELEMENT_NODE||s.nodeType===Node.TEXT_NODE)&&s.remove()})}makeSpread(e){return this.perPage<2?[this.pub.readingOrder.items[e]]:this.spreader.currentSpread(e,this.perPage)}reAlign(e=this.currentSlide){return e%2&&!this.single&&e++,e}spreadPosition(e,t){return this.perPage<2||e.length<2?H.center:t.href===e[0].href?this.rtl?H.right:H.left:this.rtl?H.left:H.right}async waitForItem(e){if(this.inprogress.has(e)&&await this.inprogress.get(e),this.delayedShow.has(e)){const t=this.delayedTimeout.get(e);t>0?clearTimeout(t):await this.delayedShow.get(e),this.delayedTimeout.set(e,0),this.delayedShow.delete(e)}}async cancelShowing(e){if(this.delayedShow.has(e)){const t=this.delayedTimeout.get(e);t>0&&clearTimeout(t),this.delayedShow.delete(e)}}async update(e,t,i,n=!1){let o=this.pub.readingOrder.items.findIndex(l=>l.href===t.href);if(o<0)throw Error("Href not found in reading order");this.currentSlide!==o&&(this.currentSlide=this.reAlign(o),this.slideToCurrent(!0));const s=this.makeSpread(this.currentSlide);this.perPage>1&&o++;for(const l of s)await this.waitForItem(l.href);const a=new Promise(async(l,h)=>{const d=[],u=[];this.positions.forEach((c,f)=>{(f>o+xn||f<o-xn)&&(d.includes(c.href)||d.push(c.href)),f<o+En&&f>o-En&&(u.includes(c.href)||u.push(c.href))}),d.forEach(async c=>{u.includes(c)||this.pool.has(c)&&(this.cancelShowing(c),await this.pool.get(c)?.unload())}),this.currentBaseURL!==void 0&&e.baseURL!==this.currentBaseURL&&(this.blobs.forEach(c=>URL.revokeObjectURL(c)),this.blobs.clear()),this.currentBaseURL=e.baseURL;const p=async c=>{const f=e.readingOrder.findIndexWithHref(c),_=e.readingOrder.items[f];if(_){if(!this.blobs.has(c)){const R=await new un(e,this.currentBaseURL||"",_,{injector:this.injector}).build(!0);this.blobs.set(c,R)}this.delayedShow.has(c)||this.delayedShow.set(c,new Promise((w,R)=>{let Hn=!1;const Hr=window.setTimeout(async()=>{this.delayedTimeout.set(c,0);const Gr=this.makeSpread(this.reAlign(f)),Vr=this.spreadPosition(Gr,_),Gn=this.pool.get(c);await Gn.load(i,this.blobs.get(c)),this.peripherals.isScaled||await Gn.show(Vr),this.delayedShow.delete(c),Hn=!0,w()},vr);setTimeout(()=>{!Hn&&this.delayedShow.has(c)&&R(`Offscreen load timeout: ${c}`)},Sr),this.delayedTimeout.set(c,Hr)}))}};try{await Promise.all(u.map(c=>p(c)))}catch(c){h(c)}const v=[];for(const c of s){const f=this.pool.get(c.href),_=this.blobs.get(c.href);_&&(this.cancelShowing(c.href),await f.load(i,_),await f.show(this.spreadPosition(s,c)),this.previousFrames.push(f),await f.activate(),v.push(f))}for(;this.previousFrames.length>0;){const c=this.previousFrames.shift();c&&!v.includes(c)&&await c.unfocus()}this.previousFrames=v,l()});for(const l of s)this.inprogress.set(l.href,a);await a;for(const l of s)this.inprogress.delete(l.href)}get currentFrames(){if(this.perPage<2){const t=this.pub.readingOrder.items[this.currentSlide];return[this.pool.get(t.href)]}return this.spreader.currentSpread(this.currentSlide,this.perPage).map(t=>this.pool.get(t.href))}get currentBounds(){const e={x:0,y:0,width:0,height:0,top:0,right:0,bottom:0,left:0,toJSON(){return this}};return this.currentFrames.forEach(t=>{if(!t)return;const i=t.realSize;e.x=Math.min(e.x,i.x),e.y=Math.min(e.y,i.y),e.width+=i.width,e.height=Math.max(e.height,i.height),e.top=Math.min(e.top,i.top),e.right=Math.min(e.right,i.right),e.bottom=Math.min(e.bottom,i.bottom),e.left=Math.min(e.left,i.left)}),e}get viewport(){const e={readingOrder:[],progressions:new Map,positions:null};return this.spreader.currentSpread(this.currentSlide,this.perPage).forEach(i=>{e.readingOrder.push(i.href),e.progressions.set(i.href,{start:0,end:1})}),e.positions=this.getCurrentNumbers(),e}getCurrentNumbers(){if(this.perPage<2)return[this.pub.readingOrder.items[this.currentSlide].properties?.otherProperties.number];const e=this.spreader.currentSpread(this.currentSlide,this.perPage);return e.length>1?[e[0].properties?.otherProperties.number,e[e.length-1].properties?.otherProperties.number]:[e[0].properties?.otherProperties.number]}deselect(){this.currentFrames?.forEach(e=>e?.deselect())}}class ve{constructor(e={}){this.backgroundColor=T(e.backgroundColor),this.blendFilter=P(e.blendFilter),this.constraint=k(e.constraint),this.columnCount=k(e.columnCount),this.darkenFilter=oe(e.darkenFilter),this.deprecatedFontSize=P(e.deprecatedFontSize),this.fontFamily=T(e.fontFamily),this.fontSize=V(e.fontSize,Ce.range),this.fontSizeNormalize=P(e.fontSizeNormalize),this.fontOpticalSizing=P(e.fontOpticalSizing),this.fontWeight=V(e.fontWeight,J.range),this.fontWidth=V(e.fontWidth,Le.range),this.hyphens=P(e.hyphens),this.invertFilter=oe(e.invertFilter),this.invertGaijiFilter=oe(e.invertGaijiFilter),this.iOSPatch=P(e.iOSPatch),this.iPadOSPatch=P(e.iPadOSPatch),this.letterSpacing=k(e.letterSpacing),this.ligatures=P(e.ligatures),this.lineHeight=k(e.lineHeight),this.linkColor=T(e.linkColor),this.noRuby=P(e.noRuby),this.pageGutter=k(e.pageGutter),this.paragraphIndent=k(e.paragraphIndent),this.paragraphSpacing=k(e.paragraphSpacing),this.scroll=P(e.scroll),this.scrollPaddingTop=k(e.scrollPaddingTop),this.scrollPaddingBottom=k(e.scrollPaddingBottom),this.selectionBackgroundColor=T(e.selectionBackgroundColor),this.selectionTextColor=T(e.selectionTextColor),this.textAlign=Fe(e.textAlign,X),this.textColor=T(e.textColor),this.textNormalization=P(e.textNormalization),this.visitedColor=T(e.visitedColor),this.wordSpacing=k(e.wordSpacing),this.optimalLineLength=k(e.optimalLineLength),this.maximalLineLength=k(e.maximalLineLength),this.minimalLineLength=k(e.minimalLineLength)}static serialize(e){const{...t}=e;return JSON.stringify(t)}static deserialize(e){try{const t=JSON.parse(e);return new ve(t)}catch(t){return console.error("Failed to deserialize preferences:",t),null}}merging(e){const t={...this};for(const i of Object.keys(e))e[i]!==void 0&&(i!=="maximalLineLength"||e[i]===null||e[i]>=(e.optimalLineLength??t.optimalLineLength??65))&&(i!=="minimalLineLength"||e[i]===null||e[i]<=(e.optimalLineLength??t.optimalLineLength??65))&&(t[i]=e[i]);return new ve(t)}}class Ln{constructor(e){this.backgroundColor=T(e.backgroundColor)||null,this.blendFilter=P(e.blendFilter)??!1,this.constraint=k(e.constraint)||0,this.columnCount=k(e.columnCount)||null,this.darkenFilter=oe(e.darkenFilter)??!1,this.deprecatedFontSize=P(e.deprecatedFontSize),(this.deprecatedFontSize===!1||this.deprecatedFontSize===null)&&(this.deprecatedFontSize=!CSS.supports("zoom","1")),this.fontFamily=T(e.fontFamily)||null,this.fontSize=V(e.fontSize,Ce.range)||1,this.fontSizeNormalize=P(e.fontSizeNormalize)??!1,this.fontOpticalSizing=P(e.fontOpticalSizing)??null,this.fontWeight=V(e.fontWeight,J.range)||null,this.fontWidth=V(e.fontWidth,Le.range)||null,this.hyphens=P(e.hyphens)??null,this.invertFilter=oe(e.invertFilter)??!1,this.invertGaijiFilter=oe(e.invertGaijiFilter)??!1,this.iOSPatch=e.iOSPatch===!1?!1:(E.OS.iOS||E.OS.iPadOS)&&E.iOSRequest==="mobile",this.iPadOSPatch=e.iPadOSPatch===!1?!1:E.OS.iPadOS&&E.iOSRequest==="desktop",this.letterSpacing=k(e.letterSpacing)||null,this.ligatures=P(e.ligatures)??null,this.lineHeight=k(e.lineHeight)||null,this.linkColor=T(e.linkColor)||null,this.noRuby=P(e.noRuby)??!1,this.pageGutter=Ze(k(e.pageGutter),20),this.paragraphIndent=k(e.paragraphIndent)??null,this.paragraphSpacing=k(e.paragraphSpacing)??null,this.scroll=P(e.scroll)??!1,this.scrollPaddingTop=k(e.scrollPaddingTop)??null,this.scrollPaddingBottom=k(e.scrollPaddingBottom)??null,this.selectionBackgroundColor=T(e.selectionBackgroundColor)||null,this.selectionTextColor=T(e.selectionTextColor)||null,this.textAlign=Fe(e.textAlign,X)||null,this.textColor=T(e.textColor)||null,this.textNormalization=P(e.textNormalization)??!1,this.visitedColor=T(e.visitedColor)||null,this.wordSpacing=k(e.wordSpacing)||null,this.optimalLineLength=k(e.optimalLineLength)||65,this.maximalLineLength=Ze(on(e.maximalLineLength,this.optimalLineLength),80),this.minimalLineLength=Ze(nn(e.minimalLineLength,this.optimalLineLength),40),this.experiments=Et(e.experiments)||null}}const Se={RS__backgroundColor:"#FFFFFF",RS__textColor:"#121212",RS__linkColor:"#0000EE",RS__visitedColor:"#551A8B",RS__selectionBackgroundColor:"#b4d8fe",RS__selectionTextColor:"inherit"};class zt{constructor(e,t,i){this.preferences=e,this.settings=t,this.metadata=i,this.layout=this.metadata?.effectiveLayout||S.reflowable}clear(){this.preferences=new ve({optimalLineLength:65})}updatePreference(e,t){this.preferences[e]=t}get backgroundColor(){return new z({initialValue:this.preferences.backgroundColor,effectiveValue:this.settings.backgroundColor||Se.RS__backgroundColor,isEffective:this.preferences.backgroundColor!==null,onChange:e=>{this.updatePreference("backgroundColor",e||null)}})}get blendFilter(){return new A({initialValue:this.preferences.blendFilter,effectiveValue:this.settings.blendFilter||!1,isEffective:this.preferences.blendFilter!==null,onChange:e=>{this.updatePreference("blendFilter",e||null)}})}get columnCount(){return new z({initialValue:this.preferences.columnCount,effectiveValue:this.settings.columnCount||null,isEffective:this.layout!==S.fixed&&!this.settings.scroll,onChange:e=>{this.updatePreference("columnCount",e||null)}})}get constraint(){return new z({initialValue:this.preferences.constraint,effectiveValue:this.preferences.constraint||0,isEffective:!0,onChange:e=>{this.updatePreference("constraint",e||null)}})}get darkenFilter(){return new x({initialValue:typeof this.preferences.darkenFilter=="boolean"?100:this.preferences.darkenFilter,effectiveValue:typeof this.settings.darkenFilter=="boolean"?100:this.settings.darkenFilter||0,isEffective:this.settings.darkenFilter!==null,onChange:e=>{this.updatePreference("darkenFilter",e||null)},supportedRange:ie.range,step:ie.step})}get deprecatedFontSize(){return new A({initialValue:this.preferences.deprecatedFontSize,effectiveValue:CSS.supports("zoom","1")?this.settings.deprecatedFontSize||!1:!0,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("deprecatedFontSize",e||null)}})}get fontFamily(){return new z({initialValue:this.preferences.fontFamily,effectiveValue:this.settings.fontFamily||null,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("fontFamily",e||null)}})}get fontSize(){return new x({initialValue:this.preferences.fontSize,effectiveValue:this.settings.fontSize||1,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("fontSize",e||null)},supportedRange:Ce.range,step:Ce.step})}get fontSizeNormalize(){return new A({initialValue:this.preferences.fontSizeNormalize,effectiveValue:this.settings.fontSizeNormalize||!1,isEffective:this.layout!==S.fixed&&this.preferences.fontSizeNormalize!==null,onChange:e=>{this.updatePreference("fontSizeNormalize",e||null)}})}get fontOpticalSizing(){return new A({initialValue:this.preferences.fontOpticalSizing,effectiveValue:this.settings.fontOpticalSizing||!0,isEffective:this.layout!==S.fixed&&this.preferences.fontOpticalSizing!==null,onChange:e=>{this.updatePreference("fontOpticalSizing",e||null)}})}get fontWeight(){return new x({initialValue:this.preferences.fontWeight,effectiveValue:this.settings.fontWeight||400,isEffective:this.layout!==S.fixed&&this.preferences.fontWeight!==null,onChange:e=>{this.updatePreference("fontWeight",e||null)},supportedRange:J.range,step:J.step})}get fontWidth(){return new x({initialValue:this.preferences.fontWidth,effectiveValue:this.settings.fontWidth||100,isEffective:this.layout!==S.fixed&&this.preferences.fontWidth!==null,onChange:e=>{this.updatePreference("fontWidth",e||null)},supportedRange:Le.range,step:Le.step})}get hyphens(){return new A({initialValue:this.preferences.hyphens,effectiveValue:this.settings.hyphens||!1,isEffective:this.layout!==S.fixed&&this.metadata?.effectiveReadingProgression===O.ltr&&this.preferences.hyphens!==null,onChange:e=>{this.updatePreference("hyphens",e||null)}})}get invertFilter(){return new x({initialValue:typeof this.preferences.invertFilter=="boolean"?100:this.preferences.invertFilter,effectiveValue:typeof this.settings.invertFilter=="boolean"?100:this.settings.invertFilter||0,isEffective:this.settings.invertFilter!==null,onChange:e=>{this.updatePreference("invertFilter",e||null)},supportedRange:ie.range,step:ie.step})}get invertGaijiFilter(){return new x({initialValue:typeof this.preferences.invertGaijiFilter=="boolean"?100:this.preferences.invertGaijiFilter,effectiveValue:typeof this.settings.invertGaijiFilter=="boolean"?100:this.settings.invertGaijiFilter||0,isEffective:this.preferences.invertGaijiFilter!==null,onChange:e=>{this.updatePreference("invertGaijiFilter",e||null)},supportedRange:ie.range,step:ie.step})}get iOSPatch(){return new A({initialValue:this.preferences.iOSPatch,effectiveValue:this.settings.iOSPatch||!1,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("iOSPatch",e||null)}})}get iPadOSPatch(){return new A({initialValue:this.preferences.iPadOSPatch,effectiveValue:this.settings.iPadOSPatch||!1,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("iPadOSPatch",e||null)}})}get letterSpacing(){return new x({initialValue:this.preferences.letterSpacing,effectiveValue:this.settings.letterSpacing||0,isEffective:this.layout!==S.fixed&&this.preferences.letterSpacing!==null,onChange:e=>{this.updatePreference("letterSpacing",e||null)},supportedRange:Ae.range,step:Ae.step})}get ligatures(){return new A({initialValue:this.preferences.ligatures,effectiveValue:this.settings.ligatures||!0,isEffective:(()=>{if(this.preferences.ligatures===null||this.layout===S.fixed)return!1;const e=this.metadata?.languages?.[0]?.toLowerCase();return!(e&&["zh","ja","ko","mn-mong"].some(t=>e.startsWith(t)))})(),onChange:e=>{this.updatePreference("ligatures",e||null)}})}get lineHeight(){return new x({initialValue:this.preferences.lineHeight,effectiveValue:this.settings.lineHeight,isEffective:this.layout!==S.fixed&&this.preferences.lineHeight!==null,onChange:e=>{this.updatePreference("lineHeight",e||null)},supportedRange:Re.range,step:Re.step})}get linkColor(){return new z({initialValue:this.preferences.linkColor,effectiveValue:this.settings.linkColor||Se.RS__linkColor,isEffective:this.layout!==S.fixed&&this.preferences.linkColor!==null,onChange:e=>{this.updatePreference("linkColor",e||null)}})}get maximalLineLength(){return new x({initialValue:this.preferences.maximalLineLength,effectiveValue:this.settings.maximalLineLength,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("maximalLineLength",e)},supportedRange:ne.range,step:ne.step})}get minimalLineLength(){return new x({initialValue:this.preferences.minimalLineLength,effectiveValue:this.settings.minimalLineLength,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("minimalLineLength",e)},supportedRange:ne.range,step:ne.step})}get noRuby(){return new A({initialValue:this.preferences.noRuby,effectiveValue:this.settings.noRuby||!1,isEffective:this.layout!==S.fixed&&this.metadata?.languages?.includes("ja")||!1,onChange:e=>{this.updatePreference("noRuby",e||null)}})}get optimalLineLength(){return new x({initialValue:this.preferences.optimalLineLength,effectiveValue:this.settings.optimalLineLength,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("optimalLineLength",e)},supportedRange:ne.range,step:ne.step})}get pageGutter(){return new z({initialValue:this.preferences.pageGutter,effectiveValue:this.settings.pageGutter,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("pageGutter",e||null)}})}get paragraphIndent(){return new x({initialValue:this.preferences.paragraphIndent,effectiveValue:this.settings.paragraphIndent||0,isEffective:this.layout!==S.fixed&&this.preferences.paragraphIndent!==null,onChange:e=>{this.updatePreference("paragraphIndent",e||null)},supportedRange:Te.range,step:Te.step})}get paragraphSpacing(){return new x({initialValue:this.preferences.paragraphSpacing,effectiveValue:this.settings.paragraphSpacing||0,isEffective:this.layout!==S.fixed&&this.preferences.paragraphSpacing!==null,onChange:e=>{this.updatePreference("paragraphSpacing",e||null)},supportedRange:ze.range,step:ze.step})}get scroll(){return new A({initialValue:this.preferences.scroll,effectiveValue:this.settings.scroll||!1,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("scroll",e||null)}})}get scrollPaddingTop(){return new z({initialValue:this.preferences.scrollPaddingTop,effectiveValue:this.settings.scrollPaddingTop||0,isEffective:this.layout!==S.fixed&&!!this.settings.scroll&&this.preferences.scrollPaddingTop!==null,onChange:e=>{this.updatePreference("scrollPaddingTop",e||null)}})}get scrollPaddingBottom(){return new z({initialValue:this.preferences.scrollPaddingBottom,effectiveValue:this.settings.scrollPaddingBottom||0,isEffective:this.layout!==S.fixed&&!!this.settings.scroll&&this.preferences.scrollPaddingBottom!==null,onChange:e=>{this.updatePreference("scrollPaddingBottom",e||null)}})}get selectionBackgroundColor(){return new z({initialValue:this.preferences.selectionBackgroundColor,effectiveValue:this.settings.selectionBackgroundColor||Se.RS__selectionBackgroundColor,isEffective:this.layout!==S.fixed&&this.preferences.selectionBackgroundColor!==null,onChange:e=>{this.updatePreference("selectionBackgroundColor",e||null)}})}get selectionTextColor(){return new z({initialValue:this.preferences.selectionTextColor,effectiveValue:this.settings.selectionTextColor||Se.RS__selectionTextColor,isEffective:this.layout!==S.fixed&&this.preferences.selectionTextColor!==null,onChange:e=>{this.updatePreference("selectionTextColor",e||null)}})}get textAlign(){return new Lt({initialValue:this.preferences.textAlign,effectiveValue:this.settings.textAlign||X.start,isEffective:this.layout!==S.fixed&&this.preferences.textAlign!==null,onChange:e=>{this.updatePreference("textAlign",e||null)},supportedValues:Object.values(X)})}get textColor(){return new z({initialValue:this.preferences.textColor,effectiveValue:this.settings.textColor||Se.RS__textColor,isEffective:this.layout!==S.fixed&&this.preferences.textColor!==null,onChange:e=>{this.updatePreference("textColor",e||null)}})}get textNormalization(){return new A({initialValue:this.preferences.textNormalization,effectiveValue:this.settings.textNormalization||!1,isEffective:this.layout!==S.fixed,onChange:e=>{this.updatePreference("textNormalization",e||null)}})}get visitedColor(){return new z({initialValue:this.preferences.visitedColor,effectiveValue:this.settings.visitedColor||Se.RS__visitedColor,isEffective:this.layout!==S.fixed&&this.preferences.visitedColor!==null,onChange:e=>{this.updatePreference("visitedColor",e||null)}})}get wordSpacing(){return new x({initialValue:this.preferences.wordSpacing,effectiveValue:this.settings.wordSpacing||0,isEffective:this.layout!==S.fixed&&this.preferences.wordSpacing!==null,onChange:e=>{this.updatePreference("wordSpacing",e||null)},supportedRange:Oe.range,step:Oe.step})}}class Ot{constructor(e,t){this.backgroundColor=e.backgroundColor||t.backgroundColor||null,this.blendFilter=typeof e.blendFilter=="boolean"?e.blendFilter:t.blendFilter??null,this.columnCount=e.columnCount!==void 0?e.columnCount:t.columnCount!==void 0?t.columnCount:null,this.constraint=e.constraint||t.constraint,this.darkenFilter=typeof e.darkenFilter=="boolean"?e.darkenFilter:t.darkenFilter??null,this.deprecatedFontSize=typeof e.deprecatedFontSize=="boolean"?e.deprecatedFontSize:t.deprecatedFontSize??null,this.fontFamily=e.fontFamily||t.fontFamily||null,this.fontSize=e.fontSize!==void 0?e.fontSize:t.fontSize!==void 0?t.fontSize:null,this.fontSizeNormalize=typeof e.fontSizeNormalize=="boolean"?e.fontSizeNormalize:t.fontSizeNormalize??null,this.fontOpticalSizing=typeof e.fontOpticalSizing=="boolean"?e.fontOpticalSizing:t.fontOpticalSizing??null,this.fontWeight=e.fontWeight!==void 0?e.fontWeight:t.fontWeight!==void 0?t.fontWeight:null,this.fontWidth=e.fontWidth!==void 0?e.fontWidth:t.fontWidth!==void 0?t.fontWidth:null,this.hyphens=typeof e.hyphens=="boolean"?e.hyphens:t.hyphens??null,this.invertFilter=typeof e.invertFilter=="boolean"?e.invertFilter:t.invertFilter??null,this.invertGaijiFilter=typeof e.invertGaijiFilter=="boolean"?e.invertGaijiFilter:t.invertGaijiFilter??null,this.iOSPatch=this.deprecatedFontSize||e.iOSPatch===!1?!1:e.iOSPatch===!0?(E.OS.iOS||E.OS.iPadOS)&&E.iOSRequest==="mobile":t.iOSPatch,this.iPadOSPatch=this.deprecatedFontSize||e.iPadOSPatch===!1?!1:e.iPadOSPatch===!0?E.OS.iPadOS&&E.iOSRequest==="desktop":t.iPadOSPatch,this.letterSpacing=e.letterSpacing!==void 0?e.letterSpacing:t.letterSpacing!==void 0?t.letterSpacing:null,this.ligatures=typeof e.ligatures=="boolean"?e.ligatures:t.ligatures??null,this.lineHeight=e.lineHeight!==void 0?e.lineHeight:t.lineHeight!==void 0?t.lineHeight:null,this.linkColor=e.linkColor||t.linkColor||null,this.maximalLineLength=e.maximalLineLength===null?null:e.maximalLineLength||t.maximalLineLength||null,this.minimalLineLength=e.minimalLineLength===null?null:e.minimalLineLength||t.minimalLineLength||null,this.noRuby=typeof e.noRuby=="boolean"?e.noRuby:t.noRuby??null,this.optimalLineLength=e.optimalLineLength||t.optimalLineLength,this.pageGutter=e.pageGutter!==void 0?e.pageGutter:t.pageGutter!==void 0?t.pageGutter:null,this.paragraphIndent=e.paragraphIndent!==void 0?e.paragraphIndent:t.paragraphIndent!==void 0?t.paragraphIndent:null,this.paragraphSpacing=e.paragraphSpacing!==void 0?e.paragraphSpacing:t.paragraphSpacing!==void 0?t.paragraphSpacing:null,this.scroll=typeof e.scroll=="boolean"?e.scroll:t.scroll??null,this.scrollPaddingTop=e.scrollPaddingTop!==void 0?e.scrollPaddingTop:t.scrollPaddingTop!==void 0?t.scrollPaddingTop:null,this.scrollPaddingBottom=e.scrollPaddingBottom!==void 0?e.scrollPaddingBottom:t.scrollPaddingBottom!==void 0?t.scrollPaddingBottom:null,this.selectionBackgroundColor=e.selectionBackgroundColor||t.selectionBackgroundColor||null,this.selectionTextColor=e.selectionTextColor||t.selectionTextColor||null,this.textAlign=e.textAlign||t.textAlign||null,this.textColor=e.textColor||t.textColor||null,this.textNormalization=typeof e.textNormalization=="boolean"?e.textNormalization:t.textNormalization??null,this.visitedColor=e.visitedColor||t.visitedColor||null,this.wordSpacing=e.wordSpacing!==void 0?e.wordSpacing:t.wordSpacing!==void 0?t.wordSpacing:null,this.experiments=t.experiments||null}}function it(r){const e=getComputedStyle(r),t=parseFloat(e.paddingLeft||"0"),i=parseFloat(e.paddingRight||"0");return r.clientWidth-t-i}class Mt extends Ie{constructor(e){super(),this.a11yNormalize=e.a11yNormalize??null,this.backgroundColor=e.backgroundColor??null,this.blendFilter=e.blendFilter??null,this.bodyHyphens=e.bodyHyphens??null,this.colCount=e.colCount??null,this.darkenFilter=e.darkenFilter??null,this.deprecatedFontSize=e.deprecatedFontSize??null,this.fontFamily=e.fontFamily??null,this.fontOpticalSizing=e.fontOpticalSizing??null,this.fontSize=e.fontSize??null,this.fontSizeNormalize=e.fontSizeNormalize??null,this.fontWeight=e.fontWeight??null,this.fontWidth=e.fontWidth??null,this.invertFilter=e.invertFilter??null,this.invertGaijiFilter=e.invertGaijiFilter??null,this.iOSPatch=e.iOSPatch??null,this.iPadOSPatch=e.iPadOSPatch??null,this.letterSpacing=e.letterSpacing??null,this.ligatures=e.ligatures??null,this.lineHeight=e.lineHeight??null,this.lineLength=e.lineLength??null,this.linkColor=e.linkColor??null,this.noRuby=e.noRuby??null,this.paraIndent=e.paraIndent??null,this.paraSpacing=e.paraSpacing??null,this.selectionBackgroundColor=e.selectionBackgroundColor??null,this.selectionTextColor=e.selectionTextColor??null,this.textAlign=e.textAlign??null,this.textColor=e.textColor??null,this.view=e.view??null,this.visitedColor=e.visitedColor??null,this.wordSpacing=e.wordSpacing??null}toCSSProperties(){const e={};return this.a11yNormalize&&(e["--USER__a11yNormalize"]=this.toFlag("a11y")),this.backgroundColor&&(e["--USER__backgroundColor"]=this.backgroundColor),this.blendFilter&&(e["--USER__blendFilter"]=this.toFlag("blend")),this.bodyHyphens&&(e["--USER__bodyHyphens"]=this.bodyHyphens),this.colCount&&(e["--USER__colCount"]=this.toUnitless(this.colCount)),this.darkenFilter===!0?e["--USER__darkenFilter"]=this.toFlag("darken"):typeof this.darkenFilter=="number"&&(e["--USER__darkenFilter"]=this.toPercentage(this.darkenFilter)),this.deprecatedFontSize&&(e["--USER__fontSizeImplementation"]=this.toFlag("deprecatedFontSize")),this.fontFamily&&(e["--USER__fontFamily"]=this.fontFamily),this.fontOpticalSizing!=null&&(e["--USER__fontOpticalSizing"]=this.fontOpticalSizing),this.fontSize!=null&&(e["--USER__fontSize"]=this.toPercentage(this.fontSize,!0)),this.fontSizeNormalize&&(e["--USER__fontSizeNormalize"]=this.toFlag("normalize")),this.fontWeight!=null&&(e["--USER__fontWeight"]=this.toUnitless(this.fontWeight)),this.fontWidth!=null&&(e["--USER__fontWidth"]=typeof this.fontWidth=="string"?this.fontWidth:this.toUnitless(this.fontWidth)),this.invertFilter===!0?e["--USER__invertFilter"]=this.toFlag("invert"):typeof this.invertFilter=="number"&&(e["--USER__invertFilter"]=this.toPercentage(this.invertFilter)),this.invertGaijiFilter===!0?e["--USER__invertGaiji"]=this.toFlag("invertGaiji"):typeof this.invertGaijiFilter=="number"&&(e["--USER__invertGaiji"]=this.toPercentage(this.invertGaijiFilter)),this.iOSPatch&&(e["--USER__iOSPatch"]=this.toFlag("iOSPatch")),this.iPadOSPatch&&(e["--USER__iPadOSPatch"]=this.toFlag("iPadOSPatch")),this.letterSpacing!=null&&(e["--USER__letterSpacing"]=this.toRem(this.letterSpacing)),this.ligatures&&(e["--USER__ligatures"]=this.ligatures),this.lineHeight!=null&&(e["--USER__lineHeight"]=this.toUnitless(this.lineHeight)),this.lineLength!=null&&(e["--USER__lineLength"]=this.toPx(this.lineLength)),this.linkColor&&(e["--USER__linkColor"]=this.linkColor),this.noRuby&&(e["--USER__noRuby"]=this.toFlag("noRuby")),this.paraIndent!=null&&(e["--USER__paraIndent"]=this.toRem(this.paraIndent)),this.paraSpacing!=null&&(e["--USER__paraSpacing"]=this.toRem(this.paraSpacing)),this.selectionBackgroundColor&&(e["--USER__selectionBackgroundColor"]=this.selectionBackgroundColor),this.selectionTextColor&&(e["--USER__selectionTextColor"]=this.selectionTextColor),this.textAlign&&(e["--USER__textAlign"]=this.textAlign),this.textColor&&(e["--USER__textColor"]=this.textColor),this.view&&(e["--USER__view"]=this.toFlag(this.view)),this.visitedColor&&(e["--USER__visitedColor"]=this.visitedColor),this.wordSpacing!=null&&(e["--USER__wordSpacing"]=this.toRem(this.wordSpacing)),e}}class An extends Ie{constructor(e){super(),this.backgroundColor=e.backgroundColor??null,this.baseFontFamily=e.baseFontFamily??null,this.baseFontSize=e.baseFontSize??null,this.baseLineHeight=e.baseLineHeight??null,this.boxSizingMedia=e.boxSizingMedia??null,this.boxSizingTable=e.boxSizingTable??null,this.colWidth=e.colWidth??null,this.colCount=e.colCount??null,this.colGap=e.colGap??null,this.codeFontFamily=e.codeFontFamily??null,this.compFontFamily=e.compFontFamily??null,this.defaultLineLength=e.defaultLineLength??null,this.flowSpacing=e.flowSpacing??null,this.humanistTf=e.humanistTf??null,this.linkColor=e.linkColor??null,this.maxMediaWidth=e.maxMediaWidth??null,this.maxMediaHeight=e.maxMediaHeight??null,this.modernTf=e.modernTf??null,this.monospaceTf=e.monospaceTf??null,this.noOverflow=e.noOverflow??null,this.noVerticalPagination=e.noVerticalPagination??null,this.oldStyleTf=e.oldStyleTf??null,this.pageGutter=e.pageGutter??null,this.paraIndent=e.paraIndent??null,this.paraSpacing=e.paraSpacing??null,this.primaryColor=e.primaryColor??null,this.scrollPaddingBottom=e.scrollPaddingBottom??null,this.scrollPaddingTop=e.scrollPaddingTop??null,this.sansSerifJa=e.sansSerifJa??null,this.sansSerifJaV=e.sansSerifJaV??null,this.sansTf=e.sansTf??null,this.secondaryColor=e.secondaryColor??null,this.selectionBackgroundColor=e.selectionBackgroundColor??null,this.selectionTextColor=e.selectionTextColor??null,this.serifJa=e.serifJa??null,this.serifJaV=e.serifJaV??null,this.textColor=e.textColor??null,this.typeScale=e.typeScale??null,this.visitedColor=e.visitedColor??null,this.experiments=e.experiments??null}toCSSProperties(){const e={};return this.backgroundColor&&(e["--RS__backgroundColor"]=this.backgroundColor),this.baseFontFamily&&(e["--RS__baseFontFamily"]=this.baseFontFamily),this.baseFontSize!=null&&(e["--RS__baseFontSize"]=this.toRem(this.baseFontSize)),this.baseLineHeight!=null&&(e["--RS__baseLineHeight"]=this.toUnitless(this.baseLineHeight)),this.boxSizingMedia&&(e["--RS__boxSizingMedia"]=this.boxSizingMedia),this.boxSizingTable&&(e["--RS__boxSizingTable"]=this.boxSizingTable),this.colWidth!=null&&(e["--RS__colWidth"]=this.colWidth),this.colCount!=null&&(e["--RS__colCount"]=this.toUnitless(this.colCount)),this.colGap!=null&&(e["--RS__colGap"]=this.toPx(this.colGap)),this.codeFontFamily&&(e["--RS__codeFontFamily"]=this.codeFontFamily),this.compFontFamily&&(e["--RS__compFontFamily"]=this.compFontFamily),this.defaultLineLength!=null&&(e["--RS__defaultLineLength"]=this.toPx(this.defaultLineLength)),this.flowSpacing!=null&&(e["--RS__flowSpacing"]=this.toRem(this.flowSpacing)),this.humanistTf&&(e["--RS__humanistTf"]=this.humanistTf),this.linkColor&&(e["--RS__linkColor"]=this.linkColor),this.maxMediaWidth&&(e["--RS__maxMediaWidth"]=this.toVw(this.maxMediaWidth)),this.maxMediaHeight&&(e["--RS__maxMediaHeight"]=this.toVh(this.maxMediaHeight)),this.modernTf&&(e["--RS__modernTf"]=this.modernTf),this.monospaceTf&&(e["--RS__monospaceTf"]=this.monospaceTf),this.noOverflow&&(e["--RS__disableOverflow"]=this.toFlag("noOverflow")),this.noVerticalPagination&&(e["--RS__disablePagination"]=this.toFlag("noVerticalPagination")),this.oldStyleTf&&(e["--RS__oldStyleTf"]=this.oldStyleTf),this.pageGutter!=null&&(e["--RS__pageGutter"]=this.toPx(this.pageGutter)),this.paraIndent!=null&&(e["--RS__paraIndent"]=this.toRem(this.paraIndent)),this.paraSpacing!=null&&(e["--RS__paraSpacing"]=this.toRem(this.paraSpacing)),this.primaryColor&&(e["--RS__primaryColor"]=this.primaryColor),this.sansSerifJa&&(e["--RS__sans-serif-ja"]=this.sansSerifJa),this.sansSerifJaV&&(e["--RS__sans-serif-ja-v"]=this.sansSerifJaV),this.sansTf&&(e["--RS__sansTf"]=this.sansTf),this.scrollPaddingBottom!=null&&(e["--RS__scrollPaddingBottom"]=this.toPx(this.scrollPaddingBottom)),this.scrollPaddingTop!=null&&(e["--RS__scrollPaddingTop"]=this.toPx(this.scrollPaddingTop)),this.secondaryColor&&(e["--RS__secondaryColor"]=this.secondaryColor),this.selectionBackgroundColor&&(e["--RS__selectionBackgroundColor"]=this.selectionBackgroundColor),this.selectionTextColor&&(e["--RS__selectionTextColor"]=this.selectionTextColor),this.serifJa&&(e["--RS__serif-ja"]=this.serifJa),this.serifJaV&&(e["--RS__serif-ja-v"]=this.serifJaV),this.textColor&&(e["--RS__textColor"]=this.textColor),this.typeScale&&(e["--RS__typeScale"]=this.toUnitless(this.typeScale)),this.visitedColor&&(e["--RS__visitedColor"]=this.visitedColor),this.experiments&&this.experiments.forEach(t=>{e["--RS__"+t]=Ke[t].value}),e}}class Rn{constructor(e){this.rsProperties=e.rsProperties,this.userProperties=e.userProperties,this.lineLengths=e.lineLengths,this.container=e.container,this.containerParent=e.container.parentElement||document.documentElement,this.constraint=e.constraint,this.cachedColCount=e.userProperties.colCount,this.effectiveContainerWidth=it(this.containerParent)}update(e){this.cachedColCount=e.columnCount,e.constraint!==this.constraint&&(this.constraint=e.constraint),e.pageGutter!==this.rsProperties.pageGutter&&(this.rsProperties.pageGutter=e.pageGutter),e.scrollPaddingBottom!==this.rsProperties.scrollPaddingBottom&&(this.rsProperties.scrollPaddingBottom=e.scrollPaddingBottom),e.scrollPaddingTop!==this.rsProperties.scrollPaddingTop&&(this.rsProperties.scrollPaddingTop=e.scrollPaddingTop),e.experiments!==this.rsProperties.experiments&&(this.rsProperties.experiments=e.experiments),this.lineLengths.update({fontFace:e.fontFamily,letterSpacing:e.letterSpacing,pageGutter:e.pageGutter,wordSpacing:e.wordSpacing,optimalChars:e.optimalLineLength,minChars:e.minimalLineLength,maxChars:e.maximalLineLength});const t=this.updateLayout(e.fontSize,e.deprecatedFontSize||e.iOSPatch,e.scroll,e.columnCount);t?.effectiveContainerWidth&&(this.effectiveContainerWidth=t?.effectiveContainerWidth);const i={a11yNormalize:e.textNormalization,backgroundColor:e.backgroundColor,blendFilter:e.blendFilter,bodyHyphens:typeof e.hyphens!="boolean"?null:e.hyphens?"auto":"none",colCount:t?.colCount,darkenFilter:e.darkenFilter,deprecatedFontSize:e.deprecatedFontSize,fontFamily:e.fontFamily,fontOpticalSizing:typeof e.fontOpticalSizing!="boolean"?null:e.fontOpticalSizing?"auto":"none",fontSize:e.fontSize,fontSizeNormalize:e.fontSizeNormalize,fontWeight:e.fontWeight,fontWidth:e.fontWidth,invertFilter:e.invertFilter,invertGaijiFilter:e.invertGaijiFilter,iOSPatch:e.iOSPatch,iPadOSPatch:e.iPadOSPatch,letterSpacing:e.letterSpacing,ligatures:typeof e.ligatures!="boolean"?null:e.ligatures?"common-ligatures":"none",lineHeight:e.lineHeight,lineLength:t?.effectiveLineLength,linkColor:e.linkColor,noRuby:e.noRuby,paraIndent:e.paragraphIndent,paraSpacing:e.paragraphSpacing,selectionBackgroundColor:e.selectionBackgroundColor,selectionTextColor:e.selectionTextColor,textAlign:e.textAlign,textColor:e.textColor,view:typeof e.scroll!="boolean"?null:e.scroll?"scroll":"paged",visitedColor:e.visitedColor,wordSpacing:e.wordSpacing};this.userProperties=new Mt(i)}updateLayout(e,t,i,n){return i??this.userProperties.view==="scroll"?this.computeScrollLength(e,t):this.paginate(e,t,n)}getCompensatedMetrics(e,t){const i=e||this.userProperties.fontSize||1,n=i<1?1/i:t?i:1;return{zoomFactor:i,zoomCompensation:n,optimal:Math.round(this.lineLengths.optimalLineLength)*i,minimal:this.lineLengths.minimalLineLength!==null?Math.round(this.lineLengths.minimalLineLength*i):null,maximal:this.lineLengths.maximalLineLength!==null?Math.round(this.lineLengths.maximalLineLength*i):null}}paginate(e,t,i){const n=Math.round(it(this.containerParent)-this.constraint),o=this.getCompensatedMetrics(e,t),{zoomCompensation:s,optimal:a,minimal:l,maximal:h}=o,d=()=>n>=a&&h!==null?Math.min(Math.round(h*s),n):n;let u=1,p=n;if(i===void 0)return{colCount:void 0,effectiveContainerWidth:p,effectiveLineLength:Math.round(p/u*s)};if(i===null)if(n>=a&&h!==null){u=Math.floor(n/a);const v=Math.round(u*(h*s));p=Math.min(v,n)}else p=d();else if(i>1){const v=Math.round(i*(l!==null?l:a));if(n>=v)if(u=i,h===null)p=n;else{const c=Math.round(u*(h*s));p=Math.min(c,n)}else if(l!==null&&n<Math.round(i*l))if(u=Math.floor(n/l),u<=1)u=1,p=d();else{const c=Math.round(u*(a*s));p=Math.min(c,n)}else{u=i;const c=Math.round(u*(a*s));p=Math.min(c,n)}}else u=1,p=d();return{colCount:u,effectiveContainerWidth:p,effectiveLineLength:Math.round(p/u/(e&&e>=1?e:1)*s)}}computeScrollLength(e,t){const i=Math.round(it(this.containerParent)-this.constraint),n=this.getCompensatedMetrics(e&&(e<1||t)?e:1,t),o=n.zoomCompensation,s=n.optimal,a=n.maximal;let l,h=i,d=Math.round(s*o);if(a===null)d=i;else{const u=Math.min(Math.round(a*o),i);d=t?u:Math.round(u*o)}return{colCount:l,effectiveContainerWidth:h,effectiveLineLength:d}}setContainerWidth(){this.container.style.width=`${this.effectiveContainerWidth}px`}resizeHandler(){const e=this.updateLayout(this.userProperties.fontSize,this.userProperties.deprecatedFontSize||this.userProperties.iOSPatch,this.userProperties.view==="scroll",this.cachedColCount);this.userProperties.colCount=e.colCount,this.userProperties.lineLength=e.effectiveLineLength,this.effectiveContainerWidth=e.effectiveContainerWidth,this.container.style.width=`${this.effectiveContainerWidth}px`}}const Pr=`/*!
381
+ * Readium CSS v.2.0.0-beta.24
382
+ * Copyright (c) 2017–2025. Readium Foundation. All rights reserved.
383
+ * Use of this source code is governed by a BSD-style license which is detailed in the
384
+ * LICENSE file present in the project repository where this source code is maintained.
385
+ * Core maintainer: Jiminy Panoz <jiminy.panoz@edrlab.org>
386
+ * Contributors:
387
+ * Daniel Weck
388
+ * Hadrien Gardeur
389
+ * Innovimax
390
+ * L. Le Meur
391
+ * Mickaël Menu
392
+ * k_taka
393
+ */
394
+
395
+ @namespace url("http://www.w3.org/1999/xhtml");
396
+
397
+ @namespace epub url("http://www.idpf.org/2007/ops");
398
+
399
+ @namespace m url("http://www.w3.org/1998/Math/MathML");
400
+
401
+ @namespace svg url("http://www.w3.org/2000/svg");
402
+
403
+ :root{
404
+
405
+ --RS__viewportWidth:100%;
406
+
407
+ --RS__pageGutter:0;
408
+
409
+ --RS__defaultLineLength:40rem;
410
+
411
+ --RS__colGap:0;
412
+
413
+ --RS__colCount:1;
414
+
415
+ --RS__colWidth:100vw;
416
+ }
417
+
418
+ @page{
419
+ margin:0 !important;
420
+ }
421
+
422
+ :root{
423
+ position:relative;
424
+
425
+ -webkit-column-width:var(--RS__colWidth);
426
+ -moz-column-width:var(--RS__colWidth);
427
+ column-width:var(--RS__colWidth);
428
+ -webkit-column-count:var(--RS__colCount);
429
+ -moz-column-count:var(--RS__colCount);
430
+ column-count:var(--RS__colCount);
431
+
432
+ -webkit-column-gap:var(--RS__colGap);
433
+ -moz-column-gap:var(--RS__colGap);
434
+ column-gap:var(--RS__colGap);
435
+ -moz-column-fill:auto;
436
+ column-fill:auto;
437
+ width:var(--RS__viewportWidth);
438
+ height:100vh;
439
+ max-width:var(--RS__viewportWidth);
440
+ max-height:100vh;
441
+ min-width:var(--RS__viewportWidth);
442
+ min-height:100vh;
443
+ padding:0 !important;
444
+ margin:0 !important;
445
+ font-size:1rem !important;
446
+ box-sizing:border-box;
447
+ -webkit-touch-callout:none;
448
+ }
449
+
450
+ body{
451
+ width:100%;
452
+ max-width:var(--RS__defaultLineLength) !important;
453
+ padding:0 var(--RS__pageGutter) !important;
454
+ margin:0 auto !important;
455
+ box-sizing:border-box;
456
+ }
457
+
458
+ :root:not([style*="readium-noOverflow-on"]) body{
459
+ overflow:hidden;
460
+ }
461
+
462
+ @supports (overflow: clip){
463
+
464
+ :root:not([style*="readium-noOverflow-on"]){
465
+ overflow:clip;
466
+ }
467
+
468
+ :root:not([style*="readium-noOverflow-on"]) body{
469
+ overflow:clip;
470
+ overflow-clip-margin:content-box;
471
+ }
472
+ }
473
+
474
+ :root[style*="readium-scroll-on"]{
475
+ -webkit-columns:auto auto !important;
476
+ -moz-columns:auto auto !important;
477
+ columns:auto auto !important;
478
+ width:auto !important;
479
+ height:auto !important;
480
+ max-width:none !important;
481
+ max-height:none !important;
482
+ min-width:0 !important;
483
+ min-height:0 !important;
484
+ }
485
+
486
+ :root[style*="readium-scroll-on"] body{
487
+ max-width:var(--RS__defaultLineLength) !important;
488
+ box-sizing:border-box !important;
489
+ }
490
+
491
+ :root[style*="readium-scroll-on"]:not([style*="readium-noOverflow-on"]) body{
492
+ overflow:auto;
493
+ }
494
+
495
+ @supports (overflow: clip){
496
+
497
+ :root[style*="readium-scroll-on"]:not([style*="readium-noOverflow-on"]){
498
+ overflow:auto;
499
+ }
500
+
501
+ :root[style*="readium-scroll-on"]:not([style*="readium-noOverflow-on"]) body{
502
+ overflow:clip;
503
+ }
504
+ }
505
+
506
+ :root[style*="readium-scroll-on"][style*="--RS__scrollPaddingTop"] body{
507
+ padding-top:var(--RS__scrollPaddingTop) !important;
508
+ }
509
+
510
+ :root[style*="readium-scroll-on"][style*="--RS__scrollPaddingBottom"] body{
511
+ padding-bottom:var(--RS__scrollPaddingBottom) !important;
512
+ }
513
+
514
+ :root[style*="readium-scroll-on"][style*="--RS__scrollPaddingLeft"] body{
515
+ padding-left:var(--RS__scrollPaddingLeft) !important;
516
+ }
517
+
518
+ :root[style*="readium-scroll-on"][style*="--RS__scrollPaddingRight"] body{
519
+ padding-right:var(--RS__scrollPaddingRight) !important;
520
+ }
521
+
522
+ :root[style*="--USER__backgroundColor"]{
523
+ background-color:var(--USER__backgroundColor) !important;
524
+ }
525
+
526
+ :root[style*="--USER__backgroundColor"] *{
527
+ background-color:transparent !important;
528
+ }
529
+
530
+ :root[style*="--USER__textColor"]{
531
+ color:var(--USER__textColor) !important;
532
+ }
533
+
534
+ :root[style*="--USER__textColor"] *:not(a){
535
+ color:inherit !important;
536
+ background-color:transparent !important;
537
+ border-color:currentcolor !important;
538
+ }
539
+
540
+ :root[style*="--USER__textColor"] svg text{
541
+ fill:currentcolor !important;
542
+ stroke:none !important;
543
+ }
544
+
545
+ :root[style*="--USER__linkColor"] a:link,
546
+ :root[style*="--USER__linkColor"] a:link *{
547
+ color:var(--USER__linkColor) !important;
548
+ }
549
+
550
+ :root[style*="--USER__visitedColor"] a:visited,
551
+ :root[style*="--USER__visitedColor"] a:visited *{
552
+ color:var(--USER__visitedColor) !important;
553
+ }
554
+
555
+ :root[style*="--USER__selectionBackgroundColor"][style*="--USER__selectionTextColor"] ::-moz-selection{
556
+ color:var(--USER__selectionTextColor) !important;
557
+ background-color:var(--USER__selectionBackgroundColor) !important;
558
+ }
559
+
560
+ :root[style*="--USER__selectionBackgroundColor"][style*="--USER__selectionTextColor"] ::selection{
561
+ color:var(--USER__selectionTextColor) !important;
562
+ background-color:var(--USER__selectionBackgroundColor) !important;
563
+ }
564
+
565
+ :root[style*="--USER__colCount"]{
566
+ -webkit-column-count:var(--USER__colCount);
567
+ -moz-column-count:var(--USER__colCount);
568
+ column-count:var(--USER__colCount);
569
+
570
+ --RS__colWidth:auto;
571
+ }
572
+
573
+ :root[style*="--USER__colCount: 0"],
574
+ :root[style*="--USER__colCount:0"]{
575
+ -webkit-column-count:1;
576
+ -moz-column-count:1;
577
+ column-count:1;
578
+ }
579
+
580
+ :root[style*="--USER__colCount: 0"],
581
+ :root[style*="--USER__colCount:0"],
582
+ :root[style*="--USER__colCount: 1"],
583
+ :root[style*="--USER__colCount:1"]{
584
+ --RS__colWidth:100vw;
585
+ }
586
+
587
+ :root[style*="--USER__lineLength"] body{
588
+ max-width:var(--USER__lineLength) !important;
589
+ }
590
+
591
+ :root[style*="--USER__textAlign"]{
592
+ text-align:var(--USER__textAlign);
593
+ }
594
+
595
+ :root[style*="--USER__textAlign"] body,
596
+ :root[style*="--USER__textAlign"] p:not(
597
+ blockquote p,
598
+ figcaption p,
599
+ header p,
600
+ hgroup p,
601
+ :root[style*="readium-experimentalHeaderFiltering-on"] p[class*="title"],
602
+ :root[style*="readium-experimentalHeaderFiltering-on"] div:has(+ *) > h1 + p,
603
+ :root[style*="readium-experimentalHeaderFiltering-on"] div:has(+ *) > p:has(+ h1)
604
+ ),
605
+ :root[style*="--USER__textAlign"] li,
606
+ :root[style*="--USER__textAlign"] dd{
607
+ text-align:var(--USER__textAlign) !important;
608
+ -moz-text-align-last:auto !important;
609
+ -epub-text-align-last:auto !important;
610
+ text-align-last:auto !important;
611
+ }
612
+
613
+ :root[style*="--USER__bodyHyphens"]{
614
+ -webkit-hyphens:var(--USER__bodyHyphens) !important;
615
+ -moz-hyphens:var(--USER__bodyHyphens) !important;
616
+ -ms-hyphens:var(--USER__bodyHyphens) !important;
617
+ -epub-hyphens:var(--USER__bodyHyphens) !important;
618
+ hyphens:var(--USER__bodyHyphens) !important;
619
+ }
620
+
621
+ :root[style*="--USER__bodyHyphens"] body,
622
+ :root[style*="--USER__bodyHyphens"] p,
623
+ :root[style*="--USER__bodyHyphens"] li,
624
+ :root[style*="--USER__bodyHyphens"] div,
625
+ :root[style*="--USER__bodyHyphens"] dd{
626
+ -webkit-hyphens:inherit;
627
+ -moz-hyphens:inherit;
628
+ -ms-hyphens:inherit;
629
+ -epub-hyphens:inherit;
630
+ hyphens:inherit;
631
+ }
632
+
633
+ :root[style*="--USER__fontFamily"]{
634
+ font-family:var(--USER__fontFamily) !important;
635
+ }
636
+
637
+ :root[style*="--USER__fontFamily"] *{
638
+ font-family:revert !important;
639
+ }
640
+
641
+ :root[style*="AccessibleDfA"]{
642
+ font-family:AccessibleDfA, Verdana, Tahoma, "Trebuchet MS", sans-serif !important;
643
+ }
644
+
645
+ :root[style*="IA Writer Duospace"]{
646
+ font-family:"IA Writer Duospace", Menlo, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", Courier, monospace !important;
647
+ }
648
+
649
+ :root[style*="AccessibleDfA"],:root[style*="IA Writer Duospace"],
650
+ :root[style*="readium-a11y-on"]{
651
+ font-style:normal !important;
652
+ font-weight:normal !important;
653
+ }
654
+
655
+ :root[style*="AccessibleDfA"] body *:not(code):not(var):not(kbd):not(samp),:root[style*="IA Writer Duospace"] body *:not(code):not(var):not(kbd):not(samp),
656
+ :root[style*="readium-a11y-on"] body *:not(code):not(var):not(kbd):not(samp){
657
+ font-family:inherit !important;
658
+ font-style:inherit !important;
659
+ font-weight:inherit !important;
660
+ }
661
+
662
+ :root[style*="AccessibleDfA"] body *:not(a),:root[style*="IA Writer Duospace"] body *:not(a),
663
+ :root[style*="readium-a11y-on"] body *:not(a){
664
+ text-decoration:none !important;
665
+ }
666
+
667
+ :root[style*="AccessibleDfA"] body *,:root[style*="IA Writer Duospace"] body *,
668
+ :root[style*="readium-a11y-on"] body *{
669
+ font-variant-caps:normal !important;
670
+ font-variant-numeric:normal !important;
671
+ font-variant-position:normal !important;
672
+ }
673
+
674
+ :root[style*="AccessibleDfA"] sup,:root[style*="IA Writer Duospace"] sup,
675
+ :root[style*="readium-a11y-on"] sup,
676
+ :root[style*="AccessibleDfA"] sub,
677
+ :root[style*="IA Writer Duospace"] sub,
678
+ :root[style*="readium-a11y-on"] sub{
679
+ font-size:1rem !important;
680
+ vertical-align:baseline !important;
681
+ }
682
+
683
+ :root:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] body{
684
+ zoom:var(--USER__fontSize) !important;
685
+ }
686
+
687
+ :root:not([style*="readium-deprecatedFontSize-on"])[style*="readium-iOSPatch-on"][style*="--USER__fontSize"] body{
688
+ -webkit-text-size-adjust:var(--USER__fontSize) !important;
689
+ }
690
+
691
+ @supports selector(figure:has(> img)){
692
+
693
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] figure:has(> img),
694
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] figure:has(> video),
695
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] figure:has(> svg),
696
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] figure:has(> canvas),
697
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] figure:has(> iframe),
698
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] figure:has(> audio),
699
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] div:has(> img:only-child),
700
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] div:has(> video:only-child),
701
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] div:has(> svg:only-child),
702
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] div:has(> canvas:only-child),
703
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] div:has(> iframe:only-child),
704
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] div:has(> audio:only-child),
705
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] table{
706
+ zoom:calc(100% / var(--USER__fontSize)) !important;
707
+ }
708
+
709
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] figcaption,
710
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] caption,
711
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] td,
712
+ :root[style*="readium-experimentalZoom-on"]:not([style*="readium-deprecatedFontSize-on"]):not([style*="readium-iOSPatch-on"])[style*="--USER__fontSize"] th{
713
+ zoom:var(--USER__fontSize) !important;
714
+ }
715
+ }
716
+
717
+ @supports not (zoom: 1){
718
+
719
+ :root[style*="--USER__fontSize"]{
720
+ font-size:var(--USER__fontSize) !important;
721
+ }
722
+ }
723
+
724
+ :root[style*="readium-deprecatedFontSize-on"][style*="--USER__fontSize"]{
725
+ font-size:var(--USER__fontSize) !important;
726
+ }
727
+
728
+ :root[style*="--USER__lineHeight"]{
729
+ line-height:var(--USER__lineHeight) !important;
730
+ }
731
+
732
+ :root[style*="--USER__lineHeight"] body,
733
+ :root[style*="--USER__lineHeight"] p,
734
+ :root[style*="--USER__lineHeight"] li,
735
+ :root[style*="--USER__lineHeight"] div{
736
+ line-height:inherit;
737
+ }
738
+
739
+ :root[style*="--USER__paraSpacing"] p{
740
+ margin-top:var(--USER__paraSpacing) !important;
741
+ margin-bottom:var(--USER__paraSpacing) !important;
742
+ }
743
+
744
+ :root[style*="--USER__paraIndent"] p:not(
745
+ blockquote p,
746
+ figcaption p,
747
+ header p,
748
+ hgroup p,
749
+ :root[style*="readium-experimentalHeaderFiltering-on"] p[class*="title"],
750
+ :root[style*="readium-experimentalHeaderFiltering-on"] div:has(+ *) > h1 + p,
751
+ :root[style*="readium-experimentalHeaderFiltering-on"] div:has(+ *) > p:has(+ h1)
752
+ ){
753
+ text-indent:var(--USER__paraIndent) !important;
754
+ }
755
+
756
+ :root[style*="--USER__paraIndent"] p *,
757
+ :root[style*="--USER__paraIndent"] p:first-letter{
758
+ text-indent:0 !important;
759
+ }
760
+
761
+ :root[style*="--USER__wordSpacing"] h1,
762
+ :root[style*="--USER__wordSpacing"] h2,
763
+ :root[style*="--USER__wordSpacing"] h3,
764
+ :root[style*="--USER__wordSpacing"] h4,
765
+ :root[style*="--USER__wordSpacing"] h5,
766
+ :root[style*="--USER__wordSpacing"] h6,
767
+ :root[style*="--USER__wordSpacing"] p,
768
+ :root[style*="--USER__wordSpacing"] li,
769
+ :root[style*="--USER__wordSpacing"] div,
770
+ :root[style*="--USER__wordSpacing"] dt,
771
+ :root[style*="--USER__wordSpacing"] dd{
772
+ word-spacing:var(--USER__wordSpacing);
773
+ }
774
+
775
+ :root[style*="--USER__letterSpacing"] h1,
776
+ :root[style*="--USER__letterSpacing"] h2,
777
+ :root[style*="--USER__letterSpacing"] h3,
778
+ :root[style*="--USER__letterSpacing"] h4,
779
+ :root[style*="--USER__letterSpacing"] h5,
780
+ :root[style*="--USER__letterSpacing"] h6,
781
+ :root[style*="--USER__letterSpacing"] p,
782
+ :root[style*="--USER__letterSpacing"] li,
783
+ :root[style*="--USER__letterSpacing"] div,
784
+ :root[style*="--USER__letterSpacing"] dt,
785
+ :root[style*="--USER__letterSpacing"] dd{
786
+ letter-spacing:var(--USER__letterSpacing);
787
+ font-variant:none;
788
+ }
789
+
790
+ :root[style*="--USER__ligatures"]{
791
+ font-variant-ligatures:var(--USER__ligatures) !important;
792
+ }
793
+
794
+ :root[style*="--USER__ligatures"] *{
795
+ font-variant-ligatures:inherit !important;
796
+ }
797
+
798
+ :root[style*="--USER__fontWeight"] body{
799
+ font-weight:var(--USER__fontWeight) !important;
800
+ }
801
+
802
+ :root[style*="--USER__fontWeight"] b,
803
+ :root[style*="--USER__fontWeight"] strong{
804
+ font-weight:bolder;
805
+ }
806
+
807
+ :root[style*="--USER__fontWidth"] body{
808
+ font-stretch:var(--USER__fontWidth) !important;
809
+ }
810
+
811
+ :root[style*="--USER__fontOpticalSizing"] body{
812
+ font-optical-sizing:var(--USER__fontOpticalSizing) !important;
813
+ }
814
+
815
+ :root[style*="readium-blend-on"] svg,
816
+ :root[style*="readium-blend-on"] img{
817
+ background-color:transparent !important;
818
+ mix-blend-mode:multiply !important;
819
+ }
820
+
821
+ :root[style*="--USER__darkenImages"] img{
822
+ -webkit-filter:brightness(var(--USER__darkenImages)) !important;
823
+ filter:brightness(var(--USER__darkenImages)) !important;
824
+ }
825
+
826
+ :root[style*="readium-darken-on"] img{
827
+ -webkit-filter:brightness(80%) !important;
828
+ filter:brightness(80%) !important;
829
+ }
830
+
831
+ :root[style*="--USER__invertImages"] img{
832
+ -webkit-filter:invert(var(--USER__invertImages)) !important;
833
+ filter:invert(var(--USER__invertImages)) !important;
834
+ }
835
+
836
+ :root[style*="readium-invert-on"] img{
837
+ -webkit-filter:invert(100%) !important;
838
+ filter:invert(100%) !important;
839
+ }
840
+
841
+ :root[style*="--USER__darkenImages"][style*="--USER__invertImages"] img{
842
+ -webkit-filter:brightness(var(--USER__darkenImages)) invert(var(--USER__invertImages)) !important;
843
+ filter:brightness(var(--USER__darkenImages)) invert(var(--USER__invertImages)) !important;
844
+ }
845
+
846
+ :root[style*="readium-darken-on"][style*="--USER__invertImages"] img{
847
+ -webkit-filter:brightness(80%) invert(var(--USER__invertImages)) !important;
848
+ filter:brightness(80%) invert(var(--USER__invertImages)) !important;
849
+ }
850
+
851
+ :root[style*="--USER__darkenImages"][style*="readium-invert-on"] img{
852
+ -webkit-filter:brightness(var(--USER__darkenImages)) invert(100%) !important;
853
+ filter:brightness(var(--USER__darkenImages)) invert(100%) !important;
854
+ }
855
+
856
+ :root[style*="readium-darken-on"][style*="readium-invert-on"] img{
857
+ -webkit-filter:brightness(80%) invert(100%) !important;
858
+ filter:brightness(80%) invert(100%) !important;
859
+ }
860
+
861
+ :root[style*="--USER__invertGaiji"] img[class*="gaiji"]{
862
+ -webkit-filter:invert(var(--USER__invertGaiji)) !important;
863
+ filter:invert(var(--USER__invertGaiji)) !important;
864
+ }
865
+
866
+ :root[style*="readium-invertGaiji-on"] img[class*="gaiji"]{
867
+ -webkit-filter:invert(100%) !important;
868
+ filter:invert(100%) !important;
869
+ }
870
+
871
+ :root[style*="readium-normalize-on"]{
872
+ --USER__typeScale:1.2;
873
+ }
874
+
875
+ :root[style*="readium-normalize-on"] p,
876
+ :root[style*="readium-normalize-on"] li,
877
+ :root[style*="readium-normalize-on"] div,
878
+ :root[style*="readium-normalize-on"] pre,
879
+ :root[style*="readium-normalize-on"] dd{
880
+ font-size:1rem !important;
881
+ }
882
+
883
+ :root[style*="readium-normalize-on"] h1{
884
+ font-size:1.75rem !important;
885
+ font-size:calc(((1rem * var(--USER__typeScale)) * var(--USER__typeScale)) * var(--USER__typeScale)) !important;
886
+ }
887
+
888
+ :root[style*="readium-normalize-on"] h2{
889
+ font-size:1.5rem !important;
890
+ font-size:calc((1rem * var(--USER__typeScale)) * var(--USER__typeScale)) !important;
891
+ }
892
+
893
+ :root[style*="readium-normalize-on"] h3{
894
+ font-size:1.25rem !important;
895
+ font-size:calc(1rem * var(--USER__typeScale)) !important;
896
+ }
897
+
898
+ :root[style*="readium-normalize-on"] h4,
899
+ :root[style*="readium-normalize-on"] h5,
900
+ :root[style*="readium-normalize-on"] h6{
901
+ font-size:1rem !important;
902
+ }
903
+
904
+ :root[style*="readium-normalize-on"] small{
905
+ font-size:smaller !important;
906
+ }
907
+
908
+ :root[style*="readium-normalize-on"] sub,
909
+ :root[style*="readium-normalize-on"] sup{
910
+ font-size:67.5% !important;
911
+ }
912
+
913
+ :root[style*="readium-normalize-on"][style*="--USER__typeScale"] h1{
914
+ font-size:calc(((1rem * var(--USER__typeScale)) * var(--USER__typeScale)) * var(--USER__typeScale)) !important;
915
+ }
916
+
917
+ :root[style*="readium-normalize-on"][style*="--USER__typeScale"] h2{
918
+ font-size:calc((1rem * var(--USER__typeScale)) * var(--USER__typeScale)) !important;
919
+ }
920
+
921
+ :root[style*="readium-normalize-on"][style*="--USER__typeScale"] h3{
922
+ font-size:calc(1rem * var(--USER__typeScale)) !important;
923
+ }
924
+
925
+ :root[style*="readium-iPadOSPatch-on"] body{
926
+ -webkit-text-size-adjust:none;
927
+ }
928
+
929
+ :root[style*="readium-iPadOSPatch-on"] p,
930
+ :root[style*="readium-iPadOSPatch-on"] h1,
931
+ :root[style*="readium-iPadOSPatch-on"] h2,
932
+ :root[style*="readium-iPadOSPatch-on"] h3,
933
+ :root[style*="readium-iPadOSPatch-on"] h4,
934
+ :root[style*="readium-iPadOSPatch-on"] h5,
935
+ :root[style*="readium-iPadOSPatch-on"] h6,
936
+ :root[style*="readium-iPadOSPatch-on"] li,
937
+ :root[style*="readium-iPadOSPatch-on"] th,
938
+ :root[style*="readium-iPadOSPatch-on"] td,
939
+ :root[style*="readium-iPadOSPatch-on"] dt,
940
+ :root[style*="readium-iPadOSPatch-on"] dd,
941
+ :root[style*="readium-iPadOSPatch-on"] pre,
942
+ :root[style*="readium-iPadOSPatch-on"] address,
943
+ :root[style*="readium-iPadOSPatch-on"] details,
944
+ :root[style*="readium-iPadOSPatch-on"] summary,
945
+ :root[style*="readium-iPadOSPatch-on"] figcaption,
946
+ :root[style*="readium-iPadOSPatch-on"] div:not(:has(p, h1, h2, h3, h4, h5, h6, li, th, td, dt, dd, pre, address, aside, details, figcaption, summary)),
947
+ :root[style*="readium-iPadOSPatch-on"] aside:not(:has(p, h1, h2, h3, h4, h5, h6, li, th, td, dt, dd, pre, address, aside, details, figcaption, summary)){
948
+ -webkit-text-zoom:reset;
949
+ }
950
+
951
+ :root[style*="readium-iPadOSPatch-on"] abbr,
952
+ :root[style*="readium-iPadOSPatch-on"] b,
953
+ :root[style*="readium-iPadOSPatch-on"] bdi,
954
+ :root[style*="readium-iPadOSPatch-on"] bdo,
955
+ :root[style*="readium-iPadOSPatch-on"] cite,
956
+ :root[style*="readium-iPadOSPatch-on"] code,
957
+ :root[style*="readium-iPadOSPatch-on"] dfn,
958
+ :root[style*="readium-iPadOSPatch-on"] em,
959
+ :root[style*="readium-iPadOSPatch-on"] i,
960
+ :root[style*="readium-iPadOSPatch-on"] kbd,
961
+ :root[style*="readium-iPadOSPatch-on"] mark,
962
+ :root[style*="readium-iPadOSPatch-on"] q,
963
+ :root[style*="readium-iPadOSPatch-on"] rp,
964
+ :root[style*="readium-iPadOSPatch-on"] rt,
965
+ :root[style*="readium-iPadOSPatch-on"] ruby,
966
+ :root[style*="readium-iPadOSPatch-on"] s,
967
+ :root[style*="readium-iPadOSPatch-on"] samp,
968
+ :root[style*="readium-iPadOSPatch-on"] small,
969
+ :root[style*="readium-iPadOSPatch-on"] span,
970
+ :root[style*="readium-iPadOSPatch-on"] strong,
971
+ :root[style*="readium-iPadOSPatch-on"] sub,
972
+ :root[style*="readium-iPadOSPatch-on"] sup,
973
+ :root[style*="readium-iPadOSPatch-on"] time,
974
+ :root[style*="readium-iPadOSPatch-on"] u,
975
+ :root[style*="readium-iPadOSPatch-on"] var{
976
+ -webkit-text-zoom:normal;
977
+ }
978
+
979
+ :root[style*="readium-iPadOSPatch-on"] p:not(:has(b, cite, em, i, q, s, small, span, strong)):first-line{
980
+ -webkit-text-zoom:normal;
981
+ }`,xr=`/*!
982
+ * Readium CSS v.2.0.0-beta.24
983
+ * Copyright (c) 2017–2025. Readium Foundation. All rights reserved.
984
+ * Use of this source code is governed by a BSD-style license which is detailed in the
985
+ * LICENSE file present in the project repository where this source code is maintained.
986
+ * Core maintainer: Jiminy Panoz <jiminy.panoz@edrlab.org>
987
+ * Contributors:
988
+ * Daniel Weck
989
+ * Hadrien Gardeur
990
+ * Innovimax
991
+ * L. Le Meur
992
+ * Mickaël Menu
993
+ * k_taka
994
+ */
995
+
996
+ @namespace url("http://www.w3.org/1999/xhtml");
997
+
998
+ @namespace epub url("http://www.idpf.org/2007/ops");
999
+
1000
+ @namespace m url("http://www.w3.org/1998/Math/MathML");
1001
+
1002
+ @namespace svg url("http://www.w3.org/2000/svg");
1003
+
1004
+ @-ms-viewport{
1005
+ width:device-width;
1006
+ }
1007
+
1008
+ @viewport{
1009
+ width:device-width;
1010
+ zoom:1;
1011
+ }
1012
+
1013
+ :root{
1014
+
1015
+ --RS__monospaceTf:ui-monospace, 'Andale Mono', 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
1016
+
1017
+ --RS__humanistTf:Seravek, Calibri, 'Gill Sans Nova', Roboto, Ubuntu, 'DejaVu Sans', source-sans-pro, sans-serif;
1018
+
1019
+ --RS__sansTf:-ui-sans-serif, -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI Variable', 'Segoe UI', Inter, Roboto, 'Helvetica Neue', 'Arial Nova', 'Liberation Sans', Arial, sans-serif;
1020
+
1021
+ --RS__modernTf:Athelas, Constantia, Charter, 'Bitstream Charter', Cambria, 'Georgia Pro', Georgia, serif;
1022
+
1023
+ --RS__oldStyleTf:'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'URW Palladio L', P052, serif;
1024
+ --RS__baseFontFamily:var(--RS__oldStyleTf);
1025
+ --RS__lineHeightCompensation:1;
1026
+
1027
+ --RS__baseLineHeight:calc(1.5 * var(--RS__lineHeightCompensation));
1028
+
1029
+ --RS__selectionTextColor:inherit;
1030
+
1031
+ --RS__selectionBackgroundColor:#b4d8fe;
1032
+
1033
+ --RS__visitedColor:#551A8B;
1034
+
1035
+ --RS__linkColor:#0000EE;
1036
+
1037
+ --RS__textColor:#121212;
1038
+
1039
+ --RS__backgroundColor:#FFFFFF;
1040
+ color:var(--RS__textColor) !important;
1041
+
1042
+ background-color:var(--RS__backgroundColor) !important;
1043
+ }
1044
+
1045
+ ::-moz-selection{
1046
+ color:var(--RS__selectionTextColor);
1047
+ background-color:var(--RS__selectionBackgroundColor);
1048
+ }
1049
+
1050
+ ::selection{
1051
+ color:var(--RS__selectionTextColor);
1052
+ background-color:var(--RS__selectionBackgroundColor);
1053
+ }
1054
+
1055
+ html{
1056
+ font-family:var(--RS__baseFontFamily);
1057
+ line-height:1.6;
1058
+ line-height:var(--RS__baseLineHeight);
1059
+ text-rendering:optimizelegibility;
1060
+ }
1061
+
1062
+ h1, h2, h3{
1063
+ line-height:normal;
1064
+ }
1065
+
1066
+ :lang(ja),
1067
+ :lang(zh),
1068
+ :lang(ko){
1069
+ word-wrap:break-word;
1070
+ -webkit-line-break:strict;
1071
+ -epub-line-break:strict;
1072
+ line-break:strict;
1073
+ }
1074
+
1075
+ math{
1076
+ font-family:"Latin Modern Math", "STIX Two Math", "XITS Math", "STIX Math", "Libertinus Math", "TeX Gyre Termes Math", "TeX Gyre Bonum Math", "TeX Gyre Schola", "DejaVu Math TeX Gyre", "TeX Gyre Pagella Math", "Asana Math", "Cambria Math", "Lucida Bright Math", "Minion Math", STIXGeneral, STIXSizeOneSym, Symbol, "Times New Roman", serif;
1077
+ }
1078
+
1079
+ :lang(am){
1080
+ --RS__baseFontFamily:kefa, nyala, roboto, noto, "Noto Sans Ethiopic", serif;
1081
+ --RS__lineHeightCompensation:1.167;
1082
+ }
1083
+
1084
+ :lang(ar){
1085
+ --RS__baseFontFamily:"Geeza Pro", "Arabic Typesetting", roboto, noto, "Noto Naskh Arabic", "Times New Roman", serif;
1086
+ }
1087
+
1088
+ :lang(bn){
1089
+ --RS__baseFontFamily:"Kohinoor Bangla", "Bangla Sangam MN", vrinda, roboto, noto, "Noto Sans Bengali", sans-serif;
1090
+ --RS__lineHeightCompensation:1.067;
1091
+ }
1092
+
1093
+ :lang(bo){
1094
+ --RS__baseFontFamily:kailasa, "Microsoft Himalaya", roboto, noto, "Noto Sans Tibetan", sans-serif;
1095
+ }
1096
+
1097
+ :lang(chr){
1098
+ --RS__baseFontFamily:"Plantagenet Cherokee", roboto, noto, "Noto Sans Cherokee";
1099
+ --RS__lineHeightCompensation:1.167;
1100
+ }
1101
+
1102
+ :lang(fa){
1103
+ --RS__baseFontFamily:"Geeza Pro", "Arabic Typesetting", roboto, noto, "Noto Naskh Arabic", "Times New Roman", serif;
1104
+ }
1105
+
1106
+ :lang(gu){
1107
+ --RS__baseFontFamily:"Gujarati Sangam MN", "Nirmala UI", shruti, roboto, noto, "Noto Sans Gujarati", sans-serif;
1108
+ --RS__lineHeightCompensation:1.167;
1109
+ }
1110
+
1111
+ :lang(he){
1112
+ --RS__baseFontFamily:"New Peninim MT", "Arial Hebrew", gisha, "Times New Roman", roboto, noto, "Noto Sans Hebrew" sans-serif;
1113
+ --RS__lineHeightCompensation:1.1;
1114
+ }
1115
+
1116
+ :lang(hi){
1117
+ --RS__baseFontFamily:"Kohinoor Devanagari", "Devanagari Sangam MN", kokila, "Nirmala UI", roboto, noto, "Noto Sans Devanagari", sans-serif;
1118
+
1119
+ --RS__lineHeightCompensation:1.1;
1120
+ }
1121
+
1122
+ :lang(hy){
1123
+ --RS__baseFontFamily:mshtakan, sylfaen, roboto, noto, "Noto Serif Armenian", serif;
1124
+ }
1125
+
1126
+ :lang(iu){
1127
+ --RS__baseFontFamily:"Euphemia UCAS", euphemia, roboto, noto, "Noto Sans Canadian Aboriginal", sans-serif;
1128
+ }
1129
+
1130
+ :lang(ja){
1131
+ --RS__baseFontFamily:yugothic, "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo UI", "MS Gothic", roboto, noto, "Noto Sans CJK JP", sans-serif;
1132
+ --RS__lineHeightCompensation:1.167;
1133
+ --RS__serif-ja:"Hiragino Mincho ProN", "Hiragino Mincho Pro", "YuMincho", "BIZ UDPMincho", "Yu Mincho", "MS P明朝", "MS PMincho", serif;
1134
+ --RS__sans-serif-ja:"Hiragino Sans", "Hiragino Kaku Gothic ProN", "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ W3", "YuGothic", "Yu Gothic Medium", "BIZ UDPGothic", "Yu Gothic", "MS Pゴシック", "MS PGothic", sans-serif;
1135
+ --RS__serif-ja-v:"Hiragino Mincho ProN", "Hiragino Mincho Pro", "YuMincho", "BIZ UDMincho", "Yu Mincho", "MS明朝", "MS Mincho", serif;
1136
+ --RS__sans-serif-ja-v:"Hiragino Sans", "Hiragino Kaku Gothic ProN", "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ W3", "YuGothic", "Yu Gothic Medium", "BIZ UDGothic", "Yu Gothic", "MSゴシック", "MS Gothic", sans-serif;
1137
+ }
1138
+
1139
+ :lang(km){
1140
+ --RS__baseFontFamily:"Khmer Sangam MN", "Leelawadee UI", "Khmer UI", roboto, noto, "Noto Sans Khmer", sans-serif;
1141
+ --RS__lineHeightCompensation:1.067;
1142
+ }
1143
+
1144
+ :lang(kn){
1145
+ --RS__baseFontFamily:"Kannada Sangam MN", "Nirmala UI", tunga, roboto, noto, "Noto Sans Kannada", sans-serif;
1146
+ --RS__lineHeightCompensation:1.1;
1147
+ }
1148
+
1149
+ :lang(ko){
1150
+ --RS__baseFontFamily:"Nanum Gothic", "Apple SD Gothic Neo", "Malgun Gothic", roboto, noto, "Noto Sans CJK KR", sans-serif;
1151
+ --RS__lineHeightCompensation:1.167;
1152
+ }
1153
+
1154
+ :lang(lo){
1155
+ --RS__baseFontFamily:"Lao Sangam MN", "Leelawadee UI", "Lao UI", roboto, noto, "Noto Sans Lao", sans-serif;
1156
+ }
1157
+
1158
+ :lang(ml){
1159
+ --RS__baseFontFamily:"Malayalam Sangam MN", "Nirmala UI", kartika, roboto, noto, "Noto Sans Malayalam", sans-serif;
1160
+ --RS__lineHeightCompensation:1.067;
1161
+ }
1162
+
1163
+ :lang(or){
1164
+ --RS__baseFontFamily:"Oriya Sangam MN", "Nirmala UI", kalinga, roboto, noto, "Noto Sans Oriya", sans-serif;
1165
+ --RS__lineHeightCompensation:1.167;
1166
+ }
1167
+
1168
+ :lang(pa){
1169
+ --RS__baseFontFamily:"Gurmukhi MN", "Nirmala UI", kartika, roboto, noto, "Noto Sans Gurmukhi", sans-serif;
1170
+ --RS__lineHeightCompensation:1.1;
1171
+ }
1172
+
1173
+ :lang(si){
1174
+ --RS__baseFontFamily:"Sinhala Sangam MN", "Nirmala UI", "Iskoola Pota", roboto, noto, "Noto Sans Sinhala", sans-serif;
1175
+ --RS__lineHeightCompensation:1.167;
1176
+ }
1177
+
1178
+ :lang(ta){
1179
+ --RS__baseFontFamily:"Tamil Sangam MN", "Nirmala UI", latha, roboto, noto, "Noto Sans Tamil", sans-serif;
1180
+ --RS__lineHeightCompensation:1.067;
1181
+ }
1182
+
1183
+ :lang(te){
1184
+ --RS__baseFontFamily:"Kohinoor Telugu", "Telugu Sangam MN", "Nirmala UI", gautami, roboto, noto, "Noto Sans Telugu", sans-serif;
1185
+ }
1186
+
1187
+ :lang(th){
1188
+ --RS__baseFontFamily:"Thonburi", "Leelawadee UI", "Cordia New", roboto, noto, "Noto Sans Thai", sans-serif;
1189
+ --RS__lineHeightCompensation:1.067;
1190
+ }
1191
+
1192
+ :lang(zh){
1193
+ --RS__baseFontFamily:"方体", "PingFang SC", "黑体", "Heiti SC", "Microsoft JhengHei UI", "Microsoft JhengHei", roboto, noto, "Noto Sans CJK SC", sans-serif;
1194
+ --RS__lineHeightCompensation:1.167;
1195
+ }
1196
+
1197
+ :lang(zh-Hant),
1198
+ :lang(zh-TW){
1199
+ --RS__baseFontFamily:"方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", roboto, noto, "Noto Sans CJK TC", sans-serif;
1200
+ --RS__lineHeightCompensation:1.167;
1201
+ }
1202
+
1203
+ :lang(zh-HK){
1204
+ --RS__baseFontFamily:"方體", "PingFang HK", "方體", "PingFang TC", "黑體", "Heiti TC", "Microsoft JhengHei UI", "Microsoft JhengHei", roboto, noto, "Noto Sans CJK TC", sans-serif;
1205
+ --RS__lineHeightCompensation:1.167;
1206
+ }
1207
+
1208
+ @font-face{
1209
+ font-family:AccessibleDfA;
1210
+ font-style:normal;
1211
+ font-weight:normal;
1212
+ src:local("AccessibleDfA"), url("fonts/AccessibleDfA-Regular.woff2") format("woff2"), url("fonts/AccessibleDfA-Regular.woff") format("woff");
1213
+ }
1214
+
1215
+ @font-face{
1216
+ font-family:AccessibleDfA;
1217
+ font-style:normal;
1218
+ font-weight:bold;
1219
+ src:local("AccessibleDfA"), url("fonts/AccessibleDfA-Bold.woff2") format("woff2");
1220
+ }
1221
+
1222
+ @font-face{
1223
+ font-family:AccessibleDfA;
1224
+ font-style:italic;
1225
+ font-weight:normal;
1226
+ src:local("AccessibleDfA"), url("fonts/AccessibleDfA-Italic.woff2") format("woff2");
1227
+ }
1228
+
1229
+ @font-face{
1230
+ font-family:"IA Writer Duospace";
1231
+ font-style:normal;
1232
+ font-weight:normal;
1233
+ src:local("iAWriterDuospace-Regular"), url("fonts/iAWriterDuospace-Regular.ttf") format("truetype");
1234
+ }
1235
+
1236
+ body{
1237
+ widows:2;
1238
+ orphans:2;
1239
+ }
1240
+
1241
+ figcaption, th, td{
1242
+ widows:1;
1243
+ orphans:1;
1244
+ }
1245
+
1246
+ h2, h3, h4, h5, h6, dt,
1247
+ hr, caption{
1248
+ -webkit-column-break-after:avoid;
1249
+ page-break-after:avoid;
1250
+ break-after:avoid;
1251
+ }
1252
+
1253
+ h1, h2, h3, h4, h5, h6, dt,
1254
+ figure, tr{
1255
+ -webkit-column-break-inside:avoid;
1256
+ page-break-inside:avoid;
1257
+ break-inside:avoid;
1258
+ }
1259
+
1260
+ body{
1261
+ -webkit-hyphenate-character:"\\002D";
1262
+ -moz-hyphenate-character:"\\002D";
1263
+ -ms-hyphenate-character:"\\002D";
1264
+ hyphenate-character:"\\002D";
1265
+ -webkit-hyphenate-limit-lines:3;
1266
+ -ms-hyphenate-limit-lines:3;
1267
+ hyphenate-limit-lines:3;
1268
+ }
1269
+
1270
+ h1, h2, h3, h4, h5, h6, dt,
1271
+ figcaption, pre, caption, address,
1272
+ center, code, var{
1273
+ -ms-hyphens:none;
1274
+ -moz-hyphens:none;
1275
+ -webkit-hyphens:none;
1276
+ -epub-hyphens:none;
1277
+ hyphens:none;
1278
+ }
1279
+
1280
+ body{
1281
+ font-variant-numeric:oldstyle-nums proportional-nums;
1282
+ }
1283
+
1284
+ :lang(ja) body,
1285
+ :lang(zh) body,
1286
+ :lang(ko) body{
1287
+ font-variant-numeric:lining-nums proportional-nums;
1288
+ }
1289
+
1290
+ h1, h2, h3, h4, h5, h6, dt{
1291
+ font-variant-numeric:lining-nums proportional-nums;
1292
+ }
1293
+
1294
+ table{
1295
+ font-variant-numeric:lining-nums tabular-nums;
1296
+ }
1297
+
1298
+ code, var{
1299
+ font-variant-ligatures:none;
1300
+ font-variant-numeric:lining-nums tabular-nums slashed-zero;
1301
+ }
1302
+
1303
+ rt{
1304
+ font-variant-east-asian:ruby;
1305
+ }
1306
+
1307
+ :lang(ar){
1308
+ font-variant-ligatures:common-ligatures;
1309
+ }
1310
+
1311
+ :lang(ko){
1312
+ font-kerning:normal;
1313
+ }
1314
+
1315
+ hr{
1316
+ color:inherit;
1317
+ border-color:currentcolor;
1318
+ }
1319
+
1320
+ table, th, td{
1321
+ border-color:currentcolor;
1322
+ }
1323
+
1324
+ figure, blockquote{
1325
+ margin:1em 5%;
1326
+ }
1327
+
1328
+ ul, ol{
1329
+ padding-left:5%;
1330
+ }
1331
+
1332
+ dd{
1333
+ margin-left:5%;
1334
+ }
1335
+
1336
+ pre{
1337
+ white-space:pre-wrap;
1338
+ -ms-tab-size:2;
1339
+ -moz-tab-size:2;
1340
+ -webkit-tab-size:2;
1341
+ tab-size:2;
1342
+ }
1343
+
1344
+ abbr[title], acronym[title]{
1345
+ text-decoration:dotted underline;
1346
+ }
1347
+
1348
+ nobr wbr{
1349
+ white-space:normal;
1350
+ }
1351
+
1352
+ ruby > rt, ruby > rp{
1353
+ -webkit-user-select:none;
1354
+ -moz-user-select:none;
1355
+ -ms-user-select:none;
1356
+ user-select:none;
1357
+ }
1358
+
1359
+ *:lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)),
1360
+ *:lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)),
1361
+ *:lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)),
1362
+ :lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) cite,
1363
+ :lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) dfn,
1364
+ :lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) em,
1365
+ :lang(ja):not(:lang(ja-Latn)):not(:lang(ja-Cyrl)) i,
1366
+ :lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) cite,
1367
+ :lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) dfn,
1368
+ :lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) em,
1369
+ :lang(zh):not(:lang(zh-Latn)):not(:lang(zh-Cyrl)) i,
1370
+ :lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) cite,
1371
+ :lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) dfn,
1372
+ :lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) em,
1373
+ :lang(ko):not(:lang(ko-Latn)):not(:lang(ko-Cyrl)) i{
1374
+ font-style:normal;
1375
+ }
1376
+
1377
+ :lang(ja) a,
1378
+ :lang(zh) a,
1379
+ :lang(ko) a{
1380
+ text-decoration:none;
1381
+ }
1382
+
1383
+ :root{
1384
+ --RS__maxMediaWidth:100%;
1385
+ --RS__maxMediaHeight:95vh;
1386
+ --RS__boxSizingMedia:border-box;
1387
+ --RS__boxSizingTable:border-box;
1388
+ }
1389
+
1390
+ a, a span, span a, h1, h2, h3, h4, h5, h6{
1391
+ word-wrap:break-word;
1392
+ }
1393
+
1394
+ div{
1395
+ max-width:var(--RS__maxMediaWidth);
1396
+ }
1397
+
1398
+ img, svg|svg, video{
1399
+ object-fit:contain;
1400
+
1401
+ width:auto;
1402
+ height:auto;
1403
+ max-width:var(--RS__maxMediaWidth);
1404
+ max-height:var(--RS__maxMediaHeight) !important;
1405
+ box-sizing:var(--RS__boxSizingMedia);
1406
+ -webkit-column-break-inside:avoid;
1407
+ page-break-inside:avoid;
1408
+ break-inside:avoid;
1409
+ }
1410
+
1411
+ audio{
1412
+ max-width:100%;
1413
+ -webkit-column-break-inside:avoid;
1414
+ page-break-inside:avoid;
1415
+ break-inside:avoid;
1416
+ }
1417
+
1418
+ table{
1419
+ max-width:var(--RS__maxMediaWidth);
1420
+ box-sizing:var(--RS__boxSizingTable);
1421
+ }`,Er=`/*!
1422
+ * Readium CSS v.2.0.0-beta.24
1423
+ * Copyright (c) 2017–2025. Readium Foundation. All rights reserved.
1424
+ * Use of this source code is governed by a BSD-style license which is detailed in the
1425
+ * LICENSE file present in the project repository where this source code is maintained.
1426
+ * Core maintainer: Jiminy Panoz <jiminy.panoz@edrlab.org>
1427
+ * Contributors:
1428
+ * Daniel Weck
1429
+ * Hadrien Gardeur
1430
+ * Innovimax
1431
+ * L. Le Meur
1432
+ * Mickaël Menu
1433
+ * k_taka
1434
+ */
1435
+
1436
+ @namespace url("http://www.w3.org/1999/xhtml");
1437
+
1438
+ @namespace epub url("http://www.idpf.org/2007/ops");
1439
+
1440
+ @namespace m url("http://www.w3.org/1998/Math/MathML");
1441
+
1442
+ @namespace svg url("http://www.w3.org/2000/svg");
1443
+
1444
+ :root{
1445
+ --RS__compFontFamily:var(--RS__baseFontFamily);
1446
+ --RS__codeFontFamily:var(--RS__monospaceTf);
1447
+
1448
+ --RS__typeScale:1.125;
1449
+ --RS__baseFontSize:100%;
1450
+
1451
+ --RS__flowSpacing:1.5rem;
1452
+ --RS__paraSpacing:0;
1453
+ --RS__paraIndent:1em;
1454
+
1455
+ --RS__linkColor:#0000EE;
1456
+ --RS__visitedColor:#551A8B;
1457
+
1458
+ --RS__primaryColor:;
1459
+ --RS__secondaryColor:;
1460
+ }
1461
+
1462
+ body{
1463
+ font-size:var(--RS__baseFontSize);
1464
+ }
1465
+
1466
+ h1, h2, h3, h4, h5, h6{
1467
+ font-family:var(--RS__compFontFamily);
1468
+ }
1469
+
1470
+ blockquote, figure, p, pre,
1471
+ aside, footer, form, hr{
1472
+ margin-top:var(--RS__flowSpacing);
1473
+ margin-bottom:var(--RS__flowSpacing);
1474
+ }
1475
+
1476
+ p{
1477
+ margin-top:var(--RS__paraSpacing);
1478
+ margin-bottom:var(--RS__paraSpacing);
1479
+ text-indent:var(--RS__paraIndent);
1480
+ }
1481
+
1482
+ h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p,
1483
+ hr + p{
1484
+ text-indent:0;
1485
+ }
1486
+
1487
+ pre{
1488
+ font-family:var(--RS__codeFontFamily);
1489
+ }
1490
+
1491
+ code, kbd, samp, tt{
1492
+ font-family:var(--RS__codeFontFamily);
1493
+ }
1494
+
1495
+ sub, sup{
1496
+ position:relative;
1497
+ font-size:67.5%;
1498
+ line-height:1;
1499
+ }
1500
+
1501
+ sub{
1502
+ bottom:-0.2ex;
1503
+ }
1504
+
1505
+ sup{
1506
+ bottom:0;
1507
+ }
1508
+
1509
+ :link{
1510
+ color:var(--RS__linkColor);
1511
+ }
1512
+
1513
+ :visited{
1514
+ color:var(--RS__visitedColor);
1515
+ }
1516
+
1517
+ h1{
1518
+ margin-top:calc(var(--RS__flowSpacing) * 2);
1519
+ margin-bottom:calc(var(--RS__flowSpacing) * 2);
1520
+ font-size:calc(((1em * var(--RS__typeScale)) * var(--RS__typeScale)) * var(--RS__typeScale));
1521
+ }
1522
+
1523
+ h2{
1524
+ margin-top:calc(var(--RS__flowSpacing) * 2);
1525
+ margin-bottom:var(--RS__flowSpacing);
1526
+ font-size:calc((1em * var(--RS__typeScale)) * var(--RS__typeScale));
1527
+ }
1528
+
1529
+ h3{
1530
+ margin-top:var(--RS__flowSpacing);
1531
+ margin-bottom:var(--RS__flowSpacing);
1532
+ font-size:calc(1em * var(--RS__typeScale));
1533
+ }
1534
+
1535
+ h4{
1536
+ margin-top:var(--RS__flowSpacing);
1537
+ margin-bottom:var(--RS__flowSpacing);
1538
+ font-size:1em;
1539
+ }
1540
+
1541
+ h5{
1542
+ margin-top:var(--RS__flowSpacing);
1543
+ margin-bottom:var(--RS__flowSpacing);
1544
+ font-size:1em;
1545
+ font-variant:small-caps;
1546
+ }
1547
+
1548
+ h6{
1549
+ margin-top:var(--RS__flowSpacing);
1550
+ margin-bottom:0;
1551
+ font-size:1em;
1552
+ text-transform:lowercase;
1553
+ font-variant:small-caps;
1554
+ }
1555
+
1556
+ dl, ol, ul{
1557
+ margin-top:var(--RS__flowSpacing);
1558
+ margin-bottom:var(--RS__flowSpacing);
1559
+ }
1560
+
1561
+ table{
1562
+ margin:var(--RS__flowSpacing) 0;
1563
+ border:1px solid currentcolor;
1564
+ border-collapse:collapse;
1565
+ empty-cells:show;
1566
+ }
1567
+
1568
+ thead, tbody, tfoot, table > tr{
1569
+ vertical-align:top;
1570
+ }
1571
+
1572
+ th{
1573
+ text-align:left;
1574
+ }
1575
+
1576
+ th, td{
1577
+ padding:4px;
1578
+ border:1px solid currentcolor;
1579
+ }`,Cr=`// Note: we aren't blocking some of the events right now to try and be as nonintrusive as possible.
1580
+ // For a more comprehensive implementation, see https://github.com/hackademix/noscript/blob/3a83c0e4a506f175e38b0342dad50cdca3eae836/src/content/syncFetchPolicy.js#L142
1581
+ // The snippet of code at the beginning of this source is an attempt at defence against JS using persistent storage
1582
+ (function() {
1583
+ const noop = () => {}, emptyObj = {}, emptyPromise = () => Promise.resolve(void 0), fakeStorage = {
1584
+ getItem: noop,
1585
+ setItem: noop,
1586
+ removeItem: noop,
1587
+ clear: noop,
1588
+ key: noop,
1589
+ length: 0
1590
+ };
1591
+
1592
+ ["localStorage", "sessionStorage"].forEach((e) => Object.defineProperty(window, e, {
1593
+ get: () => fakeStorage,
1594
+ configurable: !0
1595
+ }));
1596
+
1597
+ Object.defineProperty(document, "cookie", {
1598
+ get: () => "",
1599
+ set: noop,
1600
+ configurable: !0
1601
+ });
1602
+
1603
+ Object.defineProperty(window, "indexedDB", {
1604
+ get: () => {},
1605
+ configurable: !0
1606
+ });
1607
+
1608
+ Object.defineProperty(window, "caches", {
1609
+ get: () => emptyObj,
1610
+ configurable: !0
1611
+ });
1612
+
1613
+ Object.defineProperty(navigator, "storage", {
1614
+ get: () => ({
1615
+ persist: emptyPromise,
1616
+ persisted: emptyPromise,
1617
+ estimate: () => Promise.resolve({quota: 0, usage: 0})
1618
+ }),
1619
+ configurable: !0
1620
+ });
1621
+
1622
+ Object.defineProperty(navigator, "serviceWorker", {
1623
+ get: () => ({
1624
+ register: emptyPromise,
1625
+ getRegistration: emptyPromise,
1626
+ ready: emptyPromise()
1627
+ }),
1628
+ configurable: !0
1629
+ });
1630
+
1631
+ window._readium_blockedEvents = [];
1632
+ window._readium_blockEvents = true;
1633
+ window._readium_eventBlocker = (e) => {
1634
+ if(!window._readium_blockEvents) return;
1635
+ e.preventDefault();
1636
+ e.stopImmediatePropagation();
1637
+ _readium_blockedEvents.push([
1638
+ 1, e, e.currentTarget || e.target
1639
+ ]);
1640
+ };
1641
+ window.addEventListener("DOMContentLoaded", window._readium_eventBlocker, true);
1642
+ window.addEventListener("load", window._readium_eventBlocker, true);
1643
+ })();
1644
+ `;function Lr(r){const e=r.effectiveLayout===S.fixed,t=[{id:"css-selector-generator",as:"script",target:"head",blob:new Blob([ye(cn)],{type:"text/javascript"})},{id:"execution-prevention",as:"script",target:"head",blob:new Blob([ye(Cr)],{type:"text/javascript"}),condition:n=>!!(n.querySelector("script")||n.querySelector("body[onload]:not(body[onload=''])"))}],i=[{id:"onload-proxy",as:"script",target:"head",blob:new Blob([ye(dn)],{type:"text/javascript"}),condition:n=>!!(n.querySelector("script")||n.querySelector("body[onload]:not(body[onload=''])"))}];return e||(t.unshift({id:"readium-css-before",as:"link",target:"head",blob:new Blob([Qe(xr)],{type:"text/css"}),rel:"stylesheet"}),i.unshift({id:"readium-css-default",as:"link",target:"head",blob:new Blob([Qe(Er)],{type:"text/css"}),rel:"stylesheet",condition:n=>!(n.querySelector("link[rel='stylesheet']")||n.querySelector("style")||n.querySelector("[style]:not([style=''])"))},{id:"readium-css-after",as:"link",target:"head",blob:new Blob([Qe(Pr)],{type:"text/css"}),rel:"stylesheet"})),[{resources:[/\.xhtml$/,/\.html$/],prepend:t,append:i}]}const Ar=r=>({frameLoaded:r.frameLoaded||(()=>{}),positionChanged:r.positionChanged||(()=>{}),tap:r.tap||(()=>!1),click:r.click||(()=>!1),zoom:r.zoom||(()=>{}),miscPointer:r.miscPointer||(()=>{}),scroll:r.scroll||(()=>{}),customEvent:r.customEvent||(()=>{}),handleLocator:r.handleLocator||(()=>!1),textSelected:r.textSelected||(()=>{})});class It extends st{constructor(e,t,i,n=[],o=void 0,s={preferences:{},defaults:{}}){super(),this._preferencesEditor=null,this._injector=null,this.reflowViewport={readingOrder:[],progressions:new Map,positions:null},this.pub=t,this.container=e,this.listeners=Ar(i),this.currentLocation=o,n.length&&(this.positions=n),this._preferences=new ve(s.preferences),this._defaults=new Ln(s.defaults),this._settings=new Ot(this._preferences,this._defaults),this._css=new Rn({rsProperties:new An({}),userProperties:new Mt({}),lineLengths:new ge({optimalChars:this._settings.optimalLineLength,minChars:this._settings.minimalLineLength,maxChars:this._settings.maximalLineLength,pageGutter:this._settings.pageGutter,fontFace:this._settings.fontFamily,letterSpacing:this._settings.letterSpacing,wordSpacing:this._settings.wordSpacing}),container:e,constraint:this._settings.constraint}),this._layout=It.determineLayout(t,!!this._settings.scroll),this.currentProgression=t.metadata.effectiveReadingProgression;const a=Lr(t.metadata),l=s.injectables||{rules:[],allowedDomains:[]};this._injector=new Rt({rules:[...a,...l.rules],allowedDomains:l.allowedDomains}),this.resizeObserver=new ResizeObserver(()=>this.ownerWindow.requestAnimationFrame(async()=>await this.resizeHandler())),this.resizeObserver.observe(this.container.parentElement||document.documentElement)}static determineLayout(e,t){const i=e.metadata.effectiveLayout;return i===S.fixed||e.metadata.otherMetadata&&"http://openmangaformat.org/schema/1.0#version"in e.metadata.otherMetadata||e.metadata?.conformsTo?.includes(Yt.DIVINA)?S.fixed:i===S.scrolled||i===S.reflowable&&t?S.scrolled:S.reflowable}async load(){if(this.positions?.length||(this.positions=await this.pub.positionsFromManifest()),this._layout===S.fixed)this.framePool=new Cn(this.container,this.positions,this.pub,this._injector),this.framePool.listener=(e,t)=>{this.eventListener(e,t)};else{await this.updateCSS(!1);const e=this.compileCSSProperties(this._css);this.framePool=new fn(this.container,this.positions,e,this._injector)}this.currentLocation===void 0&&(this.currentLocation=this.positions[0]),await this.resizeHandler(),await this.apply()}get settings(){if(this._layout===S.fixed)return Object.freeze({...this._settings});{const e=this._css.userProperties.colCount||this._css.rsProperties.colCount||this._settings.columnCount;return Object.freeze({...this._settings,columnCount:e})}}get preferencesEditor(){return this._preferencesEditor===null&&(this._preferencesEditor=new zt(this._preferences,this.settings,this.pub.metadata)),this._preferencesEditor}async submitPreferences(e){this._preferences=this._preferences.merging(e),await this.applyPreferences()}async applyPreferences(){const e=this._settings;this._settings=new Ot(this._preferences,this._defaults),this._preferencesEditor!==null&&(this._preferencesEditor=new zt(this._preferences,this.settings,this.pub.metadata)),this._layout===S.fixed?this.handleFXLPrefs(e,this._settings):await this.updateCSS(!0)}handleFXLPrefs(e,t){e.columnCount!==t.columnCount&&this.framePool.setPerPage(t.columnCount)}async updateCSS(e){this._css.update(this._settings),e&&await this.commitCSS(this._css)}compileCSSProperties(e){const t={};for(const[i,n]of Object.entries(e.rsProperties.toCSSProperties()))t[i]=n;for(const[i,n]of Object.entries(e.userProperties.toCSSProperties()))t[i]=n;return t}async commitCSS(e){const t=this.compileCSSProperties(e);this.framePool.setCSSProperties(t),this._css.userProperties.view==="paged"&&this._layout===S.scrolled?await this.setLayout(S.reflowable):this._css.userProperties.view==="scroll"&&this._layout===S.reflowable&&await this.setLayout(S.scrolled),this._css.setContainerWidth()}async resizeHandler(){const e=this.container.parentElement||document.documentElement;if(this._layout===S.fixed)this.container.style.width=`${it(e)-this._settings.constraint}px`,this.framePool.resizeHandler();else{const t=this._css.userProperties.colCount,i=this._css.userProperties.lineLength;this._css.resizeHandler(),(this._css.userProperties.view!=="scroll"&&t!==this._css.userProperties.colCount||i!==this._css.userProperties.lineLength)&&await this.commitCSS(this._css)}}get layout(){return this._layout}get ownerWindow(){return this.container.ownerDocument.defaultView||window}get _cframes(){return this.framePool.currentFrames}get pool(){return this.framePool}eventListener(e,t){switch(e){case"_pong":this.listeners.frameLoaded(this._cframes[0].iframe.contentWindow),this.listeners.positionChanged(this.currentLocation);break;case"first_visible_locator":const i=ae.deserialize(t);if(!i)break;this.currentLocation=new ae({href:this.currentLocation.href,type:this.currentLocation.type,title:this.currentLocation.title,locations:i?.locations,text:i?.text}),this.listeners.positionChanged(this.currentLocation);break;case"text_selected":this.listeners.textSelected(t);break;case"click":case"tap":const n=t;if(n.interactiveElement){const o=new DOMParser().parseFromString(n.interactiveElement,"text/html").body.children[0];if(o.nodeType===o.ELEMENT_NODE&&o.nodeName==="A"&&o.hasAttribute("href")){const s=o.attributes.getNamedItem("href")?.value;if(s.startsWith("#"))this.go(this.currentLocation.copyWithLocations({fragments:[s.substring(1)]}),!1,()=>{});else if(s.startsWith("http://")||s.startsWith("https://")||s.startsWith("mailto:")||s.startsWith("tel:"))this.listeners.handleLocator(new K({href:s}).locator);else try{this.goLink(new K({href:Je.join(Je.dirname(this.currentLocation.href),s)}),!1,()=>{})}catch(a){console.warn(`Couldn't go to link for ${s}: ${a}`),this.listeners.handleLocator(new K({href:s}).locator)}}else console.log("Clicked on",o)}else{if(this._layout===S.fixed&&this.framePool.doNotDisturb&&(n.doNotDisturb=!0),this._layout===S.fixed&&(this.currentProgression===O.rtl||this.currentProgression===O.ltr)&&this.framePool.currentFrames.length>1){const a=this.framePool.currentFrames;n.targetFrameSrc===a[this.currentProgression===O.rtl?0:1]?.source&&(n.x+=(a[this.currentProgression===O.rtl?1:0]?.iframe.contentWindow?.innerWidth??0)*window.devicePixelRatio)}if(e==="click"?this.listeners.click(n):this.listeners.tap(n))break;const s=(this._cframes.length===2?this._cframes[0].window.innerWidth+this._cframes[1].window.innerWidth:this._cframes[0].window.innerWidth)*window.devicePixelRatio/4;n.x>=s&&n.x<=s*3&&this.listeners.miscPointer(1),n.x<s?this.goLeft(!1,()=>{}):n.x>s*3&&this.goRight(!1,()=>{})}break;case"tap_more":this.listeners.miscPointer(t);break;case"no_more":this.changeResource(1);break;case"no_less":this.changeResource(-1);break;case"swipe":break;case"scroll":this.listeners.scroll(t);break;case"zoom":this.listeners.zoom(t);break;case"progress":this.syncLocation(t);break;case"log":console.log(this._cframes[0]?.source?.split("/")[3],...t);break;default:this.listeners.customEvent(e,t);break}}determineModules(){let e=Array.from(Ye.keys());return this._layout===S.fixed?e.filter(t=>nr.includes(t)):(e=e.filter(t=>or.includes(t)),this._layout===S.scrolled?e=e.filter(t=>t!=="column_snapper"):e=e.filter(t=>t!=="scroll_snapper"),e)}attachListener(){const e=this._cframes.filter(t=>!!t);if(e.length===0)throw Error("no cframe to attach listener to");e.forEach(t=>{t.msg&&(t.msg.listener=(i,n)=>{this.eventListener(i,n)})})}async apply(){if(await this.framePool.update(this.pub,this.currentLocator,this.determineModules()),this.attachListener(),this.pub.readingOrder.findIndexWithHref(this.currentLocation.href)<0)throw Error("Link for "+this.currentLocation.href+" not found!")}async destroy(){await this.framePool?.destroy()}async changeResource(e){if(e===0)return!1;if(this._layout===S.fixed){const n=this.framePool,o=n.viewport.positions[0];if(e===1){if(!n.next(n.perPage))return!1}else if(e===-1){if(!n.prev(n.perPage))return!1}else throw Error("Invalid relative value for FXL");const s=n.viewport.positions[0];if(o>s){for(let a=this.positions.length-1;a>=0;a--)if(this.positions[a].href===this.pub.readingOrder.items[s-1].href){this.currentLocation=this.positions[a].copyWithLocations({progression:.999999999999});break}}else if(o<s){for(let a=0;a<this.positions.length;a++)if(this.positions[a].href===this.pub.readingOrder.items[s-1].href){this.currentLocation=this.positions[a];break}}return await this.apply(),!0}const t=this.pub.readingOrder.findIndexWithHref(this.currentLocation.href),i=Math.max(0,Math.min(this.pub.readingOrder.items.length-1,t+e));if(i===t)return this._cframes[0]?.msg?.send("shake",void 0,async n=>{}),!1;if(t>i){for(let n=this.positions.length-1;n>=0;n--)if(this.positions[n].href===this.pub.readingOrder.items[i].href){this.currentLocation=this.positions[n].copyWithLocations({progression:.999999999999});break}}else for(let n=0;n<this.positions.length;n++)if(this.positions[n].href===this.pub.readingOrder.items[i].href){this.currentLocation=this.positions[n];break}return await this.apply(),!0}findLastPositionInProgressionRange(e,t){const i=e.findLastIndex(n=>{const o=n.locations.progression;return!!(o&&o>t.start&&o<=t.end)});return i!==-1?e[i]:void 0}findNearestPositions(e){const t=this.positions.filter(o=>o.href===this.currentLocation.href);let i=this.currentLocation,n;return t.some((o,s)=>{const a=o.locations.progression??0;if(e.start<=a){i=o;const l=t.splice(s+1,t.length);return n=this.findLastPositionInProgressionRange(l,e),!0}else return!1}),{first:i,last:n}}updateViewport(e){this.reflowViewport.readingOrder=[],this.reflowViewport.progressions.clear(),this.reflowViewport.positions=null,this.currentLocation&&(this.reflowViewport.readingOrder.push(this.currentLocation.href),this.reflowViewport.progressions.set(this.currentLocation.href,e),this.currentLocation.locations?.position!==void 0&&(this.reflowViewport.positions=[this.currentLocation.locations.position],this.lastLocationInView?.locations?.position!==void 0&&this.reflowViewport.positions.push(this.lastLocationInView.locations.position)))}async syncLocation(e){const t=e,i=this.findNearestPositions(t);this.currentLocation=i.first.copyWithLocations({progression:t.start}),this.lastLocationInView=i.last,this.updateViewport(t),this.listeners.positionChanged(this.currentLocation),await this.framePool.update(this.pub,this.currentLocation,this.determineModules())}goBackward(e,t){this._layout===S.fixed?(this.changeResource(-1),t(!0)):this._cframes[0]?.msg?.send("go_prev",void 0,async i=>{t(i?!0:await this.changeResource(-1))})}goForward(e,t){this._layout===S.fixed?(this.changeResource(1),t(!0)):this._cframes[0]?.msg?.send("go_next",void 0,async i=>{t(i?!0:await this.changeResource(1))})}get currentLocator(){return this.currentLocation}get viewport(){return this._layout===S.fixed?this.framePool.viewport:this.reflowViewport}get isScrollStart(){const e=this.viewport.readingOrder[0];return this.viewport.progressions.get(e)?.start===0}get isScrollEnd(){const e=this.viewport.readingOrder[this.viewport.readingOrder.length-1];return this.viewport.progressions.get(e)?.end===1}get canGoBackward(){const e=this.pub.readingOrder.items[0]?.href;return!(this.viewport.progressions.has(e)&&this.viewport.progressions.get(e)?.start===0)}get canGoForward(){const e=this.pub.readingOrder.items[this.pub.readingOrder.items.length-1]?.href;return!(this.viewport.progressions.has(e)&&this.viewport.progressions.get(e)?.end===1)}get readingProgression(){return this.currentProgression}async setLayout(e){this._layout!==e&&(this._layout=e,await this.framePool.update(this.pub,this.currentLocator,this.determineModules(),!0),this.attachListener())}get publication(){return this.pub}async loadLocator(e,t){let i=!1,n=typeof e.locations.getCssSelector=="function"&&e.locations.getCssSelector();if(e.text?.highlight?i=await new Promise((l,h)=>{this._cframes[0].msg.send("go_text",n?[e.text?.serialize(),n]:e.text?.serialize(),d=>l(d))}):n&&(i=await new Promise((l,h)=>{this._cframes[0].msg.send("go_text",["",n],d=>l(d))})),i){t(i);return}const o=typeof e.locations.htmlId=="function"&&e.locations.htmlId();if(o&&(i=await new Promise((l,h)=>{this._cframes[0].msg.send("go_id",o,d=>l(d))})),i){t(i);return}const s=e?.locations?.progression;s&&s>0?i=await new Promise((l,h)=>{this._cframes[0].msg.send("go_progression",s,d=>l(d))}):i=!0,t(i)}go(e,t,i){const n=e.href.split("#")[0];let o=this.pub.readingOrder.findWithHref(n);if(!o)return i(this.listeners.handleLocator(e));this.currentLocation=this.positions.find(s=>s.href===o.href),this.apply().then(()=>this.loadLocator(e,s=>i(s))).then(()=>{this.attachListener()})}goLink(e,t,i){return this.go(e.locator,t,i)}}class Rr{constructor(e){this.sourceNode=null,this.listeners={},this.isMutedValue=!1,this.isPlayingValue=!1,this.isPausedValue=!1,this.isLoadingValue=!1,this.isLoadedValue=!1,this.isEndedValue=!1,this.playback=e.playback,this.audioContext=e.audioContext,this.gainNode=this.audioContext?.createGain(),this.setVolume(this.playback.state.volume),this.mediaElement=document.createElement("audio"),this.mediaElement.crossOrigin="use-credentials",this.mediaElement.addEventListener("canplaythrough",this.onCanPlayThrough.bind(this)),this.mediaElement.addEventListener("timeupdate",this.onTimeUpdate.bind(this)),this.mediaElement.addEventListener("error",this.onError.bind(this)),this.mediaElement.addEventListener("ended",this.onEnded.bind(this)),this.mediaElement.currentTime=this.playback.state.currentTime}on(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}off(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter(i=>i!==t))}loadAudio(e){this.isLoadingValue=!0,this.mediaElement.src=e,this.mediaElement.load(),this.sourceNode||(this.sourceNode=new MediaElementAudioSourceNode(this.audioContext,{mediaElement:this.mediaElement}),this.sourceNode.connect(this.gainNode),this.gainNode.connect(this.audioContext.destination))}async ensureAudioContextRunning(){this.audioContext.state==="suspended"&&await this.audioContext.resume()}onTimeUpdate(){this.emit("timeupdate",this.mediaElement.currentTime)}onCanPlayThrough(){this.isLoadingValue=!1,this.isLoadedValue=!0,this.emit("canplaythrough",null)}onError(){console.error("Error loading media element"),this.emit("error",this.mediaElement.error)}onEnded(){this.isPlayingValue=!1,this.isPausedValue=!1,this.isEndedValue=!0,this.emit("ended",null)}emit(e,t){this.listeners[e]&&this.listeners[e].forEach(i=>i(t))}async playLocator(e,t){}async play(){if(await this.ensureAudioContextRunning(),this.isPlayingValue){this.stop(),console.error("Audio is already playing");return}try{await this.mediaElement.play(),this.isPlayingValue=!0,this.isPausedValue=!1}catch(e){console.error("error trying to play media element",e)}}pause(){this.mediaElement.pause(),this.isPlayingValue=!1,this.isPausedValue=!0}stop(){this.mediaElement.pause(),this.mediaElement.currentTime=0,this.isPlayingValue=!1,this.isPausedValue=!1}setVolume(e){if(e<0){this.gainNode.gain.value=0,this.isMutedValue=!0;return}if(e>1){this.setVolume(e/100);return}this.gainNode.gain.value=e}skip(e){if(!this.mediaElement){console.error("Audio not loaded");return}const t=this.mediaElement.currentTime+e;t<0?this.mediaElement.currentTime=0:t>this.mediaElement.duration?this.mediaElement.currentTime=this.mediaElement.duration:this.mediaElement.currentTime=t}currentTime(){return this.mediaElement.currentTime}duration(){return this.mediaElement.duration}isPlaying(){return this.isPlayingValue}isPaused(){return this.isPausedValue}isStopped(){return!1}isLoading(){return this.isLoadingValue}isLoaded(){return this.isLoadedValue}isEnded(){return this.isEndedValue}isMuted(){return this.isMutedValue}}const Tn=JSON.parse(`{"format":{"audiobook":"Livre audio","audiobookJSON":"Manifeste de livre audio","cbz":"Bande dessinée","divina":"Bande dessinée Divina","divinaJSON":"Manifeste de bande dessinée Divina","epub":"EPUB","lcpa":"Livre audio protégé par LCP","lcpdf":"PDF protégé par LCP","lcpl":"Licence LCP","pdf":"PDF","rwp":"Publication web Readium","rwpm":"Manifeste de publication web Readium","zab":"Livre audio","zip":"Archive ZIP"},"kind":{"audiobook_many":"livres audio","audiobook_one":"livre audio","audiobook_other":"livres audio","book_many":"livres","book_one":"livre","book_other":"livres","comic_many":"bandes dessinées","comic_one":"bande dessinée","comic_other":"bandes dessinées","document_many":"documents","document_one":"document","document_other":"documents"},"metadata":{"accessibility":{"display-guide":{"accessibility-summary":{"no-metadata":"Aucune information disponible","publisher-contact":"Pour plus d'information à propos de l'accessibilité de cette publication, veuillez contacter l'éditeur : ","title":"Informations d'accessibilité supplémentaires fournies par l'éditeur"},"additional-accessibility-information":{"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","title":"Informations complémentaires sur l'accessibilité","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"},"conformance":{"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"},"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"}},"details-title":"Information détaillée","no":"Aucune information disponible","title":"Règles d'accessibilité","unknown-standard":"Aucune indication concernant les normes d'accessibilité"},"hazards":{"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"},"title":"Points d'attention","unknown":"La présence de risques est inconnue"},"legal-considerations":{"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","title":"Considérations légales"},"navigation":{"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"},"title":"Points de repère","toc":{"compact":"Table des matières","descriptive":"Table des matières"}},"rich-content":{"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)"},"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","math-as-mathml":{"compact":"Mathématiques en MathML","descriptive":"Formules mathématiques en format accessible (MathML)"},"open-captions":{"compact":"Sous-titres incrustés","descriptive":"Des sous titres sont incrustés pour les vidéos"},"title":"Contenus spécifiques","transcript":"Transcriptions fournies","unknown":"Aucune information disponible"},"ways-of-reading":{"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"}},"title":"Lisibilité","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"}}}}},"altIdentifier_many":"","altIdentifier_one":"identifiant alternatif","altIdentifier_other":"identifiants alternatifs","artist_many":"","artist_one":"artiste","artist_other":"artiste","author_many":"","author_one":"auteur","author_other":"auteurs","collection_many":"","collection_one":"collection éditoriale","collection_other":"collections éditoriales","colorist_many":"","colorist_one":"coloriste","colorist_other":"coloristes","contributor_many":"","contributor_one":"contributeur","contributor_other":"contributeurs","description":"description","duration":"durée","editor_many":"","editor_one":"éditeur","editor_other":"éditeurs","identifier_many":"","identifier_one":"identifiant","identifier_other":"identifiants","illustrator_many":"","illustrator_one":"illustrateur","illustrator_other":"illustrateurs","imprint_many":"","imprint_one":"marque éditoriale","imprint_other":"marques éditoriales","inker_many":"","inker_one":"encreur","inker_other":"encreurs","language_many":"","language_one":"langue","language_other":"langues","letterer_many":"","letterer_one":"lettreur","letterer_other":"lettreurs","modified":"date de modification","narrator_many":"","narrator_one":"narrateur","narrator_other":"narrateurs","numberOfPages":"pagination papier","penciler_many":"","penciler_one":"dessinateur","penciler_other":"dessinateurs","published":"date de publication","publisher_many":"","publisher_one":"éditeur","publisher_other":"éditeurs","series_many":"","series_one":"série","series_other":"séries","subject_many":"","subject_one":"catégorie","subject_other":"catégories","subtitle":"sous-titre","title":"titre","translator_many":"","translator_one":"traducteur","translator_other":"traducteurs"}}`),Tr=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:Tn},publication:Tn},Symbol.toStringTag,{value:"Module"})),zn={metadata:{accessibility:{"display-guide":{"accessibility-summary":{"no-metadata":"لا تتوفر أي معلومات","publisher-contact":"لمزيد من المعلومات حول إمكانية الوصول إلى هذا المنتج، يُرجى التواصل مع الناشر: ",title:"ملخص إمكانية الوصول"},"additional-accessibility-information":{aria:{compact:"أدوار ARIA مدرَجة",descriptive:"يتم تعزيز المحتوى باستخدام أدوار ARIA لتحسين التنظيم وتيسير التنقّل"},"audio-descriptions":"الوصف الصوتي",braille:"برايل","color-not-sole-means-of-conveying-information":"اللون ليس الوسيلة الوحيدة لنقل المعلومات","dyslexia-readability":"سهولة القراءة لذوي عُسر القراءة","full-ruby-annotations":"شروح روبي كاملة","high-contrast-between-foreground-and-background-audio":"تباين عالٍ بين الصوت الرئيسي وصوت الخلفية","high-contrast-between-text-and-background":"تباين عالٍ بين النص والخلفية","large-print":"خط كبير","page-breaks":{compact:"فواصل الصفحات متضمَّنة",descriptive:"فواصل الصفحات متضمَّنة من المصدر المطبوع الأصلي"},"ruby-annotations":"بعض شروح الروبي","sign-language":"لغة الإشارة","tactile-graphics":{compact:"الرسوم اللمسية مدرجة",descriptive:"تم دمج الرسوم اللمسية لتيسير الوصول إلى العناصر البصرية للأشخاص المكفوفين"},"tactile-objects":"مجسمات لمسية ثلاثية الأبعاد","text-to-speech-hinting":"إرشادات تحويل النص إلى كلام (TTS)متوفرة",title:"معلومات إضافية عن إمكانية الوصول","ultra-high-contrast-between-text-and-background":"تباين عالٍ جدًا بين النص والخلفية","visible-page-numbering":"ترقيم صفحات مرئي","without-background-sounds":"من دون أصوات في خلفية"},conformance:{a:{compact:"هذا المنشور يفي بالمعايير الدنيا لإمكانية الوصول",descriptive:"يحتوي هذا المنشور على بيان مطابقة يفيد بأنه يفي بمعيار إمكانية الوصول في EPUB وبمستوى A من معيار WCAG 2"},aa:{compact:"هذا المنشور يفي بالمعايير المعتمدة لإمكانية الوصول",descriptive:"يحتوي هذا المنشور على بيان مطابقة يفيد بأنه يفي بمعيار إمكانية الوصول في EPUB وبمستوى AA من معيار WCAG 2"},aaa:{compact:"هذا المنشور يفوق المعايير المقبولة لإمكانية الوصول",descriptive:"يحتوي هذا المنشور على بيان مطابقة يفيد بأنه يفي بمعيار إمكانية الوصول في EPUB وبمستوى AAA من معيار WCAG 2"},certifier:"تم اعتماد هذا المنشور من قبل ","certifier-credentials":"بيانات اعتماد جهة التصديق ",details:{"certification-info":"تم اعتماد هذا المنشور في تاريخ ","certifier-report":"لمزيد من المعلومات، يرجى الرجوع إلى تقرير جهة التصديق",claim:"يدّعي هذا المنشور أنه يستوفي","epub-accessibility-1-0":"معيار إمكانية الوصول لـ EPUB إصدار 1.0","epub-accessibility-1-1":"معيار إمكانية الوصول لـ EPUB إصدار 1.1","level-a":"المستوى A","level-aa":"المستوى AA","level-aaa":"المستوى AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"مبادئ النفاذ إلى محتوى الويب (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"مبادئ النفاذ إلى محتوى الويب (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"مبادئ النفاذ إلى محتوى الويب (WCAG) 2.2"}},"details-title":"معلومات تفصيلية عن مدى المطابقة",no:"لا تتوفر أي معلومات",title:"المطابقة","unknown-standard":"لا يمكن التأكد من مدى مطابقة هذا المنشور للمعايير المقبولة لإمكانية الوصول"},hazards:{flashing:{compact:"محتوى وامض",descriptive:"يحتوي هذا المنشور على محتوى وامض قد يسبب نوبات حساسة للضوء"},"flashing-none":{compact:"لا توجد مخاطر وميض",descriptive:"لا يحتوي هذا المنشور على محتوى وامض قد يسبب نوبات حساسة للضوء"},"flashing-unknown":{compact:"مخاطر الوميض غير معروفة",descriptive:"لم يُمكن التأكد من وجود محتوى وامض قد يسبب نوبات حساسية للضوء"},motion:{compact:"محاكاة الحركة",descriptive:"يحتوي المنشور على محاكاة حركة قد تسبّب دوار الحركة"},"motion-none":{compact:"لا توجد مخاطر محاكاة الحركة",descriptive:"لا يحتوي المنشور على محاكاة حركة قد تسبّب دوار الحركة"},"motion-unknown":{compact:"مخاطر محاكاة الحركة غير معروفة",descriptive:"تعذّر تحديد ما إذا كانت هناك محاكاة للحركة قد تُسبب دوار الحركة"},"no-metadata":"لا تتوفر أي معلومات",none:{compact:"لا توجد مخاطر",descriptive:"لا يحتوي المنشور على أي مخاطر"},sound:{compact:"أصوات",descriptive:"يحتوي المنشور على أصوات قد تؤدي إلى مشاكل حساسية صوتية"},"sound-none":{compact:"لا توجد مخاطر صوتية",descriptive:"لا يحتوي المنشور على أصوات قد تؤدي إلى مشاكل حساسية صوتية"},"sound-unknown":{compact:"مخاطر الصوت غير معروفة",descriptive:"تعذّر تحديد ما إذا كانت هناك أصوات قد تُسبب مشكلات في الحساسية"},title:"مخاطر",unknown:"وجود المخاطر غير معروف"},"legal-considerations":{exempt:{compact:"يُعلن عن استثناء من متطلبات إمكانية الوصول من بعض السلطات القضائية",descriptive:"يُصرّح هذا المنشور بوجود استثناء من متطلبات إمكانية الوصول من بعض السلطات القضائية"},"no-metadata":"لا تتوفر أي معلومات",title:"اعتبارات قانونية"},navigation:{index:{compact:"كشاف",descriptive:"كشاف يحتوي على روابط إلى الإدخالات المشار إليها"},"no-metadata":"لا تتوفر أي معلومات","page-navigation":{compact:"الانتقال إلى صفحة",descriptive:"قائمة الصفحات للانتقال إلى صفحات من النسخة المطبوعة الأصلية"},structural:{compact:"العناوين",descriptive:"عناصر مثل العناوين والجداول وغيرها للتنقل المنظّم"},title:"التنقل",toc:{compact:"جدول المحتويات",descriptive:"جدول المحتويات لكل فصول النص عبر روابط"}},"rich-content":{"accessible-chemistry-as-latex":{compact:"الصيغ الكيميائية بصيغة LaTeX",descriptive:"الصيغ الكيميائية بشكل ميسر (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"الصيغ الكيميائية بصيغة MathML",descriptive:"الصيغ الكيميائية بشكل ميسر (MathML)"},"accessible-math-as-latex":{compact:"الرياضيات بصيغة LaTeX",descriptive:"الصيغ الرياضية بشكل ميسر (LaTeX)"},"accessible-math-described":"تتوفر أوصاف نصية للصيغ الرياضية","closed-captions":{compact:"تحتوي الفيديوهات على شروح مغلقة",descriptive:"الفيديوهات الموجودة في المنشورات تحتوي على شروح مغلقة"},"extended-descriptions":"يتم وصف الصور الغنية بالمعلومات بأوصاف مفصّلة","math-as-mathml":{compact:"الرياضيات بصيغة MathML",descriptive:"الصيغ الرياضية بشكل ميسر(MathML)"},"open-captions":{compact:"تحتوي الفيديوهات على شروح مدمجة",descriptive:"الفيديوهات الموجودة في المنشورات تحتوي على شروح مدمجة"},title:"محتوى غني",transcript:"يتوفر نص(نصوص)",unknown:"لا تتوفر أي معلومات"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{compact:"يحتوي على نص بديل",descriptive:"يحتوي على أوصاف نصية بديلة للصور"},"no-metadata":"لا تتوفر معلومات عن القراءة غير البصرية",none:{compact:"غير قابل للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية",descriptive:"المحتوى غير قابل للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية"},"not-fully":{compact:"غير قابل للقراءة بالكامل بصوتٍ عالٍ أو بطريقة برايل الديناميكية",descriptive:"لن يكون كل المحتوى قابلًا للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية"},readable:{compact:"قابل للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية",descriptive:"يمكن قراءة كل المحتوى بصوتٍ عالٍ أو بطريقة برايل الديناميكية"}},"prerecorded-audio":{complementary:{compact:"مقاطع الصوت المسجّلة مسبقًا",descriptive:"مقاطع الصوت المسجّلة مسبقًا مدمجة في المحتوى"},"no-metadata":"لا توجد معلومات عن الصوت المسجّل مسبقًا",only:{compact:"الصوت المسجّل مسبقًا فقط",descriptive:"كتاب صوتي بدون بديل نصي"},synchronized:{compact:"صوت مسجّل مسبقًا متزامن مع النص",descriptive:"كل المحتوى متوفر كصوت مسجّل مسبقًا متزامن مع النص"}},title:"طرق القراءة","visual-adjustments":{modifiable:{compact:"يمكن تعديل المظهر",descriptive:"يمكن تعديل مظهر النص وتخطيط الصفحة وفقاً لإمكانات نظام القراءة (اسم الخط وحجمه، والمسافات بين الفقرات والجمل والكلمات والأحرف، بالإضافة إلى لون الخلفية والنص)"},unknown:"لا توجد معلومات عن إمكانية تعديل المظهر",unmodifiable:{compact:"لا يمكن تعديل المظهر",descriptive:"لا يمكن تعديل مظهر النص وتخطيط الصفحات لأن تجربة القراءة قريبة من النسخة المطبوعة، ولكن تطبيقات القراءة ما زالت تتيح خيارات التكبير"}}}}},altIdentifier_one:"رمز تعريفي بديل",altIdentifier_other:"رموز تعريفية بديلة",artist_one:"فنان",artist_other:"فنانون",author_one:"مؤلف",author_other:"مؤلفون",collection_one:"سلسلة تحريرية",collection_other:"سلاسل تحريرية",colorist_one:"ملوّن الألوان",colorist_other:"ملوّنو الألوان",contributor_one:"مساهم",contributor_other:"مساهمون",description:"وصف",duration:"مدة",editor_one:"محرر",editor_other:"محررون",identifier_one:"رمز تعريفي",identifier_other:"رموز تعريفية",illustrator_one:"رسًام",illustrator_other:"رسامون",imprint_one:"العلامة التجارية للنشر",imprint_other:"العلامات التجارية للنشر",inker_one:"مُحَبِّر",inker_other:"مُحَبِّرون",language_one:"اللغة",language_other:"اللغات",letterer_one:"خطّاط",letterer_other:"خطّاطون",modified:"تاريخ التعديل",narrator_one:"قارئ صوتي",narrator_other:"قرّاء صوتيون",numberOfPages:"عدد الصفحات في النسخة المطبوعة",penciler_one:"رسّام أولي",penciler_other:"رسّامون أوّليون",published:"تاريخ النشر",publisher_one:"ناشر",publisher_other:"ناشرون",series_one:"سلسلة",series_other:"سلاسل",subject_one:"موضوع",subject_other:"مواضيع",subtitle:"عنوان فرعي",title:"العنوان",translator_one:"مترجم",translator_other:"مترجمون"}},zr=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:zn},publication:zn},Symbol.toStringTag,{value:"Module"})),On={metadata:{accessibility:{"display-guide":{"accessibility-summary":{"no-metadata":"Ingen information tilgængelig","publisher-contact":"For mere information om tilgængeligheden af denne bog, kontakt venligst udgiveren: ",title:"Tilgængeligheds-oversigt"},"additional-accessibility-information":{aria:{compact:"Indeholder ARIA roller",descriptive:"Indhold forbedres med ARIA-roller for at optimere organisering og gøre navigation lettere"},"audio-descriptions":"Lydbeskrivelser",braille:"Punktskrift (braille)","color-not-sole-means-of-conveying-information":"Information gives ikke udelukkende via farver","dyslexia-readability":"Læsbarhed for ordblinde","full-ruby-annotations":'Indeholder såkalde "ruby" notationer (til asiatiske sprog)',"high-contrast-between-foreground-and-background-audio":"Høj kontrast imellem forgrunds- og baggrunds-lyd","high-contrast-between-text-and-background":"Høj kontrast imellem tekst og baggrunden","large-print":"Forstørret tekst","page-breaks":{compact:"Indeholder sideskift",descriptive:"Indeholder sideskift fra den trykte version af bogen"},"ruby-annotations":'Nogle "ruby" annotationer (til asiatiske sprog)',"sign-language":"Tegnsprog","tactile-graphics":{compact:"Indeholder taktil grafik",descriptive:"Indeholder taktil grafik for at muliggøre adgang til visuel information for blinde"},"tactile-objects":"Taktile 3D objekter","text-to-speech-hinting":"Udtaleforbedringer til syntetisk tale",title:"Yderligere information om tilgængelighed","ultra-high-contrast-between-text-and-background":"Ultra høj kontrast imellem tekst og baggrund","visible-page-numbering":"Synlige sidenumre","without-background-sounds":"Uden baggrundslyd"},conformance:{a:{compact:"Denne bog overholder minimum-tilgængelighedskravene",descriptive:"Denne bog en overensstemmelseserklæring om, at den opfylder EPUB Tilgængelighedskrav og WCAG 2 standarden på niveau A"},aa:{compact:"Denne bog lever op til de accepterede tilgængelighedskrav",descriptive:"Denne bog en overensstemmelseserklæring om, at den opfylder EPUB Tilgængelighedskrav og WCAG 2 standarden på niveau AA"},aaa:{compact:"Denne bog mere end opfylder de accepterede tilgængelighedskrav",descriptive:"Denne bog en overensstemmelseserklæring om, at den opfylder EPUB Tilgængelighedskrav og WCAG 2 standarden på niveau AAA"},certifier:"Denne bog blev certificeret af ","certifier-credentials":"Certificeringsorganets legitimationsoplysninger er ",details:{"certification-info":"Bogen blev certificeret den ","certifier-report":"Se certificeringsorganets rapport for mere information",claim:"Denne bog hævder at opfylde","epub-accessibility-1-0":"EPUB Tilgængelighed 1.0","epub-accessibility-1-1":"EPUB Tilgængelighed 1.1","level-a":"Niveau A","level-aa":"Niveau AA","level-aaa":"Niveau AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"Retningslinjer for tilgængeligt webindhold (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"Retningslinjer for tilgængeligt webindhold (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"Retningslinjer for tilgængeligt webindhold (WCAG) 2.2"}},"details-title":"Detaljeret overholdelses-information",no:"Ingen information tilgængelig",title:"Overholdelse","unknown-standard":"Overholdelse af de accepterede tilgængelighedskrav kan ikke vurderes for denne bog"},hazards:{flashing:{compact:"Blinkende indhold",descriptive:"Bogen indeholder blinkende indhold der kan forårsage epileptiske anfald"},"flashing-none":{compact:"Ingen blinkende indhold",descriptive:"Bogen indeholder ikke noget blinkende indhold, der kunne forårsage epileptiske anfald"},"flashing-unknown":{compact:"Ingen information om bogen har blinkende indhold",descriptive:"Det kunne ikke afgøres om bogen indeholder blinkende indhold der kan lede til epileptiske anfald"},motion:{compact:"Simuleret bevægelse",descriptive:"Bogen indeholder simuleret bevægelse, der kan forårsage en følelse af køresyge"},"motion-none":{compact:"Indeholder ikke simuleret bevægelse",descriptive:"Denne bog indeholder ikke noget indhold med simuleret bevægelse, der kunne lede til en følelse af køresyge"},"motion-unknown":{compact:"Ingen information om simuleret bevægelse",descriptive:"Det kunne ikke vurderes om bogen indeholder simuleret bevægelse, der kan lede til en følelse af køresyge"},"no-metadata":"Ingen information tilgængelig",none:{compact:"Ingen farer",descriptive:"Bogen indeholder ikke noget indhold der kategoriseres som farligt"},sound:{compact:"Lyde",descriptive:"Bogen indeholder lyde der kan være ubehagelige hvis man er sensitiv overfor lyde"},"sound-none":{compact:"Ingen ubehagelige lyde",descriptive:"Bogen indeholder ikke lyde der kunne opleves som ubehagelige hvis man er sensitiv overfor lyde"},"sound-unknown":{compact:"Ingen information om ubehagelige lyde",descriptive:"Det kunne ikke afgøres om bogen indeholder ubehagelige lyde"},title:"Farer",unknown:"Ingen information om farligt indhold"},"legal-considerations":{exempt:{compact:"Gør krav på undtagelser fra tilgængelighedskrav",descriptive:"Denne bog gør krav på en tilgængelighedsundtagelse i en eller flere jurisdiktioner"},"no-metadata":"Ingen information tilgængelig",title:"Juridiske overvejelser"},navigation:{index:{compact:"Indholdsfortegnelse",descriptive:"Indholdsfortegnelse med links til referencer"},"no-metadata":"Ingen information tilgængelig","page-navigation":{compact:"Gå til side",descriptive:"Sideliste for at gå til sider fra den trykte kildeversion"},structural:{compact:"Overskrifter",descriptive:"Elementer så som overskrifter og tabeller til struktureret navigation"},title:"Navigation",toc:{compact:"Indholdsfortegnelse",descriptive:"Indholdsfortegnelse med links til alle kapitler"}},"rich-content":{"accessible-chemistry-as-latex":{compact:"Kemiske formularer i LaTeX",descriptive:"Kemiske formularer i tilgængeligt format (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"Kemiske formularer i MathML notation",descriptive:"Kemiske formularer i tilgængeligt format (MathML)"},"accessible-math-as-latex":{compact:"Matematik som LaTeX",descriptive:"Matematikformler i tilgængeligt format (LaTeX)"},"accessible-math-described":"Tekstbeskrivelser til matematiske formler","closed-captions":{compact:"Videoer har undertekster",descriptive:"Videoer der optræder i bogen har undertekster"},"extended-descriptions":"Informationsrige billeder beskrives med udvidede beskrivelser","math-as-mathml":{compact:"Matematik som MathML",descriptive:"Matematiske formler i tilgængeligt format (MathML)"},"open-captions":{compact:"Videoer har indlejrede undertekster",descriptive:"Videoer der optræder i bogen har indlejrede undertekster"},title:"Komplekst indhold",transcript:"Indeholder transskription(er)",unknown:"Ingen information tilgængelig"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{compact:"Har alternativ tekst",descriptive:"Har billedbeskrivelser"},"no-metadata":"Ingen information omkring ikke-visuel læsning",none:{compact:"Ikke læsbar med oplæsning eller dynamisk punktskrift",descriptive:"Dette indhold er ikke læsbart med oplæsning eller dynamisk punktskrift"},"not-fully":{compact:"Ikke fuldt læsbar med oplæsning eller dynamisk punktskrift",descriptive:"Alt indholdet er ikke fuldt læsbart med oplæsning eller dynamisk punktskrift"},readable:{compact:"Læsbar med oplæsning eller dynamisk punktskrift",descriptive:"Alt indholdet er læsbart med oplæsning eller dynamisk punktskrift"}},"prerecorded-audio":{complementary:{compact:"Indlæste lydklip",descriptive:"Indlæste lydklip er indlejret i indholdet"},"no-metadata":"Ingen information om indlæst lyd",only:{compact:"Kun indlæst lyd",descriptive:"Lydbog uden tekst alternativer"},synchronized:{compact:"Indlæst lyd med synkroniseret tekst",descriptive:"Alt indholdet er tilgængeligt med indlæst lyd og synkroniseret tekst"}},title:"Læseformer","visual-adjustments":{modifiable:{compact:"Udseende kan ændres",descriptive:"Udseende af tekst og sidelayout kan ændres, så vidt muligt i læsesystemet (skrifttype, skriftstørrelse, afstand mellem afsnit, sætninger, ord og bogstaver, samt farven på tekst og baggrund)"},unknown:"Ingen information om mulighed for ændring af udseende",unmodifiable:{compact:"Udseende kan ikke ændres",descriptive:"Tekst og sidelayout kan ikke ændres, da læseoplevelsen afspejler den trykte version af materialet. Læsesystemet kan dog stadig give mulighed for zoom"}}}}},altIdentifier_one:"alternativt ID",altIdentifier_other:"alternative ID'er",artist_one:"kunstner",artist_other:"kunstnere",author_one:"forfatter",author_other:"forfattere",collection_one:"redaktionel samling",collection_other:"redaktionelle samlinger",colorist_one:"farvelægger",colorist_other:"farvelæggere",contributor_one:"bidragsyder",contributor_other:"bidragsydere",description:"beskrivelse",duration:"varighed",editor_one:"redaktør",editor_other:"redaktører",identifier_one:"ID",identifier_other:"ID'er",illustrator_one:"illustrator",illustrator_other:"illustratorer",imprint_one:"trykkeri",imprint_other:"trykkerier",inker_one:"tegner",inker_other:"tegnere",language_one:"sprog",language_other:"sprog",letterer_one:"taleboble-forfatter",letterer_other:"taleboble-forfattere",modified:"rettet dato",narrator_one:"indlæser",narrator_other:"indlæsere",numberOfPages:"printbare sider",penciler_one:"tegneseriekunstner",penciler_other:"tegneseriekunstnere",published:"udgivelsesdato",publisher_one:"udgiver",publisher_other:"udgivere",series_one:"serie",series_other:"serier",subject_one:"emne",subject_other:"emner",subtitle:"undertitel",title:"titel",translator_one:"oversætter",translator_other:"oversættere"}},Or=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:On},publication:On},Symbol.toStringTag,{value:"Module"})),Mn=JSON.parse(`{"format":{"audiobook":"Audiolibro","audiobookJSON":"Audiobook Manifest","cbz":"Comic book archive","divina":"Divina Publication","divinaJSON":"Divina Publication Manifest","epub":"EPUB","lcpa":"Audiolibro protetto con LCP","lcpdf":"PDF protetto con LCP","lcpl":"Licenza LCP","pdf":"PDF","rwp":"Readium Web Publication","rwpm":"Readium Web Publication Manifest","zab":"Audiobook Archive","zip":"ZIP Archive"},"kind":{"audiobook_many":"audiolibri","audiobook_one":"audiolibro","audiobook_other":"audiolibri","book_many":"libri","book_one":"libro","book_other":"libri","comic_many":"fumetti","comic_one":"fumetto","comic_other":"fumetti","document_many":"documenti","document_one":"documento","document_other":"documenti"},"metadata":{"accessibility":{"display-guide":{"accessibility-summary":{"no-metadata":"Nessuna informazione disponibile","publisher-contact":"Per ulteriori informazioni sull'accessibilità di questa risorsa, contattare l'editore: ","title":"Informazioni aggiuntive sull'accessibilità fornite dall'editore"},"additional-accessibility-information":{"aria":{"compact":"Ruoli ARIA inclusi","descriptive":"Il contenuto è semanticamente arricchito con ruoli ARIA per ottimizzare l'organizzazione e facilitare la navigazione"},"audio-descriptions":"Descrizioni audio","braille":"Braille","color-not-sole-means-of-conveying-information":"Il colore non è l'unico mezzo per trasmettere informazioni","dyslexia-readability":"Leggibilità adatta alla dislessia","full-ruby-annotations":"Annotazioni complete in Ruby","high-contrast-between-foreground-and-background-audio":"Elevato contrasto tra audio principale e sottofondo","high-contrast-between-text-and-background":"Contrasto elevato tra testo in primo piano e sfondo","large-print":"Stampa a caratteri ingranditi","page-breaks":{"compact":"Interruzioni di pagina incluse","descriptive":"Interruzioni di pagina identiche alla versione originale a stampa"},"ruby-annotations":"Alcune annotazioni in Ruby","sign-language":"Lingua dei segni","tactile-graphics":{"compact":"Grafica tattile inclusa","descriptive":"La grafica tattile è stata integrata per facilitare l'accesso agli elementi visivi alle persone non vedenti"},"tactile-objects":"Oggetti 3D tattili","text-to-speech-hinting":"Pronuncia migliorata per la sintesi vocale","title":"Ulteriori informazioni sull'accessibilità","ultra-high-contrast-between-text-and-background":"Contrasto molto elevato tra testo e sfondo","visible-page-numbering":"Numerazione delle pagine visibile","without-background-sounds":"Nessun suono in sottofondo"},"conformance":{"a":{"compact":"Questa pubblicazione soddisfa gli standard minimi di accessibilità","descriptive":"La pubblicazione contiene una dichiarazione di conformità che attesta il rispetto degli standard EPUB Accessibility e WCAG 2 Livello A"},"aa":{"compact":"Questa pubblicazione soddisfa gli standard di accessibilità accettati","descriptive":"La pubblicazione contiene una dichiarazione di conformità che attesta il rispetto degli standard EPUB Accessibility e WCAG 2 Livello AAA"},"aaa":{"compact":"Questa pubblicazione supera gli standard di accessibilità","descriptive":"La pubblicazione contiene una dichiarazione di conformità che attesta il rispetto degli standard EPUB Accessibility e WCAG 2 Livello AAA"},"certifier":"La pubblicazione è stata certificata da ","certifier-credentials":"Le credenziali del certificatore sono ","details":{"certification-info":"La pubblicazione è stata certificata il ","certifier-report":"Per ulteriori informazioni, consultare il report di accessibilità del certificatore","claim":"Questa pubblicazione è conforme ai requisiti di","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Livello A","level-aa":"Livello AA","level-aaa":"Livello AAA","wcag-2-0":{"compact":"WCAG 2.0","descriptive":"Linee guida per l'accessibilità dei contenuti web (WCAG) 2.0"},"wcag-2-1":{"compact":"WCAG 2.1","descriptive":"Linee guida per l'accessibilità dei contenuti web (WCAG) 2.1"},"wcag-2-2":{"compact":"WCAG 2.2","descriptive":"Linee guida per l'accessibilità dei contenuti web (WCAG) 2.2"}},"details-title":"Informazioni dettagliate sulla conformità","no":"Nessuna informazione disponibile","title":"Conformità","unknown-standard":"Nessuna indicazione sugli standard d'accessibilità"},"hazards":{"flashing":{"compact":"Contenuto lampeggiante","descriptive":"La pubblicazione contiene contenuti lampeggianti che possono causare crisi d'epilessia fotosensibile"},"flashing-none":{"compact":"Nessun contenuto lampeggiante","descriptive":"La pubblicazione non presenta contenuti lampeggianti che possono causare crisi d'epilessia fotosensibile"},"flashing-unknown":{"compact":"Nessuna informazione sulla presenza di contenuti lampeggianti","descriptive":"Non è stato possibile determinare la presenza di contenuti lampeggianti che possono causare crisi d'epilessia fotosensibile"},"motion":{"compact":"Simulazione del movimento","descriptive":"La pubblicazione contiene simulazioni di movimento che possono provocare cinetosi"},"motion-none":{"compact":"Nessun rischio di simulazione del movimento","descriptive":"La pubblicazione non contiene simulazioni di movimento che possono causare la malattia di movimento"},"motion-unknown":{"compact":"Nessuna informazione relativa alla presenza di simulazioni di movimento","descriptive":"Non è stato possibile determinare la presenza di contenuti che possono provocare cinetosi"},"no-metadata":"Nessuna informazione disponibile","none":{"compact":"Nessuna problematica","descriptive":"La pubblicazione non presenta contenuti a rischio di simulazione di movimento, di suoni, o di contenuti lampeggianti"},"sound":{"compact":"Suoni","descriptive":"La pubblicazione contiene suoni che possono causare problemi di sensibilità"},"sound-none":{"compact":"Nessun rischio acustico","descriptive":"La pubblicazione non contiene suoni che possono causare problemi di sensibilità"},"sound-unknown":{"compact":"Nessuna informazione sulla presenza di suoni","descriptive":"Non è stato possibile determinare la presenza di suoni che potrebbero causare problemi di sensibilità"},"title":"Problematiche","unknown":"La presenza di rischi è sconosciuta"},"legal-considerations":{"exempt":{"compact":"Dichiara di godere dell'esenzione d'accessibilità in alcune giurisdizioni","descriptive":"Questa risorsa gode dell'esenzione d'accessibilità in alcune giurisdizioni"},"no-metadata":"Nessuna informazione disponibile","title":"Note legali"},"navigation":{"index":{"compact":"Indice analitico interattivo","descriptive":"Indice analitico con link alle voci di riferimento"},"no-metadata":"Nessuna informazione disponibile","page-navigation":{"compact":"Vai alla pagina","descriptive":"Sono presenti i riferimenti ai numeri di pagina della versione a stampa corrispondente"},"structural":{"compact":"Intestazioni","descriptive":"Contiene elementi come titoli, elenchi e tabelle per permettere una navigazione strutturata"},"title":"Navigazione","toc":{"compact":"Indice interattivo","descriptive":"L’indice permette l’accesso diretto a tutti i capitoli tramite link"}},"rich-content":{"accessible-chemistry-as-latex":{"compact":"Formule chimiche in LaTeX","descriptive":"Formule chimiche in formato accessibile (LaTeX)"},"accessible-chemistry-as-mathml":{"compact":"Formule chimiche in MathML","descriptive":"Formule chimiche in formato accessibile (MathML)"},"accessible-math-as-latex":{"compact":"Matematica in LaTeX","descriptive":"Formule matematiche in formato accessibile (LaTeX)"},"accessible-math-described":"Sono disponibili descrizioni testuali per le formule matematiche","closed-captions":{"compact":"Sottotitoli disponibili per i video","descriptive":"Per i video sono disponibili dei sottotitoli"},"extended-descriptions":"Le immagini complesse presentano descrizioni estese","math-as-mathml":{"compact":"Matematica in MathML","descriptive":"Formule matematiche in formato accessibile (MathML)"},"open-captions":{"compact":"I video hanno i sottotitoli","descriptive":"I video inclusi nella pubblicazione hanno i sottotitoli"},"title":"Contenuti arricchiti","transcript":"Trascrizioni fornite","unknown":"Nessuna informazione disponibile"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{"compact":"Immagini descritte","descriptive":"Le immagini sono descritte da un testo"},"no-metadata":"Nessuna informazione sulla lettura non visiva","none":{"compact":"Non leggibile con lettura ad alta voce o in braille","descriptive":"Il contenuto non è leggibile con la lettura ad alta voce o in braille"},"not-fully":{"compact":"Non è interamente leggibile con lettura ad alta voce o in braille","descriptive":"Non tutti i contenuti potranno essere letti con lettura ad alta voce o in braille"},"readable":{"compact":"Interamente leggibile con lettura ad alta voce o in braille","descriptive":"Tutti i contenuti possono essere letti con la lettura ad alta voce o con il display braille"}},"prerecorded-audio":{"complementary":{"compact":"Clip audio preregistrate","descriptive":"Le clip audio preregistrate sono integrate nel contenuto"},"no-metadata":"Non sono disponibili informazioni sull'audio preregistrato","only":{"compact":"Solo audio preregistrato","descriptive":"Audiolibro senza testi alternativi"},"synchronized":{"compact":"Audio preregistrato sincronizzato con il testo","descriptive":"Tutti i contenuti sono disponibili come audio preregistrato sincronizzato con il testo"}},"title":"Leggibilità","visual-adjustments":{"modifiable":{"compact":"La formattazione del testo e il layout della pagina possono essere modificati","descriptive":"La formattazione del testo e il layout della pagina possono essere modificati in base alle funzionalità presenti nella soluzione di lettura (ingrandimento dei caratteri del testo, modifica dei colori e dei contrasti per il testo e lo sfondo, modifica degli spazi tra lettere, parole, frasi e paragrafi)"},"unknown":"Non sono disponibili informazioni sulla possibilità di formattare il testo","unmodifiable":{"compact":"La formattazione del testo e il display della pagina non possono essere modificati","descriptive":"Il layout di testo e pagina non può essere modificato poiché l'esperienza di lettura è vicina a una versione di stampa, ma i sistemi di lettura possono ancora fornire opzioni di zoom"}}}}},"altIdentifier_many":"identificatori alternativi","altIdentifier_one":"identificatore alternativo","altIdentifier_other":"identificatori alternativi","artist_many":"","artist_one":"artista","artist_other":"artisti","author_many":"","author_one":"autore","author_other":"autori","collection_many":"","collection_one":"collana","collection_other":"collane","colorist_many":"","colorist_one":"colorista","colorist_other":"coloristi","contributor_many":"","contributor_one":"contributore","contributor_other":"contributori","description":"descrizione","duration":"durata","editor_many":"","editor_one":"editor","editor_other":"editori","identifier_many":"identificatori","identifier_one":"identificatore","identifier_other":"identificatori","illustrator_many":"","illustrator_one":"illustratore","illustrator_other":"illustratori","imprint_many":"","imprint_one":"marca editoriale","imprint_other":"marche editoriali","inker_many":"","inker_one":"inchiostratore","inker_other":"inchiostratori","language_many":"","language_one":"lingua","language_other":"lingue","letterer_many":"letteristi","letterer_one":"letterista","letterer_other":"letteristi","modified":"Data di modifica","narrator_many":"","narrator_one":"narratore","narrator_other":"narratori","numberOfPages":"impaginazione versione cartacea","penciler_many":"","penciler_one":"disegnatore","penciler_other":"disegnatori","published":"Data di pubblicazione","publisher_many":"","publisher_one":"editore","publisher_other":"editori","series_many":"","series_one":"serie","series_other":"serie","subject_many":"","subject_one":"categoria","subject_other":"categorie","subtitle":"sottotitolo","title":"titolo","translator_many":"","translator_one":"traduttore","translator_other":"traduttori"}}`),Mr=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:Mn},publication:Mn},Symbol.toStringTag,{value:"Module"})),In={metadata:{accessibility:{"display-guide":{"accessibility-summary":{"no-metadata":"Sem informação disponível","publisher-contact":"Para mais informações sobre a acessibilidade deste produto, contacte a editora: ",title:"Resumo de acessibilidade"},"additional-accessibility-information":{aria:{compact:"Inclui funções ARIA",descriptive:"O conteúdo foi otimizado com funções ARIA para melhorar a organização e facilitar a navegação"},"audio-descriptions":"Descrições em áudio",braille:"Braille","color-not-sole-means-of-conveying-information":"A cor não é o único meio de transmitir informação","dyslexia-readability":"Otimizado para dislexia","full-ruby-annotations":"Anotações Ruby completas","high-contrast-between-foreground-and-background-audio":"Alto contraste entre som principal e fundo","high-contrast-between-text-and-background":"Alto contraste entre texto e fundo","large-print":"Impressão ampliada","page-breaks":{compact:"Inclui quebras de página",descriptive:"Inclui quebras de página da fonte impressa original"},"ruby-annotations":"Algumas anotações Ruby","sign-language":"Língua gestual","tactile-graphics":{compact:"Inclui gráficos táteis",descriptive:"Inclui gráficos táteis que facilitam o acesso a elementos visuais para pessoas cegas"},"tactile-objects":"Objetos táteis 3D","text-to-speech-hinting":"Sugestões para leitura em voz alta",title:"Informação adicional de acessibilidade","ultra-high-contrast-between-text-and-background":"Contraste muito elevado entre texto e fundo","visible-page-numbering":"Numeração de páginas visível","without-background-sounds":"Sem sons de fundo"},conformance:{a:{compact:"Cumpre as normas mínimas de acessibilidade",descriptive:"A publicação contém uma declaração de conformidade que indica que cumpre o padrão EPUB Accessibility e WCAG 2 nível A"},aa:{compact:"Cumpre as normas aceites de acessibilidade",descriptive:"A publicação contém uma declaração de conformidade que indica que cumpre o padrão EPUB Accessibility e WCAG 2 nível AA"},aaa:{compact:"Excede as normas aceites de acessibilidade",descriptive:"A publicação contém uma declaração de conformidade que indica que cumpre o padrão EPUB Accessibility e WCAG 2 nível AAA"},certifier:"A publicação foi certificada por ","certifier-credentials":"As credenciais do certificador são ",details:{"certification-info":"A publicação foi certificada em ","certifier-report":"Para mais informações, consulte o relatório do certificador",claim:"Esta publicação declara conformidade com","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Nível A","level-aa":"Nível AA","level-aaa":"Nível AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"Diretrizes de Acessibilidade para Conteúdo Web (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"Diretrizes de Acessibilidade para Conteúdo Web (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"Diretrizes de Acessibilidade para Conteúdo Web (WCAG) 2.2"}},"details-title":"Detalhes de conformidade",no:"Sem informação disponível",title:"Conformidade","unknown-standard":"Não foi possível determinar a conformidade com as normas de acessibilidade aceites para esta publicação"},hazards:{flashing:{compact:"Conteúdo intermitente",descriptive:"A publicação contém conteúdo intermitente que pode causar crises fotossensíveis"},"flashing-none":{compact:"Sem perigos de intermitência",descriptive:"A publicação não contém conteúdo intermitente que possa causar crises fotossensíveis"},"flashing-unknown":{compact:"Risco de intermitência desconhecido",descriptive:"Não foi possível determinar se existe conteúdo intermitente que possa causar crises fotossensíveis"},motion:{compact:"Simulação de movimento",descriptive:"A publicação contém simulações de movimento que podem causar enjoo"},"motion-none":{compact:"Sem simulação de movimento",descriptive:"A publicação não contém simulações de movimento que possam causar enjoo"},"motion-unknown":{compact:"Risco de movimento desconhecido",descriptive:"Não foi possível determinar se existem simulações de movimento que possam causar enjoo"},"no-metadata":"Sem informação disponível",none:{compact:"Sem perigos",descriptive:"A publicação não contém perigos conhecidos"},sound:{compact:"Sons sensíveis",descriptive:"A publicação contém sons que podem causar sensibilidade auditiva"},"sound-none":{compact:"Sem perigos sonoros",descriptive:"A publicação não contém sons que possam causar sensibilidade auditiva"},"sound-unknown":{compact:"Risco sonoro desconhecido",descriptive:"Não foi possível determinar se a publicação contém sons que possam causar sensibilidade auditiva"},title:"Perigos",unknown:"Presença de perigos não determinada"},"legal-considerations":{exempt:{compact:"Declara isenção de conformidade em algumas jurisdições",descriptive:"Esta publicação declara isenção de conformidade em algumas jurisdições"},"no-metadata":"Sem informação disponível",title:"Considerações legais"},navigation:{index:{compact:"Índice remissivo",descriptive:"Índice com ligações para entradas referenciadas"},"no-metadata":"Sem informação disponível","page-navigation":{compact:"Ir para página",descriptive:"Lista de páginas que permite aceder às páginas da versão impressa original"},structural:{compact:"Títulos e estrutura",descriptive:"Elementos como títulos, tabelas, etc., para navegação estruturada"},title:"Navegação",toc:{compact:"Índice",descriptive:"Índice de conteúdos com ligações para todos os capítulos do texto"}},"rich-content":{"accessible-chemistry-as-latex":{compact:"Fórmulas químicas em LaTeX",descriptive:"Fórmulas químicas em formato acessível (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"Fórmulas químicas em MathML",descriptive:"Fórmulas químicas em formato acessível (MathML)"},"accessible-math-as-latex":{compact:"Matemática em LaTeX",descriptive:"Fórmulas matemáticas em formato acessível (LaTeX)"},"accessible-math-described":"Descrição textual das fórmulas matemáticas","closed-captions":{compact:"Vídeos com legendas ocultas",descriptive:"Os vídeos incluídos na publicação têm legendas ocultas"},"extended-descriptions":"Imagens complexas com descrições detalhadas","math-as-mathml":{compact:"Matemática em MathML",descriptive:"Fórmulas matemáticas em formato acessível (MathML)"},"open-captions":{compact:"Vídeos com legendas abertas",descriptive:"Os vídeos incluídos na publicação têm legendas abertas"},title:"Conteúdo rico",transcript:"Transcrição fornecida",unknown:"Sem informação disponível"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{compact:"Contém texto alternativo",descriptive:"Inclui descrições alternativas de texto para imagens"},"no-metadata":"Sem informação sobre leitura não visual",none:{compact:"Não legível em leitura em voz alta ou braille dinâmico",descriptive:"O conteúdo não é legível em voz alta ou através de braille dinâmico"},"not-fully":{compact:"Parcialmente legível em leitura em voz alta ou braille dinâmico",descriptive:"Nem todo o conteúdo é legível em voz alta ou através de braille dinâmico"},readable:{compact:"Totalmente legível em leitura em voz alta ou braille dinâmico",descriptive:"Todo o conteúdo pode ser lido em voz alta ou através de braille dinâmico"}},"prerecorded-audio":{complementary:{compact:"Contém clipes de áudio pré-gravados",descriptive:"O conteúdo contém clipes de áudio pré-gravados incorporados"},"no-metadata":"Sem informação sobre áudio pré-gravado",only:{compact:"Apenas áudio pré-gravado",descriptive:"A publicação é apenas áudio e não possui alternativa em texto"},synchronized:{compact:"Áudio pré-gravado sincronizado com texto",descriptive:"Todo o conteúdo está disponível como áudio pré-gravado sincronizado com texto"}},title:"Formas de leitura","visual-adjustments":{modifiable:{compact:"Aspeto personalizável",descriptive:"O aspeto do texto e o layout da página podem ser modificados de acordo com as capacidades do sistema de leitura (tipo e tamanho de letra, espaçamento entre parágrafos, frases, palavras e letras, bem como a cor de fundo e do texto)"},unknown:"Sem informação sobre personalização do aspeto",unmodifiable:{compact:"Aspeto não ajustável",descriptive:"O texto e o layout da página não podem ser modificados, uma vez que a experiência de leitura é semelhante à versão impressa, mas os sistemas de leitura ainda podem oferecer opções de ampliação"}}}}},altIdentifier_one:"identificador alternativo",altIdentifier_other:"identificadores alternativos",artist_one:"artista",artist_other:"artistas",author_one:"autor",author_other:"autores",collection_one:"coleção",collection_other:"coleções",colorist_one:"colorista",colorist_other:"coloristas",contributor_one:"colaborador",contributor_other:"colaboradores",description:"descrição",duration:"duração",editor_one:"editor",editor_other:"editores",identifier_one:"identificador",identifier_other:"identificadores",illustrator_one:"ilustrador",illustrator_other:"ilustradores",imprint_one:"selo editorial",imprint_other:"selos editoriais",inker_one:"arte-finalista",inker_other:"arte-finalistas",language_one:"idioma",language_other:"idiomas",letterer_one:"letrista",letterer_other:"letristas",modified:"data de modificação",narrator_one:"narrador",narrator_other:"narradores",numberOfPages:"número de páginas",penciler_one:"desenhador",penciler_other:"desenhadores",published:"data de publicação",publisher_one:"editora",publisher_other:"editoras",series_one:"série",series_other:"séries",subject_one:"tema",subject_other:"temas",subtitle:"subtítulo",title:"título",translator_one:"tradutor",translator_other:"tradutores"}},Ir=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:In},publication:In},Symbol.toStringTag,{value:"Module"})),Fn={metadata:{accessibility:{"display-guide":{"accessibility-summary":{"no-metadata":"Information saknas","publisher-contact":"För mer information om den här publikationens tillgänglighet, kontakta utgivaren: ",title:"Kompletterande information om tillgänglighet"},"additional-accessibility-information":{aria:{compact:"Innehåller ARIA-roller",descriptive:"Innehållet har försetts med ARIA-roller för att tydliggöra strukturen och underlätta navigering"},"audio-descriptions":"Syntolkning",braille:"Punktskrift","color-not-sole-means-of-conveying-information":"Betydelse uttrycks aldrig enbart med färg","dyslexia-readability":"Förbättrad läsbarhet för personer med dyslexi","full-ruby-annotations":"Fullständig ruby-annotering","high-contrast-between-foreground-and-background-audio":"Hög kontrast mellan förgrundsljud och bakgrundsljud","high-contrast-between-text-and-background":"Hög kontrast mellan text och bakgrund","large-print":"Storstil","page-breaks":{compact:"Innehåller sidnummer",descriptive:"Innehåller sidnummer från tryckt förlaga"},"ruby-annotations":"Viss ruby-annotering","sign-language":"Teckenspråk","tactile-graphics":{compact:"Innehåller taktila bilder",descriptive:"Taktila bilder har lagts till för att tillgängliggöra visuella element för personer med synnedsättning"},"tactile-objects":"Taktila 3D-objekt","text-to-speech-hinting":"Innehåller uttalsinstruktioner för talsyntes",title:"Ytterligare tillgänglighetsinformation","ultra-high-contrast-between-text-and-background":"Extra hög kontrast mellan text och bakgrund","visible-page-numbering":"Synlig sidnumrering","without-background-sounds":"Utan bakgrundsljud"},conformance:{a:{compact:"Publikationen uppfyller tillgänglighetskrav på en grundläggande nivå",descriptive:"Publikationen anger att den uppfyller standarderna EPUB Accessibility och WCAG 2 nivå A"},aa:{compact:"Publikationen uppfyller tillgänglighetskrav på en vedertagen nivå",descriptive:"Publikationen anger att den uppfyller standarderna EPUB Accessibility och WCAG 2 nivå AA"},aaa:{compact:"Publikationen uppfyller tillgänglighetskrav utöver en vedertagen nivå",descriptive:"Publikationen anger att den uppfyller standarderna EPUB Accessibility och WCAG 2 nivå AAA"},certifier:"Publikationen är certifierad av ","certifier-credentials":"Certifierarens märkning är ",details:{"certification-info":"Publikationen certifierades ","certifier-report":"Se certifieringsrapporten för mer information",claim:"Publikationen anger att den uppfyller kraven enligt","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"nivå A","level-aa":"nivå AA","level-aaa":"nivå AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.2"}},"details-title":"Detaljerad information om tillgänglighetskrav",no:"Information saknas",title:"Tillgänglighetskrav","unknown-standard":"Det går inte att avgöra om publikationen uppfyller vedertagna tillgänglighetskrav"},hazards:{flashing:{compact:"Blinkande innehåll",descriptive:"Publikationen har blinkande innehåll som kan vara skadligt för ljuskänsliga personer"},"flashing-none":{compact:"Inget blinkande innehåll",descriptive:"Publikationen har inget blinkande innehåll"},"flashing-unknown":{compact:"Förekomst av blinkande innehåll är okänd",descriptive:"Förekomst av blinkande innehåll är okänd"},motion:{compact:"Rörelsesimulering",descriptive:"Publikationen innehåller rörelsesimulering som skulle kunna orsaka illamående"},"motion-none":{compact:"Ingen rörelsesimulering",descriptive:"Publikationen innehåller ingen rörelsesimulering"},"motion-unknown":{compact:"Förekomst av rörelsesimulering är okänd",descriptive:"Förekomst av rörelsesimulering är okänd"},"no-metadata":"Information saknas",none:{compact:"Inga risker",descriptive:"Publikationen innehåller inga risker"},sound:{compact:"Ljud",descriptive:"Publikationen innehåller ljud som kan orsaka obehag"},"sound-none":{compact:"Inget ljud som kan orsaka obehag",descriptive:"Publikationen innehåller inget ljud som kan orsaka obehag"},"sound-unknown":{compact:"Förekomst av ljud som kan orsaka obehag är okänd",descriptive:"Förekomst av ljud som kan orsaka obehag är okänd"},title:"Risker",unknown:"Förekomst av risker är okänd"},"legal-considerations":{exempt:{compact:"Åberopar ett undantag från vissa lagstadgade tillgänglighetskrav",descriptive:"Publikationen åberopar ett undantag från vissa lagstadgade tillgänglighetskrav"},"no-metadata":"Information saknas",title:"Juridiska aspekter"},navigation:{index:{compact:"Register",descriptive:"Register med länkar till innehållet"},"no-metadata":"Information saknas","page-navigation":{compact:"Gå till sida",descriptive:"Sidindelning för navigering enligt sidnummer i tryckt förlaga"},structural:{compact:"Rubriker",descriptive:"Navigerbara element såsom rubriker eller tabeller"},title:"Navigering",toc:{compact:"Innehållsförteckning",descriptive:"Innehållsförteckning med länkar till alla kapitel"}},"rich-content":{"accessible-chemistry-as-latex":{compact:"Kemiska formler i LaTeX",descriptive:"Kemiska formler i tillgängligt format (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"Kemiska formler i MathML",descriptive:"Kemiska formler i tillgängligt format (MathML)"},"accessible-math-as-latex":{compact:"Matematik som LaTeX",descriptive:"Matematiska formler i tillgängligt format (LaTeX)"},"accessible-math-described":"Innehåller textbeskrivningar av matematik","closed-captions":{compact:"Videoklipp har undertext som kan sättas på/stängas av",descriptive:"Videoklipp som ingår i publikationen har undertext som kan sättas på och stängas av (stängda undertexter)"},"extended-descriptions":"Informationsrika bilder har utökade bildbeskrivningar","math-as-mathml":{compact:"Matematik som MathML",descriptive:"Matematiska formler i tillgängligt format (MathML)"},"open-captions":{compact:"Videoklipp har undertext som inte kan stängas av",descriptive:"Videoklipp som ingår i publikationen har undertext som inte kan stängas av (öppna undertexter)"},title:"Berikat innehåll",transcript:"Innehåller transkriptioner",unknown:"Information saknas"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{compact:"Har textalternativ (alt-texter)",descriptive:"Har textalternativ (alt-texter) till bilder"},"no-metadata":"Information om icke-visuell läsbarhet saknas",none:{compact:"Kan inte läsas med uppläsningsfunktion eller punktskriftsskärm",descriptive:"Innehållet går inte att läsa med uppläsningsfunktion eller punktskriftsskärm"},"not-fully":{compact:"Inte läsbart i sin helhet med uppläsningsfunktion eller punktskriftsskärm",descriptive:"Allt innehåll går inte att läsa med uppläsningsfunktion eller punktskriftsskärm"},readable:{compact:"Kan läsas med uppläsningsfunktion eller punktskriftsskärm",descriptive:"Hela innehållet går att läsa med uppläsningsfunktion eller punktskriftsskärm"}},"prerecorded-audio":{complementary:{compact:"Förinspelade ljudklipp",descriptive:"Innehåller förinspelade ljudklipp"},"no-metadata":"Information om förinspelat ljud saknas",only:{compact:"Endast förinspelat ljud",descriptive:"Bok med ljud utan textalternativ"},synchronized:{compact:"Förinspelat ljud synkroniserat med texten",descriptive:"Hela innehållet finns tillgängligt som förinspelat ljud synkroniserat med texten"}},title:"Olika sätt att läsa","visual-adjustments":{modifiable:{compact:"Utseendet kan justeras",descriptive:"Det går att justera text och layout i den utsträckning som läsprogrammet tillåter, till exempel typsnitt, storlek på text, avstånd mellan rader och stycken samt färg på text och bakgrund"},unknown:"Information om möjlighet att justera utseende saknas",unmodifiable:{compact:"Utseendet kan inte justeras",descriptive:"Text- och sidlayout kan inte justeras eftersom presentationen liknar en tryckt version, men läsprogram kan ha funktioner för att zooma in"}}}}},altIdentifier_one:"alternativ identifierare",altIdentifier_other:"alternativa identifierare",artist_one:"konstnär",artist_other:"konstnärer",author_one:"författare",author_other:"författare",collection_one:"samling",collection_other:"samlingar",colorist_one:"kolorist",colorist_other:"kolorister",contributor_one:"medverkande",contributor_other:"medverkande",description:"beskrivning",duration:"speltid",editor_one:"redaktör",editor_other:"redaktörer",identifier_one:"identifierare",identifier_other:"identifierare",illustrator_one:"illustratör",illustrator_other:"illustratörer",imprint_one:"imprint",imprint_other:"imprint",inker_one:"tuschare",inker_other:"tuschare",language_one:"språk",language_other:"språk",letterer_one:"textare",letterer_other:"textare",modified:"ändringsdatum",narrator_one:"berättarröst",narrator_other:"berättarröster",numberOfPages:"sidantal",penciler_one:"tecknare",penciler_other:"tecknare",published:"publikationsdatum",publisher_one:"förlag",publisher_other:"förlag",series_one:"serie",series_other:"serier",subject_one:"ämne",subject_other:"ämnen",subtitle:"undertitel",title:"titel",translator_one:"översättare",translator_other:"översättare"}},Fr=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:Fn},publication:Fn},Symbol.toStringTag,{value:"Module"})),Nn=JSON.parse(`{"format":{"audiobook":"Livre audio","audiobookJSON":"Manifeste de livre audio","cbz":"Bande dessinée","divina":"Bande dessinée Divina","divinaJSON":"Manifeste de bande dessinée Divina","epub":"EPUB","lcpa":"Livre audio protégé par LCP","lcpdf":"PDF protégé par LCP","lcpl":"Licence LCP","pdf":"PDF","rwp":"Publication web Readium","rwpm":"Manifeste de publication web Readium","zab":"Livre audio","zip":"Archive ZIP"},"kind":{"audiobook_many":"livres audio","audiobook_one":"livre audio","audiobook_other":"livres audio","book_many":"livres","book_one":"livre","book_other":"livres","comic_many":"bandes dessinées","comic_one":"bande dessinée","comic_other":"bandes dessinées","document_many":"documents","document_one":"document","document_other":"documents"},"metadata":{"accessibility":{"display-guide":{"accessibility-summary":{"no-metadata":"Aucune information disponible","publisher-contact":"Pour plus d'information à propos de l'accessibilité de cette publication, veuillez contacter l'éditeur : ","title":"Informations d'accessibilité supplémentaires fournies par l'éditeur"},"additional-accessibility-information":{"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","title":"Informations complémentaires sur l'accessibilité","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"},"conformance":{"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"},"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"}},"details-title":"Information détaillée","no":"Aucune information disponible","title":"Règles d'accessibilité","unknown-standard":"Aucune indication concernant les normes d'accessibilité"},"hazards":{"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"},"title":"Points d'attention","unknown":"La présence de risques est inconnue"},"legal-considerations":{"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","title":"Considérations légales"},"navigation":{"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"},"title":"Points de repère","toc":{"compact":"Table des matières","descriptive":"Table des matières"}},"rich-content":{"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)"},"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","math-as-mathml":{"compact":"Mathématiques en MathML","descriptive":"Formules mathématiques en format accessible (MathML)"},"open-captions":{"compact":"Sous-titres incrustés","descriptive":"Des sous titres sont incrustés pour les vidéos"},"title":"Contenus spécifiques","transcript":"Transcriptions fournies","unknown":"Aucune information disponible"},"ways-of-reading":{"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"}},"title":"Lisibilité","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"}}}}},"altIdentifier_many":"","altIdentifier_one":"identifiant alternatif","altIdentifier_other":"identifiants alternatifs","artist_many":"","artist_one":"artiste","artist_other":"artiste","author_many":"","author_one":"auteur","author_other":"auteurs","collection_many":"","collection_one":"collection éditoriale","collection_other":"collections éditoriales","colorist_many":"","colorist_one":"coloriste","colorist_other":"coloristes","contributor_many":"","contributor_one":"contributeur","contributor_other":"contributeurs","description":"description","duration":"durée","editor_many":"","editor_one":"éditeur","editor_other":"éditeurs","identifier_many":"","identifier_one":"identifiant","identifier_other":"identifiants","illustrator_many":"","illustrator_one":"illustrateur","illustrator_other":"illustrateurs","imprint_many":"","imprint_one":"marque éditoriale","imprint_other":"marques éditoriales","inker_many":"","inker_one":"encreur","inker_other":"encreurs","language_many":"","language_one":"langue","language_other":"langues","letterer_many":"","letterer_one":"lettreur","letterer_other":"lettreurs","modified":"date de modification","narrator_many":"","narrator_one":"narrateur","narrator_other":"narrateurs","numberOfPages":"pagination papier","penciler_many":"","penciler_one":"dessinateur","penciler_other":"dessinateurs","published":"date de publication","publisher_many":"","publisher_one":"éditeur","publisher_other":"éditeurs","series_many":"","series_one":"série","series_other":"séries","subject_many":"","subject_one":"catégorie","subject_other":"catégories","subtitle":"sous-titre","title":"titre","translator_many":"","translator_one":"traducteur","translator_other":"traducteurs"}}`),Nr=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:Nn},publication:Nn},Symbol.toStringTag,{value:"Module"})),Un={metadata:{accessibility:{"display-guide":{"accessibility-summary":{"no-metadata":"لا تتوفر أي معلومات","publisher-contact":"لمزيد من المعلومات حول إمكانية الوصول إلى هذا المنتج، يُرجى التواصل مع الناشر: ",title:"ملخص إمكانية الوصول"},"additional-accessibility-information":{aria:{compact:"أدوار ARIA مدرَجة",descriptive:"يتم تعزيز المحتوى باستخدام أدوار ARIA لتحسين التنظيم وتيسير التنقّل"},"audio-descriptions":"الوصف الصوتي",braille:"برايل","color-not-sole-means-of-conveying-information":"اللون ليس الوسيلة الوحيدة لنقل المعلومات","dyslexia-readability":"سهولة القراءة لذوي عُسر القراءة","full-ruby-annotations":"شروح روبي كاملة","high-contrast-between-foreground-and-background-audio":"تباين عالٍ بين الصوت الرئيسي وصوت الخلفية","high-contrast-between-text-and-background":"تباين عالٍ بين النص والخلفية","large-print":"خط كبير","page-breaks":{compact:"فواصل الصفحات متضمَّنة",descriptive:"فواصل الصفحات متضمَّنة من المصدر المطبوع الأصلي"},"ruby-annotations":"بعض شروح الروبي","sign-language":"لغة الإشارة","tactile-graphics":{compact:"الرسوم اللمسية مدرجة",descriptive:"تم دمج الرسوم اللمسية لتيسير الوصول إلى العناصر البصرية للأشخاص المكفوفين"},"tactile-objects":"مجسمات لمسية ثلاثية الأبعاد","text-to-speech-hinting":"إرشادات تحويل النص إلى كلام (TTS)متوفرة",title:"معلومات إضافية عن إمكانية الوصول","ultra-high-contrast-between-text-and-background":"تباين عالٍ جدًا بين النص والخلفية","visible-page-numbering":"ترقيم صفحات مرئي","without-background-sounds":"من دون أصوات في خلفية"},conformance:{a:{compact:"هذا المنشور يفي بالمعايير الدنيا لإمكانية الوصول",descriptive:"يحتوي هذا المنشور على بيان مطابقة يفيد بأنه يفي بمعيار إمكانية الوصول في EPUB وبمستوى A من معيار WCAG 2"},aa:{compact:"هذا المنشور يفي بالمعايير المعتمدة لإمكانية الوصول",descriptive:"يحتوي هذا المنشور على بيان مطابقة يفيد بأنه يفي بمعيار إمكانية الوصول في EPUB وبمستوى AA من معيار WCAG 2"},aaa:{compact:"هذا المنشور يفوق المعايير المقبولة لإمكانية الوصول",descriptive:"يحتوي هذا المنشور على بيان مطابقة يفيد بأنه يفي بمعيار إمكانية الوصول في EPUB وبمستوى AAA من معيار WCAG 2"},certifier:"تم اعتماد هذا المنشور من قبل ","certifier-credentials":"بيانات اعتماد جهة التصديق ",details:{"certification-info":"تم اعتماد هذا المنشور في تاريخ ","certifier-report":"لمزيد من المعلومات، يرجى الرجوع إلى تقرير جهة التصديق",claim:"يدّعي هذا المنشور أنه يستوفي","epub-accessibility-1-0":"معيار إمكانية الوصول لـ EPUB إصدار 1.0","epub-accessibility-1-1":"معيار إمكانية الوصول لـ EPUB إصدار 1.1","level-a":"المستوى A","level-aa":"المستوى AA","level-aaa":"المستوى AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"مبادئ النفاذ إلى محتوى الويب (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"مبادئ النفاذ إلى محتوى الويب (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"مبادئ النفاذ إلى محتوى الويب (WCAG) 2.2"}},"details-title":"معلومات تفصيلية عن مدى المطابقة",no:"لا تتوفر أي معلومات",title:"المطابقة","unknown-standard":"لا يمكن التأكد من مدى مطابقة هذا المنشور للمعايير المقبولة لإمكانية الوصول"},hazards:{flashing:{compact:"محتوى وامض",descriptive:"يحتوي هذا المنشور على محتوى وامض قد يسبب نوبات حساسة للضوء"},"flashing-none":{compact:"لا توجد مخاطر وميض",descriptive:"لا يحتوي هذا المنشور على محتوى وامض قد يسبب نوبات حساسة للضوء"},"flashing-unknown":{compact:"مخاطر الوميض غير معروفة",descriptive:"لم يُمكن التأكد من وجود محتوى وامض قد يسبب نوبات حساسية للضوء"},motion:{compact:"محاكاة الحركة",descriptive:"يحتوي المنشور على محاكاة حركة قد تسبّب دوار الحركة"},"motion-none":{compact:"لا توجد مخاطر محاكاة الحركة",descriptive:"لا يحتوي المنشور على محاكاة حركة قد تسبّب دوار الحركة"},"motion-unknown":{compact:"مخاطر محاكاة الحركة غير معروفة",descriptive:"تعذّر تحديد ما إذا كانت هناك محاكاة للحركة قد تُسبب دوار الحركة"},"no-metadata":"لا تتوفر أي معلومات",none:{compact:"لا توجد مخاطر",descriptive:"لا يحتوي المنشور على أي مخاطر"},sound:{compact:"أصوات",descriptive:"يحتوي المنشور على أصوات قد تؤدي إلى مشاكل حساسية صوتية"},"sound-none":{compact:"لا توجد مخاطر صوتية",descriptive:"لا يحتوي المنشور على أصوات قد تؤدي إلى مشاكل حساسية صوتية"},"sound-unknown":{compact:"مخاطر الصوت غير معروفة",descriptive:"تعذّر تحديد ما إذا كانت هناك أصوات قد تُسبب مشكلات في الحساسية"},title:"مخاطر",unknown:"وجود المخاطر غير معروف"},"legal-considerations":{exempt:{compact:"يُعلن عن استثناء من متطلبات إمكانية الوصول من بعض السلطات القضائية",descriptive:"يُصرّح هذا المنشور بوجود استثناء من متطلبات إمكانية الوصول من بعض السلطات القضائية"},"no-metadata":"لا تتوفر أي معلومات",title:"اعتبارات قانونية"},navigation:{index:{compact:"كشاف",descriptive:"كشاف يحتوي على روابط إلى الإدخالات المشار إليها"},"no-metadata":"لا تتوفر أي معلومات","page-navigation":{compact:"الانتقال إلى صفحة",descriptive:"قائمة الصفحات للانتقال إلى صفحات من النسخة المطبوعة الأصلية"},structural:{compact:"العناوين",descriptive:"عناصر مثل العناوين والجداول وغيرها للتنقل المنظّم"},title:"التنقل",toc:{compact:"جدول المحتويات",descriptive:"جدول المحتويات لكل فصول النص عبر روابط"}},"rich-content":{"accessible-chemistry-as-latex":{compact:"الصيغ الكيميائية بصيغة LaTeX",descriptive:"الصيغ الكيميائية بشكل ميسر (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"الصيغ الكيميائية بصيغة MathML",descriptive:"الصيغ الكيميائية بشكل ميسر (MathML)"},"accessible-math-as-latex":{compact:"الرياضيات بصيغة LaTeX",descriptive:"الصيغ الرياضية بشكل ميسر (LaTeX)"},"accessible-math-described":"تتوفر أوصاف نصية للصيغ الرياضية","closed-captions":{compact:"تحتوي الفيديوهات على شروح مغلقة",descriptive:"الفيديوهات الموجودة في المنشورات تحتوي على شروح مغلقة"},"extended-descriptions":"يتم وصف الصور الغنية بالمعلومات بأوصاف مفصّلة","math-as-mathml":{compact:"الرياضيات بصيغة MathML",descriptive:"الصيغ الرياضية بشكل ميسر(MathML)"},"open-captions":{compact:"تحتوي الفيديوهات على شروح مدمجة",descriptive:"الفيديوهات الموجودة في المنشورات تحتوي على شروح مدمجة"},title:"محتوى غني",transcript:"يتوفر نص(نصوص)",unknown:"لا تتوفر أي معلومات"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{compact:"يحتوي على نص بديل",descriptive:"يحتوي على أوصاف نصية بديلة للصور"},"no-metadata":"لا تتوفر معلومات عن القراءة غير البصرية",none:{compact:"غير قابل للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية",descriptive:"المحتوى غير قابل للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية"},"not-fully":{compact:"غير قابل للقراءة بالكامل بصوتٍ عالٍ أو بطريقة برايل الديناميكية",descriptive:"لن يكون كل المحتوى قابلًا للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية"},readable:{compact:"قابل للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية",descriptive:"يمكن قراءة كل المحتوى بصوتٍ عالٍ أو بطريقة برايل الديناميكية"}},"prerecorded-audio":{complementary:{compact:"مقاطع الصوت المسجّلة مسبقًا",descriptive:"مقاطع الصوت المسجّلة مسبقًا مدمجة في المحتوى"},"no-metadata":"لا توجد معلومات عن الصوت المسجّل مسبقًا",only:{compact:"الصوت المسجّل مسبقًا فقط",descriptive:"كتاب صوتي بدون بديل نصي"},synchronized:{compact:"صوت مسجّل مسبقًا متزامن مع النص",descriptive:"كل المحتوى متوفر كصوت مسجّل مسبقًا متزامن مع النص"}},title:"طرق القراءة","visual-adjustments":{modifiable:{compact:"يمكن تعديل المظهر",descriptive:"يمكن تعديل مظهر النص وتخطيط الصفحة وفقاً لإمكانات نظام القراءة (اسم الخط وحجمه، والمسافات بين الفقرات والجمل والكلمات والأحرف، بالإضافة إلى لون الخلفية والنص)"},unknown:"لا توجد معلومات عن إمكانية تعديل المظهر",unmodifiable:{compact:"لا يمكن تعديل المظهر",descriptive:"لا يمكن تعديل مظهر النص وتخطيط الصفحات لأن تجربة القراءة قريبة من النسخة المطبوعة، ولكن تطبيقات القراءة ما زالت تتيح خيارات التكبير"}}}}},altIdentifier_one:"رمز تعريفي بديل",altIdentifier_other:"رموز تعريفية بديلة",artist_one:"فنان",artist_other:"فنانون",author_one:"مؤلف",author_other:"مؤلفون",collection_one:"سلسلة تحريرية",collection_other:"سلاسل تحريرية",colorist_one:"ملوّن الألوان",colorist_other:"ملوّنو الألوان",contributor_one:"مساهم",contributor_other:"مساهمون",description:"وصف",duration:"مدة",editor_one:"محرر",editor_other:"محررون",identifier_one:"رمز تعريفي",identifier_other:"رموز تعريفية",illustrator_one:"رسًام",illustrator_other:"رسامون",imprint_one:"العلامة التجارية للنشر",imprint_other:"العلامات التجارية للنشر",inker_one:"مُحَبِّر",inker_other:"مُحَبِّرون",language_one:"اللغة",language_other:"اللغات",letterer_one:"خطّاط",letterer_other:"خطّاطون",modified:"تاريخ التعديل",narrator_one:"قارئ صوتي",narrator_other:"قرّاء صوتيون",numberOfPages:"عدد الصفحات في النسخة المطبوعة",penciler_one:"رسّام أولي",penciler_other:"رسّامون أوّليون",published:"تاريخ النشر",publisher_one:"ناشر",publisher_other:"ناشرون",series_one:"سلسلة",series_other:"سلاسل",subject_one:"موضوع",subject_other:"مواضيع",subtitle:"عنوان فرعي",title:"العنوان",translator_one:"مترجم",translator_other:"مترجمون"}},Ur=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:Un},publication:Un},Symbol.toStringTag,{value:"Module"})),Dn={metadata:{accessibility:{"display-guide":{"accessibility-summary":{"no-metadata":"Ingen information tilgængelig","publisher-contact":"For mere information om tilgængeligheden af denne bog, kontakt venligst udgiveren: ",title:"Tilgængeligheds-oversigt"},"additional-accessibility-information":{aria:{compact:"Indeholder ARIA roller",descriptive:"Indhold forbedres med ARIA-roller for at optimere organisering og gøre navigation lettere"},"audio-descriptions":"Lydbeskrivelser",braille:"Punktskrift (braille)","color-not-sole-means-of-conveying-information":"Information gives ikke udelukkende via farver","dyslexia-readability":"Læsbarhed for ordblinde","full-ruby-annotations":'Indeholder såkalde "ruby" notationer (til asiatiske sprog)',"high-contrast-between-foreground-and-background-audio":"Høj kontrast imellem forgrunds- og baggrunds-lyd","high-contrast-between-text-and-background":"Høj kontrast imellem tekst og baggrunden","large-print":"Forstørret tekst","page-breaks":{compact:"Indeholder sideskift",descriptive:"Indeholder sideskift fra den trykte version af bogen"},"ruby-annotations":'Nogle "ruby" annotationer (til asiatiske sprog)',"sign-language":"Tegnsprog","tactile-graphics":{compact:"Indeholder taktil grafik",descriptive:"Indeholder taktil grafik for at muliggøre adgang til visuel information for blinde"},"tactile-objects":"Taktile 3D objekter","text-to-speech-hinting":"Udtaleforbedringer til syntetisk tale",title:"Yderligere information om tilgængelighed","ultra-high-contrast-between-text-and-background":"Ultra høj kontrast imellem tekst og baggrund","visible-page-numbering":"Synlige sidenumre","without-background-sounds":"Uden baggrundslyd"},conformance:{a:{compact:"Denne bog overholder minimum-tilgængelighedskravene",descriptive:"Denne bog en overensstemmelseserklæring om, at den opfylder EPUB Tilgængelighedskrav og WCAG 2 standarden på niveau A"},aa:{compact:"Denne bog lever op til de accepterede tilgængelighedskrav",descriptive:"Denne bog en overensstemmelseserklæring om, at den opfylder EPUB Tilgængelighedskrav og WCAG 2 standarden på niveau AA"},aaa:{compact:"Denne bog mere end opfylder de accepterede tilgængelighedskrav",descriptive:"Denne bog en overensstemmelseserklæring om, at den opfylder EPUB Tilgængelighedskrav og WCAG 2 standarden på niveau AAA"},certifier:"Denne bog blev certificeret af ","certifier-credentials":"Certificeringsorganets legitimationsoplysninger er ",details:{"certification-info":"Bogen blev certificeret den ","certifier-report":"Se certificeringsorganets rapport for mere information",claim:"Denne bog hævder at opfylde","epub-accessibility-1-0":"EPUB Tilgængelighed 1.0","epub-accessibility-1-1":"EPUB Tilgængelighed 1.1","level-a":"Niveau A","level-aa":"Niveau AA","level-aaa":"Niveau AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"Retningslinjer for tilgængeligt webindhold (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"Retningslinjer for tilgængeligt webindhold (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"Retningslinjer for tilgængeligt webindhold (WCAG) 2.2"}},"details-title":"Detaljeret overholdelses-information",no:"Ingen information tilgængelig",title:"Overholdelse","unknown-standard":"Overholdelse af de accepterede tilgængelighedskrav kan ikke vurderes for denne bog"},hazards:{flashing:{compact:"Blinkende indhold",descriptive:"Bogen indeholder blinkende indhold der kan forårsage epileptiske anfald"},"flashing-none":{compact:"Ingen blinkende indhold",descriptive:"Bogen indeholder ikke noget blinkende indhold, der kunne forårsage epileptiske anfald"},"flashing-unknown":{compact:"Ingen information om bogen har blinkende indhold",descriptive:"Det kunne ikke afgøres om bogen indeholder blinkende indhold der kan lede til epileptiske anfald"},motion:{compact:"Simuleret bevægelse",descriptive:"Bogen indeholder simuleret bevægelse, der kan forårsage en følelse af køresyge"},"motion-none":{compact:"Indeholder ikke simuleret bevægelse",descriptive:"Denne bog indeholder ikke noget indhold med simuleret bevægelse, der kunne lede til en følelse af køresyge"},"motion-unknown":{compact:"Ingen information om simuleret bevægelse",descriptive:"Det kunne ikke vurderes om bogen indeholder simuleret bevægelse, der kan lede til en følelse af køresyge"},"no-metadata":"Ingen information tilgængelig",none:{compact:"Ingen farer",descriptive:"Bogen indeholder ikke noget indhold der kategoriseres som farligt"},sound:{compact:"Lyde",descriptive:"Bogen indeholder lyde der kan være ubehagelige hvis man er sensitiv overfor lyde"},"sound-none":{compact:"Ingen ubehagelige lyde",descriptive:"Bogen indeholder ikke lyde der kunne opleves som ubehagelige hvis man er sensitiv overfor lyde"},"sound-unknown":{compact:"Ingen information om ubehagelige lyde",descriptive:"Det kunne ikke afgøres om bogen indeholder ubehagelige lyde"},title:"Farer",unknown:"Ingen information om farligt indhold"},"legal-considerations":{exempt:{compact:"Gør krav på undtagelser fra tilgængelighedskrav",descriptive:"Denne bog gør krav på en tilgængelighedsundtagelse i en eller flere jurisdiktioner"},"no-metadata":"Ingen information tilgængelig",title:"Juridiske overvejelser"},navigation:{index:{compact:"Indholdsfortegnelse",descriptive:"Indholdsfortegnelse med links til referencer"},"no-metadata":"Ingen information tilgængelig","page-navigation":{compact:"Gå til side",descriptive:"Sideliste for at gå til sider fra den trykte kildeversion"},structural:{compact:"Overskrifter",descriptive:"Elementer så som overskrifter og tabeller til struktureret navigation"},title:"Navigation",toc:{compact:"Indholdsfortegnelse",descriptive:"Indholdsfortegnelse med links til alle kapitler"}},"rich-content":{"accessible-chemistry-as-latex":{compact:"Kemiske formularer i LaTeX",descriptive:"Kemiske formularer i tilgængeligt format (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"Kemiske formularer i MathML notation",descriptive:"Kemiske formularer i tilgængeligt format (MathML)"},"accessible-math-as-latex":{compact:"Matematik som LaTeX",descriptive:"Matematikformler i tilgængeligt format (LaTeX)"},"accessible-math-described":"Tekstbeskrivelser til matematiske formler","closed-captions":{compact:"Videoer har undertekster",descriptive:"Videoer der optræder i bogen har undertekster"},"extended-descriptions":"Informationsrige billeder beskrives med udvidede beskrivelser","math-as-mathml":{compact:"Matematik som MathML",descriptive:"Matematiske formler i tilgængeligt format (MathML)"},"open-captions":{compact:"Videoer har indlejrede undertekster",descriptive:"Videoer der optræder i bogen har indlejrede undertekster"},title:"Komplekst indhold",transcript:"Indeholder transskription(er)",unknown:"Ingen information tilgængelig"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{compact:"Har alternativ tekst",descriptive:"Har billedbeskrivelser"},"no-metadata":"Ingen information omkring ikke-visuel læsning",none:{compact:"Ikke læsbar med oplæsning eller dynamisk punktskrift",descriptive:"Dette indhold er ikke læsbart med oplæsning eller dynamisk punktskrift"},"not-fully":{compact:"Ikke fuldt læsbar med oplæsning eller dynamisk punktskrift",descriptive:"Alt indholdet er ikke fuldt læsbart med oplæsning eller dynamisk punktskrift"},readable:{compact:"Læsbar med oplæsning eller dynamisk punktskrift",descriptive:"Alt indholdet er læsbart med oplæsning eller dynamisk punktskrift"}},"prerecorded-audio":{complementary:{compact:"Indlæste lydklip",descriptive:"Indlæste lydklip er indlejret i indholdet"},"no-metadata":"Ingen information om indlæst lyd",only:{compact:"Kun indlæst lyd",descriptive:"Lydbog uden tekst alternativer"},synchronized:{compact:"Indlæst lyd med synkroniseret tekst",descriptive:"Alt indholdet er tilgængeligt med indlæst lyd og synkroniseret tekst"}},title:"Læseformer","visual-adjustments":{modifiable:{compact:"Udseende kan ændres",descriptive:"Udseende af tekst og sidelayout kan ændres, så vidt muligt i læsesystemet (skrifttype, skriftstørrelse, afstand mellem afsnit, sætninger, ord og bogstaver, samt farven på tekst og baggrund)"},unknown:"Ingen information om mulighed for ændring af udseende",unmodifiable:{compact:"Udseende kan ikke ændres",descriptive:"Tekst og sidelayout kan ikke ændres, da læseoplevelsen afspejler den trykte version af materialet. Læsesystemet kan dog stadig give mulighed for zoom"}}}}},altIdentifier_one:"alternativt ID",altIdentifier_other:"alternative ID'er",artist_one:"kunstner",artist_other:"kunstnere",author_one:"forfatter",author_other:"forfattere",collection_one:"redaktionel samling",collection_other:"redaktionelle samlinger",colorist_one:"farvelægger",colorist_other:"farvelæggere",contributor_one:"bidragsyder",contributor_other:"bidragsydere",description:"beskrivelse",duration:"varighed",editor_one:"redaktør",editor_other:"redaktører",identifier_one:"ID",identifier_other:"ID'er",illustrator_one:"illustrator",illustrator_other:"illustratorer",imprint_one:"trykkeri",imprint_other:"trykkerier",inker_one:"tegner",inker_other:"tegnere",language_one:"sprog",language_other:"sprog",letterer_one:"taleboble-forfatter",letterer_other:"taleboble-forfattere",modified:"rettet dato",narrator_one:"indlæser",narrator_other:"indlæsere",numberOfPages:"printbare sider",penciler_one:"tegneseriekunstner",penciler_other:"tegneseriekunstnere",published:"udgivelsesdato",publisher_one:"udgiver",publisher_other:"udgivere",series_one:"serie",series_other:"serier",subject_one:"emne",subject_other:"emner",subtitle:"undertitel",title:"titel",translator_one:"oversætter",translator_other:"oversættere"}},Dr=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:Dn},publication:Dn},Symbol.toStringTag,{value:"Module"})),Wn=JSON.parse(`{"format":{"audiobook":"Audiolibro","audiobookJSON":"Audiobook Manifest","cbz":"Comic book archive","divina":"Divina Publication","divinaJSON":"Divina Publication Manifest","epub":"EPUB","lcpa":"Audiolibro protetto con LCP","lcpdf":"PDF protetto con LCP","lcpl":"Licenza LCP","pdf":"PDF","rwp":"Readium Web Publication","rwpm":"Readium Web Publication Manifest","zab":"Audiobook Archive","zip":"ZIP Archive"},"kind":{"audiobook_many":"audiolibri","audiobook_one":"audiolibro","audiobook_other":"audiolibri","book_many":"libri","book_one":"libro","book_other":"libri","comic_many":"fumetti","comic_one":"fumetto","comic_other":"fumetti","document_many":"documenti","document_one":"documento","document_other":"documenti"},"metadata":{"accessibility":{"display-guide":{"accessibility-summary":{"no-metadata":"Nessuna informazione disponibile","publisher-contact":"Per ulteriori informazioni sull'accessibilità di questa risorsa, contattare l'editore: ","title":"Informazioni aggiuntive sull'accessibilità fornite dall'editore"},"additional-accessibility-information":{"aria":{"compact":"Ruoli ARIA inclusi","descriptive":"Il contenuto è semanticamente arricchito con ruoli ARIA per ottimizzare l'organizzazione e facilitare la navigazione"},"audio-descriptions":"Descrizioni audio","braille":"Braille","color-not-sole-means-of-conveying-information":"Il colore non è l'unico mezzo per trasmettere informazioni","dyslexia-readability":"Leggibilità adatta alla dislessia","full-ruby-annotations":"Annotazioni complete in Ruby","high-contrast-between-foreground-and-background-audio":"Elevato contrasto tra audio principale e sottofondo","high-contrast-between-text-and-background":"Contrasto elevato tra testo in primo piano e sfondo","large-print":"Stampa a caratteri ingranditi","page-breaks":{"compact":"Interruzioni di pagina incluse","descriptive":"Interruzioni di pagina identiche alla versione originale a stampa"},"ruby-annotations":"Alcune annotazioni in Ruby","sign-language":"Lingua dei segni","tactile-graphics":{"compact":"Grafica tattile inclusa","descriptive":"La grafica tattile è stata integrata per facilitare l'accesso agli elementi visivi alle persone non vedenti"},"tactile-objects":"Oggetti 3D tattili","text-to-speech-hinting":"Pronuncia migliorata per la sintesi vocale","title":"Ulteriori informazioni sull'accessibilità","ultra-high-contrast-between-text-and-background":"Contrasto molto elevato tra testo e sfondo","visible-page-numbering":"Numerazione delle pagine visibile","without-background-sounds":"Nessun suono in sottofondo"},"conformance":{"a":{"compact":"Questa pubblicazione soddisfa gli standard minimi di accessibilità","descriptive":"La pubblicazione contiene una dichiarazione di conformità che attesta il rispetto degli standard EPUB Accessibility e WCAG 2 Livello A"},"aa":{"compact":"Questa pubblicazione soddisfa gli standard di accessibilità accettati","descriptive":"La pubblicazione contiene una dichiarazione di conformità che attesta il rispetto degli standard EPUB Accessibility e WCAG 2 Livello AAA"},"aaa":{"compact":"Questa pubblicazione supera gli standard di accessibilità","descriptive":"La pubblicazione contiene una dichiarazione di conformità che attesta il rispetto degli standard EPUB Accessibility e WCAG 2 Livello AAA"},"certifier":"La pubblicazione è stata certificata da ","certifier-credentials":"Le credenziali del certificatore sono ","details":{"certification-info":"La pubblicazione è stata certificata il ","certifier-report":"Per ulteriori informazioni, consultare il report di accessibilità del certificatore","claim":"Questa pubblicazione è conforme ai requisiti di","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Livello A","level-aa":"Livello AA","level-aaa":"Livello AAA","wcag-2-0":{"compact":"WCAG 2.0","descriptive":"Linee guida per l'accessibilità dei contenuti web (WCAG) 2.0"},"wcag-2-1":{"compact":"WCAG 2.1","descriptive":"Linee guida per l'accessibilità dei contenuti web (WCAG) 2.1"},"wcag-2-2":{"compact":"WCAG 2.2","descriptive":"Linee guida per l'accessibilità dei contenuti web (WCAG) 2.2"}},"details-title":"Informazioni dettagliate sulla conformità","no":"Nessuna informazione disponibile","title":"Conformità","unknown-standard":"Nessuna indicazione sugli standard d'accessibilità"},"hazards":{"flashing":{"compact":"Contenuto lampeggiante","descriptive":"La pubblicazione contiene contenuti lampeggianti che possono causare crisi d'epilessia fotosensibile"},"flashing-none":{"compact":"Nessun contenuto lampeggiante","descriptive":"La pubblicazione non presenta contenuti lampeggianti che possono causare crisi d'epilessia fotosensibile"},"flashing-unknown":{"compact":"Nessuna informazione sulla presenza di contenuti lampeggianti","descriptive":"Non è stato possibile determinare la presenza di contenuti lampeggianti che possono causare crisi d'epilessia fotosensibile"},"motion":{"compact":"Simulazione del movimento","descriptive":"La pubblicazione contiene simulazioni di movimento che possono provocare cinetosi"},"motion-none":{"compact":"Nessun rischio di simulazione del movimento","descriptive":"La pubblicazione non contiene simulazioni di movimento che possono causare la malattia di movimento"},"motion-unknown":{"compact":"Nessuna informazione relativa alla presenza di simulazioni di movimento","descriptive":"Non è stato possibile determinare la presenza di contenuti che possono provocare cinetosi"},"no-metadata":"Nessuna informazione disponibile","none":{"compact":"Nessuna problematica","descriptive":"La pubblicazione non presenta contenuti a rischio di simulazione di movimento, di suoni, o di contenuti lampeggianti"},"sound":{"compact":"Suoni","descriptive":"La pubblicazione contiene suoni che possono causare problemi di sensibilità"},"sound-none":{"compact":"Nessun rischio acustico","descriptive":"La pubblicazione non contiene suoni che possono causare problemi di sensibilità"},"sound-unknown":{"compact":"Nessuna informazione sulla presenza di suoni","descriptive":"Non è stato possibile determinare la presenza di suoni che potrebbero causare problemi di sensibilità"},"title":"Problematiche","unknown":"La presenza di rischi è sconosciuta"},"legal-considerations":{"exempt":{"compact":"Dichiara di godere dell'esenzione d'accessibilità in alcune giurisdizioni","descriptive":"Questa risorsa gode dell'esenzione d'accessibilità in alcune giurisdizioni"},"no-metadata":"Nessuna informazione disponibile","title":"Note legali"},"navigation":{"index":{"compact":"Indice analitico interattivo","descriptive":"Indice analitico con link alle voci di riferimento"},"no-metadata":"Nessuna informazione disponibile","page-navigation":{"compact":"Vai alla pagina","descriptive":"Sono presenti i riferimenti ai numeri di pagina della versione a stampa corrispondente"},"structural":{"compact":"Intestazioni","descriptive":"Contiene elementi come titoli, elenchi e tabelle per permettere una navigazione strutturata"},"title":"Navigazione","toc":{"compact":"Indice interattivo","descriptive":"L’indice permette l’accesso diretto a tutti i capitoli tramite link"}},"rich-content":{"accessible-chemistry-as-latex":{"compact":"Formule chimiche in LaTeX","descriptive":"Formule chimiche in formato accessibile (LaTeX)"},"accessible-chemistry-as-mathml":{"compact":"Formule chimiche in MathML","descriptive":"Formule chimiche in formato accessibile (MathML)"},"accessible-math-as-latex":{"compact":"Matematica in LaTeX","descriptive":"Formule matematiche in formato accessibile (LaTeX)"},"accessible-math-described":"Sono disponibili descrizioni testuali per le formule matematiche","closed-captions":{"compact":"Sottotitoli disponibili per i video","descriptive":"Per i video sono disponibili dei sottotitoli"},"extended-descriptions":"Le immagini complesse presentano descrizioni estese","math-as-mathml":{"compact":"Matematica in MathML","descriptive":"Formule matematiche in formato accessibile (MathML)"},"open-captions":{"compact":"I video hanno i sottotitoli","descriptive":"I video inclusi nella pubblicazione hanno i sottotitoli"},"title":"Contenuti arricchiti","transcript":"Trascrizioni fornite","unknown":"Nessuna informazione disponibile"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{"compact":"Immagini descritte","descriptive":"Le immagini sono descritte da un testo"},"no-metadata":"Nessuna informazione sulla lettura non visiva","none":{"compact":"Non leggibile con lettura ad alta voce o in braille","descriptive":"Il contenuto non è leggibile con la lettura ad alta voce o in braille"},"not-fully":{"compact":"Non è interamente leggibile con lettura ad alta voce o in braille","descriptive":"Non tutti i contenuti potranno essere letti con lettura ad alta voce o in braille"},"readable":{"compact":"Interamente leggibile con lettura ad alta voce o in braille","descriptive":"Tutti i contenuti possono essere letti con la lettura ad alta voce o con il display braille"}},"prerecorded-audio":{"complementary":{"compact":"Clip audio preregistrate","descriptive":"Le clip audio preregistrate sono integrate nel contenuto"},"no-metadata":"Non sono disponibili informazioni sull'audio preregistrato","only":{"compact":"Solo audio preregistrato","descriptive":"Audiolibro senza testi alternativi"},"synchronized":{"compact":"Audio preregistrato sincronizzato con il testo","descriptive":"Tutti i contenuti sono disponibili come audio preregistrato sincronizzato con il testo"}},"title":"Leggibilità","visual-adjustments":{"modifiable":{"compact":"La formattazione del testo e il layout della pagina possono essere modificati","descriptive":"La formattazione del testo e il layout della pagina possono essere modificati in base alle funzionalità presenti nella soluzione di lettura (ingrandimento dei caratteri del testo, modifica dei colori e dei contrasti per il testo e lo sfondo, modifica degli spazi tra lettere, parole, frasi e paragrafi)"},"unknown":"Non sono disponibili informazioni sulla possibilità di formattare il testo","unmodifiable":{"compact":"La formattazione del testo e il display della pagina non possono essere modificati","descriptive":"Il layout di testo e pagina non può essere modificato poiché l'esperienza di lettura è vicina a una versione di stampa, ma i sistemi di lettura possono ancora fornire opzioni di zoom"}}}}},"altIdentifier_many":"identificatori alternativi","altIdentifier_one":"identificatore alternativo","altIdentifier_other":"identificatori alternativi","artist_many":"","artist_one":"artista","artist_other":"artisti","author_many":"","author_one":"autore","author_other":"autori","collection_many":"","collection_one":"collana","collection_other":"collane","colorist_many":"","colorist_one":"colorista","colorist_other":"coloristi","contributor_many":"","contributor_one":"contributore","contributor_other":"contributori","description":"descrizione","duration":"durata","editor_many":"","editor_one":"editor","editor_other":"editori","identifier_many":"identificatori","identifier_one":"identificatore","identifier_other":"identificatori","illustrator_many":"","illustrator_one":"illustratore","illustrator_other":"illustratori","imprint_many":"","imprint_one":"marca editoriale","imprint_other":"marche editoriali","inker_many":"","inker_one":"inchiostratore","inker_other":"inchiostratori","language_many":"","language_one":"lingua","language_other":"lingue","letterer_many":"letteristi","letterer_one":"letterista","letterer_other":"letteristi","modified":"Data di modifica","narrator_many":"","narrator_one":"narratore","narrator_other":"narratori","numberOfPages":"impaginazione versione cartacea","penciler_many":"","penciler_one":"disegnatore","penciler_other":"disegnatori","published":"Data di pubblicazione","publisher_many":"","publisher_one":"editore","publisher_other":"editori","series_many":"","series_one":"serie","series_other":"serie","subject_many":"","subject_one":"categoria","subject_other":"categorie","subtitle":"sottotitolo","title":"titolo","translator_many":"","translator_one":"traduttore","translator_other":"traduttori"}}`),Wr=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:Wn},publication:Wn},Symbol.toStringTag,{value:"Module"})),jn={metadata:{accessibility:{"display-guide":{"accessibility-summary":{"no-metadata":"Sem informação disponível","publisher-contact":"Para mais informações sobre a acessibilidade deste produto, contacte a editora: ",title:"Resumo de acessibilidade"},"additional-accessibility-information":{aria:{compact:"Inclui funções ARIA",descriptive:"O conteúdo foi otimizado com funções ARIA para melhorar a organização e facilitar a navegação"},"audio-descriptions":"Descrições em áudio",braille:"Braille","color-not-sole-means-of-conveying-information":"A cor não é o único meio de transmitir informação","dyslexia-readability":"Otimizado para dislexia","full-ruby-annotations":"Anotações Ruby completas","high-contrast-between-foreground-and-background-audio":"Alto contraste entre som principal e fundo","high-contrast-between-text-and-background":"Alto contraste entre texto e fundo","large-print":"Impressão ampliada","page-breaks":{compact:"Inclui quebras de página",descriptive:"Inclui quebras de página da fonte impressa original"},"ruby-annotations":"Algumas anotações Ruby","sign-language":"Língua gestual","tactile-graphics":{compact:"Inclui gráficos táteis",descriptive:"Inclui gráficos táteis que facilitam o acesso a elementos visuais para pessoas cegas"},"tactile-objects":"Objetos táteis 3D","text-to-speech-hinting":"Sugestões para leitura em voz alta",title:"Informação adicional de acessibilidade","ultra-high-contrast-between-text-and-background":"Contraste muito elevado entre texto e fundo","visible-page-numbering":"Numeração de páginas visível","without-background-sounds":"Sem sons de fundo"},conformance:{a:{compact:"Cumpre as normas mínimas de acessibilidade",descriptive:"A publicação contém uma declaração de conformidade que indica que cumpre o padrão EPUB Accessibility e WCAG 2 nível A"},aa:{compact:"Cumpre as normas aceites de acessibilidade",descriptive:"A publicação contém uma declaração de conformidade que indica que cumpre o padrão EPUB Accessibility e WCAG 2 nível AA"},aaa:{compact:"Excede as normas aceites de acessibilidade",descriptive:"A publicação contém uma declaração de conformidade que indica que cumpre o padrão EPUB Accessibility e WCAG 2 nível AAA"},certifier:"A publicação foi certificada por ","certifier-credentials":"As credenciais do certificador são ",details:{"certification-info":"A publicação foi certificada em ","certifier-report":"Para mais informações, consulte o relatório do certificador",claim:"Esta publicação declara conformidade com","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Nível A","level-aa":"Nível AA","level-aaa":"Nível AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"Diretrizes de Acessibilidade para Conteúdo Web (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"Diretrizes de Acessibilidade para Conteúdo Web (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"Diretrizes de Acessibilidade para Conteúdo Web (WCAG) 2.2"}},"details-title":"Detalhes de conformidade",no:"Sem informação disponível",title:"Conformidade","unknown-standard":"Não foi possível determinar a conformidade com as normas de acessibilidade aceites para esta publicação"},hazards:{flashing:{compact:"Conteúdo intermitente",descriptive:"A publicação contém conteúdo intermitente que pode causar crises fotossensíveis"},"flashing-none":{compact:"Sem perigos de intermitência",descriptive:"A publicação não contém conteúdo intermitente que possa causar crises fotossensíveis"},"flashing-unknown":{compact:"Risco de intermitência desconhecido",descriptive:"Não foi possível determinar se existe conteúdo intermitente que possa causar crises fotossensíveis"},motion:{compact:"Simulação de movimento",descriptive:"A publicação contém simulações de movimento que podem causar enjoo"},"motion-none":{compact:"Sem simulação de movimento",descriptive:"A publicação não contém simulações de movimento que possam causar enjoo"},"motion-unknown":{compact:"Risco de movimento desconhecido",descriptive:"Não foi possível determinar se existem simulações de movimento que possam causar enjoo"},"no-metadata":"Sem informação disponível",none:{compact:"Sem perigos",descriptive:"A publicação não contém perigos conhecidos"},sound:{compact:"Sons sensíveis",descriptive:"A publicação contém sons que podem causar sensibilidade auditiva"},"sound-none":{compact:"Sem perigos sonoros",descriptive:"A publicação não contém sons que possam causar sensibilidade auditiva"},"sound-unknown":{compact:"Risco sonoro desconhecido",descriptive:"Não foi possível determinar se a publicação contém sons que possam causar sensibilidade auditiva"},title:"Perigos",unknown:"Presença de perigos não determinada"},"legal-considerations":{exempt:{compact:"Declara isenção de conformidade em algumas jurisdições",descriptive:"Esta publicação declara isenção de conformidade em algumas jurisdições"},"no-metadata":"Sem informação disponível",title:"Considerações legais"},navigation:{index:{compact:"Índice remissivo",descriptive:"Índice com ligações para entradas referenciadas"},"no-metadata":"Sem informação disponível","page-navigation":{compact:"Ir para página",descriptive:"Lista de páginas que permite aceder às páginas da versão impressa original"},structural:{compact:"Títulos e estrutura",descriptive:"Elementos como títulos, tabelas, etc., para navegação estruturada"},title:"Navegação",toc:{compact:"Índice",descriptive:"Índice de conteúdos com ligações para todos os capítulos do texto"}},"rich-content":{"accessible-chemistry-as-latex":{compact:"Fórmulas químicas em LaTeX",descriptive:"Fórmulas químicas em formato acessível (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"Fórmulas químicas em MathML",descriptive:"Fórmulas químicas em formato acessível (MathML)"},"accessible-math-as-latex":{compact:"Matemática em LaTeX",descriptive:"Fórmulas matemáticas em formato acessível (LaTeX)"},"accessible-math-described":"Descrição textual das fórmulas matemáticas","closed-captions":{compact:"Vídeos com legendas ocultas",descriptive:"Os vídeos incluídos na publicação têm legendas ocultas"},"extended-descriptions":"Imagens complexas com descrições detalhadas","math-as-mathml":{compact:"Matemática em MathML",descriptive:"Fórmulas matemáticas em formato acessível (MathML)"},"open-captions":{compact:"Vídeos com legendas abertas",descriptive:"Os vídeos incluídos na publicação têm legendas abertas"},title:"Conteúdo rico",transcript:"Transcrição fornecida",unknown:"Sem informação disponível"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{compact:"Contém texto alternativo",descriptive:"Inclui descrições alternativas de texto para imagens"},"no-metadata":"Sem informação sobre leitura não visual",none:{compact:"Não legível em leitura em voz alta ou braille dinâmico",descriptive:"O conteúdo não é legível em voz alta ou através de braille dinâmico"},"not-fully":{compact:"Parcialmente legível em leitura em voz alta ou braille dinâmico",descriptive:"Nem todo o conteúdo é legível em voz alta ou através de braille dinâmico"},readable:{compact:"Totalmente legível em leitura em voz alta ou braille dinâmico",descriptive:"Todo o conteúdo pode ser lido em voz alta ou através de braille dinâmico"}},"prerecorded-audio":{complementary:{compact:"Contém clipes de áudio pré-gravados",descriptive:"O conteúdo contém clipes de áudio pré-gravados incorporados"},"no-metadata":"Sem informação sobre áudio pré-gravado",only:{compact:"Apenas áudio pré-gravado",descriptive:"A publicação é apenas áudio e não possui alternativa em texto"},synchronized:{compact:"Áudio pré-gravado sincronizado com texto",descriptive:"Todo o conteúdo está disponível como áudio pré-gravado sincronizado com texto"}},title:"Formas de leitura","visual-adjustments":{modifiable:{compact:"Aspeto personalizável",descriptive:"O aspeto do texto e o layout da página podem ser modificados de acordo com as capacidades do sistema de leitura (tipo e tamanho de letra, espaçamento entre parágrafos, frases, palavras e letras, bem como a cor de fundo e do texto)"},unknown:"Sem informação sobre personalização do aspeto",unmodifiable:{compact:"Aspeto não ajustável",descriptive:"O texto e o layout da página não podem ser modificados, uma vez que a experiência de leitura é semelhante à versão impressa, mas os sistemas de leitura ainda podem oferecer opções de ampliação"}}}}},altIdentifier_one:"identificador alternativo",altIdentifier_other:"identificadores alternativos",artist_one:"artista",artist_other:"artistas",author_one:"autor",author_other:"autores",collection_one:"coleção",collection_other:"coleções",colorist_one:"colorista",colorist_other:"coloristas",contributor_one:"colaborador",contributor_other:"colaboradores",description:"descrição",duration:"duração",editor_one:"editor",editor_other:"editores",identifier_one:"identificador",identifier_other:"identificadores",illustrator_one:"ilustrador",illustrator_other:"ilustradores",imprint_one:"selo editorial",imprint_other:"selos editoriais",inker_one:"arte-finalista",inker_other:"arte-finalistas",language_one:"idioma",language_other:"idiomas",letterer_one:"letrista",letterer_other:"letristas",modified:"data de modificação",narrator_one:"narrador",narrator_other:"narradores",numberOfPages:"número de páginas",penciler_one:"desenhador",penciler_other:"desenhadores",published:"data de publicação",publisher_one:"editora",publisher_other:"editoras",series_one:"série",series_other:"séries",subject_one:"tema",subject_other:"temas",subtitle:"subtítulo",title:"título",translator_one:"tradutor",translator_other:"tradutores"}},jr=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:jn},publication:jn},Symbol.toStringTag,{value:"Module"})),Bn={metadata:{accessibility:{"display-guide":{"accessibility-summary":{"no-metadata":"Information saknas","publisher-contact":"För mer information om den här publikationens tillgänglighet, kontakta utgivaren: ",title:"Kompletterande information om tillgänglighet"},"additional-accessibility-information":{aria:{compact:"Innehåller ARIA-roller",descriptive:"Innehållet har försetts med ARIA-roller för att tydliggöra strukturen och underlätta navigering"},"audio-descriptions":"Syntolkning",braille:"Punktskrift","color-not-sole-means-of-conveying-information":"Betydelse uttrycks aldrig enbart med färg","dyslexia-readability":"Förbättrad läsbarhet för personer med dyslexi","full-ruby-annotations":"Fullständig ruby-annotering","high-contrast-between-foreground-and-background-audio":"Hög kontrast mellan förgrundsljud och bakgrundsljud","high-contrast-between-text-and-background":"Hög kontrast mellan text och bakgrund","large-print":"Storstil","page-breaks":{compact:"Innehåller sidnummer",descriptive:"Innehåller sidnummer från tryckt förlaga"},"ruby-annotations":"Viss ruby-annotering","sign-language":"Teckenspråk","tactile-graphics":{compact:"Innehåller taktila bilder",descriptive:"Taktila bilder har lagts till för att tillgängliggöra visuella element för personer med synnedsättning"},"tactile-objects":"Taktila 3D-objekt","text-to-speech-hinting":"Innehåller uttalsinstruktioner för talsyntes",title:"Ytterligare tillgänglighetsinformation","ultra-high-contrast-between-text-and-background":"Extra hög kontrast mellan text och bakgrund","visible-page-numbering":"Synlig sidnumrering","without-background-sounds":"Utan bakgrundsljud"},conformance:{a:{compact:"Publikationen uppfyller tillgänglighetskrav på en grundläggande nivå",descriptive:"Publikationen anger att den uppfyller standarderna EPUB Accessibility och WCAG 2 nivå A"},aa:{compact:"Publikationen uppfyller tillgänglighetskrav på en vedertagen nivå",descriptive:"Publikationen anger att den uppfyller standarderna EPUB Accessibility och WCAG 2 nivå AA"},aaa:{compact:"Publikationen uppfyller tillgänglighetskrav utöver en vedertagen nivå",descriptive:"Publikationen anger att den uppfyller standarderna EPUB Accessibility och WCAG 2 nivå AAA"},certifier:"Publikationen är certifierad av ","certifier-credentials":"Certifierarens märkning är ",details:{"certification-info":"Publikationen certifierades ","certifier-report":"Se certifieringsrapporten för mer information",claim:"Publikationen anger att den uppfyller kraven enligt","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"nivå A","level-aa":"nivå AA","level-aaa":"nivå AAA","wcag-2-0":{compact:"WCAG 2.0",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.0"},"wcag-2-1":{compact:"WCAG 2.1",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.1"},"wcag-2-2":{compact:"WCAG 2.2",descriptive:"Web Content Accessibility Guidelines (WCAG) 2.2"}},"details-title":"Detaljerad information om tillgänglighetskrav",no:"Information saknas",title:"Tillgänglighetskrav","unknown-standard":"Det går inte att avgöra om publikationen uppfyller vedertagna tillgänglighetskrav"},hazards:{flashing:{compact:"Blinkande innehåll",descriptive:"Publikationen har blinkande innehåll som kan vara skadligt för ljuskänsliga personer"},"flashing-none":{compact:"Inget blinkande innehåll",descriptive:"Publikationen har inget blinkande innehåll"},"flashing-unknown":{compact:"Förekomst av blinkande innehåll är okänd",descriptive:"Förekomst av blinkande innehåll är okänd"},motion:{compact:"Rörelsesimulering",descriptive:"Publikationen innehåller rörelsesimulering som skulle kunna orsaka illamående"},"motion-none":{compact:"Ingen rörelsesimulering",descriptive:"Publikationen innehåller ingen rörelsesimulering"},"motion-unknown":{compact:"Förekomst av rörelsesimulering är okänd",descriptive:"Förekomst av rörelsesimulering är okänd"},"no-metadata":"Information saknas",none:{compact:"Inga risker",descriptive:"Publikationen innehåller inga risker"},sound:{compact:"Ljud",descriptive:"Publikationen innehåller ljud som kan orsaka obehag"},"sound-none":{compact:"Inget ljud som kan orsaka obehag",descriptive:"Publikationen innehåller inget ljud som kan orsaka obehag"},"sound-unknown":{compact:"Förekomst av ljud som kan orsaka obehag är okänd",descriptive:"Förekomst av ljud som kan orsaka obehag är okänd"},title:"Risker",unknown:"Förekomst av risker är okänd"},"legal-considerations":{exempt:{compact:"Åberopar ett undantag från vissa lagstadgade tillgänglighetskrav",descriptive:"Publikationen åberopar ett undantag från vissa lagstadgade tillgänglighetskrav"},"no-metadata":"Information saknas",title:"Juridiska aspekter"},navigation:{index:{compact:"Register",descriptive:"Register med länkar till innehållet"},"no-metadata":"Information saknas","page-navigation":{compact:"Gå till sida",descriptive:"Sidindelning för navigering enligt sidnummer i tryckt förlaga"},structural:{compact:"Rubriker",descriptive:"Navigerbara element såsom rubriker eller tabeller"},title:"Navigering",toc:{compact:"Innehållsförteckning",descriptive:"Innehållsförteckning med länkar till alla kapitel"}},"rich-content":{"accessible-chemistry-as-latex":{compact:"Kemiska formler i LaTeX",descriptive:"Kemiska formler i tillgängligt format (LaTeX)"},"accessible-chemistry-as-mathml":{compact:"Kemiska formler i MathML",descriptive:"Kemiska formler i tillgängligt format (MathML)"},"accessible-math-as-latex":{compact:"Matematik som LaTeX",descriptive:"Matematiska formler i tillgängligt format (LaTeX)"},"accessible-math-described":"Innehåller textbeskrivningar av matematik","closed-captions":{compact:"Videoklipp har undertext som kan sättas på/stängas av",descriptive:"Videoklipp som ingår i publikationen har undertext som kan sättas på och stängas av (stängda undertexter)"},"extended-descriptions":"Informationsrika bilder har utökade bildbeskrivningar","math-as-mathml":{compact:"Matematik som MathML",descriptive:"Matematiska formler i tillgängligt format (MathML)"},"open-captions":{compact:"Videoklipp har undertext som inte kan stängas av",descriptive:"Videoklipp som ingår i publikationen har undertext som inte kan stängas av (öppna undertexter)"},title:"Berikat innehåll",transcript:"Innehåller transkriptioner",unknown:"Information saknas"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{compact:"Har textalternativ (alt-texter)",descriptive:"Har textalternativ (alt-texter) till bilder"},"no-metadata":"Information om icke-visuell läsbarhet saknas",none:{compact:"Kan inte läsas med uppläsningsfunktion eller punktskriftsskärm",descriptive:"Innehållet går inte att läsa med uppläsningsfunktion eller punktskriftsskärm"},"not-fully":{compact:"Inte läsbart i sin helhet med uppläsningsfunktion eller punktskriftsskärm",descriptive:"Allt innehåll går inte att läsa med uppläsningsfunktion eller punktskriftsskärm"},readable:{compact:"Kan läsas med uppläsningsfunktion eller punktskriftsskärm",descriptive:"Hela innehållet går att läsa med uppläsningsfunktion eller punktskriftsskärm"}},"prerecorded-audio":{complementary:{compact:"Förinspelade ljudklipp",descriptive:"Innehåller förinspelade ljudklipp"},"no-metadata":"Information om förinspelat ljud saknas",only:{compact:"Endast förinspelat ljud",descriptive:"Bok med ljud utan textalternativ"},synchronized:{compact:"Förinspelat ljud synkroniserat med texten",descriptive:"Hela innehållet finns tillgängligt som förinspelat ljud synkroniserat med texten"}},title:"Olika sätt att läsa","visual-adjustments":{modifiable:{compact:"Utseendet kan justeras",descriptive:"Det går att justera text och layout i den utsträckning som läsprogrammet tillåter, till exempel typsnitt, storlek på text, avstånd mellan rader och stycken samt färg på text och bakgrund"},unknown:"Information om möjlighet att justera utseende saknas",unmodifiable:{compact:"Utseendet kan inte justeras",descriptive:"Text- och sidlayout kan inte justeras eftersom presentationen liknar en tryckt version, men läsprogram kan ha funktioner för att zooma in"}}}}},altIdentifier_one:"alternativ identifierare",altIdentifier_other:"alternativa identifierare",artist_one:"konstnär",artist_other:"konstnärer",author_one:"författare",author_other:"författare",collection_one:"samling",collection_other:"samlingar",colorist_one:"kolorist",colorist_other:"kolorister",contributor_one:"medverkande",contributor_other:"medverkande",description:"beskrivning",duration:"speltid",editor_one:"redaktör",editor_other:"redaktörer",identifier_one:"identifierare",identifier_other:"identifierare",illustrator_one:"illustratör",illustrator_other:"illustratörer",imprint_one:"imprint",imprint_other:"imprint",inker_one:"tuschare",inker_other:"tuschare",language_one:"språk",language_other:"språk",letterer_one:"textare",letterer_other:"textare",modified:"ändringsdatum",narrator_one:"berättarröst",narrator_other:"berättarröster",numberOfPages:"sidantal",penciler_one:"tecknare",penciler_other:"tecknare",published:"publikationsdatum",publisher_one:"förlag",publisher_other:"förlag",series_one:"serie",series_other:"serier",subject_one:"ämne",subject_other:"ämnen",subtitle:"undertitel",title:"titel",translator_one:"översättare",translator_other:"översättare"}},Br=Object.freeze(Object.defineProperty({__proto__:null,default:{publication:Bn},publication:Bn},Symbol.toStringTag,{value:"Module"}));y.BooleanPreference=A,y.EnumPreference=Lt,y.EpubDefaults=Ln,y.EpubNavigator=It,y.EpubPreferences=ve,y.EpubPreferencesEditor=zt,y.EpubSettings=Ot,y.ExperimentalWebPubNavigator=fr,y.FXLCoordinator=Sn,y.FXLFrameManager=bn,y.FXLFramePoolManager=Cn,y.FXLPeripherals=kn,y.FXLSpreader=Pn,y.FrameComms=me,y.FrameManager=pn,y.FramePoolManager=fn,y.HorizontalThird=yn,y.Injector=Rt,y.LineLengths=ge,y.Navigator=Zt,y.Orientation=et,y.Preference=z,y.Properties=Ie,y.RSProperties=An,y.RangePreference=x,y.ReadiumCSS=Rn,y.Spread=tt,y.TextAlignment=X,y.UserProperties=Mt,y.VerticalThird=vn,y.VisualNavigator=st,y.WebAudioEngine=Rr,y.WebPubBlobBuilder=Qt,y.WebPubCSS=tn,y.WebPubDefaults=rn,y.WebPubFrameManager=Ki,y.WebPubFramePoolManager=Zi,y.WebPubNavigator=hn,y.WebPubPreferences=be,y.WebPubPreferencesEditor=At,y.WebPubSettings=Ct,y.WebRSProperties=en,y.WebUserProperties=xt,y.ensureBoolean=P,y.ensureEnumValue=Fe,y.ensureExperiment=Et,y.ensureFilter=oe,y.ensureLessThanOrEqual=nn,y.ensureMoreThanOrEqual=on,y.ensureNonNegative=k,y.ensureString=T,y.ensureValueInRange=V,y.experiments=Ke,y.filterRangeConfig=ie,y.fontSizeRangeConfig=Ce,y.fontWeightRangeConfig=J,y.fontWidthRangeConfig=Le,y.letterSpacingRangeConfig=Ae,y.lineHeightRangeConfig=Re,y.lineLengthRangeConfig=ne,y.paragraphIndentRangeConfig=Te,y.paragraphSpacingRangeConfig=ze,y.sML=fe,y.sMLWithRequest=E,y.withFallback=Ze,y.wordSpacingRangeConfig=Oe,y.zoomRangeConfig=Me,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));