universalviewer
Version:
The Universal Viewer is an open source project to enable cultural heritage institutions to present their digital artifacts in an IIIF-compliant and highly customisable user interface.
99 lines • 88.2 kB
JavaScript
var DEFAULT_SCALE="auto",DEFAULT_SCALE_DELTA=1.1,UNKNOWN_SCALE=0,CACHE_SIZE=20,CSS_UNITS=96/72,SCROLLBAR_PADDING=40,VERTICAL_PADDING=5,MAX_AUTO_SCALE=1.25,MIN_SCALE=.25,MAX_SCALE=4,VIEW_HISTORY_MEMORY=20,SCALE_SELECT_CONTAINER_PADDING=8,SCALE_SELECT_PADDING=22,THUMBNAIL_SCROLL_MARGIN=-19,USE_ONLY_CSS_ZOOM=!1,CLEANUP_TIMEOUT=3E4,IGNORE_CURRENT_POSITION_ON_ZOOM=!1,RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},FindStates={FIND_FOUND:0,FIND_NOTFOUND:1,FIND_WRAPPED:2,FIND_PENDING:3},mozL10n=
document.mozL10n||document.webL10n,CustomStyle=function(){function a(){}var b=["ms","Moz","Webkit","O"],c={};a.getProp=function(a,e){if(1==arguments.length&&"string"==typeof c[a])return c[a];e=e||document.documentElement;var f=e.style,g,h;if("string"==typeof f[a])return c[a]=a;h=a.charAt(0).toUpperCase()+a.slice(1);for(var k=0,m=b.length;k<m;k++)if(g=b[k]+h,"string"==typeof f[g])return c[a]=g;return c[a]="undefined"};a.setProp=function(a,b,c){a=this.getProp(a);"undefined"!=a&&(b.style[a]=c)};return a}();
function getFileName(a){var b=a.indexOf("#"),c=a.indexOf("?"),b=Math.min(0<b?b:a.length,0<c?c:a.length);return a.substring(a.lastIndexOf("/",b)+1,b)}function getOutputScale(a){a=(window.devicePixelRatio||1)/(a.webkitBackingStorePixelRatio||a.mozBackingStorePixelRatio||a.msBackingStorePixelRatio||a.oBackingStorePixelRatio||a.backingStorePixelRatio||1);return{sx:a,sy:a,scaled:1!=a}}
function scrollIntoView(a,b){var c=a.offsetParent,d=a.offsetTop+a.clientTop,e=a.offsetLeft+a.clientLeft;if(c){for(;c.clientHeight===c.scrollHeight;)if(c.dataset._scaleY&&(d/=c.dataset._scaleY,e/=c.dataset._scaleX),d+=c.offsetTop,e+=c.offsetLeft,c=c.offsetParent,!c)return;b&&(void 0!==b.top&&(d+=b.top),void 0!==b.left&&(e+=b.left,c.scrollLeft=e));c.scrollTop=d}else console.error("offsetParent is not set -- cannot scroll")}function noContextMenuHandler(a){a.preventDefault()}
function getPDFFileNameFromURL(a){var b=/[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i;a=/^(?:([^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(a);if(a=b.exec(a[1])||b.exec(a[2])||b.exec(a[3]))if(a=a[0],-1!=a.indexOf("%"))try{a=b.exec(decodeURIComponent(a))[0]}catch(c){}return a||"document.pdf"}
var ProgressBar=function(){function a(a,c){this.div=document.querySelector(a+" .progress");this.bar=this.div.parentNode;this.height=c.height||100;this.width=c.width||100;this.units=c.units||"%";this.div.style.height=this.height+this.units;this.percent=0}a.prototype={updateBar:function(){this._indeterminate?(this.div.classList.add("indeterminate"),this.div.style.width=this.width+this.units):(this.div.classList.remove("indeterminate"),this.div.style.width=this.width*this._percent/100+this.units)},get percent(){return this._percent},
set percent(a){this._indeterminate=isNaN(a);this._percent=Math.min(Math.max(a,0),100);this.updateBar()},setWidth:function(a){a&&(a=a.parentNode.offsetWidth-a.offsetWidth,0<a&&this.bar.setAttribute("style","width: calc(100% - "+a+"px);"))},hide:function(){this.bar.classList.add("hidden");this.bar.removeAttribute("style")}};return a}(),Cache=function(a){var b=[];this.push=function(c){var d=b.indexOf(c);0<=d&&b.splice(d);b.push(c);b.length>a&&b.shift().destroy()}},DEFAULT_PREFERENCES={showPreviousViewOnLoad:!0,
defaultZoomValue:"",ifAvailableShowOutlineOnLoad:!1,enableHandToolOnLoad:!1,enableWebGL:!1},Preferences={prefs:Object.create(DEFAULT_PREFERENCES),isInitializedPromiseResolved:!1,initializedPromise:null,initialize:function(){return this.initializedPromise=this._readFromStorage(DEFAULT_PREFERENCES).then(function(a){this.isInitializedPromiseResolved=!0;a&&(this.prefs=a)}.bind(this))},reset:function(){return this.initializedPromise.then(function(){this.prefs=Object.create(DEFAULT_PREFERENCES);return this._writeToStorage(DEFAULT_PREFERENCES)}.bind(this))},
reload:function(){return this.initializedPromise.then(function(){this._readFromStorage(DEFAULT_PREFERENCES).then(function(a){a&&(this.prefs=a)}.bind(this))}.bind(this))},set:function(a,b){return this.initializedPromise.then(function(){if(void 0===DEFAULT_PREFERENCES[a])throw Error("preferencesSet: '"+a+"' is undefined.");if(void 0===b)throw Error("preferencesSet: no value is specified.");var c=typeof b,d=typeof DEFAULT_PREFERENCES[a];if(c!==d)if("number"===c&&"string"===d)b=b.toString();else throw Error("Preferences_set: '"+
b+"' is a \""+c+'", expected "'+d+'".');else if("number"===c&&(b|0)!==b)throw Error("Preferences_set: '"+b+'\' must be an "integer".');this.prefs[a]=b;return this._writeToStorage(this.prefs)}.bind(this))},get:function(a){return this.initializedPromise.then(function(){var b=DEFAULT_PREFERENCES[a];if(void 0===b)throw Error("preferencesGet: '"+a+"' is undefined.");var c=this.prefs[a];return void 0!==c?c:b}.bind(this))},_writeToStorage:function(a){return new Promise(function(b){localStorage.setItem("pdfjs.preferences",
JSON.stringify(a));b()})},_readFromStorage:function(a){return new Promise(function(a){var c=JSON.parse(localStorage.getItem("pdfjs.preferences"));a(c)})}};
(function(){function a(a){var b=document.createEvent("CustomEvent");b.initCustomEvent(a,!1,!1,"custom");window.dispatchEvent(b)}function b(){if(e)if(d(),++f<e.length){var a=e[f];"function"===typeof a.mozPrintCallback?a.mozPrintCallback({context:a.getContext("2d"),abort:c,done:b}):b()}else d(),g.call(window),setTimeout(c,20)}function c(){e&&(e=null,d(),a("afterprint"))}function d(){var a=document.getElementById("mozPrintCallback-shim");if(e){var b=Math.round(100*f/e.length),d=a.querySelector("progress"),
g=a.querySelector(".relative-progress");d.value=b;g.textContent=b+"%";a.removeAttribute("hidden");a.onclick=c}else a.setAttribute("hidden","")}if(!("mozPrintCallback"in document.createElement("canvas"))){HTMLCanvasElement.prototype.mozPrintCallback=void 0;var e,f,g=window.print;window.print=function(){if(e)console.warn("Ignored window.print() because of a pending print job.");else try{a("beforeprint")}finally{e=document.querySelectorAll("canvas"),f=-1,b()}};var h=!!document.attachEvent;window.addEventListener("keydown",
function(a){80!==a.keyCode||!a.ctrlKey&&!a.metaKey||a.altKey||a.shiftKey&&!window.chrome&&!window.opera?27===a.keyCode&&e&&c():(window.print(),h||(a.preventDefault(),a.stopImmediatePropagation?a.stopImmediatePropagation():a.stopPropagation()))},!0);h&&document.attachEvent("onkeydown",function(a){a=a||window.event;if(80===a.keyCode&&a.ctrlKey)return a.keyCode=0,!1});if("onbeforeprint"in window){var k=function(a){"custom"!==a.detail&&a.stopImmediatePropagation&&a.stopImmediatePropagation()};window.addEventListener("beforeprint",
k,!1);window.addEventListener("afterprint",k,!1)}}})();
var DownloadManager=function(){function a(a,b){var e=document.createElement("a");e.click?(e.href=a,e.target="_parent","download"in e&&(e.download=b),(document.body||document.documentElement).appendChild(e),e.click(),e.parentNode.removeChild(e)):(window.top===window&&a.split("#")[0]===window.location.href.split("#")[0]&&(e=-1===a.indexOf("?")?"?":"&",a=a.replace(/#|$/,e+"$&")),window.open(a,"_parent"))}function b(){}b.prototype={downloadUrl:function(b,d){PDFJS.isValidUrl(b,!0)&&a(b+"#pdfjs.action=download",
d)},downloadData:function(b,d,e){b=PDFJS.createObjectURL(b,e);a(b,d)},download:function(b,d,e){URL?navigator.msSaveBlob?navigator.msSaveBlob(b,e)||this.downloadUrl(d,e):(b=URL.createObjectURL(b),a(b,e)):this.downloadUrl(d,e)}};return b}(),cache=new Cache(CACHE_SIZE),currentPageNumber=1,ViewHistory=function(){function a(a){this.fingerprint=a;var c;this.isInitializedPromiseResolved=!1;this.initializedPromise=new Promise(function(a){c=a});(function(a){this.isInitializedPromiseResolved=!0;this.initialize(a||
"{}");c()}).call(this,localStorage.getItem("database"))}a.prototype={initialize:function(a){a=JSON.parse(a);"files"in a||(a.files=[]);a.files.length>=VIEW_HISTORY_MEMORY&&a.files.shift();for(var c,d=0,e=a.files.length;d<e;d++)if(a.files[d].fingerprint===this.fingerprint){c=d;break}"number"!==typeof c&&(c=a.files.push({fingerprint:this.fingerprint})-1);this.file=a.files[c];this.database=a},set:function(a,c){if(this.isInitializedPromiseResolved){this.file[a]=c;var d=JSON.stringify(this.database);localStorage.setItem("database",
d)}},get:function(a,c){return this.isInitializedPromiseResolved?this.file[a]||c:c}};return a}(),PDFFindBar={opened:!1,bar:null,toggleButton:null,findField:null,highlightAll:null,caseSensitive:null,findMsg:null,findStatusIcon:null,findPreviousButton:null,findNextButton:null,initialize:function(a){if("undefined"===typeof PDFFindController||null===PDFFindController)throw"PDFFindBar cannot be initialized without a PDFFindController instance.";this.bar=a.bar;this.toggleButton=a.toggleButton;this.findField=
a.findField;this.highlightAll=a.highlightAllCheckbox;this.caseSensitive=a.caseSensitiveCheckbox;this.findMsg=a.findMsg;this.findStatusIcon=a.findStatusIcon;this.findPreviousButton=a.findPreviousButton;this.findNextButton=a.findNextButton;var b=this;this.toggleButton.addEventListener("click",function(){b.toggle()});this.findField.addEventListener("input",function(){b.dispatchEvent("")});this.bar.addEventListener("keydown",function(a){switch(a.keyCode){case 13:a.target===b.findField&&b.dispatchEvent("again",
a.shiftKey);break;case 27:b.close()}});this.findPreviousButton.addEventListener("click",function(){b.dispatchEvent("again",!0)});this.findNextButton.addEventListener("click",function(){b.dispatchEvent("again",!1)});this.highlightAll.addEventListener("click",function(){b.dispatchEvent("highlightallchange")});this.caseSensitive.addEventListener("click",function(){b.dispatchEvent("casesensitivitychange")})},dispatchEvent:function(a,b){var c=document.createEvent("CustomEvent");c.initCustomEvent("find"+
a,!0,!0,{query:this.findField.value,caseSensitive:this.caseSensitive.checked,highlightAll:this.highlightAll.checked,findPrevious:b});return window.dispatchEvent(c)},updateUIState:function(a,b){var c=!1,d="",e="";switch(a){case FindStates.FIND_PENDING:e="pending";break;case FindStates.FIND_NOTFOUND:d=mozL10n.get("find_not_found",null,"Phrase not found");c=!0;break;case FindStates.FIND_WRAPPED:d=b?mozL10n.get("find_reached_top",null,"Reached top of document, continued from bottom"):mozL10n.get("find_reached_bottom",
null,"Reached end of document, continued from top")}c?this.findField.classList.add("notFound"):this.findField.classList.remove("notFound");this.findField.setAttribute("data-status",e);this.findMsg.textContent=d},open:function(){this.opened||(this.opened=!0,this.toggleButton.classList.add("toggled"),this.bar.classList.remove("hidden"));this.findField.select();this.findField.focus()},close:function(){this.opened&&(this.opened=!1,this.toggleButton.classList.remove("toggled"),this.bar.classList.add("hidden"),
PDFFindController.active=!1)},toggle:function(){this.opened?this.close():this.open()}},PDFFindController={startedTextExtraction:!1,extractTextPromises:[],pendingFindMatches:{},active:!1,pageContents:[],pageMatches:[],selected:{pageIdx:-1,matchIdx:-1},offset:{pageIdx:null,matchIdx:null},resumePageIdx:null,state:null,dirtyMatch:!1,findTimeout:null,pdfPageSource:null,integratedFind:!1,initialize:function(a){if("undefined"===typeof PDFFindBar||null===PDFFindBar)throw"PDFFindController cannot be initialized without a PDFFindBar instance";
this.pdfPageSource=a.pdfPageSource;this.integratedFind=a.integratedFind;a=["find","findagain","findhighlightallchange","findcasesensitivitychange"];this.firstPagePromise=new Promise(function(a){this.resolveFirstPage=a}.bind(this));this.handleEvent=this.handleEvent.bind(this);for(var b=0;b<a.length;b++)window.addEventListener(a[b],this.handleEvent)},reset:function(){this.startedTextExtraction=!1;this.extractTextPromises=[];this.active=!1},calcFindMatch:function(a){var b=this.pageContents[a],c=this.state.query,
d=this.state.caseSensitive,e=c.length;if(0!==e){d||(b=b.toLowerCase(),c=c.toLowerCase());for(var d=[],f=-e;;){f=b.indexOf(c,f+e);if(-1===f)break;d.push(f)}this.pageMatches[a]=d;this.updatePage(a);this.resumePageIdx===a&&(this.resumePageIdx=null,this.nextPageMatch())}},extractText:function(){function a(c){e.pdfPageSource.pages[c].getTextContent().then(function(d){d=d.items;for(var h="",k=0;k<d.length;k++)h+=d[k].str;e.pageContents.push(h);b[c](c);c+1<e.pdfPageSource.pages.length&&a(c+1)})}if(!this.startedTextExtraction){this.startedTextExtraction=
!0;this.pageContents=[];for(var b=[],c=0,d=this.pdfPageSource.pdfDocument.numPages;c<d;c++)this.extractTextPromises.push(new Promise(function(a){b.push(a)}));var e=this;a(0)}},handleEvent:function(a){if(null===this.state||"findagain"!==a.type)this.dirtyMatch=!0;this.state=a.detail;this.updateUIState(FindStates.FIND_PENDING);this.firstPagePromise.then(function(){this.extractText();clearTimeout(this.findTimeout);"find"===a.type?this.findTimeout=setTimeout(this.nextMatch.bind(this),250):this.nextMatch()}.bind(this))},
updatePage:function(a){var b=this.pdfPageSource.pages[a];this.selected.pageIdx===a&&b.scrollIntoView();b.textLayer&&b.textLayer.updateMatches()},nextMatch:function(){var a=this.state.findPrevious,b=this.pdfPageSource.page-1,c=this.pdfPageSource.pages.length;this.active=!0;if(this.dirtyMatch){this.dirtyMatch=!1;this.selected.pageIdx=this.selected.matchIdx=-1;this.offset.pageIdx=b;this.offset.matchIdx=null;this.hadMatch=!1;this.resumePageIdx=null;this.pageMatches=[];for(var d=this,b=0;b<c;b++)this.updatePage(b),
b in this.pendingFindMatches||(this.pendingFindMatches[b]=!0,this.extractTextPromises[b].then(function(a){delete d.pendingFindMatches[a];d.calcFindMatch(a)}))}if(""===this.state.query)this.updateUIState(FindStates.FIND_FOUND);else if(!this.resumePageIdx){c=this.offset;if(null!==c.matchIdx){b=this.pageMatches[c.pageIdx].length;if(!a&&c.matchIdx+1<b||a&&0<c.matchIdx){this.hadMatch=!0;c.matchIdx=a?c.matchIdx-1:c.matchIdx+1;this.updateMatch(!0);return}this.advanceOffsetPage(a)}this.nextPageMatch()}},
matchesReady:function(a){var b=this.offset;a=a.length;var c=this.state.findPrevious;if(a)return this.hadMatch=!0,b.matchIdx=c?a-1:0,this.updateMatch(!0),!0;this.advanceOffsetPage(c);return b.wrapped&&(b.matchIdx=null,!this.hadMatch)?(this.updateMatch(!1),!0):!1},nextPageMatch:function(){null!==this.resumePageIdx&&console.error("There can only be one pending page.");do{var a=this.offset.pageIdx,b=this.pageMatches[a];if(!b){this.resumePageIdx=a;break}}while(!this.matchesReady(b))},advanceOffsetPage:function(a){var b=
this.offset,c=this.extractTextPromises.length;b.pageIdx=a?b.pageIdx-1:b.pageIdx+1;b.matchIdx=null;if(b.pageIdx>=c||0>b.pageIdx)b.pageIdx=a?c-1:0,b.wrapped=!0},updateMatch:function(a){var b=FindStates.FIND_NOTFOUND,c=this.offset.wrapped;this.offset.wrapped=!1;a&&(a=this.selected.pageIdx,this.selected.pageIdx=this.offset.pageIdx,this.selected.matchIdx=this.offset.matchIdx,b=c?FindStates.FIND_WRAPPED:FindStates.FIND_FOUND,-1!==a&&a!==this.selected.pageIdx&&this.updatePage(a));this.updateUIState(b,this.state.findPrevious);
-1!==this.selected.pageIdx&&this.updatePage(this.selected.pageIdx,!0)},updateUIState:function(a,b){this.integratedFind?FirefoxCom.request("updateFindControlState",{result:a,findPrevious:b}):PDFFindBar.updateUIState(a,b)}},PDFHistory={initialized:!1,initialDestination:null,initialize:function(a){function b(){var a=c._getPreviousParams(null,!0);a&&(c._pushToHistory(a,!1,!c.current.dest&&c.current.hash!==c.previousHash),c._updatePreviousBookmark());window.removeEventListener("beforeunload",b,!1)}if(!PDFJS.disableHistory&&
!PDFView.isViewerEmbedded){this.initialized=!0;this.reInitialized=!1;this.historyUnlocked=this.allowHashChange=!0;this.previousHash=window.location.hash.substring(1);this.currentBookmark="";this.currentPage=0;this.updatePreviousBookmark=!1;this.previousBookmark="";this.previousPage=0;this.nextHashParam="";this.fingerprint=a;this.currentUid=this.uid=0;this.current={};a=window.history.state;this._isStateObjectDefined(a)?(a.target.dest?this.initialDestination=a.target.dest:PDFView.initialBookmark=a.target.hash,
this.currentUid=a.uid,this.uid=a.uid+1,this.current=a.target):(a&&a.fingerprint&&this.fingerprint!==a.fingerprint&&(this.reInitialized=!0),this._pushOrReplaceState({fingerprint:this.fingerprint},!0));var c=this;window.addEventListener("popstate",function(a){a.preventDefault();a.stopPropagation();c.historyUnlocked&&(a.state?c._goTo(a.state):(c.previousHash=window.location.hash.substring(1),0===c.uid&&(a=c.previousHash&&c.currentBookmark&&c.previousHash!==c.currentBookmark?{hash:c.currentBookmark,page:c.currentPage}:
{page:1},c.historyUnlocked=!1,c.allowHashChange=!1,window.history.back(),c._pushToHistory(a,!1,!0),window.history.forward(),c.historyUnlocked=!0),c._pushToHistory({hash:c.previousHash},!1,!0),c._updatePreviousBookmark()))},!1);window.addEventListener("beforeunload",b,!1);window.addEventListener("pageshow",function(a){window.addEventListener("beforeunload",b,!1)},!1)}},_isStateObjectDefined:function(a){return a&&0<=a.uid&&a.fingerprint&&this.fingerprint===a.fingerprint&&a.target&&a.target.hash?!0:
!1},_pushOrReplaceState:function(a,b){b?window.history.replaceState(a,"",document.URL):window.history.pushState(a,"",document.URL)},get isHashChangeUnlocked(){if(!this.initialized)return!0;var a=this.allowHashChange;this.allowHashChange=!0;return a},_updatePreviousBookmark:function(){this.updatePreviousBookmark&&this.currentBookmark&&this.currentPage&&(this.previousBookmark=this.currentBookmark,this.previousPage=this.currentPage,this.updatePreviousBookmark=!1)},updateCurrentBookmark:function(a,b){this.initialized&&
(this.currentBookmark=a.substring(1),this.currentPage=b|0,this._updatePreviousBookmark())},updateNextHashParam:function(a){this.initialized&&(this.nextHashParam=a)},push:function(a,b){if(this.initialized&&this.historyUnlocked)if(a.dest&&!a.hash&&(a.hash=this.current.hash&&this.current.dest&&this.current.dest===a.dest?this.current.hash:PDFView.getDestinationHash(a.dest).split("#")[1]),a.page&&(a.page|=0),b){var c=window.history.state.target;c||(this._pushToHistory(a,!1),this.previousHash=window.location.hash.substring(1));
this.updatePreviousBookmark=this.nextHashParam?!1:!0;c&&this._updatePreviousBookmark()}else{if(this.nextHashParam){if(this.nextHashParam===a.hash){this.nextHashParam=null;this.updatePreviousBookmark=!0;return}this.nextHashParam=null}a.hash?this.current.hash?this.current.hash!==a.hash?this._pushToHistory(a,!0):(!this.current.page&&a.page&&this._pushToHistory(a,!1,!0),this.updatePreviousBookmark=!0):this._pushToHistory(a,!0):this.current.page&&a.page&&this.current.page!==a.page&&this._pushToHistory(a,
!0)}},_getPreviousParams:function(a,b){if(!this.currentBookmark||!this.currentPage)return null;this.updatePreviousBookmark&&(this.updatePreviousBookmark=!1);if(0<this.uid&&(!this.previousBookmark||!this.previousPage))return null;if(!this.current.dest&&!a||b){if(this.previousBookmark===this.currentBookmark)return null}else if(this.current.page||a){if(this.previousPage===this.currentPage)return null}else return null;var c={hash:this.currentBookmark,page:this.currentPage};PresentationMode.active&&(c.hash=
null);return c},_stateObj:function(a){return{fingerprint:this.fingerprint,uid:this.uid,target:a}},_pushToHistory:function(a,b,c){this.initialized&&(!a.hash&&a.page&&(a.hash="page="+a.page),b&&!c&&(b=this._getPreviousParams())&&this._pushToHistory(b,!1,!this.current.dest&&this.current.hash!==this.previousHash),this._pushOrReplaceState(this._stateObj(a),c||0===this.uid),this.currentUid=this.uid++,this.current=a,this.updatePreviousBookmark=!0)},_goTo:function(a){if(this.initialized&&this.historyUnlocked&&
this._isStateObjectDefined(a)){if(!this.reInitialized&&a.uid<this.currentUid){var b=this._getPreviousParams(!0);if(b){this._pushToHistory(this.current,!1);this._pushToHistory(b,!1);this.currentUid=a.uid;window.history.back();return}}this.historyUnlocked=!1;a.target.dest?PDFView.navigateTo(a.target.dest):PDFView.setHash(a.target.hash);this.currentUid=a.uid;a.uid>this.uid&&(this.uid=a.uid);this.current=a.target;this.updatePreviousBookmark=!0;a=window.location.hash.substring(1);this.previousHash!==a&&
(this.allowHashChange=!1);this.previousHash=a;this.historyUnlocked=!0}},back:function(){this.go(-1)},forward:function(){this.go(1)},go:function(a){if(this.initialized&&this.historyUnlocked){var b=window.history.state;-1===a&&b&&0<b.uid?window.history.back():1===a&&b&&b.uid<this.uid-1&&window.history.forward()}}},SecondaryToolbar={opened:!1,previousContainerHeight:null,newContainerHeight:null,initialize:function(a){this.toolbar=a.toolbar;this.presentationMode=a.presentationMode;this.documentProperties=
a.documentProperties;this.buttonContainer=this.toolbar.firstElementChild;this.toggleButton=a.toggleButton;this.presentationModeButton=a.presentationModeButton;this.openFile=a.openFile;this.print=a.print;this.download=a.download;this.viewBookmark=a.viewBookmark;this.firstPage=a.firstPage;this.lastPage=a.lastPage;this.pageRotateCw=a.pageRotateCw;this.pageRotateCcw=a.pageRotateCcw;this.documentPropertiesButton=a.documentPropertiesButton;a=[{element:this.toggleButton,handler:this.toggle},{element:this.presentationModeButton,
handler:this.presentationModeClick},{element:this.openFile,handler:this.openFileClick},{element:this.print,handler:this.printClick},{element:this.download,handler:this.downloadClick},{element:this.viewBookmark,handler:this.viewBookmarkClick},{element:this.firstPage,handler:this.firstPageClick},{element:this.lastPage,handler:this.lastPageClick},{element:this.pageRotateCw,handler:this.pageRotateCwClick},{element:this.pageRotateCcw,handler:this.pageRotateCcwClick},{element:this.documentPropertiesButton,
handler:this.documentPropertiesClick}];for(var b in a){var c=a[b].element;c&&c.addEventListener("click",a[b].handler.bind(this))}},presentationModeClick:function(a){this.presentationMode.request();this.close()},openFileClick:function(a){document.getElementById("fileInput").click();this.close()},printClick:function(a){window.print();this.close()},downloadClick:function(a){PDFView.download();this.close()},viewBookmarkClick:function(a){this.close()},firstPageClick:function(a){PDFView.page=1;this.close()},
lastPageClick:function(a){PDFView.page=PDFView.pdfDocument.numPages;this.close()},pageRotateCwClick:function(a){PDFView.rotatePages(90)},pageRotateCcwClick:function(a){PDFView.rotatePages(-90)},documentPropertiesClick:function(a){this.documentProperties.show();this.close()},setMaxHeight:function(a){a&&this.buttonContainer&&(this.newContainerHeight=a.clientHeight,this.previousContainerHeight!==this.newContainerHeight&&(this.buttonContainer.setAttribute("style","max-height: "+(this.newContainerHeight-
SCROLLBAR_PADDING)+"px;"),this.previousContainerHeight=this.newContainerHeight))},open:function(){this.opened||(this.opened=!0,this.toggleButton.classList.add("toggled"),this.toolbar.classList.remove("hidden"))},close:function(a){!this.opened||a&&!this.toolbar.contains(a)||(this.opened=!1,this.toolbar.classList.add("hidden"),this.toggleButton.classList.remove("toggled"))},toggle:function(){this.opened?this.close():this.open()}},PasswordPrompt={visible:!1,updatePassword:null,reason:null,overlayContainer:null,
passwordField:null,passwordText:null,passwordSubmit:null,passwordCancel:null,initialize:function(a){this.overlayContainer=a.overlayContainer;this.passwordField=a.passwordField;this.passwordText=a.passwordText;this.passwordSubmit=a.passwordSubmit;this.passwordCancel=a.passwordCancel;this.passwordSubmit.addEventListener("click",this.verifyPassword.bind(this));this.passwordCancel.addEventListener("click",this.hide.bind(this));this.passwordField.addEventListener("keydown",function(a){13===a.keyCode&&
this.verifyPassword()}.bind(this));window.addEventListener("keydown",function(a){27===a.keyCode&&this.hide()}.bind(this))},show:function(){if(!this.visible){this.visible=!0;this.overlayContainer.classList.remove("hidden");this.overlayContainer.firstElementChild.classList.remove("hidden");this.passwordField.focus();var a=mozL10n.get("password_label",null,"Enter the password to open this PDF file.");this.reason===PDFJS.PasswordResponses.INCORRECT_PASSWORD&&(a=mozL10n.get("password_invalid",null,"Invalid password. Please try again."));
this.passwordText.textContent=a}},hide:function(){this.visible&&(this.visible=!1,this.passwordField.value="",this.overlayContainer.classList.add("hidden"),this.overlayContainer.firstElementChild.classList.add("hidden"))},verifyPassword:function(){var a=this.passwordField.value;if(a&&0<a.length)return this.hide(),this.updatePassword(a)}},DELAY_BEFORE_HIDING_CONTROLS=3E3,SELECTOR="presentationControls",DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS=1E3,PresentationMode={active:!1,args:null,contextMenuOpen:!1,
prevCoords:{x:null,y:null},initialize:function(a){this.container=a.container;this.secondaryToolbar=a.secondaryToolbar;this.viewer=this.container.firstElementChild;this.firstPage=a.firstPage;this.lastPage=a.lastPage;this.pageRotateCw=a.pageRotateCw;this.pageRotateCcw=a.pageRotateCcw;this.firstPage.addEventListener("click",function(){this.contextMenuOpen=!1;this.secondaryToolbar.firstPageClick()}.bind(this));this.lastPage.addEventListener("click",function(){this.contextMenuOpen=!1;this.secondaryToolbar.lastPageClick()}.bind(this));
this.pageRotateCw.addEventListener("click",function(){this.contextMenuOpen=!1;this.secondaryToolbar.pageRotateCwClick()}.bind(this));this.pageRotateCcw.addEventListener("click",function(){this.contextMenuOpen=!1;this.secondaryToolbar.pageRotateCcwClick()}.bind(this))},get isFullscreen(){return document.fullscreenElement||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement},_setSwitchInProgress:function(){this.switchInProgress&&clearTimeout(this.switchInProgress);this.switchInProgress=
setTimeout(function(){delete this.switchInProgress}.bind(this),DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS);PDFView.currentPosition=null},_resetSwitchInProgress:function(){this.switchInProgress&&(clearTimeout(this.switchInProgress),delete this.switchInProgress)},request:function(){if(!PDFView.supportsFullscreen||this.isFullscreen||!this.viewer.hasChildNodes())return!1;this._setSwitchInProgress();if(this.container.requestFullscreen)this.container.requestFullscreen();else if(this.container.mozRequestFullScreen)this.container.mozRequestFullScreen();
else if(this.container.webkitRequestFullScreen)this.container.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);else if(this.container.msRequestFullscreen)this.container.msRequestFullscreen();else return!1;this.args={page:PDFView.page,previousScale:PDFView.currentScaleValue};return!0},enter:function(){this.active=!0;this._resetSwitchInProgress();setTimeout(function(){PDFView.page=this.args.page;PDFView.setScale("page-fit",!0)}.bind(this),0);window.addEventListener("mousemove",this.mouseMove,!1);
window.addEventListener("mousedown",this.mouseDown,!1);window.addEventListener("contextmenu",this.contextMenu,!1);this.showControls();HandTool.enterPresentationMode();this.contextMenuOpen=!1;this.container.setAttribute("contextmenu","viewerContextMenu")},exit:function(){var a=PDFView.page;setTimeout(function(){this.active=!1;PDFView.setScale(this.args.previousScale);PDFView.page=a;this.args=null}.bind(this),0);window.removeEventListener("mousemove",this.mouseMove,!1);window.removeEventListener("mousedown",
this.mouseDown,!1);window.removeEventListener("contextmenu",this.contextMenu,!1);this.hideControls();PDFView.clearMouseScrollState();HandTool.exitPresentationMode();this.container.removeAttribute("contextmenu");this.contextMenuOpen=!1;scrollIntoView(document.getElementById("thumbnailContainer"+a))},showControls:function(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(SELECTOR);this.controlsTimeout=setTimeout(function(){this.container.classList.remove(SELECTOR);
delete this.controlsTimeout}.bind(this),DELAY_BEFORE_HIDING_CONTROLS)},hideControls:function(){this.controlsTimeout&&(this.container.classList.remove(SELECTOR),clearTimeout(this.controlsTimeout),delete this.controlsTimeout)},mouseMove:function(a){a={x:a.clientX,y:a.clientY};var b=PresentationMode.prevCoords;PresentationMode.prevCoords=a;a.x===b.x&&a.y===b.y||PresentationMode.showControls()},mouseDown:function(a){var b=PresentationMode;b.contextMenuOpen?(b.contextMenuOpen=!1,a.preventDefault()):0!==
a.button||a.target.href&&a.target.classList.contains("internalLink")||(a.preventDefault(),PDFView.page+=a.shiftKey?-1:1)},contextMenu:function(a){PresentationMode.contextMenuOpen=!0}};(function(){function a(a){PresentationMode.isFullscreen?PresentationMode.enter():PresentationMode.exit()}window.addEventListener("fullscreenchange",a,!1);window.addEventListener("mozfullscreenchange",a,!1);window.addEventListener("webkitfullscreenchange",a,!1);window.addEventListener("MSFullscreenChange",a,!1)})();"use strict";
var GrabToPan=function(){function a(a){this.element=a.element;this.document=a.element.ownerDocument;"function"===typeof a.ignoreTarget&&(this.ignoreTarget=a.ignoreTarget);this.onActiveChanged=a.onActiveChanged;this.activate=this.activate.bind(this);this.deactivate=this.deactivate.bind(this);this.toggle=this.toggle.bind(this);this._onmousedown=this._onmousedown.bind(this);this._onmousemove=this._onmousemove.bind(this);this._endPan=this._endPan.bind(this);(this.overlay=document.createElement("div")).className=
"grab-to-pan-grabbing"}a.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function(){if(!this.active&&(this.active=!0,this.element.addEventListener("mousedown",this._onmousedown,!0),this.element.classList.add(this.CSS_CLASS_GRAB),this.onActiveChanged))this.onActiveChanged(!0)},deactivate:function(){if(this.active&&(this.active=!1,this.element.removeEventListener("mousedown",this._onmousedown,!0),this._endPan(),this.element.classList.remove(this.CSS_CLASS_GRAB),this.onActiveChanged))this.onActiveChanged(!1)},
toggle:function(){this.active?this.deactivate():this.activate()},ignoreTarget:function(a){return a[b]("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function(a){if(0===a.button&&!this.ignoreTarget(a.target)){if(a.originalTarget)try{a.originalTarget.tagName}catch(b){return}this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=a.clientX;this.clientYStart=a.clientY;this.document.addEventListener("mousemove",this._onmousemove,
!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);a.preventDefault();a.stopPropagation();this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING)}},_onmousemove:function(a){this.element.removeEventListener("scroll",this._endPan,!0);var b;b="buttons"in a&&c?!(a.buttons|1):e||f?0===a.which:void 0;b?this._endPan():(b=a.clientX-this.clientXStart,this.element.scrollTop=this.scrollTopStart-(a.clientY-this.clientYStart),this.element.scrollLeft=
this.scrollLeftStart-b,this.overlay.parentNode||document.body.appendChild(this.overlay))},_endPan:function(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onmousemove,!0);this.document.removeEventListener("mouseup",this._endPan,!0);this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)}};var b;["webkitM","mozM","msM","oM","m"].some(function(a){a+="atches";a in document.documentElement&&(b=a);a+="Selector";a in document.documentElement&&
(b=a);return b});var c=!document.documentMode||9<document.documentMode,d=window.chrome,e=d&&(d.webstore||d.app),f=/Apple/.test(navigator.vendor)&&/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);return a}(),HandTool={initialize:function(a){var b=a.toggleHandTool;this.handTool=new GrabToPan({element:a.container,onActiveChanged:function(a){b&&(a?(b.title=mozL10n.get("hand_tool_disable.title",null,"Disable hand tool"),b.firstElementChild.textContent=mozL10n.get("hand_tool_disable_label",null,
"Disable hand tool")):(b.title=mozL10n.get("hand_tool_enable.title",null,"Enable hand tool"),b.firstElementChild.textContent=mozL10n.get("hand_tool_enable_label",null,"Enable hand tool")))}});b&&(b.addEventListener("click",this.toggle.bind(this),!1),window.addEventListener("localized",function(a){Preferences.get("enableHandToolOnLoad").then(function(a){a&&this.handTool.activate()}.bind(this))}.bind(this)))},toggle:function(){this.handTool.toggle();SecondaryToolbar.close()},enterPresentationMode:function(){this.handTool.active&&
(this.wasActive=!0,this.handTool.deactivate())},exitPresentationMode:function(){this.wasActive&&(this.wasActive=null,this.handTool.activate())}},DocumentProperties={overlayContainer:null,fileName:"",fileSize:"",visible:!1,fileNameField:null,fileSizeField:null,titleField:null,authorField:null,subjectField:null,keywordsField:null,creationDateField:null,modificationDateField:null,creatorField:null,producerField:null,versionField:null,pageCountField:null,initialize:function(a){this.overlayContainer=a.overlayContainer;
this.fileNameField=a.fileNameField;this.fileSizeField=a.fileSizeField;this.titleField=a.titleField;this.authorField=a.authorField;this.subjectField=a.subjectField;this.keywordsField=a.keywordsField;this.creationDateField=a.creationDateField;this.modificationDateField=a.modificationDateField;this.creatorField=a.creatorField;this.producerField=a.producerField;this.versionField=a.versionField;this.pageCountField=a.pageCountField;a.closeButton&&a.closeButton.addEventListener("click",this.hide.bind(this));
this.dataAvailablePromise=new Promise(function(a){this.resolveDataAvailable=a}.bind(this));window.addEventListener("keydown",function(a){27===a.keyCode&&this.hide()}.bind(this))},getProperties:function(){this.visible&&(this.fileName=getPDFFileNameFromURL(PDFView.url),PDFView.pdfDocument.getDownloadInfo().then(function(a){this.setFileSize(a.length);this.updateUI(this.fileSizeField,this.fileSize)}.bind(this)),PDFView.pdfDocument.getMetadata().then(function(a){a=[{field:this.fileNameField,content:this.fileName},
{field:this.titleField,content:a.info.Title},{field:this.authorField,content:a.info.Author},{field:this.subjectField,content:a.info.Subject},{field:this.keywordsField,content:a.info.Keywords},{field:this.creationDateField,content:this.parseDate(a.info.CreationDate)},{field:this.modificationDateField,content:this.parseDate(a.info.ModDate)},{field:this.creatorField,content:a.info.Creator},{field:this.producerField,content:a.info.Producer},{field:this.versionField,content:a.info.PDFFormatVersion},{field:this.pageCountField,
content:PDFView.pdfDocument.numPages}];for(var b in a){var c=a[b];this.updateUI(c.field,c.content)}}.bind(this)))},updateUI:function(a,b){a&&void 0!==b&&""!==b&&(a.textContent=b)},setFileSize:function(a){var b=a/1024;this.fileSize=1024>b?mozL10n.get("document_properties_kb",{size_kb:(+b.toPrecision(3)).toLocaleString(),size_b:a.toLocaleString()},"{{size_kb}} KB ({{size_b}} bytes)"):mozL10n.get("document_properties_mb",{size_mb:(+(b/1024).toPrecision(3)).toLocaleString(),size_b:a.toLocaleString()},
"{{size_mb}} MB ({{size_b}} bytes)")},show:function(){this.visible||(this.visible=!0,this.overlayContainer.classList.remove("hidden"),this.overlayContainer.lastElementChild.classList.remove("hidden"),this.dataAvailablePromise.then(function(){this.getProperties()}.bind(this)))},hide:function(){this.visible&&(this.visible=!1,this.overlayContainer.classList.add("hidden"),this.overlayContainer.lastElementChild.classList.add("hidden"))},parseDate:function(a){var b=a;if(void 0===b)return"";"D:"===b.substring(0,
2)&&(b=b.substring(2));a=parseInt(b.substring(0,4),10);var c=parseInt(b.substring(4,6),10)-1,d=parseInt(b.substring(6,8),10),e=parseInt(b.substring(8,10),10),f=parseInt(b.substring(10,12),10),g=parseInt(b.substring(12,14),10),h=b.substring(14,15),k=parseInt(b.substring(15,17),10),b=parseInt(b.substring(18,20),10);"-"==h?(e+=k,f+=b):"+"==h&&(e-=k,f+=b);c=new Date(Date.UTC(a,c,d,e,f,g));a=c.toLocaleDateString();c=c.toLocaleTimeString();return mozL10n.get("document_properties_date_string",{date:a,time:c},
"{{date}}, {{time}}")}},PDFView={pages:[],thumbnails:[],currentScale:UNKNOWN_SCALE,currentScaleValue:null,initialBookmark:document.location.hash.substring(1),container:null,thumbnailContainer:null,initialized:!1,fellback:!1,pdfDocument:null,sidebarOpen:!1,pageViewScroll:null,thumbnailViewScroll:null,pageRotation:0,mouseScrollTimeStamp:0,mouseScrollDelta:0,lastScroll:0,previousPageNumber:1,isViewerEmbedded:window.parent!==window,idleTimeout:null,currentPosition:null,initialize:function(){var a=this,
b=this.container=document.getElementById("viewerContainer");this.pageViewScroll={};this.watchScroll(b,this.pageViewScroll,updateViewarea);var c=this.thumbnailContainer=document.getElementById("thumbnailView");this.thumbnailViewScroll={};this.watchScroll(c,this.thumbnailViewScroll,this.renderHighestPriority.bind(this));Preferences.initialize();PDFFindBar.initialize({bar:document.getElementById("findbar"),toggleButton:document.getElementById("viewFind"),findField:document.getElementById("findInput"),
highlightAllCheckbox:document.getElementById("findHighlightAll"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),findMsg:document.getElementById("findMsg"),findStatusIcon:document.getElementById("findStatusIcon"),findPreviousButton:document.getElementById("findPrevious"),findNextButton:document.getElementById("findNext")});PDFFindController.initialize({pdfPageSource:this,integratedFind:this.supportsIntegratedFind});HandTool.initialize({container:b,toggleHandTool:document.getElementById("toggleHandTool")});
SecondaryToolbar.initialize({toolbar:document.getElementById("secondaryToolbar"),presentationMode:PresentationMode,toggleButton:document.getElementById("secondaryToolbarToggle"),presentationModeButton:document.getElementById("secondaryPresentationMode"),openFile:document.getElementById("secondaryOpenFile"),print:document.getElementById("secondaryPrint"),download:document.getElementById("secondaryDownload"),viewBookmark:document.getElementById("secondaryViewBookmark"),firstPage:document.getElementById("firstPage"),
lastPage:document.getElementById("lastPage"),pageRotateCw:document.getElementById("pageRotateCw"),pageRotateCcw:document.getElementById("pageRotateCcw"),documentProperties:DocumentProperties,documentPropertiesButton:document.getElementById("documentProperties")});PasswordPrompt.initialize({overlayContainer:document.getElementById("overlayContainer"),passwordField:document.getElementById("password"),passwordText:document.getElementById("passwordText"),passwordSubmit:document.getElementById("passwordSubmit"),
passwordCancel:document.getElementById("passwordCancel")});PresentationMode.initialize({container:b,secondaryToolbar:SecondaryToolbar,firstPage:document.getElementById("contextFirstPage"),lastPage:document.getElementById("contextLastPage"),pageRotateCw:document.getElementById("contextPageRotateCw"),pageRotateCcw:document.getElementById("contextPageRotateCcw")});DocumentProperties.initialize({overlayContainer:document.getElementById("overlayContainer"),closeButton:document.getElementById("documentPropertiesClose"),
fileNameField:document.getElementById("fileNameField"),fileSizeField:document.getElementById("fileSizeField"),titleField:document.getElementById("titleField"),authorField:document.getElementById("authorField"),subjectField:document.getElementById("subjectField"),keywordsField:document.getElementById("keywordsField"),creationDateField:document.getElementById("creationDateField"),modificationDateField:document.getElementById("modificationDateField"),creatorField:document.getElementById("creatorField"),
producerField:document.getElementById("producerField"),versionField:document.getElementById("versionField"),pageCountField:document.getElementById("pageCountField")});b.addEventListener("scroll",function(){a.lastScroll=Date.now()},!1);return Promise.all([Preferences.get("enableWebGL").then(function(a){PDFJS.disableWebGL=!a})]).then(function(){PDFView.initialized=!0})},getPage:function(a){return this.pdfDocument.getPage(a)},watchScroll:function(a,b,c){b.down=!0;b.lastY=a.scrollTop;a.addEventListener("scroll",
function(d){d=a.scrollTop;var e=b.lastY;d>e?b.down=!0:d<e&&(b.down=!1);b.lastY=d;c()},!0)},_setScaleUpdatePages:function(a,b,c,d){this.currentScaleValue=b;if(a!==this.currentScale){b=0;for(var e=this.pages.length;b<e;b++)this.pages[b].update(a);this.currentScale=a;if(!d){d=this.page;var f;this.currentPosition&&!IGNORE_CURRENT_POSITION_ON_ZOOM&&(d=this.currentPosition.page,f=[null,{name:"XYZ"},this.currentPosition.left,this.currentPosition.top,null]);this.pages[d-1].scrollIntoView(f)}f=document.createEvent("UIEvents");
f.initUIEvent("scalechange",!1,!1,window,0);f.scale=a;f.resetAutoSettings=c;window.dispatchEvent(f)}},setScale:function(a,b,c){if("custom"!==a){var d=parseFloat(a);if(0<d)this._setScaleUpdatePages(d,a,!0,c);else{var e=this.pages[this.page-1];if(e){d=(this.container.clientWidth-(PresentationMode.active?0:SCROLLBAR_PADDING))/e.width*e.scale;e=(this.container.clientHeight-(PresentationMode.active?0:VERTICAL_PADDING))/e.height*e.scale;switch(a){case "page-actual":d=1;break;case "page-width":break;case "page-height":d=
e;break;case "page-fit":d=Math.min(d,e);break;case "auto":d=Math.min(MAX_AUTO_SCALE,d);break;default:console.error("pdfViewSetScale: '"+a+"' is an unknown zoom value.");return}this._setScaleUpdatePages(d,a,b,c);selectScaleOption(a)}}}},zoomIn:function(a){var b=this.currentScale;do b=(b*DEFAULT_SCALE_DELTA).toFixed(2),b=Math.ceil(10*b)/10,b=Math.min(MAX_SCALE,b);while(--a&&b<MAX_SCALE);this.setScale(b,!0)},zoomOut:function(a){var b=this.currentScale;do b=(b/DEFAULT_SCALE_DELTA).toFixed(2),b=Math.floor(10*
b)/10,b=Math.max(MIN_SCALE,b);while(--a&&b>MIN_SCALE);this.setScale(b,!0)},set page(a){var b=this.pages,c=document.createEvent("UIEvents");c.initUIEvent("pagechange",!1,!1,window,0);0<a&&a<=b.length?(b[a-1].updateStats(),this.previousPageNumber=currentPageNumber,currentPageNumber=a,c.pageNumber=a,window.dispatchEvent(c),updateViewarea.inProgress||this.loading&&1===a||b[a-1].scrollIntoView()):(this.previousPageNumber=a,c.pageNumber=this.page,window.dispatchEvent(c))},get page(){return currentPageNumber},
get supportsPrinting(){var a="mozPrintCallback"in document.createElement("canvas");Object.defineProperty(this,"supportsPrinting",{value:a,enumerable:!0,configurable:!0,writable:!1});return a},get supportsFullscreen(){var a=document.documentElement,a=a.requestFullscreen||a.mozRequestFullScreen||a.webkitRequestFullScreen||a.msRequestFullscreen;if(!1===document.fullscreenEnabled||!1===document.mozFullScreenEnabled||!1===document.webkitFullscreenEnabled||!1===document.msFullscreenEnabled)a=!1;Object.defineProperty(this,
"supportsFullscreen",{value:a,enumerable:!0,configurable:!0,writable:!1});return a},get supportsIntegratedFind(){Object.defineProperty(this,"supportsIntegratedFind",{value:!1,enumerable:!0,configurable:!0,writable:!1});return!1},get supportsDocumentFonts(){Object.defineProperty(this,"supportsDocumentFonts",{value:!0,enumerable:!0,configurable:!0,writable:!1});return!0},get supportsDocumentColors(){Object.defineProperty(this,"supportsDocumentColors",{value:!0,enumerable:!0,configurable:!0,writable:!1});
return!0},get loadingBar(){var a=new ProgressBar("#loadingBar",{});Object.defineProperty(this,"loadingBar",{value:a,enumerable:!0,configurable:!0,writable:!1});return a},get isHorizontalScrollbarEnabled(){return PresentationMode.active?!1:this.container.scrollWidth>this.container.clientWidth},setTitleUsingUrl:function(a){this.url=a;try{this.setTitle(decodeURIComponent(getFileName(a))||a)}catch(b){this.setTitle(a)}},setTitle:function(a){document.title=a},close:function(){document.getElementById("errorWrapper").setAttribute("hidden",
"true");if(this.pdfDocument){this.pdfDocument.destroy();this.pdfDocument=null;for(var a=document.getElementById("thumbnailView");a.hasChildNodes();)a.removeChild(a.lastChild);"_loadingInterval"in a&&clearInterval(a._loadingInterval);for(a=document.getElementById("viewer");a.hasChildNodes();)a.removeChild(a.lastChild);"undefined"!==typeof PDFBug&&PDFBug.cleanup()}},open:function(a,b,c,d,e){this.pdfDocument&&Preferences.reload();this.close();c={password:c};"string"===typeof a?(this.setTitleUsingUrl(a),
c.url=a):a&&"byteLength"in a&&(c.data=a);if(e)for(var f in e)c[f]=e[f];var g=this;g.loading=!0;g.downloadComplete=!1;PDFJS.getDocument(c,d,function(a,b){PasswordPrompt.updatePassword=a;PasswordPrompt.reason=b;PasswordPrompt.show()},function(a){g.progress(a.loaded/a.total)}).then(function(a){g.load(a,b);g.loading=!1},function(a,b){var c=mozL10n.get("loading_error",null,"An error occurred while loading the PDF.");b&&"InvalidPDFException"===b.name&&(c=mozL10n.get("invalid_file_error",null,"Invalid or corrupted PDF file."));
b&&"MissingPDFException"===b.name&&(c=mozL10n.get("missing_file_error",null,"Missing PDF file."));g.error(c,{message:a});g.loading=!1})},download:function(){function a(){d.downloadUrl(b,c)}var b=this.url.split("#")[0],c=getPDFFileNameFromURL(b),d=new DownloadManager;d.onerror=function(a){PDFView.error("PDF failed to download.")};this.pdfDocument?this.downloadComplete?this.pdfDocument.getData().then(function(a){a=PDFJS.createBlob(a,"application/pdf");d.download(a,b,c)},a).then(null,a):a():a()},fallback:function(a){},
navigateTo:function(a){var b="",c=this,d=function(e){c.pendingRefStr=null;var f=e instanceof Object?c.pagesRefMap[e.num+" "+e.gen+" R"]:e+1;f?(f>c.pages.length&&(f=c.pages.length),c.pages[f-1].scrollIntoView(a),PDFHistory.push({dest:a,hash:b,page:f})):c.pdfDocument.getPageIndex(e).then(function(a){c.pagesRefMap[e.num+" "+e.gen+" R"]=a+1;d(e)})};this.destinationsPromise.then(function(){"string"===typeof a&&(b=a,a=c.destinations[a]);a instanceof Array&&d(a[0])})},getDestinationHash:function(a){if("string"===
typeof a)return PDFView.getAnchorUrl("#"+escape(a));if(a instanceof Array){var b=a[0];if(b=b instanceof Object?this.pagesRefMap[b.num+" "+b.gen+" R"]:b+1){var b=PDFView.getAnchorUrl("#page="+b),c=a[1];if("object"===typeof c&&"name"in c&&"XYZ"==c.name){var c=a[4]||this.currentScaleValue,d=parseFloat(c);d&&(c=100*d);b+="&zoom="+c;if(a[2]||a[3])b+=","+(a[2]||0)+","+(a[3]||0)}return b}}return""},getAnchorUrl:function(a){return a},error:function(a,b){var c=mozL10n.get("error_version_info",{version:PDFJS.version||
"?",build:PDFJS.build||"?"},"PDF.js v{{version}} (build: {{build}})")+"\n";b&&(c+=mozL10n.get("error_message",{message:b.message},"Message: {{message}}"),b.stack?c+="\n"+mozL10n.get("error_stack",{stack:b.stack},"Stack: {{stack}}"):(b.filename&&(c+="\n"+mozL10n.get("error_file",{file:b.filename},"File: {{file}}")),b.lineNumber&&(c+="\n"+mozL10n.get("error_line",{line:b.lineNumber},"Line: {{line}}"))));var d=document.getElementById("errorWrapper");d.removeAttribute("hidden");document.getElementById("errorMessage").textContent=
a;var e=document.getElementById("errorClose");e.onclick=function(){d.setAttribute("hidden","true")};var f=document.getElementById("errorMoreInfo"),g=document.getElementById("errorShowMore"),h=document.getElementById("errorShowLess");g.onclick=function(){f.removeAttribute("hidden");g.setAttribute("hidden","true");h.removeAttribute("hidden");f.style.height=f.scrollHeight+"px"};h.onclick=function(){f.setAttribute("hidden","true");g.removeAttribute("hidden");h.setAttribute("hidden","true")};g.oncontextmenu=
noContextMenuHandler;h.oncontextmenu=noContextMenuHandler;e.oncontextmenu=noContextMenuHandler;g.removeAttribute("hidden");h.setAttribute("hidden","true");f.value=c},progress:function(a){a=Math.round(100*a);a>PDFView.loadingBar.percent&&(PDFView.loadingBar.percent=a)},load:function(a,b){function c(a,b){a.onAfterDraw=function(){e||(e=!0,f());b.setImage(a.canvas)}}var d=this,e=!1,f=null,g=new Promise(function(a){f=a});PDFFindController.reset();this.pdfDocument=a;DocumentProperties.resolveDataAvailable();
var h=a.getDownloadInfo().then(function(){d.downloadComplete=!0;PDFView.loadingBar.hide();document.getElementById("outerContainer").classList.remove("loadingInProgress")}),k=a.numPages,m=a.fingerprint;document.getElementById("numPages").textContent=mozL10n.get("page_of",{pageCount:k},"of {{pageCount}}");document.getElementById("pageNumber").max=k;PDFView.documentFingerprint=m;var p=PDFView.store=new ViewHistory(m);this.pageRotation=0;var u=this.pages=[],v=this.pagesRefMap={},y=this.thumbnails=[],
q;this.pagesPromise=m=new Promise(function(a){q=a});var l=a.getPage(1),r=document.getElementById("viewer"),n=document.getElementById("thumbnailView");l.then(function(e){e=e.getViewport((b||1)*CSS_UNITS);for(var f=1;f<=k;++f){var m=e.clone(),p=new PageView(r,f,b,d.navigateTo.bind(d),m),m=new ThumbnailView(n,f,m);c(p,m);u.push(p);y.push(m)}g.then(function(){if(PDFJS.disableAutoFetch)q();else for(var b=k,c=1;c<=k;++c)a.getPage(c).then(function(a,c){var d=u[a-1];d.pdfPage||d.setPdfPage(c);v[c.ref.num+
" "+c.ref.gen+" R"]=a;b--;b||q()}.bind(null,c))});h.then(function(){var a=document.createEvent("CustomEvent");a.initCustomEvent("documentload",!0,!0,{});window.dispatchEvent(a)});PDFView.loadingBar.setWidth(r);PDFFindController.resolveFirstPage();PDFHistory.initialize(d.documentFingerprint)});var w,t=Preferences.get("showPreviousViewOnLoad").then(function(a){w=a}),x,z=Preferences.get("defaultZoomValue").then(function(a){x=a});Promise.all([l,p.initializedPromise,t,z]).then(function(){var a=null;if(w&&
p.get("exists",!1))var a=p.get("page","1"),c=x||p.get("zoom",PDFView.currentScale),e=p.get("scrollLeft","0"),g=p.get("scrollTop","0"),a="page="+a+"&zoom="+c+","+e+","+g;else x&&(a="page=1&zoom="+x);d.setInitialView(a,b);d.isViewerEmbedded||d.container.focus()},function(a){console.error(a);l.then(function(){d.setInitialView(null,b)})});m.then(function(){PDFView.supportsPrinting&&a.getJavaScript().then(function(a){a.length&&(console.warn("Warning: JavaScript is not supported"),PDFView.fal