var pdfembGrabToPan=function(){function e(e){this.element=e.element,this.document=e.element.ownerDocument,"function"==typeof e.ignoreTarget&&(this.ignoreTarget=e.ignoreTarget),this.onActiveChanged=e.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._onmousewheel=this._onmousewheel.bind(this),this._endPan=this._endPan.bind(this),(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}var t;e.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function(){!this.active&&(this.active=!0,this.element.addEventListener("mousedown",this._onmousedown,!0),this.element.addEventListener("mousewheel",this._onmousewheel),this.element.addEventListener("wheel",this._onmousewheel),this.element.addEventListener("DOMMouseScroll",this._onmousewheel),this.element.classList.add(this.CSS_CLASS_GRAB),this.onActiveChanged)&&this.onActiveChanged(!0)},deactivate:function(){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(e){return e[t]("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function(e){if(0===e.button&&!this.ignoreTarget(e.target)){this.scrollLeftStart=this.element.scrollLeft,this.scrollTopStart=this.element.scrollTop,this.clientXStart=e.clientX,this.clientYStart=e.clientY,this.document.addEventListener("mousemove",this._onmousemove,!0),this.document.addEventListener("mouseup",this._endPan,!0),this.element.addEventListener("scroll",this._endPan,!0),e.preventDefault(),e.stopPropagation(),this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);var t=document.activeElement;t&&!t.contains(e.target)&&t.blur()}},_onmousemove:function(e){var t;this.element.removeEventListener("scroll",this._endPan,!0),(t="buttons"in e&&n?!(1|e.buttons):i||o?0===e.which:void 0)?this._endPan():(t=e.clientX-this.clientXStart,this.element.scrollTop=this.scrollTopStart-(e.clientY-this.clientYStart),this.element.scrollLeft=this.scrollLeftStart-t,this.overlay.parentNode||document.body.appendChild(this.overlay))},_onmousewheel:function(e){this.element.removeEventListener("scroll",this._endPan,!0);var t=.5;e.deltaMode&&(1==e.deltaMode&&(t=10),2==e.deltaMode&&(t=1e3));var n=e.deltaY?-e.deltaY:e.wheelDelta?e.wheelDelta:-e.detail;if(this.scrollLeftStart=this.element.scrollLeft,this.scrollTopStart=this.element.scrollTop,t*=n,this.element.scrollTop=this.scrollTopStart-t,this.overlay.parentNode||document.body.appendChild(this.overlay),this.element.scrollTop!=this.scrollTopStart||0==t)return e.preventDefault(),!1},_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)}},["webkitM","mozM","msM","oM","m"].some(function(e){return(e+="atches")in document.documentElement&&(t=e),(e+="Selector")in document.documentElement&&(t=e),t});var n=!document.documentMode||9",{class:"pdfemb-pagescontainer",style:o})),n.data("pdfDoc",a),"top"!=(o=n.data("toolbar"))&&"both"!=o||this.addToolbar(!0,"on"==n.data("toolbar-fixed"),i),"bottom"!=o&&"both"!=o||this.addToolbar(!1,"on"==n.data("toolbar-fixed"),i),t.annotationsLayerFactory=void 0!==PDFEMB_NS.pdfembPremiumAnnotationsLayerFactory?new PDFEMB_NS.pdfembPremiumAnnotationsLayerFactory:{createAnnotationsLayerBuilder:function(e,t){return null}},t.annotationLayerFactories=[],n.on("pdfembGotopage",function(e,n){n>this.numPages||0>=n||(t.gotoPage(n),t.jumpToTop())}),n.on("pdfembGotoHash",function(e,n){var a;n.dest&&(dest=n.dest,"string"==typeof dest?(destString=dest,a=t.pdfDoc.getDestination(dest)):a=Promise.resolve(dest),a.then(function(e){e instanceof Array&&!(1>e.length)&&t.pdfDoc.getPageIndex(e[0]).then(function(e){(e+=1)>t.numPages||0>=e||t.currentPageNum==e||(t.gotoPage(e),t.jumpToTop())})}))}),n.on("pdfembGotoAction",function(e,n){var a=t.currentPageNum,i=a;switch(n){case"GoBack":--i;break;case"GoForward":case"NextPage":++i;break;case"PrevPage":--i;break;case"LastPage":i=t.pageCount;break;case"FirstPage":i=1}i==a||i>t.pageCount||0>=i||t.gotoPage(i)}),n.on("pdfembMagnify",function(e){t.magnifyEvent(e)}),n.on("pdfembChangeZoom",function(e,n){t.changeZoom(n)}),this.pageCount=a.numPages,(!n.data("pagenum")||1>n.data("pagenum")||n.data("pagenum")>this.pageCount)&&n.data("pagenum",1),n.data("showIsSecure",this.showIsSecure),n.data("pageNumPending",null),a="on"==n.data("fullScreen")?parseInt(n.data("startfpzoom")):parseInt(n.data("startzoom")),(isNaN(a)||20>a||500=this.pageWidth||0>=this.pageHeight)&&this.divContainer.empty().append(document.createTextNode(pdfemb_trans.objectL10n.widthheightinvalid))},o.prototype.createPageInnerDivs=function(){for(var t=this.divContainer.find(".pdfemb-pagescontainer"),n=1;n<=this.pageCount;++n){var a=t.find(".pdfemb-inner-div.pdfemb-page"+n);0==a.length&&((a=e("
",{class:"pdfemb-inner-div pdfemb-page"+n})).data("pageNum",n),t.append(a))}this.resizeInnerDivs()},o.prototype.addGrabToPan=function(){var t=this,n=t.divContainer,a=n.find("div.pdfemb-pagescontainer"),i=new pdfembGrabToPan({element:a[0]});n.data("grabtopan",i),a.on("scroll",function(e){var n=t.getTopVisiblePageNum();n!=t.currentPageNum&&(t.currentPageNum=n,t.updatePageNumDisplay(n),t.renderPage(n,!1),t.prerenderNearbyPages(n),t.deallocateFarAwayPages(n)),e.stopPropagation()}),e(window).resize(function(){setTimeout(function(){t.checkForResize()},100)})},o.prototype.resizeInnerDivs=function(t){var n=this,a=n.wantCanvasWidth,i=n.wantCanvasHeight,o=n.wantHeight,s=this.divContainer.find(".pdfemb-pagescontainer").find(".pdfemb-inner-div");t&&(s=s.filter(".pdfemb-page"+t));var r=0;s.each(function(o,d){var h=e(d),p=h.data("widthfactor"),c=h.data("heightfactor");p||(p=1),c||(c=1),h.data("invalidation-round",this.invalidationRound-1),h.css("width",a*p);var m=i*c+(t==n.numPages||!t&&o==s.length-1?0:2);h.css("height",m),r+=m,(h=h.find(".pdfemb-the-canvas")).css("width",a*p),h.css("height",i*c)});var d=0;!t&&rthis.zoom&&(t*=Math.min(Math.ceil(100/this.zoom),10),n*=Math.min(Math.ceil(100/this.zoom),10)),n=Math.max(1,e-n);n<=Math.min(e+t,this.numPages);++n)n!=e&&this.renderPage(n,!1)},o.prototype.deallocateFarAwayPages=function(e){var t=50,n=50;100>this.zoom&&(t+=i=Math.min(Math.ceil(100/this.zoom),50),n+=i);var a,i=function(e){var t=(e=o.find(".pdfemb-page"+e)).find(".pdfemb-the-canvas");t.length&&(t.remove(),e.data("invalidation-round",0))},o=this.divContainer.find("div.pdfemb-pagescontainer");for(a=3;a=p)&&(p=h)),0>=p&&(p=e),p>h&&0=f||f>t)&&(f="auto"==o.data("height")?o.parent().height()-l*m.height():t),this.userHeight=f,p=Math.floor(p),t=Math.floor(t),h=100;var u=p-(this.vscrollbar?a:0),g=t-(this.hscrollbar?i:0),v=1;c||16777e3<(u=u*(h=this.zoom)/100)*(g=g*h/100)*n*n&&(v=16777e3/(u*g*n*n)),p!=o.width()&&o.width(p),o.height()!=f&&o.height(f+l*m.height()),s.width(p),s.height(f),o=m.filter(".pdfemb-toolbar-top"),0=e||e>this.pageCount||(this.renderPage(e,!0),this.currentPageNum=e,this.updatePageNumDisplay(e),this.prerenderNearbyPages(e),this.deallocateFarAwayPages(e))},o.prototype.updatePageNumDisplay=function(t){var n=this.divContainer;n.find("div.pdfemb-toolbar .pdfemb-page-num").each(function(n,a){var i=e(a);i.is("span")?i.text(t):i.val(t)}),t=o)a&&i.scrollPageIntoView(t);else{var p=h.data("pending-drawing-round");p>=o||(0",{class:"pdfemb-the-canvas"}),h.append(l)),a&&i.scrollPageIntoView(t);var f=i.wantCanvasWidth,u=i.wantCanvasHeight,g=i.canvasscale,v=i.zoom;l.css("width",f*c),l.css("height",u*m),i.wantMobile?s.data("grabtopan").deactivate():s.data("grabtopan").activate();var b=r.getViewport(g*v/100),w=document.createElement("canvas");w.width=f*n*i.reducefactor*c,w.height=u*n*i.reducefactor*m;var P=w.getContext("2d"),y=function(){l[0].width=f*n*i.reducefactor*c,l[0].height=u*n*i.reducefactor*m,i.preRenderCanvas(P,t,v);var e=P.getImageData(0,0,w.width,w.height);l[0].getContext("2d").putImageData(e,0,0),e=null,void 0===i.annotationLayerFactories[t]?(e=i.annotationsLayerFactory.createAnnotationsLayerBuilder(h[0],r),i.annotationLayerFactories[t]=e):e=i.annotationLayerFactories[t],null!=e&&e.setupAnnotations(b,i.divContainer.data("newwindow")),h.data("invalidation-round",o),p=h.data("pending-drawing-round"),h.data("pending-drawing-round",""),p>o&&i.renderPage(t,!1)};r.render({canvasContext:P,viewport:b,transform:[n*i.reducefactor,0,0,n*i.reducefactor,0,0]}).promise.then(function(){"requestAnimationFrame"in window?window.requestAnimationFrame(y):setTimeout(y,1)})})))}},o.prototype.changeZoom=function(e){var t=this.divContainer,n=this.zoom;this.zoom=e=n+e,t.find("span.pdfemb-zoom").text(e+"%"),this.fromZoom=n,this.toZoom=e,t=t.find(".pdfemb-pagescontainer"),this.pccentreLeft=t.width()/2,this.pccentreTop=t.height()/2,this.resizeViewer(),this.resizeInnerDivs(),this.invalidateAllPages(),this.renderPage(this.currentPageNum),this.prerenderNearbyPages(this.currentPageNum)},o.prototype.queueRenderPage=function(e,t){this.renderPage(e,t)},o.prototype.addToolbar=function(t,n,a){var i=this.divContainer,o=this,s=e("
",{class:"pdfemb-toolbar pdfemb-toolbar"+(n?"-fixed":"-hover")+" "+(t?" pdfemb-toolbar-top":"pdfemb-toolbar-bottom")}),r=e('');s.append(r);var d=e('');s.append(d),s.append(e('
'+pdfemb_trans.objectL10n.page+' 0 /
'));var h=e('');s.append(h);var p=e('');s.append(p),s.append(e("
"+pdfemb_trans.objectL10n.zoom+' 100%
')),a&&s.append(e("
"+pdfemb_trans.objectL10n.secure+"
")),t?i.prepend(s):i.append(s),r.on("click",function(e){1>=o.currentPageNum||(o.gotoPage(o.currentPageNum-1),o.jumpToTop())}),d.on("click",function(e){o.currentPageNum>=o.pageCount||0==o.currentPageNum||(o.gotoPage(o.currentPageNum+1),o.jumpToTop())}),p.on("click",function(e){500<=o.zoom||o.changeZoom(10)}),h.on("click",function(e){20>=o.zoom||o.changeZoom(-10)}),o.addMoreToolbar(s),n||(i.on("mouseenter",function(e){!0!==(e=i.find("div.pdfemb-toolbar-hover")).data("no-hover")&&e.show()}),i.on("mouseleave",function(e){i.find("div.pdfemb-toolbar-hover").hide()}),i.on("pdfembTouchTapped",function(e){if(e.stopPropagation(),e.preventDefault(),!o.locktaps){o.locktaps=!0;var t=(e=i.find("div.pdfemb-toolbar-hover")).is(":visible");1==e.data("no-hover")&&(t=!0),t?e.hide():e.show(),setTimeout(function(){o.locktaps=!1},250)}})),"on"==pdfemb_trans.poweredby&&s.append(e("
Powered by
",{class:"pdfemb-poweredby"}).append(e('wp-pdf.com')))},o.prototype.magnifyEvent=function(e){var t=e.originalEvent.magnification;if(-1==t)this.resizeViewer(),this.resizeInnerDivs(),this.invalidateAllPages(),this.renderPage(this.getTopVisiblePageNum());else{var n=this.divContainer.find(".pdfemb-pagescontainer").offset();this.magnifyZoom(t,e.originalEvent.centreLeft-n.left,e.originalEvent.centreTop-n.top)}},o.prototype.magnifyZoom=function(e,t,n){var a=this.zoom;20>(e=Math.floor(a*e))&&(e=20),500",{class:o.attr("class"),style:o.attr("style")})).data(e.extend({"pdf-url":o.attr("href")},s)),o.replaceWith(i)}else i=o;i.append(e("
",{class:"pdfemb-loadingmsg"}).append(document.createTextNode(pdfemb_trans.objectL10n.loading))),"on"==i.data("disablerightclick")&&i.bind("contextmenu",function(e){e.preventDefault()});var r=function(e,t){new PDFEMB_NS.pdfembPagesViewerUsable(e,i,t).setup()};if(i.data("pdfDoc"))r(i.data("pdfDoc"),i.data("showIsSecure"));else{var d=i.data("pdf-url");PDFEMB_NS.pdfembGetPDF(d,function(n,a){null!==n?pdfjsLib.getDocument(n,t).promise.then(function(e){r(e,a)},function(t){var n=document.createTextNode(t.message);"UnknownErrorException"==t.name&&"Failed to fetch"==t.message&&(n=e("").append(document.createTextNode(t.message+" "+pdfemb_trans.objectL10n.domainerror+" ")).append(e(''+pdfemb_trans.objectL10n.clickhereinfo+""))),i.empty().append(e("
",{class:"pdfemb-errormsg"}).append(n))}):i.empty().append(e("
",{class:"pdfemb-errormsg"}).append(msgnode=e("").append(document.createTextNode("Failed to load and decrypt PDF"))))})}}),this},"undefined"===pdfemb_trans.cmap_url)var t="";else t=pdfemb_trans.cmap_url;e(".pdfemb-viewer").pdfEmbedder(t)});