mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-02 14:49:16 +02:00
4 lines
No EOL
101 KiB
JavaScript
4 lines
No EOL
101 KiB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(function(){try{return require("JSZip")}catch(t){}}(),require("xmldom")):"function"==typeof define&&define.amd?define(["JSZip","xmldom"],e):"object"==typeof exports?exports.ePub=e(function(){try{return require("JSZip")}catch(t){}}(),require("xmldom")):t.ePub=e(t.JSZip,t.xmldom)}(this,function(t,e){return function(t){function e(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,e,i){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var i=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=50)}([function(t,e,i){function n(t,e){var i=t.indexOf("://")>-1,n=t;if(this.Url=void 0,this.href=t,this.protocol="",this.origin="",this.fragment="",this.search="",this.base=e,i||"string"==typeof e||(this.base=window&&window.location.href),i||this.base)try{this.Url=new URL(t,this.base),this.href=this.Url.href,this.protocol=this.Url.protocol,this.origin=this.Url.origin,this.fragment=this.Url.fragment,this.search=this.Url.search,n=this.Url.pathname}catch(o){this.Url=void 0}this.Path=new s(n),this.directory=this.Path.directory,this.filename=this.Path.filename,this.extension=this.Path.extension}function s(t){var e,i;e=t.indexOf("://"),e>-1&&(t=new URL(t).pathname),i=this.parse(t),this.path=t,this.isDirectory(t)?this.directory=t:this.directory=i.dir+"/",this.filename=i.base,this.extension=i.ext.slice(1)}function o(t){return!(!t||1!=t.nodeType)}function r(){var t=(new Date).getTime(),e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:7&i|8).toString(16)});return e}function h(t){for(var e=-1,i=Object.keys(t),n=i.length,s=Array(n);++e<n;)s[e]=t[i[e]];return s}function a(t,e){var i,n=[],s=[],o=uri(t),r=uri(e),h=o.directory,a=r.directory,c=[];return"/"===h[0]&&(h=h.substring(1)),"/"===a[a.length-1]&&(h=h.substring(0,h.length-1)),"/"===a[0]&&(a=a.substring(1)),"/"===a[a.length-1]&&(a=a.substring(0,a.length-1)),h&&(c=h.split("/")),i=a.split("/"),i.reverse().forEach(function(t,e){".."===t?c.pop():t===c[c.length-1]?(c.pop(),s.unshift(t)):s.unshift(t)}),n=[o.origin],c.length&&(n=n.concat(c)),s&&(n=n.concat(s)),n=n.concat(r.filename),n.join("/")}function c(){return Math.max(document.documentElement.clientHeight,document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight)}function p(t){return!isNaN(parseFloat(t))&&isFinite(t)}function l(t){var e=["Webkit","Moz","O","ms"],i=t[0].toUpperCase()+t.slice(1),n=e.length;if("undefined"==typeof document||"undefined"!=typeof document.body.style[t])return t;for(var s=0;s<n;s++)if("undefined"!=typeof document.body.style[e[s]+i])return e[s]+i;return t}function u(t){for(var e=1,i=arguments.length;e<i;e++){var n=arguments[e];for(var s in n)void 0===t[s]&&(t[s]=n[s])}return t}function d(t){var e=[].slice.call(arguments,1);return e.forEach(function(e){e&&Object.getOwnPropertyNames(e).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}),t}function f(t,e,i){var n=g(t,e,i);return e.splice(n,0,t),n}function g(t,e,i,n,s){var o,r=n||0,h=s||e.length,a=parseInt(r+(h-r)/2);return i||(i=function(t,e){return t>e?1:t<e?-1:(t=e)?0:void 0}),h-r<=0?a:(o=i(e[a],t),h-r===1?o>0?a:a+1:0===o?a:o===-1?g(t,e,i,a,h):g(t,e,i,r,a))}function m(t,e,i,n,s){var o,r=n||0,h=s||e.length,a=parseInt(r+(h-r)/2);return i||(i=function(t,e){return t>e?1:t<e?-1:(t=e)?0:void 0}),h-r<=0?-1:(o=i(e[a],t),h-r===1?0===o?a:-1:0===o?a:o===-1?m(t,e,i,a,h):m(t,e,i,r,a))}function y(t){var e=window.getComputedStyle(t),i=["width","paddingRight","paddingLeft","marginRight","marginLeft","borderRightWidth","borderLeftWidth"],n=["height","paddingTop","paddingBottom","marginTop","marginBottom","borderTopWidth","borderBottomWidth"],s=0,o=0;return i.forEach(function(t){s+=parseFloat(e[t])||0}),n.forEach(function(t){o+=parseFloat(e[t])||0}),{height:o,width:s}}function v(t){var e=window.getComputedStyle(t),i=["paddingRight","paddingLeft","marginRight","marginLeft","borderRightWidth","borderLeftWidth"],n=["paddingTop","paddingBottom","marginTop","marginBottom","borderTopWidth","borderBottomWidth"],s=0,o=0;return i.forEach(function(t){s+=parseFloat(e[t])||0}),n.forEach(function(t){o+=parseFloat(e[t])||0}),{height:o,width:s}}function w(){var t=window.innerWidth,e=window.innerHeight;return{top:0,left:0,right:t,bottom:e,width:t,height:e}}function b(t){var e=t.match(/[^'"]+|['"]/g);return e=e.map(function(t){return"'"===t?'"\'"':'"'===t?"'\"'":"'"+t+"'"}),"concat('',"+e.join(",")+")"}function x(t){for(var e,i=t.parentNode,n=i.childNodes,s=-1,o=0;o<n.length&&(e=n[o],e.nodeType===Node.TEXT_NODE&&s++,e!=t);o++);return s}function T(t){return["xml","opf","ncx"].indexOf(t)>-1}function E(t,e){var i=new Blob([t],{type:e});return i}function S(t,e){var i,n=window.URL||window.webkitURL||window.mozURL,s=this.createBlob(t,e);return i=n.createObjectURL(s)}function _(t,e){var i,n;if("string"==typeof t)return i=btoa(t),n="data:"+e+";base64,"+i}function C(t){return Object.prototype.toString.call(t).slice(8,-1)}function N(t,e){var n;return"undefined"==typeof DOMParser&&(DOMParser=i(13).DOMParser),n=(new DOMParser).parseFromString(t,e)}function L(t,e){var i;return"undefined"!=typeof t.querySelector?t.querySelector(e):(i=t.getElementsByTagName(e),i.length?i[0]:void 0)}function k(t,e){return"undefined"!=typeof t.querySelector?t.querySelectorAll(e):t.getElementsByTagName(e)}function z(t,e,i){var n,s;if("undefined"!=typeof t.querySelector){e+="[";for(var o in i)e+=o+"='"+i[o]+"'";return e+="]",t.querySelector(e)}if(n=t.getElementsByTagName(e),s=Array.prototype.slice.call(n,0).filter(function(t){for(var e in i)if(t.getAttribute(e)===i[e])return!0;return!1}))return s[0]}function q(t,e){var i=new FileReader;i.readAsDataURL(t),i.onloadend=function(){e(i.result)}}function P(){this.resolve=null,this.reject=null,this.id=r(),this.promise=new Promise(function(t,e){this.resolve=t,this.reject=e}.bind(this)),Object.freeze(this)}function O(t,e,i){var n;if("undefined"!=typeof t.querySelector&&(n=t.querySelector(e+'[*|type="'+i+'"]')),n&&0!==n.length)return n;n=this.qsa(t,e);for(var s=0;s<n.length;s++)if(n[s].getAttributeNS("http://www.idpf.org/2007/ops","type")===i)return n[s]}var R=(i(20),i(2)),A="undefined"!=typeof window&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame);n.prototype.path=function(){return this.Path},n.prototype.resolve=function(t){var e,i=t.indexOf("://")>-1;return i?t:(e=R.resolve(this.directory,t),this.origin+e)},n.prototype.relative=function(t){return R.relative(t,this.directory)},n.prototype.toString=function(){return this.href},s.prototype.parse=function(t){return R.parse(t)},s.prototype.isAbsolute=function(t){return R.isAbsolute(t||this.path)},s.prototype.isDirectory=function(t){return"/"===t.charAt(t.length-1)},s.prototype.resolve=function(t){return R.resolve(this.directory,t)},s.prototype.relative=function(t){return R.relative(this.directory,t)},s.prototype.splitPath=function(t){return this.splitPathRe.exec(t).slice(1)},s.prototype.toString=function(){return this.path},t.exports={isElement:o,uuid:r,values:h,resolveUrl:a,indexOfSorted:m,documentHeight:c,isNumber:p,prefixed:l,defaults:u,extend:d,insert:f,locationOf:g,indexOfSorted:m,requestAnimationFrame:A,bounds:y,borders:v,windowBounds:w,cleanStringForXpath:b,indexOfTextNode:x,isXml:T,createBlob:E,createBlobUrl:S,type:C,parse:N,qs:L,qsa:k,qsp:z,blob2base64:q,createBase64Url:_,defer:P,Url:n,Path:s,querySelectorByType:O}},function(t,e,i){function n(t,e,i){var o;if(this.str="",this.base={},this.spinePos=0,this.range=!1,this.path={},this.start=null,this.end=null,!(this instanceof n))return new n(t,e,i);if("string"==typeof e?this.base=this.parseComponent(e):"object"==typeof e&&e.steps&&(this.base=e),o=this.checkType(t),"string"===o)return this.str=t,s.extend(this,this.parse(t));if("range"===o)return s.extend(this,this.fromRange(t,this.base,i));if("node"===o)return s.extend(this,this.fromNode(t,this.base,i));if("EpubCFI"===o&&t.path)return t;if(t)throw new TypeError("not a valid argument for EpubCFI");return this}var s=i(0);n.prototype.checkType=function(t){return this.isCfiString(t)?"string":"object"==typeof t&&"Range"===s.type(t)?"range":"object"==typeof t&&"undefined"!=typeof t.nodeType?"node":"object"==typeof t&&t instanceof n&&"EpubCFI"},n.prototype.parse=function(t){var e,i,n,s={spinePos:-1,range:!1,base:{},path:{},start:null,end:null};return"string"!=typeof t?{spinePos:-1}:(0===t.indexOf("epubcfi(")&&")"===t[t.length-1]&&(t=t.slice(8,t.length-1)),(e=this.getChapterComponent(t))?(s.base=this.parseComponent(e),i=this.getPathComponent(t),s.path=this.parseComponent(i),n=this.getRange(t),n&&(s.range=!0,s.start=this.parseComponent(n[0]),s.end=this.parseComponent(n[1])),s.spinePos=s.base.steps[1].index,s):{spinePos:-1})},n.prototype.parseComponent=function(t){var e,i={steps:[],terminal:{offset:null,assertion:null}},n=t.split(":"),s=n[0].split("/");return n.length>1&&(e=n[1],i.terminal=this.parseTerminal(e)),""===s[0]&&s.shift(),i.steps=s.map(function(t){return this.parseStep(t)}.bind(this)),i},n.prototype.parseStep=function(t){var e,i,n,s,o;if(s=t.match(/\[(.*)\]/),s&&s[1]&&(o=s[1]),i=parseInt(t),!isNaN(i))return i%2===0?(e="element",n=i/2-1):(e="text",n=(i-1)/2),{type:e,index:n,id:o||null}},n.prototype.parseTerminal=function(t){var e,i,n=t.match(/\[(.*)\]/);return n&&n[1]?(e=parseInt(t.split("[")[0])||null,i=n[1]):e=parseInt(t)||null,{offset:e,assertion:i}},n.prototype.getChapterComponent=function(t){var e=t.split("!");return e[0]},n.prototype.getPathComponent=function(t){var e=t.split("!");if(e[1])return ranges=e[1].split(","),ranges[0]},n.prototype.getRange=function(t){var e=t.split(",");return 3===e.length&&[e[1],e[2]]},n.prototype.getCharecterOffsetComponent=function(t){var e=t.split(":");return e[1]||""},n.prototype.joinSteps=function(t){return t?t.map(function(t){var e="";return"element"===t.type&&(e+=2*(t.index+1)),"text"===t.type&&(e+=1+2*t.index),t.id&&(e+="["+t.id+"]"),e}).join("/"):""},n.prototype.segmentString=function(t){var e="/";return e+=this.joinSteps(t.steps),t.terminal&&null!=t.terminal.offset&&(e+=":"+t.terminal.offset),t.terminal&&null!=t.terminal.assertion&&(e+="["+t.terminal.assertion+"]"),e},n.prototype.toString=function(){var t="epubcfi(";return t+=this.segmentString(this.base),t+="!",t+=this.segmentString(this.path),this.start&&(t+=",",t+=this.segmentString(this.start)),this.end&&(t+=",",t+=this.segmentString(this.end)),t+=")"},n.prototype.compare=function(t,e){if("string"==typeof t&&(t=new n(t)),"string"==typeof e&&(e=new n(e)),t.spinePos>e.spinePos)return 1;if(t.spinePos<e.spinePos)return-1;for(var i=0;i<t.path.steps.length;i++){if(!e.path.steps[i])return 1;if(t.path.steps[i].index>e.path.steps[i].index)return 1;if(t.path.steps[i].index<e.path.steps[i].index)return-1}return t.path.steps.length<e.path.steps.length?1:t.path.terminal.offset>e.path.terminal.offset?1:t.path.terminal.offset<e.path.terminal.offset?-1:0},n.prototype.step=function(t){var e=t.nodeType===Node.TEXT_NODE?"text":"element";return{id:t.id,tagName:t.tagName,type:e,index:this.position(t)}},n.prototype.filteredStep=function(t,e){var i,n=this.filter(t,e);if(n)return i=n.nodeType===Node.TEXT_NODE?"text":"element",{id:n.id,tagName:n.tagName,type:i,index:this.filteredPosition(n,e)}},n.prototype.pathTo=function(t,e,i){for(var n,s={steps:[],terminal:{offset:null,assertion:null}},o=t;o&&o.parentNode&&o.parentNode.nodeType!=Node.DOCUMENT_NODE;)n=i?this.filteredStep(o,i):this.step(o),n&&s.steps.unshift(n),o=o.parentNode;return null!=e&&e>=0&&(s.terminal.offset=e,"text"!=s.steps[s.steps.length-1].type&&s.steps.push({type:"text",index:0})),s},n.prototype.equalStep=function(t,e){return!(!t||!e)&&(t.index===e.index&&t.id===e.id&&t.type===e.type)},n.prototype.fromRange=function(t,e,i){var n={range:!1,base:{},path:{},start:null,end:null},s=t.startContainer,o=t.endContainer,r=t.startOffset,h=t.endOffset,a=!1;if(i&&(a=null!=s.ownerDocument.querySelector("."+i)),"string"==typeof e?(n.base=this.parseComponent(e),n.spinePos=n.base.steps[1].index):"object"==typeof e&&(n.base=e),t.collapsed)a&&(r=this.patchOffset(s,r,i)),n.path=this.pathTo(s,r,i);else{n.range=!0,a&&(r=this.patchOffset(s,r,i)),n.start=this.pathTo(s,r,i),a&&(h=this.patchOffset(o,h,i)),n.end=this.pathTo(o,h,i),n.path={steps:[],terminal:null};var c,p=n.start.steps.length;for(c=0;c<p&&this.equalStep(n.start.steps[c],n.end.steps[c]);c++)c==p-1?n.start.terminal===n.end.terminal&&(n.path.steps.push(n.start.steps[c]),n.range=!1):n.path.steps.push(n.start.steps[c]);n.start.steps=n.start.steps.slice(n.path.steps.length),n.end.steps=n.end.steps.slice(n.path.steps.length)}return n},n.prototype.fromNode=function(t,e,i){var n={range:!1,base:{},path:{},start:null,end:null},s=!1;return i&&(s=null!=t.ownerDocument.querySelector("."+i)),"string"==typeof e?(n.base=this.parseComponent(e),n.spinePos=n.base.steps[1].index):"object"==typeof e&&(n.base=e),n.path=this.pathTo(t,null,i),n},n.prototype.filter=function(t,e){var i,n,s,o,r=!1;return t.nodeType===Node.TEXT_NODE?(r=!0,s=t.parentNode,i=t.parentNode.classList.contains(e)):(r=!1,i=t.classList.contains(e)),i&&r?(previousSibling=s.previousSibling,o=s.nextSibling,previousSibling&&previousSibling.nodeType===Node.TEXT_NODE?n=previousSibling:o&&o.nodeType===Node.TEXT_NODE&&(n=o),n?n:t):!(i&&!r)&&t},n.prototype.patchOffset=function(t,e,i){if(t.nodeType!=Node.TEXT_NODE)return void console.error("Anchor must be a text node");var n=t,s=e;for(t.parentNode.classList.contains(i)&&(n=t.parentNode);n.previousSibling;){if(n.previousSibling.nodeType===Node.ELEMENT_NODE){if(!n.previousSibling.classList.contains(i))break;s+=n.previousSibling.textContent.length}else s+=n.previousSibling.textContent.length;n=n.previousSibling}return s},n.prototype.normalizedMap=function(t,e,i){var n,s,o,r={},h=-1,a=t.length;for(n=0;n<a;n++)s=t[n].nodeType,s===Node.ELEMENT_NODE&&t[n].classList.contains(i)&&(s=Node.TEXT_NODE),n>0&&s===Node.TEXT_NODE&&o===Node.TEXT_NODE?r[n]=h:e===s&&(h+=1,r[n]=h),o=s;return r},n.prototype.position=function(t){var e,i;return t.nodeType===Node.ELEMENT_NODE?(e=t.parentNode.children,i=Array.prototype.indexOf.call(e,t)):(e=this.textNodes(t.parentNode),i=e.indexOf(t)),i},n.prototype.filteredPosition=function(t,e){var i,n,s;return t.nodeType===Node.ELEMENT_NODE?(i=t.parentNode.children,s=this.normalizedMap(i,Node.ELEMENT_NODE,e)):(i=t.parentNode.childNodes,t.parentNode.classList.contains(e)&&(t=t.parentNode,i=t.parentNode.childNodes),s=this.normalizedMap(i,Node.TEXT_NODE,e)),n=Array.prototype.indexOf.call(i,t),s[n]},n.prototype.stepsToXpath=function(t){var e=[".","*"];return t.forEach(function(t){var i=t.index+1;t.id?e.push("*[position()="+i+" and @id='"+t.id+"']"):"text"===t.type?e.push("text()["+i+"]"):e.push("*["+i+"]")}),e.join("/")},n.prototype.stepsToQuerySelector=function(t){var e=["html"];return t.forEach(function(t){var i=t.index+1;t.id?e.push("#"+t.id):"text"===t.type||e.push("*:nth-child("+i+")")}),e.join(">")},n.prototype.textNodes=function(t,e){return Array.prototype.slice.call(t.childNodes).filter(function(t){return t.nodeType===Node.TEXT_NODE||!(!e||!t.classList.contains(e))})},n.prototype.walkToNode=function(t,e,i){var n,s,o=e||document,r=o.documentElement,h=t.length;for(s=0;s<h;s++)n=t[s],"element"===n.type?r=r.children[n.index]:"text"===n.type&&(r=this.textNodes(r,i)[n.index]);return r},n.prototype.findNode=function(t,e,i){var n,s,o=e||document;return i||"undefined"==typeof o.evaluate?n=i?this.walkToNode(t,o,i):this.walkToNode(t,o):(s=this.stepsToXpath(t),n=o.evaluate(s,o,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue),n},n.prototype.fixMiss=function(t,e,i,n){var s,o,r,h=this.findNode(t.slice(0,-1),i,n),a=h.childNodes,c=this.normalizedMap(a,Node.TEXT_NODE,n),p=t[t.length-1].index;for(var r in c){if(!c.hasOwnProperty(r))return;if(c[r]===p){if(s=a[r],o=s.textContent.length,!(e>o)){h=s.nodeType===Node.ELEMENT_NODE?s.childNodes[0]:s;break}e-=o}}return{container:h,offset:e}},n.prototype.toRange=function(t,e){var i,n,s,o,r,h,a,c=t||document,p=c.createRange(),l=this,u=!!e&&null!=c.querySelector("."+e);if(l.range?(i=l.start,r=l.path.steps.concat(i.steps),s=this.findNode(r,c,u?e:null),n=l.end,h=l.path.steps.concat(n.steps),o=this.findNode(h,c,u?e:null)):(i=l.path,r=l.path.steps,s=this.findNode(l.path.steps,c,u?e:null)),!s)return null;try{null!=i.terminal.offset?p.setStart(s,i.terminal.offset):p.setStart(s,0)}catch(d){a=this.fixMiss(r,i.terminal.offset,c,u?e:null),p.setStart(a.container,a.offset)}if(o)try{null!=n.terminal.offset?p.setEnd(o,n.terminal.offset):p.setEnd(o,0)}catch(d){a=this.fixMiss(h,l.end.terminal.offset,c,u?e:null),p.setEnd(a.container,a.offset)}return p},n.prototype.isCfiString=function(t){return"string"==typeof t&&0===t.indexOf("epubcfi(")&&")"===t[t.length-1]},n.prototype.generateChapterComponent=function(t,e,i){var n=parseInt(e),s=t+1,o="/"+s+"/";return o+=2*(n+1),i&&(o+="["+i+"]"),o},t.exports=n},function(t,e,i){"use strict";(function(e){function i(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+t)}function n(t,e){for(var i,n="",s=-1,o=0,r=0;r<=t.length;++r){if(r<t.length)i=t.charCodeAt(r);else{if(47===i)break;i=47}if(47===i){if(s===r-1||1===o);else if(s!==r-1&&2===o){if(n.length<2||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){for(var h=n.length-1,a=h;a>=0&&47!==n.charCodeAt(a);--a);if(a!==h){n=a===-1?"":n.slice(0,a),s=r,o=0;continue}}else if(2===n.length||1===n.length){n="",s=r,o=0;continue}e&&(n.length>0?n+="/..":n="..")}else n.length>0?n+="/"+t.slice(s+1,r):n=t.slice(s+1,r);s=r,o=0}else 46===i&&o!==-1?++o:o=-1}return n}function s(t,e){var i=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return i?i===e.root?i+n:i+t+n:n}var o={resolve:function(){for(var t,s="",o=!1,r=arguments.length-1;r>=-1&&!o;r--){var h;r>=0?h=arguments[r]:(void 0===t&&(t=e.cwd()),h=t),i(h),0!==h.length&&(s=h+"/"+s,o=47===h.charCodeAt(0))}return s=n(s,!o),o?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(t){if(i(t),0===t.length)return".";var e=47===t.charCodeAt(0),s=47===t.charCodeAt(t.length-1);return t=n(t,!e),0!==t.length||e||(t="."),t.length>0&&s&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return i(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e<arguments.length;++e){var n=arguments[e];i(n),n.length>0&&(void 0===t?t=n:t+="/"+n)}return void 0===t?".":o.normalize(t)},relative:function(t,e){if(i(t),i(e),t===e)return"";if(t=o.resolve(t),e=o.resolve(e),t===e)return"";for(var n=1;n<t.length&&47===t.charCodeAt(n);++n);for(var s=t.length,r=s-n,h=1;h<e.length&&47===e.charCodeAt(h);++h);for(var a=e.length,c=a-h,p=r<c?r:c,l=-1,u=0;u<=p;++u){if(u===p){if(c>p){if(47===e.charCodeAt(h+u))return e.slice(h+u+1);if(0===u)return e.slice(h+u)}else r>p&&(47===t.charCodeAt(n+u)?l=u:0===u&&(l=0));break}var d=t.charCodeAt(n+u),f=e.charCodeAt(h+u);if(d!==f)break;47===d&&(l=u)}var g="";for(u=n+l+1;u<=s;++u)u!==s&&47!==t.charCodeAt(u)||(g+=0===g.length?"..":"/..");return g.length>0?g+e.slice(h+l):(h+=l,47===e.charCodeAt(h)&&++h,e.slice(h))},_makeLong:function(t){return t},dirname:function(t){if(i(t),0===t.length)return".";for(var e=t.charCodeAt(0),n=47===e,s=-1,o=!0,r=t.length-1;r>=1;--r)if(e=t.charCodeAt(r),47===e){if(!o){s=r;break}}else o=!1;return s===-1?n?"/":".":n&&1===s?"//":t.slice(0,s)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');i(t);var n,s=0,o=-1,r=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var h=e.length-1,a=-1;for(n=t.length-1;n>=0;--n){var c=t.charCodeAt(n);if(47===c){if(!r){s=n+1;break}}else a===-1&&(r=!1,a=n+1),h>=0&&(c===e.charCodeAt(h)?--h===-1&&(o=n):(h=-1,o=a))}return s===o?o=a:o===-1&&(o=t.length),t.slice(s,o)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!r){s=n+1;break}}else o===-1&&(r=!1,o=n+1);return o===-1?"":t.slice(s,o)},extname:function(t){i(t);for(var e=-1,n=0,s=-1,o=!0,r=0,h=t.length-1;h>=0;--h){var a=t.charCodeAt(h);if(47!==a)s===-1&&(o=!1,s=h+1),46===a?e===-1?e=h:1!==r&&(r=1):e!==-1&&(r=-1);else if(!o){n=h+1;break}}return e===-1||s===-1||0===r||1===r&&e===s-1&&e===n+1?"":t.slice(e,s)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('Parameter "pathObject" must be an object, not '+typeof t);return s("/",t)},parse:function(t){i(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var n,s=t.charCodeAt(0),o=47===s;o?(e.root="/",n=1):n=0;for(var r=-1,h=0,a=-1,c=!0,p=t.length-1,l=0;p>=n;--p)if(s=t.charCodeAt(p),47!==s)a===-1&&(c=!1,a=p+1),46===s?r===-1?r=p:1!==l&&(l=1):r!==-1&&(l=-1);else if(!c){h=p+1;break}return r===-1||a===-1||0===l||1===l&&r===a-1&&r===h+1?a!==-1&&(0===h&&o?e.base=e.name=t.slice(1,a):e.base=e.name=t.slice(h,a)):(0===h&&o?(e.name=t.slice(1,r),e.base=t.slice(1,a)):(e.name=t.slice(h,r),e.base=t.slice(h,a)),e.ext=t.slice(r,a)),h>0?e.dir=t.slice(0,h-1):o&&(e.dir="/"),e},sep:"/",delimiter:":",posix:null};t.exports=o}).call(e,i(4))},function(t,e,i){"use strict";var n,s,o,r,h,a,c,p=i(21),l=i(30),u=Function.prototype.apply,d=Function.prototype.call,f=Object.create,g=Object.defineProperty,m=Object.defineProperties,y=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};n=function(t,e){var i;return l(e),y.call(this,"__ee__")?i=this.__ee__:(i=v.value=f(null),g(this,"__ee__",v),v.value=null),i[t]?"object"==typeof i[t]?i[t].push(e):i[t]=[i[t],e]:i[t]=e,this},s=function(t,e){var i,s;return l(e),s=this,n.call(this,t,i=function(){o.call(s,t,i),u.call(e,this,arguments)}),i.__eeOnceListener__=e,this},o=function(t,e){var i,n,s,o;if(l(e),!y.call(this,"__ee__"))return this;if(i=this.__ee__,!i[t])return this;if(n=i[t],"object"==typeof n)for(o=0;s=n[o];++o)s!==e&&s.__eeOnceListener__!==e||(2===n.length?i[t]=n[o?0:1]:n.splice(o,1));else n!==e&&n.__eeOnceListener__!==e||delete i[t];return this},r=function(t){var e,i,n,s,o;if(y.call(this,"__ee__")&&(s=this.__ee__[t]))if("object"==typeof s){for(i=arguments.length,o=new Array(i-1),e=1;e<i;++e)o[e-1]=arguments[e];for(s=s.slice(),e=0;n=s[e];++e)u.call(n,this,o)}else switch(arguments.length){case 1:d.call(s,this);break;case 2:d.call(s,this,arguments[1]);break;case 3:d.call(s,this,arguments[1],arguments[2]);break;default:for(i=arguments.length,o=new Array(i-1),e=1;e<i;++e)o[e-1]=arguments[e];u.call(s,this,o)}},h={on:n,once:s,off:o,emit:r},a={on:p(n),once:p(s),off:p(o),emit:p(r)},c=m({},a),t.exports=e=function(t){return null==t?f(c):m(Object(t),a)},e.methods=h},function(t,e){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function s(t){if(p===setTimeout)return setTimeout(t,0);if((p===i||!p)&&setTimeout)return p=setTimeout,setTimeout(t,0);try{return p(t,0)}catch(e){try{return p.call(null,t,0)}catch(e){return p.call(this,t,0)}}}function o(t){if(l===clearTimeout)return clearTimeout(t);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function r(){g&&d&&(g=!1,d.length?f=d.concat(f):m=-1,f.length&&h())}function h(){if(!g){var t=s(r);g=!0;for(var e=f.length;e;){for(d=f,f=[];++m<e;)d&&d[m].run();m=-1,e=f.length}d=null,g=!1,o(t)}}function a(t,e){this.fun=t,this.array=e}function c(){}var p,l,u=t.exports={};!function(){try{p="function"==typeof setTimeout?setTimeout:i}catch(t){p=i}try{l="function"==typeof clearTimeout?clearTimeout:n}catch(t){l=n}}();var d,f=[],g=!1,m=-1;u.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];f.push(new a(t,e)),1!==f.length||g||s(h)},a.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=c,u.addListener=c,u.once=c,u.off=c,u.removeListener=c,u.removeAllListeners=c,u.emit=c,u.binding=function(t){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(t){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(t,e){function i(t){this.context=t||this,this.hooks=[]}i.prototype.register=function(){for(var t=0;t<arguments.length;++t)if("function"==typeof arguments[t])this.hooks.push(arguments[t]);else for(var e=0;e<arguments[t].length;++e)this.hooks.push(arguments[t][e])},i.prototype.trigger=function(){var t=arguments,e=this.context,i=[];return this.hooks.forEach(function(n,s){var o=n.apply(e,t);o&&"function"==typeof o.then&&i.push(o)}),Promise.all(i)},i.prototype.list=function(){return this.hooks},i.prototype.clear=function(){return this.hooks=[]},t.exports=i},function(t,e,i){function n(t){this.layout=t}var s=i(1);n.prototype.section=function(t){var e=this.findRanges(t),i=this.rangeListToCfiList(t.section.cfiBase,e);return i},n.prototype.page=function(t,e,i,n){var s=!(!t||!t.document)&&t.document.body;if(s)return this.rangePairToCfiPair(e,{start:this.findStart(s,i,n),end:this.findEnd(s,i,n)})},n.prototype.walk=function(t,e){for(var i,n,s=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode:function(t){return t.data.trim().length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}},!1);(i=s.nextNode())&&!(n=e(i)););return n},n.prototype.findRanges=function(t){for(var e,i,n=[],s=t.contents.scrollWidth(),o=this.layout.count(s),r=this.layout.column,h=this.layout.gap,a=0;a<o.pages;a++)e=(r+h)*a,i=r*(a+1)+h*a,n.push({start:this.findStart(t.document.body,e,i),end:this.findEnd(t.document.body,e,i)});return n},n.prototype.findStart=function(t,e,i){for(var n,s,o=[t],r=t;o.length;)if(n=o.shift(),s=this.walk(n,function(t){var n,s,h,a;return t.nodeType==Node.TEXT_NODE?(a=document.createRange(),a.selectNodeContents(t),h=a.getBoundingClientRect()):h=t.getBoundingClientRect(),n=h.left,s=h.right,n>=e&&n<=i?t:s>e?t:(r=t,void o.push(t))}))return this.findTextStartRange(s,e,i);return this.findTextStartRange(r,e,i)},n.prototype.findEnd=function(t,e,i){for(var n,s,o=[t],r=t;o.length;)if(n=o.shift(),s=this.walk(n,function(t){var e,n,s,h;return t.nodeType==Node.TEXT_NODE?(h=document.createRange(),h.selectNodeContents(t),s=h.getBoundingClientRect()):s=t.getBoundingClientRect(),e=s.left,n=s.right,e>i&&r?r:n>i?t:(r=t,void o.push(t))}))return this.findTextEndRange(s,e,i);return this.findTextEndRange(r,e,i)},n.prototype.findTextStartRange=function(t,e,i){for(var n,s,o,r=this.splitTextNodeIntoRanges(t),h=0;h<r.length;h++){if(s=r[h],o=s.getBoundingClientRect(),o.left>=e)return s;n=s}return r[0]},n.prototype.findTextEndRange=function(t,e,i){for(var n,s,o,r=this.splitTextNodeIntoRanges(t),h=0;h<r.length;h++){if(s=r[h],o=s.getBoundingClientRect(),o.left>i&&n)return n;if(o.right>i)return s;n=s}return r[r.length-1]},n.prototype.splitTextNodeIntoRanges=function(t,e){var i,n=[],s=t.textContent||"",o=s.trim(),r=t.ownerDocument,h=e||" ";if(pos=o.indexOf(h),pos===-1||t.nodeType!=Node.TEXT_NODE)return i=r.createRange(),i.selectNodeContents(t),[i];for(i=r.createRange(),i.setStart(t,0),i.setEnd(t,pos),n.push(i),i=!1;pos!=-1;)pos=o.indexOf(h,pos+1),pos>0&&(i&&(i.setEnd(t,pos),n.push(i)),i=r.createRange(),i.setStart(t,pos+1));return i&&(i.setEnd(t,o.length),n.push(i)),n},n.prototype.rangePairToCfiPair=function(t,e){var i=e.start,n=e.end;return i.collapse(!0),n.collapse(!0),startCfi=new s(i,t).toString(),endCfi=new s(n,t).toString(),{start:startCfi,end:endCfi}},n.prototype.rangeListToCfiList=function(t,e){for(var i,n=[],s=0;s<e.length;s++)i=this.rangePairToCfiPair(t,e[s]),n.push(i);return n},t.exports=n},function(t,e,i){function n(t){this._q=[],this.context=t,this.tick=s.requestAnimationFrame,this.running=!1,this.paused=!1}var s=i(0);n.prototype.enqueue=function(){var t,e,i,n=[].shift.call(arguments),o=arguments;return n?("function"==typeof n?(t=new s.defer,e=t.promise,i={task:n,args:o,deferred:t,promise:e}):i={promise:n},this._q.push(i),0!=this.paused||this.running||this.run(),i.promise):console.error("No Task Provided")},n.prototype.dequeue=function(){var t,e,i;return this._q.length?(t=this._q.shift(),(e=t.task)?(i=e.apply(this.context,t.args),i&&"function"==typeof i.then?i.then(function(){t.deferred.resolve.apply(this.context,arguments)}.bind(this)):(t.deferred.resolve.apply(this.context,i),t.promise)):t.promise?t.promise:void 0):(t=new s.defer,t.deferred.resolve(),t.promise)},n.prototype.dump=function(){for(;this._q.length;)this.dequeue()},n.prototype.run=function(){return this.running||(this.running=!0,this.defered=new s.defer),this.tick.call(window,function(){this._q.length?this.dequeue().then(function(){this.run()}.bind(this)):(this.defered.resolve(),this.running=void 0)}.bind(this)),1==this.paused&&(this.paused=!1),this.defered.promise},n.prototype.flush=function(){return this.running?this.running:this._q.length?(this.running=this.dequeue().then(function(){return this.running=void 0,this.flush()}.bind(this)),this.running):void 0},n.prototype.clear=function(){this._q=[],this.running=!1},n.prototype.length=function(){return this._q.length},n.prototype.pause=function(){this.paused=!0},t.exports=n},function(t,e,i){function n(t,e){var i,n;t&&(n=h.qs(t,"head"),i=h.qs(n,"base"),i||(i=t.createElement("base"),n.insertBefore(i,n.firstChild)),i.setAttribute("href",e.url))}function s(t,e){var i,n,s=e.url;t&&(i=h.qs(t,"head"),n=h.qs(i,"link[rel='canonical']"),n?n.setAttribute("href",s):(n=t.createElement("link"),n.setAttribute("rel","canonical"),n.setAttribute("href",s),i.appendChild(n)))}function o(t,e){for(var i=t.document.querySelectorAll("a[href]"),n=function(t){var i=t.getAttribute("href");if(0!==i.indexOf("mailto:")){var n=this.book.resolve(i,!1);linkUrl&&linkUrl.protocol?t.setAttribute("target","_blank"):t.onclick=function(){return e.display(n),!1}}}.bind(this),s=0;s<i.length;s++)n(i[s])}function r(t,e,i){return e.forEach(function(e,n){e&&i[n]&&(t=t.replace(new RegExp(e,"g"),i[n]))}),t}var h=i(0);t.exports={base:n,canonical:s,links:o,substitute:r}},function(t,e,i){function n(t,e,i,n){function r(t){console.error(t),l.reject(t)}function h(){if(this.readyState===XMLHttpRequest.DONE){var t=!1;if(""!==this.responseType&&"document"!==this.responseType||(t=this.responseXML),200===this.status||t){var i;if(!this.response&&!t)return l.reject({status:this.status,message:"Empty Response",stack:(new Error).stack}),l.promise;if(403===this.status)return l.reject({status:this.status,response:this.response,message:"Forbidden",stack:(new Error).stack}),l.promise;i=t?this.responseXML:s.isXml(e)?s.parse(this.response,"text/xml"):"xhtml"==e?s.parse(this.response,"application/xhtml+xml"):"html"==e||"htm"==e?s.parse(this.response,"text/html"):"json"==e?JSON.parse(this.response):"blob"==e?c?this.response:new Blob([this.response]):this.response,l.resolve(i)}else l.reject({status:this.status,message:this.response,stack:(new Error).stack})}}var a,c="undefined"!=typeof window&&window.URL,p=c?"blob":"arraybuffer",l=new s.defer,u=new XMLHttpRequest,d=XMLHttpRequest.prototype;"overrideMimeType"in d||Object.defineProperty(d,"overrideMimeType",{value:function(t){}}),i&&(u.withCredentials=!0),u.onreadystatechange=h,u.onerror=r,u.open("GET",t,!0);for(a in n)u.setRequestHeader(a,n[a]);return"json"==e&&u.setRequestHeader("Accept","application/json"),e||(e=new o(t).extension),"blob"==e&&(u.responseType=p),s.isXml(e)&&u.overrideMimeType("text/xml"),"binary"==e&&(u.responseType="arraybuffer"),u.send(),l.promise}var s=i(0),o=i(0).Path;t.exports=n},function(t,e,i){function n(t,e,i){this.epubcfi=new r,this.document=t,this.documentElement=this.document.documentElement,this.content=e||this.document.body,
|
|
this.window=this.document.defaultView,this.listenedEvents=["keydown","keyup","keypressed","mouseup","mousedown","click","touchend","touchstart"],this._size={width:0,height:0},this.cfiBase=i||"",this.listeners()}var s=i(3),o=i(0),r=i(1),h=i(6);n.prototype.width=function(t){var e=this.content;return t&&o.isNumber(t)&&(t+="px"),t&&(e.style.width=t),this.window.getComputedStyle(e).width},n.prototype.height=function(t){var e=this.content;return t&&o.isNumber(t)&&(t+="px"),t&&(e.style.height=t),this.window.getComputedStyle(e).height},n.prototype.contentWidth=function(t){var e=this.content||this.document.body;return t&&o.isNumber(t)&&(t+="px"),t&&(e.style.width=t),this.window.getComputedStyle(e).width},n.prototype.contentHeight=function(t){var e=this.content||this.document.body;return t&&o.isNumber(t)&&(t+="px"),t&&(e.style.height=t),this.window.getComputedStyle(e).height},n.prototype.textWidth=function(){var t,e=this.document.createRange(),i=this.content||this.document.body;return e.selectNodeContents(i),t=e.getBoundingClientRect().width},n.prototype.textHeight=function(){var t,e=this.document.createRange(),i=this.content||this.document.body;return e.selectNodeContents(i),t=e.getBoundingClientRect().height},n.prototype.scrollWidth=function(){var t=this.documentElement.scrollWidth;return t},n.prototype.scrollHeight=function(){var t=this.documentElement.scrollHeight;return t},n.prototype.overflow=function(t){return t&&(this.documentElement.style.overflow=t),this.window.getComputedStyle(this.documentElement).overflow},n.prototype.overflowX=function(t){return t&&(this.documentElement.style.overflowX=t),this.window.getComputedStyle(this.documentElement).overflowX},n.prototype.overflowY=function(t){return t&&(this.documentElement.style.overflowY=t),this.window.getComputedStyle(this.documentElement).overflowY},n.prototype.css=function(t,e){var i=this.content||this.document.body;return e&&(i.style[t]=e),this.window.getComputedStyle(i)[t]},n.prototype.viewport=function(t){var e,i,n,s,o=this.document.querySelector("meta[name='viewport']"),r="";return o&&o.hasAttribute("content")&&(content=o.getAttribute("content"),contents=content.split(/\s*,\s*/),contents[0]&&(e=contents[0].replace("width=","").trim()),contents[1]&&(i=contents[1].replace("height=","").trim()),contents[2]&&(n=contents[2].replace("initial-scale=","").trim()),contents[3]&&(s=contents[3].replace("user-scalable=","").trim())),t&&(r+="width="+(t.width||e),r+=", height="+(t.height||i),(t.scale||n)&&(r+=", initial-scale="+(t.scale||n)),(t.scalable||s)&&(r+=", user-scalable="+(t.scalable||s)),o||(o=this.document.createElement("meta"),o.setAttribute("name","viewport"),this.document.querySelector("head").appendChild(o)),o.setAttribute("content",r)),{width:parseInt(e),height:parseInt(i)}},n.prototype.expand=function(){this.emit("expand")},n.prototype.listeners=function(){this.imageLoadListeners(),this.mediaQueryListeners(),this.addEventListeners(),this.addSelectionListeners(),this.resizeListeners()},n.prototype.removeListeners=function(){this.removeEventListeners(),this.removeSelectionListeners()},n.prototype.resizeListeners=function(){var t,e;clearTimeout(this.expanding),t=this.scrollWidth(),e=this.scrollHeight(),t==this._size.width&&e==this._size.height||(this._size={width:t,height:e},this.emit("resize",this._size)),this.expanding=setTimeout(this.resizeListeners.bind(this),350)},n.prototype.mediaQueryListeners=function(){for(var t=this.document.styleSheets,e=function(t){t.matches&&!this._expanding&&setTimeout(this.expand.bind(this),1)}.bind(this),i=0;i<t.length;i+=1){var n;try{n=t[i].cssRules}catch(s){return}if(!n)return;for(var o=0;o<n.length;o+=1)if(n[o].media){var r=this.window.matchMedia(n[o].media.mediaText);r.addListener(e)}}},n.prototype.observe=function(t){var e=this,i=new MutationObserver(function(t){e._expanding&&e.expand()}),n={attributes:!0,childList:!0,characterData:!0,subtree:!0};return i.observe(t,n),i},n.prototype.imageLoadListeners=function(t){for(var e,i=this.document.querySelectorAll("img"),n=0;n<i.length;n++)e=i[n],"undefined"!=typeof e.naturalWidth&&0===e.naturalWidth&&(e.onload=this.expand.bind(this))},n.prototype.fontLoadListeners=function(t){this.document&&this.document.fonts&&this.document.fonts.ready.then(function(){this.expand()}.bind(this))},n.prototype.root=function(){return this.document?this.document.documentElement:null},n.prototype.locationOf=function(t,e){var i,n={left:0,top:0};if(this.document)return this.epubcfi.isCfiString(t)?(range=new r(t).toRange(this.document,e),range&&(range.startContainer.nodeType===Node.ELEMENT_NODE?(i=range.startContainer.getBoundingClientRect(),n.left=i.left,n.top=i.top):(i=range.getBoundingClientRect(),n.left=i.left,n.top=i.top))):"string"==typeof t&&t.indexOf("#")>-1&&(id=t.substring(t.indexOf("#")+1),el=this.document.getElementById(id),el&&(i=el.getBoundingClientRect(),n.left=i.left,n.top=i.top)),n},n.prototype.addStylesheet=function(t){return new Promise(function(e,i){var n,s=!1;return this.document?(n=this.document.createElement("link"),n.type="text/css",n.rel="stylesheet",n.href=t,n.onload=n.onreadystatechange=function(){s||this.readyState&&"complete"!=this.readyState||(s=!0,setTimeout(function(){e(!0)},1))},void this.document.head.appendChild(n)):void e(!1)}.bind(this))},n.prototype.addStylesheetRules=function(t){var e,i;if(this.document){e=this.document.createElement("style"),this.document.head.appendChild(e),i=e.sheet;for(var n=0,s=t.length;n<s;n++){var o=1,r=t[n],h=t[n][0],a="";"[object Array]"===Object.prototype.toString.call(r[1][0])&&(r=r[1],o=0);for(var c=r.length;o<c;o++){var p=r[o];a+=p[0]+":"+p[1]+(p[2]?" !important":"")+";\n"}i.insertRule(h+"{"+a+"}",i.cssRules.length)}}},n.prototype.addScript=function(t){return new Promise(function(e,i){var n,s=!1;return this.document?(n=this.document.createElement("script"),n.type="text/javascript",n.async=!0,n.src=t,n.onload=n.onreadystatechange=function(){s||this.readyState&&"complete"!=this.readyState||(s=!0,setTimeout(function(){e(!0)},1))},void this.document.head.appendChild(n)):void e(!1)}.bind(this))},n.prototype.addEventListeners=function(){this.document&&this.listenedEvents.forEach(function(t){this.document.addEventListener(t,this.triggerEvent.bind(this),!1)},this)},n.prototype.removeEventListeners=function(){this.document&&this.listenedEvents.forEach(function(t){this.document.removeEventListener(t,this.triggerEvent,!1)},this)},n.prototype.triggerEvent=function(t){this.emit(t.type,t)},n.prototype.addSelectionListeners=function(){this.document&&this.document.addEventListener("selectionchange",this.onSelectionChange.bind(this),!1)},n.prototype.removeSelectionListeners=function(){this.document&&this.document.removeEventListener("selectionchange",this.onSelectionChange,!1)},n.prototype.onSelectionChange=function(t){this.selectionEndTimeout&&clearTimeout(this.selectionEndTimeout),this.selectionEndTimeout=setTimeout(function(){var t=this.window.getSelection();this.triggerSelectedEvent(t)}.bind(this),500)},n.prototype.triggerSelectedEvent=function(t){var e,i;t&&t.rangeCount>0&&(e=t.getRangeAt(0),e.collapsed||(i=new r(e,this.cfiBase).toString(),this.emit("selected",i),this.emit("selectedRange",e)))},n.prototype.range=function(t,e){var i=new r(t);return i.toRange(this.document,e)},n.prototype.map=function(t){var e=new h(t);return e.section()},n.prototype.size=function(t,e){t>=0&&this.width(t),e>=0&&this.height(e),this.css("margin","0"),this.css("boxSizing","border-box")},n.prototype.columns=function(t,e,i,n){var s=o.prefixed("columnAxis"),r=o.prefixed("columnGap"),h=o.prefixed("columnWidth"),a=o.prefixed("columnFill");this.width(t),this.height(e),this.viewport({width:t,height:e,scale:1}),this.css("overflowY","hidden"),this.css("margin","0"),this.css("boxSizing","border-box"),this.css("maxWidth","inherit"),this.css(s,"horizontal"),this.css(a,"auto"),this.css(r,n+"px"),this.css(h,i+"px")},n.prototype.scale=function(t,e,i){var t="scale("+t+")",n="";this.css("transformOrigin","top left"),(e>=0||i>=0)&&(n=" translate("+(e||0)+"px, "+(i||0)+"px )"),this.css("transform",t+n)},n.prototype.fit=function(t,e){var i=this.viewport(),n=t/i.width,s=e/i.height,o=n<s?n:s,r=(e-i.height*o)/2;this.width(t),this.height(e),this.overflow("hidden"),this.viewport({scale:1}),this.scale(o,0,r),this.css("backgroundColor","transparent")},n.prototype.mapPage=function(t,e,i){var n=new h;return n.page(this,t,e,i)},n.prototype.destroy=function(){this.observer&&this.observer.disconnect(),this.removeListeners()},s(n.prototype),t.exports=n},function(t,e,i){function n(t){this.name="default",this.View=t.view,this.request=t.request,this.renditionQueue=t.queue,this.q=new h(this),this.settings=o.extend(this.settings||{},{infinite:!0,hidden:!1,width:void 0,height:void 0,axis:"vertical",ignoreClass:""}),o.extend(this.settings,t.settings||{}),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,layout:this.layout,width:0,height:0}}var s=i(3),o=i(0),r=(i(1),i(6)),h=i(7),a=i(40),c=i(41);n.prototype.render=function(t,e){this.stage=new a({width:e.width,height:e.height,overflow:this.settings.overflow,hidden:this.settings.hidden,axis:this.settings.axis}),this.stage.attachTo(t),this.container=this.stage.getContainer(),this.views=new c(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.addEventListeners(),this.layout&&this.updateLayout()},n.prototype.addEventListeners=function(){window.addEventListener("unload",function(t){this.destroy()}.bind(this))},n.prototype.destroy=function(){},n.prototype.onResized=function(t){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){this.resize()}.bind(this),150)},n.prototype.resize=function(t,e){this.q.clear(),this._stageSize=this.stage.size(t,e),this._bounds=this.bounds(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.views.each(function(t){t.size(this._stageSize.width,this._stageSize.height)}.bind(this)),this.updateLayout(),this.emit("resized",{width:this.stage.width,height:this.stage.height})},n.prototype.createView=function(t){return new this.View(t,this.viewSettings)},n.prototype.display=function(t,e){var i=new o.defer,n=i.promise,s=this.views.find(t);return s&&e?(offset=s.locationOf(e),this.moveTo(offset),i.resolve(),n):(this.views.hide(),this.views.clear(),this.add(t).then(function(){var e;if("pre-paginated"===this.layout.name&&this.layout.divisor>1&&(e=t.next()))return this.add(e)}.bind(this)).then(function(t){e&&(offset=t.locationOf(e),this.moveTo(offset)),this.views.show(),i.resolve()}.bind(this)),n)},n.prototype.afterDisplayed=function(t){this.emit("added",t)},n.prototype.afterResized=function(t){this.emit("resize",t.section)},n.prototype.moveTo=function(t){var e=0,i=0;"vertical"===this.settings.axis?i=t.top:(e=Math.floor(t.left/this.layout.delta)*this.layout.delta,e+this.layout.delta>this.container.scrollWidth&&(e=this.container.scrollWidth-this.layout.delta)),this.scrollTo(e,i)},n.prototype.add=function(t){var e=this.createView(t);return this.views.append(e),e.onDisplayed=this.afterDisplayed.bind(this),e.onResize=this.afterResized.bind(this),e.display(this.request)},n.prototype.append=function(t){var e=this.createView(t);return this.views.append(e),e.display(this.request)},n.prototype.prepend=function(t){var e=this.createView(t);return this.views.prepend(e),e.display(this.request)},n.prototype.next=function(){var t,e;if(this.views.length)return"horizontal"===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,e=this.container.scrollLeft+this.container.offsetWidth+this.layout.delta,e<this.container.scrollWidth?this.scrollBy(this.layout.delta,0):e-this.layout.columnWidth===this.container.scrollWidth?this.scrollTo(this.container.scrollWidth-this.layout.delta,0):t=this.views.last().section.next()):t=this.views.last().section.next(),t?(this.views.clear(),this.append(t).then(function(){var e;if(this.layout.name&&this.layout.divisor>1&&(e=t.next()))return this.append(e)}.bind(this)).then(function(){this.views.show()}.bind(this))):void 0},n.prototype.prev=function(){var t,e;if(this.views.length)return"horizontal"===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,e=this.container.scrollLeft,e>0?this.scrollBy(-this.layout.delta,0):t=this.views.first().section.prev()):t=this.views.first().section.prev(),t?(this.views.clear(),this.prepend(t).then(function(){var e;if(this.layout.name&&this.layout.divisor>1&&(e=t.prev()))return this.prepend(e)}.bind(this)).then(function(){"horizontal"===this.settings.axis&&this.scrollTo(this.container.scrollWidth-this.layout.delta,0),this.views.show()}.bind(this))):void 0},n.prototype.current=function(){var t=this.visible();return t.length?t[t.length-1]:null},n.prototype.currentLocation=function(){var t,e,i;if(this.views.length)return t=this.views.first(),e=container.left-t.position().left,i=e+this.layout.spread,this.mapping.page(t,t.section.cfiBase)},n.prototype.isVisible=function(t,e,i,n){var s=t.position(),o=n||this.bounds();return"horizontal"===this.settings.axis&&s.right>o.left-e&&s.left<o.right+i||"vertical"===this.settings.axis&&s.bottom>o.top-e&&s.top<o.bottom+i},n.prototype.visible=function(){for(var t,e,i=this.bounds(),n=this.views.displayed(),s=n.length,o=[],r=0;r<s;r++)e=n[r],t=this.isVisible(e,0,0,i),t===!0&&o.push(e);return o},n.prototype.scrollBy=function(t,e,i){i&&(this.ignore=!0),this.settings.height?(t&&(this.container.scrollLeft+=t),e&&(this.container.scrollTop+=e)):window.scrollBy(t,e),this.scrolled=!0,this.onScroll()},n.prototype.scrollTo=function(t,e,i){i&&(this.ignore=!0),this.settings.height?(this.container.scrollLeft=t,this.container.scrollTop=e):window.scrollTo(t,e),this.scrolled=!0,this.onScroll()},n.prototype.onScroll=function(){},n.prototype.bounds=function(){var t;return t=this.stage.bounds()},n.prototype.applyLayout=function(t){this.layout=t,this.updateLayout(),this.mapping=new r(this.layout)},n.prototype.updateLayout=function(){this.stage&&(this._stageSize=this.stage.size(),"vertical"===this.settings.axis?this.layout.calculate(this._stageSize.width,this._stageSize.height):(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),this.settings.offset=this.layout.delta,this.stage.addStyleRules("iframe",[{"margin-right":this.layout.gap+"px"}])),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))},n.prototype.setLayout=function(t){this.viewSettings.layout=t,this.views&&this.views.each(function(e){e.setLayout(t)})},n.prototype.updateFlow=function(t){var e="paginated"===t?"horizontal":"vertical";this.settings.axis=e,this.viewSettings.axis=e,this.settings.overflow="paginated"===t?"hidden":"auto"},s(n.prototype),t.exports=n},function(t,e,i){function n(t,e){this.settings=o.extend(this.settings||{},{width:null,height:null,ignoreClass:"",manager:"default",view:"iframe",flow:null,layout:null,spread:null,minSpreadWidth:800}),o.extend(this.settings,e),"object"==typeof this.settings.manager&&(this.manager=this.settings.manager),this.viewSettings={ignoreClass:this.settings.ignoreClass},this.book=t,this.views=null,this.hooks={},this.hooks.display=new h(this),this.hooks.serialize=new h(this),this.hooks.content=new h(this),this.hooks.layout=new h(this),this.hooks.render=new h(this),this.hooks.show=new h(this),this.hooks.content.register(r.links.bind(this)),this.hooks.content.register(this.passViewEvents.bind(this)),this.epubcfi=new a,this.q=new c(this),this.q.enqueue(this.book.opened),this.starting=new o.defer,this.started=this.starting.promise,this.q.enqueue(this.start)}var s=i(3),o=(i(2),i(0)),r=i(8),h=i(5),a=i(1),c=i(7),p=i(38),l=i(6);i(0).Path;n.prototype.setManager=function(t){this.manager=t},n.prototype.requireManager=function(t){var e;return e="string"==typeof t?"undefined"!=typeof ePub?ePub.ViewManagers[t]:void 0:t},n.prototype.requireView=function(t){var e;return e="string"==typeof t?"undefined"!=typeof ePub?ePub.Views[t]:void 0:t},n.prototype.start=function(){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.settings.globalLayoutProperties=this.determineLayoutProperties(this.book["package"].metadata),this.flow(this.settings.globalLayoutProperties.flow),this.layout(this.settings.globalLayoutProperties),this.manager.on("added",this.afterDisplayed.bind(this)),this.manager.on("resized",this.onResized.bind(this)),this.manager.on("scroll",this.reportLocation.bind(this)),this.on("displayed",this.reportLocation.bind(this)),this.emit("started"),this.starting.resolve()},n.prototype.attachTo=function(t){return this.q.enqueue(function(){this.manager.render(t,{width:this.settings.width,height:this.settings.height}),this.emit("attached")}.bind(this))},n.prototype.display=function(t){return this.q.enqueue(this._display,t)},n.prototype._display=function(t){var e,i,n=this.epubcfi.isCfiString(t),s=new o.defer,r=s.promise;return(e=this.book.spine.get(t))?(!n&&"string"==typeof t&&t.indexOf("#")>-1&&(i=t.substring(t.indexOf("#")+1)),n&&(i=t),this.manager.display(e,i).then(function(){this.emit("displayed",e)}.bind(this))):(s.reject(new Error("No Section Found")),r)},n.prototype.afterDisplayed=function(t){this.hooks.content.trigger(t,this),this.emit("rendered",t.section),this.reportLocation()},n.prototype.onResized=function(){this.location&&this.display(this.location.start),this.emit("resized",{width:size.width,height:size.height})},n.prototype.moveTo=function(t){this.manager.moveTo(t)},n.prototype.next=function(){return this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this))},n.prototype.prev=function(){return this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this))},n.prototype.determineLayoutProperties=function(t){var e,i=this.settings.layout||t.layout||"reflowable",n=this.settings.spread||t.spread||"auto",s=this.settings.orientation||t.orientation||"auto",o=this.settings.flow||t.flow||"auto",r=t.viewport||"",h=this.settings.minSpreadWidth||t.minSpreadWidth||800;return this.settings.width>=0&&this.settings.height>=0&&(r="width="+this.settings.width+", height="+this.settings.height),e={layout:i,spread:n,orientation:s,flow:o,viewport:r,minSpreadWidth:h}},n.prototype.flow=function(t){var e;"scrolled-doc"!==t&&"scrolled-continuous"!==t||(e="scrolled"),"auto"!==t&&"paginated"!==t||(e="paginated"),this._layout&&this._layout.flow(e),this.manager&&this.manager.updateFlow(e)},n.prototype.layout=function(t){return t&&(this._layout=new p(t),this._layout.spread(t.spread,this.settings.minSpreadWidth),this.mapping=new l(this._layout)),this.manager&&this._layout&&this.manager.applyLayout(this._layout),this._layout},n.prototype.spread=function(t,e){this._layout.spread(t,e),this.manager.isRendered()&&this.manager.updateLayout()},n.prototype.reportLocation=function(){return this.q.enqueue(function(){var t=this.manager.currentLocation();t&&t.then&&"function"==typeof t.then?t.then(function(t){this.location=t,this.emit("locationChanged",this.location)}.bind(this)):t&&(this.location=t,this.emit("locationChanged",this.location))}.bind(this))},n.prototype.destroy=function(){this.q.clear(),this.manager.destroy()},n.prototype.passViewEvents=function(t){t.contents.listenedEvents.forEach(function(e){t.on(e,this.triggerViewEvent.bind(this))}.bind(this)),t.on("selected",this.triggerSelectedEvent.bind(this))},n.prototype.triggerViewEvent=function(t){this.emit(t.type,t)},n.prototype.triggerSelectedEvent=function(t){this.emit("selected",t)},n.prototype.range=function(t,e){var i=new a(t),n=this.visible().filter(function(t){if(i.spinePos===t.index)return!0});if(n.length)return n[0].range(i,e)},n.prototype.adjustImages=function(t){return t.addStylesheetRules([["img",["max-width",t.layout.spreadWidth+"px"],["max-height",t.layout.height+"px"]]]),new Promise(function(t,e){setTimeout(function(){t()},1)})},s(n.prototype),t.exports=n},function(t,i){t.exports=e},,,function(t,e,i){function n(t,e){"undefined"==typeof e&&"object"==typeof t&&(e=t,t=void 0),this.settings=o.extend(this.settings||{},{requestMethod:void 0,requestCredentials:void 0,requestHeaders:void 0,encoding:void 0,replacements:"base64"}),o.extend(this.settings,e),this.opening=new o.defer,this.opened=this.opening.promise,this.isOpen=!1,this.loading={manifest:new o.defer,spine:new o.defer,metadata:new o.defer,cover:new o.defer,navigation:new o.defer,pageList:new o.defer,resources:new o.defer},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},this.ready=Promise.all([this.loaded.manifest,this.loaded.spine,this.loaded.metadata,this.loaded.cover,this.loaded.navigation,this.loaded.resources]),this.isRendered=!1,this.request=this.settings.requestMethod||y,this.spine=new a,this.locations=new c(this.spine,this.load),this.navigation=void 0,this.pageList=new f,this.url=void 0,this.path=void 0,this.archived=!1,t&&this.open(t)["catch"](function(e){var i=new Error("Cannot load book at "+t);console.error(i),this.emit("openFailed",i),console.log(e)}.bind(this))}var s=i(3),o=(i(2),i(0)),r=i(0).Url,h=i(0).Path,a=i(47),c=i(39),p=i(37),l=i(43),u=i(42),d=i(45),f=i(44),g=i(12),m=i(36),y=i(9),v=i(1),w="META-INF/container.xml";n.prototype.open=function(t,e){var i,n=e||this.determineType(t);return"binary"===n?(this.archived=!0,this.url=new r("/",""),i=this.openEpub(t)):"epub"===n?(this.archived=!0,this.url=new r("/",""),i=this.request(t,"binary").then(this.openEpub.bind(this))):"opf"==n?(this.url=new r(t),i=this.openPackaging(t)):(this.url=new r(t),i=this.openContainer(w).then(this.openPackaging.bind(this))),i},n.prototype.openEpub=function(t,e){return this.unarchive(t,e||this.settings.encoding).then(function(){return this.openContainer(w)}.bind(this)).then(function(t){return this.openPackaging(t)}.bind(this))},n.prototype.openContainer=function(t){return this.load(t).then(function(t){return this.container=new p(t),this.resolve(this.container.packagePath)}.bind(this))},n.prototype.openPackaging=function(t){return this.path=new h(t),this.load(t).then(function(t){return this.packaging=new l(t),this.unpack(this.packaging)}.bind(this))},n.prototype.load=function(t){var e;return this.archived?(e=this.resolve(t),this.archive.request(e)):(e=this.resolve(t),this.request(e,null,this.settings.requestCredentials,this.settings.requestHeaders))},n.prototype.resolve=function(t,e){var i=t,n=t.indexOf("://")>-1;return n?t:(this.path&&(i=this.path.resolve(t)),0!=e&&this.url&&(i=this.url.resolve(i)),i)},n.prototype.determineType=function(t){var e,i,n;return"string"!=typeof t?"binary":(e=new r(t),i=e.path(),n=i.extension,n?"epub"===n?"epub":"opf"===n?"opf":void 0:"directory")},n.prototype.unpack=function(t){this["package"]=t,this.spine.unpack(this["package"],this.resolve.bind(this)),this.resources=new d(this["package"].manifest,{archive:this.archive,resolver:this.resolve.bind(this),replacements:this.settings.replacements}),this.loadNavigation(this["package"]).then(function(t){this.toc=t,this.loading.navigation.resolve(this.toc)}.bind(this)),this.cover=this.resolve(this["package"].coverPath),this.loading.manifest.resolve(this["package"].manifest),this.loading.metadata.resolve(this["package"].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.replacements().then(function(){this.opening.resolve(this)}.bind(this)):this.opening.resolve(this)},n.prototype.loadNavigation=function(t){var e=t.navPath||t.ncxPath;if(e)return this.load(e,"xml").then(function(t){this.navigation=new u(t),this.pageList=new f(t)}.bind(this))},n.prototype.section=function(t){return this.spine.get(t)},n.prototype.renderTo=function(t,e){return this.rendition=new g(this,e),this.rendition.attachTo(t),this.rendition},n.prototype.setRequestCredentials=function(t){this.settings.requestCredentials=t},n.prototype.setRequestHeaders=function(t){this.settings.requestHeaders=t},n.prototype.unarchive=function(t,e){return this.archive=new m,this.archive.open(t,e)},n.prototype.coverUrl=function(){var t=this.loaded.cover.then(function(t){return this.archived?this.resources.get(this.cover):this.cover}.bind(this));return t},n.prototype.replacements=function(){return this.spine.hooks.serialize.register(function(t,e){e.output=this.resources.substitute(t,e.url)}.bind(this)),this.resources.replacements().then(function(){return this.resources.replaceCss()}.bind(this))},n.prototype.range=function(t){var e=new v(t),i=this.spine.get(e.spinePos);return i.load().then(function(t){var n=e.toRange(i.document);return n})},s(n.prototype),t.exports=n},function(t,e,i){function n(t){o.apply(this,arguments),this.name="continuous",this.settings=s.extend(this.settings||{},{infinite:!0,overflow:"auto",axis:"vertical",offset:500,offsetDelta:250,width:void 0,height:void 0}),s.extend(this.settings,t.settings||{}),"undefined"!=t.settings.gap&&0===t.settings.gap&&(this.settings.gap=t.settings.gap),this.viewSettings={ignoreClass:this.settings.ignoreClass,axis:this.settings.axis,layout:this.layout,width:0,height:0},this.scrollTop=0,this.scrollLeft=0}var s=i(0),o=i(11);n.prototype=Object.create(o.prototype),n.prototype.constructor=n,n.prototype.display=function(t,e){return o.prototype.display.call(this,t,e).then(function(){return this.fill()}.bind(this))},n.prototype.fill=function(t){var e=t||new s.defer;return this.check().then(function(t){t?this.fill(e):e.resolve()}.bind(this)),e.promise},n.prototype.moveTo=function(t){var e=0,i=0,n=0,s=0;return"vertical"===this.settings.axis?(i=t.top,s=t.top+this.settings.offset):(e=Math.floor(t.left/this.layout.delta)*this.layout.delta,n=e+this.settings.offset),this.check(n,s).then(function(){this.scrollBy(e,i)}.bind(this))},n.prototype.resize=function(t,e){this.q.clear(),this._stageSize=this.stage.size(t,e),this._bounds=this.bounds(),this.viewSettings.width=this._stageSize.width,this.viewSettings.height=this._stageSize.height,this.views.each(function(t){t.size(this._stageSize.width,this._stageSize.height)}.bind(this)),this.updateLayout(),this.emit("resized",{width:this.stage.width,height:this.stage.height})},n.prototype.onResized=function(t){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){this.resize()}.bind(this),150)},n.prototype.afterResized=function(t){this.emit("resize",t.section)},n.prototype.removeShownListeners=function(t){t.onDisplayed=function(){}},n.prototype.append=function(t){var e=this.createView(t);return this.views.append(e),e},n.prototype.prepend=function(t){var e=this.createView(t);return e.on("resized",this.counter.bind(this)),this.views.prepend(e),e},n.prototype.counter=function(t){"vertical"===this.settings.axis?this.scrollBy(0,t.heightDelta,!0):this.scrollBy(t.widthDelta,0,!0)},n.prototype.update=function(t){for(var e,i,n=this.bounds(),o=this.views.all(),r=o.length,h=[],a="undefined"!=typeof t?t:this.settings.offset||0,c=new s.defer,p=[],l=0;l<r;l++)i=o[l],e=this.isVisible(i,a,a,n),e===!0?(i.displayed||p.push(i.display(this.request).then(function(t){t.show()})),h.push(i)):(this.q.enqueue(i.destroy.bind(i)),clearTimeout(this.trimTimeout),this.trimTimeout=setTimeout(function(){this.q.enqueue(this.trim.bind(this))}.bind(this),250));return p.length?Promise.all(p):(c.resolve(),c.promise)},n.prototype.check=function(t,e){var i,n,o,r,h=new s.defer,a=[],c="horizontal"===this.settings.axis,p=this.settings.offset||0;t&&c&&(p=t),e&&!c&&(p=e);var l=this._bounds,u=c?this.scrollLeft:this.scrollTop,d=c?l.width:l.height,f=c?this.container.scrollWidth:this.container.scrollHeight;return u+d+p>=f&&(i=this.views.last(),o=i&&i.section.next(),o&&a.push(this.append(o))),u-p<0&&(n=this.views.first(),r=n&&n.section.prev(),r&&a.push(this.prepend(r))),a.length?this.q.enqueue(function(){return this.update(p)}.bind(this)):(h.resolve(!1),h.promise)},n.prototype.trim=function(){for(var t=new s.defer,e=this.views.displayed(),i=e[0],n=e[e.length-1],o=this.views.indexOf(i),r=this.views.indexOf(n),h=this.views.slice(0,o),a=this.views.slice(r+1),c=0;c<h.length-1;c++)this.erase(h[c],h);for(var p=1;p<a.length;p++)this.erase(a[p]);return t.resolve(),t.promise},n.prototype.erase=function(t,e){var i,n;this.settings.height?(i=this.container.scrollTop,n=this.container.scrollLeft):(i=window.scrollY,n=window.scrollX);var s=t.bounds();this.views.remove(t),e&&("vertical"===this.settings.axis?this.scrollTo(0,i-s.height,!0):this.scrollTo(n-s.width,0,!0))},n.prototype.addEventListeners=function(t){window.addEventListener("unload",function(t){this.ignore=!0,this.destroy()}.bind(this)),this.addScrollListeners()},n.prototype.addScrollListeners=function(){var t;this.tick=s.requestAnimationFrame,this.settings.height?(this.prevScrollTop=this.container.scrollTop,this.prevScrollLeft=this.container.scrollLeft):(this.prevScrollTop=window.scrollY,this.prevScrollLeft=window.scrollX),this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.settings.height?(t=this.container,this.scrollTop=this.container.scrollTop,this.scrollLeft=this.container.scrollLeft):(t=window,this.scrollTop=window.scrollY,this.scrollLeft=window.scrollX),t.addEventListener("scroll",this.onScroll.bind(this)),this.scrolled=!1},n.prototype.onScroll=function(){this.settings.height?(scrollTop=this.container.scrollTop,scrollLeft=this.container.scrollLeft):(scrollTop=window.scrollY,scrollLeft=window.scrollX),this.scrollTop=scrollTop,this.scrollLeft=scrollLeft,this.ignore?this.ignore=!1:(0===this.scrollDeltaVert&&0===this.scrollDeltaHorz||this.scrollDeltaVert>this.settings.offsetDelta||this.scrollDeltaHorz>this.settings.offsetDelta)&&(this.q.enqueue(function(){this.check()}.bind(this)),this.scrollDeltaVert=0,this.scrollDeltaHorz=0,this.emit("scroll",{top:scrollTop,left:scrollLeft}),clearTimeout(this.afterScrolled),this.afterScrolled=setTimeout(function(){this.emit("scrolled",{top:this.scrollTop,left:this.scrollLeft})}.bind(this))),this.scrollDeltaVert+=Math.abs(scrollTop-this.prevScrollTop),this.scrollDeltaHorz+=Math.abs(scrollLeft-this.prevScrollLeft),this.prevScrollTop=scrollTop,this.prevScrollLeft=scrollLeft,clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(function(){this.scrollDeltaVert=0,this.scrollDeltaHorz=0}.bind(this),150),this.scrolled=!1},n.prototype.currentLocation=function(){return"vertical"===this.settings.axis?this.location=this.scrolledLocation():this.location=this.paginatedLocation(),this.location},n.prototype.scrolledLocation=function(){var t,e,i=this.visible();this.container.getBoundingClientRect();return 1===i.length?this.mapping.page(i[0].contents,i[0].section.cfiBase):i.length>1?(t=this.mapping.page(i[0].contents,i[0].section.cfiBase),e=this.mapping.page(i[i.length-1].contents,i[i.length-1].section.cfiBase),{start:t.start,end:e.end}):void 0},n.prototype.paginatedLocation=function(){var t,e,i,n,s,o,r=this.visible(),h=this.container.getBoundingClientRect();return 1===r.length?(t=h.left-r[0].position().left,i=t+this.layout.spreadWidth,this.mapping.page(r[0].contents,r[0].section.cfiBase,t,i)):r.length>1?(t=h.left-r[0].position().left,i=t+this.layout.columnWidth,e=h.left+this.layout.spreadWidth-r[r.length-1].position().left,n=e+this.layout.columnWidth,s=this.mapping.page(r[0].contents,r[0].section.cfiBase,t,i),o=this.mapping.page(r[r.length-1].contents,r[r.length-1].section.cfiBase,e,n),{start:s.start,end:o.end}):void 0},n.prototype.updateLayout=function(){this.stage&&("vertical"===this.settings.axis?this.layout.calculate(this._stageSize.width,this._stageSize.height):(this.layout.calculate(this._stageSize.width,this._stageSize.height,this.settings.gap),
|
|
this.settings.offset=this.layout.delta,this.stage.addStyleRules("iframe",[{"margin-right":this.layout.gap+"px"}])),this.viewSettings.width=this.layout.width,this.viewSettings.height=this.layout.height,this.setLayout(this.layout))},n.prototype.next=function(){"horizontal"===this.settings.axis?(this.scrollLeft=this.container.scrollLeft,this.container.scrollLeft+this.container.offsetWidth+this.layout.delta<this.container.scrollWidth?this.scrollBy(this.layout.delta,0):this.scrollTo(this.container.scrollWidth-this.layout.delta,0)):this.scrollBy(0,this.layout.height)},n.prototype.prev=function(){"horizontal"===this.settings.axis?this.scrollBy(-this.layout.delta,0):this.scrollBy(0,-this.layout.height)},n.prototype.updateFlow=function(t){var e="paginated"===t?"horizontal":"vertical";this.settings.axis=e,this.viewSettings.axis=e,this.settings.overflow="paginated"===t?"hidden":"auto","vertical"===this.settings.axis?this.settings.infinite=!0:this.settings.infinite=!1},t.exports=n},function(t,e,i){function n(t,e){this.settings=o.extend({ignoreClass:"",axis:"vertical",width:0,height:0,layout:void 0,globalLayoutProperties:{}},e||{}),this.id="epubjs-view-"+o.uuid(),this.section=t,this.index=t.index,this.element=this.container(this.settings.axis),this.added=!1,this.displayed=!1,this.rendered=!1,this.width=this.settings.width,this.height=this.settings.height,this.fixedWidth=0,this.fixedHeight=0,this.epubcfi=new r,this.layout=this.settings.layout}var s=i(3),o=i(0),r=i(1),h=i(10);n.prototype.container=function(t){var e=document.createElement("div");return e.classList.add("epub-view"),e.style.height="0px",e.style.width="0px",e.style.overflow="hidden",t&&"horizontal"==t?e.style.display="inline-block":e.style.display="block",e},n.prototype.create=function(){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.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.appendChild(this.iframe),this.added=!0,this.elementBounds=o.bounds(this.element),"srcdoc"in this.iframe?this.supportsSrcdoc=!0:this.supportsSrcdoc=!1,this.iframe)},n.prototype.render=function(t,e){return this.create(),this.size(),this.sectionRender||(this.sectionRender=this.section.render(t)),this.sectionRender.then(function(t){return this.load(t)}.bind(this)).then(function(){}.bind(this)).then(function(){this.settings.layout.format(this.contents),this.expand(),this.addListeners(),this.emit("rendered",this.section)}.bind(this))["catch"](function(t){console.error(t),this.emit("loaderror",t)}.bind(this))},n.prototype.size=function(t,e){var i=t||this.settings.width,n=e||this.settings.height;"pre-paginated"===this.layout.name?this.lock("both",i,n):"horizontal"===this.settings.axis?this.lock("height",i,n):this.lock("width",i,n)},n.prototype.lock=function(t,e,i){var n,s=o.borders(this.element);n=this.iframe?o.borders(this.iframe):{width:0,height:0},"width"==t&&o.isNumber(e)&&(this.lockedWidth=e-s.width-n.width,this.resize(this.lockedWidth,e)),"height"==t&&o.isNumber(i)&&(this.lockedHeight=i-s.height-n.height,this.resize(e,this.lockedHeight)),"both"===t&&o.isNumber(e)&&o.isNumber(i)&&(this.lockedWidth=e-s.width-n.width,this.lockedHeight=i-s.height-n.height,this.resize(this.lockedWidth,this.lockedHeight)),this.displayed&&this.iframe&&this.expand()},n.prototype.expand=function(t){var e,i,n,s=this.lockedWidth,o=this.lockedHeight;this.iframe&&!this._expanding&&(this._expanding=!0,"horizontal"===this.settings.axis?(i=this.contents.textWidth(),i!=this._textWidth?(s=this.contentWidth(i),e=Math.ceil(s/(this.settings.layout.columnWidth+this.settings.layout.gap)),this.settings.layout.divisor>1&&"reflowable"===this.settings.layout.name&&e%2>0&&(s+=this.settings.layout.gap+this.settings.layout.columnWidth),this._textWidth=i,this._contentWidth=s):s=this._contentWidth):"vertical"===this.settings.axis&&(n=this.contents.textHeight(),n!=this._textHeight?(o=this.contentHeight(n),this._textHeight=n,this._contentHeight=o):o=this._contentHeight),(this._needsReframe||s!=this._width||o!=this._height)&&this.resize(s,o),this._expanding=!1)},n.prototype.contentWidth=function(t){var e,i;return e=this.iframe.style.width,this.iframe.style.width=(t||0)+"px",i=this.contents.scrollWidth(),this.iframe.style.width=e,i},n.prototype.contentHeight=function(t){var e,i;return e=this.iframe.style.height,this.iframe.style.height=(t||0)+"px",i=this.contents.scrollHeight(),this.iframe.style.height=e,i},n.prototype.resize=function(t,e){this.iframe&&(o.isNumber(t)&&(this.iframe.style.width=t+"px",this._width=t),o.isNumber(e)&&(this.iframe.style.height=e+"px",this._height=e),this.iframeBounds=o.bounds(this.iframe),this.reframe(this.iframeBounds.width,this.iframeBounds.height))},n.prototype.reframe=function(t,e){var i;o.isNumber(t)&&(this.element.style.width=t+"px"),o.isNumber(e)&&(this.element.style.height=e+"px"),this.prevBounds=this.elementBounds,this.elementBounds=o.bounds(this.element),i={width:this.elementBounds.width,height:this.elementBounds.height,widthDelta:this.elementBounds.width-this.prevBounds.width,heightDelta:this.elementBounds.height-this.prevBounds.height},this.onResize(this,i),this.emit("resized",i)},n.prototype.load=function(t){var e=new o.defer,i=e.promise;if(!this.iframe)return e.reject(new Error("No Iframe Available")),i;if(this.iframe.onload=function(t){this.onLoad(t,e)}.bind(this),this.supportsSrcdoc)this.iframe.srcdoc=t;else{if(this.document=this.iframe.contentDocument,!this.document)return e.reject(new Error("No Document Available")),i;this.iframe.contentDocument.open(),this.iframe.contentDocument.write(t),this.iframe.contentDocument.close()}return i},n.prototype.onLoad=function(t,e){this.window=this.iframe.contentWindow,this.document=this.iframe.contentDocument,this.contents=new h(this.document,this.document.body,this.section.cfiBase),this.rendering=!1;var i=this.document.querySelector("link[rel='canonical']");i?i.setAttribute("href",this.section.url):(i=this.document.createElement("link"),i.setAttribute("rel","canonical"),i.setAttribute("href",this.section.url),this.document.querySelector("head").appendChild(i)),this.contents.on("expand",function(){this.displayed&&this.iframe&&this.expand()}),e.resolve(this.contents)},n.prototype.setLayout=function(t){this.layout=t},n.prototype.setAxis=function(t){this.settings.axis=t},n.prototype.resizeListenters=function(){clearTimeout(this.expanding),this.expanding=setTimeout(this.expand.bind(this),350)},n.prototype.addListeners=function(){},n.prototype.removeListeners=function(t){},n.prototype.display=function(t){var e=new o.defer;return this.displayed?e.resolve(this):this.render(t).then(function(){this.emit("displayed",this),this.onDisplayed(this),this.displayed=!0,e.resolve(this)}.bind(this)),e.promise},n.prototype.show=function(){this.element.style.visibility="visible",this.iframe&&(this.iframe.style.visibility="visible"),this.emit("shown",this)},n.prototype.hide=function(){this.element.style.visibility="hidden",this.iframe.style.visibility="hidden",this.stopExpanding=!0,this.emit("hidden",this)},n.prototype.position=function(){return this.element.getBoundingClientRect()},n.prototype.locationOf=function(t){var e=this.iframe.getBoundingClientRect(),i=this.contents.locationOf(t,this.settings.ignoreClass);return{left:window.scrollX+e.left+i.left,top:window.scrollY+e.top+i.top}},n.prototype.onDisplayed=function(t){},n.prototype.onResize=function(t,e){},n.prototype.bounds=function(){return this.elementBounds||(this.elementBounds=o.bounds(this.element)),this.elementBounds},n.prototype.destroy=function(){this.displayed&&(this.displayed=!1,this.removeListeners(),this.stopExpanding=!0,this.element.removeChild(this.iframe),this.displayed=!1,this.iframe=null,this._textWidth=null,this._textHeight=null,this._width=null,this._height=null)},s(n.prototype),t.exports=n},function(t,e){function i(t){return t&&s[t.split(".").pop().toLowerCase()]||o}var n={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"}},s=function(){var t,e,i,s,o={};for(t in n)if(n.hasOwnProperty(t))for(e in n[t])if(n[t].hasOwnProperty(e))if(i=n[t][e],"string"==typeof i)o[i]=t+"/"+e;else for(s=0;s<i.length;s++)o[i[s]]=t+"/"+e;return o}(),o="text/plain";t.exports={lookup:i}},function(t,e){"use strict";function i(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function n(t){return 3*t.length/4-i(t)}function s(t){var e,n,s,o,r,h,a=t.length;r=i(t),h=new p(3*a/4-r),s=r>0?a-4:a;var l=0;for(e=0,n=0;e<s;e+=4,n+=3)o=c[t.charCodeAt(e)]<<18|c[t.charCodeAt(e+1)]<<12|c[t.charCodeAt(e+2)]<<6|c[t.charCodeAt(e+3)],h[l++]=o>>16&255,h[l++]=o>>8&255,h[l++]=255&o;return 2===r?(o=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,h[l++]=255&o):1===r&&(o=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,h[l++]=o>>8&255,h[l++]=255&o),h}function o(t){return a[t>>18&63]+a[t>>12&63]+a[t>>6&63]+a[63&t]}function r(t,e,i){for(var n,s=[],r=e;r<i;r+=3)n=(t[r]<<16)+(t[r+1]<<8)+t[r+2],s.push(o(n));return s.join("")}function h(t){for(var e,i=t.length,n=i%3,s="",o=[],h=16383,c=0,p=i-n;c<p;c+=h)o.push(r(t,c,c+h>p?p:c+h));return 1===n?(e=t[i-1],s+=a[e>>2],s+=a[e<<4&63],s+="=="):2===n&&(e=(t[i-2]<<8)+t[i-1],s+=a[e>>10],s+=a[e>>4&63],s+=a[e<<2&63],s+="="),o.push(s),o.join("")}e.byteLength=n,e.toByteArray=s,e.fromByteArray=h;for(var a=[],c=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,d=l.length;u<d;++u)a[u]=l[u],c[l.charCodeAt(u)]=u;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},function(t,e,i){"use strict";var n,s=i(22),o=i(29),r=i(25),h=i(32);n=t.exports=function(t,e){var i,n,r,a,c;return arguments.length<2||"string"!=typeof t?(a=e,e=t,t=null):a=arguments[2],null==t?(i=r=!0,n=!1):(i=h.call(t,"c"),n=h.call(t,"e"),r=h.call(t,"w")),c={value:e,configurable:i,enumerable:n,writable:r},a?s(o(a),c):c},n.gs=function(t,e,i){var n,a,c,p;return"string"!=typeof t?(c=i,i=e,e=t,t=null):c=arguments[3],null==e?e=void 0:r(e)?null==i?i=void 0:r(i)||(c=i,i=void 0):(c=e,e=i=void 0),null==t?(n=!0,a=!1):(n=h.call(t,"c"),a=h.call(t,"e")),p={get:e,set:i,configurable:n,enumerable:a},c?s(o(c),p):p}},function(t,e,i){"use strict";t.exports=i(23)()?Object.assign:i(24)},function(t,e){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(t={foo:"raz"},e(t,{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,i){"use strict";var n=i(26),s=i(31),o=Math.max;t.exports=function(t,e){var i,r,h,a=o(arguments.length,2);for(t=Object(s(t)),h=function(n){try{t[n]=e[n]}catch(s){i||(i=s)}},r=1;r<a;++r)e=arguments[r],n(e).forEach(h);if(void 0!==i)throw i;return t}},function(t,e){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,i){"use strict";t.exports=i(27)()?Object.keys:i(28)},function(t,e){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e){"use strict";var i=Object.keys;t.exports=function(t){return i(null==t?t:Object(t))}},function(t,e){"use strict";var i=Array.prototype.forEach,n=Object.create,s=function(t,e){var i;for(i in t)e[i]=t[i]};t.exports=function(t){var e=n(null);return i.call(arguments,function(t){null!=t&&s(Object(t),e)}),e}},function(t,e){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e){"use strict";t.exports=function(t){if(null==t)throw new TypeError("Cannot use null or undefined");return t}},function(t,e,i){"use strict";t.exports=i(33)()?String.prototype.contains:i(34)},function(t,e){"use strict";var i="razdwatrzy";t.exports=function(){return"function"==typeof i.contains&&(i.contains("dwa")===!0&&i.contains("foo")===!1)}},function(t,e){"use strict";var i=String.prototype.indexOf;t.exports=function(t){return i.call(this,t,arguments[1])>-1}},,function(t,e,i){function n(){this.zip=void 0,this.checkRequirements(),this.urlCache={}}var s=i(0),o=i(9),r=i(19),h=i(0).Path;n.prototype.checkRequirements=function(){try{"undefined"==typeof JSZip&&(JSZip=i(48)),this.zip=new JSZip}catch(t){console.error("JSZip lib not loaded")}},n.prototype.open=function(t,e){return this.zip.loadAsync(t,{base64:e})},n.prototype.openUrl=function(t,e){return o(t,"binary").then(function(t){return this.zip.loadAsync(t,{base64:e})}.bind(this))},n.prototype.request=function(t,e){var i,n=new s.defer,o=new h(t);return e||(e=o.extension),i="blob"==e?this.getBlob(t):this.getText(t),i?i.then(function(t){result=this.handleResponse(t,e),n.resolve(result)}.bind(this)):n.reject({message:"File not found in the epub: "+t,stack:(new Error).stack}),n.promise},n.prototype.handleResponse=function(t,e){var i;return i="json"==e?JSON.parse(t):s.isXml(e)?s.parse(t,"text/xml"):"xhtml"==e?s.parse(t,"application/xhtml+xml"):"html"==e||"htm"==e?s.parse(t,"text/html"):t},n.prototype.getBlob=function(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return e=e||r.lookup(n.name),n.async("uint8array").then(function(t){return new Blob([t],{type:e})})},n.prototype.getText=function(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return n.async("string").then(function(t){return t})},n.prototype.getBase64=function(t,e){var i=window.decodeURIComponent(t.substr(1)),n=this.zip.file(i);if(n)return e=e||r.lookup(n.name),n.async("base64").then(function(t){return"data:"+e+";base64,"+t})},n.prototype.createUrl=function(t,e){var i,n,o=new s.defer,r=window.URL||window.webkitURL||window.mozURL,h=e&&e.base64;return t in this.urlCache?(o.resolve(this.urlCache[t]),o.promise):(h?(n=this.getBase64(t),n&&n.then(function(e){this.urlCache[t]=e,o.resolve(e)}.bind(this))):(n=this.getBlob(t),n&&n.then(function(e){i=r.createObjectURL(e),this.urlCache[t]=i,o.resolve(i)}.bind(this))),n||o.reject({message:"File not found in the epub: "+t,stack:(new Error).stack}),o.promise)},n.prototype.revokeUrl=function(t){var e=window.URL||window.webkitURL||window.mozURL,i=this.urlCache[t];i&&e.revokeObjectURL(i)},t.exports=n},function(t,e,i){function n(t){t&&this.parse(t)}var s=i(2),o=i(0);i(1);n.prototype.parse=function(t){var e;return t?(e=o.qs(t,"rootfile"))?(this.packagePath=e.getAttribute("full-path"),this.directory=s.dirname(this.packagePath),void(this.encoding=t.xmlEncoding)):void console.error("No RootFile Found"):void console.error("Container File Not Found")},t.exports=n},function(t,e,i){function n(t){this.name=t.layout||"reflowable",this._spread="none"!==t.spread,this._minSpreadWidth=t.minSpreadWidth||800,this._evenSpreads=t.evenSpreads||!1,"scrolled-continuous"===t.flow||"scrolled-doc"===t.flow?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}i(0);n.prototype.flow=function(t){this._flow="paginated"===t?"paginated":"scrolled"},n.prototype.spread=function(t,e){this._spread="none"!==t,e>=0&&(this._minSpreadWidth=e)},n.prototype.calculate=function(t,e,i){var n,s,o,r=1,h=i||0,a=(Math.floor(t),t),c=Math.floor(a/8);r=this._spread&&a>=this._minSpreadWidth?2:1,"reflowable"!==this.name||"paginated"!==this._flow||i>=0||(h=c%2===0?c:c-1),"pre-paginated"===this.name&&(h=0),n=r>1?Math.floor((a-h)/r):a,"pre-paginated"===this.name&&r>1&&(a=n),s=n*r,o=(n+h)*r,this.width=a,this.height=e,this.spreadWidth=s,this.delta=o,this.columnWidth=n,this.gap=h,this.divisor=r},n.prototype.format=function(t){var e;return e="pre-paginated"===this.name?t.fit(this.columnWidth,this.height):"paginated"===this._flow?t.columns(this.width,this.height,this.columnWidth,this.gap):t.size(this.width,null)},n.prototype.count=function(t){var e=Math.ceil(t/this.spreadWidth);return{spreads:e,pages:e*this.divisor}},t.exports=n},function(t,e,i){function n(t,e){this.spine=t,this.request=e,this.q=new o(this),this.epubcfi=new r,this._locations=[],this.total=0,this["break"]=150,this._current=0}var s=i(0),o=i(7),r=i(1),h=i(3);n.prototype.generate=function(t){return t&&(this["break"]=t),this.q.pause(),this.spine.each(function(t){this.q.enqueue(this.process,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))},n.prototype.process=function(t){return t.load(this.request).then(function(e){var i,n=e.ownerDocument,s=0;this.sprint(e,function(e){var o,r=e.length,h=0;for(0==s&&(i=n.createRange(),i.setStart(e,0)),o=this["break"]-s,o>r&&(s+=r,h=r);h<r;)s=this["break"],h+=this["break"],h>=r?s=r-(h-this["break"]):(i.setEnd(e,h),cfi=t.cfiFromRange(i),this._locations.push(cfi),s=0,h+=1,i=n.createRange(),i.setStart(e,h))}.bind(this)),i&&(i.setEnd(prev,prev.length),cfi=t.cfiFromRange(i),this._locations.push(cfi),s=0)}.bind(this))},n.prototype.sprint=function(t,e){for(var i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null,!1);node=i.nextNode();)e(node)},n.prototype.locationFromCfi=function(t){return 0===this._locations.length?-1:s.locationOf(t,this._locations,this.epubcfi.compare)},n.prototype.precentageFromCfi=function(t){var e=this.locationFromCfi(t);return this.precentageFromLocation(e)},n.prototype.percentageFromLocation=function(t){return t&&this.total?t/this.total:0},n.prototype.cfiFromLocation=function(t){var e=-1;return"number"!=typeof t&&(t=parseInt(pg)),t>=0&&t<this._locations.length&&(e=this._locations[t]),e},n.prototype.cfiFromPercentage=function(t){var e=t>1?t/100:t,i=Math.ceil(this.total*e);return this.cfiFromLocation(i)},n.prototype.load=function(t){return this._locations=JSON.parse(t),this.total=this._locations.length-1,this._locations},n.prototype.save=function(t){return JSON.stringify(this._locations)},n.prototype.getCurrent=function(t){return this._current},n.prototype.setCurrent=function(t){var e;if("string"==typeof t)this._currentCfi=t;else{if("number"!=typeof t)return;this._current=t}0!==this._locations.length&&("string"==typeof t?(e=this.locationFromCfi(t),this._current=e):e=t,this.emit("changed",{percentage:this.precentageFromLocation(e)}))},Object.defineProperty(n.prototype,"currentLocation",{get:function(){return this._current},set:function(t){this.setCurrent(t)}}),h(n.prototype),t.exports=n},function(t,e,i){function n(t){this.settings=t||{},this.id="epubjs-container-"+s.uuid(),this.container=this.create(this.settings),this.settings.hidden&&(this.wrapper=this.wrap(this.container))}var s=i(0);n.prototype.create=function(t){var e=t.height,i=t.width,n=t.overflow||!1,o=t.axis||"vertical";return t.height&&s.isNumber(t.height)&&(e=t.height+"px"),t.width&&s.isNumber(t.width)&&(i=t.width+"px"),container=document.createElement("div"),container.id=this.id,container.classList.add("epub-container"),container.style.wordSpacing="0",container.style.lineHeight="0",container.style.verticalAlign="top","horizontal"===o&&(container.style.whiteSpace="nowrap"),i&&(container.style.width=i),e&&(container.style.height=e),n&&(container.style.overflow=n),container},n.wrap=function(t){var e=document.createElement("div");return e.style.visibility="hidden",e.style.overflow="hidden",e.style.width="0",e.style.height="0",e.appendChild(t),e},n.prototype.getElement=function(t){var e;return s.isElement(t)?e=t:"string"==typeof t&&(e=document.getElementById(t)),e?e:void console.error("Not an Element")},n.prototype.attachTo=function(t){var e,i=this.getElement(t);if(i)return e=this.settings.hidden?this.wrapper:this.container,i.appendChild(e),this.element=i,i},n.prototype.getContainer=function(){return this.container},n.prototype.onResize=function(t){s.isNumber(this.settings.width)&&s.isNumber(this.settings.height)||window.addEventListener("resize",t,!1)},n.prototype.size=function(t,e){var i;return null===t&&(i=this.element.getBoundingClientRect(),i.width&&(t=i.width,this.container.style.width=i.width+"px")),null===e&&(i=i||this.element.getBoundingClientRect(),i.height&&(e=i.height,this.container.style.height=i.height+"px")),s.isNumber(t)||(i=this.container.getBoundingClientRect(),t=i.width),s.isNumber(e)||(i=i||this.container.getBoundingClientRect(),e=i.height),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},{width:t-this.containerPadding.left-this.containerPadding.right,height:e-this.containerPadding.top-this.containerPadding.bottom}},n.prototype.bounds=function(){return this.container?this.container.getBoundingClientRect():s.windowBounds()},n.prototype.getSheet=function(){var t=document.createElement("style");return t.appendChild(document.createTextNode("")),document.head.appendChild(t),t.sheet},n.prototype.addStyleRules=function(t,e){var i="#"+this.id+" ",n="";this.sheet||(this.sheet=this.getSheet()),e.forEach(function(t){for(var e in t)t.hasOwnProperty(e)&&(n+=e+":"+t[e]+";")}),this.sheet.insertRule(i+t+" {"+n+"}",0)},t.exports=n},function(t,e){function i(t){this.container=t,this._views=[],this.length=0,this.hidden=!1}i.prototype.all=function(){return this._views},i.prototype.first=function(){return this._views[0]},i.prototype.last=function(){return this._views[this._views.length-1]},i.prototype.indexOf=function(t){return this._views.indexOf(t)},i.prototype.slice=function(){return this._views.slice.apply(this._views,arguments)},i.prototype.get=function(t){return this._views[t]},i.prototype.append=function(t){return this._views.push(t),this.container&&this.container.appendChild(t.element),this.length++,t},i.prototype.prepend=function(t){return this._views.unshift(t),this.container&&this.container.insertBefore(t.element,this.container.firstChild),this.length++,t},i.prototype.insert=function(t,e){return this._views.splice(e,0,t),this.container&&(e<this.container.children.length?this.container.insertBefore(t.element,this.container.children[e]):this.container.appendChild(t.element)),this.length++,t},i.prototype.remove=function(t){var e=this._views.indexOf(t);e>-1&&this._views.splice(e,1),this.destroy(t),this.length--},i.prototype.destroy=function(t){t.displayed&&t.destroy(),this.container&&this.container.removeChild(t.element),t=null},i.prototype.each=function(){return this._views.forEach.apply(this._views,arguments)},i.prototype.clear=function(){var t,e=this.length;if(this.length){for(var i=0;i<e;i++)t=this._views[i],this.destroy(t);this._views=[],this.length=0}},i.prototype.find=function(t){for(var e,i=this.length,n=0;n<i;n++)if(e=this._views[n],e.displayed&&e.section.index==t.index)return e},i.prototype.displayed=function(){for(var t,e=[],i=this.length,n=0;n<i;n++)t=this._views[n],t.displayed&&e.push(t);return e},i.prototype.show=function(){for(var t,e=this.length,i=0;i<e;i++)t=this._views[i],t.displayed&&t.show();this.hidden=!1},i.prototype.hide=function(){for(var t,e=this.length,i=0;i<e;i++)t=this._views[i],t.displayed&&t.hide();this.hidden=!0},t.exports=i},function(t,e,i){function n(t){this.toc=[],this.tocByHref={},this.tocById={},t&&this.parse(t)}var s=i(0);i(2);n.prototype.parse=function(t){var e=s.qs(t,"html"),i=s.qs(t,"ncx");e?this.toc=this.parseNav(t):i&&(this.toc=this.parseNcx(t)),this.unpack(this.toc)},n.prototype.unpack=function(t){for(var e,i=0;i<t.length;i++)e=t[i],this.tocByHref[e.href]=i,this.tocById[e.id]=i},n.prototype.get=function(t){var e;return t?(0===t.indexOf("#")?e=this.tocById[t.substring(1)]:t in this.tocByHref&&(e=this.tocByHref[t]),this.toc[e]):this.toc},n.prototype.parseNav=function(t){var e,i,n,o=s.querySelectorByType(t,"nav","toc"),r=o?s.qsa(o,"li"):[],h=r.length,a={},c=[];if(!r||0===h)return c;for(e=0;e<h;++e)i=this.navItem(r[e]),a[i.id]=i,i.parent?(n=a[i.parent],n.subitems.push(i)):c.push(i);return c},n.prototype.navItem=function(t){var e,i=t.getAttribute("id")||!1,n=s.qs(t,"a"),o=n.getAttribute("href")||"",r=n.textContent||"",h=[],a=t.parentNode;return a&&"navPoint"===a.nodeName&&(e=a.getAttribute("id")),{id:i,href:o,label:r,subitems:h,parent:e}},n.prototype.parseNcx=function(t){var e,i,n,o=s.qsa(t,"navPoint"),r=o.length,h={},a=[];if(!o||0===r)return a;for(e=0;e<r;++e)i=this.ncxItem(o[e]),h[i.id]=i,i.parent?(n=h[i.parent],n.subitems.push(i)):a.push(i);return a},n.prototype.ncxItem=function(t){var e,i=t.getAttribute("id")||!1,n=s.qs(t,"content"),o=n.getAttribute("src"),r=s.qs(t,"navLabel"),h=r.textContent?r.textContent:"",a=[],c=t.parentNode;return c&&"navPoint"===c.nodeName&&(e=c.getAttribute("id")),{id:i,href:o,label:h,subitems:a,parent:e}},t.exports=n},function(t,e,i){function n(t){t&&this.parse(t)}var s=(i(2),i(0)),o=i(1);n.prototype.parse=function(t){var e,i,n;return t?(e=s.qs(t,"metadata"))?(i=s.qs(t,"manifest"))?(n=s.qs(t,"spine"))?(this.manifest=this.parseManifest(i),this.navPath=this.findNavPath(i),this.ncxPath=this.findNcxPath(i,n),this.coverPath=this.findCoverPath(t),this.spineNodeIndex=Array.prototype.indexOf.call(n.parentNode.childNodes,n),this.spine=this.parseSpine(n,this.manifest),this.metadata=this.parseMetadata(e),this.metadata.direction=n.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}):void console.error("No Spine Found"):void console.error("No Manifest Found"):void console.error("No Metadata Found"):void console.error("Package File Not Found")},n.prototype.parseMetadata=function(t){var e={};return e.title=this.getElementText(t,"title"),e.creator=this.getElementText(t,"creator"),e.description=this.getElementText(t,"description"),e.pubdate=this.getElementText(t,"date"),e.publisher=this.getElementText(t,"publisher"),e.identifier=this.getElementText(t,"identifier"),e.language=this.getElementText(t,"language"),e.rights=this.getElementText(t,"rights"),e.modified_date=this.getPropertyText(t,"dcterms:modified"),e.layout=this.getPropertyText(t,"rendition:layout"),e.orientation=this.getPropertyText(t,"rendition:orientation"),e.flow=this.getPropertyText(t,"rendition:flow"),e.viewport=this.getPropertyText(t,"rendition:viewport"),e},n.prototype.parseManifest=function(t){var e={},i=s.qsa(t,"item"),n=Array.prototype.slice.call(i);return n.forEach(function(t){var i=t.getAttribute("id"),n=t.getAttribute("href")||"",s=t.getAttribute("media-type")||"",o=t.getAttribute("properties")||"";e[i]={href:n,type:s,properties:o.length?o.split(" "):[]}}),e},n.prototype.parseSpine=function(t,e){var i=[],n=t.getElementsByTagName("itemref"),s=Array.prototype.slice.call(n);new o;return s.forEach(function(t,e){var n=t.getAttribute("idref"),s=t.getAttribute("properties")||"",o=s.length?s.split(" "):[],r={idref:n,linear:t.getAttribute("linear")||"",properties:o,index:e};i.push(r)}),i},n.prototype.findNavPath=function(t){var e=s.qsp(t,"item",{properties:"nav"});return!!e&&e.getAttribute("href")},n.prototype.findNcxPath=function(t,e){var i,n=s.qsp(t,"item",{"media-type":"application/x-dtbncx+xml"});return n||(i=e.getAttribute("toc"),i&&(n=t.getElementById(i))),!!n&&n.getAttribute("href")},n.prototype.findCoverPath=function(t){var e=s.qs(t,"package"),i=e.getAttribute("version");if("2.0"===i){var n=s.qsp(t,"meta",{name:"cover"});if(n){var o=n.getAttribute("content"),r=t.getElementById(o);return!!r&&r.getAttribute("href")}return!1}var h=s.qsp(t,"item",{properties:"cover-image"});return!!h&&h.getAttribute("href")},n.prototype.getElementText=function(t,e){var i,n=t.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/",e);return n&&0!==n.length?(i=n[0],i.childNodes.length?i.childNodes[0].nodeValue:""):""},n.prototype.getPropertyText=function(t,e){var i=s.qsp(t,"meta",{property:e});return i&&i.childNodes.length?i.childNodes[0].nodeValue:""},t.exports=n},function(t,e,i){function n(t){this.pages=[],this.locations=[],this.epubcfi=new s,t&&(this.pageList=this.parse(t)),this.pageList&&this.pageList.length&&this.process(this.pageList)}var s=i(1),o=i(0);n.prototype.parse=function(t){var e=o.qs(t,"html");if(e)this.toc=this.parseNav(t);else if(ncx)return},n.prototype.parseNav=function(t){var e,i,n=o.querySelectorByType(t,"nav","page-list"),s=n?o.qsa(n,"li"):[],r=s.length,h=[];if(!s||0===r)return h;for(e=0;e<r;++e)i=this.item(s[e]),h.push(i);return h},n.prototype.item=function(t){var e,i,n,s=(t.getAttribute("id")||!1,o.qs(t,"a")),r=s.getAttribute("href")||"",h=s.textContent||"",a=parseInt(h),c=r.indexOf("epubcfi");return c!=-1?(e=r.split("#"),i=e[0],n=e.length>1&&e[1],{cfi:n,href:r,packageUrl:i,page:a}):{href:r,page:a}},n.prototype.process=function(t){t.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},n.prototype.addCFIs=function(){this.pageList.forEach(function(t){!t.cfi})},n.prototype.pageFromCfi=function(t){var e=-1;if(0===this.locations.length)return-1;var i=o.indexOfSorted(t,this.locations,this.epubcfi.compare);return i!=-1?e=this.pages[i]:(i=EPUBJS.core.locationOf(t,this.locations,this.epubcfi.compare),e=i-1>=0?this.pages[i-1]:this.pages[0],void 0!==e||(e=-1)),e},n.prototype.cfiFromPage=function(t){var e=-1;"number"!=typeof t&&(t=parseInt(t));
|
|
var i=this.pages.indexOf(t);return i!=-1&&(e=this.locations[i]),e},n.prototype.pageFromPercentage=function(t){var e=Math.round(this.totalPages*t);return e},n.prototype.percentageFromPage=function(t){var e=(t-this.firstPage)/this.totalPages;return Math.round(1e3*e)/1e3},n.prototype.percentageFromCfi=function(t){var e=this.pageFromCfi(t),i=this.percentageFromPage(e);return i},t.exports=n},function(t,e,i){function n(t,e){this.settings={replacements:e&&e.replacements||"base64",archive:e&&e.archive,resolver:e&&e.resolver},this.manifest=t,this.resources=Object.keys(t).map(function(e){return t[e]}),this.replacementUrls=[],this.split(),this.splitUrls()}var s=i(8),o=i(0),r=i(0).Path,h=i(2);n.prototype.split=function(){this.html=this.resources.filter(function(t){if("application/xhtml+xml"===t.type||"text/html"===t.type)return!0}),this.assets=this.resources.filter(function(t){if("application/xhtml+xml"!==t.type&&"text/html"!==t.type)return!0}),this.css=this.resources.filter(function(t){if("text/css"===t.type)return!0})},n.prototype.splitUrls=function(){this.urls=this.assets.map(function(t){return t.href}.bind(this)),this.cssUrls=this.css.map(function(t){return t.href})},n.prototype.replacements=function(t,e){if(t=t||this.settings.archive,e=e||this.settings.resolver,"none"===this.settings.replacements)return new Promise(function(t,e){t(this.urls)}.bind(this));var i=this.urls.map(function(i){var n=e(i);return t.createUrl(n,{base64:"base64"===this.settings.replacements})}.bind(this));return Promise.all(i).then(function(t){return this.replacementUrls=t,t}.bind(this))},n.prototype.replaceCss=function(t,e){var i=[];return t=t||this.settings.archive,e=e||this.settings.resolver,this.cssUrls.forEach(function(n){var s=this.createCssFile(n,t,e).then(function(t){var e=this.urls.indexOf(n);e>-1&&(this.replacementUrls[e]=t)}.bind(this));i.push(s)}.bind(this)),Promise.all(i)},n.prototype.createCssFile=function(t,e,i){var n;if(e=e||this.settings.archive,i=i||this.settings.resolver,h.isAbsolute(t))return new Promise(function(t,e){t(urls,replacementUrls)});var a=i(t),c=e.getText(a),p=this.urls.map(function(t){var e=i(t),n=new r(a).relative(e);return n}.bind(this));return c.then(function(t){return t=s.substitute(t,p,this.replacementUrls),n="base64"===this.settings.replacements?o.createBase64Url(t,"text/css"):o.createBlobUrl(t,"text/css")}.bind(this))},n.prototype.relativeTo=function(t,e){return e=e||this.settings.resolver,this.urls.map(function(i){var n=e(i),s=new r(t).relative(n);return s}.bind(this))},n.prototype.get=function(t){var e=this.urls.indexOf(t);if(e!==-1)return this.replacementUrls.length?new Promise(function(t,i){t(this.replacementUrls[e])}.bind(this)):archive.createUrl(absolute,{base64:"base64"===this.settings.replacements})},t.exports=n},function(t,e,i){function n(t,e){this.idref=t.idref,this.linear=t.linear,this.properties=t.properties,this.index=t.index,this.href=t.href,this.url=t.url,this.next=t.next,this.prev=t.prev,this.cfiBase=t.cfiBase,e?this.hooks=e:(this.hooks={},this.hooks.serialize=new r(this),this.hooks.content=new r(this))}var s=i(0),o=i(1),r=i(5),h=i(0).Url;n.prototype.load=function(t){var e=t||this.request||i(9),n=new s.defer,o=n.promise;return this.contents?n.resolve(this.contents):e(this.url).then(function(t){new h(this.url).directory;return this.document=t,this.contents=t.documentElement,this.hooks.content.trigger(this.document,this)}.bind(this)).then(function(){n.resolve(this.contents)}.bind(this))["catch"](function(t){n.reject(t)}),o},n.prototype.base=function(t){var e,i=new s.defer,n=t.createElement("base");return n.setAttribute("href",window.location.origin+"/"+this.url),t&&(e=t.querySelector("head")),e?(e.insertBefore(n,e.firstChild),i.resolve()):i.reject(new Error("No head to insert into")),i.promise},n.prototype.render=function(t){var e=new s.defer,n=e.promise;return this.output,this.load(t).then(function(t){var e;return"undefined"==typeof XMLSerializer&&(XMLSerializer=i(13).XMLSerializer),e=new XMLSerializer,this.output=e.serializeToString(t),this.output}.bind(this)).then(function(){return this.hooks.serialize.trigger(this.output,this)}.bind(this)).then(function(){e.resolve(this.output)}.bind(this))["catch"](function(t){e.reject(t)}),n},n.prototype.find=function(t){},n.prototype.reconcileLayoutSettings=function(t){var e={layout:t.layout,spread:t.spread,orientation:t.orientation};return this.properties.forEach(function(t){var i,n,s=t.replace("rendition:",""),o=s.indexOf("-");o!=-1&&(i=s.slice(0,o),n=s.slice(o+1),e[i]=n)}),e},n.prototype.cfiFromRange=function(t){return new o(t,this.cfiBase).toString()},n.prototype.cfiFromElement=function(t){return new o(t,this.cfiBase).toString()},t.exports=n},function(t,e,i){function n(){this.spineItems=[],this.spineByHref={},this.spineById={},this.hooks={},this.hooks.serialize=new o,this.hooks.content=new o,this.hooks.content.register(h.base),this.hooks.content.register(h.canonical),this.epubcfi=new s,this.loaded=!1}var s=(i(0),i(1)),o=i(5),r=i(46),h=i(8);n.prototype.unpack=function(t,e){this.items=t.spine,this.manifest=t.manifest,this.spineNodeIndex=t.spineNodeIndex,this.baseUrl=t.baseUrl||t.basePath||"",this.length=this.items.length,this.items.forEach(function(t,i){var n,s=this.manifest[t.idref];t.cfiBase=this.epubcfi.generateChapterComponent(this.spineNodeIndex,t.index,t.idref),s&&(t.href=s.href,t.url=e(t.href,!0),s.properties.length&&t.properties.push.apply(t.properties,s.properties)),t.prev=function(){return this.get(i-1)}.bind(this),t.next=function(){return this.get(i+1)}.bind(this),n=new r(t,this.hooks),this.append(n)}.bind(this)),this.loaded=!0},n.prototype.get=function(t){var e=0;return this.epubcfi.isCfiString(t)?(cfi=new s(t),e=cfi.spinePos):!t||"number"!=typeof t&&isNaN(t)!==!1?t&&0===t.indexOf("#")?e=this.spineById[t.substring(1)]:t&&(t=t.split("#")[0],e=this.spineByHref[t]):e=t,this.spineItems[e]||null},n.prototype.append=function(t){var e=this.spineItems.length;return t.index=e,this.spineItems.push(t),this.spineByHref[t.href]=e,this.spineById[t.idref]=e,e},n.prototype.prepend=function(t){this.spineItems.unshift(t);return this.spineByHref[t.href]=0,this.spineById[t.idref]=0,this.spineItems.forEach(function(t,e){t.index=e}),0},n.prototype.remove=function(t){var e=this.spineItems.indexOf(t);if(e>-1)return delete this.spineByHref[t.href],delete this.spineById[t.idref],this.spineItems.splice(e,1)},n.prototype.each=function(){return this.spineItems.forEach.apply(this.spineItems,arguments)},t.exports=n},function(e,i){if("undefined"==typeof t){var n=new Error('Cannot find module "JSZip"');throw n.code="MODULE_NOT_FOUND",n}e.exports=t},,function(t,e,i){function n(t,e){return new s(t,e)}var s=i(16),o=i(1),r=i(12),h=i(10);n.VERSION="0.3.0",n.CFI=o,n.Rendition=r,n.Contents=h,n.ViewManagers={},n.Views={},n.register={manager:function(t,e){return n.ViewManagers[t]=e},view:function(t,e){return n.Views[t]=e}},n.register.view("iframe",i(18)),n.register.manager("default",i(11)),n.register.manager("continuous",i(17)),t.exports=n}])}); |