pdfviewer
Version:
PDF Viewer using Mozila PDF JS.
2 lines • 525 kB
JavaScript
"undefined"==typeof PDFJS&&(("undefined"!=typeof window?window:this).PDFJS={}),PDFJS.version="1.1.1",PDFJS.build="5fe37f5",function(){"use strict";function e(e){PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.infos&&console.log("Info: "+e)}function t(e){PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.warnings&&console.log("Warning: "+e)}function a(e){if(arguments.length>1){var t=["Error:"];t.push.apply(t,arguments),console.log.apply(console,t),e=[].join.call(arguments," ")}else console.log("Error: "+e);throw console.log(r()),Y.notify(K.unknown),new Error(e)}function r(){try{throw new Error}catch(e){return e.stack?e.stack.split("\n").slice(2).join("\n"):""}}function i(e,t){e||a(t)}function n(e,t){if(!e)return!1;var a=/^[a-z][a-z0-9+\-.]*(?=:)/i.exec(e);if(!a)return t;switch(a=a[0].toLowerCase()){case"http":case"https":case"ftp":case"mailto":case"tel":return!0;default:return!1}}function o(e,t,a){return Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!1}),a}function s(e){i(null!==e&&"object"==typeof e&&void 0!==e.length,"Invalid argument for bytesToString");var t=e.length,a=8192;if(a>t)return String.fromCharCode.apply(null,e);for(var r=[],n=0;t>n;n+=a){var o=Math.min(n+a,t),s=e.subarray(n,o);r.push(String.fromCharCode.apply(null,s))}return r.join("")}function c(e){i("string"==typeof e,"Invalid argument for stringToBytes");for(var t=e.length,a=new Uint8Array(t),r=0;t>r;++r)a[r]=255&e.charCodeAt(r);return a}function l(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}function h(e){for(var t=1,a=0;e>t;)t<<=1,a++;return a}function u(e,t){return e[t]<<24>>24}function f(e,t){return e[t]<<8|e[t+1]}function d(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function g(){var e=new Uint8Array(2);e[0]=1;var t=new Uint16Array(e.buffer);return 1===t[0]}function m(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d"),a=t.createImageData(1,1);return"undefined"!=typeof a.data.buffer}function p(e){var t,a=e.length,r=[];if("þ"===e[0]&&"ÿ"===e[1])for(t=2;a>t;t+=2)r.push(String.fromCharCode(e.charCodeAt(t)<<8|e.charCodeAt(t+1)));else for(t=0;a>t;++t){var i=le[e.charCodeAt(t)];r.push(i?String.fromCharCode(i):e.charAt(t))}return r.join("")}function b(e){return decodeURIComponent(escape(e))}function v(e){for(var t in e)return!1;return!0}function y(e){return"boolean"==typeof e}function k(e){return"number"==typeof e&&(0|e)===e}function w(e){return"number"==typeof e}function x(e){return"string"==typeof e}function C(e){return e instanceof ye}function S(e,t){return e instanceof ke&&(void 0===t||e.cmd===t)}function A(e,t){if(!(e instanceof we))return!1;if(!t)return!0;var a=e.get("Type");return C(a)&&a.name===t}function B(e){return e instanceof Array}function I(e){return"object"==typeof e&&null!==e&&void 0!==e.getBytes}function T(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength}function O(e){return e instanceof xe}function P(){var e={};return e.promise=new Promise(function(t,a){e.resolve=t,e.reject=a}),e}function L(e,t){this.name=e,this.comObj=t,this.callbackIndex=1,this.postMessageTransfers=!0;var r=this.callbacksCapabilities={},i=this.actionHandler={};i.console_log=[function(e){console.log.apply(console,e)}],i.console_error=[function(e){console.error.apply(console,e)}],i._unsupported_feature=[function(e){Y.notify(e)}],t.onmessage=function(e){var n=e.data;if(n.isReply){var o=n.callbackId;if(n.callbackId in r){var s=r[o];delete r[o],"error"in n?s.reject(n.error):s.resolve(n.data)}else a("Cannot resolve callback "+o)}else if(n.action in i){var c=i[n.action];n.callbackId?Promise.resolve().then(function(){return c[0].call(c[1],n.data)}).then(function(e){t.postMessage({isReply:!0,callbackId:n.callbackId,data:e})},function(e){t.postMessage({isReply:!0,callbackId:n.callbackId,error:e})}):c[0].call(c[1],n.data)}else a("Unknown action from worker: "+n.action)}}function R(e,t,a){var r=t.get("Matrix"),i=t.get("BBox"),n=t.get("XStep"),o=t.get("YStep"),s=t.get("PaintType"),c=t.get("TilingType");return["TilingPattern",a,e,r,i,n,o,s,c]}function M(e){return e>=65520&&65535>=e?0:e>=62976&&63743>=e?Gt[e]||e:e}function D(e){for(var t=0,a=Xt.length;a>t;t++){var r=Xt[t];if(e>=r.begin&&e<r.end)return t}return-1}function E(e){var t=Xt[13];return e>=t.begin&&e<t.end?!0:(t=Xt[11],e>=t.begin&&e<t.end?!0:!1)}function q(e){var t=e.length;if(1>=t||!E(e.charCodeAt(0)))return e;for(var a="",r=t-1;r>=0;r--)a+=e[r];return a}function U(e){if(e.fontMatrix[0]!==H[0]){var t=.001/e.fontMatrix[0],a=e.widths;for(var r in a)a[r]*=t;e.defaultWidth*=t}}function F(e,t){switch(e){case"Type1":return"Type1C"===t?W.TYPE1C:W.TYPE1;case"CIDFontType0":return"CIDFontType0C"===t?W.CIDFONTTYPE0C:W.CIDFONTTYPE0;case"OpenType":return W.OPENTYPE;case"TrueType":return W.TRUETYPE;case"CIDFontType2":return W.CIDFONTTYPE2;case"MMType1":return W.MMTYPE1;case"Type0":return W.TYPE0;default:return W.UNKNOWN}}function N(e,t,a){var r,i,n,o=Object.create(null);if(e.baseEncodingName)for(n=Ut[e.baseEncodingName],i=0;i<n.length;i++)r=a.indexOf(n[i]),o[i]=r>=0?r:0;else if(e.flags&qt.Symbolic)for(i in t)o[i]=t[i];else for(n=Ut.StandardEncoding,i=0;i<n.length;i++)r=a.indexOf(n[i]),o[i]=r>=0?r:0;var s=e.differences;if(s)for(i in s){var c=s[i];r=a.indexOf(c),o[i]=r>=0?r:0}return o}function j(e){return e===Ca}var z="undefined"==typeof window?this:window,H=("undefined"==typeof window,[.001,0,0,.001,0,0]),G={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},X={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},_={WIDGET:1,TEXT:2,LINK:3},J={UNKNOWN:0,FLATE:1,LZW:2,DCT:3,JPX:4,JBIG:5,A85:6,AHX:7,CCF:8,RL:9},W={UNKNOWN:0,TYPE1:1,TYPE1C:2,CIDFONTTYPE0:3,CIDFONTTYPE0C:4,TRUETYPE:5,CIDFONTTYPE2:6,TYPE3:7,OPENTYPE:8,TYPE0:9,MMTYPE1:10};z.PDFJS||(z.PDFJS={}),z.PDFJS.pdfBug=!1,PDFJS.VERBOSITY_LEVELS={errors:0,warnings:1,infos:5};var V=PDFJS.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},K=PDFJS.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},Y=PDFJS.UnsupportedManager=function(){var e=[];return{listen:function(t){e.push(t)},notify:function(a){t('Unsupported feature "'+a+'"');for(var r=0,i=e.length;i>r;r++)e[r](a)}}}();PDFJS.isValidUrl=n,PDFJS.shadow=o;var Z=PDFJS.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Q=function(){function e(e,t){this.name="PasswordException",this.message=e,this.code=t}return e.prototype=new Error,e.constructor=e,e}();PDFJS.PasswordException=Q;var $=function(){function e(e,t){this.name="UnknownErrorException",this.message=e,this.details=t}return e.prototype=new Error,e.constructor=e,e}();PDFJS.UnknownErrorException=$;var ee=function(){function e(e){this.name="InvalidPDFException",this.message=e}return e.prototype=new Error,e.constructor=e,e}();PDFJS.InvalidPDFException=ee;var te=function(){function e(e){this.name="MissingPDFException",this.message=e}return e.prototype=new Error,e.constructor=e,e}();PDFJS.MissingPDFException=te;var ae=function(){function e(e,t){this.name="UnexpectedResponseException",this.message=e,this.status=t}return e.prototype=new Error,e.constructor=e,e}();PDFJS.UnexpectedResponseException=ae;var re=function(){function e(e){this.message=e}return e.prototype=new Error,e.prototype.name="NotImplementedException",e.constructor=e,e}(),ie=function(){function e(e,t){this.begin=e,this.end=t,this.message="Missing data ["+e+", "+t+")"}return e.prototype=new Error,e.prototype.name="MissingDataException",e.constructor=e,e}(),ne=function(){function e(e){this.message=e}return e.prototype=new Error,e.prototype.name="XRefParseException",e.constructor=e,e}();Object.defineProperty(PDFJS,"isLittleEndian",{configurable:!0,get:function(){return o(PDFJS,"isLittleEndian",g())}}),Object.defineProperty(PDFJS,"hasCanvasTypedArrays",{configurable:!0,get:function(){return o(PDFJS,"hasCanvasTypedArrays",m())}});var oe=function(){function e(e,t){this.buffer=e,this.byteLength=e.length,this.length=void 0===t?this.byteLength>>2:t,a(this.length)}function t(e){return{get:function(){var t=this.buffer,a=e<<2;return(t[a]|t[a+1]<<8|t[a+2]<<16|t[a+3]<<24)>>>0},set:function(t){var a=this.buffer,r=e<<2;a[r]=255&t,a[r+1]=t>>8&255,a[r+2]=t>>16&255,a[r+3]=t>>>24&255}}}function a(a){for(;a>r;)Object.defineProperty(e.prototype,r,t(r)),r++}e.prototype=Object.create(null);var r=0;return e}(),se=[1,0,0,1,0,0],ce=PDFJS.Util=function(){function e(){}var t=["rgb(",0,",",0,",",0,")"];return e.makeCssRgb=function(e,a,r){return t[1]=e,t[3]=a,t[5]=r,t.join("")},e.transform=function(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]},e.applyTransform=function(e,t){var a=e[0]*t[0]+e[1]*t[2]+t[4],r=e[0]*t[1]+e[1]*t[3]+t[5];return[a,r]},e.applyInverseTransform=function(e,t){var a=t[0]*t[3]-t[1]*t[2],r=(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/a,i=(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/a;return[r,i]},e.getAxialAlignedBoundingBox=function(t,a){var r=e.applyTransform(t,a),i=e.applyTransform(t.slice(2,4),a),n=e.applyTransform([t[0],t[3]],a),o=e.applyTransform([t[2],t[1]],a);return[Math.min(r[0],i[0],n[0],o[0]),Math.min(r[1],i[1],n[1],o[1]),Math.max(r[0],i[0],n[0],o[0]),Math.max(r[1],i[1],n[1],o[1])]},e.inverseTransform=function(e){var t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]},e.apply3dTransform=function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]},e.singularValueDecompose2dScale=function(e){var t=[e[0],e[2],e[1],e[3]],a=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],n=e[2]*t[1]+e[3]*t[3],o=(a+n)/2,s=Math.sqrt((a+n)*(a+n)-4*(a*n-i*r))/2,c=o+s||1,l=o-s||1;return[Math.sqrt(c),Math.sqrt(l)]},e.normalizeRect=function(e){var t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t},e.intersect=function(t,a){function r(e,t){return e-t}var i=[t[0],t[2],a[0],a[2]].sort(r),n=[t[1],t[3],a[1],a[3]].sort(r),o=[];return t=e.normalizeRect(t),a=e.normalizeRect(a),i[0]===t[0]&&i[1]===a[0]||i[0]===a[0]&&i[1]===t[0]?(o[0]=i[1],o[2]=i[2],n[0]===t[1]&&n[1]===a[1]||n[0]===a[1]&&n[1]===t[1]?(o[1]=n[1],o[3]=n[2],o):!1):!1},e.sign=function(e){return 0>e?-1:1},e.appendToArray=function(e,t){Array.prototype.push.apply(e,t)},e.prependToArray=function(e,t){Array.prototype.unshift.apply(e,t)},e.extendObj=function(e,t){for(var a in t)e[a]=t[a]},e.getInheritableProperty=function(e,t){for(;e&&!e.has(t);)e=e.get("Parent");return e?e.get(t):null},e.inherit=function(e,t,a){e.prototype=Object.create(t.prototype),e.prototype.constructor=e;for(var r in a)e.prototype[r]=a[r]},e.loadScript=function(e,t){var a=document.createElement("script"),r=!1;a.setAttribute("src",e),t&&(a.onload=function(){r||t(),r=!0}),document.getElementsByTagName("head")[0].appendChild(a)},e}(),le=(PDFJS.PageViewport=function(){function e(e,t,a,r,i,n){this.viewBox=e,this.scale=t,this.rotation=a,this.offsetX=r,this.offsetY=i;var o,s,c,l,h=(e[2]+e[0])/2,u=(e[3]+e[1])/2;switch(a%=360,a=0>a?a+360:a){case 180:o=-1,s=0,c=0,l=1;break;case 90:o=0,s=1,c=1,l=0;break;case 270:o=0,s=-1,c=-1,l=0;break;default:o=1,s=0,c=0,l=-1}n&&(c=-c,l=-l);var f,d,g,m;0===o?(f=Math.abs(u-e[1])*t+r,d=Math.abs(h-e[0])*t+i,g=Math.abs(e[3]-e[1])*t,m=Math.abs(e[2]-e[0])*t):(f=Math.abs(h-e[0])*t+r,d=Math.abs(u-e[1])*t+i,g=Math.abs(e[2]-e[0])*t,m=Math.abs(e[3]-e[1])*t),this.transform=[o*t,s*t,c*t,l*t,f-o*t*h-c*t*u,d-s*t*h-l*t*u],this.width=g,this.height=m,this.fontScale=t}return e.prototype={clone:function(t){t=t||{};var a="scale"in t?t.scale:this.scale,r="rotation"in t?t.rotation:this.rotation;return new e(this.viewBox.slice(),a,r,this.offsetX,this.offsetY,t.dontFlip)},convertToViewportPoint:function(e,t){return ce.applyTransform([e,t],this.transform)},convertToViewportRectangle:function(e){var t=ce.applyTransform([e[0],e[1]],this.transform),a=ce.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],a[0],a[1]]},convertToPdfPoint:function(e,t){return ce.applyInverseTransform([e,t],this.transform)}},e}(),[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364]);PDFJS.createPromiseCapability=P,function(){function e(e){this._status=a,this._handlers=[];try{e.call(this,this._resolve.bind(this),this._reject.bind(this))}catch(t){this._reject(t)}}if(z.Promise)return"function"!=typeof z.Promise.all&&(z.Promise.all=function(e){var t,a,r=0,i=[],n=new z.Promise(function(e,r){t=e,a=r});return e.forEach(function(e,n){r++,e.then(function(e){i[n]=e,r--,0===r&&t(i)},a)}),0===r&&t(i),n}),"function"!=typeof z.Promise.resolve&&(z.Promise.resolve=function(e){return new z.Promise(function(t){t(e)})}),"function"!=typeof z.Promise.reject&&(z.Promise.reject=function(e){return new z.Promise(function(t,a){a(e)})}),void("function"!=typeof z.Promise.prototype["catch"]&&(z.Promise.prototype["catch"]=function(e){return z.Promise.prototype.then(void 0,e)}));var a=0,r=1,i=2,n=500,o={handlers:[],running:!1,unhandledRejections:[],pendingRejectionCheck:!1,scheduleHandlers:function(e){e._status!==a&&(this.handlers=this.handlers.concat(e._handlers),e._handlers=[],this.running||(this.running=!0,setTimeout(this.runHandlers.bind(this),0)))},runHandlers:function(){for(var e=1,t=Date.now()+e;this.handlers.length>0;){var a=this.handlers.shift(),n=a.thisPromise._status,o=a.thisPromise._value;try{n===r?"function"==typeof a.onResolve&&(o=a.onResolve(o)):"function"==typeof a.onReject&&(o=a.onReject(o),n=r,a.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(a.thisPromise))}catch(s){n=i,o=s}if(a.nextPromise._updateStatus(n,o),Date.now()>=t)break}return this.handlers.length>0?void setTimeout(this.runHandlers.bind(this),0):void(this.running=!1)},addUnhandledRejection:function(e){this.unhandledRejections.push({promise:e,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(e){e._unhandledRejection=!1;for(var t=0;t<this.unhandledRejections.length;t++)this.unhandledRejections[t].promise===e&&(this.unhandledRejections.splice(t),t--)},scheduleRejectionCheck:function(){this.pendingRejectionCheck||(this.pendingRejectionCheck=!0,setTimeout(function(){this.pendingRejectionCheck=!1;for(var e=Date.now(),a=0;a<this.unhandledRejections.length;a++)if(e-this.unhandledRejections[a].time>n){var r=this.unhandledRejections[a].promise._value,i="Unhandled rejection: "+r;r.stack&&(i+="\n"+r.stack),t(i),this.unhandledRejections.splice(a),a--}this.unhandledRejections.length&&this.scheduleRejectionCheck()}.bind(this),n))}};e.all=function(t){function a(e){o._status!==i&&(c=[],n(e))}var r,n,o=new e(function(e,t){r=e,n=t}),s=t.length,c=[];if(0===s)return r(c),o;for(var l=0,h=t.length;h>l;++l){var u=t[l],f=function(e){return function(t){o._status!==i&&(c[e]=t,s--,0===s&&r(c))}}(l);e.isPromise(u)?u.then(f,a):f(u)}return o},e.isPromise=function(e){return e&&"function"==typeof e.then},e.resolve=function(t){return new e(function(e){e(t)})},e.reject=function(t){return new e(function(e,a){a(t)})},e.prototype={_status:null,_value:null,_handlers:null,_unhandledRejection:null,_updateStatus:function(t,a){if(this._status!==r&&this._status!==i){if(t===r&&e.isPromise(a))return void a.then(this._updateStatus.bind(this,r),this._updateStatus.bind(this,i));this._status=t,this._value=a,t===i&&0===this._handlers.length&&(this._unhandledRejection=!0,o.addUnhandledRejection(this)),o.scheduleHandlers(this)}},_resolve:function(e){this._updateStatus(r,e)},_reject:function(e){this._updateStatus(i,e)},then:function(t,a){var r=new e(function(e,t){this.resolve=e,this.reject=t});return this._handlers.push({thisPromise:this,onResolve:t,onReject:a,nextPromise:r}),o.scheduleHandlers(this),r},"catch":function(e){return this.then(void 0,e)}},z.Promise=e}();!function(){function e(e,t,a){for(;e.length<a;)e+=t;return e}function a(){this.started={},this.times=[],this.enabled=!0}return a.prototype={time:function(e){this.enabled&&(e in this.started&&t("Timer is already running for "+e),this.started[e]=Date.now())},timeEnd:function(e){this.enabled&&(e in this.started||t("Timer has not been started for "+e),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e])},toString:function(){var t,a,r=this.times,i="",n=0;for(t=0,a=r.length;a>t;++t){var o=r[t].name;o.length>n&&(n=o.length)}for(t=0,a=r.length;a>t;++t){var s=r[t],c=s.end-s.start;i+=e(s.name," ",n)+" "+c+"ms\n"}return i}},a}();PDFJS.createBlob=function(e,t){if("undefined"!=typeof Blob)return new Blob([e],{type:t});var a=new MozBlobBuilder;return a.append(e),a.getBlob(t)},PDFJS.createObjectURL=function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return function(t,a){if(!PDFJS.disableCreateObjectURL&&"undefined"!=typeof URL&&URL.createObjectURL){var r=PDFJS.createBlob(t,a);return URL.createObjectURL(r)}for(var i="data:"+a+";base64,",n=0,o=t.length;o>n;n+=3){var s=255&t[n],c=255&t[n+1],l=255&t[n+2],h=s>>2,u=(3&s)<<4|c>>4,f=o>n+1?(15&c)<<2|l>>6:64,d=o>n+2?63&l:64;i+=e[h]+e[u]+e[f]+e[d]}return i}}(),L.prototype={on:function(e,t,r){var i=this.actionHandler;i[e]&&a('There is already an actionName called "'+e+'"'),i[e]=[t,r]},send:function(e,t,a){var r={action:e,data:t};this.postMessage(r,a)},sendWithPromise:function(e,t,a){var r=this.callbackIndex++,i={action:e,data:t,callbackId:r},n=P();this.callbacksCapabilities[r]=n;try{this.postMessage(i,a)}catch(o){n.reject(o)}return n.promise},postMessage:function(e,t){t&&this.postMessageTransfers?this.comObj.postMessage(e,t):this.comObj.postMessage(e)}};var he=function(){function e(e,t){this.url=e,t=t||{},this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this.withCredentials=t.withCredentials||!1,this.getXhr=t.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests={},this.loadedRequests={}}function t(e){var t=e.response;if("string"!=typeof t)return t;for(var a=t.length,r=new Uint8Array(a),i=0;a>i;i++)r[i]=255&t.charCodeAt(i);return r.buffer}var a=200,r=206;return e.prototype={requestRange:function(e,t,a){var r={begin:e,end:t};for(var i in a)r[i]=a[i];return this.request(r)},requestFull:function(e){return this.request(e)},request:function(e){var t=this.getXhr(),a=this.currXhrId++,r=this.pendingRequests[a]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(var i in this.httpHeaders){var n=this.httpHeaders[i];"undefined"!=typeof n&&t.setRequestHeader(i,n)}if(this.isHttp&&"begin"in e&&"end"in e){var o=e.begin+"-"+(e.end-1);t.setRequestHeader("Range","bytes="+o),r.expectedStatus=206}else r.expectedStatus=200;if(e.onProgressiveData){try{t.responseType="moz-chunked-arraybuffer"}catch(s){}"moz-chunked-arraybuffer"===t.responseType?(r.onProgressiveData=e.onProgressiveData,r.mozChunked=!0):t.responseType="arraybuffer"}else t.responseType="arraybuffer";return e.onError&&(t.onerror=function(a){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,a),t.onprogress=this.onProgress.bind(this,a),r.onHeadersReceived=e.onHeadersReceived,r.onDone=e.onDone,r.onError=e.onError,r.onProgress=e.onProgress,t.send(null),a},onProgress:function(e,a){var r=this.pendingRequests[e];if(r){if(r.mozChunked){var i=t(r.xhr);r.onProgressiveData(i)}var n=r.onProgress;n&&n(a)}},onStateChange:function(e,i){var n=this.pendingRequests[e];if(n){var o=n.xhr;if(o.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),4===o.readyState&&e in this.pendingRequests){if(delete this.pendingRequests[e],0===o.status&&this.isHttp)return void(n.onError&&n.onError(o.status));var s=o.status||a,c=s===a&&n.expectedStatus===r;if(!c&&s!==n.expectedStatus)return void(n.onError&&n.onError(o.status));this.loadedRequests[e]=!0;var l=t(o);if(s===r){var h=o.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(h),f=parseInt(u[1],10);n.onDone({begin:f,chunk:l})}else n.onDone(n.onProgressiveData?null:{begin:0,chunk:l})}}},hasPendingRequests:function(){for(var e in this.pendingRequests)return!0;return!1},getRequestXhr:function(e){return this.pendingRequests[e].xhr},isStreamingRequest:function(e){return!!this.pendingRequests[e].onProgressiveData},isPendingRequest:function(e){return e in this.pendingRequests},isLoadedRequest:function(e){return e in this.loadedRequests},abortAllRequests:function(){for(var e in this.pendingRequests)this.abortRequest(0|e)},abortRequest:function(e){var t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}},e}(),ue=function(){function e(e,t,a){this.bytes=new Uint8Array(e),this.start=0,this.pos=0,this.end=e,this.chunkSize=t,this.loadedChunks=[],this.numChunksLoaded=0,this.numChunks=Math.ceil(e/t),this.manager=a,this.progressiveDataLength=0,this.lastSuccessfulEnsureByteChunk=-1}return e.prototype={getMissingChunks:function(){for(var e=[],t=0,a=this.numChunks;a>t;++t)this.loadedChunks[t]||e.push(t);return e},getBaseStreams:function(){return[this]},allChunksLoaded:function(){return this.numChunksLoaded===this.numChunks},onReceiveData:function(e,t){var a=e+t.byteLength;i(e%this.chunkSize===0,"Bad begin offset: "+e);var r=this.bytes.length;i(a%this.chunkSize===0||a===r,"Bad end offset: "+a),this.bytes.set(new Uint8Array(t),e);var n,o=this.chunkSize,s=Math.floor(e/o),c=Math.floor((a-1)/o)+1;for(n=s;c>n;++n)this.loadedChunks[n]||(this.loadedChunks[n]=!0,++this.numChunksLoaded)},onReceiveProgressiveData:function(e){var t=this.progressiveDataLength,a=Math.floor(t/this.chunkSize);this.bytes.set(new Uint8Array(e),t),t+=e.byteLength,this.progressiveDataLength=t;var r,i=t>=this.end?this.numChunks:Math.floor(t/this.chunkSize);for(r=a;i>r;++r)this.loadedChunks[r]||(this.loadedChunks[r]=!0,++this.numChunksLoaded)},ensureByte:function(e){var t=Math.floor(e/this.chunkSize);if(t!==this.lastSuccessfulEnsureByteChunk){if(!this.loadedChunks[t])throw new ie(e,e+1);this.lastSuccessfulEnsureByteChunk=t}},ensureRange:function(e,t){if(!(e>=t||t<=this.progressiveDataLength))for(var a=this.chunkSize,r=Math.floor(e/a),i=Math.floor((t-1)/a)+1,n=r;i>n;++n)if(!this.loadedChunks[n])throw new ie(e,t)},nextEmptyChunk:function(e){var t,a;for(t=e,a=this.numChunks;a>t;++t)if(!this.loadedChunks[t])return t;for(t=0;e>t;++t)if(!this.loadedChunks[t])return t;return null},hasChunk:function(e){return!!this.loadedChunks[e]},get length(){return this.end-this.start},get isEmpty(){return 0===this.length},getByte:function(){var e=this.pos;return e>=this.end?-1:(this.ensureByte(e),this.bytes[this.pos++])},getUint16:function(){var e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t},getInt32:function(){var e=this.getByte(),t=this.getByte(),a=this.getByte(),r=this.getByte();return(e<<24)+(t<<16)+(a<<8)+r},getBytes:function(e){var t=this.bytes,a=this.pos,r=this.end;if(!e)return this.ensureRange(a,r),t.subarray(a,r);var i=a+e;return i>r&&(i=r),this.ensureRange(a,i),this.pos=i,t.subarray(a,i)},peekByte:function(){var e=this.getByte();return this.pos--,e},peekBytes:function(e){var t=this.getBytes(e);return this.pos-=t.length,t},getByteRange:function(e,t){return this.ensureRange(e,t),this.bytes.subarray(e,t)},skip:function(e){e||(e=1),this.pos+=e},reset:function(){this.pos=this.start},moveStart:function(){this.start=this.pos},makeSubStream:function(e,t,a){function r(){}this.ensureRange(e,e+t),r.prototype=Object.create(this),r.prototype.getMissingChunks=function(){for(var e=this.chunkSize,t=Math.floor(this.start/e),a=Math.floor((this.end-1)/e)+1,r=[],i=t;a>i;++i)this.loadedChunks[i]||r.push(i);return r};var i=new r;return i.pos=i.start=e,i.end=e+t||this.end,i.dict=a,i},isStream:!0},e}(),fe=function(){function e(e,t,a,r){this.stream=new ue(e,t,this),this.length=e,this.chunkSize=t,this.url=a,this.disableAutoFetch=r.disableAutoFetch;var i=this.msgHandler=r.msgHandler;if(r.chunkedViewerLoading)i.on("OnDataRange",this.onReceiveData.bind(this)),i.on("OnDataProgress",this.onProgress.bind(this)),this.sendRequest=function(e,t){i.send("RequestDataRange",{begin:e,end:t})};else{var n=function(){return new XMLHttpRequest};this.networkManager=new he(this.url,{getXhr:n,httpHeaders:r.httpHeaders,withCredentials:r.withCredentials}),this.sendRequest=function(e,t){this.networkManager.requestRange(e,t,{onDone:this.onReceiveData.bind(this),onProgress:this.onProgress.bind(this)})}}this.currRequestId=0,this.chunksNeededByRequest={},this.requestsByChunk={},this.callbacksByRequest={},this.progressiveDataLength=0,this._loadedStreamCapability=P(),r.initialData&&this.onReceiveData({chunk:r.initialData})}return e.prototype={onLoadedStream:function(){return this._loadedStreamCapability.promise},requestAllChunks:function(){var e=this.stream.getMissingChunks();return this.requestChunks(e),this._loadedStreamCapability.promise},requestChunks:function(e,t){var a,r,i,n=this.currRequestId++;for(this.chunksNeededByRequest[n]=a={},r=0,i=e.length;i>r;r++)this.stream.hasChunk(e[r])||(a[e[r]]=!0);if(v(a))return void(t&&t());this.callbacksByRequest[n]=t;var o=[];for(var s in a)s=0|s,s in this.requestsByChunk||(this.requestsByChunk[s]=[],o.push(s)),this.requestsByChunk[s].push(n);if(o.length){var c=this.groupChunks(o);for(r=0;r<c.length;++r){var l=c[r],h=l.beginChunk*this.chunkSize,u=Math.min(l.endChunk*this.chunkSize,this.length);this.sendRequest(h,u)}}},getStream:function(){return this.stream},requestRange:function(e,t,a){t=Math.min(t,this.length);for(var r=this.getBeginChunk(e),i=this.getEndChunk(t),n=[],o=r;i>o;++o)n.push(o);this.requestChunks(n,a)},requestRanges:function(e,t){e=e||[];for(var a=[],r=0;r<e.length;r++)for(var i=this.getBeginChunk(e[r].begin),n=this.getEndChunk(e[r].end),o=i;n>o;++o)a.indexOf(o)<0&&a.push(o);a.sort(function(e,t){return e-t}),this.requestChunks(a,t)},groupChunks:function(e){for(var t=[],a=-1,r=-1,i=0;i<e.length;++i){var n=e[i];0>a&&(a=n),r>=0&&r+1!==n&&(t.push({beginChunk:a,endChunk:r+1}),a=n),i+1===e.length&&t.push({beginChunk:a,endChunk:n+1}),r=n}return t},onProgress:function(e){var t=this.stream.numChunksLoaded*this.chunkSize+e.loaded;this.msgHandler.send("DocProgress",{loaded:t,total:this.length})},onReceiveData:function(e){var t=e.chunk,a=void 0===e.begin,r=a?this.progressiveDataLength:e.begin,i=r+t.byteLength,n=Math.floor(r/this.chunkSize),o=i<this.length?Math.floor(i/this.chunkSize):Math.ceil(i/this.chunkSize);a?(this.stream.onReceiveProgressiveData(t),this.progressiveDataLength=i):this.stream.onReceiveData(r,t),this.stream.allChunksLoaded()&&this._loadedStreamCapability.resolve(this.stream);var s,c,l=[];for(t=n;o>t;++t){var h=this.requestsByChunk[t]||[];for(delete this.requestsByChunk[t],s=0;s<h.length;++s){c=h[s];var u=this.chunksNeededByRequest[c];t in u&&delete u[t],v(u)&&l.push(c)}}if(!this.disableAutoFetch&&v(this.requestsByChunk)){var f;if(1===this.stream.numChunksLoaded){var d=this.stream.numChunks-1;this.stream.hasChunk(d)||(f=d)}else f=this.stream.nextEmptyChunk(o);k(f)&&this.requestChunks([f])}for(s=0;s<l.length;++s){c=l[s];var g=this.callbacksByRequest[c];delete this.callbacksByRequest[c],g&&g()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})},onError:function(e){this._loadedStreamCapability.reject(e)},getBeginChunk:function(e){var t=Math.floor(e/this.chunkSize);return t},getEndChunk:function(e){if(e%this.chunkSize===0)return e/this.chunkSize;var t=Math.floor((e-1)/this.chunkSize)+1;return t}},e}(),de=65536,ge=function(){function e(){throw new Error("Cannot initialize BaseManagerManager")}return e.prototype={onLoadedStream:function(){throw new re},ensureDoc:function(e,t){return this.ensure(this.pdfDocument,e,t)},ensureXRef:function(e,t){return this.ensure(this.pdfDocument.xref,e,t)},ensureCatalog:function(e,t){return this.ensure(this.pdfDocument.catalog,e,t)},getPage:function(e){return this.pdfDocument.getPage(e)},cleanup:function(){return this.pdfDocument.cleanup()},ensure:function(e,t,a){return new re},requestRange:function(e,t){return new re},requestLoadedStream:function(){return new re},sendProgressiveData:function(e){return new re},updatePassword:function(e){this.pdfDocument.xref.password=this.password=e,this._passwordChangedCapability&&this._passwordChangedCapability.resolve()},passwordChanged:function(){return this._passwordChangedCapability=P(),this._passwordChangedCapability.promise},terminate:function(){return new re}},e}(),me=function(){function e(e,t){var a=new Ra(e);this.pdfDocument=new ve(this,a,t),this._loadedStreamCapability=P(),this._loadedStreamCapability.resolve(a)}return e.prototype=Object.create(ge.prototype),e.prototype.constructor=e,e.prototype.ensure=function(e,t,a){return new Promise(function(r,i){try{var n,o=e[t];n="function"==typeof o?o.apply(e,a):o,r(n)}catch(s){i(s)}})},e.prototype.requestRange=function(e,t){return Promise.resolve()},e.prototype.requestLoadedStream=function(){},e.prototype.onLoadedStream=function(){return this._loadedStreamCapability.promise},e.prototype.terminate=function(){},e}(),pe=function(){function e(e,t){this.msgHandler=t;var a={msgHandler:t,httpHeaders:e.httpHeaders,withCredentials:e.withCredentials,chunkedViewerLoading:e.chunkedViewerLoading,disableAutoFetch:e.disableAutoFetch,initialData:e.initialData};this.streamManager=new fe(e.length,de,e.url,a),this.pdfDocument=new ve(this,this.streamManager.getStream(),e.password)}return e.prototype=Object.create(ge.prototype),e.prototype.constructor=e,e.prototype.ensure=function(e,t,a){var r=this;return new Promise(function(i,n){function o(){try{var s,c=e[t];s="function"==typeof c?c.apply(e,a):c,i(s)}catch(l){if(!(l instanceof ie))return void n(l);r.streamManager.requestRange(l.begin,l.end,o)}}o()})},e.prototype.requestRange=function(e,t){return new Promise(function(a){this.streamManager.requestRange(e,t,function(){a()})}.bind(this))},e.prototype.requestLoadedStream=function(){this.streamManager.requestAllChunks()},e.prototype.sendProgressiveData=function(e){this.streamManager.onReceiveData({chunk:e})},e.prototype.onLoadedStream=function(){return this.streamManager.onLoadedStream()},e.prototype.terminate=function(){this.streamManager.networkManager.abortAllRequests()},e}(),be=function(){function e(e,t,a,r,i,n){this.pdfManager=e,
this.pageIndex=a,this.pageDict=r,this.xref=t,this.ref=i,this.fontCache=n,this.idCounters={obj:0},this.resourcesPromise=null}var t=[0,0,612,792];return e.prototype={getPageProp:function(e){return this.pageDict.get(e)},getInheritedPageProp:function(e){for(var t=this.pageDict,a=t.get(e);void 0===a&&(t=t.get("Parent"));)a=t.get(e);return a},get content(){return this.getPageProp("Contents")},get resources(){var e=this.getInheritedPageProp("Resources");return void 0===e&&(e=we.empty),o(this,"resources",e)},get mediaBox(){var e=this.getInheritedPageProp("MediaBox");return B(e)&&4===e.length||(e=t),o(this,"mediaBox",e)},get view(){var e=this.mediaBox,t=this.getInheritedPageProp("CropBox");return B(t)&&4===t.length?(t=ce.intersect(t,e),t?o(this,"view",t):o(this,"view",e)):o(this,"view",e)},get annotationRefs(){return o(this,"annotationRefs",this.getInheritedPageProp("Annots"))},get rotate(){var e=this.getInheritedPageProp("Rotate")||0;return e%90!==0?e=0:e>=360?e%=360:0>e&&(e=(e%360+360)%360),o(this,"rotate",e)},getContentStream:function(){var e,t=this.content;if(B(t)){var a,r=this.xref,i=t.length,n=[];for(a=0;i>a;++a)n.push(r.fetchIfRef(t[a]));e=new Ea(n)}else e=I(t)?t:new Wa;return e},loadResources:function(e){return this.resourcesPromise||(this.resourcesPromise=this.pdfManager.ensure(this,"resources")),this.resourcesPromise.then(function(){var t=new Oe(this.resources.map,e,this.xref);return t.load()}.bind(this))},getOperatorList:function(e,t){var a=this,r=this.pdfManager,i=r.ensure(this,"getContentStream",[]),n=this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"]),o=new bt(r,this.xref,e,this.pageIndex,"p"+this.pageIndex+"_",this.idCounters,this.fontCache),s=Promise.all([i,n]),c=s.then(function(r){var i=r[0],n=new yt(t,e,a.pageIndex);return e.send("StartRenderPage",{transparency:o.hasBlendModes(a.resources),pageIndex:a.pageIndex,intent:t}),o.getOperatorList(i,a.resources,n).then(function(){return n})}),l=r.ensure(this,"annotations");return Promise.all([c,l]).then(function(e){var a=e[0],i=e[1];if(0===i.length)return a.flush(!0),a;var n=Ee.appendToOperatorList(i,a,r,o,t);return n.then(function(){return a.flush(!0),a})})},extractTextContent:function(){var e={on:function(){},send:function(){}},t=this,a=this.pdfManager,r=a.ensure(this,"getContentStream",[]),i=this.loadResources(["ExtGState","XObject","Font"]),n=Promise.all([r,i]);return n.then(function(r){var i=r[0],n=new bt(a,t.xref,e,t.pageIndex,"p"+t.pageIndex+"_",t.idCounters,t.fontCache);return n.getTextContent(i,t.resources)})},getAnnotationsData:function(){for(var e=this.annotations,t=[],a=0,r=e.length;r>a;++a)t.push(e[a].getData());return t},get annotations(){for(var e=[],t=this.annotationRefs||[],a=0,r=t.length;r>a;++a){var i=t[a],n=Ee.fromRef(this.xref,i);n&&e.push(n)}return o(this,"annotations",e)}},e}(),ve=function(){function t(e,t,i){I(t)?r.call(this,e,t,i):T(t)?r.call(this,e,new Ra(t),i):a("PDFDocument: Unknown argument type")}function r(e,t,a){i(t.length>0,"stream must have data"),this.pdfManager=e,this.stream=t;var r=new Be(this.stream,a,e);this.xref=r}function n(e,t,a,r){var i=e.pos,n=e.end,o=[];i+a>n&&(a=n-i);for(var s=0;a>s;++s)o.push(String.fromCharCode(e.getByte()));var c=o.join("");e.pos=i;var l=r?c.lastIndexOf(t):c.indexOf(t);return-1===l?!1:(e.pos+=l,!0)}var s=1024,l="\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",h={get entries(){return o(this,"entries",{Title:x,Author:x,Subject:x,Keywords:x,Creator:x,Producer:x,CreationDate:x,ModDate:x,Trapped:C})}};return t.prototype={parse:function(t){this.setup(t);try{if(this.acroForm=this.catalog.catDict.get("AcroForm"),this.acroForm){this.xfa=this.acroForm.get("XFA");var a=this.acroForm.get("Fields");a&&B(a)&&0!==a.length||this.xfa||(this.acroForm=null)}}catch(r){e("Something wrong with AcroForm entry"),this.acroForm=null}},get linearization(){var t=null;if(this.stream.length)try{t=Ia.create(this.stream)}catch(a){if(a instanceof ie)throw a;e(a)}return o(this,"linearization",t)},get startXRef(){var e=this.stream,t=0,a=this.linearization;if(a)e.reset(),n(e,"endobj",1024)&&(t=e.pos+6);else{for(var r=1024,i=!1,s=e.end;!i&&s>0;)s-=r-"startxref".length,0>s&&(s=0),e.pos=s,i=n(e,"startxref",r,!0);if(i){e.skip(9);var c;do c=e.getByte();while(Ba.isSpace(c));for(var l="";c>=32&&57>=c;)l+=String.fromCharCode(c),c=e.getByte();t=parseInt(l,10),isNaN(t)&&(t=0)}}return o(this,"startXRef",t)},get mainXRefEntriesOffset(){var e=0,t=this.linearization;return t&&(e=t.mainXRefEntriesOffset),o(this,"mainXRefEntriesOffset",e)},checkHeader:function(){var e=this.stream;if(e.reset(),n(e,"%PDF-",1024)){e.moveStart();for(var t,a=12,r="";(t=e.getByte())>32&&!(r.length>=a);)r+=String.fromCharCode(t);return void(this.pdfFormatVersion=r.substring(5))}},parseStartXRef:function(){var e=this.startXRef;this.xref.setStartXRef(e)},setup:function(e){this.xref.parse(e),this.catalog=new Ae(this.pdfManager,this.xref)},get numPages(){var e=this.linearization,t=e?e.numPages:this.catalog.numPages;return o(this,"numPages",t)},get documentInfo(){var t,a={PDFFormatVersion:this.pdfFormatVersion,IsAcroFormPresent:!!this.acroForm,IsXFAPresent:!!this.xfa};try{t=this.xref.trailer.get("Info")}catch(r){e("The document information dictionary is invalid.")}if(t){var i=h.entries;for(var n in i)if(t.has(n)){var s=t.get(n);i[n](s)?a[n]="string"!=typeof s?s:p(s):e('Bad value in document info for "'+n+'"')}}return o(this,"documentInfo",a)},get fingerprint(){var e,t,a=this.xref,r="";a.trailer.has("ID")&&(e=a.trailer.get("ID")),e&&B(e)&&e[0]!==l?t=c(e[0]):(this.stream.ensureRange&&this.stream.ensureRange(0,Math.min(s,this.stream.end)),t=at(this.stream.bytes.subarray(0,s),0,s));for(var i=0,n=t.length;n>i;i++){var h=t[i].toString(16);r+=1===h.length?"0"+h:h}return o(this,"fingerprint",r)},getPage:function(e){return this.catalog.getPage(e)},cleanup:function(){return this.catalog.cleanup()}},t}(),ye=function(){function e(e){this.name=e}e.prototype={};var t={};return e.get=function(a){var r=t[a];return r?r:t[a]=new e(a)},e}(),ke=function(){function e(e){this.cmd=e}e.prototype={};var t={};return e.get=function(a){var r=t[a];return r?r:t[a]=new e(a)},e}(),we=function(){function e(e){if(!C(e.Type))return!0;var t=e.Type.name;return r[t]===!0}function t(e){this.map=Object.create(null),this.xref=e,this.objId=null,this.__nonSerializable__=a}var a=function(){return a},r={Background:!0,ExtGState:!0,Halftone:!0,Layout:!0,Mask:!0,Pagination:!0,Printing:!0};return t.prototype={assignXref:function(e){this.xref=e},get:function(e,t,a){var r,i=this.xref;return"undefined"!=typeof(r=this.map[e])||e in this.map||"undefined"==typeof t?i?i.fetchIfRef(r):r:"undefined"!=typeof(r=this.map[t])||t in this.map||"undefined"==typeof a?i?i.fetchIfRef(r):r:(r=this.map[a]||null,i?i.fetchIfRef(r):r)},getAsync:function(e,t,a){var r,i=this.xref;return"undefined"!=typeof(r=this.map[e])||e in this.map||"undefined"==typeof t?i?i.fetchIfRefAsync(r):Promise.resolve(r):"undefined"!=typeof(r=this.map[t])||t in this.map||"undefined"==typeof a?i?i.fetchIfRefAsync(r):Promise.resolve(r):(r=this.map[a]||null,i?i.fetchIfRefAsync(r):Promise.resolve(r))},getRaw:function(e){return this.map[e]},getAll:function(){var a,r,i=Object.create(null),n=null;for(a in this.map)r=this.get(a),r instanceof t?e(r)?(n||(n=[])).push({target:i,key:a,obj:r}):i[a]=this.getRaw(a):i[a]=r;if(!n)return i;for(var o=Object.create(null);n.length>0;){var s=n.shift(),c=s.obj,l=c.objId;if(l&&l in o)s.target[s.key]=o[l];else{var h=Object.create(null);for(a in c.map)r=c.get(a),r instanceof t?e(r)?n.push({target:h,key:a,obj:r}):h[a]=c.getRaw(a):h[a]=r;l&&(o[l]=h),s.target[s.key]=h}}return i},set:function(e,t){this.map[e]=t},has:function(e){return e in this.map},forEach:function(e){for(var t in this.map)e(t,this.get(t))}},t.empty=new t(null),t}(),xe=function(){function e(e,t){this.num=e,this.gen=t}return e.prototype={toString:function(){var e=this.num+"R";return 0!==this.gen&&(e+=this.gen),e}},e}(),Ce=function(){function e(){this.dict={}}return e.prototype={has:function(e){return e.toString()in this.dict},put:function(e){this.dict[e.toString()]=!0},remove:function(e){delete this.dict[e.toString()]}},e}(),Se=function(){function e(){this.dict=Object.create(null)}return e.prototype={get:function(e){return this.dict[e.toString()]},has:function(e){return e.toString()in this.dict},put:function(e,t){this.dict[e.toString()]=t},putAlias:function(e,t){this.dict[e.toString()]=this.get(t)},forEach:function(e,t){for(var a in this.dict)e.call(t,this.dict[a])},clear:function(){this.dict=Object.create(null)}},e}(),Ae=function(){function r(e,t){this.pdfManager=e,this.xref=t,this.catDict=t.getCatalogObj(),this.fontCache=new Se,i(A(this.catDict),"catalog object is not a dictionary"),this.pagePromises=[]}return r.prototype={get metadata(){var t=this.catDict.getRaw("Metadata");if(!O(t))return o(this,"metadata",null);var a,r=this.xref.encrypt?this.xref.encrypt.encryptMetadata:!1,i=this.xref.fetch(t,!r);if(i&&A(i.dict)){var n=i.dict.get("Type"),c=i.dict.get("Subtype");if(C(n)&&C(c)&&"Metadata"===n.name&&"XML"===c.name)try{a=b(s(i.getBytes()))}catch(l){e("Skipping invalid metadata.")}}return o(this,"metadata",a)},get toplevelPagesDict(){var e=this.catDict.get("Pages");return i(A(e),"invalid top-level pages dictionary"),o(this,"toplevelPagesDict",e)},get documentOutline(){var e=null;try{e=this.readDocumentOutline()}catch(a){if(a instanceof ie)throw a;t("Unable to read document outline")}return o(this,"documentOutline",e)},readDocumentOutline:function(){var e=this.xref,t=this.catDict.get("Outlines"),r={items:[]};if(A(t)){t=t.getRaw("First");var i=new Ce;if(O(t)){var n=[{obj:t,parent:r}];for(i.put(t);n.length>0;){var o=n.shift(),s=e.fetchIfRef(o.obj);if(null!==s){s.has("Title")||a("Invalid outline item");var c=s.get("A");c?c=c.get("D"):s.has("Dest")&&(c=s.getRaw("Dest"),C(c)&&(c=c.name));var l=s.get("Title"),h={dest:c,title:p(l),color:s.get("C")||[0,0,0],count:s.get("Count"),bold:!!(2&s.get("F")),italic:!!(1&s.get("F")),items:[]};o.parent.items.push(h),t=s.getRaw("First"),O(t)&&!i.has(t)&&(n.push({obj:t,parent:h}),i.put(t)),t=s.getRaw("Next"),O(t)&&!i.has(t)&&(n.push({obj:t,parent:o.parent}),i.put(t))}}}}return r.items.length>0?r.items:null},get numPages(){var e=this.toplevelPagesDict.get("Count");return i(k(e),"page count in top level pages object is not an integer"),o(this,"num",e)},get destinations(){function e(e){return A(e)?e.get("D"):e}var t,a,r=this.xref,i={},n=this.catDict.get("Names");if(n&&n.has("Dests")?t=n.getRaw("Dests"):this.catDict.has("Dests")&&(a=this.catDict.get("Dests")),a&&(n=a,n.forEach(function(t,a){a&&(i[t]=e(a))})),t){var s=new Ie(t,r),c=s.getAll();for(var l in c)c.hasOwnProperty(l)&&(i[l]=e(c[l]))}return o(this,"destinations",i)},getDestination:function(e){function t(e){return A(e)?e.get("D"):e}var a,r,i,n=this.xref,o=this.catDict.get("Names");if(o&&o.has("Dests")?r=o.getRaw("Dests"):this.catDict.has("Dests")&&(i=this.catDict.get("Dests")),i&&(o=i,o.forEach(function(r,i){i&&r===e&&(a=t(i))})),r){var s=new Ie(r,n);a=t(s.get(e))}return a},get attachments(){var e,t=this.xref,a=null,r=this.catDict.get("Names");if(r&&(e=r.getRaw("EmbeddedFiles")),e){var i=new Ie(e,t),n=i.getAll();for(var s in n)if(n.hasOwnProperty(s)){var c=new Te(n[s],t);a||(a={}),a[p(s)]=c.serializable}}return o(this,"attachments",a)},get javaScript(){var e=this.xref,t=this.catDict.get("Names"),a=[];if(t&&t.has("JavaScript")){var r=new Ie(t.getRaw("JavaScript"),e),i=r.getAll();for(var n in i)if(i.hasOwnProperty(n)){var c=i[n];if(A(c)){var l=c.get("S");if(C(l)&&"JavaScript"===l.name){var h=c.get("JS");(x(h)||I(h))&&(I(h)&&(h=s(h.getBytes())),a.push(p(h)))}}}}var u=this.catDict.get("OpenAction");if(A(u)){var f=u.get("Type"),d=u.get("S"),g=u.get("N"),m=C(f)&&"Action"===f.name&&C(d)&&"Named"===d.name&&C(g)&&"Print"===g.name;m&&a.push("print(true);")}return o(this,"javaScript",a)},cleanup:function(){var e=[];return this.fontCache.forEach(function(t){e.push(t)}),Promise.all(e).then(function(e){for(var t=0,a=e.length;a>t;t++){var r=e[t].dict;delete r.translated}this.fontCache.clear()}.bind(this))},getPage:function(e){return e in this.pagePromises||(this.pagePromises[e]=this.getPageDict(e).then(function(t){var a=t[0],r=t[1];return new be(this.pdfManager,this.xref,e,a,r,this.fontCache)}.bind(this))),this.pagePromises[e]},getPageDict:function(e){function t(){for(;r.length;){var s=r.pop();if(O(s))return void o.fetchAsync(s).then(function(i){return A(i,"Page")||A(i)&&!i.has("Kids")?void(e===n?a.resolve([i,s]):(n++,t())):(r.push(i),void t())},a.reject);i(A(s),"page dictionary kid reference points to wrong type of object");var c=s.get("Count");if(e>=n+c)n+=c;else{var l=s.get("Kids");if(i(B(l),"page dictionary kids object is not an array"),c!==l.length)for(var h=l.length-1;h>=0;h--)r.push(l[h]);else r=[l[e-n]],n=e}}a.reject("Page index "+e+" not found.")}var a=P(),r=[this.catDict.getRaw("Pages")],n=0,o=this.xref;return t(),a.promise},getPageIndex:function(e){function t(e){var t,r=0;return n.fetchAsync(e).then(function(e){return e?(t=e.getRaw("Parent"),e.getAsync("Parent")):null}).then(function(e){return e?e.getAsync("Kids"):null}).then(function(o){if(!o)return null;for(var s=[],c=!1,l=0;l<o.length;l++){var h=o[l];if(i(O(h),"kids must be a ref"),h.num===e.num){c=!0;break}s.push(n.fetchAsync(h).then(function(e){if(e.has("Count")){var t=e.get("Count");r+=t}else r++}))}return c||a("kid ref not found in parents kids"),Promise.all(s).then(function(){return[r,t]})})}function r(e){return t(e).then(function(e){if(!e)return o;var t=e[0],a=e[1];return o+=t,r(a)})}var n=this.xref,o=0;return r(e)}},r}(),Be=function(){function r(e,t){this.stream=e,this.entries=[],this.xrefstms={},this.cache=[],this.password=t,this.stats={streamTypes:[],fontTypes:[]}}return r.prototype={setStartXRef:function(e){this.startXRefQueue=[e]},parse:function(e){var r;e?(t("Indexing all PDF objects"),r=this.indexObjects()):r=this.readXRef(),r.assignXref(this),this.trailer=r;var i=r.get("Encrypt");if(i){var n=r.get("ID"),o=n&&n.length?n[0]:"";this.encrypt=new dt(i,o,this.password)}(this.root=r.get("Root"))||a("Invalid root reference")},processXRefTable:function(e){"tableState"in this||(this.tableState={entryNum:0,streamPos:e.lexer.stream.pos,parserBuf1:e.buf1,parserBuf2:e.buf2});var t=this.readXRefTable(e);S(t,"trailer")||a("Invalid XRef table: could not find trailer dictionary");var r=e.getObj();return!A(r)&&r.dict&&(r=r.dict),A(r)||a("Invalid XRef table: could not parse trailer dictionary"),delete this.tableState,r},readXRefTable:function(e){var t=e.lexer.stream,r=this.tableState;t.pos=r.streamPos,e.buf1=r.parserBuf1,e.buf2=r.parserBuf2;for(var i;;){if(!("firstEntryNum"in r&&"entryCount"in r)){if(S(i=e.getObj(),"trailer"))break;r.firstEntryNum=i,r.entryCount=e.getObj()}var n=r.firstEntryNum,o=r.entryCount;k(n)&&k(o)||a("Invalid XRef table: wrong types in subsection header");for(var s=r.entryNum;o>s;s++){r.streamPos=t.pos,r.entryNum=s,r.parserBuf1=e.buf1,r.parserBuf2=e.buf2;var c={};c.offset=e.getObj(),c.gen=e.getObj();var l=e.getObj();S(l,"f")?c.free=!0:S(l,"n")&&(c.uncompressed=!0),k(c.offset)&&k(c.gen)&&(c.free||c.uncompressed)||a("Invalid entry in XRef subsection: "+n+", "+o),this.entries[s+n]||(this.entries[s+n]=c)}r.entryNum=0,r.streamPos=t.pos,r.parserBuf1=e.buf1,r.parserBuf2=e.buf2,delete r.firstEntryNum,delete r.entryCount}return 1===n&&this.entries[1]&&this.entries[1].free&&this.entries.shift(),this.entries[0]&&!this.entries[0].free&&a("Invalid XRef table: unexpected first object"),i},processXRefStream:function(e){if(!("streamState"in this)){var t=e.dict,a=t.get("W"),r=t.get("Index");r||(r=[0,t.get("Size")]),this.streamState={entryRanges:r,byteWidths:a,entryNum:0,streamPos:e.pos}}return this.readXRefStream(e),delete this.streamState,e.dict},readXRefStream:function(e){var t,r,i=this.streamState;e.pos=i.streamPos;for(var n=i.byteWidths,o=n[0],s=n[1],c=n[2],l=i.entryRanges;l.length>0;){var h=l[0],u=l[1];for(k(h)&&k(u)||a("Invalid XRef range fields: "+h+", "+u),k(o)&&k(s)&&k(c)||a("Invalid XRef entry fields length: "+h+", "+u),t=i.entryNum;u>t;++t){i.entryNum=t,i.streamPos=e.pos;var f=0,d=0,g=0;for(r=0;o>r;++r)f=f<<8|e.getByte();for(0===o&&(f=1),r=0;s>r;++r)d=d<<8|e.getByte();for(r=0;c>r;++r)g=g<<8|e.getByte();var m={};switch(m.offset=d,m.gen=g,f){case 0:m.free=!0;break;case 1:m.uncompressed=!0;break;case 2:break;default:a("Invalid XRef entry type: "+f)}this.entries[h+t]||(this.entries[h+t]=m)}i.entryNum=0,i.streamPos=e.pos,l.splice(0,2)}},indexObjects:function(){function e(e,t){for(var a="",r=e[t];13!==r&&10!==r&&!(++t>=e.length);)a+=String.fromCharCode(r),r=e[t];return a}function t(e,t,a){for(var r=a.length,i=e.length,n=0;i>t;){for(var o=0;r>o&&e[t+o]===a[o];)++o;if(o>=r)break;t++,n++}return n}var a=new Uint8Array([116,114,97,105,108,101,114]),r=new Uint8Array([115,116,97,114,116,120,114,101,102]),i=new Uint8Array([101,110,100,111,98,106]),n=new Uint8Array([47,88,82,101,102]),o=this.stream;o.pos=0;for(var s=o.getBytes(),c=o.start,l=s.length,h=[],u=[];l>c;){var f=s[c];if(32!==f&&9!==f&&13!==f&&10!==f)if(37!==f){var d,g=e(s,c);if("xref"===g)c+=t(s,c,a),h.push(c),c+=t(s,c,r);else if(d=/^(\d+)\s+(\d+)\s+obj\b/.exec(g)){this.entries[d[1]]={offset:c,gen:0|d[2],uncompressed:!0};var m=t(s,c,i)+7,p=s.subarray(c,c+m),b=t(p,0,n);m>b&&p[b+5]<64&&(u.push(c),this.xrefstms[c]=1),c+=m}else c+=g.length+1}else do{if(++c,c>=l)break;f=s[c]}while(13!==f&&10!==f);else++c}var v,y;for(v=0,y=u.length;y>v;++v)this.startXRefQueue.push(u[v]),this.readXRef(!0);var k;for(v=0,y=h.length;y>v;++v){o.pos=h[v];var w=new Aa(new Ba(o),!0,this),x=w.getObj();if(S(x,"trailer")&&A(k=w.getObj())&&k.has("ID"))return k}if(k)return k;throw new ee("Invalid PDF structure")},readXRef:function(t){var r=this.stream;try{for(;this.startXRefQueue.length;){var i=this.startXRefQueue[0];r.pos=i+r.start;var n,o=new Aa(new Ba(r),!0,this),s=o.getObj();if(S(s,"xref")){if(n=this.processXRefTable(o),this.topDict||(this.topDict=n),s=n.get("XRefStm"),k(s)){var c=s;c in this.xrefstms||(this.xrefstms[