var DEFAULT_URL=null,DEFAULT_SCALE="auto",DEFAULT_SCALE_DELTA=1.1,UNKNOWN_SCALE=0,CACHE_SIZE=20,CSS_UNITS=96/72,SCROLLBAR_PADDING=40,VERTICAL_PADDING=5,MIN_SCALE=0.25,MAX_SCALE=4,IMAGE_DIR="./images/",SETTINGS_MEMORY=20,ANNOT_MIN_SIZE=10,RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},FindStates={FIND_FOUND:0,FIND_NOTFOUND:1,FIND_WRAPPED:2,FIND_PENDING:3};PDFJS.workerSrc="pdf.js";var mozL10n=document.mozL10n||document.webL10n; function getFileName(a){var b=a.indexOf("#"),c=a.indexOf("?"),b=Math.min(0a&&b.shift().destroy()}},ProgressBar=function(){function a(a,c){this.div=document.querySelector(a+" .progress");this.height=c.height||100;this.width=c.width||100;this.units=c.units||"%";this.div.style.height=this.height+this.units}a.prototype={updateBar:function(){if(this._indeterminate)this.div.classList.add("indeterminate");else{var a=this.width*this._percent/100;95=SETTINGS_MEMORY&&a.files.shift();for(var b,c=0,f=a.files.length;c=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){PDFView.supportsIntegratedFind?FirefoxCom.request("updateFindControlState",{result:a,findPrevious:b}):PDFFindBar.updateUIState(a,b)}},PDFFindBar={opened:!1,initialize:function(){this.bar= document.getElementById("findbar");this.toggleButton=document.getElementById("viewFind");this.findField=document.getElementById("findInput");this.highlightAll=document.getElementById("findHighlightAll");this.caseSensitive=document.getElementById("findMatchCase");this.findMsg=document.getElementById("findMsg");this.findStatusIcon=document.getElementById("findStatusIcon");var a=this;this.toggleButton.addEventListener("click",function(){a.toggle()});this.findField.addEventListener("input",function(){a.dispatchEvent("")}); this.bar.addEventListener("keydown",function(b){switch(b.keyCode){case 13:b.target===a.findField&&a.dispatchEvent("again",b.shiftKey);break;case 27:a.close()}});document.getElementById("findPrevious").addEventListener("click",function(){a.dispatchEvent("again",!0)});document.getElementById("findNext").addEventListener("click",function(){a.dispatchEvent("again",!1)});this.highlightAll.addEventListener("click",function(){a.dispatchEvent("highlightallchange")});this.caseSensitive.addEventListener("click", function(){a.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()}},PDFView={pages:[],thumbnails:[],currentScale:UNKNOWN_SCALE,currentScaleValue:null,initialBookmark:document.location.hash.substring(1),startedTextExtraction:!1,pageText:[],container:null,thumbnailContainer:null,initialized:!1,fellback:!1,pdfDocument:null,sidebarOpen:!1, pageViewScroll:null,thumbnailViewScroll:null,isFullscreen:!1,previousScale:null,pageRotation:0,mouseScrollTimeStamp:0,mouseScrollDelta:0,lastScroll:0,previousPageNumber:1,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)); PDFFindBar.initialize();PDFFindController.initialize();this.initialized=!0;b.addEventListener("scroll",function(){a.lastScroll=Date.now()},!1)},watchScroll:function(a,b,c){b.down=!0;b.lastY=a.scrollTop;a.addEventListener("scroll",function(){var d=a.scrollTop,e=b.lastY;d>e?b.down=!0:da.clientWidth},initPassiveLoading:function(){PDFView.loadingBar||(PDFView.loadingBar=new ProgressBar("#loadingBar",{}));window.addEventListener("message",function(a){var b=a.data;if("object"===typeof b&&"pdfjsLoadAction"in b)switch(b.pdfjsLoadAction){case "progress":PDFView.progress(b.loaded/b.total);break;case "complete":if(!b.data){PDFView.error(mozL10n.get("loading_error", null,"An error occurred while loading the PDF."),a);break}PDFView.open(b.data,0)}});FirefoxCom.requestSync("initPassiveLoading",null)},setTitleUsingUrl:function(a){this.url=a;try{this.setTitle(decodeURIComponent(getFileName(a))||a)}catch(b){this.setTitle(a)}},setTitle:function(a){document.title=a},open:function(a,b,c){var d={password:c};"string"===typeof a?(this.setTitleUsingUrl(a),d.url=a):a&&"byteLength"in a&&(d.data=a);PDFView.loadingBar||(PDFView.loadingBar=new ProgressBar("#loadingBar",{})); this.pdfDocument=null;var e=this;e.loading=!0;PDFJS.getDocument(d).then(function(a){e.load(a,b);e.loading=!1},function(d,f){if(f&&"PasswordException"===f.name&&"needpassword"===f.code){var h=mozL10n.get("request_password",null,"PDF is protected by a password:");if((c=prompt(h))&&0this.pages.length&&(b=this.pages.length); b&&(this.page=b,this.pages[b-1].scrollIntoView(a))}},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)&&(b+="&zoom="+100*(a[4]||this.currentScale),a[2]||a[3]))b+=","+(a[2]||0)+","+(a[3]||0);return b}}return""},getAnchorUrl:function(a){return a},getOutputScale:function(){var a= "devicePixelRatio"in window?window.devicePixelRatio:1;return{sx:a,sy:a,scaled:1!=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}}"))));document.getElementById("loadingBox").setAttribute("hidden","true");var d=document.getElementById("errorWrapper");d.removeAttribute("hidden");document.getElementById("errorMessage").textContent=a;document.getElementById("errorClose").onclick=function(){d.setAttribute("hidden","true")};var e=document.getElementById("errorMoreInfo"),j=document.getElementById("errorShowMore"),f=document.getElementById("errorShowLess");j.onclick=function(){e.removeAttribute("hidden"); j.setAttribute("hidden","true");f.removeAttribute("hidden")};f.onclick=function(){e.setAttribute("hidden","true");j.removeAttribute("hidden");f.setAttribute("hidden","true")};j.removeAttribute("hidden");f.setAttribute("hidden","true");e.value=c;e.rows=c.split("\n").length-1},progress:function(a){a=Math.round(100*a);PDFView.loadingBar.percent=a},load:function(a,b){function c(a,b){a.onAfterDraw=function(){b.setImage(a.canvas)}}this.pdfDocument=a;document.getElementById("errorWrapper").setAttribute("hidden", "true");document.getElementById("loadingBox").setAttribute("hidden","true");document.getElementById("loading").textContent="";var d=document.getElementById("thumbnailView");for(d.parentNode.scrollTop=0;d.hasChildNodes();)d.removeChild(d.lastChild);"_loadingInterval"in d&&clearInterval(d._loadingInterval);for(var e=document.getElementById("viewer");e.hasChildNodes();)e.removeChild(e.lastChild);var j=a.numPages,f=a.fingerprint;document.getElementById("numPages").textContent=mozL10n.get("page_of",{pageCount:j}, "of {{pageCount}}");document.getElementById("pageNumber").max=j;PDFView.documentFingerprint=f;var h=PDFView.store=new Settings(f),f=h.initializedPromise;this.pageRotation=0;var g=this.pages=[];this.pageText=[];this.startedTextExtraction=!1;for(var m={},k=this.thumbnails=[],l=[],n=1;n<=j;n++)l.push(a.getPage(n));var p=this,l=PDFJS.Promise.all(l);l.then(function(a){for(var f=1;f<=j;f++){var h=a[f-1],l=new PageView(e,h,f,b,h.stats,p.navigateTo.bind(p)),n=new ThumbnailView(d,h,f);c(l,n);g.push(l);k.push(n); h=h.ref;m[h.num+" "+h.gen+" R"]=f}p.pagesRefMap=m});n=a.getDestinations();n.then(function(a){p.destinations=a});PDFJS.Promise.all([l,n,f]).then(function(){a.getOutline().then(function(a){p.outline=new DocumentOutlineView(a)});var c=null;if(h.get("exists",!1))var c=h.get("page","1"),d=h.get("zoom",PDFView.currentScale),e=h.get("scrollLeft","0"),f=h.get("scrollTop","0"),c="page="+c+"&zoom="+d+","+e+","+f;p.setInitialView(c,b)});a.getMetadata().then(function(b){var c=b.info;b=b.metadata;p.documentInfo= c;p.metadata=b;console.log("PDF "+a.fingerprint+" ["+c.PDFFormatVersion+" "+(c.Producer||"-")+" / "+(c.Creator||"-")+"]"+(PDFJS.version?" (PDF.js: "+PDFJS.version+")":""));var d;b&&b.has("dc:title")&&(d=b.get("dc:title"));!d&&(c&&c.Title)&&(d=c.Title);d&&p.setTitle(d+" - "+document.title)})},setInitialView:function(a,b){this.currentScale=0;this.currentScaleValue=null;this.initialBookmark?(this.setHash(this.initialBookmark),this.initialBookmark=null):a?this.setHash(a):b&&(this.parseScale(b,!0),this.page= 1);PDFView.currentScale===UNKNOWN_SCALE&&this.parseScale(DEFAULT_SCALE,!0)},renderHighestPriority:function(){var a=this.getVisiblePages();(a=this.getHighestPriority(a,this.pages,this.pageViewScroll.down))?this.renderView(a,"page"):this.sidebarOpen&&(a=this.getVisibleThumbs(),(a=this.getHighestPriority(a,this.thumbnails,this.thumbnailViewScroll.down))&&this.renderView(a,"thumbnail"))},getHighestPriority:function(a,b,c){var d=a.views,e=d.length;if(0===e)return!1;for(var j=0;jj)break;d+=e.el.clientHeight}var g=[];if(this.isFullscreen)return c=this.pages[this.page-1],g.push({id:c.id,view:c}),{first:c,last:c,views:g};a=j+a.clientHeight;for(var m,k,l;f<= h&&dc&&50>b-c||((0a||0>this.mouseScrollDelta&&0=c+f[b].str.length;)c+=f[b].str.length,b++;b==f.length&&console.error("Could not find matching mapping");for(var n= {begin:{divIdx:b,offset:l-c}},l=l+g;b!==h&&l>c+f[b].str.length;)c+=f[b].str.length,b++;n.end={divIdx:b,offset:l-c};m.push(n)}return m};this.renderMatches=function(a){function b(a,c){var d=a.divIdx,e=h[d];e.textContent="";var g=f[d].str.substring(0,a.offset),g=document.createTextNode(g);if(c){var d=m&&d===k,j=document.createElement("span");j.className=c+(d?" selected":"");j.appendChild(g);e.appendChild(j)}else e.appendChild(g)}function c(a,b,d){var e=a.divIdx,g=h[e];a=f[e].str.substring(a.offset,b.offset); a=document.createTextNode(a);d?(b=document.createElement("span"),b.className=d,b.appendChild(a),g.appendChild(b)):g.appendChild(a)}if(0!==a.length){var f=this.textContent.bidiTexts,h=this.textDivs,g=null,m=this.pageIdx===PDFFindController.selected.pageIdx,k=PDFFindController.selected.matchIdx,l={divIdx:-1,offset:void 0},n=k,p=n+1;if(PDFFindController.state.highlightAll)n=0,p=a.length;else if(!m)return;for(;nf.percent)break;if(f.id===PDFView.page){j=!0;break}}j||(c=b[0].id);PDFView.isFullscreen||(updateViewarea.inProgress=!0,PDFView.page=c,updateViewarea.inProgress=!1);var b=PDFView.currentScale,c=PDFView.currentScaleValue,h=c==b?100*b:c,g=a.id,b="#page="+g+("&zoom="+h),m=PDFView.pages[g- 1].getPagePoint(PDFView.container.scrollLeft,PDFView.container.scrollTop-a.y),b=b+(","+Math.round(m[0])+","+Math.round(m[1])),k=PDFView.store;k.initializedPromise.then(function(){k.set("exists",!0);k.set("page",g);k.set("zoom",h);k.set("scrollLeft",Math.round(m[0]));k.set("scrollTop",Math.round(m[1]))});PDFView.getAnchorUrl(b)}}} window.addEventListener("resize",function(){PDFView.initialized&&(document.getElementById("pageWidthOption").selected||document.getElementById("pageFitOption").selected||document.getElementById("pageAutoOption").selected)&&PDFView.parseScale(document.getElementById("scaleSelect").value);updateViewarea()});window.addEventListener("hashchange",function(){PDFView.setHash(document.location.hash.substring(1))}); window.addEventListener("change",function(a){var b=a.target.files;b&&0!=b.length&&(a=new FileReader,a.onload=function(a){a=new Uint8Array(a.target.result);PDFView.open(a,0)},b=b[0],a.readAsArrayBuffer(b),PDFView.setTitleUsingUrl(b.name))},!0);function selectScaleOption(a){for(var b=document.getElementById("scaleSelect").options,c=!1,d=0;d=c)&&scrollIntoView(b)}}document.getElementById("previous").disabled=1>=a;document.getElementById("next").disabled= a>=PDFView.pages.length},!0);window.addEventListener("DOMMouseScroll",function(a){if(a.ctrlKey){a.preventDefault();var b=a.detail;a=0