UNPKG

afterwriting

Version:

Post-processing tools for Fountain screenplays

333 lines 104 kB
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ "undefined"==typeof PDFJS&&(("undefined"!=typeof window?window:this).PDFJS={}),PDFJS.version="1.1.114",PDFJS.build="3fd44fd",function(){"use strict" function t(t){PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.infos&&console.log("Info: "+t)}function e(t){PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.warnings&&console.log("Warning: "+t)}function n(t){throw PDFJS.verbosity>=PDFJS.VERBOSITY_LEVELS.errors&&(console.log("Error: "+t),console.log(i())),R.notify(L.unknown),new Error(t)}function i(){try{throw new Error}catch(t){return t.stack?t.stack.split("\n").slice(2).join("\n"):""}}function r(t,e){t||n(e)}function a(t,e){if(!e)return t if(/^[a-z][a-z0-9+\-.]*:/i.test(e))return e var n if("/"===e.charAt(0))return n=t.indexOf("://"),"/"===e.charAt(1)?++n:n=t.indexOf("/",n+3),t.substring(0,n)+e var i=t.length n=t.lastIndexOf("#"),i=n>=0?n:i,n=t.lastIndexOf("?",i),i=n>=0?n:i var r=t.lastIndexOf("/",i) return t.substring(0,r+1)+e}function s(t,e){if(!t)return!1 var n=/^[a-z][a-z0-9+\-.]*(?=:)/i.exec(t) if(!n)return e switch(n=n[0].toLowerCase()){case"http":case"https":case"ftp":case"mailto":case"tel":return!0 default:return!1}}function o(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!1}),n}function l(t){r(null!==t&&"object"==typeof t&&void 0!==t.length,"Invalid argument for bytesToString") var e=t.length,n=8192 if(n>e)return String.fromCharCode.apply(null,t) for(var i=[],a=0;e>a;a+=n){var s=Math.min(a+n,e),o=t.subarray(a,s) i.push(String.fromCharCode.apply(null,o))}return i.join("")}function c(t){r("string"==typeof t,"Invalid argument for stringToBytes") for(var e=t.length,n=new Uint8Array(e),i=0;e>i;++i)n[i]=255&t.charCodeAt(i) return n}function h(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)}function u(){var t=new Uint8Array(2) t[0]=1 var e=new Uint16Array(t.buffer) return 1===e[0]}function d(){var t=document.createElement("canvas") t.width=t.height=1 var e=t.getContext("2d"),n=e.createImageData(1,1) return"undefined"!=typeof n.data.buffer}function f(t){return"number"==typeof t}function p(t){return t instanceof Array}function A(t){return"object"==typeof t&&null!==t&&void 0!==t.byteLength}function g(){var t={} return t.promise=new Promise(function(e,n){t.resolve=e,t.reject=n}),t}function m(t,e){this.name=t,this.comObj=e,this.callbackIndex=1,this.postMessageTransfers=!0 var i=this.callbacksCapabilities={},r=this.actionHandler={} r.console_log=[function(t){console.log.apply(console,t)}],r.console_error=[function(t){console.error.apply(console,t)}],r._unsupported_feature=[function(t){R.notify(t)}],e.onmessage=function(t){var a=t.data if(a.isReply){var s=a.callbackId if(a.callbackId in i){var o=i[s] delete i[s],"error"in a?o.reject(a.error):o.resolve(a.data)}else n("Cannot resolve callback "+s)}else if(a.action in r){var l=r[a.action] a.callbackId?Promise.resolve().then(function(){return l[0].call(l[1],a.data)}).then(function(t){e.postMessage({isReply:!0,callbackId:a.callbackId,data:t})},function(t){e.postMessage({isReply:!0,callbackId:a.callbackId,error:t})}):l[0].call(l[1],a.data)}else n("Unknown action from worker: "+a.action)}}function v(t,n,i){var r=new Image r.onload=function(){i.resolve(t,r)},r.onerror=function(){i.resolve(t,null),e("Error during JPEG image loading")},r.src=n}function b(t,e){var n=document.createElement("canvas") return n.width=t,n.height=e,n}function S(t){t.mozCurrentTransform||(t._originalSave=t.save,t._originalRestore=t.restore,t._originalRotate=t.rotate,t._originalScale=t.scale,t._originalTranslate=t.translate,t._originalTransform=t.transform,t._originalSetTransform=t.setTransform,t._transformMatrix=t._transformMatrix||[1,0,0,1,0,0],t._transformStack=[],Object.defineProperty(t,"mozCurrentTransform",{get:function(){return this._transformMatrix}}),Object.defineProperty(t,"mozCurrentTransformInverse",{get:function(){var t=this._transformMatrix,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=e*r-n*i,l=n*i-e*r return[r/o,n/l,i/l,e/o,(r*a-i*s)/l,(n*a-e*s)/o]}}),t.save=function(){var t=this._transformMatrix this._transformStack.push(t),this._transformMatrix=t.slice(0,6),this._originalSave()},t.restore=function(){var t=this._transformStack.pop() t&&(this._transformMatrix=t,this._originalRestore())},t.translate=function(t,e){var n=this._transformMatrix n[4]=n[0]*t+n[2]*e+n[4],n[5]=n[1]*t+n[3]*e+n[5],this._originalTranslate(t,e)},t.scale=function(t,e){var n=this._transformMatrix n[0]=n[0]*t,n[1]=n[1]*t,n[2]=n[2]*e,n[3]=n[3]*e,this._originalScale(t,e)},t.transform=function(e,n,i,r,a,s){var o=this._transformMatrix this._transformMatrix=[o[0]*e+o[2]*n,o[1]*e+o[3]*n,o[0]*i+o[2]*r,o[1]*i+o[3]*r,o[0]*a+o[2]*s+o[4],o[1]*a+o[3]*s+o[5]],t._originalTransform(e,n,i,r,a,s)},t.setTransform=function(e,n,i,r,a,s){this._transformMatrix=[e,n,i,r,a,s],t._originalSetTransform(e,n,i,r,a,s)},t.rotate=function(t){var e=Math.cos(t),n=Math.sin(t),i=this._transformMatrix this._transformMatrix=[i[0]*e+i[2]*n,i[1]*e+i[3]*n,i[0]*-n+i[2]*e,i[1]*-n+i[3]*e,i[4],i[5]],this._originalRotate(t)})}function x(t){var e,n,i,r,a=1e3,s=t.width,o=t.height,l=s+1,c=new Uint8Array(l*(o+1)),h=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),u=s+7&-8,d=t.data,f=new Uint8Array(u*o),p=0 for(e=0,r=d.length;r>e;e++)for(var A=128,g=d[e];A>0;)f[p++]=g&A?0:255,A>>=1 var m=0 for(p=0,0!==f[p]&&(c[0]=1,++m),n=1;s>n;n++)f[p]!==f[p+1]&&(c[n]=f[p]?2:1,++m),p++ for(0!==f[p]&&(c[n]=2,++m),e=1;o>e;e++){p=e*u,i=e*l,f[p-u]!==f[p]&&(c[i]=f[p]?1:8,++m) var v=(f[p]?4:0)+(f[p-u]?8:0) for(n=1;s>n;n++)v=(v>>2)+(f[p+1]?4:0)+(f[p-u+1]?8:0),h[v]&&(c[i+n]=h[v],++m),p++ if(f[p-u]!==f[p]&&(c[i+n]=f[p]?2:4,++m),m>a)return null}for(p=u*(o-1),i=e*l,0!==f[p]&&(c[i]=8,++m),n=1;s>n;n++)f[p]!==f[p+1]&&(c[i+n]=f[p]?4:8,++m),p++ if(0!==f[p]&&(c[i+n]=4,++m),m>a)return null var b=new Int32Array([0,l,-1,0,-l,0,0,0,1]),S=[] for(e=0;m&&o>=e;e++){for(var x=e*l,y=x+s;y>x&&!c[x];)x++ if(x!==y){var k,P=[x%l,e],C=c[x],F=x do{var D=b[C] do x+=D while(!c[x]) k=c[x],5!==k&&10!==k?(C=k,c[x]=0):(C=k&51*C>>4,c[x]&=C>>2|C<<2),P.push(x%l),P.push(x/l|0),--m}while(F!==x) S.push(P),--e}}var w=function(t){t.save(),t.scale(1/s,-1/o),t.translate(0,-o),t.beginPath() for(var e=0,n=S.length;n>e;e++){var i=S[e] t.moveTo(i[0],i[1]) for(var r=2,a=i.length;a>r;r+=2)t.lineTo(i[r],i[r+1])}t.fill(),t.beginPath(),t.restore()} return w}function y(t){var e=ot[t[0]] return e||n("Unknown IR type: "+t[0]),e.fromIR(t)}var k="undefined"==typeof window?this:window,P="undefined"==typeof window,C=[.001,0,0,.001,0,0],F={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},D={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},w={WIDGET:1,TEXT:2,LINK:3} k.PDFJS||(k.PDFJS={}),k.PDFJS.pdfBug=!1,PDFJS.VERBOSITY_LEVELS={errors:0,warnings:1,infos:5} var T=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},L=PDFJS.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},R=PDFJS.UnsupportedManager=function(){var t=[] return{listen:function(e){t.push(e)},notify:function(n){e('Unsupported feature "'+n+'"') for(var i=0,r=t.length;r>i;i++)t[i](n)}}}() PDFJS.isValidUrl=s,PDFJS.shadow=o var E=PDFJS.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},I=function(){function t(t,e){this.name="PasswordException",this.message=t,this.code=e}return t.prototype=new Error,t.constructor=t,t}() PDFJS.PasswordException=I var M=function(){function t(t,e){this.name="UnknownErrorException",this.message=t,this.details=e}return t.prototype=new Error,t.constructor=t,t}() PDFJS.UnknownErrorException=M var _=function(){function t(t){this.name="InvalidPDFException",this.message=t}return t.prototype=new Error,t.constructor=t,t}() PDFJS.InvalidPDFException=_ var O=function(){function t(t){this.name="MissingPDFException",this.message=t}return t.prototype=new Error,t.constructor=t,t}() PDFJS.MissingPDFException=O var j=function(){function t(t,e){this.name="UnexpectedResponseException",this.message=t,this.status=e}return t.prototype=new Error,t.constructor=t,t}() PDFJS.UnexpectedResponseException=j;(function(){function t(t){this.message=t}return t.prototype=new Error,t.prototype.name="NotImplementedException",t.constructor=t,t})(),function(){function t(t,e){this.begin=t,this.end=e,this.message="Missing data ["+t+", "+e+")"}return t.prototype=new Error,t.prototype.name="MissingDataException",t.constructor=t,t}(),function(){function t(t){this.message=t}return t.prototype=new Error,t.prototype.name="XRefParseException",t.constructor=t,t}() Object.defineProperty(PDFJS,"isLittleEndian",{configurable:!0,get:function(){return o(PDFJS,"isLittleEndian",u())}}),Object.defineProperty(PDFJS,"hasCanvasTypedArrays",{configurable:!0,get:function(){return o(PDFJS,"hasCanvasTypedArrays",d())}}) var N=function(){function t(t,e){this.buffer=t,this.byteLength=t.length,this.length=void 0===e?this.byteLength>>2:e,n(this.length)}function e(t){return{get:function(){var e=this.buffer,n=t<<2 return(e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24)>>>0},set:function(e){var n=this.buffer,i=t<<2 n[i]=255&e,n[i+1]=e>>8&255,n[i+2]=e>>16&255,n[i+3]=e>>>24&255}}}function n(n){for(;n>i;)Object.defineProperty(t.prototype,i,e(i)),i++}t.prototype=Object.create(null) var i=0 return t}(),J=[1,0,0,1,0,0],B=PDFJS.Util=function(){function t(){}var e=["rgb(",0,",",0,",",0,")"] return t.makeCssRgb=function(t,n,i){return e[1]=t,e[3]=n,e[5]=i,e.join("")},t.transform=function(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]},t.applyTransform=function(t,e){var n=t[0]*e[0]+t[1]*e[2]+e[4],i=t[0]*e[1]+t[1]*e[3]+e[5] return[n,i]},t.applyInverseTransform=function(t,e){var n=e[0]*e[3]-e[1]*e[2],i=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/n,r=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/n return[i,r]},t.getAxialAlignedBoundingBox=function(e,n){var i=t.applyTransform(e,n),r=t.applyTransform(e.slice(2,4),n),a=t.applyTransform([e[0],e[3]],n),s=t.applyTransform([e[2],e[1]],n) return[Math.min(i[0],r[0],a[0],s[0]),Math.min(i[1],r[1],a[1],s[1]),Math.max(i[0],r[0],a[0],s[0]),Math.max(i[1],r[1],a[1],s[1])]},t.inverseTransform=function(t){var e=t[0]*t[3]-t[1]*t[2] return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]},t.apply3dTransform=function(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2],t[3]*e[0]+t[4]*e[1]+t[5]*e[2],t[6]*e[0]+t[7]*e[1]+t[8]*e[2]]},t.singularValueDecompose2dScale=function(t){var e=[t[0],t[2],t[1],t[3]],n=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],r=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],s=(n+a)/2,o=Math.sqrt((n+a)*(n+a)-4*(n*a-r*i))/2,l=s+o||1,c=s-o||1 return[Math.sqrt(l),Math.sqrt(c)]},t.normalizeRect=function(t){var e=t.slice(0) return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e},t.intersect=function(e,n){function i(t,e){return t-e}var r=[e[0],e[2],n[0],n[2]].sort(i),a=[e[1],e[3],n[1],n[3]].sort(i),s=[] return e=t.normalizeRect(e),n=t.normalizeRect(n),r[0]===e[0]&&r[1]===n[0]||r[0]===n[0]&&r[1]===e[0]?(s[0]=r[1],s[2]=r[2],a[0]===e[1]&&a[1]===n[1]||a[0]===n[1]&&a[1]===e[1]?(s[1]=a[1],s[3]=a[2],s):!1):!1},t.sign=function(t){return 0>t?-1:1},t.appendToArray=function(t,e){Array.prototype.push.apply(t,e)},t.prependToArray=function(t,e){Array.prototype.unshift.apply(t,e)},t.extendObj=function(t,e){for(var n in e)t[n]=e[n]},t.getInheritableProperty=function(t,e){for(;t&&!t.has(e);)t=t.get("Parent") return t?t.get(e):null},t.inherit=function(t,e,n){t.prototype=Object.create(e.prototype),t.prototype.constructor=t for(var i in n)t.prototype[i]=n[i]},t.loadScript=function(t,e){var n=document.createElement("script"),i=!1 n.setAttribute("src",t),e&&(n.onload=function(){i||e(),i=!0}),document.getElementsByTagName("head")[0].appendChild(n)},t}() PDFJS.PageViewport=function(){function t(t,e,n,i,r,a){this.viewBox=t,this.scale=e,this.rotation=n,this.offsetX=i,this.offsetY=r var s,o,l,c,h=(t[2]+t[0])/2,u=(t[3]+t[1])/2 switch(n%=360,n=0>n?n+360:n){case 180:s=-1,o=0,l=0,c=1 break case 90:s=0,o=1,l=1,c=0 break case 270:s=0,o=-1,l=-1,c=0 break default:s=1,o=0,l=0,c=-1}a&&(l=-l,c=-c) var d,f,p,A 0===s?(d=Math.abs(u-t[1])*e+i,f=Math.abs(h-t[0])*e+r,p=Math.abs(t[3]-t[1])*e,A=Math.abs(t[2]-t[0])*e):(d=Math.abs(h-t[0])*e+i,f=Math.abs(u-t[1])*e+r,p=Math.abs(t[2]-t[0])*e,A=Math.abs(t[3]-t[1])*e),this.transform=[s*e,o*e,l*e,c*e,d-s*e*h-l*e*u,f-o*e*h-c*e*u],this.width=p,this.height=A,this.fontScale=e}return t.prototype={clone:function(e){e=e||{} var n="scale"in e?e.scale:this.scale,i="rotation"in e?e.rotation:this.rotation return new t(this.viewBox.slice(),n,i,this.offsetX,this.offsetY,e.dontFlip)},convertToViewportPoint:function(t,e){return B.applyTransform([t,e],this.transform)},convertToViewportRectangle:function(t){var e=B.applyTransform([t[0],t[1]],this.transform),n=B.applyTransform([t[2],t[3]],this.transform) return[e[0],e[1],n[0],n[1]]},convertToPdfPoint:function(t,e){return B.applyInverseTransform([t,e],this.transform)}},t}() PDFJS.createPromiseCapability=g,function(){function t(t){this._status=n,this._handlers=[] try{t.call(this,this._resolve.bind(this),this._reject.bind(this))}catch(e){this._reject(e)}}if(k.Promise)return"function"!=typeof k.Promise.all&&(k.Promise.all=function(t){var e,n,i=0,r=[],a=new k.Promise(function(t,i){e=t,n=i}) return t.forEach(function(t,a){i++,t.then(function(t){r[a]=t,i--,0===i&&e(r)},n)}),0===i&&e(r),a}),"function"!=typeof k.Promise.resolve&&(k.Promise.resolve=function(t){return new k.Promise(function(e){e(t)})}),"function"!=typeof k.Promise.reject&&(k.Promise.reject=function(t){return new k.Promise(function(e,n){n(t)})}),void("function"!=typeof k.Promise.prototype["catch"]&&(k.Promise.prototype["catch"]=function(t){return k.Promise.prototype.then(void 0,t)})) var n=0,i=1,r=2,a=500,s={handlers:[],running:!1,unhandledRejections:[],pendingRejectionCheck:!1,scheduleHandlers:function(t){t._status!==n&&(this.handlers=this.handlers.concat(t._handlers),t._handlers=[],this.running||(this.running=!0,setTimeout(this.runHandlers.bind(this),0)))},runHandlers:function(){for(var t=1,e=Date.now()+t;this.handlers.length>0;){var n=this.handlers.shift(),a=n.thisPromise._status,s=n.thisPromise._value try{a===i?"function"==typeof n.onResolve&&(s=n.onResolve(s)):"function"==typeof n.onReject&&(s=n.onReject(s),a=i,n.thisPromise._unhandledRejection&&this.removeUnhandeledRejection(n.thisPromise))}catch(o){a=r,s=o}if(n.nextPromise._updateStatus(a,s),Date.now()>=e)break}return this.handlers.length>0?void setTimeout(this.runHandlers.bind(this),0):void(this.running=!1)},addUnhandledRejection:function(t){this.unhandledRejections.push({promise:t,time:Date.now()}),this.scheduleRejectionCheck()},removeUnhandeledRejection:function(t){t._unhandledRejection=!1 for(var e=0;e<this.unhandledRejections.length;e++)this.unhandledRejections[e].promise===t&&(this.unhandledRejections.splice(e),e--)},scheduleRejectionCheck:function(){this.pendingRejectionCheck||(this.pendingRejectionCheck=!0,setTimeout(function(){this.pendingRejectionCheck=!1 for(var t=Date.now(),n=0;n<this.unhandledRejections.length;n++)if(t-this.unhandledRejections[n].time>a){var i=this.unhandledRejections[n].promise._value,r="Unhandled rejection: "+i i.stack&&(r+="\n"+i.stack),e(r),this.unhandledRejections.splice(n),n--}this.unhandledRejections.length&&this.scheduleRejectionCheck()}.bind(this),a))}} t.all=function(e){function n(t){s._status!==r&&(l=[],a(t))}var i,a,s=new t(function(t,e){i=t,a=e}),o=e.length,l=[] if(0===o)return i(l),s for(var c=0,h=e.length;h>c;++c){var u=e[c],d=function(t){return function(e){s._status!==r&&(l[t]=e,o--,0===o&&i(l))}}(c) t.isPromise(u)?u.then(d,n):d(u)}return s},t.isPromise=function(t){return t&&"function"==typeof t.then},t.resolve=function(e){return new t(function(t){t(e)})},t.reject=function(e){return new t(function(t,n){n(e)})},t.prototype={_status:null,_value:null,_handlers:null,_unhandledRejection:null,_updateStatus:function(e,n){if(this._status!==i&&this._status!==r){if(e===i&&t.isPromise(n))return void n.then(this._updateStatus.bind(this,i),this._updateStatus.bind(this,r)) this._status=e,this._value=n,e===r&&0===this._handlers.length&&(this._unhandledRejection=!0,s.addUnhandledRejection(this)),s.scheduleHandlers(this)}},_resolve:function(t){this._updateStatus(i,t)},_reject:function(t){this._updateStatus(r,t)},then:function(e,n){var i=new t(function(t,e){this.resolve=t,this.reject=e}) return this._handlers.push({thisPromise:this,onResolve:e,onReject:n,nextPromise:i}),s.scheduleHandlers(this),i},"catch":function(t){return this.then(void 0,t)}},k.Promise=t}() var W=function(){function t(t,e,n){for(;t.length<n;)t+=e return t}function n(){this.started={},this.times=[],this.enabled=!0}return n.prototype={time:function(t){this.enabled&&(t in this.started&&e("Timer is already running for "+t),this.started[t]=Date.now())},timeEnd:function(t){this.enabled&&(t in this.started||e("Timer has not been started for "+t),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t])},toString:function(){var e,n,i=this.times,r="",a=0 for(e=0,n=i.length;n>e;++e){var s=i[e].name s.length>a&&(a=s.length)}for(e=0,n=i.length;n>e;++e){var o=i[e],l=o.end-o.start r+=t(o.name," ",a)+" "+l+"ms\n"}return r}},n}() PDFJS.createBlob=function(t,e){if("undefined"!=typeof Blob)return new Blob([t],{type:e}) var n=new MozBlobBuilder return n.append(t),n.getBlob(e)},PDFJS.createObjectURL=function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" return function(e,n){if(!PDFJS.disableCreateObjectURL&&"undefined"!=typeof URL&&URL.createObjectURL){var i=PDFJS.createBlob(e,n) return URL.createObjectURL(i)}for(var r="data:"+n+";base64,",a=0,s=e.length;s>a;a+=3){var o=255&e[a],l=255&e[a+1],c=255&e[a+2],h=o>>2,u=(3&o)<<4|l>>4,d=s>a+1?(15&l)<<2|c>>6:64,f=s>a+2?63&c:64 r+=t[h]+t[u]+t[d]+t[f]}return r}}(),m.prototype={on:function(t,e,i){var r=this.actionHandler r[t]&&n('There is already an actionName called "'+t+'"'),r[t]=[e,i]},send:function(t,e,n){var i={action:t,data:e} this.postMessage(i,n)},sendWithPromise:function(t,e,n){var i=this.callbackIndex++,r={action:t,data:e,callbackId:i},a=g() this.callbacksCapabilities[i]=a try{this.postMessage(r,n)}catch(s){a.reject(s)}return a.promise},postMessage:function(t,e){e&&this.postMessageTransfers?this.comObj.postMessage(t,e):this.comObj.postMessage(t)}},PDFJS.maxImageSize=void 0===PDFJS.maxImageSize?-1:PDFJS.maxImageSize,PDFJS.cMapUrl=void 0===PDFJS.cMapUrl?null:PDFJS.cMapUrl,PDFJS.cMapPacked=void 0===PDFJS.cMapPacked?!1:PDFJS.cMapPacked,PDFJS.disableFontFace=void 0===PDFJS.disableFontFace?!1:PDFJS.disableFontFace,PDFJS.imageResourcesPath=void 0===PDFJS.imageResourcesPath?"":PDFJS.imageResourcesPath,PDFJS.disableWorker=void 0===PDFJS.disableWorker?!1:PDFJS.disableWorker,PDFJS.workerSrc=void 0===PDFJS.workerSrc?null:PDFJS.workerSrc,PDFJS.disableRange=void 0===PDFJS.disableRange?!1:PDFJS.disableRange,PDFJS.disableStream=void 0===PDFJS.disableStream?!1:PDFJS.disableStream,PDFJS.disableAutoFetch=void 0===PDFJS.disableAutoFetch?!1:PDFJS.disableAutoFetch,PDFJS.pdfBug=void 0===PDFJS.pdfBug?!1:PDFJS.pdfBug,PDFJS.postMessageTransfers=void 0===PDFJS.postMessageTransfers?!0:PDFJS.postMessageTransfers,PDFJS.disableCreateObjectURL=void 0===PDFJS.disableCreateObjectURL?!1:PDFJS.disableCreateObjectURL,PDFJS.disableWebGL=void 0===PDFJS.disableWebGL?!0:PDFJS.disableWebGL,PDFJS.disableFullscreen=void 0===PDFJS.disableFullscreen?!1:PDFJS.disableFullscreen,PDFJS.useOnlyCssZoom=void 0===PDFJS.useOnlyCssZoom?!1:PDFJS.useOnlyCssZoom,PDFJS.verbosity=void 0===PDFJS.verbosity?PDFJS.VERBOSITY_LEVELS.warnings:PDFJS.verbosity,PDFJS.maxCanvasPixels=void 0===PDFJS.maxCanvasPixels?16777216:PDFJS.maxCanvasPixels,PDFJS.openExternalLinksInNewWindow=void 0===PDFJS.openExternalLinksInNewWindow?!1:PDFJS.openExternalLinksInNewWindow,PDFJS.getDocument=function(t,e,i,r){var s=new G e&&(e instanceof U||(e=Object.create(e),e.length=t.length,e.initialData=t.initialData),t=Object.create(t),t.range=e),s.onPassword=i||null,s.onProgress=r||null var o,l,h "string"==typeof t?h={url:t}:A(t)?h={data:t}:t instanceof U?h={range:t}:("object"!=typeof t&&n("Invalid parameter in getDocument, need either Uint8Array, string or a parameter object"),t.url||t.data||t.range||n("Invalid parameter object: need either .data, .range or .url"),h=t) var u={} for(var d in h)if("url"!==d||"undefined"==typeof window){if("range"!==d)if("data"!==d||h[d]instanceof Uint8Array)u[d]=h[d] else{var f=h[d] "string"==typeof f?u[d]=c(f):"object"!=typeof f||null===f||isNaN(f.length)?n("Invalid PDF binary data: either typed array, string or array-like object is expected in the data property."):u[d]=new Uint8Array(f)}}else u[d]=a(window.location.href,h[d]) return o=g(),l=new Y(o,h.range),o.promise.then(function(){l.fetchDocument(s,u)}),s} var G=function(){function t(){this._capability=g(),this.onPassword=null,this.onProgress=null}return t.prototype={get promise(){return this._capability.promise},then:function(t,e){return this.promise.then.apply(this.promise,arguments)}},t}(),U=function(){function t(t,e){this.length=t,this.initialData=e,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._readyCapability=g()}return t.prototype={addRangeListener:function(t){this._rangeListeners.push(t)},addProgressListener:function(t){this._progressListeners.push(t)},addProgressiveReadListener:function(t){this._progressiveReadListeners.push(t)},onDataRange:function(t,e){for(var n=this._rangeListeners,i=0,r=n.length;r>i;++i)n[i](t,e)},onDataProgress:function(t){this._readyCapability.promise.then(function(){for(var e=this._progressListeners,n=0,i=e.length;i>n;++n)e[n](t)}.bind(this))},onDataProgressiveRead:function(t){this._readyCapability.promise.then(function(){for(var e=this._progressiveReadListeners,n=0,i=e.length;i>n;++n)e[n](t)}.bind(this))},transportReady:function(){this._readyCapability.resolve()},requestDataRange:function(t,e){throw new Error("Abstract method PDFDataRangeTransport.requestDataRange")}},t}() PDFJS.PDFDataRangeTransport=U var X=function(){function t(t,e){this.pdfInfo=t,this.transport=e}return t.prototype={get numPages(){return this.pdfInfo.numPages},get fingerprint(){return this.pdfInfo.fingerprint},getPage:function(t){return this.transport.getPage(t)},getPageIndex:function(t){return this.transport.getPageIndex(t)},getDestinations:function(){return this.transport.getDestinations()},getDestination:function(t){return this.transport.getDestination(t)},getAttachments:function(){return this.transport.getAttachments()},getJavaScript:function(){return this.transport.getJavaScript()},getOutline:function(){return this.transport.getOutline()},getMetadata:function(){return this.transport.getMetadata()},getData:function(){return this.transport.getData()},getDownloadInfo:function(){return this.transport.downloadInfoCapability.promise},getStats:function(){return this.transport.getStats()},cleanup:function(){this.transport.startCleanup()},destroy:function(){this.transport.destroy()}},t}(),z=function(){function t(t,e,n){this.pageIndex=t,this.pageInfo=e,this.transport=n,this.stats=new W,this.stats.enabled=!!k.PDFJS.enableStats,this.commonObjs=n.commonObjs,this.objs=new H,this.cleanupAfterRender=!1,this.pendingDestroy=!1,this.intentStates={}}return t.prototype={get pageNumber(){return this.pageIndex+1},get rotate(){return this.pageInfo.rotate},get ref(){return this.pageInfo.ref},get view(){return this.pageInfo.view},getViewport:function(t,e){return arguments.length<2&&(e=this.rotate),new PDFJS.PageViewport(this.view,t,e,0,0)},getAnnotations:function(){if(this.annotationsPromise)return this.annotationsPromise var t=this.transport.getAnnotations(this.pageIndex) return this.annotationsPromise=t,t},render:function(t){function e(t){var e=r.renderTasks.indexOf(a) e>=0&&r.renderTasks.splice(e,1),o.cleanupAfterRender&&(o.pendingDestroy=!0),o._tryDestroy(),t?a.capability.reject(t):a.capability.resolve(),n.timeEnd("Rendering"),n.timeEnd("Overall")}var n=this.stats n.time("Overall"),this.pendingDestroy=!1 var i="print"===t.intent?"print":"display" this.intentStates[i]||(this.intentStates[i]={}) var r=this.intentStates[i] r.displayReadyCapability||(r.receivingOperatorList=!0,r.displayReadyCapability=g(),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this.stats.time("Page Request"),this.transport.messageHandler.send("RenderPageRequest",{pageIndex:this.pageNumber-1,intent:i})) var a=new V(e,t,this.objs,this.commonObjs,r.operatorList,this.pageNumber) r.renderTasks||(r.renderTasks=[]),r.renderTasks.push(a) var s=a.task t.continueCallback&&(s.onContinue=t.continueCallback) var o=this return r.displayReadyCapability.promise.then(function(t){return o.pendingDestroy?void e():(n.time("Rendering"),a.initalizeGraphics(t),void a.operatorListChanged())},function(t){e(t)}),s},getOperatorList:function(){function t(){n.operatorList.lastChunk&&n.opListReadCapability.resolve(n.operatorList)}var e="oplist" this.intentStates[e]||(this.intentStates[e]={}) var n=this.intentStates[e] if(!n.opListReadCapability){var i={} i.operatorListChanged=t,n.receivingOperatorList=!0,n.opListReadCapability=g(),n.renderTasks=[],n.renderTasks.push(i),n.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this.transport.messageHandler.send("RenderPageRequest",{pageIndex:this.pageIndex,intent:e})}return n.opListReadCapability.promise},getTextContent:function(){return this.transport.messageHandler.sendWithPromise("GetTextContent",{pageIndex:this.pageNumber-1})},destroy:function(){this.pendingDestroy=!0,this._tryDestroy()},_tryDestroy:function(){this.pendingDestroy&&!Object.keys(this.intentStates).some(function(t){var e=this.intentStates[t] return 0!==e.renderTasks.length||e.receivingOperatorList},this)&&(Object.keys(this.intentStates).forEach(function(t){delete this.intentStates[t]},this),this.objs.clear(),this.annotationsPromise=null,this.pendingDestroy=!1)},_startRenderPage:function(t,e){var n=this.intentStates[e] n.displayReadyCapability&&n.displayReadyCapability.resolve(t)},_renderPageChunk:function(t,e){var n,i,r=this.intentStates[e] for(n=0,i=t.length;i>n;n++)r.operatorList.fnArray.push(t.fnArray[n]),r.operatorList.argsArray.push(t.argsArray[n]) for(r.operatorList.lastChunk=t.lastChunk,n=0;n<r.renderTasks.length;n++)r.renderTasks[n].operatorListChanged() t.lastChunk&&(r.receivingOperatorList=!1,this._tryDestroy())}},t}(),Y=function(){function i(e,i){if(this.pdfDataRangeTransport=i,this.workerInitializedCapability=e,this.commonObjs=new H,this.loadingTask=null,this.pageCache=[],this.pagePromises=[],this.downloadInfoCapability=g(),!k.PDFJS.disableWorker&&"undefined"!=typeof Worker){var r=PDFJS.workerSrc r||n("No PDFJS.workerSrc specified") try{var a=new Worker(r),s=new m("main",a) this.messageHandler=s,s.on("test",function(t){var n=t&&t.supportTypedArray n?(this.worker=a,t.supportTransfers||(PDFJS.postMessageTransfers=!1),this.setupMessageHandler(s),e.resolve()):this.setupFakeWorker()}.bind(this)) var o=new Uint8Array([PDFJS.postMessageTransfers?255:0]) try{s.send("test",o,[o.buffer])}catch(l){t("Cannot use postMessage transfers"),o[0]=0,s.send("test",o)}return}catch(c){t("The worker has been disabled.")}}this.setupFakeWorker()}return i.prototype={destroy:function(){this.pageCache=[],this.pagePromises=[] var t=this this.messageHandler.sendWithPromise("Terminate",null).then(function(){ht.clear(),t.worker&&t.worker.terminate()})},setupFakeWorker:function(){k.PDFJS.disableWorker=!0,PDFJS.fakeWorkerFilesLoadedCapability||(PDFJS.fakeWorkerFilesLoadedCapability=g(),B.loadScript(PDFJS.workerSrc,function(){PDFJS.fakeWorkerFilesLoadedCapability.resolve()})),PDFJS.fakeWorkerFilesLoadedCapability.promise.then(function(){e("Setting up fake worker.") var t={postMessage:function(e){t.onmessage({data:e})},terminate:function(){}},n=new m("main",t) this.setupMessageHandler(n),PDFJS.WorkerMessageHandler.setup(n),this.workerInitializedCapability.resolve()}.bind(this))},setupMessageHandler:function(t){function i(e){t.send("UpdatePassword",e)}this.messageHandler=t var r=this.pdfDataRangeTransport r&&(r.addRangeListener(function(e,n){t.send("OnDataRange",{begin:e,chunk:n})}),r.addProgressListener(function(e){t.send("OnDataProgress",{loaded:e})}),r.addProgressiveReadListener(function(e){t.send("OnDataRange",{chunk:e})}),t.on("RequestDataRange",function(t){r.requestDataRange(t.begin,t.end)},this)),t.on("GetDoc",function(t){var e=t.pdfInfo this.numPages=t.pdfInfo.numPages var n=new X(e,this) this.pdfDocument=n,this.loadingTask._capability.resolve(n)},this),t.on("NeedPassword",function(t){var e=this.loadingTask return e.onPassword?e.onPassword(i,E.NEED_PASSWORD):void e._capability.reject(new I(t.message,t.code))},this),t.on("IncorrectPassword",function(t){var e=this.loadingTask return e.onPassword?e.onPassword(i,E.INCORRECT_PASSWORD):void e._capability.reject(new I(t.message,t.code))},this),t.on("InvalidPDF",function(t){this.loadingTask._capability.reject(new _(t.message))},this),t.on("MissingPDF",function(t){this.loadingTask._capability.reject(new O(t.message))},this),t.on("UnexpectedResponse",function(t){this.loadingTask._capability.reject(new j(t.message,t.status))},this),t.on("UnknownError",function(t){this.loadingTask._capability.reject(new M(t.message,t.details))},this),t.on("DataLoaded",function(t){this.downloadInfoCapability.resolve(t)},this),t.on("PDFManagerReady",function(t){this.pdfDataRangeTransport&&this.pdfDataRangeTransport.transportReady()},this),t.on("StartRenderPage",function(t){var e=this.pageCache[t.pageIndex] e.stats.timeEnd("Page Request"),e._startRenderPage(t.transparency,t.intent)},this),t.on("RenderPageChunk",function(t){var e=this.pageCache[t.pageIndex] e._renderPageChunk(t.operatorList,t.intent)},this),t.on("commonobj",function(t){var n=t[0],i=t[1] if(!this.commonObjs.hasData(n))switch(i){case"Font":var r,a=t[2] if("error"in a){var s=a.error e("Error during font loading: "+s),this.commonObjs.resolve(n,s) break}r=new ut(a),ht.bind([r],function(t){this.commonObjs.resolve(n,r)}.bind(this)) break case"FontPath":this.commonObjs.resolve(n,t[2]) break default:s("Got unknown common object type "+i)}},this),t.on("obj",function(t){var e,i=t[0],r=t[1],a=t[2],s=this.pageCache[r] if(!s.objs.hasData(i))switch(a){case"JpegStream":e=t[3],v(i,e,s.objs) break case"Image":e=t[3],s.objs.resolve(i,e) var o=8e6 e&&"data"in e&&e.data.length>o&&(s.cleanupAfterRender=!0) break default:n("Got unknown object type "+a)}},this),t.on("DocProgress",function(t){var e=this.loadingTask e.onProgress&&e.onProgress({loaded:t.loaded,total:t.total})},this),t.on("PageError",function(t){var e=this.pageCache[t.pageNum-1],i=e.intentStates[t.intent] i.displayReadyCapability?i.displayReadyCapability.reject(t.error):n(t.error)},this),t.on("JpegDecode",function(t){var e=t[0],n=t[1] return 3!==n&&1!==n?Promise.reject(new Error("Only 3 components or 1 component can be returned")):new Promise(function(t,i){var r=new Image r.onload=function(){var e=r.width,i=r.height,a=e*i,s=4*a,o=new Uint8Array(a*n),l=b(e,i),c=l.getContext("2d") c.drawImage(r,0,0) var h,u,d=c.getImageData(0,0,e,i).data if(3===n)for(h=0,u=0;s>h;h+=4,u+=3)o[u]=d[h],o[u+1]=d[h+1],o[u+2]=d[h+2] else if(1===n)for(h=0,u=0;s>h;h+=4,u++)o[u]=d[h] t({data:o,width:e,height:i})},r.onerror=function(){i(new Error("JpegDecode failed to load image"))},r.src=e})})},fetchDocument:function(t,e){this.loadingTask=t,e.disableAutoFetch=PDFJS.disableAutoFetch,e.disableStream=PDFJS.disableStream,e.chunkedViewerLoading=!!this.pdfDataRangeTransport,this.pdfDataRangeTransport&&(e.length=this.pdfDataRangeTransport.length,e.initialData=this.pdfDataRangeTransport.initialData),this.messageHandler.send("GetDocRequest",{source:e,disableRange:PDFJS.disableRange,maxImageSize:PDFJS.maxImageSize,cMapUrl:PDFJS.cMapUrl,cMapPacked:PDFJS.cMapPacked,disableFontFace:PDFJS.disableFontFace,disableCreateObjectURL:PDFJS.disableCreateObjectURL,verbosity:PDFJS.verbosity})},getData:function(){return this.messageHandler.sendWithPromise("GetData",null)},getPage:function(t,e){if(0>=t||t>this.numPages||(0|t)!==t)return Promise.reject(new Error("Invalid page request")) var n=t-1 if(n in this.pagePromises)return this.pagePromises[n] var i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:n}).then(function(t){var e=new z(n,t,this) return this.pageCache[n]=e,e}.bind(this)) return this.pagePromises[n]=i,i},getPageIndex:function(t){return this.messageHandler.sendWithPromise("GetPageIndex",{ref:t})},getAnnotations:function(t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t})},getDestinations:function(){return this.messageHandler.sendWithPromise("GetDestinations",null)},getDestination:function(t){return this.messageHandler.sendWithPromise("GetDestination",{id:t})},getAttachments:function(){return this.messageHandler.sendWithPromise("GetAttachments",null)},getJavaScript:function(){return this.messageHandler.sendWithPromise("GetJavaScript",null)},getOutline:function(){return this.messageHandler.sendWithPromise("GetOutline",null)},getMetadata:function(){return this.messageHandler.sendWithPromise("GetMetadata",null).then(function(t){return{info:t[0],metadata:t[1]?new PDFJS.Metadata(t[1]):null}})},getStats:function(){return this.messageHandler.sendWithPromise("GetStats",null)},startCleanup:function(){this.messageHandler.sendWithPromise("Cleanup",null).then(function(){for(var t=0,e=this.pageCache.length;e>t;t++){var n=this.pageCache[t] n&&n.destroy()}this.commonObjs.clear(),ht.clear()}.bind(this))}},i}(),H=function(){function t(){this.objs={}}return t.prototype={ensureObj:function(t){if(this.objs[t])return this.objs[t] var e={capability:g(),data:null,resolved:!1} return this.objs[t]=e,e},get:function(t,e){if(e)return this.ensureObj(t).capability.promise.then(e),null var i=this.objs[t] return i&&i.resolved||n("Requesting object that isn't resolved yet "+t),i.data},resolve:function(t,e){var n=this.ensureObj(t) n.resolved=!0,n.data=e,n.capability.resolve(e)},isResolved:function(t){var e=this.objs return e[t]?e[t].resolved:!1},hasData:function(t){return this.isResolved(t)},getData:function(t){var e=this.objs return e[t]&&e[t].resolved?e[t].data:null},clear:function(){this.objs={}}},t}(),Q=function(){function t(t){this._internalRenderTask=t,this.onContinue=null}return t.prototype={get promise(){return this._internalRenderTask.capability.promise},cancel:function(){this._internalRenderTask.cancel()},then:function(t,e){return this.promise.then.apply(this.promise,arguments)}},t}(),V=function(){function t(t,e,n,i,r,a){this.callback=t,this.params=e,this.objs=n,this.commonObjs=i,this.operatorListIdx=null,this.operatorList=r,this.pageNumber=a,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this.cancelled=!1,this.capability=g(),this.task=new Q(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this)}return t.prototype={initalizeGraphics:function(t){if(!this.cancelled){PDFJS.pdfBug&&"StepperManager"in k&&k.StepperManager.enabled&&(this.stepper=k.StepperManager.create(this.pageNumber-1),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint()) var e=this.params this.gfx=new at(e.canvasContext,this.commonObjs,this.objs,e.imageLayer),this.gfx.beginDrawing(e.viewport,t),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}},cancel:function(){this.running=!1,this.cancelled=!0,this.callback("cancelled")},operatorListChanged:function(){return this.graphicsReady?(this.stepper&&this.stepper.updateOperatorList(this.operatorList),void(this.running||this._continue())):void(this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound))},_continue:function(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue.call(this.task,this._scheduleNextBound):this._scheduleNext())},_scheduleNext:function(){window.requestAnimationFrame(this._nextBound)},_next:function(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),this.callback())))}},t}(),q=(PDFJS.Metadata=function(){function t(t){return t.replace(/>\\376\\377([^<]+)/g,function(t,e){for(var n=e.replace(/\\([0-3])([0-7])([0-7])/g,function(t,e,n,i){return String.fromCharCode(64*e+8*n+1*i)}),i="",r=0;r<n.length;r+=2){var a=256*n.charCodeAt(r)+n.charCodeAt(r+1) i+="&#x"+(65536+a).toString(16).substring(1)+";"}return">"+i})}function e(e){if("string"==typeof e){e=t(e) var i=new DOMParser e=i.parseFromString(e,"application/xml")}else e instanceof Document||n("Metadata: Invalid metadata object") this.metaDocument=e,this.metadata={},this.parse()}return e.prototype={parse:function(){var t=this.metaDocument,e=t.documentElement if("rdf:rdf"!==e.nodeName.toLowerCase())for(e=e.firstChild;e&&"rdf:rdf"!==e.nodeName.toLowerCase();)e=e.nextSibling var n=e?e.nodeName.toLowerCase():null if(e&&"rdf:rdf"===n&&e.hasChildNodes()){var i,r,a,s,o,l,c,h=e.childNodes for(s=0,l=h.length;l>s;s++)if(i=h[s],"rdf:description"===i.nodeName.toLowerCase())for(o=0,c=i.childNodes.length;c>o;o++)"#text"!==i.childNodes[o].nodeName.toLowerCase()&&(r=i.childNodes[o],a=r.nodeName.toLowerCase(),this.metadata[a]=r.textContent.trim())}},get:function(t){return this.metadata[t]||null},has:function(t){return"undefined"!=typeof this.metadata[t]}},e}(),16),K=100,Z=4096,$=.65,tt=!0,et=1e3,nt=16,it=function(){var t={} return{getCanvas:function(e,n,i,r){var a if(void 0!==t[e])a=t[e],a.canvas.width=n,a.canvas.height=i,a.context.setTransform(1,0,0,1,0,0) else{var s=b(n,i),o=s.getContext("2d") r&&S(o),t[e]=a={canvas:s,context:o}}return a},clear:function(){for(var e in t){var n=t[e] n.canvas.width=0,n.canvas.height=0,delete t[e]}}}}(),rt=function(){function t(t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=J,this.textMatrixScale=1,this.fontMatrix=C,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=F.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.old=t}return t.prototype={clone:function(){return Object.create(this)},setCurrentPoint:function(t,e){this.x=t,this.y=e}},t}(),at=function(){function i(t,e,n,i){this.ctx=t,this.current=new rt,this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=n,this.imageLayer=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,t&&S(t),this.cachedGetSinglePixelWidth=null}function a(t,e){if("undefined"!=typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0) var i,r,a,s,o,l=e.height,c=e.width,h=l%nt,u=(l-h)/nt,d=0===h?u:u+1,f=t.createImageData(c,nt),p=0,A=e.data,g=f.data if(e.kind===D.GRAYSCALE_1BPP){var m=A.byteLength,v=PDFJS.hasCanvasTypedArrays?new Uint32Array(g.buffer):new N(g),b=v.length,S=c+7>>3,x=4294967295,y=PDFJS.isLittleEndian||!PDFJS.hasCanvasTypedArrays?4278190080:255 for(r=0;d>r;r++){for(s=u>r?nt:h,i=0,a=0;s>a;a++){for(var k=m-p,P=0,C=k>S?c:8*k-7,F=-8&C,w=0,T=0;F>P;P+=8)T=A[p++],v[i++]=128&T?x:y,v[i++]=64&T?x:y,v[i++]=32&T?x:y,v[i++]=16&T?x:y,v[i++]=8&T?x:y,v[i++]=4&T?x:y,v[i++]=2&T?x:y,v[i++]=1&T?x:y for(;C>P;P++)0===w&&(T=A[p++],w=128),v[i++]=T&w?x:y,w>>=1}for(;b>i;)v[i++]=0 t.putImageData(f,0,r*nt)}}else if(e.kind===D.RGBA_32BPP){for(a=0,o=c*nt*4,r=0;u>r;r++)g.set(A.subarray(p,p+o)),p+=o,t.putImageData(f,0,a),a+=nt d>r&&(o=c*h*4,g.set(A.subarray(p,p+o)),t.putImageData(f,0,a))}else if(e.kind===D.RGB_24BPP)for(s=nt,o=c*s,r=0;d>r;r++){for(r>=u&&(s=h,o=c*s),i=0,a=o;a--;)g[i++]=A[p++],g[i++]=A[p++],g[i++]=A[p++],g[i++]=255 t.putImageData(f,0,r*nt)}else n("bad image kind: "+e.kind)}function s(t,e){for(var n=e.height,i=e.width,r=n%nt,a=(n-r)/nt,s=0===r?a:a+1,o=t.createImageData(i,nt),l=0,c=e.data,h=o.data,u=0;s>u;u++){for(var d=a>u?nt:r,f=3,p=0;d>p;p++)for(var A=0,g=0;i>g;g++){if(!A){var m=c[l++] A=128}h[f]=m&A?0:255,f+=4,A>>=1}t.putImageData(o,0,u*nt)}}function l(t,e){for(var n=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"],i=0,r=n.length;r>i;i++){var a=n[i] void 0!==t[a]&&(e[a]=t[a])}void 0!==t.setLineDash?(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset):void 0!==t.mozDashOffset&&(e.mozDash=t.mozDash,e.mozDashOffset=t.mozDashOffset)}function c(t,e,n,i){for(var r=t.length,a=3;r>a;a+=4){var s=t[a] if(0===s)t[a-3]=e,t[a-2]=n,t[a-1]=i else if(255>s){var o=255-s t[a-3]=t[a-3]*s+e*o>>8,t[a-2]=t[a-2]*s+n*o>>8,t[a-1]=t[a-1]*s+i*o>>8}}}function h(t,e){for(var n=t.length,i=1/255,r=3;n>r;r+=4){var a=t[r] e[r]=e[r]*a*i|0}}function u(t,e){for(var n=t.length,i=3;n>i;i+=4){var r=77*t[i-3]+152*t[i-2]+28*t[i-1] e[i]=e[i]*r>>16}}function d(t,e,n,i,r,a){var s,o=!!a,l=o?a[0]:0,d=o?a[1]:0,f=o?a[2]:0 s="Luminosity"===r?u:h for(var p=1048576,A=Math.min(i,Math.ceil(p/n)),g=0;i>g;g+=A){var m=Math.min(A,i-g),v=t.getImageData(0,g,n,m),b=e.getImageData(0,g,n,m) o&&c(v.data,l,d,f),s(v.data,b.data),t.putImageData(b,0,g)}}function A(t,e,n){var i=e.canvas,r=e.context t.setTransform(e.scaleX,0,0,e.scaleY,e.offsetX,e.offsetY) var a=e.backdrop||null if(st.isEnabled){var s=st.composeSMask(n.canvas,i,{subtype:e.subtype,backdrop:a}) return t.setTransform(1,0,0,1,0,0),void t.drawImage(s,e.offsetX,e.offsetY)}d(r,n,i.width,i.height,e.subtype,a),t.drawImage(i,0,0)}var g=15,m=10,v=["butt","round","square"],b=["miter","round","bevel"],k={},P={} i.prototype={beginDrawing:function(t,e){var n=this.ctx.canvas.width,i=this.ctx.canvas.height e?this.ctx.clearRect(0,0,n,i):(this.ctx.mozOpaque=!0,this.ctx.save(),this.ctx.fillStyle="rgb(255, 255, 255)",this.ctx.fillRect(0,0,n,i),this.ctx.restore()) var r=t.transform this.ctx.save(),this.ctx.transform.apply(this.ctx,r),this.baseTransform=this.ctx.mozCurrentTransform.slice(),this.imageLayer&&this.imageLayer.beginLayout()},executeOperatorList:function(t,e,n,i){var r=t.argsArray,a=t.fnArray,s=e||0,o=r.length if(o===s)return s for(var l,c=o-s>m&&"function"==typeof n,h=c?Date.now()+g:0,u=0,d=this.commonObjs,f=this.objs;;){if(void 0!==i&&s===i.nextBreakPoint)return i.breakIt(s,n),s if(l=a[s],l!==T.dependency)this[l].apply(this,r[s]) else for(var p=r[s],A=0,v=p.length;v>A;A++){var b=p[A],S="g"===b[0]&&"_"===b[1],x=S?d:f if(!x.isResolved(b))return x.get(b,n),s}if(s++,s===o)return s if(c&&++u>m){if(Date.now()>h)return n(),s u=0}}},endDrawing:function(){this.ctx.restore(),it.clear(),st.clear(),this.imageLayer&&this.imageLayer.endLayout()},setLineWidth:function(t){this.current.lineWidth=t,this.ctx.lineWidth=t},setLineCap:function(t){this.ctx.lineCap=v[t]},setLineJoin:function(t){this.ctx.lineJoin=b[t]},setMiterLimit:function(t){this.ctx.miterLimit=t},setDash:function(t,e){var n=this.ctx void 0!==n.setLineDash?(n.setLineDash(t),n.lineDashOffset=e):(n.mozDash=t,n.mozDashOffset=e)},setRenderingIntent:function(t){},setFlatness:function(t){},setGState:function(t){for(var n=0,i=t.length;i>n;n++){var r=t[n],a=r[0],s=r[1] switch(a){case"LW":this.setLineWidth(s) break case"LC":this.setLineCap(s) break case"LJ":this.setLineJoin(s) break case"ML":this.setMiterLimit(s) break case"D":this.setDash(s[0],s[1]) break case"RI":this.setRenderingIntent(s) break case"FL":this.setFlatness(s) break case"Font":this.setFont(s[0],s[1]) break case"CA":this.current.strokeAlpha=r[1] break case"ca":this.current.fillAlpha=r[1],this.ctx.globalAlpha=r[1] break case"BM":if(s&&s.name&&"Normal"!==s.name){var o=s.name.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()}).substring(1) this.ctx.globalCompositeOperation=o,this.ctx.globalCompositeOperation!==o&&e('globalCompositeOperation "'+o+'" is not supported')}else this.ctx.globalCompositeOperation="source-over" break case"SMask":this.current.activeSMask&&this.endSMaskGroup(),this.current.activeSMask=s?this.tempSMask:null,this.current.activeSMask&&this.beginSMaskGroup(),this.tempSMask=null}}},beginSMaskGroup:function(){var t=this.current.activeSMask,e=t.canvas.width,n=t.canvas.height,i="smaskGroupAt"+this.groupLevel,r=it.getCanvas(i,e,n,!0),a=this.ctx,s=a.mozCurrentTransform this.ctx.save() var o=r.context o.scale(1/t.scaleX,1/t.scaleY),o.translate(-t.offsetX,-t.offsetY),o.transform.apply(o,s),l(a,o),this.ctx=o,this.setGState([["BM","Normal"],["ca",1],["CA",1]]),this.groupStack.push(a),this.groupLevel++},endSMaskGroup:function(){var t=this.ctx this.groupLevel--,this.ctx=this.groupStack.pop(),A(this.ctx,this.current.activeSMask,t),this.ctx.restore()},save:function(){this.ctx.save() var t=this.current this.stateStack.push(t),this.current=t.clone(),this.current.activeSMask=null},restore:function(){0!==this.stateStack.length&&(null!==this.current.activeSMask&&this.endSMaskGroup(),this.current=this.stateStack.pop(),this.ctx.restore(),this.cachedGetSinglePixelWidth=null)},transform:function(t,e,n,i,r,a){this.ctx.transform(t,e,n,i,r,a),this.cachedGetSinglePixelWidth=null},constructPath:function(t,e){for(var n=this.ctx,i=this.current,r=i.x,a=i.y,s=0,o=0,l=t.length;l>s;s++)switch(0|t[s]){case T.rectangle:r=e[o++],a=e[o++] var c=e[o++],h=e[o++] 0===c&&(c=this.getSinglePixelWidth()),0===h&&(h=this.getSinglePixelWidth()) var u=r+c,d=a+h this.ctx.moveTo(r,a),this.ctx.lineTo(u,a),this.ctx.lineTo(u,d),this.ctx.lineTo(r,d),this.ctx.lineTo(r,a),this.ctx.closePath() break case T.moveTo:r=e[o++],a=e[o++],n.moveTo(r,a) break case T.lineTo:r=e[o++],a=e[o++],n.lineTo(r,a) break case T.curveTo:r=e[o+4],a=e[o+5],n.bezierCurveTo(e[o],e[o+1],e[o+2],e[o+3],r,a),o+=6 break case T.curveTo2:n.bezierCurveTo(r,a,e[o],e[o+1],e[o+2],e[o+3]),r=e[o+2],a=e[o+3],o+=4 break case T.curveTo3:r=e[o+2],a=e[o+3],n.bezierCurveTo(e[o],e[o+1],r,a,r,a),o+=4 break case T.closePath:n.closePath()}i.setCurrentPoint(r,a)},closePath:function(){this.ctx.closePath()},stroke:function(t){t="undefined"!=typeof t?t:!0 var e=this.ctx,n=this.current.strokeColor e.lineWidth=Math.max(this.getSinglePixelWidth()*$,this.current.lineWidth),e.globalAlpha=this.current.strokeAlpha,n&&n.hasOwnProperty("type")&&"Pattern"===n.type?(e.save(),e.strokeStyle=n.getPattern(e,this),e.stroke(),e.restore()):e.stroke(),t&&this.consumePath(),e.globalAlpha=this.current.fillAlpha},closeStroke:function(){this.closePath(),this.stroke()},fill:function(t){t="undefined"!=typeof t?t:!0 var e=this.ctx,n=this.current.fillColor,i=this.current.patternFill,r=!1 if(i&&(e.save(),e.fillStyle=n.getPattern(e,this),r=!0),this.pendingEOFill){if(void 0!==e.mozFillRule)e.mozFillRule="evenodd",e.fill(),e.mozFillRule="nonzero" else try{e.fill("evenodd")}catch(a){e.fill()}this.pendingEOFill=!1}else e.fill() r&&e.restore(),t&&this.consumePath()},eoFill:function(){this.pendingEOFill=!0,this.fill()},fillStroke:function(){this.fill(!1),this.stroke(!1),this.consumePath()},eoFillStroke:function(){this.pendingEOFill=!0,this.fillStroke()},closeFillStroke:function(){this.closePath(),this.fillStroke()},closeEOFillStroke:function(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()},endPath:function(){this.consumePath()},clip:function(){this.pendingClip=k},eoClip:function(){this.pendingClip=P},beginText:function(){this.current.textMatrix=J,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0},endText:function(){var t=this.pendingTextPaths,e=this.ctx if(void 0===t)return void e.beginPath() e.save(),e.beginPath() for(var n=0;n<t.length;n++){var i=t[n] e.setTransform.apply(e,i.transform),e.translate(i.x,i.y),i.addToPath(e,i.fontSize)}e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths},setCharSpacing:function(t){this.current.charSpacing=t},setWordSpacing:function(t){this.current.wordSpacing=t},setHScale:function(t){this.current.textHScale=t/100},setLeading:function(t){this.current.leading=-t},setFont:function(t,i){var r=this.commonObjs.get(t),a=this.current if(r||n("Can't find font for "+t),a.fontMatrix=r.fontMatrix?r.fontMatrix:C,(0===a.fontMatrix[0]||0===a.fontMatrix[3])&&e("Invalid font matrix for font "+t),0>i?(i=-i,a.fontDirection=-1):a.fontDirection=1,this.current.font=r,this