<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>EPUB Renderer</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    body {
      background: white;
      overflow: hidden;
    }
    #container {
      width: 100%;
      height: 100vh;
      display: flex;
      justify-content: flex-start;
      align-items: flex-start;
      background: white;
    }
    #epub-container {
      background: white;
    }
  </style>
  <script type="module" crossorigin>(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();var gt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ci(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var xr={exports:{}},Pn={exports:{}},sa=void 0,zn=function(n){return n!==sa&&n!==null},aa=zn,oa={object:!0,function:!0,undefined:!0},ua=function(n){return aa(n)?hasOwnProperty.call(oa,typeof n):!1},la=ua,ha=function(n){if(!la(n))return!1;try{return n.constructor?n.constructor.prototype===n:!1}catch{return!1}},fa=ha,ca=function(n){if(typeof n!="function"||!hasOwnProperty.call(n,"length"))return!1;try{if(typeof n.length!="number"||typeof n.call!="function"||typeof n.apply!="function")return!1}catch{return!1}return!fa(n)},da=ca,pa=/^\s*class[\s{/}]/,va=Function.prototype.toString,ga=function(n){return!(!da(n)||pa.test(va.call(n)))},ma=function(){var n=Object.assign,e;return typeof n!="function"?!1:(e={foo:"raz"},n(e,{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")},fr,nn;function ya(){return nn||(nn=1,fr=function(){try{return Object.keys("primitive"),!0}catch{return!1}}),fr}var ba=function(){},wa=ba(),Or=function(n){return n!==wa&&n!==null},cr,sn;function _a(){if(sn)return cr;sn=1;var n=Or,e=Object.keys;return cr=function(t){return e(n(t)?Object(t):t)},cr}var dr,an;function Ea(){return an||(an=1,dr=ya()()?Object.keys:_a()),dr}var pr,on;function xa(){if(on)return pr;on=1;var n=Or;return pr=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e},pr}var vr,un;function Aa(){if(un)return vr;un=1;var n=Ea(),e=xa(),t=Math.max;return vr=function(i,r){var s,a,o=t(arguments.length,2),u;for(i=Object(e(i)),u=function(h){try{i[h]=r[h]}catch(f){s||(s=f)}},a=1;a<o;++a)r=arguments[a],n(r).forEach(u);if(s!==void 0)throw s;return i},vr}var Da=ma()?Object.assign:Aa(),Ca=Or,Sa=Array.prototype.forEach,Ta=Object.create,ka=function(n,e){var t;for(t in n)e[t]=n[t]},Na=function(n){var e=Ta(null);return Sa.call(arguments,function(t){Ca(t)&&ka(Object(t),e)}),e},gr="razdwatrzy",Ra=function(){return typeof gr.contains!="function"?!1:gr.contains("dwa")===!0&&gr.contains("foo")===!1},mr,ln;function Ia(){if(ln)return mr;ln=1;var n=String.prototype.indexOf;return mr=function(e){return n.call(this,e,arguments[1])>-1},mr}var Oa=Ra()?String.prototype.contains:Ia(),Pi=zn,hn=ga,Mn=Da,Un=Na,wi=Oa,Ba=Pn.exports=function(n,e){var t,i,r,s,a;return arguments.length<2||typeof n!="string"?(s=e,e=n,n=null):s=arguments[2],Pi(n)?(t=wi.call(n,"c"),i=wi.call(n,"e"),r=wi.call(n,"w")):(t=r=!0,i=!1),a={value:e,configurable:t,enumerable:i,writable:r},s?Mn(Un(s),a):a};Ba.gs=function(n,e,t){var i,r,s,a;return typeof n!="string"?(s=t,t=e,e=n,n=null):s=arguments[3],Pi(e)?hn(e)?Pi(t)?hn(t)||(s=t,t=void 0):t=void 0:(s=e,e=t=void 0):e=void 0,Pi(n)?(i=wi.call(n,"c"),r=wi.call(n,"e")):(i=!0,r=!1),a={get:e,set:t,configurable:i,enumerable:r},s?Mn(Un(s),a):a};var La=Pn.exports,Fa=function(n){if(typeof n!="function")throw new TypeError(n+" is not a function");return n};(function(n,e){var t=La,i=Fa,r=Function.prototype.apply,s=Function.prototype.call,a=Object.create,o=Object.defineProperty,u=Object.defineProperties,h=Object.prototype.hasOwnProperty,f={configurable:!0,enumerable:!1,writable:!0},c,b,g,S,T,d,p;c=function(y,D){var I;return i(D),h.call(this,"__ee__")?I=this.__ee__:(I=f.value=a(null),o(this,"__ee__",f),f.value=null),I[y]?typeof I[y]=="object"?I[y].push(D):I[y]=[I[y],D]:I[y]=D,this},b=function(y,D){var I,w;return i(D),w=this,c.call(this,y,I=function(){g.call(w,y,I),r.call(D,this,arguments)}),I.__eeOnceListener__=D,this},g=function(y,D){var I,w,A,C;if(i(D),!h.call(this,"__ee__"))return this;if(I=this.__ee__,!I[y])return this;if(w=I[y],typeof w=="object")for(C=0;A=w[C];++C)(A===D||A.__eeOnceListener__===D)&&(w.length===2?I[y]=w[C?0:1]:w.splice(C,1));else(w===D||w.__eeOnceListener__===D)&&delete I[y];return this},S=function(y){var D,I,w,A,C;if(h.call(this,"__ee__")&&(A=this.__ee__[y],!!A))if(typeof A=="object"){for(I=arguments.length,C=new Array(I-1),D=1;D<I;++D)C[D-1]=arguments[D];for(A=A.slice(),D=0;w=A[D];++D)r.call(w,this,C)}else switch(arguments.length){case 1:s.call(A,this);break;case 2:s.call(A,this,arguments[1]);break;case 3:s.call(A,this,arguments[1],arguments[2]);break;default:for(I=arguments.length,C=new Array(I-1),D=1;D<I;++D)C[D-1]=arguments[D];r.call(A,this,C)}},T={on:c,once:b,off:g,emit:S},d={on:t(c),once:t(b),off:t(g),emit:t(S)},p=u({},d),n.exports=e=function(y){return y==null?a(p):u(Object(y),d)},e.methods=T})(xr,xr.exports);var Pa=xr.exports;const Rt=ci(Pa);var Vt={},Zt={};function za(n,e,t){if(t===void 0&&(t=Array.prototype),n&&typeof t.find=="function")return t.find.call(n,e);for(var i=0;i<n.length;i++)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];if(e.call(void 0,r,i,n))return r}}function Br(n,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(n):n}var qn=Br({HTML:"text/html",isHTML:function(n){return n===qn.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Wn=Br({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(n){return n===Wn.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Zt.find=za;Zt.freeze=Br;Zt.MIME_TYPE=qn;Zt.NAMESPACE=Wn;var jn=Zt,Tt=jn.find,_i=jn.NAMESPACE;function Ma(n){return n!==""}function Ua(n){return n?n.split(/[\t\n\f\r ]+/).filter(Ma):[]}function qa(n,e){return n.hasOwnProperty(e)||(n[e]=!0),n}function fn(n){if(!n)return[];var e=Ua(n);return Object.keys(e.reduce(qa,{}))}function Wa(n){return function(e){return n&&n.indexOf(e)!==-1}}function Si(n,e){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}function ft(n,e){var t=n.prototype;if(!(t instanceof e)){let r=function(){};var i=r;r.prototype=e.prototype,r=new r,Si(t,r),n.prototype=t=r}t.constructor!=n&&(typeof n!="function"&&console.error("unknown Class:"+n),t.constructor=n)}var ct={},Ct=ct.ELEMENT_NODE=1,ui=ct.ATTRIBUTE_NODE=2,qi=ct.TEXT_NODE=3,Hn=ct.CDATA_SECTION_NODE=4,Vn=ct.ENTITY_REFERENCE_NODE=5,ja=ct.ENTITY_NODE=6,Zn=ct.PROCESSING_INSTRUCTION_NODE=7,Gn=ct.COMMENT_NODE=8,Yn=ct.DOCUMENT_NODE=9,Xn=ct.DOCUMENT_TYPE_NODE=10,Pt=ct.DOCUMENT_FRAGMENT_NODE=11,Ha=ct.NOTATION_NODE=12,rt={},Je={};rt.INDEX_SIZE_ERR=(Je[1]="Index size error",1);rt.DOMSTRING_SIZE_ERR=(Je[2]="DOMString size error",2);var ht=rt.HIERARCHY_REQUEST_ERR=(Je[3]="Hierarchy request error",3);rt.WRONG_DOCUMENT_ERR=(Je[4]="Wrong document",4);rt.INVALID_CHARACTER_ERR=(Je[5]="Invalid character",5);rt.NO_DATA_ALLOWED_ERR=(Je[6]="No data allowed",6);rt.NO_MODIFICATION_ALLOWED_ERR=(Je[7]="No modification allowed",7);var $n=rt.NOT_FOUND_ERR=(Je[8]="Not found",8);rt.NOT_SUPPORTED_ERR=(Je[9]="Not supported",9);var cn=rt.INUSE_ATTRIBUTE_ERR=(Je[10]="Attribute in use",10);rt.INVALID_STATE_ERR=(Je[11]="Invalid state",11);rt.SYNTAX_ERR=(Je[12]="Syntax error",12);rt.INVALID_MODIFICATION_ERR=(Je[13]="Invalid modification",13);rt.NAMESPACE_ERR=(Je[14]="Invalid namespace",14);rt.INVALID_ACCESS_ERR=(Je[15]="Invalid access",15);function We(n,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,Je[n]),this.message=Je[n],Error.captureStackTrace&&Error.captureStackTrace(this,We);return t.code=n,e&&(this.message=this.message+": "+e),t}We.prototype=Error.prototype;Si(rt,We);function Ft(){}Ft.prototype={length:0,item:function(n){return n>=0&&n<this.length?this[n]:null},toString:function(n,e){for(var t=[],i=0;i<this.length;i++)ai(this[i],t,n,e);return t.join("")},filter:function(n){return Array.prototype.filter.call(this,n)},indexOf:function(n){return Array.prototype.indexOf.call(this,n)}};function li(n,e){this._node=n,this._refresh=e,Lr(this)}function Lr(n){var e=n._node._inc||n._node.ownerDocument._inc;if(n._inc!==e){var t=n._refresh(n._node);if(us(n,"length",t.length),!n.$$length||t.length<n.$$length)for(var i=t.length;i in n;i++)Object.prototype.hasOwnProperty.call(n,i)&&delete n[i];Si(t,n),n._inc=e}}li.prototype.item=function(n){return Lr(this),this[n]||null};ft(li,Ft);function Wi(){}function Kn(n,e){for(var t=n.length;t--;)if(n[t]===e)return t}function dn(n,e,t,i){if(i?e[Kn(e,i)]=t:e[e.length++]=t,n){t.ownerElement=n;var r=n.ownerDocument;r&&(i&&es(r,n,i),Va(r,n,t))}}function pn(n,e,t){var i=Kn(e,t);if(i>=0){for(var r=e.length-1;i<r;)e[i]=e[++i];if(e.length=r,n){var s=n.ownerDocument;s&&(es(s,n,t),t.ownerElement=null)}}else throw new We($n,new Error(n.tagName+"@"+t))}Wi.prototype={length:0,item:Ft.prototype.item,getNamedItem:function(n){for(var e=this.length;e--;){var t=this[e];if(t.nodeName==n)return t}},setNamedItem:function(n){var e=n.ownerElement;if(e&&e!=this._ownerElement)throw new We(cn);var t=this.getNamedItem(n.nodeName);return dn(this._ownerElement,this,n,t),t},setNamedItemNS:function(n){var e=n.ownerElement,t;if(e&&e!=this._ownerElement)throw new We(cn);return t=this.getNamedItemNS(n.namespaceURI,n.localName),dn(this._ownerElement,this,n,t),t},removeNamedItem:function(n){var e=this.getNamedItem(n);return pn(this._ownerElement,this,e),e},removeNamedItemNS:function(n,e){var t=this.getNamedItemNS(n,e);return pn(this._ownerElement,this,t),t},getNamedItemNS:function(n,e){for(var t=this.length;t--;){var i=this[t];if(i.localName==e&&i.namespaceURI==n)return i}return null}};function Jn(){}Jn.prototype={hasFeature:function(n,e){return!0},createDocument:function(n,e,t){var i=new Ti;if(i.implementation=this,i.childNodes=new Ft,i.doctype=t||null,t&&i.appendChild(t),e){var r=i.createElementNS(n,e);i.appendChild(r)}return i},createDocumentType:function(n,e,t){var i=new er;return i.name=n,i.nodeName=n,i.publicId=e||"",i.systemId=t||"",i}};function ke(){}ke.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(n,e){return ji(this,n,e)},replaceChild:function(n,e){ji(this,n,e,is),e&&this.removeChild(e)},removeChild:function(n){return ts(this,n)},appendChild:function(n){return this.insertBefore(n,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(n){return Ar(this.ownerDocument||this,this,n)},normalize:function(){for(var n=this.firstChild;n;){var e=n.nextSibling;e&&e.nodeType==qi&&n.nodeType==qi?(this.removeChild(e),n.appendData(e.data)):(n.normalize(),n=e)}},isSupported:function(n,e){return this.ownerDocument.implementation.hasFeature(n,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(n){for(var e=this;e;){var t=e._nsMap;if(t){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&t[i]===n)return i}e=e.nodeType==ui?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(n){for(var e=this;e;){var t=e._nsMap;if(t&&n in t&&Object.prototype.hasOwnProperty.call(t,n))return t[n];e=e.nodeType==ui?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(n){var e=this.lookupPrefix(n);return e==null}};function Qn(n){return n=="<"&&"&lt;"||n==">"&&"&gt;"||n=="&"&&"&amp;"||n=='"'&&"&quot;"||"&#"+n.charCodeAt()+";"}Si(ct,ke);Si(ct,ke.prototype);function Ei(n,e){if(e(n))return!0;if(n=n.firstChild)do if(Ei(n,e))return!0;while(n=n.nextSibling)}function Ti(){this.ownerDocument=this}function Va(n,e,t){n&&n._inc++;var i=t.namespaceURI;i===_i.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function es(n,e,t,i){n&&n._inc++;var r=t.namespaceURI;r===_i.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function Fr(n,e,t){if(n&&n._inc){n._inc++;var i=e.childNodes;if(t)i[i.length++]=t;else{for(var r=e.firstChild,s=0;r;)i[s++]=r,r=r.nextSibling;i.length=s,delete i[i.length]}}}function ts(n,e){var t=e.previousSibling,i=e.nextSibling;return t?t.nextSibling=i:n.firstChild=i,i?i.previousSibling=t:n.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Fr(n.ownerDocument,n),e}function Za(n){return n&&(n.nodeType===ke.DOCUMENT_NODE||n.nodeType===ke.DOCUMENT_FRAGMENT_NODE||n.nodeType===ke.ELEMENT_NODE)}function Ga(n){return n&&(kt(n)||Pr(n)||zt(n)||n.nodeType===ke.DOCUMENT_FRAGMENT_NODE||n.nodeType===ke.COMMENT_NODE||n.nodeType===ke.PROCESSING_INSTRUCTION_NODE)}function zt(n){return n&&n.nodeType===ke.DOCUMENT_TYPE_NODE}function kt(n){return n&&n.nodeType===ke.ELEMENT_NODE}function Pr(n){return n&&n.nodeType===ke.TEXT_NODE}function vn(n,e){var t=n.childNodes||[];if(Tt(t,kt)||zt(e))return!1;var i=Tt(t,zt);return!(e&&i&&t.indexOf(i)>t.indexOf(e))}function gn(n,e){var t=n.childNodes||[];function i(s){return kt(s)&&s!==e}if(Tt(t,i))return!1;var r=Tt(t,zt);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function Ya(n,e,t){if(!Za(n))throw new We(ht,"Unexpected parent node type "+n.nodeType);if(t&&t.parentNode!==n)throw new We($n,"child not in parent");if(!Ga(e)||zt(e)&&n.nodeType!==ke.DOCUMENT_NODE)throw new We(ht,"Unexpected node type "+e.nodeType+" for parent node type "+n.nodeType)}function Xa(n,e,t){var i=n.childNodes||[],r=e.childNodes||[];if(e.nodeType===ke.DOCUMENT_FRAGMENT_NODE){var s=r.filter(kt);if(s.length>1||Tt(r,Pr))throw new We(ht,"More than one element or text in fragment");if(s.length===1&&!vn(n,t))throw new We(ht,"Element in fragment can not be inserted before doctype")}if(kt(e)&&!vn(n,t))throw new We(ht,"Only one element can be added and only after doctype");if(zt(e)){if(Tt(i,zt))throw new We(ht,"Only one doctype is allowed");var a=Tt(i,kt);if(t&&i.indexOf(a)<i.indexOf(t))throw new We(ht,"Doctype can only be inserted before an element");if(!t&&a)throw new We(ht,"Doctype can not be appended since element is present")}}function is(n,e,t){var i=n.childNodes||[],r=e.childNodes||[];if(e.nodeType===ke.DOCUMENT_FRAGMENT_NODE){var s=r.filter(kt);if(s.length>1||Tt(r,Pr))throw new We(ht,"More than one element or text in fragment");if(s.length===1&&!gn(n,t))throw new We(ht,"Element in fragment can not be inserted before doctype")}if(kt(e)&&!gn(n,t))throw new We(ht,"Only one element can be added and only after doctype");if(zt(e)){let u=function(h){return zt(h)&&h!==t};var o=u;if(Tt(i,u))throw new We(ht,"Only one doctype is allowed");var a=Tt(i,kt);if(t&&i.indexOf(a)<i.indexOf(t))throw new We(ht,"Doctype can only be inserted before an element")}}function ji(n,e,t,i){Ya(n,e,t),n.nodeType===ke.DOCUMENT_NODE&&(i||Xa)(n,e,t);var r=e.parentNode;if(r&&r.removeChild(e),e.nodeType===Pt){var s=e.firstChild;if(s==null)return e;var a=e.lastChild}else s=a=e;var o=t?t.previousSibling:n.lastChild;s.previousSibling=o,a.nextSibling=t,o?o.nextSibling=s:n.firstChild=s,t==null?n.lastChild=a:t.previousSibling=a;do s.parentNode=n;while(s!==a&&(s=s.nextSibling));return Fr(n.ownerDocument||n,n),e.nodeType==Pt&&(e.firstChild=e.lastChild=null),e}function $a(n,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=n,e.previousSibling=n.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:n.firstChild=e,n.lastChild=e,Fr(n.ownerDocument,n,e),e}Ti.prototype={nodeName:"#document",nodeType:Yn,doctype:null,documentElement:null,_inc:1,insertBefore:function(n,e){if(n.nodeType==Pt){for(var t=n.firstChild;t;){var i=t.nextSibling;this.insertBefore(t,e),t=i}return n}return ji(this,n,e),n.ownerDocument=this,this.documentElement===null&&n.nodeType===Ct&&(this.documentElement=n),n},removeChild:function(n){return this.documentElement==n&&(this.documentElement=null),ts(this,n)},replaceChild:function(n,e){ji(this,n,e,is),n.ownerDocument=this,e&&this.removeChild(e),kt(n)&&(this.documentElement=n)},importNode:function(n,e){return os(this,n,e)},getElementById:function(n){var e=null;return Ei(this.documentElement,function(t){if(t.nodeType==Ct&&t.getAttribute("id")==n)return e=t,!0}),e},getElementsByClassName:function(n){var e=fn(n);return new li(this,function(t){var i=[];return e.length>0&&Ei(t.documentElement,function(r){if(r!==t&&r.nodeType===Ct){var s=r.getAttribute("class");if(s){var a=n===s;if(!a){var o=fn(s);a=e.every(Wa(o))}a&&i.push(r)}}}),i})},createElement:function(n){var e=new Gt;e.ownerDocument=this,e.nodeName=n,e.tagName=n,e.localName=n,e.childNodes=new Ft;var t=e.attributes=new Wi;return t._ownerElement=e,e},createDocumentFragment:function(){var n=new tr;return n.ownerDocument=this,n.childNodes=new Ft,n},createTextNode:function(n){var e=new zr;return e.ownerDocument=this,e.appendData(n),e},createComment:function(n){var e=new Mr;return e.ownerDocument=this,e.appendData(n),e},createCDATASection:function(n){var e=new Ur;return e.ownerDocument=this,e.appendData(n),e},createProcessingInstruction:function(n,e){var t=new Wr;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=n,t.nodeValue=t.data=e,t},createAttribute:function(n){var e=new Hi;return e.ownerDocument=this,e.name=n,e.nodeName=n,e.localName=n,e.specified=!0,e},createEntityReference:function(n){var e=new qr;return e.ownerDocument=this,e.nodeName=n,e},createElementNS:function(n,e){var t=new Gt,i=e.split(":"),r=t.attributes=new Wi;return t.childNodes=new Ft,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=n,i.length==2?(t.prefix=i[0],t.localName=i[1]):t.localName=e,r._ownerElement=t,t},createAttributeNS:function(n,e){var t=new Hi,i=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=n,t.specified=!0,i.length==2?(t.prefix=i[0],t.localName=i[1]):t.localName=e,t}};ft(Ti,ke);function Gt(){this._nsMap={}}Gt.prototype={nodeType:Ct,hasAttribute:function(n){return this.getAttributeNode(n)!=null},getAttribute:function(n){var e=this.getAttributeNode(n);return e&&e.value||""},getAttributeNode:function(n){return this.attributes.getNamedItem(n)},setAttribute:function(n,e){var t=this.ownerDocument.createAttribute(n);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(n){var e=this.getAttributeNode(n);e&&this.removeAttributeNode(e)},appendChild:function(n){return n.nodeType===Pt?this.insertBefore(n,null):$a(this,n)},setAttributeNode:function(n){return this.attributes.setNamedItem(n)},setAttributeNodeNS:function(n){return this.attributes.setNamedItemNS(n)},removeAttributeNode:function(n){return this.attributes.removeNamedItem(n.nodeName)},removeAttributeNS:function(n,e){var t=this.getAttributeNodeNS(n,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(n,e){return this.getAttributeNodeNS(n,e)!=null},getAttributeNS:function(n,e){var t=this.getAttributeNodeNS(n,e);return t&&t.value||""},setAttributeNS:function(n,e,t){var i=this.ownerDocument.createAttributeNS(n,e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},getAttributeNodeNS:function(n,e){return this.attributes.getNamedItemNS(n,e)},getElementsByTagName:function(n){return new li(this,function(e){var t=[];return Ei(e,function(i){i!==e&&i.nodeType==Ct&&(n==="*"||i.tagName==n)&&t.push(i)}),t})},getElementsByTagNameNS:function(n,e){return new li(this,function(t){var i=[];return Ei(t,function(r){r!==t&&r.nodeType===Ct&&(n==="*"||r.namespaceURI===n)&&(e==="*"||r.localName==e)&&i.push(r)}),i})}};Ti.prototype.getElementsByTagName=Gt.prototype.getElementsByTagName;Ti.prototype.getElementsByTagNameNS=Gt.prototype.getElementsByTagNameNS;ft(Gt,ke);function Hi(){}Hi.prototype.nodeType=ui;ft(Hi,ke);function ki(){}ki.prototype={data:"",substringData:function(n,e){return this.data.substring(n,n+e)},appendData:function(n){n=this.data+n,this.nodeValue=this.data=n,this.length=n.length},insertData:function(n,e){this.replaceData(n,0,e)},appendChild:function(n){throw new Error(Je[ht])},deleteData:function(n,e){this.replaceData(n,e,"")},replaceData:function(n,e,t){var i=this.data.substring(0,n),r=this.data.substring(n+e);t=i+t+r,this.nodeValue=this.data=t,this.length=t.length}};ft(ki,ke);function zr(){}zr.prototype={nodeName:"#text",nodeType:qi,splitText:function(n){var e=this.data,t=e.substring(n);e=e.substring(0,n),this.data=this.nodeValue=e,this.length=e.length;var i=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}};ft(zr,ki);function Mr(){}Mr.prototype={nodeName:"#comment",nodeType:Gn};ft(Mr,ki);function Ur(){}Ur.prototype={nodeName:"#cdata-section",nodeType:Hn};ft(Ur,ki);function er(){}er.prototype.nodeType=Xn;ft(er,ke);function rs(){}rs.prototype.nodeType=Ha;ft(rs,ke);function ns(){}ns.prototype.nodeType=ja;ft(ns,ke);function qr(){}qr.prototype.nodeType=Vn;ft(qr,ke);function tr(){}tr.prototype.nodeName="#document-fragment";tr.prototype.nodeType=Pt;ft(tr,ke);function Wr(){}Wr.prototype.nodeType=Zn;ft(Wr,ke);function ss(){}ss.prototype.serializeToString=function(n,e,t){return as.call(n,e,t)};ke.prototype.toString=as;function as(n,e){var t=[],i=this.nodeType==9&&this.documentElement||this,r=i.prefix,s=i.namespaceURI;if(s&&r==null){var r=i.lookupPrefix(s);if(r==null)var a=[{namespace:s,prefix:null}]}return ai(this,t,n,e,a),t.join("")}function mn(n,e,t){var i=n.prefix||"",r=n.namespaceURI;if(!r||i==="xml"&&r===_i.XML||r===_i.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===i)return a.namespace!==r}return!0}function yr(n,e,t){n.push(" ",e,'="',t.replace(/[<&"]/g,Qn),'"')}function ai(n,e,t,i,r){if(r||(r=[]),i)if(n=i(n),n){if(typeof n=="string"){e.push(n);return}}else return;switch(n.nodeType){case Ct:var s=n.attributes,a=s.length,p=n.firstChild,o=n.tagName;t=_i.isHTML(n.namespaceURI)||t;var u=o;if(!t&&!n.prefix&&n.namespaceURI){for(var h,f=0;f<s.length;f++)if(s.item(f).name==="xmlns"){h=s.item(f).value;break}if(!h)for(var c=r.length-1;c>=0;c--){var b=r[c];if(b.prefix===""&&b.namespace===n.namespaceURI){h=b.namespace;break}}if(h!==n.namespaceURI)for(var c=r.length-1;c>=0;c--){var b=r[c];if(b.namespace===n.namespaceURI){b.prefix&&(u=b.prefix+":"+o);break}}}e.push("<",u);for(var g=0;g<a;g++){var S=s.item(g);S.prefix=="xmlns"?r.push({prefix:S.localName,namespace:S.value}):S.nodeName=="xmlns"&&r.push({prefix:"",namespace:S.value})}for(var g=0;g<a;g++){var S=s.item(g);if(mn(S,t,r)){var T=S.prefix||"",d=S.namespaceURI;yr(e,T?"xmlns:"+T:"xmlns",d),r.push({prefix:T,namespace:d})}ai(S,e,t,i,r)}if(o===u&&mn(n,t,r)){var T=n.prefix||"",d=n.namespaceURI;yr(e,T?"xmlns:"+T:"xmlns",d),r.push({prefix:T,namespace:d})}if(p||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(o)){if(e.push(">"),t&&/^script$/i.test(o))for(;p;)p.data?e.push(p.data):ai(p,e,t,i,r.slice()),p=p.nextSibling;else for(;p;)ai(p,e,t,i,r.slice()),p=p.nextSibling;e.push("</",u,">")}else e.push("/>");return;case Yn:case Pt:for(var p=n.firstChild;p;)ai(p,e,t,i,r.slice()),p=p.nextSibling;return;case ui:return yr(e,n.name,n.value);case qi:return e.push(n.data.replace(/[<&]/g,Qn).replace(/]]>/g,"]]&gt;"));case Hn:return e.push("<![CDATA[",n.data,"]]>");case Gn:return e.push("\x3C!--",n.data,"-->");case Xn:var y=n.publicId,D=n.systemId;if(e.push("<!DOCTYPE ",n.name),y)e.push(" PUBLIC ",y),D&&D!="."&&e.push(" ",D),e.push(">");else if(D&&D!=".")e.push(" SYSTEM ",D,">");else{var I=n.internalSubset;I&&e.push(" [",I,"]"),e.push(">")}return;case Zn:return e.push("<?",n.target," ",n.data,"?>");case Vn:return e.push("&",n.nodeName,";");default:e.push("??",n.nodeName)}}function os(n,e,t){var i;switch(e.nodeType){case Ct:i=e.cloneNode(!1),i.ownerDocument=n;case Pt:break;case ui:t=!0;break}if(i||(i=e.cloneNode(!1)),i.ownerDocument=n,i.parentNode=null,t)for(var r=e.firstChild;r;)i.appendChild(os(n,r,t)),r=r.nextSibling;return i}function Ar(n,e,t){var i=new e.constructor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var s=e[r];typeof s!="object"&&s!=i[r]&&(i[r]=s)}switch(e.childNodes&&(i.childNodes=new Ft),i.ownerDocument=n,i.nodeType){case Ct:var a=e.attributes,o=i.attributes=new Wi,u=a.length;o._ownerElement=i;for(var h=0;h<u;h++)i.setAttributeNode(Ar(n,a.item(h),!0));break;case ui:t=!0}if(t)for(var f=e.firstChild;f;)i.appendChild(Ar(n,f,t)),f=f.nextSibling;return i}function us(n,e,t){n[e]=t}try{if(Object.defineProperty){let n=function(e){switch(e.nodeType){case Ct:case Pt:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(n(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};var hl=n;Object.defineProperty(li.prototype,"length",{get:function(){return Lr(this),this.$$length}}),Object.defineProperty(ke.prototype,"textContent",{get:function(){return n(this)},set:function(e){switch(this.nodeType){case Ct:case Pt:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),us=function(e,t,i){e["$$"+t]=i}}}catch{}Vt.DocumentType=er;Vt.DOMException=We;Vt.DOMImplementation=Jn;Vt.Element=Gt;Vt.Node=ke;Vt.NodeList=Ft;Vt.XMLSerializer=ss;var Ni={},ls={};(function(n){var e=Zt.freeze;n.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),n.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ﬃ",fflig:"ﬀ",ffllig:"ﬄ",Ffr:"𝔉",ffr:"𝔣",filig:"ﬁ",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"ﬂ",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"Ĳ",ijlig:"ĳ",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ŉ",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"	",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),n.entityMap=n.HTML_ENTITIES})(ls);var jr={},xi=Zt.NAMESPACE,Dr=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,yn=new RegExp("[\\-\\.0-9"+Dr.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),bn=new RegExp("^"+Dr.source+yn.source+"*(?::"+Dr.source+yn.source+"*)?$"),vi=0,Wt=1,Jt=2,gi=3,Qt=4,ei=5,mi=6,Li=7;function hi(n,e){this.message=n,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,hi)}hi.prototype=new Error;hi.prototype.name=hi.name;function hs(){}hs.prototype={parse:function(n,e,t){var i=this.domBuilder;i.startDocument(),fs(e,e={}),Ka(n,e,t,i,this.errorHandler),i.endDocument()}};function Ka(n,e,t,i,r){function s(ue){if(ue>65535){ue-=65536;var se=55296+(ue>>10),ne=56320+(ue&1023);return String.fromCharCode(se,ne)}else return String.fromCharCode(ue)}function a(ue){var se=ue.slice(1,-1);return se in t?t[se]:se.charAt(0)==="#"?s(parseInt(se.substr(1).replace("x","0x"))):(r.error("entity not found:"+ue),ue)}function o(ue){if(ue>T){var se=n.substring(T,ue).replace(/&#?\w+;/g,a);b&&u(T),i.characters(se,0,ue-T),T=ue}}function u(ue,se){for(;ue>=f&&(se=c.exec(n));)h=se.index,f=h+se[0].length,b.lineNumber++;b.columnNumber=ue-h+1}for(var h=0,f=0,c=/.*(?:\r\n?|\n)|.*$/g,b=i.locator,g=[{currentNSMap:e}],S={},T=0;;){try{var d=n.indexOf("<",T);if(d<0){if(!n.substr(T).match(/^\s*$/)){var p=i.doc,y=p.createTextNode(n.substr(T));p.appendChild(y),i.currentElement=y}return}switch(d>T&&o(d),n.charAt(d+1)){case"/":var H=n.indexOf(">",d+3),D=n.substring(d+2,H).replace(/[ \t\n\r]+$/g,""),I=g.pop();H<0?(D=n.substring(d+2).replace(/[\s<].*/,""),r.error("end tag name: "+D+" is not complete:"+I.tagName),H=d+1+D.length):D.match(/\s</)&&(D=D.replace(/[\s<].*/,""),r.error("end tag name: "+D+" maybe not complete"),H=d+1+D.length);var w=I.localNSMap,A=I.tagName==D,C=A||I.tagName&&I.tagName.toLowerCase()==D.toLowerCase();if(C){if(i.endElement(I.uri,I.localName,D),w)for(var R in w)Object.prototype.hasOwnProperty.call(w,R)&&i.endPrefixMapping(R);A||r.fatalError("end tag name: "+D+" is not match the current start tagName:"+I.tagName)}else g.push(I);H++;break;case"?":b&&u(d),H=io(n,d,i);break;case"!":b&&u(d),H=to(n,d,i,r);break;default:b&&u(d);var z=new cs,P=g[g.length-1].currentNSMap,H=Ja(n,d,z,P,a,r),V=z.length;if(!z.closed&&eo(n,H,z.tagName,S)&&(z.closed=!0,t.nbsp||r.warning("unclosed xml attribute")),b&&V){for(var te=wn(b,{}),ce=0;ce<V;ce++){var he=z[ce];u(he.offset),he.locator=wn(b,{})}i.locator=te,_n(z,i,P)&&g.push(z),i.locator=b}else _n(z,i,P)&&g.push(z);xi.isHTML(z.uri)&&!z.closed?H=Qa(n,H,z.tagName,a,i):H++}}catch(ue){if(ue instanceof hi)throw ue;r.error("element parse error: "+ue),H=-1}H>T?T=H:o(Math.max(d,T)+1)}}function wn(n,e){return e.lineNumber=n.lineNumber,e.columnNumber=n.columnNumber,e}function Ja(n,e,t,i,r,s){function a(b,g,S){t.attributeNames.hasOwnProperty(b)&&s.fatalError("Attribute "+b+" redefined"),t.addValue(b,g,S)}for(var o,u,h=++e,f=vi;;){var c=n.charAt(h);switch(c){case"=":if(f===Wt)o=n.slice(e,h),f=gi;else if(f===Jt)f=gi;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(f===gi||f===Wt)if(f===Wt&&(s.warning('attribute value must after "="'),o=n.slice(e,h)),e=h+1,h=n.indexOf(c,e),h>0)u=n.slice(e,h).replace(/&#?\w+;/g,r),a(o,u,e-1),f=ei;else throw new Error("attribute value no end '"+c+"' match");else if(f==Qt)u=n.slice(e,h).replace(/&#?\w+;/g,r),a(o,u,e),s.warning('attribute "'+o+'" missed start quot('+c+")!!"),e=h+1,f=ei;else throw new Error('attribute value must after "="');break;case"/":switch(f){case vi:t.setTagName(n.slice(e,h));case ei:case mi:case Li:f=Li,t.closed=!0;case Qt:case Wt:break;case Jt:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),f==vi&&t.setTagName(n.slice(e,h)),h;case">":switch(f){case vi:t.setTagName(n.slice(e,h));case ei:case mi:case Li:break;case Qt:case Wt:u=n.slice(e,h),u.slice(-1)==="/"&&(t.closed=!0,u=u.slice(0,-1));case Jt:f===Jt&&(u=o),f==Qt?(s.warning('attribute "'+u+'" missed quot(")!'),a(o,u.replace(/&#?\w+;/g,r),e)):((!xi.isHTML(i[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case gi:throw new Error("attribute value missed!!")}return h;case"":c=" ";default:if(c<=" ")switch(f){case vi:t.setTagName(n.slice(e,h)),f=mi;break;case Wt:o=n.slice(e,h),f=Jt;break;case Qt:var u=n.slice(e,h).replace(/&#?\w+;/g,r);s.warning('attribute "'+u+'" missed quot(")!!'),a(o,u,e);case ei:f=mi;break}else switch(f){case Jt:t.tagName,(!xi.isHTML(i[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=h,f=Wt;break;case ei:s.warning('attribute space is required"'+o+'"!!');case mi:f=Wt,e=h;break;case gi:f=Qt,e=h;break;case Li:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function _n(n,e,t){for(var i=n.tagName,r=null,c=n.length;c--;){var s=n[c],a=s.qName,o=s.value,b=a.indexOf(":");if(b>0)var u=s.prefix=a.slice(0,b),h=a.slice(b+1),f=u==="xmlns"&&h;else h=a,u=null,f=a==="xmlns"&&"";s.localName=h,f!==!1&&(r==null&&(r={},fs(t,t={})),t[f]=r[f]=o,s.uri=xi.XMLNS,e.startPrefixMapping(f,o))}for(var c=n.length;c--;){s=n[c];var u=s.prefix;u&&(u==="xml"&&(s.uri=xi.XML),u!=="xmlns"&&(s.uri=t[u||""]))}var b=i.indexOf(":");b>0?(u=n.prefix=i.slice(0,b),h=n.localName=i.slice(b+1)):(u=null,h=n.localName=i);var g=n.uri=t[u||""];if(e.startElement(g,h,i,n),n.closed){if(e.endElement(g,h,i),r)for(u in r)Object.prototype.hasOwnProperty.call(r,u)&&e.endPrefixMapping(u)}else return n.currentNSMap=t,n.localNSMap=r,!0}function Qa(n,e,t,i,r){if(/^(?:script|textarea)$/i.test(t)){var s=n.indexOf("</"+t+">",e),a=n.substring(e+1,s);if(/[&<]/.test(a))return/^script$/i.test(t)?(r.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,i),r.characters(a,0,a.length),s)}return e+1}function eo(n,e,t,i){var r=i[t];return r==null&&(r=n.lastIndexOf("</"+t+">"),r<e&&(r=n.lastIndexOf("</"+t)),i[t]=r),r<e}function fs(n,e){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}function to(n,e,t,i){var r=n.charAt(e+2);switch(r){case"-":if(n.charAt(e+3)==="-"){var s=n.indexOf("-->",e+4);return s>e?(t.comment(n,e+4,s-e-4),s+3):(i.error("Unclosed comment"),-1)}else return-1;default:if(n.substr(e+3,6)=="CDATA["){var s=n.indexOf("]]>",e+9);return t.startCDATA(),t.characters(n,e+9,s-e-9),t.endCDATA(),s+3}var a=ro(n,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],h=!1,f=!1;o>3&&(/^public$/i.test(a[2][0])?(h=a[3][0],f=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(f=a[3][0]));var c=a[o-1];return t.startDTD(u,h,f),t.endDTD(),c.index+c[0].length}}return-1}function io(n,e,t){var i=n.indexOf("?>",e);if(i){var r=n.substring(e,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,t.processingInstruction(r[1],r[2]),i+2):-1}return-1}function cs(){this.attributeNames={}}cs.prototype={setTagName:function(n){if(!bn.test(n))throw new Error("invalid tagName:"+n);this.tagName=n},addValue:function(n,e,t){if(!bn.test(n))throw new Error("invalid attribute:"+n);this.attributeNames[n]=this.length,this[this.length++]={qName:n,value:e,offset:t}},length:0,getLocalName:function(n){return this[n].localName},getLocator:function(n){return this[n].locator},getQName:function(n){return this[n].qName},getURI:function(n){return this[n].uri},getValue:function(n){return this[n].value}};function ro(n,e){var t,i=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=e,r.exec(n);t=r.exec(n);)if(i.push(t),t[1])return i}jr.XMLReader=hs;jr.ParseError=hi;var no=Zt,Hr=Vt,En=ls,ds=jr,so=Hr.DOMImplementation,xn=no.NAMESPACE,ao=ds.ParseError,oo=ds.XMLReader;function ps(n){this.options=n||{locator:{}}}ps.prototype.parseFromString=function(n,e){var t=this.options,i=new oo,r=t.domBuilder||new Ri,s=t.errorHandler,a=t.locator,o=t.xmlns||{},u=/\/x?html?$/.test(e),h=u?En.HTML_ENTITIES:En.XML_ENTITIES;return a&&r.setDocumentLocator(a),i.errorHandler=uo(s,r,a),i.domBuilder=t.domBuilder||r,u&&(o[""]=xn.HTML),o.xml=o.xml||xn.XML,n&&typeof n=="string"?i.parse(n,o,h):i.errorHandler.error("invalid doc source"),r.doc};function uo(n,e,t){if(!n){if(e instanceof Ri)return e;n=e}var i={},r=n instanceof Function;t=t||{};function s(a){var o=n[a];!o&&r&&(o=n.length==2?function(u){n(a,u)}:n),i[a]=o&&function(u){o("[xmldom "+a+"]	"+u+Cr(t))}||function(){}}return s("warning"),s("error"),s("fatalError"),i}function Ri(){this.cdata=!1}function ti(n,e){e.lineNumber=n.lineNumber,e.columnNumber=n.columnNumber}Ri.prototype={startDocument:function(){this.doc=new so().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(n,e,t,i){var r=this.doc,s=r.createElementNS(n,t||e),a=i.length;Fi(this,s),this.currentElement=s,this.locator&&ti(this.locator,s);for(var o=0;o<a;o++){var n=i.getURI(o),u=i.getValue(o),t=i.getQName(o),h=r.createAttributeNS(n,t);this.locator&&ti(i.getLocator(o),h),h.value=h.nodeValue=u,s.setAttributeNode(h)}},endElement:function(n,e,t){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(n,e){},endPrefixMapping:function(n){},processingInstruction:function(n,e){var t=this.doc.createProcessingInstruction(n,e);this.locator&&ti(this.locator,t),Fi(this,t)},ignorableWhitespace:function(n,e,t){},characters:function(n,e,t){if(n=An.apply(this,arguments),n){if(this.cdata)var i=this.doc.createCDATASection(n);else var i=this.doc.createTextNode(n);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(n)&&this.doc.appendChild(i),this.locator&&ti(this.locator,i)}},skippedEntity:function(n){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(n){(this.locator=n)&&(n.lineNumber=0)},comment:function(n,e,t){n=An.apply(this,arguments);var i=this.doc.createComment(n);this.locator&&ti(this.locator,i),Fi(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(n,e,t){var i=this.doc.implementation;if(i&&i.createDocumentType){var r=i.createDocumentType(n,e,t);this.locator&&ti(this.locator,r),Fi(this,r),this.doc.doctype=r}},warning:function(n){console.warn("[xmldom warning]	"+n,Cr(this.locator))},error:function(n){console.error("[xmldom error]	"+n,Cr(this.locator))},fatalError:function(n){throw new ao(n,this.locator)}};function Cr(n){if(n)return`
@`+(n.systemId||"")+"#[line:"+n.lineNumber+",col:"+n.columnNumber+"]"}function An(n,e,t){return typeof n=="string"?n.substr(e,t):n.length>=e+t||e?new java.lang.String(n,e,t)+"":n}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(n){Ri.prototype[n]=function(){return null}});function Fi(n,e){n.currentElement?n.currentElement.appendChild(e):n.doc.appendChild(e)}Ni.__DOMHandler=Ri;Ni.DOMParser=ps;Ni.DOMImplementation=Hr.DOMImplementation;Ni.XMLSerializer=Hr.XMLSerializer;var vs=Ni.DOMParser;const Vr=typeof window<"u"?window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame:!1,lo=1,ho=3,gs=typeof URL<"u"?URL:typeof window<"u"?window.URL||window.webkitURL||window.mozURL:void 0;function ir(){var n=new Date().getTime(),e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var i=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(t=="x"?i:i&7|8).toString(16)});return e}function fo(){return Math.max(document.documentElement.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight)}function ms(n){return!!(n&&n.nodeType==1)}function ze(n){return!isNaN(parseFloat(n))&&isFinite(n)}function ys(n){let e=parseFloat(n);return ze(n)===!1?!1:typeof n=="string"&&n.indexOf(".")>-1?!0:Math.floor(e)!==e}function ri(n){var e=["Webkit","webkit","Moz","O","ms"],t=["-webkit-","-webkit-","-moz-","-o-","-ms-"],i=n.toLowerCase(),r=e.length;if(typeof document>"u"||typeof document.body.style[i]<"u")return n;for(var s=0;s<r;s++)if(typeof document.body.style[t[s]+i]<"u")return t[s]+i;return n}function bs(n){for(var e=1,t=arguments.length;e<t;e++){var i=arguments[e];for(var r in i)n[r]===void 0&&(n[r]=i[r])}return n}function et(n){var e=[].slice.call(arguments,1);return e.forEach(function(t){t&&Object.getOwnPropertyNames(t).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}),n}function co(n,e,t){var i=fi(n,e,t);return e.splice(i,0,n),i}function fi(n,e,t,i,r){var s=i||0,a=r||e.length,o=parseInt(s+(a-s)/2),u;return t||(t=function(h,f){if(h>f)return 1;if(h<f)return-1;if(h==f)return 0}),a-s<=0?o:(u=t(e[o],n),a-s===1?u>=0?o:o+1:u===0?o:u===-1?fi(n,e,t,o,a):fi(n,e,t,s,o))}function Vi(n,e,t,i,r){var s=i||0,a=r||e.length,o=parseInt(s+(a-s)/2),u;return t||(t=function(h,f){if(h>f)return 1;if(h<f)return-1;if(h==f)return 0}),a-s<=0?-1:(u=t(e[o],n),a-s===1?u===0?o:-1:u===0?o:u===-1?Vi(n,e,t,o,a):Vi(n,e,t,s,o))}function zi(n){var e=window.getComputedStyle(n),t=["width","paddingRight","paddingLeft","marginRight","marginLeft","borderRightWidth","borderLeftWidth"],i=["height","paddingTop","paddingBottom","marginTop","marginBottom","borderTopWidth","borderBottomWidth"],r=0,s=0;return t.forEach(function(a){r+=parseFloat(e[a])||0}),i.forEach(function(a){s+=parseFloat(e[a])||0}),{height:s,width:r}}function Zi(n){var e=window.getComputedStyle(n),t=["paddingRight","paddingLeft","marginRight","marginLeft","borderRightWidth","borderLeftWidth"],i=["paddingTop","paddingBottom","marginTop","marginBottom","borderTopWidth","borderBottomWidth"],r=0,s=0;return t.forEach(function(a){r+=parseFloat(e[a])||0}),i.forEach(function(a){s+=parseFloat(e[a])||0}),{height:s,width:r}}function Sr(n){let e,t=n.ownerDocument;if(n.nodeType==Node.TEXT_NODE){let i=t.createRange();i.selectNodeContents(n),e=i.getBoundingClientRect()}else e=n.getBoundingClientRect();return e}function Gi(){var n=window.innerWidth,e=window.innerHeight;return{top:0,left:0,right:n,bottom:e,width:n,height:e}}function Zr(n,e){for(var t=n.parentNode,i=t.childNodes,r,s=-1,a=0;a<i.length&&(r=i[a],r.nodeType===e&&s++,r!=n);a++);return s}function po(n){return Zr(n,ho)}function ws(n){return Zr(n,lo)}function Ai(n){return["xml","opf","ncx"].indexOf(n)>-1}function _s(n,e){return new Blob([n],{type:e})}function Yi(n,e){var t,i=_s(n,e);return t=gs.createObjectURL(i),t}function Es(n){return gs.revokeObjectURL(n)}function Tr(n,e){var t,i;if(typeof n=="string")return t=btoa(n),i="data:"+e+";base64,"+t,i}function xs(n){return Object.prototype.toString.call(n).slice(8,-1)}function Nt(n,e,t){var i,r;return typeof DOMParser>"u"||t?r=vs:r=DOMParser,n.charCodeAt(0)===65279&&(n=n.slice(1)),i=new r().parseFromString(n,e),i}function Ne(n,e){var t;if(!n)throw new Error("No Element Provided");if(typeof n.querySelector<"u")return n.querySelector(e);if(t=n.getElementsByTagName(e),t.length)return t[0]}function Mt(n,e){return typeof n.querySelector<"u"?n.querySelectorAll(e):n.getElementsByTagName(e)}function ni(n,e,t){var i,r;if(typeof n.querySelector<"u"){e+="[";for(var s in t)e+=s+"~='"+t[s]+"'";return e+="]",n.querySelector(e)}else if(i=n.getElementsByTagName(e),r=Array.prototype.slice.call(i,0).filter(function(a){for(var o in t)if(a.getAttribute(o)===t[o])return!0;return!1}),r)return r[0]}function Xi(n,e){var t=n.ownerDocument||n;typeof t.createTreeWalker<"u"?As(n,e,NodeFilter.SHOW_TEXT):Gr(n,function(i){i&&i.nodeType===3&&e(i)})}function As(n,e,t){var i=document.createTreeWalker(n,t,null,!1);let r;for(;r=i.nextNode();)e(r)}function Gr(n,e){if(e(n))return!0;if(n=n.firstChild,n)do{if(Gr(n,e))return!0;n=n.nextSibling}while(n)}function Ds(n){return new Promise(function(e,t){var i=new FileReader;i.readAsDataURL(n),i.onloadend=function(){e(i.result)}})}function be(){this.resolve=null,this.reject=null,this.id=ir(),this.promise=new Promise((n,e)=>{this.resolve=n,this.reject=e}),Object.freeze(this)}function $i(n,e,t){var i;if(typeof n.querySelector<"u"&&(i=n.querySelector(`${e}[*|type="${t}"]`)),!i||i.length===0){i=Mt(n,e);for(var r=0;r<i.length;r++)if(i[r].getAttributeNS("http://www.idpf.org/2007/ops","type")===t||i[r].getAttribute("epub:type")===t)return i[r]}else return i}function kr(n){for(var e=[],t=n.childNodes,i=0;i<t.length;i++){let r=t[i];r.nodeType===1&&e.push(r)}return e}function Nr(n){for(var e=[n];n;n=n.parentNode)e.unshift(n);return e}function si(n,e,t){for(var i=[],r=n.childNodes,s=0;s<r.length;s++){let a=r[s];if(a.nodeType===1&&a.nodeName.toLowerCase()===e){if(t)return a;i.push(a)}}if(!t)return i}function vo(n,e){let t;if(!(n===null||e===""))for(t=n.parentNode;t.nodeType===1;){if(t.tagName.toLowerCase()===e)return t;t=t.parentNode}}class Cs{constructor(){this.collapsed=!1,this.commonAncestorContainer=void 0,this.endContainer=void 0,this.endOffset=void 0,this.startContainer=void 0,this.startOffset=void 0}setStart(e,t){this.startContainer=e,this.startOffset=t,this.endContainer?this.commonAncestorContainer=this._commonAncestorContainer():this.collapse(!0),this._checkCollapsed()}setEnd(e,t){this.endContainer=e,this.endOffset=t,this.startContainer?(this.collapsed=!1,this.commonAncestorContainer=this._commonAncestorContainer()):this.collapse(!1),this._checkCollapsed()}collapse(e){this.collapsed=!0,e?(this.endContainer=this.startContainer,this.endOffset=this.startOffset,this.commonAncestorContainer=this.startContainer.parentNode):(this.startContainer=this.endContainer,this.startOffset=this.endOffset,this.commonAncestorContainer=this.endOffset.parentNode)}selectNode(e){let t=e.parentNode,i=Array.prototype.indexOf.call(t.childNodes,e);this.setStart(t,i),this.setEnd(t,i+1)}selectNodeContents(e){e.childNodes[e.childNodes-1];let t=e.nodeType===3?e.textContent.length:parent.childNodes.length;this.setStart(e,0),this.setEnd(e,t)}_commonAncestorContainer(e,t){var i=Nr(e||this.startContainer),r=Nr(t||this.endContainer);if(i[0]==r[0]){for(var s=0;s<i.length;s++)if(i[s]!=r[s])return i[s-1]}}_checkCollapsed(){this.startContainer===this.endContainer&&this.startOffset===this.endOffset?this.collapsed=!0:this.collapsed=!1}toString(){}}const go=Object.freeze(Object.defineProperty({__proto__:null,RangeObject:Cs,blob2base64:Ds,borders:Zi,bounds:zi,createBase64Url:Tr,createBlob:_s,createBlobUrl:Yi,defaults:bs,defer:be,documentHeight:fo,extend:et,filterChildren:si,findChildren:kr,getParentByTagName:vo,indexOfElementNode:ws,indexOfNode:Zr,indexOfSorted:Vi,indexOfTextNode:po,insert:co,isElement:ms,isFloat:ys,isNumber:ze,isXml:Ai,locationOf:fi,nodeBounds:Sr,parents:Nr,parse:Nt,prefixed:ri,qs:Ne,qsa:Mt,qsp:ni,querySelectorByType:$i,requestAnimationFrame:Vr,revokeBlobUrl:Es,sprint:Xi,treeWalker:As,type:xs,uuid:ir,walk:Gr,windowBounds:Gi},Symbol.toStringTag,{value:"Module"}));if(!Ss)var Ss={cwd:function(){return"/"}};function St(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+n)}function Dn(n,e){for(var t="",i=-1,r=0,s,a=0;a<=n.length;++a){if(a<n.length)s=n.charCodeAt(a);else{if(s===47)break;s=47}if(s===47){if(!(i===a-1||r===1))if(i!==a-1&&r===2){if(t.length<2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){for(var o=t.length-1,u=o;u>=0&&t.charCodeAt(u)!==47;--u);if(u!==o){u===-1?t="":t=t.slice(0,u),i=a,r=0;continue}}else if(t.length===2||t.length===1){t="",i=a,r=0;continue}}e&&(t.length>0?t+="/..":t="..")}else t.length>0?t+="/"+n.slice(i+1,a):t=n.slice(i+1,a);i=a,r=0}else s===46&&r!==-1?++r:r=-1}return t}function mo(n,e){var t=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+i:t+n+i:i}var Mi={resolve:function(){for(var e="",t=!1,i,r=arguments.length-1;r>=-1&&!t;r--){var s;r>=0?s=arguments[r]:(i===void 0&&(i=Ss.cwd()),s=i),St(s),s.length!==0&&(e=s+"/"+e,t=s.charCodeAt(0)===47)}return e=Dn(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(St(e),e.length===0)return".";var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=Dn(e,!t),e.length===0&&!t&&(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return St(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];St(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":Mi.normalize(e)},relative:function(e,t){if(St(e),St(t),e===t||(e=Mi.resolve(e),t=Mi.resolve(t),e===t))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var r=e.length,s=r-i,a=1;a<t.length&&t.charCodeAt(a)===47;++a);for(var o=t.length,u=o-a,h=s<u?s:u,f=-1,c=0;c<=h;++c){if(c===h){if(u>h){if(t.charCodeAt(a+c)===47)return t.slice(a+c+1);if(c===0)return t.slice(a+c)}else s>h&&(e.charCodeAt(i+c)===47?f=c:c===0&&(f=0));break}var b=e.charCodeAt(i+c),g=t.charCodeAt(a+c);if(b!==g)break;b===47&&(f=c)}var S="";for(c=i+f+1;c<=r;++c)(c===r||e.charCodeAt(c)===47)&&(S.length===0?S+="..":S+="/..");return S.length>0?S+t.slice(a+f):(a+=f,t.charCodeAt(a)===47&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(St(e),e.length===0)return".";for(var t=e.charCodeAt(0),i=t===47,r=-1,s=!0,a=e.length-1;a>=1;--a)if(t=e.charCodeAt(a),t===47){if(!s){r=a;break}}else s=!1;return r===-1?i?"/":".":i&&r===1?"//":e.slice(0,r)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');St(e);var i=0,r=-1,s=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,u=-1;for(a=e.length-1;a>=0;--a){var h=e.charCodeAt(a);if(h===47){if(!s){i=a+1;break}}else u===-1&&(s=!1,u=a+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(r=a):(o=-1,r=u))}return i===r?r=u:r===-1&&(r=e.length),e.slice(i,r)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!s){i=a+1;break}}else r===-1&&(s=!1,r=a+1);return r===-1?"":e.slice(i,r)}},extname:function(e){St(e);for(var t=-1,i=0,r=-1,s=!0,a=0,o=e.length-1;o>=0;--o){var u=e.charCodeAt(o);if(u===47){if(!s){i=o+1;break}continue}r===-1&&(s=!1,r=o+1),u===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===i+1?"":e.slice(t,r)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('Parameter "pathObject" must be an object, not '+typeof e);return mo("/",e)},parse:function(e){St(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var i=e.charCodeAt(0),r=i===47,s;r?(t.root="/",s=1):s=0;for(var a=-1,o=0,u=-1,h=!0,f=e.length-1,c=0;f>=s;--f){if(i=e.charCodeAt(f),i===47){if(!h){o=f+1;break}continue}u===-1&&(h=!1,u=f+1),i===46?a===-1?a=f:c!==1&&(c=1):a!==-1&&(c=-1)}return a===-1||u===-1||c===0||c===1&&a===u-1&&a===o+1?u!==-1&&(o===0&&r?t.base=t.name=e.slice(1,u):t.base=t.name=e.slice(o,u)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,u)):(t.name=e.slice(o,a),t.base=e.slice(o,u)),t.ext=e.slice(a,u)),o>0?t.dir=e.slice(0,o-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",posix:null},yo=Mi;const jt=ci(yo);class Ut{constructor(e){var t,i;t=e.indexOf("://"),t>-1&&(e=new URL(e).pathname),i=this.parse(e),this.path=e,this.isDirectory(e)?this.directory=e:this.directory=i.dir+"/",this.filename=i.base,this.extension=i.ext.slice(1)}parse(e){return jt.parse(e)}isAbsolute(e){return jt.isAbsolute(e||this.path)}isDirectory(e){return e.charAt(e.length-1)==="/"}resolve(e){return jt.resolve(this.directory,e)}relative(e){var t=e&&e.indexOf("://")>-1;return t?e:jt.relative(this.directory,e)}splitPath(e){return this.splitPathRe.exec(e).slice(1)}toString(){return this.path}}class At{constructor(e,t){var i=e.indexOf("://")>-1,r=e,s;if(this.Url=void 0,this.href=e,this.protocol="",this.origin="",this.hash="",this.hash="",this.search="",this.base=t,!i&&t!==!1&&typeof t!="string"&&window&&window.location&&(this.base=window.location.href),i||this.base)try{this.base?this.Url=new URL(e,this.base):this.Url=new URL(e),this.href=this.Url.href,this.protocol=this.Url.protocol,this.origin=this.Url.origin,this.hash=this.Url.hash,this.search=this.Url.search,r=this.Url.pathname+(this.Url.search?this.Url.search:"")}catch{this.Url=void 0,this.base&&(s=new Ut(this.base),r=s.resolve(r))}this.Path=new Ut(r),this.directory=this.Path.directory,this.filename=this.Path.filename,this.extension=this.Path.extension}path(){return this.Path}resolve(e){var t=e.indexOf("://")>-1,i;return t?e:(i=jt.resolve(this.directory,e),this.origin+i)}relative(e){return jt.relative(e,this.directory)}toString(){return this.href}}const ii=1,vt=3,bo=9;class we{constructor(e,t,i){var r;if(this.str="",this.base={},this.spinePos=0,this.range=!1,this.path={},this.start=null,this.end=null,!(this instanceof we))return new we(e,t,i);if(typeof t=="string"?this.base=this.parseComponent(t):typeof t=="object"&&t.steps&&(this.base=t),r=this.checkType(e),r==="string")return this.str=e,et(this,this.parse(e));if(r==="range")return et(this,this.fromRange(e,this.base,i));if(r==="node")return et(this,this.fromNode(e,this.base,i));if(r==="EpubCFI"&&e.path)return e;if(e)throw new TypeError("not a valid argument for EpubCFI");return this}checkType(e){return this.isCfiString(e)?"string":e&&typeof e=="object"&&(xs(e)==="Range"||typeof e.startContainer<"u")?"range":e&&typeof e=="object"&&typeof e.nodeType<"u"?"node":e&&typeof e=="object"&&e instanceof we?"EpubCFI":!1}parse(e){var t={spinePos:-1,range:!1,base:{},path:{},start:null,end:null},i,r,s;return typeof e!="string"?{spinePos:-1}:(e.indexOf("epubcfi(")===0&&e[e.length-1]===")"&&(e=e.slice(8,e.length-1)),i=this.getChapterComponent(e),i?(t.base=this.parseComponent(i),r=this.getPathComponent(e),t.path=this.parseComponent(r),s=this.getRange(e),s&&(t.range=!0,t.start=this.parseComponent(s[0]),t.end=this.parseComponent(s[1])),t.spinePos=t.base.steps[1].index,t):{spinePos:-1})}parseComponent(e){var t={steps:[],terminal:{offset:null,assertion:null}},i=e.split(":"),r=i[0].split("/"),s;return i.length>1&&(s=i[1],t.terminal=this.parseTerminal(s)),r[0]===""&&r.shift(),t.steps=r.map(function(a){return this.parseStep(a)}.bind(this)),t}parseStep(e){var t,i,r,s,a;if(s=e.match(/\[(.*)\]/),s&&s[1]&&(a=s[1]),i=parseInt(e),!isNaN(i))return i%2===0?(t="element",r=i/2-1):(t="text",r=(i-1)/2),{type:t,index:r,id:a||null}}parseTerminal(e){var t,i,r=e.match(/\[(.*)\]/);return r&&r[1]?(t=parseInt(e.split("[")[0]),i=r[1]):t=parseInt(e),ze(t)||(t=null),{offset:t,assertion:i}}getChapterComponent(e){var t=e.split("!");return t[0]}getPathComponent(e){var t=e.split("!");if(t[1])return t[1].split(",")[0]}getRange(e){var t=e.split(",");return t.length===3?[t[1],t[2]]:!1}getCharecterOffsetComponent(e){var t=e.split(":");return t[1]||""}joinSteps(e){return e?e.map(function(t){var i="";return t.type==="element"&&(i+=(t.index+1)*2),t.type==="text"&&(i+=1+2*t.index),t.id&&(i+="["+t.id+"]"),i}).join("/"):""}segmentString(e){var t="/";return t+=this.joinSteps(e.steps),e.terminal&&e.terminal.offset!=null&&(t+=":"+e.terminal.offset),e.terminal&&e.terminal.assertion!=null&&(t+="["+e.terminal.assertion+"]"),t}toString(){var e="epubcfi(";return e+=this.segmentString(this.base),e+="!",e+=this.segmentString(this.path),this.range&&this.start&&(e+=",",e+=this.segmentString(this.start)),this.range&&this.end&&(e+=",",e+=this.segmentString(this.end)),e+=")",e}compare(e,t){var i,r,s,a;if(typeof e=="string"&&(e=new we(e)),typeof t=="string"&&(t=new we(t)),e.spinePos>t.spinePos)return 1;if(e.spinePos<t.spinePos)return-1;e.range?(i=e.path.steps.concat(e.start.steps),s=e.start.terminal):(i=e.path.steps,s=e.path.terminal),t.range?(r=t.path.steps.concat(t.start.steps),a=t.start.terminal):(r=t.path.steps,a=t.path.terminal);for(var o=0;o<i.length;o++){if(!i[o])return-1;if(!r[o]||i[o].index>r[o].index)return 1;if(i[o].index<r[o].index)return-1}return i.length<r.length?-1:s.offset>a.offset?1:s.offset<a.offset?-1:0}step(e){var t=e.nodeType===vt?"text":"element";return{id:e.id,tagName:e.tagName,type:t,index:this.position(e)}}filteredStep(e,t){var i=this.filter(e,t),r;if(i)return r=i.nodeType===vt?"text":"element",{id:i.id,tagName:i.tagName,type:r,index:this.filteredPosition(i,t)}}pathTo(e,t,i){for(var r={steps:[],terminal:{offset:null,assertion:null}},s=e,a;s&&s.parentNode&&s.parentNode.nodeType!=bo;)i?a=this.filteredStep(s,i):a=this.step(s),a&&r.steps.unshift(a),s=s.parentNode;return t!=null&&t>=0&&(r.terminal.offset=t,r.steps[r.steps.length-1].type!="text"&&r.steps.push({type:"text",index:0})),r}equalStep(e,t){return!e||!t?!1:e.index===t.index&&e.id===t.id&&e.type===t.type}fromRange(e,t,i){var r={range:!1,base:{},path:{},start:null,end:null},s=e.startContainer,a=e.endContainer,o=e.startOffset,u=e.endOffset,h=!1;if(i&&(h=s.ownerDocument.querySelector("."+i)!=null),typeof t=="string"?(r.base=this.parseComponent(t),r.spinePos=r.base.steps[1].index):typeof t=="object"&&(r.base=t),e.collapsed)h&&(o=this.patchOffset(s,o,i)),r.path=this.pathTo(s,o,i);else{r.range=!0,h&&(o=this.patchOffset(s,o,i)),r.start=this.pathTo(s,o,i),h&&(u=this.patchOffset(a,u,i)),r.end=this.pathTo(a,u,i),r.path={steps:[],terminal:null};var f=r.start.steps.length,c;for(c=0;c<f&&this.equalStep(r.start.steps[c],r.end.steps[c]);c++)c===f-1?r.start.terminal===r.end.terminal&&(r.path.steps.push(r.start.steps[c]),r.range=!1):r.path.steps.push(r.start.steps[c]);r.start.steps=r.start.steps.slice(r.path.steps.length),r.end.steps=r.end.steps.slice(r.path.steps.length)}return r}fromNode(e,t,i){var r={range:!1,base:{},path:{},start:null,end:null};return typeof t=="string"?(r.base=this.parseComponent(t),r.spinePos=r.base.steps[1].index):typeof t=="object"&&(r.base=t),r.path=this.pathTo(e,null,i),r}filter(e,t){var i,r,s,a,o,u=!1;return e.nodeType===vt?(u=!0,s=e.parentNode,i=e.parentNode.classList.contains(t)):(u=!1,i=e.classList.contains(t)),i&&u?(a=s.previousSibling,o=s.nextSibling,a&&a.nodeType===vt?r=a:o&&o.nodeType===vt&&(r=o),r||e):i&&!u?!1:e}patchOffset(e,t,i){if(e.nodeType!=vt)throw new Error("Anchor must be a text node");var r=e,s=t;for(e.parentNode.classList.contains(i)&&(r=e.parentNode);r.previousSibling;){if(r.previousSibling.nodeType===ii)if(r.previousSibling.classList.contains(i))s+=r.previousSibling.textContent.length;else break;else s+=r.previousSibling.textContent.length;r=r.previousSibling}return s}normalizedMap(e,t,i){var r={},s=-1,a,o=e.length,u,h;for(a=0;a<o;a++)u=e[a].nodeType,u===ii&&e[a].classList.contains(i)&&(u=vt),a>0&&u===vt&&h===vt?r[a]=s:t===u&&(s=s+1,r[a]=s),h=u;return r}position(e){var t,i;return e.nodeType===ii?(t=e.parentNode.children,t||(t=kr(e.parentNode)),i=Array.prototype.indexOf.call(t,e)):(t=this.textNodes(e.parentNode),i=t.indexOf(e)),i}filteredPosition(e,t){var i,r,s;return e.nodeType===ii?(i=e.parentNode.children,s=this.normalizedMap(i,ii,t)):(i=e.parentNode.childNodes,e.parentNode.classList.contains(t)&&(e=e.parentNode,i=e.parentNode.childNodes),s=this.normalizedMap(i,vt,t)),r=Array.prototype.indexOf.call(i,e),s[r]}stepsToXpath(e){var t=[".","*"];return e.forEach(function(i){var r=i.index+1;i.id?t.push("*[position()="+r+" and @id='"+i.id+"']"):i.type==="text"?t.push("text()["+r+"]"):t.push("*["+r+"]")}),t.join("/")}stepsToQuerySelector(e){var t=["html"];return e.forEach(function(i){var r=i.index+1;i.id?t.push("#"+i.id):i.type==="text"||t.push("*:nth-child("+r+")")}),t.join(">")}textNodes(e,t){return Array.prototype.slice.call(e.childNodes).filter(function(i){return i.nodeType===vt?!0:!!(t&&i.classList.contains(t))})}walkToNode(e,t,i){var r=t||document,s=r.documentElement,a,o,u=e.length,h;for(h=0;h<u&&(o=e[h],o.type==="element"?o.id?s=r.getElementById(o.id):(a=s.children||kr(s),s=a[o.index]):o.type==="text"&&(s=this.textNodes(s,i)[o.index]),!!s);h++);return s}findNode(e,t,i){var r=t||document,s,a;return!i&&typeof r.evaluate<"u"?(a=this.stepsToXpath(e),s=r.evaluate(a,r,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue):i?s=this.walkToNode(e,r,i):s=this.walkToNode(e,r),s}fixMiss(e,t,i,r){var s=this.findNode(e.slice(0,-1),i,r),a=s.childNodes,o=this.normalizedMap(a,vt,r),u,h,f=e[e.length-1].index;for(let c in o){if(!o.hasOwnProperty(c))return;if(o[c]===f)if(u=a[c],h=u.textContent.length,t>h)t=t-h;else{u.nodeType===ii?s=u.childNodes[0]:s=u;break}}return{container:s,offset:t}}toRange(e,t){var i=e||document,r,s,a,o,u,h=this,f,c,b=t?i.querySelector("."+t)!=null:!1,g;if(typeof i.createRange<"u"?r=i.createRange():r=new Cs,h.range?(s=h.start,f=h.path.steps.concat(s.steps),o=this.findNode(f,i,b?t:null),a=h.end,c=h.path.steps.concat(a.steps),u=this.findNode(c,i,b?t:null)):(s=h.path,f=h.path.steps,o=this.findNode(h.path.steps,i,b?t:null)),o)try{s.terminal.offset!=null?r.setStart(o,s.terminal.offset):r.setStart(o,0)}catch{g=this.fixMiss(f,s.terminal.offset,i,b?t:null),r.setStart(g.container,g.offset)}else return console.log("No startContainer found for",this.toString()),null;if(u)try{a.terminal.offset!=null?r.setEnd(u,a.terminal.offset):r.setEnd(u,0)}catch{g=this.fixMiss(c,h.end.terminal.offset,i,b?t:null),r.setEnd(g.container,g.offset)}return r}isCfiString(e){return typeof e=="string"&&e.indexOf("epubcfi(")===0&&e[e.length-1]===")"}generateChapterComponent(e,t,i){var r=parseInt(t),s=(e+1)*2,a="/"+s+"/";return a+=(r+1)*2,i&&(a+="["+i+"]"),a}collapse(e){this.range&&(this.range=!1,e?(this.path.steps=this.path.steps.concat(this.start.steps),this.path.terminal=this.start.terminal):(this.path.steps=this.path.steps.concat(this.end.steps),this.path.terminal=this.end.terminal))}}class Dt{constructor(e){this.context=e||this,this.hooks=[]}register(){for(var e=0;e<arguments.length;++e)if(typeof arguments[e]=="function")this.hooks.push(arguments[e]);else for(var t=0;t<arguments[e].length;++t)this.hooks.push(arguments[e][t])}deregister(e){let t;for(let i=0;i<this.hooks.length;i++)if(t=this.hooks[i],t===e){this.hooks.splice(i,1);break}}trigger(){var e=arguments,t=this.context,i=[];return this.hooks.forEach(function(r){try{var s=r.apply(t,e)}catch(a){console.log(a)}s&&typeof s.then=="function"&&i.push(s)}),Promise.all(i)}list(){return this.hooks}clear(){return this.hooks=[]}}function Ts(n,e){var t,i,r=e.url,s=r.indexOf("://")>-1;n&&(i=Ne(n,"head"),t=Ne(i,"base"),t||(t=n.createElement("base"),i.insertBefore(t,i.firstChild)),!s&&window&&window.location&&(r=window.location.origin+r),t.setAttribute("href",r))}function wo(n,e){var t,i,r=e.canonical;n&&(t=Ne(n,"head"),i=Ne(t,"link[rel='canonical']"),i?i.setAttribute("href",r):(i=n.createElement("link"),i.setAttribute("rel","canonical"),i.setAttribute("href",r),t.appendChild(i)))}function _o(n,e){var t,i,r=e.idref;n&&(t=Ne(n,"head"),i=Ne(t,"link[property='dc.identifier']"),i?i.setAttribute("content",r):(i=n.createElement("meta"),i.setAttribute("name","dc.identifier"),i.setAttribute("content",r),t.appendChild(i)))}function Eo(n,e){var t=n.querySelectorAll("a[href]");if(t.length)for(var i=Ne(n.ownerDocument,"base"),r=i?i.getAttribute("href"):void 0,s=function(o){var u=o.getAttribute("href");if(u.indexOf("mailto:")!==0){var h=u.indexOf("://")>-1;if(h)o.setAttribute("target","_blank");else{var f;try{f=new At(u,r)}catch{}o.onclick=function(){return f&&f.hash?e(f.Path.path+f.hash):e(f?f.Path.path:u),!1}}}}.bind(this),a=0;a<t.length;a++)s(t[a])}function Cn(n,e,t){return e.forEach(function(i,r){i&&t[r]&&(i=i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),n=n.replace(new RegExp(i,"g"),t[r]))}),n}function Di(n,e,t,i){var r=typeof window<"u"?window.URL:!1,s=r?"blob":"arraybuffer",a=new be,o=new XMLHttpRequest,u=XMLHttpRequest.prototype,h;"overrideMimeType"in u||Object.defineProperty(u,"overrideMimeType",{value:function(){}}),t&&(o.withCredentials=!0),o.onreadystatechange=c,o.onerror=f,o.open("GET",n,!0);for(h in i)o.setRequestHeader(h,i[h]);e=="json"&&o.setRequestHeader("Accept","application/json"),e||(e=new Ut(n).extension),e=="blob"&&(o.responseType=s),Ai(e)&&o.overrideMimeType("text/xml"),e=="binary"&&(o.responseType="arraybuffer"),o.send();function f(b){a.reject(b)}function c(){if(this.readyState===XMLHttpRequest.DONE){var b=!1;if((this.responseType===""||this.responseType==="document")&&(b=this.responseXML),this.status===200||this.status===0||b){var g;if(!this.response&&!b)return a.reject({status:this.status,message:"Empty Response",stack:new Error().stack}),a.promise;if(this.status===403)return a.reject({status:this.status,response:this.response,message:"Forbidden",stack:new Error().stack}),a.promise;b?g=this.responseXML:Ai(e)?g=Nt(this.response,"text/xml"):e=="xhtml"?g=Nt(this.response,"application/xhtml+xml"):e=="html"||e=="htm"?g=Nt(this.response,"text/html"):e=="json"?g=JSON.parse(this.response):e=="blob"?r?g=this.response:g=new Blob([this.response]):g=this.response,a.resolve(g)}else a.reject({status:this.status,message:this.response,stack:new Error().stack})}}return a.promise}class xo{constructor(e,t){this.idref=e.idref,this.linear=e.linear==="yes",this.properties=e.properties,this.index=e.index,this.href=e.href,this.url=e.url,this.canonical=e.canonical,this.next=e.next,this.prev=e.prev,this.cfiBase=e.cfiBase,t?this.hooks=t:(this.hooks={},this.hooks.serialize=new Dt(this),this.hooks.content=new Dt(this)),this.document=void 0,this.contents=void 0,this.output=void 0}load(e){var t=e||this.request||Di,i=new be,r=i.promise;return this.contents?i.resolve(this.contents):t(this.url).then(function(s){return this.document=s,this.contents=s.documentElement,this.hooks.content.trigger(this.document,this)}.bind(this)).then(function(){i.resolve(this.contents)}.bind(this)).catch(function(s){i.reject(s)}),r}base(){return Ts(this.document,this)}render(e){var t=new be,i=t.promise;return this.output,this.load(e).then(function(r){var s=typeof navigator<"u"&&navigator.userAgent||"",a=s.indexOf("Trident")>=0,o;typeof XMLSerializer>"u"||a?o=vs:o=XMLSerializer;var u=new o;return this.output=u.serializeToString(r),this.output}.bind(this)).then(function(){return this.hooks.serialize.trigger(this.output,this)}.bind(this)).then(function(){t.resolve(this.output)}.bind(this)).catch(function(r){t.reject(r)}),i}find(e){var t=this,i=[],r=e.toLowerCase(),s=function(a){for(var o=a.textContent.toLowerCase(),u=t.document.createRange(),h,f,c=-1,b,g=150;f!=-1;)f=o.indexOf(r,c+1),f!=-1&&(u=t.document.createRange(),u.setStart(a,f),u.setEnd(a,f+r.length),h=t.cfiFromRange(u),a.textContent.length<g?b=a.textContent:(b=a.textContent.substring(f-g/2,f+g/2),b="..."+b+"..."),i.push({cfi:h,excerpt:b})),c=f};return Xi(t.document,function(a){s(a)}),i}search(e,t=5){if(typeof document.createTreeWalker>"u")return this.find(e);let i=[];const r=150,s=this,a=e.toLowerCase(),o=function(c){const S=c.reduce((T,d)=>T+d.textContent,"").toLowerCase().indexOf(a);if(S!=-1){const d=S+a.length;let p=0,y=0;if(S<c[0].length){let D;for(;p<c.length-1&&(y+=c[p].length,!(d<=y));)p+=1;let I=c[0],w=c[p],A=s.document.createRange();A.setStart(I,S);let C=c.slice(0,p).reduce((z,P)=>z+P.textContent.length,0);A.setEnd(w,C>d?d:d-C),D=s.cfiFromRange(A);let R=c.slice(0,p+1).reduce((z,P)=>z+P.textContent,"");R.length>r&&(R=R.substring(S-r/2,S+r/2),R="..."+R+"..."),i.push({cfi:D,excerpt:R})}}},u=document.createTreeWalker(s.document,NodeFilter.SHOW_TEXT,null,!1);let h,f=[];for(;h=u.nextNode();)f.push(h),f.length==t&&(o(f.slice(0,t)),f=f.slice(1,t));return f.length>0&&o(f),i}reconcileLayoutSettings(e){var t={layout:e.layout,spread:e.spread,orientation:e.orientation};return this.properties.forEach(function(i){var r=i.replace("rendition:",""),s=r.indexOf("-"),a,o;s!=-1&&(a=r.slice(0,s),o=r.slice(s+1),t[a]=o)}),t}cfiFromRange(e){return new we(e,this.cfiBase).toString()}cfiFromElement(e){return new we(e,this.cfiBase).toString()}unload(){this.document=void 0,this.contents=void 0,this.output=void 0}destroy(){this.unload(),this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.idref=void 0,this.linear=void 0,this.properties=void 0,this.index=void 0,this.href=void 0,this.url=void 0,this.next=void 0,this.prev=void 0,this.cfiBase=void 0}}class Ao{constructor(){this.spineItems=[],this.spineByHref={},this.spineById={},this.hooks={},this.hooks.serialize=new Dt,this.hooks.content=new Dt,this.hooks.content.register(Ts),this.hooks.content.register(wo),this.hooks.content.register(_o),this.epubcfi=new we,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}unpack(e,t,i){this.items=e.spine,this.manifest=e.manifest,this.spineNodeIndex=e.spineNodeIndex,this.baseUrl=e.baseUrl||e.basePath||"",this.length=this.items.length,this.items.forEach((r,s)=>{var a=this.manifest[r.idref],o;r.index=s,r.cfiBase=this.epubcfi.generateChapterComponent(this.spineNodeIndex,r.index,r.id),r.href&&(r.url=t(r.href,!0),r.canonical=i(r.href)),a&&(r.href=a.href,r.url=t(r.href,!0),r.canonical=i(r.href),a.properties.length&&r.properties.push.apply(r.properties,a.properties)),r.linear==="yes"?(r.prev=function(){let u=r.index;for(;u>0;){let h=this.get(u-1);if(h&&h.linear)return h;u-=1}}.bind(this),r.next=function(){let u=r.index;for(;u<this.spineItems.length-1;){let h=this.get(u+1);if(h&&h.linear)return h;u+=1}}.bind(this)):(r.prev=function(){},r.next=function(){}),o=new xo(r,this.hooks),this.append(o)}),this.loaded=!0}get(e){var t=0;if(typeof e>"u")for(;t<this.spineItems.length;){let i=this.spineItems[t];if(i&&i.linear)break;t+=1}else this.epubcfi.isCfiString(e)?t=new we(e).spinePos:typeof e=="number"||isNaN(e)===!1?t=e:typeof e=="string"&&e.indexOf("#")===0?t=this.spineById[e.substring(1)]:typeof e=="string"&&(e=e.split("#")[0],t=this.spineByHref[e]||this.spineByHref[encodeURI(e)]);return this.spineItems[t]||null}append(e){var t=this.spineItems.length;return e.index=t,this.spineItems.push(e),this.spineByHref[decodeURI(e.href)]=t,this.spineByHref[encodeURI(e.href)]=t,this.spineByHref[e.href]=t,this.spineById[e.idref]=t,t}prepend(e){return this.spineByHref[e.href]=0,this.spineById[e.idref]=0,this.spineItems.forEach(function(t,i){t.index=i}),0}remove(e){var t=this.spineItems.indexOf(e);if(t>-1)return delete this.spineByHref[e.href],delete this.spineById[e.idref],this.spineItems.splice(t,1)}each(){return this.spineItems.forEach.apply(this.spineItems,arguments)}first(){let e=0;do{let t=this.get(e);if(t&&t.linear)return t;e+=1}while(e<this.spineItems.length)}last(){let e=this.spineItems.length-1;do{let t=this.get(e);if(t&&t.linear)return t;e-=1}while(e>=0)}destroy(){this.each(e=>e.destroy()),this.spineItems=void 0,this.spineByHref=void 0,this.spineById=void 0,this.hooks.serialize.clear(),this.hooks.content.clear(),this.hooks=void 0,this.epubcfi=void 0,this.loaded=!1,this.items=void 0,this.manifest=void 0,this.spineNodeIndex=void 0,this.baseUrl=void 0,this.length=void 0}}class Yr{constructor(e){this._q=[],this.context=e,this.tick=Vr,this.running=!1,this.paused=!1}enqueue(){var e,t,i,r=[].shift.call(arguments),s=arguments;if(!r)throw new Error("No Task Provided");return typeof r=="function"?(e=new be,t=e.promise,i={task:r,args:s,deferred:e,promise:t}):i={promise:r},this._q.push(i),this.paused==!1&&!this.running&&this.run(),i.promise}dequeue(){var e,t,i;if(this._q.length&&!this.paused){if(e=this._q.shift(),t=e.task,t)return i=t.apply(this.context,e.args),i&&typeof i.then=="function"?i.then(function(){e.deferred.resolve.apply(this.context,arguments)}.bind(this),function(){e.deferred.reject.apply(this.context,arguments)}.bind(this)):(e.deferred.resolve.apply(this.context,i),e.promise);if(e.promise)return e.promise}else return e=new be,e.deferred.resolve(),e.promise}dump(){for(;this._q.length;)this.dequeue()}run(){return this.running||(this.running=!0,this.defered=new be),this.tick.call(window,()=>{this._q.length?this.dequeue().then(function(){this.run()}.bind(this)):(this.defered.resolve(),this.running=void 0)}),this.paused==!0&&(this.paused=!1),this.defered.promise}flush(){if(this.running)return this.running;if(this._q.length)return this.running=this.dequeue().then(function(){return this.running=void 0,this.flush()}.bind(this)),this.running}clear(){this._q=[]}length(){return this._q.length}pause(){this.paused=!0}stop(){this._q=[],this.running=!1,this.paused=!0}}const rr="0.3",Ui=["keydown","keyup","keypressed","mouseup","mousedown","mousemove","click","touchend","touchstart","touchmove"],Q={BOOK:{OPEN_FAILED:"openFailed"},CONTENTS:{EXPAND:"expand",RESIZE:"resize",SELECTED:"selected",SELECTED_RANGE:"selectedRange",LINK_CLICKED:"linkClicked"},LOCATIONS:{CHANGED:"changed"},MANAGERS:{RESIZE:"resize",RESIZED:"resized",ORIENTATION_CHANGE:"orientationchange",ADDED:"added",SCROLL:"scroll",SCROLLED:"scrolled",REMOVED:"removed"},VIEWS:{AXIS:"axis",WRITING_MODE:"writingMode",LOAD_ERROR:"loaderror",RENDERED:"rendered",RESIZED:"resized",DISPLAYED:"displayed",SHOWN:"shown",HIDDEN:"hidden",MARK_CLICKED:"markClicked"},RENDITION:{STARTED:"started",ATTACHED:"attached",DISPLAYED:"displayed",DISPLAY_ERROR:"displayerror",RENDERED:"rendered",REMOVED:"removed",RESIZED:"resized",ORIENTATION_CHANGE:"orientationchange",LOCATION_CHANGED:"locationChanged",RELOCATED:"relocated",MARK_CLICKED:"markClicked",SELECTED:"selected",LAYOUT:"layout"},LAYOUT:{UPDATED:"updated"},ANNOTATION:{ATTACH:"attach",DETACH:"detach"}};class ks{constructor(e,t,i){this.spine=e,this.request=t,this.pause=i||100,this.q=new Yr(this),this.epubcfi=new we,this._locations=[],this._locationsWords=[],this.total=0,this.break=150,this._current=0,this._wordCounter=0,this.currentLocation="",this._currentCfi="",this.processingTimeout=void 0}generate(e){return e&&(this.break=e),this.q.pause(),this.spine.each(function(t){t.linear&&this.q.enqueue(this.process.bind(this),t)}.bind(this)),this.q.run().then(function(){return this.total=this._locations.length-1,this._currentCfi&&(this.currentLocation=this._currentCfi),this._locations}.bind(this))}createRange(){return{startContainer:void 0,startOffset:void 0,endContainer:void 0,endOffset:void 0}}process(e){return e.load(this.request).then(function(t){var i=new be,r=this.parse(t,e.cfiBase);return this._locations=this._locations.concat(r),e.unload(),this.processingTimeout=setTimeout(()=>i.resolve(r),this.pause),i.promise}.bind(this))}parse(e,t,i){var r=[],s,a=e.ownerDocument,o=Ne(a,"body"),u=0,h,f=i||this.break,c=function(b){var g=b.length,S,T=0;if(b.textContent.trim().length===0)return!1;for(u==0&&(s=this.createRange(),s.startContainer=b,s.startOffset=0),S=f-u,S>g&&(u+=g,T=g);T<g;)if(S=f-u,u===0&&(T+=1,s=this.createRange(),s.startContainer=b,s.startOffset=T),T+S>=g)u+=g-T,T=g;else{T+=S,s.endContainer=b,s.endOffset=T;let d=new we(s,t).toString();r.push(d),u=0}h=b};if(Xi(o,c.bind(this)),s&&s.startContainer&&h){s.endContainer=h,s.endOffset=h.length;let b=new we(s,t).toString();r.push(b),u=0}return r}generateFromWords(e,t,i){var r=e?new we(e):void 0;return this.q.pause(),this._locationsWords=[],this._wordCounter=0,this.spine.each(function(s){s.linear&&(r?s.index>=r.spinePos&&this.q.enqueue(this.processWords.bind(this),s,t,r,i):this.q.enqueue(this.processWords.bind(this),s,t,r,i))}.bind(this)),this.q.run().then(function(){return this._currentCfi&&(this.currentLocation=this._currentCfi),this._locationsWords}.bind(this))}processWords(e,t,i,r){return r&&this._locationsWords.length>=r?Promise.resolve():e.load(this.request).then(function(s){var a=new be,o=this.parseWords(s,e,t,i),u=r-this._locationsWords.length;return this._locationsWords=this._locationsWords.concat(o.length>=r?o.slice(0,u):o),e.unload(),this.processingTimeout=setTimeout(()=>a.resolve(o),this.pause),a.promise}.bind(this))}countWords(e){return e=e.replace(/(^\s*)|(\s*$)/gi,""),e=e.replace(/[ ]{2,}/gi," "),e=e.replace(/\n /,`
`),e.split(" ").length}parseWords(e,t,i,r){var s=t.cfiBase,a=[],o=e.ownerDocument,u=Ne(o,"body"),h=i,f=r?r.spinePos!==t.index:!0,c;r&&t.index===r.spinePos&&(c=r.findNode(r.range?r.path.steps.concat(r.start.steps):r.path.steps,e.ownerDocument));var b=function(g){if(!f)if(g===c)f=!0;else return!1;if(g.textContent.length<10&&g.textContent.trim().length===0)return!1;var S=this.countWords(g.textContent),T,d=0;if(S===0)return!1;for(T=h-this._wordCounter,T>S&&(this._wordCounter+=S,d=S);d<S;)if(T=h-this._wordCounter,d+T>=S)this._wordCounter+=S-d,d=S;else{d+=T;let p=new we(g,s);a.push({cfi:p.toString(),wordCount:this._wordCounter}),this._wordCounter=0}};return Xi(u,b.bind(this)),a}locationFromCfi(e){let t;return we.prototype.isCfiString(e)&&(e=new we(e)),this._locations.length===0?-1:(t=fi(e,this._locations,this.epubcfi.compare),t>this.total?this.total:t)}percentageFromCfi(e){if(this._locations.length===0)return null;var t=this.locationFromCfi(e);return this.percentageFromLocation(t)}percentageFromLocation(e){return!e||!this.total?0:e/this.total}cfiFromLocation(e){var t=-1;return typeof e!="number"&&(e=parseInt(e)),e>=0&&e<this._locations.length&&(t=this._locations[e]),t}cfiFromPercentage(e){let t;if(e>1&&console.warn("Normalize cfiFromPercentage value to between 0 - 1"),e>=1){let i=new we(this._locations[this.total]);return i.collapse(),i.toString()}return t=Math.ceil(this.total*e),this.cfiFromLocation(t)}load(e){return typeof e=="string"?this._locations=JSON.parse(e):this._locations=e,this.total=this._locations.length-1,this._locations}save(){return JSON.stringify(this._locations)}getCurrent(){return this._current}setCurrent(e){var t;if(typeof e=="string")this._currentCfi=e;else if(typeof e=="number")this._current=e;else return;this._locations.length!==0&&(typeof e=="string"?(t=this.locationFromCfi(e),this._current=t):t=e,this.emit(Q.LOCATIONS.CHANGED,{percentage:this.percentageFromLocation(t)}))}get currentLocation(){return this._current}set currentLocation(e){this.setCurrent(e)}length(){return this._locations.length}destroy(){this.spine=void 0,this.request=void 0,this.pause=void 0,this.q.stop(),this.q=void 0,this.epubcfi=void 0,this._locations=void 0,this.total=void 0,this.break=void 0,this._current=void 0,this.currentLocation=void 0,this._currentCfi=void 0,clearTimeout(this.processingTimeout)}}Rt(ks.prototype);class Do{constructor(e){this.packagePath="",this.directory="",this.encoding="",e&&this.parse(e)}parse(e){var t;if(!e)throw new Error("Container File Not Found");if(t=Ne(e,"rootfile"),!t)throw new Error("No RootFile Found");this.packagePath=t.getAttribute("full-path"),this.directory=jt.dirname(this.packagePath),this.encoding=e.xmlEncoding}destroy(){this.packagePath=void 0,this.directory=void 0,this.encoding=void 0}}class Sn{constructor(e){this.manifest={},this.navPath="",this.ncxPath="",this.coverPath="",this.spineNodeIndex=0,this.spine=[],this.metadata={},e&&this.parse(e)}parse(e){var t,i,r;if(!e)throw new Error("Package File Not Found");if(t=Ne(e,"metadata"),!t)throw new Error("No Metadata Found");if(i=Ne(e,"manifest"),!i)throw new Error("No Manifest Found");if(r=Ne(e,"spine"),!r)throw new Error("No Spine Found");return this.manifest=this.parseManifest(i),this.navPath=this.findNavPath(i),this.ncxPath=this.findNcxPath(i,r),this.coverPath=this.findCoverPath(e),this.spineNodeIndex=ws(r),this.spine=this.parseSpine(r,this.manifest),this.uniqueIdentifier=this.findUniqueIdentifier(e),this.metadata=this.parseMetadata(t),this.metadata.direction=r.getAttribute("page-progression-direction"),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex}}parseMetadata(e){var t={};return t.title=this.getElementText(e,"title"),t.creator=this.getElementText(e,"creator"),t.description=this.getElementText(e,"description"),t.pubdate=this.getElementText(e,"date"),t.publisher=this.getElementText(e,"publisher"),t.identifier=this.getElementText(e,"identifier"),t.language=this.getElementText(e,"language"),t.rights=this.getElementText(e,"rights"),t.modified_date=this.getPropertyText(e,"dcterms:modified"),t.layout=this.getPropertyText(e,"rendition:layout"),t.orientation=this.getPropertyText(e,"rendition:orientation"),t.flow=this.getPropertyText(e,"rendition:flow"),t.viewport=this.getPropertyText(e,"rendition:viewport"),t.media_active_class=this.getPropertyText(e,"media:active-class"),t.spread=this.getPropertyText(e,"rendition:spread"),t}parseManifest(e){var t={},i=Mt(e,"item"),r=Array.prototype.slice.call(i);return r.forEach(function(s){var a=s.getAttribute("id"),o=s.getAttribute("href")||"",u=s.getAttribute("media-type")||"",h=s.getAttribute("media-overlay")||"",f=s.getAttribute("properties")||"";t[a]={href:o,type:u,overlay:h,properties:f.length?f.split(" "):[]}}),t}parseSpine(e,t){var i=[],r=Mt(e,"itemref"),s=Array.prototype.slice.call(r);return s.forEach(function(a,o){var u=a.getAttribute("idref"),h=a.getAttribute("properties")||"",f=h.length?h.split(" "):[],c={id:a.getAttribute("id"),idref:u,linear:a.getAttribute("linear")||"yes",properties:f,index:o};i.push(c)}),i}findUniqueIdentifier(e){var t=e.documentElement.getAttribute("unique-identifier");if(!t)return"";var i=e.getElementById(t);return i&&i.localName==="identifier"&&i.namespaceURI==="http://purl.org/dc/elements/1.1/"&&i.childNodes.length>0?i.childNodes[0].nodeValue.trim():""}findNavPath(e){var t=ni(e,"item",{properties:"nav"});return t?t.getAttribute("href"):!1}findNcxPath(e,t){var i=ni(e,"item",{"media-type":"application/x-dtbncx+xml"}),r;return i||(r=t.getAttribute("toc"),r&&(i=e.querySelector(`#${r}`))),i?i.getAttribute("href"):!1}findCoverPath(e){var t=Ne(e,"package");t.getAttribute("version");var i=ni(e,"item",{properties:"cover-image"});if(i)return i.getAttribute("href");var r=ni(e,"meta",{name:"cover"});if(r){var s=r.getAttribute("content"),a=e.getElementById(s);return a?a.getAttribute("href"):""}else return!1}getElementText(e,t){var i=e.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",t),r;return!i||i.length===0?"":(r=i[0],r.childNodes.length?r.childNodes[0].nodeValue:"")}getPropertyText(e,t){var i=ni(e,"meta",{property:t});return i&&i.childNodes.length?i.childNodes[0].nodeValue:""}load(e){this.metadata=e.metadata;let t=e.readingOrder||e.spine;return this.spine=t.map((i,r)=>(i.index=r,i.linear=i.linear||"yes",i)),e.resources.forEach((i,r)=>{this.manifest[r]=i,i.rel&&i.rel[0]==="cover"&&(this.coverPath=i.href)}),this.spineNodeIndex=0,this.toc=e.toc.map((i,r)=>(i.label=i.title,i)),{metadata:this.metadata,spine:this.spine,manifest:this.manifest,navPath:this.navPath,ncxPath:this.ncxPath,coverPath:this.coverPath,spineNodeIndex:this.spineNodeIndex,toc:this.toc}}destroy(){this.manifest=void 0,this.navPath=void 0,this.ncxPath=void 0,this.coverPath=void 0,this.spineNodeIndex=void 0,this.spine=void 0,this.metadata=void 0}}class br{constructor(e){this.toc=[],this.tocByHref={},this.tocById={},this.landmarks=[],this.landmarksByType={},this.length=0,e&&this.parse(e)}parse(e){let t=e.nodeType,i,r;t&&(i=Ne(e,"html"),r=Ne(e,"ncx")),t?i?(this.toc=this.parseNav(e),this.landmarks=this.parseLandmarks(e)):r&&(this.toc=this.parseNcx(e)):this.toc=this.load(e),this.length=0,this.unpack(this.toc)}unpack(e){for(var t,i=0;i<e.length;i++)t=e[i],t.href&&(this.tocByHref[t.href]=i),t.id&&(this.tocById[t.id]=i),this.length++,t.subitems.length&&this.unpack(t.subitems)}get(e){var t;return e?(e.indexOf("#")===0?t=this.tocById[e.substring(1)]:e in this.tocByHref&&(t=this.tocByHref[e]),this.getByIndex(e,t,this.toc)):this.toc}getByIndex(e,t,i){if(i.length===0)return;const r=i[t];if(r&&(e===r.id||e===r.href))return r;{let s;for(let a=0;a<i.length&&(s=this.getByIndex(e,t,i[a].subitems),!s);++a);return s}}landmark(e){var t;return e?(t=this.landmarksByType[e],this.landmarks[t]):this.landmarks}parseNav(e){var t=$i(e,"nav","toc"),i=[];if(!t)return i;let r=si(t,"ol",!0);return r&&(i=this.parseNavList(r)),i}parseNavList(e,t){const i=[];if(!e||!e.children)return i;for(let r=0;r<e.children.length;r++){const s=this.navItem(e.children[r],t);s&&i.push(s)}return i}navItem(e,t){let i=e.getAttribute("id")||void 0,r=si(e,"a",!0)||si(e,"span",!0);if(!r)return;let s=r.getAttribute("href")||"";i||(i=s);let a=r.textContent||"",o=[],u=si(e,"ol",!0);return u&&(o=this.parseNavList(u,i)),{id:i,href:s,label:a,subitems:o,parent:t}}parseLandmarks(e){var t=$i(e,"nav","landmarks"),i=t?Mt(t,"li"):[],r=i.length,s,a=[],o;if(!i||r===0)return a;for(s=0;s<r;++s)o=this.landmarkItem(i[s]),o&&(a.push(o),this.landmarksByType[o.type]=s);return a}landmarkItem(e){let t=si(e,"a",!0);if(!t)return;let i=t.getAttributeNS("http://www.idpf.org/2007/ops","type")||void 0,r=t.getAttribute("href")||"",s=t.textContent||"";return{href:r,label:s,type:i}}parseNcx(e){var t=Mt(e,"navPoint"),i=t.length,r,s={},a=[],o,u;if(!t||i===0)return a;for(r=0;r<i;++r)o=this.ncxItem(t[r]),s[o.id]=o,o.parent?(u=s[o.parent],u.subitems.push(o)):a.push(o);return a}ncxItem(e){var t=e.getAttribute("id")||!1,i=Ne(e,"content"),r=i.getAttribute("src"),s=Ne(e,"navLabel"),a=s.textContent?s.textContent:"",o=[],u=e.parentNode,h;return u&&(u.nodeName==="navPoint"||u.nodeName.split(":").slice(-1)[0]==="navPoint")&&(h=u.getAttribute("id")),{id:t,href:r,label:a,subitems:o,parent:h}}load(e){return e.map(t=>(t.label=t.title,t.subitems=t.children?this.load(t.children):[],t))}forEach(e){return this.toc.forEach(e)}}var yi={application:{ecmascript:["es","ecma"],javascript:"js",ogg:"ogx",pdf:"pdf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],"rdf+xml":"rdf",smil:["smi","smil"],"xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd","opf","ncx"],zip:"zip","x-httpd-eruby":"rhtml","x-latex":"latex","x-maker":["frm","maker","frame","fm","fb","book","fbdoc"],"x-object":"o","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","epub+zip":"epub","font-tdpfr":"pfr","inkml+xml":["ink","inkml"],json:"json","jsonml+json":"jsonml","mathml+xml":"mathml","metalink+xml":"metalink",mp4:"mp4s","omdoc+xml":"omdoc",oxps:"oxps","vnd.amazon.ebook":"azw",widget:"wgt","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-otf":"otf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-font-woff":"woff","x-mobipocket-ebook":["prc","mobi"],"x-mspublisher":"pub","x-nzb":"nzb","x-tgif":"obj","xaml+xml":"xaml","xml-dtd":"dtd","xproc+xml":"xpl","xslt+xml":"xslt","internet-property-stream":"acx","x-compress":"z","x-compressed":"tgz","x-gzip":"gz"},audio:{flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp2","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"x-aiff":["aif","aiff","aifc"],"x-ms-wma":"wma","x-wav":"wav",adpcm:"adp",mp4:"mp4a",webm:"weba","x-aac":"aac","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",mid:["mid","rmi"]},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"x-icon":"ico",bmp:"bmp",webp:"webp","x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod"},text:{"cache-manifest":["manifest","appcache"],css:"css",csv:"csv",html:["html","htm","shtml","stm"],mathml:"mml",plain:["txt","text","brf","conf","def","list","log","in","bas"],richtext:"rtx","tab-separated-values":"tsv","x-bibtex":"bib"},video:{mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv"}},Co=function(){var n,e,t,i,r={};for(n in yi)if(yi.hasOwnProperty(n)){for(e in yi[n])if(yi[n].hasOwnProperty(e))if(t=yi[n][e],typeof t=="string")r[t]=n+"/"+e;else for(i=0;i<t.length;i++)r[t[i]]=n+"/"+e}return r}(),So="text/plain";function To(n){return n&&Co[n.split(".").pop().toLowerCase()]||So}const oi={lookup:To};class ko{constructor(e,t){this.settings={replacements:t&&t.replacements||"base64",archive:t&&t.archive,resolver:t&&t.resolver,request:t&&t.request},this.process(e)}process(e){this.manifest=e,this.resources=Object.keys(e).map(function(t){return e[t]}),this.replacementUrls=[],this.html=[],this.assets=[],this.css=[],this.urls=[],this.cssUrls=[],this.split(),this.splitUrls()}split(){this.html=this.resources.filter(function(e){if(e.type==="application/xhtml+xml"||e.type==="text/html")return!0}),this.assets=this.resources.filter(function(e){if(e.type!=="application/xhtml+xml"&&e.type!=="text/html")return!0}),this.css=this.resources.filter(function(e){if(e.type==="text/css")return!0})}splitUrls(){this.urls=this.assets.map(function(e){return e.href}.bind(this)),this.cssUrls=this.css.map(function(e){return e.href})}createUrl(e){var t=new At(e),i=oi.lookup(t.filename);return this.settings.archive?this.settings.archive.createUrl(e,{base64:this.settings.replacements==="base64"}):this.settings.replacements==="base64"?this.settings.request(e,"blob").then(r=>Ds(r)).then(r=>Tr(r,i)):this.settings.request(e,"blob").then(r=>Yi(r,i))}replacements(){if(this.settings.replacements==="none")return new Promise(function(t){t(this.urls)}.bind(this));var e=this.urls.map(t=>{var i=this.settings.resolver(t);return this.createUrl(i).catch(r=>(console.error(r),null))});return Promise.all(e).then(t=>(this.replacementUrls=t.filter(i=>typeof i=="string"),t))}replaceCss(e,t){var i=[];return e=e||this.settings.archive,t=t||this.settings.resolver,this.cssUrls.forEach(function(r){var s=this.createCssFile(r,e,t).then(function(a){var o=this.urls.indexOf(r);o>-1&&(this.replacementUrls[o]=a)}.bind(this));i.push(s)}.bind(this)),Promise.all(i)}createCssFile(e){var t;if(jt.isAbsolute(e))return new Promise(function(a){a()});var i=this.settings.resolver(e),r;this.settings.archive?r=this.settings.archive.getText(i):r=this.settings.request(i,"text");var s=this.urls.map(a=>{var o=this.settings.resolver(a),u=new Ut(i).relative(o);return u});return r?r.then(a=>(a=Cn(a,s,this.replacementUrls),this.settings.replacements==="base64"?t=Tr(a,"text/css"):t=Yi(a,"text/css"),t),a=>new Promise(function(o){o()})):new Promise(function(a){a()})}relativeTo(e,t){return t=t||this.settings.resolver,this.urls.map(function(i){var r=t(i),s=new Ut(e).relative(r);return s}.bind(this))}get(e){var t=this.urls.indexOf(e);if(t!==-1)return this.replacementUrls.length?new Promise(function(i,r){i(this.replacementUrls[t])}.bind(this)):this.createUrl(e)}substitute(e,t){var i;return t?i=this.relativeTo(t):i=this.urls,Cn(e,i,this.replacementUrls)}destroy(){this.settings=void 0,this.manifest=void 0,this.resources=void 0,this.replacementUrls=void 0,this.html=void 0,this.assets=void 0,this.css=void 0,this.urls=void 0,this.cssUrls=void 0}}class wr{constructor(e){this.pages=[],this.locations=[],this.epubcfi=new we,this.firstPage=0,this.lastPage=0,this.totalPages=0,this.toc=void 0,this.ncx=void 0,e&&(this.pageList=this.parse(e)),this.pageList&&this.pageList.length&&this.process(this.pageList)}parse(e){var t=Ne(e,"html"),i=Ne(e,"ncx");if(t)return this.parseNav(e);if(i)return this.parseNcx(e)}parseNav(e){var t=$i(e,"nav","page-list"),i=t?Mt(t,"li"):[],r=i.length,s,a=[],o;if(!i||r===0)return a;for(s=0;s<r;++s)o=this.item(i[s]),a.push(o);return a}parseNcx(e){var t=[],i=0,r,s,a,o=0;if(s=Ne(e,"pageList"),!s||(a=Mt(s,"pageTarget"),o=a.length,!a||a.length===0))return t;for(i=0;i<o;++i)r=this.ncxItem(a[i]),t.push(r);return t}ncxItem(e){var t=Ne(e,"navLabel"),i=Ne(t,"text"),r=i.textContent,s=Ne(e,"content"),a=s.getAttribute("src"),o=parseInt(r,10);return{href:a,page:o}}item(e){var t=Ne(e,"a"),i=t.getAttribute("href")||"",r=t.textContent||"",s=parseInt(r),a=i.indexOf("epubcfi"),o,u,h;return a!=-1?(o=i.split("#"),u=o[0],h=o.length>1?o[1]:!1,{cfi:h,href:i,packageUrl:u,page:s}):{href:i,page:s}}process(e){e.forEach(function(t){this.pages.push(t.page),t.cfi&&this.locations.push(t.cfi)},this),this.firstPage=parseInt(this.pages[0]),this.lastPage=parseInt(this.pages[this.pages.length-1]),this.totalPages=this.lastPage-this.firstPage}pageFromCfi(e){var t=-1;if(this.locations.length===0)return-1;var i=Vi(e,this.locations,this.epubcfi.compare);return i!=-1?t=this.pages[i]:(i=fi(e,this.locations,this.epubcfi.compare),t=i-1>=0?this.pages[i-1]:this.pages[0],t!==void 0||(t=-1)),t}cfiFromPage(e){var t=-1;typeof e!="number"&&(e=parseInt(e));var i=this.pages.indexOf(e);return i!=-1&&(t=this.locations[i]),t}pageFromPercentage(e){var t=Math.round(this.totalPages*e);return t}percentageFromPage(e){var t=(e-this.firstPage)/this.totalPages;return Math.round(t*1e3)/1e3}percentageFromCfi(e){var t=this.pageFromCfi(e),i=this.percentageFromPage(t);return i}destroy(){this.pages=void 0,this.locations=void 0,this.epubcfi=void 0,this.pageList=void 0,this.toc=void 0,this.ncx=void 0}}class Ns{constructor(e){this.settings=e,this.name=e.layout||"reflowable",this._spread=e.spread!=="none",this._minSpreadWidth=e.minSpreadWidth||800,this._evenSpreads=e.evenSpreads||!1,e.flow==="scrolled"||e.flow==="scrolled-continuous"||e.flow==="scrolled-doc"?this._flow="scrolled":this._flow="paginated",this.width=0,this.height=0,this.spreadWidth=0,this.delta=0,this.columnWidth=0,this.gap=0,this.divisor=1,this.props={name:this.name,spread:this._spread,flow:this._flow,width:0,height:0,spreadWidth:0,delta:0,columnWidth:0,gap:0,divisor:1}}flow(e){return typeof e<"u"&&(e==="scrolled"||e==="scrolled-continuous"||e==="scrolled-doc"?this._flow="scrolled":this._flow="paginated",this.update({flow:this._flow})),this._flow}spread(e,t){return e&&(this._spread=e!=="none",this.update({spread:this._spread})),t>=0&&(this._minSpreadWidth=t),this._spread}calculate(e,t,i){var r=1,s=i||0,a=e,o=t,u=Math.floor(a/12),h,f,c,b;this._spread&&a>=this._minSpreadWidth?r=2:r=1,this.name==="reflowable"&&this._flow==="paginated"&&!(i>=0)&&(s=u%2===0?u:u-1),this.name==="pre-paginated"&&(s=0),r>1?(h=a/r-s,c=h+s):(h=a,c=a),this.name==="pre-paginated"&&r>1&&(a=h),f=h*r+s,b=a,this.width=a,this.height=o,this.spreadWidth=f,this.pageWidth=c,this.delta=b,this.columnWidth=h,this.gap=s,this.divisor=r,this.update({width:a,height:o,spreadWidth:f,pageWidth:c,delta:b,columnWidth:h,gap:s,divisor:r})}format(e,t,i){var r;return this.name==="pre-paginated"?r=e.fit(this.columnWidth,this.height,t):this._flow==="paginated"?r=e.columns(this.width,this.height,this.columnWidth,this.gap,this.settings.direction):i&&i==="horizontal"?r=e.size(null,this.height):r=e.size(this.width,null),r}count(e,t){let i,r;return this.name==="pre-paginated"?(i=1,r=1):this._flow==="paginated"?(t=t||this.delta,i=Math.ceil(e/t),r=i*this.divisor):(t=t||this.height,i=Math.ceil(e/t),r=i),{spreads:i,pages:r}}update(e){if(Object.keys(e).forEach(t=>{this.props[t]===e[t]&&delete e[t]}),Object.keys(e).length>0){let t=et(this.props,e);this.emit(Q.LAYOUT.UPDATED,t,e)}}}Rt(Ns.prototype);class No{constructor(e){this.rendition=e,this._themes={default:{rules:{},url:"",serialized:""}},this._overrides={},this._current="default",this._injected=[],this.rendition.hooks.content.register(this.inject.bind(this)),this.rendition.hooks.content.register(this.overrides.bind(this))}register(){if(arguments.length!==0){if(arguments.length===1&&typeof arguments[0]=="object")return this.registerThemes(arguments[0]);if(arguments.length===1&&typeof arguments[0]=="string")return this.default(arguments[0]);if(arguments.length===2&&typeof arguments[1]=="string")return this.registerUrl(arguments[0],arguments[1]);if(arguments.length===2&&typeof arguments[1]=="object")return this.registerRules(arguments[0],arguments[1])}}default(e){if(e){if(typeof e=="string")return this.registerUrl("default",e);if(typeof e=="object")return this.registerRules("default",e)}}registerThemes(e){for(var t in e)e.hasOwnProperty(t)&&(typeof e[t]=="string"?this.registerUrl(t,e[t]):this.registerRules(t,e[t]))}registerCss(e,t){this._themes[e]={serialized:t},(this._injected[e]||e=="default")&&this.update(e)}registerUrl(e,t){var i=new At(t);this._themes[e]={url:i.toString()},(this._injected[e]||e=="default")&&this.update(e)}registerRules(e,t){this._themes[e]={rules:t},(this._injected[e]||e=="default")&&this.update(e)}select(e){var t=this._current,i;this._current=e,this.update(e),i=this.rendition.getContents(),i.forEach(r=>{r.removeClass(t),r.addClass(e)})}update(e){var t=this.rendition.getContents();t.forEach(i=>{this.add(e,i)})}inject(e){var t=[],i=this._themes,r;for(var s in i)i.hasOwnProperty(s)&&(s===this._current||s==="default")&&(r=i[s],(r.rules&&Object.keys(r.rules).length>0||r.url&&t.indexOf(r.url)===-1)&&this.add(s,e),this._injected.push(s));this._current!="default"&&e.addClass(this._current)}add(e,t){var i=this._themes[e];!i||!t||(i.url?t.addStylesheet(i.url):i.serialized?(t.addStylesheetCss(i.serialized,e),i.injected=!0):i.rules&&(t.addStylesheetRules(i.rules,e),i.injected=!0))}override(e,t,i){var r=this.rendition.getContents();this._overrides[e]={value:t,priority:i===!0},r.forEach(s=>{s.css(e,this._overrides[e].value,this._overrides[e].priority)})}removeOverride(e){var t=this.rendition.getContents();delete this._overrides[e],t.forEach(i=>{i.css(e)})}overrides(e){var t=this._overrides;for(var i in t)t.hasOwnProperty(i)&&e.css(i,t[i].value,t[i].priority)}fontSize(e){this.override("font-size",e)}font(e){this.override("font-family",e,!0)}destroy(){this.rendition=void 0,this._themes=void 0,this._overrides=void 0,this._current=void 0,this._injected=void 0}}class Ki{constructor(e,t,i,r=!1){this.layout=e,this.horizontal=i==="horizontal",this.direction=t||"ltr",this._dev=r}section(e){var t=this.findRanges(e),i=this.rangeListToCfiList(e.section.cfiBase,t);return i}page(e,t,i,r){var s=e&&e.document?e.document.body:!1,a;if(s){if(a=this.rangePairToCfiPair(t,{start:this.findStart(s,i,r),end:this.findEnd(s,i,r)}),this._dev===!0){let o=e.document,u=new we(a.start).toRange(o),h=new we(a.end).toRange(o),f=o.defaultView.getSelection(),c=o.createRange();f.removeAllRanges(),c.setStart(u.startContainer,u.startOffset),c.setEnd(h.endContainer,h.endOffset),f.addRange(c)}return a}}walk(e,t){if(!(e&&e.nodeType===Node.TEXT_NODE)){var i={acceptNode:function(u){return u.data.trim().length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}},r=i.acceptNode;r.acceptNode=i.acceptNode;for(var s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,r,!1),a,o;(a=s.nextNode())&&(o=t(a),!o););return o}}findRanges(e){for(var t=[],i=e.contents.scrollWidth(),r=Math.ceil(i/this.layout.spreadWidth),s=r*this.layout.divisor,a=this.layout.columnWidth,o=this.layout.gap,u,h,f=0;f<s.pages;f++)u=(a+o)*f,h=a*(f+1)+o*f,t.push({start:this.findStart(e.document.body,u,h),end:this.findEnd(e.document.body,u,h)});return t}findStart(e,t,i){for(var r=[e],s,a,o=e;r.length;)if(s=r.shift(),a=this.walk(s,u=>{var h,f,c,b,g;if(g=Sr(u),this.horizontal&&this.direction==="ltr"){if(h=this.horizontal?g.left:g.top,f=this.horizontal?g.right:g.bottom,h>=t&&h<=i)return u;if(f>t)return u;o=u,r.push(u)}else if(this.horizontal&&this.direction==="rtl"){if(h=g.left,f=g.right,f<=i&&f>=t)return u;if(h<i)return u;o=u,r.push(u)}else{if(c=g.top,b=g.bottom,c>=t&&c<=i)return u;if(b>t)return u;o=u,r.push(u)}}),a)return this.findTextStartRange(a,t,i);return this.findTextStartRange(o,t,i)}findEnd(e,t,i){for(var r=[e],s,a=e,o;r.length;)if(s=r.shift(),o=this.walk(s,u=>{var h,f,c,b,g;if(g=Sr(u),this.horizontal&&this.direction==="ltr"){if(h=Math.round(g.left),f=Math.round(g.right),h>i&&a)return a;if(f>i)return u;a=u,r.push(u)}else if(this.horizontal&&this.direction==="rtl"){if(h=Math.round(this.horizontal?g.left:g.top),f=Math.round(this.horizontal?g.right:g.bottom),f<t&&a)return a;if(h<t)return u;a=u,r.push(u)}else{if(c=Math.round(g.top),b=Math.round(g.bottom),c>i&&a)return a;if(b>i)return u;a=u,r.push(u)}}),o)return this.findTextEndRange(o,t,i);return this.findTextEndRange(a,t,i)}findTextStartRange(e,t,i){for(var r=this.splitTextNodeIntoRanges(e),s,a,o,u,h,f=0;f<r.length;f++)if(s=r[f],a=s.getBoundingClientRect(),this.horizontal&&this.direction==="ltr"){if(o=a.left,o>=t)return s}else if(this.horizontal&&this.direction==="rtl"){if(h=a.right,h<=i)return s}else if(u=a.top,u>=t)return s;return r[0]}findTextEndRange(e,t,i){for(var r=this.splitTextNodeIntoRanges(e),s,a,o,u,h,f,c,b=0;b<r.length;b++){if(a=r[b],o=a.getBoundingClientRect(),this.horizontal&&this.direction==="ltr"){if(u=o.left,h=o.right,u>i&&s)return s;if(h>i)return a}else if(this.horizontal&&this.direction==="rtl"){if(u=o.left,h=o.right,h<t&&s)return s;if(u<t)return a}else{if(f=o.top,c=o.bottom,f>i&&s)return s;if(c>i)return a}s=a}return r[r.length-1]}splitTextNodeIntoRanges(e,t){var i=[],r=e.textContent||"",s=r.trim(),a,o=e.ownerDocument,u=t||" ",h=s.indexOf(u);if(h===-1||e.nodeType!=Node.TEXT_NODE)return a=o.createRange(),a.selectNodeContents(e),[a];for(a=o.createRange(),a.setStart(e,0),a.setEnd(e,h),i.push(a),a=!1;h!=-1;)h=s.indexOf(u,h+1),h>0&&(a&&(a.setEnd(e,h),i.push(a)),a=o.createRange(),a.setStart(e,h+1));return a&&(a.setEnd(e,s.length),i.push(a)),i}rangePairToCfiPair(e,t){var i=t.start,r=t.end;i.collapse(!0),r.collapse(!1);let s=new we(i,e).toString(),a=new we(r,e).toString();return{start:s,end:a}}rangeListToCfiList(e,t){for(var i=[],r,s=0;s<t.length;s++)r=this.rangePairToCfiPair(e,t[s]),i.push(r);return i}axis(e){return e&&(this.horizontal=e==="horizontal"),this.horizontal}}const Rs=typeof navigator<"u",Ro=Rs&&/Chrome/.test(navigator.userAgent),Tn=Rs&&!Ro&&/AppleWebKit/.test(navigator.userAgent),Io=1;class Xr{constructor(e,t,i,r){this.epubcfi=new we,this.document=e,this.documentElement=this.document.documentElement,this.content=t||this.document.body,this.window=this.document.defaultView,this._size={width:0,height:0},this.sectionIndex=r||0,this.cfiBase=i||"",this.epubReadingSystem("epub.js",rr),this.called=0,this.active=!0,this.listeners()}static get listenedEvents(){return Ui}width(e){var t=this.content;return e&&ze(e)&&(e=e+"px"),e&&(t.style.width=e),parseInt(this.window.getComputedStyle(t).width)}height(e){var t=this.content;return e&&ze(e)&&(e=e+"px"),e&&(t.style.height=e),parseInt(this.window.getComputedStyle(t).height)}contentWidth(e){var t=this.content||this.document.body;return e&&ze(e)&&(e=e+"px"),e&&(t.style.width=e),parseInt(this.window.getComputedStyle(t).width)}contentHeight(e){var t=this.content||this.document.body;return e&&ze(e)&&(e=e+"px"),e&&(t.style.height=e),parseInt(this.window.getComputedStyle(t).height)}textWidth(){let e,t,i=this.document.createRange(),r=this.content||this.document.body,s=Zi(r);return i.selectNodeContents(r),e=i.getBoundingClientRect(),t=e.width,s&&s.width&&(t+=s.width),Math.round(t)}textHeight(){let e,t,i=this.document.createRange(),r=this.content||this.document.body;return i.selectNodeContents(r),e=i.getBoundingClientRect(),t=e.bottom,Math.round(t)}scrollWidth(){var e=this.documentElement.scrollWidth;return e}scrollHeight(){var e=this.documentElement.scrollHeight;return e}overflow(e){return e&&(this.documentElement.style.overflow=e),this.window.getComputedStyle(this.documentElement).overflow}overflowX(e){return e&&(this.documentElement.style.overflowX=e),this.window.getComputedStyle(this.documentElement).overflowX}overflowY(e){return e&&(this.documentElement.style.overflowY=e),this.window.getComputedStyle(this.documentElement).overflowY}css(e,t,i){var r=this.content||this.document.body;return t?r.style.setProperty(e,t,i?"important":""):r.style.removeProperty(e),this.window.getComputedStyle(r)[e]}viewport(e){var t=this.document.querySelector("meta[name='viewport']"),i={width:void 0,height:void 0,scale:void 0,minimum:void 0,maximum:void 0,scalable:void 0},r=[],s={};if(t&&t.hasAttribute("content")){let a=t.getAttribute("content"),o=a.match(/width\s*=\s*([^,]*)/),u=a.match(/height\s*=\s*([^,]*)/),h=a.match(/initial-scale\s*=\s*([^,]*)/),f=a.match(/minimum-scale\s*=\s*([^,]*)/),c=a.match(/maximum-scale\s*=\s*([^,]*)/),b=a.match(/user-scalable\s*=\s*([^,]*)/);o&&o.length&&typeof o[1]<"u"&&(i.width=o[1]),u&&u.length&&typeof u[1]<"u"&&(i.height=u[1]),h&&h.length&&typeof h[1]<"u"&&(i.scale=h[1]),f&&f.length&&typeof f[1]<"u"&&(i.minimum=f[1]),c&&c.length&&typeof c[1]<"u"&&(i.maximum=c[1]),b&&b.length&&typeof b[1]<"u"&&(i.scalable=b[1])}return s=bs(e||{},i),e&&(s.width&&r.push("width="+s.width),s.height&&r.push("height="+s.height),s.scale&&r.push("initial-scale="+s.scale),s.scalable==="no"?(r.push("minimum-scale="+s.scale),r.push("maximum-scale="+s.scale),r.push("user-scalable="+s.scalable)):(s.scalable&&r.push("user-scalable="+s.scalable),s.minimum&&r.push("minimum-scale="+s.minimum),s.maximum&&r.push("minimum-scale="+s.maximum)),t||(t=this.document.createElement("meta"),t.setAttribute("name","viewport"),this.document.querySelector("head").appendChild(t)),t.setAttribute("content",r.join(", ")),this.window.scrollTo(0,0)),s}expand(){this.emit(Q.CONTENTS.EXPAND)}listeners(){this.imageLoadListeners(),this.mediaQueryListeners(),this.addEventListeners(),this.addSelectionListeners(),typeof ResizeObserver>"u"?(this.resizeListeners(),this.visibilityListeners()):this.resizeObservers(),this.linksHandler()}removeListeners(){this.removeEventListeners(),this.removeSelectionListeners(),this.observer&&this.observer.disconnect(),clearTimeout(this.expanding)}resizeCheck(){let e=this.textWidth(),t=this.textHeight();(e!=this._size.width||t!=this._size.height)&&(this._size={width:e,height:t},this.onResize&&this.onResize(this._size),this.emit(Q.CONTENTS.RESIZE,this._size))}resizeListeners(){clearTimeout(this.expanding),requestAnimationFrame(this.resizeCheck.bind(this)),this.expanding=setTimeout(this.resizeListeners.bind(this),350)}visibilityListeners(){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.active===!1?(this.active=!0,this.resizeListeners()):(this.active=!1,clearTimeout(this.expanding))})}transitionListeners(){let e=this.content;e.style.transitionProperty="font, font-size, font-size-adjust, font-stretch, font-variation-settings, font-weight, width, height",e.style.transitionDuration="0.001ms",e.style.transitionTimingFunction="linear",e.style.transitionDelay="0",this._resizeCheck=this.resizeCheck.bind(this),this.document.addEventListener("transitionend",this._resizeCheck)}mediaQueryListeners(){for(var e=this.document.styleSheets,t=function(o){o.matches&&!this._expanding&&setTimeout(this.expand.bind(this),1)}.bind(this),i=0;i<e.length;i+=1){var r;try{r=e[i].cssRules}catch{return}if(!r)return;for(var s=0;s<r.length;s+=1)if(r[s].media){var a=this.window.matchMedia(r[s].media.mediaText);a.addListener(t)}}}resizeObservers(){this.observer=new ResizeObserver(e=>{requestAnimationFrame(this.resizeCheck.bind(this))}),this.observer.observe(this.document.documentElement)}mutationObservers(){this.observer=new MutationObserver(t=>{this.resizeCheck()});let e={attributes:!0,childList:!0,characterData:!0,subtree:!0};this.observer.observe(this.document,e)}imageLoadListeners(){for(var e=this.document.querySelectorAll("img"),t,i=0;i<e.length;i++)t=e[i],typeof t.naturalWidth<"u"&&t.naturalWidth===0&&(t.onload=this.expand.bind(this))}fontLoadListeners(){!this.document||!this.document.fonts||this.document.fonts.ready.then(function(){this.resizeCheck()}.bind(this))}root(){return this.document?this.document.documentElement:null}locationOf(e,t){var i,r={left:0,top:0};if(!this.document)return r;if(this.epubcfi.isCfiString(e)){let s=new we(e).toRange(this.document,t);if(s){try{if(!s.endContainer||s.startContainer==s.endContainer&&s.startOffset==s.endOffset){let a=s.startContainer.textContent.indexOf(" ",s.startOffset);a==-1&&(a=s.startContainer.textContent.length),s.setEnd(s.startContainer,a)}}catch(a){console.error("setting end offset to start container length failed",a)}if(s.startContainer.nodeType===Node.ELEMENT_NODE)i=s.startContainer.getBoundingClientRect(),r.left=i.left,r.top=i.top;else if(Tn){let a=s.startContainer,o=new Range;try{a.nodeType===Io?i=a.getBoundingClientRect():s.startOffset+2<a.length?(o.setStart(a,s.startOffset),o.setEnd(a,s.startOffset+2),i=o.getBoundingClientRect()):s.startOffset-2>0?(o.setStart(a,s.startOffset-2),o.setEnd(a,s.startOffset),i=o.getBoundingClientRect()):i=a.parentNode.getBoundingClientRect()}catch(u){console.error(u,u.stack)}}else i=s.getBoundingClientRect()}}else if(typeof e=="string"&&e.indexOf("#")>-1){let s=e.substring(e.indexOf("#")+1),a=this.document.getElementById(s);if(a)if(Tn){let o=new Range;o.selectNode(a),i=o.getBoundingClientRect()}else i=a.getBoundingClientRect()}return i&&(r.left=i.left,r.top=i.top),r}addStylesheet(e){return new Promise(function(t,i){var r,s=!1;if(!this.document){t(!1);return}if(r=this.document.querySelector("link[href='"+e+"']"),r){t(!0);return}r=this.document.createElement("link"),r.type="text/css",r.rel="stylesheet",r.href=e,r.onload=r.onreadystatechange=function(){!s&&(!this.readyState||this.readyState=="complete")&&(s=!0,setTimeout(()=>{t(!0)},1))},this.document.head.appendChild(r)}.bind(this))}_getStylesheetNode(e){var t;return e="epubjs-inserted-css-"+(e||""),this.document?(t=this.document.getElementById(e),t||(t=this.document.createElement("style"),t.id=e,this.document.head.appendChild(t)),t):!1}addStylesheetCss(e,t){if(!this.document||!e)return!1;var i;return i=this._getStylesheetNode(t),i.innerHTML=e,!0}addStylesheetRules(e,t){var i;if(!(!this.document||!e||e.length===0))if(i=this._getStylesheetNode(t).sheet,Object.prototype.toString.call(e)==="[object Array]")for(var r=0,s=e.length;r<s;r++){var a=1,o=e[r],u=e[r][0],h="";Object.prototype.toString.call(o[1][0])==="[object Array]"&&(o=o[1],a=0);for(var f=o.length;a<f;a++){var c=o[a];h+=c[0]+":"+c[1]+(c[2]?" !important":"")+`;
`}i.insertRule(u+"{"+h+"}",i.cssRules.length)}else Object.keys(e).forEach(g=>{const S=e[g];if(Array.isArray(S))S.forEach(T=>{const p=Object.keys(T).map(y=>`${y}:${T[y]}`).join(";");i.insertRule(`${g}{${p}}`,i.cssRules.length)});else{const d=Object.keys(S).map(p=>`${p}:${S[p]}`).join(";");i.insertRule(`${g}{${d}}`,i.cssRules.length)}})}addScript(e){return new Promise(function(t,i){var r,s=!1;if(!this.document){t(!1);return}r=this.document.createElement("script"),r.type="text/javascript",r.async=!0,r.src=e,r.onload=r.onreadystatechange=function(){!s&&(!this.readyState||this.readyState=="complete")&&(s=!0,setTimeout(function(){t(!0)},1))},this.document.head.appendChild(r)}.bind(this))}addClass(e){var t;this.document&&(t=this.content||this.document.body,t&&t.classList.add(e))}removeClass(e){var t;this.document&&(t=this.content||this.document.body,t&&t.classList.remove(e))}addEventListeners(){this.document&&(this._triggerEvent=this.triggerEvent.bind(this),Ui.forEach(function(e){this.document.addEventListener(e,this._triggerEvent,{passive:!0})},this))}removeEventListeners(){this.document&&(Ui.forEach(function(e){this.document.removeEventListener(e,this._triggerEvent,{passive:!0})},this),this._triggerEvent=void 0)}triggerEvent(e){this.emit(e.type,e)}addSelectionListeners(){this.document&&(this._onSelectionChange=this.onSelectionChange.bind(this),this.document.addEventListener("selectionchange",this._onSelectionChange,{passive:!0}))}removeSelectionListeners(){this.document&&(this.document.removeEventListener("selectionchange",this._onSelectionChange,{passive:!0}),this._onSelectionChange=void 0)}onSelectionChange(e){this.selectionEndTimeout&&clearTimeout(this.selectionEndTimeout),this.selectionEndTimeout=setTimeout(function(){var t=this.window.getSelection();this.triggerSelectedEvent(t)}.bind(this),250)}triggerSelectedEvent(e){var t,i;e&&e.rangeCount>0&&(t=e.getRangeAt(0),t.collapsed||(i=new we(t,this.cfiBase).toString(),this.emit(Q.CONTENTS.SELECTED,i),this.emit(Q.CONTENTS.SELECTED_RANGE,t)))}range(e,t){var i=new we(e);return i.toRange(this.document,t)}cfiFromRange(e,t){return new we(e,this.cfiBase,t).toString()}cfiFromNode(e,t){return new we(e,this.cfiBase,t).toString()}map(e){var t=new Ki(e);return t.section()}size(e,t){var i={scale:1,scalable:"no"};this.layoutStyle("scrolling"),e>=0&&(this.width(e),i.width=e,this.css("padding","0 "+e/12+"px")),t>=0&&(this.height(t),i.height=t),this.css("margin","0"),this.css("box-sizing","border-box"),this.viewport(i)}columns(e,t,i,r,s){let a=ri("column-axis"),o=ri("column-gap"),u=ri("column-width"),h=ri("column-fill"),c=this.writingMode().indexOf("vertical")===0?"vertical":"horizontal";this.layoutStyle("paginated"),s==="rtl"&&c==="horizontal"&&this.direction(s),this.width(e),this.height(t),this.viewport({width:e,height:t,scale:1,scalable:"no"}),this.css("overflow-y","hidden"),this.css("margin","0",!0),c==="vertical"?(this.css("padding-top",r/2+"px",!0),this.css("padding-bottom",r/2+"px",!0),this.css("padding-left","20px"),this.css("padding-right","20px"),this.css(a,"vertical")):(this.css("padding-top","20px"),this.css("padding-bottom","20px"),this.css("padding-left",r/2+"px",!0),this.css("padding-right",r/2+"px",!0),this.css(a,"horizontal")),this.css("box-sizing","border-box"),this.css("max-width","inherit"),this.css(h,"auto"),this.css(o,r+"px"),this.css(u,i+"px"),this.css("-webkit-line-box-contain","block glyphs replaced")}scaler(e,t,i){var r="scale("+e+")",s="";this.css("transform-origin","top left"),(t>=0||i>=0)&&(s=" translate("+(t||0)+"px, "+(i||0)+"px )"),this.css("transform",r+s)}fit(e,t,i){var r=this.viewport(),s=parseInt(r.width),a=parseInt(r.height),o=e/s,u=t/a,h=o<u?o:u;if(this.layoutStyle("paginated"),this.width(s),this.height(a),this.overflow("hidden"),this.scaler(h,0,0),this.css("background-size",s*h+"px "+a*h+"px"),this.css("background-color","transparent"),i&&i.properties.includes("page-spread-left")){var f=e-s*h;this.css("margin-left",f+"px")}}direction(e){this.documentElement&&(this.documentElement.style.direction=e)}mapPage(e,t,i,r,s){var a=new Ki(t,s);return a.page(this,e,i,r)}linksHandler(){Eo(this.content,e=>{this.emit(Q.CONTENTS.LINK_CLICKED,e)})}writingMode(e){let t=ri("writing-mode");return e&&this.documentElement&&(this.documentElement.style[t]=e),this.window.getComputedStyle(this.documentElement)[t]||""}layoutStyle(e){return e&&(this._layoutStyle=e,navigator.epubReadingSystem.layoutStyle=this._layoutStyle),this._layoutStyle||"paginated"}epubReadingSystem(e,t){return navigator.epubReadingSystem={name:e,version:t,layoutStyle:this.layoutStyle(),hasFeature:function(i){switch(i){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!1;default:return!1}}},navigator.epubReadingSystem}destroy(){this.removeListeners()}}Rt(Xr.prototype);class Oo{constructor(e){this.rendition=e,this.highlights=[],this.underlines=[],this.marks=[],this._annotations={},this._annotationsBySectionIndex={},this.rendition.hooks.render.register(this.inject.bind(this)),this.rendition.hooks.unloaded.register(this.clear.bind(this))}add(e,t,i,r,s,a){let o=encodeURI(t+e),h=new we(t).spinePos,f=new Is({type:e,cfiRange:t,data:i,sectionIndex:h,cb:r,className:s,styles:a});return this._annotations[o]=f,h in this._annotationsBySectionIndex?this._annotationsBySectionIndex[h].push(o):this._annotationsBySectionIndex[h]=[o],this.rendition.views().forEach(b=>{f.sectionIndex===b.index&&f.attach(b)}),f}remove(e,t){let i=encodeURI(e+t);if(i in this._annotations){let r=this._annotations[i];if(t&&r.type!==t)return;this.rendition.views().forEach(a=>{this._removeFromAnnotationBySectionIndex(r.sectionIndex,i),r.sectionIndex===a.index&&r.detach(a)}),delete this._annotations[i]}}_removeFromAnnotationBySectionIndex(e,t){this._annotationsBySectionIndex[e]=this._annotationsAt(e).filter(i=>i!==t)}_annotationsAt(e){return this._annotationsBySectionIndex[e]}highlight(e,t,i,r,s){return this.add("highlight",e,t,i,r,s)}underline(e,t,i,r,s){return this.add("underline",e,t,i,r,s)}mark(e,t,i){return this.add("mark",e,t,i)}each(){return this._annotations.forEach.apply(this._annotations,arguments)}inject(e){let t=e.index;t in this._annotationsBySectionIndex&&this._annotationsBySectionIndex[t].forEach(r=>{this._annotations[r].attach(e)})}clear(e){let t=e.index;t in this._annotationsBySectionIndex&&this._annotationsBySectionIndex[t].forEach(r=>{this._annotations[r].detach(e)})}show(){}hide(){}}class Is{constructor({type:e,cfiRange:t,data:i,sectionIndex:r,cb:s,className:a,styles:o}){this.type=e,this.cfiRange=t,this.data=i,this.sectionIndex=r,this.mark=void 0,this.cb=s,this.className=a,this.styles=o}update(e){this.data=e}attach(e){let{cfiRange:t,data:i,type:r,mark:s,cb:a,className:o,styles:u}=this,h;return r==="highlight"?h=e.highlight(t,i,a,o,u):r==="underline"?h=e.underline(t,i,a,o,u):r==="mark"&&(h=e.mark(t,i,a)),this.mark=h,this.emit(Q.ANNOTATION.ATTACH,h),h}detach(e){let{cfiRange:t,type:i}=this,r;return e&&(i==="highlight"?r=e.unhighlight(t):i==="underline"?r=e.ununderline(t):i==="mark"&&(r=e.unmark(t))),this.mark=void 0,this.emit(Q.ANNOTATION.DETACH,r),r}text(){}}Rt(Is.prototype);var Lt={},nr={};Object.defineProperty(nr,"__esModule",{value:!0});nr.createElement=Os;function Os(n){return document.createElementNS("http://www.w3.org/2000/svg",n)}nr.default={createElement:Os};var Ii={};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.proxyMouse=Bs;Ii.clone=Ls;Ii.default={proxyMouse:Bs};function Bs(n,e){function t(a){for(var o=e.length-1;o>=0;o--){var u=e[o],h=a.clientX,f=a.clientY;if(a.touches&&a.touches.length&&(h=a.touches[0].clientX,f=a.touches[0].clientY),!!Bo(u,n,h,f)){u.dispatchEvent(Ls(a));break}}}if(n.nodeName==="iframe"||n.nodeName==="IFRAME")try{this.target=n.contentDocument}catch{this.target=n}else this.target=n;for(var i=["mouseup","mousedown","click","touchstart"],r=0;r<i.length;r++){var s=i[r];this.target.addEventListener(s,function(a){return t(a)},!1)}}function Ls(n){var e=Object.assign({},n,{bubbles:!1});try{return new MouseEvent(n.type,e)}catch{var t=document.createEvent("MouseEvents");return t.initMouseEvent(n.type,!1,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),t}}function Bo(n,e,t,i){var r=e.getBoundingClientRect();function s(f,c,b){var g=f.top-r.top,S=f.left-r.left,T=g+f.height,d=S+f.width;return g<=b&&S<=c&&T>b&&d>c}var a=n.getBoundingClientRect();if(!s(a,t,i))return!1;for(var o=n.getClientRects(),u=0,h=o.length;u<h;u++)if(s(o[u],t,i))return!0;return!1}var Ji,$r;Object.defineProperty(Lt,"__esModule",{value:!0});var Fs=Lt.Underline=$r=Lt.Highlight=Lt.Mark=Ji=Lt.Pane=void 0,Lo=function n(e,t,i){e===null&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(r===void 0){var s=Object.getPrototypeOf(e);return s===null?void 0:n(s,t,i)}else{if("value"in r)return r.value;var a=r.get;return a===void 0?void 0:a.call(i)}},sr=function(){function n(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e}}(),Fo=nr,Ci=Ps(Fo),Po=Ii,zo=Ps(Po);function Ps(n){return n&&n.__esModule?n:{default:n}}function zs(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:n}function Ms(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}function ar(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}Ji=Lt.Pane=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document.body;ar(this,n),this.target=e,this.element=Ci.default.createElement("svg"),this.marks=[],this.element.style.position="absolute",this.element.setAttribute("pointer-events","none"),zo.default.proxyMouse(this.target,this.marks),this.container=t,this.container.appendChild(this.element),this.render()}return sr(n,[{key:"addMark",value:function(t){var i=Ci.default.createElement("g");return this.element.appendChild(i),t.bind(i,this.container),this.marks.push(t),t.render(),t}},{key:"removeMark",value:function(t){var i=this.marks.indexOf(t);if(i!==-1){var r=t.unbind();this.element.removeChild(r),this.marks.splice(i,1)}}},{key:"render",value:function(){Wo(this.element,qo(this.target,this.container));var t=!0,i=!1,r=void 0;try{for(var s=this.marks[Symbol.iterator](),a;!(t=(a=s.next()).done);t=!0){var o=a.value;o.render()}}catch(u){i=!0,r=u}finally{try{!t&&s.return&&s.return()}finally{if(i)throw r}}}}]),n}();var Mo=Lt.Mark=function(){function n(){ar(this,n),this.element=null}return sr(n,[{key:"bind",value:function(t,i){this.element=t,this.container=i}},{key:"unbind",value:function(){var t=this.element;return this.element=null,t}},{key:"render",value:function(){}},{key:"dispatchEvent",value:function(t){this.element&&this.element.dispatchEvent(t)}},{key:"getBoundingClientRect",value:function(){return this.element.getBoundingClientRect()}},{key:"getClientRects",value:function(){for(var t=[],i=this.element.firstChild;i;)t.push(i.getBoundingClientRect()),i=i.nextSibling;return t}},{key:"filteredRanges",value:function(){var t=Array.from(this.range.getClientRects());return t.filter(function(i){for(var r=0;r<t.length;r++){if(t[r]===i)return!0;var s=jo(t[r],i);if(s)return!1}return!0})}}]),n}(),Uo=$r=Lt.Highlight=function(n){Ms(e,n);function e(t,i,r,s){ar(this,e);var a=zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return a.range=t,a.className=i,a.data=r||{},a.attributes=s||{},a}return sr(e,[{key:"bind",value:function(i,r){Lo(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"bind",this).call(this,i,r);for(var s in this.data)this.data.hasOwnProperty(s)&&(this.element.dataset[s]=this.data[s]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&this.element.setAttribute(s,this.attributes[s]);this.className&&this.element.classList.add(this.className)}},{key:"render",value:function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(var i=this.element.ownerDocument.createDocumentFragment(),r=this.filteredRanges(),s=this.element.getBoundingClientRect(),a=this.container.getBoundingClientRect(),o=0,u=r.length;o<u;o++){var h=r[o],f=Ci.default.createElement("rect");f.setAttribute("x",h.left-s.left+a.left),f.setAttribute("y",h.top-s.top+a.top),f.setAttribute("height",h.height),f.setAttribute("width",h.width),i.appendChild(f)}this.element.appendChild(i)}}]),e}(Mo);Fs=Lt.Underline=function(n){Ms(e,n);function e(t,i,r,s){return ar(this,e),zs(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,i,r,s))}return sr(e,[{key:"render",value:function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(var i=this.element.ownerDocument.createDocumentFragment(),r=this.filteredRanges(),s=this.element.getBoundingClientRect(),a=this.container.getBoundingClientRect(),o=0,u=r.length;o<u;o++){var h=r[o],f=Ci.default.createElement("rect");f.setAttribute("x",h.left-s.left+a.left),f.setAttribute("y",h.top-s.top+a.top),f.setAttribute("height",h.height),f.setAttribute("width",h.width),f.setAttribute("fill","none");var c=Ci.default.createElement("line");c.setAttribute("x1",h.left-s.left+a.left),c.setAttribute("x2",h.left-s.left+a.left+h.width),c.setAttribute("y1",h.top-s.top+a.top+h.height-1),c.setAttribute("y2",h.top-s.top+a.top+h.height-1),c.setAttribute("stroke-width",1),c.setAttribute("stroke","black"),c.setAttribute("stroke-linecap","square"),i.appendChild(f),i.appendChild(c)}this.element.appendChild(i)}}]),e}(Uo);function qo(n,e){var t=e.getBoundingClientRect(),i=n.getBoundingClientRect();return{top:i.top-t.top,left:i.left-t.left,height:n.scrollHeight,width:n.scrollWidth}}function Wo(n,e){n.style.setProperty("top",e.top+"px","important"),n.style.setProperty("left",e.left+"px","important"),n.style.setProperty("height",e.height+"px","important"),n.style.setProperty("width",e.width+"px","important")}function jo(n,e){return e.right<=n.right&&e.left>=n.left&&e.top>=n.top&&e.bottom<=n.bottom}class Us{constructor(e,t){this.settings=et({ignoreClass:"",axis:void 0,direction:void 0,width:0,height:0,layout:void 0,globalLayoutProperties:{},method:void 0,forceRight:!1,allowScriptedContent:!1,allowPopups:!1},t||{}),this.id="epubjs-view-"+ir(),this.section=e,this.index=e.index,this.element=this.container(this.settings.axis),this.added=!1,this.displayed=!1,this.rendered=!1,this.fixedWidth=0,this.fixedHeight=0,this.epubcfi=new we,this.layout=this.settings.layout,this.pane=void 0,this.highlights={},this.underlines={},this.marks={}}container(e){var t=document.createElement("div");return t.classList.add("epub-view"),t.style.height="0px",t.style.width="0px",t.style.overflow="hidden",t.style.position="relative",t.style.display="block",e&&e=="horizontal"?t.style.flex="none":t.style.flex="initial",t}create(){return this.iframe?this.iframe:(this.element||(this.element=this.createContainer()),this.iframe=document.createElement("iframe"),this.iframe.id=this.id,this.iframe.scrolling="no",this.iframe.style.overflow="hidden",this.iframe.seamless="seamless",this.iframe.style.border="none",this.iframe.sandbox="allow-same-origin",this.settings.allowScriptedContent&&(this.iframe.sandbox+=" allow-scripts"),this.settings.allowPopups&&(this.iframe.sandbox+=" allow-popups"),this.iframe.setAttribute("enable-annotation","true"),this.resizing=!0,this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.iframe.style.width="0",this.iframe.style.height="0",this._width=0,this._height=0,this.element.setAttribute("ref",this.index),this.added=!0,this.elementBounds=zi(this.element),"srcdoc"in this.iframe?this.supportsSrcdoc=!0:this.supportsSrcdoc=!1,this.settings.method||(this.settings.method=this.supportsSrcdoc?"srcdoc":"write"),this.iframe)}render(e,t){return this.create(),this.size(),this.sectionRender||(this.sectionRender=this.section.render(e)),this.sectionRender.then(function(i){return this.load(i)}.bind(this)).then(function(){let i=this.contents.writingMode(),r;return this.settings.flow==="scrolled"?r=i.indexOf("vertical")===0?"horizontal":"vertical":r=i.indexOf("vertical")===0?"vertical":"horizontal",i.indexOf("vertical")===0&&this.settings.flow==="paginated"&&(this.layout.delta=this.layout.height),this.setAxis(r),this.emit(Q.VIEWS.AXIS,r),this.setWritingMode(i),this.emit(Q.VIEWS.WRITING_MODE,i),this.layout.format(this.contents,this.section,this.axis),this.addListeners(),new Promise((s,a)=>{this.expand(),this.settings.forceRight&&(this.element.style.marginLeft=this.width()+"px"),s()})}.bind(this),function(i){return this.emit(Q.VIEWS.LOAD_ERROR,i),new Promise((r,s)=>{s(i)})}.bind(this)).then(function(){this.emit(Q.VIEWS.RENDERED,this.section)}.bind(this))}reset(){this.iframe&&(this.iframe.style.width="0",this.iframe.style.height="0",this._width=0,this._height=0,this._textWidth=void 0,this._contentWidth=void 0,this._textHeight=void 0,this._contentHeight=void 0),this._needsReframe=!0}size(e,t){var i=e||this.settings.width,r=t||this.settings.height;this.layout.name==="pre-paginated"?this.lock("both",i,r):this.settings.axis==="horizontal"?this.lock("height",i,r):this.lock("width",i,r),this.settings.width=i,this.settings.height=r}lock(e,t,i){var r=Zi(this.element),s;this.iframe?s=Zi(this.iframe):s={width:0,height:0},e=="width"&&ze(t)&&(this.lockedWidth=t-r.width-s.width),e=="height"&&ze(i)&&(this.lockedHeight=i-r.height-s.height),e==="both"&&ze(t)&&ze(i)&&(this.lockedWidth=t-r.width-s.width,this.lockedHeight=i-r.height-s.height),this.displayed&&this.iframe&&this.expand()}expand(e){var t=this.lockedWidth,i=this.lockedHeight,r;!this.iframe||this._expanding||(this._expanding=!0,this.layout.name==="pre-paginated"?(t=this.layout.columnWidth,i=this.layout.height):this.settings.axis==="horizontal"?(t=this.contents.textWidth(),t%this.layout.pageWidth>0&&(t=Math.ceil(t/this.layout.pageWidth)*this.layout.pageWidth),this.settings.forceEvenPages&&(r=t/this.layout.pageWidth,this.layout.divisor>1&&this.layout.name==="reflowable"&&r%2>0&&(t+=this.layout.pageWidth))):this.settings.axis==="vertical"&&(i=this.contents.textHeight(),this.settings.flow==="paginated"&&i%this.layout.height>0&&(i=Math.ceil(i/this.layout.height)*this.layout.height)),(this._needsReframe||t!=this._width||i!=this._height)&&this.reframe(t,i),this._expanding=!1)}reframe(e,t){var i;ze(e)&&(this.element.style.width=e+"px",this.iframe.style.width=e+"px",this._width=e),ze(t)&&(this.element.style.height=t+"px",this.iframe.style.height=t+"px",this._height=t);let r=this.prevBounds?e-this.prevBounds.width:e,s=this.prevBounds?t-this.prevBounds.height:t;i={width:e,height:t,widthDelta:r,heightDelta:s},this.pane&&this.pane.render(),requestAnimationFrame(()=>{let a;for(let o in this.marks)this.marks.hasOwnProperty(o)&&(a=this.marks[o],this.placeMark(a.element,a.range))}),this.onResize(this,i),this.emit(Q.VIEWS.RESIZED,i),this.prevBounds=i,this.elementBounds=zi(this.element)}load(e){var t=new be,i=t.promise;if(!this.iframe)return t.reject(new Error("No Iframe Available")),i;if(this.iframe.onload=function(s){this.onLoad(s,t)}.bind(this),this.settings.method==="blobUrl")this.blobUrl=Yi(e,"application/xhtml+xml"),this.iframe.src=this.blobUrl,this.element.appendChild(this.iframe);else if(this.settings.method==="srcdoc")this.iframe.srcdoc=e,this.element.appendChild(this.iframe);else{if(this.element.appendChild(this.iframe),this.document=this.iframe.contentDocument,!this.document)return t.reject(new Error("No Document Available")),i;if(this.iframe.contentDocument.open(),window.MSApp&&MSApp.execUnsafeLocalFunction){var r=this;MSApp.execUnsafeLocalFunction(function(){r.iframe.contentDocument.write(e)})}else this.iframe.contentDocument.write(e);this.iframe.contentDocument.close()}return i}onLoad(e,t){this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.contents=new Xr(this.document,this.document.body,this.section.cfiBase,this.section.index),this.rendering=!1;var i=this.document.querySelector("link[rel='canonical']");i?i.setAttribute("href",this.section.canonical):(i=this.document.createElement("link"),i.setAttribute("rel","canonical"),i.setAttribute("href",this.section.canonical),this.document.querySelector("head").appendChild(i)),this.contents.on(Q.CONTENTS.EXPAND,()=>{this.displayed&&this.iframe&&(this.expand(),this.contents&&this.layout.format(this.contents))}),this.contents.on(Q.CONTENTS.RESIZE,r=>{this.displayed&&this.iframe&&(this.expand(),this.contents&&this.layout.format(this.contents))}),t.resolve(this.contents)}setLayout(e){this.layout=e,this.contents&&(this.layout.format(this.contents),this.expand())}setAxis(e){this.settings.axis=e,e=="horizontal"?this.element.style.flex="none":this.element.style.flex="initial",this.size()}setWritingMode(e){this.writingMode=e}addListeners(){}removeListeners(e){}display(e){var t=new be;return this.displayed?t.resolve(this):this.render(e).then(function(){this.emit(Q.VIEWS.DISPLAYED,this),this.onDisplayed(this),this.displayed=!0,t.resolve(this)}.bind(this),function(i){t.reject(i,this)}),t.promise}show(){this.element.style.visibility="visible",this.iframe&&(this.iframe.style.visibility="visible",this.iframe.style.transform="translateZ(0)",this.iframe.offsetWidth,this.iframe.style.transform=null),this.emit(Q.VIEWS.SHOWN,this)}hide(){this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.stopExpanding=!0,this.emit(Q.VIEWS.HIDDEN,this)}offset(){return{top:this.element.offsetTop,left:this.element.offsetLeft}}width(){return this._width}height(){return this._height}position(){return this.element.getBoundingClientRect()}locationOf(e){this.iframe.getBoundingClientRect();var t=this.contents.locationOf(e,this.settings.ignoreClass);return{left:t.left,top:t.top}}onDisplayed(e){}onResize(e,t){}bounds(e){return(e||!this.elementBounds)&&(this.elementBounds=zi(this.element)),this.elementBounds}highlight(e,t={},i,r="epubjs-hl",s={}){if(!this.contents)return;const a=Object.assign({fill:"yellow","fill-opacity":"0.3","mix-blend-mode":"multiply"},s);let o=this.contents.range(e),u=()=>{this.emit(Q.VIEWS.MARK_CLICKED,e,t)};t.epubcfi=e,this.pane||(this.pane=new Ji(this.iframe,this.element));let h=new $r(o,r,t,a),f=this.pane.addMark(h);return this.highlights[e]={mark:f,element:f.element,listeners:[u,i]},f.element.setAttribute("ref",r),f.element.addEventListener("click",u),f.element.addEventListener("touchstart",u),i&&(f.element.addEventListener("click",i),f.element.addEventListener("touchstart",i)),f}underline(e,t={},i,r="epubjs-ul",s={}){if(!this.contents)return;const a=Object.assign({stroke:"black","stroke-opacity":"0.3","mix-blend-mode":"multiply"},s);let o=this.contents.range(e),u=()=>{this.emit(Q.VIEWS.MARK_CLICKED,e,t)};t.epubcfi=e,this.pane||(this.pane=new Ji(this.iframe,this.element));let h=new Fs(o,r,t,a),f=this.pane.addMark(h);return this.underlines[e]={mark:f,element:f.element,listeners:[u,i]},f.element.setAttribute("ref",r),f.element.addEventListener("click",u),f.element.addEventListener("touchstart",u),i&&(f.element.addEventListener("click",i),f.element.addEventListener("touchstart",i)),f}mark(e,t={},i){if(!this.contents)return;if(e in this.marks)return this.marks[e];let r=this.contents.range(e);if(!r)return;let s=r.commonAncestorContainer,a=s.nodeType===1?s:s.parentNode,o=h=>{this.emit(Q.VIEWS.MARK_CLICKED,e,t)};r.collapsed&&s.nodeType===1?(r=new Range,r.selectNodeContents(s)):r.collapsed&&(r=new Range,r.selectNodeContents(a));let u=this.document.createElement("a");return u.setAttribute("ref","epubjs-mk"),u.style.position="absolute",u.dataset.epubcfi=e,t&&Object.keys(t).forEach(h=>{u.dataset[h]=t[h]}),i&&(u.addEventListener("click",i),u.addEventListener("touchstart",i)),u.addEventListener("click",o),u.addEventListener("touchstart",o),this.placeMark(u,r),this.element.appendChild(u),this.marks[e]={element:u,range:r,listeners:[o,i]},a}placeMark(e,t){let i,r,s;if(this.layout.name==="pre-paginated"||this.settings.axis!=="horizontal"){let o=t.getBoundingClientRect();i=o.top,r=o.right}else{let o=t.getClientRects(),u;for(var a=0;a!=o.length;a++)u=o[a],(!s||u.left<s)&&(s=u.left,r=Math.ceil(s/this.layout.props.pageWidth)*this.layout.props.pageWidth-this.layout.gap/2,i=u.top)}e.style.top=`${i}px`,e.style.left=`${r}px`}unhighlight(e){let t;e in this.highlights&&(t=this.highlights[e],this.pane.removeMark(t.mark),t.listeners.forEach(i=>{i&&(t.element.removeEventListener("click",i),t.element.removeEventListener("touchstart",i))}),delete this.highlights[e])}ununderline(e){let t;e in this.underlines&&(t=this.underlines[e],this.pane.removeMark(t.mark),t.listeners.forEach(i=>{i&&(t.element.removeEventListener("click",i),t.element.removeEventListener("touchstart",i))}),delete this.underlines[e])}unmark(e){let t;e in this.marks&&(t=this.marks[e],this.element.removeChild(t.element),t.listeners.forEach(i=>{i&&(t.element.removeEventListener("click",i),t.element.removeEventListener("touchstart",i))}),delete this.marks[e])}destroy(){for(let e in this.highlights)this.unhighlight(e);for(let e in this.underlines)this.ununderline(e);for(let e in this.marks)this.unmark(e);this.blobUrl&&Es(this.blobUrl),this.displayed&&(this.displayed=!1,this.removeListeners(),this.contents.destroy(),this.stopExpanding=!0,this.element.removeChild(this.iframe),this.pane&&(this.pane.element.remove(),this.pane=void 0),this.iframe=void 0,this.contents=void 0,this._textWidth=null,this._textHeight=null,this._width=null,this._height=null)}}Rt(Us.prototype);function Ho(){var n="reverse",e=Vo();return document.body.appendChild(e),e.scrollLeft>0?n="default":typeof Element<"u"&&Element.prototype.scrollIntoView?(e.children[0].children[1].scrollIntoView(),e.scrollLeft<0&&(n="negative")):(e.scrollLeft=1,e.scrollLeft===0&&(n="negative")),document.body.removeChild(e),n}function Vo(){var n=document.createElement("div");n.dir="rtl",n.style.position="fixed",n.style.width="1px",n.style.height="1px",n.style.top="0px",n.style.left="0px",n.style.overflow="hidden";var e=document.createElement("div");e.style.width="2px";var t=document.createElement("span");t.style.width="1px",t.style.display="inline-block";var i=document.createElement("span");return i.style.width="1px",i.style.display="inline-block",e.appendChild(t),e.appendChild(i),n.appendChild(e),n}function Zo(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Kr=Zo,Go=typeof gt=="object"&&gt&&gt.Object===Object&&gt,Yo=Go,Xo=Yo,$o=typeof self=="object"&&self&&self.Object===Object&&self,Ko=Xo||$o||Function("return this")(),qs=Ko,Jo=qs,Qo=function(){return Jo.Date.now()},eu=Qo,tu=/\s/;function iu(n){for(var e=n.length;e--&&tu.test(n.charAt(e)););return e}var ru=iu,nu=ru,su=/^\s+/;function au(n){return n&&n.slice(0,nu(n)+1).replace(su,"")}var ou=au,uu=qs,lu=uu.Symbol,Ws=lu,kn=Ws,js=Object.prototype,hu=js.hasOwnProperty,fu=js.toString,bi=kn?kn.toStringTag:void 0;function cu(n){var e=hu.call(n,bi),t=n[bi];try{n[bi]=void 0;var i=!0}catch{}var r=fu.call(n);return i&&(e?n[bi]=t:delete n[bi]),r}var du=cu,pu=Object.prototype,vu=pu.toString;function gu(n){return vu.call(n)}var mu=gu,Nn=Ws,yu=du,bu=mu,wu="[object Null]",_u="[object Undefined]",Rn=Nn?Nn.toStringTag:void 0;function Eu(n){return n==null?n===void 0?_u:wu:Rn&&Rn in Object(n)?yu(n):bu(n)}var xu=Eu;function Au(n){return n!=null&&typeof n=="object"}var Du=Au,Cu=xu,Su=Du,Tu="[object Symbol]";function ku(n){return typeof n=="symbol"||Su(n)&&Cu(n)==Tu}var Nu=ku,Ru=ou,In=Kr,Iu=Nu,On=NaN,Ou=/^[-+]0x[0-9a-f]+$/i,Bu=/^0b[01]+$/i,Lu=/^0o[0-7]+$/i,Fu=parseInt;function Pu(n){if(typeof n=="number")return n;if(Iu(n))return On;if(In(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=In(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Ru(n);var t=Bu.test(n);return t||Lu.test(n)?Fu(n.slice(2),t?2:8):Ou.test(n)?On:+n}var zu=Pu,Mu=Kr,_r=eu,Bn=zu,Uu="Expected a function",qu=Math.max,Wu=Math.min;function ju(n,e,t){var i,r,s,a,o,u,h=0,f=!1,c=!1,b=!0;if(typeof n!="function")throw new TypeError(Uu);e=Bn(e)||0,Mu(t)&&(f=!!t.leading,c="maxWait"in t,s=c?qu(Bn(t.maxWait)||0,e):s,b="trailing"in t?!!t.trailing:b);function g(A){var C=i,R=r;return i=r=void 0,h=A,a=n.apply(R,C),a}function S(A){return h=A,o=setTimeout(p,e),f?g(A):a}function T(A){var C=A-u,R=A-h,z=e-C;return c?Wu(z,s-R):z}function d(A){var C=A-u,R=A-h;return u===void 0||C>=e||C<0||c&&R>=s}function p(){var A=_r();if(d(A))return y(A);o=setTimeout(p,T(A))}function y(A){return o=void 0,b&&i?g(A):(i=r=void 0,a)}function D(){o!==void 0&&clearTimeout(o),h=0,i=u=r=o=void 0}function I(){return o===void 0?a:y(_r())}function w(){var A=_r(),C=d(A);if(i=arguments,r=this,u=A,C){if(o===void 0)return S(u);if(c)return clearTimeout(o),o=setTimeout(p,e),g(u)}return o===void 0&&(o=setTimeout(p,e)),a}return w.cancel=D,w.flush=I,w}var Hs=ju;const Hu=ci(Hs);var Vu=Hs,Zu=Kr,Gu="Expected a function";function Yu(n,e,t){var i=!0,r=!0;if(typeof n!="function")throw new TypeError(Gu);return Zu(t)&&(i="leading"in t?!!t.leading:i,r="trailing"in t?!!t.trailing:r),Vu(n,e,{leading:i,maxWait:e,trailing:r})}var Xu=Yu;const $u=ci(Xu);class Ku{constructor(e){this.settings=e||{},this.id="epubjs-container-"+ir(),this.container=this.create(this.settings),this.settings.hidden&&(this.wrapper=this.wrap(this.container))}create(e){let t=e.height,i=e.width,r=e.overflow||!1,s=e.axis||"vertical",a=e.direction;et(this.settings,e),e.height&&ze(e.height)&&(t=e.height+"px"),e.width&&ze(e.width)&&(i=e.width+"px");let o=document.createElement("div");return o.id=this.id,o.classList.add("epub-container"),o.style.wordSpacing="0",o.style.lineHeight="0",o.style.verticalAlign="top",o.style.position="relative",s==="horizontal"&&(o.style.display="flex",o.style.flexDirection="row",o.style.flexWrap="nowrap"),i&&(o.style.width=i),t&&(o.style.height=t),r&&(r==="scroll"&&s==="vertical"?(o.style["overflow-y"]=r,o.style["overflow-x"]="hidden"):r==="scroll"&&s==="horizontal"?(o.style["overflow-y"]="hidden",o.style["overflow-x"]=r):o.style.overflow=r),a&&(o.dir=a,o.style.direction=a),a&&this.settings.fullsize&&(document.body.style.direction=a),o}wrap(e){var t=document.createElement("div");return t.style.visibility="hidden",t.style.overflow="hidden",t.style.width="0",t.style.height="0",t.appendChild(e),t}getElement(e){var t;if(ms(e)?t=e:typeof e=="string"&&(t=document.getElementById(e)),!t)throw new Error("Not an Element");return t}attachTo(e){var t=this.getElement(e),i;if(t)return this.settings.hidden?i=this.wrapper:i=this.container,t.appendChild(i),this.element=t,t}getContainer(){return this.container}onResize(e){(!ze(this.settings.width)||!ze(this.settings.height))&&(this.resizeFunc=$u(e,50),window.addEventListener("resize",this.resizeFunc,!1))}onOrientationChange(e){this.orientationChangeFunc=e,window.addEventListener("orientationchange",this.orientationChangeFunc,!1)}size(e,t){var i;let r=e||this.settings.width,s=t||this.settings.height;e===null?(i=this.element.getBoundingClientRect(),i.width&&(e=Math.floor(i.width),this.container.style.width=e+"px")):ze(e)?this.container.style.width=e+"px":this.container.style.width=e,t===null?(i=i||this.element.getBoundingClientRect(),i.height&&(t=i.height,this.container.style.height=t+"px")):ze(t)?this.container.style.height=t+"px":this.container.style.height=t,ze(e)||(e=this.container.clientWidth),ze(t)||(t=this.container.clientHeight),this.containerStyles=window.getComputedStyle(this.container),this.containerPadding={left:parseFloat(this.containerStyles["padding-left"])||0,right:parseFloat(this.containerStyles["padding-right"])||0,top:parseFloat(this.containerStyles["padding-top"])||0,bottom:parseFloat(this.containerStyles["padding-bottom"])||0};let a=Gi(),o=window.getComputedStyle(document.body),u={left:parseFloat(o["padding-left"])||0,right:parseFloat(o["padding-right"])||0,top:parseFloat(o["padding-top"])||0,bottom:parseFloat(o["padding-bottom"])||0};return r||(e=a.width-u.left-u.right),(this.settings.fullsize&&!s||!s)&&(t=a.height-u.top-u.bottom),{width:e-this.containerPadding.left-this.containerPadding.right,height:t-this.containerPadding.top-this.containerPadding.bottom}}bounds(){let e;return this.container.style.overflow!=="visible"&&(e=this.container&&this.container.getBoundingClientRect()),!e||!e.width||!e.height?Gi():e}getSheet(){var e=document.createElement("style");return e.appendChild(document.createTextNode("")),document.head.appendChild(e),e.sheet}addStyleRules(e,t){var i="#"+this.id+" ",r="";this.sheet||(this.sheet=this.getSheet()),t.forEach(function(s){for(var a in s)s.hasOwnProperty(a)&&(r+=a+":"+s[a]+";")}),this.sheet.insertRule(i+e+" {"+r+"}",0)}axis(e){e==="horizontal"?(this.container.style.display="flex",this.container.style.flexDirection="row",this.container.style.flexWrap="nowrap"):this.container.style.display="block",this.settings.axis=e}direction(e){this.container&&(this.container.dir=e,this.container.style.direction=e),this.settings.fullsize&&(document.body.style.direction=e),this.settings.dir=e}overflow(e){this.container&&(e==="scroll"&&this.settings.axis==="vertical"?(this.container.style["overflow-y"]=e,this.container.style["overflow-x"]="hidden"):e==="scroll"&&this.settings.axis==="horizontal"?(this.container.style["overflow-y"]="hidden",this.container.style["overflow-x"]=e):this.container.style.overflow=e),this.settings.overflow=e}destroy(){this.element&&(this.settings.hidden?this.wrapper:this.container,this.element.contains(this.container)&&this.element.removeChild(this.container),window.removeEventListener("resize",this.resizeFunc),window.removeEventListener("orientationChange",this.orientationChangeFunc))}}class Ju{constructor(e){this.container=e,this._views=[],this.length=0,this.hidden=!1}all(){return this._views}first(){return this._views[0]}last(){return this._views[this._views.length-1]}indexOf(e){return this._views.indexOf(e)}slice(){return this._views.slice.apply(this._views,arguments)}get(e){return this._views[e]}append(e){return this._views.push(e),this.container&&this.container.appendChild(e.element),this.length++,e}prepend(e){return this._views.unshift(e),this.container&&this.container.insertBefore(e.element,this.container.firstChild),this.length++,e}insert(e,t){return this._views.splice(t,0,e),this.container&&(t<this.container.children.length?this.container.insertBefore(e.element,this.container.children[t]):this.container.appendChild(e.element)),this.length++,e}remove(e){var t=this._views.indexOf(e);t>-1&&this._views.splice(t,1),this.destroy(e),this.length--}destroy(e){e.displayed&&e.destroy(),this.container&&this.container.removeChild(e.element),e=null}forEach(){return this._views.forEach.apply(this._views,arguments)}clear(){var e,t=this.length;if(this.length){for(var i=0;i<t;i++)e=this._views[i],this.destroy(e);this._views=[],this.length=0}}find(e){for(var t,i=this.length,r=0;r<i;r++)if(t=this._views[r],t.displayed&&t.section.index==e.index)return t}displayed(){for(var e=[],t,i=this.length,r=0;r<i;r++)t=this._views[r],t.displayed&&e.push(t);return e}show(){for(var e,t=this.length,i=0;i<t;i++)e=this._views[i],e.displayed&&e.show();this.hidden=!1}hide(){for(var e,t=this.length,i=0;i<t;i++)e=this._views[i],e.displayed&&e.hide();this.hidden=!0}}class Qi{constructor(e){this.name="default",this.optsSettings=e.settings,this.View=e.view,this.request=e.request,this.renditionQueue=e.queue,this.q=new Yr(this),this.settings=et(this.settings||{},{infinite:!0,hidden:!1,width:void 0,height:void 0,axis:void 0,writingMode:void 0,flow:"scrolled",ignoreClass:"",fullsize:void 0,allowScriptedContent:!1,allowPopups:!1}),et(this.settings,e.settings||{}),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,method:this.settings.method,width:0,height:0,forceEvenPages:!0,allowScriptedContent:this.settings.allowScriptedContent,allowPopups:this.settings.allowPopups},this.rendered=!1}render(e,t){let i=e.tagName;typeof this.settings.fullsize>"u"&&i&&(i.toLowerCase()=="body"||i.toLowerCase()=="html")&&(this.settings.fullsize=!0),this.settings.fullsize&&(this.settings.overflow="visible",this.overflow=this.settings.overflow),this.settings.size=t,this.settings.rtlScrollType=Ho(),this.stage=new Ku({width:t.width,height:t.height,overflow:this.overflow,hidden:this.settings.hidden,axis:this.settings.axis,fullsize:this.settings.fullsize,direction:this.settings.direction}),this.stage.attachTo(e),this.container=this.stage.getContainer(),this.views=new Ju(this.container),this._bounds=this.bounds(),this._stageSize=this.stage.size(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.stage.onResize(this.onResized.bind(this)),this.stage.onOrientationChange(this.onOrientationChange.bind(this)),this.addEventListeners(),this.layout&&this.updateLayout(),this.rendered=!0}addEventListeners(){var e;window.addEventListener("unload",function(t){this.destroy()}.bind(this)),this.settings.fullsize?e=window:e=this.container,this._onScroll=this.onScroll.bind(this),e.addEventListener("scroll",this._onScroll)}removeEventListeners(){var e;this.settings.fullsize?e=window:e=this.container,e.removeEventListener("scroll",this._onScroll),this._onScroll=void 0}destroy(){clearTimeout(this.orientationTimeout),clearTimeout(this.resizeTimeout),clearTimeout(this.afterScrolled),this.clear(),this.removeEventListeners(),this.stage.destroy(),this.rendered=!1}onOrientationChange(e){let{orientation:t}=window;this.optsSettings.resizeOnOrientationChange&&this.resize(),clearTimeout(this.orientationTimeout),this.orientationTimeout=setTimeout(function(){this.orientationTimeout=void 0,this.optsSettings.resizeOnOrientationChange&&this.resize(),this.emit(Q.MANAGERS.ORIENTATION_CHANGE,t)}.bind(this),500)}onResized(e){this.resize()}resize(e,t,i){let r=this.stage.size(e,t);if(this.winBounds=Gi(),this.orientationTimeout&&this.winBounds.width===this.winBounds.height){this._stageSize=void 0;return}this._stageSize&&this._stageSize.width===r.width&&this._stageSize.height===r.height||(this._stageSize=r,this._bounds=this.bounds(),this.clear(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.updateLayout(),this.emit(Q.MANAGERS.RESIZED,{width:this._stageSize.width,height:this._stageSize.height},i))}createView(e,t){return new this.View(e,et(this.viewSettings,{forceRight:t}))}handleNextPrePaginated(e,t,i){let r;if(this.layout.name==="pre-paginated"&&this.layout.divisor>1){if(e||t.index===0)return;if(r=t.next(),r&&!r.properties.includes("page-spread-left"))return i.call(this,r)}}display(e,t){var i=new be,r=i.promise;(t===e.href||ze(t))&&(t=void 0);var s=this.views.find(e);if(s&&e&&this.layout.name!=="pre-paginated"){let o=s.offset();if(this.settings.direction==="ltr")this.scrollTo(o.left,o.top,!0);else{let u=s.width();this.scrollTo(o.left+u,o.top,!0)}if(t){let u=s.locationOf(t),h=s.width();this.moveTo(u,h)}return i.resolve(),r}this.clear();let a=!1;return this.layout.name==="pre-paginated"&&this.layout.divisor===2&&e.properties.includes("page-spread-right")&&(a=!0),this.add(e,a).then(function(o){if(t){let u=o.locationOf(t),h=o.width();this.moveTo(u,h)}}.bind(this),o=>{i.reject(o)}).then(function(){return this.handleNextPrePaginated(a,e,this.add)}.bind(this)).then(function(){this.views.show(),i.resolve()}.bind(this)),r}afterDisplayed(e){this.emit(Q.MANAGERS.ADDED,e)}afterResized(e){this.emit(Q.MANAGERS.RESIZE,e.section)}moveTo(e,t){var i=0,r=0;this.isPaginated?(i=Math.floor(e.left/this.layout.delta)*this.layout.delta,i+this.layout.delta>this.container.scrollWidth&&(i=this.container.scrollWidth-this.layout.delta),r=Math.floor(e.top/this.layout.delta)*this.layout.delta,r+this.layout.delta>this.container.scrollHeight&&(r=this.container.scrollHeight-this.layout.delta)):r=e.top,this.settings.direction==="rtl"&&(i=i+this.layout.delta,i=i-t),this.scrollTo(i,r,!0)}add(e,t){var i=this.createView(e,t);return this.views.append(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(Q.VIEWS.AXIS,r=>{this.updateAxis(r)}),i.on(Q.VIEWS.WRITING_MODE,r=>{this.updateWritingMode(r)}),i.display(this.request)}append(e,t){var i=this.createView(e,t);return this.views.append(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(Q.VIEWS.AXIS,r=>{this.updateAxis(r)}),i.on(Q.VIEWS.WRITING_MODE,r=>{this.updateWritingMode(r)}),i.display(this.request)}prepend(e,t){var i=this.createView(e,t);return i.on(Q.VIEWS.RESIZED,r=>{this.counter(r)}),this.views.prepend(i),i.onDisplayed=this.afterDisplayed.bind(this),i.onResize=this.afterResized.bind(this),i.on(Q.VIEWS.AXIS,r=>{this.updateAxis(r)}),i.on(Q.VIEWS.WRITING_MODE,r=>{this.updateWritingMode(r)}),i.display(this.request)}counter(e){this.settings.axis==="vertical"?this.scrollBy(0,e.heightDelta,!0):this.scrollBy(e.widthDelta,0,!0)}next(){var e,t;let i=this.settings.direction;if(this.views.length&&(this.isPaginated&&this.settings.axis==="horizontal"&&(!i||i==="ltr")?(this.scrollLeft=this.container.scrollLeft,t=this.container.scrollLeft+this.container.offsetWidth+this.layout.delta,t<=this.container.scrollWidth?this.scrollBy(this.layout.delta,0,!0):e=this.views.last().section.next()):this.isPaginated&&this.settings.axis==="horizontal"&&i==="rtl"?(this.scrollLeft=this.container.scrollLeft,this.settings.rtlScrollType==="default"?(t=this.container.scrollLeft,t>0?this.scrollBy(this.layout.delta,0,!0):e=this.views.last().section.next()):(t=this.container.scrollLeft+this.layout.delta*-1,t>this.container.scrollWidth*-1?this.scrollBy(this.layout.delta,0,!0):e=this.views.last().section.next())):this.isPaginated&&this.settings.axis==="vertical"?(this.scrollTop=this.container.scrollTop,this.container.scrollTop+this.container.offsetHeight<this.container.scrollHeight?this.scrollBy(0,this.layout.height,!0):e=this.views.last().section.next()):e=this.views.last().section.next(),e)){this.clear(),this.updateLayout();let r=!1;return this.layout.name==="pre-paginated"&&this.layout.divisor===2&&e.properties.includes("page-spread-right")&&(r=!0),this.append(e,r).then(function(){return this.handleNextPrePaginated(r,e,this.append)}.bind(this),s=>s).then(function(){!this.isPaginated&&this.settings.axis==="horizontal"&&this.settings.direction==="rtl"&&this.settings.rtlScrollType==="default"&&this.scrollTo(this.container.scrollWidth,0,!0),this.views.show()}.bind(this))}}prev(){var e,t;let i=this.settings.direction;if(this.views.length&&(this.isPaginated&&this.settings.axis==="horizontal"&&(!i||i==="ltr")?(this.scrollLeft=this.container.scrollLeft,t=this.container.scrollLeft,t>0?this.scrollBy(-this.layout.delta,0,!0):e=this.views.first().section.prev()):this.isPaginated&&this.settings.axis==="horizontal"&&i==="rtl"?(this.scrollLeft=this.container.scrollLeft,this.settings.rtlScrollType==="default"?(t=this.container.scrollLeft+this.container.offsetWidth,t<this.container.scrollWidth?this.scrollBy(-this.layout.delta,0,!0):e=this.views.first().section.prev()):(t=this.container.scrollLeft,t<0?this.scrollBy(-this.layout.delta,0,!0):e=this.views.first().section.prev())):this.isPaginated&&this.settings.axis==="vertical"?(this.scrollTop=this.container.scrollTop,this.container.scrollTop>0?this.scrollBy(0,-this.layout.height,!0):e=this.views.first().section.prev()):e=this.views.first().section.prev(),e)){this.clear(),this.updateLayout();let r=!1;return this.layout.name==="pre-paginated"&&this.layout.divisor===2&&typeof e.prev()!="object"&&(r=!0),this.prepend(e,r).then(function(){var s;if(this.layout.name==="pre-paginated"&&this.layout.divisor>1&&(s=e.prev(),s))return this.prepend(s)}.bind(this),s=>s).then(function(){this.isPaginated&&this.settings.axis==="horizontal"&&(this.settings.direction==="rtl"?this.settings.rtlScrollType==="default"?this.scrollTo(0,0,!0):this.scrollTo(this.container.scrollWidth*-1+this.layout.delta,0,!0):this.scrollTo(this.container.scrollWidth-this.layout.delta,0,!0)),this.views.show()}.bind(this))}}current(){var e=this.visible();return e.length?e[e.length-1]:null}clear(){this.views&&(this.views.hide(),this.scrollTo(0,0,!0),this.views.clear())}currentLocation(){return this.updateLayout(),this.isPaginated&&this.settings.axis==="horizontal"?this.location=this.paginatedLocation():this.location=this.scrolledLocation(),this.location}scrolledLocation(){let e=this.visible(),t=this.container.getBoundingClientRect(),i=t.height<window.innerHeight?t.height:window.innerHeight,r=t.width<window.innerWidth?t.width:window.innerWidth,s=this.settings.axis==="vertical";this.settings.direction;let a=0,o=0;return this.settings.fullsize&&(a=s?window.scrollY:window.scrollX),e.map(h=>{let{index:f,href:c}=h.section,b=h.position(),g=h.width(),S=h.height(),T,d,p,y;s?(T=a+t.top-b.top+o,d=T+i-o,y=this.layout.count(S,i).pages,p=i):(T=a+t.left-b.left+o,d=T+r-o,y=this.layout.count(g,r).pages,p=r);let D=Math.ceil(T/p),I=[],w=Math.ceil(d/p);if(this.settings.direction==="rtl"&&!s){let R=D;D=y-w,w=y-R}I=[];for(var A=D;A<=w;A++){let R=A+1;I.push(R)}let C=this.mapping.page(h.contents,h.section.cfiBase,T,d);return{index:f,href:c,pages:I,totalPages:y,mapping:C}})}paginatedLocation(){let e=this.visible(),t=this.container.getBoundingClientRect(),i=0,r=0;return this.settings.fullsize&&(i=window.scrollX),e.map(a=>{let{index:o,href:u}=a.section,h,f=a.position(),c=a.width(),b,g,S;this.settings.direction==="rtl"?(h=t.right-i,S=Math.min(Math.abs(h-f.left),this.layout.width)-r,g=f.width-(f.right-h)-r,b=g-S):(h=t.left+i,S=Math.min(f.right-h,this.layout.width)-r,b=h-f.left+r,g=b+S),r+=S;let T=this.mapping.page(a.contents,a.section.cfiBase,b,g),d=this.layout.count(c).pages,p=Math.floor(b/this.layout.pageWidth),y=[],D=Math.floor(g/this.layout.pageWidth);if(p<0&&(p=0,D=D+1),this.settings.direction==="rtl"){let w=p;p=d-D,D=d-w}for(var I=p+1;I<=D;I++){let w=I;y.push(w)}return{index:o,href:u,pages:y,totalPages:d,mapping:T}})}isVisible(e,t,i,r){var s=e.position(),a=r||this.bounds();return this.settings.axis==="horizontal"&&s.right>a.left-t&&s.left<a.right+i?!0:this.settings.axis==="vertical"&&s.bottom>a.top-t&&s.top<a.bottom+i}visible(){for(var e=this.bounds(),t=this.views.displayed(),i=t.length,r=[],s,a,o=0;o<i;o++)a=t[o],s=this.isVisible(a,0,0,e),s===!0&&r.push(a);return r}scrollBy(e,t,i){let r=this.settings.direction==="rtl"?-1:1;i&&(this.ignore=!0),this.settings.fullsize?window.scrollBy(e*r,t*r):(e&&(this.container.scrollLeft+=e*r),t&&(this.container.scrollTop+=t)),this.scrolled=!0}scrollTo(e,t,i){i&&(this.ignore=!0),this.settings.fullsize?window.scrollTo(e,t):(this.container.scrollLeft=e,this.container.scrollTop=t),this.scrolled=!0}onScroll(){let e,t;this.settings.fullsize?(e=window.scrollY,t=window.scrollX):(e=this.container.scrollTop,t=this.container.scrollLeft),this.scrollTop=e,this.scrollLeft=t,this.ignore?this.ignore=!1:(this.emit(Q.MANAGERS.SCROLL,{top:e,left:t}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.emit(Q.MANAGERS.SCROLLED,{top:this.scrollTop,left:this.scrollLeft})}.bind(this),20))}bounds(){var e;return e=this.stage.bounds(),e}applyLayout(e){this.layout=e,this.updateLayout(),this.views&&this.views.length>0&&this.layout.name==="pre-paginated"&&this.display(this.views.first().section)}updateLayout(){this.stage&&(this._stageSize=this.stage.size(),this.isPaginated?(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),this.settings.offset=this.layout.delta/this.layout.divisor):this.layout.calculate(this._stageSize.width,this._stageSize.height),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))}setLayout(e){this.viewSettings.layout=e,this.mapping=new Ki(e.props,this.settings.direction,this.settings.axis),this.views&&this.views.forEach(function(t){t&&t.setLayout(e)})}updateWritingMode(e){this.writingMode=e}updateAxis(e,t){!t&&e===this.settings.axis||(this.settings.axis=e,this.stage&&this.stage.axis(e),this.viewSettings.axis=e,this.mapping&&(this.mapping=new Ki(this.layout.props,this.settings.direction,this.settings.axis)),this.layout&&(e==="vertical"?this.layout.spread("none"):this.layout.spread(this.layout.settings.spread)))}updateFlow(e,t="auto"){let i=e==="paginated"||e==="auto";this.isPaginated=i,e==="scrolled-doc"||e==="scrolled-continuous"||e==="scrolled"?this.updateAxis("vertical"):this.updateAxis("horizontal"),this.viewSettings.flow=e,this.settings.overflow?this.overflow=this.settings.overflow:this.overflow=i?"hidden":t,this.stage&&this.stage.overflow(this.overflow),this.updateLayout()}getContents(){var e=[];return this.views&&this.views.forEach(function(t){const i=t&&t.contents;i&&e.push(i)}),e}direction(e="ltr"){this.settings.direction=e,this.stage&&this.stage.direction(e),this.viewSettings.direction=e,this.updateLayout()}isRendered(){return this.rendered}}Rt(Qi.prototype);const Qu={easeInCubic:function(n){return Math.pow(n,3)}};class Rr{constructor(e,t){this.settings=et({duration:80,minVelocity:.2,minDistance:10,easing:Qu.easeInCubic},t||{}),this.supportsTouch=this.supportsTouch(),this.supportsTouch&&this.setup(e)}setup(e){this.manager=e,this.layout=this.manager.layout,this.fullsize=this.manager.settings.fullsize,this.fullsize?(this.element=this.manager.stage.element,this.scroller=window,this.disableScroll()):(this.element=this.manager.stage.container,this.scroller=this.element,this.element.style.WebkitOverflowScrolling="touch"),this.manager.settings.offset=this.layout.width,this.manager.settings.afterScrolledTimeout=this.settings.duration*2,this.isVertical=this.manager.settings.axis==="vertical",!(!this.manager.isPaginated||this.isVertical)&&(this.touchCanceler=!1,this.resizeCanceler=!1,this.snapping=!1,this.scrollLeft,this.scrollTop,this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0,this.addListeners())}supportsTouch(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}disableScroll(){this.element.style.overflow="hidden"}enableScroll(){this.element.style.overflow=""}addListeners(){this._onResize=this.onResize.bind(this),window.addEventListener("resize",this._onResize),this._onScroll=this.onScroll.bind(this),this.scroller.addEventListener("scroll",this._onScroll),this._onTouchStart=this.onTouchStart.bind(this),this.scroller.addEventListener("touchstart",this._onTouchStart,{passive:!0}),this.on("touchstart",this._onTouchStart),this._onTouchMove=this.onTouchMove.bind(this),this.scroller.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.on("touchmove",this._onTouchMove),this._onTouchEnd=this.onTouchEnd.bind(this),this.scroller.addEventListener("touchend",this._onTouchEnd,{passive:!0}),this.on("touchend",this._onTouchEnd),this._afterDisplayed=this.afterDisplayed.bind(this),this.manager.on(Q.MANAGERS.ADDED,this._afterDisplayed)}removeListeners(){window.removeEventListener("resize",this._onResize),this._onResize=void 0,this.scroller.removeEventListener("scroll",this._onScroll),this._onScroll=void 0,this.scroller.removeEventListener("touchstart",this._onTouchStart,{passive:!0}),this.off("touchstart",this._onTouchStart),this._onTouchStart=void 0,this.scroller.removeEventListener("touchmove",this._onTouchMove,{passive:!0}),this.off("touchmove",this._onTouchMove),this._onTouchMove=void 0,this.scroller.removeEventListener("touchend",this._onTouchEnd,{passive:!0}),this.off("touchend",this._onTouchEnd),this._onTouchEnd=void 0,this.manager.off(Q.MANAGERS.ADDED,this._afterDisplayed),this._afterDisplayed=void 0}afterDisplayed(e){let t=e.contents;["touchstart","touchmove","touchend"].forEach(i=>{t.on(i,r=>this.triggerViewEvent(r,t))})}triggerViewEvent(e,t){this.emit(e.type,e,t)}onScroll(e){this.scrollLeft=this.fullsize?window.scrollX:this.scroller.scrollLeft,this.scrollTop=this.fullsize?window.scrollY:this.scroller.scrollTop}onResize(e){this.resizeCanceler=!0}onTouchStart(e){let{screenX:t,screenY:i}=e.touches[0];this.fullsize&&this.enableScroll(),this.touchCanceler=!0,this.startTouchX||(this.startTouchX=t,this.startTouchY=i,this.startTime=this.now()),this.endTouchX=t,this.endTouchY=i,this.endTime=this.now()}onTouchMove(e){let{screenX:t,screenY:i}=e.touches[0],r=Math.abs(i-this.endTouchY);this.touchCanceler=!0,!this.fullsize&&r<10&&(this.element.scrollLeft-=t-this.endTouchX),this.endTouchX=t,this.endTouchY=i,this.endTime=this.now()}onTouchEnd(e){this.fullsize&&this.disableScroll(),this.touchCanceler=!1;let t=this.wasSwiped();t!==0?this.snap(t):this.snap(),this.startTouchX=void 0,this.startTouchY=void 0,this.startTime=void 0,this.endTouchX=void 0,this.endTouchY=void 0,this.endTime=void 0}wasSwiped(){let e=this.layout.pageWidth*this.layout.divisor,t=this.endTouchX-this.startTouchX,i=Math.abs(t),r=this.endTime-this.startTime,s=t/r,a=this.settings.minVelocity;if(i<=this.settings.minDistance||i>=e)return 0;if(s>a)return-1;if(s<-a)return 1}needsSnap(){let e=this.scrollLeft,t=this.layout.pageWidth*this.layout.divisor;return e%t!==0}snap(e=0){let t=this.scrollLeft,i=this.layout.pageWidth*this.layout.divisor,r=Math.round(t/i)*i;return e&&(r+=e*i),this.smoothScrollTo(r)}smoothScrollTo(e){const t=new be,i=this.scrollLeft,r=this.now(),s=this.settings.duration,a=this.settings.easing;this.snapping=!0;function o(){const u=this.now(),h=Math.min(1,(u-r)/s);if(a(h),this.touchCanceler||this.resizeCanceler){this.resizeCanceler=!1,this.snapping=!1,t.resolve();return}h<1?(window.requestAnimationFrame(o.bind(this)),this.scrollTo(i+(e-i)*h,0)):(this.scrollTo(e,0),this.snapping=!1,t.resolve())}return o.call(this),t.promise}scrollTo(e=0,t=0){this.fullsize?window.scroll(e,t):(this.scroller.scrollLeft=e,this.scroller.scrollTop=t)}now(){return"now"in window.performance?performance.now():new Date().getTime()}destroy(){this.scroller&&(this.fullsize&&this.enableScroll(),this.removeListeners(),this.scroller=void 0)}}Rt(Rr.prototype);class el extends Qi{constructor(e){super(e),this.name="continuous",this.settings=et(this.settings||{},{infinite:!0,overflow:void 0,axis:void 0,writingMode:void 0,flow:"scrolled",offset:500,offsetDelta:250,width:void 0,height:void 0,snap:!1,afterScrolledTimeout:10,allowScriptedContent:!1,allowPopups:!1}),et(this.settings,e.settings||{}),e.settings.gap!="undefined"&&e.settings.gap===0&&(this.settings.gap=e.settings.gap),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,flow:this.settings.flow,layout:this.layout,width:0,height:0,forceEvenPages:!1,allowScriptedContent:this.settings.allowScriptedContent,allowPopups:this.settings.allowPopups},this.scrollTop=0,this.scrollLeft=0}display(e,t){return Qi.prototype.display.call(this,e,t).then(function(){return this.fill()}.bind(this))}fill(e){var t=e||new be;return this.q.enqueue(()=>this.check()).then(i=>{i?this.fill(t):t.resolve()}),t.promise}moveTo(e){var t=0,i=0;this.isPaginated?(t=Math.floor(e.left/this.layout.delta)*this.layout.delta,t+this.settings.offsetDelta):(i=e.top,e.top+this.settings.offsetDelta),(t>0||i>0)&&this.scrollBy(t,i,!0)}afterResized(e){this.emit(Q.MANAGERS.RESIZE,e.section)}removeShownListeners(e){e.onDisplayed=function(){}}add(e){var t=this.createView(e);return this.views.append(t),t.on(Q.VIEWS.RESIZED,i=>{t.expanded=!0}),t.on(Q.VIEWS.AXIS,i=>{this.updateAxis(i)}),t.on(Q.VIEWS.WRITING_MODE,i=>{this.updateWritingMode(i)}),t.onDisplayed=this.afterDisplayed.bind(this),t.onResize=this.afterResized.bind(this),t.display(this.request)}append(e){var t=this.createView(e);return t.on(Q.VIEWS.RESIZED,i=>{t.expanded=!0}),t.on(Q.VIEWS.AXIS,i=>{this.updateAxis(i)}),t.on(Q.VIEWS.WRITING_MODE,i=>{this.updateWritingMode(i)}),this.views.append(t),t.onDisplayed=this.afterDisplayed.bind(this),t}prepend(e){var t=this.createView(e);return t.on(Q.VIEWS.RESIZED,i=>{this.counter(i),t.expanded=!0}),t.on(Q.VIEWS.AXIS,i=>{this.updateAxis(i)}),t.on(Q.VIEWS.WRITING_MODE,i=>{this.updateWritingMode(i)}),this.views.prepend(t),t.onDisplayed=this.afterDisplayed.bind(this),t}counter(e){this.settings.axis==="vertical"?this.scrollBy(0,e.heightDelta,!0):this.scrollBy(e.widthDelta,0,!0)}update(e){for(var t=this.bounds(),i=this.views.all(),r=i.length,s=typeof e<"u"?e:this.settings.offset||0,a,o,u=new be,h=[],f=0;f<r;f++)if(o=i[f],a=this.isVisible(o,s,s,t),a===!0)if(o.displayed)o.show();else{let c=o.display(this.request).then(function(b){b.show()},b=>{o.hide()});h.push(c)}else this.q.enqueue(o.destroy.bind(o)),clearTimeout(this.trimTimeout),this.trimTimeout=setTimeout(function(){this.q.enqueue(this.trim.bind(this))}.bind(this),250);return h.length?Promise.all(h).catch(c=>{u.reject(c)}):(u.resolve(),u.promise)}check(e,t){var i=new be,r=[],s=this.settings.axis==="horizontal",a=this.settings.offset||0;e&&s&&(a=e),t&&!s&&(a=t);var o=this._bounds;let u=s?this.scrollLeft:this.scrollTop,h=s?Math.floor(o.width):o.height,f=s?this.container.scrollWidth:this.container.scrollHeight,c=this.writingMode&&this.writingMode.indexOf("vertical")===0?"vertical":"horizontal",b=this.settings.rtlScrollType,g=this.settings.direction==="rtl";this.settings.fullsize?(s&&g&&b==="negative"||!s&&g&&b==="default")&&(u=u*-1):(g&&b==="default"&&c==="horizontal"&&(u=f-h-u),g&&b==="negative"&&c==="horizontal"&&(u=u*-1));let S=()=>{let D=this.views.first(),I=D&&D.section.prev();I&&r.push(this.prepend(I))},T=()=>{let D=this.views.last(),I=D&&D.section.next();I&&r.push(this.append(I))},d=u+h+a,p=u-a;d>=f&&T(),p<0&&S();let y=r.map(D=>D.display(this.request));return r.length?Promise.all(y).then(()=>this.check()).then(()=>this.update(a),D=>D):(this.q.enqueue(function(){this.update()}.bind(this)),i.resolve(!1),i.promise)}trim(){for(var e=new be,t=this.views.displayed(),i=t[0],r=t[t.length-1],s=this.views.indexOf(i),a=this.views.indexOf(r),o=this.views.slice(0,s),u=this.views.slice(a+1),h=0;h<o.length-1;h++)this.erase(o[h],o);for(var f=1;f<u.length;f++)this.erase(u[f]);return e.resolve(),e.promise}erase(e,t){var i,r;this.settings.fullsize?(i=window.scrollY,r=window.scrollX):(i=this.container.scrollTop,r=this.container.scrollLeft);var s=e.bounds();this.views.remove(e),t&&(this.settings.axis==="vertical"?this.scrollTo(0,i-s.height,!0):this.settings.direction==="rtl"?this.settings.fullsize?this.scrollTo(r+Math.floor(s.width),0,!0):this.scrollTo(r,0,!0):this.scrollTo(r-Math.floor(s.width),0,!0))}addEventListeners(e){window.addEventListener("unload",function(t){this.ignore=!0,this.destroy()}.bind(this)),this.addScrollListeners(),this.isPaginated&&this.settings.snap&&(this.snapper=new Rr(this,this.settings.snap&&typeof this.settings.snap=="object"&&this.settings.snap))}addScrollListeners(){var e;this.tick=Vr;let t=this.settings.direction==="rtl"&&this.settings.rtlScrollType==="default"?-1:1;this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.settings.fullsize?(e=window,this.scrollTop=window.scrollY*t,this.scrollLeft=window.scrollX*t):(e=this.container,this.scrollTop=this.container.scrollTop,this.scrollLeft=this.container.scrollLeft),this._onScroll=this.onScroll.bind(this),e.addEventListener("scroll",this._onScroll),this._scrolled=Hu(this.scrolled.bind(this),30),this.didScroll=!1}removeEventListeners(){var e;this.settings.fullsize?e=window:e=this.container,e.removeEventListener("scroll",this._onScroll),this._onScroll=void 0}onScroll(){let e,t,i=this.settings.direction==="rtl"&&this.settings.rtlScrollType==="default"?-1:1;this.settings.fullsize?(e=window.scrollY*i,t=window.scrollX*i):(e=this.container.scrollTop,t=this.container.scrollLeft),this.scrollTop=e,this.scrollLeft=t,this.ignore?this.ignore=!1:this._scrolled(),this.scrollDeltaVert+=Math.abs(e-this.prevScrollTop),this.scrollDeltaHorz+=Math.abs(t-this.prevScrollLeft),this.prevScrollTop=e,this.prevScrollLeft=t,clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(function(){this.scrollDeltaVert=0,this.scrollDeltaHorz=0}.bind(this),150),clearTimeout(this.afterScrolled),this.didScroll=!1}scrolled(){this.q.enqueue(function(){return this.check()}.bind(this)),this.emit(Q.MANAGERS.SCROLL,{top:this.scrollTop,left:this.scrollLeft}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.snapper&&this.snapper.supportsTouch&&this.snapper.needsSnap()||this.emit(Q.MANAGERS.SCROLLED,{top:this.scrollTop,left:this.scrollLeft})}.bind(this),this.settings.afterScrolledTimeout)}next(){let e=this.layout.props.name==="pre-paginated"&&this.layout.props.spread?this.layout.props.delta*2:this.layout.props.delta;this.views.length&&(this.isPaginated&&this.settings.axis==="horizontal"?this.scrollBy(e,0,!0):this.scrollBy(0,this.layout.height,!0),this.q.enqueue(function(){return this.check()}.bind(this)))}prev(){let e=this.layout.props.name==="pre-paginated"&&this.layout.props.spread?this.layout.props.delta*2:this.layout.props.delta;this.views.length&&(this.isPaginated&&this.settings.axis==="horizontal"?this.scrollBy(-e,0,!0):this.scrollBy(0,-this.layout.height,!0),this.q.enqueue(function(){return this.check()}.bind(this)))}updateFlow(e){this.rendered&&this.snapper&&(this.snapper.destroy(),this.snapper=void 0),super.updateFlow(e,"scroll"),this.rendered&&this.isPaginated&&this.settings.snap&&(this.snapper=new Rr(this,this.settings.snap&&typeof this.settings.snap=="object"&&this.settings.snap))}destroy(){super.destroy(),this.snapper&&this.snapper.destroy()}}class Jr{constructor(e,t){this.settings=et(this.settings||{},{width:null,height:null,ignoreClass:"",manager:"default",view:"iframe",flow:null,layout:null,spread:null,minSpreadWidth:800,stylesheet:null,resizeOnOrientationChange:!0,script:null,snap:!1,defaultDirection:"ltr",allowScriptedContent:!1,allowPopups:!1}),et(this.settings,t),typeof this.settings.manager=="object"&&(this.manager=this.settings.manager),this.book=e,this.hooks={},this.hooks.display=new Dt(this),this.hooks.serialize=new Dt(this),this.hooks.content=new Dt(this),this.hooks.unloaded=new Dt(this),this.hooks.layout=new Dt(this),this.hooks.render=new Dt(this),this.hooks.show=new Dt(this),this.hooks.content.register(this.handleLinks.bind(this)),this.hooks.content.register(this.passEvents.bind(this)),this.hooks.content.register(this.adjustImages.bind(this)),this.book.spine.hooks.content.register(this.injectIdentifier.bind(this)),this.settings.stylesheet&&this.book.spine.hooks.content.register(this.injectStylesheet.bind(this)),this.settings.script&&this.book.spine.hooks.content.register(this.injectScript.bind(this)),this.themes=new No(this),this.annotations=new Oo(this),this.epubcfi=new we,this.q=new Yr(this),this.location=void 0,this.q.enqueue(this.book.opened),this.starting=new be,this.started=this.starting.promise,this.q.enqueue(this.start)}setManager(e){this.manager=e}requireManager(e){var t;return typeof e=="string"&&e==="default"?t=Qi:typeof e=="string"&&e==="continuous"?t=el:t=e,t}requireView(e){var t;return typeof e=="string"&&e==="iframe"?t=Us:t=e,t}start(){switch(!this.settings.layout&&(this.book.package.metadata.layout==="pre-paginated"||this.book.displayOptions.fixedLayout==="true")&&(this.settings.layout="pre-paginated"),this.book.package.metadata.spread){case"none":this.settings.spread="none";break;case"both":this.settings.spread=!0;break}this.manager||(this.ViewManager=this.requireManager(this.settings.manager),this.View=this.requireView(this.settings.view),this.manager=new this.ViewManager({view:this.View,queue:this.q,request:this.book.load.bind(this.book),settings:this.settings})),this.direction(this.book.package.metadata.direction||this.settings.defaultDirection),this.settings.globalLayoutProperties=this.determineLayoutProperties(this.book.package.metadata),this.flow(this.settings.globalLayoutProperties.flow),this.layout(this.settings.globalLayoutProperties),this.manager.on(Q.MANAGERS.ADDED,this.afterDisplayed.bind(this)),this.manager.on(Q.MANAGERS.REMOVED,this.afterRemoved.bind(this)),this.manager.on(Q.MANAGERS.RESIZED,this.onResized.bind(this)),this.manager.on(Q.MANAGERS.ORIENTATION_CHANGE,this.onOrientationChange.bind(this)),this.manager.on(Q.MANAGERS.SCROLLED,this.reportLocation.bind(this)),this.emit(Q.RENDITION.STARTED),this.starting.resolve()}attachTo(e){return this.q.enqueue(function(){this.manager.render(e,{width:this.settings.width,height:this.settings.height}),this.emit(Q.RENDITION.ATTACHED)}.bind(this))}display(e){return this.displaying&&this.displaying.resolve(),this.q.enqueue(this._display,e)}_display(e){if(this.book){this.epubcfi.isCfiString(e);var t=new be,i=t.promise,r;return this.displaying=t,this.book.locations.length()&&ys(e)&&(e=this.book.locations.cfiFromPercentage(parseFloat(e))),r=this.book.spine.get(e),r?(this.manager.display(r,e).then(()=>{t.resolve(r),this.displaying=void 0,this.emit(Q.RENDITION.DISPLAYED,r),this.reportLocation()},s=>{this.emit(Q.RENDITION.DISPLAY_ERROR,s)}),i):(t.reject(new Error("No Section Found")),i)}}afterDisplayed(e){e.on(Q.VIEWS.MARK_CLICKED,(t,i)=>this.triggerMarkEvent(t,i,e.contents)),this.hooks.render.trigger(e,this).then(()=>{e.contents?this.hooks.content.trigger(e.contents,this).then(()=>{this.emit(Q.RENDITION.RENDERED,e.section,e)}):this.emit(Q.RENDITION.RENDERED,e.section,e)})}afterRemoved(e){this.hooks.unloaded.trigger(e,this).then(()=>{this.emit(Q.RENDITION.REMOVED,e.section,e)})}onResized(e,t){this.emit(Q.RENDITION.RESIZED,{width:e.width,height:e.height},t),this.location&&this.location.start&&this.display(t||this.location.start.cfi)}onOrientationChange(e){this.emit(Q.RENDITION.ORIENTATION_CHANGE,e)}moveTo(e){this.manager.moveTo(e)}resize(e,t,i){e&&(this.settings.width=e),t&&(this.settings.height=t),this.manager.resize(e,t,i)}clear(){this.manager.clear()}next(){return this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this))}prev(){return this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this))}determineLayoutProperties(e){var t,i=this.settings.layout||e.layout||"reflowable",r=this.settings.spread||e.spread||"auto",s=this.settings.orientation||e.orientation||"auto",a=this.settings.flow||e.flow||"auto",o=e.viewport||"",u=this.settings.minSpreadWidth||e.minSpreadWidth||800,h=this.settings.direction||e.direction||"ltr";return(this.settings.width===0||this.settings.width>0)&&(this.settings.height===0||this.settings.height>0),t={layout:i,spread:r,orientation:s,flow:a,viewport:o,minSpreadWidth:u,direction:h},t}flow(e){var t=e;(e==="scrolled"||e==="scrolled-doc"||e==="scrolled-continuous")&&(t="scrolled"),(e==="auto"||e==="paginated")&&(t="paginated"),this.settings.flow=e,this._layout&&this._layout.flow(t),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this.manager&&this.manager.updateFlow(t),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}layout(e){return e&&(this._layout=new Ns(e),this._layout.spread(e.spread,this.settings.minSpreadWidth),this._layout.on(Q.LAYOUT.UPDATED,(t,i)=>{this.emit(Q.RENDITION.LAYOUT,t,i)})),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this._layout}spread(e,t){this.settings.spread=e,t&&(this.settings.minSpreadWidth=t),this._layout&&this._layout.spread(e,t),this.manager&&this.manager.isRendered()&&this.manager.updateLayout()}direction(e){this.settings.direction=e||"ltr",this.manager&&this.manager.direction(this.settings.direction),this.manager&&this.manager.isRendered()&&this.location&&(this.manager.clear(),this.display(this.location.start.cfi))}reportLocation(){return this.q.enqueue(function(){requestAnimationFrame(function(){var i=this.manager.currentLocation();if(i&&i.then&&typeof i.then=="function")i.then(function(r){let s=this.located(r);!s||!s.start||!s.end||(this.location=s,this.emit(Q.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(Q.RENDITION.RELOCATED,this.location))}.bind(this));else if(i){let r=this.located(i);if(!r||!r.start||!r.end)return;this.location=r,this.emit(Q.RENDITION.LOCATION_CHANGED,{index:this.location.start.index,href:this.location.start.href,start:this.location.start.cfi,end:this.location.end.cfi,percentage:this.location.start.percentage}),this.emit(Q.RENDITION.RELOCATED,this.location)}}.bind(this))}.bind(this))}currentLocation(){var e=this.manager.currentLocation();if(e&&e.then&&typeof e.then=="function")e.then(function(t){return this.located(t)}.bind(this));else if(e)return this.located(e)}located(e){if(!e.length)return{};let t=e[0],i=e[e.length-1],r={start:{index:t.index,href:t.href,cfi:t.mapping.start,displayed:{page:t.pages[0]||1,total:t.totalPages}},end:{index:i.index,href:i.href,cfi:i.mapping.end,displayed:{page:i.pages[i.pages.length-1]||1,total:i.totalPages}}},s=this.book.locations.locationFromCfi(t.mapping.start),a=this.book.locations.locationFromCfi(i.mapping.end);s!=null&&(r.start.location=s,r.start.percentage=this.book.locations.percentageFromLocation(s)),a!=null&&(r.end.location=a,r.end.percentage=this.book.locations.percentageFromLocation(a));let o=this.book.pageList.pageFromCfi(t.mapping.start),u=this.book.pageList.pageFromCfi(i.mapping.end);return o!=-1&&(r.start.page=o),u!=-1&&(r.end.page=u),i.index===this.book.spine.last().index&&r.end.displayed.page>=r.end.displayed.total&&(r.atEnd=!0),t.index===this.book.spine.first().index&&r.start.displayed.page===1&&(r.atStart=!0),r}destroy(){this.manager&&this.manager.destroy(),this.book=void 0}passEvents(e){Ui.forEach(t=>{e.on(t,i=>this.triggerViewEvent(i,e))}),e.on(Q.CONTENTS.SELECTED,t=>this.triggerSelectedEvent(t,e))}triggerViewEvent(e,t){this.emit(e.type,e,t)}triggerSelectedEvent(e,t){this.emit(Q.RENDITION.SELECTED,e,t)}triggerMarkEvent(e,t,i){this.emit(Q.RENDITION.MARK_CLICKED,e,t,i)}getRange(e,t){var i=new we(e),r=this.manager.visible().filter(function(s){if(i.spinePos===s.index)return!0});if(r.length)return r[0].contents.range(i,t)}adjustImages(e){if(this._layout.name==="pre-paginated")return new Promise(function(s){s()});let t=e.window.getComputedStyle(e.content,null),i=(e.content.offsetHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)))*.95,r=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight);return e.addStylesheetRules({img:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-r+"px":"100%")+"!important","max-height":i+"px!important","object-fit":"contain","page-break-inside":"avoid","break-inside":"avoid","box-sizing":"border-box"},svg:{"max-width":(this._layout.columnWidth?this._layout.columnWidth-r+"px":"100%")+"!important","max-height":i+"px!important","page-break-inside":"avoid","break-inside":"avoid"}}),new Promise(function(s,a){setTimeout(function(){s()},1)})}getContents(){return this.manager?this.manager.getContents():[]}views(){return(this.manager?this.manager.views:void 0)||[]}handleLinks(e){e&&e.on(Q.CONTENTS.LINK_CLICKED,t=>{let i=this.book.path.relative(t);this.display(i)})}injectStylesheet(e,t){let i=e.createElement("link");i.setAttribute("type","text/css"),i.setAttribute("rel","stylesheet"),i.setAttribute("href",this.settings.stylesheet),e.getElementsByTagName("head")[0].appendChild(i)}injectScript(e,t){let i=e.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("src",this.settings.script),i.textContent=" ",e.getElementsByTagName("head")[0].appendChild(i)}injectIdentifier(e,t){let i=this.book.packaging.metadata.identifier,r=e.createElement("meta");r.setAttribute("name","dc.relation.ispartof"),i&&r.setAttribute("content",i),e.getElementsByTagName("head")[0].appendChild(r)}}Rt(Jr.prototype);function Ht(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vs={exports:{}};/*!

JSZip v3.10.1 - A JavaScript class for generating and reading zip files
<http://stuartk.com/jszip>

(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.

JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/main/LICENSE
*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(i,r,s){function a(h,f){if(!r[h]){if(!i[h]){var c=typeof Ht=="function"&&Ht;if(!f&&c)return c(h,!0);if(o)return o(h,!0);var b=new Error("Cannot find module '"+h+"'");throw b.code="MODULE_NOT_FOUND",b}var g=r[h]={exports:{}};i[h][0].call(g.exports,function(S){var T=i[h][1][S];return a(T||S)},g,g.exports,t,i,r,s)}return r[h].exports}for(var o=typeof Ht=="function"&&Ht,u=0;u<s.length;u++)a(s[u]);return a}({1:[function(t,i,r){var s=t("./utils"),a=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(u){for(var h=[],f,c,b,g,S,T,d,p=0,y=u.length,D=y,I=s.getTypeOf(u)!=="string";p<u.length;)D=y-p,I?(f=u[p++],c=p<y?u[p++]:0,b=p<y?u[p++]:0):(f=u.charCodeAt(p++),c=p<y?u.charCodeAt(p++):0,b=p<y?u.charCodeAt(p++):0),g=f>>2,S=(f&3)<<4|c>>4,T=D>1?(c&15)<<2|b>>6:64,d=D>2?b&63:64,h.push(o.charAt(g)+o.charAt(S)+o.charAt(T)+o.charAt(d));return h.join("")},r.decode=function(u){var h,f,c,b,g,S,T,d=0,p=0,y="data:";if(u.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");u=u.replace(/[^A-Za-z0-9+/=]/g,"");var D=u.length*3/4;if(u.charAt(u.length-1)===o.charAt(64)&&D--,u.charAt(u.length-2)===o.charAt(64)&&D--,D%1!==0)throw new Error("Invalid base64 input, bad content length.");var I;for(a.uint8array?I=new Uint8Array(D|0):I=new Array(D|0);d<u.length;)b=o.indexOf(u.charAt(d++)),g=o.indexOf(u.charAt(d++)),S=o.indexOf(u.charAt(d++)),T=o.indexOf(u.charAt(d++)),h=b<<2|g>>4,f=(g&15)<<4|S>>2,c=(S&3)<<6|T,I[p++]=h,S!==64&&(I[p++]=f),T!==64&&(I[p++]=c);return I}},{"./support":30,"./utils":32}],2:[function(t,i,r){var s=t("./external"),a=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),u=t("./stream/DataLengthProbe");function h(f,c,b,g,S){this.compressedSize=f,this.uncompressedSize=c,this.crc32=b,this.compression=g,this.compressedContent=S}h.prototype={getContentWorker:function(){var f=new a(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),c=this;return f.on("end",function(){if(this.streamInfo.data_length!==c.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),f},getCompressedWorker:function(){return new a(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},h.createWorkerFrom=function(f,c,b){return f.pipe(new o).pipe(new u("uncompressedSize")).pipe(c.compressWorker(b)).pipe(new u("compressedSize")).withStreamInfo("compression",c)},i.exports=h},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,i,r){var s=t("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},r.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,i,r){var s=t("./utils");function a(){for(var f,c=[],b=0;b<256;b++){f=b;for(var g=0;g<8;g++)f=f&1?3988292384^f>>>1:f>>>1;c[b]=f}return c}var o=a();function u(f,c,b,g){var S=o,T=g+b;f=f^-1;for(var d=g;d<T;d++)f=f>>>8^S[(f^c[d])&255];return f^-1}function h(f,c,b,g){var S=o,T=g+b;f=f^-1;for(var d=g;d<T;d++)f=f>>>8^S[(f^c.charCodeAt(d))&255];return f^-1}i.exports=function(c,b){if(typeof c>"u"||!c.length)return 0;var g=s.getTypeOf(c)!=="string";return g?u(b|0,c,c.length,0):h(b|0,c,c.length,0)}},{"./utils":32}],5:[function(t,i,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(t,i,r){var s=null;typeof Promise<"u"?s=Promise:s=t("lie"),i.exports={Promise:s}},{lie:37}],7:[function(t,i,r){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=t("pako"),o=t("./utils"),u=t("./stream/GenericWorker"),h=s?"uint8array":"array";r.magic="\b\0";function f(c,b){u.call(this,"FlateWorker/"+c),this._pako=null,this._pakoAction=c,this._pakoOptions=b,this.meta={}}o.inherits(f,u),f.prototype.processChunk=function(c){this.meta=c.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(h,c.data),!1)},f.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},f.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},f.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var c=this;this._pako.onData=function(b){c.push({data:b,meta:c.meta})}},r.compressWorker=function(c){return new f("Deflate",c)},r.uncompressWorker=function(){return new f("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,i,r){var s=t("../utils"),a=t("../stream/GenericWorker"),o=t("../utf8"),u=t("../crc32"),h=t("../signature"),f=function(p,y){var D="",I;for(I=0;I<y;I++)D+=String.fromCharCode(p&255),p=p>>>8;return D},c=function(p,y){var D=p;return p||(D=y?16893:33204),(D&65535)<<16},b=function(p){return(p||0)&63},g=function(p,y,D,I,w,A){var C=p.file,R=p.compression,z=A!==o.utf8encode,P=s.transformTo("string",A(C.name)),H=s.transformTo("string",o.utf8encode(C.name)),V=C.comment,te=s.transformTo("string",A(V)),ce=s.transformTo("string",o.utf8encode(V)),he=H.length!==C.name.length,ue=ce.length!==V.length,se,ne,me="",Re="",Ae="",le=C.dir,Se=C.date,_e={crc32:0,compressedSize:0,uncompressedSize:0};(!y||D)&&(_e.crc32=p.crc32,_e.compressedSize=p.compressedSize,_e.uncompressedSize=p.uncompressedSize);var Xe=0;y&&(Xe|=8),!z&&(he||ue)&&(Xe|=2048);var je=0,Le=0;le&&(je|=16),w==="UNIX"?(Le=798,je|=c(C.unixPermissions,le)):(Le=20,je|=b(C.dosPermissions)),se=Se.getUTCHours(),se=se<<6,se=se|Se.getUTCMinutes(),se=se<<5,se=se|Se.getUTCSeconds()/2,ne=Se.getUTCFullYear()-1980,ne=ne<<4,ne=ne|Se.getUTCMonth()+1,ne=ne<<5,ne=ne|Se.getUTCDate(),he&&(Re=f(1,1)+f(u(P),4)+H,me+="up"+f(Re.length,2)+Re),ue&&(Ae=f(1,1)+f(u(te),4)+ce,me+="uc"+f(Ae.length,2)+Ae);var ve="";ve+=`
\0`,ve+=f(Xe,2),ve+=R.magic,ve+=f(se,2),ve+=f(ne,2),ve+=f(_e.crc32,4),ve+=f(_e.compressedSize,4),ve+=f(_e.uncompressedSize,4),ve+=f(P.length,2),ve+=f(me.length,2);var Ve=h.LOCAL_FILE_HEADER+ve+P+me,Fe=h.CENTRAL_FILE_HEADER+f(Le,2)+ve+f(te.length,2)+"\0\0\0\0"+f(je,4)+f(I,4)+P+me+te;return{fileRecord:Ve,dirRecord:Fe}},S=function(p,y,D,I,w){var A="",C=s.transformTo("string",w(I));return A=h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+f(p,2)+f(p,2)+f(y,4)+f(D,4)+f(C.length,2)+C,A},T=function(p){var y="";return y=h.DATA_DESCRIPTOR+f(p.crc32,4)+f(p.compressedSize,4)+f(p.uncompressedSize,4),y};function d(p,y,D,I){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=D,this.encodeFileName=I,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(d,a),d.prototype.push=function(p){var y=p.meta.percent||0,D=this.entriesCount,I=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,a.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:D?(y+100*(D-I-1))/D:100}}))},d.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var y=this.streamFiles&&!p.file.dir;if(y){var D=g(p,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:D.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(p){this.accumulate=!1;var y=this.streamFiles&&!p.file.dir,D=g(p,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(D.dirRecord),y)this.push({data:T(p),meta:{percent:100}});else for(this.push({data:D.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var p=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var D=this.bytesWritten-p,I=S(this.dirRecords.length,D,p,this.zipComment,this.encodeFileName);this.push({data:I,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(p){this._sources.push(p);var y=this;return p.on("data",function(D){y.processChunk(D)}),p.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),p.on("error",function(D){y.error(D)}),this},d.prototype.resume=function(){if(!a.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0},d.prototype.error=function(p){var y=this._sources;if(!a.prototype.error.call(this,p))return!1;for(var D=0;D<y.length;D++)try{y[D].error(p)}catch{}return!0},d.prototype.lock=function(){a.prototype.lock.call(this);for(var p=this._sources,y=0;y<p.length;y++)p[y].lock()},i.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,i,r){var s=t("../compressions"),a=t("./ZipFileWorker"),o=function(u,h){var f=u||h,c=s[f];if(!c)throw new Error(f+" is not a valid compression method !");return c};r.generateWorker=function(u,h,f){var c=new a(h.streamFiles,f,h.platform,h.encodeFileName),b=0;try{u.forEach(function(g,S){b++;var T=o(S.options.compression,h.compression),d=S.options.compressionOptions||h.compressionOptions||{},p=S.dir,y=S.date;S._compressWorker(T,d).withStreamInfo("file",{name:g,dir:p,date:y,comment:S.comment||"",unixPermissions:S.unixPermissions,dosPermissions:S.dosPermissions}).pipe(c)}),c.entriesCount=b}catch(g){c.error(g)}return c}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,i,r){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new s;for(var o in this)typeof this[o]!="function"&&(a[o]=this[o]);return a}}s.prototype=t("./object"),s.prototype.loadAsync=t("./load"),s.support=t("./support"),s.defaults=t("./defaults"),s.version="3.10.1",s.loadAsync=function(a,o){return new s().loadAsync(a,o)},s.external=t("./external"),i.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,i,r){var s=t("./utils"),a=t("./external"),o=t("./utf8"),u=t("./zipEntries"),h=t("./stream/Crc32Probe"),f=t("./nodejsUtils");function c(b){return new a.Promise(function(g,S){var T=b.decompressed.getContentWorker().pipe(new h);T.on("error",function(d){S(d)}).on("end",function(){T.streamInfo.crc32!==b.decompressed.crc32?S(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}i.exports=function(b,g){var S=this;return g=s.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),f.isNode&&f.isStream(b)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",b,!0,g.optimizedBinaryString,g.base64).then(function(T){var d=new u(g);return d.load(T),d}).then(function(d){var p=[a.Promise.resolve(d)],y=d.files;if(g.checkCRC32)for(var D=0;D<y.length;D++)p.push(c(y[D]));return a.Promise.all(p)}).then(function(d){for(var p=d.shift(),y=p.files,D=0;D<y.length;D++){var I=y[D],w=I.fileNameStr,A=s.resolve(I.fileNameStr);S.file(A,I.decompressed,{binary:!0,optimizedBinaryString:!0,date:I.date,dir:I.dir,comment:I.fileCommentStr.length?I.fileCommentStr:null,unixPermissions:I.unixPermissions,dosPermissions:I.dosPermissions,createFolders:g.createFolders}),I.dir||(S.file(A).unsafeOriginalName=w)}return p.zipComment.length&&(S.comment=p.zipComment),S})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,i,r){var s=t("../utils"),a=t("../stream/GenericWorker");function o(u,h){a.call(this,"Nodejs stream input adapter for "+u),this._upstreamEnded=!1,this._bindStream(h)}s.inherits(o,a),o.prototype._bindStream=function(u){var h=this;this._stream=u,u.pause(),u.on("data",function(f){h.push({data:f,meta:{percent:0}})}).on("error",function(f){h.isPaused?this.generatedError=f:h.error(f)}).on("end",function(){h.isPaused?h._upstreamEnded=!0:h.end()})},o.prototype.pause=function(){return a.prototype.pause.call(this)?(this._stream.pause(),!0):!1},o.prototype.resume=function(){return a.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1},i.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,i,r){var s=t("readable-stream").Readable,a=t("../utils");a.inherits(o,s);function o(u,h,f){s.call(this,h),this._helper=u;var c=this;u.on("data",function(b,g){c.push(b)||c._helper.pause(),f&&f(g)}).on("error",function(b){c.emit("error",b)}).on("end",function(){c.push(null)})}o.prototype._read=function(){this._helper.resume()},i.exports=o},{"../utils":32,"readable-stream":16}],14:[function(t,i,r){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,a);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,a)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var a=new Buffer(s);return a.fill(0),a},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(t,i,r){var s=t("./utf8"),a=t("./utils"),o=t("./stream/GenericWorker"),u=t("./stream/StreamHelper"),h=t("./defaults"),f=t("./compressedObject"),c=t("./zipObject"),b=t("./generate"),g=t("./nodejsUtils"),S=t("./nodejs/NodejsStreamInputAdapter"),T=function(w,A,C){var R=a.getTypeOf(A),z,P=a.extend(C||{},h);P.date=P.date||new Date,P.compression!==null&&(P.compression=P.compression.toUpperCase()),typeof P.unixPermissions=="string"&&(P.unixPermissions=parseInt(P.unixPermissions,8)),P.unixPermissions&&P.unixPermissions&16384&&(P.dir=!0),P.dosPermissions&&P.dosPermissions&16&&(P.dir=!0),P.dir&&(w=p(w)),P.createFolders&&(z=d(w))&&y.call(this,z,!0);var H=R==="string"&&P.binary===!1&&P.base64===!1;(!C||typeof C.binary>"u")&&(P.binary=!H);var V=A instanceof f&&A.uncompressedSize===0;(V||P.dir||!A||A.length===0)&&(P.base64=!1,P.binary=!0,A="",P.compression="STORE",R="string");var te=null;A instanceof f||A instanceof o?te=A:g.isNode&&g.isStream(A)?te=new S(w,A):te=a.prepareContent(w,A,P.binary,P.optimizedBinaryString,P.base64);var ce=new c(w,te,P);this.files[w]=ce},d=function(w){w.slice(-1)==="/"&&(w=w.substring(0,w.length-1));var A=w.lastIndexOf("/");return A>0?w.substring(0,A):""},p=function(w){return w.slice(-1)!=="/"&&(w+="/"),w},y=function(w,A){return A=typeof A<"u"?A:h.createFolders,w=p(w),this.files[w]||T.call(this,w,null,{dir:!0,createFolders:A}),this.files[w]};function D(w){return Object.prototype.toString.call(w)==="[object RegExp]"}var I={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(w){var A,C,R;for(A in this.files)R=this.files[A],C=A.slice(this.root.length,A.length),C&&A.slice(0,this.root.length)===this.root&&w(C,R)},filter:function(w){var A=[];return this.forEach(function(C,R){w(C,R)&&A.push(R)}),A},file:function(w,A,C){if(arguments.length===1)if(D(w)){var R=w;return this.filter(function(P,H){return!H.dir&&R.test(P)})}else{var z=this.files[this.root+w];return z&&!z.dir?z:null}else w=this.root+w,T.call(this,w,A,C);return this},folder:function(w){if(!w)return this;if(D(w))return this.filter(function(z,P){return P.dir&&w.test(z)});var A=this.root+w,C=y.call(this,A),R=this.clone();return R.root=C.name,R},remove:function(w){w=this.root+w;var A=this.files[w];if(A||(w.slice(-1)!=="/"&&(w+="/"),A=this.files[w]),A&&!A.dir)delete this.files[w];else for(var C=this.filter(function(z,P){return P.name.slice(0,w.length)===w}),R=0;R<C.length;R++)delete this.files[C[R].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(w){var A,C={};try{if(C=a.extend(w||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode}),C.type=C.type.toLowerCase(),C.compression=C.compression.toUpperCase(),C.type==="binarystring"&&(C.type="string"),!C.type)throw new Error("No output type specified.");a.checkSupport(C.type),(C.platform==="darwin"||C.platform==="freebsd"||C.platform==="linux"||C.platform==="sunos")&&(C.platform="UNIX"),C.platform==="win32"&&(C.platform="DOS");var R=C.comment||this.comment||"";A=b.generateWorker(this,C,R)}catch(z){A=new o("error"),A.error(z)}return new u(A,C.type||"string",C.mimeType)},generateAsync:function(w,A){return this.generateInternalStream(w).accumulate(A)},generateNodeStream:function(w,A){return w=w||{},w.type||(w.type="nodebuffer"),this.generateInternalStream(w).toNodejsStream(A)}};i.exports=I},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,i,r){i.exports=t("stream")},{stream:void 0}],17:[function(t,i,r){var s=t("./DataReader"),a=t("../utils");function o(u){s.call(this,u);for(var h=0;h<this.data.length;h++)u[h]=u[h]&255}a.inherits(o,s),o.prototype.byteAt=function(u){return this.data[this.zero+u]},o.prototype.lastIndexOfSignature=function(u){for(var h=u.charCodeAt(0),f=u.charCodeAt(1),c=u.charCodeAt(2),b=u.charCodeAt(3),g=this.length-4;g>=0;--g)if(this.data[g]===h&&this.data[g+1]===f&&this.data[g+2]===c&&this.data[g+3]===b)return g-this.zero;return-1},o.prototype.readAndCheckSignature=function(u){var h=u.charCodeAt(0),f=u.charCodeAt(1),c=u.charCodeAt(2),b=u.charCodeAt(3),g=this.readData(4);return h===g[0]&&f===g[1]&&c===g[2]&&b===g[3]},o.prototype.readData=function(u){if(this.checkOffset(u),u===0)return[];var h=this.data.slice(this.zero+this.index,this.zero+this.index+u);return this.index+=u,h},i.exports=o},{"../utils":32,"./DataReader":18}],18:[function(t,i,r){var s=t("../utils");function a(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var u=0,h;for(this.checkOffset(o),h=this.index+o-1;h>=this.index;h--)u=(u<<8)+this.byteAt(h);return this.index+=o,u},readString:function(o){return s.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC((o>>25&127)+1980,(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(o&31)<<1))}},i.exports=a},{"../utils":32}],19:[function(t,i,r){var s=t("./Uint8ArrayReader"),a=t("../utils");function o(u){s.call(this,u)}a.inherits(o,s),o.prototype.readData=function(u){this.checkOffset(u);var h=this.data.slice(this.zero+this.index,this.zero+this.index+u);return this.index+=u,h},i.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,i,r){var s=t("./DataReader"),a=t("../utils");function o(u){s.call(this,u)}a.inherits(o,s),o.prototype.byteAt=function(u){return this.data.charCodeAt(this.zero+u)},o.prototype.lastIndexOfSignature=function(u){return this.data.lastIndexOf(u)-this.zero},o.prototype.readAndCheckSignature=function(u){var h=this.readData(4);return u===h},o.prototype.readData=function(u){this.checkOffset(u);var h=this.data.slice(this.zero+this.index,this.zero+this.index+u);return this.index+=u,h},i.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,i,r){var s=t("./ArrayReader"),a=t("../utils");function o(u){s.call(this,u)}a.inherits(o,s),o.prototype.readData=function(u){if(this.checkOffset(u),u===0)return new Uint8Array(0);var h=this.data.subarray(this.zero+this.index,this.zero+this.index+u);return this.index+=u,h},i.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,i,r){var s=t("../utils"),a=t("../support"),o=t("./ArrayReader"),u=t("./StringReader"),h=t("./NodeBufferReader"),f=t("./Uint8ArrayReader");i.exports=function(c){var b=s.getTypeOf(c);return s.checkSupport(b),b==="string"&&!a.uint8array?new u(c):b==="nodebuffer"?new h(c):a.uint8array?new f(s.transformTo("uint8array",c)):new o(s.transformTo("array",c))}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,i,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,i,r){var s=t("./GenericWorker"),a=t("../utils");function o(u){s.call(this,"ConvertWorker to "+u),this.destType=u}a.inherits(o,s),o.prototype.processChunk=function(u){this.push({data:a.transformTo(this.destType,u.data),meta:u.meta})},i.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,i,r){var s=t("./GenericWorker"),a=t("../crc32"),o=t("../utils");function u(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}o.inherits(u,s),u.prototype.processChunk=function(h){this.streamInfo.crc32=a(h.data,this.streamInfo.crc32||0),this.push(h)},i.exports=u},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,i,r){var s=t("../utils"),a=t("./GenericWorker");function o(u){a.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}s.inherits(o,a),o.prototype.processChunk=function(u){if(u){var h=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=h+u.data.length}a.prototype.processChunk.call(this,u)},i.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,i,r){var s=t("../utils"),a=t("./GenericWorker"),o=16*1024;function u(h){a.call(this,"DataWorker");var f=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,h.then(function(c){f.dataIsReady=!0,f.data=c,f.max=c&&c.length||0,f.type=s.getTypeOf(c),f.isPaused||f._tickAndRepeat()},function(c){f.error(c)})}s.inherits(u,a),u.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},u.prototype.resume=function(){return a.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0):!1},u.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},u.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var h=o,f=null,c=Math.min(this.max,this.index+h);if(this.index>=this.max)return this.end();switch(this.type){case"string":f=this.data.substring(this.index,c);break;case"uint8array":f=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":f=this.data.slice(this.index,c);break}return this.index=c,this.push({data:f,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=u},{"../utils":32,"./GenericWorker":28}],28:[function(t,i,r){function s(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return this.isFinished?!1:(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var u=0;u<this._listeners[a].length;u++)this._listeners[a][u].call(this,o)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var o=this;return a.on("data",function(u){o.processChunk(u)}),a.on("end",function(){o.end()}),a.on("error",function(u){o.error(u)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var a=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,o){return this.extraStreamInfo[a]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},i.exports=s},{}],29:[function(t,i,r){var s=t("../utils"),a=t("./ConvertWorker"),o=t("./GenericWorker"),u=t("../base64"),h=t("../support"),f=t("../external"),c=null;if(h.nodestream)try{c=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function b(d,p,y){switch(d){case"blob":return s.newBlob(s.transformTo("arraybuffer",p),y);case"base64":return u.encode(p);default:return s.transformTo(d,p)}}function g(d,p){var y,D=0,I=null,w=0;for(y=0;y<p.length;y++)w+=p[y].length;switch(d){case"string":return p.join("");case"array":return Array.prototype.concat.apply([],p);case"uint8array":for(I=new Uint8Array(w),y=0;y<p.length;y++)I.set(p[y],D),D+=p[y].length;return I;case"nodebuffer":return Buffer.concat(p);default:throw new Error("concat : unsupported type '"+d+"'")}}function S(d,p){return new f.Promise(function(y,D){var I=[],w=d._internalType,A=d._outputType,C=d._mimeType;d.on("data",function(R,z){I.push(R),p&&p(z)}).on("error",function(R){I=[],D(R)}).on("end",function(){try{var R=b(A,g(w,I),C);y(R)}catch(z){D(z)}I=[]}).resume()})}function T(d,p,y){var D=p;switch(p){case"blob":case"arraybuffer":D="uint8array";break;case"base64":D="string";break}try{this._internalType=D,this._outputType=p,this._mimeType=y,s.checkSupport(D),this._worker=d.pipe(new a(D)),d.lock()}catch(I){this._worker=new o("error"),this._worker.error(I)}}T.prototype={accumulate:function(d){return S(this,d)},on:function(d,p){var y=this;return d==="data"?this._worker.on(d,function(D){p.call(y,D.data,D.meta)}):this._worker.on(d,function(){s.delay(p,arguments,y)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(d){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new c(this,{objectMode:this._outputType!=="nodebuffer"},d)}},i.exports=T},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,i,r){if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",r.nodebuffer=typeof Buffer<"u",r.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")r.blob=!1;else{var s=new ArrayBuffer(0);try{r.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var a=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,o=new a;o.append(s),r.blob=o.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!t("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(t,i,r){for(var s=t("./utils"),a=t("./support"),o=t("./nodejsUtils"),u=t("./stream/GenericWorker"),h=new Array(256),f=0;f<256;f++)h[f]=f>=252?6:f>=248?5:f>=240?4:f>=224?3:f>=192?2:1;h[254]=h[254]=1;var c=function(d){var p,y,D,I,w,A=d.length,C=0;for(I=0;I<A;I++)y=d.charCodeAt(I),(y&64512)===55296&&I+1<A&&(D=d.charCodeAt(I+1),(D&64512)===56320&&(y=65536+(y-55296<<10)+(D-56320),I++)),C+=y<128?1:y<2048?2:y<65536?3:4;for(a.uint8array?p=new Uint8Array(C):p=new Array(C),w=0,I=0;w<C;I++)y=d.charCodeAt(I),(y&64512)===55296&&I+1<A&&(D=d.charCodeAt(I+1),(D&64512)===56320&&(y=65536+(y-55296<<10)+(D-56320),I++)),y<128?p[w++]=y:y<2048?(p[w++]=192|y>>>6,p[w++]=128|y&63):y<65536?(p[w++]=224|y>>>12,p[w++]=128|y>>>6&63,p[w++]=128|y&63):(p[w++]=240|y>>>18,p[w++]=128|y>>>12&63,p[w++]=128|y>>>6&63,p[w++]=128|y&63);return p},b=function(d,p){var y;for(p=p||d.length,p>d.length&&(p=d.length),y=p-1;y>=0&&(d[y]&192)===128;)y--;return y<0||y===0?p:y+h[d[y]]>p?y:p},g=function(d){var p,y,D,I,w=d.length,A=new Array(w*2);for(y=0,p=0;p<w;){if(D=d[p++],D<128){A[y++]=D;continue}if(I=h[D],I>4){A[y++]=65533,p+=I-1;continue}for(D&=I===2?31:I===3?15:7;I>1&&p<w;)D=D<<6|d[p++]&63,I--;if(I>1){A[y++]=65533;continue}D<65536?A[y++]=D:(D-=65536,A[y++]=55296|D>>10&1023,A[y++]=56320|D&1023)}return A.length!==y&&(A.subarray?A=A.subarray(0,y):A.length=y),s.applyFromCharCode(A)};r.utf8encode=function(p){return a.nodebuffer?o.newBufferFrom(p,"utf-8"):c(p)},r.utf8decode=function(p){return a.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(p=s.transformTo(a.uint8array?"uint8array":"array",p),g(p))};function S(){u.call(this,"utf-8 decode"),this.leftOver=null}s.inherits(S,u),S.prototype.processChunk=function(d){var p=s.transformTo(a.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var y=p;p=new Uint8Array(y.length+this.leftOver.length),p.set(this.leftOver,0),p.set(y,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var D=b(p),I=p;D!==p.length&&(a.uint8array?(I=p.subarray(0,D),this.leftOver=p.subarray(D,p.length)):(I=p.slice(0,D),this.leftOver=p.slice(D,p.length))),this.push({data:r.utf8decode(I),meta:d.meta})},S.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=S;function T(){u.call(this,"utf-8 encode")}s.inherits(T,u),T.prototype.processChunk=function(d){this.push({data:r.utf8encode(d.data),meta:d.meta})},r.Utf8EncodeWorker=T},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,i,r){var s=t("./support"),a=t("./base64"),o=t("./nodejsUtils"),u=t("./external");t("setimmediate");function h(d){var p=null;return s.uint8array?p=new Uint8Array(d.length):p=new Array(d.length),c(d,p)}r.newBlob=function(d,p){r.checkSupport("blob");try{return new Blob([d],{type:p})}catch{try{var y=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,D=new y;return D.append(d),D.getBlob(p)}catch{throw new Error("Bug : can't construct the Blob.")}}};function f(d){return d}function c(d,p){for(var y=0;y<d.length;++y)p[y]=d.charCodeAt(y)&255;return p}var b={stringifyByChunk:function(d,p,y){var D=[],I=0,w=d.length;if(w<=y)return String.fromCharCode.apply(null,d);for(;I<w;)p==="array"||p==="nodebuffer"?D.push(String.fromCharCode.apply(null,d.slice(I,Math.min(I+y,w)))):D.push(String.fromCharCode.apply(null,d.subarray(I,Math.min(I+y,w)))),I+=y;return D.join("")},stringifyByChar:function(d){for(var p="",y=0;y<d.length;y++)p+=String.fromCharCode(d[y]);return p},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}}()}};function g(d){var p=65536,y=r.getTypeOf(d),D=!0;if(y==="uint8array"?D=b.applyCanBeUsed.uint8array:y==="nodebuffer"&&(D=b.applyCanBeUsed.nodebuffer),D)for(;p>1;)try{return b.stringifyByChunk(d,y,p)}catch{p=Math.floor(p/2)}return b.stringifyByChar(d)}r.applyFromCharCode=g;function S(d,p){for(var y=0;y<d.length;y++)p[y]=d[y];return p}var T={};T.string={string:f,array:function(d){return c(d,new Array(d.length))},arraybuffer:function(d){return T.string.uint8array(d).buffer},uint8array:function(d){return c(d,new Uint8Array(d.length))},nodebuffer:function(d){return c(d,o.allocBuffer(d.length))}},T.array={string:g,array:f,arraybuffer:function(d){return new Uint8Array(d).buffer},uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return o.newBufferFrom(d)}},T.arraybuffer={string:function(d){return g(new Uint8Array(d))},array:function(d){return S(new Uint8Array(d),new Array(d.byteLength))},arraybuffer:f,uint8array:function(d){return new Uint8Array(d)},nodebuffer:function(d){return o.newBufferFrom(new Uint8Array(d))}},T.uint8array={string:g,array:function(d){return S(d,new Array(d.length))},arraybuffer:function(d){return d.buffer},uint8array:f,nodebuffer:function(d){return o.newBufferFrom(d)}},T.nodebuffer={string:g,array:function(d){return S(d,new Array(d.length))},arraybuffer:function(d){return T.nodebuffer.uint8array(d).buffer},uint8array:function(d){return S(d,new Uint8Array(d.length))},nodebuffer:f},r.transformTo=function(d,p){if(p||(p=""),!d)return p;r.checkSupport(d);var y=r.getTypeOf(p),D=T[y][d](p);return D},r.resolve=function(d){for(var p=d.split("/"),y=[],D=0;D<p.length;D++){var I=p[D];I==="."||I===""&&D!==0&&D!==p.length-1||(I===".."?y.pop():y.push(I))}return y.join("/")},r.getTypeOf=function(d){if(typeof d=="string")return"string";if(Object.prototype.toString.call(d)==="[object Array]")return"array";if(s.nodebuffer&&o.isBuffer(d))return"nodebuffer";if(s.uint8array&&d instanceof Uint8Array)return"uint8array";if(s.arraybuffer&&d instanceof ArrayBuffer)return"arraybuffer"},r.checkSupport=function(d){var p=s[d.toLowerCase()];if(!p)throw new Error(d+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(d){var p="",y,D;for(D=0;D<(d||"").length;D++)y=d.charCodeAt(D),p+="\\x"+(y<16?"0":"")+y.toString(16).toUpperCase();return p},r.delay=function(d,p,y){setImmediate(function(){d.apply(y||null,p||[])})},r.inherits=function(d,p){var y=function(){};y.prototype=p.prototype,d.prototype=new y},r.extend=function(){var d={},p,y;for(p=0;p<arguments.length;p++)for(y in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],y)&&typeof d[y]>"u"&&(d[y]=arguments[p][y]);return d},r.prepareContent=function(d,p,y,D,I){var w=u.Promise.resolve(p).then(function(A){var C=s.blob&&(A instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(A))!==-1);return C&&typeof FileReader<"u"?new u.Promise(function(R,z){var P=new FileReader;P.onload=function(H){R(H.target.result)},P.onerror=function(H){z(H.target.error)},P.readAsArrayBuffer(A)}):A});return w.then(function(A){var C=r.getTypeOf(A);return C?(C==="arraybuffer"?A=r.transformTo("uint8array",A):C==="string"&&(I?A=a.decode(A):y&&D!==!0&&(A=h(A))),A):u.Promise.reject(new Error("Can't read the data of '"+d+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,i,r){var s=t("./reader/readerFor"),a=t("./utils"),o=t("./signature"),u=t("./zipEntry"),h=t("./support");function f(c){this.files=[],this.loadOptions=c}f.prototype={checkSignature:function(c){if(!this.reader.readAndCheckSignature(c)){this.reader.index-=4;var b=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(b)+", expected "+a.pretty(c)+")")}},isSignature:function(c,b){var g=this.reader.index;this.reader.setIndex(c);var S=this.reader.readString(4),T=S===b;return this.reader.setIndex(g),T},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var c=this.reader.readData(this.zipCommentLength),b=h.uint8array?"uint8array":"array",g=a.transformTo(b,c);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var c=this.zip64EndOfCentralSize-44,b=0,g,S,T;b<c;)g=this.reader.readInt(2),S=this.reader.readInt(4),T=this.reader.readData(S),this.zip64ExtensibleData[g]={id:g,length:S,value:T}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var c,b;for(c=0;c<this.files.length;c++)b=this.files[c],this.reader.setIndex(b.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),b.readLocalPart(this.reader),b.handleUTF8(),b.processAttributes()},readCentralDir:function(){var c;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)c=new u({zip64:this.zip64},this.loadOptions),c.readCentralPart(this.reader),this.files.push(c);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var c=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(c<0){var b=!this.isSignature(0,o.LOCAL_FILE_HEADER);throw b?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(c);var g=c;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,c=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),c<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(c),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var S=this.centralDirOffset+this.centralDirSize;this.zip64&&(S+=20,S+=12+this.zip64EndOfCentralSize);var T=g-S;if(T>0)this.isSignature(g,o.CENTRAL_FILE_HEADER)||(this.reader.zero=T);else if(T<0)throw new Error("Corrupted zip: missing "+Math.abs(T)+" bytes.")},prepareReader:function(c){this.reader=s(c)},load:function(c){this.prepareReader(c),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=f},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,i,r){var s=t("./reader/readerFor"),a=t("./utils"),o=t("./compressedObject"),u=t("./crc32"),h=t("./utf8"),f=t("./compressions"),c=t("./support"),b=0,g=3,S=function(d){for(var p in f)if(Object.prototype.hasOwnProperty.call(f,p)&&f[p].magic===d)return f[p];return null};function T(d,p){this.options=d,this.loadOptions=p}T.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(d){var p,y;if(d.skip(22),this.fileNameLength=d.readInt(2),y=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(y),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(p=S(this.compressionMethod),p===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,p,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var p=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(p),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),d===b&&(this.dosPermissions=this.externalFileAttributes&63),d===g&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=s(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var p=d.index+this.extraFieldsLength,y,D,I;for(this.extraFields||(this.extraFields={});d.index+4<p;)y=d.readInt(2),D=d.readInt(2),I=d.readData(D),this.extraFields[y]={id:y,length:D,value:I};d.setIndex(p)},handleUTF8:function(){var d=c.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=h.utf8decode(this.fileName),this.fileCommentStr=h.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var y=a.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(y)}var D=this.findExtraFieldUnicodeComment();if(D!==null)this.fileCommentStr=D;else{var I=a.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(I)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var p=s(d.value);return p.readInt(1)!==1||u(this.fileName)!==p.readInt(4)?null:h.utf8decode(p.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var p=s(d.value);return p.readInt(1)!==1||u(this.fileComment)!==p.readInt(4)?null:h.utf8decode(p.readData(d.length-5))}return null}},i.exports=T},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,i,r){var s=t("./stream/StreamHelper"),a=t("./stream/DataWorker"),o=t("./utf8"),u=t("./compressedObject"),h=t("./stream/GenericWorker"),f=function(S,T,d){this.name=S,this.dir=d.dir,this.date=d.date,this.comment=d.comment,this.unixPermissions=d.unixPermissions,this.dosPermissions=d.dosPermissions,this._data=T,this._dataBinary=d.binary,this.options={compression:d.compression,compressionOptions:d.compressionOptions}};f.prototype={internalStream:function(S){var T=null,d="string";try{if(!S)throw new Error("No output type specified.");d=S.toLowerCase();var p=d==="string"||d==="text";(d==="binarystring"||d==="text")&&(d="string"),T=this._decompressWorker();var y=!this._dataBinary;y&&!p&&(T=T.pipe(new o.Utf8EncodeWorker)),!y&&p&&(T=T.pipe(new o.Utf8DecodeWorker))}catch(D){T=new h("error"),T.error(D)}return new s(T,d,"")},async:function(S,T){return this.internalStream(S).accumulate(T)},nodeStream:function(S,T){return this.internalStream(S||"nodebuffer").toNodejsStream(T)},_compressWorker:function(S,T){if(this._data instanceof u&&this._data.compression.magic===S.magic)return this._data.getCompressedWorker();var d=this._decompressWorker();return this._dataBinary||(d=d.pipe(new o.Utf8EncodeWorker)),u.createWorkerFrom(d,S,T)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof h?this._data:new a(this._data)}};for(var c=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],b=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<c.length;g++)f.prototype[c[g]]=b;i.exports=f},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,i,r){(function(s){var a=s.MutationObserver||s.WebKitMutationObserver,o;if(a){var u=0,h=new a(S),f=s.document.createTextNode("");h.observe(f,{characterData:!0}),o=function(){f.data=u=++u%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var c=new s.MessageChannel;c.port1.onmessage=S,o=function(){c.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?o=function(){var d=s.document.createElement("script");d.onreadystatechange=function(){S(),d.onreadystatechange=null,d.parentNode.removeChild(d),d=null},s.document.documentElement.appendChild(d)}:o=function(){setTimeout(S,0)};var b,g=[];function S(){b=!0;for(var d,p,y=g.length;y;){for(p=g,g=[],d=-1;++d<y;)p[d]();y=g.length}b=!1}i.exports=T;function T(d){g.push(d)===1&&!b&&o()}}).call(this,typeof gt<"u"?gt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,i,r){var s=t("immediate");function a(){}var o={},u=["REJECTED"],h=["FULFILLED"],f=["PENDING"];i.exports=c;function c(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,w!==a&&T(this,w)}c.prototype.finally=function(w){if(typeof w!="function")return this;var A=this.constructor;return this.then(C,R);function C(z){function P(){return z}return A.resolve(w()).then(P)}function R(z){function P(){throw z}return A.resolve(w()).then(P)}},c.prototype.catch=function(w){return this.then(null,w)},c.prototype.then=function(w,A){if(typeof w!="function"&&this.state===h||typeof A!="function"&&this.state===u)return this;var C=new this.constructor(a);if(this.state!==f){var R=this.state===h?w:A;g(C,R,this.outcome)}else this.queue.push(new b(C,w,A));return C};function b(w,A,C){this.promise=w,typeof A=="function"&&(this.onFulfilled=A,this.callFulfilled=this.otherCallFulfilled),typeof C=="function"&&(this.onRejected=C,this.callRejected=this.otherCallRejected)}b.prototype.callFulfilled=function(w){o.resolve(this.promise,w)},b.prototype.otherCallFulfilled=function(w){g(this.promise,this.onFulfilled,w)},b.prototype.callRejected=function(w){o.reject(this.promise,w)},b.prototype.otherCallRejected=function(w){g(this.promise,this.onRejected,w)};function g(w,A,C){s(function(){var R;try{R=A(C)}catch(z){return o.reject(w,z)}R===w?o.reject(w,new TypeError("Cannot resolve promise with itself")):o.resolve(w,R)})}o.resolve=function(w,A){var C=d(S,A);if(C.status==="error")return o.reject(w,C.value);var R=C.value;if(R)T(w,R);else{w.state=h,w.outcome=A;for(var z=-1,P=w.queue.length;++z<P;)w.queue[z].callFulfilled(A)}return w},o.reject=function(w,A){w.state=u,w.outcome=A;for(var C=-1,R=w.queue.length;++C<R;)w.queue[C].callRejected(A);return w};function S(w){var A=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof A=="function")return function(){A.apply(w,arguments)}}function T(w,A){var C=!1;function R(V){C||(C=!0,o.reject(w,V))}function z(V){C||(C=!0,o.resolve(w,V))}function P(){A(z,R)}var H=d(P);H.status==="error"&&R(H.value)}function d(w,A){var C={};try{C.value=w(A),C.status="success"}catch(R){C.status="error",C.value=R}return C}c.resolve=p;function p(w){return w instanceof this?w:o.resolve(new this(a),w)}c.reject=y;function y(w){var A=new this(a);return o.reject(A,w)}c.all=D;function D(w){var A=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=w.length,R=!1;if(!C)return this.resolve([]);for(var z=new Array(C),P=0,H=-1,V=new this(a);++H<C;)te(w[H],H);return V;function te(ce,he){A.resolve(ce).then(ue,function(se){R||(R=!0,o.reject(V,se))});function ue(se){z[he]=se,++P===C&&!R&&(R=!0,o.resolve(V,z))}}}c.race=I;function I(w){var A=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=w.length,R=!1;if(!C)return this.resolve([]);for(var z=-1,P=new this(a);++z<C;)H(w[z]);return P;function H(V){A.resolve(V).then(function(te){R||(R=!0,o.resolve(P,te))},function(te){R||(R=!0,o.reject(P,te))})}}},{immediate:36}],38:[function(t,i,r){var s=t("./lib/utils/common").assign,a=t("./lib/deflate"),o=t("./lib/inflate"),u=t("./lib/zlib/constants"),h={};s(h,a,o,u),i.exports=h},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,i,r){var s=t("./zlib/deflate"),a=t("./utils/common"),o=t("./utils/strings"),u=t("./zlib/messages"),h=t("./zlib/zstream"),f=Object.prototype.toString,c=0,b=4,g=0,S=1,T=2,d=-1,p=0,y=8;function D(C){if(!(this instanceof D))return new D(C);this.options=a.assign({level:d,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},C||{});var R=this.options;R.raw&&R.windowBits>0?R.windowBits=-R.windowBits:R.gzip&&R.windowBits>0&&R.windowBits<16&&(R.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var z=s.deflateInit2(this.strm,R.level,R.method,R.windowBits,R.memLevel,R.strategy);if(z!==g)throw new Error(u[z]);if(R.header&&s.deflateSetHeader(this.strm,R.header),R.dictionary){var P;if(typeof R.dictionary=="string"?P=o.string2buf(R.dictionary):f.call(R.dictionary)==="[object ArrayBuffer]"?P=new Uint8Array(R.dictionary):P=R.dictionary,z=s.deflateSetDictionary(this.strm,P),z!==g)throw new Error(u[z]);this._dict_set=!0}}D.prototype.push=function(C,R){var z=this.strm,P=this.options.chunkSize,H,V;if(this.ended)return!1;V=R===~~R?R:R===!0?b:c,typeof C=="string"?z.input=o.string2buf(C):f.call(C)==="[object ArrayBuffer]"?z.input=new Uint8Array(C):z.input=C,z.next_in=0,z.avail_in=z.input.length;do{if(z.avail_out===0&&(z.output=new a.Buf8(P),z.next_out=0,z.avail_out=P),H=s.deflate(z,V),H!==S&&H!==g)return this.onEnd(H),this.ended=!0,!1;(z.avail_out===0||z.avail_in===0&&(V===b||V===T))&&(this.options.to==="string"?this.onData(o.buf2binstring(a.shrinkBuf(z.output,z.next_out))):this.onData(a.shrinkBuf(z.output,z.next_out)))}while((z.avail_in>0||z.avail_out===0)&&H!==S);return V===b?(H=s.deflateEnd(this.strm),this.onEnd(H),this.ended=!0,H===g):(V===T&&(this.onEnd(g),z.avail_out=0),!0)},D.prototype.onData=function(C){this.chunks.push(C)},D.prototype.onEnd=function(C){C===g&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=C,this.msg=this.strm.msg};function I(C,R){var z=new D(R);if(z.push(C,!0),z.err)throw z.msg||u[z.err];return z.result}function w(C,R){return R=R||{},R.raw=!0,I(C,R)}function A(C,R){return R=R||{},R.gzip=!0,I(C,R)}r.Deflate=D,r.deflate=I,r.deflateRaw=w,r.gzip=A},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,i,r){var s=t("./zlib/inflate"),a=t("./utils/common"),o=t("./utils/strings"),u=t("./zlib/constants"),h=t("./zlib/messages"),f=t("./zlib/zstream"),c=t("./zlib/gzheader"),b=Object.prototype.toString;function g(d){if(!(this instanceof g))return new g(d);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},d||{});var p=this.options;p.raw&&p.windowBits>=0&&p.windowBits<16&&(p.windowBits=-p.windowBits,p.windowBits===0&&(p.windowBits=-15)),p.windowBits>=0&&p.windowBits<16&&!(d&&d.windowBits)&&(p.windowBits+=32),p.windowBits>15&&p.windowBits<48&&(p.windowBits&15||(p.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var y=s.inflateInit2(this.strm,p.windowBits);if(y!==u.Z_OK)throw new Error(h[y]);this.header=new c,s.inflateGetHeader(this.strm,this.header)}g.prototype.push=function(d,p){var y=this.strm,D=this.options.chunkSize,I=this.options.dictionary,w,A,C,R,z,P,H=!1;if(this.ended)return!1;A=p===~~p?p:p===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof d=="string"?y.input=o.binstring2buf(d):b.call(d)==="[object ArrayBuffer]"?y.input=new Uint8Array(d):y.input=d,y.next_in=0,y.avail_in=y.input.length;do{if(y.avail_out===0&&(y.output=new a.Buf8(D),y.next_out=0,y.avail_out=D),w=s.inflate(y,u.Z_NO_FLUSH),w===u.Z_NEED_DICT&&I&&(typeof I=="string"?P=o.string2buf(I):b.call(I)==="[object ArrayBuffer]"?P=new Uint8Array(I):P=I,w=s.inflateSetDictionary(this.strm,P)),w===u.Z_BUF_ERROR&&H===!0&&(w=u.Z_OK,H=!1),w!==u.Z_STREAM_END&&w!==u.Z_OK)return this.onEnd(w),this.ended=!0,!1;y.next_out&&(y.avail_out===0||w===u.Z_STREAM_END||y.avail_in===0&&(A===u.Z_FINISH||A===u.Z_SYNC_FLUSH))&&(this.options.to==="string"?(C=o.utf8border(y.output,y.next_out),R=y.next_out-C,z=o.buf2string(y.output,C),y.next_out=R,y.avail_out=D-R,R&&a.arraySet(y.output,y.output,C,R,0),this.onData(z)):this.onData(a.shrinkBuf(y.output,y.next_out))),y.avail_in===0&&y.avail_out===0&&(H=!0)}while((y.avail_in>0||y.avail_out===0)&&w!==u.Z_STREAM_END);return w===u.Z_STREAM_END&&(A=u.Z_FINISH),A===u.Z_FINISH?(w=s.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===u.Z_OK):(A===u.Z_SYNC_FLUSH&&(this.onEnd(u.Z_OK),y.avail_out=0),!0)},g.prototype.onData=function(d){this.chunks.push(d)},g.prototype.onEnd=function(d){d===u.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=d,this.msg=this.strm.msg};function S(d,p){var y=new g(p);if(y.push(d,!0),y.err)throw y.msg||h[y.err];return y.result}function T(d,p){return p=p||{},p.raw=!0,S(d,p)}r.Inflate=g,r.inflate=S,r.inflateRaw=T,r.ungzip=S},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,i,r){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";r.assign=function(u){for(var h=Array.prototype.slice.call(arguments,1);h.length;){var f=h.shift();if(f){if(typeof f!="object")throw new TypeError(f+"must be non-object");for(var c in f)f.hasOwnProperty(c)&&(u[c]=f[c])}}return u},r.shrinkBuf=function(u,h){return u.length===h?u:u.subarray?u.subarray(0,h):(u.length=h,u)};var a={arraySet:function(u,h,f,c,b){if(h.subarray&&u.subarray){u.set(h.subarray(f,f+c),b);return}for(var g=0;g<c;g++)u[b+g]=h[f+g]},flattenChunks:function(u){var h,f,c,b,g,S;for(c=0,h=0,f=u.length;h<f;h++)c+=u[h].length;for(S=new Uint8Array(c),b=0,h=0,f=u.length;h<f;h++)g=u[h],S.set(g,b),b+=g.length;return S}},o={arraySet:function(u,h,f,c,b){for(var g=0;g<c;g++)u[b+g]=h[f+g]},flattenChunks:function(u){return[].concat.apply([],u)}};r.setTyped=function(u){u?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,a)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,o))},r.setTyped(s)},{}],42:[function(t,i,r){var s=t("./common"),a=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var u=new s.Buf8(256),h=0;h<256;h++)u[h]=h>=252?6:h>=248?5:h>=240?4:h>=224?3:h>=192?2:1;u[254]=u[254]=1,r.string2buf=function(c){var b,g,S,T,d,p=c.length,y=0;for(T=0;T<p;T++)g=c.charCodeAt(T),(g&64512)===55296&&T+1<p&&(S=c.charCodeAt(T+1),(S&64512)===56320&&(g=65536+(g-55296<<10)+(S-56320),T++)),y+=g<128?1:g<2048?2:g<65536?3:4;for(b=new s.Buf8(y),d=0,T=0;d<y;T++)g=c.charCodeAt(T),(g&64512)===55296&&T+1<p&&(S=c.charCodeAt(T+1),(S&64512)===56320&&(g=65536+(g-55296<<10)+(S-56320),T++)),g<128?b[d++]=g:g<2048?(b[d++]=192|g>>>6,b[d++]=128|g&63):g<65536?(b[d++]=224|g>>>12,b[d++]=128|g>>>6&63,b[d++]=128|g&63):(b[d++]=240|g>>>18,b[d++]=128|g>>>12&63,b[d++]=128|g>>>6&63,b[d++]=128|g&63);return b};function f(c,b){if(b<65537&&(c.subarray&&o||!c.subarray&&a))return String.fromCharCode.apply(null,s.shrinkBuf(c,b));for(var g="",S=0;S<b;S++)g+=String.fromCharCode(c[S]);return g}r.buf2binstring=function(c){return f(c,c.length)},r.binstring2buf=function(c){for(var b=new s.Buf8(c.length),g=0,S=b.length;g<S;g++)b[g]=c.charCodeAt(g);return b},r.buf2string=function(c,b){var g,S,T,d,p=b||c.length,y=new Array(p*2);for(S=0,g=0;g<p;){if(T=c[g++],T<128){y[S++]=T;continue}if(d=u[T],d>4){y[S++]=65533,g+=d-1;continue}for(T&=d===2?31:d===3?15:7;d>1&&g<p;)T=T<<6|c[g++]&63,d--;if(d>1){y[S++]=65533;continue}T<65536?y[S++]=T:(T-=65536,y[S++]=55296|T>>10&1023,y[S++]=56320|T&1023)}return f(y,S)},r.utf8border=function(c,b){var g;for(b=b||c.length,b>c.length&&(b=c.length),g=b-1;g>=0&&(c[g]&192)===128;)g--;return g<0||g===0?b:g+u[c[g]]>b?g:b}},{"./common":41}],43:[function(t,i,r){function s(a,o,u,h){for(var f=a&65535|0,c=a>>>16&65535|0,b=0;u!==0;){b=u>2e3?2e3:u,u-=b;do f=f+o[h++]|0,c=c+f|0;while(--b);f%=65521,c%=65521}return f|c<<16|0}i.exports=s},{}],44:[function(t,i,r){i.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,i,r){function s(){for(var u,h=[],f=0;f<256;f++){u=f;for(var c=0;c<8;c++)u=u&1?3988292384^u>>>1:u>>>1;h[f]=u}return h}var a=s();function o(u,h,f,c){var b=a,g=c+f;u^=-1;for(var S=c;S<g;S++)u=u>>>8^b[(u^h[S])&255];return u^-1}i.exports=o},{}],46:[function(t,i,r){var s=t("../utils/common"),a=t("./trees"),o=t("./adler32"),u=t("./crc32"),h=t("./messages"),f=0,c=1,b=3,g=4,S=5,T=0,d=1,p=-2,y=-3,D=-5,I=-1,w=1,A=2,C=3,R=4,z=0,P=2,H=8,V=9,te=15,ce=8,he=29,ue=256,se=ue+1+he,ne=30,me=19,Re=2*se+1,Ae=15,le=3,Se=258,_e=Se+le+1,Xe=32,je=42,Le=69,ve=73,Ve=91,Fe=103,De=113,Oe=666,Ee=1,$e=2,Me=3,at=4,xe=3;function Ze(l,U){return l.msg=h[U],U}function mt(l){return(l<<1)-(l>4?9:0)}function tt(l){for(var U=l.length;--U>=0;)l[U]=0}function Qe(l){var U=l.state,q=U.pending;q>l.avail_out&&(q=l.avail_out),q!==0&&(s.arraySet(l.output,U.pending_buf,U.pending_out,q,l.next_out),l.next_out+=q,U.pending_out+=q,l.total_out+=q,l.avail_out-=q,U.pending-=q,U.pending===0&&(U.pending_out=0))}function Ie(l,U){a._tr_flush_block(l,l.block_start>=0?l.block_start:-1,l.strstart-l.block_start,U),l.block_start=l.strstart,Qe(l.strm)}function de(l,U){l.pending_buf[l.pending++]=U}function nt(l,U){l.pending_buf[l.pending++]=U>>>8&255,l.pending_buf[l.pending++]=U&255}function It(l,U,q,m){var N=l.avail_in;return N>m&&(N=m),N===0?0:(l.avail_in-=N,s.arraySet(U,l.input,l.next_in,N,q),l.state.wrap===1?l.adler=o(l.adler,U,N,q):l.state.wrap===2&&(l.adler=u(l.adler,U,N,q)),l.next_in+=N,l.total_in+=N,N)}function yt(l,U){var q=l.max_chain_length,m=l.strstart,N,M,ae=l.prev_length,ee=l.nice_match,ie=l.strstart>l.w_size-_e?l.strstart-(l.w_size-_e):0,ge=l.window,_t=l.w_mask,Be=l.prev,ye=l.strstart+Se,Ue=ge[m+ae-1],Ke=ge[m+ae];l.prev_length>=l.good_match&&(q>>=2),ee>l.lookahead&&(ee=l.lookahead);do if(N=U,!(ge[N+ae]!==Ke||ge[N+ae-1]!==Ue||ge[N]!==ge[m]||ge[++N]!==ge[m+1])){m+=2,N++;do;while(ge[++m]===ge[++N]&&ge[++m]===ge[++N]&&ge[++m]===ge[++N]&&ge[++m]===ge[++N]&&ge[++m]===ge[++N]&&ge[++m]===ge[++N]&&ge[++m]===ge[++N]&&ge[++m]===ge[++N]&&m<ye);if(M=Se-(ye-m),m=ye-Se,M>ae){if(l.match_start=U,ae=M,M>=ee)break;Ue=ge[m+ae-1],Ke=ge[m+ae]}}while((U=Be[U&_t])>ie&&--q!==0);return ae<=l.lookahead?ae:l.lookahead}function st(l){var U=l.w_size,q,m,N,M,ae;do{if(M=l.window_size-l.lookahead-l.strstart,l.strstart>=U+(U-_e)){s.arraySet(l.window,l.window,U,U,0),l.match_start-=U,l.strstart-=U,l.block_start-=U,m=l.hash_size,q=m;do N=l.head[--q],l.head[q]=N>=U?N-U:0;while(--m);m=U,q=m;do N=l.prev[--q],l.prev[q]=N>=U?N-U:0;while(--m);M+=U}if(l.strm.avail_in===0)break;if(m=It(l.strm,l.window,l.strstart+l.lookahead,M),l.lookahead+=m,l.lookahead+l.insert>=le)for(ae=l.strstart-l.insert,l.ins_h=l.window[ae],l.ins_h=(l.ins_h<<l.hash_shift^l.window[ae+1])&l.hash_mask;l.insert&&(l.ins_h=(l.ins_h<<l.hash_shift^l.window[ae+le-1])&l.hash_mask,l.prev[ae&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=ae,ae++,l.insert--,!(l.lookahead+l.insert<le)););}while(l.lookahead<_e&&l.strm.avail_in!==0)}function Ot(l,U){var q=65535;for(q>l.pending_buf_size-5&&(q=l.pending_buf_size-5);;){if(l.lookahead<=1){if(st(l),l.lookahead===0&&U===f)return Ee;if(l.lookahead===0)break}l.strstart+=l.lookahead,l.lookahead=0;var m=l.block_start+q;if((l.strstart===0||l.strstart>=m)&&(l.lookahead=l.strstart-m,l.strstart=m,Ie(l,!1),l.strm.avail_out===0)||l.strstart-l.block_start>=l.w_size-_e&&(Ie(l,!1),l.strm.avail_out===0))return Ee}return l.insert=0,U===g?(Ie(l,!0),l.strm.avail_out===0?Me:at):(l.strstart>l.block_start&&(Ie(l,!1),l.strm.avail_out===0),Ee)}function bt(l,U){for(var q,m;;){if(l.lookahead<_e){if(st(l),l.lookahead<_e&&U===f)return Ee;if(l.lookahead===0)break}if(q=0,l.lookahead>=le&&(l.ins_h=(l.ins_h<<l.hash_shift^l.window[l.strstart+le-1])&l.hash_mask,q=l.prev[l.strstart&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=l.strstart),q!==0&&l.strstart-q<=l.w_size-_e&&(l.match_length=yt(l,q)),l.match_length>=le)if(m=a._tr_tally(l,l.strstart-l.match_start,l.match_length-le),l.lookahead-=l.match_length,l.match_length<=l.max_lazy_match&&l.lookahead>=le){l.match_length--;do l.strstart++,l.ins_h=(l.ins_h<<l.hash_shift^l.window[l.strstart+le-1])&l.hash_mask,q=l.prev[l.strstart&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=l.strstart;while(--l.match_length!==0);l.strstart++}else l.strstart+=l.match_length,l.match_length=0,l.ins_h=l.window[l.strstart],l.ins_h=(l.ins_h<<l.hash_shift^l.window[l.strstart+1])&l.hash_mask;else m=a._tr_tally(l,0,l.window[l.strstart]),l.lookahead--,l.strstart++;if(m&&(Ie(l,!1),l.strm.avail_out===0))return Ee}return l.insert=l.strstart<le-1?l.strstart:le-1,U===g?(Ie(l,!0),l.strm.avail_out===0?Me:at):l.last_lit&&(Ie(l,!1),l.strm.avail_out===0)?Ee:$e}function ot(l,U){for(var q,m,N;;){if(l.lookahead<_e){if(st(l),l.lookahead<_e&&U===f)return Ee;if(l.lookahead===0)break}if(q=0,l.lookahead>=le&&(l.ins_h=(l.ins_h<<l.hash_shift^l.window[l.strstart+le-1])&l.hash_mask,q=l.prev[l.strstart&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=l.strstart),l.prev_length=l.match_length,l.prev_match=l.match_start,l.match_length=le-1,q!==0&&l.prev_length<l.max_lazy_match&&l.strstart-q<=l.w_size-_e&&(l.match_length=yt(l,q),l.match_length<=5&&(l.strategy===w||l.match_length===le&&l.strstart-l.match_start>4096)&&(l.match_length=le-1)),l.prev_length>=le&&l.match_length<=l.prev_length){N=l.strstart+l.lookahead-le,m=a._tr_tally(l,l.strstart-1-l.prev_match,l.prev_length-le),l.lookahead-=l.prev_length-1,l.prev_length-=2;do++l.strstart<=N&&(l.ins_h=(l.ins_h<<l.hash_shift^l.window[l.strstart+le-1])&l.hash_mask,q=l.prev[l.strstart&l.w_mask]=l.head[l.ins_h],l.head[l.ins_h]=l.strstart);while(--l.prev_length!==0);if(l.match_available=0,l.match_length=le-1,l.strstart++,m&&(Ie(l,!1),l.strm.avail_out===0))return Ee}else if(l.match_available){if(m=a._tr_tally(l,0,l.window[l.strstart-1]),m&&Ie(l,!1),l.strstart++,l.lookahead--,l.strm.avail_out===0)return Ee}else l.match_available=1,l.strstart++,l.lookahead--}return l.match_available&&(m=a._tr_tally(l,0,l.window[l.strstart-1]),l.match_available=0),l.insert=l.strstart<le-1?l.strstart:le-1,U===g?(Ie(l,!0),l.strm.avail_out===0?Me:at):l.last_lit&&(Ie(l,!1),l.strm.avail_out===0)?Ee:$e}function Bt(l,U){for(var q,m,N,M,ae=l.window;;){if(l.lookahead<=Se){if(st(l),l.lookahead<=Se&&U===f)return Ee;if(l.lookahead===0)break}if(l.match_length=0,l.lookahead>=le&&l.strstart>0&&(N=l.strstart-1,m=ae[N],m===ae[++N]&&m===ae[++N]&&m===ae[++N])){M=l.strstart+Se;do;while(m===ae[++N]&&m===ae[++N]&&m===ae[++N]&&m===ae[++N]&&m===ae[++N]&&m===ae[++N]&&m===ae[++N]&&m===ae[++N]&&N<M);l.match_length=Se-(M-N),l.match_length>l.lookahead&&(l.match_length=l.lookahead)}if(l.match_length>=le?(q=a._tr_tally(l,1,l.match_length-le),l.lookahead-=l.match_length,l.strstart+=l.match_length,l.match_length=0):(q=a._tr_tally(l,0,l.window[l.strstart]),l.lookahead--,l.strstart++),q&&(Ie(l,!1),l.strm.avail_out===0))return Ee}return l.insert=0,U===g?(Ie(l,!0),l.strm.avail_out===0?Me:at):l.last_lit&&(Ie(l,!1),l.strm.avail_out===0)?Ee:$e}function wt(l,U){for(var q;;){if(l.lookahead===0&&(st(l),l.lookahead===0)){if(U===f)return Ee;break}if(l.match_length=0,q=a._tr_tally(l,0,l.window[l.strstart]),l.lookahead--,l.strstart++,q&&(Ie(l,!1),l.strm.avail_out===0))return Ee}return l.insert=0,U===g?(Ie(l,!0),l.strm.avail_out===0?Me:at):l.last_lit&&(Ie(l,!1),l.strm.avail_out===0)?Ee:$e}function Ge(l,U,q,m,N){this.good_length=l,this.max_lazy=U,this.nice_length=q,this.max_chain=m,this.func=N}var ut;ut=[new Ge(0,0,0,0,Ot),new Ge(4,4,8,4,bt),new Ge(4,5,16,8,bt),new Ge(4,6,32,32,bt),new Ge(4,4,16,16,ot),new Ge(8,16,32,32,ot),new Ge(8,16,128,128,ot),new Ge(8,32,128,256,ot),new Ge(32,128,258,1024,ot),new Ge(32,258,258,4096,ot)];function qt(l){l.window_size=2*l.w_size,tt(l.head),l.max_lazy_match=ut[l.level].max_lazy,l.good_match=ut[l.level].good_length,l.nice_match=ut[l.level].nice_length,l.max_chain_length=ut[l.level].max_chain,l.strstart=0,l.block_start=0,l.lookahead=0,l.insert=0,l.match_length=l.prev_length=le-1,l.match_available=0,l.ins_h=0}function E(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=H,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(Re*2),this.dyn_dtree=new s.Buf16((2*ne+1)*2),this.bl_tree=new s.Buf16((2*me+1)*2),tt(this.dyn_ltree),tt(this.dyn_dtree),tt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(Ae+1),this.heap=new s.Buf16(2*se+1),tt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*se+1),tt(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Z(l){var U;return!l||!l.state?Ze(l,p):(l.total_in=l.total_out=0,l.data_type=P,U=l.state,U.pending=0,U.pending_out=0,U.wrap<0&&(U.wrap=-U.wrap),U.status=U.wrap?je:De,l.adler=U.wrap===2?0:1,U.last_flush=f,a._tr_init(U),T)}function X(l){var U=Z(l);return U===T&&qt(l.state),U}function re(l,U){return!l||!l.state||l.state.wrap!==2?p:(l.state.gzhead=U,T)}function O(l,U,q,m,N,M){if(!l)return p;var ae=1;if(U===I&&(U=6),m<0?(ae=0,m=-m):m>15&&(ae=2,m-=16),N<1||N>V||q!==H||m<8||m>15||U<0||U>9||M<0||M>R)return Ze(l,p);m===8&&(m=9);var ee=new E;return l.state=ee,ee.strm=l,ee.wrap=ae,ee.gzhead=null,ee.w_bits=m,ee.w_size=1<<ee.w_bits,ee.w_mask=ee.w_size-1,ee.hash_bits=N+7,ee.hash_size=1<<ee.hash_bits,ee.hash_mask=ee.hash_size-1,ee.hash_shift=~~((ee.hash_bits+le-1)/le),ee.window=new s.Buf8(ee.w_size*2),ee.head=new s.Buf16(ee.hash_size),ee.prev=new s.Buf16(ee.w_size),ee.lit_bufsize=1<<N+6,ee.pending_buf_size=ee.lit_bufsize*4,ee.pending_buf=new s.Buf8(ee.pending_buf_size),ee.d_buf=1*ee.lit_bufsize,ee.l_buf=3*ee.lit_bufsize,ee.level=U,ee.strategy=M,ee.method=q,X(l)}function W(l,U){return O(l,U,H,te,ce,z)}function v(l,U){var q,m,N,M;if(!l||!l.state||U>S||U<0)return l?Ze(l,p):p;if(m=l.state,!l.output||!l.input&&l.avail_in!==0||m.status===Oe&&U!==g)return Ze(l,l.avail_out===0?D:p);if(m.strm=l,q=m.last_flush,m.last_flush=U,m.status===je)if(m.wrap===2)l.adler=0,de(m,31),de(m,139),de(m,8),m.gzhead?(de(m,(m.gzhead.text?1:0)+(m.gzhead.hcrc?2:0)+(m.gzhead.extra?4:0)+(m.gzhead.name?8:0)+(m.gzhead.comment?16:0)),de(m,m.gzhead.time&255),de(m,m.gzhead.time>>8&255),de(m,m.gzhead.time>>16&255),de(m,m.gzhead.time>>24&255),de(m,m.level===9?2:m.strategy>=A||m.level<2?4:0),de(m,m.gzhead.os&255),m.gzhead.extra&&m.gzhead.extra.length&&(de(m,m.gzhead.extra.length&255),de(m,m.gzhead.extra.length>>8&255)),m.gzhead.hcrc&&(l.adler=u(l.adler,m.pending_buf,m.pending,0)),m.gzindex=0,m.status=Le):(de(m,0),de(m,0),de(m,0),de(m,0),de(m,0),de(m,m.level===9?2:m.strategy>=A||m.level<2?4:0),de(m,xe),m.status=De);else{var ae=H+(m.w_bits-8<<4)<<8,ee=-1;m.strategy>=A||m.level<2?ee=0:m.level<6?ee=1:m.level===6?ee=2:ee=3,ae|=ee<<6,m.strstart!==0&&(ae|=Xe),ae+=31-ae%31,m.status=De,nt(m,ae),m.strstart!==0&&(nt(m,l.adler>>>16),nt(m,l.adler&65535)),l.adler=1}if(m.status===Le)if(m.gzhead.extra){for(N=m.pending;m.gzindex<(m.gzhead.extra.length&65535)&&!(m.pending===m.pending_buf_size&&(m.gzhead.hcrc&&m.pending>N&&(l.adler=u(l.adler,m.pending_buf,m.pending-N,N)),Qe(l),N=m.pending,m.pending===m.pending_buf_size));)de(m,m.gzhead.extra[m.gzindex]&255),m.gzindex++;m.gzhead.hcrc&&m.pending>N&&(l.adler=u(l.adler,m.pending_buf,m.pending-N,N)),m.gzindex===m.gzhead.extra.length&&(m.gzindex=0,m.status=ve)}else m.status=ve;if(m.status===ve)if(m.gzhead.name){N=m.pending;do{if(m.pending===m.pending_buf_size&&(m.gzhead.hcrc&&m.pending>N&&(l.adler=u(l.adler,m.pending_buf,m.pending-N,N)),Qe(l),N=m.pending,m.pending===m.pending_buf_size)){M=1;break}m.gzindex<m.gzhead.name.length?M=m.gzhead.name.charCodeAt(m.gzindex++)&255:M=0,de(m,M)}while(M!==0);m.gzhead.hcrc&&m.pending>N&&(l.adler=u(l.adler,m.pending_buf,m.pending-N,N)),M===0&&(m.gzindex=0,m.status=Ve)}else m.status=Ve;if(m.status===Ve)if(m.gzhead.comment){N=m.pending;do{if(m.pending===m.pending_buf_size&&(m.gzhead.hcrc&&m.pending>N&&(l.adler=u(l.adler,m.pending_buf,m.pending-N,N)),Qe(l),N=m.pending,m.pending===m.pending_buf_size)){M=1;break}m.gzindex<m.gzhead.comment.length?M=m.gzhead.comment.charCodeAt(m.gzindex++)&255:M=0,de(m,M)}while(M!==0);m.gzhead.hcrc&&m.pending>N&&(l.adler=u(l.adler,m.pending_buf,m.pending-N,N)),M===0&&(m.status=Fe)}else m.status=Fe;if(m.status===Fe&&(m.gzhead.hcrc?(m.pending+2>m.pending_buf_size&&Qe(l),m.pending+2<=m.pending_buf_size&&(de(m,l.adler&255),de(m,l.adler>>8&255),l.adler=0,m.status=De)):m.status=De),m.pending!==0){if(Qe(l),l.avail_out===0)return m.last_flush=-1,T}else if(l.avail_in===0&&mt(U)<=mt(q)&&U!==g)return Ze(l,D);if(m.status===Oe&&l.avail_in!==0)return Ze(l,D);if(l.avail_in!==0||m.lookahead!==0||U!==f&&m.status!==Oe){var ie=m.strategy===A?wt(m,U):m.strategy===C?Bt(m,U):ut[m.level].func(m,U);if((ie===Me||ie===at)&&(m.status=Oe),ie===Ee||ie===Me)return l.avail_out===0&&(m.last_flush=-1),T;if(ie===$e&&(U===c?a._tr_align(m):U!==S&&(a._tr_stored_block(m,0,0,!1),U===b&&(tt(m.head),m.lookahead===0&&(m.strstart=0,m.block_start=0,m.insert=0))),Qe(l),l.avail_out===0))return m.last_flush=-1,T}return U!==g?T:m.wrap<=0?d:(m.wrap===2?(de(m,l.adler&255),de(m,l.adler>>8&255),de(m,l.adler>>16&255),de(m,l.adler>>24&255),de(m,l.total_in&255),de(m,l.total_in>>8&255),de(m,l.total_in>>16&255),de(m,l.total_in>>24&255)):(nt(m,l.adler>>>16),nt(m,l.adler&65535)),Qe(l),m.wrap>0&&(m.wrap=-m.wrap),m.pending!==0?T:d)}function G(l){var U;return!l||!l.state?p:(U=l.state.status,U!==je&&U!==Le&&U!==ve&&U!==Ve&&U!==Fe&&U!==De&&U!==Oe?Ze(l,p):(l.state=null,U===De?Ze(l,y):T))}function fe(l,U){var q=U.length,m,N,M,ae,ee,ie,ge,_t;if(!l||!l.state||(m=l.state,ae=m.wrap,ae===2||ae===1&&m.status!==je||m.lookahead))return p;for(ae===1&&(l.adler=o(l.adler,U,q,0)),m.wrap=0,q>=m.w_size&&(ae===0&&(tt(m.head),m.strstart=0,m.block_start=0,m.insert=0),_t=new s.Buf8(m.w_size),s.arraySet(_t,U,q-m.w_size,m.w_size,0),U=_t,q=m.w_size),ee=l.avail_in,ie=l.next_in,ge=l.input,l.avail_in=q,l.next_in=0,l.input=U,st(m);m.lookahead>=le;){N=m.strstart,M=m.lookahead-(le-1);do m.ins_h=(m.ins_h<<m.hash_shift^m.window[N+le-1])&m.hash_mask,m.prev[N&m.w_mask]=m.head[m.ins_h],m.head[m.ins_h]=N,N++;while(--M);m.strstart=N,m.lookahead=le-1,st(m)}return m.strstart+=m.lookahead,m.block_start=m.strstart,m.insert=m.lookahead,m.lookahead=0,m.match_length=m.prev_length=le-1,m.match_available=0,l.next_in=ie,l.input=ge,l.avail_in=ee,m.wrap=ae,T}r.deflateInit=W,r.deflateInit2=O,r.deflateReset=X,r.deflateResetKeep=Z,r.deflateSetHeader=re,r.deflate=v,r.deflateEnd=G,r.deflateSetDictionary=fe,r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,i,r){function s(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}i.exports=s},{}],48:[function(t,i,r){var s=30,a=12;i.exports=function(u,h){var f,c,b,g,S,T,d,p,y,D,I,w,A,C,R,z,P,H,V,te,ce,he,ue,se,ne;f=u.state,c=u.next_in,se=u.input,b=c+(u.avail_in-5),g=u.next_out,ne=u.output,S=g-(h-u.avail_out),T=g+(u.avail_out-257),d=f.dmax,p=f.wsize,y=f.whave,D=f.wnext,I=f.window,w=f.hold,A=f.bits,C=f.lencode,R=f.distcode,z=(1<<f.lenbits)-1,P=(1<<f.distbits)-1;e:do{A<15&&(w+=se[c++]<<A,A+=8,w+=se[c++]<<A,A+=8),H=C[w&z];t:for(;;){if(V=H>>>24,w>>>=V,A-=V,V=H>>>16&255,V===0)ne[g++]=H&65535;else if(V&16){te=H&65535,V&=15,V&&(A<V&&(w+=se[c++]<<A,A+=8),te+=w&(1<<V)-1,w>>>=V,A-=V),A<15&&(w+=se[c++]<<A,A+=8,w+=se[c++]<<A,A+=8),H=R[w&P];i:for(;;){if(V=H>>>24,w>>>=V,A-=V,V=H>>>16&255,V&16){if(ce=H&65535,V&=15,A<V&&(w+=se[c++]<<A,A+=8,A<V&&(w+=se[c++]<<A,A+=8)),ce+=w&(1<<V)-1,ce>d){u.msg="invalid distance too far back",f.mode=s;break e}if(w>>>=V,A-=V,V=g-S,ce>V){if(V=ce-V,V>y&&f.sane){u.msg="invalid distance too far back",f.mode=s;break e}if(he=0,ue=I,D===0){if(he+=p-V,V<te){te-=V;do ne[g++]=I[he++];while(--V);he=g-ce,ue=ne}}else if(D<V){if(he+=p+D-V,V-=D,V<te){te-=V;do ne[g++]=I[he++];while(--V);if(he=0,D<te){V=D,te-=V;do ne[g++]=I[he++];while(--V);he=g-ce,ue=ne}}}else if(he+=D-V,V<te){te-=V;do ne[g++]=I[he++];while(--V);he=g-ce,ue=ne}for(;te>2;)ne[g++]=ue[he++],ne[g++]=ue[he++],ne[g++]=ue[he++],te-=3;te&&(ne[g++]=ue[he++],te>1&&(ne[g++]=ue[he++]))}else{he=g-ce;do ne[g++]=ne[he++],ne[g++]=ne[he++],ne[g++]=ne[he++],te-=3;while(te>2);te&&(ne[g++]=ne[he++],te>1&&(ne[g++]=ne[he++]))}}else if(V&64){u.msg="invalid distance code",f.mode=s;break e}else{H=R[(H&65535)+(w&(1<<V)-1)];continue i}break}}else if(V&64)if(V&32){f.mode=a;break e}else{u.msg="invalid literal/length code",f.mode=s;break e}else{H=C[(H&65535)+(w&(1<<V)-1)];continue t}break}}while(c<b&&g<T);te=A>>3,c-=te,A-=te<<3,w&=(1<<A)-1,u.next_in=c,u.next_out=g,u.avail_in=c<b?5+(b-c):5-(c-b),u.avail_out=g<T?257+(T-g):257-(g-T),f.hold=w,f.bits=A}},{}],49:[function(t,i,r){var s=t("../utils/common"),a=t("./adler32"),o=t("./crc32"),u=t("./inffast"),h=t("./inftrees"),f=0,c=1,b=2,g=4,S=5,T=6,d=0,p=1,y=2,D=-2,I=-3,w=-4,A=-5,C=8,R=1,z=2,P=3,H=4,V=5,te=6,ce=7,he=8,ue=9,se=10,ne=11,me=12,Re=13,Ae=14,le=15,Se=16,_e=17,Xe=18,je=19,Le=20,ve=21,Ve=22,Fe=23,De=24,Oe=25,Ee=26,$e=27,Me=28,at=29,xe=30,Ze=31,mt=32,tt=852,Qe=592,Ie=15,de=Ie;function nt(O){return(O>>>24&255)+(O>>>8&65280)+((O&65280)<<8)+((O&255)<<24)}function It(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function yt(O){var W;return!O||!O.state?D:(W=O.state,O.total_in=O.total_out=W.total=0,O.msg="",W.wrap&&(O.adler=W.wrap&1),W.mode=R,W.last=0,W.havedict=0,W.dmax=32768,W.head=null,W.hold=0,W.bits=0,W.lencode=W.lendyn=new s.Buf32(tt),W.distcode=W.distdyn=new s.Buf32(Qe),W.sane=1,W.back=-1,d)}function st(O){var W;return!O||!O.state?D:(W=O.state,W.wsize=0,W.whave=0,W.wnext=0,yt(O))}function Ot(O,W){var v,G;return!O||!O.state||(G=O.state,W<0?(v=0,W=-W):(v=(W>>4)+1,W<48&&(W&=15)),W&&(W<8||W>15))?D:(G.window!==null&&G.wbits!==W&&(G.window=null),G.wrap=v,G.wbits=W,st(O))}function bt(O,W){var v,G;return O?(G=new It,O.state=G,G.window=null,v=Ot(O,W),v!==d&&(O.state=null),v):D}function ot(O){return bt(O,de)}var Bt=!0,wt,Ge;function ut(O){if(Bt){var W;for(wt=new s.Buf32(512),Ge=new s.Buf32(32),W=0;W<144;)O.lens[W++]=8;for(;W<256;)O.lens[W++]=9;for(;W<280;)O.lens[W++]=7;for(;W<288;)O.lens[W++]=8;for(h(c,O.lens,0,288,wt,0,O.work,{bits:9}),W=0;W<32;)O.lens[W++]=5;h(b,O.lens,0,32,Ge,0,O.work,{bits:5}),Bt=!1}O.lencode=wt,O.lenbits=9,O.distcode=Ge,O.distbits=5}function qt(O,W,v,G){var fe,l=O.state;return l.window===null&&(l.wsize=1<<l.wbits,l.wnext=0,l.whave=0,l.window=new s.Buf8(l.wsize)),G>=l.wsize?(s.arraySet(l.window,W,v-l.wsize,l.wsize,0),l.wnext=0,l.whave=l.wsize):(fe=l.wsize-l.wnext,fe>G&&(fe=G),s.arraySet(l.window,W,v-G,fe,l.wnext),G-=fe,G?(s.arraySet(l.window,W,v-G,G,0),l.wnext=G,l.whave=l.wsize):(l.wnext+=fe,l.wnext===l.wsize&&(l.wnext=0),l.whave<l.wsize&&(l.whave+=fe))),0}function E(O,W){var v,G,fe,l,U,q,m,N,M,ae,ee,ie,ge,_t,Be=0,ye,Ue,Ke,it,Xt,$t,Pe,lt,Ye=new s.Buf8(4),Et,dt,Oi=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!O||!O.state||!O.output||!O.input&&O.avail_in!==0)return D;v=O.state,v.mode===me&&(v.mode=Re),U=O.next_out,fe=O.output,m=O.avail_out,l=O.next_in,G=O.input,q=O.avail_in,N=v.hold,M=v.bits,ae=q,ee=m,lt=d;e:for(;;)switch(v.mode){case R:if(v.wrap===0){v.mode=Re;break}for(;M<16;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}if(v.wrap&2&&N===35615){v.check=0,Ye[0]=N&255,Ye[1]=N>>>8&255,v.check=o(v.check,Ye,2,0),N=0,M=0,v.mode=z;break}if(v.flags=0,v.head&&(v.head.done=!1),!(v.wrap&1)||(((N&255)<<8)+(N>>8))%31){O.msg="incorrect header check",v.mode=xe;break}if((N&15)!==C){O.msg="unknown compression method",v.mode=xe;break}if(N>>>=4,M-=4,Pe=(N&15)+8,v.wbits===0)v.wbits=Pe;else if(Pe>v.wbits){O.msg="invalid window size",v.mode=xe;break}v.dmax=1<<Pe,O.adler=v.check=1,v.mode=N&512?se:me,N=0,M=0;break;case z:for(;M<16;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}if(v.flags=N,(v.flags&255)!==C){O.msg="unknown compression method",v.mode=xe;break}if(v.flags&57344){O.msg="unknown header flags set",v.mode=xe;break}v.head&&(v.head.text=N>>8&1),v.flags&512&&(Ye[0]=N&255,Ye[1]=N>>>8&255,v.check=o(v.check,Ye,2,0)),N=0,M=0,v.mode=P;case P:for(;M<32;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}v.head&&(v.head.time=N),v.flags&512&&(Ye[0]=N&255,Ye[1]=N>>>8&255,Ye[2]=N>>>16&255,Ye[3]=N>>>24&255,v.check=o(v.check,Ye,4,0)),N=0,M=0,v.mode=H;case H:for(;M<16;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}v.head&&(v.head.xflags=N&255,v.head.os=N>>8),v.flags&512&&(Ye[0]=N&255,Ye[1]=N>>>8&255,v.check=o(v.check,Ye,2,0)),N=0,M=0,v.mode=V;case V:if(v.flags&1024){for(;M<16;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}v.length=N,v.head&&(v.head.extra_len=N),v.flags&512&&(Ye[0]=N&255,Ye[1]=N>>>8&255,v.check=o(v.check,Ye,2,0)),N=0,M=0}else v.head&&(v.head.extra=null);v.mode=te;case te:if(v.flags&1024&&(ie=v.length,ie>q&&(ie=q),ie&&(v.head&&(Pe=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),s.arraySet(v.head.extra,G,l,ie,Pe)),v.flags&512&&(v.check=o(v.check,G,ie,l)),q-=ie,l+=ie,v.length-=ie),v.length))break e;v.length=0,v.mode=ce;case ce:if(v.flags&2048){if(q===0)break e;ie=0;do Pe=G[l+ie++],v.head&&Pe&&v.length<65536&&(v.head.name+=String.fromCharCode(Pe));while(Pe&&ie<q);if(v.flags&512&&(v.check=o(v.check,G,ie,l)),q-=ie,l+=ie,Pe)break e}else v.head&&(v.head.name=null);v.length=0,v.mode=he;case he:if(v.flags&4096){if(q===0)break e;ie=0;do Pe=G[l+ie++],v.head&&Pe&&v.length<65536&&(v.head.comment+=String.fromCharCode(Pe));while(Pe&&ie<q);if(v.flags&512&&(v.check=o(v.check,G,ie,l)),q-=ie,l+=ie,Pe)break e}else v.head&&(v.head.comment=null);v.mode=ue;case ue:if(v.flags&512){for(;M<16;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}if(N!==(v.check&65535)){O.msg="header crc mismatch",v.mode=xe;break}N=0,M=0}v.head&&(v.head.hcrc=v.flags>>9&1,v.head.done=!0),O.adler=v.check=0,v.mode=me;break;case se:for(;M<32;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}O.adler=v.check=nt(N),N=0,M=0,v.mode=ne;case ne:if(v.havedict===0)return O.next_out=U,O.avail_out=m,O.next_in=l,O.avail_in=q,v.hold=N,v.bits=M,y;O.adler=v.check=1,v.mode=me;case me:if(W===S||W===T)break e;case Re:if(v.last){N>>>=M&7,M-=M&7,v.mode=$e;break}for(;M<3;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}switch(v.last=N&1,N>>>=1,M-=1,N&3){case 0:v.mode=Ae;break;case 1:if(ut(v),v.mode=Le,W===T){N>>>=2,M-=2;break e}break;case 2:v.mode=_e;break;case 3:O.msg="invalid block type",v.mode=xe}N>>>=2,M-=2;break;case Ae:for(N>>>=M&7,M-=M&7;M<32;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}if((N&65535)!==(N>>>16^65535)){O.msg="invalid stored block lengths",v.mode=xe;break}if(v.length=N&65535,N=0,M=0,v.mode=le,W===T)break e;case le:v.mode=Se;case Se:if(ie=v.length,ie){if(ie>q&&(ie=q),ie>m&&(ie=m),ie===0)break e;s.arraySet(fe,G,l,ie,U),q-=ie,l+=ie,m-=ie,U+=ie,v.length-=ie;break}v.mode=me;break;case _e:for(;M<14;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}if(v.nlen=(N&31)+257,N>>>=5,M-=5,v.ndist=(N&31)+1,N>>>=5,M-=5,v.ncode=(N&15)+4,N>>>=4,M-=4,v.nlen>286||v.ndist>30){O.msg="too many length or distance symbols",v.mode=xe;break}v.have=0,v.mode=Xe;case Xe:for(;v.have<v.ncode;){for(;M<3;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}v.lens[Oi[v.have++]]=N&7,N>>>=3,M-=3}for(;v.have<19;)v.lens[Oi[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,Et={bits:v.lenbits},lt=h(f,v.lens,0,19,v.lencode,0,v.work,Et),v.lenbits=Et.bits,lt){O.msg="invalid code lengths set",v.mode=xe;break}v.have=0,v.mode=je;case je:for(;v.have<v.nlen+v.ndist;){for(;Be=v.lencode[N&(1<<v.lenbits)-1],ye=Be>>>24,Ue=Be>>>16&255,Ke=Be&65535,!(ye<=M);){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}if(Ke<16)N>>>=ye,M-=ye,v.lens[v.have++]=Ke;else{if(Ke===16){for(dt=ye+2;M<dt;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}if(N>>>=ye,M-=ye,v.have===0){O.msg="invalid bit length repeat",v.mode=xe;break}Pe=v.lens[v.have-1],ie=3+(N&3),N>>>=2,M-=2}else if(Ke===17){for(dt=ye+3;M<dt;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}N>>>=ye,M-=ye,Pe=0,ie=3+(N&7),N>>>=3,M-=3}else{for(dt=ye+7;M<dt;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}N>>>=ye,M-=ye,Pe=0,ie=11+(N&127),N>>>=7,M-=7}if(v.have+ie>v.nlen+v.ndist){O.msg="invalid bit length repeat",v.mode=xe;break}for(;ie--;)v.lens[v.have++]=Pe}}if(v.mode===xe)break;if(v.lens[256]===0){O.msg="invalid code -- missing end-of-block",v.mode=xe;break}if(v.lenbits=9,Et={bits:v.lenbits},lt=h(c,v.lens,0,v.nlen,v.lencode,0,v.work,Et),v.lenbits=Et.bits,lt){O.msg="invalid literal/lengths set",v.mode=xe;break}if(v.distbits=6,v.distcode=v.distdyn,Et={bits:v.distbits},lt=h(b,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,Et),v.distbits=Et.bits,lt){O.msg="invalid distances set",v.mode=xe;break}if(v.mode=Le,W===T)break e;case Le:v.mode=ve;case ve:if(q>=6&&m>=258){O.next_out=U,O.avail_out=m,O.next_in=l,O.avail_in=q,v.hold=N,v.bits=M,u(O,ee),U=O.next_out,fe=O.output,m=O.avail_out,l=O.next_in,G=O.input,q=O.avail_in,N=v.hold,M=v.bits,v.mode===me&&(v.back=-1);break}for(v.back=0;Be=v.lencode[N&(1<<v.lenbits)-1],ye=Be>>>24,Ue=Be>>>16&255,Ke=Be&65535,!(ye<=M);){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}if(Ue&&!(Ue&240)){for(it=ye,Xt=Ue,$t=Ke;Be=v.lencode[$t+((N&(1<<it+Xt)-1)>>it)],ye=Be>>>24,Ue=Be>>>16&255,Ke=Be&65535,!(it+ye<=M);){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}N>>>=it,M-=it,v.back+=it}if(N>>>=ye,M-=ye,v.back+=ye,v.length=Ke,Ue===0){v.mode=Ee;break}if(Ue&32){v.back=-1,v.mode=me;break}if(Ue&64){O.msg="invalid literal/length code",v.mode=xe;break}v.extra=Ue&15,v.mode=Ve;case Ve:if(v.extra){for(dt=v.extra;M<dt;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}v.length+=N&(1<<v.extra)-1,N>>>=v.extra,M-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=Fe;case Fe:for(;Be=v.distcode[N&(1<<v.distbits)-1],ye=Be>>>24,Ue=Be>>>16&255,Ke=Be&65535,!(ye<=M);){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}if(!(Ue&240)){for(it=ye,Xt=Ue,$t=Ke;Be=v.distcode[$t+((N&(1<<it+Xt)-1)>>it)],ye=Be>>>24,Ue=Be>>>16&255,Ke=Be&65535,!(it+ye<=M);){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}N>>>=it,M-=it,v.back+=it}if(N>>>=ye,M-=ye,v.back+=ye,Ue&64){O.msg="invalid distance code",v.mode=xe;break}v.offset=Ke,v.extra=Ue&15,v.mode=De;case De:if(v.extra){for(dt=v.extra;M<dt;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}v.offset+=N&(1<<v.extra)-1,N>>>=v.extra,M-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){O.msg="invalid distance too far back",v.mode=xe;break}v.mode=Oe;case Oe:if(m===0)break e;if(ie=ee-m,v.offset>ie){if(ie=v.offset-ie,ie>v.whave&&v.sane){O.msg="invalid distance too far back",v.mode=xe;break}ie>v.wnext?(ie-=v.wnext,ge=v.wsize-ie):ge=v.wnext-ie,ie>v.length&&(ie=v.length),_t=v.window}else _t=fe,ge=U-v.offset,ie=v.length;ie>m&&(ie=m),m-=ie,v.length-=ie;do fe[U++]=_t[ge++];while(--ie);v.length===0&&(v.mode=ve);break;case Ee:if(m===0)break e;fe[U++]=v.length,m--,v.mode=ve;break;case $e:if(v.wrap){for(;M<32;){if(q===0)break e;q--,N|=G[l++]<<M,M+=8}if(ee-=m,O.total_out+=ee,v.total+=ee,ee&&(O.adler=v.check=v.flags?o(v.check,fe,ee,U-ee):a(v.check,fe,ee,U-ee)),ee=m,(v.flags?N:nt(N))!==v.check){O.msg="incorrect data check",v.mode=xe;break}N=0,M=0}v.mode=Me;case Me:if(v.wrap&&v.flags){for(;M<32;){if(q===0)break e;q--,N+=G[l++]<<M,M+=8}if(N!==(v.total&4294967295)){O.msg="incorrect length check",v.mode=xe;break}N=0,M=0}v.mode=at;case at:lt=p;break e;case xe:lt=I;break e;case Ze:return w;case mt:default:return D}return O.next_out=U,O.avail_out=m,O.next_in=l,O.avail_in=q,v.hold=N,v.bits=M,(v.wsize||ee!==O.avail_out&&v.mode<xe&&(v.mode<$e||W!==g))&&qt(O,O.output,O.next_out,ee-O.avail_out),ae-=O.avail_in,ee-=O.avail_out,O.total_in+=ae,O.total_out+=ee,v.total+=ee,v.wrap&&ee&&(O.adler=v.check=v.flags?o(v.check,fe,ee,O.next_out-ee):a(v.check,fe,ee,O.next_out-ee)),O.data_type=v.bits+(v.last?64:0)+(v.mode===me?128:0)+(v.mode===Le||v.mode===le?256:0),(ae===0&&ee===0||W===g)&&lt===d&&(lt=A),lt}function Z(O){if(!O||!O.state)return D;var W=O.state;return W.window&&(W.window=null),O.state=null,d}function X(O,W){var v;return!O||!O.state||(v=O.state,!(v.wrap&2))?D:(v.head=W,W.done=!1,d)}function re(O,W){var v=W.length,G,fe,l;return!O||!O.state||(G=O.state,G.wrap!==0&&G.mode!==ne)?D:G.mode===ne&&(fe=1,fe=a(fe,W,v,0),fe!==G.check)?I:(l=qt(O,W,v,v),l?(G.mode=Ze,w):(G.havedict=1,d))}r.inflateReset=st,r.inflateReset2=Ot,r.inflateResetKeep=yt,r.inflateInit=ot,r.inflateInit2=bt,r.inflate=E,r.inflateEnd=Z,r.inflateGetHeader=X,r.inflateSetDictionary=re,r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,i,r){var s=t("../utils/common"),a=15,o=852,u=592,h=0,f=1,c=2,b=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],g=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],S=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],T=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];i.exports=function(p,y,D,I,w,A,C,R){var z=R.bits,P=0,H=0,V=0,te=0,ce=0,he=0,ue=0,se=0,ne=0,me=0,Re,Ae,le,Se,_e,Xe=null,je=0,Le,ve=new s.Buf16(a+1),Ve=new s.Buf16(a+1),Fe=null,De=0,Oe,Ee,$e;for(P=0;P<=a;P++)ve[P]=0;for(H=0;H<I;H++)ve[y[D+H]]++;for(ce=z,te=a;te>=1&&ve[te]===0;te--);if(ce>te&&(ce=te),te===0)return w[A++]=1<<24|64<<16|0,w[A++]=1<<24|64<<16|0,R.bits=1,0;for(V=1;V<te&&ve[V]===0;V++);for(ce<V&&(ce=V),se=1,P=1;P<=a;P++)if(se<<=1,se-=ve[P],se<0)return-1;if(se>0&&(p===h||te!==1))return-1;for(Ve[1]=0,P=1;P<a;P++)Ve[P+1]=Ve[P]+ve[P];for(H=0;H<I;H++)y[D+H]!==0&&(C[Ve[y[D+H]]++]=H);if(p===h?(Xe=Fe=C,Le=19):p===f?(Xe=b,je-=257,Fe=g,De-=257,Le=256):(Xe=S,Fe=T,Le=-1),me=0,H=0,P=V,_e=A,he=ce,ue=0,le=-1,ne=1<<ce,Se=ne-1,p===f&&ne>o||p===c&&ne>u)return 1;for(;;){Oe=P-ue,C[H]<Le?(Ee=0,$e=C[H]):C[H]>Le?(Ee=Fe[De+C[H]],$e=Xe[je+C[H]]):(Ee=96,$e=0),Re=1<<P-ue,Ae=1<<he,V=Ae;do Ae-=Re,w[_e+(me>>ue)+Ae]=Oe<<24|Ee<<16|$e|0;while(Ae!==0);for(Re=1<<P-1;me&Re;)Re>>=1;if(Re!==0?(me&=Re-1,me+=Re):me=0,H++,--ve[P]===0){if(P===te)break;P=y[D+C[H]]}if(P>ce&&(me&Se)!==le){for(ue===0&&(ue=ce),_e+=V,he=P-ue,se=1<<he;he+ue<te&&(se-=ve[he+ue],!(se<=0));)he++,se<<=1;if(ne+=1<<he,p===f&&ne>o||p===c&&ne>u)return 1;le=me&Se,w[le]=ce<<24|he<<16|_e-A|0}}return me!==0&&(w[_e+me]=P-ue<<24|64<<16|0),R.bits=ce,0}},{"../utils/common":41}],51:[function(t,i,r){i.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,i,r){var s=t("../utils/common"),a=4,o=0,u=1,h=2;function f(E){for(var Z=E.length;--Z>=0;)E[Z]=0}var c=0,b=1,g=2,S=3,T=258,d=29,p=256,y=p+1+d,D=30,I=19,w=2*y+1,A=15,C=16,R=7,z=256,P=16,H=17,V=18,te=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ce=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],he=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ue=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],se=512,ne=new Array((y+2)*2);f(ne);var me=new Array(D*2);f(me);var Re=new Array(se);f(Re);var Ae=new Array(T-S+1);f(Ae);var le=new Array(d);f(le);var Se=new Array(D);f(Se);function _e(E,Z,X,re,O){this.static_tree=E,this.extra_bits=Z,this.extra_base=X,this.elems=re,this.max_length=O,this.has_stree=E&&E.length}var Xe,je,Le;function ve(E,Z){this.dyn_tree=E,this.max_code=0,this.stat_desc=Z}function Ve(E){return E<256?Re[E]:Re[256+(E>>>7)]}function Fe(E,Z){E.pending_buf[E.pending++]=Z&255,E.pending_buf[E.pending++]=Z>>>8&255}function De(E,Z,X){E.bi_valid>C-X?(E.bi_buf|=Z<<E.bi_valid&65535,Fe(E,E.bi_buf),E.bi_buf=Z>>C-E.bi_valid,E.bi_valid+=X-C):(E.bi_buf|=Z<<E.bi_valid&65535,E.bi_valid+=X)}function Oe(E,Z,X){De(E,X[Z*2],X[Z*2+1])}function Ee(E,Z){var X=0;do X|=E&1,E>>>=1,X<<=1;while(--Z>0);return X>>>1}function $e(E){E.bi_valid===16?(Fe(E,E.bi_buf),E.bi_buf=0,E.bi_valid=0):E.bi_valid>=8&&(E.pending_buf[E.pending++]=E.bi_buf&255,E.bi_buf>>=8,E.bi_valid-=8)}function Me(E,Z){var X=Z.dyn_tree,re=Z.max_code,O=Z.stat_desc.static_tree,W=Z.stat_desc.has_stree,v=Z.stat_desc.extra_bits,G=Z.stat_desc.extra_base,fe=Z.stat_desc.max_length,l,U,q,m,N,M,ae=0;for(m=0;m<=A;m++)E.bl_count[m]=0;for(X[E.heap[E.heap_max]*2+1]=0,l=E.heap_max+1;l<w;l++)U=E.heap[l],m=X[X[U*2+1]*2+1]+1,m>fe&&(m=fe,ae++),X[U*2+1]=m,!(U>re)&&(E.bl_count[m]++,N=0,U>=G&&(N=v[U-G]),M=X[U*2],E.opt_len+=M*(m+N),W&&(E.static_len+=M*(O[U*2+1]+N)));if(ae!==0){do{for(m=fe-1;E.bl_count[m]===0;)m--;E.bl_count[m]--,E.bl_count[m+1]+=2,E.bl_count[fe]--,ae-=2}while(ae>0);for(m=fe;m!==0;m--)for(U=E.bl_count[m];U!==0;)q=E.heap[--l],!(q>re)&&(X[q*2+1]!==m&&(E.opt_len+=(m-X[q*2+1])*X[q*2],X[q*2+1]=m),U--)}}function at(E,Z,X){var re=new Array(A+1),O=0,W,v;for(W=1;W<=A;W++)re[W]=O=O+X[W-1]<<1;for(v=0;v<=Z;v++){var G=E[v*2+1];G!==0&&(E[v*2]=Ee(re[G]++,G))}}function xe(){var E,Z,X,re,O,W=new Array(A+1);for(X=0,re=0;re<d-1;re++)for(le[re]=X,E=0;E<1<<te[re];E++)Ae[X++]=re;for(Ae[X-1]=re,O=0,re=0;re<16;re++)for(Se[re]=O,E=0;E<1<<ce[re];E++)Re[O++]=re;for(O>>=7;re<D;re++)for(Se[re]=O<<7,E=0;E<1<<ce[re]-7;E++)Re[256+O++]=re;for(Z=0;Z<=A;Z++)W[Z]=0;for(E=0;E<=143;)ne[E*2+1]=8,E++,W[8]++;for(;E<=255;)ne[E*2+1]=9,E++,W[9]++;for(;E<=279;)ne[E*2+1]=7,E++,W[7]++;for(;E<=287;)ne[E*2+1]=8,E++,W[8]++;for(at(ne,y+1,W),E=0;E<D;E++)me[E*2+1]=5,me[E*2]=Ee(E,5);Xe=new _e(ne,te,p+1,y,A),je=new _e(me,ce,0,D,A),Le=new _e(new Array(0),he,0,I,R)}function Ze(E){var Z;for(Z=0;Z<y;Z++)E.dyn_ltree[Z*2]=0;for(Z=0;Z<D;Z++)E.dyn_dtree[Z*2]=0;for(Z=0;Z<I;Z++)E.bl_tree[Z*2]=0;E.dyn_ltree[z*2]=1,E.opt_len=E.static_len=0,E.last_lit=E.matches=0}function mt(E){E.bi_valid>8?Fe(E,E.bi_buf):E.bi_valid>0&&(E.pending_buf[E.pending++]=E.bi_buf),E.bi_buf=0,E.bi_valid=0}function tt(E,Z,X,re){mt(E),Fe(E,X),Fe(E,~X),s.arraySet(E.pending_buf,E.window,Z,X,E.pending),E.pending+=X}function Qe(E,Z,X,re){var O=Z*2,W=X*2;return E[O]<E[W]||E[O]===E[W]&&re[Z]<=re[X]}function Ie(E,Z,X){for(var re=E.heap[X],O=X<<1;O<=E.heap_len&&(O<E.heap_len&&Qe(Z,E.heap[O+1],E.heap[O],E.depth)&&O++,!Qe(Z,re,E.heap[O],E.depth));)E.heap[X]=E.heap[O],X=O,O<<=1;E.heap[X]=re}function de(E,Z,X){var re,O,W=0,v,G;if(E.last_lit!==0)do re=E.pending_buf[E.d_buf+W*2]<<8|E.pending_buf[E.d_buf+W*2+1],O=E.pending_buf[E.l_buf+W],W++,re===0?Oe(E,O,Z):(v=Ae[O],Oe(E,v+p+1,Z),G=te[v],G!==0&&(O-=le[v],De(E,O,G)),re--,v=Ve(re),Oe(E,v,X),G=ce[v],G!==0&&(re-=Se[v],De(E,re,G)));while(W<E.last_lit);Oe(E,z,Z)}function nt(E,Z){var X=Z.dyn_tree,re=Z.stat_desc.static_tree,O=Z.stat_desc.has_stree,W=Z.stat_desc.elems,v,G,fe=-1,l;for(E.heap_len=0,E.heap_max=w,v=0;v<W;v++)X[v*2]!==0?(E.heap[++E.heap_len]=fe=v,E.depth[v]=0):X[v*2+1]=0;for(;E.heap_len<2;)l=E.heap[++E.heap_len]=fe<2?++fe:0,X[l*2]=1,E.depth[l]=0,E.opt_len--,O&&(E.static_len-=re[l*2+1]);for(Z.max_code=fe,v=E.heap_len>>1;v>=1;v--)Ie(E,X,v);l=W;do v=E.heap[1],E.heap[1]=E.heap[E.heap_len--],Ie(E,X,1),G=E.heap[1],E.heap[--E.heap_max]=v,E.heap[--E.heap_max]=G,X[l*2]=X[v*2]+X[G*2],E.depth[l]=(E.depth[v]>=E.depth[G]?E.depth[v]:E.depth[G])+1,X[v*2+1]=X[G*2+1]=l,E.heap[1]=l++,Ie(E,X,1);while(E.heap_len>=2);E.heap[--E.heap_max]=E.heap[1],Me(E,Z),at(X,fe,E.bl_count)}function It(E,Z,X){var re,O=-1,W,v=Z[0*2+1],G=0,fe=7,l=4;for(v===0&&(fe=138,l=3),Z[(X+1)*2+1]=65535,re=0;re<=X;re++)W=v,v=Z[(re+1)*2+1],!(++G<fe&&W===v)&&(G<l?E.bl_tree[W*2]+=G:W!==0?(W!==O&&E.bl_tree[W*2]++,E.bl_tree[P*2]++):G<=10?E.bl_tree[H*2]++:E.bl_tree[V*2]++,G=0,O=W,v===0?(fe=138,l=3):W===v?(fe=6,l=3):(fe=7,l=4))}function yt(E,Z,X){var re,O=-1,W,v=Z[0*2+1],G=0,fe=7,l=4;for(v===0&&(fe=138,l=3),re=0;re<=X;re++)if(W=v,v=Z[(re+1)*2+1],!(++G<fe&&W===v)){if(G<l)do Oe(E,W,E.bl_tree);while(--G!==0);else W!==0?(W!==O&&(Oe(E,W,E.bl_tree),G--),Oe(E,P,E.bl_tree),De(E,G-3,2)):G<=10?(Oe(E,H,E.bl_tree),De(E,G-3,3)):(Oe(E,V,E.bl_tree),De(E,G-11,7));G=0,O=W,v===0?(fe=138,l=3):W===v?(fe=6,l=3):(fe=7,l=4)}}function st(E){var Z;for(It(E,E.dyn_ltree,E.l_desc.max_code),It(E,E.dyn_dtree,E.d_desc.max_code),nt(E,E.bl_desc),Z=I-1;Z>=3&&E.bl_tree[ue[Z]*2+1]===0;Z--);return E.opt_len+=3*(Z+1)+5+5+4,Z}function Ot(E,Z,X,re){var O;for(De(E,Z-257,5),De(E,X-1,5),De(E,re-4,4),O=0;O<re;O++)De(E,E.bl_tree[ue[O]*2+1],3);yt(E,E.dyn_ltree,Z-1),yt(E,E.dyn_dtree,X-1)}function bt(E){var Z=4093624447,X;for(X=0;X<=31;X++,Z>>>=1)if(Z&1&&E.dyn_ltree[X*2]!==0)return o;if(E.dyn_ltree[9*2]!==0||E.dyn_ltree[10*2]!==0||E.dyn_ltree[13*2]!==0)return u;for(X=32;X<p;X++)if(E.dyn_ltree[X*2]!==0)return u;return o}var ot=!1;function Bt(E){ot||(xe(),ot=!0),E.l_desc=new ve(E.dyn_ltree,Xe),E.d_desc=new ve(E.dyn_dtree,je),E.bl_desc=new ve(E.bl_tree,Le),E.bi_buf=0,E.bi_valid=0,Ze(E)}function wt(E,Z,X,re){De(E,(c<<1)+(re?1:0),3),tt(E,Z,X)}function Ge(E){De(E,b<<1,3),Oe(E,z,ne),$e(E)}function ut(E,Z,X,re){var O,W,v=0;E.level>0?(E.strm.data_type===h&&(E.strm.data_type=bt(E)),nt(E,E.l_desc),nt(E,E.d_desc),v=st(E),O=E.opt_len+3+7>>>3,W=E.static_len+3+7>>>3,W<=O&&(O=W)):O=W=X+5,X+4<=O&&Z!==-1?wt(E,Z,X,re):E.strategy===a||W===O?(De(E,(b<<1)+(re?1:0),3),de(E,ne,me)):(De(E,(g<<1)+(re?1:0),3),Ot(E,E.l_desc.max_code+1,E.d_desc.max_code+1,v+1),de(E,E.dyn_ltree,E.dyn_dtree)),Ze(E),re&&mt(E)}function qt(E,Z,X){return E.pending_buf[E.d_buf+E.last_lit*2]=Z>>>8&255,E.pending_buf[E.d_buf+E.last_lit*2+1]=Z&255,E.pending_buf[E.l_buf+E.last_lit]=X&255,E.last_lit++,Z===0?E.dyn_ltree[X*2]++:(E.matches++,Z--,E.dyn_ltree[(Ae[X]+p+1)*2]++,E.dyn_dtree[Ve(Z)*2]++),E.last_lit===E.lit_bufsize-1}r._tr_init=Bt,r._tr_stored_block=wt,r._tr_flush_block=ut,r._tr_tally=qt,r._tr_align=Ge},{"../utils/common":41}],53:[function(t,i,r){function s(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}i.exports=s},{}],54:[function(t,i,r){(function(s){(function(a,o){if(a.setImmediate)return;var u=1,h={},f=!1,c=a.document,b;function g(R){typeof R!="function"&&(R=new Function(""+R));for(var z=new Array(arguments.length-1),P=0;P<z.length;P++)z[P]=arguments[P+1];var H={callback:R,args:z};return h[u]=H,b(u),u++}function S(R){delete h[R]}function T(R){var z=R.callback,P=R.args;switch(P.length){case 0:z();break;case 1:z(P[0]);break;case 2:z(P[0],P[1]);break;case 3:z(P[0],P[1],P[2]);break;default:z.apply(o,P);break}}function d(R){if(f)setTimeout(d,0,R);else{var z=h[R];if(z){f=!0;try{T(z)}finally{S(R),f=!1}}}}function p(){b=function(R){process.nextTick(function(){d(R)})}}function y(){if(a.postMessage&&!a.importScripts){var R=!0,z=a.onmessage;return a.onmessage=function(){R=!1},a.postMessage("","*"),a.onmessage=z,R}}function D(){var R="setImmediate$"+Math.random()+"$",z=function(P){P.source===a&&typeof P.data=="string"&&P.data.indexOf(R)===0&&d(+P.data.slice(R.length))};a.addEventListener?a.addEventListener("message",z,!1):a.attachEvent("onmessage",z),b=function(P){a.postMessage(R+P,"*")}}function I(){var R=new MessageChannel;R.port1.onmessage=function(z){var P=z.data;d(P)},b=function(z){R.port2.postMessage(z)}}function w(){var R=c.documentElement;b=function(z){var P=c.createElement("script");P.onreadystatechange=function(){d(z),P.onreadystatechange=null,R.removeChild(P),P=null},R.appendChild(P)}}function A(){b=function(R){setTimeout(d,0,R)}}var C=Object.getPrototypeOf&&Object.getPrototypeOf(a);C=C&&C.setTimeout?C:a,{}.toString.call(a.process)==="[object process]"?p():y()?D():a.MessageChannel?I():c&&"onreadystatechange"in c.createElement("script")?w():A(),C.setImmediate=g,C.clearImmediate=S})(typeof self>"u"?typeof s>"u"?this:s:self)}).call(this,typeof gt<"u"?gt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Vs);var tl=Vs.exports;const il=ci(tl);class rl{constructor(){this.zip=void 0,this.urlCache={},this.checkRequirements()}checkRequirements(){try{this.zip=new il}catch{throw new Error("JSZip lib not loaded")}}open(e,t){return this.zip.loadAsync(e,{base64:t})}openUrl(e,t){return Di(e,"binary").then(function(i){return this.zip.loadAsync(i,{base64:t})}.bind(this))}request(e,t){var i=new be,r,s=new Ut(e);return t||(t=s.extension),t=="blob"?r=this.getBlob(e):r=this.getText(e),r?r.then(function(a){let o=this.handleResponse(a,t);i.resolve(o)}.bind(this)):i.reject({message:"File not found in the epub: "+e,stack:new Error().stack}),i.promise}handleResponse(e,t){var i;return t=="json"?i=JSON.parse(e):Ai(t)?i=Nt(e,"text/xml"):t=="xhtml"?i=Nt(e,"application/xhtml+xml"):t=="html"||t=="htm"?i=Nt(e,"text/html"):i=e,i}getBlob(e,t){var i=window.decodeURIComponent(e.substr(1)),r=this.zip.file(i);if(r)return t=t||oi.lookup(r.name),r.async("uint8array").then(function(s){return new Blob([s],{type:t})})}getText(e,t){var i=window.decodeURIComponent(e.substr(1)),r=this.zip.file(i);if(r)return r.async("string").then(function(s){return s})}getBase64(e,t){var i=window.decodeURIComponent(e.substr(1)),r=this.zip.file(i);if(r)return t=t||oi.lookup(r.name),r.async("base64").then(function(s){return"data:"+t+";base64,"+s})}createUrl(e,t){var i=new be,r=window.URL||window.webkitURL||window.mozURL,s,a,o=t&&t.base64;return e in this.urlCache?(i.resolve(this.urlCache[e]),i.promise):(o?(a=this.getBase64(e),a&&a.then(function(u){this.urlCache[e]=u,i.resolve(u)}.bind(this))):(a=this.getBlob(e),a&&a.then(function(u){s=r.createObjectURL(u),this.urlCache[e]=s,i.resolve(s)}.bind(this))),a||i.reject({message:"File not found in the epub: "+e,stack:new Error().stack}),i.promise)}revokeUrl(e){var t=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[e];i&&t.revokeObjectURL(i)}destroy(){var e=window.URL||window.webkitURL||window.mozURL;for(let t in this.urlCache)e.revokeObjectURL(t);this.zip=void 0,this.urlCache={}}}var Zs={exports:{}};/*!
    localForage -- Offline Storage, Improved
    Version 1.10.0
    https://localforage.github.io/localForage
    (c) 2013-2017 Mozilla, Apache License 2.0
*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(i,r,s){function a(h,f){if(!r[h]){if(!i[h]){var c=typeof Ht=="function"&&Ht;if(!f&&c)return c(h,!0);if(o)return o(h,!0);var b=new Error("Cannot find module '"+h+"'");throw b.code="MODULE_NOT_FOUND",b}var g=r[h]={exports:{}};i[h][0].call(g.exports,function(S){var T=i[h][1][S];return a(T||S)},g,g.exports,t,i,r,s)}return r[h].exports}for(var o=typeof Ht=="function"&&Ht,u=0;u<s.length;u++)a(s[u]);return a}({1:[function(t,i,r){(function(s){var a=s.MutationObserver||s.WebKitMutationObserver,o;if(a){var u=0,h=new a(S),f=s.document.createTextNode("");h.observe(f,{characterData:!0}),o=function(){f.data=u=++u%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var c=new s.MessageChannel;c.port1.onmessage=S,o=function(){c.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?o=function(){var d=s.document.createElement("script");d.onreadystatechange=function(){S(),d.onreadystatechange=null,d.parentNode.removeChild(d),d=null},s.document.documentElement.appendChild(d)}:o=function(){setTimeout(S,0)};var b,g=[];function S(){b=!0;for(var d,p,y=g.length;y;){for(p=g,g=[],d=-1;++d<y;)p[d]();y=g.length}b=!1}i.exports=T;function T(d){g.push(d)===1&&!b&&o()}}).call(this,typeof gt<"u"?gt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(t,i,r){var s=t(1);function a(){}var o={},u=["REJECTED"],h=["FULFILLED"],f=["PENDING"];i.exports=c;function c(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,w!==a&&T(this,w)}c.prototype.catch=function(w){return this.then(null,w)},c.prototype.then=function(w,A){if(typeof w!="function"&&this.state===h||typeof A!="function"&&this.state===u)return this;var C=new this.constructor(a);if(this.state!==f){var R=this.state===h?w:A;g(C,R,this.outcome)}else this.queue.push(new b(C,w,A));return C};function b(w,A,C){this.promise=w,typeof A=="function"&&(this.onFulfilled=A,this.callFulfilled=this.otherCallFulfilled),typeof C=="function"&&(this.onRejected=C,this.callRejected=this.otherCallRejected)}b.prototype.callFulfilled=function(w){o.resolve(this.promise,w)},b.prototype.otherCallFulfilled=function(w){g(this.promise,this.onFulfilled,w)},b.prototype.callRejected=function(w){o.reject(this.promise,w)},b.prototype.otherCallRejected=function(w){g(this.promise,this.onRejected,w)};function g(w,A,C){s(function(){var R;try{R=A(C)}catch(z){return o.reject(w,z)}R===w?o.reject(w,new TypeError("Cannot resolve promise with itself")):o.resolve(w,R)})}o.resolve=function(w,A){var C=d(S,A);if(C.status==="error")return o.reject(w,C.value);var R=C.value;if(R)T(w,R);else{w.state=h,w.outcome=A;for(var z=-1,P=w.queue.length;++z<P;)w.queue[z].callFulfilled(A)}return w},o.reject=function(w,A){w.state=u,w.outcome=A;for(var C=-1,R=w.queue.length;++C<R;)w.queue[C].callRejected(A);return w};function S(w){var A=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof A=="function")return function(){A.apply(w,arguments)}}function T(w,A){var C=!1;function R(V){C||(C=!0,o.reject(w,V))}function z(V){C||(C=!0,o.resolve(w,V))}function P(){A(z,R)}var H=d(P);H.status==="error"&&R(H.value)}function d(w,A){var C={};try{C.value=w(A),C.status="success"}catch(R){C.status="error",C.value=R}return C}c.resolve=p;function p(w){return w instanceof this?w:o.resolve(new this(a),w)}c.reject=y;function y(w){var A=new this(a);return o.reject(A,w)}c.all=D;function D(w){var A=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=w.length,R=!1;if(!C)return this.resolve([]);for(var z=new Array(C),P=0,H=-1,V=new this(a);++H<C;)te(w[H],H);return V;function te(ce,he){A.resolve(ce).then(ue,function(se){R||(R=!0,o.reject(V,se))});function ue(se){z[he]=se,++P===C&&!R&&(R=!0,o.resolve(V,z))}}}c.race=I;function I(w){var A=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=w.length,R=!1;if(!C)return this.resolve([]);for(var z=-1,P=new this(a);++z<C;)H(w[z]);return P;function H(V){A.resolve(V).then(function(te){R||(R=!0,o.resolve(P,te))},function(te){R||(R=!0,o.reject(P,te))})}}},{1:1}],3:[function(t,i,r){(function(s){typeof s.Promise!="function"&&(s.Promise=t(2))}).call(this,typeof gt<"u"?gt:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(t,i,r){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _};function a(_,k){if(!(_ instanceof k))throw new TypeError("Cannot call a class as a function")}function o(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var u=o();function h(){try{if(!u||!u.open)return!1;var _=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),k=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!_||k)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function f(_,k){_=_||[],k=k||{};try{return new Blob(_,k)}catch(B){if(B.name!=="TypeError")throw B;for(var x=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,L=new x,F=0;F<_.length;F+=1)L.append(_[F]);return L.getBlob(k.type)}}typeof Promise>"u"&&t(3);var c=Promise;function b(_,k){k&&_.then(function(x){k(null,x)},function(x){k(x)})}function g(_,k,x){typeof k=="function"&&_.then(k),typeof x=="function"&&_.catch(x)}function S(_){return typeof _!="string"&&(console.warn(_+" used as a key, but it is not a string."),_=String(_)),_}function T(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var d="local-forage-detect-blob-support",p=void 0,y={},D=Object.prototype.toString,I="readonly",w="readwrite";function A(_){for(var k=_.length,x=new ArrayBuffer(k),L=new Uint8Array(x),F=0;F<k;F++)L[F]=_.charCodeAt(F);return x}function C(_){return new c(function(k){var x=_.transaction(d,w),L=f([""]);x.objectStore(d).put(L,"key"),x.onabort=function(F){F.preventDefault(),F.stopPropagation(),k(!1)},x.oncomplete=function(){var F=navigator.userAgent.match(/Chrome\/(\d+)/),B=navigator.userAgent.match(/Edge\//);k(B||!F||parseInt(F[1],10)>=43)}}).catch(function(){return!1})}function R(_){return typeof p=="boolean"?c.resolve(p):C(_).then(function(k){return p=k,p})}function z(_){var k=y[_.name],x={};x.promise=new c(function(L,F){x.resolve=L,x.reject=F}),k.deferredOperations.push(x),k.dbReady?k.dbReady=k.dbReady.then(function(){return x.promise}):k.dbReady=x.promise}function P(_){var k=y[_.name],x=k.deferredOperations.pop();if(x)return x.resolve(),x.promise}function H(_,k){var x=y[_.name],L=x.deferredOperations.pop();if(L)return L.reject(k),L.promise}function V(_,k){return new c(function(x,L){if(y[_.name]=y[_.name]||le(),_.db)if(k)z(_),_.db.close();else return x(_.db);var F=[_.name];k&&F.push(_.version);var B=u.open.apply(u,F);k&&(B.onupgradeneeded=function(j){var Y=B.result;try{Y.createObjectStore(_.storeName),j.oldVersion<=1&&Y.createObjectStore(d)}catch($){if($.name==="ConstraintError")console.warn('The database "'+_.name+'" has been upgraded from version '+j.oldVersion+" to version "+j.newVersion+', but the storage "'+_.storeName+'" already exists.');else throw $}}),B.onerror=function(j){j.preventDefault(),L(B.error)},B.onsuccess=function(){var j=B.result;j.onversionchange=function(Y){Y.target.close()},x(j),P(_)}})}function te(_){return V(_,!1)}function ce(_){return V(_,!0)}function he(_,k){if(!_.db)return!0;var x=!_.db.objectStoreNames.contains(_.storeName),L=_.version<_.db.version,F=_.version>_.db.version;if(L&&(_.version!==k&&console.warn('The database "'+_.name+`" can't be downgraded from version `+_.db.version+" to version "+_.version+"."),_.version=_.db.version),F||x){if(x){var B=_.db.version+1;B>_.version&&(_.version=B)}return!0}return!1}function ue(_){return new c(function(k,x){var L=new FileReader;L.onerror=x,L.onloadend=function(F){var B=btoa(F.target.result||"");k({__local_forage_encoded_blob:!0,data:B,type:_.type})},L.readAsBinaryString(_)})}function se(_){var k=A(atob(_.data));return f([k],{type:_.type})}function ne(_){return _&&_.__local_forage_encoded_blob}function me(_){var k=this,x=k._initReady().then(function(){var L=y[k._dbInfo.name];if(L&&L.dbReady)return L.dbReady});return g(x,_,_),x}function Re(_){z(_);for(var k=y[_.name],x=k.forages,L=0;L<x.length;L++){var F=x[L];F._dbInfo.db&&(F._dbInfo.db.close(),F._dbInfo.db=null)}return _.db=null,te(_).then(function(B){return _.db=B,he(_)?ce(_):B}).then(function(B){_.db=k.db=B;for(var j=0;j<x.length;j++)x[j]._dbInfo.db=B}).catch(function(B){throw H(_,B),B})}function Ae(_,k,x,L){L===void 0&&(L=1);try{var F=_.db.transaction(_.storeName,k);x(null,F)}catch(B){if(L>0&&(!_.db||B.name==="InvalidStateError"||B.name==="NotFoundError"))return c.resolve().then(function(){if(!_.db||B.name==="NotFoundError"&&!_.db.objectStoreNames.contains(_.storeName)&&_.version<=_.db.version)return _.db&&(_.version=_.db.version+1),ce(_)}).then(function(){return Re(_).then(function(){Ae(_,k,x,L-1)})}).catch(x);x(B)}}function le(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Se(_){var k=this,x={db:null};if(_)for(var L in _)x[L]=_[L];var F=y[x.name];F||(F=le(),y[x.name]=F),F.forages.push(k),k._initReady||(k._initReady=k.ready,k.ready=me);var B=[];function j(){return c.resolve()}for(var Y=0;Y<F.forages.length;Y++){var $=F.forages[Y];$!==k&&B.push($._initReady().catch(j))}var K=F.forages.slice(0);return c.all(B).then(function(){return x.db=F.db,te(x)}).then(function(J){return x.db=J,he(x,k._defaultConfig.version)?ce(x):J}).then(function(J){x.db=F.db=J,k._dbInfo=x;for(var oe=0;oe<K.length;oe++){var pe=K[oe];pe!==k&&(pe._dbInfo.db=x.db,pe._dbInfo.version=x.version)}})}function _e(_,k){var x=this;_=S(_);var L=new c(function(F,B){x.ready().then(function(){Ae(x._dbInfo,I,function(j,Y){if(j)return B(j);try{var $=Y.objectStore(x._dbInfo.storeName),K=$.get(_);K.onsuccess=function(){var J=K.result;J===void 0&&(J=null),ne(J)&&(J=se(J)),F(J)},K.onerror=function(){B(K.error)}}catch(J){B(J)}})}).catch(B)});return b(L,k),L}function Xe(_,k){var x=this,L=new c(function(F,B){x.ready().then(function(){Ae(x._dbInfo,I,function(j,Y){if(j)return B(j);try{var $=Y.objectStore(x._dbInfo.storeName),K=$.openCursor(),J=1;K.onsuccess=function(){var oe=K.result;if(oe){var pe=oe.value;ne(pe)&&(pe=se(pe));var Ce=_(pe,oe.key,J++);Ce!==void 0?F(Ce):oe.continue()}else F()},K.onerror=function(){B(K.error)}}catch(oe){B(oe)}})}).catch(B)});return b(L,k),L}function je(_,k,x){var L=this;_=S(_);var F=new c(function(B,j){var Y;L.ready().then(function(){return Y=L._dbInfo,D.call(k)==="[object Blob]"?R(Y.db).then(function($){return $?k:ue(k)}):k}).then(function($){Ae(L._dbInfo,w,function(K,J){if(K)return j(K);try{var oe=J.objectStore(L._dbInfo.storeName);$===null&&($=void 0);var pe=oe.put($,_);J.oncomplete=function(){$===void 0&&($=null),B($)},J.onabort=J.onerror=function(){var Ce=pe.error?pe.error:pe.transaction.error;j(Ce)}}catch(Ce){j(Ce)}})}).catch(j)});return b(F,x),F}function Le(_,k){var x=this;_=S(_);var L=new c(function(F,B){x.ready().then(function(){Ae(x._dbInfo,w,function(j,Y){if(j)return B(j);try{var $=Y.objectStore(x._dbInfo.storeName),K=$.delete(_);Y.oncomplete=function(){F()},Y.onerror=function(){B(K.error)},Y.onabort=function(){var J=K.error?K.error:K.transaction.error;B(J)}}catch(J){B(J)}})}).catch(B)});return b(L,k),L}function ve(_){var k=this,x=new c(function(L,F){k.ready().then(function(){Ae(k._dbInfo,w,function(B,j){if(B)return F(B);try{var Y=j.objectStore(k._dbInfo.storeName),$=Y.clear();j.oncomplete=function(){L()},j.onabort=j.onerror=function(){var K=$.error?$.error:$.transaction.error;F(K)}}catch(K){F(K)}})}).catch(F)});return b(x,_),x}function Ve(_){var k=this,x=new c(function(L,F){k.ready().then(function(){Ae(k._dbInfo,I,function(B,j){if(B)return F(B);try{var Y=j.objectStore(k._dbInfo.storeName),$=Y.count();$.onsuccess=function(){L($.result)},$.onerror=function(){F($.error)}}catch(K){F(K)}})}).catch(F)});return b(x,_),x}function Fe(_,k){var x=this,L=new c(function(F,B){if(_<0){F(null);return}x.ready().then(function(){Ae(x._dbInfo,I,function(j,Y){if(j)return B(j);try{var $=Y.objectStore(x._dbInfo.storeName),K=!1,J=$.openKeyCursor();J.onsuccess=function(){var oe=J.result;if(!oe){F(null);return}_===0||K?F(oe.key):(K=!0,oe.advance(_))},J.onerror=function(){B(J.error)}}catch(oe){B(oe)}})}).catch(B)});return b(L,k),L}function De(_){var k=this,x=new c(function(L,F){k.ready().then(function(){Ae(k._dbInfo,I,function(B,j){if(B)return F(B);try{var Y=j.objectStore(k._dbInfo.storeName),$=Y.openKeyCursor(),K=[];$.onsuccess=function(){var J=$.result;if(!J){L(K);return}K.push(J.key),J.continue()},$.onerror=function(){F($.error)}}catch(J){F(J)}})}).catch(F)});return b(x,_),x}function Oe(_,k){k=T.apply(this,arguments);var x=this.config();_=typeof _!="function"&&_||{},_.name||(_.name=_.name||x.name,_.storeName=_.storeName||x.storeName);var L=this,F;if(!_.name)F=c.reject("Invalid arguments");else{var B=_.name===x.name&&L._dbInfo.db,j=B?c.resolve(L._dbInfo.db):te(_).then(function(Y){var $=y[_.name],K=$.forages;$.db=Y;for(var J=0;J<K.length;J++)K[J]._dbInfo.db=Y;return Y});_.storeName?F=j.then(function(Y){if(Y.objectStoreNames.contains(_.storeName)){var $=Y.version+1;z(_);var K=y[_.name],J=K.forages;Y.close();for(var oe=0;oe<J.length;oe++){var pe=J[oe];pe._dbInfo.db=null,pe._dbInfo.version=$}var Ce=new c(function(Te,He){var qe=u.open(_.name,$);qe.onerror=function(pt){var pi=qe.result;pi.close(),He(pt)},qe.onupgradeneeded=function(){var pt=qe.result;pt.deleteObjectStore(_.storeName)},qe.onsuccess=function(){var pt=qe.result;pt.close(),Te(pt)}});return Ce.then(function(Te){K.db=Te;for(var He=0;He<J.length;He++){var qe=J[He];qe._dbInfo.db=Te,P(qe._dbInfo)}}).catch(function(Te){throw(H(_,Te)||c.resolve()).catch(function(){}),Te})}}):F=j.then(function(Y){z(_);var $=y[_.name],K=$.forages;Y.close();for(var J=0;J<K.length;J++){var oe=K[J];oe._dbInfo.db=null}var pe=new c(function(Ce,Te){var He=u.deleteDatabase(_.name);He.onerror=function(){var qe=He.result;qe&&qe.close(),Te(He.error)},He.onblocked=function(){console.warn('dropInstance blocked for database "'+_.name+'" until all open connections are closed')},He.onsuccess=function(){var qe=He.result;qe&&qe.close(),Ce(qe)}});return pe.then(function(Ce){$.db=Ce;for(var Te=0;Te<K.length;Te++){var He=K[Te];P(He._dbInfo)}}).catch(function(Ce){throw(H(_,Ce)||c.resolve()).catch(function(){}),Ce})})}return b(F,k),F}var Ee={_driver:"asyncStorage",_initStorage:Se,_support:h(),iterate:Xe,getItem:_e,setItem:je,removeItem:Le,clear:ve,length:Ve,key:Fe,keys:De,dropInstance:Oe};function $e(){return typeof openDatabase=="function"}var Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",at="~~local_forage_type~",xe=/^~~local_forage_type~([^~]+)~/,Ze="__lfsc__:",mt=Ze.length,tt="arbf",Qe="blob",Ie="si08",de="ui08",nt="uic8",It="si16",yt="si32",st="ur16",Ot="ui32",bt="fl32",ot="fl64",Bt=mt+tt.length,wt=Object.prototype.toString;function Ge(_){var k=_.length*.75,x=_.length,L,F=0,B,j,Y,$;_[_.length-1]==="="&&(k--,_[_.length-2]==="="&&k--);var K=new ArrayBuffer(k),J=new Uint8Array(K);for(L=0;L<x;L+=4)B=Me.indexOf(_[L]),j=Me.indexOf(_[L+1]),Y=Me.indexOf(_[L+2]),$=Me.indexOf(_[L+3]),J[F++]=B<<2|j>>4,J[F++]=(j&15)<<4|Y>>2,J[F++]=(Y&3)<<6|$&63;return K}function ut(_){var k=new Uint8Array(_),x="",L;for(L=0;L<k.length;L+=3)x+=Me[k[L]>>2],x+=Me[(k[L]&3)<<4|k[L+1]>>4],x+=Me[(k[L+1]&15)<<2|k[L+2]>>6],x+=Me[k[L+2]&63];return k.length%3===2?x=x.substring(0,x.length-1)+"=":k.length%3===1&&(x=x.substring(0,x.length-2)+"=="),x}function qt(_,k){var x="";if(_&&(x=wt.call(_)),_&&(x==="[object ArrayBuffer]"||_.buffer&&wt.call(_.buffer)==="[object ArrayBuffer]")){var L,F=Ze;_ instanceof ArrayBuffer?(L=_,F+=tt):(L=_.buffer,x==="[object Int8Array]"?F+=Ie:x==="[object Uint8Array]"?F+=de:x==="[object Uint8ClampedArray]"?F+=nt:x==="[object Int16Array]"?F+=It:x==="[object Uint16Array]"?F+=st:x==="[object Int32Array]"?F+=yt:x==="[object Uint32Array]"?F+=Ot:x==="[object Float32Array]"?F+=bt:x==="[object Float64Array]"?F+=ot:k(new Error("Failed to get type for BinaryArray"))),k(F+ut(L))}else if(x==="[object Blob]"){var B=new FileReader;B.onload=function(){var j=at+_.type+"~"+ut(this.result);k(Ze+Qe+j)},B.readAsArrayBuffer(_)}else try{k(JSON.stringify(_))}catch(j){console.error("Couldn't convert value into a JSON string: ",_),k(null,j)}}function E(_){if(_.substring(0,mt)!==Ze)return JSON.parse(_);var k=_.substring(Bt),x=_.substring(mt,Bt),L;if(x===Qe&&xe.test(k)){var F=k.match(xe);L=F[1],k=k.substring(F[0].length)}var B=Ge(k);switch(x){case tt:return B;case Qe:return f([B],{type:L});case Ie:return new Int8Array(B);case de:return new Uint8Array(B);case nt:return new Uint8ClampedArray(B);case It:return new Int16Array(B);case st:return new Uint16Array(B);case yt:return new Int32Array(B);case Ot:return new Uint32Array(B);case bt:return new Float32Array(B);case ot:return new Float64Array(B);default:throw new Error("Unkown type: "+x)}}var Z={serialize:qt,deserialize:E,stringToBuffer:Ge,bufferToString:ut};function X(_,k,x,L){_.executeSql("CREATE TABLE IF NOT EXISTS "+k.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],x,L)}function re(_){var k=this,x={db:null};if(_)for(var L in _)x[L]=typeof _[L]!="string"?_[L].toString():_[L];var F=new c(function(B,j){try{x.db=openDatabase(x.name,String(x.version),x.description,x.size)}catch(Y){return j(Y)}x.db.transaction(function(Y){X(Y,x,function(){k._dbInfo=x,B()},function($,K){j(K)})},j)});return x.serializer=Z,F}function O(_,k,x,L,F,B){_.executeSql(x,L,F,function(j,Y){Y.code===Y.SYNTAX_ERR?j.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[k.storeName],function($,K){K.rows.length?B($,Y):X($,k,function(){$.executeSql(x,L,F,B)},B)},B):B(j,Y)},B)}function W(_,k){var x=this;_=S(_);var L=new c(function(F,B){x.ready().then(function(){var j=x._dbInfo;j.db.transaction(function(Y){O(Y,j,"SELECT * FROM "+j.storeName+" WHERE key = ? LIMIT 1",[_],function($,K){var J=K.rows.length?K.rows.item(0).value:null;J&&(J=j.serializer.deserialize(J)),F(J)},function($,K){B(K)})})}).catch(B)});return b(L,k),L}function v(_,k){var x=this,L=new c(function(F,B){x.ready().then(function(){var j=x._dbInfo;j.db.transaction(function(Y){O(Y,j,"SELECT * FROM "+j.storeName,[],function($,K){for(var J=K.rows,oe=J.length,pe=0;pe<oe;pe++){var Ce=J.item(pe),Te=Ce.value;if(Te&&(Te=j.serializer.deserialize(Te)),Te=_(Te,Ce.key,pe+1),Te!==void 0){F(Te);return}}F()},function($,K){B(K)})})}).catch(B)});return b(L,k),L}function G(_,k,x,L){var F=this;_=S(_);var B=new c(function(j,Y){F.ready().then(function(){k===void 0&&(k=null);var $=k,K=F._dbInfo;K.serializer.serialize(k,function(J,oe){oe?Y(oe):K.db.transaction(function(pe){O(pe,K,"INSERT OR REPLACE INTO "+K.storeName+" (key, value) VALUES (?, ?)",[_,J],function(){j($)},function(Ce,Te){Y(Te)})},function(pe){if(pe.code===pe.QUOTA_ERR){if(L>0){j(G.apply(F,[_,$,x,L-1]));return}Y(pe)}})})}).catch(Y)});return b(B,x),B}function fe(_,k,x){return G.apply(this,[_,k,x,1])}function l(_,k){var x=this;_=S(_);var L=new c(function(F,B){x.ready().then(function(){var j=x._dbInfo;j.db.transaction(function(Y){O(Y,j,"DELETE FROM "+j.storeName+" WHERE key = ?",[_],function(){F()},function($,K){B(K)})})}).catch(B)});return b(L,k),L}function U(_){var k=this,x=new c(function(L,F){k.ready().then(function(){var B=k._dbInfo;B.db.transaction(function(j){O(j,B,"DELETE FROM "+B.storeName,[],function(){L()},function(Y,$){F($)})})}).catch(F)});return b(x,_),x}function q(_){var k=this,x=new c(function(L,F){k.ready().then(function(){var B=k._dbInfo;B.db.transaction(function(j){O(j,B,"SELECT COUNT(key) as c FROM "+B.storeName,[],function(Y,$){var K=$.rows.item(0).c;L(K)},function(Y,$){F($)})})}).catch(F)});return b(x,_),x}function m(_,k){var x=this,L=new c(function(F,B){x.ready().then(function(){var j=x._dbInfo;j.db.transaction(function(Y){O(Y,j,"SELECT key FROM "+j.storeName+" WHERE id = ? LIMIT 1",[_+1],function($,K){var J=K.rows.length?K.rows.item(0).key:null;F(J)},function($,K){B(K)})})}).catch(B)});return b(L,k),L}function N(_){var k=this,x=new c(function(L,F){k.ready().then(function(){var B=k._dbInfo;B.db.transaction(function(j){O(j,B,"SELECT key FROM "+B.storeName,[],function(Y,$){for(var K=[],J=0;J<$.rows.length;J++)K.push($.rows.item(J).key);L(K)},function(Y,$){F($)})})}).catch(F)});return b(x,_),x}function M(_){return new c(function(k,x){_.transaction(function(L){L.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(F,B){for(var j=[],Y=0;Y<B.rows.length;Y++)j.push(B.rows.item(Y).name);k({db:_,storeNames:j})},function(F,B){x(B)})},function(L){x(L)})})}function ae(_,k){k=T.apply(this,arguments);var x=this.config();_=typeof _!="function"&&_||{},_.name||(_.name=_.name||x.name,_.storeName=_.storeName||x.storeName);var L=this,F;return _.name?F=new c(function(B){var j;_.name===x.name?j=L._dbInfo.db:j=openDatabase(_.name,"","",0),_.storeName?B({db:j,storeNames:[_.storeName]}):B(M(j))}).then(function(B){return new c(function(j,Y){B.db.transaction(function($){function K(Ce){return new c(function(Te,He){$.executeSql("DROP TABLE IF EXISTS "+Ce,[],function(){Te()},function(qe,pt){He(pt)})})}for(var J=[],oe=0,pe=B.storeNames.length;oe<pe;oe++)J.push(K(B.storeNames[oe]));c.all(J).then(function(){j()}).catch(function(Ce){Y(Ce)})},function($){Y($)})})}):F=c.reject("Invalid arguments"),b(F,k),F}var ee={_driver:"webSQLStorage",_initStorage:re,_support:$e(),iterate:v,getItem:W,setItem:fe,removeItem:l,clear:U,length:q,key:m,keys:N,dropInstance:ae};function ie(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function ge(_,k){var x=_.name+"/";return _.storeName!==k.storeName&&(x+=_.storeName+"/"),x}function _t(){var _="_localforage_support_test";try{return localStorage.setItem(_,!0),localStorage.removeItem(_),!1}catch{return!0}}function Be(){return!_t()||localStorage.length>0}function ye(_){var k=this,x={};if(_)for(var L in _)x[L]=_[L];return x.keyPrefix=ge(_,k._defaultConfig),Be()?(k._dbInfo=x,x.serializer=Z,c.resolve()):c.reject()}function Ue(_){var k=this,x=k.ready().then(function(){for(var L=k._dbInfo.keyPrefix,F=localStorage.length-1;F>=0;F--){var B=localStorage.key(F);B.indexOf(L)===0&&localStorage.removeItem(B)}});return b(x,_),x}function Ke(_,k){var x=this;_=S(_);var L=x.ready().then(function(){var F=x._dbInfo,B=localStorage.getItem(F.keyPrefix+_);return B&&(B=F.serializer.deserialize(B)),B});return b(L,k),L}function it(_,k){var x=this,L=x.ready().then(function(){for(var F=x._dbInfo,B=F.keyPrefix,j=B.length,Y=localStorage.length,$=1,K=0;K<Y;K++){var J=localStorage.key(K);if(J.indexOf(B)===0){var oe=localStorage.getItem(J);if(oe&&(oe=F.serializer.deserialize(oe)),oe=_(oe,J.substring(j),$++),oe!==void 0)return oe}}});return b(L,k),L}function Xt(_,k){var x=this,L=x.ready().then(function(){var F=x._dbInfo,B;try{B=localStorage.key(_)}catch{B=null}return B&&(B=B.substring(F.keyPrefix.length)),B});return b(L,k),L}function $t(_){var k=this,x=k.ready().then(function(){for(var L=k._dbInfo,F=localStorage.length,B=[],j=0;j<F;j++){var Y=localStorage.key(j);Y.indexOf(L.keyPrefix)===0&&B.push(Y.substring(L.keyPrefix.length))}return B});return b(x,_),x}function Pe(_){var k=this,x=k.keys().then(function(L){return L.length});return b(x,_),x}function lt(_,k){var x=this;_=S(_);var L=x.ready().then(function(){var F=x._dbInfo;localStorage.removeItem(F.keyPrefix+_)});return b(L,k),L}function Ye(_,k,x){var L=this;_=S(_);var F=L.ready().then(function(){k===void 0&&(k=null);var B=k;return new c(function(j,Y){var $=L._dbInfo;$.serializer.serialize(k,function(K,J){if(J)Y(J);else try{localStorage.setItem($.keyPrefix+_,K),j(B)}catch(oe){(oe.name==="QuotaExceededError"||oe.name==="NS_ERROR_DOM_QUOTA_REACHED")&&Y(oe),Y(oe)}})})});return b(F,x),F}function Et(_,k){if(k=T.apply(this,arguments),_=typeof _!="function"&&_||{},!_.name){var x=this.config();_.name=_.name||x.name,_.storeName=_.storeName||x.storeName}var L=this,F;return _.name?F=new c(function(B){_.storeName?B(ge(_,L._defaultConfig)):B(_.name+"/")}).then(function(B){for(var j=localStorage.length-1;j>=0;j--){var Y=localStorage.key(j);Y.indexOf(B)===0&&localStorage.removeItem(Y)}}):F=c.reject("Invalid arguments"),b(F,k),F}var dt={_driver:"localStorageWrapper",_initStorage:ye,_support:ie(),iterate:it,getItem:Ke,setItem:Ye,removeItem:lt,clear:Ue,length:Pe,key:Xt,keys:$t,dropInstance:Et},Oi=function(k,x){return k===x||typeof k=="number"&&typeof x=="number"&&isNaN(k)&&isNaN(x)},$s=function(k,x){for(var L=k.length,F=0;F<L;){if(Oi(k[F],x))return!0;F++}return!1},en=Array.isArray||function(_){return Object.prototype.toString.call(_)==="[object Array]"},di={},tn={},Kt={INDEXEDDB:Ee,WEBSQL:ee,LOCALSTORAGE:dt},Ks=[Kt.INDEXEDDB._driver,Kt.WEBSQL._driver,Kt.LOCALSTORAGE._driver],Bi=["dropInstance"],or=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Bi),Js={description:"",driver:Ks.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Qs(_,k){_[k]=function(){var x=arguments;return _.ready().then(function(){return _[k].apply(_,x)})}}function ur(){for(var _=1;_<arguments.length;_++){var k=arguments[_];if(k)for(var x in k)k.hasOwnProperty(x)&&(en(k[x])?arguments[0][x]=k[x].slice():arguments[0][x]=k[x])}return arguments[0]}var ea=function(){function _(k){a(this,_);for(var x in Kt)if(Kt.hasOwnProperty(x)){var L=Kt[x],F=L._driver;this[x]=F,di[F]||this.defineDriver(L)}this._defaultConfig=ur({},Js),this._config=ur({},this._defaultConfig,k),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return _.prototype.config=function(x){if((typeof x>"u"?"undefined":s(x))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var L in x){if(L==="storeName"&&(x[L]=x[L].replace(/\W/g,"_")),L==="version"&&typeof x[L]!="number")return new Error("Database version must be a number.");this._config[L]=x[L]}return"driver"in x&&x.driver?this.setDriver(this._config.driver):!0}else return typeof x=="string"?this._config[x]:this._config},_.prototype.defineDriver=function(x,L,F){var B=new c(function(j,Y){try{var $=x._driver,K=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!x._driver){Y(K);return}for(var J=or.concat("_initStorage"),oe=0,pe=J.length;oe<pe;oe++){var Ce=J[oe],Te=!$s(Bi,Ce);if((Te||x[Ce])&&typeof x[Ce]!="function"){Y(K);return}}var He=function(){for(var pi=function(ra){return function(){var na=new Error("Method "+ra+" is not implemented by the current driver"),rn=c.reject(na);return b(rn,arguments[arguments.length-1]),rn}},lr=0,ia=Bi.length;lr<ia;lr++){var hr=Bi[lr];x[hr]||(x[hr]=pi(hr))}};He();var qe=function(pi){di[$]&&console.info("Redefining LocalForage driver: "+$),di[$]=x,tn[$]=pi,j()};"_support"in x?x._support&&typeof x._support=="function"?x._support().then(qe,Y):qe(!!x._support):qe(!0)}catch(pt){Y(pt)}});return g(B,L,F),B},_.prototype.driver=function(){return this._driver||null},_.prototype.getDriver=function(x,L,F){var B=di[x]?c.resolve(di[x]):c.reject(new Error("Driver not found."));return g(B,L,F),B},_.prototype.getSerializer=function(x){var L=c.resolve(Z);return g(L,x),L},_.prototype.ready=function(x){var L=this,F=L._driverSet.then(function(){return L._ready===null&&(L._ready=L._initDriver()),L._ready});return g(F,x,x),F},_.prototype.setDriver=function(x,L,F){var B=this;en(x)||(x=[x]);var j=this._getSupportedDrivers(x);function Y(){B._config.driver=B.driver()}function $(oe){return B._extend(oe),Y(),B._ready=B._initStorage(B._config),B._ready}function K(oe){return function(){var pe=0;function Ce(){for(;pe<oe.length;){var Te=oe[pe];return pe++,B._dbInfo=null,B._ready=null,B.getDriver(Te).then($).catch(Ce)}Y();var He=new Error("No available storage method found.");return B._driverSet=c.reject(He),B._driverSet}return Ce()}}var J=this._driverSet!==null?this._driverSet.catch(function(){return c.resolve()}):c.resolve();return this._driverSet=J.then(function(){var oe=j[0];return B._dbInfo=null,B._ready=null,B.getDriver(oe).then(function(pe){B._driver=pe._driver,Y(),B._wrapLibraryMethodsWithReady(),B._initDriver=K(j)})}).catch(function(){Y();var oe=new Error("No available storage method found.");return B._driverSet=c.reject(oe),B._driverSet}),g(this._driverSet,L,F),this._driverSet},_.prototype.supports=function(x){return!!tn[x]},_.prototype._extend=function(x){ur(this,x)},_.prototype._getSupportedDrivers=function(x){for(var L=[],F=0,B=x.length;F<B;F++){var j=x[F];this.supports(j)&&L.push(j)}return L},_.prototype._wrapLibraryMethodsWithReady=function(){for(var x=0,L=or.length;x<L;x++)Qs(this,or[x])},_.prototype.createInstance=function(x){return new _(x)},_}(),ta=new ea;i.exports=ta},{3:3}]},{},[4])(4)})})(Zs);var nl=Zs.exports;const Ln=ci(nl);class Gs{constructor(e,t,i){this.urlCache={},this.storage=void 0,this.name=e,this.requester=t||Di,this.resolver=i,this.online=!0,this.checkRequirements(),this.addListeners()}checkRequirements(){try{let e;typeof Ln>"u"&&(e=Ln),this.storage=e.createInstance({name:this.name})}catch{throw new Error("localForage lib not loaded")}}addListeners(){this._status=this.status.bind(this),window.addEventListener("online",this._status),window.addEventListener("offline",this._status)}removeListeners(){window.removeEventListener("online",this._status),window.removeEventListener("offline",this._status),this._status=void 0}status(e){let t=navigator.onLine;this.online=t,t?this.emit("online",this):this.emit("offline",this)}add(e,t){let i=e.resources.map(r=>{let{href:s}=r,a=this.resolver(s),o=window.encodeURIComponent(a);return this.storage.getItem(o).then(u=>!u||t?this.requester(a,"binary").then(h=>this.storage.setItem(o,h)):u)});return Promise.all(i)}put(e,t,i){let r=window.encodeURIComponent(e);return this.storage.getItem(r).then(s=>s||this.requester(e,"binary",t,i).then(a=>this.storage.setItem(r,a)))}request(e,t,i,r){return this.online?this.requester(e,t,i,r).then(s=>(this.put(e),s)):this.retrieve(e,t)}retrieve(e,t){new be;var i,r=new Ut(e);return t||(t=r.extension),t=="blob"?i=this.getBlob(e):i=this.getText(e),i.then(s=>{var a=new be,o;return s?(o=this.handleResponse(s,t),a.resolve(o)):a.reject({message:"File not found in storage: "+e,stack:new Error().stack}),a.promise})}handleResponse(e,t){var i;return t=="json"?i=JSON.parse(e):Ai(t)?i=Nt(e,"text/xml"):t=="xhtml"?i=Nt(e,"application/xhtml+xml"):t=="html"||t=="htm"?i=Nt(e,"text/html"):i=e,i}getBlob(e,t){let i=window.encodeURIComponent(e);return this.storage.getItem(i).then(function(r){if(r)return t=t||oi.lookup(e),new Blob([r],{type:t})})}getText(e,t){let i=window.encodeURIComponent(e);return t=t||oi.lookup(e),this.storage.getItem(i).then(function(r){var s=new be,a=new FileReader,o;if(r)return o=new Blob([r],{type:t}),a.addEventListener("loadend",()=>{s.resolve(a.result)}),a.readAsText(o,t),s.promise})}getBase64(e,t){let i=window.encodeURIComponent(e);return t=t||oi.lookup(e),this.storage.getItem(i).then(r=>{var s=new be,a=new FileReader,o;if(r)return o=new Blob([r],{type:t}),a.addEventListener("loadend",()=>{s.resolve(a.result)}),a.readAsDataURL(o,t),s.promise})}createUrl(e,t){var i=new be,r=window.URL||window.webkitURL||window.mozURL,s,a,o=t&&t.base64;return e in this.urlCache?(i.resolve(this.urlCache[e]),i.promise):(o?(a=this.getBase64(e),a&&a.then(function(u){this.urlCache[e]=u,i.resolve(u)}.bind(this))):(a=this.getBlob(e),a&&a.then(function(u){s=r.createObjectURL(u),this.urlCache[e]=s,i.resolve(s)}.bind(this))),a||i.reject({message:"File not found in storage: "+e,stack:new Error().stack}),i.promise)}revokeUrl(e){var t=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[e];i&&t.revokeObjectURL(i)}destroy(){var e=window.URL||window.webkitURL||window.mozURL;for(let t in this.urlCache)e.revokeObjectURL(t);this.urlCache={},this.removeListeners()}}Rt(Gs.prototype);class Er{constructor(e){this.interactive="",this.fixedLayout="",this.openToSpread="",this.orientationLock="",e&&this.parse(e)}parse(e){if(!e)return this;const t=Ne(e,"display_options");return t?(Mt(t,"option").forEach(r=>{let s="";switch(r.childNodes.length&&(s=r.childNodes[0].nodeValue),r.attributes.name.value){case"interactive":this.interactive=s;break;case"fixed-layout":this.fixedLayout=s;break;case"open-to-spread":this.openToSpread=s;break;case"orientation-lock":this.orientationLock=s;break}}),this):this}destroy(){this.interactive=void 0,this.fixedLayout=void 0,this.openToSpread=void 0,this.orientationLock=void 0}}const Fn="META-INF/container.xml",sl="META-INF/com.apple.ibooks.display-options.xml",xt={BINARY:"binary",BASE64:"base64",EPUB:"epub",OPF:"opf",MANIFEST:"json",DIRECTORY:"directory"};class Qr{constructor(e,t){typeof t>"u"&&typeof e!="string"&&!(e instanceof Blob)&&!(e instanceof ArrayBuffer)&&(t=e,e=void 0),this.settings=et(this.settings||{},{requestMethod:void 0,requestCredentials:void 0,requestHeaders:void 0,encoding:void 0,replacements:void 0,canonical:void 0,openAs:void 0,store:void 0}),et(this.settings,t),this.opening=new be,this.opened=this.opening.promise,this.isOpen=!1,this.loading={manifest:new be,spine:new be,metadata:new be,cover:new be,navigation:new be,pageList:new be,resources:new be,displayOptions:new be},this.loaded={manifest:this.loading.manifest.promise,spine:this.loading.spine.promise,metadata:this.loading.metadata.promise,cover:this.loading.cover.promise,navigation:this.loading.navigation.promise,pageList:this.loading.pageList.promise,resources:this.loading.resources.promise,displayOptions:this.loading.displayOptions.promise},this.ready=Promise.all([this.loaded.manifest,this.loaded.spine,this.loaded.metadata,this.loaded.cover,this.loaded.navigation,this.loaded.resources,this.loaded.displayOptions]),this.isRendered=!1,this.request=this.settings.requestMethod||Di,this.spine=new Ao,this.locations=new ks(this.spine,this.load.bind(this)),this.navigation=void 0,this.pageList=void 0,this.url=void 0,this.path=void 0,this.archived=!1,this.archive=void 0,this.storage=void 0,this.resources=void 0,this.rendition=void 0,this.container=void 0,this.packaging=void 0,this.displayOptions=void 0,this.settings.store&&this.store(this.settings.store),e&&this.open(e,this.settings.openAs).catch(i=>{var r=new Error("Cannot load book at "+e);this.emit(Q.BOOK.OPEN_FAILED,r)})}open(e,t){var i,r=t||this.determineType(e);return r===xt.BINARY?(this.archived=!0,this.url=new At("/",""),i=this.openEpub(e)):r===xt.BASE64?(this.archived=!0,this.url=new At("/",""),i=this.openEpub(e,r)):r===xt.EPUB?(this.archived=!0,this.url=new At("/",""),i=this.request(e,"binary",this.settings.requestCredentials,this.settings.requestHeaders).then(this.openEpub.bind(this))):r==xt.OPF?(this.url=new At(e),i=this.openPackaging(this.url.Path.toString())):r==xt.MANIFEST?(this.url=new At(e),i=this.openManifest(this.url.Path.toString())):(this.url=new At(e),i=this.openContainer(Fn).then(this.openPackaging.bind(this))),i}openEpub(e,t){return this.unarchive(e,t||this.settings.encoding).then(()=>this.openContainer(Fn)).then(i=>this.openPackaging(i))}openContainer(e){return this.load(e).then(t=>(this.container=new Do(t),this.resolve(this.container.packagePath)))}openPackaging(e){return this.path=new Ut(e),this.load(e).then(t=>(this.packaging=new Sn(t),this.unpack(this.packaging)))}openManifest(e){return this.path=new Ut(e),this.load(e).then(t=>(this.packaging=new Sn,this.packaging.load(t),this.unpack(this.packaging)))}load(e){var t=this.resolve(e);return this.archived?this.archive.request(t):this.request(t,null,this.settings.requestCredentials,this.settings.requestHeaders)}resolve(e,t){if(e){var i=e,r=e.indexOf("://")>-1;return r?e:(this.path&&(i=this.path.resolve(e)),t!=!1&&this.url&&(i=this.url.resolve(i)),i)}}canonical(e){var t=e;return e?(this.settings.canonical?t=this.settings.canonical(e):t=this.resolve(e,!0),t):""}determineType(e){var t,i,r;if(this.settings.encoding==="base64")return xt.BASE64;if(typeof e!="string")return xt.BINARY;if(t=new At(e),i=t.path(),r=i.extension,r&&(r=r.replace(/\?.*$/,"")),!r)return xt.DIRECTORY;if(r==="epub")return xt.EPUB;if(r==="opf")return xt.OPF;if(r==="json")return xt.MANIFEST}unpack(e){this.package=e,this.packaging.metadata.layout===""?this.load(this.url.resolve(sl)).then(t=>{this.displayOptions=new Er(t),this.loading.displayOptions.resolve(this.displayOptions)}).catch(t=>{this.displayOptions=new Er,this.loading.displayOptions.resolve(this.displayOptions)}):(this.displayOptions=new Er,this.loading.displayOptions.resolve(this.displayOptions)),this.spine.unpack(this.packaging,this.resolve.bind(this),this.canonical.bind(this)),this.resources=new ko(this.packaging.manifest,{archive:this.archive,resolver:this.resolve.bind(this),request:this.request.bind(this),replacements:this.settings.replacements||(this.archived?"blobUrl":"base64")}),this.loadNavigation(this.packaging).then(()=>{this.loading.navigation.resolve(this.navigation)}),this.packaging.coverPath&&(this.cover=this.resolve(this.packaging.coverPath)),this.loading.manifest.resolve(this.packaging.manifest),this.loading.metadata.resolve(this.packaging.metadata),this.loading.spine.resolve(this.spine),this.loading.cover.resolve(this.cover),this.loading.resources.resolve(this.resources),this.loading.pageList.resolve(this.pageList),this.isOpen=!0,this.archived||this.settings.replacements&&this.settings.replacements!="none"?this.replacements().then(()=>{this.loaded.displayOptions.then(()=>{this.opening.resolve(this)})}).catch(t=>{console.error(t)}):this.loaded.displayOptions.then(()=>{this.opening.resolve(this)})}loadNavigation(e){let t=e.navPath||e.ncxPath,i=e.toc;return i?new Promise((r,s)=>{this.navigation=new br(i),e.pageList&&(this.pageList=new wr(e.pageList)),r(this.navigation)}):t?this.load(t,"xml").then(r=>(this.navigation=new br(r),this.pageList=new wr(r),this.navigation)):new Promise((r,s)=>{this.navigation=new br,this.pageList=new wr,r(this.navigation)})}section(e){return this.spine.get(e)}renderTo(e,t){return this.rendition=new Jr(this,t),this.rendition.attachTo(e),this.rendition}setRequestCredentials(e){this.settings.requestCredentials=e}setRequestHeaders(e){this.settings.requestHeaders=e}unarchive(e,t){return this.archive=new rl,this.archive.open(e,t)}store(e){let t=this.settings.replacements&&this.settings.replacements!=="none",i=this.url,r=this.settings.requestMethod||Di.bind(this);return this.storage=new Gs(e,r,this.resolve.bind(this)),this.request=this.storage.request.bind(this.storage),this.opened.then(()=>{this.archived&&(this.storage.requester=this.archive.request.bind(this.archive));let s=(a,o)=>{o.output=this.resources.substitute(a,o.url)};this.resources.settings.replacements=t||"blobUrl",this.resources.replacements().then(()=>this.resources.replaceCss()),this.storage.on("offline",()=>{this.url=new At("/",""),this.spine.hooks.serialize.register(s)}),this.storage.on("online",()=>{this.url=i,this.spine.hooks.serialize.deregister(s)})}),this.storage}coverUrl(){return this.loaded.cover.then(()=>this.cover?this.archived?this.archive.createUrl(this.cover):this.cover:null)}replacements(){return this.spine.hooks.serialize.register((e,t)=>{t.output=this.resources.substitute(e,t.url)}),this.resources.replacements().then(()=>this.resources.replaceCss())}getRange(e){var t=new we(e),i=this.spine.get(t.spinePos),r=this.load.bind(this);return i?i.load(r).then(function(s){var a=t.toRange(i.document);return a}):new Promise((s,a)=>{a("CFI could not be found")})}key(e){var t=e||this.packaging.metadata.identifier||this.url.filename;return`epubjs:${rr}:${t}`}destroy(){this.opened=void 0,this.loading=void 0,this.loaded=void 0,this.ready=void 0,this.isOpen=!1,this.isRendered=!1,this.spine&&this.spine.destroy(),this.locations&&this.locations.destroy(),this.pageList&&this.pageList.destroy(),this.archive&&this.archive.destroy(),this.resources&&this.resources.destroy(),this.container&&this.container.destroy(),this.packaging&&this.packaging.destroy(),this.rendition&&this.rendition.destroy(),this.displayOptions&&this.displayOptions.destroy(),this.spine=void 0,this.locations=void 0,this.pageList=void 0,this.archive=void 0,this.resources=void 0,this.container=void 0,this.packaging=void 0,this.rendition=void 0,this.navigation=void 0,this.url=void 0,this.path=void 0,this.archived=!1}}Rt(Qr.prototype);function Yt(n,e){return new Qr(n,e)}Yt.VERSION=rr;typeof global<"u"&&(global.EPUBJS_VERSION=rr);Yt.Book=Qr;Yt.Rendition=Jr;Yt.Contents=Xr;Yt.CFI=we;Yt.utils=go;const Ys="FILE_BASE64_PLACEHOLDER",al=1;let Ir=globalThis.fileBase64||Ys,ol=globalThis.pageNumber||al;function ul(){if(!document.getElementById("container"))return;const e=document.createElement("div");e.style.cssText=`
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
  `,e.innerHTML=`
    <div style="padding: 2rem; text-align: center;">
      <h2>Local Testing Mode</h2>
      <p>Select an EPUB file to render:</p>
      <input type="file" accept=".epub" id="file-input" style="margin: 1rem 0;">
    </div>
  `,document.body.appendChild(e),document.getElementById("file-input").addEventListener("change",async i=>{const r=i.target.files?.[0];if(!r)return;const s=new FileReader;s.onload=async a=>{Ir=(a.target?.result).split(",")[1],e.remove(),await Xs()},s.readAsDataURL(r)})}async function Xs(){try{const n=document.getElementById("epub-container");if(!n)throw new Error("EPUB container element not found");if(Ir===Ys)return ul(),{width:800,height:1200,pageCount:1,pageNumber:1,scale:2};const e=atob(Ir),t=new Uint8Array(e.length);for(let g=0;g<e.length;g++)t[g]=e.charCodeAt(g);const i=t.buffer,r=2,s=Yt(i);await s.ready;const a=s.spine,o=a.items?.length||a.length||1,u=Math.max(1,Math.min(ol,o)),h=s.renderTo(n,{width:960,spread:"none",flow:"scrolled-doc",allowScriptedContent:!0});if(h.themes.default({body:{margin:"0 !important",padding:"0 !important"},html:{margin:"0 !important",padding:"0 !important"}}),u>1&&a.items&&a.items[u-1]){const g=a.items[u-1];await h.display(g.href)}else await h.display();await new Promise(g=>setTimeout(g,500));const f=n.querySelector("iframe");let c=960,b=960;if(f&&f.contentDocument){const g=f.contentDocument.body,S=f.contentDocument.documentElement;if(g&&S){g.style.margin="0",g.style.padding="0",S.style.margin="0",S.style.padding="0";const T=g.querySelectorAll("*");let d=1/0,p=1/0,y=0,D=0;const I=new Set(["DIV","SPAN","SECTION","ARTICLE","MAIN","HEADER","FOOTER","NAV","ASIDE"]);T.forEach(A=>{const C=A.getBoundingClientRect(),R=A.tagName.toUpperCase(),z=I.has(R);C.width>0&&C.height>0&&!z&&(d=Math.min(d,C.left),p=Math.min(p,C.top),y=Math.max(y,C.right),D=Math.max(D,C.bottom))});const w=Math.max(g.scrollHeight,S.scrollHeight,D);if(d!==1/0){c=Math.max(Math.ceil(y-d),100),b=Math.max(Math.ceil(w-p),100);const A=d,C=p;return{width:Math.ceil(c),height:Math.ceil(b),pageCount:o,pageNumber:u,scale:r,clipX:Math.floor(A),clipY:Math.floor(C)}}}}return{width:Math.ceil(c),height:Math.ceil(b),pageCount:o,pageNumber:u,scale:r}}catch(n){throw console.error("Error rendering EPUB:",n),n}}window.renderComplete=Xs();</script>
</head>
<body>
  <div id="container">
    <div id="epub-container"></div>
  </div>
</body>
</html>
