Skip to content

Instantly share code, notes, and snippets.

@Buntelrus
Last active September 4, 2021 08:14
Show Gist options
  • Save Buntelrus/1508cb9c1de48da29c03a9b278042697 to your computer and use it in GitHub Desktop.
Save Buntelrus/1508cb9c1de48da29c03a9b278042697 to your computer and use it in GitHub Desktop.
Make printing recipes easier
// ==UserScript==
// @name Print Recipes
// @version 0.1.5
// @author Buntelrus
// @description Make printing recipes easier
// @homepage https://buntel.de
// @match https://www.zdf.de/*
// @match https://www.swr.de/buffet*
// @downloadURL https://gist.github.com/Buntelrus/1508cb9c1de48da29c03a9b278042697/raw/main.bundle.min.user.js
// @updateURL https://gist.github.com/Buntelrus/1508cb9c1de48da29c03a9b278042697/raw/main.bundle.min.user.js
// ==/UserScript==
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,r),s.l=!0,s.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)r.d(n,s,function(e){return t[e]}.bind(null,s));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=24)}([function(t,e,r){"use strict";const n=location.hostname.split("."),s=n[n.length-2];e.a={get pdfBoxId(){return this[s+"PdfBoxId"]},get link(){return this[s+"Link"]},get getTitle(){return this[s+"GetTitle"]},get pdfContainerClasses(){return this[s+"PdfContainerClasses"]},zdfPdfBoxId:".box .icon-404_download",zdfLink:".box a",zdfGetTitle(t,e){return(t=e||t).querySelector(this.zdfLink).title},zdfPdfContainerClasses:["b-content-teaser-item","b-cluster-teaser"],swrPdfBoxId:'img[alt="Download"]',swrLink:'a[href$=".pdf"]',swrGetTitle:(t,e)=>t.querySelector(".headline").innerText,swrPdfContainerClasses:["teaser"],style:"head > style:last-of-type",swrBroadcastHeadline:".headline",swrFollowArticleLink:"#articlebody > .link > a",fiveMonthList:{entries:".detailSectionGroupZ > .teaserBundle",link:"a"}}},function(t,e,r){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r=function(t,e){var r=t[1]||"",n=t[3];if(!n)return r;if(e&&"function"==typeof btoa){var s=(a=n,o=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(o),"/*# ".concat(l," */")),i=n.sources.map((function(t){return"/*# sourceURL=".concat(n.sourceRoot||"").concat(t," */")}));return[r].concat(i).concat([s]).join("\n")}var a,o,l;return[r].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(r,"}"):r})).join("")},e.i=function(t,r,n){"string"==typeof t&&(t=[[null,t,""]]);var s={};if(n)for(var i=0;i<this.length;i++){var a=this[i][0];null!=a&&(s[a]=!0)}for(var o=0;o<t.length;o++){var l=[].concat(t[o]);n&&s[l[0]]||(r&&(l[2]?l[2]="".concat(r," and ").concat(l[2]):l[2]=r),e.push(l))}},e}},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return Recipe}));var _selectors__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_PdfJsWrapper__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(5),_functions_fetch_doc__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6);class Recipe{pdfJsWrapper;pdf;boxElement;link;loader;constructor(t,{boxElement:e,pdf:r,title:n,link:s=location.href,context:i=document}){this.pdfJsWrapper=t,e&&e.addEventListener("click",this.onClick.bind(this)),this.boxElement=e,this.pdf=r||e.querySelector(_selectors__WEBPACK_IMPORTED_MODULE_0__.a.link),this.title=n||_selectors__WEBPACK_IMPORTED_MODULE_0__.a.getTitle(i,e)||this.pdf,this.link=s,this.loader=document.querySelector(".pr-loader-container")}static find(t,e){return Array.from(t.querySelectorAll(_selectors__WEBPACK_IMPORTED_MODULE_0__.a.pdfBoxId)).map(r=>{let n=r.parentElement;for(;!_selectors__WEBPACK_IMPORTED_MODULE_0__.a.pdfContainerClasses.some(t=>n.classList.contains(t));)n=n.parentElement;return new Recipe(e,{boxElement:n,context:t})})}static swrBroadcastLookahead(broadcastDate,callback,pdfJsWrapper){const dateTime=new Intl.DateTimeFormat("de-DE",{dateStyle:"medium"});broadcastDate=dateTime.format(broadcastDate);const recipesLast5month="https://www.swr.de/buffet/rezepte/rezepte-der-letzten-6-monate/-/id=257024/did=4163584/nid=257024/ejvtj6/index.html";Object(_functions_fetch_doc__WEBPACK_IMPORTED_MODULE_2__.a)(recipesLast5month).then(doc=>{const entries=Array.from(doc.querySelectorAll(_selectors__WEBPACK_IMPORTED_MODULE_0__.a.fiveMonthList.entries)).filter(entry=>{const broadcastDateElement=entry.querySelector("span[data-ctrl-datetime]");let ctrlDatetime;eval("ctrlDatetime = "+broadcastDateElement.dataset.ctrlDatetime);let date=new Date(parseInt(ctrlDatetime.date));return date=dateTime.format(date),date===broadcastDate});entries.forEach(t=>{const e=t.querySelector(_selectors__WEBPACK_IMPORTED_MODULE_0__.a.fiveMonthList.link).href;Object(_functions_fetch_doc__WEBPACK_IMPORTED_MODULE_2__.a)(e).then(t=>{Recipe.find(t,pdfJsWrapper).forEach(t=>callback(t))})})})}onClick(t){t.preventDefault(),this.open()}open(t=!1){this.loader.classList.add("show"),this.pdfJsWrapper.loadDocument(this.pdf).then(()=>{this.loader.classList.remove("show"),this.pdfJsWrapper.showPdf(t)}).catch(t=>{throw this.loader.classList.remove("show"),t})}}},function(module,exports,__webpack_require__){(function(process,Buffer){var factory;factory=function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,r),s.l=!0,s.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)r.d(n,s,function(e){return t[e]}.bind(null,s));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1),s=r(3),i=r(16),a=r(17),o=r(4),l=r(18);const c=r(10),h=r(6);{const{isNodeJS:t}=r(7);if(t){const t=r(19).PDFNodeStream;s.setPDFNetworkStreamFactory(e=>new t(e))}else{const t=r(22).PDFNetworkStream;let e;o.isFetchSupported()&&(e=r(23).PDFFetchStream),s.setPDFNetworkStreamFactory(r=>e&&o.isValidFetchUrl(r.url)?new e(r):new t(r))}}e.build=s.build,e.version=s.version,e.getDocument=s.getDocument,e.LoopbackPort=s.LoopbackPort,e.PDFDataRangeTransport=s.PDFDataRangeTransport,e.PDFWorker=s.PDFWorker,e.renderTextLayer=i.renderTextLayer,e.AnnotationLayer=a.AnnotationLayer,e.createPromiseCapability=n.createPromiseCapability,e.PasswordResponses=n.PasswordResponses,e.InvalidPDFException=n.InvalidPDFException,e.MissingPDFException=n.MissingPDFException,e.SVGGraphics=l.SVGGraphics,e.NativeImageDecoding=n.NativeImageDecoding,e.CMapCompressionType=n.CMapCompressionType,e.PermissionFlag=n.PermissionFlag,e.UnexpectedResponseException=n.UnexpectedResponseException,e.OPS=n.OPS,e.VerbosityLevel=n.VerbosityLevel,e.UNSUPPORTED_FEATURES=n.UNSUPPORTED_FEATURES,e.createValidAbsoluteUrl=n.createValidAbsoluteUrl,e.createObjectURL=n.createObjectURL,e.removeNullCharacters=n.removeNullCharacters,e.shadow=n.shadow,e.Util=n.Util,e.RenderingCancelledException=o.RenderingCancelledException,e.getFilenameFromUrl=o.getFilenameFromUrl,e.LinkTarget=o.LinkTarget,e.addLinkAttributes=o.addLinkAttributes,e.loadScript=o.loadScript,e.PDFDateString=o.PDFDateString,e.GlobalWorkerOptions=c.GlobalWorkerOptions,e.apiCompatibilityParams=h.apiCompatibilityParams},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.arrayByteLength=u,e.arraysToBytes=function(t){const e=t.length;if(1===e&&t[0]instanceof Uint8Array)return t[0];let r=0;for(let n=0;n<e;n++)r+=u(t[n]);let n=0;const s=new Uint8Array(r);for(let r=0;r<e;r++){let e=t[r];e instanceof Uint8Array||(e="string"==typeof e?d(e):new Uint8Array(e));const i=e.byteLength;s.set(e,n),n+=i}return s},e.assert=o,e.bytesToString=function(t){o(null!==t&&"object"==typeof t&&void 0!==t.length,"Invalid argument for bytesToString");const e=t.length;if(e<8192)return String.fromCharCode.apply(null,t);const r=[];for(let n=0;n<e;n+=8192){const s=Math.min(n+8192,e),i=t.subarray(n,s);r.push(String.fromCharCode.apply(null,i))}return r.join("")},e.createPromiseCapability=function(){const t=Object.create(null);let e=!1;return Object.defineProperty(t,"settled",{get:()=>e}),t.promise=new Promise((function(r,n){t.resolve=function(t){e=!0,r(t)},t.reject=function(t){e=!0,n(t)}})),t},e.getVerbosityLevel=function(){return s},e.info=function(t){s>=n.INFOS&&console.log("Info: "+t)},e.isArrayBuffer=function(t){return"object"==typeof t&&null!==t&&void 0!==t.byteLength},e.isArrayEqual=function(t,e){return t.length===e.length&&t.every((function(t,r){return t===e[r]}))},e.isBool=function(t){return"boolean"==typeof t},e.isEmptyObj=function(t){for(const e in t)return!1;return!0},e.isNum=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSameOrigin=function(t,e){let r;try{if(r=new URL(t),!r.origin||"null"===r.origin)return!1}catch(t){return!1}const n=new URL(e,r);return r.origin===n.origin},e.createValidAbsoluteUrl=function(t,e){if(!t)return null;try{const r=e?new URL(t,e):new URL(t);if(function(t){if(!t)return!1;switch(t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch(t){}return null},e.removeNullCharacters=function(t){return"string"!=typeof t?(i("The argument for removeNullCharacters must be a string."),t):t.replace(h,"")},e.setVerbosityLevel=function(t){Number.isInteger(t)&&(s=t)},e.shadow=l,e.string32=function(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)},e.stringToBytes=d,e.stringToPDFString=function(t){const e=t.length,r=[];if("þ"===t[0]&&"ÿ"===t[1])for(let n=2;n<e;n+=2)r.push(String.fromCharCode(t.charCodeAt(n)<<8|t.charCodeAt(n+1)));else if("ÿ"===t[0]&&"þ"===t[1])for(let n=2;n<e;n+=2)r.push(String.fromCharCode(t.charCodeAt(n+1)<<8|t.charCodeAt(n)));else for(let n=0;n<e;++n){const e=b[t.charCodeAt(n)];r.push(e?String.fromCharCode(e):t.charAt(n))}return r.join("")},e.stringToUTF8String=function(t){return decodeURIComponent(escape(t))},e.utf8StringToString=function(t){return unescape(encodeURIComponent(t))},e.warn=i,e.unreachable=a,e.IsEvalSupportedCached=e.IsLittleEndianCached=e.createObjectURL=e.FormatError=e.Util=e.UnknownErrorException=e.UnexpectedResponseException=e.TextRenderingMode=e.StreamType=e.PermissionFlag=e.PasswordResponses=e.PasswordException=e.NativeImageDecoding=e.MissingPDFException=e.InvalidPDFException=e.AbortException=e.CMapCompressionType=e.ImageKind=e.FontType=e.AnnotationType=e.AnnotationStateModelType=e.AnnotationReviewState=e.AnnotationReplyType=e.AnnotationMarkedState=e.AnnotationFlag=e.AnnotationFieldFlag=e.AnnotationBorderStyleType=e.UNSUPPORTED_FEATURES=e.VerbosityLevel=e.OPS=e.IDENTITY_MATRIX=e.FONT_IDENTITY_MATRIX=e.BaseException=void 0,r(2),e.IDENTITY_MATRIX=[1,0,0,1,0,0],e.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],e.NativeImageDecoding={NONE:"none",DECODE:"decode",DISPLAY:"display"},e.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},e.TextRenderingMode={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},e.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},e.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},e.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"},e.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"},e.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"},e.AnnotationReplyType={GROUP:"Group",REPLY:"R"},e.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},e.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},e.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},e.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"},e.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const n={ERRORS:0,WARNINGS:1,INFOS:5};e.VerbosityLevel=n,e.CMapCompressionType={NONE:0,BINARY:1,STREAM:2},e.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},e.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font"},e.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let s=n.WARNINGS;function i(t){s>=n.WARNINGS&&console.log("Warning: "+t)}function a(t){throw new Error(t)}function o(t,e){t||a(e)}function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!1}),r}const c=function(){function t(e){this.constructor===t&&a("Cannot initialize BaseException."),this.message=e,this.name=this.constructor.name}return t.prototype=new Error,t.constructor=t,t}();e.BaseException=c,e.PasswordException=class extends c{constructor(t,e){super(t),this.code=e}},e.UnknownErrorException=class extends c{constructor(t,e){super(t),this.details=e}},e.InvalidPDFException=class extends c{},e.MissingPDFException=class extends c{},e.UnexpectedResponseException=class extends c{constructor(t,e){super(t),this.status=e}},e.FormatError=class extends c{},e.AbortException=class extends c{};const h=/\x00/g;function d(t){o("string"==typeof t,"Invalid argument for stringToBytes");const e=t.length,r=new Uint8Array(e);for(let n=0;n<e;++n)r[n]=255&t.charCodeAt(n);return r}function u(t){return void 0!==t.length?t.length:(o(void 0!==t.byteLength),t.byteLength)}const p={get value(){return l(this,"value",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}};e.IsLittleEndianCached=p;const f={get value(){return l(this,"value",function(){try{return new Function(""),!0}catch(t){return!1}}())}};e.IsEvalSupportedCached=f;const g=["rgb(",0,",",0,",",0,")"];class m{static makeCssRgb(t,e,r){return g[1]=t,g[3]=e,g[5]=r,g.join("")}static transform(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]]}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){const r=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/r,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/r]}static getAxialAlignedBoundingBox(t,e){const r=m.applyTransform(t,e),n=m.applyTransform(t.slice(2,4),e),s=m.applyTransform([t[0],t[3]],e),i=m.applyTransform([t[2],t[1]],e);return[Math.min(r[0],n[0],s[0],i[0]),Math.min(r[1],n[1],s[1],i[1]),Math.max(r[0],n[0],s[0],i[0]),Math.max(r[1],n[1],s[1],i[1])]}static inverseTransform(t){const 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]}static apply3dTransform(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]]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],r=t[0]*e[0]+t[1]*e[2],n=t[0]*e[1]+t[1]*e[3],s=t[2]*e[0]+t[3]*e[2],i=t[2]*e[1]+t[3]*e[3],a=(r+i)/2,o=Math.sqrt((r+i)*(r+i)-4*(r*i-s*n))/2,l=a+o||1,c=a-o||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(t){const 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}static intersect(t,e){function r(t,e){return t-e}const n=[t[0],t[2],e[0],e[2]].sort(r),s=[t[1],t[3],e[1],e[3]].sort(r),i=[];return t=m.normalizeRect(t),e=m.normalizeRect(e),n[0]===t[0]&&n[1]===e[0]||n[0]===e[0]&&n[1]===t[0]?(i[0]=n[1],i[2]=n[2],s[0]===t[1]&&s[1]===e[1]||s[0]===e[1]&&s[1]===t[1]?(i[1]=s[1],i[3]=s[2],i):null):null}}e.Util=m;const b=[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],A=function(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return function(e,r,n=!1){if(!n&&URL.createObjectURL){const t=new Blob([e],{type:r});return URL.createObjectURL(t)}let s=`data:${r};base64,`;for(let r=0,n=e.length;r<n;r+=3){const i=255&e[r],a=255&e[r+1],o=255&e[r+2];s+=t[i>>2]+t[(3&i)<<4|a>>4]+t[r+1<n?(15&a)<<2|o>>6:64]+t[r+2<n?63&o:64]}return s}}();e.createObjectURL=A},function(t,e,r){},function(module,exports,__w_pdfjs_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getDocument=getDocument,exports.setPDFNetworkStreamFactory=setPDFNetworkStreamFactory,exports.build=exports.version=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFWorker=exports.PDFDataRangeTransport=exports.LoopbackPort=void 0;var _util=__w_pdfjs_require__(1),_display_utils=__w_pdfjs_require__(4),_font_loader=__w_pdfjs_require__(5),_api_compatibility=__w_pdfjs_require__(6),_canvas=__w_pdfjs_require__(8),_worker_options=__w_pdfjs_require__(10),_is_node=__w_pdfjs_require__(7),_message_handler=__w_pdfjs_require__(11),_metadata=__w_pdfjs_require__(12),_transport_stream=__w_pdfjs_require__(14),_webgl=__w_pdfjs_require__(15);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100;let createPDFNetworkStream;function setPDFNetworkStreamFactory(t){createPDFNetworkStream=t}function getDocument(t){const e=new PDFDocumentLoadingTask;let r;if("string"==typeof t)r={url:t};else if((0,_util.isArrayBuffer)(t))r={data:t};else if(t instanceof PDFDataRangeTransport)r={range:t};else{if("object"!=typeof t)throw new Error("Invalid parameter in getDocument, need either Uint8Array, string or a parameter object");if(!t.url&&!t.data&&!t.range)throw new Error("Invalid parameter object: need either .data, .range or .url");r=t}const n=Object.create(null);let s=null,i=null;for(const t in r)if("url"!==t||"undefined"==typeof window)if("range"!==t)if("worker"!==t)if("data"!==t||r[t]instanceof Uint8Array)n[t]=r[t];else{const e=r[t];if("string"==typeof e)n[t]=(0,_util.stringToBytes)(e);else if("object"!=typeof e||null===e||isNaN(e.length)){if(!(0,_util.isArrayBuffer)(e))throw new Error("Invalid PDF binary data: either typed array, string or array-like object is expected in the data property.");n[t]=new Uint8Array(e)}else n[t]=new Uint8Array(e)}else i=r[t];else s=r[t];else n[t]=new URL(r[t],window.location).href;n.rangeChunkSize=n.rangeChunkSize||DEFAULT_RANGE_CHUNK_SIZE,n.CMapReaderFactory=n.CMapReaderFactory||_display_utils.DOMCMapReaderFactory,n.ignoreErrors=!0!==n.stopAtErrors,n.pdfBug=!0===n.pdfBug;const a=Object.values(_util.NativeImageDecoding);if(void 0!==n.nativeImageDecoderSupport&&a.includes(n.nativeImageDecoderSupport)||(n.nativeImageDecoderSupport=_api_compatibility.apiCompatibilityParams.nativeImageDecoderSupport||_util.NativeImageDecoding.DECODE),Number.isInteger(n.maxImageSize)||(n.maxImageSize=-1),"boolean"!=typeof n.isEvalSupported&&(n.isEvalSupported=!0),"boolean"!=typeof n.disableFontFace&&(n.disableFontFace=_api_compatibility.apiCompatibilityParams.disableFontFace||!1),"boolean"!=typeof n.disableRange&&(n.disableRange=!1),"boolean"!=typeof n.disableStream&&(n.disableStream=!1),"boolean"!=typeof n.disableAutoFetch&&(n.disableAutoFetch=!1),"boolean"!=typeof n.disableCreateObjectURL&&(n.disableCreateObjectURL=_api_compatibility.apiCompatibilityParams.disableCreateObjectURL||!1),(0,_util.setVerbosityLevel)(n.verbosity),!i){const t={verbosity:n.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};i=t.port?PDFWorker.fromPort(t):new PDFWorker(t),e._worker=i}const o=e.docId;return i.promise.then((function(){if(e.destroyed)throw new Error("Loading aborted");return _fetchDocument(i,n,s,o).then((function(t){if(e.destroyed)throw new Error("Loading aborted");let r;s?r=new _transport_stream.PDFDataTransportStream({length:n.length,initialData:n.initialData,progressiveDone:n.progressiveDone,disableRange:n.disableRange,disableStream:n.disableStream},s):n.data||(r=createPDFNetworkStream({url:n.url,length:n.length,httpHeaders:n.httpHeaders,withCredentials:n.withCredentials,rangeChunkSize:n.rangeChunkSize,disableRange:n.disableRange,disableStream:n.disableStream}));const a=new _message_handler.MessageHandler(o,t,i.port);a.postMessageTransfers=i.postMessageTransfers;const l=new WorkerTransport(a,e,r,n);e._transport=l,a.send("Ready",null)}))})).catch(e._capability.reject),e}function _fetchDocument(t,e,r,n){return t.destroyed?Promise.reject(new Error("Worker was destroyed")):(r&&(e.length=r.length,e.initialData=r.initialData,e.progressiveDone=r.progressiveDone),t.messageHandler.sendWithPromise("GetDocRequest",{docId:n,apiVersion:"2.4.456",source:{data:e.data,url:e.url,password:e.password,disableAutoFetch:e.disableAutoFetch,rangeChunkSize:e.rangeChunkSize,length:e.length},maxImageSize:e.maxImageSize,disableFontFace:e.disableFontFace,disableCreateObjectURL:e.disableCreateObjectURL,postMessageTransfers:t.postMessageTransfers,docBaseUrl:e.docBaseUrl,nativeImageDecoderSupport:e.nativeImageDecoderSupport,ignoreErrors:e.ignoreErrors,isEvalSupported:e.isEvalSupported}).then((function(e){if(t.destroyed)throw new Error("Worker was destroyed");return e})))}const PDFDocumentLoadingTask=function(){let t=0;return class{constructor(){this._capability=(0,_util.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId="d"+t++,this.destroyed=!1,this.onPassword=null,this.onProgress=null,this.onUnsupportedFeature=null}get promise(){return this._capability.promise}destroy(){return this.destroyed=!0,(this._transport?this._transport.destroy():Promise.resolve()).then(()=>{this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)})}then(t,e){throw new Error("Removed API method: PDFDocumentLoadingTask.then, use the `promise` getter instead.")}}}();class PDFDataRangeTransport{constructor(t,e,r=!1){this.length=t,this.initialData=e,this.progressiveDone=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const r of this._rangeListeners)r(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(const r of this._progressListeners)r(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(t,e){this._pdfInfo=t,this._transport=e}get numPages(){return this._pdfInfo.numPages}get fingerprint(){return this._pdfInfo.fingerprint}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getOpenActionDestination(){return(0,_display_utils.deprecated)("getOpenActionDestination, use getOpenAction instead."),this.getOpenAction().then((function(t){return t&&t.dest?t.dest:null}))}getAttachments(){return this._transport.getAttachments()}getJavaScript(){return this._transport.getJavaScript()}getOutline(){return this._transport.getOutline()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getData(){return this._transport.getData()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getStats(){return this._transport.getStats()}cleanup(){return this._transport.startCleanup()}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(t,e,r,n=!1){this._pageIndex=t,this._pageInfo=e,this._transport=r,this._stats=n?new _display_utils.StatTimer:null,this._pdfBug=n,this.commonObjs=r.commonObjs,this.objs=new PDFObjects,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this.intentStates=Object.create(null),this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:r=0,offsetY:n=0,dontFlip:s=!1}={}){if(arguments.length>1||"number"==typeof arguments[0])throw new Error("PDFPageProxy.getViewport is called with obsolete arguments.");return new _display_utils.PageViewport({viewBox:this.view,scale:t,rotation:e,offsetX:r,offsetY:n,dontFlip:s})}getAnnotations({intent:t=null}={}){return this.annotationsPromise&&this.annotationsIntent===t||(this.annotationsPromise=this._transport.getAnnotations(this._pageIndex,t),this.annotationsIntent=t),this.annotationsPromise}render({canvasContext:t,viewport:e,intent:r="display",enableWebGL:n=!1,renderInteractiveForms:s=!1,transform:i=null,imageLayer:a=null,canvasFactory:o=null,background:l=null}){this._stats&&this._stats.time("Overall");const c="print"===r?"print":"display";this.pendingCleanup=!1,this.intentStates[c]||(this.intentStates[c]=Object.create(null));const h=this.intentStates[c];h.streamReaderCancelTimeout&&(clearTimeout(h.streamReaderCancelTimeout),h.streamReaderCancelTimeout=null);const d=o||new _display_utils.DOMCanvasFactory,u=new _webgl.WebGLContext({enable:n});h.displayReadyCapability||(h.displayReadyCapability=(0,_util.createPromiseCapability)(),h.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList({pageIndex:this._pageIndex,intent:c,renderInteractiveForms:!0===s}));const p=t=>{const e=h.renderTasks.indexOf(f);e>=0&&h.renderTasks.splice(e,1),(this.cleanupAfterRender||"print"===c)&&(this.pendingCleanup=!0),this._tryCleanup(),t?(f.capability.reject(t),this._abortOperatorList({intentState:h,reason:t})):f.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},f=new InternalRenderTask({callback:p,params:{canvasContext:t,viewport:e,transform:i,imageLayer:a,background:l},objs:this.objs,commonObjs:this.commonObjs,operatorList:h.operatorList,pageIndex:this._pageIndex,canvasFactory:d,webGLContext:u,useRequestAnimationFrame:"print"!==c,pdfBug:this._pdfBug});h.renderTasks||(h.renderTasks=[]),h.renderTasks.push(f);const g=f.task;return h.displayReadyCapability.promise.then(t=>{this.pendingCleanup?p():(this._stats&&this._stats.time("Rendering"),f.initializeGraphics(t),f.operatorListChanged())}).catch(p),g}getOperatorList(){this.intentStates.oplist||(this.intentStates.oplist=Object.create(null));const t=this.intentStates.oplist;let e;return t.opListReadCapability||(e={},e.operatorListChanged=function(){if(t.operatorList.lastChunk){t.opListReadCapability.resolve(t.operatorList);const r=t.renderTasks.indexOf(e);r>=0&&t.renderTasks.splice(r,1)}},t.opListReadCapability=(0,_util.createPromiseCapability)(),t.renderTasks=[],t.renderTasks.push(e),t.operatorList={fnArray:[],argsArray:[],lastChunk:!1},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList({pageIndex:this._pageIndex,intent:"oplist"})),t.opListReadCapability.promise}streamTextContent({normalizeWhitespace:t=!1,disableCombineTextItems:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,normalizeWhitespace:!0===t,combineTextItems:!0!==e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(t={}){const e=this.streamTextContent(t);return new Promise((function(t,r){const n=e.getReader(),s={items:[],styles:Object.create(null)};!function e(){n.read().then((function({value:r,done:n}){n?t(s):(Object.assign(s.styles,r.styles),s.items.push(...r.items),e())}),r)}()}))}_destroy(){this.destroyed=!0,this._transport.pageCache[this._pageIndex]=null;const t=[];return Object.keys(this.intentStates).forEach(e=>{const r=this.intentStates[e];this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),"oplist"!==e&&r.renderTasks.forEach((function(e){const r=e.capability.promise.catch((function(){}));t.push(r),e.cancel()}))}),this.objs.clear(),this.annotationsPromise=null,this.pendingCleanup=!1,Promise.all(t)}cleanup(t=!1){return this.pendingCleanup=!0,this._tryCleanup(t)}_tryCleanup(t=!1){return!(!this.pendingCleanup||Object.keys(this.intentStates).some(t=>{const e=this.intentStates[t];return 0!==e.renderTasks.length||!e.operatorList.lastChunk})||(Object.keys(this.intentStates).forEach(t=>{delete this.intentStates[t]}),this.objs.clear(),this.annotationsPromise=null,t&&this._stats&&(this._stats=new _display_utils.StatTimer),this.pendingCleanup=!1,0))}_startRenderPage(t,e){const r=this.intentStates[e];r&&(this._stats&&this._stats.timeEnd("Page Request"),r.displayReadyCapability&&r.displayReadyCapability.resolve(t))}_renderPageChunk(t,e){for(let r=0,n=t.length;r<n;r++)e.operatorList.fnArray.push(t.fnArray[r]),e.operatorList.argsArray.push(t.argsArray[r]);e.operatorList.lastChunk=t.lastChunk;for(let t=0;t<e.renderTasks.length;t++)e.renderTasks[t].operatorListChanged();t.lastChunk&&this._tryCleanup()}_pumpOperatorList(t){(0,_util.assert)(t.intent,'PDFPageProxy._pumpOperatorList: Expected "intent" argument.');const e=this._transport.messageHandler.sendWithStream("GetOperatorList",t).getReader(),r=this.intentStates[t.intent];r.streamReader=e;const n=()=>{e.read().then(({value:t,done:e})=>{e?r.streamReader=null:this._transport.destroyed||(this._renderPageChunk(t,r),n())},t=>{if(r.streamReader=null,!this._transport.destroyed){if(r.operatorList){r.operatorList.lastChunk=!0;for(let t=0;t<r.renderTasks.length;t++)r.renderTasks[t].operatorListChanged();this._tryCleanup()}if(r.displayReadyCapability)r.displayReadyCapability.reject(t);else{if(!r.opListReadCapability)throw t;r.opListReadCapability.reject(t)}}})};n()}_abortOperatorList({intentState:t,reason:e,force:r=!1}){if((0,_util.assert)(e instanceof Error||"object"==typeof e&&null!==e,'PDFPageProxy._abortOperatorList: Expected "reason" argument.'),t.streamReader){if(!r){if(0!==t.renderTasks.length)return;if(e instanceof _display_utils.RenderingCancelledException)return void(t.streamReaderCancelTimeout=setTimeout(()=>{this._abortOperatorList({intentState:t,reason:e,force:!0}),t.streamReaderCancelTimeout=null},RENDERING_CANCELLED_TIMEOUT))}t.streamReader.cancel(new _util.AbortException(e&&e.message)),t.streamReader=null,this._transport.destroyed||(Object.keys(this.intentStates).some(e=>this.intentStates[e]===t&&(delete this.intentStates[e],!0)),this.cleanup())}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(t=!0){this._listeners=[],this._defer=t,this._deferred=Promise.resolve(void 0)}postMessage(t,e){if(!this._defer)return void this._listeners.forEach(e=>{e.call(this,{data:t})});const r=new WeakMap,n={data:function t(n){if("object"!=typeof n||null===n)return n;if(r.has(n))return r.get(n);let s,i;if((s=n.buffer)&&(0,_util.isArrayBuffer)(s))return i=e&&e.includes(s)?new n.constructor(s,n.byteOffset,n.byteLength):new n.constructor(n),r.set(n,i),i;i=Array.isArray(n)?[]:{},r.set(n,i);for(const e in n){let r,s=n;for(;!(r=Object.getOwnPropertyDescriptor(s,e));)s=Object.getPrototypeOf(s);if(void 0!==r.value)if("function"!=typeof r.value)i[e]=t(r.value);else if(n.hasOwnProperty&&n.hasOwnProperty(e))throw new Error("LoopbackPort.postMessage - cannot clone: "+n[e])}return i}(t)};this._deferred.then(()=>{this._listeners.forEach(t=>{t.call(this,n)})})}addEventListener(t,e){this._listeners.push(e)}removeEventListener(t,e){const r=this._listeners.indexOf(e);this._listeners.splice(r,1)}terminate(){this._listeners.length=0}}exports.LoopbackPort=LoopbackPort;const PDFWorker=function PDFWorkerClosure(){const pdfWorkerPorts=new WeakMap;let isWorkerDisabled=!1,fallbackWorkerSrc,nextFakeWorkerId=0,fakeWorkerCapability;if(_is_node.isNodeJS)isWorkerDisabled=!0,fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document&&"currentScript"in document){const t=document.currentScript&&document.currentScript.src;t&&(fallbackWorkerSrc=t.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}function getWorkerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(void 0!==fallbackWorkerSrc)return _is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}function getMainThreadWorkerMessageHandler(){let t;try{t=globalThis.pdfjsWorker&&globalThis.pdfjsWorker.WorkerMessageHandler}catch(t){}return t||null}function setupFakeWorkerGlobal(){if(fakeWorkerCapability)return fakeWorkerCapability.promise;fakeWorkerCapability=(0,_util.createPromiseCapability)();const loader=async function(){const mainWorkerMessageHandler=getMainThreadWorkerMessageHandler();if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS){const worker=eval("require")(getWorkerSrc());return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(getWorkerSrc()),window.pdfjsWorker.WorkerMessageHandler};return loader().then(fakeWorkerCapability.resolve,fakeWorkerCapability.reject),fakeWorkerCapability.promise}function createCDNWrapper(t){const e="importScripts('"+t+"');";return URL.createObjectURL(new Blob([e]))}class PDFWorker{constructor({name:t=null,port:e=null,verbosity:r=(0,_util.getVerbosityLevel)()}={}){if(e&&pdfWorkerPorts.has(e))throw new Error("Cannot use more than one PDFWorker per port");if(this.name=t,this.destroyed=!1,this.postMessageTransfers=!0,this.verbosity=r,this._readyCapability=(0,_util.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,e)return pdfWorkerPorts.set(e,this),void this._initializeFromPort(e);this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new _message_handler.MessageHandler("main","worker",t),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve()}_initialize(){if("undefined"!=typeof Worker&&!isWorkerDisabled&&!getMainThreadWorkerMessageHandler()){let t=getWorkerSrc();try{(0,_util.isSameOrigin)(window.location.href,t)||(t=createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t),r=new _message_handler.MessageHandler("main","worker",e),n=()=>{e.removeEventListener("error",s),r.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},s=()=>{this._webWorker||n()};e.addEventListener("error",s),r.on("test",t=>{e.removeEventListener("error",s),this.destroyed?n():t?(this._messageHandler=r,this._port=e,this._webWorker=e,t.supportTransfers||(this.postMessageTransfers=!1),this._readyCapability.resolve(),r.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),r.destroy(),e.terminate())}),r.on("ready",t=>{if(e.removeEventListener("error",s),this.destroyed)n();else try{i()}catch(t){this._setupFakeWorker()}});const i=()=>{const t=new Uint8Array([this.postMessageTransfers?255:0]);try{r.send("test",t,[t.buffer])}catch(e){(0,_util.warn)("Cannot use postMessage transfers."),t[0]=0,r.send("test",t)}};return void i()}catch(t){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),isWorkerDisabled=!0),setupFakeWorkerGlobal().then(t=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const e=new LoopbackPort;this._port=e;const r="fake"+nextFakeWorkerId++,n=new _message_handler.MessageHandler(r+"_worker",r,e);t.setup(n,e);const s=new _message_handler.MessageHandler(r,r+"_worker",e);this._messageHandler=s,this._readyCapability.resolve(),s.send("configure",{verbosity:this.verbosity})}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),pdfWorkerPorts.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return pdfWorkerPorts.has(t.port)?pdfWorkerPorts.get(t.port):new PDFWorker(t)}static getWorkerSrc(){return getWorkerSrc()}}return PDFWorker}();exports.PDFWorker=PDFWorker;class WorkerTransport{constructor(t,e,r,n){this.messageHandler=t,this.loadingTask=e,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({docId:e.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this)}),this._params=n,this.CMapReaderFactory=new n.CMapReaderFactory({baseUrl:n.cMapUrl,isCompressed:n.cMapPacked}),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.pageCache=[],this.pagePromises=[],this.downloadInfoCapability=(0,_util.createPromiseCapability)(),this.setupMessageHandler()}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,_util.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];this.pageCache.forEach((function(e){e&&t.push(e._destroy())})),this.pageCache.length=0,this.pagePromises.length=0;const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.fontLoader.clear(),this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{(0,_util.assert)(this._networkStream),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then((function({value:t,done:r}){r?e.close():((0,_util.assert)((0,_util.isArrayBuffer)(t)),e.enqueue(new Uint8Array(t),1,[t]))})).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t)}}),t.on("ReaderHeadersReady",t=>{const r=(0,_util.createPromiseCapability)(),n=this._fullReader;return n.headersReady.then(()=>{n.isStreamingSupported&&n.isRangeSupported||(this._lastProgress&&e.onProgress&&e.onProgress(this._lastProgress),n.onProgress=t=>{e.onProgress&&e.onProgress({loaded:t.loaded,total:t.total})}),r.resolve({isStreamingSupported:n.isStreamingSupported,isRangeSupported:n.isRangeSupported,contentLength:n.contentLength})},r.reject),r.promise}),t.on("GetRangeReader",(t,e)=>{(0,_util.assert)(this._networkStream);const r=this._networkStream.getRangeReader(t.begin,t.end);r?(e.onPull=()=>{r.read().then((function({value:t,done:r}){r?e.close():((0,_util.assert)((0,_util.isArrayBuffer)(t)),e.enqueue(new Uint8Array(t),1,[t]))})).catch(t=>{e.error(t)})},e.onCancel=t=>{r.cancel(t)}):e.close()}),t.on("GetDoc",({pdfInfo:t})=>{this._numPages=t.numPages,e._capability.resolve(new PDFDocumentProxy(t,this))}),t.on("DocException",(function(t){let r;switch(t.name){case"PasswordException":r=new _util.PasswordException(t.message,t.code);break;case"InvalidPDFException":r=new _util.InvalidPDFException(t.message);break;case"MissingPDFException":r=new _util.MissingPDFException(t.message);break;case"UnexpectedResponseException":r=new _util.UnexpectedResponseException(t.message,t.status);break;case"UnknownErrorException":r=new _util.UnknownErrorException(t.message,t.details)}e._capability.reject(r)})),t.on("PasswordRequest",t=>{if(this._passwordCapability=(0,_util.createPromiseCapability)(),e.onPassword){const r=t=>{this._passwordCapability.resolve({password:t})};try{e.onPassword(r,t.code)}catch(t){this._passwordCapability.reject(t)}}else this._passwordCapability.reject(new _util.PasswordException(t.message,t.code));return this._passwordCapability.promise}),t.on("DataLoaded",t=>{e.onProgress&&e.onProgress({loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{this.destroyed||this.pageCache[t.pageIndex]._startRenderPage(t.transparency,t.intent)}),t.on("commonobj",e=>{if(this.destroyed)return;const[r,n,s]=e;if(!this.commonObjs.has(r))switch(n){case"Font":const e=this._params;if("error"in s){const t=s.error;(0,_util.warn)("Error during font loading: "+t),this.commonObjs.resolve(r,t);break}let i=null;e.pdfBug&&globalThis.FontInspector&&globalThis.FontInspector.enabled&&(i={registerFont(t,e){globalThis.FontInspector.fontAdded(t,e)}});const a=new _font_loader.FontFaceObject(s,{isEvalSupported:e.isEvalSupported,disableFontFace:e.disableFontFace,ignoreErrors:e.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:i});this.fontLoader.bind(a).then(()=>{this.commonObjs.resolve(r,a)},e=>{t.sendWithPromise("FontFallback",{id:r}).finally(()=>{this.commonObjs.resolve(r,a)})});break;case"FontPath":case"FontType3Res":this.commonObjs.resolve(r,s);break;default:throw new Error("Got unknown common object type "+n)}}),t.on("obj",t=>{if(this.destroyed)return;const[e,r,n,s]=t,i=this.pageCache[r];if(!i.objs.has(e))switch(n){case"JpegStream":return new Promise((t,e)=>{const r=new Image;r.onload=function(){t(r)},r.onerror=function(){e(new Error("Error during JPEG image loading")),(0,_display_utils.releaseImageResources)(r)},r.src=s}).then(t=>{i.objs.resolve(e,t)});case"Image":i.objs.resolve(e,s);const t=8e6;s&&"data"in s&&s.data.length>t&&(i.cleanupAfterRender=!0);break;default:throw new Error("Got unknown object type "+n)}}),t.on("DocProgress",t=>{this.destroyed||e.onProgress&&e.onProgress({loaded:t.loaded,total:t.total})}),t.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this)),t.on("JpegDecode",t=>{if(this.destroyed)return Promise.reject(new Error("Worker was destroyed"));if("undefined"==typeof document)return Promise.reject(new Error('"document" is not defined.'));const[e,r]=t;return 3!==r&&1!==r?Promise.reject(new Error("Only 3 components or 1 component can be returned")):new Promise((function(t,n){const s=new Image;s.onload=function(){const{width:e,height:n}=s,i=e*n,a=4*i,o=new Uint8ClampedArray(i*r);let l=document.createElement("canvas");l.width=e,l.height=n;let c=l.getContext("2d");c.drawImage(s,0,0);const h=c.getImageData(0,0,e,n).data;if(3===r)for(let t=0,e=0;t<a;t+=4,e+=3)o[e]=h[t],o[e+1]=h[t+1],o[e+2]=h[t+2];else if(1===r)for(let t=0,e=0;t<a;t+=4,e++)o[e]=h[t];t({data:o,width:e,height:n}),(0,_display_utils.releaseImageResources)(s),l.width=0,l.height=0,l=null,c=null},s.onerror=function(){n(new Error("JpegDecode failed to load image")),(0,_display_utils.releaseImageResources)(s)},s.src=e}))}),t.on("FetchBuiltInCMap",(t,e)=>{if(this.destroyed)return void e.error(new Error("Worker was destroyed"));let r=!1;e.onPull=()=>{r?e.close():(r=!0,this.CMapReaderFactory.fetch(t).then((function(t){e.enqueue(t,1,[t.cMapData.buffer])})).catch((function(t){e.error(t)})))}})}_onUnsupportedFeature({featureId:t}){this.destroyed||this.loadingTask.onUnsupportedFeature&&this.loadingTask.onUnsupportedFeature(t)}getData(){return this.messageHandler.sendWithPromise("GetData",null)}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request"));const e=t-1;if(e in this.pagePromises)return this.pagePromises[e];const r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(t=>{if(this.destroyed)throw new Error("Transport destroyed");const r=new PDFPageProxy(e,t,this,this._params.pdfBug);return this.pageCache[e]=r,r});return this.pagePromises[e]=r,r}getPageIndex(t){return this.messageHandler.sendWithPromise("GetPageIndex",{ref:t}).catch((function(t){return Promise.reject(new Error(t))}))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return this.messageHandler.sendWithPromise("GetMetadata",null).then(t=>({info:t[0],metadata:t[1]?new _metadata.Metadata(t[1]):null,contentDispositionFilename:this._fullReader?this._fullReader.filename:null}))}getStats(){return this.messageHandler.sendWithPromise("GetStats",null)}startCleanup(){return this.messageHandler.sendWithPromise("Cleanup",null).then(()=>{for(let t=0,e=this.pageCache.length;t<e;t++){const e=this.pageCache[t];if(e&&!e.cleanup())throw new Error(`startCleanup: Page ${t+1} is currently rendering.`)}this.commonObjs.clear(),this.fontLoader.clear()})}get loadingParams(){const t=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:t.disableAutoFetch,disableCreateObjectURL:t.disableCreateObjectURL,disableFontFace:t.disableFontFace,nativeImageDecoderSupport:t.nativeImageDecoderSupport})}}class PDFObjects{constructor(){this._objs=Object.create(null)}_ensureObj(t){return this._objs[t]?this._objs[t]:this._objs[t]={capability:(0,_util.createPromiseCapability)(),data:null,resolved:!1}}get(t,e=null){if(e)return this._ensureObj(t).capability.promise.then(e),null;const r=this._objs[t];if(!r||!r.resolved)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return r.data}has(t){const e=this._objs[t];return!!e&&e.resolved}resolve(t,e){const r=this._ensureObj(t);r.resolved=!0,r.data=e,r.capability.resolve(e)}clear(){for(const t in this._objs){const{data:e}=this._objs[t];"undefined"!=typeof Image&&e instanceof Image&&(0,_display_utils.releaseImageResources)(e)}this._objs=Object.create(null)}}class RenderTask{constructor(t){this._internalRenderTask=t,this.onContinue=null}get promise(){return this._internalRenderTask.capability.promise}cancel(){this._internalRenderTask.cancel()}then(t,e){throw new Error("Removed API method: RenderTask.then, use the `promise` getter instead.")}}const InternalRenderTask=function(){const t=new WeakSet;return class{constructor({callback:t,params:e,objs:r,commonObjs:n,operatorList:s,pageIndex:i,canvasFactory:a,webGLContext:o,useRequestAnimationFrame:l=!1,pdfBug:c=!1}){this.callback=t,this.params=e,this.objs=r,this.commonObjs=n,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=i,this.canvasFactory=a,this.webGLContext=o,this._pdfBug=c,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===l&&"undefined"!=typeof window,this.cancelled=!1,this.capability=(0,_util.createPromiseCapability)(),this.task=new RenderTask(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}initializeGraphics(e=!1){if(this.cancelled)return;if(this._canvas){if(t.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager&&globalThis.StepperManager.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:r,viewport:n,transform:s,imageLayer:i,background:a}=this.params;this.gfx=new _canvas.CanvasGraphics(r,this.commonObjs,this.objs,this.canvasFactory,this.webGLContext,i),this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(e=null){this.running=!1,this.cancelled=!0,this.gfx&&this.gfx.endDrawing(),this._canvas&&t.delete(this._canvas),this.callback(e||new _display_utils.RenderingCancelledException("Rendering cancelled, page "+(this._pageIndex+1),"canvas"))}operatorListChanged(){this.graphicsReady?(this.stepper&&this.stepper.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this.cancel.bind(this))}):Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this))}async _next(){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._canvas&&t.delete(this._canvas),this.callback())))}}}(),version="2.4.456";exports.version=version;const build="228a591c";exports.build=build},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.addLinkAttributes=function(t,{url:e,target:r,rel:s,enabled:i=!0}={}){(0,n.assert)(e&&"string"==typeof e,'addLinkAttributes: A valid "url" parameter must provided.');const a=(0,n.removeNullCharacters)(e);i?t.href=t.title=a:(t.href="",t.title="Disabled: "+a,t.onclick=()=>!1);let l="";switch(r){case o.NONE:break;case o.SELF:l="_self";break;case o.BLANK:l="_blank";break;case o.PARENT:l="_parent";break;case o.TOP:l="_top"}t.target=l,t.rel="string"==typeof s?s:"noopener noreferrer nofollow"},e.getFilenameFromUrl=function(t){const e=t.indexOf("#"),r=t.indexOf("?"),n=Math.min(e>0?e:t.length,r>0?r:t.length);return t.substring(t.lastIndexOf("/",n)+1,n)},e.isFetchSupported=l,e.isValidFetchUrl=c,e.loadScript=function(t){return new Promise((e,r)=>{const n=document.createElement("script");n.src=t,n.onload=e,n.onerror=function(){r(new Error("Cannot load script at: "+n.src))},(document.head||document.documentElement).appendChild(n)})},e.deprecated=function(t){console.log("Deprecated API usage: "+t)},e.releaseImageResources=function(t){(0,n.assert)(t instanceof Image,"Invalid `img` parameter.");const e=t.src;"string"==typeof e&&e.startsWith("blob:")&&URL.revokeObjectURL&&URL.revokeObjectURL(e),t.removeAttribute("src")},e.PDFDateString=e.StatTimer=e.DOMSVGFactory=e.DOMCMapReaderFactory=e.DOMCanvasFactory=e.DEFAULT_LINK_REL=e.LinkTarget=e.RenderingCancelledException=e.PageViewport=void 0;var n=r(1);e.DEFAULT_LINK_REL="noopener noreferrer nofollow";const s="http://www.w3.org/2000/svg";e.DOMCanvasFactory=class{create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const r=document.createElement("canvas"),n=r.getContext("2d");return r.width=t,r.height=e,{canvas:r,context:n}}reset(t,e,r){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||r<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=r}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}},e.DOMCMapReaderFactory=class{constructor({baseUrl:t=null,isCompressed:e=!1}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":""),r=this.isCompressed?n.CMapCompressionType.BINARY:n.CMapCompressionType.NONE;return l()&&c(e,document.baseURI)?fetch(e).then(async t=>{if(!t.ok)throw new Error(t.statusText);let e;return e=this.isCompressed?new Uint8Array(await t.arrayBuffer()):(0,n.stringToBytes)(await t.text()),{cMapData:e,compressionType:r}}).catch(t=>{throw new Error("Unable to load "+(this.isCompressed?"binary ":"")+"CMap at: "+e)}):new Promise((t,s)=>{const i=new XMLHttpRequest;i.open("GET",e,!0),this.isCompressed&&(i.responseType="arraybuffer"),i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(200===i.status||0===i.status){let e;if(this.isCompressed&&i.response?e=new Uint8Array(i.response):!this.isCompressed&&i.responseText&&(e=(0,n.stringToBytes)(i.responseText)),e)return void t({cMapData:e,compressionType:r})}s(new Error(i.statusText))}},i.send(null)}).catch(t=>{throw new Error("Unable to load "+(this.isCompressed?"binary ":"")+"CMap at: "+e)})}},e.DOMSVGFactory=class{create(t,e){(0,n.assert)(t>0&&e>0,"Invalid SVG dimensions");const r=document.createElementNS(s,"svg:svg");return r.setAttribute("version","1.1"),r.setAttribute("width",t+"px"),r.setAttribute("height",e+"px"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox","0 0 "+t+" "+e),r}createElement(t){return(0,n.assert)("string"==typeof t,"Invalid SVG element type"),document.createElementNS(s,t)}};class i{constructor({viewBox:t,scale:e,rotation:r,offsetX:n=0,offsetY:s=0,dontFlip:i=!1}){this.viewBox=t,this.scale=e,this.rotation=r,this.offsetX=n,this.offsetY=s;const a=(t[2]+t[0])/2,o=(t[3]+t[1])/2;let l,c,h,d,u,p,f,g;switch(r=(r%=360)<0?r+360:r){case 180:l=-1,c=0,h=0,d=1;break;case 90:l=0,c=1,h=1,d=0;break;case 270:l=0,c=-1,h=-1,d=0;break;default:l=1,c=0,h=0,d=-1}i&&(h=-h,d=-d),0===l?(u=Math.abs(o-t[1])*e+n,p=Math.abs(a-t[0])*e+s,f=Math.abs(t[3]-t[1])*e,g=Math.abs(t[2]-t[0])*e):(u=Math.abs(a-t[0])*e+n,p=Math.abs(o-t[1])*e+s,f=Math.abs(t[2]-t[0])*e,g=Math.abs(t[3]-t[1])*e),this.transform=[l*e,c*e,h*e,d*e,u-l*e*a-h*e*o,p-c*e*a-d*e*o],this.width=f,this.height=g}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:r=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new i({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:r,offsetY:n,dontFlip:s})}convertToViewportPoint(t,e){return n.Util.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=n.Util.applyTransform([t[0],t[1]],this.transform),r=n.Util.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],r[0],r[1]]}convertToPdfPoint(t,e){return n.Util.applyInverseTransform([t,e],this.transform)}}e.PageViewport=i;class a extends n.BaseException{constructor(t,e){super(t),this.type=e}}e.RenderingCancelledException=a;const o={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};function l(){return"undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&"undefined"!=typeof ReadableStream}function c(t,e){try{const{protocol:r}=e?new URL(t,e):new URL(t);return"http:"===r||"https:"===r}catch(t){return!1}}let h;e.LinkTarget=o,e.StatTimer=class{constructor(){this.started=Object.create(null),this.times=[]}time(t){t in this.started&&(0,n.warn)("Timer is already running for "+t),this.started[t]=Date.now()}timeEnd(t){t in this.started||(0,n.warn)("Timer has not been started for "+t),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const t of this.times){const r=t.name;r.length>e&&(e=r.length)}for(const r of this.times){const n=r.end-r.start;t.push(`${r.name.padEnd(e)} ${n}ms\n`)}return t.join("")}},e.PDFDateString=class{static toDateObject(t){if(!t||!(0,n.isString)(t))return null;h||(h=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=h.exec(t);if(!e)return null;const r=parseInt(e[1],10);let s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let i=parseInt(e[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const c=e[7]||"Z";let d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===c?(a+=d,o+=u):"+"===c&&(a-=d,o-=u),new Date(Date.UTC(r,s,i,a,o,l))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FontLoader=e.FontFaceObject=void 0;var n=r(1);class s{constructor({docId:t,onUnsupportedFeature:e}){this.constructor===s&&(0,n.unreachable)("Cannot initialize BaseFontLoader."),this.docId=t,this._onUnsupportedFeature=e,this.nativeFontFaces=[],this.styleElement=null}addNativeFontFace(t){this.nativeFontFaces.push(t),document.fonts.add(t)}insertRule(t){let e=this.styleElement;e||(e=this.styleElement=document.createElement("style"),e.id="PDFJS_FONT_STYLE_TAG_"+this.docId,document.documentElement.getElementsByTagName("head")[0].appendChild(e));const r=e.sheet;r.insertRule(t,r.cssRules.length)}clear(){this.nativeFontFaces.forEach((function(t){document.fonts.delete(t)})),this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async bind(t){if(t.attached||t.missingFile)return;if(t.attached=!0,this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(r){throw this._onUnsupportedFeature({featureId:n.UNSUPPORTED_FEATURES.font}),(0,n.warn)(`Failed to load font '${e.family}': '${r}'.`),t.disableFontFace=!0,r}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(r=>{const n=this._queueLoadingCallback(r);this._prepareFontLoadEvent([e],[t],n)})}}_queueLoadingCallback(t){(0,n.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){const t="undefined"!=typeof document&&!!document.fonts;return(0,n.shadow)(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){(0,n.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,n.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(t,e,r){(0,n.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let i;e.FontLoader=i,e.FontLoader=i=class extends s{constructor(t){super(t),this.loadingContext={requests:[],nextRequestId:0},this.loadTestFontId=0}get isSyncFontLoadingSupported(){let t=!1;if("undefined"==typeof navigator)t=!0;else{const e=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);e&&e[1]>=14&&(t=!0)}return(0,n.shadow)(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){const e=this.loadingContext,r={id:"pdfjs-font-loading-"+e.nextRequestId++,done:!1,complete:function(){for((0,n.assert)(!r.done,"completeRequest() cannot be called twice."),r.done=!0;e.requests.length>0&&e.requests[0].done;){const t=e.requests.shift();setTimeout(t.callback,0)}},callback:t};return e.requests.push(r),r}get _loadTestFont(){return(0,n.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e,r){function s(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function i(t,e,r,n){return t.substring(0,e)+n+t.substring(e+r)}let a,o;const l=document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let h=0;const d=`lt${Date.now()}${this.loadTestFontId++}`;let u=this._loadTestFont;u=i(u,976,d.length,d);let p=s(u,16);for(a=0,o=d.length-3;a<o;a+=4)p=p-1482184792+s(d,a)|0;a<d.length&&(p=p-1482184792+s(d+"XXX",a)|0),u=i(u,16,4,(0,n.string32)(p));const f=`@font-face {font-family:"${d}";src:url(data:font/opentype;base64,${btoa(u)});}`;this.insertRule(f);const g=[];for(a=0,o=e.length;a<o;a++)g.push(e[a].loadedName);g.push(d);const m=document.createElement("div");for(m.style.visibility="hidden",m.style.width=m.style.height="10px",m.style.position="absolute",m.style.top=m.style.left="0px",a=0,o=g.length;a<o;++a){const t=document.createElement("span");t.textContent="Hi",t.style.fontFamily=g[a],m.appendChild(t)}document.body.appendChild(m),function t(e,r){if(h++,h>30)return(0,n.warn)("Load test font never loaded."),void r();c.font="30px "+e,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0?r():setTimeout(t.bind(null,e,r))}(d,(function(){document.body.removeChild(m),r.complete()}))}},e.FontFaceObject=class{constructor(t,{isEvalSupported:e=!0,disableFontFace:r=!1,ignoreErrors:n=!1,onUnsupportedFeature:s=null,fontRegistry:i=null}){this.compiledGlyphs=Object.create(null);for(const e in t)this[e]=t[e];this.isEvalSupported=!1!==e,this.disableFontFace=!0===r,this.ignoreErrors=!0===n,this._onUnsupportedFeature=s,this.fontRegistry=i}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;const t=new FontFace(this.loadedName,this.data,{});return this.fontRegistry&&this.fontRegistry.registerFont(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=(0,n.bytesToString)(new Uint8Array(this.data)),e=`url(data:${this.mimetype};base64,${btoa(t)});`,r=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this.fontRegistry&&this.fontRegistry.registerFont(this,e),r}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let r,s;try{r=t.get(this.loadedName+"_path_"+e)}catch(t){if(!this.ignoreErrors)throw t;return this._onUnsupportedFeature&&this._onUnsupportedFeature({featureId:n.UNSUPPORTED_FEATURES.font}),(0,n.warn)(`getPathGenerator - ignoring character: "${t}".`),this.compiledGlyphs[e]=function(t,e){}}if(this.isEvalSupported&&n.IsEvalSupportedCached.value){let t,n="";for(let e=0,i=r.length;e<i;e++)s=r[e],t=void 0!==s.args?s.args.join(","):"",n+="c."+s.cmd+"("+t+");\n";return this.compiledGlyphs[e]=new Function("c","size",n)}return this.compiledGlyphs[e]=function(t,e){for(let n=0,i=r.length;n<i;n++)s=r[n],"scale"===s.cmd&&(s.args=[e,-e]),t[s.cmd].apply(t,s.args)}}}},function(t,e,r){"use strict";const n=Object.create(null);{const{isNodeJS:t}=r(7),e="undefined"!=typeof navigator&&navigator.userAgent||"",s=/Trident/.test(e),i=/CriOS/.test(e);(s||i)&&(n.disableCreateObjectURL=!0),t&&(n.disableFontFace=!0,n.nativeImageDecoderSupport="none")}e.apiCompatibilityParams=Object.freeze(n)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isNodeJS=void 0;const n="object"==typeof process&&process+""=="[object process]"&&!process.versions.nw&&!process.versions.electron;e.isNodeJS=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasGraphics=void 0;var n=r(1),s=r(9);function i(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],r=t[1],n=t[2],s=t[3],i=t[4],a=t[5],o=e*s-r*n,l=r*n-e*s;return[s/o,r/l,n/l,e/o,(s*i-n*a)/l,(r*i-e*a)/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 r=this._transformMatrix;r[4]=r[0]*t+r[2]*e+r[4],r[5]=r[1]*t+r[3]*e+r[5],this._originalTranslate(t,e)},t.scale=function(t,e){var r=this._transformMatrix;r[0]=r[0]*t,r[1]=r[1]*t,r[2]=r[2]*e,r[3]=r[3]*e,this._originalScale(t,e)},t.transform=function(e,r,n,s,i,a){var o=this._transformMatrix;this._transformMatrix=[o[0]*e+o[2]*r,o[1]*e+o[3]*r,o[0]*n+o[2]*s,o[1]*n+o[3]*s,o[0]*i+o[2]*a+o[4],o[1]*i+o[3]*a+o[5]],t._originalTransform(e,r,n,s,i,a)},t.setTransform=function(e,r,n,s,i,a){this._transformMatrix=[e,r,n,s,i,a],t._originalSetTransform(e,r,n,s,i,a)},t.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),n=this._transformMatrix;this._transformMatrix=[n[0]*e+n[2]*r,n[1]*e+n[3]*r,n[0]*-r+n[2]*e,n[1]*-r+n[3]*e,n[4],n[5]],this._originalRotate(t)})}var a=function(){function t(t){this.canvasFactory=t,this.cache=Object.create(null)}return t.prototype={getCanvas:function(t,e,r,n){var s;return void 0!==this.cache[t]?(s=this.cache[t],this.canvasFactory.reset(s,e,r),s.context.setTransform(1,0,0,1,0,0)):(s=this.canvasFactory.create(e,r),this.cache[t]=s),n&&i(s.context),s},clear(){for(var t in this.cache){var e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}},t}(),o=function(){function t(){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=n.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=n.FONT_IDENTITY_MATRIX,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=n.TextRenderingMode.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.resumeSMaskCtx=null}return t.prototype={clone:function(){return Object.create(this)},setCurrentPoint:function(t,e){this.x=t,this.y=e}},t}(),l=function(){function t(t,e,r,n,s,l){this.ctx=t,this.current=new o,this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=r,this.canvasFactory=n,this.webGLContext=s,this.imageLayer=l,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.cachedCanvases=new a(this.canvasFactory),t&&i(t),this._cachedGetSinglePixelWidth=null}function e(t,e){if("undefined"!=typeof ImageData&&e instanceof ImageData)t.putImageData(e,0,0);else{var r,s,i,a,o,l=e.height,c=e.width,h=l%16,d=(l-h)/16,u=0===h?d:d+1,p=t.createImageData(c,16),f=0,g=e.data,m=p.data;if(e.kind===n.ImageKind.GRAYSCALE_1BPP){var b=g.byteLength,A=new Uint32Array(m.buffer,0,m.byteLength>>2),x=A.length,_=c+7>>3,y=4294967295,v=n.IsLittleEndianCached.value?4278190080:255;for(s=0;s<u;s++){for(a=s<d?16:h,r=0,i=0;i<a;i++){for(var w=b-f,S=0,C=w>_?c:8*w-7,k=-8&C,P=0,R=0;S<k;S+=8)R=g[f++],A[r++]=128&R?y:v,A[r++]=64&R?y:v,A[r++]=32&R?y:v,A[r++]=16&R?y:v,A[r++]=8&R?y:v,A[r++]=4&R?y:v,A[r++]=2&R?y:v,A[r++]=1&R?y:v;for(;S<C;S++)0===P&&(R=g[f++],P=128),A[r++]=R&P?y:v,P>>=1}for(;r<x;)A[r++]=0;t.putImageData(p,0,16*s)}}else if(e.kind===n.ImageKind.RGBA_32BPP){for(i=0,o=16*c*4,s=0;s<d;s++)m.set(g.subarray(f,f+o)),f+=o,t.putImageData(p,0,i),i+=16;s<u&&(o=c*h*4,m.set(g.subarray(f,f+o)),t.putImageData(p,0,i))}else{if(e.kind!==n.ImageKind.RGB_24BPP)throw new Error("bad image kind: "+e.kind);for(o=c*(a=16),s=0;s<u;s++){for(s>=d&&(o=c*(a=h)),r=0,i=o;i--;)m[r++]=g[f++],m[r++]=g[f++],m[r++]=g[f++],m[r++]=255;t.putImageData(p,0,16*s)}}}}function r(t,e){for(var r=e.height,n=e.width,s=r%16,i=(r-s)/16,a=0===s?i:i+1,o=t.createImageData(n,16),l=0,c=e.data,h=o.data,d=0;d<a;d++){for(var u=d<i?16:s,p=3,f=0;f<u;f++)for(var g=0,m=0;m<n;m++){if(!g){var b=c[l++];g=128}h[p]=b&g?0:255,p+=4,g>>=1}t.putImageData(o,0,16*d)}}function l(t,e){for(var r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"],n=0,s=r.length;n<s;n++){var i=r[n];void 0!==t[i]&&(e[i]=t[i])}void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function c(t){t.strokeStyle="#000000",t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0)}function h(t,e,r,n){for(var s=t.length,i=3;i<s;i+=4){var a=t[i];if(0===a)t[i-3]=e,t[i-2]=r,t[i-1]=n;else if(a<255){var o=255-a;t[i-3]=t[i-3]*a+e*o>>8,t[i-2]=t[i-2]*a+r*o>>8,t[i-1]=t[i-1]*a+n*o>>8}}}function d(t,e,r){for(var n=t.length,s=3;s<n;s+=4){var i=r?r[t[s]]:t[s];e[s]=e[s]*i*(1/255)|0}}function u(t,e,r){for(var n=t.length,s=3;s<n;s+=4){var i=77*t[s-3]+152*t[s-2]+28*t[s-1];e[s]=r?e[s]*r[i>>8]>>8:e[s]*i>>16}}function p(t,e,r,n){var s=e.canvas,i=e.context;t.setTransform(e.scaleX,0,0,e.scaleY,e.offsetX,e.offsetY);var a=e.backdrop||null;if(!e.transferMap&&n.isEnabled){const i=n.composeSMask({layer:r.canvas,mask:s,properties:{subtype:e.subtype,backdrop:a}});return t.setTransform(1,0,0,1,0,0),void t.drawImage(i,e.offsetX,e.offsetY)}!function(t,e,r,n,s,i,a){var o,l=!!i,c=l?i[0]:0,p=l?i[1]:0,f=l?i[2]:0;o="Luminosity"===s?u:d;for(var g=Math.min(n,Math.ceil(1048576/r)),m=0;m<n;m+=g){var b=Math.min(g,n-m),A=t.getImageData(0,m,r,b),x=e.getImageData(0,m,r,b);l&&h(A.data,c,p,f),o(A.data,x.data,a),t.putImageData(x,0,m)}}(i,r,s.width,s.height,e.subtype,a,e.transferMap),t.drawImage(s,0,0)}var f=["butt","round","square"],g=["miter","round","bevel"],m={},b={};for(var A in t.prototype={beginDrawing({transform:t,viewport:e,transparency:r=!1,background:n=null}){var s=this.ctx.canvas.width,i=this.ctx.canvas.height;if(this.ctx.save(),this.ctx.fillStyle=n||"rgb(255, 255, 255)",this.ctx.fillRect(0,0,s,i),this.ctx.restore(),r){var a=this.cachedCanvases.getCanvas("transparent",s,i,!0);this.compositeCtx=this.ctx,this.transparentCanvas=a.canvas,this.ctx=a.context,this.ctx.save(),this.ctx.transform.apply(this.ctx,this.compositeCtx.mozCurrentTransform)}this.ctx.save(),c(this.ctx),t&&this.ctx.transform.apply(this.ctx,t),this.ctx.transform.apply(this.ctx,e.transform),this.baseTransform=this.ctx.mozCurrentTransform.slice(),this.imageLayer&&this.imageLayer.beginLayout()},executeOperatorList:function(t,e,r,s){var i=t.argsArray,a=t.fnArray,o=e||0,l=i.length;if(l===o)return o;for(var c,h=l-o>10&&"function"==typeof r,d=h?Date.now()+15:0,u=0,p=this.commonObjs,f=this.objs;;){if(void 0!==s&&o===s.nextBreakPoint)return s.breakIt(o,r),o;if((c=a[o])!==n.OPS.dependency)this[c].apply(this,i[o]);else for(const t of i[o]){const e=t.startsWith("g_")?p:f;if(!e.has(t))return e.get(t,r),o}if(++o===l)return o;if(h&&++u>10){if(Date.now()>d)return r(),o;u=0}}},endDrawing:function(){null!==this.current.activeSMask&&this.endSMaskGroup(),this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null),this.cachedCanvases.clear(),this.webGLContext.clear(),this.imageLayer&&this.imageLayer.endLayout()},setLineWidth:function(t){this.current.lineWidth=t,this.ctx.lineWidth=t},setLineCap:function(t){this.ctx.lineCap=f[t]},setLineJoin:function(t){this.ctx.lineJoin=g[t]},setMiterLimit:function(t){this.ctx.miterLimit=t},setDash:function(t,e){var r=this.ctx;void 0!==r.setLineDash&&(r.setLineDash(t),r.lineDashOffset=e)},setRenderingIntent(t){},setFlatness(t){},setGState:function(t){for(var e=0,r=t.length;e<r;e++){var n=t[e],s=n[0],i=n[1];switch(s){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=n[1];break;case"ca":this.current.fillAlpha=n[1],this.ctx.globalAlpha=n[1];break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask&&(this.stateStack.length>0&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask?this.suspendSMaskGroup():this.endSMaskGroup()),this.current.activeSMask=i?this.tempSMask:null,this.current.activeSMask&&this.beginSMaskGroup(),this.tempSMask=null}}},beginSMaskGroup:function(){var t=this.current.activeSMask,e=t.canvas.width,r=t.canvas.height,n="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(n,e,r,!0),i=this.ctx,a=i.mozCurrentTransform;this.ctx.save();var o=s.context;o.scale(1/t.scaleX,1/t.scaleY),o.translate(-t.offsetX,-t.offsetY),o.transform.apply(o,a),t.startTransformInverse=o.mozCurrentTransformInverse,l(i,o),this.ctx=o,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(i),this.groupLevel++},suspendSMaskGroup:function(){var t=this.ctx;this.groupLevel--,this.ctx=this.groupStack.pop(),p(this.ctx,this.current.activeSMask,t,this.webGLContext),this.ctx.restore(),this.ctx.save(),l(t,this.ctx),this.current.resumeSMaskCtx=t;var e=n.Util.transform(this.current.activeSMask.startTransformInverse,t.mozCurrentTransform);this.ctx.transform.apply(this.ctx,e),t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,t.canvas.width,t.canvas.height),t.restore()},resumeSMaskGroup:function(){var t=this.current.resumeSMaskCtx,e=this.ctx;this.ctx=t,this.groupStack.push(e),this.groupLevel++},endSMaskGroup:function(){var t=this.ctx;this.groupLevel--,this.ctx=this.groupStack.pop(),p(this.ctx,this.current.activeSMask,t,this.webGLContext),this.ctx.restore(),l(t,this.ctx);var e=n.Util.transform(this.current.activeSMask.startTransformInverse,t.mozCurrentTransform);this.ctx.transform.apply(this.ctx,e)},save:function(){this.ctx.save();var t=this.current;this.stateStack.push(t),this.current=t.clone(),this.current.resumeSMaskCtx=null},restore:function(){this.current.resumeSMaskCtx&&this.resumeSMaskGroup(),null===this.current.activeSMask||0!==this.stateStack.length&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask||this.endSMaskGroup(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.ctx.restore(),this.pendingClip=null,this._cachedGetSinglePixelWidth=null)},transform:function(t,e,r,n,s,i){this.ctx.transform(t,e,r,n,s,i),this._cachedGetSinglePixelWidth=null},constructPath:function(t,e){for(var r=this.ctx,s=this.current,i=s.x,a=s.y,o=0,l=0,c=t.length;o<c;o++)switch(0|t[o]){case n.OPS.rectangle:i=e[l++],a=e[l++];var h=e[l++],d=e[l++];0===h&&(h=this.getSinglePixelWidth()),0===d&&(d=this.getSinglePixelWidth());var u=i+h,p=a+d;this.ctx.moveTo(i,a),this.ctx.lineTo(u,a),this.ctx.lineTo(u,p),this.ctx.lineTo(i,p),this.ctx.lineTo(i,a),this.ctx.closePath();break;case n.OPS.moveTo:i=e[l++],a=e[l++],r.moveTo(i,a);break;case n.OPS.lineTo:i=e[l++],a=e[l++],r.lineTo(i,a);break;case n.OPS.curveTo:i=e[l+4],a=e[l+5],r.bezierCurveTo(e[l],e[l+1],e[l+2],e[l+3],i,a),l+=6;break;case n.OPS.curveTo2:r.bezierCurveTo(i,a,e[l],e[l+1],e[l+2],e[l+3]),i=e[l+2],a=e[l+3],l+=4;break;case n.OPS.curveTo3:i=e[l+2],a=e[l+3],r.bezierCurveTo(e[l],e[l+1],i,a,i,a),l+=4;break;case n.OPS.closePath:r.closePath()}s.setCurrentPoint(i,a)},closePath:function(){this.ctx.closePath()},stroke:function(t){t=void 0===t||t;var e=this.ctx,r=this.current.strokeColor;if(e.globalAlpha=this.current.strokeAlpha,r&&r.hasOwnProperty("type")&&"Pattern"===r.type){e.save();const t=e.mozCurrentTransform,s=n.Util.singularValueDecompose2dScale(t)[0];e.strokeStyle=r.getPattern(e,this),e.lineWidth=Math.max(.65*this.getSinglePixelWidth(),this.current.lineWidth*s),e.stroke(),e.restore()}else e.lineWidth=Math.max(.65*this.getSinglePixelWidth(),this.current.lineWidth),e.stroke();t&&this.consumePath(),e.globalAlpha=this.current.fillAlpha},closeStroke:function(){this.closePath(),this.stroke()},fill:function(t){t=void 0===t||t;var e=this.ctx,r=this.current.fillColor,n=!1;this.current.patternFill&&(e.save(),this.baseTransform&&e.setTransform.apply(e,this.baseTransform),e.fillStyle=r.getPattern(e,this),n=!0),this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill(),n&&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=m},eoClip:function(){this.pendingClip=b},beginText:function(){this.current.textMatrix=n.IDENTITY_MATRIX,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){e.save(),e.beginPath();for(var r=0;r<t.length;r++){var n=t[r];e.setTransform.apply(e,n.transform),e.translate(n.x,n.y),n.addToPath(e,n.fontSize)}e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}else e.beginPath()},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,e){var r=this.commonObjs.get(t),s=this.current;if(!r)throw new Error("Can't find font for "+t);if(s.fontMatrix=r.fontMatrix?r.fontMatrix:n.FONT_IDENTITY_MATRIX,0!==s.fontMatrix[0]&&0!==s.fontMatrix[3]||(0,n.warn)("Invalid font matrix for font "+t),e<0?(e=-e,s.fontDirection=-1):s.fontDirection=1,this.current.font=r,this.current.fontSize=e,r.isType3Font)return;var i=r.loadedName||"sans-serif";let a="normal";r.black?a="900":r.bold&&(a="bold");var o=r.italic?"italic":"normal",l=`"${i}", ${r.fallbackName}`;let c=e;e<16?c=16:e>100&&(c=100),this.current.fontSizeScale=e/c,this.ctx.font=`${o} ${a} ${c}px ${l}`},setTextRenderingMode:function(t){this.current.textRenderingMode=t},setTextRise:function(t){this.current.textRise=t},moveText:function(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e},setLeadingMoveText:function(t,e){this.setLeading(-e),this.moveText(t,e)},setTextMatrix:function(t,e,r,n,s,i){this.current.textMatrix=[t,e,r,n,s,i],this.current.textMatrixScale=Math.sqrt(t*t+e*e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0},nextLine:function(){this.moveText(0,this.current.leading)},paintChar(t,e,r,s){var i=this.ctx,a=this.current,o=a.font,l=a.textRenderingMode,c=a.fontSize/a.fontSizeScale,h=l&n.TextRenderingMode.FILL_STROKE_MASK,d=!!(l&n.TextRenderingMode.ADD_TO_PATH_FLAG);const u=a.patternFill&&o.data;var p;(o.disableFontFace||d||u)&&(p=o.getPathGenerator(this.commonObjs,t)),o.disableFontFace||u?(i.save(),i.translate(e,r),i.beginPath(),p(i,c),s&&i.setTransform.apply(i,s),h!==n.TextRenderingMode.FILL&&h!==n.TextRenderingMode.FILL_STROKE||i.fill(),h!==n.TextRenderingMode.STROKE&&h!==n.TextRenderingMode.FILL_STROKE||i.stroke(),i.restore()):(h!==n.TextRenderingMode.FILL&&h!==n.TextRenderingMode.FILL_STROKE||i.fillText(t,e,r),h!==n.TextRenderingMode.STROKE&&h!==n.TextRenderingMode.FILL_STROKE||i.strokeText(t,e,r)),d&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:i.mozCurrentTransform,x:e,y:r,fontSize:c,addToPath:p})},get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);for(var e=t.getImageData(0,0,10,10).data,r=!1,s=3;s<e.length;s+=4)if(e[s]>0&&e[s]<255){r=!0;break}return(0,n.shadow)(this,"isFontSubpixelAAEnabled",r)},showText:function(t){var e=this.current,r=e.font;if(r.isType3Font)return this.showType3Text(t);var s=e.fontSize;if(0===s)return;var i=this.ctx,a=e.fontSizeScale,o=e.charSpacing,l=e.wordSpacing,c=e.fontDirection,h=e.textHScale*c,d=t.length,u=r.vertical,p=u?1:-1,f=r.defaultVMetrics,g=s*e.fontMatrix[0],m=e.textRenderingMode===n.TextRenderingMode.FILL&&!r.disableFontFace&&!e.patternFill;let b;if(i.save(),e.patternFill){i.save();const t=e.fillColor.getPattern(i,this);b=i.mozCurrentTransform,i.restore(),i.fillStyle=t}i.transform.apply(i,e.textMatrix),i.translate(e.x,e.y+e.textRise),c>0?i.scale(h,-1):i.scale(h,1);var A=e.lineWidth,x=e.textMatrixScale;if(0===x||0===A){var _=e.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;_!==n.TextRenderingMode.STROKE&&_!==n.TextRenderingMode.FILL_STROKE||(this._cachedGetSinglePixelWidth=null,A=.65*this.getSinglePixelWidth())}else A/=x;1!==a&&(i.scale(a,a),A/=a),i.lineWidth=A;var y,v=0;for(y=0;y<d;++y){var w=t[y];if((0,n.isNum)(w))v+=p*w*s/1e3;else{var S,C,k,P,R,E,T,L=!1,F=(w.isSpace?l:0)+o,I=w.fontChar,M=w.accent,D=w.width;if(u?(R=w.vmetric||f,E=-(E=w.vmetric?R[1]:.5*D)*g,T=R[2]*g,D=R?-R[0]:D,S=E/a,C=(v+T)/a):(S=v/a,C=0),r.remeasure&&D>0){var O=1e3*i.measureText(I).width/s*a;if(D<O&&this.isFontSubpixelAAEnabled){var N=D/O;L=!0,i.save(),i.scale(N,1),S/=N}else D!==O&&(S+=(D-O)/2e3*s/a)}(w.isInFont||r.missingFile)&&(m&&!M?i.fillText(I,S,C):(this.paintChar(I,S,C,b),M&&(k=S+M.offset.x/a,P=C-M.offset.y/a,this.paintChar(M.fontChar,k,P,b)))),v+=u?D*g-F*c:D*g+F*c,L&&i.restore()}}u?e.y-=v:e.x+=v*h,i.restore()},showType3Text:function(t){var e,r,s,i,a=this.ctx,o=this.current,l=o.font,c=o.fontSize,h=o.fontDirection,d=l.vertical?1:-1,u=o.charSpacing,p=o.wordSpacing,f=o.textHScale*h,g=o.fontMatrix||n.FONT_IDENTITY_MATRIX,m=t.length;if(o.textRenderingMode!==n.TextRenderingMode.INVISIBLE&&0!==c){for(this._cachedGetSinglePixelWidth=null,a.save(),a.transform.apply(a,o.textMatrix),a.translate(o.x,o.y),a.scale(f,h),e=0;e<m;++e)if(r=t[e],(0,n.isNum)(r))i=d*r*c/1e3,this.ctx.translate(i,0),o.x+=i*f;else{var b=(r.isSpace?p:0)+u,A=l.charProcOperatorList[r.operatorListId];A?(this.processingType3=r,this.save(),a.scale(c,c),a.transform.apply(a,g),this.executeOperatorList(A),this.restore(),s=n.Util.applyTransform([r.width,0],g)[0]*c+b,a.translate(s,0),o.x+=s*f):(0,n.warn)(`Type3 character "${r.operatorListId}" is not available.`)}a.restore(),this.processingType3=null}},setCharWidth:function(t,e){},setCharWidthAndBounds:function(t,e,r,n,s,i){this.ctx.rect(r,n,s-r,i-n),this.clip(),this.endPath()},getColorN_Pattern:function(e){var r;if("TilingPattern"===e[0]){var n=e[1],i=this.baseTransform||this.ctx.mozCurrentTransform.slice(),a={createCanvasGraphics:e=>new t(e,this.commonObjs,this.objs,this.canvasFactory,this.webGLContext)};r=new s.TilingPattern(e,n,this.ctx,a,i)}else r=(0,s.getShadingPatternFromIR)(e);return r},setStrokeColorN:function(){this.current.strokeColor=this.getColorN_Pattern(arguments)},setFillColorN:function(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0},setStrokeRGBColor:function(t,e,r){var s=n.Util.makeCssRgb(t,e,r);this.ctx.strokeStyle=s,this.current.strokeColor=s},setFillRGBColor:function(t,e,r){var s=n.Util.makeCssRgb(t,e,r);this.ctx.fillStyle=s,this.current.fillColor=s,this.current.patternFill=!1},shadingFill:function(t){var e=this.ctx;this.save();var r=(0,s.getShadingPatternFromIR)(t);e.fillStyle=r.getPattern(e,this,!0);var i=e.mozCurrentTransformInverse;if(i){var a=e.canvas,o=a.width,l=a.height,c=n.Util.applyTransform([0,0],i),h=n.Util.applyTransform([0,l],i),d=n.Util.applyTransform([o,0],i),u=n.Util.applyTransform([o,l],i),p=Math.min(c[0],h[0],d[0],u[0]),f=Math.min(c[1],h[1],d[1],u[1]),g=Math.max(c[0],h[0],d[0],u[0]),m=Math.max(c[1],h[1],d[1],u[1]);this.ctx.fillRect(p,f,g-p,m-f)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.restore()},beginInlineImage:function(){(0,n.unreachable)("Should not call beginInlineImage")},beginImageData:function(){(0,n.unreachable)("Should not call beginImageData")},paintFormXObjectBegin:function(t,e){if(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(t)&&6===t.length&&this.transform.apply(this,t),this.baseTransform=this.ctx.mozCurrentTransform,e){var r=e[2]-e[0],n=e[3]-e[1];this.ctx.rect(e[0],e[1],r,n),this.clip(),this.endPath()}},paintFormXObjectEnd:function(){this.restore(),this.baseTransform=this.baseTransformStack.pop()},beginGroup:function(t){this.save();var e=this.ctx;t.isolated||(0,n.info)("TODO: Support non-isolated groups."),t.knockout&&(0,n.warn)("Knockout groups not supported.");var r=e.mozCurrentTransform;if(t.matrix&&e.transform.apply(e,t.matrix),!t.bbox)throw new Error("Bounding box is required.");var s=n.Util.getAxialAlignedBoundingBox(t.bbox,e.mozCurrentTransform),i=[0,0,e.canvas.width,e.canvas.height];s=n.Util.intersect(s,i)||[0,0,0,0];var a=Math.floor(s[0]),o=Math.floor(s[1]),c=Math.max(Math.ceil(s[2])-a,1),h=Math.max(Math.ceil(s[3])-o,1),d=1,u=1;c>4096&&(d=c/4096,c=4096),h>4096&&(u=h/4096,h=4096);var p="groupAt"+this.groupLevel;t.smask&&(p+="_smask_"+this.smaskCounter++%2);var f=this.cachedCanvases.getCanvas(p,c,h,!0),g=f.context;g.scale(1/d,1/u),g.translate(-a,-o),g.transform.apply(g,r),t.smask?this.smaskStack.push({canvas:f.canvas,context:g,offsetX:a,offsetY:o,scaleX:d,scaleY:u,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,o),e.scale(d,u)),l(e,g),this.ctx=g,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++,this.current.activeSMask=null},endGroup:function(t){this.groupLevel--;var e=this.ctx;this.ctx=this.groupStack.pop(),void 0!==this.ctx.imageSmoothingEnabled?this.ctx.imageSmoothingEnabled=!1:this.ctx.mozImageSmoothingEnabled=!1,t.smask?this.tempSMask=this.smaskStack.pop():this.ctx.drawImage(e.canvas,0,0),this.restore()},beginAnnotations:function(){this.save(),this.baseTransform&&this.ctx.setTransform.apply(this.ctx,this.baseTransform)},endAnnotations:function(){this.restore()},beginAnnotation:function(t,e,r){if(this.save(),c(this.ctx),this.current=new o,Array.isArray(t)&&4===t.length){var n=t[2]-t[0],s=t[3]-t[1];this.ctx.rect(t[0],t[1],n,s),this.clip(),this.endPath()}this.transform.apply(this,e),this.transform.apply(this,r)},endAnnotation:function(){this.restore()},paintJpegXObject:function(t,e,r){const s=this.processingType3?this.commonObjs.get(t):this.objs.get(t);if(s){this.save();var i=this.ctx;if(i.scale(1/e,-1/r),i.drawImage(s,0,0,s.width,s.height,0,-r,e,r),this.imageLayer){var a=i.mozCurrentTransformInverse,o=this.getCanvasPosition(0,0);this.imageLayer.appendImage({objId:t,left:o[0],top:o[1],width:e/a[0],height:r/a[3]})}this.restore()}else(0,n.warn)("Dependent image isn't ready yet")},paintImageMaskXObject:function(t){var e=this.ctx,n=t.width,s=t.height,i=this.current.fillColor,a=this.current.patternFill,o=this.processingType3;if(o&&void 0===o.compiled&&(o.compiled=n<=1e3&&s<=1e3?function(t){var e,r,n,s,i=t.width,a=t.height,o=i+1,l=new Uint8Array(o*(a+1)),c=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),h=i+7&-8,d=t.data,u=new Uint8Array(h*a),p=0;for(e=0,s=d.length;e<s;e++)for(var f=128,g=d[e];f>0;)u[p++]=g&f?0:255,f>>=1;var m=0;for(0!==u[p=0]&&(l[0]=1,++m),r=1;r<i;r++)u[p]!==u[p+1]&&(l[r]=u[p]?2:1,++m),p++;for(0!==u[p]&&(l[r]=2,++m),e=1;e<a;e++){n=e*o,u[(p=e*h)-h]!==u[p]&&(l[n]=u[p]?1:8,++m);var b=(u[p]?4:0)+(u[p-h]?8:0);for(r=1;r<i;r++)c[b=(b>>2)+(u[p+1]?4:0)+(u[p-h+1]?8:0)]&&(l[n+r]=c[b],++m),p++;if(u[p-h]!==u[p]&&(l[n+r]=u[p]?2:4,++m),m>1e3)return null}for(n=e*o,0!==u[p=h*(a-1)]&&(l[n]=8,++m),r=1;r<i;r++)u[p]!==u[p+1]&&(l[n+r]=u[p]?4:8,++m),p++;if(0!==u[p]&&(l[n+r]=4,++m),m>1e3)return null;var A=new Int32Array([0,o,-1,0,-o,0,0,0,1]),x=[];for(e=0;m&&e<=a;e++){for(var _=e*o,y=_+i;_<y&&!l[_];)_++;if(_!==y){var v,w=[_%o,e],S=l[_],C=_;do{var k=A[S];do{_+=k}while(!l[_]);5!==(v=l[_])&&10!==v?(S=v,l[_]=0):(S=v&51*S>>4,l[_]&=S>>2|S<<2),w.push(_%o),w.push(_/o|0),l[_]||--m}while(C!==_);x.push(w),--e}}return function(t){t.save(),t.scale(1/i,-1/a),t.translate(0,-a),t.beginPath();for(var e=0,r=x.length;e<r;e++){var n=x[e];t.moveTo(n[0],n[1]);for(var s=2,o=n.length;s<o;s+=2)t.lineTo(n[s],n[s+1])}t.fill(),t.beginPath(),t.restore()}}({data:t.data,width:n,height:s}):null),o&&o.compiled)o.compiled(e);else{var l=this.cachedCanvases.getCanvas("maskCanvas",n,s),c=l.context;c.save(),r(c,t),c.globalCompositeOperation="source-in",c.fillStyle=a?i.getPattern(c,this):i,c.fillRect(0,0,n,s),c.restore(),this.paintInlineImageXObject(l.canvas)}},paintImageMaskXObjectRepeat:function(t,e,n,s){var i=t.width,a=t.height,o=this.current.fillColor,l=this.current.patternFill,c=this.cachedCanvases.getCanvas("maskCanvas",i,a),h=c.context;h.save(),r(h,t),h.globalCompositeOperation="source-in",h.fillStyle=l?o.getPattern(h,this):o,h.fillRect(0,0,i,a),h.restore();for(var d=this.ctx,u=0,p=s.length;u<p;u+=2)d.save(),d.transform(e,0,0,n,s[u],s[u+1]),d.scale(1,-1),d.drawImage(c.canvas,0,0,i,a,0,-1,1,1),d.restore()},paintImageMaskXObjectGroup:function(t){for(var e=this.ctx,n=this.current.fillColor,s=this.current.patternFill,i=0,a=t.length;i<a;i++){var o=t[i],l=o.width,c=o.height,h=this.cachedCanvases.getCanvas("maskCanvas",l,c),d=h.context;d.save(),r(d,o),d.globalCompositeOperation="source-in",d.fillStyle=s?n.getPattern(d,this):n,d.fillRect(0,0,l,c),d.restore(),e.save(),e.transform.apply(e,o.transform),e.scale(1,-1),e.drawImage(h.canvas,0,0,l,c,0,-1,1,1),e.restore()}},paintImageXObject:function(t){const e=this.processingType3?this.commonObjs.get(t):this.objs.get(t);e?this.paintInlineImageXObject(e):(0,n.warn)("Dependent image isn't ready yet")},paintImageXObjectRepeat:function(t,e,r,s){const i=this.processingType3?this.commonObjs.get(t):this.objs.get(t);if(i){for(var a=i.width,o=i.height,l=[],c=0,h=s.length;c<h;c+=2)l.push({transform:[e,0,0,r,s[c],s[c+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(i,l)}else(0,n.warn)("Dependent image isn't ready yet")},paintInlineImageXObject:function(t){var r=t.width,n=t.height,s=this.ctx;this.save(),s.scale(1/r,-1/n);var i,a,o=s.mozCurrentTransformInverse,l=o[0],c=o[1],h=Math.max(Math.sqrt(l*l+c*c),1),d=o[2],u=o[3],p=Math.max(Math.sqrt(d*d+u*u),1);if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)i=t;else{var f=(a=this.cachedCanvases.getCanvas("inlineImage",r,n)).context;e(f,t),i=a.canvas}for(var g=r,m=n,b="prescale1";h>2&&g>1||p>2&&m>1;){var A=g,x=m;h>2&&g>1&&(h/=g/(A=Math.ceil(g/2))),p>2&&m>1&&(p/=m/(x=Math.ceil(m/2))),(f=(a=this.cachedCanvases.getCanvas(b,A,x)).context).clearRect(0,0,A,x),f.drawImage(i,0,0,g,m,0,0,A,x),i=a.canvas,g=A,m=x,b="prescale1"===b?"prescale2":"prescale1"}if(s.drawImage(i,0,0,g,m,0,-n,r,n),this.imageLayer){var _=this.getCanvasPosition(0,-n);this.imageLayer.appendImage({imgData:t,left:_[0],top:_[1],width:r/o[0],height:n/o[3]})}this.restore()},paintInlineImageXObjectGroup:function(t,r){var n=this.ctx,s=t.width,i=t.height,a=this.cachedCanvases.getCanvas("inlineImage",s,i);e(a.context,t);for(var o=0,l=r.length;o<l;o++){var c=r[o];if(n.save(),n.transform.apply(n,c.transform),n.scale(1,-1),n.drawImage(a.canvas,c.x,c.y,c.w,c.h,0,-1,1,1),this.imageLayer){var h=this.getCanvasPosition(c.x,c.y);this.imageLayer.appendImage({imgData:t,left:h[0],top:h[1],width:s,height:i})}n.restore()}},paintSolidColorImageMask:function(){this.ctx.fillRect(0,0,1,1)},paintXObject:function(){(0,n.warn)("Unsupported 'paintXObject' command.")},markPoint:function(t){},markPointProps:function(t,e){},beginMarkedContent:function(t){},beginMarkedContentProps:function(t,e){},endMarkedContent:function(){},beginCompat:function(){},endCompat:function(){},consumePath:function(){var t=this.ctx;this.pendingClip&&(this.pendingClip===b?t.clip("evenodd"):t.clip(),this.pendingClip=null),t.beginPath()},getSinglePixelWidth(t){if(null===this._cachedGetSinglePixelWidth){const t=this.ctx.mozCurrentTransformInverse;this._cachedGetSinglePixelWidth=Math.sqrt(Math.max(t[0]*t[0]+t[1]*t[1],t[2]*t[2]+t[3]*t[3]))}return this._cachedGetSinglePixelWidth},getCanvasPosition:function(t,e){var r=this.ctx.mozCurrentTransform;return[r[0]*t+r[2]*e+r[4],r[1]*t+r[3]*e+r[5]]}},n.OPS)t.prototype[n.OPS[A]]=t.prototype[A];return t}();e.CanvasGraphics=l},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getShadingPatternFromIR=function(t){var e=s[t[0]];if(!e)throw new Error("Unknown IR type: "+t[0]);return e.fromIR(t)},e.TilingPattern=void 0;var n=r(1),s={};function i(t,e){if(!e||"undefined"==typeof Path2D)return;const r=e[2]-e[0],n=e[3]-e[1],s=new Path2D;s.rect(e[0],e[1],r,n),t.clip(s)}s.RadialAxial={fromIR:function(t){var e=t[1],r=t[2],n=t[3],s=t[4],a=t[5],o=t[6],l=t[7];return{type:"Pattern",getPattern:function(t){var c;i(t,r),"axial"===e?c=t.createLinearGradient(s[0],s[1],a[0],a[1]):"radial"===e&&(c=t.createRadialGradient(s[0],s[1],o,a[0],a[1],l));for(var h=0,d=n.length;h<d;++h){var u=n[h];c.addColorStop(u[0],u[1])}return c}}}};var a=function(){function t(t,e,r,n,s,i,a,o){var l,c=e.coords,h=e.colors,d=t.data,u=4*t.width;c[r+1]>c[n+1]&&(l=r,r=n,n=l,l=i,i=a,a=l),c[n+1]>c[s+1]&&(l=n,n=s,s=l,l=a,a=o,o=l),c[r+1]>c[n+1]&&(l=r,r=n,n=l,l=i,i=a,a=l);var p=(c[r]+e.offsetX)*e.scaleX,f=(c[r+1]+e.offsetY)*e.scaleY,g=(c[n]+e.offsetX)*e.scaleX,m=(c[n+1]+e.offsetY)*e.scaleY,b=(c[s]+e.offsetX)*e.scaleX,A=(c[s+1]+e.offsetY)*e.scaleY;if(!(f>=A))for(var x,_,y,v,w,S,C,k,P=h[i],R=h[i+1],E=h[i+2],T=h[a],L=h[a+1],F=h[a+2],I=h[o],M=h[o+1],D=h[o+2],O=Math.round(f),N=Math.round(A),U=O;U<=N;U++){if(U<m){let t;t=U<f?0:f===m?1:(f-U)/(f-m),x=p-(p-g)*t,_=P-(P-T)*t,y=R-(R-L)*t,v=E-(E-F)*t}else{let t;t=U>A?1:m===A?0:(m-U)/(m-A),x=g-(g-b)*t,_=T-(T-I)*t,y=L-(L-M)*t,v=F-(F-D)*t}let t;t=U<f?0:U>A?1:(f-U)/(f-A),w=p-(p-b)*t,S=P-(P-I)*t,C=R-(R-M)*t,k=E-(E-D)*t;for(var j=Math.round(Math.min(x,w)),B=Math.round(Math.max(x,w)),W=u*U+4*j,q=j;q<=B;q++){let t=(x-q)/(x-w);t<0?t=0:t>1&&(t=1),d[W++]=_-(_-S)*t|0,d[W++]=y-(y-C)*t|0,d[W++]=v-(v-k)*t|0,d[W++]=255}}}function e(e,r,n){var s,i,a=r.coords,o=r.colors;switch(r.type){case"lattice":var l=r.verticesPerRow,c=Math.floor(a.length/l)-1,h=l-1;for(s=0;s<c;s++)for(var d=s*l,u=0;u<h;u++,d++)t(e,n,a[d],a[d+1],a[d+l],o[d],o[d+1],o[d+l]),t(e,n,a[d+l+1],a[d+1],a[d+l],o[d+l+1],o[d+1],o[d+l]);break;case"triangles":for(s=0,i=a.length;s<i;s+=3)t(e,n,a[s],a[s+1],a[s+2],o[s],o[s+1],o[s+2]);break;default:throw new Error("illegal figure")}}return function(t,r,n,s,i,a,o,l){var c,h,d,u,p=Math.floor(t[0]),f=Math.floor(t[1]),g=Math.ceil(t[2])-p,m=Math.ceil(t[3])-f,b=Math.min(Math.ceil(Math.abs(g*r[0]*1.1)),3e3),A=Math.min(Math.ceil(Math.abs(m*r[1]*1.1)),3e3),x=g/b,_=m/A,y={coords:n,colors:s,offsetX:-p,offsetY:-f,scaleX:1/x,scaleY:1/_},v=b+4,w=A+4;if(l.isEnabled)c=l.drawFigures({width:b,height:A,backgroundColor:a,figures:i,context:y}),(h=o.getCanvas("mesh",v,w,!1)).context.drawImage(c,2,2),c=h.canvas;else{var S=(h=o.getCanvas("mesh",v,w,!1)).context,C=S.createImageData(b,A);if(a){var k=C.data;for(d=0,u=k.length;d<u;d+=4)k[d]=a[0],k[d+1]=a[1],k[d+2]=a[2],k[d+3]=255}for(d=0;d<i.length;d++)e(C,i[d],y);S.putImageData(C,2,2),c=h.canvas}return{canvas:c,offsetX:p-2*x,offsetY:f-2*_,scaleX:x,scaleY:_}}}();s.Mesh={fromIR:function(t){var e=t[2],r=t[3],s=t[4],o=t[5],l=t[6],c=t[7],h=t[8];return{type:"Pattern",getPattern:function(t,d,u){var p;if(i(t,c),u)p=n.Util.singularValueDecompose2dScale(t.mozCurrentTransform);else if(p=n.Util.singularValueDecompose2dScale(d.baseTransform),l){var f=n.Util.singularValueDecompose2dScale(l);p=[p[0]*f[0],p[1]*f[1]]}var g=a(o,p,e,r,s,u?null:h,d.cachedCanvases,d.webGLContext);return u||(t.setTransform.apply(t,d.baseTransform),l&&t.transform.apply(t,l)),t.translate(g.offsetX,g.offsetY),t.scale(g.scaleX,g.scaleY),t.createPattern(g.canvas,"no-repeat")}}}},s.Dummy={fromIR:function(){return{type:"Pattern",getPattern:function(){return"hotpink"}}}};var o=function(){var t=1,e=2;function r(t,e,r,n,s){this.operatorList=t[2],this.matrix=t[3]||[1,0,0,1,0,0],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.canvasGraphicsFactory=n,this.baseTransform=s,this.type="Pattern",this.ctx=r}return r.prototype={createPatternCanvas:function(t){var e=this.operatorList,r=this.bbox,s=this.xstep,i=this.ystep,a=this.paintType,o=this.tilingType,l=this.color,c=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+o);var h=r[0],d=r[1],u=r[2],p=r[3],f=n.Util.singularValueDecompose2dScale(this.matrix),g=n.Util.singularValueDecompose2dScale(this.baseTransform),m=[f[0]*g[0],f[1]*g[1]],b=this.getSizeAndScale(s,this.ctx.canvas.width,m[0]),A=this.getSizeAndScale(i,this.ctx.canvas.height,m[1]),x=t.cachedCanvases.getCanvas("pattern",b.size,A.size,!0),_=x.context,y=c.createCanvasGraphics(_);return y.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(y,a,l),y.transform(b.scale,0,0,A.scale,0,0),y.transform(1,0,0,1,-h,-d),this.clipBbox(y,r,h,d,u,p),y.executeOperatorList(e),this.ctx.transform(1,0,0,1,h,d),this.ctx.scale(1/b.scale,1/A.scale),x.canvas},getSizeAndScale:function(t,e,r){t=Math.abs(t);var n=Math.max(3e3,e),s=Math.ceil(t*r);return s>=n?s=n:r=s/t,{scale:r,size:s}},clipBbox:function(t,e,r,n,s,i){if(Array.isArray(e)&&4===e.length){var a=s-r,o=i-n;t.ctx.rect(r,n,a,o),t.clip(),t.endPath()}},setFillAndStrokeStyleToContext:function(r,s,i){const a=r.ctx,o=r.current;switch(s){case t:var l=this.ctx;a.fillStyle=l.fillStyle,a.strokeStyle=l.strokeStyle,o.fillColor=l.fillStyle,o.strokeColor=l.strokeStyle;break;case e:var c=n.Util.makeCssRgb(i[0],i[1],i[2]);a.fillStyle=c,a.strokeStyle=c,o.fillColor=c,o.strokeColor=c;break;default:throw new n.FormatError("Unsupported paint type: "+s)}},getPattern:function(t,e){(t=this.ctx).setTransform.apply(t,this.baseTransform),t.transform.apply(t,this.matrix);var r=this.createPatternCanvas(e);return t.createPattern(r,"repeat")}},r}();e.TilingPattern=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalWorkerOptions=void 0;const n=Object.create(null);e.GlobalWorkerOptions=n,n.workerPort=void 0===n.workerPort?null:n.workerPort,n.workerSrc=void 0===n.workerSrc?"":n.workerSrc},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MessageHandler=void 0;var n=r(1);const s=1,i=2,a=1,o=2,l=3,c=4,h=5,d=6,u=7,p=8;function f(t){if("object"!=typeof t||null===t)return t;switch(t.name){case"AbortException":return new n.AbortException(t.message);case"MissingPDFException":return new n.MissingPDFException(t.message);case"UnexpectedResponseException":return new n.UnexpectedResponseException(t.message,t.status);case"UnknownErrorException":return new n.UnknownErrorException(t.message,t.details);default:return new n.UnknownErrorException(t.message,t.toString())}}e.MessageHandler=class{constructor(t,e,r){this.sourceName=t,this.targetName=e,this.comObj=r,this.callbackId=1,this.streamId=1,this.postMessageTransfers=!0,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=t=>{const e=t.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void this._processStreamMessage(e);if(e.callback){const t=e.callbackId,r=this.callbackCapabilities[t];if(!r)throw new Error("Cannot resolve callback "+t);if(delete this.callbackCapabilities[t],e.callback===s)r.resolve(e.data);else{if(e.callback!==i)throw new Error("Unexpected callback case");r.reject(f(e.reason))}return}const n=this.actionHandler[e.action];if(!n)throw new Error("Unknown action from worker: "+e.action);if(e.callbackId){const t=this.sourceName,a=e.sourceName;new Promise((function(t){t(n(e.data))})).then((function(n){r.postMessage({sourceName:t,targetName:a,callback:s,callbackId:e.callbackId,data:n})}),(function(n){r.postMessage({sourceName:t,targetName:a,callback:i,callbackId:e.callbackId,reason:f(n)})}))}else e.streamId?this._createStreamSink(e):n(e.data)},r.addEventListener("message",this._onComObjOnMessage)}on(t,e){const r=this.actionHandler;if(r[t])throw new Error(`There is already an actionName called "${t}"`);r[t]=e}send(t,e,r){this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},r)}sendWithPromise(t,e,r){const s=this.callbackId++,i=(0,n.createPromiseCapability)();this.callbackCapabilities[s]=i;try{this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},r)}catch(t){i.reject(t)}return i.promise}sendWithStream(t,e,r,s){const i=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:r=>{const a=(0,n.createPromiseCapability)();return this.streamControllers[i]={controller:r,startCall:a,pullCall:null,cancelCall:null,isClosed:!1},this._postMessage({sourceName:o,targetName:l,action:t,streamId:i,data:e,desiredSize:r.desiredSize},s),a.promise},pull:t=>{const e=(0,n.createPromiseCapability)();return this.streamControllers[i].pullCall=e,c.postMessage({sourceName:o,targetName:l,stream:d,streamId:i,desiredSize:t.desiredSize}),e.promise},cancel:t=>{(0,n.assert)(t instanceof Error,"cancel must have a valid reason");const e=(0,n.createPromiseCapability)();return this.streamControllers[i].cancelCall=e,this.streamControllers[i].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:a,streamId:i,reason:f(t)}),e.promise}},r)}_createStreamSink(t){const e=this,r=this.actionHandler[t.action],s=t.streamId,i=this.sourceName,a=t.sourceName,o=this.comObj,d={enqueue(t,r=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=r,l>0&&this.desiredSize<=0&&(this.sinkCapability=(0,n.createPromiseCapability)(),this.ready=this.sinkCapability.promise),e._postMessage({sourceName:i,targetName:a,stream:c,streamId:s,chunk:t},o)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:a,stream:l,streamId:s}),delete e.streamSinks[s])},error(t){(0,n.assert)(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:a,stream:h,streamId:s,reason:f(t)}))},sinkCapability:(0,n.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[s]=d,new Promise((function(e){e(r(t.data,d))})).then((function(){o.postMessage({sourceName:i,targetName:a,stream:p,streamId:s,success:!0})}),(function(t){o.postMessage({sourceName:i,targetName:a,stream:p,streamId:s,reason:f(t)})}))}_processStreamMessage(t){const e=t.streamId,r=this.sourceName,s=t.sourceName,i=this.comObj;switch(t.stream){case p:t.success?this.streamControllers[e].startCall.resolve():this.streamControllers[e].startCall.reject(f(t.reason));break;case u:t.success?this.streamControllers[e].pullCall.resolve():this.streamControllers[e].pullCall.reject(f(t.reason));break;case d:if(!this.streamSinks[e]){i.postMessage({sourceName:r,targetName:s,stream:u,streamId:e,success:!0});break}this.streamSinks[e].desiredSize<=0&&t.desiredSize>0&&this.streamSinks[e].sinkCapability.resolve(),this.streamSinks[e].desiredSize=t.desiredSize;const{onPull:g}=this.streamSinks[t.streamId];new Promise((function(t){t(g&&g())})).then((function(){i.postMessage({sourceName:r,targetName:s,stream:u,streamId:e,success:!0})}),(function(t){i.postMessage({sourceName:r,targetName:s,stream:u,streamId:e,reason:f(t)})}));break;case c:if((0,n.assert)(this.streamControllers[e],"enqueue should have stream controller"),this.streamControllers[e].isClosed)break;this.streamControllers[e].controller.enqueue(t.chunk);break;case l:if((0,n.assert)(this.streamControllers[e],"close should have stream controller"),this.streamControllers[e].isClosed)break;this.streamControllers[e].isClosed=!0,this.streamControllers[e].controller.close(),this._deleteStreamController(e);break;case h:(0,n.assert)(this.streamControllers[e],"error should have stream controller"),this.streamControllers[e].controller.error(f(t.reason)),this._deleteStreamController(e);break;case o:t.success?this.streamControllers[e].cancelCall.resolve():this.streamControllers[e].cancelCall.reject(f(t.reason)),this._deleteStreamController(e);break;case a:if(!this.streamSinks[e])break;const{onCancel:m}=this.streamSinks[t.streamId];new Promise((function(e){e(m&&m(f(t.reason)))})).then((function(){i.postMessage({sourceName:r,targetName:s,stream:o,streamId:e,success:!0})}),(function(t){i.postMessage({sourceName:r,targetName:s,stream:o,streamId:e,reason:f(t)})})),this.streamSinks[e].sinkCapability.reject(f(t.reason)),this.streamSinks[e].isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(t){await Promise.allSettled([this.streamControllers[t].startCall,this.streamControllers[t].pullCall,this.streamControllers[t].cancelCall].map((function(t){return t&&t.promise}))),delete this.streamControllers[t]}_postMessage(t,e){e&&this.postMessageTransfers?this.comObj.postMessage(t,e):this.comObj.postMessage(t)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Metadata=void 0;var n=r(1),s=r(13);e.Metadata=class{constructor(t){(0,n.assert)("string"==typeof t,"Metadata: input is not a string"),t=this._repair(t);const e=(new s.SimpleXMLParser).parseFromString(t);this._metadataMap=new Map,e&&this._parse(e)}_repair(t){return t.replace(/^[^<]+/,"").replace(/>\\376\\377([^<]+)/g,(function(t,e){const r=e.replace(/\\([0-3])([0-7])([0-7])/g,(function(t,e,r,n){return String.fromCharCode(64*e+8*r+1*n)})).replace(/&(amp|apos|gt|lt|quot);/g,(function(t,e){switch(e){case"amp":return"&";case"apos":return"'";case"gt":return">";case"lt":return"<";case"quot":return'"'}throw new Error(`_repair: ${e} isn't defined.`)}));let n="";for(let t=0,e=r.length;t<e;t+=2){const e=256*r.charCodeAt(t)+r.charCodeAt(t+1);n+=e>=32&&e<127&&60!==e&&62!==e&&38!==e?String.fromCharCode(e):"&#x"+(65536+e).toString(16).substring(1)+";"}return">"+n}))}_parse(t){let e=t.documentElement;if("rdf:rdf"!==e.nodeName.toLowerCase())for(e=e.firstChild;e&&"rdf:rdf"!==e.nodeName.toLowerCase();)e=e.nextSibling;const r=e?e.nodeName.toLowerCase():null;if(!e||"rdf:rdf"!==r||!e.hasChildNodes())return;const n=e.childNodes;for(let t=0,e=n.length;t<e;t++){const e=n[t];if("rdf:description"===e.nodeName.toLowerCase())for(let t=0,r=e.childNodes.length;t<r;t++)if("#text"!==e.childNodes[t].nodeName.toLowerCase()){const r=e.childNodes[t],n=r.nodeName.toLowerCase();this._metadataMap.set(n,r.textContent.trim())}}}get(t){return this._metadataMap.has(t)?this._metadataMap.get(t):null}getAll(){const t=Object.create(null);for(const[e,r]of this._metadataMap)t[e]=r;return t}has(t){return this._metadataMap.has(t)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SimpleXMLParser=void 0;const n=0,s=-2,i=-3,a=-4,o=-5,l=-6,c=-9;function h(t,e){const r=t[e];return" "===r||"\n"===r||"\r"===r||"\t"===r}class d{constructor(t,e){this.nodeName=t,this.nodeValue=e,Object.defineProperty(this,"parentNode",{value:null,writable:!0})}get firstChild(){return this.childNodes&&this.childNodes[0]}get nextSibling(){const t=this.parentNode.childNodes;if(!t)return;const e=t.indexOf(this);return-1!==e?t[e+1]:void 0}get textContent(){return this.childNodes?this.childNodes.map((function(t){return t.textContent})).join(""):this.nodeValue||""}hasChildNodes(){return this.childNodes&&this.childNodes.length>0}}e.SimpleXMLParser=class extends class{_resolveEntities(t){return t.replace(/&([^;]+);/g,(t,e)=>{if("#x"===e.substring(0,2))return String.fromCharCode(parseInt(e.substring(2),16));if("#"===e.substring(0,1))return String.fromCharCode(parseInt(e.substring(1),10));switch(e){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"'}return this.onResolveEntity(e)})}_parseContent(t,e){const r=[];let n=e;function s(){for(;n<t.length&&h(t,n);)++n}for(;n<t.length&&!h(t,n)&&">"!==t[n]&&"/"!==t[n];)++n;const i=t.substring(e,n);for(s();n<t.length&&">"!==t[n]&&"/"!==t[n]&&"?"!==t[n];){s();let e="",i="";for(;n<t.length&&!h(t,n)&&"="!==t[n];)e+=t[n],++n;if(s(),"="!==t[n])return null;++n,s();const a=t[n];if('"'!==a&&"'"!==a)return null;const o=t.indexOf(a,++n);if(o<0)return null;i=t.substring(n,o),r.push({name:e,value:this._resolveEntities(i)}),n=o+1,s()}return{name:i,attributes:r,parsed:n-e}}_parseProcessingInstruction(t,e){let r=e;for(;r<t.length&&!h(t,r)&&">"!==t[r]&&"/"!==t[r];)++r;const n=t.substring(e,r);!function(){for(;r<t.length&&h(t,r);)++r}();const s=r;for(;r<t.length&&("?"!==t[r]||">"!==t[r+1]);)++r;return{name:n,value:t.substring(s,r),parsed:r-e}}parseXml(t){let e=0;for(;e<t.length;){let r=e;if("<"===t[e]){let e;switch(++r,t[r]){case"/":if(++r,e=t.indexOf(">",r),e<0)return void this.onError(c);this.onEndElement(t.substring(r,e)),r=e+1;break;case"?":++r;const n=this._parseProcessingInstruction(t,r);if("?>"!==t.substring(r+n.parsed,r+n.parsed+2))return void this.onError(i);this.onPi(n.name,n.value),r+=n.parsed+2;break;case"!":if("--"===t.substring(r+1,r+3)){if(e=t.indexOf("--\x3e",r+3),e<0)return void this.onError(o);this.onComment(t.substring(r+3,e)),r=e+3}else if("[CDATA["===t.substring(r+1,r+8)){if(e=t.indexOf("]]>",r+8),e<0)return void this.onError(s);this.onCdata(t.substring(r+8,e)),r=e+3}else{if("DOCTYPE"!==t.substring(r+1,r+8))return void this.onError(l);{const n=t.indexOf("[",r+8);let s=!1;if(e=t.indexOf(">",r+8),e<0)return void this.onError(a);if(n>0&&e>n){if(e=t.indexOf("]>",r+8),e<0)return void this.onError(a);s=!0}const i=t.substring(r+8,e+(s?1:0));this.onDoctype(i),r=e+(s?2:1)}}break;default:const h=this._parseContent(t,r);if(null===h)return void this.onError(l);let d=!1;if("/>"===t.substring(r+h.parsed,r+h.parsed+2))d=!0;else if(">"!==t.substring(r+h.parsed,r+h.parsed+1))return void this.onError(c);this.onBeginElement(h.name,h.attributes,d),r+=h.parsed+(d?2:1)}}else{for(;r<t.length&&"<"!==t[r];)r++;const n=t.substring(e,r);this.onText(this._resolveEntities(n))}e=r}}onResolveEntity(t){return`&${t};`}onPi(t,e){}onComment(t){}onCdata(t){}onDoctype(t){}onText(t){}onBeginElement(t,e,r){}onEndElement(t){}onError(t){}}{constructor(){super(),this._currentFragment=null,this._stack=null,this._errorCode=n}parseFromString(t){if(this._currentFragment=[],this._stack=[],this._errorCode=n,this.parseXml(t),this._errorCode!==n)return;const[e]=this._currentFragment;return e?{documentElement:e}:void 0}onResolveEntity(t){switch(t){case"apos":return"'"}return super.onResolveEntity(t)}onText(t){if(function(t){for(let e=0,r=t.length;e<r;e++)if(!h(t,e))return!1;return!0}(t))return;const e=new d("#text",t);this._currentFragment.push(e)}onCdata(t){const e=new d("#text",t);this._currentFragment.push(e)}onBeginElement(t,e,r){const n=new d(t);n.childNodes=[],this._currentFragment.push(n),r||(this._stack.push(this._currentFragment),this._currentFragment=n.childNodes)}onEndElement(t){this._currentFragment=this._stack.pop()||[];const e=this._currentFragment[this._currentFragment.length-1];if(e)for(let t=0,r=e.childNodes.length;t<r;t++)e.childNodes[t].parentNode=e}onError(t){this._errorCode=t}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PDFDataTransportStream=void 0;var n=r(1);e.PDFDataTransportStream=class{constructor(t,e){(0,n.assert)(e),this._queuedChunks=[],this._progressiveDone=t.progressiveDone||!1;const r=t.initialData;if(r&&r.length>0){const t=new Uint8Array(r).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._contentLength=t.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),this._pdfDataRangeTransport.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),this._pdfDataRangeTransport.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData(t){const e=new Uint8Array(t.chunk).buffer;if(void 0===t.begin)this._fullRequestReader?this._fullRequestReader._enqueue(e):this._queuedChunks.push(e);else{const r=this._rangeReaders.some((function(r){return r._begin===t.begin&&(r._enqueue(e),!0)}));(0,n.assert)(r)}}get _progressiveDataLength(){return this._fullRequestReader?this._fullRequestReader._loaded:0}_onProgress(t){if(void 0===t.total){const e=this._rangeReaders[0];e&&e.onProgress&&e.onProgress({loaded:t.loaded})}else{const e=this._fullRequestReader;e&&e.onProgress&&e.onProgress({loaded:t.loaded,total:t.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){(0,n.assert)(!this._fullRequestReader);const t=this._queuedChunks;return this._queuedChunks=null,new s(this,t,this._progressiveDone)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const r=new i(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(r),r}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t),this._rangeReaders.slice(0).forEach((function(e){e.cancel(t)})),this._pdfDataRangeTransport.abort()}};class s{constructor(t,e,r=!1){this._stream=t,this._done=r||!1,this._filename=null,this._queuedChunks=e||[],this._loaded=0;for(const t of this._queuedChunks)this._loaded+=t.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=(0,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._requests.forEach((function(t){t.resolve({value:void 0,done:!0})})),this._requests=[]}progressiveDone(){this._done||(this._done=!0)}}class i{constructor(t,e,r){this._stream=t,this._begin=e,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){this._done||(0===this._requests.length?this._queuedChunk=t:(this._requests.shift().resolve({value:t,done:!1}),this._requests.forEach((function(t){t.resolve({value:void 0,done:!0})})),this._requests=[]),this._done=!0,this._stream._removeRangeReader(this))}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=(0,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._requests.forEach((function(t){t.resolve({value:void 0,done:!0})})),this._requests=[],this._stream._removeRangeReader(this)}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebGLContext=void 0;var n=r(1);e.WebGLContext=class{constructor({enable:t=!1}){this._enabled=!0===t}get isEnabled(){let t=this._enabled;return t&&(t=s.tryInitGL()),(0,n.shadow)(this,"isEnabled",t)}composeSMask({layer:t,mask:e,properties:r}){return s.composeSMask(t,e,r)}drawFigures({width:t,height:e,backgroundColor:r,figures:n,context:i}){return s.drawFigures(t,e,r,n,i)}clear(){s.cleanup()}};var s=function(){function t(t,e,r){var n=t.createShader(r);if(t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var s=t.getShaderInfoLog(n);throw new Error("Error during shader compilation: "+s)}return n}function e(e,r){return t(e,r,e.VERTEX_SHADER)}function r(e,r){return t(e,r,e.FRAGMENT_SHADER)}function n(t,e){for(var r=t.createProgram(),n=0,s=e.length;n<s;++n)t.attachShader(r,e[n]);if(t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS)){var i=t.getProgramInfoLog(r);throw new Error("Error during program linking: "+i)}return r}function s(t,e,r){t.activeTexture(r);var n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),n}var i,a;function o(){i||(a=document.createElement("canvas"),i=a.getContext("webgl",{premultipliedalpha:!1}))}var l=null,c=null;return{tryInitGL(){try{return o(),!!i}catch(t){}return!1},composeSMask:function(t,c,h){var d=t.width,u=t.height;l||function(){var t,s;o(),t=a,a=null,s=i,i=null;var c=n(s,[e(s," attribute vec2 a_position; attribute vec2 a_texCoord; uniform vec2 u_resolution; varying vec2 v_texCoord; void main() { vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); v_texCoord = a_texCoord; } "),r(s," precision mediump float; uniform vec4 u_backdrop; uniform int u_subtype; uniform sampler2D u_image; uniform sampler2D u_mask; varying vec2 v_texCoord; void main() { vec4 imageColor = texture2D(u_image, v_texCoord); vec4 maskColor = texture2D(u_mask, v_texCoord); if (u_backdrop.a > 0.0) { maskColor.rgb = maskColor.rgb * maskColor.a + u_backdrop.rgb * (1.0 - maskColor.a); } float lum; if (u_subtype == 0) { lum = maskColor.a; } else { lum = maskColor.r * 0.3 + maskColor.g * 0.59 + maskColor.b * 0.11; } imageColor.a *= lum; imageColor.rgb *= imageColor.a; gl_FragColor = imageColor; } ")]);s.useProgram(c);var h={};h.gl=s,h.canvas=t,h.resolutionLocation=s.getUniformLocation(c,"u_resolution"),h.positionLocation=s.getAttribLocation(c,"a_position"),h.backdropLocation=s.getUniformLocation(c,"u_backdrop"),h.subtypeLocation=s.getUniformLocation(c,"u_subtype");var d=s.getAttribLocation(c,"a_texCoord"),u=s.getUniformLocation(c,"u_image"),p=s.getUniformLocation(c,"u_mask"),f=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,f),s.bufferData(s.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),s.STATIC_DRAW),s.enableVertexAttribArray(d),s.vertexAttribPointer(d,2,s.FLOAT,!1,0,0),s.uniform1i(u,0),s.uniform1i(p,1),l=h}();var p=l,f=p.canvas,g=p.gl;f.width=d,f.height=u,g.viewport(0,0,g.drawingBufferWidth,g.drawingBufferHeight),g.uniform2f(p.resolutionLocation,d,u),h.backdrop?g.uniform4f(p.resolutionLocation,h.backdrop[0],h.backdrop[1],h.backdrop[2],1):g.uniform4f(p.resolutionLocation,0,0,0,0),g.uniform1i(p.subtypeLocation,"Luminosity"===h.subtype?1:0);var m=s(g,t,g.TEXTURE0),b=s(g,c,g.TEXTURE1),A=g.createBuffer();return g.bindBuffer(g.ARRAY_BUFFER,A),g.bufferData(g.ARRAY_BUFFER,new Float32Array([0,0,d,0,0,u,0,u,d,0,d,u]),g.STATIC_DRAW),g.enableVertexAttribArray(p.positionLocation),g.vertexAttribPointer(p.positionLocation,2,g.FLOAT,!1,0,0),g.clearColor(0,0,0,0),g.enable(g.BLEND),g.blendFunc(g.ONE,g.ONE_MINUS_SRC_ALPHA),g.clear(g.COLOR_BUFFER_BIT),g.drawArrays(g.TRIANGLES,0,6),g.flush(),g.deleteTexture(m),g.deleteTexture(b),g.deleteBuffer(A),f},drawFigures:function(t,s,l,h,d){c||function(){var t,s;o(),t=a,a=null,s=i,i=null;var l=n(s,[e(s," attribute vec2 a_position; attribute vec3 a_color; uniform vec2 u_resolution; uniform vec2 u_scale; uniform vec2 u_offset; varying vec4 v_color; void main() { vec2 position = (a_position + u_offset) * u_scale; vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); v_color = vec4(a_color / 255.0, 1.0); } "),r(s," precision mediump float; varying vec4 v_color; void main() { gl_FragColor = v_color; } ")]);s.useProgram(l);var h={};h.gl=s,h.canvas=t,h.resolutionLocation=s.getUniformLocation(l,"u_resolution"),h.scaleLocation=s.getUniformLocation(l,"u_scale"),h.offsetLocation=s.getUniformLocation(l,"u_offset"),h.positionLocation=s.getAttribLocation(l,"a_position"),h.colorLocation=s.getAttribLocation(l,"a_color"),c=h}();var u=c,p=u.canvas,f=u.gl;p.width=t,p.height=s,f.viewport(0,0,f.drawingBufferWidth,f.drawingBufferHeight),f.uniform2f(u.resolutionLocation,t,s);var g,m,b,A=0;for(g=0,m=h.length;g<m;g++)switch(h[g].type){case"lattice":A+=((b=h[g].coords.length/h[g].verticesPerRow|0)-1)*(h[g].verticesPerRow-1)*6;break;case"triangles":A+=h[g].coords.length}var x=new Float32Array(2*A),_=new Uint8Array(3*A),y=d.coords,v=d.colors,w=0,S=0;for(g=0,m=h.length;g<m;g++){var C=h[g],k=C.coords,P=C.colors;switch(C.type){case"lattice":var R=C.verticesPerRow;b=k.length/R|0;for(var E=1;E<b;E++)for(var T=E*R+1,L=1;L<R;L++,T++)x[w]=y[k[T-R-1]],x[w+1]=y[k[T-R-1]+1],x[w+2]=y[k[T-R]],x[w+3]=y[k[T-R]+1],x[w+4]=y[k[T-1]],x[w+5]=y[k[T-1]+1],_[S]=v[P[T-R-1]],_[S+1]=v[P[T-R-1]+1],_[S+2]=v[P[T-R-1]+2],_[S+3]=v[P[T-R]],_[S+4]=v[P[T-R]+1],_[S+5]=v[P[T-R]+2],_[S+6]=v[P[T-1]],_[S+7]=v[P[T-1]+1],_[S+8]=v[P[T-1]+2],x[w+6]=x[w+2],x[w+7]=x[w+3],x[w+8]=x[w+4],x[w+9]=x[w+5],x[w+10]=y[k[T]],x[w+11]=y[k[T]+1],_[S+9]=_[S+3],_[S+10]=_[S+4],_[S+11]=_[S+5],_[S+12]=_[S+6],_[S+13]=_[S+7],_[S+14]=_[S+8],_[S+15]=v[P[T]],_[S+16]=v[P[T]+1],_[S+17]=v[P[T]+2],w+=12,S+=18;break;case"triangles":for(var F=0,I=k.length;F<I;F++)x[w]=y[k[F]],x[w+1]=y[k[F]+1],_[S]=v[P[F]],_[S+1]=v[P[F]+1],_[S+2]=v[P[F]+2],w+=2,S+=3}}l?f.clearColor(l[0]/255,l[1]/255,l[2]/255,1):f.clearColor(0,0,0,0),f.clear(f.COLOR_BUFFER_BIT);var M=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,M),f.bufferData(f.ARRAY_BUFFER,x,f.STATIC_DRAW),f.enableVertexAttribArray(u.positionLocation),f.vertexAttribPointer(u.positionLocation,2,f.FLOAT,!1,0,0);var D=f.createBuffer();return f.bindBuffer(f.ARRAY_BUFFER,D),f.bufferData(f.ARRAY_BUFFER,_,f.STATIC_DRAW),f.enableVertexAttribArray(u.colorLocation),f.vertexAttribPointer(u.colorLocation,3,f.UNSIGNED_BYTE,!1,0,0),f.uniform2f(u.scaleLocation,d.scaleX,d.scaleY),f.uniform2f(u.offsetLocation,d.offsetX,d.offsetY),f.drawArrays(f.TRIANGLES,0,A),f.flush(),f.deleteBuffer(M),f.deleteBuffer(D),p},cleanup(){l&&l.canvas&&(l.canvas.width=0,l.canvas.height=0),c&&c.canvas&&(c.canvas.width=0,c.canvas.height=0),l=null,c=null}}}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.renderTextLayer=void 0;var n=r(1),s=function(){var t=/\S/;function e(e,r,s){var i,a=document.createElement("span"),o={angle:0,canvasWidth:0,isWhitespace:!1,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1};if(e._textDivs.push(a),i=r.str,!t.test(i))return o.isWhitespace=!0,void e._textDivProperties.set(a,o);var l=n.Util.transform(e._viewport.transform,r.transform),c=Math.atan2(l[1],l[0]),h=s[r.fontName];h.vertical&&(c+=Math.PI/2);var d=Math.sqrt(l[2]*l[2]+l[3]*l[3]),u=d;let p,f;if(h.ascent?u=h.ascent*u:h.descent&&(u=(1+h.descent)*u),0===c?(p=l[4],f=l[5]-u):(p=l[4]+u*Math.sin(c),f=l[5]-u*Math.cos(c)),a.style.left=p+"px",a.style.top=f+"px",a.style.fontSize=d+"px",a.style.fontFamily=h.fontFamily,a.textContent=r.str,e._fontInspectorEnabled&&(a.dataset.fontName=r.fontName),0!==c&&(o.angle=c*(180/Math.PI)),r.str.length>1&&(h.vertical?o.canvasWidth=r.height*e._viewport.scale:o.canvasWidth=r.width*e._viewport.scale),e._textDivProperties.set(a,o),e._textContentStream&&e._layoutText(a),e._enhanceTextSelection){var g=1,m=0;0!==c&&(g=Math.cos(c),m=Math.sin(c));var b,A,x=(h.vertical?r.height:r.width)*e._viewport.scale,_=d;0!==c?(b=[g,m,-m,g,p,f],A=n.Util.getAxialAlignedBoundingBox([0,0,x,_],b)):A=[p,f,p+x,f+_],e._bounds.push({left:A[0],top:A[1],right:A[2],bottom:A[3],div:a,size:[x,_],m:b})}}function r(t){if(!t._canceled){var e=t._textDivs,r=t._capability,n=e.length;if(n>1e5)return t._renderingDone=!0,void r.resolve();if(!t._textContentStream)for(var s=0;s<n;s++)t._layoutText(e[s]);t._renderingDone=!0,r.resolve()}}function s(t){for(var e=t._bounds,r=t._viewport,s=function(t,e,r){var n=r.map((function(t,e){return{x1:t.left,y1:t.top,x2:t.right,y2:t.bottom,index:e,x1New:void 0,x2New:void 0}}));i(t,n);var s=new Array(r.length);return n.forEach((function(t){var e=t.index;s[e]={left:t.x1New,top:0,right:t.x2New,bottom:0}})),r.map((function(e,r){var i=s[r],a=n[r];a.x1=e.top,a.y1=t-i.right,a.x2=e.bottom,a.y2=t-i.left,a.index=r,a.x1New=void 0,a.x2New=void 0})),i(e,n),n.forEach((function(t){var e=t.index;s[e].top=t.x1New,s[e].bottom=t.x2New})),s}(r.width,r.height,e),a=0;a<s.length;a++){var o=e[a].div,l=t._textDivProperties.get(o);if(0!==l.angle){var c=s[a],h=e[a],d=h.m,u=d[0],p=d[1],f=[[0,0],[0,h.size[1]],[h.size[0],0],h.size],g=new Float64Array(64);f.forEach((function(t,e){var r=n.Util.applyTransform(t,d);g[e+0]=u&&(c.left-r[0])/u,g[e+4]=p&&(c.top-r[1])/p,g[e+8]=u&&(c.right-r[0])/u,g[e+12]=p&&(c.bottom-r[1])/p,g[e+16]=p&&(c.left-r[0])/-p,g[e+20]=u&&(c.top-r[1])/u,g[e+24]=p&&(c.right-r[0])/-p,g[e+28]=u&&(c.bottom-r[1])/u,g[e+32]=u&&(c.left-r[0])/-u,g[e+36]=p&&(c.top-r[1])/-p,g[e+40]=u&&(c.right-r[0])/-u,g[e+44]=p&&(c.bottom-r[1])/-p,g[e+48]=p&&(c.left-r[0])/p,g[e+52]=u&&(c.top-r[1])/-u,g[e+56]=p&&(c.right-r[0])/p,g[e+60]=u&&(c.bottom-r[1])/-u}));var m=function(t,e,r){for(var n=0,s=0;s<r;s++){var i=t[e++];i>0&&(n=n?Math.min(i,n):i)}return n},b=1+Math.min(Math.abs(u),Math.abs(p));l.paddingLeft=m(g,32,16)/b,l.paddingTop=m(g,48,16)/b,l.paddingRight=m(g,0,16)/b,l.paddingBottom=m(g,16,16)/b,t._textDivProperties.set(o,l)}else l.paddingLeft=e[a].left-s[a].left,l.paddingTop=e[a].top-s[a].top,l.paddingRight=s[a].right-e[a].right,l.paddingBottom=s[a].bottom-e[a].bottom,t._textDivProperties.set(o,l)}}function i(t,e){e.sort((function(t,e){return t.x1-e.x1||t.index-e.index}));var r=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];e.forEach((function(t){for(var e=0;e<r.length&&r[e].end<=t.y1;)e++;for(var n,s,i=r.length-1;i>=0&&r[i].start>=t.y2;)i--;var a,o,l=-1/0;for(a=e;a<=i;a++){var c;(c=(s=(n=r[a]).boundary).x2>t.x1?s.index>t.index?s.x1New:t.x1:void 0===s.x2New?(s.x2+t.x1)/2:s.x2New)>l&&(l=c)}for(t.x1New=l,a=e;a<=i;a++)void 0===(s=(n=r[a]).boundary).x2New?s.x2>t.x1?s.index>t.index&&(s.x2New=s.x2):s.x2New=l:s.x2New>l&&(s.x2New=Math.max(l,s.x2));var h=[],d=null;for(a=e;a<=i;a++){var u=(s=(n=r[a]).boundary).x2>t.x2?s:t;d===u?h[h.length-1].end=n.end:(h.push({start:n.start,end:n.end,boundary:u}),d=u)}for(r[e].start<t.y1&&(h[0].start=t.y1,h.unshift({start:r[e].start,end:t.y1,boundary:r[e].boundary})),t.y2<r[i].end&&(h[h.length-1].end=t.y2,h.push({start:t.y2,end:r[i].end,boundary:r[i].boundary})),a=e;a<=i;a++)if(void 0===(s=(n=r[a]).boundary).x2New){var p=!1;for(o=e-1;!p&&o>=0&&r[o].start>=s.y1;o--)p=r[o].boundary===s;for(o=i+1;!p&&o<r.length&&r[o].end<=s.y2;o++)p=r[o].boundary===s;for(o=0;!p&&o<h.length;o++)p=h[o].boundary===s;p||(s.x2New=l)}Array.prototype.splice.apply(r,[e,i-e+1].concat(h))})),r.forEach((function(e){var r=e.boundary;void 0===r.x2New&&(r.x2New=Math.max(t,r.x2))}))}function a({textContent:t,textContentStream:e,container:r,viewport:s,textDivs:i,textContentItemsStr:a,enhanceTextSelection:o}){this._textContent=t,this._textContentStream=e,this._container=r,this._viewport=s,this._textDivs=i||[],this._textContentItemsStr=a||[],this._enhanceTextSelection=!!o,this._fontInspectorEnabled=!(!globalThis.FontInspector||!globalThis.FontInspector.enabled),this._reader=null,this._layoutTextLastFontSize=null,this._layoutTextLastFontFamily=null,this._layoutTextCtx=null,this._textDivProperties=new WeakMap,this._renderingDone=!1,this._canceled=!1,this._capability=(0,n.createPromiseCapability)(),this._renderTimer=null,this._bounds=[],this._capability.promise.finally(()=>{this._layoutTextCtx&&(this._layoutTextCtx.canvas.width=0,this._layoutTextCtx.canvas.height=0,this._layoutTextCtx=null)}).catch(()=>{})}return a.prototype={get promise(){return this._capability.promise},cancel:function(){this._canceled=!0,this._reader&&(this._reader.cancel(new n.AbortException("TextLayer task cancelled.")),this._reader=null),null!==this._renderTimer&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject(new Error("TextLayer task cancelled."))},_processItems(t,r){for(let n=0,s=t.length;n<s;n++)this._textContentItemsStr.push(t[n].str),e(this,t[n],r)},_layoutText(t){const e=this._textDivProperties.get(t);if(e.isWhitespace)return;let r="";if(0!==e.canvasWidth){const{fontSize:n,fontFamily:s}=t.style;n===this._layoutTextLastFontSize&&s===this._layoutTextLastFontFamily||(this._layoutTextCtx.font=`${n} ${s}`,this._layoutTextLastFontSize=n,this._layoutTextLastFontFamily=s);const{width:i}=this._layoutTextCtx.measureText(t.textContent);i>0&&(e.scale=e.canvasWidth/i,r=`scaleX(${e.scale})`)}0!==e.angle&&(r=`rotate(${e.angle}deg) ${r}`),r.length>0&&(this._enhanceTextSelection&&(e.originalTransform=r),t.style.transform=r),this._textDivProperties.set(t,e),this._container.appendChild(t)},_render:function(t){const e=(0,n.createPromiseCapability)();let s=Object.create(null);const i=document.createElement("canvas");if(i.mozOpaque=!0,this._layoutTextCtx=i.getContext("2d",{alpha:!1}),this._textContent){const t=this._textContent.items,r=this._textContent.styles;this._processItems(t,r),e.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');{const t=()=>{this._reader.read().then(({value:r,done:n})=>{n?e.resolve():(Object.assign(s,r.styles),this._processItems(r.items,s),t())},e.reject)};this._reader=this._textContentStream.getReader(),t()}}e.promise.then(()=>{s=null,t?this._renderTimer=setTimeout(()=>{r(this),this._renderTimer=null},t):r(this)},this._capability.reject)},expandTextDivs:function(t){if(!this._enhanceTextSelection||!this._renderingDone)return;null!==this._bounds&&(s(this),this._bounds=null);const e=[],r=[];for(var n=0,i=this._textDivs.length;n<i;n++){const s=this._textDivs[n],i=this._textDivProperties.get(s);i.isWhitespace||(t?(e.length=0,r.length=0,i.originalTransform&&e.push(i.originalTransform),i.paddingTop>0?(r.push(i.paddingTop+"px"),e.push(`translateY(${-i.paddingTop}px)`)):r.push(0),i.paddingRight>0?r.push(i.paddingRight/i.scale+"px"):r.push(0),i.paddingBottom>0?r.push(i.paddingBottom+"px"):r.push(0),i.paddingLeft>0?(r.push(i.paddingLeft/i.scale+"px"),e.push(`translateX(${-i.paddingLeft/i.scale}px)`)):r.push(0),s.style.padding=r.join(" "),e.length&&(s.style.transform=e.join(" "))):(s.style.padding=null,s.style.transform=i.originalTransform))}}},function(t){var e=new a({textContent:t.textContent,textContentStream:t.textContentStream,container:t.container,viewport:t.viewport,textDivs:t.textDivs,textContentItemsStr:t.textContentItemsStr,enhanceTextSelection:t.enhanceTextSelection});return e._render(t.timeout),e}}();e.renderTextLayer=s},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationLayer=void 0;var n=r(4),s=r(1);class i{static create(t){switch(t.data.annotationType){case s.AnnotationType.LINK:return new o(t);case s.AnnotationType.TEXT:return new l(t);case s.AnnotationType.WIDGET:switch(t.data.fieldType){case"Tx":return new h(t);case"Btn":return t.data.radioButton?new u(t):t.data.checkBox?new d(t):new p(t);case"Ch":return new f(t)}return new c(t);case s.AnnotationType.POPUP:return new g(t);case s.AnnotationType.FREETEXT:return new b(t);case s.AnnotationType.LINE:return new A(t);case s.AnnotationType.SQUARE:return new x(t);case s.AnnotationType.CIRCLE:return new _(t);case s.AnnotationType.POLYLINE:return new y(t);case s.AnnotationType.CARET:return new w(t);case s.AnnotationType.INK:return new S(t);case s.AnnotationType.POLYGON:return new v(t);case s.AnnotationType.HIGHLIGHT:return new C(t);case s.AnnotationType.UNDERLINE:return new k(t);case s.AnnotationType.SQUIGGLY:return new P(t);case s.AnnotationType.STRIKEOUT:return new R(t);case s.AnnotationType.STAMP:return new E(t);case s.AnnotationType.FILEATTACHMENT:return new T(t);default:return new a(t)}}}class a{constructor(t,e=!1,r=!1){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.page=t.page,this.viewport=t.viewport,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderInteractiveForms=t.renderInteractiveForms,this.svgFactory=t.svgFactory,e&&(this.container=this._createContainer(r))}_createContainer(t=!1){const e=this.data,r=this.page,n=this.viewport,i=document.createElement("section");let a=e.rect[2]-e.rect[0],o=e.rect[3]-e.rect[1];i.setAttribute("data-annotation-id",e.id);const l=s.Util.normalizeRect([e.rect[0],r.view[3]-e.rect[1]+r.view[1],e.rect[2],r.view[3]-e.rect[3]+r.view[1]]);if(i.style.transform=`matrix(${n.transform.join(",")})`,i.style.transformOrigin=`-${l[0]}px -${l[1]}px`,!t&&e.borderStyle.width>0){i.style.borderWidth=e.borderStyle.width+"px",e.borderStyle.style!==s.AnnotationBorderStyleType.UNDERLINE&&(a-=2*e.borderStyle.width,o-=2*e.borderStyle.width);const t=e.borderStyle.horizontalCornerRadius,r=e.borderStyle.verticalCornerRadius;if(t>0||r>0){const e=`${t}px / ${r}px`;i.style.borderRadius=e}switch(e.borderStyle.style){case s.AnnotationBorderStyleType.SOLID:i.style.borderStyle="solid";break;case s.AnnotationBorderStyleType.DASHED:i.style.borderStyle="dashed";break;case s.AnnotationBorderStyleType.BEVELED:(0,s.warn)("Unimplemented border style: beveled");break;case s.AnnotationBorderStyleType.INSET:(0,s.warn)("Unimplemented border style: inset");break;case s.AnnotationBorderStyleType.UNDERLINE:i.style.borderBottomStyle="solid"}e.color?i.style.borderColor=s.Util.makeCssRgb(0|e.color[0],0|e.color[1],0|e.color[2]):i.style.borderWidth=0}return i.style.left=l[0]+"px",i.style.top=l[1]+"px",i.style.width=a+"px",i.style.height=o+"px",i}_createPopup(t,e,r){e||((e=document.createElement("div")).style.height=t.style.height,e.style.width=t.style.width,t.appendChild(e));const n=new m({container:t,trigger:e,color:r.color,title:r.title,modificationDate:r.modificationDate,contents:r.contents,hideWrapper:!0}).render();n.style.left=t.style.width,t.appendChild(n)}render(){(0,s.unreachable)("Abstract method `AnnotationElement.render` called")}}class o extends a{constructor(t){super(t,!!(t.data.url||t.data.dest||t.data.action))}render(){this.container.className="linkAnnotation";const{data:t,linkService:e}=this,r=document.createElement("a");return t.url?(0,n.addLinkAttributes)(r,{url:t.url,target:t.newWindow?n.LinkTarget.BLANK:e.externalLinkTarget,rel:e.externalLinkRel,enabled:e.externalLinkEnabled}):t.action?this._bindNamedAction(r,t.action):this._bindLink(r,t.dest),this.container.appendChild(r),this.container}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.navigateTo(e),!1),e&&(t.className="internalLink")}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),t.className="internalLink"}}class l extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents))}render(){this.container.className="textAnnotation";const t=document.createElement("img");return t.style.height=this.container.style.height,t.style.width=this.container.style.width,t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.alt="[{{type}} Annotation]",t.dataset.l10nId="text_annotation_type",t.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(this.container,t,this.data),this.container.appendChild(t),this.container}}class c extends a{render(){return this.container}}class h extends c{constructor(t){super(t,t.renderInteractiveForms||!t.data.hasAppearance&&!!t.data.fieldValue)}render(){const t=["left","center","right"];this.container.className="textWidgetAnnotation";let e=null;if(this.renderInteractiveForms){if(this.data.multiLine?(e=document.createElement("textarea"),e.textContent=this.data.fieldValue):(e=document.createElement("input"),e.type="text",e.setAttribute("value",this.data.fieldValue)),e.disabled=this.data.readOnly,null!==this.data.maxLen&&(e.maxLength=this.data.maxLen),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/this.data.maxLen;e.classList.add("comb"),e.style.letterSpacing=`calc(${t}px - 1ch)`}}else{e=document.createElement("div"),e.textContent=this.data.fieldValue,e.style.verticalAlign="middle",e.style.display="table-cell";let t=null;this.data.fontRefName&&this.page.commonObjs.has(this.data.fontRefName)&&(t=this.page.commonObjs.get(this.data.fontRefName)),this._setTextStyle(e,t)}return null!==this.data.textAlignment&&(e.style.textAlign=t[this.data.textAlignment]),this.container.appendChild(e),this.container}_setTextStyle(t,e){const r=t.style;if(r.fontSize=this.data.fontSize+"px",r.direction=this.data.fontDirection<0?"rtl":"ltr",!e)return;let n="normal";e.black?n="900":e.bold&&(n="bold"),r.fontWeight=n,r.fontStyle=e.italic?"italic":"normal";const s=e.loadedName?`"${e.loadedName}", `:"",i=e.fallbackName||"Helvetica, sans-serif";r.fontFamily=s+i}}class d extends c{constructor(t){super(t,t.renderInteractiveForms)}render(){this.container.className="buttonWidgetAnnotation checkBox";const t=document.createElement("input");return t.disabled=this.data.readOnly,t.type="checkbox",this.data.fieldValue&&"Off"!==this.data.fieldValue&&t.setAttribute("checked",!0),this.container.appendChild(t),this.container}}class u extends c{constructor(t){super(t,t.renderInteractiveForms)}render(){this.container.className="buttonWidgetAnnotation radioButton";const t=document.createElement("input");return t.disabled=this.data.readOnly,t.type="radio",t.name=this.data.fieldName,this.data.fieldValue===this.data.buttonValue&&t.setAttribute("checked",!0),this.container.appendChild(t),this.container}}class p extends o{render(){const t=super.render();return t.className="buttonWidgetAnnotation pushButton",t}}class f extends c{constructor(t){super(t,t.renderInteractiveForms)}render(){this.container.className="choiceWidgetAnnotation";const t=document.createElement("select");t.disabled=this.data.readOnly,this.data.combo||(t.size=this.data.options.length,this.data.multiSelect&&(t.multiple=!0));for(const e of this.data.options){const r=document.createElement("option");r.textContent=e.displayValue,r.value=e.exportValue,this.data.fieldValue.includes(e.displayValue)&&r.setAttribute("selected",!0),t.appendChild(r)}return this.container.appendChild(t),this.container}}class g extends a{constructor(t){super(t,!(!t.data.title&&!t.data.contents))}render(){if(this.container.className="popupAnnotation",["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;const t=`[data-annotation-id="${this.data.parentId}"]`,e=this.layer.querySelector(t);if(!e)return this.container;const r=new m({container:this.container,trigger:e,color:this.data.color,title:this.data.title,modificationDate:this.data.modificationDate,contents:this.data.contents}),n=parseFloat(e.style.left),s=parseFloat(e.style.width);return this.container.style.transformOrigin=`-${n+s}px -${e.style.top}`,this.container.style.left=n+s+"px",this.container.appendChild(r.render()),this.container}}class m{constructor(t){this.container=t.container,this.trigger=t.trigger,this.color=t.color,this.title=t.title,this.modificationDate=t.modificationDate,this.contents=t.contents,this.hideWrapper=t.hideWrapper||!1,this.pinned=!1}render(){const t=document.createElement("div");t.className="popupWrapper",this.hideElement=this.hideWrapper?t:this.container,this.hideElement.setAttribute("hidden",!0);const e=document.createElement("div");e.className="popup";const r=this.color;if(r){const t=.7*(255-r[0])+r[0],n=.7*(255-r[1])+r[1],i=.7*(255-r[2])+r[2];e.style.backgroundColor=s.Util.makeCssRgb(0|t,0|n,0|i)}const i=document.createElement("h1");i.textContent=this.title,e.appendChild(i);const a=n.PDFDateString.toDateObject(this.modificationDate);if(a){const t=document.createElement("span");t.textContent="{{date}}, {{time}}",t.dataset.l10nId="annotation_date_string",t.dataset.l10nArgs=JSON.stringify({date:a.toLocaleDateString(),time:a.toLocaleTimeString()}),e.appendChild(t)}const o=this._formatContents(this.contents);return e.appendChild(o),this.trigger.addEventListener("click",this._toggle.bind(this)),this.trigger.addEventListener("mouseover",this._show.bind(this,!1)),this.trigger.addEventListener("mouseout",this._hide.bind(this,!1)),e.addEventListener("click",this._hide.bind(this,!0)),t.appendChild(e),t}_formatContents(t){const e=document.createElement("p"),r=t.split(/(?:\r\n?|\n)/);for(let t=0,n=r.length;t<n;++t){const s=r[t];e.appendChild(document.createTextNode(s)),t<n-1&&e.appendChild(document.createElement("br"))}return e}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(t=!1){t&&(this.pinned=!0),this.hideElement.hasAttribute("hidden")&&(this.hideElement.removeAttribute("hidden"),this.container.style.zIndex+=1)}_hide(t=!0){t&&(this.pinned=!1),this.hideElement.hasAttribute("hidden")||this.pinned||(this.hideElement.setAttribute("hidden",!0),this.container.style.zIndex-=1)}}class b extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0)}render(){return this.container.className="freeTextAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}class A extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0)}render(){this.container.className="lineAnnotation";const t=this.data,e=t.rect[2]-t.rect[0],r=t.rect[3]-t.rect[1],n=this.svgFactory.create(e,r),s=this.svgFactory.createElement("svg:line");return s.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),s.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),s.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),s.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),n.appendChild(s),this.container.append(n),this._createPopup(this.container,s,t),this.container}}class x extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0)}render(){this.container.className="squareAnnotation";const t=this.data,e=t.rect[2]-t.rect[0],r=t.rect[3]-t.rect[1],n=this.svgFactory.create(e,r),s=t.borderStyle.width,i=this.svgFactory.createElement("svg:rect");return i.setAttribute("x",s/2),i.setAttribute("y",s/2),i.setAttribute("width",e-s),i.setAttribute("height",r-s),i.setAttribute("stroke-width",s||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","none"),n.appendChild(i),this.container.append(n),this._createPopup(this.container,i,t),this.container}}class _ extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0)}render(){this.container.className="circleAnnotation";const t=this.data,e=t.rect[2]-t.rect[0],r=t.rect[3]-t.rect[1],n=this.svgFactory.create(e,r),s=t.borderStyle.width,i=this.svgFactory.createElement("svg:ellipse");return i.setAttribute("cx",e/2),i.setAttribute("cy",r/2),i.setAttribute("rx",e/2-s/2),i.setAttribute("ry",r/2-s/2),i.setAttribute("stroke-width",s||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","none"),n.appendChild(i),this.container.append(n),this._createPopup(this.container,i,t),this.container}}class y extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const t=this.data,e=t.rect[2]-t.rect[0],r=t.rect[3]-t.rect[1],n=this.svgFactory.create(e,r);let s=[];for(const e of t.vertices){const r=e.x-t.rect[0],n=t.rect[3]-e.y;s.push(r+","+n)}s=s.join(" ");const i=this.svgFactory.createElement(this.svgElementName);return i.setAttribute("points",s),i.setAttribute("stroke-width",t.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","none"),n.appendChild(i),this.container.append(n),this._createPopup(this.container,i,t),this.container}}class v extends y{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class w extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0)}render(){return this.container.className="caretAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}class S extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const t=this.data,e=t.rect[2]-t.rect[0],r=t.rect[3]-t.rect[1],n=this.svgFactory.create(e,r);for(const e of t.inkLists){let r=[];for(const n of e){const e=n.x-t.rect[0],s=t.rect[3]-n.y;r.push(`${e},${s}`)}r=r.join(" ");const s=this.svgFactory.createElement(this.svgElementName);s.setAttribute("points",r),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","none"),this._createPopup(this.container,s,t),n.appendChild(s)}return this.container.append(n),this.container}}class C extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0)}render(){return this.container.className="highlightAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}class k extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0)}render(){return this.container.className="underlineAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}class P extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0)}render(){return this.container.className="squigglyAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}class R extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0)}render(){return this.container.className="strikeoutAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}class E extends a{constructor(t){super(t,!!(t.data.hasPopup||t.data.title||t.data.contents),!0)}render(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(this.container,null,this.data),this.container}}class T extends a{constructor(t){super(t,!0);const{filename:e,content:r}=this.data.file;this.filename=(0,n.getFilenameFromUrl)(e),this.content=r,this.linkService.eventBus&&this.linkService.eventBus.dispatch("fileattachmentannotation",{source:this,id:(0,s.stringToPDFString)(e),filename:e,content:r})}render(){this.container.className="fileAttachmentAnnotation";const t=document.createElement("div");return t.style.height=this.container.style.height,t.style.width=this.container.style.width,t.addEventListener("dblclick",this._download.bind(this)),this.data.hasPopup||!this.data.title&&!this.data.contents||this._createPopup(this.container,t,this.data),this.container.appendChild(t),this.container}_download(){this.downloadManager?this.downloadManager.downloadData(this.content,this.filename,""):(0,s.warn)("Download cannot be started due to unavailable download manager")}}e.AnnotationLayer=class{static render(t){const e=[],r=[];for(const n of t.annotations)n&&(n.annotationType!==s.AnnotationType.POPUP?e.push(n):r.push(n));r.length&&e.push(...r);for(const r of e){const e=i.create({data:r,layer:t.div,page:t.page,viewport:t.viewport,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderInteractiveForms:t.renderInteractiveForms||!1,svgFactory:new n.DOMSVGFactory});e.isRenderable&&t.div.appendChild(e.render())}}static update(t){for(const e of t.annotations){const r=t.div.querySelector(`[data-annotation-id="${e.id}"]`);r&&(r.style.transform=`matrix(${t.viewport.transform.join(",")})`)}t.div.removeAttribute("hidden")}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SVGGraphics=void 0;var n=r(1),s=r(4),i=r(7);let a=function(){throw new Error("Not implemented: SVGGraphics")};e.SVGGraphics=a;{const t={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},r="http://www.w3.org/XML/1998/namespace",c="http://www.w3.org/1999/xlink",h=["butt","round","square"],d=["miter","round","bevel"],u=function(){const t=new Uint8Array([137,80,78,71,13,10,26,10]),e=new Int32Array(256);for(let t=0;t<256;t++){let r=t;for(let t=0;t<8;t++)r=1&r?3988292384^r>>1&2147483647:r>>1&2147483647;e[t]=r}function r(t,r,n,s){let i=s;const a=r.length;n[i]=a>>24&255,n[i+1]=a>>16&255,n[i+2]=a>>8&255,n[i+3]=255&a,i+=4,n[i]=255&t.charCodeAt(0),n[i+1]=255&t.charCodeAt(1),n[i+2]=255&t.charCodeAt(2),n[i+3]=255&t.charCodeAt(3),i+=4,n.set(r,i),i+=r.length;const o=function(t,r,n){let s=-1;for(let i=r;i<n;i++){const r=255&(s^t[i]);s=s>>>8^e[r]}return-1^s}(n,s+4,i);n[i]=o>>24&255,n[i+1]=o>>16&255,n[i+2]=o>>8&255,n[i+3]=255&o}function s(t){let e=t.length;const r=Math.ceil(e/65535),n=new Uint8Array(2+e+5*r+4);let s=0;n[s++]=120,n[s++]=156;let i=0;for(;e>65535;)n[s++]=0,n[s++]=255,n[s++]=255,n[s++]=0,n[s++]=0,n.set(t.subarray(i,i+65535),s),s+=65535,i+=65535,e-=65535;n[s++]=1,n[s++]=255&e,n[s++]=e>>8&255,n[s++]=255&~e,n[s++]=(65535&~e)>>8&255,n.set(t.subarray(i),s),s+=t.length-i;const a=function(t,e,r){let n=1,s=0;for(let i=e;i<r;++i)n=(n+(255&t[i]))%65521,s=(s+n)%65521;return s<<16|n}(t,0,t.length);return n[s++]=a>>24&255,n[s++]=a>>16&255,n[s++]=a>>8&255,n[s++]=255&a,n}function a(e,a,o,l){const c=e.width,h=e.height;let d,u,p;const f=e.data;switch(a){case n.ImageKind.GRAYSCALE_1BPP:u=0,d=1,p=c+7>>3;break;case n.ImageKind.RGB_24BPP:u=2,d=8,p=3*c;break;case n.ImageKind.RGBA_32BPP:u=6,d=8,p=4*c;break;default:throw new Error("invalid format")}const g=new Uint8Array((1+p)*h);let m=0,b=0;for(let t=0;t<h;++t)g[m++]=0,g.set(f.subarray(b,b+p),m),b+=p,m+=p;if(a===n.ImageKind.GRAYSCALE_1BPP&&l){m=0;for(let t=0;t<h;t++){m++;for(let t=0;t<p;t++)g[m++]^=255}}const A=new Uint8Array([c>>24&255,c>>16&255,c>>8&255,255&c,h>>24&255,h>>16&255,h>>8&255,255&h,d,u,0,0,0]),x=function(t){if(!i.isNodeJS)return s(t);try{let e;e=parseInt(process.versions.node)>=8?t:Buffer.from(t);const r=__webpack_require__(19).deflateSync(e,{level:9});return r instanceof Uint8Array?r:new Uint8Array(r)}catch(t){(0,n.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+t)}return s(t)}(g),_=t.length+36+A.length+x.length,y=new Uint8Array(_);let v=0;return y.set(t,v),v+=t.length,r("IHDR",A,y,v),v+=12+A.length,r("IDATA",x,y,v),v+=12+x.length,r("IEND",new Uint8Array(0),y,v),(0,n.createObjectURL)(y,"image/png",o)}return function(t,e,r){return a(t,void 0===t.kind?n.ImageKind.GRAYSCALE_1BPP:t.kind,e,r)}}();class p{constructor(){this.fontSizeScale=1,this.fontWeight=t.fontWeight,this.fontSize=0,this.textMatrix=n.IDENTITY_MATRIX,this.fontMatrix=n.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=n.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=t.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(t,e){this.x=t,this.y=e}}function o(t){if(Number.isInteger(t))return t.toString();const e=t.toFixed(10);let r=e.length-1;if("0"!==e[r])return e;do{r--}while("0"===e[r]);return e.substring(0,"."===e[r]?r:r+1)}function l(t){if(0===t[4]&&0===t[5]){if(0===t[1]&&0===t[2])return 1===t[0]&&1===t[3]?"":`scale(${o(t[0])} ${o(t[3])})`;if(t[0]===t[3]&&t[1]===-t[2])return`rotate(${o(180*Math.acos(t[0])/Math.PI)})`}else if(1===t[0]&&0===t[1]&&0===t[2]&&1===t[3])return`translate(${o(t[4])} ${o(t[5])})`;return`matrix(${o(t[0])} ${o(t[1])} ${o(t[2])} ${o(t[3])} ${o(t[4])} `+o(t[5])+")"}let f=0,g=0,m=0;e.SVGGraphics=a=class{constructor(t,e,r){this.svgFactory=new s.DOMSVGFactory,this.current=new p,this.transformMatrix=n.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=t,this.objs=e,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!r,this._operatorIdMapping=[];for(const t in n.OPS)this._operatorIdMapping[n.OPS[t]]=t}save(){this.transformStack.push(this.transformMatrix);const t=this.current;this.extraStack.push(t),this.current=t.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(t){this.save(),this.executeOpTree(t),this.restore()}loadDependencies(t){const e=t.fnArray,r=t.argsArray;for(let t=0,s=e.length;t<s;t++)if(e[t]===n.OPS.dependency)for(const e of r[t]){const t=e.startsWith("g_")?this.commonObjs:this.objs,r=new Promise(r=>{t.get(e,r)});this.current.dependencies.push(r)}return Promise.all(this.current.dependencies)}transform(t,e,r,s,i,a){const o=[t,e,r,s,i,a];this.transformMatrix=n.Util.transform(this.transformMatrix,o),this.tgrp=null}getSVG(t,e){this.viewport=e;const r=this._initialize(e);return this.loadDependencies(t).then(()=>(this.transformMatrix=n.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(t)),r))}convertOpList(t){const e=this._operatorIdMapping,r=t.argsArray,n=t.fnArray,s=[];for(let t=0,i=n.length;t<i;t++){const i=n[t];s.push({fnId:i,fn:e[i],args:r[t]})}return function(t){let e=[];const r=[];for(const n of t)"save"!==n.fn?"restore"===n.fn?e=r.pop():e.push(n):(e.push({fnId:92,fn:"group",items:[]}),r.push(e),e=e[e.length-1].items);return e}(s)}executeOpTree(t){for(const e of t){const t=e.fn,r=e.fnId,s=e.args;switch(0|r){case n.OPS.beginText:this.beginText();break;case n.OPS.dependency:break;case n.OPS.setLeading:this.setLeading(s);break;case n.OPS.setLeadingMoveText:this.setLeadingMoveText(s[0],s[1]);break;case n.OPS.setFont:this.setFont(s);break;case n.OPS.showText:case n.OPS.showSpacedText:this.showText(s[0]);break;case n.OPS.endText:this.endText();break;case n.OPS.moveText:this.moveText(s[0],s[1]);break;case n.OPS.setCharSpacing:this.setCharSpacing(s[0]);break;case n.OPS.setWordSpacing:this.setWordSpacing(s[0]);break;case n.OPS.setHScale:this.setHScale(s[0]);break;case n.OPS.setTextMatrix:this.setTextMatrix(s[0],s[1],s[2],s[3],s[4],s[5]);break;case n.OPS.setTextRise:this.setTextRise(s[0]);break;case n.OPS.setTextRenderingMode:this.setTextRenderingMode(s[0]);break;case n.OPS.setLineWidth:this.setLineWidth(s[0]);break;case n.OPS.setLineJoin:this.setLineJoin(s[0]);break;case n.OPS.setLineCap:this.setLineCap(s[0]);break;case n.OPS.setMiterLimit:this.setMiterLimit(s[0]);break;case n.OPS.setFillRGBColor:this.setFillRGBColor(s[0],s[1],s[2]);break;case n.OPS.setStrokeRGBColor:this.setStrokeRGBColor(s[0],s[1],s[2]);break;case n.OPS.setStrokeColorN:this.setStrokeColorN(s);break;case n.OPS.setFillColorN:this.setFillColorN(s);break;case n.OPS.shadingFill:this.shadingFill(s[0]);break;case n.OPS.setDash:this.setDash(s[0],s[1]);break;case n.OPS.setRenderingIntent:this.setRenderingIntent(s[0]);break;case n.OPS.setFlatness:this.setFlatness(s[0]);break;case n.OPS.setGState:this.setGState(s[0]);break;case n.OPS.fill:this.fill();break;case n.OPS.eoFill:this.eoFill();break;case n.OPS.stroke:this.stroke();break;case n.OPS.fillStroke:this.fillStroke();break;case n.OPS.eoFillStroke:this.eoFillStroke();break;case n.OPS.clip:this.clip("nonzero");break;case n.OPS.eoClip:this.clip("evenodd");break;case n.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case n.OPS.paintJpegXObject:this.paintJpegXObject(s[0],s[1],s[2]);break;case n.OPS.paintImageXObject:this.paintImageXObject(s[0]);break;case n.OPS.paintInlineImageXObject:this.paintInlineImageXObject(s[0]);break;case n.OPS.paintImageMaskXObject:this.paintImageMaskXObject(s[0]);break;case n.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(s[0],s[1]);break;case n.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case n.OPS.closePath:this.closePath();break;case n.OPS.closeStroke:this.closeStroke();break;case n.OPS.closeFillStroke:this.closeFillStroke();break;case n.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case n.OPS.nextLine:this.nextLine();break;case n.OPS.transform:this.transform(s[0],s[1],s[2],s[3],s[4],s[5]);break;case n.OPS.constructPath:this.constructPath(s[0],s[1]);break;case n.OPS.endPath:this.endPath();break;case 92:this.group(e.items);break;default:(0,n.warn)("Unimplemented operator "+t)}}}setWordSpacing(t){this.current.wordSpacing=t}setCharSpacing(t){this.current.charSpacing=t}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(t,e,r,n,s,i){const a=this.current;a.textMatrix=a.lineMatrix=[t,e,r,n,s,i],a.textMatrixScale=Math.sqrt(t*t+e*e),a.x=a.lineX=0,a.y=a.lineY=0,a.xcoords=[],a.tspan=this.svgFactory.createElement("svg:tspan"),a.tspan.setAttributeNS(null,"font-family",a.fontFamily),a.tspan.setAttributeNS(null,"font-size",o(a.fontSize)+"px"),a.tspan.setAttributeNS(null,"y",o(-a.y)),a.txtElement=this.svgFactory.createElement("svg:text"),a.txtElement.appendChild(a.tspan)}beginText(){const t=this.current;t.x=t.lineX=0,t.y=t.lineY=0,t.textMatrix=n.IDENTITY_MATRIX,t.lineMatrix=n.IDENTITY_MATRIX,t.textMatrixScale=1,t.tspan=this.svgFactory.createElement("svg:tspan"),t.txtElement=this.svgFactory.createElement("svg:text"),t.txtgrp=this.svgFactory.createElement("svg:g"),t.xcoords=[]}moveText(t,e){const r=this.current;r.x=r.lineX+=t,r.y=r.lineY+=e,r.xcoords=[],r.tspan=this.svgFactory.createElement("svg:tspan"),r.tspan.setAttributeNS(null,"font-family",r.fontFamily),r.tspan.setAttributeNS(null,"font-size",o(r.fontSize)+"px"),r.tspan.setAttributeNS(null,"y",o(-r.y))}showText(e){const s=this.current,i=s.font,a=s.fontSize;if(0===a)return;const c=s.charSpacing,h=s.wordSpacing,d=s.fontDirection,u=s.textHScale*d,p=i.vertical,f=a*s.fontMatrix[0];let g=0;for(const t of e){if(null===t){g+=d*h;continue}if((0,n.isNum)(t)){g+=-t*a*.001;continue}const e=t.width,r=t.fontChar,o=e*f+((t.isSpace?h:0)+c)*d;t.isInFont||i.missingFile?(s.xcoords.push(s.x+g),s.tspan.textContent+=r,g+=o):g+=o}p?s.y-=g*u:s.x+=g*u,s.tspan.setAttributeNS(null,"x",s.xcoords.map(o).join(" ")),s.tspan.setAttributeNS(null,"y",o(-s.y)),s.tspan.setAttributeNS(null,"font-family",s.fontFamily),s.tspan.setAttributeNS(null,"font-size",o(s.fontSize)+"px"),s.fontStyle!==t.fontStyle&&s.tspan.setAttributeNS(null,"font-style",s.fontStyle),s.fontWeight!==t.fontWeight&&s.tspan.setAttributeNS(null,"font-weight",s.fontWeight);const m=s.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;if(m===n.TextRenderingMode.FILL||m===n.TextRenderingMode.FILL_STROKE?(s.fillColor!==t.fillColor&&s.tspan.setAttributeNS(null,"fill",s.fillColor),s.fillAlpha<1&&s.tspan.setAttributeNS(null,"fill-opacity",s.fillAlpha)):s.textRenderingMode===n.TextRenderingMode.ADD_TO_PATH?s.tspan.setAttributeNS(null,"fill","transparent"):s.tspan.setAttributeNS(null,"fill","none"),m===n.TextRenderingMode.STROKE||m===n.TextRenderingMode.FILL_STROKE){const t=1/(s.textMatrixScale||1);this._setStrokeAttributes(s.tspan,t)}let b=s.textMatrix;0!==s.textRise&&(b=b.slice(),b[5]+=s.textRise),s.txtElement.setAttributeNS(null,"transform",`${l(b)} scale(${o(u)}, -1)`),s.txtElement.setAttributeNS(r,"xml:space","preserve"),s.txtElement.appendChild(s.tspan),s.txtgrp.appendChild(s.txtElement),this._ensureTransformGroup().appendChild(s.txtElement)}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}addFontStyle(t){this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.appendChild(this.cssStyle));const e=(0,n.createObjectURL)(t.data,t.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${t.loadedName}"; src: url(${e}); }\n`}setFont(t){const e=this.current,r=this.commonObjs.get(t[0]);let s=t[1];e.font=r,this.embedFonts&&r.data&&!this.embeddedFonts[r.loadedName]&&(this.addFontStyle(r),this.embeddedFonts[r.loadedName]=r),e.fontMatrix=r.fontMatrix?r.fontMatrix:n.FONT_IDENTITY_MATRIX;let i="normal";r.black?i="900":r.bold&&(i="bold");const a=r.italic?"italic":"normal";s<0?(s=-s,e.fontDirection=-1):e.fontDirection=1,e.fontSize=s,e.fontFamily=r.loadedName,e.fontWeight=i,e.fontStyle=a,e.tspan=this.svgFactory.createElement("svg:tspan"),e.tspan.setAttributeNS(null,"y",o(-e.y)),e.xcoords=[]}endText(){const t=this.current;t.textRenderingMode&n.TextRenderingMode.ADD_TO_PATH_FLAG&&t.txtElement&&t.txtElement.hasChildNodes()&&(t.element=t.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(t){t>0&&(this.current.lineWidth=t)}setLineCap(t){this.current.lineCap=h[t]}setLineJoin(t){this.current.lineJoin=d[t]}setMiterLimit(t){this.current.miterLimit=t}setStrokeAlpha(t){this.current.strokeAlpha=t}setStrokeRGBColor(t,e,r){this.current.strokeColor=n.Util.makeCssRgb(t,e,r)}setFillAlpha(t){this.current.fillAlpha=t}setFillRGBColor(t,e,r){this.current.fillColor=n.Util.makeCssRgb(t,e,r),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[]}setStrokeColorN(t){this.current.strokeColor=this._makeColorN_Pattern(t)}setFillColorN(t){this.current.fillColor=this._makeColorN_Pattern(t)}shadingFill(t){const e=this.viewport.width,r=this.viewport.height,s=n.Util.inverseTransform(this.transformMatrix),i=n.Util.applyTransform([0,0],s),a=n.Util.applyTransform([0,r],s),o=n.Util.applyTransform([e,0],s),l=n.Util.applyTransform([e,r],s),c=Math.min(i[0],a[0],o[0],l[0]),h=Math.min(i[1],a[1],o[1],l[1]),d=Math.max(i[0],a[0],o[0],l[0]),u=Math.max(i[1],a[1],o[1],l[1]),p=this.svgFactory.createElement("svg:rect");p.setAttributeNS(null,"x",c),p.setAttributeNS(null,"y",h),p.setAttributeNS(null,"width",d-c),p.setAttributeNS(null,"height",u-h),p.setAttributeNS(null,"fill",this._makeShadingPattern(t)),this._ensureTransformGroup().appendChild(p)}_makeColorN_Pattern(t){return"TilingPattern"===t[0]?this._makeTilingPattern(t):this._makeShadingPattern(t)}_makeTilingPattern(t){const e=t[1],r=t[2],s=t[3]||n.IDENTITY_MATRIX,[i,a,o,l]=t[4],c=t[5],h=t[6],d=t[7],u="shading"+m++,[p,f]=n.Util.applyTransform([i,a],s),[g,b]=n.Util.applyTransform([o,l],s),[A,x]=n.Util.singularValueDecompose2dScale(s),_=c*A,y=h*x,v=this.svgFactory.createElement("svg:pattern");v.setAttributeNS(null,"id",u),v.setAttributeNS(null,"patternUnits","userSpaceOnUse"),v.setAttributeNS(null,"width",_),v.setAttributeNS(null,"height",y),v.setAttributeNS(null,"x",""+p),v.setAttributeNS(null,"y",""+f);const w=this.svg,S=this.transformMatrix,C=this.current.fillColor,k=this.current.strokeColor,P=this.svgFactory.create(g-p,b-f);if(this.svg=P,this.transformMatrix=s,2===d){const t=n.Util.makeCssRgb(...e);this.current.fillColor=t,this.current.strokeColor=t}return this.executeOpTree(this.convertOpList(r)),this.svg=w,this.transformMatrix=S,this.current.fillColor=C,this.current.strokeColor=k,v.appendChild(P.childNodes[0]),this.defs.appendChild(v),`url(#${u})`}_makeShadingPattern(t){switch(t[0]){case"RadialAxial":const e="shading"+m++,r=t[3];let s;switch(t[1]){case"axial":const r=t[4],n=t[5];s=this.svgFactory.createElement("svg:linearGradient"),s.setAttributeNS(null,"id",e),s.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),s.setAttributeNS(null,"x1",r[0]),s.setAttributeNS(null,"y1",r[1]),s.setAttributeNS(null,"x2",n[0]),s.setAttributeNS(null,"y2",n[1]);break;case"radial":const i=t[4],a=t[5],o=t[6],l=t[7];s=this.svgFactory.createElement("svg:radialGradient"),s.setAttributeNS(null,"id",e),s.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),s.setAttributeNS(null,"cx",a[0]),s.setAttributeNS(null,"cy",a[1]),s.setAttributeNS(null,"r",l),s.setAttributeNS(null,"fx",i[0]),s.setAttributeNS(null,"fy",i[1]),s.setAttributeNS(null,"fr",o);break;default:throw new Error("Unknown RadialAxial type: "+t[1])}for(const t of r){const e=this.svgFactory.createElement("svg:stop");e.setAttributeNS(null,"offset",t[0]),e.setAttributeNS(null,"stop-color",t[1]),s.appendChild(e)}return this.defs.appendChild(s),`url(#${e})`;case"Mesh":return(0,n.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error("Unknown IR type: "+t[0])}}setDash(t,e){this.current.dashArray=t,this.current.dashPhase=e}constructPath(t,e){const r=this.current;let s=r.x,i=r.y,a=[],l=0;for(const r of t)switch(0|r){case n.OPS.rectangle:s=e[l++],i=e[l++];const t=s+e[l++],r=i+e[l++];a.push("M",o(s),o(i),"L",o(t),o(i),"L",o(t),o(r),"L",o(s),o(r),"Z");break;case n.OPS.moveTo:s=e[l++],i=e[l++],a.push("M",o(s),o(i));break;case n.OPS.lineTo:s=e[l++],i=e[l++],a.push("L",o(s),o(i));break;case n.OPS.curveTo:s=e[l+4],i=e[l+5],a.push("C",o(e[l]),o(e[l+1]),o(e[l+2]),o(e[l+3]),o(s),o(i)),l+=6;break;case n.OPS.curveTo2:a.push("C",o(s),o(i),o(e[l]),o(e[l+1]),o(e[l+2]),o(e[l+3])),s=e[l+2],i=e[l+3],l+=4;break;case n.OPS.curveTo3:s=e[l+2],i=e[l+3],a.push("C",o(e[l]),o(e[l+1]),o(s),o(i),o(s),o(i)),l+=4;break;case n.OPS.closePath:a.push("Z")}a=a.join(" "),r.path&&t.length>0&&t[0]!==n.OPS.rectangle&&t[0]!==n.OPS.moveTo?a=r.path.getAttributeNS(null,"d")+a:(r.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().appendChild(r.path)),r.path.setAttributeNS(null,"d",a),r.path.setAttributeNS(null,"fill","none"),r.element=r.path,r.setCurrentPoint(s,i)}endPath(){const t=this.current;if(t.path=null,!this.pendingClip)return;if(!t.element)return void(this.pendingClip=null);const e="clippath"+f++,r=this.svgFactory.createElement("svg:clipPath");r.setAttributeNS(null,"id",e),r.setAttributeNS(null,"transform",l(this.transformMatrix));const n=t.element.cloneNode(!0);"evenodd"===this.pendingClip?n.setAttributeNS(null,"clip-rule","evenodd"):n.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,r.appendChild(n),this.defs.appendChild(r),t.activeClipUrl&&(t.clipGroup=null,this.extraStack.forEach((function(t){t.clipGroup=null})),r.setAttributeNS(null,"clip-path",t.activeClipUrl)),t.activeClipUrl=`url(#${e})`,this.tgrp=null}clip(t){this.pendingClip=t}closePath(){const t=this.current;if(t.path){const e=t.path.getAttributeNS(null,"d")+"Z";t.path.setAttributeNS(null,"d",e)}}setLeading(t){this.current.leading=-t}setTextRise(t){this.current.textRise=t}setTextRenderingMode(t){this.current.textRenderingMode=t}setHScale(t){this.current.textHScale=t/100}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,r]of t)switch(e){case"LW":this.setLineWidth(r);break;case"LC":this.setLineCap(r);break;case"LJ":this.setLineJoin(r);break;case"ML":this.setMiterLimit(r);break;case"D":this.setDash(r[0],r[1]);break;case"RI":this.setRenderingIntent(r);break;case"FL":this.setFlatness(r);break;case"Font":this.setFont(r);break;case"CA":this.setStrokeAlpha(r);break;case"ca":this.setFillAlpha(r);break;default:(0,n.warn)("Unimplemented graphic state operator "+e)}}fill(){const t=this.current;t.element&&(t.element.setAttributeNS(null,"fill",t.fillColor),t.element.setAttributeNS(null,"fill-opacity",t.fillAlpha),this.endPath())}stroke(){const t=this.current;t.element&&(this._setStrokeAttributes(t.element),t.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(t,e=1){const r=this.current;let n=r.dashArray;1!==e&&n.length>0&&(n=n.map((function(t){return e*t}))),t.setAttributeNS(null,"stroke",r.strokeColor),t.setAttributeNS(null,"stroke-opacity",r.strokeAlpha),t.setAttributeNS(null,"stroke-miterlimit",o(r.miterLimit)),t.setAttributeNS(null,"stroke-linecap",r.lineCap),t.setAttributeNS(null,"stroke-linejoin",r.lineJoin),t.setAttributeNS(null,"stroke-width",o(e*r.lineWidth)+"px"),t.setAttributeNS(null,"stroke-dasharray",n.map(o).join(" ")),t.setAttributeNS(null,"stroke-dashoffset",o(e*r.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const t=this.svgFactory.createElement("svg:rect");t.setAttributeNS(null,"x","0"),t.setAttributeNS(null,"y","0"),t.setAttributeNS(null,"width","1px"),t.setAttributeNS(null,"height","1px"),t.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().appendChild(t)}paintJpegXObject(t,e,r){const n=this.objs.get(t),s=this.svgFactory.createElement("svg:image");s.setAttributeNS(c,"xlink:href",n.src),s.setAttributeNS(null,"width",o(e)),s.setAttributeNS(null,"height",o(r)),s.setAttributeNS(null,"x","0"),s.setAttributeNS(null,"y",o(-r)),s.setAttributeNS(null,"transform",`scale(${o(1/e)} ${o(-1/r)})`),this._ensureTransformGroup().appendChild(s)}paintImageXObject(t){const e=this.objs.get(t);e?this.paintInlineImageXObject(e):(0,n.warn)(`Dependent image with object ID ${t} is not ready yet`)}paintInlineImageXObject(t,e){const r=t.width,n=t.height,s=u(t,this.forceDataSchema,!!e),i=this.svgFactory.createElement("svg:rect");i.setAttributeNS(null,"x","0"),i.setAttributeNS(null,"y","0"),i.setAttributeNS(null,"width",o(r)),i.setAttributeNS(null,"height",o(n)),this.current.element=i,this.clip("nonzero");const a=this.svgFactory.createElement("svg:image");a.setAttributeNS(c,"xlink:href",s),a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y",o(-n)),a.setAttributeNS(null,"width",o(r)+"px"),a.setAttributeNS(null,"height",o(n)+"px"),a.setAttributeNS(null,"transform",`scale(${o(1/r)} ${o(-1/n)})`),e?e.appendChild(a):this._ensureTransformGroup().appendChild(a)}paintImageMaskXObject(t){const e=this.current,r=t.width,n=t.height,s=e.fillColor;e.maskId="mask"+g++;const i=this.svgFactory.createElement("svg:mask");i.setAttributeNS(null,"id",e.maskId);const a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y","0"),a.setAttributeNS(null,"width",o(r)),a.setAttributeNS(null,"height",o(n)),a.setAttributeNS(null,"fill",s),a.setAttributeNS(null,"mask",`url(#${e.maskId})`),this.defs.appendChild(i),this._ensureTransformGroup().appendChild(a),this.paintInlineImageXObject(t,i)}paintFormXObjectBegin(t,e){if(Array.isArray(t)&&6===t.length&&this.transform(t[0],t[1],t[2],t[3],t[4],t[5]),e){const t=e[2]-e[0],r=e[3]-e[1],n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x",e[0]),n.setAttributeNS(null,"y",e[1]),n.setAttributeNS(null,"width",o(t)),n.setAttributeNS(null,"height",o(r)),this.current.element=n,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(t){const e=this.svgFactory.create(t.width,t.height),r=this.svgFactory.createElement("svg:defs");e.appendChild(r),this.defs=r;const n=this.svgFactory.createElement("svg:g");return n.setAttributeNS(null,"transform",l(t.transform)),e.appendChild(n),this.svg=n,e}_ensureClipGroup(){if(!this.current.clipGroup){const t=this.svgFactory.createElement("svg:g");t.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.appendChild(t),this.current.clipGroup=t}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",l(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().appendChild(this.tgrp):this.svg.appendChild(this.tgrp)),this.tgrp}}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PDFNodeStream=void 0;var n=r(1),s=r(20);const i=__webpack_require__(20),a=__webpack_require__(21),o=__webpack_require__(22),l=__webpack_require__(23),c=/^file:\/\/\/[a-zA-Z]:\//;e.PDFNodeStream=class{constructor(t){this.source=t,this.url=function(t){const e=l.parse(t);return"file:"===e.protocol||e.host?e:/^[a-z]:[/\\]/i.test(t)?l.parse("file:///"+t):(e.host||(e.protocol="file:"),e)}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?this._fullRequestReader._loaded:0}getFullReader(){return(0,n.assert)(!this._fullRequestReader),this._fullRequestReader=this.isFsUrl?new g(this):new p(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const r=this.isFsUrl?new m(this,t,e):new f(this,t,e);return this._rangeRequestReaders.push(r),r}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t),this._rangeRequestReaders.slice(0).forEach((function(e){e.cancel(t)}))}};class h{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=(0,n.createPromiseCapability)(),this._headersCapability=(0,n.createPromiseCapability)()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return null===t?(this._readCapability=(0,n.createPromiseCapability)(),this.read()):(this._loaded+=t.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new n.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class d{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,n.createPromiseCapability)();const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return null===t?(this._readCapability=(0,n.createPromiseCapability)(),this.read()):(this._loaded+=t.length,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function u(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class p extends h{constructor(t){super(t);const e=e=>{if(404===e.statusCode){const t=new n.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=t,void this._headersCapability.reject(t)}this._headersCapability.resolve(),this._setReadableStream(e);const r=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:i,suggestedLength:a}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:r,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=i,this._contentLength=a||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(r)};this._request=null,"http:"===this._url.protocol?this._request=a.request(u(this._url,t.httpHeaders),e):this._request=o.request(u(this._url,t.httpHeaders),e),this._request.on("error",t=>{this._storedError=t,this._headersCapability.reject(t)}),this._request.end()}}class f extends d{constructor(t,e,r){super(t),this._httpHeaders={};for(const e in t.httpHeaders){const r=t.httpHeaders[e];void 0!==r&&(this._httpHeaders[e]=r)}this._httpHeaders.Range=`bytes=${e}-${r-1}`;const s=t=>{if(404!==t.statusCode)this._setReadableStream(t);else{const t=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=t}};this._request=null,"http:"===this._url.protocol?this._request=a.request(u(this._url,this._httpHeaders),s):this._request=o.request(u(this._url,this._httpHeaders),s),this._request.on("error",t=>{this._storedError=t}),this._request.end()}}class g extends h{constructor(t){super(t);let e=decodeURIComponent(this._url.path);c.test(this._url.href)&&(e=e.replace(/^\//,"")),i.lstat(e,(t,r)=>{if(t)return"ENOENT"===t.code&&(t=new n.MissingPDFException(`Missing PDF "${e}".`)),this._storedError=t,void this._headersCapability.reject(t);this._contentLength=r.size,this._setReadableStream(i.createReadStream(e)),this._headersCapability.resolve()})}}class m extends d{constructor(t,e,r){super(t);let n=decodeURIComponent(this._url.path);c.test(this._url.href)&&(n=n.replace(/^\//,"")),this._setReadableStream(i.createReadStream(n,{start:e,end:r-1}))}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createResponseStatusError=function(t,e){return 404===t||0===t&&e.startsWith("file:")?new n.MissingPDFException('Missing PDF "'+e+'".'):new n.UnexpectedResponseException("Unexpected server response ("+t+') while retrieving PDF "'+e+'".',t)},e.extractFilenameFromHeader=function(t){const e=t("Content-Disposition");if(e){let t=(0,s.getFilenameFromContentDispositionHeader)(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(t){}if(/\.pdf$/i.test(t))return t}return null},e.validateRangeRequestCapabilities=function({getResponseHeader:t,isHttp:e,rangeChunkSize:r,disableRange:s}){(0,n.assert)(r>0,"Range chunk size must be larger than zero");const i={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(t("Content-Length"),10);return Number.isInteger(a)?(i.suggestedLength=a,a<=2*r||s||!e||"bytes"!==t("Accept-Ranges")||"identity"!==(t("Content-Encoding")||"identity")||(i.allowRangeRequests=!0),i):i},e.validateResponseStatus=function(t){return 200===t||206===t};var n=r(1),s=r(21)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getFilenameFromContentDispositionHeader=function(t){let e=!0,r=n("filename\\*","i").exec(t);if(r){r=r[1];let t=a(r);return t=unescape(t),t=o(t),t=l(t),i(t)}if(r=function(t){const e=[];let r;const s=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(r=s.exec(t));){let[,t,n,s]=r;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[n,s]}const i=[];for(let t=0;t<e.length&&t in e;++t){let[r,n]=e[t];n=a(n),r&&(n=unescape(n),0===t&&(n=o(n))),i.push(n)}return i.join("")}(t),r)return i(l(r));if(r=n("filename","i").exec(t),r){r=r[1];let t=a(r);return t=l(t),i(t)}function n(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function s(t,r){if(t){if(!/^[\x00-\xFF]+$/.test(r))return r;try{const n=new TextDecoder(t,{fatal:!0}),s=Array.from(r,(function(t){return 255&t.charCodeAt(0)}));r=n.decode(new Uint8Array(s)),e=!1}catch(n){if(/^utf-?8$/i.test(t))try{r=decodeURIComponent(escape(r)),e=!1}catch(t){}}}return r}function i(t){return e&&/[\x80-\xff]/.test(t)&&(t=s("utf-8",t),e&&(t=s("iso-8859-1",t))),t}function a(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const r=e[t].indexOf('"');-1!==r&&(e[t]=e[t].slice(0,r),e.length=t+1),e[t]=e[t].replace(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){const e=t.indexOf("'");return-1===e?t:s(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(t,e,r,n){if("q"===r||"Q"===r)return s(e,n=(n=n.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,(function(t,e){return String.fromCharCode(parseInt(e,16))})));try{n=atob(n)}catch(t){}return s(e,n)}))}return""}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PDFNetworkStream=void 0;var n=r(1),s=r(20);class i{constructor(t,e){this.url=t,e=e||{},this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&e.httpHeaders||{},this.withCredentials=e.withCredentials||!1,this.getXhr=e.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,r){const n={begin:t,end:e};for(const t in r)n[t]=r[t];return this.request(n)}requestFull(t){return this.request(t)}request(t){const e=this.getXhr(),r=this.currXhrId++,n=this.pendingRequests[r]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const t in this.httpHeaders){const r=this.httpHeaders[t];void 0!==r&&e.setRequestHeader(t,r)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),n.expectedStatus=206):n.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(r){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,r),e.onprogress=this.onProgress.bind(this,r),n.onHeadersReceived=t.onHeadersReceived,n.onDone=t.onDone,n.onError=t.onError,n.onProgress=t.onProgress,e.send(null),r}onProgress(t,e){const r=this.pendingRequests[t];r&&r.onProgress&&r.onProgress(e)}onStateChange(t,e){const r=this.pendingRequests[t];if(!r)return;const s=r.xhr;if(s.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),4!==s.readyState)return;if(!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===s.status&&this.isHttp)return void(r.onError&&r.onError(s.status));const i=s.status||200;if((200!==i||206!==r.expectedStatus)&&i!==r.expectedStatus)return void(r.onError&&r.onError(s.status));const a=function(t){const e=t.response;return"string"!=typeof e?e:(0,n.stringToBytes)(e).buffer}(s);if(206===i){const t=s.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);r.onDone({begin:parseInt(e[1],10),chunk:a})}else a?r.onDone({begin:0,chunk:a}):r.onError&&r.onError(s.status)}hasPendingRequests(){for(const t in this.pendingRequests)return!0;return!1}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortAllRequests(){for(const t in this.pendingRequests)this.abortRequest(0|t)}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}e.PDFNetworkStream=class{constructor(t){this._source=t,this._manager=new i(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return(0,n.assert)(!this._fullRequestReader),this._fullRequestReader=new a(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const r=new o(this._manager,t,e);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t),this._rangeRequestReaders.slice(0).forEach((function(e){e.cancel(t)}))}};class a{constructor(t,e){this._manager=t;const r={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(r),this._headersReceivedCapability=(0,n.createPromiseCapability)(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t),r=t=>e.getResponseHeader(t),{allowRangeRequests:n,suggestedLength:i}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:r,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=i||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(r),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,this._cachedChunks.length>0||(this._requests.forEach((function(t){t.resolve({value:void 0,done:!0})})),this._requests=[])}_onError(t){const e=this._url,r=(0,s.createResponseStatusError)(t,e);this._storedError=r,this._headersReceivedCapability.reject(r),this._requests.forEach((function(t){t.reject(r)})),this._requests=[],this._cachedChunks=[]}_onProgress(t){this.onProgress&&this.onProgress({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=(0,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t),this._requests.forEach((function(t){t.resolve({value:void 0,done:!0})})),this._requests=[],this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class o{constructor(t,e,r){this._manager=t;const n={onDone:this._onDone.bind(this),onProgress:this._onProgress.bind(this)};this._requestId=t.requestRange(e,r,n),this._requests=[],this._queuedChunk=null,this._done=!1,this.onProgress=null,this.onClosed=null}_close(){this.onClosed&&this.onClosed(this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,this._requests.forEach((function(t){t.resolve({value:void 0,done:!0})})),this._requests=[],this._close()}_onProgress(t){!this.isStreamingSupported&&this.onProgress&&this.onProgress({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=(0,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._requests.forEach((function(t){t.resolve({value:void 0,done:!0})})),this._requests=[],this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PDFFetchStream=void 0;var n=r(1),s=r(20);function i(t,e,r){return{method:"GET",headers:t,signal:r&&r.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function a(t){const e=new Headers;for(const r in t){const n=t[r];void 0!==n&&e.append(r,n)}return e}e.PDFFetchStream=class{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?this._fullRequestReader._loaded:0}getFullReader(){return(0,n.assert)(!this._fullRequestReader),this._fullRequestReader=new o(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const r=new l(this,t,e);return this._rangeRequestReaders.push(r),r}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t),this._rangeRequestReaders.slice(0).forEach((function(e){e.cancel(t)}))}};class o{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=(0,n.createPromiseCapability)(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),"undefined"!=typeof AbortController&&(this._abortController=new AbortController),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._headers=a(this._stream.httpHeaders);const r=e.url;fetch(r,i(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!(0,s.validateResponseStatus)(t.status))throw(0,s.createResponseStatusError)(t.status,r);this._reader=t.body.getReader(),this._headersCapability.resolve();const e=e=>t.headers.get(e),{allowRangeRequests:i,suggestedLength:a}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=i,this._contentLength=a||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(e),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new n.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._reader&&this._reader.cancel(t),this._abortController&&this._abortController.abort()}}class l{constructor(t,e,r){this._stream=t,this._reader=null,this._loaded=0;const o=t.source;this._withCredentials=o.withCredentials||!1,this._readCapability=(0,n.createPromiseCapability)(),this._isStreamingSupported=!o.disableStream,"undefined"!=typeof AbortController&&(this._abortController=new AbortController),this._headers=a(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${r-1}`);const l=o.url;fetch(l,i(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!(0,s.validateResponseStatus)(t.status))throw(0,s.createResponseStatusError)(t.status,l);this._readCapability.resolve(),this._reader=t.body.getReader()}),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._reader&&this._reader.cancel(t),this._abortController&&this._abortController.abort()}}}])},module.exports=factory()}).call(this,__webpack_require__(13),__webpack_require__(14).Buffer)},function(t,e,r){"use strict";var n,s=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},i=function(){var t={};return function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}t[e]=r}return t[e]}}(),a=[];function o(t){for(var e=-1,r=0;r<a.length;r++)if(a[r].identifier===t){e=r;break}return e}function l(t,e){for(var r={},n=[],s=0;s<t.length;s++){var i=t[s],l=e.base?i[0]+e.base:i[0],c=r[l]||0,h="".concat(l," ").concat(c);r[l]=c+1;var d=o(h),u={css:i[1],media:i[2],sourceMap:i[3]};-1!==d?(a[d].references++,a[d].updater(u)):a.push({identifier:h,updater:m(u,e),references:1}),n.push(h)}return n}function c(t){var e=document.createElement("style"),n=t.attributes||{};if(void 0===n.nonce){var s=r.nc;s&&(n.nonce=s)}if(Object.keys(n).forEach((function(t){e.setAttribute(t,n[t])})),"function"==typeof t.insert)t.insert(e);else{var a=i(t.insert||"head");if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");a.appendChild(e)}return e}var h,d=(h=[],function(t,e){return h[t]=e,h.filter(Boolean).join("\n")});function u(t,e,r,n){var s=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(t.styleSheet)t.styleSheet.cssText=d(e,s);else{var i=document.createTextNode(s),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function p(t,e,r){var n=r.css,s=r.media,i=r.sourceMap;if(s?t.setAttribute("media",s):t.removeAttribute("media"),i&&btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var f=null,g=0;function m(t,e){var r,n,s;if(e.singleton){var i=g++;r=f||(f=c(e)),n=u.bind(null,r,i,!1),s=u.bind(null,r,i,!0)}else r=c(e),n=p.bind(null,r,e),s=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(r)};return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else s()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=s());var r=l(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var n=0;n<r.length;n++){var s=o(r[n]);a[s].references--}for(var i=l(t,e),c=0;c<r.length;c++){var h=o(r[c]);0===a[h].references&&(a[h].updater(),a.splice(h,1))}r=i}}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));var n=r(3),s=r.n(n),i=r(0);class a{document;canvases=[];style;popup;constructor(){"undefined"!=typeof DEVELOPMENT&&DEVELOPMENT?s.a.GlobalWorkerOptions.workerSrc="https://localhost:8080/pdf.worker.js":s.a.GlobalWorkerOptions.workerSrc="https://gistcdn.githack.com/Buntelrus/1508cb9c1de48da29c03a9b278042697/raw/pdf.worker.js",this.style=document.querySelector(i.a.style)}loadDocument(t){return s.a.getDocument({url:t}).promise.then(t=>{console.log("pdf loaded!",t),this.document=t,this.canvases=[];const e=[];let r=1;for(;r<=t.numPages;)e.push(t.getPage(r++).then(t=>(console.log("page loaded!",t),this.renderPage(t).promise.then(()=>{console.log("page rendered")}))));return Promise.all(e)})}renderPage(t){const e=t.getViewport({scale:3}),r=document.createElement("canvas");this.canvases.push(r);const n=r.getContext("2d");return r.height=e.height,r.width=e.width,t.render({canvasContext:n,viewport:e})}afterPrint(){this.popup.close()}showPdf(t=!1){console.log("show pdf");if(this.popup=window.open(),this.popup.document.head.append(this.style),this.popup.document.body.classList.add("pr"),this.popup.addEventListener("afterprint",this.afterPrint.bind(this)),this.canvases.forEach(t=>{t.classList.add("pr"),this.popup.document.body.append(t)}),t)this.popup.print();else{const t=document.createElement("button");t.innerText="drucken",t.classList.add("pr"),t.addEventListener("click",()=>{this.popup.print()}),this.popup.document.body.append(t)}}}},function(t,e,r){"use strict";r.d(e,"a",(function(){return s}));var n=r(0);function s(t){return fetch(t).then(t=>t.text()).then(t=>{const e=(new DOMParser).parseFromString(t,"text/html"),r=e.querySelector(n.a.swrFollowArticleLink);return r?s(r.href):e})}},function(t,e,r){var n=r(4),s=r(8);"string"==typeof(s=s.__esModule?s.default:s)&&(s=[[t.i,s,""]]);var i={insert:"head",singleton:!1};n(s,i);t.exports=s.locals||{}},function(t,e,r){"use strict";r.r(e);var n=r(1),s=r.n(n)()(!1);s.push([t.i,".dot-elastic{position:relative;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-elastic 1s infinite linear}.dot-elastic::before,.dot-elastic::after{content:'';display:inline-block;position:absolute;top:0}.dot-elastic::before{left:-15px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-elastic-before 1s infinite linear}.dot-elastic::after{left:15px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-elastic-after 1s infinite linear}@keyframes dot-elastic-before{0%{transform:scale(1, 1)}25%{transform:scale(1, 1.5)}50%{transform:scale(1, 0.67)}75%{transform:scale(1, 1)}100%{transform:scale(1, 1)}}@keyframes dot-elastic{0%{transform:scale(1, 1)}25%{transform:scale(1, 1)}50%{transform:scale(1, 1.5)}75%{transform:scale(1, 1)}100%{transform:scale(1, 1)}}@keyframes dot-elastic-after{0%{transform:scale(1, 1)}25%{transform:scale(1, 1)}50%{transform:scale(1, 0.67)}75%{transform:scale(1, 1.5)}100%{transform:scale(1, 1)}}.dot-pulse{position:relative;left:-9999px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;box-shadow:9999px 0 0 -5px #fa7d19;animation:dot-pulse 1.5s infinite linear;animation-delay:.25s}.dot-pulse::before,.dot-pulse::after{content:'';display:inline-block;position:absolute;top:0;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19}.dot-pulse::before{box-shadow:9984px 0 0 -5px #fa7d19;animation:dot-pulse-before 1.5s infinite linear;animation-delay:0s}.dot-pulse::after{box-shadow:10014px 0 0 -5px #fa7d19;animation:dot-pulse-after 1.5s infinite linear;animation-delay:.5s}@keyframes dot-pulse-before{0%{box-shadow:9984px 0 0 -5px #fa7d19}30%{box-shadow:9984px 0 0 2px #fa7d19}60%,100%{box-shadow:9984px 0 0 -5px #fa7d19}}@keyframes dot-pulse{0%{box-shadow:9999px 0 0 -5px #fa7d19}30%{box-shadow:9999px 0 0 2px #fa7d19}60%,100%{box-shadow:9999px 0 0 -5px #fa7d19}}@keyframes dot-pulse-after{0%{box-shadow:10014px 0 0 -5px #fa7d19}30%{box-shadow:10014px 0 0 2px #fa7d19}60%,100%{box-shadow:10014px 0 0 -5px #fa7d19}}.dot-flashing{position:relative;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-flashing 1s infinite linear alternate;animation-delay:.5s}.dot-flashing::before,.dot-flashing::after{content:'';display:inline-block;position:absolute;top:0}.dot-flashing::before{left:-15px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-flashing 1s infinite alternate;animation-delay:0s}.dot-flashing::after{left:15px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-flashing 1s infinite alternate;animation-delay:1s}@keyframes dot-flashing{0%{background-color:#fa7d19}50%,100%{background-color:#fcb57d}}.dot-collision{position:relative;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19}.dot-collision::before,.dot-collision::after{content:'';display:inline-block;position:absolute;top:0}.dot-collision::before{left:-10px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-collision-before 2s infinite ease-in}.dot-collision::after{left:10px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-collision-after 2s infinite ease-in;animation-delay:1s}@keyframes dot-collision-before{0%,50%,75%,100%{transform:translateX(0)}25%{transform:translateX(-15px)}}@keyframes dot-collision-after{0%,50%,75%,100%{transform:translateX(0)}25%{transform:translateX(15px)}}.dot-revolution{position:relative;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19}.dot-revolution::before,.dot-revolution::after{content:'';display:inline-block;position:absolute}.dot-revolution::before{left:0;top:-15px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;transform-origin:5px 20px;animation:dot-revolution 1.4s linear infinite}.dot-revolution::after{left:0;top:-30px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;transform-origin:5px 35px;animation:dot-revolution 1s linear infinite}@keyframes dot-revolution{0%{transform:rotateZ(0deg) translate3d(0, 0, 0)}100%{transform:rotateZ(360deg) translate3d(0, 0, 0)}}.dot-carousel{position:relative;left:-9999px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;box-shadow:9984px 0 0 0 #fa7d19,9999px 0 0 0 #fa7d19,10014px 0 0 0 #fa7d19;animation:dot-carousel 1.5s infinite linear}@keyframes dot-carousel{0%{box-shadow:9984px 0 0 -1px #fa7d19,9999px 0 0 1px #fa7d19,10014px 0 0 -1px #fa7d19}50%{box-shadow:10014px 0 0 -1px #fa7d19,9984px 0 0 -1px #fa7d19,9999px 0 0 1px #fa7d19}100%{box-shadow:9999px 0 0 1px #fa7d19,10014px 0 0 -1px #fa7d19,9984px 0 0 -1px #fa7d19}}.dot-typing{position:relative;left:-9999px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;box-shadow:9984px 0 0 0 #fa7d19,9999px 0 0 0 #fa7d19,10014px 0 0 0 #fa7d19;animation:dot-typing 1.5s infinite linear}@keyframes dot-typing{0%{box-shadow:9984px 0 0 0 #fa7d19,9999px 0 0 0 #fa7d19,10014px 0 0 0 #fa7d19}16.667%{box-shadow:9984px -10px 0 0 #fa7d19,9999px 0 0 0 #fa7d19,10014px 0 0 0 #fa7d19}33.333%{box-shadow:9984px 0 0 0 #fa7d19,9999px 0 0 0 #fa7d19,10014px 0 0 0 #fa7d19}50%{box-shadow:9984px 0 0 0 #fa7d19,9999px -10px 0 0 #fa7d19,10014px 0 0 0 #fa7d19}66.667%{box-shadow:9984px 0 0 0 #fa7d19,9999px 0 0 0 #fa7d19,10014px 0 0 0 #fa7d19}83.333%{box-shadow:9984px 0 0 0 #fa7d19,9999px 0 0 0 #fa7d19,10014px -10px 0 0 #fa7d19}100%{box-shadow:9984px 0 0 0 #fa7d19,9999px 0 0 0 #fa7d19,10014px 0 0 0 #fa7d19}}.dot-windmill{position:relative;top:-10px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;transform-origin:5px 15px;animation:dot-windmill 2s infinite linear}.dot-windmill::before,.dot-windmill::after{content:'';display:inline-block;position:absolute}.dot-windmill::before{left:-8.66px;top:15px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19}.dot-windmill::after{left:8.66px;top:15px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19}@keyframes dot-windmill{0%{transform:rotateZ(0deg) translate3d(0, 0, 0)}100%{transform:rotateZ(720deg) translate3d(0, 0, 0)}}.dot-bricks{position:relative;top:8px;left:-9999px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;box-shadow:9991px -16px 0 0 #fa7d19,9991px 0 0 0 #fa7d19,10007px 0 0 0 #fa7d19;animation:dot-bricks 2s infinite ease}@keyframes dot-bricks{0%{box-shadow:9991px -16px 0 0 #fa7d19,9991px 0 0 0 #fa7d19,10007px 0 0 0 #fa7d19}8.333%{box-shadow:10007px -16px 0 0 #fa7d19,9991px 0 0 0 #fa7d19,10007px 0 0 0 #fa7d19}16.667%{box-shadow:10007px -16px 0 0 #fa7d19,9991px -16px 0 0 #fa7d19,10007px 0 0 0 #fa7d19}25%{box-shadow:10007px -16px 0 0 #fa7d19,9991px -16px 0 0 #fa7d19,9991px 0 0 0 #fa7d19}33.333%{box-shadow:10007px 0 0 0 #fa7d19,9991px -16px 0 0 #fa7d19,9991px 0 0 0 #fa7d19}41.667%{box-shadow:10007px 0 0 0 #fa7d19,10007px -16px 0 0 #fa7d19,9991px 0 0 0 #fa7d19}50%{box-shadow:10007px 0 0 0 #fa7d19,10007px -16px 0 0 #fa7d19,9991px -16px 0 0 #fa7d19}58.333%{box-shadow:9991px 0 0 0 #fa7d19,10007px -16px 0 0 #fa7d19,9991px -16px 0 0 #fa7d19}66.666%{box-shadow:9991px 0 0 0 #fa7d19,10007px 0 0 0 #fa7d19,9991px -16px 0 0 #fa7d19}75%{box-shadow:9991px 0 0 0 #fa7d19,10007px 0 0 0 #fa7d19,10007px -16px 0 0 #fa7d19}83.333%{box-shadow:9991px -16px 0 0 #fa7d19,10007px 0 0 0 #fa7d19,10007px -16px 0 0 #fa7d19}91.667%{box-shadow:9991px -16px 0 0 #fa7d19,9991px 0 0 0 #fa7d19,10007px -16px 0 0 #fa7d19}100%{box-shadow:9991px -16px 0 0 #fa7d19,9991px 0 0 0 #fa7d19,10007px 0 0 0 #fa7d19}}.dot-floating{position:relative;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-floating 3s infinite cubic-bezier(0.15, 0.6, 0.9, 0.1)}.dot-floating::before,.dot-floating::after{content:'';display:inline-block;position:absolute;top:0}.dot-floating::before{left:-12px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-floating-before 3s infinite ease-in-out}.dot-floating::after{left:-24px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-floating-after 3s infinite cubic-bezier(0.4, 0, 1, 1)}@keyframes dot-floating{0%{left:calc(-50% - 5px)}75%{left:calc(50% + 105px)}100%{left:calc(50% + 105px)}}@keyframes dot-floating-before{0%{left:-50px}50%{left:-12px}75%{left:-50px}100%{left:-50px}}@keyframes dot-floating-after{0%{left:-100px}50%{left:-24px}75%{left:-100px}100%{left:-100px}}.dot-fire{position:relative;left:-9999px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;box-shadow:9999px 22.5px 0 -5px #fa7d19;animation:dot-fire 1.5s infinite linear;animation-delay:-.85s}.dot-fire::before,.dot-fire::after{content:'';display:inline-block;position:absolute;top:0;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19}.dot-fire::before{box-shadow:9999px 22.5px 0 -5px #fa7d19;animation:dot-fire 1.5s infinite linear;animation-delay:-1.85s}.dot-fire::after{box-shadow:9999px 22.5px 0 -5px #fa7d19;animation:dot-fire 1.5s infinite linear;animation-delay:-2.85s}@keyframes dot-fire{1%{box-shadow:9999px 22.5px 0 -5px #fa7d19}50%{box-shadow:9999px -5.625px 0 2px #fa7d19}100%{box-shadow:9999px -22.5px 0 -5px #fa7d19}}.dot-spin{position:relative;width:10px;height:10px;border-radius:5px;background-color:rgba(0,0,0,0);color:rgba(0,0,0,0);box-shadow:0 -18px 0 0 #fa7d19,12.72984px -12.72984px 0 0 #fa7d19,18px 0 0 0 #fa7d19,12.72984px 12.72984px 0 0 rgba(250,125,25,0),0 18px 0 0 rgba(250,125,25,0),-12.72984px 12.72984px 0 0 rgba(250,125,25,0),-18px 0 0 0 rgba(250,125,25,0),-12.72984px -12.72984px 0 0 rgba(250,125,25,0);animation:dot-spin 1.5s infinite linear}@keyframes dot-spin{0%,100%{box-shadow:0 -18px 0 0 #fa7d19,12.72984px -12.72984px 0 0 #fa7d19,18px 0 0 0 #fa7d19,12.72984px 12.72984px 0 -5px rgba(250,125,25,0),0 18px 0 -5px rgba(250,125,25,0),-12.72984px 12.72984px 0 -5px rgba(250,125,25,0),-18px 0 0 -5px rgba(250,125,25,0),-12.72984px -12.72984px 0 -5px rgba(250,125,25,0)}12.5%{box-shadow:0 -18px 0 -5px rgba(250,125,25,0),12.72984px -12.72984px 0 0 #fa7d19,18px 0 0 0 #fa7d19,12.72984px 12.72984px 0 0 #fa7d19,0 18px 0 -5px rgba(250,125,25,0),-12.72984px 12.72984px 0 -5px rgba(250,125,25,0),-18px 0 0 -5px rgba(250,125,25,0),-12.72984px -12.72984px 0 -5px rgba(250,125,25,0)}25%{box-shadow:0 -18px 0 -5px rgba(250,125,25,0),12.72984px -12.72984px 0 -5px rgba(250,125,25,0),18px 0 0 0 #fa7d19,12.72984px 12.72984px 0 0 #fa7d19,0 18px 0 0 #fa7d19,-12.72984px 12.72984px 0 -5px rgba(250,125,25,0),-18px 0 0 -5px rgba(250,125,25,0),-12.72984px -12.72984px 0 -5px rgba(250,125,25,0)}37.5%{box-shadow:0 -18px 0 -5px rgba(250,125,25,0),12.72984px -12.72984px 0 -5px rgba(250,125,25,0),18px 0 0 -5px rgba(250,125,25,0),12.72984px 12.72984px 0 0 #fa7d19,0 18px 0 0 #fa7d19,-12.72984px 12.72984px 0 0 #fa7d19,-18px 0 0 -5px rgba(250,125,25,0),-12.72984px -12.72984px 0 -5px rgba(250,125,25,0)}50%{box-shadow:0 -18px 0 -5px rgba(250,125,25,0),12.72984px -12.72984px 0 -5px rgba(250,125,25,0),18px 0 0 -5px rgba(250,125,25,0),12.72984px 12.72984px 0 -5px rgba(250,125,25,0),0 18px 0 0 #fa7d19,-12.72984px 12.72984px 0 0 #fa7d19,-18px 0 0 0 #fa7d19,-12.72984px -12.72984px 0 -5px rgba(250,125,25,0)}62.5%{box-shadow:0 -18px 0 -5px rgba(250,125,25,0),12.72984px -12.72984px 0 -5px rgba(250,125,25,0),18px 0 0 -5px rgba(250,125,25,0),12.72984px 12.72984px 0 -5px rgba(250,125,25,0),0 18px 0 -5px rgba(250,125,25,0),-12.72984px 12.72984px 0 0 #fa7d19,-18px 0 0 0 #fa7d19,-12.72984px -12.72984px 0 0 #fa7d19}75%{box-shadow:0 -18px 0 0 #fa7d19,12.72984px -12.72984px 0 -5px rgba(250,125,25,0),18px 0 0 -5px rgba(250,125,25,0),12.72984px 12.72984px 0 -5px rgba(250,125,25,0),0 18px 0 -5px rgba(250,125,25,0),-12.72984px 12.72984px 0 -5px rgba(250,125,25,0),-18px 0 0 0 #fa7d19,-12.72984px -12.72984px 0 0 #fa7d19}87.5%{box-shadow:0 -18px 0 0 #fa7d19,12.72984px -12.72984px 0 0 #fa7d19,18px 0 0 -5px rgba(250,125,25,0),12.72984px 12.72984px 0 -5px rgba(250,125,25,0),0 18px 0 -5px rgba(250,125,25,0),-12.72984px 12.72984px 0 -5px rgba(250,125,25,0),-18px 0 0 -5px rgba(250,125,25,0),-12.72984px -12.72984px 0 0 #fa7d19}}.dot-falling{position:relative;left:-9999px;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;box-shadow:9999px 0 0 0 #fa7d19;animation:dot-falling 1s infinite linear;animation-delay:.1s}.dot-falling::before,.dot-falling::after{content:'';display:inline-block;position:absolute;top:0}.dot-falling::before{width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-falling-before 1s infinite linear;animation-delay:0s}.dot-falling::after{width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-falling-after 1s infinite linear;animation-delay:.2s}@keyframes dot-falling{0%{box-shadow:9999px -15px 0 0 rgba(250,125,25,0)}25%,50%,75%{box-shadow:9999px 0 0 0 #fa7d19}100%{box-shadow:9999px 15px 0 0 rgba(250,125,25,0)}}@keyframes dot-falling-before{0%{box-shadow:9984px -15px 0 0 rgba(250,125,25,0)}25%,50%,75%{box-shadow:9984px 0 0 0 #fa7d19}100%{box-shadow:9984px 15px 0 0 rgba(250,125,25,0)}}@keyframes dot-falling-after{0%{box-shadow:10014px -15px 0 0 rgba(250,125,25,0)}25%,50%,75%{box-shadow:10014px 0 0 0 #fa7d19}100%{box-shadow:10014px 15px 0 0 rgba(250,125,25,0)}}.dot-stretching{position:relative;width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;transform:scale(1.25, 1.25);animation:dot-stretching 2s infinite ease-in}.dot-stretching::before,.dot-stretching::after{content:'';display:inline-block;position:absolute;top:0}.dot-stretching::before{width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-stretching-before 2s infinite ease-in}.dot-stretching::after{width:10px;height:10px;border-radius:5px;background-color:#fa7d19;color:#fa7d19;animation:dot-stretching-after 2s infinite ease-in}@keyframes dot-stretching{0%{transform:scale(1.25, 1.25)}50%,60%{transform:scale(.8, .8)}100%{transform:scale(1.25, 1.25)}}@keyframes dot-stretching-before{0%{transform:translate(0) scale(.7, .7)}50%,60%{transform:translate(-20px) scale(1, 1)}100%{transform:translate(0) scale(.7, .7)}}@keyframes dot-stretching-after{0%{transform:translate(0) scale(.7, .7)}50%,60%{transform:translate(20px) scale(1, 1)}100%{transform:translate(0) scale(.7, .7)}}.dot-gathering{position:relative;width:12px;height:12px;border-radius:6px;background-color:#000;color:rgba(0,0,0,0);margin:-1px 0;filter:blur(2px)}.dot-gathering::before,.dot-gathering::after{content:'';display:inline-block;position:absolute;top:0;left:-50px;width:12px;height:12px;border-radius:6px;background-color:#000;color:rgba(0,0,0,0);opacity:0;filter:blur(2px);animation:dot-gathering 2s infinite ease-in}.dot-gathering::after{animation-delay:.5s}@keyframes dot-gathering{0%{opacity:0;transform:translateX(0)}35%,60%{opacity:1;transform:translateX(50px)}100%{opacity:0;transform:translateX(100px)}}.dot-hourglass{position:relative;top:-15px;width:12px;height:12px;border-radius:6px;background-color:#000;color:rgba(0,0,0,0);margin:-1px 0;filter:blur(2px);transform-origin:5px 20px;animation:dot-hourglass 2.4s infinite ease-in-out;animation-delay:.6s}.dot-hourglass::before,.dot-hourglass::after{content:'';display:inline-block;position:absolute;top:0;left:0;width:12px;height:12px;border-radius:6px;background-color:#000;color:rgba(0,0,0,0);filter:blur(2px)}.dot-hourglass::before{top:30px}.dot-hourglass::after{animation:dot-hourglass-after 2.4s infinite cubic-bezier(0.65, 0.05, 0.36, 1)}@keyframes dot-hourglass{0%{transform:rotateZ(0deg)}25%{transform:rotateZ(180deg)}50%{transform:rotateZ(180deg)}75%{transform:rotateZ(360deg)}100%{transform:rotateZ(360deg)}}@keyframes dot-hourglass-after{0%{transform:translateY(0)}25%{transform:translateY(30px)}50%{transform:translateY(30px)}75%{transform:translateY(0)}100%{transform:translateY(0)}}.dot-overtaking{position:relative;width:12px;height:12px;border-radius:6px;background-color:rgba(0,0,0,0);color:#000;margin:-1px 0;box-shadow:0 -20px 0 0;filter:blur(2px);animation:dot-overtaking 2s infinite cubic-bezier(0.2, 0.6, 0.8, 0.2)}.dot-overtaking::before,.dot-overtaking::after{content:'';display:inline-block;position:absolute;top:0;left:0;width:12px;height:12px;border-radius:6px;background-color:rgba(0,0,0,0);color:#000;box-shadow:0 -20px 0 0;filter:blur(2px)}.dot-overtaking::before{animation:dot-overtaking 2s infinite cubic-bezier(0.2, 0.6, 0.8, 0.2);animation-delay:.3s}.dot-overtaking::after{animation:dot-overtaking 1.5s infinite cubic-bezier(0.2, 0.6, 0.8, 0.2);animation-delay:.6s}@keyframes dot-overtaking{0%{transform:rotateZ(0deg)}100%{transform:rotateZ(360deg)}}.dot-shuttle{position:relative;left:-15px;width:12px;height:12px;border-radius:6px;background-color:#000;color:rgba(0,0,0,0);margin:-1px 0;filter:blur(2px)}.dot-shuttle::before,.dot-shuttle::after{content:'';display:inline-block;position:absolute;top:0;width:12px;height:12px;border-radius:6px;background-color:#000;color:rgba(0,0,0,0);filter:blur(2px)}.dot-shuttle::before{left:15px;animation:dot-shuttle 2s infinite ease-out}.dot-shuttle::after{left:30px}@keyframes dot-shuttle{0%,50%,100%{transform:translateX(0)}25%{transform:translateX(-45px)}75%{transform:translateX(45px)}}.dot-bouncing{position:relative;height:10px;font-size:10px}.dot-bouncing::before{content:'⚽🏀🏐';display:inline-block;position:relative;animation:dot-bouncing 1s infinite}@keyframes dot-bouncing{0%{top:-20px;animation-timing-function:ease-in}34%{transform:scale(1, 1)}35%{top:20px;animation-timing-function:ease-out;transform:scale(1.5, 0.5)}45%{transform:scale(1, 1)}90%{top:-20px}100%{top:-20px}}.dot-rolling{position:relative;height:10px;font-size:10px}.dot-rolling::before{content:'⚽';display:inline-block;position:relative;transform:translateX(-25px);animation:dot-rolling 3s infinite}@keyframes dot-rolling{0%{content:'⚽';transform:translateX(-25px) rotateZ(0deg)}16.667%{content:'⚽';transform:translateX(25px) rotateZ(720deg)}33.333%{content:'⚽';transform:translateX(-25px) rotateZ(0deg)}34.333%{content:'🏀';transform:translateX(-25px) rotateZ(0deg)}50%{content:'🏀';transform:translateX(25px) rotateZ(720deg)}66.667%{content:'🏀';transform:translateX(-25px) rotateZ(0deg)}67.667%{content:'🏐';transform:translateX(-25px) rotateZ(0deg)}83.333%{content:'🏐';transform:translateX(25px) rotateZ(720deg)}100%{content:'🏐';transform:translateX(-25px) rotateZ(0deg)}}.pr-loader-container{display:flex;justify-content:center;width:100%;position:fixed;top:0;z-index:100;display:none}.pr-loader-container.show{display:flex}\n",""]),e.default=s},function(t,e,r){var n=r(4),s=r(10);"string"==typeof(s=s.__esModule?s.default:s)&&(s=[[t.i,s,""]]);var i={insert:"head",singleton:!1};n(s,i);t.exports=s.locals||{}},function(t,e,r){"use strict";r.r(e);var n=r(1),s=r.n(n)()(!1);s.push([t.i,".recipe-list.pr{display:none;justify-content:space-between;flex-wrap:wrap;align-items:baseline;color:#e9ecef;background:#212529;position:fixed;top:0;right:0;z-index:100;padding:.5rem;border-radius:4px 0 4px 4px}.recipe-list.pr.show{display:flex}.recipe-list.pr ul{display:none;flex-basis:100%}.recipe-list.pr:hover ul{display:block}.recipe-list.pr ul>li{background:#495057;cursor:pointer;padding:.5rem;margin-top:.5rem;border-radius:4px}.recipe-list.pr ul>li a{color:#e9ecef;text-decoration:none}.recipe-list.pr button{display:none;border:none;padding:.5rem;vertical-align:middle;overflow:hidden;text-decoration:none;color:inherit;background-color:#495057;text-align:center;cursor:pointer;white-space:nowrap;border-radius:4px;margin-left:.5rem}.recipe-list.pr button.show{display:inline-block}.error.pr{position:fixed;z-index:101;background:#7D4F50;padding:.5rem;margin:.5rem;left:50%;transform:translate(-50%, 0);border-radius:4px;animation-name:slideFromTheLeft;animation-duration:1s}.error.pr h1{font-weight:bold}@keyframes slideFromTheLeft{0%{left:0}80%{left:50%;transform:translate(-50%, 0)}90%{left:40%;transform:translate(-50%, 0)}100%{left:50%;transform:translate(-50%, 0)}}\n",""]),e.default=s},function(t,e,r){var n=r(4),s=r(12);"string"==typeof(s=s.__esModule?s.default:s)&&(s=[[t.i,s,""]]);var i={insert:"head",singleton:!1};n(s,i);t.exports=s.locals||{}},function(t,e,r){"use strict";r.r(e);var n=r(1),s=r.n(n)()(!1);s.push([t.i,"body.pr{background:#484848}canvas.pr{display:block;max-width:800px;margin:0 auto .5em auto}button.pr{position:fixed;right:.5em;top:.5em}@media print{button{display:none}}\n",""]),e.default=s},function(t,e){var r,n,s=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(t){n=a}}();var l,c=[],h=!1,d=-1;function u(){h&&l&&(h=!1,l.length?c=l.concat(c):d=-1,c.length&&p())}function p(){if(!h){var t=o(u);h=!0;for(var e=c.length;e;){for(l=c,c=[];++d<e;)l&&l[d].run();d=-1,e=c.length}l=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function g(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new f(t,e)),1!==c.length||h||o(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=g,s.addListener=g,s.once=g,s.off=g,s.removeListener=g,s.removeAllListeners=g,s.emit=g,s.prependListener=g,s.prependOnceListener=g,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(t,e,r){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var n=r(16),s=r(17),i=r(18);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=l.prototype:(null===t&&(t=new l(e)),t.length=e),t}function l(t,e,r){if(!(l.TYPED_ARRAY_SUPPORT||this instanceof l))return new l(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return d(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);l.TYPED_ARRAY_SUPPORT?(t=e).__proto__=l.prototype:t=u(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!l.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|f(e,r),s=(t=o(t,n)).write(e,r);s!==n&&(t=t.slice(0,s));return t}(t,e,r):function(t,e){if(l.isBuffer(e)){var r=0|p(e.length);return 0===(t=o(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?o(t,0):u(t,e);if("Buffer"===e.type&&i(e.data))return u(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function d(t,e){if(h(e),t=o(t,e<0?0:0|p(e)),!l.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function u(t,e){var r=e.length<0?0:0|p(e.length);t=o(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function f(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return E(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,s){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=s?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(s)return-1;r=t.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof e&&(e=l.from(e,n)),l.isBuffer(e))return 0===e.length?-1:A(t,e,r,n,s);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):A(t,[e],r,n,s);throw new TypeError("val must be string, number or Buffer")}function A(t,e,r,n,s){var i,a=1,o=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,o/=2,l/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(s){var h=-1;for(i=r;i<o;i++)if(c(t,i)===c(e,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===l)return h*a}else-1!==h&&(i-=i-h),h=-1}else for(r+l>o&&(r=o-l),i=r;i>=0;i--){for(var d=!0,u=0;u<l;u++)if(c(t,i+u)!==c(e,u)){d=!1;break}if(d)return i}return-1}function x(t,e,r,n){r=Number(r)||0;var s=t.length-r;n?(n=Number(n))>s&&(n=s):n=s;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var o=parseInt(e.substr(2*a,2),16);if(isNaN(o))return a;t[r+a]=o}return a}function _(t,e,r,n){return q(B(e,t.length-r),t,r,n)}function y(t,e,r,n){return q(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function v(t,e,r,n){return y(t,e,r,n)}function w(t,e,r,n){return q(W(e),t,r,n)}function S(t,e,r,n){return q(function(t,e){for(var r,n,s,i=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,s=r%256,i.push(s),i.push(n);return i}(e,t.length-r),t,r,n)}function C(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function k(t,e,r){r=Math.min(t.length,r);for(var n=[],s=e;s<r;){var i,a,o,l,c=t[s],h=null,d=c>239?4:c>223?3:c>191?2:1;if(s+d<=r)switch(d){case 1:c<128&&(h=c);break;case 2:128==(192&(i=t[s+1]))&&(l=(31&c)<<6|63&i)>127&&(h=l);break;case 3:i=t[s+1],a=t[s+2],128==(192&i)&&128==(192&a)&&(l=(15&c)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:i=t[s+1],a=t[s+2],o=t[s+3],128==(192&i)&&128==(192&a)&&128==(192&o)&&(l=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(h=l)}null===h?(h=65533,d=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),s+=d}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=l,e.SlowBuffer=function(t){+t!=t&&(t=0);return l.alloc(+t)},e.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),l.poolSize=8192,l._augment=function(t){return t.__proto__=l.prototype,t},l.from=function(t,e,r){return c(null,t,e,r)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(t,e,r){return function(t,e,r,n){return h(e),e<=0?o(t,e):void 0!==r?"string"==typeof n?o(t,e).fill(r,n):o(t,e).fill(r):o(t,e)}(null,t,e,r)},l.allocUnsafe=function(t){return d(null,t)},l.allocUnsafeSlow=function(t){return d(null,t)},l.isBuffer=function(t){return!(null==t||!t._isBuffer)},l.compare=function(t,e){if(!l.isBuffer(t)||!l.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,s=0,i=Math.min(r,n);s<i;++s)if(t[s]!==e[s]){r=t[s],n=e[s];break}return r<n?-1:n<r?1:0},l.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=l.allocUnsafe(e),s=0;for(r=0;r<t.length;++r){var a=t[r];if(!l.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,s),s+=a.length}return n},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},l.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},l.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},l.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?k(this,0,t):g.apply(this,arguments)},l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},l.prototype.compare=function(t,e,r,n,s){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),e<0||r>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&e>=r)return 0;if(n>=s)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(s>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),o=Math.min(i,a),c=this.slice(n,s),h=t.slice(e,r),d=0;d<o;++d)if(c[d]!==h[d]){i=c[d],a=h[d];break}return i<a?-1:a<i?1:0},l.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},l.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},l.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},l.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var s=this.length-e;if((void 0===r||r>s)&&(r=s),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return v(this,t,e,r);case"base64":return w(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function P(t,e,r){var n="";r=Math.min(t.length,r);for(var s=e;s<r;++s)n+=String.fromCharCode(127&t[s]);return n}function R(t,e,r){var n="";r=Math.min(t.length,r);for(var s=e;s<r;++s)n+=String.fromCharCode(t[s]);return n}function E(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var s="",i=e;i<r;++i)s+=j(t[i]);return s}function T(t,e,r){for(var n=t.slice(e,r),s="",i=0;i<n.length;i+=2)s+=String.fromCharCode(n[i]+256*n[i+1]);return s}function L(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function F(t,e,r,n,s,i){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function I(t,e,r,n){e<0&&(e=65535+e+1);for(var s=0,i=Math.min(t.length-r,2);s<i;++s)t[r+s]=(e&255<<8*(n?s:1-s))>>>8*(n?s:1-s)}function M(t,e,r,n){e<0&&(e=4294967295+e+1);for(var s=0,i=Math.min(t.length-r,4);s<i;++s)t[r+s]=e>>>8*(n?s:3-s)&255}function D(t,e,r,n,s,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(t,e,r,n,i){return i||D(t,0,r,4),s.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,i){return i||D(t,0,r,8),s.write(t,e,r,n,52,8),r+8}l.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),l.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=l.prototype;else{var s=e-t;r=new l(s,void 0);for(var i=0;i<s;++i)r[i]=this[i+t]}return r},l.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],s=1,i=0;++i<e&&(s*=256);)n+=this[t+i]*s;return n},l.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t+--e],s=1;e>0&&(s*=256);)n+=this[t+--e]*s;return n},l.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],s=1,i=0;++i<e&&(s*=256);)n+=this[t+i]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*e)),n},l.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=e,s=1,i=this[t+--n];n>0&&(s*=256);)i+=this[t+--n]*s;return i>=(s*=128)&&(i-=Math.pow(2,8*e)),i},l.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),s.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),s.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),s.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),s.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var s=1,i=0;for(this[e]=255&t;++i<r&&(s*=256);)this[e+i]=t/s&255;return e+r},l.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var s=r-1,i=1;for(this[e+s]=255&t;--s>=0&&(i*=256);)this[e+s]=t/i&255;return e+r},l.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):M(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var s=Math.pow(2,8*r-1);F(this,t,e,r,s-1,-s)}var i=0,a=1,o=0;for(this[e]=255&t;++i<r&&(a*=256);)t<0&&0===o&&0!==this[e+i-1]&&(o=1),this[e+i]=(t/a>>0)-o&255;return e+r},l.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var s=Math.pow(2,8*r-1);F(this,t,e,r,s-1,-s)}var i=r-1,a=1,o=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===o&&0!==this[e+i+1]&&(o=1),this[e+i]=(t/a>>0)-o&255;return e+r},l.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):I(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):I(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):M(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},l.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},l.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},l.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},l.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var s,i=n-r;if(this===t&&r<e&&e<n)for(s=i-1;s>=0;--s)t[s+e]=this[s+r];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(s=0;s<i;++s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},l.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var s=t.charCodeAt(0);s<256&&(t=s)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var a=l.isBuffer(t)?t:B(new l(t,n).toString()),o=a.length;for(i=0;i<r-e;++i)this[i+e]=a[i%o]}return this};var U=/[^+\/0-9A-Za-z-_]/g;function j(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(t,e){var r;e=e||1/0;for(var n=t.length,s=null,i=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!s){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}s=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),s=r;continue}r=65536+(s-55296<<10|r-56320)}else s&&(e-=3)>-1&&i.push(239,191,189);if(s=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function W(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,r,n){for(var s=0;s<n&&!(s+r>=e.length||s>=t.length);++s)e[s+r]=t[s];return s}}).call(this,r(15))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=c(t),a=n[0],o=n[1],l=new i(function(t,e,r){return 3*(e+r)/4-r}(0,a,o)),h=0,d=o>0?a-4:a;for(r=0;r<d;r+=4)e=s[t.charCodeAt(r)]<<18|s[t.charCodeAt(r+1)]<<12|s[t.charCodeAt(r+2)]<<6|s[t.charCodeAt(r+3)],l[h++]=e>>16&255,l[h++]=e>>8&255,l[h++]=255&e;2===o&&(e=s[t.charCodeAt(r)]<<2|s[t.charCodeAt(r+1)]>>4,l[h++]=255&e);1===o&&(e=s[t.charCodeAt(r)]<<10|s[t.charCodeAt(r+1)]<<4|s[t.charCodeAt(r+2)]>>2,l[h++]=e>>8&255,l[h++]=255&e);return l},e.fromByteArray=function(t){for(var e,r=t.length,s=r%3,i=[],a=0,o=r-s;a<o;a+=16383)i.push(h(t,a,a+16383>o?o:a+16383));1===s?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===s&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],s=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,l=a.length;o<l;++o)n[o]=a[o],s[a.charCodeAt(o)]=o;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var s,i,a=[],o=e;o<r;o+=3)s=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),a.push(n[(i=s)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,s){var i,a,o=8*s-n-1,l=(1<<o)-1,c=l>>1,h=-7,d=r?s-1:0,u=r?-1:1,p=t[e+d];for(d+=u,i=p&(1<<-h)-1,p>>=-h,h+=o;h>0;i=256*i+t[e+d],d+=u,h-=8);for(a=i&(1<<-h)-1,i>>=-h,h+=n;h>0;a=256*a+t[e+d],d+=u,h-=8);if(0===i)i=1-c;else{if(i===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),i-=c}return(p?-1:1)*a*Math.pow(2,i-n)},e.write=function(t,e,r,n,s,i){var a,o,l,c=8*i-s-1,h=(1<<c)-1,d=h>>1,u=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,f=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+d>=1?u/l:u*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=h?(o=0,a=h):a+d>=1?(o=(e*l-1)*Math.pow(2,s),a+=d):(o=e*Math.pow(2,d-1)*Math.pow(2,s),a=0));s>=8;t[r+p]=255&o,p+=f,o/=256,s-=8);for(a=a<<s|o,c+=s;c>0;t[r+p]=255&a,p+=f,a/=256,c-=8);t[r+p-f]|=128*g}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e,r){"use strict";r.r(e);r(7),r(9),r(11);var n=r(5),s=r(2);class i{pdfJsWrapper;element;listElement;printButton;recipes=[];get length(){return this.recipes.length}constructor(t,e){this.pdfJsWrapper=t,this.element=document.createElement("div"),this.element.classList.add("pr","recipe-list"),this.element.innerText="Rezepte:",this.printButton=document.createElement("button"),this.printButton.innerText="drucken",this.printButton.addEventListener("click",()=>{this.recipes[0].open(!0)}),this.element.append(this.printButton),this.listElement=document.createElement("ul"),this.element.append(this.listElement),this.setRecipes(e),this.observeRecipeContainers(e)}observeRecipeContainers(t){const e=[];t.forEach(t=>{t.boxElement&&(e.includes(t.boxElement.parentElement)||e.push(t.boxElement.parentElement))}),e.forEach(t=>{(class{static observe(t,e,r={childList:!0}){const n=new MutationObserver(e);return n.observe(t,r),()=>n.disconnect()}static once(t,e,r={childList:!0}){const n=new MutationObserver(()=>{n.disconnect(),e(...arguments)});return n.observe(t,r),()=>n.disconnect()}}).observe(t,t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{if("function"==typeof t.querySelector){const e=s.a.find(t,this.pdfJsWrapper);e.length&&e.forEach(t=>this.add(t))}})})},{subtree:!0,childList:!0})})}add(t){this.recipes.push(t),this.append(this.createLink(t)),1===this.recipes.length?this.printButton.classList.add("show"):this.printButton.classList.remove("show")}createLink(t){const e=document.createElement("li");e.addEventListener("click",t.onClick.bind(t));const r=document.createElement("a");return r.href="",r.innerText=t.title,e.append(r),e}append(t){this.element.classList.add("show"),this.listElement.append(t)}setRecipes(t){this.recipes=t,this.listElement.childNodes.length&&this.listElement.childNodes.forEach(t=>t.remove()),t.forEach(t=>this.append(this.createLink(t))),1===this.recipes.length&&this.printButton.classList.add("show")}}var a=r(0);function o(){window.addEventListener("keydown",t=>{"p"===t.key&&t.ctrlKey&&(t.preventDefault(),1===recipeList.length&&recipeList.recipes[0].open(!0))})}try{const t=document.createElement("div"),e=document.createElement("div");t.classList.add("pr-loader-container"),e.classList.add("dot-floating"),t.append(e),document.body.append(t);const r=new n.a,l=window.recipeList=new i(r,s.a.find(document,r));if(document.body.prepend(l.element),o(),window.addEventListener("beforeprint",()=>{document.body.style.display="none"}),window.addEventListener("afterprint",()=>{document.body.style.removeProperty("display")}),location.href.toLowerCase().includes("sendung")){let t=document.querySelector(a.a.swrBroadcastHeadline).innerText.match(/\d{1,2}.\d{1,2}.\d{2,4}/)[0];t&&(t=t.split("."),t=new Date(t[2],t[1]-1,t[0]),s.a.swrBroadcastLookahead(t,t=>l.add(t),r))}}catch(t){!function(t){const e=document.createElement("div");e.classList.add("pr","error"),e.innerHTML="<h1>Print Recipes Error:</h1>"+t.message,e.addEventListener("click",()=>e.remove()),document.body.prepend(e)}(new Error(t))}}]);
This file has been truncated, but you can view the full file.
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./node_modules/pdfjs-dist/build/pdf.worker.entry.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./node_modules/pdfjs-dist/build/pdf.worker.entry.js":
/*!***********************************************************!*\
!*** ./node_modules/pdfjs-dist/build/pdf.worker.entry.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n(typeof window !== \"undefined\"\n ? window\n : {}\n).pdfjsWorker = __webpack_require__(/*! ./pdf.worker.js */ \"./node_modules/pdfjs-dist/build/pdf.worker.js\");\n\n\n//# sourceURL=webpack:///./node_modules/pdfjs-dist/build/pdf.worker.entry.js?");
/***/ }),
/***/ "./node_modules/pdfjs-dist/build/pdf.worker.js":
/*!*****************************************************!*\
!*** ./node_modules/pdfjs-dist/build/pdf.worker.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* WEBPACK VAR INJECTION */(function(process) {/**\n * @licstart The following is the entire license notice for the\n * Javascript code in this page\n *\n * Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @licend The above is the entire license notice for the\n * Javascript code in this page\n */\n\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(true)\n\t\tmodule.exports = factory();\n\telse {}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __w_pdfjs_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__w_pdfjs_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__w_pdfjs_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__w_pdfjs_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__w_pdfjs_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__w_pdfjs_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__w_pdfjs_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __w_pdfjs_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__w_pdfjs_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__w_pdfjs_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__w_pdfjs_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__w_pdfjs_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __w_pdfjs_require__(__w_pdfjs_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nconst pdfjsVersion = '2.4.456';\nconst pdfjsBuild = '228a591c';\n\nconst pdfjsCoreWorker = __w_pdfjs_require__(1);\n\nexports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.WorkerMessageHandler = exports.WorkerTask = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _pdf_manager = __w_pdfjs_require__(5);\n\nvar _is_node = __w_pdfjs_require__(44);\n\nvar _message_handler = __w_pdfjs_require__(45);\n\nvar _worker_stream = __w_pdfjs_require__(46);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nvar WorkerTask = function WorkerTaskClosure() {\n function WorkerTask(name) {\n this.name = name;\n this.terminated = false;\n this._capability = (0, _util.createPromiseCapability)();\n }\n\n WorkerTask.prototype = {\n get finished() {\n return this._capability.promise;\n },\n\n finish() {\n this._capability.resolve();\n },\n\n terminate() {\n this.terminated = true;\n },\n\n ensureNotTerminated() {\n if (this.terminated) {\n throw new Error(\"Worker task was terminated\");\n }\n }\n\n };\n return WorkerTask;\n}();\n\nexports.WorkerTask = WorkerTask;\nvar WorkerMessageHandler = {\n setup(handler, port) {\n var testMessageProcessed = false;\n handler.on(\"test\", function wphSetupTest(data) {\n if (testMessageProcessed) {\n return;\n }\n\n testMessageProcessed = true;\n\n if (!(data instanceof Uint8Array)) {\n handler.send(\"test\", null);\n return;\n }\n\n const supportTransfers = data[0] === 255;\n handler.postMessageTransfers = supportTransfers;\n handler.send(\"test\", {\n supportTransfers\n });\n });\n handler.on(\"configure\", function wphConfigure(data) {\n (0, _util.setVerbosityLevel)(data.verbosity);\n });\n handler.on(\"GetDocRequest\", function wphSetupDoc(data) {\n return WorkerMessageHandler.createDocumentHandler(data, port);\n });\n },\n\n createDocumentHandler(docParams, port) {\n var pdfManager;\n var terminated = false;\n var cancelXHRs = null;\n var WorkerTasks = [];\n const verbosity = (0, _util.getVerbosityLevel)();\n const apiVersion = docParams.apiVersion;\n const workerVersion = '2.4.456';\n\n if (apiVersion !== workerVersion) {\n throw new Error(`The API version \"${apiVersion}\" does not match ` + `the Worker version \"${workerVersion}\".`);\n }\n\n const enumerableProperties = [];\n\n for (const property in []) {\n enumerableProperties.push(property);\n }\n\n if (enumerableProperties.length) {\n throw new Error(\"The `Array.prototype` contains unexpected enumerable properties: \" + enumerableProperties.join(\", \") + \"; thus breaking e.g. `for...in` iteration of `Array`s.\");\n }\n\n var docId = docParams.docId;\n var docBaseUrl = docParams.docBaseUrl;\n var workerHandlerName = docParams.docId + \"_worker\";\n var handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);\n handler.postMessageTransfers = docParams.postMessageTransfers;\n\n function ensureNotTerminated() {\n if (terminated) {\n throw new Error(\"Worker was terminated\");\n }\n }\n\n function startWorkerTask(task) {\n WorkerTasks.push(task);\n }\n\n function finishWorkerTask(task) {\n task.finish();\n var i = WorkerTasks.indexOf(task);\n WorkerTasks.splice(i, 1);\n }\n\n async function loadDocument(recoveryMode) {\n await pdfManager.ensureDoc(\"checkHeader\");\n await pdfManager.ensureDoc(\"parseStartXRef\");\n await pdfManager.ensureDoc(\"parse\", [recoveryMode]);\n\n if (!recoveryMode) {\n await pdfManager.ensureDoc(\"checkFirstPage\");\n }\n\n const [numPages, fingerprint] = await Promise.all([pdfManager.ensureDoc(\"numPages\"), pdfManager.ensureDoc(\"fingerprint\")]);\n return {\n numPages,\n fingerprint\n };\n }\n\n function getPdfManager(data, evaluatorOptions) {\n var pdfManagerCapability = (0, _util.createPromiseCapability)();\n var pdfManager;\n var source = data.source;\n\n if (source.data) {\n try {\n pdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);\n pdfManagerCapability.resolve(pdfManager);\n } catch (ex) {\n pdfManagerCapability.reject(ex);\n }\n\n return pdfManagerCapability.promise;\n }\n\n var pdfStream,\n cachedChunks = [];\n\n try {\n pdfStream = new _worker_stream.PDFWorkerStream(handler);\n } catch (ex) {\n pdfManagerCapability.reject(ex);\n return pdfManagerCapability.promise;\n }\n\n var fullRequest = pdfStream.getFullReader();\n fullRequest.headersReady.then(function () {\n if (!fullRequest.isRangeSupported) {\n return;\n }\n\n var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;\n pdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {\n msgHandler: handler,\n password: source.password,\n length: fullRequest.contentLength,\n disableAutoFetch,\n rangeChunkSize: source.rangeChunkSize\n }, evaluatorOptions, docBaseUrl);\n\n for (let i = 0; i < cachedChunks.length; i++) {\n pdfManager.sendProgressiveData(cachedChunks[i]);\n }\n\n cachedChunks = [];\n pdfManagerCapability.resolve(pdfManager);\n cancelXHRs = null;\n }).catch(function (reason) {\n pdfManagerCapability.reject(reason);\n cancelXHRs = null;\n });\n var loaded = 0;\n\n var flushChunks = function () {\n var pdfFile = (0, _util.arraysToBytes)(cachedChunks);\n\n if (source.length && pdfFile.length !== source.length) {\n (0, _util.warn)(\"reported HTTP length is different from actual\");\n }\n\n try {\n pdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);\n pdfManagerCapability.resolve(pdfManager);\n } catch (ex) {\n pdfManagerCapability.reject(ex);\n }\n\n cachedChunks = [];\n };\n\n var readPromise = new Promise(function (resolve, reject) {\n var readChunk = function (chunk) {\n try {\n ensureNotTerminated();\n\n if (chunk.done) {\n if (!pdfManager) {\n flushChunks();\n }\n\n cancelXHRs = null;\n return;\n }\n\n var data = chunk.value;\n loaded += (0, _util.arrayByteLength)(data);\n\n if (!fullRequest.isStreamingSupported) {\n handler.send(\"DocProgress\", {\n loaded,\n total: Math.max(loaded, fullRequest.contentLength || 0)\n });\n }\n\n if (pdfManager) {\n pdfManager.sendProgressiveData(data);\n } else {\n cachedChunks.push(data);\n }\n\n fullRequest.read().then(readChunk, reject);\n } catch (e) {\n reject(e);\n }\n };\n\n fullRequest.read().then(readChunk, reject);\n });\n readPromise.catch(function (e) {\n pdfManagerCapability.reject(e);\n cancelXHRs = null;\n });\n\n cancelXHRs = function (reason) {\n pdfStream.cancelAllRequests(reason);\n };\n\n return pdfManagerCapability.promise;\n }\n\n function setupDoc(data) {\n function onSuccess(doc) {\n ensureNotTerminated();\n handler.send(\"GetDoc\", {\n pdfInfo: doc\n });\n }\n\n function onFailure(ex) {\n ensureNotTerminated();\n\n if (ex instanceof _util.PasswordException) {\n var task = new WorkerTask(`PasswordException: response ${ex.code}`);\n startWorkerTask(task);\n handler.sendWithPromise(\"PasswordRequest\", ex).then(function (data) {\n finishWorkerTask(task);\n pdfManager.updatePassword(data.password);\n pdfManagerReady();\n }).catch(function () {\n finishWorkerTask(task);\n handler.send(\"DocException\", ex);\n });\n } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {\n handler.send(\"DocException\", ex);\n } else {\n handler.send(\"DocException\", new _util.UnknownErrorException(ex.message, ex.toString()));\n }\n }\n\n function pdfManagerReady() {\n ensureNotTerminated();\n loadDocument(false).then(onSuccess, function loadFailure(ex) {\n ensureNotTerminated();\n\n if (!(ex instanceof _core_utils.XRefParseException)) {\n onFailure(ex);\n return;\n }\n\n pdfManager.requestLoadedStream();\n pdfManager.onLoadedStream().then(function () {\n ensureNotTerminated();\n loadDocument(true).then(onSuccess, onFailure);\n });\n }, onFailure);\n }\n\n ensureNotTerminated();\n var evaluatorOptions = {\n forceDataSchema: data.disableCreateObjectURL,\n maxImageSize: data.maxImageSize,\n disableFontFace: data.disableFontFace,\n nativeImageDecoderSupport: data.nativeImageDecoderSupport,\n ignoreErrors: data.ignoreErrors,\n isEvalSupported: data.isEvalSupported\n };\n getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {\n if (terminated) {\n newPdfManager.terminate(new _util.AbortException(\"Worker was terminated.\"));\n throw new Error(\"Worker was terminated\");\n }\n\n pdfManager = newPdfManager;\n pdfManager.onLoadedStream().then(function (stream) {\n handler.send(\"DataLoaded\", {\n length: stream.bytes.byteLength\n });\n });\n }).then(pdfManagerReady, onFailure);\n }\n\n handler.on(\"GetPage\", function wphSetupGetPage(data) {\n return pdfManager.getPage(data.pageIndex).then(function (page) {\n return Promise.all([pdfManager.ensure(page, \"rotate\"), pdfManager.ensure(page, \"ref\"), pdfManager.ensure(page, \"userUnit\"), pdfManager.ensure(page, \"view\")]).then(function ([rotate, ref, userUnit, view]) {\n return {\n rotate,\n ref,\n userUnit,\n view\n };\n });\n });\n });\n handler.on(\"GetPageIndex\", function wphSetupGetPageIndex(data) {\n var ref = _primitives.Ref.get(data.ref.num, data.ref.gen);\n\n var catalog = pdfManager.pdfDocument.catalog;\n return catalog.getPageIndex(ref);\n });\n handler.on(\"GetDestinations\", function wphSetupGetDestinations(data) {\n return pdfManager.ensureCatalog(\"destinations\");\n });\n handler.on(\"GetDestination\", function wphSetupGetDestination(data) {\n return pdfManager.ensureCatalog(\"getDestination\", [data.id]);\n });\n handler.on(\"GetPageLabels\", function wphSetupGetPageLabels(data) {\n return pdfManager.ensureCatalog(\"pageLabels\");\n });\n handler.on(\"GetPageLayout\", function wphSetupGetPageLayout(data) {\n return pdfManager.ensureCatalog(\"pageLayout\");\n });\n handler.on(\"GetPageMode\", function wphSetupGetPageMode(data) {\n return pdfManager.ensureCatalog(\"pageMode\");\n });\n handler.on(\"GetViewerPreferences\", function (data) {\n return pdfManager.ensureCatalog(\"viewerPreferences\");\n });\n handler.on(\"GetOpenAction\", function (data) {\n return pdfManager.ensureCatalog(\"openAction\");\n });\n handler.on(\"GetAttachments\", function wphSetupGetAttachments(data) {\n return pdfManager.ensureCatalog(\"attachments\");\n });\n handler.on(\"GetJavaScript\", function wphSetupGetJavaScript(data) {\n return pdfManager.ensureCatalog(\"javaScript\");\n });\n handler.on(\"GetOutline\", function wphSetupGetOutline(data) {\n return pdfManager.ensureCatalog(\"documentOutline\");\n });\n handler.on(\"GetPermissions\", function (data) {\n return pdfManager.ensureCatalog(\"permissions\");\n });\n handler.on(\"GetMetadata\", function wphSetupGetMetadata(data) {\n return Promise.all([pdfManager.ensureDoc(\"documentInfo\"), pdfManager.ensureCatalog(\"metadata\")]);\n });\n handler.on(\"GetData\", function wphSetupGetData(data) {\n pdfManager.requestLoadedStream();\n return pdfManager.onLoadedStream().then(function (stream) {\n return stream.bytes;\n });\n });\n handler.on(\"GetStats\", function wphSetupGetStats(data) {\n return pdfManager.pdfDocument.xref.stats;\n });\n handler.on(\"GetAnnotations\", function ({\n pageIndex,\n intent\n }) {\n return pdfManager.getPage(pageIndex).then(function (page) {\n return page.getAnnotationsData(intent);\n });\n });\n handler.on(\"GetOperatorList\", function wphSetupRenderPage(data, sink) {\n var pageIndex = data.pageIndex;\n pdfManager.getPage(pageIndex).then(function (page) {\n var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);\n startWorkerTask(task);\n const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;\n page.getOperatorList({\n handler,\n sink,\n task,\n intent: data.intent,\n renderInteractiveForms: data.renderInteractiveForms\n }).then(function (operatorListInfo) {\n finishWorkerTask(task);\n\n if (start) {\n (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);\n }\n\n sink.close();\n }, function (reason) {\n finishWorkerTask(task);\n\n if (task.terminated) {\n return;\n }\n\n handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.unknown\n });\n sink.error(reason);\n });\n });\n }, this);\n handler.on(\"GetTextContent\", function wphExtractText(data, sink) {\n var pageIndex = data.pageIndex;\n\n sink.onPull = function (desiredSize) {};\n\n sink.onCancel = function (reason) {};\n\n pdfManager.getPage(pageIndex).then(function (page) {\n var task = new WorkerTask(\"GetTextContent: page \" + pageIndex);\n startWorkerTask(task);\n const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;\n page.extractTextContent({\n handler,\n task,\n sink,\n normalizeWhitespace: data.normalizeWhitespace,\n combineTextItems: data.combineTextItems\n }).then(function () {\n finishWorkerTask(task);\n\n if (start) {\n (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);\n }\n\n sink.close();\n }, function (reason) {\n finishWorkerTask(task);\n\n if (task.terminated) {\n return;\n }\n\n sink.error(reason);\n });\n });\n });\n handler.on(\"FontFallback\", function (data) {\n return pdfManager.fontFallback(data.id, handler);\n });\n handler.on(\"Cleanup\", function wphCleanup(data) {\n return pdfManager.cleanup();\n });\n handler.on(\"Terminate\", function wphTerminate(data) {\n terminated = true;\n const waitOn = [];\n\n if (pdfManager) {\n pdfManager.terminate(new _util.AbortException(\"Worker was terminated.\"));\n const cleanupPromise = pdfManager.cleanup();\n waitOn.push(cleanupPromise);\n pdfManager = null;\n } else {\n (0, _primitives.clearPrimitiveCaches)();\n }\n\n if (cancelXHRs) {\n cancelXHRs(new _util.AbortException(\"Worker was terminated.\"));\n }\n\n WorkerTasks.forEach(function (task) {\n waitOn.push(task.finished);\n task.terminate();\n });\n return Promise.all(waitOn).then(function () {\n handler.destroy();\n handler = null;\n });\n });\n handler.on(\"Ready\", function wphReady(data) {\n setupDoc(docParams);\n docParams = null;\n });\n return workerHandlerName;\n },\n\n initializeFromPort(port) {\n var handler = new _message_handler.MessageHandler(\"worker\", \"main\", port);\n WorkerMessageHandler.setup(handler, port);\n handler.send(\"ready\", null);\n }\n\n};\nexports.WorkerMessageHandler = WorkerMessageHandler;\n\nfunction isMessagePort(maybePort) {\n return typeof maybePort.postMessage === \"function\" && \"onmessage\" in maybePort;\n}\n\nif (typeof window === \"undefined\" && !_is_node.isNodeJS && typeof self !== \"undefined\" && isMessagePort(self)) {\n WorkerMessageHandler.initializeFromPort(self);\n}\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.arrayByteLength = arrayByteLength;\nexports.arraysToBytes = arraysToBytes;\nexports.assert = assert;\nexports.bytesToString = bytesToString;\nexports.createPromiseCapability = createPromiseCapability;\nexports.getVerbosityLevel = getVerbosityLevel;\nexports.info = info;\nexports.isArrayBuffer = isArrayBuffer;\nexports.isArrayEqual = isArrayEqual;\nexports.isBool = isBool;\nexports.isEmptyObj = isEmptyObj;\nexports.isNum = isNum;\nexports.isString = isString;\nexports.isSameOrigin = isSameOrigin;\nexports.createValidAbsoluteUrl = createValidAbsoluteUrl;\nexports.removeNullCharacters = removeNullCharacters;\nexports.setVerbosityLevel = setVerbosityLevel;\nexports.shadow = shadow;\nexports.string32 = string32;\nexports.stringToBytes = stringToBytes;\nexports.stringToPDFString = stringToPDFString;\nexports.stringToUTF8String = stringToUTF8String;\nexports.utf8StringToString = utf8StringToString;\nexports.warn = warn;\nexports.unreachable = unreachable;\nexports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0;\n\n__w_pdfjs_require__(3);\n\nconst IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];\nexports.IDENTITY_MATRIX = IDENTITY_MATRIX;\nconst FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];\nexports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;\nconst NativeImageDecoding = {\n NONE: \"none\",\n DECODE: \"decode\",\n DISPLAY: \"display\"\n};\nexports.NativeImageDecoding = NativeImageDecoding;\nconst PermissionFlag = {\n PRINT: 0x04,\n MODIFY_CONTENTS: 0x08,\n COPY: 0x10,\n MODIFY_ANNOTATIONS: 0x20,\n FILL_INTERACTIVE_FORMS: 0x100,\n COPY_FOR_ACCESSIBILITY: 0x200,\n ASSEMBLE: 0x400,\n PRINT_HIGH_QUALITY: 0x800\n};\nexports.PermissionFlag = PermissionFlag;\nconst TextRenderingMode = {\n FILL: 0,\n STROKE: 1,\n FILL_STROKE: 2,\n INVISIBLE: 3,\n FILL_ADD_TO_PATH: 4,\n STROKE_ADD_TO_PATH: 5,\n FILL_STROKE_ADD_TO_PATH: 6,\n ADD_TO_PATH: 7,\n FILL_STROKE_MASK: 3,\n ADD_TO_PATH_FLAG: 4\n};\nexports.TextRenderingMode = TextRenderingMode;\nconst ImageKind = {\n GRAYSCALE_1BPP: 1,\n RGB_24BPP: 2,\n RGBA_32BPP: 3\n};\nexports.ImageKind = ImageKind;\nconst AnnotationType = {\n TEXT: 1,\n LINK: 2,\n FREETEXT: 3,\n LINE: 4,\n SQUARE: 5,\n CIRCLE: 6,\n POLYGON: 7,\n POLYLINE: 8,\n HIGHLIGHT: 9,\n UNDERLINE: 10,\n SQUIGGLY: 11,\n STRIKEOUT: 12,\n STAMP: 13,\n CARET: 14,\n INK: 15,\n POPUP: 16,\n FILEATTACHMENT: 17,\n SOUND: 18,\n MOVIE: 19,\n WIDGET: 20,\n SCREEN: 21,\n PRINTERMARK: 22,\n TRAPNET: 23,\n WATERMARK: 24,\n THREED: 25,\n REDACT: 26\n};\nexports.AnnotationType = AnnotationType;\nconst AnnotationStateModelType = {\n MARKED: \"Marked\",\n REVIEW: \"Review\"\n};\nexports.AnnotationStateModelType = AnnotationStateModelType;\nconst AnnotationMarkedState = {\n MARKED: \"Marked\",\n UNMARKED: \"Unmarked\"\n};\nexports.AnnotationMarkedState = AnnotationMarkedState;\nconst AnnotationReviewState = {\n ACCEPTED: \"Accepted\",\n REJECTED: \"Rejected\",\n CANCELLED: \"Cancelled\",\n COMPLETED: \"Completed\",\n NONE: \"None\"\n};\nexports.AnnotationReviewState = AnnotationReviewState;\nconst AnnotationReplyType = {\n GROUP: \"Group\",\n REPLY: \"R\"\n};\nexports.AnnotationReplyType = AnnotationReplyType;\nconst AnnotationFlag = {\n INVISIBLE: 0x01,\n HIDDEN: 0x02,\n PRINT: 0x04,\n NOZOOM: 0x08,\n NOROTATE: 0x10,\n NOVIEW: 0x20,\n READONLY: 0x40,\n LOCKED: 0x80,\n TOGGLENOVIEW: 0x100,\n LOCKEDCONTENTS: 0x200\n};\nexports.AnnotationFlag = AnnotationFlag;\nconst AnnotationFieldFlag = {\n READONLY: 0x0000001,\n REQUIRED: 0x0000002,\n NOEXPORT: 0x0000004,\n MULTILINE: 0x0001000,\n PASSWORD: 0x0002000,\n NOTOGGLETOOFF: 0x0004000,\n RADIO: 0x0008000,\n PUSHBUTTON: 0x0010000,\n COMBO: 0x0020000,\n EDIT: 0x0040000,\n SORT: 0x0080000,\n FILESELECT: 0x0100000,\n MULTISELECT: 0x0200000,\n DONOTSPELLCHECK: 0x0400000,\n DONOTSCROLL: 0x0800000,\n COMB: 0x1000000,\n RICHTEXT: 0x2000000,\n RADIOSINUNISON: 0x2000000,\n COMMITONSELCHANGE: 0x4000000\n};\nexports.AnnotationFieldFlag = AnnotationFieldFlag;\nconst AnnotationBorderStyleType = {\n SOLID: 1,\n DASHED: 2,\n BEVELED: 3,\n INSET: 4,\n UNDERLINE: 5\n};\nexports.AnnotationBorderStyleType = AnnotationBorderStyleType;\nconst StreamType = {\n UNKNOWN: \"UNKNOWN\",\n FLATE: \"FLATE\",\n LZW: \"LZW\",\n DCT: \"DCT\",\n JPX: \"JPX\",\n JBIG: \"JBIG\",\n A85: \"A85\",\n AHX: \"AHX\",\n CCF: \"CCF\",\n RLX: \"RLX\"\n};\nexports.StreamType = StreamType;\nconst FontType = {\n UNKNOWN: \"UNKNOWN\",\n TYPE1: \"TYPE1\",\n TYPE1C: \"TYPE1C\",\n CIDFONTTYPE0: \"CIDFONTTYPE0\",\n CIDFONTTYPE0C: \"CIDFONTTYPE0C\",\n TRUETYPE: \"TRUETYPE\",\n CIDFONTTYPE2: \"CIDFONTTYPE2\",\n TYPE3: \"TYPE3\",\n OPENTYPE: \"OPENTYPE\",\n TYPE0: \"TYPE0\",\n MMTYPE1: \"MMTYPE1\"\n};\nexports.FontType = FontType;\nconst VerbosityLevel = {\n ERRORS: 0,\n WARNINGS: 1,\n INFOS: 5\n};\nexports.VerbosityLevel = VerbosityLevel;\nconst CMapCompressionType = {\n NONE: 0,\n BINARY: 1,\n STREAM: 2\n};\nexports.CMapCompressionType = CMapCompressionType;\nconst OPS = {\n dependency: 1,\n setLineWidth: 2,\n setLineCap: 3,\n setLineJoin: 4,\n setMiterLimit: 5,\n setDash: 6,\n setRenderingIntent: 7,\n setFlatness: 8,\n setGState: 9,\n save: 10,\n restore: 11,\n transform: 12,\n moveTo: 13,\n lineTo: 14,\n curveTo: 15,\n curveTo2: 16,\n curveTo3: 17,\n closePath: 18,\n rectangle: 19,\n stroke: 20,\n closeStroke: 21,\n fill: 22,\n eoFill: 23,\n fillStroke: 24,\n eoFillStroke: 25,\n closeFillStroke: 26,\n closeEOFillStroke: 27,\n endPath: 28,\n clip: 29,\n eoClip: 30,\n beginText: 31,\n endText: 32,\n setCharSpacing: 33,\n setWordSpacing: 34,\n setHScale: 35,\n setLeading: 36,\n setFont: 37,\n setTextRenderingMode: 38,\n setTextRise: 39,\n moveText: 40,\n setLeadingMoveText: 41,\n setTextMatrix: 42,\n nextLine: 43,\n showText: 44,\n showSpacedText: 45,\n nextLineShowText: 46,\n nextLineSetSpacingShowText: 47,\n setCharWidth: 48,\n setCharWidthAndBounds: 49,\n setStrokeColorSpace: 50,\n setFillColorSpace: 51,\n setStrokeColor: 52,\n setStrokeColorN: 53,\n setFillColor: 54,\n setFillColorN: 55,\n setStrokeGray: 56,\n setFillGray: 57,\n setStrokeRGBColor: 58,\n setFillRGBColor: 59,\n setStrokeCMYKColor: 60,\n setFillCMYKColor: 61,\n shadingFill: 62,\n beginInlineImage: 63,\n beginImageData: 64,\n endInlineImage: 65,\n paintXObject: 66,\n markPoint: 67,\n markPointProps: 68,\n beginMarkedContent: 69,\n beginMarkedContentProps: 70,\n endMarkedContent: 71,\n beginCompat: 72,\n endCompat: 73,\n paintFormXObjectBegin: 74,\n paintFormXObjectEnd: 75,\n beginGroup: 76,\n endGroup: 77,\n beginAnnotations: 78,\n endAnnotations: 79,\n beginAnnotation: 80,\n endAnnotation: 81,\n paintJpegXObject: 82,\n paintImageMaskXObject: 83,\n paintImageMaskXObjectGroup: 84,\n paintImageXObject: 85,\n paintInlineImageXObject: 86,\n paintInlineImageXObjectGroup: 87,\n paintImageXObjectRepeat: 88,\n paintImageMaskXObjectRepeat: 89,\n paintSolidColorImageMask: 90,\n constructPath: 91\n};\nexports.OPS = OPS;\nconst UNSUPPORTED_FEATURES = {\n unknown: \"unknown\",\n forms: \"forms\",\n javaScript: \"javaScript\",\n smask: \"smask\",\n shadingPattern: \"shadingPattern\",\n font: \"font\"\n};\nexports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;\nconst PasswordResponses = {\n NEED_PASSWORD: 1,\n INCORRECT_PASSWORD: 2\n};\nexports.PasswordResponses = PasswordResponses;\nlet verbosity = VerbosityLevel.WARNINGS;\n\nfunction setVerbosityLevel(level) {\n if (Number.isInteger(level)) {\n verbosity = level;\n }\n}\n\nfunction getVerbosityLevel() {\n return verbosity;\n}\n\nfunction info(msg) {\n if (verbosity >= VerbosityLevel.INFOS) {\n console.log(`Info: ${msg}`);\n }\n}\n\nfunction warn(msg) {\n if (verbosity >= VerbosityLevel.WARNINGS) {\n console.log(`Warning: ${msg}`);\n }\n}\n\nfunction unreachable(msg) {\n throw new Error(msg);\n}\n\nfunction assert(cond, msg) {\n if (!cond) {\n unreachable(msg);\n }\n}\n\nfunction isSameOrigin(baseUrl, otherUrl) {\n let base;\n\n try {\n base = new URL(baseUrl);\n\n if (!base.origin || base.origin === \"null\") {\n return false;\n }\n } catch (e) {\n return false;\n }\n\n const other = new URL(otherUrl, base);\n return base.origin === other.origin;\n}\n\nfunction _isValidProtocol(url) {\n if (!url) {\n return false;\n }\n\n switch (url.protocol) {\n case \"http:\":\n case \"https:\":\n case \"ftp:\":\n case \"mailto:\":\n case \"tel:\":\n return true;\n\n default:\n return false;\n }\n}\n\nfunction createValidAbsoluteUrl(url, baseUrl) {\n if (!url) {\n return null;\n }\n\n try {\n const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);\n\n if (_isValidProtocol(absoluteUrl)) {\n return absoluteUrl;\n }\n } catch (ex) {}\n\n return null;\n}\n\nfunction shadow(obj, prop, value) {\n Object.defineProperty(obj, prop, {\n value,\n enumerable: true,\n configurable: true,\n writable: false\n });\n return value;\n}\n\nconst BaseException = function BaseExceptionClosure() {\n function BaseException(message) {\n if (this.constructor === BaseException) {\n unreachable(\"Cannot initialize BaseException.\");\n }\n\n this.message = message;\n this.name = this.constructor.name;\n }\n\n BaseException.prototype = new Error();\n BaseException.constructor = BaseException;\n return BaseException;\n}();\n\nexports.BaseException = BaseException;\n\nclass PasswordException extends BaseException {\n constructor(msg, code) {\n super(msg);\n this.code = code;\n }\n\n}\n\nexports.PasswordException = PasswordException;\n\nclass UnknownErrorException extends BaseException {\n constructor(msg, details) {\n super(msg);\n this.details = details;\n }\n\n}\n\nexports.UnknownErrorException = UnknownErrorException;\n\nclass InvalidPDFException extends BaseException {}\n\nexports.InvalidPDFException = InvalidPDFException;\n\nclass MissingPDFException extends BaseException {}\n\nexports.MissingPDFException = MissingPDFException;\n\nclass UnexpectedResponseException extends BaseException {\n constructor(msg, status) {\n super(msg);\n this.status = status;\n }\n\n}\n\nexports.UnexpectedResponseException = UnexpectedResponseException;\n\nclass FormatError extends BaseException {}\n\nexports.FormatError = FormatError;\n\nclass AbortException extends BaseException {}\n\nexports.AbortException = AbortException;\nconst NullCharactersRegExp = /\\x00/g;\n\nfunction removeNullCharacters(str) {\n if (typeof str !== \"string\") {\n warn(\"The argument for removeNullCharacters must be a string.\");\n return str;\n }\n\n return str.replace(NullCharactersRegExp, \"\");\n}\n\nfunction bytesToString(bytes) {\n assert(bytes !== null && typeof bytes === \"object\" && bytes.length !== undefined, \"Invalid argument for bytesToString\");\n const length = bytes.length;\n const MAX_ARGUMENT_COUNT = 8192;\n\n if (length < MAX_ARGUMENT_COUNT) {\n return String.fromCharCode.apply(null, bytes);\n }\n\n const strBuf = [];\n\n for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {\n const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);\n const chunk = bytes.subarray(i, chunkEnd);\n strBuf.push(String.fromCharCode.apply(null, chunk));\n }\n\n return strBuf.join(\"\");\n}\n\nfunction stringToBytes(str) {\n assert(typeof str === \"string\", \"Invalid argument for stringToBytes\");\n const length = str.length;\n const bytes = new Uint8Array(length);\n\n for (let i = 0; i < length; ++i) {\n bytes[i] = str.charCodeAt(i) & 0xff;\n }\n\n return bytes;\n}\n\nfunction arrayByteLength(arr) {\n if (arr.length !== undefined) {\n return arr.length;\n }\n\n assert(arr.byteLength !== undefined);\n return arr.byteLength;\n}\n\nfunction arraysToBytes(arr) {\n const length = arr.length;\n\n if (length === 1 && arr[0] instanceof Uint8Array) {\n return arr[0];\n }\n\n let resultLength = 0;\n\n for (let i = 0; i < length; i++) {\n resultLength += arrayByteLength(arr[i]);\n }\n\n let pos = 0;\n const data = new Uint8Array(resultLength);\n\n for (let i = 0; i < length; i++) {\n let item = arr[i];\n\n if (!(item instanceof Uint8Array)) {\n if (typeof item === \"string\") {\n item = stringToBytes(item);\n } else {\n item = new Uint8Array(item);\n }\n }\n\n const itemLength = item.byteLength;\n data.set(item, pos);\n pos += itemLength;\n }\n\n return data;\n}\n\nfunction string32(value) {\n return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);\n}\n\nfunction isLittleEndian() {\n const buffer8 = new Uint8Array(4);\n buffer8[0] = 1;\n const view32 = new Uint32Array(buffer8.buffer, 0, 1);\n return view32[0] === 1;\n}\n\nconst IsLittleEndianCached = {\n get value() {\n return shadow(this, \"value\", isLittleEndian());\n }\n\n};\nexports.IsLittleEndianCached = IsLittleEndianCached;\n\nfunction isEvalSupported() {\n try {\n new Function(\"\");\n return true;\n } catch (e) {\n return false;\n }\n}\n\nconst IsEvalSupportedCached = {\n get value() {\n return shadow(this, \"value\", isEvalSupported());\n }\n\n};\nexports.IsEvalSupportedCached = IsEvalSupportedCached;\nconst rgbBuf = [\"rgb(\", 0, \",\", 0, \",\", 0, \")\"];\n\nclass Util {\n static makeCssRgb(r, g, b) {\n rgbBuf[1] = r;\n rgbBuf[3] = g;\n rgbBuf[5] = b;\n return rgbBuf.join(\"\");\n }\n\n static transform(m1, m2) {\n return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];\n }\n\n static applyTransform(p, m) {\n const xt = p[0] * m[0] + p[1] * m[2] + m[4];\n const yt = p[0] * m[1] + p[1] * m[3] + m[5];\n return [xt, yt];\n }\n\n static applyInverseTransform(p, m) {\n const d = m[0] * m[3] - m[1] * m[2];\n const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;\n const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;\n return [xt, yt];\n }\n\n static getAxialAlignedBoundingBox(r, m) {\n const p1 = Util.applyTransform(r, m);\n const p2 = Util.applyTransform(r.slice(2, 4), m);\n const p3 = Util.applyTransform([r[0], r[3]], m);\n const p4 = Util.applyTransform([r[2], r[1]], m);\n return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];\n }\n\n static inverseTransform(m) {\n const d = m[0] * m[3] - m[1] * m[2];\n return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];\n }\n\n static apply3dTransform(m, v) {\n return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];\n }\n\n static singularValueDecompose2dScale(m) {\n const transpose = [m[0], m[2], m[1], m[3]];\n const a = m[0] * transpose[0] + m[1] * transpose[2];\n const b = m[0] * transpose[1] + m[1] * transpose[3];\n const c = m[2] * transpose[0] + m[3] * transpose[2];\n const d = m[2] * transpose[1] + m[3] * transpose[3];\n const first = (a + d) / 2;\n const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;\n const sx = first + second || 1;\n const sy = first - second || 1;\n return [Math.sqrt(sx), Math.sqrt(sy)];\n }\n\n static normalizeRect(rect) {\n const r = rect.slice(0);\n\n if (rect[0] > rect[2]) {\n r[0] = rect[2];\n r[2] = rect[0];\n }\n\n if (rect[1] > rect[3]) {\n r[1] = rect[3];\n r[3] = rect[1];\n }\n\n return r;\n }\n\n static intersect(rect1, rect2) {\n function compare(a, b) {\n return a - b;\n }\n\n const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);\n const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);\n const result = [];\n rect1 = Util.normalizeRect(rect1);\n rect2 = Util.normalizeRect(rect2);\n\n if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {\n result[0] = orderedX[1];\n result[2] = orderedX[2];\n } else {\n return null;\n }\n\n if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {\n result[1] = orderedY[1];\n result[3] = orderedY[2];\n } else {\n return null;\n }\n\n return result;\n }\n\n}\n\nexports.Util = Util;\nconst PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 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, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC];\n\nfunction stringToPDFString(str) {\n const length = str.length,\n strBuf = [];\n\n if (str[0] === \"\\xFE\" && str[1] === \"\\xFF\") {\n for (let i = 2; i < length; i += 2) {\n strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));\n }\n } else if (str[0] === \"\\xFF\" && str[1] === \"\\xFE\") {\n for (let i = 2; i < length; i += 2) {\n strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));\n }\n } else {\n for (let i = 0; i < length; ++i) {\n const code = PDFStringTranslateTable[str.charCodeAt(i)];\n strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));\n }\n }\n\n return strBuf.join(\"\");\n}\n\nfunction stringToUTF8String(str) {\n return decodeURIComponent(escape(str));\n}\n\nfunction utf8StringToString(str) {\n return unescape(encodeURIComponent(str));\n}\n\nfunction isEmptyObj(obj) {\n for (const key in obj) {\n return false;\n }\n\n return true;\n}\n\nfunction isBool(v) {\n return typeof v === \"boolean\";\n}\n\nfunction isNum(v) {\n return typeof v === \"number\";\n}\n\nfunction isString(v) {\n return typeof v === \"string\";\n}\n\nfunction isArrayBuffer(v) {\n return typeof v === \"object\" && v !== null && v.byteLength !== undefined;\n}\n\nfunction isArrayEqual(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false;\n }\n\n return arr1.every(function (element, index) {\n return element === arr2[index];\n });\n}\n\nfunction createPromiseCapability() {\n const capability = Object.create(null);\n let isSettled = false;\n Object.defineProperty(capability, \"settled\", {\n get() {\n return isSettled;\n }\n\n });\n capability.promise = new Promise(function (resolve, reject) {\n capability.resolve = function (data) {\n isSettled = true;\n resolve(data);\n };\n\n capability.reject = function (reason) {\n isSettled = true;\n reject(reason);\n };\n });\n return capability;\n}\n\nconst createObjectURL = function createObjectURLClosure() {\n const digits = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n return function createObjectURL(data, contentType, forceDataSchema = false) {\n if (!forceDataSchema && URL.createObjectURL) {\n const blob = new Blob([data], {\n type: contentType\n });\n return URL.createObjectURL(blob);\n }\n\n let buffer = `data:${contentType};base64,`;\n\n for (let i = 0, ii = data.length; i < ii; i += 3) {\n const b1 = data[i] & 0xff;\n const b2 = data[i + 1] & 0xff;\n const b3 = data[i + 2] & 0xff;\n const d1 = b1 >> 2,\n d2 = (b1 & 3) << 4 | b2 >> 4;\n const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;\n const d4 = i + 2 < ii ? b3 & 0x3f : 64;\n buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];\n }\n\n return buffer;\n };\n}();\n\nexports.createObjectURL = createObjectURL;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\n;\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.clearPrimitiveCaches = clearPrimitiveCaches;\nexports.isEOF = isEOF;\nexports.isCmd = isCmd;\nexports.isDict = isDict;\nexports.isName = isName;\nexports.isRef = isRef;\nexports.isRefsEqual = isRefsEqual;\nexports.isStream = isStream;\nexports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar EOF = {};\nexports.EOF = EOF;\n\nvar Name = function NameClosure() {\n let nameCache = Object.create(null);\n\n function Name(name) {\n this.name = name;\n }\n\n Name.prototype = {};\n\n Name.get = function Name_get(name) {\n var nameValue = nameCache[name];\n return nameValue ? nameValue : nameCache[name] = new Name(name);\n };\n\n Name._clearCache = function () {\n nameCache = Object.create(null);\n };\n\n return Name;\n}();\n\nexports.Name = Name;\n\nvar Cmd = function CmdClosure() {\n let cmdCache = Object.create(null);\n\n function Cmd(cmd) {\n this.cmd = cmd;\n }\n\n Cmd.prototype = {};\n\n Cmd.get = function Cmd_get(cmd) {\n var cmdValue = cmdCache[cmd];\n return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);\n };\n\n Cmd._clearCache = function () {\n cmdCache = Object.create(null);\n };\n\n return Cmd;\n}();\n\nexports.Cmd = Cmd;\n\nvar Dict = function DictClosure() {\n var nonSerializable = function nonSerializableClosure() {\n return nonSerializable;\n };\n\n function Dict(xref) {\n this._map = Object.create(null);\n this.xref = xref;\n this.objId = null;\n this.suppressEncryption = false;\n this.__nonSerializable__ = nonSerializable;\n }\n\n Dict.prototype = {\n assignXref: function Dict_assignXref(newXref) {\n this.xref = newXref;\n },\n\n get(key1, key2, key3) {\n let value = this._map[key1];\n\n if (value === undefined && key2 !== undefined) {\n value = this._map[key2];\n\n if (value === undefined && key3 !== undefined) {\n value = this._map[key3];\n }\n }\n\n if (value instanceof Ref && this.xref) {\n return this.xref.fetch(value, this.suppressEncryption);\n }\n\n return value;\n },\n\n async getAsync(key1, key2, key3) {\n let value = this._map[key1];\n\n if (value === undefined && key2 !== undefined) {\n value = this._map[key2];\n\n if (value === undefined && key3 !== undefined) {\n value = this._map[key3];\n }\n }\n\n if (value instanceof Ref && this.xref) {\n return this.xref.fetchAsync(value, this.suppressEncryption);\n }\n\n return value;\n },\n\n getArray(key1, key2, key3) {\n let value = this.get(key1, key2, key3);\n\n if (!Array.isArray(value) || !this.xref) {\n return value;\n }\n\n value = value.slice();\n\n for (let i = 0, ii = value.length; i < ii; i++) {\n if (!(value[i] instanceof Ref)) {\n continue;\n }\n\n value[i] = this.xref.fetch(value[i], this.suppressEncryption);\n }\n\n return value;\n },\n\n getRaw: function Dict_getRaw(key) {\n return this._map[key];\n },\n getKeys: function Dict_getKeys() {\n return Object.keys(this._map);\n },\n set: function Dict_set(key, value) {\n this._map[key] = value;\n },\n has: function Dict_has(key) {\n return this._map[key] !== undefined;\n },\n forEach: function Dict_forEach(callback) {\n for (var key in this._map) {\n callback(key, this.get(key));\n }\n }\n };\n Dict.empty = new Dict(null);\n\n Dict.merge = function (xref, dictArray) {\n const mergedDict = new Dict(xref);\n\n for (let i = 0, ii = dictArray.length; i < ii; i++) {\n const dict = dictArray[i];\n\n if (!isDict(dict)) {\n continue;\n }\n\n for (const keyName in dict._map) {\n if (mergedDict._map[keyName] !== undefined) {\n continue;\n }\n\n mergedDict._map[keyName] = dict._map[keyName];\n }\n }\n\n return mergedDict;\n };\n\n return Dict;\n}();\n\nexports.Dict = Dict;\n\nvar Ref = function RefClosure() {\n let refCache = Object.create(null);\n\n function Ref(num, gen) {\n this.num = num;\n this.gen = gen;\n }\n\n Ref.prototype = {\n toString: function Ref_toString() {\n if (this.gen === 0) {\n return `${this.num}R`;\n }\n\n return `${this.num}R${this.gen}`;\n }\n };\n\n Ref.get = function (num, gen) {\n const key = gen === 0 ? `${num}R` : `${num}R${gen}`;\n const refValue = refCache[key];\n return refValue ? refValue : refCache[key] = new Ref(num, gen);\n };\n\n Ref._clearCache = function () {\n refCache = Object.create(null);\n };\n\n return Ref;\n}();\n\nexports.Ref = Ref;\n\nvar RefSet = function RefSetClosure() {\n function RefSet() {\n this.dict = Object.create(null);\n }\n\n RefSet.prototype = {\n has: function RefSet_has(ref) {\n return ref.toString() in this.dict;\n },\n put: function RefSet_put(ref) {\n this.dict[ref.toString()] = true;\n },\n remove: function RefSet_remove(ref) {\n delete this.dict[ref.toString()];\n }\n };\n return RefSet;\n}();\n\nexports.RefSet = RefSet;\n\nvar RefSetCache = function RefSetCacheClosure() {\n function RefSetCache() {\n this.dict = Object.create(null);\n }\n\n RefSetCache.prototype = {\n get: function RefSetCache_get(ref) {\n return this.dict[ref.toString()];\n },\n has: function RefSetCache_has(ref) {\n return ref.toString() in this.dict;\n },\n put: function RefSetCache_put(ref, obj) {\n this.dict[ref.toString()] = obj;\n },\n putAlias: function RefSetCache_putAlias(ref, aliasRef) {\n this.dict[ref.toString()] = this.get(aliasRef);\n },\n forEach: function RefSetCache_forEach(callback) {\n for (const i in this.dict) {\n callback(this.dict[i]);\n }\n },\n clear: function RefSetCache_clear() {\n this.dict = Object.create(null);\n }\n };\n return RefSetCache;\n}();\n\nexports.RefSetCache = RefSetCache;\n\nfunction isEOF(v) {\n return v === EOF;\n}\n\nfunction isName(v, name) {\n return v instanceof Name && (name === undefined || v.name === name);\n}\n\nfunction isCmd(v, cmd) {\n return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);\n}\n\nfunction isDict(v, type) {\n return v instanceof Dict && (type === undefined || isName(v.get(\"Type\"), type));\n}\n\nfunction isRef(v) {\n return v instanceof Ref;\n}\n\nfunction isRefsEqual(v1, v2) {\n return v1.num === v2.num && v1.gen === v2.gen;\n}\n\nfunction isStream(v) {\n return typeof v === \"object\" && v !== null && v.getBytes !== undefined;\n}\n\nfunction clearPrimitiveCaches() {\n Cmd._clearCache();\n\n Name._clearCache();\n\n Ref._clearCache();\n}\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.NetworkPdfManager = exports.LocalPdfManager = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _chunked_stream = __w_pdfjs_require__(6);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nvar _document = __w_pdfjs_require__(8);\n\nvar _stream = __w_pdfjs_require__(11);\n\nclass BasePdfManager {\n constructor() {\n if (this.constructor === BasePdfManager) {\n (0, _util.unreachable)(\"Cannot initialize BasePdfManager.\");\n }\n }\n\n get docId() {\n return this._docId;\n }\n\n get password() {\n return this._password;\n }\n\n get docBaseUrl() {\n let docBaseUrl = null;\n\n if (this._docBaseUrl) {\n const absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);\n\n if (absoluteUrl) {\n docBaseUrl = absoluteUrl.href;\n } else {\n (0, _util.warn)(`Invalid absolute docBaseUrl: \"${this._docBaseUrl}\".`);\n }\n }\n\n return (0, _util.shadow)(this, \"docBaseUrl\", docBaseUrl);\n }\n\n onLoadedStream() {\n (0, _util.unreachable)(\"Abstract method `onLoadedStream` called\");\n }\n\n ensureDoc(prop, args) {\n return this.ensure(this.pdfDocument, prop, args);\n }\n\n ensureXRef(prop, args) {\n return this.ensure(this.pdfDocument.xref, prop, args);\n }\n\n ensureCatalog(prop, args) {\n return this.ensure(this.pdfDocument.catalog, prop, args);\n }\n\n getPage(pageIndex) {\n return this.pdfDocument.getPage(pageIndex);\n }\n\n fontFallback(id, handler) {\n return this.pdfDocument.fontFallback(id, handler);\n }\n\n cleanup() {\n return this.pdfDocument.cleanup();\n }\n\n async ensure(obj, prop, args) {\n (0, _util.unreachable)(\"Abstract method `ensure` called\");\n }\n\n requestRange(begin, end) {\n (0, _util.unreachable)(\"Abstract method `requestRange` called\");\n }\n\n requestLoadedStream() {\n (0, _util.unreachable)(\"Abstract method `requestLoadedStream` called\");\n }\n\n sendProgressiveData(chunk) {\n (0, _util.unreachable)(\"Abstract method `sendProgressiveData` called\");\n }\n\n updatePassword(password) {\n this._password = password;\n }\n\n terminate(reason) {\n (0, _util.unreachable)(\"Abstract method `terminate` called\");\n }\n\n}\n\nclass LocalPdfManager extends BasePdfManager {\n constructor(docId, data, password, evaluatorOptions, docBaseUrl) {\n super();\n this._docId = docId;\n this._password = password;\n this._docBaseUrl = docBaseUrl;\n this.evaluatorOptions = evaluatorOptions;\n const stream = new _stream.Stream(data);\n this.pdfDocument = new _document.PDFDocument(this, stream);\n this._loadedStreamPromise = Promise.resolve(stream);\n }\n\n async ensure(obj, prop, args) {\n const value = obj[prop];\n\n if (typeof value === \"function\") {\n return value.apply(obj, args);\n }\n\n return value;\n }\n\n requestRange(begin, end) {\n return Promise.resolve();\n }\n\n requestLoadedStream() {}\n\n onLoadedStream() {\n return this._loadedStreamPromise;\n }\n\n terminate(reason) {}\n\n}\n\nexports.LocalPdfManager = LocalPdfManager;\n\nclass NetworkPdfManager extends BasePdfManager {\n constructor(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {\n super();\n this._docId = docId;\n this._password = args.password;\n this._docBaseUrl = docBaseUrl;\n this.msgHandler = args.msgHandler;\n this.evaluatorOptions = evaluatorOptions;\n this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {\n msgHandler: args.msgHandler,\n length: args.length,\n disableAutoFetch: args.disableAutoFetch,\n rangeChunkSize: args.rangeChunkSize\n });\n this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());\n }\n\n async ensure(obj, prop, args) {\n try {\n const value = obj[prop];\n\n if (typeof value === \"function\") {\n return value.apply(obj, args);\n }\n\n return value;\n } catch (ex) {\n if (!(ex instanceof _core_utils.MissingDataException)) {\n throw ex;\n }\n\n await this.requestRange(ex.begin, ex.end);\n return this.ensure(obj, prop, args);\n }\n }\n\n requestRange(begin, end) {\n return this.streamManager.requestRange(begin, end);\n }\n\n requestLoadedStream() {\n this.streamManager.requestAllChunks();\n }\n\n sendProgressiveData(chunk) {\n this.streamManager.onReceiveData({\n chunk\n });\n }\n\n onLoadedStream() {\n return this.streamManager.onLoadedStream();\n }\n\n terminate(reason) {\n this.streamManager.abort(reason);\n }\n\n}\n\nexports.NetworkPdfManager = NetworkPdfManager;\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ChunkedStreamManager = exports.ChunkedStream = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nclass ChunkedStream {\n constructor(length, chunkSize, manager) {\n this.bytes = new Uint8Array(length);\n this.start = 0;\n this.pos = 0;\n this.end = length;\n this.chunkSize = chunkSize;\n this.loadedChunks = [];\n this.numChunksLoaded = 0;\n this.numChunks = Math.ceil(length / chunkSize);\n this.manager = manager;\n this.progressiveDataLength = 0;\n this.lastSuccessfulEnsureByteChunk = -1;\n }\n\n getMissingChunks() {\n const chunks = [];\n\n for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {\n if (!this.loadedChunks[chunk]) {\n chunks.push(chunk);\n }\n }\n\n return chunks;\n }\n\n getBaseStreams() {\n return [this];\n }\n\n allChunksLoaded() {\n return this.numChunksLoaded === this.numChunks;\n }\n\n onReceiveData(begin, chunk) {\n const chunkSize = this.chunkSize;\n\n if (begin % chunkSize !== 0) {\n throw new Error(`Bad begin offset: ${begin}`);\n }\n\n const end = begin + chunk.byteLength;\n\n if (end % chunkSize !== 0 && end !== this.bytes.length) {\n throw new Error(`Bad end offset: ${end}`);\n }\n\n this.bytes.set(new Uint8Array(chunk), begin);\n const beginChunk = Math.floor(begin / chunkSize);\n const endChunk = Math.floor((end - 1) / chunkSize) + 1;\n\n for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {\n if (!this.loadedChunks[curChunk]) {\n this.loadedChunks[curChunk] = true;\n ++this.numChunksLoaded;\n }\n }\n }\n\n onReceiveProgressiveData(data) {\n let position = this.progressiveDataLength;\n const beginChunk = Math.floor(position / this.chunkSize);\n this.bytes.set(new Uint8Array(data), position);\n position += data.byteLength;\n this.progressiveDataLength = position;\n const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);\n\n for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {\n if (!this.loadedChunks[curChunk]) {\n this.loadedChunks[curChunk] = true;\n ++this.numChunksLoaded;\n }\n }\n }\n\n ensureByte(pos) {\n if (pos < this.progressiveDataLength) {\n return;\n }\n\n const chunk = Math.floor(pos / this.chunkSize);\n\n if (chunk === this.lastSuccessfulEnsureByteChunk) {\n return;\n }\n\n if (!this.loadedChunks[chunk]) {\n throw new _core_utils.MissingDataException(pos, pos + 1);\n }\n\n this.lastSuccessfulEnsureByteChunk = chunk;\n }\n\n ensureRange(begin, end) {\n if (begin >= end) {\n return;\n }\n\n if (end <= this.progressiveDataLength) {\n return;\n }\n\n const chunkSize = this.chunkSize;\n const beginChunk = Math.floor(begin / chunkSize);\n const endChunk = Math.floor((end - 1) / chunkSize) + 1;\n\n for (let chunk = beginChunk; chunk < endChunk; ++chunk) {\n if (!this.loadedChunks[chunk]) {\n throw new _core_utils.MissingDataException(begin, end);\n }\n }\n }\n\n nextEmptyChunk(beginChunk) {\n const numChunks = this.numChunks;\n\n for (let i = 0; i < numChunks; ++i) {\n const chunk = (beginChunk + i) % numChunks;\n\n if (!this.loadedChunks[chunk]) {\n return chunk;\n }\n }\n\n return null;\n }\n\n hasChunk(chunk) {\n return !!this.loadedChunks[chunk];\n }\n\n get length() {\n return this.end - this.start;\n }\n\n get isEmpty() {\n return this.length === 0;\n }\n\n getByte() {\n const pos = this.pos;\n\n if (pos >= this.end) {\n return -1;\n }\n\n if (pos >= this.progressiveDataLength) {\n this.ensureByte(pos);\n }\n\n return this.bytes[this.pos++];\n }\n\n getUint16() {\n const b0 = this.getByte();\n const b1 = this.getByte();\n\n if (b0 === -1 || b1 === -1) {\n return -1;\n }\n\n return (b0 << 8) + b1;\n }\n\n getInt32() {\n const b0 = this.getByte();\n const b1 = this.getByte();\n const b2 = this.getByte();\n const b3 = this.getByte();\n return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;\n }\n\n getBytes(length, forceClamped = false) {\n const bytes = this.bytes;\n const pos = this.pos;\n const strEnd = this.end;\n\n if (!length) {\n if (strEnd > this.progressiveDataLength) {\n this.ensureRange(pos, strEnd);\n }\n\n const subarray = bytes.subarray(pos, strEnd);\n return forceClamped ? new Uint8ClampedArray(subarray) : subarray;\n }\n\n let end = pos + length;\n\n if (end > strEnd) {\n end = strEnd;\n }\n\n if (end > this.progressiveDataLength) {\n this.ensureRange(pos, end);\n }\n\n this.pos = end;\n const subarray = bytes.subarray(pos, end);\n return forceClamped ? new Uint8ClampedArray(subarray) : subarray;\n }\n\n peekByte() {\n const peekedByte = this.getByte();\n\n if (peekedByte !== -1) {\n this.pos--;\n }\n\n return peekedByte;\n }\n\n peekBytes(length, forceClamped = false) {\n const bytes = this.getBytes(length, forceClamped);\n this.pos -= bytes.length;\n return bytes;\n }\n\n getByteRange(begin, end) {\n if (begin < 0) {\n begin = 0;\n }\n\n if (end > this.end) {\n end = this.end;\n }\n\n if (end > this.progressiveDataLength) {\n this.ensureRange(begin, end);\n }\n\n return this.bytes.subarray(begin, end);\n }\n\n skip(n) {\n if (!n) {\n n = 1;\n }\n\n this.pos += n;\n }\n\n reset() {\n this.pos = this.start;\n }\n\n moveStart() {\n this.start = this.pos;\n }\n\n makeSubStream(start, length, dict) {\n if (length) {\n if (start + length > this.progressiveDataLength) {\n this.ensureRange(start, start + length);\n }\n } else {\n if (start >= this.progressiveDataLength) {\n this.ensureByte(start);\n }\n }\n\n function ChunkedStreamSubstream() {}\n\n ChunkedStreamSubstream.prototype = Object.create(this);\n\n ChunkedStreamSubstream.prototype.getMissingChunks = function () {\n const chunkSize = this.chunkSize;\n const beginChunk = Math.floor(this.start / chunkSize);\n const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;\n const missingChunks = [];\n\n for (let chunk = beginChunk; chunk < endChunk; ++chunk) {\n if (!this.loadedChunks[chunk]) {\n missingChunks.push(chunk);\n }\n }\n\n return missingChunks;\n };\n\n ChunkedStreamSubstream.prototype.allChunksLoaded = function () {\n if (this.numChunksLoaded === this.numChunks) {\n return true;\n }\n\n return this.getMissingChunks().length === 0;\n };\n\n const subStream = new ChunkedStreamSubstream();\n subStream.pos = subStream.start = start;\n subStream.end = start + length || this.end;\n subStream.dict = dict;\n return subStream;\n }\n\n}\n\nexports.ChunkedStream = ChunkedStream;\n\nclass ChunkedStreamManager {\n constructor(pdfNetworkStream, args) {\n this.length = args.length;\n this.chunkSize = args.rangeChunkSize;\n this.stream = new ChunkedStream(this.length, this.chunkSize, this);\n this.pdfNetworkStream = pdfNetworkStream;\n this.disableAutoFetch = args.disableAutoFetch;\n this.msgHandler = args.msgHandler;\n this.currRequestId = 0;\n this.chunksNeededByRequest = Object.create(null);\n this.requestsByChunk = Object.create(null);\n this.promisesByRequest = Object.create(null);\n this.progressiveDataLength = 0;\n this.aborted = false;\n this._loadedStreamCapability = (0, _util.createPromiseCapability)();\n }\n\n onLoadedStream() {\n return this._loadedStreamCapability.promise;\n }\n\n sendRequest(begin, end) {\n const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);\n\n if (!rangeReader.isStreamingSupported) {\n rangeReader.onProgress = this.onProgress.bind(this);\n }\n\n let chunks = [],\n loaded = 0;\n const promise = new Promise((resolve, reject) => {\n const readChunk = chunk => {\n try {\n if (!chunk.done) {\n const data = chunk.value;\n chunks.push(data);\n loaded += (0, _util.arrayByteLength)(data);\n\n if (rangeReader.isStreamingSupported) {\n this.onProgress({\n loaded\n });\n }\n\n rangeReader.read().then(readChunk, reject);\n return;\n }\n\n const chunkData = (0, _util.arraysToBytes)(chunks);\n chunks = null;\n resolve(chunkData);\n } catch (e) {\n reject(e);\n }\n };\n\n rangeReader.read().then(readChunk, reject);\n });\n promise.then(data => {\n if (this.aborted) {\n return;\n }\n\n this.onReceiveData({\n chunk: data,\n begin\n });\n });\n }\n\n requestAllChunks() {\n const missingChunks = this.stream.getMissingChunks();\n\n this._requestChunks(missingChunks);\n\n return this._loadedStreamCapability.promise;\n }\n\n _requestChunks(chunks) {\n const requestId = this.currRequestId++;\n const chunksNeeded = Object.create(null);\n this.chunksNeededByRequest[requestId] = chunksNeeded;\n\n for (const chunk of chunks) {\n if (!this.stream.hasChunk(chunk)) {\n chunksNeeded[chunk] = true;\n }\n }\n\n if ((0, _util.isEmptyObj)(chunksNeeded)) {\n return Promise.resolve();\n }\n\n const capability = (0, _util.createPromiseCapability)();\n this.promisesByRequest[requestId] = capability;\n const chunksToRequest = [];\n\n for (let chunk in chunksNeeded) {\n chunk = chunk | 0;\n\n if (!(chunk in this.requestsByChunk)) {\n this.requestsByChunk[chunk] = [];\n chunksToRequest.push(chunk);\n }\n\n this.requestsByChunk[chunk].push(requestId);\n }\n\n if (!chunksToRequest.length) {\n return capability.promise;\n }\n\n const groupedChunksToRequest = this.groupChunks(chunksToRequest);\n\n for (const groupedChunk of groupedChunksToRequest) {\n const begin = groupedChunk.beginChunk * this.chunkSize;\n const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);\n this.sendRequest(begin, end);\n }\n\n return capability.promise;\n }\n\n getStream() {\n return this.stream;\n }\n\n requestRange(begin, end) {\n end = Math.min(end, this.length);\n const beginChunk = this.getBeginChunk(begin);\n const endChunk = this.getEndChunk(end);\n const chunks = [];\n\n for (let chunk = beginChunk; chunk < endChunk; ++chunk) {\n chunks.push(chunk);\n }\n\n return this._requestChunks(chunks);\n }\n\n requestRanges(ranges = []) {\n const chunksToRequest = [];\n\n for (const range of ranges) {\n const beginChunk = this.getBeginChunk(range.begin);\n const endChunk = this.getEndChunk(range.end);\n\n for (let chunk = beginChunk; chunk < endChunk; ++chunk) {\n if (!chunksToRequest.includes(chunk)) {\n chunksToRequest.push(chunk);\n }\n }\n }\n\n chunksToRequest.sort(function (a, b) {\n return a - b;\n });\n return this._requestChunks(chunksToRequest);\n }\n\n groupChunks(chunks) {\n const groupedChunks = [];\n let beginChunk = -1;\n let prevChunk = -1;\n\n for (let i = 0, ii = chunks.length; i < ii; ++i) {\n const chunk = chunks[i];\n\n if (beginChunk < 0) {\n beginChunk = chunk;\n }\n\n if (prevChunk >= 0 && prevChunk + 1 !== chunk) {\n groupedChunks.push({\n beginChunk,\n endChunk: prevChunk + 1\n });\n beginChunk = chunk;\n }\n\n if (i + 1 === chunks.length) {\n groupedChunks.push({\n beginChunk,\n endChunk: chunk + 1\n });\n }\n\n prevChunk = chunk;\n }\n\n return groupedChunks;\n }\n\n onProgress(args) {\n this.msgHandler.send(\"DocProgress\", {\n loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,\n total: this.length\n });\n }\n\n onReceiveData(args) {\n const chunk = args.chunk;\n const isProgressive = args.begin === undefined;\n const begin = isProgressive ? this.progressiveDataLength : args.begin;\n const end = begin + chunk.byteLength;\n const beginChunk = Math.floor(begin / this.chunkSize);\n const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);\n\n if (isProgressive) {\n this.stream.onReceiveProgressiveData(chunk);\n this.progressiveDataLength = end;\n } else {\n this.stream.onReceiveData(begin, chunk);\n }\n\n if (this.stream.allChunksLoaded()) {\n this._loadedStreamCapability.resolve(this.stream);\n }\n\n const loadedRequests = [];\n\n for (let chunk = beginChunk; chunk < endChunk; ++chunk) {\n const requestIds = this.requestsByChunk[chunk] || [];\n delete this.requestsByChunk[chunk];\n\n for (const requestId of requestIds) {\n const chunksNeeded = this.chunksNeededByRequest[requestId];\n\n if (chunk in chunksNeeded) {\n delete chunksNeeded[chunk];\n }\n\n if (!(0, _util.isEmptyObj)(chunksNeeded)) {\n continue;\n }\n\n loadedRequests.push(requestId);\n }\n }\n\n if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) {\n let nextEmptyChunk;\n\n if (this.stream.numChunksLoaded === 1) {\n const lastChunk = this.stream.numChunks - 1;\n\n if (!this.stream.hasChunk(lastChunk)) {\n nextEmptyChunk = lastChunk;\n }\n } else {\n nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);\n }\n\n if (Number.isInteger(nextEmptyChunk)) {\n this._requestChunks([nextEmptyChunk]);\n }\n }\n\n for (const requestId of loadedRequests) {\n const capability = this.promisesByRequest[requestId];\n delete this.promisesByRequest[requestId];\n capability.resolve();\n }\n\n this.msgHandler.send(\"DocProgress\", {\n loaded: this.stream.numChunksLoaded * this.chunkSize,\n total: this.length\n });\n }\n\n onError(err) {\n this._loadedStreamCapability.reject(err);\n }\n\n getBeginChunk(begin) {\n return Math.floor(begin / this.chunkSize);\n }\n\n getEndChunk(end) {\n return Math.floor((end - 1) / this.chunkSize) + 1;\n }\n\n abort(reason) {\n this.aborted = true;\n\n if (this.pdfNetworkStream) {\n this.pdfNetworkStream.cancelAllRequests(reason);\n }\n\n for (const requestId in this.promisesByRequest) {\n this.promisesByRequest[requestId].reject(reason);\n }\n }\n\n}\n\nexports.ChunkedStreamManager = ChunkedStreamManager;\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getLookupTableFactory = getLookupTableFactory;\nexports.getInheritableProperty = getInheritableProperty;\nexports.toRomanNumerals = toRomanNumerals;\nexports.log2 = log2;\nexports.readInt8 = readInt8;\nexports.readUint16 = readUint16;\nexports.readUint32 = readUint32;\nexports.isWhiteSpace = isWhiteSpace;\nexports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nfunction getLookupTableFactory(initializer) {\n let lookup;\n return function () {\n if (initializer) {\n lookup = Object.create(null);\n initializer(lookup);\n initializer = null;\n }\n\n return lookup;\n };\n}\n\nclass MissingDataException extends _util.BaseException {\n constructor(begin, end) {\n super(`Missing data [${begin}, ${end})`);\n this.begin = begin;\n this.end = end;\n }\n\n}\n\nexports.MissingDataException = MissingDataException;\n\nclass XRefEntryException extends _util.BaseException {}\n\nexports.XRefEntryException = XRefEntryException;\n\nclass XRefParseException extends _util.BaseException {}\n\nexports.XRefParseException = XRefParseException;\n\nfunction getInheritableProperty({\n dict,\n key,\n getArray = false,\n stopWhenFound = true\n}) {\n const LOOP_LIMIT = 100;\n let loopCount = 0;\n let values;\n\n while (dict) {\n const value = getArray ? dict.getArray(key) : dict.get(key);\n\n if (value !== undefined) {\n if (stopWhenFound) {\n return value;\n }\n\n if (!values) {\n values = [];\n }\n\n values.push(value);\n }\n\n if (++loopCount > LOOP_LIMIT) {\n (0, _util.warn)(`getInheritableProperty: maximum loop count exceeded for \"${key}\"`);\n break;\n }\n\n dict = dict.get(\"Parent\");\n }\n\n return values;\n}\n\nconst ROMAN_NUMBER_MAP = [\"\", \"C\", \"CC\", \"CCC\", \"CD\", \"D\", \"DC\", \"DCC\", \"DCCC\", \"CM\", \"\", \"X\", \"XX\", \"XXX\", \"XL\", \"L\", \"LX\", \"LXX\", \"LXXX\", \"XC\", \"\", \"I\", \"II\", \"III\", \"IV\", \"V\", \"VI\", \"VII\", \"VIII\", \"IX\"];\n\nfunction toRomanNumerals(number, lowerCase = false) {\n (0, _util.assert)(Number.isInteger(number) && number > 0, \"The number should be a positive integer.\");\n const romanBuf = [];\n let pos;\n\n while (number >= 1000) {\n number -= 1000;\n romanBuf.push(\"M\");\n }\n\n pos = number / 100 | 0;\n number %= 100;\n romanBuf.push(ROMAN_NUMBER_MAP[pos]);\n pos = number / 10 | 0;\n number %= 10;\n romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);\n romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);\n const romanStr = romanBuf.join(\"\");\n return lowerCase ? romanStr.toLowerCase() : romanStr;\n}\n\nfunction log2(x) {\n if (x <= 0) {\n return 0;\n }\n\n return Math.ceil(Math.log2(x));\n}\n\nfunction readInt8(data, offset) {\n return data[offset] << 24 >> 24;\n}\n\nfunction readUint16(data, offset) {\n return data[offset] << 8 | data[offset + 1];\n}\n\nfunction readUint32(data, offset) {\n return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;\n}\n\nfunction isWhiteSpace(ch) {\n return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;\n}\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.PDFDocument = exports.Page = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _obj = __w_pdfjs_require__(9);\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nvar _stream = __w_pdfjs_require__(11);\n\nvar _annotation = __w_pdfjs_require__(23);\n\nvar _crypto = __w_pdfjs_require__(21);\n\nvar _parser = __w_pdfjs_require__(10);\n\nvar _operator_list = __w_pdfjs_require__(24);\n\nvar _evaluator = __w_pdfjs_require__(25);\n\nvar _function = __w_pdfjs_require__(39);\n\nconst DEFAULT_USER_UNIT = 1.0;\nconst LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];\n\nfunction isAnnotationRenderable(annotation, intent) {\n return intent === \"display\" && annotation.viewable || intent === \"print\" && annotation.printable;\n}\n\nclass Page {\n constructor({\n pdfManager,\n xref,\n pageIndex,\n pageDict,\n ref,\n fontCache,\n builtInCMapCache,\n pdfFunctionFactory\n }) {\n this.pdfManager = pdfManager;\n this.pageIndex = pageIndex;\n this.pageDict = pageDict;\n this.xref = xref;\n this.ref = ref;\n this.fontCache = fontCache;\n this.builtInCMapCache = builtInCMapCache;\n this.pdfFunctionFactory = pdfFunctionFactory;\n this.evaluatorOptions = pdfManager.evaluatorOptions;\n this.resourcesPromise = null;\n const idCounters = {\n obj: 0\n };\n this.idFactory = {\n createObjId() {\n return `p${pageIndex}_${++idCounters.obj}`;\n },\n\n getDocId() {\n return `g_${pdfManager.docId}`;\n }\n\n };\n }\n\n _getInheritableProperty(key, getArray = false) {\n const value = (0, _core_utils.getInheritableProperty)({\n dict: this.pageDict,\n key,\n getArray,\n stopWhenFound: false\n });\n\n if (!Array.isArray(value)) {\n return value;\n }\n\n if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {\n return value[0];\n }\n\n return _primitives.Dict.merge(this.xref, value);\n }\n\n get content() {\n return this.pageDict.get(\"Contents\");\n }\n\n get resources() {\n return (0, _util.shadow)(this, \"resources\", this._getInheritableProperty(\"Resources\") || _primitives.Dict.empty);\n }\n\n _getBoundingBox(name) {\n const box = this._getInheritableProperty(name, true);\n\n if (Array.isArray(box) && box.length === 4) {\n if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {\n return box;\n }\n\n (0, _util.warn)(`Empty /${name} entry.`);\n }\n\n return null;\n }\n\n get mediaBox() {\n return (0, _util.shadow)(this, \"mediaBox\", this._getBoundingBox(\"MediaBox\") || LETTER_SIZE_MEDIABOX);\n }\n\n get cropBox() {\n return (0, _util.shadow)(this, \"cropBox\", this._getBoundingBox(\"CropBox\") || this.mediaBox);\n }\n\n get userUnit() {\n let obj = this.pageDict.get(\"UserUnit\");\n\n if (!(0, _util.isNum)(obj) || obj <= 0) {\n obj = DEFAULT_USER_UNIT;\n }\n\n return (0, _util.shadow)(this, \"userUnit\", obj);\n }\n\n get view() {\n const {\n cropBox,\n mediaBox\n } = this;\n let view;\n\n if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {\n view = mediaBox;\n } else {\n const box = _util.Util.intersect(cropBox, mediaBox);\n\n if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {\n view = box;\n } else {\n (0, _util.warn)(\"Empty /CropBox and /MediaBox intersection.\");\n }\n }\n\n return (0, _util.shadow)(this, \"view\", view || mediaBox);\n }\n\n get rotate() {\n let rotate = this._getInheritableProperty(\"Rotate\") || 0;\n\n if (rotate % 90 !== 0) {\n rotate = 0;\n } else if (rotate >= 360) {\n rotate = rotate % 360;\n } else if (rotate < 0) {\n rotate = (rotate % 360 + 360) % 360;\n }\n\n return (0, _util.shadow)(this, \"rotate\", rotate);\n }\n\n getContentStream() {\n const content = this.content;\n let stream;\n\n if (Array.isArray(content)) {\n const xref = this.xref;\n const streams = [];\n\n for (const stream of content) {\n streams.push(xref.fetchIfRef(stream));\n }\n\n stream = new _stream.StreamsSequenceStream(streams);\n } else if ((0, _primitives.isStream)(content)) {\n stream = content;\n } else {\n stream = new _stream.NullStream();\n }\n\n return stream;\n }\n\n loadResources(keys) {\n if (!this.resourcesPromise) {\n this.resourcesPromise = this.pdfManager.ensure(this, \"resources\");\n }\n\n return this.resourcesPromise.then(() => {\n const objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref);\n return objectLoader.load();\n });\n }\n\n getOperatorList({\n handler,\n sink,\n task,\n intent,\n renderInteractiveForms\n }) {\n const contentStreamPromise = this.pdfManager.ensure(this, \"getContentStream\");\n const resourcesPromise = this.loadResources([\"ExtGState\", \"ColorSpace\", \"Pattern\", \"Shading\", \"XObject\", \"Font\"]);\n const partialEvaluator = new _evaluator.PartialEvaluator({\n xref: this.xref,\n handler,\n pageIndex: this.pageIndex,\n idFactory: this.idFactory,\n fontCache: this.fontCache,\n builtInCMapCache: this.builtInCMapCache,\n options: this.evaluatorOptions,\n pdfFunctionFactory: this.pdfFunctionFactory\n });\n const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);\n const pageListPromise = dataPromises.then(([contentStream]) => {\n const opList = new _operator_list.OperatorList(intent, sink, this.pageIndex);\n handler.send(\"StartRenderPage\", {\n transparency: partialEvaluator.hasBlendModes(this.resources),\n pageIndex: this.pageIndex,\n intent\n });\n return partialEvaluator.getOperatorList({\n stream: contentStream,\n task,\n resources: this.resources,\n operatorList: opList\n }).then(function () {\n return opList;\n });\n });\n return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {\n if (annotations.length === 0) {\n pageOpList.flush(true);\n return {\n length: pageOpList.totalLength\n };\n }\n\n const opListPromises = [];\n\n for (const annotation of annotations) {\n if (isAnnotationRenderable(annotation, intent)) {\n opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms));\n }\n }\n\n return Promise.all(opListPromises).then(function (opLists) {\n pageOpList.addOp(_util.OPS.beginAnnotations, []);\n\n for (const opList of opLists) {\n pageOpList.addOpList(opList);\n }\n\n pageOpList.addOp(_util.OPS.endAnnotations, []);\n pageOpList.flush(true);\n return {\n length: pageOpList.totalLength\n };\n });\n });\n }\n\n extractTextContent({\n handler,\n task,\n normalizeWhitespace,\n sink,\n combineTextItems\n }) {\n const contentStreamPromise = this.pdfManager.ensure(this, \"getContentStream\");\n const resourcesPromise = this.loadResources([\"ExtGState\", \"XObject\", \"Font\"]);\n const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);\n return dataPromises.then(([contentStream]) => {\n const partialEvaluator = new _evaluator.PartialEvaluator({\n xref: this.xref,\n handler,\n pageIndex: this.pageIndex,\n idFactory: this.idFactory,\n fontCache: this.fontCache,\n builtInCMapCache: this.builtInCMapCache,\n options: this.evaluatorOptions,\n pdfFunctionFactory: this.pdfFunctionFactory\n });\n return partialEvaluator.getTextContent({\n stream: contentStream,\n task,\n resources: this.resources,\n normalizeWhitespace,\n combineTextItems,\n sink\n });\n });\n }\n\n getAnnotationsData(intent) {\n return this._parsedAnnotations.then(function (annotations) {\n const annotationsData = [];\n\n for (let i = 0, ii = annotations.length; i < ii; i++) {\n if (!intent || isAnnotationRenderable(annotations[i], intent)) {\n annotationsData.push(annotations[i].data);\n }\n }\n\n return annotationsData;\n });\n }\n\n get annotations() {\n return (0, _util.shadow)(this, \"annotations\", this._getInheritableProperty(\"Annots\") || []);\n }\n\n get _parsedAnnotations() {\n const parsedAnnotations = this.pdfManager.ensure(this, \"annotations\").then(() => {\n const annotationRefs = this.annotations;\n const annotationPromises = [];\n\n for (let i = 0, ii = annotationRefs.length; i < ii; i++) {\n annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRefs[i], this.pdfManager, this.idFactory));\n }\n\n return Promise.all(annotationPromises).then(function (annotations) {\n return annotations.filter(function isDefined(annotation) {\n return !!annotation;\n });\n }, function (reason) {\n (0, _util.warn)(`_parsedAnnotations: \"${reason}\".`);\n return [];\n });\n });\n return (0, _util.shadow)(this, \"_parsedAnnotations\", parsedAnnotations);\n }\n\n}\n\nexports.Page = Page;\nconst PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);\nconst STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);\nconst ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);\nconst FINGERPRINT_FIRST_BYTES = 1024;\nconst EMPTY_FINGERPRINT = \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\";\nconst PDF_HEADER_VERSION_REGEXP = /^[1-9]\\.[0-9]$/;\n\nfunction find(stream, signature, limit = 1024, backwards = false) {\n const signatureLength = signature.length;\n const scanBytes = stream.peekBytes(limit);\n const scanLength = scanBytes.length - signatureLength;\n\n if (scanLength <= 0) {\n return false;\n }\n\n if (backwards) {\n const signatureEnd = signatureLength - 1;\n let pos = scanBytes.length - 1;\n\n while (pos >= signatureEnd) {\n let j = 0;\n\n while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {\n j++;\n }\n\n if (j >= signatureLength) {\n stream.pos += pos - signatureEnd;\n return true;\n }\n\n pos--;\n }\n } else {\n let pos = 0;\n\n while (pos <= scanLength) {\n let j = 0;\n\n while (j < signatureLength && scanBytes[pos + j] === signature[j]) {\n j++;\n }\n\n if (j >= signatureLength) {\n stream.pos += pos;\n return true;\n }\n\n pos++;\n }\n }\n\n return false;\n}\n\nclass PDFDocument {\n constructor(pdfManager, arg) {\n let stream;\n\n if ((0, _primitives.isStream)(arg)) {\n stream = arg;\n } else if ((0, _util.isArrayBuffer)(arg)) {\n stream = new _stream.Stream(arg);\n } else {\n throw new Error(\"PDFDocument: Unknown argument type\");\n }\n\n if (stream.length <= 0) {\n throw new _util.InvalidPDFException(\"The PDF file is empty, i.e. its size is zero bytes.\");\n }\n\n this.pdfManager = pdfManager;\n this.stream = stream;\n this.xref = new _obj.XRef(stream, pdfManager);\n this.pdfFunctionFactory = new _function.PDFFunctionFactory({\n xref: this.xref,\n isEvalSupported: pdfManager.evaluatorOptions.isEvalSupported\n });\n this._pagePromises = [];\n }\n\n parse(recoveryMode) {\n this.setup(recoveryMode);\n const version = this.catalog.catDict.get(\"Version\");\n\n if ((0, _primitives.isName)(version)) {\n this.pdfFormatVersion = version.name;\n }\n\n try {\n this.acroForm = this.catalog.catDict.get(\"AcroForm\");\n\n if (this.acroForm) {\n this.xfa = this.acroForm.get(\"XFA\");\n const fields = this.acroForm.get(\"Fields\");\n\n if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) {\n this.acroForm = null;\n }\n }\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n (0, _util.info)(\"Cannot fetch AcroForm entry; assuming no AcroForms are present\");\n this.acroForm = null;\n }\n\n try {\n const collection = this.catalog.catDict.get(\"Collection\");\n\n if ((0, _primitives.isDict)(collection) && collection.getKeys().length > 0) {\n this.collection = collection;\n }\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n (0, _util.info)(\"Cannot fetch Collection dictionary.\");\n }\n }\n\n get linearization() {\n let linearization = null;\n\n try {\n linearization = _parser.Linearization.create(this.stream);\n } catch (err) {\n if (err instanceof _core_utils.MissingDataException) {\n throw err;\n }\n\n (0, _util.info)(err);\n }\n\n return (0, _util.shadow)(this, \"linearization\", linearization);\n }\n\n get startXRef() {\n const stream = this.stream;\n let startXRef = 0;\n\n if (this.linearization) {\n stream.reset();\n\n if (find(stream, ENDOBJ_SIGNATURE)) {\n startXRef = stream.pos + 6 - stream.start;\n }\n } else {\n const step = 1024;\n const startXRefLength = STARTXREF_SIGNATURE.length;\n let found = false,\n pos = stream.end;\n\n while (!found && pos > 0) {\n pos -= step - startXRefLength;\n\n if (pos < 0) {\n pos = 0;\n }\n\n stream.pos = pos;\n found = find(stream, STARTXREF_SIGNATURE, step, true);\n }\n\n if (found) {\n stream.skip(9);\n let ch;\n\n do {\n ch = stream.getByte();\n } while ((0, _core_utils.isWhiteSpace)(ch));\n\n let str = \"\";\n\n while (ch >= 0x20 && ch <= 0x39) {\n str += String.fromCharCode(ch);\n ch = stream.getByte();\n }\n\n startXRef = parseInt(str, 10);\n\n if (isNaN(startXRef)) {\n startXRef = 0;\n }\n }\n }\n\n return (0, _util.shadow)(this, \"startXRef\", startXRef);\n }\n\n checkHeader() {\n const stream = this.stream;\n stream.reset();\n\n if (!find(stream, PDF_HEADER_SIGNATURE)) {\n return;\n }\n\n stream.moveStart();\n const MAX_PDF_VERSION_LENGTH = 12;\n let version = \"\",\n ch;\n\n while ((ch = stream.getByte()) > 0x20) {\n if (version.length >= MAX_PDF_VERSION_LENGTH) {\n break;\n }\n\n version += String.fromCharCode(ch);\n }\n\n if (!this.pdfFormatVersion) {\n this.pdfFormatVersion = version.substring(5);\n }\n }\n\n parseStartXRef() {\n this.xref.setStartXRef(this.startXRef);\n }\n\n setup(recoveryMode) {\n this.xref.parse(recoveryMode);\n this.catalog = new _obj.Catalog(this.pdfManager, this.xref);\n }\n\n get numPages() {\n const linearization = this.linearization;\n const num = linearization ? linearization.numPages : this.catalog.numPages;\n return (0, _util.shadow)(this, \"numPages\", num);\n }\n\n get documentInfo() {\n const DocumentInfoValidators = {\n Title: _util.isString,\n Author: _util.isString,\n Subject: _util.isString,\n Keywords: _util.isString,\n Creator: _util.isString,\n Producer: _util.isString,\n CreationDate: _util.isString,\n ModDate: _util.isString,\n Trapped: _primitives.isName\n };\n let version = this.pdfFormatVersion;\n\n if (typeof version !== \"string\" || !PDF_HEADER_VERSION_REGEXP.test(version)) {\n (0, _util.warn)(`Invalid PDF header version number: ${version}`);\n version = null;\n }\n\n const docInfo = {\n PDFFormatVersion: version,\n IsLinearized: !!this.linearization,\n IsAcroFormPresent: !!this.acroForm,\n IsXFAPresent: !!this.xfa,\n IsCollectionPresent: !!this.collection\n };\n let infoDict;\n\n try {\n infoDict = this.xref.trailer.get(\"Info\");\n } catch (err) {\n if (err instanceof _core_utils.MissingDataException) {\n throw err;\n }\n\n (0, _util.info)(\"The document information dictionary is invalid.\");\n }\n\n if ((0, _primitives.isDict)(infoDict)) {\n for (const key of infoDict.getKeys()) {\n const value = infoDict.get(key);\n\n if (DocumentInfoValidators[key]) {\n if (DocumentInfoValidators[key](value)) {\n docInfo[key] = typeof value !== \"string\" ? value : (0, _util.stringToPDFString)(value);\n } else {\n (0, _util.info)(`Bad value in document info for \"${key}\".`);\n }\n } else if (typeof key === \"string\") {\n let customValue;\n\n if ((0, _util.isString)(value)) {\n customValue = (0, _util.stringToPDFString)(value);\n } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {\n customValue = value;\n } else {\n (0, _util.info)(`Unsupported value in document info for (custom) \"${key}\".`);\n continue;\n }\n\n if (!docInfo[\"Custom\"]) {\n docInfo[\"Custom\"] = Object.create(null);\n }\n\n docInfo[\"Custom\"][key] = customValue;\n }\n }\n }\n\n return (0, _util.shadow)(this, \"documentInfo\", docInfo);\n }\n\n get fingerprint() {\n let hash;\n const idArray = this.xref.trailer.get(\"ID\");\n\n if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {\n hash = (0, _util.stringToBytes)(idArray[0]);\n } else {\n hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);\n }\n\n const fingerprintBuf = [];\n\n for (let i = 0, ii = hash.length; i < ii; i++) {\n const hex = hash[i].toString(16);\n fingerprintBuf.push(hex.padStart(2, \"0\"));\n }\n\n return (0, _util.shadow)(this, \"fingerprint\", fingerprintBuf.join(\"\"));\n }\n\n _getLinearizationPage(pageIndex) {\n const {\n catalog,\n linearization\n } = this;\n (0, _util.assert)(linearization && linearization.pageFirst === pageIndex);\n\n const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);\n\n return this.xref.fetchAsync(ref).then(obj => {\n if ((0, _primitives.isDict)(obj, \"Page\") || (0, _primitives.isDict)(obj) && !obj.has(\"Type\") && obj.has(\"Contents\")) {\n if (ref && !catalog.pageKidsCountCache.has(ref)) {\n catalog.pageKidsCountCache.put(ref, 1);\n }\n\n return [obj, ref];\n }\n\n throw new _util.FormatError(\"The Linearization dictionary doesn't point \" + \"to a valid Page dictionary.\");\n }).catch(reason => {\n (0, _util.info)(reason);\n return catalog.getPageDict(pageIndex);\n });\n }\n\n getPage(pageIndex) {\n if (this._pagePromises[pageIndex] !== undefined) {\n return this._pagePromises[pageIndex];\n }\n\n const {\n catalog,\n linearization\n } = this;\n const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);\n return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => {\n return new Page({\n pdfManager: this.pdfManager,\n xref: this.xref,\n pageIndex,\n pageDict,\n ref,\n fontCache: catalog.fontCache,\n builtInCMapCache: catalog.builtInCMapCache,\n pdfFunctionFactory: this.pdfFunctionFactory\n });\n });\n }\n\n checkFirstPage() {\n return this.getPage(0).catch(async reason => {\n if (reason instanceof _core_utils.XRefEntryException) {\n this._pagePromises.length = 0;\n await this.cleanup();\n throw new _core_utils.XRefParseException();\n }\n });\n }\n\n fontFallback(id, handler) {\n return this.catalog.fontFallback(id, handler);\n }\n\n async cleanup() {\n return this.catalog ? this.catalog.cleanup() : (0, _primitives.clearPrimitiveCaches)();\n }\n\n}\n\nexports.PDFDocument = PDFDocument;\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _parser = __w_pdfjs_require__(10);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nvar _crypto = __w_pdfjs_require__(21);\n\nvar _colorspace = __w_pdfjs_require__(22);\n\nfunction fetchDestination(dest) {\n return (0, _primitives.isDict)(dest) ? dest.get(\"D\") : dest;\n}\n\nclass Catalog {\n constructor(pdfManager, xref) {\n this.pdfManager = pdfManager;\n this.xref = xref;\n this.catDict = xref.getCatalogObj();\n\n if (!(0, _primitives.isDict)(this.catDict)) {\n throw new _util.FormatError(\"Catalog object is not a dictionary.\");\n }\n\n this.fontCache = new _primitives.RefSetCache();\n this.builtInCMapCache = new Map();\n this.pageKidsCountCache = new _primitives.RefSetCache();\n }\n\n get metadata() {\n const streamRef = this.catDict.getRaw(\"Metadata\");\n\n if (!(0, _primitives.isRef)(streamRef)) {\n return (0, _util.shadow)(this, \"metadata\", null);\n }\n\n const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);\n const stream = this.xref.fetch(streamRef, suppressEncryption);\n let metadata;\n\n if (stream && (0, _primitives.isDict)(stream.dict)) {\n const type = stream.dict.get(\"Type\");\n const subtype = stream.dict.get(\"Subtype\");\n\n if ((0, _primitives.isName)(type, \"Metadata\") && (0, _primitives.isName)(subtype, \"XML\")) {\n try {\n metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes()));\n } catch (e) {\n if (e instanceof _core_utils.MissingDataException) {\n throw e;\n }\n\n (0, _util.info)(\"Skipping invalid metadata.\");\n }\n }\n }\n\n return (0, _util.shadow)(this, \"metadata\", metadata);\n }\n\n get toplevelPagesDict() {\n const pagesObj = this.catDict.get(\"Pages\");\n\n if (!(0, _primitives.isDict)(pagesObj)) {\n throw new _util.FormatError(\"Invalid top-level pages dictionary.\");\n }\n\n return (0, _util.shadow)(this, \"toplevelPagesDict\", pagesObj);\n }\n\n get documentOutline() {\n let obj = null;\n\n try {\n obj = this._readDocumentOutline();\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n (0, _util.warn)(\"Unable to read document outline.\");\n }\n\n return (0, _util.shadow)(this, \"documentOutline\", obj);\n }\n\n _readDocumentOutline() {\n let obj = this.catDict.get(\"Outlines\");\n\n if (!(0, _primitives.isDict)(obj)) {\n return null;\n }\n\n obj = obj.getRaw(\"First\");\n\n if (!(0, _primitives.isRef)(obj)) {\n return null;\n }\n\n const root = {\n items: []\n };\n const queue = [{\n obj,\n parent: root\n }];\n const processed = new _primitives.RefSet();\n processed.put(obj);\n const xref = this.xref,\n blackColor = new Uint8ClampedArray(3);\n\n while (queue.length > 0) {\n const i = queue.shift();\n const outlineDict = xref.fetchIfRef(i.obj);\n\n if (outlineDict === null) {\n continue;\n }\n\n if (!outlineDict.has(\"Title\")) {\n throw new _util.FormatError(\"Invalid outline item encountered.\");\n }\n\n const data = {\n url: null,\n dest: null\n };\n Catalog.parseDestDictionary({\n destDict: outlineDict,\n resultObj: data,\n docBaseUrl: this.pdfManager.docBaseUrl\n });\n const title = outlineDict.get(\"Title\");\n const flags = outlineDict.get(\"F\") || 0;\n const color = outlineDict.getArray(\"C\");\n const count = outlineDict.get(\"Count\");\n let rgbColor = blackColor;\n\n if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {\n rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);\n }\n\n const outlineItem = {\n dest: data.dest,\n url: data.url,\n unsafeUrl: data.unsafeUrl,\n newWindow: data.newWindow,\n title: (0, _util.stringToPDFString)(title),\n color: rgbColor,\n count: Number.isInteger(count) ? count : undefined,\n bold: !!(flags & 2),\n italic: !!(flags & 1),\n items: []\n };\n i.parent.items.push(outlineItem);\n obj = outlineDict.getRaw(\"First\");\n\n if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {\n queue.push({\n obj,\n parent: outlineItem\n });\n processed.put(obj);\n }\n\n obj = outlineDict.getRaw(\"Next\");\n\n if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {\n queue.push({\n obj,\n parent: i.parent\n });\n processed.put(obj);\n }\n }\n\n return root.items.length > 0 ? root.items : null;\n }\n\n get permissions() {\n let permissions = null;\n\n try {\n permissions = this._readPermissions();\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n (0, _util.warn)(\"Unable to read permissions.\");\n }\n\n return (0, _util.shadow)(this, \"permissions\", permissions);\n }\n\n _readPermissions() {\n const encrypt = this.xref.trailer.get(\"Encrypt\");\n\n if (!(0, _primitives.isDict)(encrypt)) {\n return null;\n }\n\n let flags = encrypt.get(\"P\");\n\n if (!(0, _util.isNum)(flags)) {\n return null;\n }\n\n flags += 2 ** 32;\n const permissions = [];\n\n for (const key in _util.PermissionFlag) {\n const value = _util.PermissionFlag[key];\n\n if (flags & value) {\n permissions.push(value);\n }\n }\n\n return permissions;\n }\n\n get numPages() {\n const obj = this.toplevelPagesDict.get(\"Count\");\n\n if (!Number.isInteger(obj)) {\n throw new _util.FormatError(\"Page count in top-level pages dictionary is not an integer.\");\n }\n\n return (0, _util.shadow)(this, \"numPages\", obj);\n }\n\n get destinations() {\n const obj = this._readDests(),\n dests = Object.create(null);\n\n if (obj instanceof NameTree) {\n const names = obj.getAll();\n\n for (const name in names) {\n dests[name] = fetchDestination(names[name]);\n }\n } else if (obj instanceof _primitives.Dict) {\n obj.forEach(function (key, value) {\n if (value) {\n dests[key] = fetchDestination(value);\n }\n });\n }\n\n return (0, _util.shadow)(this, \"destinations\", dests);\n }\n\n getDestination(destinationId) {\n const obj = this._readDests();\n\n if (obj instanceof NameTree || obj instanceof _primitives.Dict) {\n return fetchDestination(obj.get(destinationId) || null);\n }\n\n return null;\n }\n\n _readDests() {\n const obj = this.catDict.get(\"Names\");\n\n if (obj && obj.has(\"Dests\")) {\n return new NameTree(obj.getRaw(\"Dests\"), this.xref);\n } else if (this.catDict.has(\"Dests\")) {\n return this.catDict.get(\"Dests\");\n }\n\n return undefined;\n }\n\n get pageLabels() {\n let obj = null;\n\n try {\n obj = this._readPageLabels();\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n (0, _util.warn)(\"Unable to read page labels.\");\n }\n\n return (0, _util.shadow)(this, \"pageLabels\", obj);\n }\n\n _readPageLabels() {\n const obj = this.catDict.getRaw(\"PageLabels\");\n\n if (!obj) {\n return null;\n }\n\n const pageLabels = new Array(this.numPages);\n let style = null,\n prefix = \"\";\n const numberTree = new NumberTree(obj, this.xref);\n const nums = numberTree.getAll();\n let currentLabel = \"\",\n currentIndex = 1;\n\n for (let i = 0, ii = this.numPages; i < ii; i++) {\n if (i in nums) {\n const labelDict = nums[i];\n\n if (!(0, _primitives.isDict)(labelDict)) {\n throw new _util.FormatError(\"PageLabel is not a dictionary.\");\n }\n\n if (labelDict.has(\"Type\") && !(0, _primitives.isName)(labelDict.get(\"Type\"), \"PageLabel\")) {\n throw new _util.FormatError(\"Invalid type in PageLabel dictionary.\");\n }\n\n if (labelDict.has(\"S\")) {\n const s = labelDict.get(\"S\");\n\n if (!(0, _primitives.isName)(s)) {\n throw new _util.FormatError(\"Invalid style in PageLabel dictionary.\");\n }\n\n style = s.name;\n } else {\n style = null;\n }\n\n if (labelDict.has(\"P\")) {\n const p = labelDict.get(\"P\");\n\n if (!(0, _util.isString)(p)) {\n throw new _util.FormatError(\"Invalid prefix in PageLabel dictionary.\");\n }\n\n prefix = (0, _util.stringToPDFString)(p);\n } else {\n prefix = \"\";\n }\n\n if (labelDict.has(\"St\")) {\n const st = labelDict.get(\"St\");\n\n if (!(Number.isInteger(st) && st >= 1)) {\n throw new _util.FormatError(\"Invalid start in PageLabel dictionary.\");\n }\n\n currentIndex = st;\n } else {\n currentIndex = 1;\n }\n }\n\n switch (style) {\n case \"D\":\n currentLabel = currentIndex;\n break;\n\n case \"R\":\n case \"r\":\n currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === \"r\");\n break;\n\n case \"A\":\n case \"a\":\n const LIMIT = 26;\n const A_UPPER_CASE = 0x41,\n A_LOWER_CASE = 0x61;\n const baseCharCode = style === \"a\" ? A_LOWER_CASE : A_UPPER_CASE;\n const letterIndex = currentIndex - 1;\n const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);\n const charBuf = [];\n\n for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {\n charBuf.push(character);\n }\n\n currentLabel = charBuf.join(\"\");\n break;\n\n default:\n if (style) {\n throw new _util.FormatError(`Invalid style \"${style}\" in PageLabel dictionary.`);\n }\n\n currentLabel = \"\";\n }\n\n pageLabels[i] = prefix + currentLabel;\n currentIndex++;\n }\n\n return pageLabels;\n }\n\n get pageLayout() {\n const obj = this.catDict.get(\"PageLayout\");\n let pageLayout = \"\";\n\n if ((0, _primitives.isName)(obj)) {\n switch (obj.name) {\n case \"SinglePage\":\n case \"OneColumn\":\n case \"TwoColumnLeft\":\n case \"TwoColumnRight\":\n case \"TwoPageLeft\":\n case \"TwoPageRight\":\n pageLayout = obj.name;\n }\n }\n\n return (0, _util.shadow)(this, \"pageLayout\", pageLayout);\n }\n\n get pageMode() {\n const obj = this.catDict.get(\"PageMode\");\n let pageMode = \"UseNone\";\n\n if ((0, _primitives.isName)(obj)) {\n switch (obj.name) {\n case \"UseNone\":\n case \"UseOutlines\":\n case \"UseThumbs\":\n case \"FullScreen\":\n case \"UseOC\":\n case \"UseAttachments\":\n pageMode = obj.name;\n }\n }\n\n return (0, _util.shadow)(this, \"pageMode\", pageMode);\n }\n\n get viewerPreferences() {\n const ViewerPreferencesValidators = {\n HideToolbar: _util.isBool,\n HideMenubar: _util.isBool,\n HideWindowUI: _util.isBool,\n FitWindow: _util.isBool,\n CenterWindow: _util.isBool,\n DisplayDocTitle: _util.isBool,\n NonFullScreenPageMode: _primitives.isName,\n Direction: _primitives.isName,\n ViewArea: _primitives.isName,\n ViewClip: _primitives.isName,\n PrintArea: _primitives.isName,\n PrintClip: _primitives.isName,\n PrintScaling: _primitives.isName,\n Duplex: _primitives.isName,\n PickTrayByPDFSize: _util.isBool,\n PrintPageRange: Array.isArray,\n NumCopies: Number.isInteger\n };\n const obj = this.catDict.get(\"ViewerPreferences\");\n const prefs = Object.create(null);\n\n if ((0, _primitives.isDict)(obj)) {\n for (const key in ViewerPreferencesValidators) {\n if (!obj.has(key)) {\n continue;\n }\n\n const value = obj.get(key);\n\n if (!ViewerPreferencesValidators[key](value)) {\n (0, _util.info)(`Bad value in ViewerPreferences for \"${key}\".`);\n continue;\n }\n\n let prefValue;\n\n switch (key) {\n case \"NonFullScreenPageMode\":\n switch (value.name) {\n case \"UseNone\":\n case \"UseOutlines\":\n case \"UseThumbs\":\n case \"UseOC\":\n prefValue = value.name;\n break;\n\n default:\n prefValue = \"UseNone\";\n }\n\n break;\n\n case \"Direction\":\n switch (value.name) {\n case \"L2R\":\n case \"R2L\":\n prefValue = value.name;\n break;\n\n default:\n prefValue = \"L2R\";\n }\n\n break;\n\n case \"ViewArea\":\n case \"ViewClip\":\n case \"PrintArea\":\n case \"PrintClip\":\n switch (value.name) {\n case \"MediaBox\":\n case \"CropBox\":\n case \"BleedBox\":\n case \"TrimBox\":\n case \"ArtBox\":\n prefValue = value.name;\n break;\n\n default:\n prefValue = \"CropBox\";\n }\n\n break;\n\n case \"PrintScaling\":\n switch (value.name) {\n case \"None\":\n case \"AppDefault\":\n prefValue = value.name;\n break;\n\n default:\n prefValue = \"AppDefault\";\n }\n\n break;\n\n case \"Duplex\":\n switch (value.name) {\n case \"Simplex\":\n case \"DuplexFlipShortEdge\":\n case \"DuplexFlipLongEdge\":\n prefValue = value.name;\n break;\n\n default:\n prefValue = \"None\";\n }\n\n break;\n\n case \"PrintPageRange\":\n const length = value.length;\n\n if (length % 2 !== 0) {\n break;\n }\n\n const isValid = value.every((page, i, arr) => {\n return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;\n });\n\n if (isValid) {\n prefValue = value;\n }\n\n break;\n\n case \"NumCopies\":\n if (value > 0) {\n prefValue = value;\n }\n\n break;\n\n default:\n (0, _util.assert)(typeof value === \"boolean\");\n prefValue = value;\n }\n\n if (prefValue !== undefined) {\n prefs[key] = prefValue;\n } else {\n (0, _util.info)(`Bad value in ViewerPreferences for \"${key}\".`);\n }\n }\n }\n\n return (0, _util.shadow)(this, \"viewerPreferences\", prefs);\n }\n\n get openAction() {\n const obj = this.catDict.get(\"OpenAction\");\n let openAction = null;\n\n if ((0, _primitives.isDict)(obj)) {\n const destDict = new _primitives.Dict(this.xref);\n destDict.set(\"A\", obj);\n const resultObj = {\n url: null,\n dest: null,\n action: null\n };\n Catalog.parseDestDictionary({\n destDict,\n resultObj\n });\n\n if (Array.isArray(resultObj.dest)) {\n if (!openAction) {\n openAction = Object.create(null);\n }\n\n openAction.dest = resultObj.dest;\n } else if (resultObj.action) {\n if (!openAction) {\n openAction = Object.create(null);\n }\n\n openAction.action = resultObj.action;\n }\n } else if (Array.isArray(obj)) {\n if (!openAction) {\n openAction = Object.create(null);\n }\n\n openAction.dest = obj;\n }\n\n return (0, _util.shadow)(this, \"openAction\", openAction);\n }\n\n get attachments() {\n const obj = this.catDict.get(\"Names\");\n let attachments = null;\n\n if (obj && obj.has(\"EmbeddedFiles\")) {\n const nameTree = new NameTree(obj.getRaw(\"EmbeddedFiles\"), this.xref);\n const names = nameTree.getAll();\n\n for (const name in names) {\n const fs = new FileSpec(names[name], this.xref);\n\n if (!attachments) {\n attachments = Object.create(null);\n }\n\n attachments[(0, _util.stringToPDFString)(name)] = fs.serializable;\n }\n }\n\n return (0, _util.shadow)(this, \"attachments\", attachments);\n }\n\n get javaScript() {\n const obj = this.catDict.get(\"Names\");\n let javaScript = null;\n\n function appendIfJavaScriptDict(jsDict) {\n const type = jsDict.get(\"S\");\n\n if (!(0, _primitives.isName)(type, \"JavaScript\")) {\n return;\n }\n\n let js = jsDict.get(\"JS\");\n\n if ((0, _primitives.isStream)(js)) {\n js = (0, _util.bytesToString)(js.getBytes());\n } else if (!(0, _util.isString)(js)) {\n return;\n }\n\n if (!javaScript) {\n javaScript = [];\n }\n\n javaScript.push((0, _util.stringToPDFString)(js));\n }\n\n if (obj && obj.has(\"JavaScript\")) {\n const nameTree = new NameTree(obj.getRaw(\"JavaScript\"), this.xref);\n const names = nameTree.getAll();\n\n for (const name in names) {\n const jsDict = names[name];\n\n if ((0, _primitives.isDict)(jsDict)) {\n appendIfJavaScriptDict(jsDict);\n }\n }\n }\n\n const openAction = this.catDict.get(\"OpenAction\");\n\n if ((0, _primitives.isDict)(openAction) && (0, _primitives.isName)(openAction.get(\"S\"), \"JavaScript\")) {\n appendIfJavaScriptDict(openAction);\n }\n\n return (0, _util.shadow)(this, \"javaScript\", javaScript);\n }\n\n fontFallback(id, handler) {\n const promises = [];\n this.fontCache.forEach(function (promise) {\n promises.push(promise);\n });\n return Promise.all(promises).then(translatedFonts => {\n for (const translatedFont of translatedFonts) {\n if (translatedFont.loadedName === id) {\n translatedFont.fallback(handler);\n return;\n }\n }\n });\n }\n\n cleanup() {\n (0, _primitives.clearPrimitiveCaches)();\n this.pageKidsCountCache.clear();\n const promises = [];\n this.fontCache.forEach(function (promise) {\n promises.push(promise);\n });\n return Promise.all(promises).then(translatedFonts => {\n for (const {\n dict\n } of translatedFonts) {\n delete dict.translated;\n }\n\n this.fontCache.clear();\n this.builtInCMapCache.clear();\n });\n }\n\n getPageDict(pageIndex) {\n const capability = (0, _util.createPromiseCapability)();\n const nodesToVisit = [this.catDict.getRaw(\"Pages\")];\n const visitedNodes = new _primitives.RefSet();\n const xref = this.xref,\n pageKidsCountCache = this.pageKidsCountCache;\n let count,\n currentPageIndex = 0;\n\n function next() {\n while (nodesToVisit.length) {\n const currentNode = nodesToVisit.pop();\n\n if ((0, _primitives.isRef)(currentNode)) {\n count = pageKidsCountCache.get(currentNode);\n\n if (count > 0 && currentPageIndex + count < pageIndex) {\n currentPageIndex += count;\n continue;\n }\n\n if (visitedNodes.has(currentNode)) {\n capability.reject(new _util.FormatError(\"Pages tree contains circular reference.\"));\n return;\n }\n\n visitedNodes.put(currentNode);\n xref.fetchAsync(currentNode).then(function (obj) {\n if ((0, _primitives.isDict)(obj, \"Page\") || (0, _primitives.isDict)(obj) && !obj.has(\"Kids\")) {\n if (pageIndex === currentPageIndex) {\n if (currentNode && !pageKidsCountCache.has(currentNode)) {\n pageKidsCountCache.put(currentNode, 1);\n }\n\n capability.resolve([obj, currentNode]);\n } else {\n currentPageIndex++;\n next();\n }\n\n return;\n }\n\n nodesToVisit.push(obj);\n next();\n }, capability.reject);\n return;\n }\n\n if (!(0, _primitives.isDict)(currentNode)) {\n capability.reject(new _util.FormatError(\"Page dictionary kid reference points to wrong type of object.\"));\n return;\n }\n\n count = currentNode.get(\"Count\");\n\n if (Number.isInteger(count) && count >= 0) {\n const objId = currentNode.objId;\n\n if (objId && !pageKidsCountCache.has(objId)) {\n pageKidsCountCache.put(objId, count);\n }\n\n if (currentPageIndex + count <= pageIndex) {\n currentPageIndex += count;\n continue;\n }\n }\n\n const kids = currentNode.get(\"Kids\");\n\n if (!Array.isArray(kids)) {\n if ((0, _primitives.isName)(currentNode.get(\"Type\"), \"Page\") || !currentNode.has(\"Type\") && currentNode.has(\"Contents\")) {\n if (currentPageIndex === pageIndex) {\n capability.resolve([currentNode, null]);\n return;\n }\n\n currentPageIndex++;\n continue;\n }\n\n capability.reject(new _util.FormatError(\"Page dictionary kids object is not an array.\"));\n return;\n }\n\n for (let last = kids.length - 1; last >= 0; last--) {\n nodesToVisit.push(kids[last]);\n }\n }\n\n capability.reject(new Error(`Page index ${pageIndex} not found.`));\n }\n\n next();\n return capability.promise;\n }\n\n getPageIndex(pageRef) {\n const xref = this.xref;\n\n function pagesBeforeRef(kidRef) {\n let total = 0,\n parentRef;\n return xref.fetchAsync(kidRef).then(function (node) {\n if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, \"Page\") && !((0, _primitives.isDict)(node) && !node.has(\"Type\") && node.has(\"Contents\"))) {\n throw new _util.FormatError(\"The reference does not point to a /Page dictionary.\");\n }\n\n if (!node) {\n return null;\n }\n\n if (!(0, _primitives.isDict)(node)) {\n throw new _util.FormatError(\"Node must be a dictionary.\");\n }\n\n parentRef = node.getRaw(\"Parent\");\n return node.getAsync(\"Parent\");\n }).then(function (parent) {\n if (!parent) {\n return null;\n }\n\n if (!(0, _primitives.isDict)(parent)) {\n throw new _util.FormatError(\"Parent must be a dictionary.\");\n }\n\n return parent.getAsync(\"Kids\");\n }).then(function (kids) {\n if (!kids) {\n return null;\n }\n\n const kidPromises = [];\n let found = false;\n\n for (let i = 0, ii = kids.length; i < ii; i++) {\n const kid = kids[i];\n\n if (!(0, _primitives.isRef)(kid)) {\n throw new _util.FormatError(\"Kid must be a reference.\");\n }\n\n if ((0, _primitives.isRefsEqual)(kid, kidRef)) {\n found = true;\n break;\n }\n\n kidPromises.push(xref.fetchAsync(kid).then(function (kid) {\n if (!(0, _primitives.isDict)(kid)) {\n throw new _util.FormatError(\"Kid node must be a dictionary.\");\n }\n\n if (kid.has(\"Count\")) {\n total += kid.get(\"Count\");\n } else {\n total++;\n }\n }));\n }\n\n if (!found) {\n throw new _util.FormatError(\"Kid reference not found in parent's kids.\");\n }\n\n return Promise.all(kidPromises).then(function () {\n return [total, parentRef];\n });\n });\n }\n\n let total = 0;\n\n function next(ref) {\n return pagesBeforeRef(ref).then(function (args) {\n if (!args) {\n return total;\n }\n\n const [count, parentRef] = args;\n total += count;\n return next(parentRef);\n });\n }\n\n return next(pageRef);\n }\n\n static parseDestDictionary(params) {\n function addDefaultProtocolToUrl(url) {\n return url.startsWith(\"www.\") ? `http://${url}` : url;\n }\n\n function tryConvertUrlEncoding(url) {\n try {\n return (0, _util.stringToUTF8String)(url);\n } catch (e) {\n return url;\n }\n }\n\n const destDict = params.destDict;\n\n if (!(0, _primitives.isDict)(destDict)) {\n (0, _util.warn)(\"parseDestDictionary: `destDict` must be a dictionary.\");\n return;\n }\n\n const resultObj = params.resultObj;\n\n if (typeof resultObj !== \"object\") {\n (0, _util.warn)(\"parseDestDictionary: `resultObj` must be an object.\");\n return;\n }\n\n const docBaseUrl = params.docBaseUrl || null;\n let action = destDict.get(\"A\"),\n url,\n dest;\n\n if (!(0, _primitives.isDict)(action) && destDict.has(\"Dest\")) {\n action = destDict.get(\"Dest\");\n }\n\n if ((0, _primitives.isDict)(action)) {\n const actionType = action.get(\"S\");\n\n if (!(0, _primitives.isName)(actionType)) {\n (0, _util.warn)(\"parseDestDictionary: Invalid type in Action dictionary.\");\n return;\n }\n\n const actionName = actionType.name;\n\n switch (actionName) {\n case \"URI\":\n url = action.get(\"URI\");\n\n if ((0, _primitives.isName)(url)) {\n url = \"/\" + url.name;\n } else if ((0, _util.isString)(url)) {\n url = addDefaultProtocolToUrl(url);\n }\n\n break;\n\n case \"GoTo\":\n dest = action.get(\"D\");\n break;\n\n case \"Launch\":\n case \"GoToR\":\n const urlDict = action.get(\"F\");\n\n if ((0, _primitives.isDict)(urlDict)) {\n url = urlDict.get(\"F\") || null;\n } else if ((0, _util.isString)(urlDict)) {\n url = urlDict;\n }\n\n let remoteDest = action.get(\"D\");\n\n if (remoteDest) {\n if ((0, _primitives.isName)(remoteDest)) {\n remoteDest = remoteDest.name;\n }\n\n if ((0, _util.isString)(url)) {\n const baseUrl = url.split(\"#\")[0];\n\n if ((0, _util.isString)(remoteDest)) {\n url = baseUrl + \"#\" + remoteDest;\n } else if (Array.isArray(remoteDest)) {\n url = baseUrl + \"#\" + JSON.stringify(remoteDest);\n }\n }\n }\n\n const newWindow = action.get(\"NewWindow\");\n\n if ((0, _util.isBool)(newWindow)) {\n resultObj.newWindow = newWindow;\n }\n\n break;\n\n case \"Named\":\n const namedAction = action.get(\"N\");\n\n if ((0, _primitives.isName)(namedAction)) {\n resultObj.action = namedAction.name;\n }\n\n break;\n\n case \"JavaScript\":\n const jsAction = action.get(\"JS\");\n let js;\n\n if ((0, _primitives.isStream)(jsAction)) {\n js = (0, _util.bytesToString)(jsAction.getBytes());\n } else if ((0, _util.isString)(jsAction)) {\n js = jsAction;\n }\n\n if (js) {\n const URL_OPEN_METHODS = [\"app.launchURL\", \"window.open\"];\n const regex = new RegExp(\"^\\\\s*(\" + URL_OPEN_METHODS.join(\"|\").split(\".\").join(\"\\\\.\") + \")\\\\((?:'|\\\")([^'\\\"]*)(?:'|\\\")(?:,\\\\s*(\\\\w+)\\\\)|\\\\))\", \"i\");\n const jsUrl = regex.exec((0, _util.stringToPDFString)(js));\n\n if (jsUrl && jsUrl[2]) {\n url = jsUrl[2];\n\n if (jsUrl[3] === \"true\" && jsUrl[1] === \"app.launchURL\") {\n resultObj.newWindow = true;\n }\n\n break;\n }\n }\n\n default:\n (0, _util.warn)(`parseDestDictionary: unsupported action type \"${actionName}\".`);\n break;\n }\n } else if (destDict.has(\"Dest\")) {\n dest = destDict.get(\"Dest\");\n }\n\n if ((0, _util.isString)(url)) {\n url = tryConvertUrlEncoding(url);\n const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);\n\n if (absoluteUrl) {\n resultObj.url = absoluteUrl.href;\n }\n\n resultObj.unsafeUrl = url;\n }\n\n if (dest) {\n if ((0, _primitives.isName)(dest)) {\n dest = dest.name;\n }\n\n if ((0, _util.isString)(dest) || Array.isArray(dest)) {\n resultObj.dest = dest;\n }\n }\n }\n\n}\n\nexports.Catalog = Catalog;\n\nvar XRef = function XRefClosure() {\n function XRef(stream, pdfManager) {\n this.stream = stream;\n this.pdfManager = pdfManager;\n this.entries = [];\n this.xrefstms = Object.create(null);\n this._cacheMap = new Map();\n this.stats = {\n streamTypes: Object.create(null),\n fontTypes: Object.create(null)\n };\n }\n\n XRef.prototype = {\n setStartXRef: function XRef_setStartXRef(startXRef) {\n this.startXRefQueue = [startXRef];\n },\n parse: function XRef_parse(recoveryMode) {\n var trailerDict;\n\n if (!recoveryMode) {\n trailerDict = this.readXRef();\n } else {\n (0, _util.warn)(\"Indexing all PDF objects\");\n trailerDict = this.indexObjects();\n }\n\n trailerDict.assignXref(this);\n this.trailer = trailerDict;\n let encrypt;\n\n try {\n encrypt = trailerDict.get(\"Encrypt\");\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n (0, _util.warn)(`XRef.parse - Invalid \"Encrypt\" reference: \"${ex}\".`);\n }\n\n if ((0, _primitives.isDict)(encrypt)) {\n var ids = trailerDict.get(\"ID\");\n var fileId = ids && ids.length ? ids[0] : \"\";\n encrypt.suppressEncryption = true;\n this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);\n }\n\n let root;\n\n try {\n root = trailerDict.get(\"Root\");\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n (0, _util.warn)(`XRef.parse - Invalid \"Root\" reference: \"${ex}\".`);\n }\n\n if ((0, _primitives.isDict)(root) && root.has(\"Pages\")) {\n this.root = root;\n } else {\n if (!recoveryMode) {\n throw new _core_utils.XRefParseException();\n }\n\n throw new _util.FormatError(\"Invalid root reference\");\n }\n },\n processXRefTable: function XRef_processXRefTable(parser) {\n if (!(\"tableState\" in this)) {\n this.tableState = {\n entryNum: 0,\n streamPos: parser.lexer.stream.pos,\n parserBuf1: parser.buf1,\n parserBuf2: parser.buf2\n };\n }\n\n var obj = this.readXRefTable(parser);\n\n if (!(0, _primitives.isCmd)(obj, \"trailer\")) {\n throw new _util.FormatError(\"Invalid XRef table: could not find trailer dictionary\");\n }\n\n var dict = parser.getObj();\n\n if (!(0, _primitives.isDict)(dict) && dict.dict) {\n dict = dict.dict;\n }\n\n if (!(0, _primitives.isDict)(dict)) {\n throw new _util.FormatError(\"Invalid XRef table: could not parse trailer dictionary\");\n }\n\n delete this.tableState;\n return dict;\n },\n readXRefTable: function XRef_readXRefTable(parser) {\n var stream = parser.lexer.stream;\n var tableState = this.tableState;\n stream.pos = tableState.streamPos;\n parser.buf1 = tableState.parserBuf1;\n parser.buf2 = tableState.parserBuf2;\n var obj;\n\n while (true) {\n if (!(\"firstEntryNum\" in tableState) || !(\"entryCount\" in tableState)) {\n if ((0, _primitives.isCmd)(obj = parser.getObj(), \"trailer\")) {\n break;\n }\n\n tableState.firstEntryNum = obj;\n tableState.entryCount = parser.getObj();\n }\n\n var first = tableState.firstEntryNum;\n var count = tableState.entryCount;\n\n if (!Number.isInteger(first) || !Number.isInteger(count)) {\n throw new _util.FormatError(\"Invalid XRef table: wrong types in subsection header\");\n }\n\n for (var i = tableState.entryNum; i < count; i++) {\n tableState.streamPos = stream.pos;\n tableState.entryNum = i;\n tableState.parserBuf1 = parser.buf1;\n tableState.parserBuf2 = parser.buf2;\n var entry = {};\n entry.offset = parser.getObj();\n entry.gen = parser.getObj();\n var type = parser.getObj();\n\n if (type instanceof _primitives.Cmd) {\n switch (type.cmd) {\n case \"f\":\n entry.free = true;\n break;\n\n case \"n\":\n entry.uncompressed = true;\n break;\n }\n }\n\n if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {\n throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);\n }\n\n if (i === 0 && entry.free && first === 1) {\n first = 0;\n }\n\n if (!this.entries[i + first]) {\n this.entries[i + first] = entry;\n }\n }\n\n tableState.entryNum = 0;\n tableState.streamPos = stream.pos;\n tableState.parserBuf1 = parser.buf1;\n tableState.parserBuf2 = parser.buf2;\n delete tableState.firstEntryNum;\n delete tableState.entryCount;\n }\n\n if (this.entries[0] && !this.entries[0].free) {\n throw new _util.FormatError(\"Invalid XRef table: unexpected first object\");\n }\n\n return obj;\n },\n processXRefStream: function XRef_processXRefStream(stream) {\n if (!(\"streamState\" in this)) {\n var streamParameters = stream.dict;\n var byteWidths = streamParameters.get(\"W\");\n var range = streamParameters.get(\"Index\");\n\n if (!range) {\n range = [0, streamParameters.get(\"Size\")];\n }\n\n this.streamState = {\n entryRanges: range,\n byteWidths,\n entryNum: 0,\n streamPos: stream.pos\n };\n }\n\n this.readXRefStream(stream);\n delete this.streamState;\n return stream.dict;\n },\n readXRefStream: function XRef_readXRefStream(stream) {\n var i, j;\n var streamState = this.streamState;\n stream.pos = streamState.streamPos;\n var byteWidths = streamState.byteWidths;\n var typeFieldWidth = byteWidths[0];\n var offsetFieldWidth = byteWidths[1];\n var generationFieldWidth = byteWidths[2];\n var entryRanges = streamState.entryRanges;\n\n while (entryRanges.length > 0) {\n var first = entryRanges[0];\n var n = entryRanges[1];\n\n if (!Number.isInteger(first) || !Number.isInteger(n)) {\n throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);\n }\n\n if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {\n throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);\n }\n\n for (i = streamState.entryNum; i < n; ++i) {\n streamState.entryNum = i;\n streamState.streamPos = stream.pos;\n var type = 0,\n offset = 0,\n generation = 0;\n\n for (j = 0; j < typeFieldWidth; ++j) {\n type = type << 8 | stream.getByte();\n }\n\n if (typeFieldWidth === 0) {\n type = 1;\n }\n\n for (j = 0; j < offsetFieldWidth; ++j) {\n offset = offset << 8 | stream.getByte();\n }\n\n for (j = 0; j < generationFieldWidth; ++j) {\n generation = generation << 8 | stream.getByte();\n }\n\n var entry = {};\n entry.offset = offset;\n entry.gen = generation;\n\n switch (type) {\n case 0:\n entry.free = true;\n break;\n\n case 1:\n entry.uncompressed = true;\n break;\n\n case 2:\n break;\n\n default:\n throw new _util.FormatError(`Invalid XRef entry type: ${type}`);\n }\n\n if (!this.entries[first + i]) {\n this.entries[first + i] = entry;\n }\n }\n\n streamState.entryNum = 0;\n streamState.streamPos = stream.pos;\n entryRanges.splice(0, 2);\n }\n },\n indexObjects: function XRef_indexObjects() {\n var TAB = 0x9,\n LF = 0xa,\n CR = 0xd,\n SPACE = 0x20;\n var PERCENT = 0x25,\n LT = 0x3c;\n\n function readToken(data, offset) {\n var token = \"\",\n ch = data[offset];\n\n while (ch !== LF && ch !== CR && ch !== LT) {\n if (++offset >= data.length) {\n break;\n }\n\n token += String.fromCharCode(ch);\n ch = data[offset];\n }\n\n return token;\n }\n\n function skipUntil(data, offset, what) {\n var length = what.length,\n dataLength = data.length;\n var skipped = 0;\n\n while (offset < dataLength) {\n var i = 0;\n\n while (i < length && data[offset + i] === what[i]) {\n ++i;\n }\n\n if (i >= length) {\n break;\n }\n\n offset++;\n skipped++;\n }\n\n return skipped;\n }\n\n var objRegExp = /^(\\d+)\\s+(\\d+)\\s+obj\\b/;\n const endobjRegExp = /\\bendobj[\\b\\s]$/;\n const nestedObjRegExp = /\\s+(\\d+\\s+\\d+\\s+obj[\\b\\s<])$/;\n const CHECK_CONTENT_LENGTH = 25;\n var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);\n var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);\n const objBytes = new Uint8Array([111, 98, 106]);\n var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);\n this.entries.length = 0;\n var stream = this.stream;\n stream.pos = 0;\n var buffer = stream.getBytes();\n var position = stream.start,\n length = buffer.length;\n var trailers = [],\n xrefStms = [];\n\n while (position < length) {\n var ch = buffer[position];\n\n if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {\n ++position;\n continue;\n }\n\n if (ch === PERCENT) {\n do {\n ++position;\n\n if (position >= length) {\n break;\n }\n\n ch = buffer[position];\n } while (ch !== LF && ch !== CR);\n\n continue;\n }\n\n var token = readToken(buffer, position);\n var m;\n\n if (token.startsWith(\"xref\") && (token.length === 4 || /\\s/.test(token[4]))) {\n position += skipUntil(buffer, position, trailerBytes);\n trailers.push(position);\n position += skipUntil(buffer, position, startxrefBytes);\n } else if (m = objRegExp.exec(token)) {\n const num = m[1] | 0,\n gen = m[2] | 0;\n\n if (!this.entries[num] || this.entries[num].gen === gen) {\n this.entries[num] = {\n offset: position - stream.start,\n gen,\n uncompressed: true\n };\n }\n\n let contentLength,\n startPos = position + token.length;\n\n while (startPos < buffer.length) {\n const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;\n contentLength = endPos - position;\n const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);\n const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));\n\n if (endobjRegExp.test(tokenStr)) {\n break;\n } else {\n const objToken = nestedObjRegExp.exec(tokenStr);\n\n if (objToken && objToken[1]) {\n (0, _util.warn)('indexObjects: Found new \"obj\" inside of another \"obj\", ' + 'caused by missing \"endobj\" -- trying to recover.');\n contentLength -= objToken[1].length;\n break;\n }\n }\n\n startPos = endPos;\n }\n\n const content = buffer.subarray(position, position + contentLength);\n var xrefTagOffset = skipUntil(content, 0, xrefBytes);\n\n if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {\n xrefStms.push(position - stream.start);\n this.xrefstms[position - stream.start] = 1;\n }\n\n position += contentLength;\n } else if (token.startsWith(\"trailer\") && (token.length === 7 || /\\s/.test(token[7]))) {\n trailers.push(position);\n position += skipUntil(buffer, position, startxrefBytes);\n } else {\n position += token.length + 1;\n }\n }\n\n var i, ii;\n\n for (i = 0, ii = xrefStms.length; i < ii; ++i) {\n this.startXRefQueue.push(xrefStms[i]);\n this.readXRef(true);\n }\n\n let trailerDict;\n\n for (i = 0, ii = trailers.length; i < ii; ++i) {\n stream.pos = trailers[i];\n const parser = new _parser.Parser({\n lexer: new _parser.Lexer(stream),\n xref: this,\n allowStreams: true,\n recoveryMode: true\n });\n var obj = parser.getObj();\n\n if (!(0, _primitives.isCmd)(obj, \"trailer\")) {\n continue;\n }\n\n const dict = parser.getObj();\n\n if (!(0, _primitives.isDict)(dict)) {\n continue;\n }\n\n let rootDict;\n\n try {\n rootDict = dict.get(\"Root\");\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n continue;\n }\n\n if (!(0, _primitives.isDict)(rootDict) || !rootDict.has(\"Pages\")) {\n continue;\n }\n\n if (dict.has(\"ID\")) {\n return dict;\n }\n\n trailerDict = dict;\n }\n\n if (trailerDict) {\n return trailerDict;\n }\n\n throw new _util.InvalidPDFException(\"Invalid PDF structure.\");\n },\n readXRef: function XRef_readXRef(recoveryMode) {\n var stream = this.stream;\n const startXRefParsedCache = Object.create(null);\n\n try {\n while (this.startXRefQueue.length) {\n var startXRef = this.startXRefQueue[0];\n\n if (startXRefParsedCache[startXRef]) {\n (0, _util.warn)(\"readXRef - skipping XRef table since it was already parsed.\");\n this.startXRefQueue.shift();\n continue;\n }\n\n startXRefParsedCache[startXRef] = true;\n stream.pos = startXRef + stream.start;\n const parser = new _parser.Parser({\n lexer: new _parser.Lexer(stream),\n xref: this,\n allowStreams: true\n });\n var obj = parser.getObj();\n var dict;\n\n if ((0, _primitives.isCmd)(obj, \"xref\")) {\n dict = this.processXRefTable(parser);\n\n if (!this.topDict) {\n this.topDict = dict;\n }\n\n obj = dict.get(\"XRefStm\");\n\n if (Number.isInteger(obj)) {\n var pos = obj;\n\n if (!(pos in this.xrefstms)) {\n this.xrefstms[pos] = 1;\n this.startXRefQueue.push(pos);\n }\n }\n } else if (Number.isInteger(obj)) {\n if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), \"obj\") || !(0, _primitives.isStream)(obj = parser.getObj())) {\n throw new _util.FormatError(\"Invalid XRef stream\");\n }\n\n dict = this.processXRefStream(obj);\n\n if (!this.topDict) {\n this.topDict = dict;\n }\n\n if (!dict) {\n throw new _util.FormatError(\"Failed to read XRef stream\");\n }\n } else {\n throw new _util.FormatError(\"Invalid XRef stream header\");\n }\n\n obj = dict.get(\"Prev\");\n\n if (Number.isInteger(obj)) {\n this.startXRefQueue.push(obj);\n } else if ((0, _primitives.isRef)(obj)) {\n this.startXRefQueue.push(obj.num);\n }\n\n this.startXRefQueue.shift();\n }\n\n return this.topDict;\n } catch (e) {\n if (e instanceof _core_utils.MissingDataException) {\n throw e;\n }\n\n (0, _util.info)(\"(while reading XRef): \" + e);\n }\n\n if (recoveryMode) {\n return undefined;\n }\n\n throw new _core_utils.XRefParseException();\n },\n getEntry: function XRef_getEntry(i) {\n var xrefEntry = this.entries[i];\n\n if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {\n return xrefEntry;\n }\n\n return null;\n },\n fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {\n if (obj instanceof _primitives.Ref) {\n return this.fetch(obj, suppressEncryption);\n }\n\n return obj;\n },\n fetch: function XRef_fetch(ref, suppressEncryption) {\n if (!(ref instanceof _primitives.Ref)) {\n throw new Error(\"ref object is not a reference\");\n }\n\n const num = ref.num;\n\n const cacheEntry = this._cacheMap.get(num);\n\n if (cacheEntry !== undefined) {\n if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {\n cacheEntry.objId = ref.toString();\n }\n\n return cacheEntry;\n }\n\n let xrefEntry = this.getEntry(num);\n\n if (xrefEntry === null) {\n this._cacheMap.set(num, xrefEntry);\n\n return xrefEntry;\n }\n\n if (xrefEntry.uncompressed) {\n xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);\n } else {\n xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);\n }\n\n if ((0, _primitives.isDict)(xrefEntry)) {\n xrefEntry.objId = ref.toString();\n } else if ((0, _primitives.isStream)(xrefEntry)) {\n xrefEntry.dict.objId = ref.toString();\n }\n\n return xrefEntry;\n },\n\n fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {\n var gen = ref.gen;\n var num = ref.num;\n\n if (xrefEntry.gen !== gen) {\n throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);\n }\n\n var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);\n const parser = new _parser.Parser({\n lexer: new _parser.Lexer(stream),\n xref: this,\n allowStreams: true\n });\n var obj1 = parser.getObj();\n var obj2 = parser.getObj();\n var obj3 = parser.getObj();\n\n if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {\n throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);\n }\n\n if (obj3.cmd !== \"obj\") {\n if (obj3.cmd.startsWith(\"obj\")) {\n num = parseInt(obj3.cmd.substring(3), 10);\n\n if (!Number.isNaN(num)) {\n return num;\n }\n }\n\n throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);\n }\n\n if (this.encrypt && !suppressEncryption) {\n xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));\n } else {\n xrefEntry = parser.getObj();\n }\n\n if (!(0, _primitives.isStream)(xrefEntry)) {\n this._cacheMap.set(num, xrefEntry);\n }\n\n return xrefEntry;\n },\n\n fetchCompressed(ref, xrefEntry, suppressEncryption = false) {\n const tableOffset = xrefEntry.offset;\n const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));\n\n if (!(0, _primitives.isStream)(stream)) {\n throw new _util.FormatError(\"bad ObjStm stream\");\n }\n\n const first = stream.dict.get(\"First\");\n const n = stream.dict.get(\"N\");\n\n if (!Number.isInteger(first) || !Number.isInteger(n)) {\n throw new _util.FormatError(\"invalid first and n parameters for ObjStm stream\");\n }\n\n const parser = new _parser.Parser({\n lexer: new _parser.Lexer(stream),\n xref: this,\n allowStreams: true\n });\n const nums = new Array(n);\n\n for (let i = 0; i < n; ++i) {\n const num = parser.getObj();\n\n if (!Number.isInteger(num)) {\n throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);\n }\n\n const offset = parser.getObj();\n\n if (!Number.isInteger(offset)) {\n throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);\n }\n\n nums[i] = num;\n }\n\n const entries = new Array(n);\n\n for (let i = 0; i < n; ++i) {\n const obj = parser.getObj();\n entries[i] = obj;\n\n if (parser.buf1 instanceof _primitives.Cmd && parser.buf1.cmd === \"endobj\") {\n parser.shift();\n }\n\n if ((0, _primitives.isStream)(obj)) {\n continue;\n }\n\n const num = nums[i],\n entry = this.entries[num];\n\n if (entry && entry.offset === tableOffset && entry.gen === i) {\n this._cacheMap.set(num, obj);\n }\n }\n\n xrefEntry = entries[xrefEntry.gen];\n\n if (xrefEntry === undefined) {\n throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);\n }\n\n return xrefEntry;\n },\n\n async fetchIfRefAsync(obj, suppressEncryption) {\n if (obj instanceof _primitives.Ref) {\n return this.fetchAsync(obj, suppressEncryption);\n }\n\n return obj;\n },\n\n async fetchAsync(ref, suppressEncryption) {\n try {\n return this.fetch(ref, suppressEncryption);\n } catch (ex) {\n if (!(ex instanceof _core_utils.MissingDataException)) {\n throw ex;\n }\n\n await this.pdfManager.requestRange(ex.begin, ex.end);\n return this.fetchAsync(ref, suppressEncryption);\n }\n },\n\n getCatalogObj: function XRef_getCatalogObj() {\n return this.root;\n }\n };\n return XRef;\n}();\n\nexports.XRef = XRef;\n\nclass NameOrNumberTree {\n constructor(root, xref, type) {\n if (this.constructor === NameOrNumberTree) {\n (0, _util.unreachable)(\"Cannot initialize NameOrNumberTree.\");\n }\n\n this.root = root;\n this.xref = xref;\n this._type = type;\n }\n\n getAll() {\n const dict = Object.create(null);\n\n if (!this.root) {\n return dict;\n }\n\n const xref = this.xref;\n const processed = new _primitives.RefSet();\n processed.put(this.root);\n const queue = [this.root];\n\n while (queue.length > 0) {\n const obj = xref.fetchIfRef(queue.shift());\n\n if (!(0, _primitives.isDict)(obj)) {\n continue;\n }\n\n if (obj.has(\"Kids\")) {\n const kids = obj.get(\"Kids\");\n\n for (let i = 0, ii = kids.length; i < ii; i++) {\n const kid = kids[i];\n\n if (processed.has(kid)) {\n throw new _util.FormatError(`Duplicate entry in \"${this._type}\" tree.`);\n }\n\n queue.push(kid);\n processed.put(kid);\n }\n\n continue;\n }\n\n const entries = obj.get(this._type);\n\n if (Array.isArray(entries)) {\n for (let i = 0, ii = entries.length; i < ii; i += 2) {\n dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);\n }\n }\n }\n\n return dict;\n }\n\n get(key) {\n if (!this.root) {\n return null;\n }\n\n const xref = this.xref;\n let kidsOrEntries = xref.fetchIfRef(this.root);\n let loopCount = 0;\n const MAX_LEVELS = 10;\n\n while (kidsOrEntries.has(\"Kids\")) {\n if (++loopCount > MAX_LEVELS) {\n (0, _util.warn)(`Search depth limit reached for \"${this._type}\" tree.`);\n return null;\n }\n\n const kids = kidsOrEntries.get(\"Kids\");\n\n if (!Array.isArray(kids)) {\n return null;\n }\n\n let l = 0,\n r = kids.length - 1;\n\n while (l <= r) {\n const m = l + r >> 1;\n const kid = xref.fetchIfRef(kids[m]);\n const limits = kid.get(\"Limits\");\n\n if (key < xref.fetchIfRef(limits[0])) {\n r = m - 1;\n } else if (key > xref.fetchIfRef(limits[1])) {\n l = m + 1;\n } else {\n kidsOrEntries = xref.fetchIfRef(kids[m]);\n break;\n }\n }\n\n if (l > r) {\n return null;\n }\n }\n\n const entries = kidsOrEntries.get(this._type);\n\n if (Array.isArray(entries)) {\n let l = 0,\n r = entries.length - 2;\n\n while (l <= r) {\n const tmp = l + r >> 1,\n m = tmp + (tmp & 1);\n const currentKey = xref.fetchIfRef(entries[m]);\n\n if (key < currentKey) {\n r = m - 2;\n } else if (key > currentKey) {\n l = m + 2;\n } else {\n return xref.fetchIfRef(entries[m + 1]);\n }\n }\n\n (0, _util.info)(`Falling back to an exhaustive search, for key \"${key}\", ` + `in \"${this._type}\" tree.`);\n\n for (let m = 0, mm = entries.length; m < mm; m += 2) {\n const currentKey = xref.fetchIfRef(entries[m]);\n\n if (currentKey === key) {\n (0, _util.warn)(`The \"${key}\" key was found at an incorrect, ` + `i.e. out-of-order, position in \"${this._type}\" tree.`);\n return xref.fetchIfRef(entries[m + 1]);\n }\n }\n }\n\n return null;\n }\n\n}\n\nclass NameTree extends NameOrNumberTree {\n constructor(root, xref) {\n super(root, xref, \"Names\");\n }\n\n}\n\nclass NumberTree extends NameOrNumberTree {\n constructor(root, xref) {\n super(root, xref, \"Nums\");\n }\n\n}\n\nvar FileSpec = function FileSpecClosure() {\n function FileSpec(root, xref) {\n if (!root || !(0, _primitives.isDict)(root)) {\n return;\n }\n\n this.xref = xref;\n this.root = root;\n\n if (root.has(\"FS\")) {\n this.fs = root.get(\"FS\");\n }\n\n this.description = root.has(\"Desc\") ? (0, _util.stringToPDFString)(root.get(\"Desc\")) : \"\";\n\n if (root.has(\"RF\")) {\n (0, _util.warn)(\"Related file specifications are not supported\");\n }\n\n this.contentAvailable = true;\n\n if (!root.has(\"EF\")) {\n this.contentAvailable = false;\n (0, _util.warn)(\"Non-embedded file specifications are not supported\");\n }\n }\n\n function pickPlatformItem(dict) {\n if (dict.has(\"UF\")) {\n return dict.get(\"UF\");\n } else if (dict.has(\"F\")) {\n return dict.get(\"F\");\n } else if (dict.has(\"Unix\")) {\n return dict.get(\"Unix\");\n } else if (dict.has(\"Mac\")) {\n return dict.get(\"Mac\");\n } else if (dict.has(\"DOS\")) {\n return dict.get(\"DOS\");\n }\n\n return null;\n }\n\n FileSpec.prototype = {\n get filename() {\n if (!this._filename && this.root) {\n var filename = pickPlatformItem(this.root) || \"unnamed\";\n this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\\\\\/g, \"\\\\\").replace(/\\\\\\//g, \"/\").replace(/\\\\/g, \"/\");\n }\n\n return this._filename;\n },\n\n get content() {\n if (!this.contentAvailable) {\n return null;\n }\n\n if (!this.contentRef && this.root) {\n this.contentRef = pickPlatformItem(this.root.get(\"EF\"));\n }\n\n var content = null;\n\n if (this.contentRef) {\n var xref = this.xref;\n var fileObj = xref.fetchIfRef(this.contentRef);\n\n if (fileObj && (0, _primitives.isStream)(fileObj)) {\n content = fileObj.getBytes();\n } else {\n (0, _util.warn)(\"Embedded file specification points to non-existing/invalid \" + \"content\");\n }\n } else {\n (0, _util.warn)(\"Embedded file specification does not have a content\");\n }\n\n return content;\n },\n\n get serializable() {\n return {\n filename: this.filename,\n content: this.content\n };\n }\n\n };\n return FileSpec;\n}();\n\nexports.FileSpec = FileSpec;\n\nconst ObjectLoader = function () {\n function mayHaveChildren(value) {\n return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);\n }\n\n function addChildren(node, nodesToVisit) {\n if (node instanceof _primitives.Dict || (0, _primitives.isStream)(node)) {\n const dict = node instanceof _primitives.Dict ? node : node.dict;\n const dictKeys = dict.getKeys();\n\n for (let i = 0, ii = dictKeys.length; i < ii; i++) {\n const rawValue = dict.getRaw(dictKeys[i]);\n\n if (mayHaveChildren(rawValue)) {\n nodesToVisit.push(rawValue);\n }\n }\n } else if (Array.isArray(node)) {\n for (let i = 0, ii = node.length; i < ii; i++) {\n const value = node[i];\n\n if (mayHaveChildren(value)) {\n nodesToVisit.push(value);\n }\n }\n }\n }\n\n function ObjectLoader(dict, keys, xref) {\n this.dict = dict;\n this.keys = keys;\n this.xref = xref;\n this.refSet = null;\n }\n\n ObjectLoader.prototype = {\n async load() {\n if (!this.xref.stream.allChunksLoaded || this.xref.stream.allChunksLoaded()) {\n return undefined;\n }\n\n const {\n keys,\n dict\n } = this;\n this.refSet = new _primitives.RefSet();\n const nodesToVisit = [];\n\n for (let i = 0, ii = keys.length; i < ii; i++) {\n const rawValue = dict.getRaw(keys[i]);\n\n if (rawValue !== undefined) {\n nodesToVisit.push(rawValue);\n }\n }\n\n return this._walk(nodesToVisit);\n },\n\n async _walk(nodesToVisit) {\n const nodesToRevisit = [];\n const pendingRequests = [];\n\n while (nodesToVisit.length) {\n let currentNode = nodesToVisit.pop();\n\n if (currentNode instanceof _primitives.Ref) {\n if (this.refSet.has(currentNode)) {\n continue;\n }\n\n try {\n this.refSet.put(currentNode);\n currentNode = this.xref.fetch(currentNode);\n } catch (ex) {\n if (!(ex instanceof _core_utils.MissingDataException)) {\n throw ex;\n }\n\n nodesToRevisit.push(currentNode);\n pendingRequests.push({\n begin: ex.begin,\n end: ex.end\n });\n }\n }\n\n if (currentNode && currentNode.getBaseStreams) {\n const baseStreams = currentNode.getBaseStreams();\n let foundMissingData = false;\n\n for (let i = 0, ii = baseStreams.length; i < ii; i++) {\n const stream = baseStreams[i];\n\n if (stream.allChunksLoaded && !stream.allChunksLoaded()) {\n foundMissingData = true;\n pendingRequests.push({\n begin: stream.start,\n end: stream.end\n });\n }\n }\n\n if (foundMissingData) {\n nodesToRevisit.push(currentNode);\n }\n }\n\n addChildren(currentNode, nodesToVisit);\n }\n\n if (pendingRequests.length) {\n await this.xref.stream.manager.requestRanges(pendingRequests);\n\n for (let i = 0, ii = nodesToRevisit.length; i < ii; i++) {\n const node = nodesToRevisit[i];\n\n if (node instanceof _primitives.Ref) {\n this.refSet.remove(node);\n }\n }\n\n return this._walk(nodesToRevisit);\n }\n\n this.refSet = null;\n return undefined;\n }\n\n };\n return ObjectLoader;\n}();\n\nexports.ObjectLoader = ObjectLoader;\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Parser = exports.Linearization = exports.Lexer = void 0;\n\nvar _stream = __w_pdfjs_require__(11);\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nvar _ccitt_stream = __w_pdfjs_require__(12);\n\nvar _jbig2_stream = __w_pdfjs_require__(14);\n\nvar _jpeg_stream = __w_pdfjs_require__(17);\n\nvar _jpx_stream = __w_pdfjs_require__(19);\n\nconst MAX_LENGTH_TO_CACHE = 1000;\nconst MAX_ADLER32_LENGTH = 5552;\n\nfunction computeAdler32(bytes) {\n const bytesLength = bytes.length;\n let a = 1,\n b = 0;\n\n for (let i = 0; i < bytesLength; ++i) {\n a += bytes[i] & 0xff;\n b += a;\n }\n\n return b % 65521 << 16 | a % 65521;\n}\n\nclass Parser {\n constructor({\n lexer,\n xref,\n allowStreams = false,\n recoveryMode = false\n }) {\n this.lexer = lexer;\n this.xref = xref;\n this.allowStreams = allowStreams;\n this.recoveryMode = recoveryMode;\n this.imageCache = Object.create(null);\n this.refill();\n }\n\n refill() {\n this.buf1 = this.lexer.getObj();\n this.buf2 = this.lexer.getObj();\n }\n\n shift() {\n if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === \"ID\") {\n this.buf1 = this.buf2;\n this.buf2 = null;\n } else {\n this.buf1 = this.buf2;\n this.buf2 = this.lexer.getObj();\n }\n }\n\n tryShift() {\n try {\n this.shift();\n return true;\n } catch (e) {\n if (e instanceof _core_utils.MissingDataException) {\n throw e;\n }\n\n return false;\n }\n }\n\n getObj(cipherTransform = null) {\n const buf1 = this.buf1;\n this.shift();\n\n if (buf1 instanceof _primitives.Cmd) {\n switch (buf1.cmd) {\n case \"BI\":\n return this.makeInlineImage(cipherTransform);\n\n case \"[\":\n const array = [];\n\n while (!(0, _primitives.isCmd)(this.buf1, \"]\") && !(0, _primitives.isEOF)(this.buf1)) {\n array.push(this.getObj(cipherTransform));\n }\n\n if ((0, _primitives.isEOF)(this.buf1)) {\n if (!this.recoveryMode) {\n throw new _util.FormatError(\"End of file inside array\");\n }\n\n return array;\n }\n\n this.shift();\n return array;\n\n case \"<<\":\n const dict = new _primitives.Dict(this.xref);\n\n while (!(0, _primitives.isCmd)(this.buf1, \">>\") && !(0, _primitives.isEOF)(this.buf1)) {\n if (!(0, _primitives.isName)(this.buf1)) {\n (0, _util.info)(\"Malformed dictionary: key must be a name object\");\n this.shift();\n continue;\n }\n\n const key = this.buf1.name;\n this.shift();\n\n if ((0, _primitives.isEOF)(this.buf1)) {\n break;\n }\n\n dict.set(key, this.getObj(cipherTransform));\n }\n\n if ((0, _primitives.isEOF)(this.buf1)) {\n if (!this.recoveryMode) {\n throw new _util.FormatError(\"End of file inside dictionary\");\n }\n\n return dict;\n }\n\n if ((0, _primitives.isCmd)(this.buf2, \"stream\")) {\n return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;\n }\n\n this.shift();\n return dict;\n\n default:\n return buf1;\n }\n }\n\n if (Number.isInteger(buf1)) {\n if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, \"R\")) {\n const ref = _primitives.Ref.get(buf1, this.buf1);\n\n this.shift();\n this.shift();\n return ref;\n }\n\n return buf1;\n }\n\n if (typeof buf1 === \"string\") {\n if (cipherTransform) {\n return cipherTransform.decryptString(buf1);\n }\n\n return buf1;\n }\n\n return buf1;\n }\n\n findDefaultInlineStreamEnd(stream) {\n const E = 0x45,\n I = 0x49,\n SPACE = 0x20,\n LF = 0xa,\n CR = 0xd;\n const n = 10,\n NUL = 0x0;\n const startPos = stream.pos;\n let state = 0,\n ch,\n maybeEIPos;\n\n while ((ch = stream.getByte()) !== -1) {\n if (state === 0) {\n state = ch === E ? 1 : 0;\n } else if (state === 1) {\n state = ch === I ? 2 : 0;\n } else {\n (0, _util.assert)(state === 2);\n\n if (ch === SPACE || ch === LF || ch === CR) {\n maybeEIPos = stream.pos;\n const followingBytes = stream.peekBytes(n);\n\n for (let i = 0, ii = followingBytes.length; i < ii; i++) {\n ch = followingBytes[i];\n\n if (ch === NUL && followingBytes[i + 1] !== NUL) {\n continue;\n }\n\n if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {\n state = 0;\n break;\n }\n }\n\n if (state === 2) {\n break;\n }\n } else {\n state = 0;\n }\n }\n }\n\n if (ch === -1) {\n (0, _util.warn)(\"findDefaultInlineStreamEnd: \" + \"Reached the end of the stream without finding a valid EI marker\");\n\n if (maybeEIPos) {\n (0, _util.warn)('... trying to recover by using the last \"EI\" occurrence.');\n stream.skip(-(stream.pos - maybeEIPos));\n }\n }\n\n let endOffset = 4;\n stream.skip(-endOffset);\n ch = stream.peekByte();\n stream.skip(endOffset);\n\n if (!(0, _core_utils.isWhiteSpace)(ch)) {\n endOffset--;\n }\n\n return stream.pos - endOffset - startPos;\n }\n\n findDCTDecodeInlineStreamEnd(stream) {\n const startPos = stream.pos;\n let foundEOI = false,\n b,\n markerLength;\n\n while ((b = stream.getByte()) !== -1) {\n if (b !== 0xff) {\n continue;\n }\n\n switch (stream.getByte()) {\n case 0x00:\n break;\n\n case 0xff:\n stream.skip(-1);\n break;\n\n case 0xd9:\n foundEOI = true;\n break;\n\n case 0xc0:\n case 0xc1:\n case 0xc2:\n case 0xc3:\n case 0xc5:\n case 0xc6:\n case 0xc7:\n case 0xc9:\n case 0xca:\n case 0xcb:\n case 0xcd:\n case 0xce:\n case 0xcf:\n case 0xc4:\n case 0xcc:\n case 0xda:\n case 0xdb:\n case 0xdc:\n case 0xdd:\n case 0xde:\n case 0xdf:\n case 0xe0:\n case 0xe1:\n case 0xe2:\n case 0xe3:\n case 0xe4:\n case 0xe5:\n case 0xe6:\n case 0xe7:\n case 0xe8:\n case 0xe9:\n case 0xea:\n case 0xeb:\n case 0xec:\n case 0xed:\n case 0xee:\n case 0xef:\n case 0xfe:\n markerLength = stream.getUint16();\n\n if (markerLength > 2) {\n stream.skip(markerLength - 2);\n } else {\n stream.skip(-2);\n }\n\n break;\n }\n\n if (foundEOI) {\n break;\n }\n }\n\n const length = stream.pos - startPos;\n\n if (b === -1) {\n (0, _util.warn)(\"Inline DCTDecode image stream: \" + \"EOI marker not found, searching for /EI/ instead.\");\n stream.skip(-length);\n return this.findDefaultInlineStreamEnd(stream);\n }\n\n this.inlineStreamSkipEI(stream);\n return length;\n }\n\n findASCII85DecodeInlineStreamEnd(stream) {\n const TILDE = 0x7e,\n GT = 0x3e;\n const startPos = stream.pos;\n let ch;\n\n while ((ch = stream.getByte()) !== -1) {\n if (ch === TILDE) {\n const tildePos = stream.pos;\n ch = stream.peekByte();\n\n while ((0, _core_utils.isWhiteSpace)(ch)) {\n stream.skip();\n ch = stream.peekByte();\n }\n\n if (ch === GT) {\n stream.skip();\n break;\n }\n\n if (stream.pos > tildePos) {\n const maybeEI = stream.peekBytes(2);\n\n if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {\n break;\n }\n }\n }\n }\n\n const length = stream.pos - startPos;\n\n if (ch === -1) {\n (0, _util.warn)(\"Inline ASCII85Decode image stream: \" + \"EOD marker not found, searching for /EI/ instead.\");\n stream.skip(-length);\n return this.findDefaultInlineStreamEnd(stream);\n }\n\n this.inlineStreamSkipEI(stream);\n return length;\n }\n\n findASCIIHexDecodeInlineStreamEnd(stream) {\n const GT = 0x3e;\n const startPos = stream.pos;\n let ch;\n\n while ((ch = stream.getByte()) !== -1) {\n if (ch === GT) {\n break;\n }\n }\n\n const length = stream.pos - startPos;\n\n if (ch === -1) {\n (0, _util.warn)(\"Inline ASCIIHexDecode image stream: \" + \"EOD marker not found, searching for /EI/ instead.\");\n stream.skip(-length);\n return this.findDefaultInlineStreamEnd(stream);\n }\n\n this.inlineStreamSkipEI(stream);\n return length;\n }\n\n inlineStreamSkipEI(stream) {\n const E = 0x45,\n I = 0x49;\n let state = 0,\n ch;\n\n while ((ch = stream.getByte()) !== -1) {\n if (state === 0) {\n state = ch === E ? 1 : 0;\n } else if (state === 1) {\n state = ch === I ? 2 : 0;\n } else if (state === 2) {\n break;\n }\n }\n }\n\n makeInlineImage(cipherTransform) {\n const lexer = this.lexer;\n const stream = lexer.stream;\n const dict = new _primitives.Dict(this.xref);\n let dictLength;\n\n while (!(0, _primitives.isCmd)(this.buf1, \"ID\") && !(0, _primitives.isEOF)(this.buf1)) {\n if (!(0, _primitives.isName)(this.buf1)) {\n throw new _util.FormatError(\"Dictionary key must be a name object\");\n }\n\n const key = this.buf1.name;\n this.shift();\n\n if ((0, _primitives.isEOF)(this.buf1)) {\n break;\n }\n\n dict.set(key, this.getObj(cipherTransform));\n }\n\n if (lexer.beginInlineImagePos !== -1) {\n dictLength = stream.pos - lexer.beginInlineImagePos;\n }\n\n const filter = dict.get(\"Filter\", \"F\");\n let filterName;\n\n if ((0, _primitives.isName)(filter)) {\n filterName = filter.name;\n } else if (Array.isArray(filter)) {\n const filterZero = this.xref.fetchIfRef(filter[0]);\n\n if ((0, _primitives.isName)(filterZero)) {\n filterName = filterZero.name;\n }\n }\n\n const startPos = stream.pos;\n let length;\n\n if (filterName === \"DCTDecode\" || filterName === \"DCT\") {\n length = this.findDCTDecodeInlineStreamEnd(stream);\n } else if (filterName === \"ASCII85Decode\" || filterName === \"A85\") {\n length = this.findASCII85DecodeInlineStreamEnd(stream);\n } else if (filterName === \"ASCIIHexDecode\" || filterName === \"AHx\") {\n length = this.findASCIIHexDecodeInlineStreamEnd(stream);\n } else {\n length = this.findDefaultInlineStreamEnd(stream);\n }\n\n let imageStream = stream.makeSubStream(startPos, length, dict);\n let cacheKey;\n\n if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {\n const imageBytes = imageStream.getBytes();\n imageStream.reset();\n const initialStreamPos = stream.pos;\n stream.pos = lexer.beginInlineImagePos;\n const dictBytes = stream.getBytes(dictLength);\n stream.pos = initialStreamPos;\n cacheKey = computeAdler32(imageBytes) + \"_\" + computeAdler32(dictBytes);\n const cacheEntry = this.imageCache[cacheKey];\n\n if (cacheEntry !== undefined) {\n this.buf2 = _primitives.Cmd.get(\"EI\");\n this.shift();\n cacheEntry.reset();\n return cacheEntry;\n }\n }\n\n if (cipherTransform) {\n imageStream = cipherTransform.createStream(imageStream, length);\n }\n\n imageStream = this.filter(imageStream, dict, length);\n imageStream.dict = dict;\n\n if (cacheKey !== undefined) {\n imageStream.cacheKey = `inline_${length}_${cacheKey}`;\n this.imageCache[cacheKey] = imageStream;\n }\n\n this.buf2 = _primitives.Cmd.get(\"EI\");\n this.shift();\n return imageStream;\n }\n\n _findStreamLength(startPos, signature) {\n const {\n stream\n } = this.lexer;\n stream.pos = startPos;\n const SCAN_BLOCK_LENGTH = 2048;\n const signatureLength = signature.length;\n\n while (stream.pos < stream.end) {\n const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);\n const scanLength = scanBytes.length - signatureLength;\n\n if (scanLength <= 0) {\n break;\n }\n\n let pos = 0;\n\n while (pos < scanLength) {\n let j = 0;\n\n while (j < signatureLength && scanBytes[pos + j] === signature[j]) {\n j++;\n }\n\n if (j >= signatureLength) {\n stream.pos += pos;\n return stream.pos - startPos;\n }\n\n pos++;\n }\n\n stream.pos += scanLength;\n }\n\n return -1;\n }\n\n makeStream(dict, cipherTransform) {\n const lexer = this.lexer;\n let stream = lexer.stream;\n lexer.skipToNextLine();\n const startPos = stream.pos - 1;\n let length = dict.get(\"Length\");\n\n if (!Number.isInteger(length)) {\n (0, _util.info)(`Bad length \"${length}\" in stream`);\n length = 0;\n }\n\n stream.pos = startPos + length;\n lexer.nextChar();\n\n if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, \"endstream\")) {\n this.shift();\n } else {\n const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);\n\n let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);\n\n if (actualLength < 0) {\n const MAX_TRUNCATION = 1;\n\n for (let i = 1; i <= MAX_TRUNCATION; i++) {\n const end = ENDSTREAM_SIGNATURE.length - i;\n const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);\n\n const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);\n\n if (maybeLength >= 0) {\n const lastByte = stream.peekBytes(end + 1)[end];\n\n if (!(0, _core_utils.isWhiteSpace)(lastByte)) {\n break;\n }\n\n (0, _util.info)(`Found \"${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}\" when ` + \"searching for endstream command.\");\n actualLength = maybeLength;\n break;\n }\n }\n\n if (actualLength < 0) {\n throw new _util.FormatError(\"Missing endstream command.\");\n }\n }\n\n length = actualLength;\n lexer.nextChar();\n this.shift();\n this.shift();\n }\n\n this.shift();\n stream = stream.makeSubStream(startPos, length, dict);\n\n if (cipherTransform) {\n stream = cipherTransform.createStream(stream, length);\n }\n\n stream = this.filter(stream, dict, length);\n stream.dict = dict;\n return stream;\n }\n\n filter(stream, dict, length) {\n let filter = dict.get(\"Filter\", \"F\");\n let params = dict.get(\"DecodeParms\", \"DP\");\n\n if ((0, _primitives.isName)(filter)) {\n if (Array.isArray(params)) {\n (0, _util.warn)(\"/DecodeParms should not contain an Array, \" + \"when /Filter contains a Name.\");\n }\n\n return this.makeFilter(stream, filter.name, length, params);\n }\n\n let maybeLength = length;\n\n if (Array.isArray(filter)) {\n const filterArray = filter;\n const paramsArray = params;\n\n for (let i = 0, ii = filterArray.length; i < ii; ++i) {\n filter = this.xref.fetchIfRef(filterArray[i]);\n\n if (!(0, _primitives.isName)(filter)) {\n throw new _util.FormatError(`Bad filter name \"${filter}\"`);\n }\n\n params = null;\n\n if (Array.isArray(paramsArray) && i in paramsArray) {\n params = this.xref.fetchIfRef(paramsArray[i]);\n }\n\n stream = this.makeFilter(stream, filter.name, maybeLength, params);\n maybeLength = null;\n }\n }\n\n return stream;\n }\n\n makeFilter(stream, name, maybeLength, params) {\n if (maybeLength === 0) {\n (0, _util.warn)(`Empty \"${name}\" stream.`);\n return new _stream.NullStream();\n }\n\n try {\n const xrefStreamStats = this.xref.stats.streamTypes;\n\n if (name === \"FlateDecode\" || name === \"Fl\") {\n xrefStreamStats[_util.StreamType.FLATE] = true;\n\n if (params) {\n return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params);\n }\n\n return new _stream.FlateStream(stream, maybeLength);\n }\n\n if (name === \"LZWDecode\" || name === \"LZW\") {\n xrefStreamStats[_util.StreamType.LZW] = true;\n let earlyChange = 1;\n\n if (params) {\n if (params.has(\"EarlyChange\")) {\n earlyChange = params.get(\"EarlyChange\");\n }\n\n return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);\n }\n\n return new _stream.LZWStream(stream, maybeLength, earlyChange);\n }\n\n if (name === \"DCTDecode\" || name === \"DCT\") {\n xrefStreamStats[_util.StreamType.DCT] = true;\n return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params);\n }\n\n if (name === \"JPXDecode\" || name === \"JPX\") {\n xrefStreamStats[_util.StreamType.JPX] = true;\n return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params);\n }\n\n if (name === \"ASCII85Decode\" || name === \"A85\") {\n xrefStreamStats[_util.StreamType.A85] = true;\n return new _stream.Ascii85Stream(stream, maybeLength);\n }\n\n if (name === \"ASCIIHexDecode\" || name === \"AHx\") {\n xrefStreamStats[_util.StreamType.AHX] = true;\n return new _stream.AsciiHexStream(stream, maybeLength);\n }\n\n if (name === \"CCITTFaxDecode\" || name === \"CCF\") {\n xrefStreamStats[_util.StreamType.CCF] = true;\n return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);\n }\n\n if (name === \"RunLengthDecode\" || name === \"RL\") {\n xrefStreamStats[_util.StreamType.RLX] = true;\n return new _stream.RunLengthStream(stream, maybeLength);\n }\n\n if (name === \"JBIG2Decode\") {\n xrefStreamStats[_util.StreamType.JBIG] = true;\n return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params);\n }\n\n (0, _util.warn)(`Filter \"${name}\" is not supported.`);\n return stream;\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n (0, _util.warn)(`Invalid stream: \"${ex}\"`);\n return new _stream.NullStream();\n }\n }\n\n}\n\nexports.Parser = Parser;\nconst specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 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, 2, 0, 2, 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, 2, 0, 2, 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, 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];\n\nfunction toHexDigit(ch) {\n if (ch >= 0x30 && ch <= 0x39) {\n return ch & 0x0f;\n }\n\n if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {\n return (ch & 0x0f) + 9;\n }\n\n return -1;\n}\n\nclass Lexer {\n constructor(stream, knownCommands = null) {\n this.stream = stream;\n this.nextChar();\n this.strBuf = [];\n this.knownCommands = knownCommands;\n this._hexStringNumWarn = 0;\n this.beginInlineImagePos = -1;\n }\n\n nextChar() {\n return this.currentChar = this.stream.getByte();\n }\n\n peekChar() {\n return this.stream.peekByte();\n }\n\n getNumber() {\n let ch = this.currentChar;\n let eNotation = false;\n let divideBy = 0;\n let sign = 0;\n\n if (ch === 0x2d) {\n sign = -1;\n ch = this.nextChar();\n\n if (ch === 0x2d) {\n ch = this.nextChar();\n }\n } else if (ch === 0x2b) {\n sign = 1;\n ch = this.nextChar();\n }\n\n if (ch === 0x0a || ch === 0x0d) {\n do {\n ch = this.nextChar();\n } while (ch === 0x0a || ch === 0x0d);\n }\n\n if (ch === 0x2e) {\n divideBy = 10;\n ch = this.nextChar();\n }\n\n if (ch < 0x30 || ch > 0x39) {\n if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {\n (0, _util.warn)(\"Lexer.getNumber - treating a single decimal point as zero.\");\n return 0;\n }\n\n throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);\n }\n\n sign = sign || 1;\n let baseValue = ch - 0x30;\n let powerValue = 0;\n let powerValueSign = 1;\n\n while ((ch = this.nextChar()) >= 0) {\n if (ch >= 0x30 && ch <= 0x39) {\n const currentDigit = ch - 0x30;\n\n if (eNotation) {\n powerValue = powerValue * 10 + currentDigit;\n } else {\n if (divideBy !== 0) {\n divideBy *= 10;\n }\n\n baseValue = baseValue * 10 + currentDigit;\n }\n } else if (ch === 0x2e) {\n if (divideBy === 0) {\n divideBy = 1;\n } else {\n break;\n }\n } else if (ch === 0x2d) {\n (0, _util.warn)(\"Badly formatted number: minus sign in the middle\");\n } else if (ch === 0x45 || ch === 0x65) {\n ch = this.peekChar();\n\n if (ch === 0x2b || ch === 0x2d) {\n powerValueSign = ch === 0x2d ? -1 : 1;\n this.nextChar();\n } else if (ch < 0x30 || ch > 0x39) {\n break;\n }\n\n eNotation = true;\n } else {\n break;\n }\n }\n\n if (divideBy !== 0) {\n baseValue /= divideBy;\n }\n\n if (eNotation) {\n baseValue *= 10 ** (powerValueSign * powerValue);\n }\n\n return sign * baseValue;\n }\n\n getString() {\n let numParen = 1;\n let done = false;\n const strBuf = this.strBuf;\n strBuf.length = 0;\n let ch = this.nextChar();\n\n while (true) {\n let charBuffered = false;\n\n switch (ch | 0) {\n case -1:\n (0, _util.warn)(\"Unterminated string\");\n done = true;\n break;\n\n case 0x28:\n ++numParen;\n strBuf.push(\"(\");\n break;\n\n case 0x29:\n if (--numParen === 0) {\n this.nextChar();\n done = true;\n } else {\n strBuf.push(\")\");\n }\n\n break;\n\n case 0x5c:\n ch = this.nextChar();\n\n switch (ch) {\n case -1:\n (0, _util.warn)(\"Unterminated string\");\n done = true;\n break;\n\n case 0x6e:\n strBuf.push(\"\\n\");\n break;\n\n case 0x72:\n strBuf.push(\"\\r\");\n break;\n\n case 0x74:\n strBuf.push(\"\\t\");\n break;\n\n case 0x62:\n strBuf.push(\"\\b\");\n break;\n\n case 0x66:\n strBuf.push(\"\\f\");\n break;\n\n case 0x5c:\n case 0x28:\n case 0x29:\n strBuf.push(String.fromCharCode(ch));\n break;\n\n case 0x30:\n case 0x31:\n case 0x32:\n case 0x33:\n case 0x34:\n case 0x35:\n case 0x36:\n case 0x37:\n let x = ch & 0x0f;\n ch = this.nextChar();\n charBuffered = true;\n\n if (ch >= 0x30 && ch <= 0x37) {\n x = (x << 3) + (ch & 0x0f);\n ch = this.nextChar();\n\n if (ch >= 0x30 && ch <= 0x37) {\n charBuffered = false;\n x = (x << 3) + (ch & 0x0f);\n }\n }\n\n strBuf.push(String.fromCharCode(x));\n break;\n\n case 0x0d:\n if (this.peekChar() === 0x0a) {\n this.nextChar();\n }\n\n break;\n\n case 0x0a:\n break;\n\n default:\n strBuf.push(String.fromCharCode(ch));\n break;\n }\n\n break;\n\n default:\n strBuf.push(String.fromCharCode(ch));\n break;\n }\n\n if (done) {\n break;\n }\n\n if (!charBuffered) {\n ch = this.nextChar();\n }\n }\n\n return strBuf.join(\"\");\n }\n\n getName() {\n let ch, previousCh;\n const strBuf = this.strBuf;\n strBuf.length = 0;\n\n while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {\n if (ch === 0x23) {\n ch = this.nextChar();\n\n if (specialChars[ch]) {\n (0, _util.warn)(\"Lexer_getName: \" + \"NUMBER SIGN (#) should be followed by a hexadecimal number.\");\n strBuf.push(\"#\");\n break;\n }\n\n const x = toHexDigit(ch);\n\n if (x !== -1) {\n previousCh = ch;\n ch = this.nextChar();\n const x2 = toHexDigit(ch);\n\n if (x2 === -1) {\n (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + \"in hexadecimal number.\");\n strBuf.push(\"#\", String.fromCharCode(previousCh));\n\n if (specialChars[ch]) {\n break;\n }\n\n strBuf.push(String.fromCharCode(ch));\n continue;\n }\n\n strBuf.push(String.fromCharCode(x << 4 | x2));\n } else {\n strBuf.push(\"#\", String.fromCharCode(ch));\n }\n } else {\n strBuf.push(String.fromCharCode(ch));\n }\n }\n\n if (strBuf.length > 127) {\n (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);\n }\n\n return _primitives.Name.get(strBuf.join(\"\"));\n }\n\n _hexStringWarn(ch) {\n const MAX_HEX_STRING_NUM_WARN = 5;\n\n if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {\n (0, _util.warn)(\"getHexString - ignoring additional invalid characters.\");\n return;\n }\n\n if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {\n return;\n }\n\n (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);\n }\n\n getHexString() {\n const strBuf = this.strBuf;\n strBuf.length = 0;\n let ch = this.currentChar;\n let isFirstHex = true;\n let firstDigit, secondDigit;\n this._hexStringNumWarn = 0;\n\n while (true) {\n if (ch < 0) {\n (0, _util.warn)(\"Unterminated hex string\");\n break;\n } else if (ch === 0x3e) {\n this.nextChar();\n break;\n } else if (specialChars[ch] === 1) {\n ch = this.nextChar();\n continue;\n } else {\n if (isFirstHex) {\n firstDigit = toHexDigit(ch);\n\n if (firstDigit === -1) {\n this._hexStringWarn(ch);\n\n ch = this.nextChar();\n continue;\n }\n } else {\n secondDigit = toHexDigit(ch);\n\n if (secondDigit === -1) {\n this._hexStringWarn(ch);\n\n ch = this.nextChar();\n continue;\n }\n\n strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));\n }\n\n isFirstHex = !isFirstHex;\n ch = this.nextChar();\n }\n }\n\n return strBuf.join(\"\");\n }\n\n getObj() {\n let comment = false;\n let ch = this.currentChar;\n\n while (true) {\n if (ch < 0) {\n return _primitives.EOF;\n }\n\n if (comment) {\n if (ch === 0x0a || ch === 0x0d) {\n comment = false;\n }\n } else if (ch === 0x25) {\n comment = true;\n } else if (specialChars[ch] !== 1) {\n break;\n }\n\n ch = this.nextChar();\n }\n\n switch (ch | 0) {\n case 0x30:\n case 0x31:\n case 0x32:\n case 0x33:\n case 0x34:\n case 0x35:\n case 0x36:\n case 0x37:\n case 0x38:\n case 0x39:\n case 0x2b:\n case 0x2d:\n case 0x2e:\n return this.getNumber();\n\n case 0x28:\n return this.getString();\n\n case 0x2f:\n return this.getName();\n\n case 0x5b:\n this.nextChar();\n return _primitives.Cmd.get(\"[\");\n\n case 0x5d:\n this.nextChar();\n return _primitives.Cmd.get(\"]\");\n\n case 0x3c:\n ch = this.nextChar();\n\n if (ch === 0x3c) {\n this.nextChar();\n return _primitives.Cmd.get(\"<<\");\n }\n\n return this.getHexString();\n\n case 0x3e:\n ch = this.nextChar();\n\n if (ch === 0x3e) {\n this.nextChar();\n return _primitives.Cmd.get(\">>\");\n }\n\n return _primitives.Cmd.get(\">\");\n\n case 0x7b:\n this.nextChar();\n return _primitives.Cmd.get(\"{\");\n\n case 0x7d:\n this.nextChar();\n return _primitives.Cmd.get(\"}\");\n\n case 0x29:\n this.nextChar();\n throw new _util.FormatError(`Illegal character: ${ch}`);\n }\n\n let str = String.fromCharCode(ch);\n const knownCommands = this.knownCommands;\n let knownCommandFound = knownCommands && knownCommands[str] !== undefined;\n\n while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {\n const possibleCommand = str + String.fromCharCode(ch);\n\n if (knownCommandFound && knownCommands[possibleCommand] === undefined) {\n break;\n }\n\n if (str.length === 128) {\n throw new _util.FormatError(`Command token too long: ${str.length}`);\n }\n\n str = possibleCommand;\n knownCommandFound = knownCommands && knownCommands[str] !== undefined;\n }\n\n if (str === \"true\") {\n return true;\n }\n\n if (str === \"false\") {\n return false;\n }\n\n if (str === \"null\") {\n return null;\n }\n\n if (str === \"BI\") {\n this.beginInlineImagePos = this.stream.pos;\n }\n\n return _primitives.Cmd.get(str);\n }\n\n skipToNextLine() {\n let ch = this.currentChar;\n\n while (ch >= 0) {\n if (ch === 0x0d) {\n ch = this.nextChar();\n\n if (ch === 0x0a) {\n this.nextChar();\n }\n\n break;\n } else if (ch === 0x0a) {\n this.nextChar();\n break;\n }\n\n ch = this.nextChar();\n }\n }\n\n}\n\nexports.Lexer = Lexer;\n\nclass Linearization {\n static create(stream) {\n function getInt(linDict, name, allowZeroValue = false) {\n const obj = linDict.get(name);\n\n if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {\n return obj;\n }\n\n throw new Error(`The \"${name}\" parameter in the linearization ` + \"dictionary is invalid.\");\n }\n\n function getHints(linDict) {\n const hints = linDict.get(\"H\");\n let hintsLength;\n\n if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {\n for (let index = 0; index < hintsLength; index++) {\n const hint = hints[index];\n\n if (!(Number.isInteger(hint) && hint > 0)) {\n throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);\n }\n }\n\n return hints;\n }\n\n throw new Error(\"Hint array in the linearization dictionary is invalid.\");\n }\n\n const parser = new Parser({\n lexer: new Lexer(stream),\n xref: null\n });\n const obj1 = parser.getObj();\n const obj2 = parser.getObj();\n const obj3 = parser.getObj();\n const linDict = parser.getObj();\n let obj, length;\n\n if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, \"obj\") && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get(\"Linearized\")) && obj > 0)) {\n return null;\n } else if ((length = getInt(linDict, \"L\")) !== stream.length) {\n throw new Error('The \"L\" parameter in the linearization dictionary ' + \"does not equal the stream length.\");\n }\n\n return {\n length,\n hints: getHints(linDict),\n objectNumberFirst: getInt(linDict, \"O\"),\n endFirst: getInt(linDict, \"E\"),\n numPages: getInt(linDict, \"N\"),\n mainXRefEntriesOffset: getInt(linDict, \"T\"),\n pageFirst: linDict.has(\"P\") ? getInt(linDict, \"P\", true) : 0\n };\n }\n\n}\n\nexports.Linearization = Linearization;\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nvar Stream = function StreamClosure() {\n function Stream(arrayBuffer, start, length, dict) {\n this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);\n this.start = start || 0;\n this.pos = this.start;\n this.end = start + length || this.bytes.length;\n this.dict = dict;\n }\n\n Stream.prototype = {\n get length() {\n return this.end - this.start;\n },\n\n get isEmpty() {\n return this.length === 0;\n },\n\n getByte: function Stream_getByte() {\n if (this.pos >= this.end) {\n return -1;\n }\n\n return this.bytes[this.pos++];\n },\n getUint16: function Stream_getUint16() {\n var b0 = this.getByte();\n var b1 = this.getByte();\n\n if (b0 === -1 || b1 === -1) {\n return -1;\n }\n\n return (b0 << 8) + b1;\n },\n getInt32: function Stream_getInt32() {\n var b0 = this.getByte();\n var b1 = this.getByte();\n var b2 = this.getByte();\n var b3 = this.getByte();\n return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;\n },\n\n getBytes(length, forceClamped = false) {\n var bytes = this.bytes;\n var pos = this.pos;\n var strEnd = this.end;\n\n if (!length) {\n const subarray = bytes.subarray(pos, strEnd);\n return forceClamped ? new Uint8ClampedArray(subarray) : subarray;\n }\n\n var end = pos + length;\n\n if (end > strEnd) {\n end = strEnd;\n }\n\n this.pos = end;\n const subarray = bytes.subarray(pos, end);\n return forceClamped ? new Uint8ClampedArray(subarray) : subarray;\n },\n\n peekByte: function Stream_peekByte() {\n var peekedByte = this.getByte();\n\n if (peekedByte !== -1) {\n this.pos--;\n }\n\n return peekedByte;\n },\n\n peekBytes(length, forceClamped = false) {\n var bytes = this.getBytes(length, forceClamped);\n this.pos -= bytes.length;\n return bytes;\n },\n\n getByteRange(begin, end) {\n if (begin < 0) {\n begin = 0;\n }\n\n if (end > this.end) {\n end = this.end;\n }\n\n return this.bytes.subarray(begin, end);\n },\n\n skip: function Stream_skip(n) {\n if (!n) {\n n = 1;\n }\n\n this.pos += n;\n },\n reset: function Stream_reset() {\n this.pos = this.start;\n },\n moveStart: function Stream_moveStart() {\n this.start = this.pos;\n },\n makeSubStream: function Stream_makeSubStream(start, length, dict) {\n return new Stream(this.bytes.buffer, start, length, dict);\n }\n };\n return Stream;\n}();\n\nexports.Stream = Stream;\n\nvar StringStream = function StringStreamClosure() {\n function StringStream(str) {\n const bytes = (0, _util.stringToBytes)(str);\n Stream.call(this, bytes);\n }\n\n StringStream.prototype = Stream.prototype;\n return StringStream;\n}();\n\nexports.StringStream = StringStream;\n\nvar DecodeStream = function DecodeStreamClosure() {\n var emptyBuffer = new Uint8Array(0);\n\n function DecodeStream(maybeMinBufferLength) {\n this._rawMinBufferLength = maybeMinBufferLength || 0;\n this.pos = 0;\n this.bufferLength = 0;\n this.eof = false;\n this.buffer = emptyBuffer;\n this.minBufferLength = 512;\n\n if (maybeMinBufferLength) {\n while (this.minBufferLength < maybeMinBufferLength) {\n this.minBufferLength *= 2;\n }\n }\n }\n\n DecodeStream.prototype = {\n get isEmpty() {\n while (!this.eof && this.bufferLength === 0) {\n this.readBlock();\n }\n\n return this.bufferLength === 0;\n },\n\n ensureBuffer: function DecodeStream_ensureBuffer(requested) {\n var buffer = this.buffer;\n\n if (requested <= buffer.byteLength) {\n return buffer;\n }\n\n var size = this.minBufferLength;\n\n while (size < requested) {\n size *= 2;\n }\n\n var buffer2 = new Uint8Array(size);\n buffer2.set(buffer);\n return this.buffer = buffer2;\n },\n getByte: function DecodeStream_getByte() {\n var pos = this.pos;\n\n while (this.bufferLength <= pos) {\n if (this.eof) {\n return -1;\n }\n\n this.readBlock();\n }\n\n return this.buffer[this.pos++];\n },\n getUint16: function DecodeStream_getUint16() {\n var b0 = this.getByte();\n var b1 = this.getByte();\n\n if (b0 === -1 || b1 === -1) {\n return -1;\n }\n\n return (b0 << 8) + b1;\n },\n getInt32: function DecodeStream_getInt32() {\n var b0 = this.getByte();\n var b1 = this.getByte();\n var b2 = this.getByte();\n var b3 = this.getByte();\n return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;\n },\n\n getBytes(length, forceClamped = false) {\n var end,\n pos = this.pos;\n\n if (length) {\n this.ensureBuffer(pos + length);\n end = pos + length;\n\n while (!this.eof && this.bufferLength < end) {\n this.readBlock();\n }\n\n var bufEnd = this.bufferLength;\n\n if (end > bufEnd) {\n end = bufEnd;\n }\n } else {\n while (!this.eof) {\n this.readBlock();\n }\n\n end = this.bufferLength;\n }\n\n this.pos = end;\n const subarray = this.buffer.subarray(pos, end);\n return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;\n },\n\n peekByte: function DecodeStream_peekByte() {\n var peekedByte = this.getByte();\n\n if (peekedByte !== -1) {\n this.pos--;\n }\n\n return peekedByte;\n },\n\n peekBytes(length, forceClamped = false) {\n var bytes = this.getBytes(length, forceClamped);\n this.pos -= bytes.length;\n return bytes;\n },\n\n makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {\n var end = start + length;\n\n while (this.bufferLength <= end && !this.eof) {\n this.readBlock();\n }\n\n return new Stream(this.buffer, start, length, dict);\n },\n\n getByteRange(begin, end) {\n (0, _util.unreachable)(\"Should not call DecodeStream.getByteRange\");\n },\n\n skip: function DecodeStream_skip(n) {\n if (!n) {\n n = 1;\n }\n\n this.pos += n;\n },\n reset: function DecodeStream_reset() {\n this.pos = 0;\n },\n getBaseStreams: function DecodeStream_getBaseStreams() {\n if (this.str && this.str.getBaseStreams) {\n return this.str.getBaseStreams();\n }\n\n return [];\n }\n };\n return DecodeStream;\n}();\n\nexports.DecodeStream = DecodeStream;\n\nvar StreamsSequenceStream = function StreamsSequenceStreamClosure() {\n function StreamsSequenceStream(streams) {\n this.streams = streams;\n let maybeLength = 0;\n\n for (let i = 0, ii = streams.length; i < ii; i++) {\n const stream = streams[i];\n\n if (stream instanceof DecodeStream) {\n maybeLength += stream._rawMinBufferLength;\n } else {\n maybeLength += stream.length;\n }\n }\n\n DecodeStream.call(this, maybeLength);\n }\n\n StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);\n\n StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {\n var streams = this.streams;\n\n if (streams.length === 0) {\n this.eof = true;\n return;\n }\n\n var stream = streams.shift();\n var chunk = stream.getBytes();\n var bufferLength = this.bufferLength;\n var newLength = bufferLength + chunk.length;\n var buffer = this.ensureBuffer(newLength);\n buffer.set(chunk, bufferLength);\n this.bufferLength = newLength;\n };\n\n StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {\n var baseStreams = [];\n\n for (var i = 0, ii = this.streams.length; i < ii; i++) {\n var stream = this.streams[i];\n\n if (stream.getBaseStreams) {\n baseStreams.push(...stream.getBaseStreams());\n }\n }\n\n return baseStreams;\n };\n\n return StreamsSequenceStream;\n}();\n\nexports.StreamsSequenceStream = StreamsSequenceStream;\n\nvar FlateStream = function FlateStreamClosure() {\n var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n var lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]);\n var distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);\n var fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9];\n var fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5];\n\n function FlateStream(str, maybeLength) {\n this.str = str;\n this.dict = str.dict;\n var cmf = str.getByte();\n var flg = str.getByte();\n\n if (cmf === -1 || flg === -1) {\n throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);\n }\n\n if ((cmf & 0x0f) !== 0x08) {\n throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);\n }\n\n if (((cmf << 8) + flg) % 31 !== 0) {\n throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);\n }\n\n if (flg & 0x20) {\n throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);\n }\n\n this.codeSize = 0;\n this.codeBuf = 0;\n DecodeStream.call(this, maybeLength);\n }\n\n FlateStream.prototype = Object.create(DecodeStream.prototype);\n\n FlateStream.prototype.getBits = function FlateStream_getBits(bits) {\n var str = this.str;\n var codeSize = this.codeSize;\n var codeBuf = this.codeBuf;\n var b;\n\n while (codeSize < bits) {\n if ((b = str.getByte()) === -1) {\n throw new _util.FormatError(\"Bad encoding in flate stream\");\n }\n\n codeBuf |= b << codeSize;\n codeSize += 8;\n }\n\n b = codeBuf & (1 << bits) - 1;\n this.codeBuf = codeBuf >> bits;\n this.codeSize = codeSize -= bits;\n return b;\n };\n\n FlateStream.prototype.getCode = function FlateStream_getCode(table) {\n var str = this.str;\n var codes = table[0];\n var maxLen = table[1];\n var codeSize = this.codeSize;\n var codeBuf = this.codeBuf;\n var b;\n\n while (codeSize < maxLen) {\n if ((b = str.getByte()) === -1) {\n break;\n }\n\n codeBuf |= b << codeSize;\n codeSize += 8;\n }\n\n var code = codes[codeBuf & (1 << maxLen) - 1];\n var codeLen = code >> 16;\n var codeVal = code & 0xffff;\n\n if (codeLen < 1 || codeSize < codeLen) {\n throw new _util.FormatError(\"Bad encoding in flate stream\");\n }\n\n this.codeBuf = codeBuf >> codeLen;\n this.codeSize = codeSize - codeLen;\n return codeVal;\n };\n\n FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {\n var n = lengths.length;\n var maxLen = 0;\n var i;\n\n for (i = 0; i < n; ++i) {\n if (lengths[i] > maxLen) {\n maxLen = lengths[i];\n }\n }\n\n var size = 1 << maxLen;\n var codes = new Int32Array(size);\n\n for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {\n for (var val = 0; val < n; ++val) {\n if (lengths[val] === len) {\n var code2 = 0;\n var t = code;\n\n for (i = 0; i < len; ++i) {\n code2 = code2 << 1 | t & 1;\n t >>= 1;\n }\n\n for (i = code2; i < size; i += skip) {\n codes[i] = len << 16 | val;\n }\n\n ++code;\n }\n }\n }\n\n return [codes, maxLen];\n };\n\n FlateStream.prototype.readBlock = function FlateStream_readBlock() {\n var buffer, len;\n var str = this.str;\n var hdr = this.getBits(3);\n\n if (hdr & 1) {\n this.eof = true;\n }\n\n hdr >>= 1;\n\n if (hdr === 0) {\n var b;\n\n if ((b = str.getByte()) === -1) {\n throw new _util.FormatError(\"Bad block header in flate stream\");\n }\n\n var blockLen = b;\n\n if ((b = str.getByte()) === -1) {\n throw new _util.FormatError(\"Bad block header in flate stream\");\n }\n\n blockLen |= b << 8;\n\n if ((b = str.getByte()) === -1) {\n throw new _util.FormatError(\"Bad block header in flate stream\");\n }\n\n var check = b;\n\n if ((b = str.getByte()) === -1) {\n throw new _util.FormatError(\"Bad block header in flate stream\");\n }\n\n check |= b << 8;\n\n if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {\n throw new _util.FormatError(\"Bad uncompressed block length in flate stream\");\n }\n\n this.codeBuf = 0;\n this.codeSize = 0;\n const bufferLength = this.bufferLength,\n end = bufferLength + blockLen;\n buffer = this.ensureBuffer(end);\n this.bufferLength = end;\n\n if (blockLen === 0) {\n if (str.peekByte() === -1) {\n this.eof = true;\n }\n } else {\n const block = str.getBytes(blockLen);\n buffer.set(block, bufferLength);\n\n if (block.length < blockLen) {\n this.eof = true;\n }\n }\n\n return;\n }\n\n var litCodeTable;\n var distCodeTable;\n\n if (hdr === 1) {\n litCodeTable = fixedLitCodeTab;\n distCodeTable = fixedDistCodeTab;\n } else if (hdr === 2) {\n var numLitCodes = this.getBits(5) + 257;\n var numDistCodes = this.getBits(5) + 1;\n var numCodeLenCodes = this.getBits(4) + 4;\n var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);\n var i;\n\n for (i = 0; i < numCodeLenCodes; ++i) {\n codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);\n }\n\n var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);\n len = 0;\n i = 0;\n var codes = numLitCodes + numDistCodes;\n var codeLengths = new Uint8Array(codes);\n var bitsLength, bitsOffset, what;\n\n while (i < codes) {\n var code = this.getCode(codeLenCodeTab);\n\n if (code === 16) {\n bitsLength = 2;\n bitsOffset = 3;\n what = len;\n } else if (code === 17) {\n bitsLength = 3;\n bitsOffset = 3;\n what = len = 0;\n } else if (code === 18) {\n bitsLength = 7;\n bitsOffset = 11;\n what = len = 0;\n } else {\n codeLengths[i++] = len = code;\n continue;\n }\n\n var repeatLength = this.getBits(bitsLength) + bitsOffset;\n\n while (repeatLength-- > 0) {\n codeLengths[i++] = what;\n }\n }\n\n litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));\n distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));\n } else {\n throw new _util.FormatError(\"Unknown block type in flate stream\");\n }\n\n buffer = this.buffer;\n var limit = buffer ? buffer.length : 0;\n var pos = this.bufferLength;\n\n while (true) {\n var code1 = this.getCode(litCodeTable);\n\n if (code1 < 256) {\n if (pos + 1 >= limit) {\n buffer = this.ensureBuffer(pos + 1);\n limit = buffer.length;\n }\n\n buffer[pos++] = code1;\n continue;\n }\n\n if (code1 === 256) {\n this.bufferLength = pos;\n return;\n }\n\n code1 -= 257;\n code1 = lengthDecode[code1];\n var code2 = code1 >> 16;\n\n if (code2 > 0) {\n code2 = this.getBits(code2);\n }\n\n len = (code1 & 0xffff) + code2;\n code1 = this.getCode(distCodeTable);\n code1 = distDecode[code1];\n code2 = code1 >> 16;\n\n if (code2 > 0) {\n code2 = this.getBits(code2);\n }\n\n var dist = (code1 & 0xffff) + code2;\n\n if (pos + len >= limit) {\n buffer = this.ensureBuffer(pos + len);\n limit = buffer.length;\n }\n\n for (var k = 0; k < len; ++k, ++pos) {\n buffer[pos] = buffer[pos - dist];\n }\n }\n };\n\n return FlateStream;\n}();\n\nexports.FlateStream = FlateStream;\n\nvar PredictorStream = function PredictorStreamClosure() {\n function PredictorStream(str, maybeLength, params) {\n if (!(0, _primitives.isDict)(params)) {\n return str;\n }\n\n var predictor = this.predictor = params.get(\"Predictor\") || 1;\n\n if (predictor <= 1) {\n return str;\n }\n\n if (predictor !== 2 && (predictor < 10 || predictor > 15)) {\n throw new _util.FormatError(`Unsupported predictor: ${predictor}`);\n }\n\n if (predictor === 2) {\n this.readBlock = this.readBlockTiff;\n } else {\n this.readBlock = this.readBlockPng;\n }\n\n this.str = str;\n this.dict = str.dict;\n var colors = this.colors = params.get(\"Colors\") || 1;\n var bits = this.bits = params.get(\"BitsPerComponent\") || 8;\n var columns = this.columns = params.get(\"Columns\") || 1;\n this.pixBytes = colors * bits + 7 >> 3;\n this.rowBytes = columns * colors * bits + 7 >> 3;\n DecodeStream.call(this, maybeLength);\n return this;\n }\n\n PredictorStream.prototype = Object.create(DecodeStream.prototype);\n\n PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {\n var rowBytes = this.rowBytes;\n var bufferLength = this.bufferLength;\n var buffer = this.ensureBuffer(bufferLength + rowBytes);\n var bits = this.bits;\n var colors = this.colors;\n var rawBytes = this.str.getBytes(rowBytes);\n this.eof = !rawBytes.length;\n\n if (this.eof) {\n return;\n }\n\n var inbuf = 0,\n outbuf = 0;\n var inbits = 0,\n outbits = 0;\n var pos = bufferLength;\n var i;\n\n if (bits === 1 && colors === 1) {\n for (i = 0; i < rowBytes; ++i) {\n var c = rawBytes[i] ^ inbuf;\n c ^= c >> 1;\n c ^= c >> 2;\n c ^= c >> 4;\n inbuf = (c & 1) << 7;\n buffer[pos++] = c;\n }\n } else if (bits === 8) {\n for (i = 0; i < colors; ++i) {\n buffer[pos++] = rawBytes[i];\n }\n\n for (; i < rowBytes; ++i) {\n buffer[pos] = buffer[pos - colors] + rawBytes[i];\n pos++;\n }\n } else if (bits === 16) {\n var bytesPerPixel = colors * 2;\n\n for (i = 0; i < bytesPerPixel; ++i) {\n buffer[pos++] = rawBytes[i];\n }\n\n for (; i < rowBytes; i += 2) {\n var sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);\n buffer[pos++] = sum >> 8 & 0xff;\n buffer[pos++] = sum & 0xff;\n }\n } else {\n var compArray = new Uint8Array(colors + 1);\n var bitMask = (1 << bits) - 1;\n var j = 0,\n k = bufferLength;\n var columns = this.columns;\n\n for (i = 0; i < columns; ++i) {\n for (var kk = 0; kk < colors; ++kk) {\n if (inbits < bits) {\n inbuf = inbuf << 8 | rawBytes[j++] & 0xff;\n inbits += 8;\n }\n\n compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;\n inbits -= bits;\n outbuf = outbuf << bits | compArray[kk];\n outbits += bits;\n\n if (outbits >= 8) {\n buffer[k++] = outbuf >> outbits - 8 & 0xff;\n outbits -= 8;\n }\n }\n }\n\n if (outbits > 0) {\n buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);\n }\n }\n\n this.bufferLength += rowBytes;\n };\n\n PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {\n var rowBytes = this.rowBytes;\n var pixBytes = this.pixBytes;\n var predictor = this.str.getByte();\n var rawBytes = this.str.getBytes(rowBytes);\n this.eof = !rawBytes.length;\n\n if (this.eof) {\n return;\n }\n\n var bufferLength = this.bufferLength;\n var buffer = this.ensureBuffer(bufferLength + rowBytes);\n var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);\n\n if (prevRow.length === 0) {\n prevRow = new Uint8Array(rowBytes);\n }\n\n var i,\n j = bufferLength,\n up,\n c;\n\n switch (predictor) {\n case 0:\n for (i = 0; i < rowBytes; ++i) {\n buffer[j++] = rawBytes[i];\n }\n\n break;\n\n case 1:\n for (i = 0; i < pixBytes; ++i) {\n buffer[j++] = rawBytes[i];\n }\n\n for (; i < rowBytes; ++i) {\n buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;\n j++;\n }\n\n break;\n\n case 2:\n for (i = 0; i < rowBytes; ++i) {\n buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;\n }\n\n break;\n\n case 3:\n for (i = 0; i < pixBytes; ++i) {\n buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];\n }\n\n for (; i < rowBytes; ++i) {\n buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;\n j++;\n }\n\n break;\n\n case 4:\n for (i = 0; i < pixBytes; ++i) {\n up = prevRow[i];\n c = rawBytes[i];\n buffer[j++] = up + c;\n }\n\n for (; i < rowBytes; ++i) {\n up = prevRow[i];\n var upLeft = prevRow[i - pixBytes];\n var left = buffer[j - pixBytes];\n var p = left + up - upLeft;\n var pa = p - left;\n\n if (pa < 0) {\n pa = -pa;\n }\n\n var pb = p - up;\n\n if (pb < 0) {\n pb = -pb;\n }\n\n var pc = p - upLeft;\n\n if (pc < 0) {\n pc = -pc;\n }\n\n c = rawBytes[i];\n\n if (pa <= pb && pa <= pc) {\n buffer[j++] = left + c;\n } else if (pb <= pc) {\n buffer[j++] = up + c;\n } else {\n buffer[j++] = upLeft + c;\n }\n }\n\n break;\n\n default:\n throw new _util.FormatError(`Unsupported predictor: ${predictor}`);\n }\n\n this.bufferLength += rowBytes;\n };\n\n return PredictorStream;\n}();\n\nexports.PredictorStream = PredictorStream;\n\nvar DecryptStream = function DecryptStreamClosure() {\n function DecryptStream(str, maybeLength, decrypt) {\n this.str = str;\n this.dict = str.dict;\n this.decrypt = decrypt;\n this.nextChunk = null;\n this.initialized = false;\n DecodeStream.call(this, maybeLength);\n }\n\n var chunkSize = 512;\n DecryptStream.prototype = Object.create(DecodeStream.prototype);\n\n DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {\n var chunk;\n\n if (this.initialized) {\n chunk = this.nextChunk;\n } else {\n chunk = this.str.getBytes(chunkSize);\n this.initialized = true;\n }\n\n if (!chunk || chunk.length === 0) {\n this.eof = true;\n return;\n }\n\n this.nextChunk = this.str.getBytes(chunkSize);\n var hasMoreData = this.nextChunk && this.nextChunk.length > 0;\n var decrypt = this.decrypt;\n chunk = decrypt(chunk, !hasMoreData);\n var bufferLength = this.bufferLength;\n var i,\n n = chunk.length;\n var buffer = this.ensureBuffer(bufferLength + n);\n\n for (i = 0; i < n; i++) {\n buffer[bufferLength++] = chunk[i];\n }\n\n this.bufferLength = bufferLength;\n };\n\n return DecryptStream;\n}();\n\nexports.DecryptStream = DecryptStream;\n\nvar Ascii85Stream = function Ascii85StreamClosure() {\n function Ascii85Stream(str, maybeLength) {\n this.str = str;\n this.dict = str.dict;\n this.input = new Uint8Array(5);\n\n if (maybeLength) {\n maybeLength = 0.8 * maybeLength;\n }\n\n DecodeStream.call(this, maybeLength);\n }\n\n Ascii85Stream.prototype = Object.create(DecodeStream.prototype);\n\n Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {\n var TILDA_CHAR = 0x7e;\n var Z_LOWER_CHAR = 0x7a;\n var EOF = -1;\n var str = this.str;\n var c = str.getByte();\n\n while ((0, _core_utils.isWhiteSpace)(c)) {\n c = str.getByte();\n }\n\n if (c === EOF || c === TILDA_CHAR) {\n this.eof = true;\n return;\n }\n\n var bufferLength = this.bufferLength,\n buffer;\n var i;\n\n if (c === Z_LOWER_CHAR) {\n buffer = this.ensureBuffer(bufferLength + 4);\n\n for (i = 0; i < 4; ++i) {\n buffer[bufferLength + i] = 0;\n }\n\n this.bufferLength += 4;\n } else {\n var input = this.input;\n input[0] = c;\n\n for (i = 1; i < 5; ++i) {\n c = str.getByte();\n\n while ((0, _core_utils.isWhiteSpace)(c)) {\n c = str.getByte();\n }\n\n input[i] = c;\n\n if (c === EOF || c === TILDA_CHAR) {\n break;\n }\n }\n\n buffer = this.ensureBuffer(bufferLength + i - 1);\n this.bufferLength += i - 1;\n\n if (i < 5) {\n for (; i < 5; ++i) {\n input[i] = 0x21 + 84;\n }\n\n this.eof = true;\n }\n\n var t = 0;\n\n for (i = 0; i < 5; ++i) {\n t = t * 85 + (input[i] - 0x21);\n }\n\n for (i = 3; i >= 0; --i) {\n buffer[bufferLength + i] = t & 0xff;\n t >>= 8;\n }\n }\n };\n\n return Ascii85Stream;\n}();\n\nexports.Ascii85Stream = Ascii85Stream;\n\nvar AsciiHexStream = function AsciiHexStreamClosure() {\n function AsciiHexStream(str, maybeLength) {\n this.str = str;\n this.dict = str.dict;\n this.firstDigit = -1;\n\n if (maybeLength) {\n maybeLength = 0.5 * maybeLength;\n }\n\n DecodeStream.call(this, maybeLength);\n }\n\n AsciiHexStream.prototype = Object.create(DecodeStream.prototype);\n\n AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {\n var UPSTREAM_BLOCK_SIZE = 8000;\n var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);\n\n if (!bytes.length) {\n this.eof = true;\n return;\n }\n\n var maxDecodeLength = bytes.length + 1 >> 1;\n var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);\n var bufferLength = this.bufferLength;\n var firstDigit = this.firstDigit;\n\n for (var i = 0, ii = bytes.length; i < ii; i++) {\n var ch = bytes[i],\n digit;\n\n if (ch >= 0x30 && ch <= 0x39) {\n digit = ch & 0x0f;\n } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {\n digit = (ch & 0x0f) + 9;\n } else if (ch === 0x3e) {\n this.eof = true;\n break;\n } else {\n continue;\n }\n\n if (firstDigit < 0) {\n firstDigit = digit;\n } else {\n buffer[bufferLength++] = firstDigit << 4 | digit;\n firstDigit = -1;\n }\n }\n\n if (firstDigit >= 0 && this.eof) {\n buffer[bufferLength++] = firstDigit << 4;\n firstDigit = -1;\n }\n\n this.firstDigit = firstDigit;\n this.bufferLength = bufferLength;\n };\n\n return AsciiHexStream;\n}();\n\nexports.AsciiHexStream = AsciiHexStream;\n\nvar RunLengthStream = function RunLengthStreamClosure() {\n function RunLengthStream(str, maybeLength) {\n this.str = str;\n this.dict = str.dict;\n DecodeStream.call(this, maybeLength);\n }\n\n RunLengthStream.prototype = Object.create(DecodeStream.prototype);\n\n RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {\n var repeatHeader = this.str.getBytes(2);\n\n if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {\n this.eof = true;\n return;\n }\n\n var buffer;\n var bufferLength = this.bufferLength;\n var n = repeatHeader[0];\n\n if (n < 128) {\n buffer = this.ensureBuffer(bufferLength + n + 1);\n buffer[bufferLength++] = repeatHeader[1];\n\n if (n > 0) {\n var source = this.str.getBytes(n);\n buffer.set(source, bufferLength);\n bufferLength += n;\n }\n } else {\n n = 257 - n;\n var b = repeatHeader[1];\n buffer = this.ensureBuffer(bufferLength + n + 1);\n\n for (var i = 0; i < n; i++) {\n buffer[bufferLength++] = b;\n }\n }\n\n this.bufferLength = bufferLength;\n };\n\n return RunLengthStream;\n}();\n\nexports.RunLengthStream = RunLengthStream;\n\nvar LZWStream = function LZWStreamClosure() {\n function LZWStream(str, maybeLength, earlyChange) {\n this.str = str;\n this.dict = str.dict;\n this.cachedData = 0;\n this.bitsCached = 0;\n var maxLzwDictionarySize = 4096;\n var lzwState = {\n earlyChange,\n codeLength: 9,\n nextCode: 258,\n dictionaryValues: new Uint8Array(maxLzwDictionarySize),\n dictionaryLengths: new Uint16Array(maxLzwDictionarySize),\n dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),\n currentSequence: new Uint8Array(maxLzwDictionarySize),\n currentSequenceLength: 0\n };\n\n for (var i = 0; i < 256; ++i) {\n lzwState.dictionaryValues[i] = i;\n lzwState.dictionaryLengths[i] = 1;\n }\n\n this.lzwState = lzwState;\n DecodeStream.call(this, maybeLength);\n }\n\n LZWStream.prototype = Object.create(DecodeStream.prototype);\n\n LZWStream.prototype.readBits = function LZWStream_readBits(n) {\n var bitsCached = this.bitsCached;\n var cachedData = this.cachedData;\n\n while (bitsCached < n) {\n var c = this.str.getByte();\n\n if (c === -1) {\n this.eof = true;\n return null;\n }\n\n cachedData = cachedData << 8 | c;\n bitsCached += 8;\n }\n\n this.bitsCached = bitsCached -= n;\n this.cachedData = cachedData;\n this.lastCode = null;\n return cachedData >>> bitsCached & (1 << n) - 1;\n };\n\n LZWStream.prototype.readBlock = function LZWStream_readBlock() {\n var blockSize = 512;\n var estimatedDecodedSize = blockSize * 2,\n decodedSizeDelta = blockSize;\n var i, j, q;\n var lzwState = this.lzwState;\n\n if (!lzwState) {\n return;\n }\n\n var earlyChange = lzwState.earlyChange;\n var nextCode = lzwState.nextCode;\n var dictionaryValues = lzwState.dictionaryValues;\n var dictionaryLengths = lzwState.dictionaryLengths;\n var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;\n var codeLength = lzwState.codeLength;\n var prevCode = lzwState.prevCode;\n var currentSequence = lzwState.currentSequence;\n var currentSequenceLength = lzwState.currentSequenceLength;\n var decodedLength = 0;\n var currentBufferLength = this.bufferLength;\n var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);\n\n for (i = 0; i < blockSize; i++) {\n var code = this.readBits(codeLength);\n var hasPrev = currentSequenceLength > 0;\n\n if (code < 256) {\n currentSequence[0] = code;\n currentSequenceLength = 1;\n } else if (code >= 258) {\n if (code < nextCode) {\n currentSequenceLength = dictionaryLengths[code];\n\n for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {\n currentSequence[j] = dictionaryValues[q];\n q = dictionaryPrevCodes[q];\n }\n } else {\n currentSequence[currentSequenceLength++] = currentSequence[0];\n }\n } else if (code === 256) {\n codeLength = 9;\n nextCode = 258;\n currentSequenceLength = 0;\n continue;\n } else {\n this.eof = true;\n delete this.lzwState;\n break;\n }\n\n if (hasPrev) {\n dictionaryPrevCodes[nextCode] = prevCode;\n dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;\n dictionaryValues[nextCode] = currentSequence[0];\n nextCode++;\n codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;\n }\n\n prevCode = code;\n decodedLength += currentSequenceLength;\n\n if (estimatedDecodedSize < decodedLength) {\n do {\n estimatedDecodedSize += decodedSizeDelta;\n } while (estimatedDecodedSize < decodedLength);\n\n buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);\n }\n\n for (j = 0; j < currentSequenceLength; j++) {\n buffer[currentBufferLength++] = currentSequence[j];\n }\n }\n\n lzwState.nextCode = nextCode;\n lzwState.codeLength = codeLength;\n lzwState.prevCode = prevCode;\n lzwState.currentSequenceLength = currentSequenceLength;\n this.bufferLength = currentBufferLength;\n };\n\n return LZWStream;\n}();\n\nexports.LZWStream = LZWStream;\n\nvar NullStream = function NullStreamClosure() {\n function NullStream() {\n Stream.call(this, new Uint8Array(0));\n }\n\n NullStream.prototype = Stream.prototype;\n return NullStream;\n}();\n\nexports.NullStream = NullStream;\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.CCITTFaxStream = void 0;\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _ccitt = __w_pdfjs_require__(13);\n\nvar _stream = __w_pdfjs_require__(11);\n\nvar CCITTFaxStream = function CCITTFaxStreamClosure() {\n function CCITTFaxStream(str, maybeLength, params) {\n this.str = str;\n this.dict = str.dict;\n\n if (!(0, _primitives.isDict)(params)) {\n params = _primitives.Dict.empty;\n }\n\n const source = {\n next() {\n return str.getByte();\n }\n\n };\n this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {\n K: params.get(\"K\"),\n EndOfLine: params.get(\"EndOfLine\"),\n EncodedByteAlign: params.get(\"EncodedByteAlign\"),\n Columns: params.get(\"Columns\"),\n Rows: params.get(\"Rows\"),\n EndOfBlock: params.get(\"EndOfBlock\"),\n BlackIs1: params.get(\"BlackIs1\")\n });\n\n _stream.DecodeStream.call(this, maybeLength);\n }\n\n CCITTFaxStream.prototype = Object.create(_stream.DecodeStream.prototype);\n\n CCITTFaxStream.prototype.readBlock = function () {\n while (!this.eof) {\n const c = this.ccittFaxDecoder.readNextChar();\n\n if (c === -1) {\n this.eof = true;\n return;\n }\n\n this.ensureBuffer(this.bufferLength + 1);\n this.buffer[this.bufferLength++] = c;\n }\n };\n\n return CCITTFaxStream;\n}();\n\nexports.CCITTFaxStream = CCITTFaxStream;\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.CCITTFaxDecoder = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nconst CCITTFaxDecoder = function CCITTFaxDecoder() {\n const ccittEOL = -2;\n const ccittEOF = -1;\n const twoDimPass = 0;\n const twoDimHoriz = 1;\n const twoDimVert0 = 2;\n const twoDimVertR1 = 3;\n const twoDimVertL1 = 4;\n const twoDimVertR2 = 5;\n const twoDimVertL2 = 6;\n const twoDimVertR3 = 7;\n const twoDimVertL3 = 8;\n const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];\n const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];\n const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];\n const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];\n const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];\n const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];\n\n function CCITTFaxDecoder(source, options = {}) {\n if (!source || typeof source.next !== \"function\") {\n throw new Error('CCITTFaxDecoder - invalid \"source\" parameter.');\n }\n\n this.source = source;\n this.eof = false;\n this.encoding = options[\"K\"] || 0;\n this.eoline = options[\"EndOfLine\"] || false;\n this.byteAlign = options[\"EncodedByteAlign\"] || false;\n this.columns = options[\"Columns\"] || 1728;\n this.rows = options[\"Rows\"] || 0;\n let eoblock = options[\"EndOfBlock\"];\n\n if (eoblock === null || eoblock === undefined) {\n eoblock = true;\n }\n\n this.eoblock = eoblock;\n this.black = options[\"BlackIs1\"] || false;\n this.codingLine = new Uint32Array(this.columns + 1);\n this.refLine = new Uint32Array(this.columns + 2);\n this.codingLine[0] = this.columns;\n this.codingPos = 0;\n this.row = 0;\n this.nextLine2D = this.encoding < 0;\n this.inputBits = 0;\n this.inputBuf = 0;\n this.outputBits = 0;\n this.rowsDone = false;\n let code1;\n\n while ((code1 = this._lookBits(12)) === 0) {\n this._eatBits(1);\n }\n\n if (code1 === 1) {\n this._eatBits(12);\n }\n\n if (this.encoding > 0) {\n this.nextLine2D = !this._lookBits(1);\n\n this._eatBits(1);\n }\n }\n\n CCITTFaxDecoder.prototype = {\n readNextChar() {\n if (this.eof) {\n return -1;\n }\n\n const refLine = this.refLine;\n const codingLine = this.codingLine;\n const columns = this.columns;\n let refPos, blackPixels, bits, i;\n\n if (this.outputBits === 0) {\n if (this.rowsDone) {\n this.eof = true;\n }\n\n if (this.eof) {\n return -1;\n }\n\n this.err = false;\n let code1, code2, code3;\n\n if (this.nextLine2D) {\n for (i = 0; codingLine[i] < columns; ++i) {\n refLine[i] = codingLine[i];\n }\n\n refLine[i++] = columns;\n refLine[i] = columns;\n codingLine[0] = 0;\n this.codingPos = 0;\n refPos = 0;\n blackPixels = 0;\n\n while (codingLine[this.codingPos] < columns) {\n code1 = this._getTwoDimCode();\n\n switch (code1) {\n case twoDimPass:\n this._addPixels(refLine[refPos + 1], blackPixels);\n\n if (refLine[refPos + 1] < columns) {\n refPos += 2;\n }\n\n break;\n\n case twoDimHoriz:\n code1 = code2 = 0;\n\n if (blackPixels) {\n do {\n code1 += code3 = this._getBlackCode();\n } while (code3 >= 64);\n\n do {\n code2 += code3 = this._getWhiteCode();\n } while (code3 >= 64);\n } else {\n do {\n code1 += code3 = this._getWhiteCode();\n } while (code3 >= 64);\n\n do {\n code2 += code3 = this._getBlackCode();\n } while (code3 >= 64);\n }\n\n this._addPixels(codingLine[this.codingPos] + code1, blackPixels);\n\n if (codingLine[this.codingPos] < columns) {\n this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);\n }\n\n while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {\n refPos += 2;\n }\n\n break;\n\n case twoDimVertR3:\n this._addPixels(refLine[refPos] + 3, blackPixels);\n\n blackPixels ^= 1;\n\n if (codingLine[this.codingPos] < columns) {\n ++refPos;\n\n while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {\n refPos += 2;\n }\n }\n\n break;\n\n case twoDimVertR2:\n this._addPixels(refLine[refPos] + 2, blackPixels);\n\n blackPixels ^= 1;\n\n if (codingLine[this.codingPos] < columns) {\n ++refPos;\n\n while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {\n refPos += 2;\n }\n }\n\n break;\n\n case twoDimVertR1:\n this._addPixels(refLine[refPos] + 1, blackPixels);\n\n blackPixels ^= 1;\n\n if (codingLine[this.codingPos] < columns) {\n ++refPos;\n\n while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {\n refPos += 2;\n }\n }\n\n break;\n\n case twoDimVert0:\n this._addPixels(refLine[refPos], blackPixels);\n\n blackPixels ^= 1;\n\n if (codingLine[this.codingPos] < columns) {\n ++refPos;\n\n while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {\n refPos += 2;\n }\n }\n\n break;\n\n case twoDimVertL3:\n this._addPixelsNeg(refLine[refPos] - 3, blackPixels);\n\n blackPixels ^= 1;\n\n if (codingLine[this.codingPos] < columns) {\n if (refPos > 0) {\n --refPos;\n } else {\n ++refPos;\n }\n\n while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {\n refPos += 2;\n }\n }\n\n break;\n\n case twoDimVertL2:\n this._addPixelsNeg(refLine[refPos] - 2, blackPixels);\n\n blackPixels ^= 1;\n\n if (codingLine[this.codingPos] < columns) {\n if (refPos > 0) {\n --refPos;\n } else {\n ++refPos;\n }\n\n while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {\n refPos += 2;\n }\n }\n\n break;\n\n case twoDimVertL1:\n this._addPixelsNeg(refLine[refPos] - 1, blackPixels);\n\n blackPixels ^= 1;\n\n if (codingLine[this.codingPos] < columns) {\n if (refPos > 0) {\n --refPos;\n } else {\n ++refPos;\n }\n\n while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {\n refPos += 2;\n }\n }\n\n break;\n\n case ccittEOF:\n this._addPixels(columns, 0);\n\n this.eof = true;\n break;\n\n default:\n (0, _util.info)(\"bad 2d code\");\n\n this._addPixels(columns, 0);\n\n this.err = true;\n }\n }\n } else {\n codingLine[0] = 0;\n this.codingPos = 0;\n blackPixels = 0;\n\n while (codingLine[this.codingPos] < columns) {\n code1 = 0;\n\n if (blackPixels) {\n do {\n code1 += code3 = this._getBlackCode();\n } while (code3 >= 64);\n } else {\n do {\n code1 += code3 = this._getWhiteCode();\n } while (code3 >= 64);\n }\n\n this._addPixels(codingLine[this.codingPos] + code1, blackPixels);\n\n blackPixels ^= 1;\n }\n }\n\n let gotEOL = false;\n\n if (this.byteAlign) {\n this.inputBits &= ~7;\n }\n\n if (!this.eoblock && this.row === this.rows - 1) {\n this.rowsDone = true;\n } else {\n code1 = this._lookBits(12);\n\n if (this.eoline) {\n while (code1 !== ccittEOF && code1 !== 1) {\n this._eatBits(1);\n\n code1 = this._lookBits(12);\n }\n } else {\n while (code1 === 0) {\n this._eatBits(1);\n\n code1 = this._lookBits(12);\n }\n }\n\n if (code1 === 1) {\n this._eatBits(12);\n\n gotEOL = true;\n } else if (code1 === ccittEOF) {\n this.eof = true;\n }\n }\n\n if (!this.eof && this.encoding > 0 && !this.rowsDone) {\n this.nextLine2D = !this._lookBits(1);\n\n this._eatBits(1);\n }\n\n if (this.eoblock && gotEOL && this.byteAlign) {\n code1 = this._lookBits(12);\n\n if (code1 === 1) {\n this._eatBits(12);\n\n if (this.encoding > 0) {\n this._lookBits(1);\n\n this._eatBits(1);\n }\n\n if (this.encoding >= 0) {\n for (i = 0; i < 4; ++i) {\n code1 = this._lookBits(12);\n\n if (code1 !== 1) {\n (0, _util.info)(\"bad rtc code: \" + code1);\n }\n\n this._eatBits(12);\n\n if (this.encoding > 0) {\n this._lookBits(1);\n\n this._eatBits(1);\n }\n }\n }\n\n this.eof = true;\n }\n } else if (this.err && this.eoline) {\n while (true) {\n code1 = this._lookBits(13);\n\n if (code1 === ccittEOF) {\n this.eof = true;\n return -1;\n }\n\n if (code1 >> 1 === 1) {\n break;\n }\n\n this._eatBits(1);\n }\n\n this._eatBits(12);\n\n if (this.encoding > 0) {\n this._eatBits(1);\n\n this.nextLine2D = !(code1 & 1);\n }\n }\n\n if (codingLine[0] > 0) {\n this.outputBits = codingLine[this.codingPos = 0];\n } else {\n this.outputBits = codingLine[this.codingPos = 1];\n }\n\n this.row++;\n }\n\n let c;\n\n if (this.outputBits >= 8) {\n c = this.codingPos & 1 ? 0 : 0xff;\n this.outputBits -= 8;\n\n if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {\n this.codingPos++;\n this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];\n }\n } else {\n bits = 8;\n c = 0;\n\n do {\n if (this.outputBits > bits) {\n c <<= bits;\n\n if (!(this.codingPos & 1)) {\n c |= 0xff >> 8 - bits;\n }\n\n this.outputBits -= bits;\n bits = 0;\n } else {\n c <<= this.outputBits;\n\n if (!(this.codingPos & 1)) {\n c |= 0xff >> 8 - this.outputBits;\n }\n\n bits -= this.outputBits;\n this.outputBits = 0;\n\n if (codingLine[this.codingPos] < columns) {\n this.codingPos++;\n this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];\n } else if (bits > 0) {\n c <<= bits;\n bits = 0;\n }\n }\n } while (bits);\n }\n\n if (this.black) {\n c ^= 0xff;\n }\n\n return c;\n },\n\n _addPixels(a1, blackPixels) {\n const codingLine = this.codingLine;\n let codingPos = this.codingPos;\n\n if (a1 > codingLine[codingPos]) {\n if (a1 > this.columns) {\n (0, _util.info)(\"row is wrong length\");\n this.err = true;\n a1 = this.columns;\n }\n\n if (codingPos & 1 ^ blackPixels) {\n ++codingPos;\n }\n\n codingLine[codingPos] = a1;\n }\n\n this.codingPos = codingPos;\n },\n\n _addPixelsNeg(a1, blackPixels) {\n const codingLine = this.codingLine;\n let codingPos = this.codingPos;\n\n if (a1 > codingLine[codingPos]) {\n if (a1 > this.columns) {\n (0, _util.info)(\"row is wrong length\");\n this.err = true;\n a1 = this.columns;\n }\n\n if (codingPos & 1 ^ blackPixels) {\n ++codingPos;\n }\n\n codingLine[codingPos] = a1;\n } else if (a1 < codingLine[codingPos]) {\n if (a1 < 0) {\n (0, _util.info)(\"invalid code\");\n this.err = true;\n a1 = 0;\n }\n\n while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {\n --codingPos;\n }\n\n codingLine[codingPos] = a1;\n }\n\n this.codingPos = codingPos;\n },\n\n _findTableCode(start, end, table, limit) {\n const limitValue = limit || 0;\n\n for (let i = start; i <= end; ++i) {\n let code = this._lookBits(i);\n\n if (code === ccittEOF) {\n return [true, 1, false];\n }\n\n if (i < end) {\n code <<= end - i;\n }\n\n if (!limitValue || code >= limitValue) {\n const p = table[code - limitValue];\n\n if (p[0] === i) {\n this._eatBits(i);\n\n return [true, p[1], true];\n }\n }\n }\n\n return [false, 0, false];\n },\n\n _getTwoDimCode() {\n let code = 0;\n let p;\n\n if (this.eoblock) {\n code = this._lookBits(7);\n p = twoDimTable[code];\n\n if (p && p[0] > 0) {\n this._eatBits(p[0]);\n\n return p[1];\n }\n } else {\n const result = this._findTableCode(1, 7, twoDimTable);\n\n if (result[0] && result[2]) {\n return result[1];\n }\n }\n\n (0, _util.info)(\"Bad two dim code\");\n return ccittEOF;\n },\n\n _getWhiteCode() {\n let code = 0;\n let p;\n\n if (this.eoblock) {\n code = this._lookBits(12);\n\n if (code === ccittEOF) {\n return 1;\n }\n\n if (code >> 5 === 0) {\n p = whiteTable1[code];\n } else {\n p = whiteTable2[code >> 3];\n }\n\n if (p[0] > 0) {\n this._eatBits(p[0]);\n\n return p[1];\n }\n } else {\n let result = this._findTableCode(1, 9, whiteTable2);\n\n if (result[0]) {\n return result[1];\n }\n\n result = this._findTableCode(11, 12, whiteTable1);\n\n if (result[0]) {\n return result[1];\n }\n }\n\n (0, _util.info)(\"bad white code\");\n\n this._eatBits(1);\n\n return 1;\n },\n\n _getBlackCode() {\n let code, p;\n\n if (this.eoblock) {\n code = this._lookBits(13);\n\n if (code === ccittEOF) {\n return 1;\n }\n\n if (code >> 7 === 0) {\n p = blackTable1[code];\n } else if (code >> 9 === 0 && code >> 7 !== 0) {\n p = blackTable2[(code >> 1) - 64];\n } else {\n p = blackTable3[code >> 7];\n }\n\n if (p[0] > 0) {\n this._eatBits(p[0]);\n\n return p[1];\n }\n } else {\n let result = this._findTableCode(2, 6, blackTable3);\n\n if (result[0]) {\n return result[1];\n }\n\n result = this._findTableCode(7, 12, blackTable2, 64);\n\n if (result[0]) {\n return result[1];\n }\n\n result = this._findTableCode(10, 13, blackTable1);\n\n if (result[0]) {\n return result[1];\n }\n }\n\n (0, _util.info)(\"bad black code\");\n\n this._eatBits(1);\n\n return 1;\n },\n\n _lookBits(n) {\n let c;\n\n while (this.inputBits < n) {\n if ((c = this.source.next()) === -1) {\n if (this.inputBits === 0) {\n return ccittEOF;\n }\n\n return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;\n }\n\n this.inputBuf = this.inputBuf << 8 | c;\n this.inputBits += 8;\n }\n\n return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;\n },\n\n _eatBits(n) {\n if ((this.inputBits -= n) < 0) {\n this.inputBits = 0;\n }\n }\n\n };\n return CCITTFaxDecoder;\n}();\n\nexports.CCITTFaxDecoder = CCITTFaxDecoder;\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Jbig2Stream = void 0;\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _stream = __w_pdfjs_require__(11);\n\nvar _jbig = __w_pdfjs_require__(15);\n\nvar _util = __w_pdfjs_require__(2);\n\nconst Jbig2Stream = function Jbig2StreamClosure() {\n function Jbig2Stream(stream, maybeLength, dict, params) {\n this.stream = stream;\n this.maybeLength = maybeLength;\n this.dict = dict;\n this.params = params;\n\n _stream.DecodeStream.call(this, maybeLength);\n }\n\n Jbig2Stream.prototype = Object.create(_stream.DecodeStream.prototype);\n Object.defineProperty(Jbig2Stream.prototype, \"bytes\", {\n get() {\n return (0, _util.shadow)(this, \"bytes\", this.stream.getBytes(this.maybeLength));\n },\n\n configurable: true\n });\n\n Jbig2Stream.prototype.ensureBuffer = function (requested) {};\n\n Jbig2Stream.prototype.readBlock = function () {\n if (this.eof) {\n return;\n }\n\n const jbig2Image = new _jbig.Jbig2Image();\n const chunks = [];\n\n if ((0, _primitives.isDict)(this.params)) {\n const globalsStream = this.params.get(\"JBIG2Globals\");\n\n if ((0, _primitives.isStream)(globalsStream)) {\n const globals = globalsStream.getBytes();\n chunks.push({\n data: globals,\n start: 0,\n end: globals.length\n });\n }\n }\n\n chunks.push({\n data: this.bytes,\n start: 0,\n end: this.bytes.length\n });\n const data = jbig2Image.parseChunks(chunks);\n const dataLength = data.length;\n\n for (let i = 0; i < dataLength; i++) {\n data[i] ^= 0xff;\n }\n\n this.buffer = data;\n this.bufferLength = dataLength;\n this.eof = true;\n };\n\n return Jbig2Stream;\n}();\n\nexports.Jbig2Stream = Jbig2Stream;\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Jbig2Image = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nvar _arithmetic_decoder = __w_pdfjs_require__(16);\n\nvar _ccitt = __w_pdfjs_require__(13);\n\nclass Jbig2Error extends _util.BaseException {\n constructor(msg) {\n super(`JBIG2 error: ${msg}`);\n }\n\n}\n\nvar Jbig2Image = function Jbig2ImageClosure() {\n function ContextCache() {}\n\n ContextCache.prototype = {\n getContexts(id) {\n if (id in this) {\n return this[id];\n }\n\n return this[id] = new Int8Array(1 << 16);\n }\n\n };\n\n function DecodingContext(data, start, end) {\n this.data = data;\n this.start = start;\n this.end = end;\n }\n\n DecodingContext.prototype = {\n get decoder() {\n var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);\n return (0, _util.shadow)(this, \"decoder\", decoder);\n },\n\n get contextCache() {\n var cache = new ContextCache();\n return (0, _util.shadow)(this, \"contextCache\", cache);\n }\n\n };\n\n function decodeInteger(contextCache, procedure, decoder) {\n var contexts = contextCache.getContexts(procedure);\n var prev = 1;\n\n function readBits(length) {\n var v = 0;\n\n for (var i = 0; i < length; i++) {\n var bit = decoder.readBit(contexts, prev);\n prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;\n v = v << 1 | bit;\n }\n\n return v >>> 0;\n }\n\n var sign = readBits(1);\n var value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2);\n\n if (sign === 0) {\n return value;\n } else if (value > 0) {\n return -value;\n }\n\n return null;\n }\n\n function decodeIAID(contextCache, decoder, codeLength) {\n var contexts = contextCache.getContexts(\"IAID\");\n var prev = 1;\n\n for (var i = 0; i < codeLength; i++) {\n var bit = decoder.readBit(contexts, prev);\n prev = prev << 1 | bit;\n }\n\n if (codeLength < 31) {\n return prev & (1 << codeLength) - 1;\n }\n\n return prev & 0x7fffffff;\n }\n\n var SegmentTypes = [\"SymbolDictionary\", null, null, null, \"IntermediateTextRegion\", null, \"ImmediateTextRegion\", \"ImmediateLosslessTextRegion\", null, null, null, null, null, null, null, null, \"PatternDictionary\", null, null, null, \"IntermediateHalftoneRegion\", null, \"ImmediateHalftoneRegion\", \"ImmediateLosslessHalftoneRegion\", null, null, null, null, null, null, null, null, null, null, null, null, \"IntermediateGenericRegion\", null, \"ImmediateGenericRegion\", \"ImmediateLosslessGenericRegion\", \"IntermediateGenericRefinementRegion\", null, \"ImmediateGenericRefinementRegion\", \"ImmediateLosslessGenericRefinementRegion\", null, null, null, null, \"PageInformation\", \"EndOfPage\", \"EndOfStripe\", \"EndOfFile\", \"Profiles\", \"Tables\", null, null, null, null, null, null, null, null, \"Extension\"];\n var CodingTemplates = [[{\n x: -1,\n y: -2\n }, {\n x: 0,\n y: -2\n }, {\n x: 1,\n y: -2\n }, {\n x: -2,\n y: -1\n }, {\n x: -1,\n y: -1\n }, {\n x: 0,\n y: -1\n }, {\n x: 1,\n y: -1\n }, {\n x: 2,\n y: -1\n }, {\n x: -4,\n y: 0\n }, {\n x: -3,\n y: 0\n }, {\n x: -2,\n y: 0\n }, {\n x: -1,\n y: 0\n }], [{\n x: -1,\n y: -2\n }, {\n x: 0,\n y: -2\n }, {\n x: 1,\n y: -2\n }, {\n x: 2,\n y: -2\n }, {\n x: -2,\n y: -1\n }, {\n x: -1,\n y: -1\n }, {\n x: 0,\n y: -1\n }, {\n x: 1,\n y: -1\n }, {\n x: 2,\n y: -1\n }, {\n x: -3,\n y: 0\n }, {\n x: -2,\n y: 0\n }, {\n x: -1,\n y: 0\n }], [{\n x: -1,\n y: -2\n }, {\n x: 0,\n y: -2\n }, {\n x: 1,\n y: -2\n }, {\n x: -2,\n y: -1\n }, {\n x: -1,\n y: -1\n }, {\n x: 0,\n y: -1\n }, {\n x: 1,\n y: -1\n }, {\n x: -2,\n y: 0\n }, {\n x: -1,\n y: 0\n }], [{\n x: -3,\n y: -1\n }, {\n x: -2,\n y: -1\n }, {\n x: -1,\n y: -1\n }, {\n x: 0,\n y: -1\n }, {\n x: 1,\n y: -1\n }, {\n x: -4,\n y: 0\n }, {\n x: -3,\n y: 0\n }, {\n x: -2,\n y: 0\n }, {\n x: -1,\n y: 0\n }]];\n var RefinementTemplates = [{\n coding: [{\n x: 0,\n y: -1\n }, {\n x: 1,\n y: -1\n }, {\n x: -1,\n y: 0\n }],\n reference: [{\n x: 0,\n y: -1\n }, {\n x: 1,\n y: -1\n }, {\n x: -1,\n y: 0\n }, {\n x: 0,\n y: 0\n }, {\n x: 1,\n y: 0\n }, {\n x: -1,\n y: 1\n }, {\n x: 0,\n y: 1\n }, {\n x: 1,\n y: 1\n }]\n }, {\n coding: [{\n x: -1,\n y: -1\n }, {\n x: 0,\n y: -1\n }, {\n x: 1,\n y: -1\n }, {\n x: -1,\n y: 0\n }],\n reference: [{\n x: 0,\n y: -1\n }, {\n x: -1,\n y: 0\n }, {\n x: 0,\n y: 0\n }, {\n x: 1,\n y: 0\n }, {\n x: 0,\n y: 1\n }, {\n x: 1,\n y: 1\n }]\n }];\n var ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];\n var RefinementReusedContexts = [0x0020, 0x0008];\n\n function decodeBitmapTemplate0(width, height, decodingContext) {\n var decoder = decodingContext.decoder;\n var contexts = decodingContext.contextCache.getContexts(\"GB\");\n var contextLabel,\n i,\n j,\n pixel,\n row,\n row1,\n row2,\n bitmap = [];\n var OLD_PIXEL_MASK = 0x7bf7;\n\n for (i = 0; i < height; i++) {\n row = bitmap[i] = new Uint8Array(width);\n row1 = i < 1 ? row : bitmap[i - 1];\n row2 = i < 2 ? row : bitmap[i - 2];\n contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;\n\n for (j = 0; j < width; j++) {\n row[j] = pixel = decoder.readBit(contexts, contextLabel);\n contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;\n }\n }\n\n return bitmap;\n }\n\n function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {\n if (mmr) {\n const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);\n return decodeMMRBitmap(input, width, height, false);\n }\n\n if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) {\n return decodeBitmapTemplate0(width, height, decodingContext);\n }\n\n var useskip = !!skip;\n var template = CodingTemplates[templateIndex].concat(at);\n template.sort(function (a, b) {\n return a.y - b.y || a.x - b.x;\n });\n var templateLength = template.length;\n var templateX = new Int8Array(templateLength);\n var templateY = new Int8Array(templateLength);\n var changingTemplateEntries = [];\n var reuseMask = 0,\n minX = 0,\n maxX = 0,\n minY = 0;\n var c, k;\n\n for (k = 0; k < templateLength; k++) {\n templateX[k] = template[k].x;\n templateY[k] = template[k].y;\n minX = Math.min(minX, template[k].x);\n maxX = Math.max(maxX, template[k].x);\n minY = Math.min(minY, template[k].y);\n\n if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {\n reuseMask |= 1 << templateLength - 1 - k;\n } else {\n changingTemplateEntries.push(k);\n }\n }\n\n var changingEntriesLength = changingTemplateEntries.length;\n var changingTemplateX = new Int8Array(changingEntriesLength);\n var changingTemplateY = new Int8Array(changingEntriesLength);\n var changingTemplateBit = new Uint16Array(changingEntriesLength);\n\n for (c = 0; c < changingEntriesLength; c++) {\n k = changingTemplateEntries[c];\n changingTemplateX[c] = template[k].x;\n changingTemplateY[c] = template[k].y;\n changingTemplateBit[c] = 1 << templateLength - 1 - k;\n }\n\n var sbb_left = -minX;\n var sbb_top = -minY;\n var sbb_right = width - maxX;\n var pseudoPixelContext = ReusedContexts[templateIndex];\n var row = new Uint8Array(width);\n var bitmap = [];\n var decoder = decodingContext.decoder;\n var contexts = decodingContext.contextCache.getContexts(\"GB\");\n var ltp = 0,\n j,\n i0,\n j0,\n contextLabel = 0,\n bit,\n shift;\n\n for (var i = 0; i < height; i++) {\n if (prediction) {\n var sltp = decoder.readBit(contexts, pseudoPixelContext);\n ltp ^= sltp;\n\n if (ltp) {\n bitmap.push(row);\n continue;\n }\n }\n\n row = new Uint8Array(row);\n bitmap.push(row);\n\n for (j = 0; j < width; j++) {\n if (useskip && skip[i][j]) {\n row[j] = 0;\n continue;\n }\n\n if (j >= sbb_left && j < sbb_right && i >= sbb_top) {\n contextLabel = contextLabel << 1 & reuseMask;\n\n for (k = 0; k < changingEntriesLength; k++) {\n i0 = i + changingTemplateY[k];\n j0 = j + changingTemplateX[k];\n bit = bitmap[i0][j0];\n\n if (bit) {\n bit = changingTemplateBit[k];\n contextLabel |= bit;\n }\n }\n } else {\n contextLabel = 0;\n shift = templateLength - 1;\n\n for (k = 0; k < templateLength; k++, shift--) {\n j0 = j + templateX[k];\n\n if (j0 >= 0 && j0 < width) {\n i0 = i + templateY[k];\n\n if (i0 >= 0) {\n bit = bitmap[i0][j0];\n\n if (bit) {\n contextLabel |= bit << shift;\n }\n }\n }\n }\n }\n\n var pixel = decoder.readBit(contexts, contextLabel);\n row[j] = pixel;\n }\n }\n\n return bitmap;\n }\n\n function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {\n var codingTemplate = RefinementTemplates[templateIndex].coding;\n\n if (templateIndex === 0) {\n codingTemplate = codingTemplate.concat([at[0]]);\n }\n\n var codingTemplateLength = codingTemplate.length;\n var codingTemplateX = new Int32Array(codingTemplateLength);\n var codingTemplateY = new Int32Array(codingTemplateLength);\n var k;\n\n for (k = 0; k < codingTemplateLength; k++) {\n codingTemplateX[k] = codingTemplate[k].x;\n codingTemplateY[k] = codingTemplate[k].y;\n }\n\n var referenceTemplate = RefinementTemplates[templateIndex].reference;\n\n if (templateIndex === 0) {\n referenceTemplate = referenceTemplate.concat([at[1]]);\n }\n\n var referenceTemplateLength = referenceTemplate.length;\n var referenceTemplateX = new Int32Array(referenceTemplateLength);\n var referenceTemplateY = new Int32Array(referenceTemplateLength);\n\n for (k = 0; k < referenceTemplateLength; k++) {\n referenceTemplateX[k] = referenceTemplate[k].x;\n referenceTemplateY[k] = referenceTemplate[k].y;\n }\n\n var referenceWidth = referenceBitmap[0].length;\n var referenceHeight = referenceBitmap.length;\n var pseudoPixelContext = RefinementReusedContexts[templateIndex];\n var bitmap = [];\n var decoder = decodingContext.decoder;\n var contexts = decodingContext.contextCache.getContexts(\"GR\");\n var ltp = 0;\n\n for (var i = 0; i < height; i++) {\n if (prediction) {\n var sltp = decoder.readBit(contexts, pseudoPixelContext);\n ltp ^= sltp;\n\n if (ltp) {\n throw new Jbig2Error(\"prediction is not supported\");\n }\n }\n\n var row = new Uint8Array(width);\n bitmap.push(row);\n\n for (var j = 0; j < width; j++) {\n var i0, j0;\n var contextLabel = 0;\n\n for (k = 0; k < codingTemplateLength; k++) {\n i0 = i + codingTemplateY[k];\n j0 = j + codingTemplateX[k];\n\n if (i0 < 0 || j0 < 0 || j0 >= width) {\n contextLabel <<= 1;\n } else {\n contextLabel = contextLabel << 1 | bitmap[i0][j0];\n }\n }\n\n for (k = 0; k < referenceTemplateLength; k++) {\n i0 = i + referenceTemplateY[k] - offsetY;\n j0 = j + referenceTemplateX[k] - offsetX;\n\n if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {\n contextLabel <<= 1;\n } else {\n contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];\n }\n }\n\n var pixel = decoder.readBit(contexts, contextLabel);\n row[j] = pixel;\n }\n }\n\n return bitmap;\n }\n\n function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {\n if (huffman && refinement) {\n throw new Jbig2Error(\"symbol refinement with Huffman is not supported\");\n }\n\n var newSymbols = [];\n var currentHeight = 0;\n var symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);\n var decoder = decodingContext.decoder;\n var contextCache = decodingContext.contextCache;\n let tableB1, symbolWidths;\n\n if (huffman) {\n tableB1 = getStandardTable(1);\n symbolWidths = [];\n symbolCodeLength = Math.max(symbolCodeLength, 1);\n }\n\n while (newSymbols.length < numberOfNewSymbols) {\n var deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, \"IADH\", decoder);\n currentHeight += deltaHeight;\n let currentWidth = 0,\n totalWidth = 0;\n const firstSymbol = huffman ? symbolWidths.length : 0;\n\n while (true) {\n var deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, \"IADW\", decoder);\n\n if (deltaWidth === null) {\n break;\n }\n\n currentWidth += deltaWidth;\n totalWidth += currentWidth;\n var bitmap;\n\n if (refinement) {\n var numberOfInstances = decodeInteger(contextCache, \"IAAI\", decoder);\n\n if (numberOfInstances > 1) {\n bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);\n } else {\n var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);\n var rdx = decodeInteger(contextCache, \"IARDX\", decoder);\n var rdy = decodeInteger(contextCache, \"IARDY\", decoder);\n var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];\n bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);\n }\n\n newSymbols.push(bitmap);\n } else if (huffman) {\n symbolWidths.push(currentWidth);\n } else {\n bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);\n newSymbols.push(bitmap);\n }\n }\n\n if (huffman && !refinement) {\n const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);\n huffmanInput.byteAlign();\n let collectiveBitmap;\n\n if (bitmapSize === 0) {\n collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);\n } else {\n const originalEnd = huffmanInput.end;\n const bitmapEnd = huffmanInput.position + bitmapSize;\n huffmanInput.end = bitmapEnd;\n collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);\n huffmanInput.end = originalEnd;\n huffmanInput.position = bitmapEnd;\n }\n\n const numberOfSymbolsDecoded = symbolWidths.length;\n\n if (firstSymbol === numberOfSymbolsDecoded - 1) {\n newSymbols.push(collectiveBitmap);\n } else {\n let i,\n y,\n xMin = 0,\n xMax,\n bitmapWidth,\n symbolBitmap;\n\n for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {\n bitmapWidth = symbolWidths[i];\n xMax = xMin + bitmapWidth;\n symbolBitmap = [];\n\n for (y = 0; y < currentHeight; y++) {\n symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));\n }\n\n newSymbols.push(symbolBitmap);\n xMin = xMax;\n }\n }\n }\n }\n\n var exportedSymbols = [];\n var flags = [],\n currentFlag = false;\n var totalSymbolsLength = symbols.length + numberOfNewSymbols;\n\n while (flags.length < totalSymbolsLength) {\n var runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, \"IAEX\", decoder);\n\n while (runLength--) {\n flags.push(currentFlag);\n }\n\n currentFlag = !currentFlag;\n }\n\n for (var i = 0, ii = symbols.length; i < ii; i++) {\n if (flags[i]) {\n exportedSymbols.push(symbols[i]);\n }\n }\n\n for (var j = 0; j < numberOfNewSymbols; i++, j++) {\n if (flags[i]) {\n exportedSymbols.push(newSymbols[j]);\n }\n }\n\n return exportedSymbols;\n }\n\n function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {\n if (huffman && refinement) {\n throw new Jbig2Error(\"refinement with Huffman is not supported\");\n }\n\n var bitmap = [];\n var i, row;\n\n for (i = 0; i < height; i++) {\n row = new Uint8Array(width);\n\n if (defaultPixelValue) {\n for (var j = 0; j < width; j++) {\n row[j] = defaultPixelValue;\n }\n }\n\n bitmap.push(row);\n }\n\n var decoder = decodingContext.decoder;\n var contextCache = decodingContext.contextCache;\n var stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, \"IADT\", decoder);\n var firstS = 0;\n i = 0;\n\n while (i < numberOfSymbolInstances) {\n var deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, \"IADT\", decoder);\n stripT += deltaT;\n var deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, \"IAFS\", decoder);\n firstS += deltaFirstS;\n var currentS = firstS;\n\n do {\n let currentT = 0;\n\n if (stripSize > 1) {\n currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, \"IAIT\", decoder);\n }\n\n var t = stripSize * stripT + currentT;\n var symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);\n var applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, \"IARI\", decoder));\n var symbolBitmap = inputSymbols[symbolId];\n var symbolWidth = symbolBitmap[0].length;\n var symbolHeight = symbolBitmap.length;\n\n if (applyRefinement) {\n var rdw = decodeInteger(contextCache, \"IARDW\", decoder);\n var rdh = decodeInteger(contextCache, \"IARDH\", decoder);\n var rdx = decodeInteger(contextCache, \"IARDX\", decoder);\n var rdy = decodeInteger(contextCache, \"IARDY\", decoder);\n symbolWidth += rdw;\n symbolHeight += rdh;\n symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);\n }\n\n var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);\n var offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);\n var s2, t2, symbolRow;\n\n if (transposed) {\n for (s2 = 0; s2 < symbolHeight; s2++) {\n row = bitmap[offsetS + s2];\n\n if (!row) {\n continue;\n }\n\n symbolRow = symbolBitmap[s2];\n var maxWidth = Math.min(width - offsetT, symbolWidth);\n\n switch (combinationOperator) {\n case 0:\n for (t2 = 0; t2 < maxWidth; t2++) {\n row[offsetT + t2] |= symbolRow[t2];\n }\n\n break;\n\n case 2:\n for (t2 = 0; t2 < maxWidth; t2++) {\n row[offsetT + t2] ^= symbolRow[t2];\n }\n\n break;\n\n default:\n throw new Jbig2Error(`operator ${combinationOperator} is not supported`);\n }\n }\n\n currentS += symbolHeight - 1;\n } else {\n for (t2 = 0; t2 < symbolHeight; t2++) {\n row = bitmap[offsetT + t2];\n\n if (!row) {\n continue;\n }\n\n symbolRow = symbolBitmap[t2];\n\n switch (combinationOperator) {\n case 0:\n for (s2 = 0; s2 < symbolWidth; s2++) {\n row[offsetS + s2] |= symbolRow[s2];\n }\n\n break;\n\n case 2:\n for (s2 = 0; s2 < symbolWidth; s2++) {\n row[offsetS + s2] ^= symbolRow[s2];\n }\n\n break;\n\n default:\n throw new Jbig2Error(`operator ${combinationOperator} is not supported`);\n }\n }\n\n currentS += symbolWidth - 1;\n }\n\n i++;\n var deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, \"IADS\", decoder);\n\n if (deltaS === null) {\n break;\n }\n\n currentS += deltaS + dsOffset;\n } while (true);\n }\n\n return bitmap;\n }\n\n function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {\n const at = [];\n\n if (!mmr) {\n at.push({\n x: -patternWidth,\n y: 0\n });\n\n if (template === 0) {\n at.push({\n x: -3,\n y: -1\n });\n at.push({\n x: 2,\n y: -2\n });\n at.push({\n x: -2,\n y: -2\n });\n }\n }\n\n const collectiveWidth = (maxPatternIndex + 1) * patternWidth;\n const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);\n const patterns = [];\n\n for (let i = 0; i <= maxPatternIndex; i++) {\n const patternBitmap = [];\n const xMin = patternWidth * i;\n const xMax = xMin + patternWidth;\n\n for (let y = 0; y < patternHeight; y++) {\n patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));\n }\n\n patterns.push(patternBitmap);\n }\n\n return patterns;\n }\n\n function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {\n const skip = null;\n\n if (enableSkip) {\n throw new Jbig2Error(\"skip is not supported\");\n }\n\n if (combinationOperator !== 0) {\n throw new Jbig2Error(\"operator \" + combinationOperator + \" is not supported in halftone region\");\n }\n\n const regionBitmap = [];\n let i, j, row;\n\n for (i = 0; i < regionHeight; i++) {\n row = new Uint8Array(regionWidth);\n\n if (defaultPixelValue) {\n for (j = 0; j < regionWidth; j++) {\n row[j] = defaultPixelValue;\n }\n }\n\n regionBitmap.push(row);\n }\n\n const numberOfPatterns = patterns.length;\n const pattern0 = patterns[0];\n const patternWidth = pattern0[0].length,\n patternHeight = pattern0.length;\n const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);\n const at = [];\n\n if (!mmr) {\n at.push({\n x: template <= 1 ? 3 : 2,\n y: -1\n });\n\n if (template === 0) {\n at.push({\n x: -3,\n y: -1\n });\n at.push({\n x: 2,\n y: -2\n });\n at.push({\n x: -2,\n y: -2\n });\n }\n }\n\n const grayScaleBitPlanes = [];\n let mmrInput, bitmap;\n\n if (mmr) {\n mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);\n }\n\n for (i = bitsPerValue - 1; i >= 0; i--) {\n if (mmr) {\n bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);\n } else {\n bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);\n }\n\n grayScaleBitPlanes[i] = bitmap;\n }\n\n let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;\n\n for (mg = 0; mg < gridHeight; mg++) {\n for (ng = 0; ng < gridWidth; ng++) {\n bit = 0;\n patternIndex = 0;\n\n for (j = bitsPerValue - 1; j >= 0; j--) {\n bit = grayScaleBitPlanes[j][mg][ng] ^ bit;\n patternIndex |= bit << j;\n }\n\n patternBitmap = patterns[patternIndex];\n x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;\n y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;\n\n if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {\n for (i = 0; i < patternHeight; i++) {\n regionRow = regionBitmap[y + i];\n patternRow = patternBitmap[i];\n\n for (j = 0; j < patternWidth; j++) {\n regionRow[x + j] |= patternRow[j];\n }\n }\n } else {\n let regionX, regionY;\n\n for (i = 0; i < patternHeight; i++) {\n regionY = y + i;\n\n if (regionY < 0 || regionY >= regionHeight) {\n continue;\n }\n\n regionRow = regionBitmap[regionY];\n patternRow = patternBitmap[i];\n\n for (j = 0; j < patternWidth; j++) {\n regionX = x + j;\n\n if (regionX >= 0 && regionX < regionWidth) {\n regionRow[regionX] |= patternRow[j];\n }\n }\n }\n }\n }\n }\n\n return regionBitmap;\n }\n\n function readSegmentHeader(data, start) {\n var segmentHeader = {};\n segmentHeader.number = (0, _core_utils.readUint32)(data, start);\n var flags = data[start + 4];\n var segmentType = flags & 0x3f;\n\n if (!SegmentTypes[segmentType]) {\n throw new Jbig2Error(\"invalid segment type: \" + segmentType);\n }\n\n segmentHeader.type = segmentType;\n segmentHeader.typeName = SegmentTypes[segmentType];\n segmentHeader.deferredNonRetain = !!(flags & 0x80);\n var pageAssociationFieldSize = !!(flags & 0x40);\n var referredFlags = data[start + 5];\n var referredToCount = referredFlags >> 5 & 7;\n var retainBits = [referredFlags & 31];\n var position = start + 6;\n\n if (referredFlags === 7) {\n referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;\n position += 3;\n var bytes = referredToCount + 7 >> 3;\n retainBits[0] = data[position++];\n\n while (--bytes > 0) {\n retainBits.push(data[position++]);\n }\n } else if (referredFlags === 5 || referredFlags === 6) {\n throw new Jbig2Error(\"invalid referred-to flags\");\n }\n\n segmentHeader.retainBits = retainBits;\n let referredToSegmentNumberSize = 4;\n\n if (segmentHeader.number <= 256) {\n referredToSegmentNumberSize = 1;\n } else if (segmentHeader.number <= 65536) {\n referredToSegmentNumberSize = 2;\n }\n\n var referredTo = [];\n var i, ii;\n\n for (i = 0; i < referredToCount; i++) {\n let number;\n\n if (referredToSegmentNumberSize === 1) {\n number = data[position];\n } else if (referredToSegmentNumberSize === 2) {\n number = (0, _core_utils.readUint16)(data, position);\n } else {\n number = (0, _core_utils.readUint32)(data, position);\n }\n\n referredTo.push(number);\n position += referredToSegmentNumberSize;\n }\n\n segmentHeader.referredTo = referredTo;\n\n if (!pageAssociationFieldSize) {\n segmentHeader.pageAssociation = data[position++];\n } else {\n segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);\n position += 4;\n }\n\n segmentHeader.length = (0, _core_utils.readUint32)(data, position);\n position += 4;\n\n if (segmentHeader.length === 0xffffffff) {\n if (segmentType === 38) {\n var genericRegionInfo = readRegionSegmentInformation(data, position);\n var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];\n var genericRegionMmr = !!(genericRegionSegmentFlags & 1);\n var searchPatternLength = 6;\n var searchPattern = new Uint8Array(searchPatternLength);\n\n if (!genericRegionMmr) {\n searchPattern[0] = 0xff;\n searchPattern[1] = 0xac;\n }\n\n searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;\n searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;\n searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;\n searchPattern[5] = genericRegionInfo.height & 0xff;\n\n for (i = position, ii = data.length; i < ii; i++) {\n var j = 0;\n\n while (j < searchPatternLength && searchPattern[j] === data[i + j]) {\n j++;\n }\n\n if (j === searchPatternLength) {\n segmentHeader.length = i + searchPatternLength;\n break;\n }\n }\n\n if (segmentHeader.length === 0xffffffff) {\n throw new Jbig2Error(\"segment end was not found\");\n }\n } else {\n throw new Jbig2Error(\"invalid unknown segment length\");\n }\n }\n\n segmentHeader.headerEnd = position;\n return segmentHeader;\n }\n\n function readSegments(header, data, start, end) {\n var segments = [];\n var position = start;\n\n while (position < end) {\n var segmentHeader = readSegmentHeader(data, position);\n position = segmentHeader.headerEnd;\n var segment = {\n header: segmentHeader,\n data\n };\n\n if (!header.randomAccess) {\n segment.start = position;\n position += segmentHeader.length;\n segment.end = position;\n }\n\n segments.push(segment);\n\n if (segmentHeader.type === 51) {\n break;\n }\n }\n\n if (header.randomAccess) {\n for (var i = 0, ii = segments.length; i < ii; i++) {\n segments[i].start = position;\n position += segments[i].header.length;\n segments[i].end = position;\n }\n }\n\n return segments;\n }\n\n function readRegionSegmentInformation(data, start) {\n return {\n width: (0, _core_utils.readUint32)(data, start),\n height: (0, _core_utils.readUint32)(data, start + 4),\n x: (0, _core_utils.readUint32)(data, start + 8),\n y: (0, _core_utils.readUint32)(data, start + 12),\n combinationOperator: data[start + 16] & 7\n };\n }\n\n var RegionSegmentInformationFieldLength = 17;\n\n function processSegment(segment, visitor) {\n var header = segment.header;\n var data = segment.data,\n position = segment.start,\n end = segment.end;\n var args, at, i, atLength;\n\n switch (header.type) {\n case 0:\n var dictionary = {};\n var dictionaryFlags = (0, _core_utils.readUint16)(data, position);\n dictionary.huffman = !!(dictionaryFlags & 1);\n dictionary.refinement = !!(dictionaryFlags & 2);\n dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;\n dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;\n dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;\n dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;\n dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);\n dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);\n dictionary.template = dictionaryFlags >> 10 & 3;\n dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;\n position += 2;\n\n if (!dictionary.huffman) {\n atLength = dictionary.template === 0 ? 4 : 1;\n at = [];\n\n for (i = 0; i < atLength; i++) {\n at.push({\n x: (0, _core_utils.readInt8)(data, position),\n y: (0, _core_utils.readInt8)(data, position + 1)\n });\n position += 2;\n }\n\n dictionary.at = at;\n }\n\n if (dictionary.refinement && !dictionary.refinementTemplate) {\n at = [];\n\n for (i = 0; i < 2; i++) {\n at.push({\n x: (0, _core_utils.readInt8)(data, position),\n y: (0, _core_utils.readInt8)(data, position + 1)\n });\n position += 2;\n }\n\n dictionary.refinementAt = at;\n }\n\n dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);\n position += 4;\n dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);\n position += 4;\n args = [dictionary, header.number, header.referredTo, data, position, end];\n break;\n\n case 6:\n case 7:\n var textRegion = {};\n textRegion.info = readRegionSegmentInformation(data, position);\n position += RegionSegmentInformationFieldLength;\n var textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);\n position += 2;\n textRegion.huffman = !!(textRegionSegmentFlags & 1);\n textRegion.refinement = !!(textRegionSegmentFlags & 2);\n textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;\n textRegion.stripSize = 1 << textRegion.logStripSize;\n textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;\n textRegion.transposed = !!(textRegionSegmentFlags & 64);\n textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;\n textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;\n textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;\n textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;\n\n if (textRegion.huffman) {\n var textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);\n position += 2;\n textRegion.huffmanFS = textRegionHuffmanFlags & 3;\n textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;\n textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;\n textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;\n textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;\n textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;\n textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;\n textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);\n }\n\n if (textRegion.refinement && !textRegion.refinementTemplate) {\n at = [];\n\n for (i = 0; i < 2; i++) {\n at.push({\n x: (0, _core_utils.readInt8)(data, position),\n y: (0, _core_utils.readInt8)(data, position + 1)\n });\n position += 2;\n }\n\n textRegion.refinementAt = at;\n }\n\n textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);\n position += 4;\n args = [textRegion, header.referredTo, data, position, end];\n break;\n\n case 16:\n const patternDictionary = {};\n const patternDictionaryFlags = data[position++];\n patternDictionary.mmr = !!(patternDictionaryFlags & 1);\n patternDictionary.template = patternDictionaryFlags >> 1 & 3;\n patternDictionary.patternWidth = data[position++];\n patternDictionary.patternHeight = data[position++];\n patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);\n position += 4;\n args = [patternDictionary, header.number, data, position, end];\n break;\n\n case 22:\n case 23:\n const halftoneRegion = {};\n halftoneRegion.info = readRegionSegmentInformation(data, position);\n position += RegionSegmentInformationFieldLength;\n const halftoneRegionFlags = data[position++];\n halftoneRegion.mmr = !!(halftoneRegionFlags & 1);\n halftoneRegion.template = halftoneRegionFlags >> 1 & 3;\n halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);\n halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;\n halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;\n halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);\n position += 4;\n halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);\n position += 4;\n halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;\n position += 4;\n halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;\n position += 4;\n halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);\n position += 2;\n halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);\n position += 2;\n args = [halftoneRegion, header.referredTo, data, position, end];\n break;\n\n case 38:\n case 39:\n var genericRegion = {};\n genericRegion.info = readRegionSegmentInformation(data, position);\n position += RegionSegmentInformationFieldLength;\n var genericRegionSegmentFlags = data[position++];\n genericRegion.mmr = !!(genericRegionSegmentFlags & 1);\n genericRegion.template = genericRegionSegmentFlags >> 1 & 3;\n genericRegion.prediction = !!(genericRegionSegmentFlags & 8);\n\n if (!genericRegion.mmr) {\n atLength = genericRegion.template === 0 ? 4 : 1;\n at = [];\n\n for (i = 0; i < atLength; i++) {\n at.push({\n x: (0, _core_utils.readInt8)(data, position),\n y: (0, _core_utils.readInt8)(data, position + 1)\n });\n position += 2;\n }\n\n genericRegion.at = at;\n }\n\n args = [genericRegion, data, position, end];\n break;\n\n case 48:\n var pageInfo = {\n width: (0, _core_utils.readUint32)(data, position),\n height: (0, _core_utils.readUint32)(data, position + 4),\n resolutionX: (0, _core_utils.readUint32)(data, position + 8),\n resolutionY: (0, _core_utils.readUint32)(data, position + 12)\n };\n\n if (pageInfo.height === 0xffffffff) {\n delete pageInfo.height;\n }\n\n var pageSegmentFlags = data[position + 16];\n (0, _core_utils.readUint16)(data, position + 17);\n pageInfo.lossless = !!(pageSegmentFlags & 1);\n pageInfo.refinement = !!(pageSegmentFlags & 2);\n pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;\n pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;\n pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);\n pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);\n args = [pageInfo];\n break;\n\n case 49:\n break;\n\n case 50:\n break;\n\n case 51:\n break;\n\n case 53:\n args = [header.number, data, position, end];\n break;\n\n case 62:\n break;\n\n default:\n throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + \" is not implemented\");\n }\n\n var callbackName = \"on\" + header.typeName;\n\n if (callbackName in visitor) {\n visitor[callbackName].apply(visitor, args);\n }\n }\n\n function processSegments(segments, visitor) {\n for (var i = 0, ii = segments.length; i < ii; i++) {\n processSegment(segments[i], visitor);\n }\n }\n\n function parseJbig2Chunks(chunks) {\n var visitor = new SimpleSegmentVisitor();\n\n for (var i = 0, ii = chunks.length; i < ii; i++) {\n var chunk = chunks[i];\n var segments = readSegments({}, chunk.data, chunk.start, chunk.end);\n processSegments(segments, visitor);\n }\n\n return visitor.buffer;\n }\n\n function parseJbig2(data) {\n const end = data.length;\n let position = 0;\n\n if (data[position] !== 0x97 || data[position + 1] !== 0x4a || data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || data[position + 4] !== 0x0d || data[position + 5] !== 0x0a || data[position + 6] !== 0x1a || data[position + 7] !== 0x0a) {\n throw new Jbig2Error(\"parseJbig2 - invalid header.\");\n }\n\n const header = Object.create(null);\n position += 8;\n const flags = data[position++];\n header.randomAccess = !(flags & 1);\n\n if (!(flags & 2)) {\n header.numberOfPages = (0, _core_utils.readUint32)(data, position);\n position += 4;\n }\n\n const segments = readSegments(header, data, position, end);\n const visitor = new SimpleSegmentVisitor();\n processSegments(segments, visitor);\n const {\n width,\n height\n } = visitor.currentPageInfo;\n const bitPacked = visitor.buffer;\n const imgData = new Uint8ClampedArray(width * height);\n let q = 0,\n k = 0;\n\n for (let i = 0; i < height; i++) {\n let mask = 0,\n buffer;\n\n for (let j = 0; j < width; j++) {\n if (!mask) {\n mask = 128;\n buffer = bitPacked[k++];\n }\n\n imgData[q++] = buffer & mask ? 0 : 255;\n mask >>= 1;\n }\n }\n\n return {\n imgData,\n width,\n height\n };\n }\n\n function SimpleSegmentVisitor() {}\n\n SimpleSegmentVisitor.prototype = {\n onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {\n this.currentPageInfo = info;\n var rowSize = info.width + 7 >> 3;\n var buffer = new Uint8ClampedArray(rowSize * info.height);\n\n if (info.defaultPixelValue) {\n for (var i = 0, ii = buffer.length; i < ii; i++) {\n buffer[i] = 0xff;\n }\n }\n\n this.buffer = buffer;\n },\n drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {\n var pageInfo = this.currentPageInfo;\n var width = regionInfo.width,\n height = regionInfo.height;\n var rowSize = pageInfo.width + 7 >> 3;\n var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;\n var buffer = this.buffer;\n var mask0 = 128 >> (regionInfo.x & 7);\n var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);\n var i, j, mask, offset;\n\n switch (combinationOperator) {\n case 0:\n for (i = 0; i < height; i++) {\n mask = mask0;\n offset = offset0;\n\n for (j = 0; j < width; j++) {\n if (bitmap[i][j]) {\n buffer[offset] |= mask;\n }\n\n mask >>= 1;\n\n if (!mask) {\n mask = 128;\n offset++;\n }\n }\n\n offset0 += rowSize;\n }\n\n break;\n\n case 2:\n for (i = 0; i < height; i++) {\n mask = mask0;\n offset = offset0;\n\n for (j = 0; j < width; j++) {\n if (bitmap[i][j]) {\n buffer[offset] ^= mask;\n }\n\n mask >>= 1;\n\n if (!mask) {\n mask = 128;\n offset++;\n }\n }\n\n offset0 += rowSize;\n }\n\n break;\n\n default:\n throw new Jbig2Error(`operator ${combinationOperator} is not supported`);\n }\n },\n onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {\n var regionInfo = region.info;\n var decodingContext = new DecodingContext(data, start, end);\n var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);\n this.drawBitmap(regionInfo, bitmap);\n },\n onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {\n this.onImmediateGenericRegion.apply(this, arguments);\n },\n onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {\n let huffmanTables, huffmanInput;\n\n if (dictionary.huffman) {\n huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);\n huffmanInput = new Reader(data, start, end);\n }\n\n var symbols = this.symbols;\n\n if (!symbols) {\n this.symbols = symbols = {};\n }\n\n var inputSymbols = [];\n\n for (var i = 0, ii = referredSegments.length; i < ii; i++) {\n const referredSymbols = symbols[referredSegments[i]];\n\n if (referredSymbols) {\n inputSymbols = inputSymbols.concat(referredSymbols);\n }\n }\n\n var decodingContext = new DecodingContext(data, start, end);\n symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);\n },\n onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {\n var regionInfo = region.info;\n let huffmanTables, huffmanInput;\n var symbols = this.symbols;\n var inputSymbols = [];\n\n for (var i = 0, ii = referredSegments.length; i < ii; i++) {\n const referredSymbols = symbols[referredSegments[i]];\n\n if (referredSymbols) {\n inputSymbols = inputSymbols.concat(referredSymbols);\n }\n }\n\n var symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);\n\n if (region.huffman) {\n huffmanInput = new Reader(data, start, end);\n huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);\n }\n\n var decodingContext = new DecodingContext(data, start, end);\n var bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput);\n this.drawBitmap(regionInfo, bitmap);\n },\n onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {\n this.onImmediateTextRegion.apply(this, arguments);\n },\n\n onPatternDictionary(dictionary, currentSegment, data, start, end) {\n let patterns = this.patterns;\n\n if (!patterns) {\n this.patterns = patterns = {};\n }\n\n const decodingContext = new DecodingContext(data, start, end);\n patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);\n },\n\n onImmediateHalftoneRegion(region, referredSegments, data, start, end) {\n const patterns = this.patterns[referredSegments[0]];\n const regionInfo = region.info;\n const decodingContext = new DecodingContext(data, start, end);\n const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);\n this.drawBitmap(regionInfo, bitmap);\n },\n\n onImmediateLosslessHalftoneRegion() {\n this.onImmediateHalftoneRegion.apply(this, arguments);\n },\n\n onTables(currentSegment, data, start, end) {\n let customTables = this.customTables;\n\n if (!customTables) {\n this.customTables = customTables = {};\n }\n\n customTables[currentSegment] = decodeTablesSegment(data, start, end);\n }\n\n };\n\n function HuffmanLine(lineData) {\n if (lineData.length === 2) {\n this.isOOB = true;\n this.rangeLow = 0;\n this.prefixLength = lineData[0];\n this.rangeLength = 0;\n this.prefixCode = lineData[1];\n this.isLowerRange = false;\n } else {\n this.isOOB = false;\n this.rangeLow = lineData[0];\n this.prefixLength = lineData[1];\n this.rangeLength = lineData[2];\n this.prefixCode = lineData[3];\n this.isLowerRange = lineData[4] === \"lower\";\n }\n }\n\n function HuffmanTreeNode(line) {\n this.children = [];\n\n if (line) {\n this.isLeaf = true;\n this.rangeLength = line.rangeLength;\n this.rangeLow = line.rangeLow;\n this.isLowerRange = line.isLowerRange;\n this.isOOB = line.isOOB;\n } else {\n this.isLeaf = false;\n }\n }\n\n HuffmanTreeNode.prototype = {\n buildTree(line, shift) {\n const bit = line.prefixCode >> shift & 1;\n\n if (shift <= 0) {\n this.children[bit] = new HuffmanTreeNode(line);\n } else {\n let node = this.children[bit];\n\n if (!node) {\n this.children[bit] = node = new HuffmanTreeNode(null);\n }\n\n node.buildTree(line, shift - 1);\n }\n },\n\n decodeNode(reader) {\n if (this.isLeaf) {\n if (this.isOOB) {\n return null;\n }\n\n const htOffset = reader.readBits(this.rangeLength);\n return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);\n }\n\n const node = this.children[reader.readBit()];\n\n if (!node) {\n throw new Jbig2Error(\"invalid Huffman data\");\n }\n\n return node.decodeNode(reader);\n }\n\n };\n\n function HuffmanTable(lines, prefixCodesDone) {\n if (!prefixCodesDone) {\n this.assignPrefixCodes(lines);\n }\n\n this.rootNode = new HuffmanTreeNode(null);\n\n for (let i = 0, ii = lines.length; i < ii; i++) {\n const line = lines[i];\n\n if (line.prefixLength > 0) {\n this.rootNode.buildTree(line, line.prefixLength - 1);\n }\n }\n }\n\n HuffmanTable.prototype = {\n decode(reader) {\n return this.rootNode.decodeNode(reader);\n },\n\n assignPrefixCodes(lines) {\n const linesLength = lines.length;\n let prefixLengthMax = 0;\n\n for (let i = 0; i < linesLength; i++) {\n prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);\n }\n\n const histogram = new Uint32Array(prefixLengthMax + 1);\n\n for (let i = 0; i < linesLength; i++) {\n histogram[lines[i].prefixLength]++;\n }\n\n let currentLength = 1,\n firstCode = 0,\n currentCode,\n currentTemp,\n line;\n histogram[0] = 0;\n\n while (currentLength <= prefixLengthMax) {\n firstCode = firstCode + histogram[currentLength - 1] << 1;\n currentCode = firstCode;\n currentTemp = 0;\n\n while (currentTemp < linesLength) {\n line = lines[currentTemp];\n\n if (line.prefixLength === currentLength) {\n line.prefixCode = currentCode;\n currentCode++;\n }\n\n currentTemp++;\n }\n\n currentLength++;\n }\n }\n\n };\n\n function decodeTablesSegment(data, start, end) {\n const flags = data[start];\n const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;\n const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;\n const reader = new Reader(data, start + 9, end);\n const prefixSizeBits = (flags >> 1 & 7) + 1;\n const rangeSizeBits = (flags >> 4 & 7) + 1;\n const lines = [];\n let prefixLength,\n rangeLength,\n currentRangeLow = lowestValue;\n\n do {\n prefixLength = reader.readBits(prefixSizeBits);\n rangeLength = reader.readBits(rangeSizeBits);\n lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));\n currentRangeLow += 1 << rangeLength;\n } while (currentRangeLow < highestValue);\n\n prefixLength = reader.readBits(prefixSizeBits);\n lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, \"lower\"]));\n prefixLength = reader.readBits(prefixSizeBits);\n lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));\n\n if (flags & 1) {\n prefixLength = reader.readBits(prefixSizeBits);\n lines.push(new HuffmanLine([prefixLength, 0]));\n }\n\n return new HuffmanTable(lines, false);\n }\n\n const standardTablesCache = {};\n\n function getStandardTable(number) {\n let table = standardTablesCache[number];\n\n if (table) {\n return table;\n }\n\n let lines;\n\n switch (number) {\n case 1:\n lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];\n break;\n\n case 2:\n lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]];\n break;\n\n case 3:\n lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, \"lower\"], [75, 7, 32, 0x7e], [6, 0x3e]];\n break;\n\n case 4:\n lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]];\n break;\n\n case 5:\n lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, \"lower\"], [76, 6, 32, 0x3e]];\n break;\n\n case 6:\n lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, \"lower\"], [2048, 6, 32, 0x3f]];\n break;\n\n case 7:\n lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, \"lower\"], [2048, 5, 32, 0x1f]];\n break;\n\n case 8:\n lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, \"lower\"], [1670, 9, 32, 0x1ff], [2, 0x1]];\n break;\n\n case 9:\n lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, \"lower\"], [3339, 9, 32, 0x1ff], [2, 0x0]];\n break;\n\n case 10:\n lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, \"lower\"], [4166, 8, 32, 0xff], [2, 0x2]];\n break;\n\n case 11:\n lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];\n break;\n\n case 12:\n lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]];\n break;\n\n case 13:\n lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];\n break;\n\n case 14:\n lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];\n break;\n\n case 15:\n lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, \"lower\"], [25, 7, 32, 0x7f]];\n break;\n\n default:\n throw new Jbig2Error(`standard table B.${number} does not exist`);\n }\n\n for (let i = 0, ii = lines.length; i < ii; i++) {\n lines[i] = new HuffmanLine(lines[i]);\n }\n\n table = new HuffmanTable(lines, true);\n standardTablesCache[number] = table;\n return table;\n }\n\n function Reader(data, start, end) {\n this.data = data;\n this.start = start;\n this.end = end;\n this.position = start;\n this.shift = -1;\n this.currentByte = 0;\n }\n\n Reader.prototype = {\n readBit() {\n if (this.shift < 0) {\n if (this.position >= this.end) {\n throw new Jbig2Error(\"end of data while reading bit\");\n }\n\n this.currentByte = this.data[this.position++];\n this.shift = 7;\n }\n\n const bit = this.currentByte >> this.shift & 1;\n this.shift--;\n return bit;\n },\n\n readBits(numBits) {\n let result = 0,\n i;\n\n for (i = numBits - 1; i >= 0; i--) {\n result |= this.readBit() << i;\n }\n\n return result;\n },\n\n byteAlign() {\n this.shift = -1;\n },\n\n next() {\n if (this.position >= this.end) {\n return -1;\n }\n\n return this.data[this.position++];\n }\n\n };\n\n function getCustomHuffmanTable(index, referredTo, customTables) {\n let currentIndex = 0;\n\n for (let i = 0, ii = referredTo.length; i < ii; i++) {\n const table = customTables[referredTo[i]];\n\n if (table) {\n if (index === currentIndex) {\n return table;\n }\n\n currentIndex++;\n }\n }\n\n throw new Jbig2Error(\"can't find custom Huffman table\");\n }\n\n function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {\n const codes = [];\n\n for (let i = 0; i <= 34; i++) {\n const codeLength = reader.readBits(4);\n codes.push(new HuffmanLine([i, codeLength, 0, 0]));\n }\n\n const runCodesTable = new HuffmanTable(codes, false);\n codes.length = 0;\n\n for (let i = 0; i < numberOfSymbols;) {\n const codeLength = runCodesTable.decode(reader);\n\n if (codeLength >= 32) {\n let repeatedLength, numberOfRepeats, j;\n\n switch (codeLength) {\n case 32:\n if (i === 0) {\n throw new Jbig2Error(\"no previous value in symbol ID table\");\n }\n\n numberOfRepeats = reader.readBits(2) + 3;\n repeatedLength = codes[i - 1].prefixLength;\n break;\n\n case 33:\n numberOfRepeats = reader.readBits(3) + 3;\n repeatedLength = 0;\n break;\n\n case 34:\n numberOfRepeats = reader.readBits(7) + 11;\n repeatedLength = 0;\n break;\n\n default:\n throw new Jbig2Error(\"invalid code length in symbol ID table\");\n }\n\n for (j = 0; j < numberOfRepeats; j++) {\n codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));\n i++;\n }\n } else {\n codes.push(new HuffmanLine([i, codeLength, 0, 0]));\n i++;\n }\n }\n\n reader.byteAlign();\n const symbolIDTable = new HuffmanTable(codes, false);\n let customIndex = 0,\n tableFirstS,\n tableDeltaS,\n tableDeltaT;\n\n switch (textRegion.huffmanFS) {\n case 0:\n case 1:\n tableFirstS = getStandardTable(textRegion.huffmanFS + 6);\n break;\n\n case 3:\n tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);\n customIndex++;\n break;\n\n default:\n throw new Jbig2Error(\"invalid Huffman FS selector\");\n }\n\n switch (textRegion.huffmanDS) {\n case 0:\n case 1:\n case 2:\n tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);\n break;\n\n case 3:\n tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);\n customIndex++;\n break;\n\n default:\n throw new Jbig2Error(\"invalid Huffman DS selector\");\n }\n\n switch (textRegion.huffmanDT) {\n case 0:\n case 1:\n case 2:\n tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);\n break;\n\n case 3:\n tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);\n customIndex++;\n break;\n\n default:\n throw new Jbig2Error(\"invalid Huffman DT selector\");\n }\n\n if (textRegion.refinement) {\n throw new Jbig2Error(\"refinement with Huffman is not supported\");\n }\n\n return {\n symbolIDTable,\n tableFirstS,\n tableDeltaS,\n tableDeltaT\n };\n }\n\n function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {\n let customIndex = 0,\n tableDeltaHeight,\n tableDeltaWidth;\n\n switch (dictionary.huffmanDHSelector) {\n case 0:\n case 1:\n tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);\n break;\n\n case 3:\n tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);\n customIndex++;\n break;\n\n default:\n throw new Jbig2Error(\"invalid Huffman DH selector\");\n }\n\n switch (dictionary.huffmanDWSelector) {\n case 0:\n case 1:\n tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);\n break;\n\n case 3:\n tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);\n customIndex++;\n break;\n\n default:\n throw new Jbig2Error(\"invalid Huffman DW selector\");\n }\n\n let tableBitmapSize, tableAggregateInstances;\n\n if (dictionary.bitmapSizeSelector) {\n tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);\n customIndex++;\n } else {\n tableBitmapSize = getStandardTable(1);\n }\n\n if (dictionary.aggregationInstancesSelector) {\n tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);\n } else {\n tableAggregateInstances = getStandardTable(1);\n }\n\n return {\n tableDeltaHeight,\n tableDeltaWidth,\n tableBitmapSize,\n tableAggregateInstances\n };\n }\n\n function readUncompressedBitmap(reader, width, height) {\n const bitmap = [];\n\n for (let y = 0; y < height; y++) {\n const row = new Uint8Array(width);\n bitmap.push(row);\n\n for (let x = 0; x < width; x++) {\n row[x] = reader.readBit();\n }\n\n reader.byteAlign();\n }\n\n return bitmap;\n }\n\n function decodeMMRBitmap(input, width, height, endOfBlock) {\n const params = {\n K: -1,\n Columns: width,\n Rows: height,\n BlackIs1: true,\n EndOfBlock: endOfBlock\n };\n const decoder = new _ccitt.CCITTFaxDecoder(input, params);\n const bitmap = [];\n let currentByte,\n eof = false;\n\n for (let y = 0; y < height; y++) {\n const row = new Uint8Array(width);\n bitmap.push(row);\n let shift = -1;\n\n for (let x = 0; x < width; x++) {\n if (shift < 0) {\n currentByte = decoder.readNextChar();\n\n if (currentByte === -1) {\n currentByte = 0;\n eof = true;\n }\n\n shift = 7;\n }\n\n row[x] = currentByte >> shift & 1;\n shift--;\n }\n }\n\n if (endOfBlock && !eof) {\n const lookForEOFLimit = 5;\n\n for (let i = 0; i < lookForEOFLimit; i++) {\n if (decoder.readNextChar() === -1) {\n break;\n }\n }\n }\n\n return bitmap;\n }\n\n function Jbig2Image() {}\n\n Jbig2Image.prototype = {\n parseChunks(chunks) {\n return parseJbig2Chunks(chunks);\n },\n\n parse(data) {\n const {\n imgData,\n width,\n height\n } = parseJbig2(data);\n this.width = width;\n this.height = height;\n return imgData;\n }\n\n };\n return Jbig2Image;\n}();\n\nexports.Jbig2Image = Jbig2Image;\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ArithmeticDecoder = void 0;\nconst QeTable = [{\n qe: 0x5601,\n nmps: 1,\n nlps: 1,\n switchFlag: 1\n}, {\n qe: 0x3401,\n nmps: 2,\n nlps: 6,\n switchFlag: 0\n}, {\n qe: 0x1801,\n nmps: 3,\n nlps: 9,\n switchFlag: 0\n}, {\n qe: 0x0ac1,\n nmps: 4,\n nlps: 12,\n switchFlag: 0\n}, {\n qe: 0x0521,\n nmps: 5,\n nlps: 29,\n switchFlag: 0\n}, {\n qe: 0x0221,\n nmps: 38,\n nlps: 33,\n switchFlag: 0\n}, {\n qe: 0x5601,\n nmps: 7,\n nlps: 6,\n switchFlag: 1\n}, {\n qe: 0x5401,\n nmps: 8,\n nlps: 14,\n switchFlag: 0\n}, {\n qe: 0x4801,\n nmps: 9,\n nlps: 14,\n switchFlag: 0\n}, {\n qe: 0x3801,\n nmps: 10,\n nlps: 14,\n switchFlag: 0\n}, {\n qe: 0x3001,\n nmps: 11,\n nlps: 17,\n switchFlag: 0\n}, {\n qe: 0x2401,\n nmps: 12,\n nlps: 18,\n switchFlag: 0\n}, {\n qe: 0x1c01,\n nmps: 13,\n nlps: 20,\n switchFlag: 0\n}, {\n qe: 0x1601,\n nmps: 29,\n nlps: 21,\n switchFlag: 0\n}, {\n qe: 0x5601,\n nmps: 15,\n nlps: 14,\n switchFlag: 1\n}, {\n qe: 0x5401,\n nmps: 16,\n nlps: 14,\n switchFlag: 0\n}, {\n qe: 0x5101,\n nmps: 17,\n nlps: 15,\n switchFlag: 0\n}, {\n qe: 0x4801,\n nmps: 18,\n nlps: 16,\n switchFlag: 0\n}, {\n qe: 0x3801,\n nmps: 19,\n nlps: 17,\n switchFlag: 0\n}, {\n qe: 0x3401,\n nmps: 20,\n nlps: 18,\n switchFlag: 0\n}, {\n qe: 0x3001,\n nmps: 21,\n nlps: 19,\n switchFlag: 0\n}, {\n qe: 0x2801,\n nmps: 22,\n nlps: 19,\n switchFlag: 0\n}, {\n qe: 0x2401,\n nmps: 23,\n nlps: 20,\n switchFlag: 0\n}, {\n qe: 0x2201,\n nmps: 24,\n nlps: 21,\n switchFlag: 0\n}, {\n qe: 0x1c01,\n nmps: 25,\n nlps: 22,\n switchFlag: 0\n}, {\n qe: 0x1801,\n nmps: 26,\n nlps: 23,\n switchFlag: 0\n}, {\n qe: 0x1601,\n nmps: 27,\n nlps: 24,\n switchFlag: 0\n}, {\n qe: 0x1401,\n nmps: 28,\n nlps: 25,\n switchFlag: 0\n}, {\n qe: 0x1201,\n nmps: 29,\n nlps: 26,\n switchFlag: 0\n}, {\n qe: 0x1101,\n nmps: 30,\n nlps: 27,\n switchFlag: 0\n}, {\n qe: 0x0ac1,\n nmps: 31,\n nlps: 28,\n switchFlag: 0\n}, {\n qe: 0x09c1,\n nmps: 32,\n nlps: 29,\n switchFlag: 0\n}, {\n qe: 0x08a1,\n nmps: 33,\n nlps: 30,\n switchFlag: 0\n}, {\n qe: 0x0521,\n nmps: 34,\n nlps: 31,\n switchFlag: 0\n}, {\n qe: 0x0441,\n nmps: 35,\n nlps: 32,\n switchFlag: 0\n}, {\n qe: 0x02a1,\n nmps: 36,\n nlps: 33,\n switchFlag: 0\n}, {\n qe: 0x0221,\n nmps: 37,\n nlps: 34,\n switchFlag: 0\n}, {\n qe: 0x0141,\n nmps: 38,\n nlps: 35,\n switchFlag: 0\n}, {\n qe: 0x0111,\n nmps: 39,\n nlps: 36,\n switchFlag: 0\n}, {\n qe: 0x0085,\n nmps: 40,\n nlps: 37,\n switchFlag: 0\n}, {\n qe: 0x0049,\n nmps: 41,\n nlps: 38,\n switchFlag: 0\n}, {\n qe: 0x0025,\n nmps: 42,\n nlps: 39,\n switchFlag: 0\n}, {\n qe: 0x0015,\n nmps: 43,\n nlps: 40,\n switchFlag: 0\n}, {\n qe: 0x0009,\n nmps: 44,\n nlps: 41,\n switchFlag: 0\n}, {\n qe: 0x0005,\n nmps: 45,\n nlps: 42,\n switchFlag: 0\n}, {\n qe: 0x0001,\n nmps: 45,\n nlps: 43,\n switchFlag: 0\n}, {\n qe: 0x5601,\n nmps: 46,\n nlps: 46,\n switchFlag: 0\n}];\n\nclass ArithmeticDecoder {\n constructor(data, start, end) {\n this.data = data;\n this.bp = start;\n this.dataEnd = end;\n this.chigh = data[start];\n this.clow = 0;\n this.byteIn();\n this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;\n this.clow = this.clow << 7 & 0xffff;\n this.ct -= 7;\n this.a = 0x8000;\n }\n\n byteIn() {\n const data = this.data;\n let bp = this.bp;\n\n if (data[bp] === 0xff) {\n if (data[bp + 1] > 0x8f) {\n this.clow += 0xff00;\n this.ct = 8;\n } else {\n bp++;\n this.clow += data[bp] << 9;\n this.ct = 7;\n this.bp = bp;\n }\n } else {\n bp++;\n this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;\n this.ct = 8;\n this.bp = bp;\n }\n\n if (this.clow > 0xffff) {\n this.chigh += this.clow >> 16;\n this.clow &= 0xffff;\n }\n }\n\n readBit(contexts, pos) {\n let cx_index = contexts[pos] >> 1,\n cx_mps = contexts[pos] & 1;\n const qeTableIcx = QeTable[cx_index];\n const qeIcx = qeTableIcx.qe;\n let d;\n let a = this.a - qeIcx;\n\n if (this.chigh < qeIcx) {\n if (a < qeIcx) {\n a = qeIcx;\n d = cx_mps;\n cx_index = qeTableIcx.nmps;\n } else {\n a = qeIcx;\n d = 1 ^ cx_mps;\n\n if (qeTableIcx.switchFlag === 1) {\n cx_mps = d;\n }\n\n cx_index = qeTableIcx.nlps;\n }\n } else {\n this.chigh -= qeIcx;\n\n if ((a & 0x8000) !== 0) {\n this.a = a;\n return cx_mps;\n }\n\n if (a < qeIcx) {\n d = 1 ^ cx_mps;\n\n if (qeTableIcx.switchFlag === 1) {\n cx_mps = d;\n }\n\n cx_index = qeTableIcx.nlps;\n } else {\n d = cx_mps;\n cx_index = qeTableIcx.nmps;\n }\n }\n\n do {\n if (this.ct === 0) {\n this.byteIn();\n }\n\n a <<= 1;\n this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;\n this.clow = this.clow << 1 & 0xffff;\n this.ct--;\n } while ((a & 0x8000) === 0);\n\n this.a = a;\n contexts[pos] = cx_index << 1 | cx_mps;\n return d;\n }\n\n}\n\nexports.ArithmeticDecoder = ArithmeticDecoder;\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.JpegStream = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _stream = __w_pdfjs_require__(11);\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _jpg = __w_pdfjs_require__(18);\n\nconst JpegStream = function JpegStreamClosure() {\n function JpegStream(stream, maybeLength, dict, params) {\n let ch;\n\n while ((ch = stream.getByte()) !== -1) {\n if (ch === 0xff) {\n stream.skip(-1);\n break;\n }\n }\n\n this.stream = stream;\n this.maybeLength = maybeLength;\n this.dict = dict;\n this.params = params;\n\n _stream.DecodeStream.call(this, maybeLength);\n }\n\n JpegStream.prototype = Object.create(_stream.DecodeStream.prototype);\n Object.defineProperty(JpegStream.prototype, \"bytes\", {\n get: function JpegStream_bytes() {\n return (0, _util.shadow)(this, \"bytes\", this.stream.getBytes(this.maybeLength));\n },\n configurable: true\n });\n\n JpegStream.prototype.ensureBuffer = function (requested) {};\n\n JpegStream.prototype.readBlock = function () {\n if (this.eof) {\n return;\n }\n\n const jpegOptions = {\n decodeTransform: undefined,\n colorTransform: undefined\n };\n const decodeArr = this.dict.getArray(\"Decode\", \"D\");\n\n if (this.forceRGB && Array.isArray(decodeArr)) {\n const bitsPerComponent = this.dict.get(\"BitsPerComponent\") || 8;\n const decodeArrLength = decodeArr.length;\n const transform = new Int32Array(decodeArrLength);\n let transformNeeded = false;\n const maxValue = (1 << bitsPerComponent) - 1;\n\n for (let i = 0; i < decodeArrLength; i += 2) {\n transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;\n transform[i + 1] = decodeArr[i] * maxValue | 0;\n\n if (transform[i] !== 256 || transform[i + 1] !== 0) {\n transformNeeded = true;\n }\n }\n\n if (transformNeeded) {\n jpegOptions.decodeTransform = transform;\n }\n }\n\n if ((0, _primitives.isDict)(this.params)) {\n const colorTransform = this.params.get(\"ColorTransform\");\n\n if (Number.isInteger(colorTransform)) {\n jpegOptions.colorTransform = colorTransform;\n }\n }\n\n const jpegImage = new _jpg.JpegImage(jpegOptions);\n jpegImage.parse(this.bytes);\n const data = jpegImage.getData({\n width: this.drawWidth,\n height: this.drawHeight,\n forceRGB: this.forceRGB,\n isSourcePDF: true\n });\n this.buffer = data;\n this.bufferLength = data.length;\n this.eof = true;\n };\n\n Object.defineProperty(JpegStream.prototype, \"maybeValidDimensions\", {\n get: function JpegStream_maybeValidDimensions() {\n const {\n dict,\n stream\n } = this;\n const dictHeight = dict.get(\"Height\", \"H\");\n const startPos = stream.pos;\n let validDimensions = true,\n foundSOF = false,\n b;\n\n while ((b = stream.getByte()) !== -1) {\n if (b !== 0xff) {\n continue;\n }\n\n switch (stream.getByte()) {\n case 0xc0:\n case 0xc1:\n case 0xc2:\n foundSOF = true;\n stream.pos += 2;\n stream.pos += 1;\n const scanLines = stream.getUint16();\n\n if (scanLines === dictHeight) {\n break;\n }\n\n if (scanLines === 0) {\n validDimensions = false;\n break;\n }\n\n if (scanLines > dictHeight * 10) {\n validDimensions = false;\n break;\n }\n\n break;\n\n case 0xc3:\n case 0xc5:\n case 0xc6:\n case 0xc7:\n case 0xc9:\n case 0xca:\n case 0xcb:\n case 0xcd:\n case 0xce:\n case 0xcf:\n foundSOF = true;\n break;\n\n case 0xc4:\n case 0xcc:\n case 0xda:\n case 0xdb:\n case 0xdc:\n case 0xdd:\n case 0xde:\n case 0xdf:\n case 0xe0:\n case 0xe1:\n case 0xe2:\n case 0xe3:\n case 0xe4:\n case 0xe5:\n case 0xe6:\n case 0xe7:\n case 0xe8:\n case 0xe9:\n case 0xea:\n case 0xeb:\n case 0xec:\n case 0xed:\n case 0xee:\n case 0xef:\n case 0xfe:\n const markerLength = stream.getUint16();\n\n if (markerLength > 2) {\n stream.skip(markerLength - 2);\n } else {\n stream.skip(-2);\n }\n\n break;\n\n case 0xff:\n stream.skip(-1);\n break;\n\n case 0xd9:\n foundSOF = true;\n break;\n }\n\n if (foundSOF) {\n break;\n }\n }\n\n stream.pos = startPos;\n return (0, _util.shadow)(this, \"maybeValidDimensions\", validDimensions);\n },\n configurable: true\n });\n\n JpegStream.prototype.getIR = function (forceDataSchema = false) {\n return (0, _util.createObjectURL)(this.bytes, \"image/jpeg\", forceDataSchema);\n };\n\n return JpegStream;\n}();\n\nexports.JpegStream = JpegStream;\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.JpegImage = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nclass JpegError extends _util.BaseException {\n constructor(msg) {\n super(`JPEG error: ${msg}`);\n }\n\n}\n\nclass DNLMarkerError extends _util.BaseException {\n constructor(message, scanLines) {\n super(message);\n this.scanLines = scanLines;\n }\n\n}\n\nclass EOIMarkerError extends _util.BaseException {}\n\nvar JpegImage = function JpegImageClosure() {\n var dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);\n var dctCos1 = 4017;\n var dctSin1 = 799;\n var dctCos3 = 3406;\n var dctSin3 = 2276;\n var dctCos6 = 1567;\n var dctSin6 = 3784;\n var dctSqrt2 = 5793;\n var dctSqrt1d2 = 2896;\n\n function JpegImage({\n decodeTransform = null,\n colorTransform = -1\n } = {}) {\n this._decodeTransform = decodeTransform;\n this._colorTransform = colorTransform;\n }\n\n function buildHuffmanTable(codeLengths, values) {\n var k = 0,\n code = [],\n i,\n j,\n length = 16;\n\n while (length > 0 && !codeLengths[length - 1]) {\n length--;\n }\n\n code.push({\n children: [],\n index: 0\n });\n var p = code[0],\n q;\n\n for (i = 0; i < length; i++) {\n for (j = 0; j < codeLengths[i]; j++) {\n p = code.pop();\n p.children[p.index] = values[k];\n\n while (p.index > 0) {\n p = code.pop();\n }\n\n p.index++;\n code.push(p);\n\n while (code.length <= i) {\n code.push(q = {\n children: [],\n index: 0\n });\n p.children[p.index] = q.children;\n p = q;\n }\n\n k++;\n }\n\n if (i + 1 < length) {\n code.push(q = {\n children: [],\n index: 0\n });\n p.children[p.index] = q.children;\n p = q;\n }\n }\n\n return code[0].children;\n }\n\n function getBlockBufferOffset(component, row, col) {\n return 64 * ((component.blocksPerLine + 1) * row + col);\n }\n\n function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {\n var mcusPerLine = frame.mcusPerLine;\n var progressive = frame.progressive;\n var startOffset = offset,\n bitsData = 0,\n bitsCount = 0;\n\n function readBit() {\n if (bitsCount > 0) {\n bitsCount--;\n return bitsData >> bitsCount & 1;\n }\n\n bitsData = data[offset++];\n\n if (bitsData === 0xff) {\n var nextByte = data[offset++];\n\n if (nextByte) {\n if (nextByte === 0xdc && parseDNLMarker) {\n offset += 2;\n const scanLines = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n\n if (scanLines > 0 && scanLines !== frame.scanLines) {\n throw new DNLMarkerError(\"Found DNL marker (0xFFDC) while parsing scan data\", scanLines);\n }\n } else if (nextByte === 0xd9) {\n if (parseDNLMarker) {\n const maybeScanLines = blockRow * 8;\n\n if (maybeScanLines > 0 && maybeScanLines < frame.scanLines / 10) {\n throw new DNLMarkerError(\"Found EOI marker (0xFFD9) while parsing scan data, \" + \"possibly caused by incorrect `scanLines` parameter\", maybeScanLines);\n }\n }\n\n throw new EOIMarkerError(\"Found EOI marker (0xFFD9) while parsing scan data\");\n }\n\n throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);\n }\n }\n\n bitsCount = 7;\n return bitsData >>> 7;\n }\n\n function decodeHuffman(tree) {\n var node = tree;\n\n while (true) {\n node = node[readBit()];\n\n switch (typeof node) {\n case \"number\":\n return node;\n\n case \"object\":\n continue;\n }\n\n throw new JpegError(\"invalid huffman sequence\");\n }\n }\n\n function receive(length) {\n var n = 0;\n\n while (length > 0) {\n n = n << 1 | readBit();\n length--;\n }\n\n return n;\n }\n\n function receiveAndExtend(length) {\n if (length === 1) {\n return readBit() === 1 ? 1 : -1;\n }\n\n var n = receive(length);\n\n if (n >= 1 << length - 1) {\n return n;\n }\n\n return n + (-1 << length) + 1;\n }\n\n function decodeBaseline(component, offset) {\n var t = decodeHuffman(component.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t);\n component.blockData[offset] = component.pred += diff;\n var k = 1;\n\n while (k < 64) {\n var rs = decodeHuffman(component.huffmanTableAC);\n var s = rs & 15,\n r = rs >> 4;\n\n if (s === 0) {\n if (r < 15) {\n break;\n }\n\n k += 16;\n continue;\n }\n\n k += r;\n var z = dctZigZag[k];\n component.blockData[offset + z] = receiveAndExtend(s);\n k++;\n }\n }\n\n function decodeDCFirst(component, offset) {\n var t = decodeHuffman(component.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;\n component.blockData[offset] = component.pred += diff;\n }\n\n function decodeDCSuccessive(component, offset) {\n component.blockData[offset] |= readBit() << successive;\n }\n\n var eobrun = 0;\n\n function decodeACFirst(component, offset) {\n if (eobrun > 0) {\n eobrun--;\n return;\n }\n\n var k = spectralStart,\n e = spectralEnd;\n\n while (k <= e) {\n var rs = decodeHuffman(component.huffmanTableAC);\n var s = rs & 15,\n r = rs >> 4;\n\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r) - 1;\n break;\n }\n\n k += 16;\n continue;\n }\n\n k += r;\n var z = dctZigZag[k];\n component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);\n k++;\n }\n }\n\n var successiveACState = 0,\n successiveACNextValue;\n\n function decodeACSuccessive(component, offset) {\n var k = spectralStart;\n var e = spectralEnd;\n var r = 0;\n var s;\n var rs;\n\n while (k <= e) {\n const offsetZ = offset + dctZigZag[k];\n const sign = component.blockData[offsetZ] < 0 ? -1 : 1;\n\n switch (successiveACState) {\n case 0:\n rs = decodeHuffman(component.huffmanTableAC);\n s = rs & 15;\n r = rs >> 4;\n\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r);\n successiveACState = 4;\n } else {\n r = 16;\n successiveACState = 1;\n }\n } else {\n if (s !== 1) {\n throw new JpegError(\"invalid ACn encoding\");\n }\n\n successiveACNextValue = receiveAndExtend(s);\n successiveACState = r ? 2 : 3;\n }\n\n continue;\n\n case 1:\n case 2:\n if (component.blockData[offsetZ]) {\n component.blockData[offsetZ] += sign * (readBit() << successive);\n } else {\n r--;\n\n if (r === 0) {\n successiveACState = successiveACState === 2 ? 3 : 0;\n }\n }\n\n break;\n\n case 3:\n if (component.blockData[offsetZ]) {\n component.blockData[offsetZ] += sign * (readBit() << successive);\n } else {\n component.blockData[offsetZ] = successiveACNextValue << successive;\n successiveACState = 0;\n }\n\n break;\n\n case 4:\n if (component.blockData[offsetZ]) {\n component.blockData[offsetZ] += sign * (readBit() << successive);\n }\n\n break;\n }\n\n k++;\n }\n\n if (successiveACState === 4) {\n eobrun--;\n\n if (eobrun === 0) {\n successiveACState = 0;\n }\n }\n }\n\n let blockRow = 0;\n\n function decodeMcu(component, decode, mcu, row, col) {\n var mcuRow = mcu / mcusPerLine | 0;\n var mcuCol = mcu % mcusPerLine;\n blockRow = mcuRow * component.v + row;\n var blockCol = mcuCol * component.h + col;\n var offset = getBlockBufferOffset(component, blockRow, blockCol);\n decode(component, offset);\n }\n\n function decodeBlock(component, decode, mcu) {\n blockRow = mcu / component.blocksPerLine | 0;\n var blockCol = mcu % component.blocksPerLine;\n var offset = getBlockBufferOffset(component, blockRow, blockCol);\n decode(component, offset);\n }\n\n var componentsLength = components.length;\n var component, i, j, k, n;\n var decodeFn;\n\n if (progressive) {\n if (spectralStart === 0) {\n decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;\n } else {\n decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;\n }\n } else {\n decodeFn = decodeBaseline;\n }\n\n var mcu = 0,\n fileMarker;\n var mcuExpected;\n\n if (componentsLength === 1) {\n mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;\n } else {\n mcuExpected = mcusPerLine * frame.mcusPerColumn;\n }\n\n var h, v;\n\n while (mcu < mcuExpected) {\n var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;\n\n for (i = 0; i < componentsLength; i++) {\n components[i].pred = 0;\n }\n\n eobrun = 0;\n\n if (componentsLength === 1) {\n component = components[0];\n\n for (n = 0; n < mcuToRead; n++) {\n decodeBlock(component, decodeFn, mcu);\n mcu++;\n }\n } else {\n for (n = 0; n < mcuToRead; n++) {\n for (i = 0; i < componentsLength; i++) {\n component = components[i];\n h = component.h;\n v = component.v;\n\n for (j = 0; j < v; j++) {\n for (k = 0; k < h; k++) {\n decodeMcu(component, decodeFn, mcu, j, k);\n }\n }\n }\n\n mcu++;\n }\n }\n\n bitsCount = 0;\n fileMarker = findNextFileMarker(data, offset);\n\n if (!fileMarker) {\n break;\n } else if (fileMarker.invalid) {\n (0, _util.warn)(\"decodeScan - unexpected MCU data, current marker is: \" + fileMarker.invalid);\n offset = fileMarker.offset;\n }\n\n var marker = fileMarker && fileMarker.marker;\n\n if (!marker || marker <= 0xff00) {\n throw new JpegError(\"decodeScan - a valid marker was not found.\");\n }\n\n if (marker >= 0xffd0 && marker <= 0xffd7) {\n offset += 2;\n } else {\n break;\n }\n }\n\n fileMarker = findNextFileMarker(data, offset);\n\n if (fileMarker && fileMarker.invalid) {\n (0, _util.warn)(\"decodeScan - unexpected Scan data, current marker is: \" + fileMarker.invalid);\n offset = fileMarker.offset;\n }\n\n return offset - startOffset;\n }\n\n function quantizeAndInverse(component, blockBufferOffset, p) {\n var qt = component.quantizationTable,\n blockData = component.blockData;\n var v0, v1, v2, v3, v4, v5, v6, v7;\n var p0, p1, p2, p3, p4, p5, p6, p7;\n var t;\n\n if (!qt) {\n throw new JpegError(\"missing required Quantization Table.\");\n }\n\n for (var row = 0; row < 64; row += 8) {\n p0 = blockData[blockBufferOffset + row];\n p1 = blockData[blockBufferOffset + row + 1];\n p2 = blockData[blockBufferOffset + row + 2];\n p3 = blockData[blockBufferOffset + row + 3];\n p4 = blockData[blockBufferOffset + row + 4];\n p5 = blockData[blockBufferOffset + row + 5];\n p6 = blockData[blockBufferOffset + row + 6];\n p7 = blockData[blockBufferOffset + row + 7];\n p0 *= qt[row];\n\n if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {\n t = dctSqrt2 * p0 + 512 >> 10;\n p[row] = t;\n p[row + 1] = t;\n p[row + 2] = t;\n p[row + 3] = t;\n p[row + 4] = t;\n p[row + 5] = t;\n p[row + 6] = t;\n p[row + 7] = t;\n continue;\n }\n\n p1 *= qt[row + 1];\n p2 *= qt[row + 2];\n p3 *= qt[row + 3];\n p4 *= qt[row + 4];\n p5 *= qt[row + 5];\n p6 *= qt[row + 6];\n p7 *= qt[row + 7];\n v0 = dctSqrt2 * p0 + 128 >> 8;\n v1 = dctSqrt2 * p4 + 128 >> 8;\n v2 = p2;\n v3 = p6;\n v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;\n v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;\n v5 = p3 << 4;\n v6 = p5 << 4;\n v0 = v0 + v1 + 1 >> 1;\n v1 = v0 - v1;\n t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;\n v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;\n v3 = t;\n v4 = v4 + v6 + 1 >> 1;\n v6 = v4 - v6;\n v7 = v7 + v5 + 1 >> 1;\n v5 = v7 - v5;\n v0 = v0 + v3 + 1 >> 1;\n v3 = v0 - v3;\n v1 = v1 + v2 + 1 >> 1;\n v2 = v1 - v2;\n t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;\n v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;\n v7 = t;\n t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;\n v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;\n v6 = t;\n p[row] = v0 + v7;\n p[row + 7] = v0 - v7;\n p[row + 1] = v1 + v6;\n p[row + 6] = v1 - v6;\n p[row + 2] = v2 + v5;\n p[row + 5] = v2 - v5;\n p[row + 3] = v3 + v4;\n p[row + 4] = v3 - v4;\n }\n\n for (var col = 0; col < 8; ++col) {\n p0 = p[col];\n p1 = p[col + 8];\n p2 = p[col + 16];\n p3 = p[col + 24];\n p4 = p[col + 32];\n p5 = p[col + 40];\n p6 = p[col + 48];\n p7 = p[col + 56];\n\n if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {\n t = dctSqrt2 * p0 + 8192 >> 14;\n\n if (t < -2040) {\n t = 0;\n } else if (t >= 2024) {\n t = 255;\n } else {\n t = t + 2056 >> 4;\n }\n\n blockData[blockBufferOffset + col] = t;\n blockData[blockBufferOffset + col + 8] = t;\n blockData[blockBufferOffset + col + 16] = t;\n blockData[blockBufferOffset + col + 24] = t;\n blockData[blockBufferOffset + col + 32] = t;\n blockData[blockBufferOffset + col + 40] = t;\n blockData[blockBufferOffset + col + 48] = t;\n blockData[blockBufferOffset + col + 56] = t;\n continue;\n }\n\n v0 = dctSqrt2 * p0 + 2048 >> 12;\n v1 = dctSqrt2 * p4 + 2048 >> 12;\n v2 = p2;\n v3 = p6;\n v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;\n v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;\n v5 = p3;\n v6 = p5;\n v0 = (v0 + v1 + 1 >> 1) + 4112;\n v1 = v0 - v1;\n t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;\n v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;\n v3 = t;\n v4 = v4 + v6 + 1 >> 1;\n v6 = v4 - v6;\n v7 = v7 + v5 + 1 >> 1;\n v5 = v7 - v5;\n v0 = v0 + v3 + 1 >> 1;\n v3 = v0 - v3;\n v1 = v1 + v2 + 1 >> 1;\n v2 = v1 - v2;\n t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;\n v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;\n v7 = t;\n t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;\n v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;\n v6 = t;\n p0 = v0 + v7;\n p7 = v0 - v7;\n p1 = v1 + v6;\n p6 = v1 - v6;\n p2 = v2 + v5;\n p5 = v2 - v5;\n p3 = v3 + v4;\n p4 = v3 - v4;\n\n if (p0 < 16) {\n p0 = 0;\n } else if (p0 >= 4080) {\n p0 = 255;\n } else {\n p0 >>= 4;\n }\n\n if (p1 < 16) {\n p1 = 0;\n } else if (p1 >= 4080) {\n p1 = 255;\n } else {\n p1 >>= 4;\n }\n\n if (p2 < 16) {\n p2 = 0;\n } else if (p2 >= 4080) {\n p2 = 255;\n } else {\n p2 >>= 4;\n }\n\n if (p3 < 16) {\n p3 = 0;\n } else if (p3 >= 4080) {\n p3 = 255;\n } else {\n p3 >>= 4;\n }\n\n if (p4 < 16) {\n p4 = 0;\n } else if (p4 >= 4080) {\n p4 = 255;\n } else {\n p4 >>= 4;\n }\n\n if (p5 < 16) {\n p5 = 0;\n } else if (p5 >= 4080) {\n p5 = 255;\n } else {\n p5 >>= 4;\n }\n\n if (p6 < 16) {\n p6 = 0;\n } else if (p6 >= 4080) {\n p6 = 255;\n } else {\n p6 >>= 4;\n }\n\n if (p7 < 16) {\n p7 = 0;\n } else if (p7 >= 4080) {\n p7 = 255;\n } else {\n p7 >>= 4;\n }\n\n blockData[blockBufferOffset + col] = p0;\n blockData[blockBufferOffset + col + 8] = p1;\n blockData[blockBufferOffset + col + 16] = p2;\n blockData[blockBufferOffset + col + 24] = p3;\n blockData[blockBufferOffset + col + 32] = p4;\n blockData[blockBufferOffset + col + 40] = p5;\n blockData[blockBufferOffset + col + 48] = p6;\n blockData[blockBufferOffset + col + 56] = p7;\n }\n }\n\n function buildComponentData(frame, component) {\n var blocksPerLine = component.blocksPerLine;\n var blocksPerColumn = component.blocksPerColumn;\n var computationBuffer = new Int16Array(64);\n\n for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {\n for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {\n var offset = getBlockBufferOffset(component, blockRow, blockCol);\n quantizeAndInverse(component, offset, computationBuffer);\n }\n }\n\n return component.blockData;\n }\n\n function findNextFileMarker(data, currentPos, startPos = currentPos) {\n const maxPos = data.length - 1;\n var newPos = startPos < currentPos ? startPos : currentPos;\n\n if (currentPos >= maxPos) {\n return null;\n }\n\n var currentMarker = (0, _core_utils.readUint16)(data, currentPos);\n\n if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {\n return {\n invalid: null,\n marker: currentMarker,\n offset: currentPos\n };\n }\n\n var newMarker = (0, _core_utils.readUint16)(data, newPos);\n\n while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {\n if (++newPos >= maxPos) {\n return null;\n }\n\n newMarker = (0, _core_utils.readUint16)(data, newPos);\n }\n\n return {\n invalid: currentMarker.toString(16),\n marker: newMarker,\n offset: newPos\n };\n }\n\n JpegImage.prototype = {\n parse(data, {\n dnlScanLines = null\n } = {}) {\n function readDataBlock() {\n const length = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n let endOffset = offset + length - 2;\n var fileMarker = findNextFileMarker(data, endOffset, offset);\n\n if (fileMarker && fileMarker.invalid) {\n (0, _util.warn)(\"readDataBlock - incorrect length, current marker is: \" + fileMarker.invalid);\n endOffset = fileMarker.offset;\n }\n\n var array = data.subarray(offset, endOffset);\n offset += array.length;\n return array;\n }\n\n function prepareComponents(frame) {\n var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);\n var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);\n\n for (var i = 0; i < frame.components.length; i++) {\n component = frame.components[i];\n var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);\n var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);\n var blocksPerLineForMcu = mcusPerLine * component.h;\n var blocksPerColumnForMcu = mcusPerColumn * component.v;\n var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);\n component.blockData = new Int16Array(blocksBufferSize);\n component.blocksPerLine = blocksPerLine;\n component.blocksPerColumn = blocksPerColumn;\n }\n\n frame.mcusPerLine = mcusPerLine;\n frame.mcusPerColumn = mcusPerColumn;\n }\n\n var offset = 0;\n var jfif = null;\n var adobe = null;\n var frame, resetInterval;\n let numSOSMarkers = 0;\n var quantizationTables = [];\n var huffmanTablesAC = [],\n huffmanTablesDC = [];\n let fileMarker = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n\n if (fileMarker !== 0xffd8) {\n throw new JpegError(\"SOI not found\");\n }\n\n fileMarker = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n\n markerLoop: while (fileMarker !== 0xffd9) {\n var i, j, l;\n\n switch (fileMarker) {\n case 0xffe0:\n case 0xffe1:\n case 0xffe2:\n case 0xffe3:\n case 0xffe4:\n case 0xffe5:\n case 0xffe6:\n case 0xffe7:\n case 0xffe8:\n case 0xffe9:\n case 0xffea:\n case 0xffeb:\n case 0xffec:\n case 0xffed:\n case 0xffee:\n case 0xffef:\n case 0xfffe:\n var appData = readDataBlock();\n\n if (fileMarker === 0xffe0) {\n if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {\n jfif = {\n version: {\n major: appData[5],\n minor: appData[6]\n },\n densityUnits: appData[7],\n xDensity: appData[8] << 8 | appData[9],\n yDensity: appData[10] << 8 | appData[11],\n thumbWidth: appData[12],\n thumbHeight: appData[13],\n thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])\n };\n }\n }\n\n if (fileMarker === 0xffee) {\n if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {\n adobe = {\n version: appData[5] << 8 | appData[6],\n flags0: appData[7] << 8 | appData[8],\n flags1: appData[9] << 8 | appData[10],\n transformCode: appData[11]\n };\n }\n }\n\n break;\n\n case 0xffdb:\n const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n var quantizationTablesEnd = quantizationTablesLength + offset - 2;\n var z;\n\n while (offset < quantizationTablesEnd) {\n var quantizationTableSpec = data[offset++];\n var tableData = new Uint16Array(64);\n\n if (quantizationTableSpec >> 4 === 0) {\n for (j = 0; j < 64; j++) {\n z = dctZigZag[j];\n tableData[z] = data[offset++];\n }\n } else if (quantizationTableSpec >> 4 === 1) {\n for (j = 0; j < 64; j++) {\n z = dctZigZag[j];\n tableData[z] = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n }\n } else {\n throw new JpegError(\"DQT - invalid table spec\");\n }\n\n quantizationTables[quantizationTableSpec & 15] = tableData;\n }\n\n break;\n\n case 0xffc0:\n case 0xffc1:\n case 0xffc2:\n if (frame) {\n throw new JpegError(\"Only single frame JPEGs supported\");\n }\n\n offset += 2;\n frame = {};\n frame.extended = fileMarker === 0xffc1;\n frame.progressive = fileMarker === 0xffc2;\n frame.precision = data[offset++];\n const sofScanLines = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n frame.scanLines = dnlScanLines || sofScanLines;\n frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n frame.components = [];\n frame.componentIds = {};\n var componentsCount = data[offset++],\n componentId;\n var maxH = 0,\n maxV = 0;\n\n for (i = 0; i < componentsCount; i++) {\n componentId = data[offset];\n var h = data[offset + 1] >> 4;\n var v = data[offset + 1] & 15;\n\n if (maxH < h) {\n maxH = h;\n }\n\n if (maxV < v) {\n maxV = v;\n }\n\n var qId = data[offset + 2];\n l = frame.components.push({\n h,\n v,\n quantizationId: qId,\n quantizationTable: null\n });\n frame.componentIds[componentId] = l - 1;\n offset += 3;\n }\n\n frame.maxH = maxH;\n frame.maxV = maxV;\n prepareComponents(frame);\n break;\n\n case 0xffc4:\n const huffmanLength = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n\n for (i = 2; i < huffmanLength;) {\n var huffmanTableSpec = data[offset++];\n var codeLengths = new Uint8Array(16);\n var codeLengthSum = 0;\n\n for (j = 0; j < 16; j++, offset++) {\n codeLengthSum += codeLengths[j] = data[offset];\n }\n\n var huffmanValues = new Uint8Array(codeLengthSum);\n\n for (j = 0; j < codeLengthSum; j++, offset++) {\n huffmanValues[j] = data[offset];\n }\n\n i += 17 + codeLengthSum;\n (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);\n }\n\n break;\n\n case 0xffdd:\n offset += 2;\n resetInterval = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n break;\n\n case 0xffda:\n const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;\n offset += 2;\n var selectorsCount = data[offset++];\n var components = [],\n component;\n\n for (i = 0; i < selectorsCount; i++) {\n var componentIndex = frame.componentIds[data[offset++]];\n component = frame.components[componentIndex];\n var tableSpec = data[offset++];\n component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];\n component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];\n components.push(component);\n }\n\n var spectralStart = data[offset++];\n var spectralEnd = data[offset++];\n var successiveApproximation = data[offset++];\n\n try {\n var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);\n offset += processed;\n } catch (ex) {\n if (ex instanceof DNLMarkerError) {\n (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);\n return this.parse(data, {\n dnlScanLines: ex.scanLines\n });\n } else if (ex instanceof EOIMarkerError) {\n (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);\n break markerLoop;\n }\n\n throw ex;\n }\n\n break;\n\n case 0xffdc:\n offset += 4;\n break;\n\n case 0xffff:\n if (data[offset] !== 0xff) {\n offset--;\n }\n\n break;\n\n default:\n const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);\n\n if (nextFileMarker && nextFileMarker.invalid) {\n (0, _util.warn)(\"JpegImage.parse - unexpected data, current marker is: \" + nextFileMarker.invalid);\n offset = nextFileMarker.offset;\n break;\n }\n\n if (offset >= data.length - 1) {\n (0, _util.warn)(\"JpegImage.parse - reached the end of the image data \" + \"without finding an EOI marker (0xFFD9).\");\n break markerLoop;\n }\n\n throw new JpegError(\"JpegImage.parse - unknown marker: \" + fileMarker.toString(16));\n }\n\n fileMarker = (0, _core_utils.readUint16)(data, offset);\n offset += 2;\n }\n\n this.width = frame.samplesPerLine;\n this.height = frame.scanLines;\n this.jfif = jfif;\n this.adobe = adobe;\n this.components = [];\n\n for (i = 0; i < frame.components.length; i++) {\n component = frame.components[i];\n var quantizationTable = quantizationTables[component.quantizationId];\n\n if (quantizationTable) {\n component.quantizationTable = quantizationTable;\n }\n\n this.components.push({\n output: buildComponentData(frame, component),\n scaleX: component.h / frame.maxH,\n scaleY: component.v / frame.maxV,\n blocksPerLine: component.blocksPerLine,\n blocksPerColumn: component.blocksPerColumn\n });\n }\n\n this.numComponents = this.components.length;\n return undefined;\n },\n\n _getLinearizedBlockData(width, height, isSourcePDF = false) {\n var scaleX = this.width / width,\n scaleY = this.height / height;\n var component, componentScaleX, componentScaleY, blocksPerScanline;\n var x, y, i, j, k;\n var index;\n var offset = 0;\n var output;\n var numComponents = this.components.length;\n var dataLength = width * height * numComponents;\n var data = new Uint8ClampedArray(dataLength);\n var xScaleBlockOffset = new Uint32Array(width);\n var mask3LSB = 0xfffffff8;\n let lastComponentScaleX;\n\n for (i = 0; i < numComponents; i++) {\n component = this.components[i];\n componentScaleX = component.scaleX * scaleX;\n componentScaleY = component.scaleY * scaleY;\n offset = i;\n output = component.output;\n blocksPerScanline = component.blocksPerLine + 1 << 3;\n\n if (componentScaleX !== lastComponentScaleX) {\n for (x = 0; x < width; x++) {\n j = 0 | x * componentScaleX;\n xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;\n }\n\n lastComponentScaleX = componentScaleX;\n }\n\n for (y = 0; y < height; y++) {\n j = 0 | y * componentScaleY;\n index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;\n\n for (x = 0; x < width; x++) {\n data[offset] = output[index + xScaleBlockOffset[x]];\n offset += numComponents;\n }\n }\n }\n\n let transform = this._decodeTransform;\n\n if (!isSourcePDF && numComponents === 4 && !transform) {\n transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);\n }\n\n if (transform) {\n for (i = 0; i < dataLength;) {\n for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {\n data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];\n }\n }\n }\n\n return data;\n },\n\n get _isColorConversionNeeded() {\n if (this.adobe) {\n return !!this.adobe.transformCode;\n }\n\n if (this.numComponents === 3) {\n if (this._colorTransform === 0) {\n return false;\n }\n\n return true;\n }\n\n if (this._colorTransform === 1) {\n return true;\n }\n\n return false;\n },\n\n _convertYccToRgb: function convertYccToRgb(data) {\n var Y, Cb, Cr;\n\n for (var i = 0, length = data.length; i < length; i += 3) {\n Y = data[i];\n Cb = data[i + 1];\n Cr = data[i + 2];\n data[i] = Y - 179.456 + 1.402 * Cr;\n data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;\n data[i + 2] = Y - 226.816 + 1.772 * Cb;\n }\n\n return data;\n },\n _convertYcckToRgb: function convertYcckToRgb(data) {\n var Y, Cb, Cr, k;\n var offset = 0;\n\n for (var i = 0, length = data.length; i < length; i += 4) {\n Y = data[i];\n Cb = data[i + 1];\n Cr = data[i + 2];\n k = data[i + 3];\n data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);\n data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);\n data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);\n }\n\n return data.subarray(0, offset);\n },\n _convertYcckToCmyk: function convertYcckToCmyk(data) {\n var Y, Cb, Cr;\n\n for (var i = 0, length = data.length; i < length; i += 4) {\n Y = data[i];\n Cb = data[i + 1];\n Cr = data[i + 2];\n data[i] = 434.456 - Y - 1.402 * Cr;\n data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;\n data[i + 2] = 481.816 - Y - 1.772 * Cb;\n }\n\n return data;\n },\n _convertCmykToRgb: function convertCmykToRgb(data) {\n var c, m, y, k;\n var offset = 0;\n\n for (var i = 0, length = data.length; i < length; i += 4) {\n c = data[i];\n m = data[i + 1];\n y = data[i + 2];\n k = data[i + 3];\n data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254);\n data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.00031891311758832814 * k + 0.7364883807733168);\n data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144);\n }\n\n return data.subarray(0, offset);\n },\n\n getData({\n width,\n height,\n forceRGB = false,\n isSourcePDF = false\n }) {\n if (this.numComponents > 4) {\n throw new JpegError(\"Unsupported color mode\");\n }\n\n var data = this._getLinearizedBlockData(width, height, isSourcePDF);\n\n if (this.numComponents === 1 && forceRGB) {\n var dataLength = data.length;\n var rgbData = new Uint8ClampedArray(dataLength * 3);\n var offset = 0;\n\n for (var i = 0; i < dataLength; i++) {\n var grayColor = data[i];\n rgbData[offset++] = grayColor;\n rgbData[offset++] = grayColor;\n rgbData[offset++] = grayColor;\n }\n\n return rgbData;\n } else if (this.numComponents === 3 && this._isColorConversionNeeded) {\n return this._convertYccToRgb(data);\n } else if (this.numComponents === 4) {\n if (this._isColorConversionNeeded) {\n if (forceRGB) {\n return this._convertYcckToRgb(data);\n }\n\n return this._convertYcckToCmyk(data);\n } else if (forceRGB) {\n return this._convertCmykToRgb(data);\n }\n }\n\n return data;\n }\n\n };\n return JpegImage;\n}();\n\nexports.JpegImage = JpegImage;\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.JpxStream = void 0;\n\nvar _stream = __w_pdfjs_require__(11);\n\nvar _jpx = __w_pdfjs_require__(20);\n\nvar _util = __w_pdfjs_require__(2);\n\nconst JpxStream = function JpxStreamClosure() {\n function JpxStream(stream, maybeLength, dict, params) {\n this.stream = stream;\n this.maybeLength = maybeLength;\n this.dict = dict;\n this.params = params;\n\n _stream.DecodeStream.call(this, maybeLength);\n }\n\n JpxStream.prototype = Object.create(_stream.DecodeStream.prototype);\n Object.defineProperty(JpxStream.prototype, \"bytes\", {\n get: function JpxStream_bytes() {\n return (0, _util.shadow)(this, \"bytes\", this.stream.getBytes(this.maybeLength));\n },\n configurable: true\n });\n\n JpxStream.prototype.ensureBuffer = function (requested) {};\n\n JpxStream.prototype.readBlock = function () {\n if (this.eof) {\n return;\n }\n\n const jpxImage = new _jpx.JpxImage();\n jpxImage.parse(this.bytes);\n const width = jpxImage.width;\n const height = jpxImage.height;\n const componentsCount = jpxImage.componentsCount;\n const tileCount = jpxImage.tiles.length;\n\n if (tileCount === 1) {\n this.buffer = jpxImage.tiles[0].items;\n } else {\n const data = new Uint8ClampedArray(width * height * componentsCount);\n\n for (let k = 0; k < tileCount; k++) {\n const tileComponents = jpxImage.tiles[k];\n const tileWidth = tileComponents.width;\n const tileHeight = tileComponents.height;\n const tileLeft = tileComponents.left;\n const tileTop = tileComponents.top;\n const src = tileComponents.items;\n let srcPosition = 0;\n let dataPosition = (width * tileTop + tileLeft) * componentsCount;\n const imgRowSize = width * componentsCount;\n const tileRowSize = tileWidth * componentsCount;\n\n for (let j = 0; j < tileHeight; j++) {\n const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);\n data.set(rowBytes, dataPosition);\n srcPosition += tileRowSize;\n dataPosition += imgRowSize;\n }\n }\n\n this.buffer = data;\n }\n\n this.bufferLength = this.buffer.length;\n this.eof = true;\n };\n\n return JpxStream;\n}();\n\nexports.JpxStream = JpxStream;\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.JpxImage = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nvar _arithmetic_decoder = __w_pdfjs_require__(16);\n\nclass JpxError extends _util.BaseException {\n constructor(msg) {\n super(`JPX error: ${msg}`);\n }\n\n}\n\nvar JpxImage = function JpxImageClosure() {\n var SubbandsGainLog2 = {\n LL: 0,\n LH: 1,\n HL: 1,\n HH: 2\n };\n\n function JpxImage() {\n this.failOnCorruptedImage = false;\n }\n\n JpxImage.prototype = {\n parse: function JpxImage_parse(data) {\n var head = (0, _core_utils.readUint16)(data, 0);\n\n if (head === 0xff4f) {\n this.parseCodestream(data, 0, data.length);\n return;\n }\n\n var position = 0,\n length = data.length;\n\n while (position < length) {\n var headerSize = 8;\n var lbox = (0, _core_utils.readUint32)(data, position);\n var tbox = (0, _core_utils.readUint32)(data, position + 4);\n position += headerSize;\n\n if (lbox === 1) {\n lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);\n position += 8;\n headerSize += 8;\n }\n\n if (lbox === 0) {\n lbox = length - position + headerSize;\n }\n\n if (lbox < headerSize) {\n throw new JpxError(\"Invalid box field size\");\n }\n\n var dataLength = lbox - headerSize;\n var jumpDataLength = true;\n\n switch (tbox) {\n case 0x6a703268:\n jumpDataLength = false;\n break;\n\n case 0x636f6c72:\n var method = data[position];\n\n if (method === 1) {\n var colorspace = (0, _core_utils.readUint32)(data, position + 3);\n\n switch (colorspace) {\n case 16:\n case 17:\n case 18:\n break;\n\n default:\n (0, _util.warn)(\"Unknown colorspace \" + colorspace);\n break;\n }\n } else if (method === 2) {\n (0, _util.info)(\"ICC profile not supported\");\n }\n\n break;\n\n case 0x6a703263:\n this.parseCodestream(data, position, position + dataLength);\n break;\n\n case 0x6a502020:\n if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {\n (0, _util.warn)(\"Invalid JP2 signature\");\n }\n\n break;\n\n case 0x6a501a1a:\n case 0x66747970:\n case 0x72726571:\n case 0x72657320:\n case 0x69686472:\n break;\n\n default:\n var headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);\n (0, _util.warn)(\"Unsupported header type \" + tbox + \" (\" + headerType + \")\");\n break;\n }\n\n if (jumpDataLength) {\n position += dataLength;\n }\n }\n },\n parseImageProperties: function JpxImage_parseImageProperties(stream) {\n var newByte = stream.getByte();\n\n while (newByte >= 0) {\n var oldByte = newByte;\n newByte = stream.getByte();\n var code = oldByte << 8 | newByte;\n\n if (code === 0xff51) {\n stream.skip(4);\n var Xsiz = stream.getInt32() >>> 0;\n var Ysiz = stream.getInt32() >>> 0;\n var XOsiz = stream.getInt32() >>> 0;\n var YOsiz = stream.getInt32() >>> 0;\n stream.skip(16);\n var Csiz = stream.getUint16();\n this.width = Xsiz - XOsiz;\n this.height = Ysiz - YOsiz;\n this.componentsCount = Csiz;\n this.bitsPerComponent = 8;\n return;\n }\n }\n\n throw new JpxError(\"No size marker found in JPX stream\");\n },\n parseCodestream: function JpxImage_parseCodestream(data, start, end) {\n var context = {};\n var doNotRecover = false;\n\n try {\n var position = start;\n\n while (position + 1 < end) {\n var code = (0, _core_utils.readUint16)(data, position);\n position += 2;\n var length = 0,\n j,\n sqcd,\n spqcds,\n spqcdSize,\n scalarExpounded,\n tile;\n\n switch (code) {\n case 0xff4f:\n context.mainHeader = true;\n break;\n\n case 0xffd9:\n break;\n\n case 0xff51:\n length = (0, _core_utils.readUint16)(data, position);\n var siz = {};\n siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);\n siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);\n siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);\n siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);\n siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);\n siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);\n siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);\n siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);\n var componentsCount = (0, _core_utils.readUint16)(data, position + 36);\n siz.Csiz = componentsCount;\n var components = [];\n j = position + 38;\n\n for (var i = 0; i < componentsCount; i++) {\n var component = {\n precision: (data[j] & 0x7f) + 1,\n isSigned: !!(data[j] & 0x80),\n XRsiz: data[j + 1],\n YRsiz: data[j + 2]\n };\n j += 3;\n calculateComponentDimensions(component, siz);\n components.push(component);\n }\n\n context.SIZ = siz;\n context.components = components;\n calculateTileGrids(context, components);\n context.QCC = [];\n context.COC = [];\n break;\n\n case 0xff5c:\n length = (0, _core_utils.readUint16)(data, position);\n var qcd = {};\n j = position + 2;\n sqcd = data[j++];\n\n switch (sqcd & 0x1f) {\n case 0:\n spqcdSize = 8;\n scalarExpounded = true;\n break;\n\n case 1:\n spqcdSize = 16;\n scalarExpounded = false;\n break;\n\n case 2:\n spqcdSize = 16;\n scalarExpounded = true;\n break;\n\n default:\n throw new Error(\"Invalid SQcd value \" + sqcd);\n }\n\n qcd.noQuantization = spqcdSize === 8;\n qcd.scalarExpounded = scalarExpounded;\n qcd.guardBits = sqcd >> 5;\n spqcds = [];\n\n while (j < length + position) {\n var spqcd = {};\n\n if (spqcdSize === 8) {\n spqcd.epsilon = data[j++] >> 3;\n spqcd.mu = 0;\n } else {\n spqcd.epsilon = data[j] >> 3;\n spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];\n j += 2;\n }\n\n spqcds.push(spqcd);\n }\n\n qcd.SPqcds = spqcds;\n\n if (context.mainHeader) {\n context.QCD = qcd;\n } else {\n context.currentTile.QCD = qcd;\n context.currentTile.QCC = [];\n }\n\n break;\n\n case 0xff5d:\n length = (0, _core_utils.readUint16)(data, position);\n var qcc = {};\n j = position + 2;\n var cqcc;\n\n if (context.SIZ.Csiz < 257) {\n cqcc = data[j++];\n } else {\n cqcc = (0, _core_utils.readUint16)(data, j);\n j += 2;\n }\n\n sqcd = data[j++];\n\n switch (sqcd & 0x1f) {\n case 0:\n spqcdSize = 8;\n scalarExpounded = true;\n break;\n\n case 1:\n spqcdSize = 16;\n scalarExpounded = false;\n break;\n\n case 2:\n spqcdSize = 16;\n scalarExpounded = true;\n break;\n\n default:\n throw new Error(\"Invalid SQcd value \" + sqcd);\n }\n\n qcc.noQuantization = spqcdSize === 8;\n qcc.scalarExpounded = scalarExpounded;\n qcc.guardBits = sqcd >> 5;\n spqcds = [];\n\n while (j < length + position) {\n spqcd = {};\n\n if (spqcdSize === 8) {\n spqcd.epsilon = data[j++] >> 3;\n spqcd.mu = 0;\n } else {\n spqcd.epsilon = data[j] >> 3;\n spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];\n j += 2;\n }\n\n spqcds.push(spqcd);\n }\n\n qcc.SPqcds = spqcds;\n\n if (context.mainHeader) {\n context.QCC[cqcc] = qcc;\n } else {\n context.currentTile.QCC[cqcc] = qcc;\n }\n\n break;\n\n case 0xff52:\n length = (0, _core_utils.readUint16)(data, position);\n var cod = {};\n j = position + 2;\n var scod = data[j++];\n cod.entropyCoderWithCustomPrecincts = !!(scod & 1);\n cod.sopMarkerUsed = !!(scod & 2);\n cod.ephMarkerUsed = !!(scod & 4);\n cod.progressionOrder = data[j++];\n cod.layersCount = (0, _core_utils.readUint16)(data, j);\n j += 2;\n cod.multipleComponentTransform = data[j++];\n cod.decompositionLevelsCount = data[j++];\n cod.xcb = (data[j++] & 0xf) + 2;\n cod.ycb = (data[j++] & 0xf) + 2;\n var blockStyle = data[j++];\n cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);\n cod.resetContextProbabilities = !!(blockStyle & 2);\n cod.terminationOnEachCodingPass = !!(blockStyle & 4);\n cod.verticallyStripe = !!(blockStyle & 8);\n cod.predictableTermination = !!(blockStyle & 16);\n cod.segmentationSymbolUsed = !!(blockStyle & 32);\n cod.reversibleTransformation = data[j++];\n\n if (cod.entropyCoderWithCustomPrecincts) {\n var precinctsSizes = [];\n\n while (j < length + position) {\n var precinctsSize = data[j++];\n precinctsSizes.push({\n PPx: precinctsSize & 0xf,\n PPy: precinctsSize >> 4\n });\n }\n\n cod.precinctsSizes = precinctsSizes;\n }\n\n var unsupported = [];\n\n if (cod.selectiveArithmeticCodingBypass) {\n unsupported.push(\"selectiveArithmeticCodingBypass\");\n }\n\n if (cod.resetContextProbabilities) {\n unsupported.push(\"resetContextProbabilities\");\n }\n\n if (cod.terminationOnEachCodingPass) {\n unsupported.push(\"terminationOnEachCodingPass\");\n }\n\n if (cod.verticallyStripe) {\n unsupported.push(\"verticallyStripe\");\n }\n\n if (cod.predictableTermination) {\n unsupported.push(\"predictableTermination\");\n }\n\n if (unsupported.length > 0) {\n doNotRecover = true;\n throw new Error(\"Unsupported COD options (\" + unsupported.join(\", \") + \")\");\n }\n\n if (context.mainHeader) {\n context.COD = cod;\n } else {\n context.currentTile.COD = cod;\n context.currentTile.COC = [];\n }\n\n break;\n\n case 0xff90:\n length = (0, _core_utils.readUint16)(data, position);\n tile = {};\n tile.index = (0, _core_utils.readUint16)(data, position + 2);\n tile.length = (0, _core_utils.readUint32)(data, position + 4);\n tile.dataEnd = tile.length + position - 2;\n tile.partIndex = data[position + 8];\n tile.partsCount = data[position + 9];\n context.mainHeader = false;\n\n if (tile.partIndex === 0) {\n tile.COD = context.COD;\n tile.COC = context.COC.slice(0);\n tile.QCD = context.QCD;\n tile.QCC = context.QCC.slice(0);\n }\n\n context.currentTile = tile;\n break;\n\n case 0xff93:\n tile = context.currentTile;\n\n if (tile.partIndex === 0) {\n initializeTile(context, tile.index);\n buildPackets(context);\n }\n\n length = tile.dataEnd - position;\n parseTilePackets(context, data, position, length);\n break;\n\n case 0xff55:\n case 0xff57:\n case 0xff58:\n case 0xff64:\n length = (0, _core_utils.readUint16)(data, position);\n break;\n\n case 0xff53:\n throw new Error(\"Codestream code 0xFF53 (COC) is not implemented\");\n\n default:\n throw new Error(\"Unknown codestream code: \" + code.toString(16));\n }\n\n position += length;\n }\n } catch (e) {\n if (doNotRecover || this.failOnCorruptedImage) {\n throw new JpxError(e.message);\n } else {\n (0, _util.warn)(\"JPX: Trying to recover from: \" + e.message);\n }\n }\n\n this.tiles = transformComponents(context);\n this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;\n this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;\n this.componentsCount = context.SIZ.Csiz;\n }\n };\n\n function calculateComponentDimensions(component, siz) {\n component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);\n component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);\n component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);\n component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);\n component.width = component.x1 - component.x0;\n component.height = component.y1 - component.y0;\n }\n\n function calculateTileGrids(context, components) {\n var siz = context.SIZ;\n var tile,\n tiles = [];\n var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);\n var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);\n\n for (var q = 0; q < numYtiles; q++) {\n for (var p = 0; p < numXtiles; p++) {\n tile = {};\n tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);\n tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);\n tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);\n tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);\n tile.width = tile.tx1 - tile.tx0;\n tile.height = tile.ty1 - tile.ty0;\n tile.components = [];\n tiles.push(tile);\n }\n }\n\n context.tiles = tiles;\n var componentsCount = siz.Csiz;\n\n for (var i = 0, ii = componentsCount; i < ii; i++) {\n var component = components[i];\n\n for (var j = 0, jj = tiles.length; j < jj; j++) {\n var tileComponent = {};\n tile = tiles[j];\n tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);\n tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);\n tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);\n tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);\n tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;\n tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;\n tile.components[i] = tileComponent;\n }\n }\n }\n\n function getBlocksDimensions(context, component, r) {\n var codOrCoc = component.codingStyleParameters;\n var result = {};\n\n if (!codOrCoc.entropyCoderWithCustomPrecincts) {\n result.PPx = 15;\n result.PPy = 15;\n } else {\n result.PPx = codOrCoc.precinctsSizes[r].PPx;\n result.PPy = codOrCoc.precinctsSizes[r].PPy;\n }\n\n result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);\n result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);\n return result;\n }\n\n function buildPrecincts(context, resolution, dimensions) {\n var precinctWidth = 1 << dimensions.PPx;\n var precinctHeight = 1 << dimensions.PPy;\n var isZeroRes = resolution.resLevel === 0;\n var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);\n var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);\n var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;\n var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;\n var numprecincts = numprecinctswide * numprecinctshigh;\n resolution.precinctParameters = {\n precinctWidth,\n precinctHeight,\n numprecinctswide,\n numprecinctshigh,\n numprecincts,\n precinctWidthInSubband,\n precinctHeightInSubband\n };\n }\n\n function buildCodeblocks(context, subband, dimensions) {\n var xcb_ = dimensions.xcb_;\n var ycb_ = dimensions.ycb_;\n var codeblockWidth = 1 << xcb_;\n var codeblockHeight = 1 << ycb_;\n var cbx0 = subband.tbx0 >> xcb_;\n var cby0 = subband.tby0 >> ycb_;\n var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;\n var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;\n var precinctParameters = subband.resolution.precinctParameters;\n var codeblocks = [];\n var precincts = [];\n var i, j, codeblock, precinctNumber;\n\n for (j = cby0; j < cby1; j++) {\n for (i = cbx0; i < cbx1; i++) {\n codeblock = {\n cbx: i,\n cby: j,\n tbx0: codeblockWidth * i,\n tby0: codeblockHeight * j,\n tbx1: codeblockWidth * (i + 1),\n tby1: codeblockHeight * (j + 1)\n };\n codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);\n codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);\n codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);\n codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);\n var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);\n var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);\n precinctNumber = pi + pj * precinctParameters.numprecinctswide;\n codeblock.precinctNumber = precinctNumber;\n codeblock.subbandType = subband.type;\n codeblock.Lblock = 3;\n\n if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {\n continue;\n }\n\n codeblocks.push(codeblock);\n var precinct = precincts[precinctNumber];\n\n if (precinct !== undefined) {\n if (i < precinct.cbxMin) {\n precinct.cbxMin = i;\n } else if (i > precinct.cbxMax) {\n precinct.cbxMax = i;\n }\n\n if (j < precinct.cbyMin) {\n precinct.cbxMin = j;\n } else if (j > precinct.cbyMax) {\n precinct.cbyMax = j;\n }\n } else {\n precincts[precinctNumber] = precinct = {\n cbxMin: i,\n cbyMin: j,\n cbxMax: i,\n cbyMax: j\n };\n }\n\n codeblock.precinct = precinct;\n }\n }\n\n subband.codeblockParameters = {\n codeblockWidth: xcb_,\n codeblockHeight: ycb_,\n numcodeblockwide: cbx1 - cbx0 + 1,\n numcodeblockhigh: cby1 - cby0 + 1\n };\n subband.codeblocks = codeblocks;\n subband.precincts = precincts;\n }\n\n function createPacket(resolution, precinctNumber, layerNumber) {\n var precinctCodeblocks = [];\n var subbands = resolution.subbands;\n\n for (var i = 0, ii = subbands.length; i < ii; i++) {\n var subband = subbands[i];\n var codeblocks = subband.codeblocks;\n\n for (var j = 0, jj = codeblocks.length; j < jj; j++) {\n var codeblock = codeblocks[j];\n\n if (codeblock.precinctNumber !== precinctNumber) {\n continue;\n }\n\n precinctCodeblocks.push(codeblock);\n }\n }\n\n return {\n layerNumber,\n codeblocks: precinctCodeblocks\n };\n }\n\n function LayerResolutionComponentPositionIterator(context) {\n var siz = context.SIZ;\n var tileIndex = context.currentTile.index;\n var tile = context.tiles[tileIndex];\n var layersCount = tile.codingStyleDefaultParameters.layersCount;\n var componentsCount = siz.Csiz;\n var maxDecompositionLevelsCount = 0;\n\n for (var q = 0; q < componentsCount; q++) {\n maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);\n }\n\n var l = 0,\n r = 0,\n i = 0,\n k = 0;\n\n this.nextPacket = function JpxImage_nextPacket() {\n for (; l < layersCount; l++) {\n for (; r <= maxDecompositionLevelsCount; r++) {\n for (; i < componentsCount; i++) {\n var component = tile.components[i];\n\n if (r > component.codingStyleParameters.decompositionLevelsCount) {\n continue;\n }\n\n var resolution = component.resolutions[r];\n var numprecincts = resolution.precinctParameters.numprecincts;\n\n for (; k < numprecincts;) {\n var packet = createPacket(resolution, k, l);\n k++;\n return packet;\n }\n\n k = 0;\n }\n\n i = 0;\n }\n\n r = 0;\n }\n\n throw new JpxError(\"Out of packets\");\n };\n }\n\n function ResolutionLayerComponentPositionIterator(context) {\n var siz = context.SIZ;\n var tileIndex = context.currentTile.index;\n var tile = context.tiles[tileIndex];\n var layersCount = tile.codingStyleDefaultParameters.layersCount;\n var componentsCount = siz.Csiz;\n var maxDecompositionLevelsCount = 0;\n\n for (var q = 0; q < componentsCount; q++) {\n maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);\n }\n\n var r = 0,\n l = 0,\n i = 0,\n k = 0;\n\n this.nextPacket = function JpxImage_nextPacket() {\n for (; r <= maxDecompositionLevelsCount; r++) {\n for (; l < layersCount; l++) {\n for (; i < componentsCount; i++) {\n var component = tile.components[i];\n\n if (r > component.codingStyleParameters.decompositionLevelsCount) {\n continue;\n }\n\n var resolution = component.resolutions[r];\n var numprecincts = resolution.precinctParameters.numprecincts;\n\n for (; k < numprecincts;) {\n var packet = createPacket(resolution, k, l);\n k++;\n return packet;\n }\n\n k = 0;\n }\n\n i = 0;\n }\n\n l = 0;\n }\n\n throw new JpxError(\"Out of packets\");\n };\n }\n\n function ResolutionPositionComponentLayerIterator(context) {\n var siz = context.SIZ;\n var tileIndex = context.currentTile.index;\n var tile = context.tiles[tileIndex];\n var layersCount = tile.codingStyleDefaultParameters.layersCount;\n var componentsCount = siz.Csiz;\n var l, r, c, p;\n var maxDecompositionLevelsCount = 0;\n\n for (c = 0; c < componentsCount; c++) {\n var component = tile.components[c];\n maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);\n }\n\n var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);\n\n for (r = 0; r <= maxDecompositionLevelsCount; ++r) {\n var maxNumPrecincts = 0;\n\n for (c = 0; c < componentsCount; ++c) {\n var resolutions = tile.components[c].resolutions;\n\n if (r < resolutions.length) {\n maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);\n }\n }\n\n maxNumPrecinctsInLevel[r] = maxNumPrecincts;\n }\n\n l = 0;\n r = 0;\n c = 0;\n p = 0;\n\n this.nextPacket = function JpxImage_nextPacket() {\n for (; r <= maxDecompositionLevelsCount; r++) {\n for (; p < maxNumPrecinctsInLevel[r]; p++) {\n for (; c < componentsCount; c++) {\n var component = tile.components[c];\n\n if (r > component.codingStyleParameters.decompositionLevelsCount) {\n continue;\n }\n\n var resolution = component.resolutions[r];\n var numprecincts = resolution.precinctParameters.numprecincts;\n\n if (p >= numprecincts) {\n continue;\n }\n\n for (; l < layersCount;) {\n var packet = createPacket(resolution, p, l);\n l++;\n return packet;\n }\n\n l = 0;\n }\n\n c = 0;\n }\n\n p = 0;\n }\n\n throw new JpxError(\"Out of packets\");\n };\n }\n\n function PositionComponentResolutionLayerIterator(context) {\n var siz = context.SIZ;\n var tileIndex = context.currentTile.index;\n var tile = context.tiles[tileIndex];\n var layersCount = tile.codingStyleDefaultParameters.layersCount;\n var componentsCount = siz.Csiz;\n var precinctsSizes = getPrecinctSizesInImageScale(tile);\n var precinctsIterationSizes = precinctsSizes;\n var l = 0,\n r = 0,\n c = 0,\n px = 0,\n py = 0;\n\n this.nextPacket = function JpxImage_nextPacket() {\n for (; py < precinctsIterationSizes.maxNumHigh; py++) {\n for (; px < precinctsIterationSizes.maxNumWide; px++) {\n for (; c < componentsCount; c++) {\n var component = tile.components[c];\n var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;\n\n for (; r <= decompositionLevelsCount; r++) {\n var resolution = component.resolutions[r];\n var sizeInImageScale = precinctsSizes.components[c].resolutions[r];\n var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);\n\n if (k === null) {\n continue;\n }\n\n for (; l < layersCount;) {\n var packet = createPacket(resolution, k, l);\n l++;\n return packet;\n }\n\n l = 0;\n }\n\n r = 0;\n }\n\n c = 0;\n }\n\n px = 0;\n }\n\n throw new JpxError(\"Out of packets\");\n };\n }\n\n function ComponentPositionResolutionLayerIterator(context) {\n var siz = context.SIZ;\n var tileIndex = context.currentTile.index;\n var tile = context.tiles[tileIndex];\n var layersCount = tile.codingStyleDefaultParameters.layersCount;\n var componentsCount = siz.Csiz;\n var precinctsSizes = getPrecinctSizesInImageScale(tile);\n var l = 0,\n r = 0,\n c = 0,\n px = 0,\n py = 0;\n\n this.nextPacket = function JpxImage_nextPacket() {\n for (; c < componentsCount; ++c) {\n var component = tile.components[c];\n var precinctsIterationSizes = precinctsSizes.components[c];\n var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;\n\n for (; py < precinctsIterationSizes.maxNumHigh; py++) {\n for (; px < precinctsIterationSizes.maxNumWide; px++) {\n for (; r <= decompositionLevelsCount; r++) {\n var resolution = component.resolutions[r];\n var sizeInImageScale = precinctsIterationSizes.resolutions[r];\n var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);\n\n if (k === null) {\n continue;\n }\n\n for (; l < layersCount;) {\n var packet = createPacket(resolution, k, l);\n l++;\n return packet;\n }\n\n l = 0;\n }\n\n r = 0;\n }\n\n px = 0;\n }\n\n py = 0;\n }\n\n throw new JpxError(\"Out of packets\");\n };\n }\n\n function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {\n var posX = pxIndex * precinctIterationSizes.minWidth;\n var posY = pyIndex * precinctIterationSizes.minHeight;\n\n if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {\n return null;\n }\n\n var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;\n return posX / sizeInImageScale.height + startPrecinctRowIndex;\n }\n\n function getPrecinctSizesInImageScale(tile) {\n var componentsCount = tile.components.length;\n var minWidth = Number.MAX_VALUE;\n var minHeight = Number.MAX_VALUE;\n var maxNumWide = 0;\n var maxNumHigh = 0;\n var sizePerComponent = new Array(componentsCount);\n\n for (var c = 0; c < componentsCount; c++) {\n var component = tile.components[c];\n var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;\n var sizePerResolution = new Array(decompositionLevelsCount + 1);\n var minWidthCurrentComponent = Number.MAX_VALUE;\n var minHeightCurrentComponent = Number.MAX_VALUE;\n var maxNumWideCurrentComponent = 0;\n var maxNumHighCurrentComponent = 0;\n var scale = 1;\n\n for (var r = decompositionLevelsCount; r >= 0; --r) {\n var resolution = component.resolutions[r];\n var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;\n var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;\n minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);\n minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);\n maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);\n maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);\n sizePerResolution[r] = {\n width: widthCurrentResolution,\n height: heightCurrentResolution\n };\n scale <<= 1;\n }\n\n minWidth = Math.min(minWidth, minWidthCurrentComponent);\n minHeight = Math.min(minHeight, minHeightCurrentComponent);\n maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);\n maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);\n sizePerComponent[c] = {\n resolutions: sizePerResolution,\n minWidth: minWidthCurrentComponent,\n minHeight: minHeightCurrentComponent,\n maxNumWide: maxNumWideCurrentComponent,\n maxNumHigh: maxNumHighCurrentComponent\n };\n }\n\n return {\n components: sizePerComponent,\n minWidth,\n minHeight,\n maxNumWide,\n maxNumHigh\n };\n }\n\n function buildPackets(context) {\n var siz = context.SIZ;\n var tileIndex = context.currentTile.index;\n var tile = context.tiles[tileIndex];\n var componentsCount = siz.Csiz;\n\n for (var c = 0; c < componentsCount; c++) {\n var component = tile.components[c];\n var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;\n var resolutions = [];\n var subbands = [];\n\n for (var r = 0; r <= decompositionLevelsCount; r++) {\n var blocksDimensions = getBlocksDimensions(context, component, r);\n var resolution = {};\n var scale = 1 << decompositionLevelsCount - r;\n resolution.trx0 = Math.ceil(component.tcx0 / scale);\n resolution.try0 = Math.ceil(component.tcy0 / scale);\n resolution.trx1 = Math.ceil(component.tcx1 / scale);\n resolution.try1 = Math.ceil(component.tcy1 / scale);\n resolution.resLevel = r;\n buildPrecincts(context, resolution, blocksDimensions);\n resolutions.push(resolution);\n var subband;\n\n if (r === 0) {\n subband = {};\n subband.type = \"LL\";\n subband.tbx0 = Math.ceil(component.tcx0 / scale);\n subband.tby0 = Math.ceil(component.tcy0 / scale);\n subband.tbx1 = Math.ceil(component.tcx1 / scale);\n subband.tby1 = Math.ceil(component.tcy1 / scale);\n subband.resolution = resolution;\n buildCodeblocks(context, subband, blocksDimensions);\n subbands.push(subband);\n resolution.subbands = [subband];\n } else {\n var bscale = 1 << decompositionLevelsCount - r + 1;\n var resolutionSubbands = [];\n subband = {};\n subband.type = \"HL\";\n subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);\n subband.tby0 = Math.ceil(component.tcy0 / bscale);\n subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);\n subband.tby1 = Math.ceil(component.tcy1 / bscale);\n subband.resolution = resolution;\n buildCodeblocks(context, subband, blocksDimensions);\n subbands.push(subband);\n resolutionSubbands.push(subband);\n subband = {};\n subband.type = \"LH\";\n subband.tbx0 = Math.ceil(component.tcx0 / bscale);\n subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);\n subband.tbx1 = Math.ceil(component.tcx1 / bscale);\n subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);\n subband.resolution = resolution;\n buildCodeblocks(context, subband, blocksDimensions);\n subbands.push(subband);\n resolutionSubbands.push(subband);\n subband = {};\n subband.type = \"HH\";\n subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);\n subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);\n subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);\n subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);\n subband.resolution = resolution;\n buildCodeblocks(context, subband, blocksDimensions);\n subbands.push(subband);\n resolutionSubbands.push(subband);\n resolution.subbands = resolutionSubbands;\n }\n }\n\n component.resolutions = resolutions;\n component.subbands = subbands;\n }\n\n var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;\n\n switch (progressionOrder) {\n case 0:\n tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);\n break;\n\n case 1:\n tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);\n break;\n\n case 2:\n tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);\n break;\n\n case 3:\n tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);\n break;\n\n case 4:\n tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);\n break;\n\n default:\n throw new JpxError(`Unsupported progression order ${progressionOrder}`);\n }\n }\n\n function parseTilePackets(context, data, offset, dataLength) {\n var position = 0;\n var buffer,\n bufferSize = 0,\n skipNextBit = false;\n\n function readBits(count) {\n while (bufferSize < count) {\n var b = data[offset + position];\n position++;\n\n if (skipNextBit) {\n buffer = buffer << 7 | b;\n bufferSize += 7;\n skipNextBit = false;\n } else {\n buffer = buffer << 8 | b;\n bufferSize += 8;\n }\n\n if (b === 0xff) {\n skipNextBit = true;\n }\n }\n\n bufferSize -= count;\n return buffer >>> bufferSize & (1 << count) - 1;\n }\n\n function skipMarkerIfEqual(value) {\n if (data[offset + position - 1] === 0xff && data[offset + position] === value) {\n skipBytes(1);\n return true;\n } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {\n skipBytes(2);\n return true;\n }\n\n return false;\n }\n\n function skipBytes(count) {\n position += count;\n }\n\n function alignToByte() {\n bufferSize = 0;\n\n if (skipNextBit) {\n position++;\n skipNextBit = false;\n }\n }\n\n function readCodingpasses() {\n if (readBits(1) === 0) {\n return 1;\n }\n\n if (readBits(1) === 0) {\n return 2;\n }\n\n var value = readBits(2);\n\n if (value < 3) {\n return value + 3;\n }\n\n value = readBits(5);\n\n if (value < 31) {\n return value + 6;\n }\n\n value = readBits(7);\n return value + 37;\n }\n\n var tileIndex = context.currentTile.index;\n var tile = context.tiles[tileIndex];\n var sopMarkerUsed = context.COD.sopMarkerUsed;\n var ephMarkerUsed = context.COD.ephMarkerUsed;\n var packetsIterator = tile.packetsIterator;\n\n while (position < dataLength) {\n alignToByte();\n\n if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {\n skipBytes(4);\n }\n\n var packet = packetsIterator.nextPacket();\n\n if (!readBits(1)) {\n continue;\n }\n\n var layerNumber = packet.layerNumber;\n var queue = [],\n codeblock;\n\n for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {\n codeblock = packet.codeblocks[i];\n var precinct = codeblock.precinct;\n var codeblockColumn = codeblock.cbx - precinct.cbxMin;\n var codeblockRow = codeblock.cby - precinct.cbyMin;\n var codeblockIncluded = false;\n var firstTimeInclusion = false;\n var valueReady;\n\n if (codeblock[\"included\"] !== undefined) {\n codeblockIncluded = !!readBits(1);\n } else {\n precinct = codeblock.precinct;\n var inclusionTree, zeroBitPlanesTree;\n\n if (precinct[\"inclusionTree\"] !== undefined) {\n inclusionTree = precinct.inclusionTree;\n } else {\n var width = precinct.cbxMax - precinct.cbxMin + 1;\n var height = precinct.cbyMax - precinct.cbyMin + 1;\n inclusionTree = new InclusionTree(width, height, layerNumber);\n zeroBitPlanesTree = new TagTree(width, height);\n precinct.inclusionTree = inclusionTree;\n precinct.zeroBitPlanesTree = zeroBitPlanesTree;\n }\n\n if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {\n while (true) {\n if (readBits(1)) {\n valueReady = !inclusionTree.nextLevel();\n\n if (valueReady) {\n codeblock.included = true;\n codeblockIncluded = firstTimeInclusion = true;\n break;\n }\n } else {\n inclusionTree.incrementValue(layerNumber);\n break;\n }\n }\n }\n }\n\n if (!codeblockIncluded) {\n continue;\n }\n\n if (firstTimeInclusion) {\n zeroBitPlanesTree = precinct.zeroBitPlanesTree;\n zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);\n\n while (true) {\n if (readBits(1)) {\n valueReady = !zeroBitPlanesTree.nextLevel();\n\n if (valueReady) {\n break;\n }\n } else {\n zeroBitPlanesTree.incrementValue();\n }\n }\n\n codeblock.zeroBitPlanes = zeroBitPlanesTree.value;\n }\n\n var codingpasses = readCodingpasses();\n\n while (readBits(1)) {\n codeblock.Lblock++;\n }\n\n var codingpassesLog2 = (0, _core_utils.log2)(codingpasses);\n var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;\n var codedDataLength = readBits(bits);\n queue.push({\n codeblock,\n codingpasses,\n dataLength: codedDataLength\n });\n }\n\n alignToByte();\n\n if (ephMarkerUsed) {\n skipMarkerIfEqual(0x92);\n }\n\n while (queue.length > 0) {\n var packetItem = queue.shift();\n codeblock = packetItem.codeblock;\n\n if (codeblock[\"data\"] === undefined) {\n codeblock.data = [];\n }\n\n codeblock.data.push({\n data,\n start: offset + position,\n end: offset + position + packetItem.dataLength,\n codingpasses: packetItem.codingpasses\n });\n position += packetItem.dataLength;\n }\n }\n\n return position;\n }\n\n function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {\n var x0 = subband.tbx0;\n var y0 = subband.tby0;\n var width = subband.tbx1 - subband.tbx0;\n var codeblocks = subband.codeblocks;\n var right = subband.type.charAt(0) === \"H\" ? 1 : 0;\n var bottom = subband.type.charAt(1) === \"H\" ? levelWidth : 0;\n\n for (var i = 0, ii = codeblocks.length; i < ii; ++i) {\n var codeblock = codeblocks[i];\n var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;\n var blockHeight = codeblock.tby1_ - codeblock.tby0_;\n\n if (blockWidth === 0 || blockHeight === 0) {\n continue;\n }\n\n if (codeblock[\"data\"] === undefined) {\n continue;\n }\n\n var bitModel, currentCodingpassType;\n bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);\n currentCodingpassType = 2;\n var data = codeblock.data,\n totalLength = 0,\n codingpasses = 0;\n var j, jj, dataItem;\n\n for (j = 0, jj = data.length; j < jj; j++) {\n dataItem = data[j];\n totalLength += dataItem.end - dataItem.start;\n codingpasses += dataItem.codingpasses;\n }\n\n var encodedData = new Uint8Array(totalLength);\n var position = 0;\n\n for (j = 0, jj = data.length; j < jj; j++) {\n dataItem = data[j];\n var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);\n encodedData.set(chunk, position);\n position += chunk.length;\n }\n\n var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);\n bitModel.setDecoder(decoder);\n\n for (j = 0; j < codingpasses; j++) {\n switch (currentCodingpassType) {\n case 0:\n bitModel.runSignificancePropagationPass();\n break;\n\n case 1:\n bitModel.runMagnitudeRefinementPass();\n break;\n\n case 2:\n bitModel.runCleanupPass();\n\n if (segmentationSymbolUsed) {\n bitModel.checkSegmentationSymbol();\n }\n\n break;\n }\n\n currentCodingpassType = (currentCodingpassType + 1) % 3;\n }\n\n var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;\n var sign = bitModel.coefficentsSign;\n var magnitude = bitModel.coefficentsMagnitude;\n var bitsDecoded = bitModel.bitsDecoded;\n var magnitudeCorrection = reversible ? 0 : 0.5;\n var k, n, nb;\n position = 0;\n var interleave = subband.type !== \"LL\";\n\n for (j = 0; j < blockHeight; j++) {\n var row = offset / width | 0;\n var levelOffset = 2 * row * (levelWidth - width) + right + bottom;\n\n for (k = 0; k < blockWidth; k++) {\n n = magnitude[position];\n\n if (n !== 0) {\n n = (n + magnitudeCorrection) * delta;\n\n if (sign[position] !== 0) {\n n = -n;\n }\n\n nb = bitsDecoded[position];\n var pos = interleave ? levelOffset + (offset << 1) : offset;\n\n if (reversible && nb >= mb) {\n coefficients[pos] = n;\n } else {\n coefficients[pos] = n * (1 << mb - nb);\n }\n }\n\n offset++;\n position++;\n }\n\n offset += width - blockWidth;\n }\n }\n }\n\n function transformTile(context, tile, c) {\n var component = tile.components[c];\n var codingStyleParameters = component.codingStyleParameters;\n var quantizationParameters = component.quantizationParameters;\n var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;\n var spqcds = quantizationParameters.SPqcds;\n var scalarExpounded = quantizationParameters.scalarExpounded;\n var guardBits = quantizationParameters.guardBits;\n var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;\n var precision = context.components[c].precision;\n var reversible = codingStyleParameters.reversibleTransformation;\n var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();\n var subbandCoefficients = [];\n var b = 0;\n\n for (var i = 0; i <= decompositionLevelsCount; i++) {\n var resolution = component.resolutions[i];\n var width = resolution.trx1 - resolution.trx0;\n var height = resolution.try1 - resolution.try0;\n var coefficients = new Float32Array(width * height);\n\n for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {\n var mu, epsilon;\n\n if (!scalarExpounded) {\n mu = spqcds[0].mu;\n epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);\n } else {\n mu = spqcds[b].mu;\n epsilon = spqcds[b].epsilon;\n b++;\n }\n\n var subband = resolution.subbands[j];\n var gainLog2 = SubbandsGainLog2[subband.type];\n var delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);\n var mb = guardBits + epsilon - 1;\n copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);\n }\n\n subbandCoefficients.push({\n width,\n height,\n items: coefficients\n });\n }\n\n var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);\n return {\n left: component.tcx0,\n top: component.tcy0,\n width: result.width,\n height: result.height,\n items: result.items\n };\n }\n\n function transformComponents(context) {\n var siz = context.SIZ;\n var components = context.components;\n var componentsCount = siz.Csiz;\n var resultImages = [];\n\n for (var i = 0, ii = context.tiles.length; i < ii; i++) {\n var tile = context.tiles[i];\n var transformedTiles = [];\n var c;\n\n for (c = 0; c < componentsCount; c++) {\n transformedTiles[c] = transformTile(context, tile, c);\n }\n\n var tile0 = transformedTiles[0];\n var out = new Uint8ClampedArray(tile0.items.length * componentsCount);\n var result = {\n left: tile0.left,\n top: tile0.top,\n width: tile0.width,\n height: tile0.height,\n items: out\n };\n var shift, offset;\n var pos = 0,\n j,\n jj,\n y0,\n y1,\n y2;\n\n if (tile.codingStyleDefaultParameters.multipleComponentTransform) {\n var fourComponents = componentsCount === 4;\n var y0items = transformedTiles[0].items;\n var y1items = transformedTiles[1].items;\n var y2items = transformedTiles[2].items;\n var y3items = fourComponents ? transformedTiles[3].items : null;\n shift = components[0].precision - 8;\n offset = (128 << shift) + 0.5;\n var component0 = tile.components[0];\n var alpha01 = componentsCount - 3;\n jj = y0items.length;\n\n if (!component0.codingStyleParameters.reversibleTransformation) {\n for (j = 0; j < jj; j++, pos += alpha01) {\n y0 = y0items[j] + offset;\n y1 = y1items[j];\n y2 = y2items[j];\n out[pos++] = y0 + 1.402 * y2 >> shift;\n out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;\n out[pos++] = y0 + 1.772 * y1 >> shift;\n }\n } else {\n for (j = 0; j < jj; j++, pos += alpha01) {\n y0 = y0items[j] + offset;\n y1 = y1items[j];\n y2 = y2items[j];\n const g = y0 - (y2 + y1 >> 2);\n out[pos++] = g + y2 >> shift;\n out[pos++] = g >> shift;\n out[pos++] = g + y1 >> shift;\n }\n }\n\n if (fourComponents) {\n for (j = 0, pos = 3; j < jj; j++, pos += 4) {\n out[pos] = y3items[j] + offset >> shift;\n }\n }\n } else {\n for (c = 0; c < componentsCount; c++) {\n var items = transformedTiles[c].items;\n shift = components[c].precision - 8;\n offset = (128 << shift) + 0.5;\n\n for (pos = c, j = 0, jj = items.length; j < jj; j++) {\n out[pos] = items[j] + offset >> shift;\n pos += componentsCount;\n }\n }\n }\n\n resultImages.push(result);\n }\n\n return resultImages;\n }\n\n function initializeTile(context, tileIndex) {\n var siz = context.SIZ;\n var componentsCount = siz.Csiz;\n var tile = context.tiles[tileIndex];\n\n for (var c = 0; c < componentsCount; c++) {\n var component = tile.components[c];\n var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;\n component.quantizationParameters = qcdOrQcc;\n var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;\n component.codingStyleParameters = codOrCoc;\n }\n\n tile.codingStyleDefaultParameters = context.currentTile.COD;\n }\n\n var TagTree = function TagTreeClosure() {\n function TagTree(width, height) {\n var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;\n this.levels = [];\n\n for (var i = 0; i < levelsLength; i++) {\n var level = {\n width,\n height,\n items: []\n };\n this.levels.push(level);\n width = Math.ceil(width / 2);\n height = Math.ceil(height / 2);\n }\n }\n\n TagTree.prototype = {\n reset: function TagTree_reset(i, j) {\n var currentLevel = 0,\n value = 0,\n level;\n\n while (currentLevel < this.levels.length) {\n level = this.levels[currentLevel];\n var index = i + j * level.width;\n\n if (level.items[index] !== undefined) {\n value = level.items[index];\n break;\n }\n\n level.index = index;\n i >>= 1;\n j >>= 1;\n currentLevel++;\n }\n\n currentLevel--;\n level = this.levels[currentLevel];\n level.items[level.index] = value;\n this.currentLevel = currentLevel;\n delete this.value;\n },\n incrementValue: function TagTree_incrementValue() {\n var level = this.levels[this.currentLevel];\n level.items[level.index]++;\n },\n nextLevel: function TagTree_nextLevel() {\n var currentLevel = this.currentLevel;\n var level = this.levels[currentLevel];\n var value = level.items[level.index];\n currentLevel--;\n\n if (currentLevel < 0) {\n this.value = value;\n return false;\n }\n\n this.currentLevel = currentLevel;\n level = this.levels[currentLevel];\n level.items[level.index] = value;\n return true;\n }\n };\n return TagTree;\n }();\n\n var InclusionTree = function InclusionTreeClosure() {\n function InclusionTree(width, height, defaultValue) {\n var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;\n this.levels = [];\n\n for (var i = 0; i < levelsLength; i++) {\n var items = new Uint8Array(width * height);\n\n for (var j = 0, jj = items.length; j < jj; j++) {\n items[j] = defaultValue;\n }\n\n var level = {\n width,\n height,\n items\n };\n this.levels.push(level);\n width = Math.ceil(width / 2);\n height = Math.ceil(height / 2);\n }\n }\n\n InclusionTree.prototype = {\n reset: function InclusionTree_reset(i, j, stopValue) {\n var currentLevel = 0;\n\n while (currentLevel < this.levels.length) {\n var level = this.levels[currentLevel];\n var index = i + j * level.width;\n level.index = index;\n var value = level.items[index];\n\n if (value === 0xff) {\n break;\n }\n\n if (value > stopValue) {\n this.currentLevel = currentLevel;\n this.propagateValues();\n return false;\n }\n\n i >>= 1;\n j >>= 1;\n currentLevel++;\n }\n\n this.currentLevel = currentLevel - 1;\n return true;\n },\n incrementValue: function InclusionTree_incrementValue(stopValue) {\n var level = this.levels[this.currentLevel];\n level.items[level.index] = stopValue + 1;\n this.propagateValues();\n },\n propagateValues: function InclusionTree_propagateValues() {\n var levelIndex = this.currentLevel;\n var level = this.levels[levelIndex];\n var currentValue = level.items[level.index];\n\n while (--levelIndex >= 0) {\n level = this.levels[levelIndex];\n level.items[level.index] = currentValue;\n }\n },\n nextLevel: function InclusionTree_nextLevel() {\n var currentLevel = this.currentLevel;\n var level = this.levels[currentLevel];\n var value = level.items[level.index];\n level.items[level.index] = 0xff;\n currentLevel--;\n\n if (currentLevel < 0) {\n return false;\n }\n\n this.currentLevel = currentLevel;\n level = this.levels[currentLevel];\n level.items[level.index] = value;\n return true;\n }\n };\n return InclusionTree;\n }();\n\n var BitModel = function BitModelClosure() {\n var UNIFORM_CONTEXT = 17;\n var RUNLENGTH_CONTEXT = 18;\n var LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]);\n var HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]);\n var HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]);\n\n function BitModel(width, height, subband, zeroBitPlanes, mb) {\n this.width = width;\n this.height = height;\n let contextLabelTable;\n\n if (subband === \"HH\") {\n contextLabelTable = HHContextLabel;\n } else if (subband === \"HL\") {\n contextLabelTable = HLContextLabel;\n } else {\n contextLabelTable = LLAndLHContextsLabel;\n }\n\n this.contextLabelTable = contextLabelTable;\n var coefficientCount = width * height;\n this.neighborsSignificance = new Uint8Array(coefficientCount);\n this.coefficentsSign = new Uint8Array(coefficientCount);\n let coefficentsMagnitude;\n\n if (mb > 14) {\n coefficentsMagnitude = new Uint32Array(coefficientCount);\n } else if (mb > 6) {\n coefficentsMagnitude = new Uint16Array(coefficientCount);\n } else {\n coefficentsMagnitude = new Uint8Array(coefficientCount);\n }\n\n this.coefficentsMagnitude = coefficentsMagnitude;\n this.processingFlags = new Uint8Array(coefficientCount);\n var bitsDecoded = new Uint8Array(coefficientCount);\n\n if (zeroBitPlanes !== 0) {\n for (var i = 0; i < coefficientCount; i++) {\n bitsDecoded[i] = zeroBitPlanes;\n }\n }\n\n this.bitsDecoded = bitsDecoded;\n this.reset();\n }\n\n BitModel.prototype = {\n setDecoder: function BitModel_setDecoder(decoder) {\n this.decoder = decoder;\n },\n reset: function BitModel_reset() {\n this.contexts = new Int8Array(19);\n this.contexts[0] = 4 << 1 | 0;\n this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;\n this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;\n },\n setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {\n var neighborsSignificance = this.neighborsSignificance;\n var width = this.width,\n height = this.height;\n var left = column > 0;\n var right = column + 1 < width;\n var i;\n\n if (row > 0) {\n i = index - width;\n\n if (left) {\n neighborsSignificance[i - 1] += 0x10;\n }\n\n if (right) {\n neighborsSignificance[i + 1] += 0x10;\n }\n\n neighborsSignificance[i] += 0x04;\n }\n\n if (row + 1 < height) {\n i = index + width;\n\n if (left) {\n neighborsSignificance[i - 1] += 0x10;\n }\n\n if (right) {\n neighborsSignificance[i + 1] += 0x10;\n }\n\n neighborsSignificance[i] += 0x04;\n }\n\n if (left) {\n neighborsSignificance[index - 1] += 0x01;\n }\n\n if (right) {\n neighborsSignificance[index + 1] += 0x01;\n }\n\n neighborsSignificance[index] |= 0x80;\n },\n runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {\n var decoder = this.decoder;\n var width = this.width,\n height = this.height;\n var coefficentsMagnitude = this.coefficentsMagnitude;\n var coefficentsSign = this.coefficentsSign;\n var neighborsSignificance = this.neighborsSignificance;\n var processingFlags = this.processingFlags;\n var contexts = this.contexts;\n var labels = this.contextLabelTable;\n var bitsDecoded = this.bitsDecoded;\n var processedInverseMask = ~1;\n var processedMask = 1;\n var firstMagnitudeBitMask = 2;\n\n for (var i0 = 0; i0 < height; i0 += 4) {\n for (var j = 0; j < width; j++) {\n var index = i0 * width + j;\n\n for (var i1 = 0; i1 < 4; i1++, index += width) {\n var i = i0 + i1;\n\n if (i >= height) {\n break;\n }\n\n processingFlags[index] &= processedInverseMask;\n\n if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {\n continue;\n }\n\n var contextLabel = labels[neighborsSignificance[index]];\n var decision = decoder.readBit(contexts, contextLabel);\n\n if (decision) {\n var sign = this.decodeSignBit(i, j, index);\n coefficentsSign[index] = sign;\n coefficentsMagnitude[index] = 1;\n this.setNeighborsSignificance(i, j, index);\n processingFlags[index] |= firstMagnitudeBitMask;\n }\n\n bitsDecoded[index]++;\n processingFlags[index] |= processedMask;\n }\n }\n }\n },\n decodeSignBit: function BitModel_decodeSignBit(row, column, index) {\n var width = this.width,\n height = this.height;\n var coefficentsMagnitude = this.coefficentsMagnitude;\n var coefficentsSign = this.coefficentsSign;\n var contribution, sign0, sign1, significance1;\n var contextLabel, decoded;\n significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;\n\n if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {\n sign1 = coefficentsSign[index + 1];\n\n if (significance1) {\n sign0 = coefficentsSign[index - 1];\n contribution = 1 - sign1 - sign0;\n } else {\n contribution = 1 - sign1 - sign1;\n }\n } else if (significance1) {\n sign0 = coefficentsSign[index - 1];\n contribution = 1 - sign0 - sign0;\n } else {\n contribution = 0;\n }\n\n var horizontalContribution = 3 * contribution;\n significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;\n\n if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {\n sign1 = coefficentsSign[index + width];\n\n if (significance1) {\n sign0 = coefficentsSign[index - width];\n contribution = 1 - sign1 - sign0 + horizontalContribution;\n } else {\n contribution = 1 - sign1 - sign1 + horizontalContribution;\n }\n } else if (significance1) {\n sign0 = coefficentsSign[index - width];\n contribution = 1 - sign0 - sign0 + horizontalContribution;\n } else {\n contribution = horizontalContribution;\n }\n\n if (contribution >= 0) {\n contextLabel = 9 + contribution;\n decoded = this.decoder.readBit(this.contexts, contextLabel);\n } else {\n contextLabel = 9 - contribution;\n decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;\n }\n\n return decoded;\n },\n runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {\n var decoder = this.decoder;\n var width = this.width,\n height = this.height;\n var coefficentsMagnitude = this.coefficentsMagnitude;\n var neighborsSignificance = this.neighborsSignificance;\n var contexts = this.contexts;\n var bitsDecoded = this.bitsDecoded;\n var processingFlags = this.processingFlags;\n var processedMask = 1;\n var firstMagnitudeBitMask = 2;\n var length = width * height;\n var width4 = width * 4;\n\n for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {\n indexNext = Math.min(length, index0 + width4);\n\n for (var j = 0; j < width; j++) {\n for (var index = index0 + j; index < indexNext; index += width) {\n if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {\n continue;\n }\n\n var contextLabel = 16;\n\n if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {\n processingFlags[index] ^= firstMagnitudeBitMask;\n var significance = neighborsSignificance[index] & 127;\n contextLabel = significance === 0 ? 15 : 14;\n }\n\n var bit = decoder.readBit(contexts, contextLabel);\n coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;\n bitsDecoded[index]++;\n processingFlags[index] |= processedMask;\n }\n }\n }\n },\n runCleanupPass: function BitModel_runCleanupPass() {\n var decoder = this.decoder;\n var width = this.width,\n height = this.height;\n var neighborsSignificance = this.neighborsSignificance;\n var coefficentsMagnitude = this.coefficentsMagnitude;\n var coefficentsSign = this.coefficentsSign;\n var contexts = this.contexts;\n var labels = this.contextLabelTable;\n var bitsDecoded = this.bitsDecoded;\n var processingFlags = this.processingFlags;\n var processedMask = 1;\n var firstMagnitudeBitMask = 2;\n var oneRowDown = width;\n var twoRowsDown = width * 2;\n var threeRowsDown = width * 3;\n var iNext;\n\n for (var i0 = 0; i0 < height; i0 = iNext) {\n iNext = Math.min(i0 + 4, height);\n var indexBase = i0 * width;\n var checkAllEmpty = i0 + 3 < height;\n\n for (var j = 0; j < width; j++) {\n var index0 = indexBase + j;\n var allEmpty = checkAllEmpty && processingFlags[index0] === 0 && processingFlags[index0 + oneRowDown] === 0 && processingFlags[index0 + twoRowsDown] === 0 && processingFlags[index0 + threeRowsDown] === 0 && neighborsSignificance[index0] === 0 && neighborsSignificance[index0 + oneRowDown] === 0 && neighborsSignificance[index0 + twoRowsDown] === 0 && neighborsSignificance[index0 + threeRowsDown] === 0;\n var i1 = 0,\n index = index0;\n var i = i0,\n sign;\n\n if (allEmpty) {\n var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);\n\n if (!hasSignificantCoefficent) {\n bitsDecoded[index0]++;\n bitsDecoded[index0 + oneRowDown]++;\n bitsDecoded[index0 + twoRowsDown]++;\n bitsDecoded[index0 + threeRowsDown]++;\n continue;\n }\n\n i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);\n\n if (i1 !== 0) {\n i = i0 + i1;\n index += i1 * width;\n }\n\n sign = this.decodeSignBit(i, j, index);\n coefficentsSign[index] = sign;\n coefficentsMagnitude[index] = 1;\n this.setNeighborsSignificance(i, j, index);\n processingFlags[index] |= firstMagnitudeBitMask;\n index = index0;\n\n for (var i2 = i0; i2 <= i; i2++, index += width) {\n bitsDecoded[index]++;\n }\n\n i1++;\n }\n\n for (i = i0 + i1; i < iNext; i++, index += width) {\n if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {\n continue;\n }\n\n var contextLabel = labels[neighborsSignificance[index]];\n var decision = decoder.readBit(contexts, contextLabel);\n\n if (decision === 1) {\n sign = this.decodeSignBit(i, j, index);\n coefficentsSign[index] = sign;\n coefficentsMagnitude[index] = 1;\n this.setNeighborsSignificance(i, j, index);\n processingFlags[index] |= firstMagnitudeBitMask;\n }\n\n bitsDecoded[index]++;\n }\n }\n }\n },\n checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {\n var decoder = this.decoder;\n var contexts = this.contexts;\n var symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);\n\n if (symbol !== 0xa) {\n throw new JpxError(\"Invalid segmentation symbol\");\n }\n }\n };\n return BitModel;\n }();\n\n var Transform = function TransformClosure() {\n function Transform() {}\n\n Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {\n var ll = subbands[0];\n\n for (var i = 1, ii = subbands.length; i < ii; i++) {\n ll = this.iterate(ll, subbands[i], u0, v0);\n }\n\n return ll;\n };\n\n Transform.prototype.extend = function extend(buffer, offset, size) {\n var i1 = offset - 1,\n j1 = offset + 1;\n var i2 = offset + size - 2,\n j2 = offset + size;\n buffer[i1--] = buffer[j1++];\n buffer[j2++] = buffer[i2--];\n buffer[i1--] = buffer[j1++];\n buffer[j2++] = buffer[i2--];\n buffer[i1--] = buffer[j1++];\n buffer[j2++] = buffer[i2--];\n buffer[i1] = buffer[j1];\n buffer[j2] = buffer[i2];\n };\n\n Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {\n var llWidth = ll.width,\n llHeight = ll.height,\n llItems = ll.items;\n var width = hl_lh_hh.width;\n var height = hl_lh_hh.height;\n var items = hl_lh_hh.items;\n var i, j, k, l, u, v;\n\n for (k = 0, i = 0; i < llHeight; i++) {\n l = i * 2 * width;\n\n for (j = 0; j < llWidth; j++, k++, l += 2) {\n items[l] = llItems[k];\n }\n }\n\n llItems = ll.items = null;\n var bufferPadding = 4;\n var rowBuffer = new Float32Array(width + 2 * bufferPadding);\n\n if (width === 1) {\n if ((u0 & 1) !== 0) {\n for (v = 0, k = 0; v < height; v++, k += width) {\n items[k] *= 0.5;\n }\n }\n } else {\n for (v = 0, k = 0; v < height; v++, k += width) {\n rowBuffer.set(items.subarray(k, k + width), bufferPadding);\n this.extend(rowBuffer, bufferPadding, width);\n this.filter(rowBuffer, bufferPadding, width);\n items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);\n }\n }\n\n var numBuffers = 16;\n var colBuffers = [];\n\n for (i = 0; i < numBuffers; i++) {\n colBuffers.push(new Float32Array(height + 2 * bufferPadding));\n }\n\n var b,\n currentBuffer = 0;\n ll = bufferPadding + height;\n\n if (height === 1) {\n if ((v0 & 1) !== 0) {\n for (u = 0; u < width; u++) {\n items[u] *= 0.5;\n }\n }\n } else {\n for (u = 0; u < width; u++) {\n if (currentBuffer === 0) {\n numBuffers = Math.min(width - u, numBuffers);\n\n for (k = u, l = bufferPadding; l < ll; k += width, l++) {\n for (b = 0; b < numBuffers; b++) {\n colBuffers[b][l] = items[k + b];\n }\n }\n\n currentBuffer = numBuffers;\n }\n\n currentBuffer--;\n var buffer = colBuffers[currentBuffer];\n this.extend(buffer, bufferPadding, height);\n this.filter(buffer, bufferPadding, height);\n\n if (currentBuffer === 0) {\n k = u - numBuffers + 1;\n\n for (l = bufferPadding; l < ll; k += width, l++) {\n for (b = 0; b < numBuffers; b++) {\n items[k + b] = colBuffers[b][l];\n }\n }\n }\n }\n }\n\n return {\n width,\n height,\n items\n };\n };\n\n return Transform;\n }();\n\n var IrreversibleTransform = function IrreversibleTransformClosure() {\n function IrreversibleTransform() {\n Transform.call(this);\n }\n\n IrreversibleTransform.prototype = Object.create(Transform.prototype);\n\n IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {\n var len = length >> 1;\n offset = offset | 0;\n var j, n, current, next;\n var alpha = -1.586134342059924;\n var beta = -0.052980118572961;\n var gamma = 0.882911075530934;\n var delta = 0.443506852043971;\n var K = 1.230174104914001;\n var K_ = 1 / K;\n j = offset - 3;\n\n for (n = len + 4; n--; j += 2) {\n x[j] *= K_;\n }\n\n j = offset - 2;\n current = delta * x[j - 1];\n\n for (n = len + 3; n--; j += 2) {\n next = delta * x[j + 1];\n x[j] = K * x[j] - current - next;\n\n if (n--) {\n j += 2;\n current = delta * x[j + 1];\n x[j] = K * x[j] - current - next;\n } else {\n break;\n }\n }\n\n j = offset - 1;\n current = gamma * x[j - 1];\n\n for (n = len + 2; n--; j += 2) {\n next = gamma * x[j + 1];\n x[j] -= current + next;\n\n if (n--) {\n j += 2;\n current = gamma * x[j + 1];\n x[j] -= current + next;\n } else {\n break;\n }\n }\n\n j = offset;\n current = beta * x[j - 1];\n\n for (n = len + 1; n--; j += 2) {\n next = beta * x[j + 1];\n x[j] -= current + next;\n\n if (n--) {\n j += 2;\n current = beta * x[j + 1];\n x[j] -= current + next;\n } else {\n break;\n }\n }\n\n if (len !== 0) {\n j = offset + 1;\n current = alpha * x[j - 1];\n\n for (n = len; n--; j += 2) {\n next = alpha * x[j + 1];\n x[j] -= current + next;\n\n if (n--) {\n j += 2;\n current = alpha * x[j + 1];\n x[j] -= current + next;\n } else {\n break;\n }\n }\n }\n };\n\n return IrreversibleTransform;\n }();\n\n var ReversibleTransform = function ReversibleTransformClosure() {\n function ReversibleTransform() {\n Transform.call(this);\n }\n\n ReversibleTransform.prototype = Object.create(Transform.prototype);\n\n ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {\n var len = length >> 1;\n offset = offset | 0;\n var j, n;\n\n for (j = offset, n = len + 1; n--; j += 2) {\n x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;\n }\n\n for (j = offset + 1, n = len; n--; j += 2) {\n x[j] += x[j - 1] + x[j + 1] >> 1;\n }\n };\n\n return ReversibleTransform;\n }();\n\n return JpxImage;\n}();\n\nexports.JpxImage = JpxImage;\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _stream = __w_pdfjs_require__(11);\n\nvar ARCFourCipher = function ARCFourCipherClosure() {\n function ARCFourCipher(key) {\n this.a = 0;\n this.b = 0;\n var s = new Uint8Array(256);\n var i,\n j = 0,\n tmp,\n keyLength = key.length;\n\n for (i = 0; i < 256; ++i) {\n s[i] = i;\n }\n\n for (i = 0; i < 256; ++i) {\n tmp = s[i];\n j = j + tmp + key[i % keyLength] & 0xff;\n s[i] = s[j];\n s[j] = tmp;\n }\n\n this.s = s;\n }\n\n ARCFourCipher.prototype = {\n encryptBlock: function ARCFourCipher_encryptBlock(data) {\n var i,\n n = data.length,\n tmp,\n tmp2;\n var a = this.a,\n b = this.b,\n s = this.s;\n var output = new Uint8Array(n);\n\n for (i = 0; i < n; ++i) {\n a = a + 1 & 0xff;\n tmp = s[a];\n b = b + tmp & 0xff;\n tmp2 = s[b];\n s[a] = tmp2;\n s[b] = tmp;\n output[i] = data[i] ^ s[tmp + tmp2 & 0xff];\n }\n\n this.a = a;\n this.b = b;\n return output;\n }\n };\n ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;\n return ARCFourCipher;\n}();\n\nexports.ARCFourCipher = ARCFourCipher;\n\nvar calculateMD5 = function calculateMD5Closure() {\n var r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]);\n var k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]);\n\n function hash(data, offset, length) {\n var h0 = 1732584193,\n h1 = -271733879,\n h2 = -1732584194,\n h3 = 271733878;\n var paddedLength = length + 72 & ~63;\n var padded = new Uint8Array(paddedLength);\n var i, j, n;\n\n for (i = 0; i < length; ++i) {\n padded[i] = data[offset++];\n }\n\n padded[i++] = 0x80;\n n = paddedLength - 8;\n\n while (i < n) {\n padded[i++] = 0;\n }\n\n padded[i++] = length << 3 & 0xff;\n padded[i++] = length >> 5 & 0xff;\n padded[i++] = length >> 13 & 0xff;\n padded[i++] = length >> 21 & 0xff;\n padded[i++] = length >>> 29 & 0xff;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n var w = new Int32Array(16);\n\n for (i = 0; i < paddedLength;) {\n for (j = 0; j < 16; ++j, i += 4) {\n w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;\n }\n\n var a = h0,\n b = h1,\n c = h2,\n d = h3,\n f,\n g;\n\n for (j = 0; j < 64; ++j) {\n if (j < 16) {\n f = b & c | ~b & d;\n g = j;\n } else if (j < 32) {\n f = d & b | ~d & c;\n g = 5 * j + 1 & 15;\n } else if (j < 48) {\n f = b ^ c ^ d;\n g = 3 * j + 5 & 15;\n } else {\n f = c ^ (b | ~d);\n g = 7 * j & 15;\n }\n\n var tmp = d,\n rotateArg = a + f + k[j] + w[g] | 0,\n rotate = r[j];\n d = c;\n c = b;\n b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;\n a = tmp;\n }\n\n h0 = h0 + a | 0;\n h1 = h1 + b | 0;\n h2 = h2 + c | 0;\n h3 = h3 + d | 0;\n }\n\n return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]);\n }\n\n return hash;\n}();\n\nexports.calculateMD5 = calculateMD5;\n\nvar Word64 = function Word64Closure() {\n function Word64(highInteger, lowInteger) {\n this.high = highInteger | 0;\n this.low = lowInteger | 0;\n }\n\n Word64.prototype = {\n and: function Word64_and(word) {\n this.high &= word.high;\n this.low &= word.low;\n },\n xor: function Word64_xor(word) {\n this.high ^= word.high;\n this.low ^= word.low;\n },\n or: function Word64_or(word) {\n this.high |= word.high;\n this.low |= word.low;\n },\n shiftRight: function Word64_shiftRight(places) {\n if (places >= 32) {\n this.low = this.high >>> places - 32 | 0;\n this.high = 0;\n } else {\n this.low = this.low >>> places | this.high << 32 - places;\n this.high = this.high >>> places | 0;\n }\n },\n shiftLeft: function Word64_shiftLeft(places) {\n if (places >= 32) {\n this.high = this.low << places - 32;\n this.low = 0;\n } else {\n this.high = this.high << places | this.low >>> 32 - places;\n this.low = this.low << places;\n }\n },\n rotateRight: function Word64_rotateRight(places) {\n var low, high;\n\n if (places & 32) {\n high = this.low;\n low = this.high;\n } else {\n low = this.low;\n high = this.high;\n }\n\n places &= 31;\n this.low = low >>> places | high << 32 - places;\n this.high = high >>> places | low << 32 - places;\n },\n not: function Word64_not() {\n this.high = ~this.high;\n this.low = ~this.low;\n },\n add: function Word64_add(word) {\n var lowAdd = (this.low >>> 0) + (word.low >>> 0);\n var highAdd = (this.high >>> 0) + (word.high >>> 0);\n\n if (lowAdd > 0xffffffff) {\n highAdd += 1;\n }\n\n this.low = lowAdd | 0;\n this.high = highAdd | 0;\n },\n copyTo: function Word64_copyTo(bytes, offset) {\n bytes[offset] = this.high >>> 24 & 0xff;\n bytes[offset + 1] = this.high >> 16 & 0xff;\n bytes[offset + 2] = this.high >> 8 & 0xff;\n bytes[offset + 3] = this.high & 0xff;\n bytes[offset + 4] = this.low >>> 24 & 0xff;\n bytes[offset + 5] = this.low >> 16 & 0xff;\n bytes[offset + 6] = this.low >> 8 & 0xff;\n bytes[offset + 7] = this.low & 0xff;\n },\n assign: function Word64_assign(word) {\n this.high = word.high;\n this.low = word.low;\n }\n };\n return Word64;\n}();\n\nvar calculateSHA256 = function calculateSHA256Closure() {\n function rotr(x, n) {\n return x >>> n | x << 32 - n;\n }\n\n function ch(x, y, z) {\n return x & y ^ ~x & z;\n }\n\n function maj(x, y, z) {\n return x & y ^ x & z ^ y & z;\n }\n\n function sigma(x) {\n return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);\n }\n\n function sigmaPrime(x) {\n return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);\n }\n\n function littleSigma(x) {\n return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;\n }\n\n function littleSigmaPrime(x) {\n return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;\n }\n\n var k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];\n\n function hash(data, offset, length) {\n var h0 = 0x6a09e667,\n h1 = 0xbb67ae85,\n h2 = 0x3c6ef372,\n h3 = 0xa54ff53a,\n h4 = 0x510e527f,\n h5 = 0x9b05688c,\n h6 = 0x1f83d9ab,\n h7 = 0x5be0cd19;\n var paddedLength = Math.ceil((length + 9) / 64) * 64;\n var padded = new Uint8Array(paddedLength);\n var i, j, n;\n\n for (i = 0; i < length; ++i) {\n padded[i] = data[offset++];\n }\n\n padded[i++] = 0x80;\n n = paddedLength - 8;\n\n while (i < n) {\n padded[i++] = 0;\n }\n\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = length >>> 29 & 0xff;\n padded[i++] = length >> 21 & 0xff;\n padded[i++] = length >> 13 & 0xff;\n padded[i++] = length >> 5 & 0xff;\n padded[i++] = length << 3 & 0xff;\n var w = new Uint32Array(64);\n\n for (i = 0; i < paddedLength;) {\n for (j = 0; j < 16; ++j) {\n w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];\n i += 4;\n }\n\n for (j = 16; j < 64; ++j) {\n w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;\n }\n\n var a = h0,\n b = h1,\n c = h2,\n d = h3,\n e = h4,\n f = h5,\n g = h6,\n h = h7,\n t1,\n t2;\n\n for (j = 0; j < 64; ++j) {\n t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];\n t2 = sigma(a) + maj(a, b, c);\n h = g;\n g = f;\n f = e;\n e = d + t1 | 0;\n d = c;\n c = b;\n b = a;\n a = t1 + t2 | 0;\n }\n\n h0 = h0 + a | 0;\n h1 = h1 + b | 0;\n h2 = h2 + c | 0;\n h3 = h3 + d | 0;\n h4 = h4 + e | 0;\n h5 = h5 + f | 0;\n h6 = h6 + g | 0;\n h7 = h7 + h | 0;\n }\n\n return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]);\n }\n\n return hash;\n}();\n\nexports.calculateSHA256 = calculateSHA256;\n\nvar calculateSHA512 = function calculateSHA512Closure() {\n function ch(result, x, y, z, tmp) {\n result.assign(x);\n result.and(y);\n tmp.assign(x);\n tmp.not();\n tmp.and(z);\n result.xor(tmp);\n }\n\n function maj(result, x, y, z, tmp) {\n result.assign(x);\n result.and(y);\n tmp.assign(x);\n tmp.and(z);\n result.xor(tmp);\n tmp.assign(y);\n tmp.and(z);\n result.xor(tmp);\n }\n\n function sigma(result, x, tmp) {\n result.assign(x);\n result.rotateRight(28);\n tmp.assign(x);\n tmp.rotateRight(34);\n result.xor(tmp);\n tmp.assign(x);\n tmp.rotateRight(39);\n result.xor(tmp);\n }\n\n function sigmaPrime(result, x, tmp) {\n result.assign(x);\n result.rotateRight(14);\n tmp.assign(x);\n tmp.rotateRight(18);\n result.xor(tmp);\n tmp.assign(x);\n tmp.rotateRight(41);\n result.xor(tmp);\n }\n\n function littleSigma(result, x, tmp) {\n result.assign(x);\n result.rotateRight(1);\n tmp.assign(x);\n tmp.rotateRight(8);\n result.xor(tmp);\n tmp.assign(x);\n tmp.shiftRight(7);\n result.xor(tmp);\n }\n\n function littleSigmaPrime(result, x, tmp) {\n result.assign(x);\n result.rotateRight(19);\n tmp.assign(x);\n tmp.rotateRight(61);\n result.xor(tmp);\n tmp.assign(x);\n tmp.shiftRight(6);\n result.xor(tmp);\n }\n\n var k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)];\n\n function hash(data, offset, length, mode384) {\n mode384 = !!mode384;\n var h0, h1, h2, h3, h4, h5, h6, h7;\n\n if (!mode384) {\n h0 = new Word64(0x6a09e667, 0xf3bcc908);\n h1 = new Word64(0xbb67ae85, 0x84caa73b);\n h2 = new Word64(0x3c6ef372, 0xfe94f82b);\n h3 = new Word64(0xa54ff53a, 0x5f1d36f1);\n h4 = new Word64(0x510e527f, 0xade682d1);\n h5 = new Word64(0x9b05688c, 0x2b3e6c1f);\n h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);\n h7 = new Word64(0x5be0cd19, 0x137e2179);\n } else {\n h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);\n h1 = new Word64(0x629a292a, 0x367cd507);\n h2 = new Word64(0x9159015a, 0x3070dd17);\n h3 = new Word64(0x152fecd8, 0xf70e5939);\n h4 = new Word64(0x67332667, 0xffc00b31);\n h5 = new Word64(0x8eb44a87, 0x68581511);\n h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);\n h7 = new Word64(0x47b5481d, 0xbefa4fa4);\n }\n\n var paddedLength = Math.ceil((length + 17) / 128) * 128;\n var padded = new Uint8Array(paddedLength);\n var i, j, n;\n\n for (i = 0; i < length; ++i) {\n padded[i] = data[offset++];\n }\n\n padded[i++] = 0x80;\n n = paddedLength - 16;\n\n while (i < n) {\n padded[i++] = 0;\n }\n\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = 0;\n padded[i++] = length >>> 29 & 0xff;\n padded[i++] = length >> 21 & 0xff;\n padded[i++] = length >> 13 & 0xff;\n padded[i++] = length >> 5 & 0xff;\n padded[i++] = length << 3 & 0xff;\n var w = new Array(80);\n\n for (i = 0; i < 80; i++) {\n w[i] = new Word64(0, 0);\n }\n\n var a = new Word64(0, 0),\n b = new Word64(0, 0),\n c = new Word64(0, 0);\n var d = new Word64(0, 0),\n e = new Word64(0, 0),\n f = new Word64(0, 0);\n var g = new Word64(0, 0),\n h = new Word64(0, 0);\n var t1 = new Word64(0, 0),\n t2 = new Word64(0, 0);\n var tmp1 = new Word64(0, 0),\n tmp2 = new Word64(0, 0),\n tmp3;\n\n for (i = 0; i < paddedLength;) {\n for (j = 0; j < 16; ++j) {\n w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];\n w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];\n i += 8;\n }\n\n for (j = 16; j < 80; ++j) {\n tmp3 = w[j];\n littleSigmaPrime(tmp3, w[j - 2], tmp2);\n tmp3.add(w[j - 7]);\n littleSigma(tmp1, w[j - 15], tmp2);\n tmp3.add(tmp1);\n tmp3.add(w[j - 16]);\n }\n\n a.assign(h0);\n b.assign(h1);\n c.assign(h2);\n d.assign(h3);\n e.assign(h4);\n f.assign(h5);\n g.assign(h6);\n h.assign(h7);\n\n for (j = 0; j < 80; ++j) {\n t1.assign(h);\n sigmaPrime(tmp1, e, tmp2);\n t1.add(tmp1);\n ch(tmp1, e, f, g, tmp2);\n t1.add(tmp1);\n t1.add(k[j]);\n t1.add(w[j]);\n sigma(t2, a, tmp2);\n maj(tmp1, a, b, c, tmp2);\n t2.add(tmp1);\n tmp3 = h;\n h = g;\n g = f;\n f = e;\n d.add(t1);\n e = d;\n d = c;\n c = b;\n b = a;\n tmp3.assign(t1);\n tmp3.add(t2);\n a = tmp3;\n }\n\n h0.add(a);\n h1.add(b);\n h2.add(c);\n h3.add(d);\n h4.add(e);\n h5.add(f);\n h6.add(g);\n h7.add(h);\n }\n\n var result;\n\n if (!mode384) {\n result = new Uint8Array(64);\n h0.copyTo(result, 0);\n h1.copyTo(result, 8);\n h2.copyTo(result, 16);\n h3.copyTo(result, 24);\n h4.copyTo(result, 32);\n h5.copyTo(result, 40);\n h6.copyTo(result, 48);\n h7.copyTo(result, 56);\n } else {\n result = new Uint8Array(48);\n h0.copyTo(result, 0);\n h1.copyTo(result, 8);\n h2.copyTo(result, 16);\n h3.copyTo(result, 24);\n h4.copyTo(result, 32);\n h5.copyTo(result, 40);\n }\n\n return result;\n }\n\n return hash;\n}();\n\nexports.calculateSHA512 = calculateSHA512;\n\nvar calculateSHA384 = function calculateSHA384Closure() {\n function hash(data, offset, length) {\n return calculateSHA512(data, offset, length, true);\n }\n\n return hash;\n}();\n\nexports.calculateSHA384 = calculateSHA384;\n\nvar NullCipher = function NullCipherClosure() {\n function NullCipher() {}\n\n NullCipher.prototype = {\n decryptBlock: function NullCipher_decryptBlock(data) {\n return data;\n }\n };\n return NullCipher;\n}();\n\nclass AESBaseCipher {\n constructor() {\n if (this.constructor === AESBaseCipher) {\n (0, _util.unreachable)(\"Cannot initialize AESBaseCipher.\");\n }\n\n this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]);\n this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]);\n this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]);\n this._mixCol = new Uint8Array(256);\n\n for (let i = 0; i < 256; i++) {\n if (i < 128) {\n this._mixCol[i] = i << 1;\n } else {\n this._mixCol[i] = i << 1 ^ 0x1b;\n }\n }\n\n this.buffer = new Uint8Array(16);\n this.bufferPosition = 0;\n }\n\n _expandKey(cipherKey) {\n (0, _util.unreachable)(\"Cannot call `_expandKey` on the base class\");\n }\n\n _decrypt(input, key) {\n let t, u, v;\n const state = new Uint8Array(16);\n state.set(input);\n\n for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {\n state[j] ^= key[k];\n }\n\n for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {\n t = state[13];\n state[13] = state[9];\n state[9] = state[5];\n state[5] = state[1];\n state[1] = t;\n t = state[14];\n u = state[10];\n state[14] = state[6];\n state[10] = state[2];\n state[6] = t;\n state[2] = u;\n t = state[15];\n u = state[11];\n v = state[7];\n state[15] = state[3];\n state[11] = t;\n state[7] = u;\n state[3] = v;\n\n for (let j = 0; j < 16; ++j) {\n state[j] = this._inv_s[state[j]];\n }\n\n for (let j = 0, k = i * 16; j < 16; ++j, ++k) {\n state[j] ^= key[k];\n }\n\n for (let j = 0; j < 16; j += 4) {\n const s0 = this._mix[state[j]];\n const s1 = this._mix[state[j + 1]];\n const s2 = this._mix[state[j + 2]];\n const s3 = this._mix[state[j + 3]];\n t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;\n state[j] = t >>> 24 & 0xff;\n state[j + 1] = t >> 16 & 0xff;\n state[j + 2] = t >> 8 & 0xff;\n state[j + 3] = t & 0xff;\n }\n }\n\n t = state[13];\n state[13] = state[9];\n state[9] = state[5];\n state[5] = state[1];\n state[1] = t;\n t = state[14];\n u = state[10];\n state[14] = state[6];\n state[10] = state[2];\n state[6] = t;\n state[2] = u;\n t = state[15];\n u = state[11];\n v = state[7];\n state[15] = state[3];\n state[11] = t;\n state[7] = u;\n state[3] = v;\n\n for (let j = 0; j < 16; ++j) {\n state[j] = this._inv_s[state[j]];\n state[j] ^= key[j];\n }\n\n return state;\n }\n\n _encrypt(input, key) {\n const s = this._s;\n let t, u, v;\n const state = new Uint8Array(16);\n state.set(input);\n\n for (let j = 0; j < 16; ++j) {\n state[j] ^= key[j];\n }\n\n for (let i = 1; i < this._cyclesOfRepetition; i++) {\n for (let j = 0; j < 16; ++j) {\n state[j] = s[state[j]];\n }\n\n v = state[1];\n state[1] = state[5];\n state[5] = state[9];\n state[9] = state[13];\n state[13] = v;\n v = state[2];\n u = state[6];\n state[2] = state[10];\n state[6] = state[14];\n state[10] = v;\n state[14] = u;\n v = state[3];\n u = state[7];\n t = state[11];\n state[3] = state[15];\n state[7] = v;\n state[11] = u;\n state[15] = t;\n\n for (let j = 0; j < 16; j += 4) {\n const s0 = state[j + 0];\n const s1 = state[j + 1];\n const s2 = state[j + 2];\n const s3 = state[j + 3];\n t = s0 ^ s1 ^ s2 ^ s3;\n state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];\n state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];\n state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];\n state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];\n }\n\n for (let j = 0, k = i * 16; j < 16; ++j, ++k) {\n state[j] ^= key[k];\n }\n }\n\n for (let j = 0; j < 16; ++j) {\n state[j] = s[state[j]];\n }\n\n v = state[1];\n state[1] = state[5];\n state[5] = state[9];\n state[9] = state[13];\n state[13] = v;\n v = state[2];\n u = state[6];\n state[2] = state[10];\n state[6] = state[14];\n state[10] = v;\n state[14] = u;\n v = state[3];\n u = state[7];\n t = state[11];\n state[3] = state[15];\n state[7] = v;\n state[11] = u;\n state[15] = t;\n\n for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {\n state[j] ^= key[k];\n }\n\n return state;\n }\n\n _decryptBlock2(data, finalize) {\n const sourceLength = data.length;\n let buffer = this.buffer,\n bufferLength = this.bufferPosition;\n const result = [];\n let iv = this.iv;\n\n for (let i = 0; i < sourceLength; ++i) {\n buffer[bufferLength] = data[i];\n ++bufferLength;\n\n if (bufferLength < 16) {\n continue;\n }\n\n const plain = this._decrypt(buffer, this._key);\n\n for (let j = 0; j < 16; ++j) {\n plain[j] ^= iv[j];\n }\n\n iv = buffer;\n result.push(plain);\n buffer = new Uint8Array(16);\n bufferLength = 0;\n }\n\n this.buffer = buffer;\n this.bufferLength = bufferLength;\n this.iv = iv;\n\n if (result.length === 0) {\n return new Uint8Array(0);\n }\n\n let outputLength = 16 * result.length;\n\n if (finalize) {\n const lastBlock = result[result.length - 1];\n let psLen = lastBlock[15];\n\n if (psLen <= 16) {\n for (let i = 15, ii = 16 - psLen; i >= ii; --i) {\n if (lastBlock[i] !== psLen) {\n psLen = 0;\n break;\n }\n }\n\n outputLength -= psLen;\n result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);\n }\n }\n\n const output = new Uint8Array(outputLength);\n\n for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {\n output.set(result[i], j);\n }\n\n return output;\n }\n\n decryptBlock(data, finalize, iv = null) {\n const sourceLength = data.length;\n const buffer = this.buffer;\n let bufferLength = this.bufferPosition;\n\n if (iv) {\n this.iv = iv;\n } else {\n for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {\n buffer[bufferLength] = data[i];\n }\n\n if (bufferLength < 16) {\n this.bufferLength = bufferLength;\n return new Uint8Array(0);\n }\n\n this.iv = buffer;\n data = data.subarray(16);\n }\n\n this.buffer = new Uint8Array(16);\n this.bufferLength = 0;\n this.decryptBlock = this._decryptBlock2;\n return this.decryptBlock(data, finalize);\n }\n\n encrypt(data, iv) {\n const sourceLength = data.length;\n let buffer = this.buffer,\n bufferLength = this.bufferPosition;\n const result = [];\n\n if (!iv) {\n iv = new Uint8Array(16);\n }\n\n for (let i = 0; i < sourceLength; ++i) {\n buffer[bufferLength] = data[i];\n ++bufferLength;\n\n if (bufferLength < 16) {\n continue;\n }\n\n for (let j = 0; j < 16; ++j) {\n buffer[j] ^= iv[j];\n }\n\n const cipher = this._encrypt(buffer, this._key);\n\n iv = cipher;\n result.push(cipher);\n buffer = new Uint8Array(16);\n bufferLength = 0;\n }\n\n this.buffer = buffer;\n this.bufferLength = bufferLength;\n this.iv = iv;\n\n if (result.length === 0) {\n return new Uint8Array(0);\n }\n\n const outputLength = 16 * result.length;\n const output = new Uint8Array(outputLength);\n\n for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {\n output.set(result[i], j);\n }\n\n return output;\n }\n\n}\n\nclass AES128Cipher extends AESBaseCipher {\n constructor(key) {\n super();\n this._cyclesOfRepetition = 10;\n this._keySize = 160;\n this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);\n this._key = this._expandKey(key);\n }\n\n _expandKey(cipherKey) {\n const b = 176;\n const s = this._s;\n const rcon = this._rcon;\n const result = new Uint8Array(b);\n result.set(cipherKey);\n\n for (let j = 16, i = 1; j < b; ++i) {\n let t1 = result[j - 3];\n let t2 = result[j - 2];\n let t3 = result[j - 1];\n let t4 = result[j - 4];\n t1 = s[t1];\n t2 = s[t2];\n t3 = s[t3];\n t4 = s[t4];\n t1 = t1 ^ rcon[i];\n\n for (let n = 0; n < 4; ++n) {\n result[j] = t1 ^= result[j - 16];\n j++;\n result[j] = t2 ^= result[j - 16];\n j++;\n result[j] = t3 ^= result[j - 16];\n j++;\n result[j] = t4 ^= result[j - 16];\n j++;\n }\n }\n\n return result;\n }\n\n}\n\nexports.AES128Cipher = AES128Cipher;\n\nclass AES256Cipher extends AESBaseCipher {\n constructor(key) {\n super();\n this._cyclesOfRepetition = 14;\n this._keySize = 224;\n this._key = this._expandKey(key);\n }\n\n _expandKey(cipherKey) {\n const b = 240;\n const s = this._s;\n const result = new Uint8Array(b);\n result.set(cipherKey);\n let r = 1;\n let t1, t2, t3, t4;\n\n for (let j = 32, i = 1; j < b; ++i) {\n if (j % 32 === 16) {\n t1 = s[t1];\n t2 = s[t2];\n t3 = s[t3];\n t4 = s[t4];\n } else if (j % 32 === 0) {\n t1 = result[j - 3];\n t2 = result[j - 2];\n t3 = result[j - 1];\n t4 = result[j - 4];\n t1 = s[t1];\n t2 = s[t2];\n t3 = s[t3];\n t4 = s[t4];\n t1 = t1 ^ r;\n\n if ((r <<= 1) >= 256) {\n r = (r ^ 0x1b) & 0xff;\n }\n }\n\n for (let n = 0; n < 4; ++n) {\n result[j] = t1 ^= result[j - 32];\n j++;\n result[j] = t2 ^= result[j - 32];\n j++;\n result[j] = t3 ^= result[j - 32];\n j++;\n result[j] = t4 ^= result[j - 32];\n j++;\n }\n }\n\n return result;\n }\n\n}\n\nexports.AES256Cipher = AES256Cipher;\n\nvar PDF17 = function PDF17Closure() {\n function compareByteArrays(array1, array2) {\n if (array1.length !== array2.length) {\n return false;\n }\n\n for (var i = 0; i < array1.length; i++) {\n if (array1[i] !== array2[i]) {\n return false;\n }\n }\n\n return true;\n }\n\n function PDF17() {}\n\n PDF17.prototype = {\n checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {\n var hashData = new Uint8Array(password.length + 56);\n hashData.set(password, 0);\n hashData.set(ownerValidationSalt, password.length);\n hashData.set(userBytes, password.length + ownerValidationSalt.length);\n var result = calculateSHA256(hashData, 0, hashData.length);\n return compareByteArrays(result, ownerPassword);\n },\n checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {\n var hashData = new Uint8Array(password.length + 8);\n hashData.set(password, 0);\n hashData.set(userValidationSalt, password.length);\n var result = calculateSHA256(hashData, 0, hashData.length);\n return compareByteArrays(result, userPassword);\n },\n getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {\n var hashData = new Uint8Array(password.length + 56);\n hashData.set(password, 0);\n hashData.set(ownerKeySalt, password.length);\n hashData.set(userBytes, password.length + ownerKeySalt.length);\n var key = calculateSHA256(hashData, 0, hashData.length);\n var cipher = new AES256Cipher(key);\n return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));\n },\n getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {\n var hashData = new Uint8Array(password.length + 8);\n hashData.set(password, 0);\n hashData.set(userKeySalt, password.length);\n var key = calculateSHA256(hashData, 0, hashData.length);\n var cipher = new AES256Cipher(key);\n return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));\n }\n };\n return PDF17;\n}();\n\nexports.PDF17 = PDF17;\n\nvar PDF20 = function PDF20Closure() {\n function concatArrays(array1, array2) {\n var t = new Uint8Array(array1.length + array2.length);\n t.set(array1, 0);\n t.set(array2, array1.length);\n return t;\n }\n\n function calculatePDF20Hash(password, input, userBytes) {\n var k = calculateSHA256(input, 0, input.length).subarray(0, 32);\n var e = [0];\n var i = 0;\n\n while (i < 64 || e[e.length - 1] > i - 32) {\n var arrayLength = password.length + k.length + userBytes.length;\n var k1 = new Uint8Array(arrayLength * 64);\n var array = concatArrays(password, k);\n array = concatArrays(array, userBytes);\n\n for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {\n k1.set(array, pos);\n }\n\n var cipher = new AES128Cipher(k.subarray(0, 16));\n e = cipher.encrypt(k1, k.subarray(16, 32));\n var remainder = 0;\n\n for (var z = 0; z < 16; z++) {\n remainder *= 256 % 3;\n remainder %= 3;\n remainder += (e[z] >>> 0) % 3;\n remainder %= 3;\n }\n\n if (remainder === 0) {\n k = calculateSHA256(e, 0, e.length);\n } else if (remainder === 1) {\n k = calculateSHA384(e, 0, e.length);\n } else if (remainder === 2) {\n k = calculateSHA512(e, 0, e.length);\n }\n\n i++;\n }\n\n return k.subarray(0, 32);\n }\n\n function PDF20() {}\n\n function compareByteArrays(array1, array2) {\n if (array1.length !== array2.length) {\n return false;\n }\n\n for (var i = 0; i < array1.length; i++) {\n if (array1[i] !== array2[i]) {\n return false;\n }\n }\n\n return true;\n }\n\n PDF20.prototype = {\n hash: function PDF20_hash(password, concatBytes, userBytes) {\n return calculatePDF20Hash(password, concatBytes, userBytes);\n },\n checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {\n var hashData = new Uint8Array(password.length + 56);\n hashData.set(password, 0);\n hashData.set(ownerValidationSalt, password.length);\n hashData.set(userBytes, password.length + ownerValidationSalt.length);\n var result = calculatePDF20Hash(password, hashData, userBytes);\n return compareByteArrays(result, ownerPassword);\n },\n checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {\n var hashData = new Uint8Array(password.length + 8);\n hashData.set(password, 0);\n hashData.set(userValidationSalt, password.length);\n var result = calculatePDF20Hash(password, hashData, []);\n return compareByteArrays(result, userPassword);\n },\n getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {\n var hashData = new Uint8Array(password.length + 56);\n hashData.set(password, 0);\n hashData.set(ownerKeySalt, password.length);\n hashData.set(userBytes, password.length + ownerKeySalt.length);\n var key = calculatePDF20Hash(password, hashData, userBytes);\n var cipher = new AES256Cipher(key);\n return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));\n },\n getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {\n var hashData = new Uint8Array(password.length + 8);\n hashData.set(password, 0);\n hashData.set(userKeySalt, password.length);\n var key = calculatePDF20Hash(password, hashData, []);\n var cipher = new AES256Cipher(key);\n return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));\n }\n };\n return PDF20;\n}();\n\nexports.PDF20 = PDF20;\n\nvar CipherTransform = function CipherTransformClosure() {\n function CipherTransform(stringCipherConstructor, streamCipherConstructor) {\n this.StringCipherConstructor = stringCipherConstructor;\n this.StreamCipherConstructor = streamCipherConstructor;\n }\n\n CipherTransform.prototype = {\n createStream: function CipherTransform_createStream(stream, length) {\n var cipher = new this.StreamCipherConstructor();\n return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {\n return cipher.decryptBlock(data, finalize);\n });\n },\n decryptString: function CipherTransform_decryptString(s) {\n var cipher = new this.StringCipherConstructor();\n var data = (0, _util.stringToBytes)(s);\n data = cipher.decryptBlock(data, true);\n return (0, _util.bytesToString)(data);\n }\n };\n return CipherTransform;\n}();\n\nvar CipherTransformFactory = function CipherTransformFactoryClosure() {\n var defaultPasswordBytes = new Uint8Array([0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A]);\n\n function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {\n if (password) {\n var passwordLength = Math.min(127, password.length);\n password = password.subarray(0, passwordLength);\n } else {\n password = [];\n }\n\n var pdfAlgorithm;\n\n if (revision === 6) {\n pdfAlgorithm = new PDF20();\n } else {\n pdfAlgorithm = new PDF17();\n }\n\n if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {\n return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);\n } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {\n return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);\n }\n\n return null;\n }\n\n function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {\n var hashDataSize = 40 + ownerPassword.length + fileId.length;\n var hashData = new Uint8Array(hashDataSize),\n i = 0,\n j,\n n;\n\n if (password) {\n n = Math.min(32, password.length);\n\n for (; i < n; ++i) {\n hashData[i] = password[i];\n }\n }\n\n j = 0;\n\n while (i < 32) {\n hashData[i++] = defaultPasswordBytes[j++];\n }\n\n for (j = 0, n = ownerPassword.length; j < n; ++j) {\n hashData[i++] = ownerPassword[j];\n }\n\n hashData[i++] = flags & 0xff;\n hashData[i++] = flags >> 8 & 0xff;\n hashData[i++] = flags >> 16 & 0xff;\n hashData[i++] = flags >>> 24 & 0xff;\n\n for (j = 0, n = fileId.length; j < n; ++j) {\n hashData[i++] = fileId[j];\n }\n\n if (revision >= 4 && !encryptMetadata) {\n hashData[i++] = 0xff;\n hashData[i++] = 0xff;\n hashData[i++] = 0xff;\n hashData[i++] = 0xff;\n }\n\n var hash = calculateMD5(hashData, 0, i);\n var keyLengthInBytes = keyLength >> 3;\n\n if (revision >= 3) {\n for (j = 0; j < 50; ++j) {\n hash = calculateMD5(hash, 0, keyLengthInBytes);\n }\n }\n\n var encryptionKey = hash.subarray(0, keyLengthInBytes);\n var cipher, checkData;\n\n if (revision >= 3) {\n for (i = 0; i < 32; ++i) {\n hashData[i] = defaultPasswordBytes[i];\n }\n\n for (j = 0, n = fileId.length; j < n; ++j) {\n hashData[i++] = fileId[j];\n }\n\n cipher = new ARCFourCipher(encryptionKey);\n checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));\n n = encryptionKey.length;\n var derivedKey = new Uint8Array(n),\n k;\n\n for (j = 1; j <= 19; ++j) {\n for (k = 0; k < n; ++k) {\n derivedKey[k] = encryptionKey[k] ^ j;\n }\n\n cipher = new ARCFourCipher(derivedKey);\n checkData = cipher.encryptBlock(checkData);\n }\n\n for (j = 0, n = checkData.length; j < n; ++j) {\n if (userPassword[j] !== checkData[j]) {\n return null;\n }\n }\n } else {\n cipher = new ARCFourCipher(encryptionKey);\n checkData = cipher.encryptBlock(defaultPasswordBytes);\n\n for (j = 0, n = checkData.length; j < n; ++j) {\n if (userPassword[j] !== checkData[j]) {\n return null;\n }\n }\n }\n\n return encryptionKey;\n }\n\n function decodeUserPassword(password, ownerPassword, revision, keyLength) {\n var hashData = new Uint8Array(32),\n i = 0,\n j,\n n;\n n = Math.min(32, password.length);\n\n for (; i < n; ++i) {\n hashData[i] = password[i];\n }\n\n j = 0;\n\n while (i < 32) {\n hashData[i++] = defaultPasswordBytes[j++];\n }\n\n var hash = calculateMD5(hashData, 0, i);\n var keyLengthInBytes = keyLength >> 3;\n\n if (revision >= 3) {\n for (j = 0; j < 50; ++j) {\n hash = calculateMD5(hash, 0, hash.length);\n }\n }\n\n var cipher, userPassword;\n\n if (revision >= 3) {\n userPassword = ownerPassword;\n var derivedKey = new Uint8Array(keyLengthInBytes),\n k;\n\n for (j = 19; j >= 0; j--) {\n for (k = 0; k < keyLengthInBytes; ++k) {\n derivedKey[k] = hash[k] ^ j;\n }\n\n cipher = new ARCFourCipher(derivedKey);\n userPassword = cipher.encryptBlock(userPassword);\n }\n } else {\n cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));\n userPassword = cipher.encryptBlock(ownerPassword);\n }\n\n return userPassword;\n }\n\n var identityName = _primitives.Name.get(\"Identity\");\n\n function CipherTransformFactory(dict, fileId, password) {\n var filter = dict.get(\"Filter\");\n\n if (!(0, _primitives.isName)(filter, \"Standard\")) {\n throw new _util.FormatError(\"unknown encryption method\");\n }\n\n this.dict = dict;\n var algorithm = dict.get(\"V\");\n\n if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {\n throw new _util.FormatError(\"unsupported encryption algorithm\");\n }\n\n this.algorithm = algorithm;\n var keyLength = dict.get(\"Length\");\n\n if (!keyLength) {\n if (algorithm <= 3) {\n keyLength = 40;\n } else {\n var cfDict = dict.get(\"CF\");\n var streamCryptoName = dict.get(\"StmF\");\n\n if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {\n cfDict.suppressEncryption = true;\n var handlerDict = cfDict.get(streamCryptoName.name);\n keyLength = handlerDict && handlerDict.get(\"Length\") || 128;\n\n if (keyLength < 40) {\n keyLength <<= 3;\n }\n }\n }\n }\n\n if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {\n throw new _util.FormatError(\"invalid key length\");\n }\n\n var ownerPassword = (0, _util.stringToBytes)(dict.get(\"O\")).subarray(0, 32);\n var userPassword = (0, _util.stringToBytes)(dict.get(\"U\")).subarray(0, 32);\n var flags = dict.get(\"P\");\n var revision = dict.get(\"R\");\n var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get(\"EncryptMetadata\") !== false;\n this.encryptMetadata = encryptMetadata;\n var fileIdBytes = (0, _util.stringToBytes)(fileId);\n var passwordBytes;\n\n if (password) {\n if (revision === 6) {\n try {\n password = (0, _util.utf8StringToString)(password);\n } catch (ex) {\n (0, _util.warn)(\"CipherTransformFactory: \" + \"Unable to convert UTF8 encoded password.\");\n }\n }\n\n passwordBytes = (0, _util.stringToBytes)(password);\n }\n\n var encryptionKey;\n\n if (algorithm !== 5) {\n encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);\n } else {\n var ownerValidationSalt = (0, _util.stringToBytes)(dict.get(\"O\")).subarray(32, 40);\n var ownerKeySalt = (0, _util.stringToBytes)(dict.get(\"O\")).subarray(40, 48);\n var uBytes = (0, _util.stringToBytes)(dict.get(\"U\")).subarray(0, 48);\n var userValidationSalt = (0, _util.stringToBytes)(dict.get(\"U\")).subarray(32, 40);\n var userKeySalt = (0, _util.stringToBytes)(dict.get(\"U\")).subarray(40, 48);\n var ownerEncryption = (0, _util.stringToBytes)(dict.get(\"OE\"));\n var userEncryption = (0, _util.stringToBytes)(dict.get(\"UE\"));\n var perms = (0, _util.stringToBytes)(dict.get(\"Perms\"));\n encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);\n }\n\n if (!encryptionKey && !password) {\n throw new _util.PasswordException(\"No password given\", _util.PasswordResponses.NEED_PASSWORD);\n } else if (!encryptionKey && password) {\n var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);\n encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);\n }\n\n if (!encryptionKey) {\n throw new _util.PasswordException(\"Incorrect Password\", _util.PasswordResponses.INCORRECT_PASSWORD);\n }\n\n this.encryptionKey = encryptionKey;\n\n if (algorithm >= 4) {\n var cf = dict.get(\"CF\");\n\n if ((0, _primitives.isDict)(cf)) {\n cf.suppressEncryption = true;\n }\n\n this.cf = cf;\n this.stmf = dict.get(\"StmF\") || identityName;\n this.strf = dict.get(\"StrF\") || identityName;\n this.eff = dict.get(\"EFF\") || this.stmf;\n }\n }\n\n function buildObjectKey(num, gen, encryptionKey, isAes) {\n var key = new Uint8Array(encryptionKey.length + 9),\n i,\n n;\n\n for (i = 0, n = encryptionKey.length; i < n; ++i) {\n key[i] = encryptionKey[i];\n }\n\n key[i++] = num & 0xff;\n key[i++] = num >> 8 & 0xff;\n key[i++] = num >> 16 & 0xff;\n key[i++] = gen & 0xff;\n key[i++] = gen >> 8 & 0xff;\n\n if (isAes) {\n key[i++] = 0x73;\n key[i++] = 0x41;\n key[i++] = 0x6c;\n key[i++] = 0x54;\n }\n\n var hash = calculateMD5(key, 0, i);\n return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));\n }\n\n function buildCipherConstructor(cf, name, num, gen, key) {\n if (!(0, _primitives.isName)(name)) {\n throw new _util.FormatError(\"Invalid crypt filter name.\");\n }\n\n var cryptFilter = cf.get(name.name);\n var cfm;\n\n if (cryptFilter !== null && cryptFilter !== undefined) {\n cfm = cryptFilter.get(\"CFM\");\n }\n\n if (!cfm || cfm.name === \"None\") {\n return function cipherTransformFactoryBuildCipherConstructorNone() {\n return new NullCipher();\n };\n }\n\n if (cfm.name === \"V2\") {\n return function cipherTransformFactoryBuildCipherConstructorV2() {\n return new ARCFourCipher(buildObjectKey(num, gen, key, false));\n };\n }\n\n if (cfm.name === \"AESV2\") {\n return function cipherTransformFactoryBuildCipherConstructorAESV2() {\n return new AES128Cipher(buildObjectKey(num, gen, key, true));\n };\n }\n\n if (cfm.name === \"AESV3\") {\n return function cipherTransformFactoryBuildCipherConstructorAESV3() {\n return new AES256Cipher(key);\n };\n }\n\n throw new _util.FormatError(\"Unknown crypto method\");\n }\n\n CipherTransformFactory.prototype = {\n createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {\n if (this.algorithm === 4 || this.algorithm === 5) {\n return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));\n }\n\n var key = buildObjectKey(num, gen, this.encryptionKey, false);\n\n var cipherConstructor = function buildCipherCipherConstructor() {\n return new ARCFourCipher(key);\n };\n\n return new CipherTransform(cipherConstructor, cipherConstructor);\n }\n };\n return CipherTransformFactory;\n}();\n\nexports.CipherTransformFactory = CipherTransformFactory;\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ColorSpace = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _primitives = __w_pdfjs_require__(4);\n\nfunction resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {\n const COMPONENTS = 3;\n alpha01 = alpha01 !== 1 ? 0 : alpha01;\n const xRatio = w1 / w2;\n const yRatio = h1 / h2;\n let newIndex = 0,\n oldIndex;\n const xScaled = new Uint16Array(w2);\n const w1Scanline = w1 * COMPONENTS;\n\n for (let i = 0; i < w2; i++) {\n xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;\n }\n\n for (let i = 0; i < h2; i++) {\n const py = Math.floor(i * yRatio) * w1Scanline;\n\n for (let j = 0; j < w2; j++) {\n oldIndex = py + xScaled[j];\n dest[newIndex++] = src[oldIndex++];\n dest[newIndex++] = src[oldIndex++];\n dest[newIndex++] = src[oldIndex++];\n newIndex += alpha01;\n }\n }\n}\n\nclass ColorSpace {\n constructor(name, numComps) {\n if (this.constructor === ColorSpace) {\n (0, _util.unreachable)(\"Cannot initialize ColorSpace.\");\n }\n\n this.name = name;\n this.numComps = numComps;\n }\n\n getRgb(src, srcOffset) {\n const rgb = new Uint8ClampedArray(3);\n this.getRgbItem(src, srcOffset, rgb, 0);\n return rgb;\n }\n\n getRgbItem(src, srcOffset, dest, destOffset) {\n (0, _util.unreachable)(\"Should not call ColorSpace.getRgbItem\");\n }\n\n getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {\n (0, _util.unreachable)(\"Should not call ColorSpace.getRgbBuffer\");\n }\n\n getOutputLength(inputLength, alpha01) {\n (0, _util.unreachable)(\"Should not call ColorSpace.getOutputLength\");\n }\n\n isPassthrough(bits) {\n return false;\n }\n\n isDefaultDecode(decodeMap, bpc) {\n return ColorSpace.isDefaultDecode(decodeMap, this.numComps);\n }\n\n fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {\n const count = originalWidth * originalHeight;\n let rgbBuf = null;\n const numComponentColors = 1 << bpc;\n const needsResizing = originalHeight !== height || originalWidth !== width;\n\n if (this.isPassthrough(bpc)) {\n rgbBuf = comps;\n } else if (this.numComps === 1 && count > numComponentColors && this.name !== \"DeviceGray\" && this.name !== \"DeviceRGB\") {\n const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);\n\n for (let i = 0; i < numComponentColors; i++) {\n allColors[i] = i;\n }\n\n const colorMap = new Uint8ClampedArray(numComponentColors * 3);\n this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);\n\n if (!needsResizing) {\n let destPos = 0;\n\n for (let i = 0; i < count; ++i) {\n const key = comps[i] * 3;\n dest[destPos++] = colorMap[key];\n dest[destPos++] = colorMap[key + 1];\n dest[destPos++] = colorMap[key + 2];\n destPos += alpha01;\n }\n } else {\n rgbBuf = new Uint8Array(count * 3);\n let rgbPos = 0;\n\n for (let i = 0; i < count; ++i) {\n const key = comps[i] * 3;\n rgbBuf[rgbPos++] = colorMap[key];\n rgbBuf[rgbPos++] = colorMap[key + 1];\n rgbBuf[rgbPos++] = colorMap[key + 2];\n }\n }\n } else {\n if (!needsResizing) {\n this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);\n } else {\n rgbBuf = new Uint8ClampedArray(count * 3);\n this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);\n }\n }\n\n if (rgbBuf) {\n if (needsResizing) {\n resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);\n } else {\n let destPos = 0,\n rgbPos = 0;\n\n for (let i = 0, ii = width * actualHeight; i < ii; i++) {\n dest[destPos++] = rgbBuf[rgbPos++];\n dest[destPos++] = rgbBuf[rgbPos++];\n dest[destPos++] = rgbBuf[rgbPos++];\n destPos += alpha01;\n }\n }\n }\n }\n\n get usesZeroToOneRange() {\n return (0, _util.shadow)(this, \"usesZeroToOneRange\", true);\n }\n\n static parse(cs, xref, res, pdfFunctionFactory) {\n const IR = this.parseToIR(cs, xref, res, pdfFunctionFactory);\n return this.fromIR(IR);\n }\n\n static fromIR(IR) {\n const name = Array.isArray(IR) ? IR[0] : IR;\n let whitePoint, blackPoint, gamma;\n\n switch (name) {\n case \"DeviceGrayCS\":\n return this.singletons.gray;\n\n case \"DeviceRgbCS\":\n return this.singletons.rgb;\n\n case \"DeviceCmykCS\":\n return this.singletons.cmyk;\n\n case \"CalGrayCS\":\n whitePoint = IR[1];\n blackPoint = IR[2];\n gamma = IR[3];\n return new CalGrayCS(whitePoint, blackPoint, gamma);\n\n case \"CalRGBCS\":\n whitePoint = IR[1];\n blackPoint = IR[2];\n gamma = IR[3];\n const matrix = IR[4];\n return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);\n\n case \"PatternCS\":\n let basePatternCS = IR[1];\n\n if (basePatternCS) {\n basePatternCS = this.fromIR(basePatternCS);\n }\n\n return new PatternCS(basePatternCS);\n\n case \"IndexedCS\":\n const baseIndexedCS = IR[1];\n const hiVal = IR[2];\n const lookup = IR[3];\n return new IndexedCS(this.fromIR(baseIndexedCS), hiVal, lookup);\n\n case \"AlternateCS\":\n const numComps = IR[1];\n const alt = IR[2];\n const tintFn = IR[3];\n return new AlternateCS(numComps, this.fromIR(alt), tintFn);\n\n case \"LabCS\":\n whitePoint = IR[1];\n blackPoint = IR[2];\n const range = IR[3];\n return new LabCS(whitePoint, blackPoint, range);\n\n default:\n throw new _util.FormatError(`Unknown colorspace name: ${name}`);\n }\n }\n\n static parseToIR(cs, xref, res = null, pdfFunctionFactory) {\n cs = xref.fetchIfRef(cs);\n\n if ((0, _primitives.isName)(cs)) {\n switch (cs.name) {\n case \"DeviceGray\":\n case \"G\":\n return \"DeviceGrayCS\";\n\n case \"DeviceRGB\":\n case \"RGB\":\n return \"DeviceRgbCS\";\n\n case \"DeviceCMYK\":\n case \"CMYK\":\n return \"DeviceCmykCS\";\n\n case \"Pattern\":\n return [\"PatternCS\", null];\n\n default:\n if ((0, _primitives.isDict)(res)) {\n const colorSpaces = res.get(\"ColorSpace\");\n\n if ((0, _primitives.isDict)(colorSpaces)) {\n const resCS = colorSpaces.get(cs.name);\n\n if (resCS) {\n if ((0, _primitives.isName)(resCS)) {\n return this.parseToIR(resCS, xref, res, pdfFunctionFactory);\n }\n\n cs = resCS;\n break;\n }\n }\n }\n\n throw new _util.FormatError(`unrecognized colorspace ${cs.name}`);\n }\n }\n\n if (Array.isArray(cs)) {\n const mode = xref.fetchIfRef(cs[0]).name;\n let numComps, params, alt, whitePoint, blackPoint, gamma;\n\n switch (mode) {\n case \"DeviceGray\":\n case \"G\":\n return \"DeviceGrayCS\";\n\n case \"DeviceRGB\":\n case \"RGB\":\n return \"DeviceRgbCS\";\n\n case \"DeviceCMYK\":\n case \"CMYK\":\n return \"DeviceCmykCS\";\n\n case \"CalGray\":\n params = xref.fetchIfRef(cs[1]);\n whitePoint = params.getArray(\"WhitePoint\");\n blackPoint = params.getArray(\"BlackPoint\");\n gamma = params.get(\"Gamma\");\n return [\"CalGrayCS\", whitePoint, blackPoint, gamma];\n\n case \"CalRGB\":\n params = xref.fetchIfRef(cs[1]);\n whitePoint = params.getArray(\"WhitePoint\");\n blackPoint = params.getArray(\"BlackPoint\");\n gamma = params.getArray(\"Gamma\");\n const matrix = params.getArray(\"Matrix\");\n return [\"CalRGBCS\", whitePoint, blackPoint, gamma, matrix];\n\n case \"ICCBased\":\n const stream = xref.fetchIfRef(cs[1]);\n const dict = stream.dict;\n numComps = dict.get(\"N\");\n alt = dict.get(\"Alternate\");\n\n if (alt) {\n const altIR = this.parseToIR(alt, xref, res, pdfFunctionFactory);\n const altCS = this.fromIR(altIR, pdfFunctionFactory);\n\n if (altCS.numComps === numComps) {\n return altIR;\n }\n\n (0, _util.warn)(\"ICCBased color space: Ignoring incorrect /Alternate entry.\");\n }\n\n if (numComps === 1) {\n return \"DeviceGrayCS\";\n } else if (numComps === 3) {\n return \"DeviceRgbCS\";\n } else if (numComps === 4) {\n return \"DeviceCmykCS\";\n }\n\n break;\n\n case \"Pattern\":\n let basePatternCS = cs[1] || null;\n\n if (basePatternCS) {\n basePatternCS = this.parseToIR(basePatternCS, xref, res, pdfFunctionFactory);\n }\n\n return [\"PatternCS\", basePatternCS];\n\n case \"Indexed\":\n case \"I\":\n const baseIndexedCS = this.parseToIR(cs[1], xref, res, pdfFunctionFactory);\n const hiVal = xref.fetchIfRef(cs[2]) + 1;\n let lookup = xref.fetchIfRef(cs[3]);\n\n if ((0, _primitives.isStream)(lookup)) {\n lookup = lookup.getBytes();\n }\n\n return [\"IndexedCS\", baseIndexedCS, hiVal, lookup];\n\n case \"Separation\":\n case \"DeviceN\":\n const name = xref.fetchIfRef(cs[1]);\n numComps = Array.isArray(name) ? name.length : 1;\n alt = this.parseToIR(cs[2], xref, res, pdfFunctionFactory);\n const tintFn = pdfFunctionFactory.create(xref.fetchIfRef(cs[3]));\n return [\"AlternateCS\", numComps, alt, tintFn];\n\n case \"Lab\":\n params = xref.fetchIfRef(cs[1]);\n whitePoint = params.getArray(\"WhitePoint\");\n blackPoint = params.getArray(\"BlackPoint\");\n const range = params.getArray(\"Range\");\n return [\"LabCS\", whitePoint, blackPoint, range];\n\n default:\n throw new _util.FormatError(`unimplemented color space object \"${mode}\"`);\n }\n }\n\n throw new _util.FormatError(`unrecognized color space object: \"${cs}\"`);\n }\n\n static isDefaultDecode(decode, numComps) {\n if (!Array.isArray(decode)) {\n return true;\n }\n\n if (numComps * 2 !== decode.length) {\n (0, _util.warn)(\"The decode map is not the correct length\");\n return true;\n }\n\n for (let i = 0, ii = decode.length; i < ii; i += 2) {\n if (decode[i] !== 0 || decode[i + 1] !== 1) {\n return false;\n }\n }\n\n return true;\n }\n\n static get singletons() {\n return (0, _util.shadow)(this, \"singletons\", {\n get gray() {\n return (0, _util.shadow)(this, \"gray\", new DeviceGrayCS());\n },\n\n get rgb() {\n return (0, _util.shadow)(this, \"rgb\", new DeviceRgbCS());\n },\n\n get cmyk() {\n return (0, _util.shadow)(this, \"cmyk\", new DeviceCmykCS());\n }\n\n });\n }\n\n}\n\nexports.ColorSpace = ColorSpace;\n\nclass AlternateCS extends ColorSpace {\n constructor(numComps, base, tintFn) {\n super(\"Alternate\", numComps);\n this.base = base;\n this.tintFn = tintFn;\n this.tmpBuf = new Float32Array(base.numComps);\n }\n\n getRgbItem(src, srcOffset, dest, destOffset) {\n const tmpBuf = this.tmpBuf;\n this.tintFn(src, srcOffset, tmpBuf, 0);\n this.base.getRgbItem(tmpBuf, 0, dest, destOffset);\n }\n\n getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {\n const tintFn = this.tintFn;\n const base = this.base;\n const scale = 1 / ((1 << bits) - 1);\n const baseNumComps = base.numComps;\n const usesZeroToOneRange = base.usesZeroToOneRange;\n const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;\n let pos = isPassthrough ? destOffset : 0;\n const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);\n const numComps = this.numComps;\n const scaled = new Float32Array(numComps);\n const tinted = new Float32Array(baseNumComps);\n let i, j;\n\n for (i = 0; i < count; i++) {\n for (j = 0; j < numComps; j++) {\n scaled[j] = src[srcOffset++] * scale;\n }\n\n tintFn(scaled, 0, tinted, 0);\n\n if (usesZeroToOneRange) {\n for (j = 0; j < baseNumComps; j++) {\n baseBuf[pos++] = tinted[j] * 255;\n }\n } else {\n base.getRgbItem(tinted, 0, baseBuf, pos);\n pos += baseNumComps;\n }\n }\n\n if (!isPassthrough) {\n base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);\n }\n }\n\n getOutputLength(inputLength, alpha01) {\n return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);\n }\n\n}\n\nclass PatternCS extends ColorSpace {\n constructor(baseCS) {\n super(\"Pattern\", null);\n this.base = baseCS;\n }\n\n isDefaultDecode(decodeMap, bpc) {\n (0, _util.unreachable)(\"Should not call PatternCS.isDefaultDecode\");\n }\n\n}\n\nclass IndexedCS extends ColorSpace {\n constructor(base, highVal, lookup) {\n super(\"Indexed\", 1);\n this.base = base;\n this.highVal = highVal;\n const baseNumComps = base.numComps;\n const length = baseNumComps * highVal;\n\n if ((0, _primitives.isStream)(lookup)) {\n this.lookup = new Uint8Array(length);\n const bytes = lookup.getBytes(length);\n this.lookup.set(bytes);\n } else if ((0, _util.isString)(lookup)) {\n this.lookup = new Uint8Array(length);\n\n for (let i = 0; i < length; ++i) {\n this.lookup[i] = lookup.charCodeAt(i);\n }\n } else if (lookup instanceof Uint8Array) {\n this.lookup = lookup;\n } else {\n throw new _util.FormatError(`Unrecognized lookup table: ${lookup}`);\n }\n }\n\n getRgbItem(src, srcOffset, dest, destOffset) {\n const numComps = this.base.numComps;\n const start = src[srcOffset] * numComps;\n this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);\n }\n\n getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {\n const base = this.base;\n const numComps = base.numComps;\n const outputDelta = base.getOutputLength(numComps, alpha01);\n const lookup = this.lookup;\n\n for (let i = 0; i < count; ++i) {\n const lookupPos = src[srcOffset++] * numComps;\n base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);\n destOffset += outputDelta;\n }\n }\n\n getOutputLength(inputLength, alpha01) {\n return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);\n }\n\n isDefaultDecode(decodeMap, bpc) {\n if (!Array.isArray(decodeMap)) {\n return true;\n }\n\n if (decodeMap.length !== 2) {\n (0, _util.warn)(\"Decode map length is not correct\");\n return true;\n }\n\n if (!Number.isInteger(bpc) || bpc < 1) {\n (0, _util.warn)(\"Bits per component is not correct\");\n return true;\n }\n\n return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;\n }\n\n}\n\nclass DeviceGrayCS extends ColorSpace {\n constructor() {\n super(\"DeviceGray\", 1);\n }\n\n getRgbItem(src, srcOffset, dest, destOffset) {\n const c = src[srcOffset] * 255;\n dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;\n }\n\n getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {\n const scale = 255 / ((1 << bits) - 1);\n let j = srcOffset,\n q = destOffset;\n\n for (let i = 0; i < count; ++i) {\n const c = scale * src[j++];\n dest[q++] = c;\n dest[q++] = c;\n dest[q++] = c;\n q += alpha01;\n }\n }\n\n getOutputLength(inputLength, alpha01) {\n return inputLength * (3 + alpha01);\n }\n\n}\n\nclass DeviceRgbCS extends ColorSpace {\n constructor() {\n super(\"DeviceRGB\", 3);\n }\n\n getRgbItem(src, srcOffset, dest, destOffset) {\n dest[destOffset] = src[srcOffset] * 255;\n dest[destOffset + 1] = src[srcOffset + 1] * 255;\n dest[destOffset + 2] = src[srcOffset + 2] * 255;\n }\n\n getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {\n if (bits === 8 && alpha01 === 0) {\n dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);\n return;\n }\n\n const scale = 255 / ((1 << bits) - 1);\n let j = srcOffset,\n q = destOffset;\n\n for (let i = 0; i < count; ++i) {\n dest[q++] = scale * src[j++];\n dest[q++] = scale * src[j++];\n dest[q++] = scale * src[j++];\n q += alpha01;\n }\n }\n\n getOutputLength(inputLength, alpha01) {\n return inputLength * (3 + alpha01) / 3 | 0;\n }\n\n isPassthrough(bits) {\n return bits === 8;\n }\n\n}\n\nconst DeviceCmykCS = function DeviceCmykCSClosure() {\n function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {\n const c = src[srcOffset] * srcScale;\n const m = src[srcOffset + 1] * srcScale;\n const y = src[srcOffset + 2] * srcScale;\n const k = src[srcOffset + 3] * srcScale;\n dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);\n dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);\n dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);\n }\n\n class DeviceCmykCS extends ColorSpace {\n constructor() {\n super(\"DeviceCMYK\", 4);\n }\n\n getRgbItem(src, srcOffset, dest, destOffset) {\n convertToRgb(src, srcOffset, 1, dest, destOffset);\n }\n\n getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {\n const scale = 1 / ((1 << bits) - 1);\n\n for (let i = 0; i < count; i++) {\n convertToRgb(src, srcOffset, scale, dest, destOffset);\n srcOffset += 4;\n destOffset += 3 + alpha01;\n }\n }\n\n getOutputLength(inputLength, alpha01) {\n return inputLength / 4 * (3 + alpha01) | 0;\n }\n\n }\n\n return DeviceCmykCS;\n}();\n\nconst CalGrayCS = function CalGrayCSClosure() {\n function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {\n const A = src[srcOffset] * scale;\n const AG = A ** cs.G;\n const L = cs.YW * AG;\n const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);\n dest[destOffset] = val;\n dest[destOffset + 1] = val;\n dest[destOffset + 2] = val;\n }\n\n class CalGrayCS extends ColorSpace {\n constructor(whitePoint, blackPoint, gamma) {\n super(\"CalGray\", 1);\n\n if (!whitePoint) {\n throw new _util.FormatError(\"WhitePoint missing - required for color space CalGray\");\n }\n\n blackPoint = blackPoint || [0, 0, 0];\n gamma = gamma || 1;\n this.XW = whitePoint[0];\n this.YW = whitePoint[1];\n this.ZW = whitePoint[2];\n this.XB = blackPoint[0];\n this.YB = blackPoint[1];\n this.ZB = blackPoint[2];\n this.G = gamma;\n\n if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {\n throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + \", no fallback available\");\n }\n\n if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {\n (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);\n this.XB = this.YB = this.ZB = 0;\n }\n\n if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {\n (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);\n }\n\n if (this.G < 1) {\n (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + \"falling back to default.\");\n this.G = 1;\n }\n }\n\n getRgbItem(src, srcOffset, dest, destOffset) {\n convertToRgb(this, src, srcOffset, dest, destOffset, 1);\n }\n\n getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {\n const scale = 1 / ((1 << bits) - 1);\n\n for (let i = 0; i < count; ++i) {\n convertToRgb(this, src, srcOffset, dest, destOffset, scale);\n srcOffset += 1;\n destOffset += 3 + alpha01;\n }\n }\n\n getOutputLength(inputLength, alpha01) {\n return inputLength * (3 + alpha01);\n }\n\n }\n\n return CalGrayCS;\n}();\n\nconst CalRGBCS = function CalRGBCSClosure() {\n const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);\n const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);\n const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);\n const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);\n const tempNormalizeMatrix = new Float32Array(3);\n const tempConvertMatrix1 = new Float32Array(3);\n const tempConvertMatrix2 = new Float32Array(3);\n const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;\n\n function matrixProduct(a, b, result) {\n result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];\n result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];\n }\n\n function convertToFlat(sourceWhitePoint, LMS, result) {\n result[0] = LMS[0] * 1 / sourceWhitePoint[0];\n result[1] = LMS[1] * 1 / sourceWhitePoint[1];\n result[2] = LMS[2] * 1 / sourceWhitePoint[2];\n }\n\n function convertToD65(sourceWhitePoint, LMS, result) {\n const D65X = 0.95047;\n const D65Y = 1;\n const D65Z = 1.08883;\n result[0] = LMS[0] * D65X / sourceWhitePoint[0];\n result[1] = LMS[1] * D65Y / sourceWhitePoint[1];\n result[2] = LMS[2] * D65Z / sourceWhitePoint[2];\n }\n\n function sRGBTransferFunction(color) {\n if (color <= 0.0031308) {\n return adjustToRange(0, 1, 12.92 * color);\n }\n\n return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);\n }\n\n function adjustToRange(min, max, value) {\n return Math.max(min, Math.min(max, value));\n }\n\n function decodeL(L) {\n if (L < 0) {\n return -decodeL(-L);\n }\n\n if (L > 8.0) {\n return ((L + 16) / 116) ** 3;\n }\n\n return L * DECODE_L_CONSTANT;\n }\n\n function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {\n if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {\n result[0] = XYZ_Flat[0];\n result[1] = XYZ_Flat[1];\n result[2] = XYZ_Flat[2];\n return;\n }\n\n const zeroDecodeL = decodeL(0);\n const X_DST = zeroDecodeL;\n const X_SRC = decodeL(sourceBlackPoint[0]);\n const Y_DST = zeroDecodeL;\n const Y_SRC = decodeL(sourceBlackPoint[1]);\n const Z_DST = zeroDecodeL;\n const Z_SRC = decodeL(sourceBlackPoint[2]);\n const X_Scale = (1 - X_DST) / (1 - X_SRC);\n const X_Offset = 1 - X_Scale;\n const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);\n const Y_Offset = 1 - Y_Scale;\n const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);\n const Z_Offset = 1 - Z_Scale;\n result[0] = XYZ_Flat[0] * X_Scale + X_Offset;\n result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;\n result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;\n }\n\n function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {\n if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {\n result[0] = XYZ_In[0];\n result[1] = XYZ_In[1];\n result[2] = XYZ_In[2];\n return;\n }\n\n const LMS = result;\n matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);\n const LMS_Flat = tempNormalizeMatrix;\n convertToFlat(sourceWhitePoint, LMS, LMS_Flat);\n matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);\n }\n\n function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {\n const LMS = result;\n matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);\n const LMS_D65 = tempNormalizeMatrix;\n convertToD65(sourceWhitePoint, LMS, LMS_D65);\n matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);\n }\n\n function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {\n const A = adjustToRange(0, 1, src[srcOffset] * scale);\n const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);\n const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);\n const AGR = A ** cs.GR;\n const BGG = B ** cs.GG;\n const CGB = C ** cs.GB;\n const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;\n const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;\n const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;\n const XYZ = tempConvertMatrix1;\n XYZ[0] = X;\n XYZ[1] = Y;\n XYZ[2] = Z;\n const XYZ_Flat = tempConvertMatrix2;\n normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);\n const XYZ_Black = tempConvertMatrix1;\n compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);\n const XYZ_D65 = tempConvertMatrix2;\n normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);\n const SRGB = tempConvertMatrix1;\n matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);\n dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;\n dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;\n dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;\n }\n\n class CalRGBCS extends ColorSpace {\n constructor(whitePoint, blackPoint, gamma, matrix) {\n super(\"CalRGB\", 3);\n\n if (!whitePoint) {\n throw new _util.FormatError(\"WhitePoint missing - required for color space CalRGB\");\n }\n\n blackPoint = blackPoint || new Float32Array(3);\n gamma = gamma || new Float32Array([1, 1, 1]);\n matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);\n const XW = whitePoint[0];\n const YW = whitePoint[1];\n const ZW = whitePoint[2];\n this.whitePoint = whitePoint;\n const XB = blackPoint[0];\n const YB = blackPoint[1];\n const ZB = blackPoint[2];\n this.blackPoint = blackPoint;\n this.GR = gamma[0];\n this.GG = gamma[1];\n this.GB = gamma[2];\n this.MXA = matrix[0];\n this.MYA = matrix[1];\n this.MZA = matrix[2];\n this.MXB = matrix[3];\n this.MYB = matrix[4];\n this.MZB = matrix[5];\n this.MXC = matrix[6];\n this.MYC = matrix[7];\n this.MZC = matrix[8];\n\n if (XW < 0 || ZW < 0 || YW !== 1) {\n throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + \", no fallback available\");\n }\n\n if (XB < 0 || YB < 0 || ZB < 0) {\n (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + \"falling back to default.\");\n this.blackPoint = new Float32Array(3);\n }\n\n if (this.GR < 0 || this.GG < 0 || this.GB < 0) {\n (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);\n this.GR = this.GG = this.GB = 1;\n }\n }\n\n getRgbItem(src, srcOffset, dest, destOffset) {\n convertToRgb(this, src, srcOffset, dest, destOffset, 1);\n }\n\n getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {\n const scale = 1 / ((1 << bits) - 1);\n\n for (let i = 0; i < count; ++i) {\n convertToRgb(this, src, srcOffset, dest, destOffset, scale);\n srcOffset += 3;\n destOffset += 3 + alpha01;\n }\n }\n\n getOutputLength(inputLength, alpha01) {\n return inputLength * (3 + alpha01) / 3 | 0;\n }\n\n }\n\n return CalRGBCS;\n}();\n\nconst LabCS = function LabCSClosure() {\n function fn_g(x) {\n let result;\n\n if (x >= 6 / 29) {\n result = x * x * x;\n } else {\n result = 108 / 841 * (x - 4 / 29);\n }\n\n return result;\n }\n\n function decode(value, high1, low2, high2) {\n return low2 + value * (high2 - low2) / high1;\n }\n\n function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {\n let Ls = src[srcOffset];\n let as = src[srcOffset + 1];\n let bs = src[srcOffset + 2];\n\n if (maxVal !== false) {\n Ls = decode(Ls, maxVal, 0, 100);\n as = decode(as, maxVal, cs.amin, cs.amax);\n bs = decode(bs, maxVal, cs.bmin, cs.bmax);\n }\n\n if (as > cs.amax) {\n as = cs.amax;\n } else if (as < cs.amin) {\n as = cs.amin;\n }\n\n if (bs > cs.bmax) {\n bs = cs.bmax;\n } else if (bs < cs.bmin) {\n bs = cs.bmin;\n }\n\n const M = (Ls + 16) / 116;\n const L = M + as / 500;\n const N = M - bs / 200;\n const X = cs.XW * fn_g(L);\n const Y = cs.YW * fn_g(M);\n const Z = cs.ZW * fn_g(N);\n let r, g, b;\n\n if (cs.ZW < 1) {\n r = X * 3.1339 + Y * -1.617 + Z * -0.4906;\n g = X * -0.9785 + Y * 1.916 + Z * 0.0333;\n b = X * 0.072 + Y * -0.229 + Z * 1.4057;\n } else {\n r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;\n g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;\n b = X * 0.0557 + Y * -0.204 + Z * 1.057;\n }\n\n dest[destOffset] = Math.sqrt(r) * 255;\n dest[destOffset + 1] = Math.sqrt(g) * 255;\n dest[destOffset + 2] = Math.sqrt(b) * 255;\n }\n\n class LabCS extends ColorSpace {\n constructor(whitePoint, blackPoint, range) {\n super(\"Lab\", 3);\n\n if (!whitePoint) {\n throw new _util.FormatError(\"WhitePoint missing - required for color space Lab\");\n }\n\n blackPoint = blackPoint || [0, 0, 0];\n range = range || [-100, 100, -100, 100];\n this.XW = whitePoint[0];\n this.YW = whitePoint[1];\n this.ZW = whitePoint[2];\n this.amin = range[0];\n this.amax = range[1];\n this.bmin = range[2];\n this.bmax = range[3];\n this.XB = blackPoint[0];\n this.YB = blackPoint[1];\n this.ZB = blackPoint[2];\n\n if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {\n throw new _util.FormatError(\"Invalid WhitePoint components, no fallback available\");\n }\n\n if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {\n (0, _util.info)(\"Invalid BlackPoint, falling back to default\");\n this.XB = this.YB = this.ZB = 0;\n }\n\n if (this.amin > this.amax || this.bmin > this.bmax) {\n (0, _util.info)(\"Invalid Range, falling back to defaults\");\n this.amin = -100;\n this.amax = 100;\n this.bmin = -100;\n this.bmax = 100;\n }\n }\n\n getRgbItem(src, srcOffset, dest, destOffset) {\n convertToRgb(this, src, srcOffset, false, dest, destOffset);\n }\n\n getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {\n const maxVal = (1 << bits) - 1;\n\n for (let i = 0; i < count; i++) {\n convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);\n srcOffset += 3;\n destOffset += 3 + alpha01;\n }\n }\n\n getOutputLength(inputLength, alpha01) {\n return inputLength * (3 + alpha01) / 3 | 0;\n }\n\n isDefaultDecode(decodeMap, bpc) {\n return true;\n }\n\n get usesZeroToOneRange() {\n return (0, _util.shadow)(this, \"usesZeroToOneRange\", false);\n }\n\n }\n\n return LabCS;\n}();\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getQuadPoints = getQuadPoints;\nexports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _obj = __w_pdfjs_require__(9);\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _colorspace = __w_pdfjs_require__(22);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nvar _operator_list = __w_pdfjs_require__(24);\n\nvar _stream = __w_pdfjs_require__(11);\n\nclass AnnotationFactory {\n static create(xref, ref, pdfManager, idFactory) {\n return pdfManager.ensure(this, \"_create\", [xref, ref, pdfManager, idFactory]);\n }\n\n static _create(xref, ref, pdfManager, idFactory) {\n const dict = xref.fetchIfRef(ref);\n\n if (!(0, _primitives.isDict)(dict)) {\n return undefined;\n }\n\n const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;\n let subtype = dict.get(\"Subtype\");\n subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;\n const parameters = {\n xref,\n dict,\n subtype,\n id,\n pdfManager\n };\n\n switch (subtype) {\n case \"Link\":\n return new LinkAnnotation(parameters);\n\n case \"Text\":\n return new TextAnnotation(parameters);\n\n case \"Widget\":\n let fieldType = (0, _core_utils.getInheritableProperty)({\n dict,\n key: \"FT\"\n });\n fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;\n\n switch (fieldType) {\n case \"Tx\":\n return new TextWidgetAnnotation(parameters);\n\n case \"Btn\":\n return new ButtonWidgetAnnotation(parameters);\n\n case \"Ch\":\n return new ChoiceWidgetAnnotation(parameters);\n }\n\n (0, _util.warn)('Unimplemented widget field type \"' + fieldType + '\", ' + \"falling back to base field type.\");\n return new WidgetAnnotation(parameters);\n\n case \"Popup\":\n return new PopupAnnotation(parameters);\n\n case \"FreeText\":\n return new FreeTextAnnotation(parameters);\n\n case \"Line\":\n return new LineAnnotation(parameters);\n\n case \"Square\":\n return new SquareAnnotation(parameters);\n\n case \"Circle\":\n return new CircleAnnotation(parameters);\n\n case \"PolyLine\":\n return new PolylineAnnotation(parameters);\n\n case \"Polygon\":\n return new PolygonAnnotation(parameters);\n\n case \"Caret\":\n return new CaretAnnotation(parameters);\n\n case \"Ink\":\n return new InkAnnotation(parameters);\n\n case \"Highlight\":\n return new HighlightAnnotation(parameters);\n\n case \"Underline\":\n return new UnderlineAnnotation(parameters);\n\n case \"Squiggly\":\n return new SquigglyAnnotation(parameters);\n\n case \"StrikeOut\":\n return new StrikeOutAnnotation(parameters);\n\n case \"Stamp\":\n return new StampAnnotation(parameters);\n\n case \"FileAttachment\":\n return new FileAttachmentAnnotation(parameters);\n\n default:\n if (!subtype) {\n (0, _util.warn)(\"Annotation is missing the required /Subtype.\");\n } else {\n (0, _util.warn)('Unimplemented annotation type \"' + subtype + '\", ' + \"falling back to base annotation.\");\n }\n\n return new Annotation(parameters);\n }\n }\n\n}\n\nexports.AnnotationFactory = AnnotationFactory;\n\nfunction getQuadPoints(dict, rect) {\n if (!dict.has(\"QuadPoints\")) {\n return null;\n }\n\n const quadPoints = dict.getArray(\"QuadPoints\");\n\n if (!Array.isArray(quadPoints) || quadPoints.length % 8 > 0) {\n return null;\n }\n\n const quadPointsLists = [];\n\n for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {\n quadPointsLists.push([]);\n\n for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {\n const x = quadPoints[j];\n const y = quadPoints[j + 1];\n\n if (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3]) {\n return null;\n }\n\n quadPointsLists[i].push({\n x,\n y\n });\n }\n }\n\n return quadPointsLists;\n}\n\nfunction getTransformMatrix(rect, bbox, matrix) {\n const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);\n\n if (minX === maxX || minY === maxY) {\n return [1, 0, 0, 1, rect[0], rect[1]];\n }\n\n const xRatio = (rect[2] - rect[0]) / (maxX - minX);\n const yRatio = (rect[3] - rect[1]) / (maxY - minY);\n return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];\n}\n\nclass Annotation {\n constructor(params) {\n const dict = params.dict;\n this.setContents(dict.get(\"Contents\"));\n this.setModificationDate(dict.get(\"M\"));\n this.setFlags(dict.get(\"F\"));\n this.setRectangle(dict.getArray(\"Rect\"));\n this.setColor(dict.getArray(\"C\"));\n this.setBorderStyle(dict);\n this.setAppearance(dict);\n this.data = {\n annotationFlags: this.flags,\n borderStyle: this.borderStyle,\n color: this.color,\n contents: this.contents,\n hasAppearance: !!this.appearance,\n id: params.id,\n modificationDate: this.modificationDate,\n rect: this.rectangle,\n subtype: params.subtype\n };\n }\n\n _hasFlag(flags, flag) {\n return !!(flags & flag);\n }\n\n _isViewable(flags) {\n return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);\n }\n\n _isPrintable(flags) {\n return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN);\n }\n\n get viewable() {\n if (this.flags === 0) {\n return true;\n }\n\n return this._isViewable(this.flags);\n }\n\n get printable() {\n if (this.flags === 0) {\n return false;\n }\n\n return this._isPrintable(this.flags);\n }\n\n setContents(contents) {\n this.contents = (0, _util.stringToPDFString)(contents || \"\");\n }\n\n setModificationDate(modificationDate) {\n this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;\n }\n\n setFlags(flags) {\n this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;\n }\n\n hasFlag(flag) {\n return this._hasFlag(this.flags, flag);\n }\n\n setRectangle(rectangle) {\n if (Array.isArray(rectangle) && rectangle.length === 4) {\n this.rectangle = _util.Util.normalizeRect(rectangle);\n } else {\n this.rectangle = [0, 0, 0, 0];\n }\n }\n\n setColor(color) {\n const rgbColor = new Uint8ClampedArray(3);\n\n if (!Array.isArray(color)) {\n this.color = rgbColor;\n return;\n }\n\n switch (color.length) {\n case 0:\n this.color = null;\n break;\n\n case 1:\n _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);\n\n this.color = rgbColor;\n break;\n\n case 3:\n _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);\n\n this.color = rgbColor;\n break;\n\n case 4:\n _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);\n\n this.color = rgbColor;\n break;\n\n default:\n this.color = rgbColor;\n break;\n }\n }\n\n setBorderStyle(borderStyle) {\n this.borderStyle = new AnnotationBorderStyle();\n\n if (!(0, _primitives.isDict)(borderStyle)) {\n return;\n }\n\n if (borderStyle.has(\"BS\")) {\n const dict = borderStyle.get(\"BS\");\n const dictType = dict.get(\"Type\");\n\n if (!dictType || (0, _primitives.isName)(dictType, \"Border\")) {\n this.borderStyle.setWidth(dict.get(\"W\"), this.rectangle);\n this.borderStyle.setStyle(dict.get(\"S\"));\n this.borderStyle.setDashArray(dict.getArray(\"D\"));\n }\n } else if (borderStyle.has(\"Border\")) {\n const array = borderStyle.getArray(\"Border\");\n\n if (Array.isArray(array) && array.length >= 3) {\n this.borderStyle.setHorizontalCornerRadius(array[0]);\n this.borderStyle.setVerticalCornerRadius(array[1]);\n this.borderStyle.setWidth(array[2], this.rectangle);\n\n if (array.length === 4) {\n this.borderStyle.setDashArray(array[3]);\n }\n }\n } else {\n this.borderStyle.setWidth(0);\n }\n }\n\n setAppearance(dict) {\n this.appearance = null;\n const appearanceStates = dict.get(\"AP\");\n\n if (!(0, _primitives.isDict)(appearanceStates)) {\n return;\n }\n\n const normalAppearanceState = appearanceStates.get(\"N\");\n\n if ((0, _primitives.isStream)(normalAppearanceState)) {\n this.appearance = normalAppearanceState;\n return;\n }\n\n if (!(0, _primitives.isDict)(normalAppearanceState)) {\n return;\n }\n\n const as = dict.get(\"AS\");\n\n if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {\n return;\n }\n\n this.appearance = normalAppearanceState.get(as.name);\n }\n\n loadResources(keys) {\n return this.appearance.dict.getAsync(\"Resources\").then(resources => {\n if (!resources) {\n return undefined;\n }\n\n const objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);\n return objectLoader.load().then(function () {\n return resources;\n });\n });\n }\n\n getOperatorList(evaluator, task, renderForms) {\n if (!this.appearance) {\n return Promise.resolve(new _operator_list.OperatorList());\n }\n\n const data = this.data;\n const appearanceDict = this.appearance.dict;\n const resourcesPromise = this.loadResources([\"ExtGState\", \"ColorSpace\", \"Pattern\", \"Shading\", \"XObject\", \"Font\"]);\n const bbox = appearanceDict.getArray(\"BBox\") || [0, 0, 1, 1];\n const matrix = appearanceDict.getArray(\"Matrix\") || [1, 0, 0, 1, 0, 0];\n const transform = getTransformMatrix(data.rect, bbox, matrix);\n return resourcesPromise.then(resources => {\n const opList = new _operator_list.OperatorList();\n opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);\n return evaluator.getOperatorList({\n stream: this.appearance,\n task,\n resources,\n operatorList: opList\n }).then(() => {\n opList.addOp(_util.OPS.endAnnotation, []);\n this.appearance.reset();\n return opList;\n });\n });\n }\n\n}\n\nexports.Annotation = Annotation;\n\nclass AnnotationBorderStyle {\n constructor() {\n this.width = 1;\n this.style = _util.AnnotationBorderStyleType.SOLID;\n this.dashArray = [3];\n this.horizontalCornerRadius = 0;\n this.verticalCornerRadius = 0;\n }\n\n setWidth(width, rect = [0, 0, 0, 0]) {\n if ((0, _primitives.isName)(width)) {\n this.width = 0;\n return;\n }\n\n if (Number.isInteger(width)) {\n if (width > 0) {\n const maxWidth = (rect[2] - rect[0]) / 2;\n const maxHeight = (rect[3] - rect[1]) / 2;\n\n if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {\n (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);\n width = 1;\n }\n }\n\n this.width = width;\n }\n }\n\n setStyle(style) {\n if (!(0, _primitives.isName)(style)) {\n return;\n }\n\n switch (style.name) {\n case \"S\":\n this.style = _util.AnnotationBorderStyleType.SOLID;\n break;\n\n case \"D\":\n this.style = _util.AnnotationBorderStyleType.DASHED;\n break;\n\n case \"B\":\n this.style = _util.AnnotationBorderStyleType.BEVELED;\n break;\n\n case \"I\":\n this.style = _util.AnnotationBorderStyleType.INSET;\n break;\n\n case \"U\":\n this.style = _util.AnnotationBorderStyleType.UNDERLINE;\n break;\n\n default:\n break;\n }\n }\n\n setDashArray(dashArray) {\n if (Array.isArray(dashArray) && dashArray.length > 0) {\n let isValid = true;\n let allZeros = true;\n\n for (const element of dashArray) {\n const validNumber = +element >= 0;\n\n if (!validNumber) {\n isValid = false;\n break;\n } else if (element > 0) {\n allZeros = false;\n }\n }\n\n if (isValid && !allZeros) {\n this.dashArray = dashArray;\n } else {\n this.width = 0;\n }\n } else if (dashArray) {\n this.width = 0;\n }\n }\n\n setHorizontalCornerRadius(radius) {\n if (Number.isInteger(radius)) {\n this.horizontalCornerRadius = radius;\n }\n }\n\n setVerticalCornerRadius(radius) {\n if (Number.isInteger(radius)) {\n this.verticalCornerRadius = radius;\n }\n }\n\n}\n\nexports.AnnotationBorderStyle = AnnotationBorderStyle;\n\nclass MarkupAnnotation extends Annotation {\n constructor(parameters) {\n super(parameters);\n const dict = parameters.dict;\n\n if (dict.has(\"IRT\")) {\n const rawIRT = dict.getRaw(\"IRT\");\n this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;\n const rt = dict.get(\"RT\");\n this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;\n }\n\n if (this.data.replyType === _util.AnnotationReplyType.GROUP) {\n const parent = dict.get(\"IRT\");\n this.data.title = (0, _util.stringToPDFString)(parent.get(\"T\") || \"\");\n this.setContents(parent.get(\"Contents\"));\n this.data.contents = this.contents;\n\n if (!parent.has(\"CreationDate\")) {\n this.data.creationDate = null;\n } else {\n this.setCreationDate(parent.get(\"CreationDate\"));\n this.data.creationDate = this.creationDate;\n }\n\n if (!parent.has(\"M\")) {\n this.data.modificationDate = null;\n } else {\n this.setModificationDate(parent.get(\"M\"));\n this.data.modificationDate = this.modificationDate;\n }\n\n this.data.hasPopup = parent.has(\"Popup\");\n\n if (!parent.has(\"C\")) {\n this.data.color = null;\n } else {\n this.setColor(parent.getArray(\"C\"));\n this.data.color = this.color;\n }\n } else {\n this.data.title = (0, _util.stringToPDFString)(dict.get(\"T\") || \"\");\n this.setCreationDate(dict.get(\"CreationDate\"));\n this.data.creationDate = this.creationDate;\n this.data.hasPopup = dict.has(\"Popup\");\n\n if (!dict.has(\"C\")) {\n this.data.color = null;\n }\n }\n }\n\n setCreationDate(creationDate) {\n this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;\n }\n\n}\n\nexports.MarkupAnnotation = MarkupAnnotation;\n\nclass WidgetAnnotation extends Annotation {\n constructor(params) {\n super(params);\n const dict = params.dict;\n const data = this.data;\n data.annotationType = _util.AnnotationType.WIDGET;\n data.fieldName = this._constructFieldName(dict);\n data.fieldValue = (0, _core_utils.getInheritableProperty)({\n dict,\n key: \"V\",\n getArray: true\n });\n data.alternativeText = (0, _util.stringToPDFString)(dict.get(\"TU\") || \"\");\n data.defaultAppearance = (0, _core_utils.getInheritableProperty)({\n dict,\n key: \"DA\"\n }) || \"\";\n const fieldType = (0, _core_utils.getInheritableProperty)({\n dict,\n key: \"FT\"\n });\n data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;\n this.fieldResources = (0, _core_utils.getInheritableProperty)({\n dict,\n key: \"DR\"\n }) || _primitives.Dict.empty;\n data.fieldFlags = (0, _core_utils.getInheritableProperty)({\n dict,\n key: \"Ff\"\n });\n\n if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {\n data.fieldFlags = 0;\n }\n\n data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);\n\n if (data.fieldType === \"Sig\") {\n data.fieldValue = null;\n this.setFlags(_util.AnnotationFlag.HIDDEN);\n }\n }\n\n _constructFieldName(dict) {\n if (!dict.has(\"T\") && !dict.has(\"Parent\")) {\n (0, _util.warn)(\"Unknown field name, falling back to empty field name.\");\n return \"\";\n }\n\n if (!dict.has(\"Parent\")) {\n return (0, _util.stringToPDFString)(dict.get(\"T\"));\n }\n\n const fieldName = [];\n\n if (dict.has(\"T\")) {\n fieldName.unshift((0, _util.stringToPDFString)(dict.get(\"T\")));\n }\n\n let loopDict = dict;\n\n while (loopDict.has(\"Parent\")) {\n loopDict = loopDict.get(\"Parent\");\n\n if (!(0, _primitives.isDict)(loopDict)) {\n break;\n }\n\n if (loopDict.has(\"T\")) {\n fieldName.unshift((0, _util.stringToPDFString)(loopDict.get(\"T\")));\n }\n }\n\n return fieldName.join(\".\");\n }\n\n hasFieldFlag(flag) {\n return !!(this.data.fieldFlags & flag);\n }\n\n getOperatorList(evaluator, task, renderForms) {\n if (renderForms) {\n return Promise.resolve(new _operator_list.OperatorList());\n }\n\n return super.getOperatorList(evaluator, task, renderForms);\n }\n\n}\n\nclass TextWidgetAnnotation extends WidgetAnnotation {\n constructor(params) {\n super(params);\n const dict = params.dict;\n this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || \"\");\n let alignment = (0, _core_utils.getInheritableProperty)({\n dict,\n key: \"Q\"\n });\n\n if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {\n alignment = null;\n }\n\n this.data.textAlignment = alignment;\n let maximumLength = (0, _core_utils.getInheritableProperty)({\n dict,\n key: \"MaxLen\"\n });\n\n if (!Number.isInteger(maximumLength) || maximumLength < 0) {\n maximumLength = null;\n }\n\n this.data.maxLen = maximumLength;\n this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);\n this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;\n }\n\n getOperatorList(evaluator, task, renderForms) {\n if (renderForms || this.appearance) {\n return super.getOperatorList(evaluator, task, renderForms);\n }\n\n const operatorList = new _operator_list.OperatorList();\n\n if (!this.data.defaultAppearance) {\n return Promise.resolve(operatorList);\n }\n\n const stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance));\n return evaluator.getOperatorList({\n stream,\n task,\n resources: this.fieldResources,\n operatorList\n }).then(function () {\n return operatorList;\n });\n }\n\n}\n\nclass ButtonWidgetAnnotation extends WidgetAnnotation {\n constructor(params) {\n super(params);\n this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);\n this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);\n this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);\n\n if (this.data.checkBox) {\n this._processCheckBox(params);\n } else if (this.data.radioButton) {\n this._processRadioButton(params);\n } else if (this.data.pushButton) {\n this._processPushButton(params);\n } else {\n (0, _util.warn)(\"Invalid field flags for button widget annotation\");\n }\n }\n\n _processCheckBox(params) {\n if ((0, _primitives.isName)(this.data.fieldValue)) {\n this.data.fieldValue = this.data.fieldValue.name;\n }\n\n const customAppearance = params.dict.get(\"AP\");\n\n if (!(0, _primitives.isDict)(customAppearance)) {\n return;\n }\n\n const exportValueOptionsDict = customAppearance.get(\"D\");\n\n if (!(0, _primitives.isDict)(exportValueOptionsDict)) {\n return;\n }\n\n const exportValues = exportValueOptionsDict.getKeys();\n const hasCorrectOptionCount = exportValues.length === 2;\n\n if (!hasCorrectOptionCount) {\n return;\n }\n\n this.data.exportValue = exportValues[0] === \"Off\" ? exportValues[1] : exportValues[0];\n }\n\n _processRadioButton(params) {\n this.data.fieldValue = this.data.buttonValue = null;\n const fieldParent = params.dict.get(\"Parent\");\n\n if ((0, _primitives.isDict)(fieldParent) && fieldParent.has(\"V\")) {\n const fieldParentValue = fieldParent.get(\"V\");\n\n if ((0, _primitives.isName)(fieldParentValue)) {\n this.data.fieldValue = fieldParentValue.name;\n }\n }\n\n const appearanceStates = params.dict.get(\"AP\");\n\n if (!(0, _primitives.isDict)(appearanceStates)) {\n return;\n }\n\n const normalAppearanceState = appearanceStates.get(\"N\");\n\n if (!(0, _primitives.isDict)(normalAppearanceState)) {\n return;\n }\n\n for (const key of normalAppearanceState.getKeys()) {\n if (key !== \"Off\") {\n this.data.buttonValue = key;\n break;\n }\n }\n }\n\n _processPushButton(params) {\n if (!params.dict.has(\"A\")) {\n (0, _util.warn)(\"Push buttons without action dictionaries are not supported\");\n return;\n }\n\n _obj.Catalog.parseDestDictionary({\n destDict: params.dict,\n resultObj: this.data,\n docBaseUrl: params.pdfManager.docBaseUrl\n });\n }\n\n}\n\nclass ChoiceWidgetAnnotation extends WidgetAnnotation {\n constructor(params) {\n super(params);\n this.data.options = [];\n const options = (0, _core_utils.getInheritableProperty)({\n dict: params.dict,\n key: \"Opt\"\n });\n\n if (Array.isArray(options)) {\n const xref = params.xref;\n\n for (let i = 0, ii = options.length; i < ii; i++) {\n const option = xref.fetchIfRef(options[i]);\n const isOptionArray = Array.isArray(option);\n this.data.options[i] = {\n exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,\n displayValue: (0, _util.stringToPDFString)(isOptionArray ? xref.fetchIfRef(option[1]) : option)\n };\n }\n }\n\n if (!Array.isArray(this.data.fieldValue)) {\n this.data.fieldValue = [this.data.fieldValue];\n }\n\n this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);\n this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);\n }\n\n}\n\nclass TextAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n const DEFAULT_ICON_SIZE = 22;\n super(parameters);\n const dict = parameters.dict;\n this.data.annotationType = _util.AnnotationType.TEXT;\n\n if (this.data.hasAppearance) {\n this.data.name = \"NoIcon\";\n } else {\n this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;\n this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;\n this.data.name = dict.has(\"Name\") ? dict.get(\"Name\").name : \"Note\";\n }\n\n if (dict.has(\"State\")) {\n this.data.state = dict.get(\"State\") || null;\n this.data.stateModel = dict.get(\"StateModel\") || null;\n } else {\n this.data.state = null;\n this.data.stateModel = null;\n }\n }\n\n}\n\nclass LinkAnnotation extends Annotation {\n constructor(params) {\n super(params);\n this.data.annotationType = _util.AnnotationType.LINK;\n const quadPoints = getQuadPoints(params.dict, this.rectangle);\n\n if (quadPoints) {\n this.data.quadPoints = quadPoints;\n }\n\n _obj.Catalog.parseDestDictionary({\n destDict: params.dict,\n resultObj: this.data,\n docBaseUrl: params.pdfManager.docBaseUrl\n });\n }\n\n}\n\nclass PopupAnnotation extends Annotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.POPUP;\n let parentItem = parameters.dict.get(\"Parent\");\n\n if (!parentItem) {\n (0, _util.warn)(\"Popup annotation has a missing or invalid parent annotation.\");\n return;\n }\n\n const parentSubtype = parentItem.get(\"Subtype\");\n this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;\n const rawParent = parameters.dict.getRaw(\"Parent\");\n this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;\n const rt = parentItem.get(\"RT\");\n\n if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {\n parentItem = parentItem.get(\"IRT\");\n }\n\n if (!parentItem.has(\"M\")) {\n this.data.modificationDate = null;\n } else {\n this.setModificationDate(parentItem.get(\"M\"));\n this.data.modificationDate = this.modificationDate;\n }\n\n if (!parentItem.has(\"C\")) {\n this.data.color = null;\n } else {\n this.setColor(parentItem.getArray(\"C\"));\n this.data.color = this.color;\n }\n\n if (!this.viewable) {\n const parentFlags = parentItem.get(\"F\");\n\n if (this._isViewable(parentFlags)) {\n this.setFlags(parentFlags);\n }\n }\n\n this.data.title = (0, _util.stringToPDFString)(parentItem.get(\"T\") || \"\");\n this.data.contents = (0, _util.stringToPDFString)(parentItem.get(\"Contents\") || \"\");\n }\n\n}\n\nclass FreeTextAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.FREETEXT;\n }\n\n}\n\nclass LineAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.LINE;\n this.data.lineCoordinates = _util.Util.normalizeRect(parameters.dict.getArray(\"L\"));\n }\n\n}\n\nclass SquareAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.SQUARE;\n }\n\n}\n\nclass CircleAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.CIRCLE;\n }\n\n}\n\nclass PolylineAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.POLYLINE;\n const rawVertices = parameters.dict.getArray(\"Vertices\");\n this.data.vertices = [];\n\n for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {\n this.data.vertices.push({\n x: rawVertices[i],\n y: rawVertices[i + 1]\n });\n }\n }\n\n}\n\nclass PolygonAnnotation extends PolylineAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.POLYGON;\n }\n\n}\n\nclass CaretAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.CARET;\n }\n\n}\n\nclass InkAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.INK;\n const xref = parameters.xref;\n const originalInkLists = parameters.dict.getArray(\"InkList\");\n this.data.inkLists = [];\n\n for (let i = 0, ii = originalInkLists.length; i < ii; ++i) {\n this.data.inkLists.push([]);\n\n for (let j = 0, jj = originalInkLists[i].length; j < jj; j += 2) {\n this.data.inkLists[i].push({\n x: xref.fetchIfRef(originalInkLists[i][j]),\n y: xref.fetchIfRef(originalInkLists[i][j + 1])\n });\n }\n }\n }\n\n}\n\nclass HighlightAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.HIGHLIGHT;\n const quadPoints = getQuadPoints(parameters.dict, this.rectangle);\n\n if (quadPoints) {\n this.data.quadPoints = quadPoints;\n }\n }\n\n}\n\nclass UnderlineAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.UNDERLINE;\n const quadPoints = getQuadPoints(parameters.dict, this.rectangle);\n\n if (quadPoints) {\n this.data.quadPoints = quadPoints;\n }\n }\n\n}\n\nclass SquigglyAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.SQUIGGLY;\n const quadPoints = getQuadPoints(parameters.dict, this.rectangle);\n\n if (quadPoints) {\n this.data.quadPoints = quadPoints;\n }\n }\n\n}\n\nclass StrikeOutAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.STRIKEOUT;\n const quadPoints = getQuadPoints(parameters.dict, this.rectangle);\n\n if (quadPoints) {\n this.data.quadPoints = quadPoints;\n }\n }\n\n}\n\nclass StampAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n this.data.annotationType = _util.AnnotationType.STAMP;\n }\n\n}\n\nclass FileAttachmentAnnotation extends MarkupAnnotation {\n constructor(parameters) {\n super(parameters);\n const file = new _obj.FileSpec(parameters.dict.get(\"FS\"), parameters.xref);\n this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;\n this.data.file = file.serializable;\n }\n\n}\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.OperatorList = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar QueueOptimizer = function QueueOptimizerClosure() {\n function addState(parentState, pattern, checkFn, iterateFn, processFn) {\n var state = parentState;\n\n for (var i = 0, ii = pattern.length - 1; i < ii; i++) {\n var item = pattern[i];\n state = state[item] || (state[item] = []);\n }\n\n state[pattern[pattern.length - 1]] = {\n checkFn,\n iterateFn,\n processFn\n };\n }\n\n function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {\n var iFirstPIMXO = iFirstSave + 2;\n\n for (var i = 0; i < count; i++) {\n var arg = argsArray[iFirstPIMXO + 4 * i];\n var imageMask = arg.length === 1 && arg[0];\n\n if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {\n fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;\n continue;\n }\n\n break;\n }\n\n return count - i;\n }\n\n var InitialState = [];\n addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {\n var fnArray = context.fnArray;\n var iFirstSave = context.iCurr - 3;\n var pos = (i - iFirstSave) % 4;\n\n switch (pos) {\n case 0:\n return fnArray[i] === _util.OPS.save;\n\n case 1:\n return fnArray[i] === _util.OPS.transform;\n\n case 2:\n return fnArray[i] === _util.OPS.paintInlineImageXObject;\n\n case 3:\n return fnArray[i] === _util.OPS.restore;\n }\n\n throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);\n }, function foundInlineImageGroup(context, i) {\n var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;\n var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;\n var MAX_WIDTH = 1000;\n var IMAGE_PADDING = 1;\n var fnArray = context.fnArray,\n argsArray = context.argsArray;\n var curr = context.iCurr;\n var iFirstSave = curr - 3;\n var iFirstTransform = curr - 2;\n var iFirstPIIXO = curr - 1;\n var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);\n\n if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {\n return i - (i - iFirstSave) % 4;\n }\n\n var maxX = 0;\n var map = [],\n maxLineHeight = 0;\n var currentX = IMAGE_PADDING,\n currentY = IMAGE_PADDING;\n var q;\n\n for (q = 0; q < count; q++) {\n var transform = argsArray[iFirstTransform + (q << 2)];\n var img = argsArray[iFirstPIIXO + (q << 2)][0];\n\n if (currentX + img.width > MAX_WIDTH) {\n maxX = Math.max(maxX, currentX);\n currentY += maxLineHeight + 2 * IMAGE_PADDING;\n currentX = 0;\n maxLineHeight = 0;\n }\n\n map.push({\n transform,\n x: currentX,\n y: currentY,\n w: img.width,\n h: img.height\n });\n currentX += img.width + 2 * IMAGE_PADDING;\n maxLineHeight = Math.max(maxLineHeight, img.height);\n }\n\n var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;\n var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;\n var imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);\n var imgRowSize = imgWidth << 2;\n\n for (q = 0; q < count; q++) {\n var data = argsArray[iFirstPIIXO + (q << 2)][0].data;\n var rowSize = map[q].w << 2;\n var dataOffset = 0;\n var offset = map[q].x + map[q].y * imgWidth << 2;\n imgData.set(data.subarray(0, rowSize), offset - imgRowSize);\n\n for (var k = 0, kk = map[q].h; k < kk; k++) {\n imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);\n dataOffset += rowSize;\n offset += imgRowSize;\n }\n\n imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);\n\n while (offset >= 0) {\n data[offset - 4] = data[offset];\n data[offset - 3] = data[offset + 1];\n data[offset - 2] = data[offset + 2];\n data[offset - 1] = data[offset + 3];\n data[offset + rowSize] = data[offset + rowSize - 4];\n data[offset + rowSize + 1] = data[offset + rowSize - 3];\n data[offset + rowSize + 2] = data[offset + rowSize - 2];\n data[offset + rowSize + 3] = data[offset + rowSize - 1];\n offset -= imgRowSize;\n }\n }\n\n fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);\n argsArray.splice(iFirstSave, count * 4, [{\n width: imgWidth,\n height: imgHeight,\n kind: _util.ImageKind.RGBA_32BPP,\n data: imgData\n }, map]);\n return iFirstSave + 1;\n });\n addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {\n var fnArray = context.fnArray;\n var iFirstSave = context.iCurr - 3;\n var pos = (i - iFirstSave) % 4;\n\n switch (pos) {\n case 0:\n return fnArray[i] === _util.OPS.save;\n\n case 1:\n return fnArray[i] === _util.OPS.transform;\n\n case 2:\n return fnArray[i] === _util.OPS.paintImageMaskXObject;\n\n case 3:\n return fnArray[i] === _util.OPS.restore;\n }\n\n throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);\n }, function foundImageMaskGroup(context, i) {\n var MIN_IMAGES_IN_MASKS_BLOCK = 10;\n var MAX_IMAGES_IN_MASKS_BLOCK = 100;\n var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;\n var fnArray = context.fnArray,\n argsArray = context.argsArray;\n var curr = context.iCurr;\n var iFirstSave = curr - 3;\n var iFirstTransform = curr - 2;\n var iFirstPIMXO = curr - 1;\n var count = Math.floor((i - iFirstSave) / 4);\n count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);\n\n if (count < MIN_IMAGES_IN_MASKS_BLOCK) {\n return i - (i - iFirstSave) % 4;\n }\n\n var q;\n var isSameImage = false;\n var iTransform, transformArgs;\n var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];\n\n if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {\n isSameImage = true;\n var firstTransformArg0 = argsArray[iFirstTransform][0];\n var firstTransformArg3 = argsArray[iFirstTransform][3];\n iTransform = iFirstTransform + 4;\n var iPIMXO = iFirstPIMXO + 4;\n\n for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {\n transformArgs = argsArray[iTransform];\n\n if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {\n if (q < MIN_IMAGES_IN_MASKS_BLOCK) {\n isSameImage = false;\n } else {\n count = q;\n }\n\n break;\n }\n }\n }\n\n if (isSameImage) {\n count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);\n var positions = new Float32Array(count * 2);\n iTransform = iFirstTransform;\n\n for (q = 0; q < count; q++, iTransform += 4) {\n transformArgs = argsArray[iTransform];\n positions[q << 1] = transformArgs[4];\n positions[(q << 1) + 1] = transformArgs[5];\n }\n\n fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);\n argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg3, positions]);\n } else {\n count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);\n var images = [];\n\n for (q = 0; q < count; q++) {\n transformArgs = argsArray[iFirstTransform + (q << 2)];\n var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];\n images.push({\n data: maskParams.data,\n width: maskParams.width,\n height: maskParams.height,\n transform: transformArgs\n });\n }\n\n fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);\n argsArray.splice(iFirstSave, count * 4, [images]);\n }\n\n return iFirstSave + 1;\n });\n addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {\n var argsArray = context.argsArray;\n var iFirstTransform = context.iCurr - 2;\n return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;\n }, function iterateImageGroup(context, i) {\n var fnArray = context.fnArray,\n argsArray = context.argsArray;\n var iFirstSave = context.iCurr - 3;\n var pos = (i - iFirstSave) % 4;\n\n switch (pos) {\n case 0:\n return fnArray[i] === _util.OPS.save;\n\n case 1:\n if (fnArray[i] !== _util.OPS.transform) {\n return false;\n }\n\n var iFirstTransform = context.iCurr - 2;\n var firstTransformArg0 = argsArray[iFirstTransform][0];\n var firstTransformArg3 = argsArray[iFirstTransform][3];\n\n if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {\n return false;\n }\n\n return true;\n\n case 2:\n if (fnArray[i] !== _util.OPS.paintImageXObject) {\n return false;\n }\n\n var iFirstPIXO = context.iCurr - 1;\n var firstPIXOArg0 = argsArray[iFirstPIXO][0];\n\n if (argsArray[i][0] !== firstPIXOArg0) {\n return false;\n }\n\n return true;\n\n case 3:\n return fnArray[i] === _util.OPS.restore;\n }\n\n throw new Error(`iterateImageGroup - invalid pos: ${pos}`);\n }, function (context, i) {\n var MIN_IMAGES_IN_BLOCK = 3;\n var MAX_IMAGES_IN_BLOCK = 1000;\n var fnArray = context.fnArray,\n argsArray = context.argsArray;\n var curr = context.iCurr;\n var iFirstSave = curr - 3;\n var iFirstTransform = curr - 2;\n var iFirstPIXO = curr - 1;\n var firstPIXOArg0 = argsArray[iFirstPIXO][0];\n var firstTransformArg0 = argsArray[iFirstTransform][0];\n var firstTransformArg3 = argsArray[iFirstTransform][3];\n var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);\n\n if (count < MIN_IMAGES_IN_BLOCK) {\n return i - (i - iFirstSave) % 4;\n }\n\n var positions = new Float32Array(count * 2);\n var iTransform = iFirstTransform;\n\n for (var q = 0; q < count; q++, iTransform += 4) {\n var transformArgs = argsArray[iTransform];\n positions[q << 1] = transformArgs[4];\n positions[(q << 1) + 1] = transformArgs[5];\n }\n\n var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];\n fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);\n argsArray.splice(iFirstSave, count * 4, args);\n return iFirstSave + 1;\n });\n addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {\n var fnArray = context.fnArray,\n argsArray = context.argsArray;\n var iFirstSave = context.iCurr - 4;\n var pos = (i - iFirstSave) % 5;\n\n switch (pos) {\n case 0:\n return fnArray[i] === _util.OPS.beginText;\n\n case 1:\n return fnArray[i] === _util.OPS.setFont;\n\n case 2:\n return fnArray[i] === _util.OPS.setTextMatrix;\n\n case 3:\n if (fnArray[i] !== _util.OPS.showText) {\n return false;\n }\n\n var iFirstSetFont = context.iCurr - 3;\n var firstSetFontArg0 = argsArray[iFirstSetFont][0];\n var firstSetFontArg1 = argsArray[iFirstSetFont][1];\n\n if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {\n return false;\n }\n\n return true;\n\n case 4:\n return fnArray[i] === _util.OPS.endText;\n }\n\n throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);\n }, function (context, i) {\n var MIN_CHARS_IN_BLOCK = 3;\n var MAX_CHARS_IN_BLOCK = 1000;\n var fnArray = context.fnArray,\n argsArray = context.argsArray;\n var curr = context.iCurr;\n var iFirstBeginText = curr - 4;\n var iFirstSetFont = curr - 3;\n var iFirstSetTextMatrix = curr - 2;\n var iFirstShowText = curr - 1;\n var iFirstEndText = curr;\n var firstSetFontArg0 = argsArray[iFirstSetFont][0];\n var firstSetFontArg1 = argsArray[iFirstSetFont][1];\n var count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);\n\n if (count < MIN_CHARS_IN_BLOCK) {\n return i - (i - iFirstBeginText) % 5;\n }\n\n var iFirst = iFirstBeginText;\n\n if (iFirstBeginText >= 4 && fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) {\n count++;\n iFirst -= 5;\n }\n\n var iEndText = iFirst + 4;\n\n for (var q = 1; q < count; q++) {\n fnArray.splice(iEndText, 3);\n argsArray.splice(iEndText, 3);\n iEndText += 2;\n }\n\n return iEndText + 1;\n });\n\n function QueueOptimizer(queue) {\n this.queue = queue;\n this.state = null;\n this.context = {\n iCurr: 0,\n fnArray: queue.fnArray,\n argsArray: queue.argsArray\n };\n this.match = null;\n this.lastProcessed = 0;\n }\n\n QueueOptimizer.prototype = {\n _optimize() {\n const fnArray = this.queue.fnArray;\n let i = this.lastProcessed,\n ii = fnArray.length;\n let state = this.state;\n let match = this.match;\n\n if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {\n this.lastProcessed = ii;\n return;\n }\n\n const context = this.context;\n\n while (i < ii) {\n if (match) {\n const iterate = (0, match.iterateFn)(context, i);\n\n if (iterate) {\n i++;\n continue;\n }\n\n i = (0, match.processFn)(context, i + 1);\n ii = fnArray.length;\n match = null;\n state = null;\n\n if (i >= ii) {\n break;\n }\n }\n\n state = (state || InitialState)[fnArray[i]];\n\n if (!state || Array.isArray(state)) {\n i++;\n continue;\n }\n\n context.iCurr = i;\n i++;\n\n if (state.checkFn && !(0, state.checkFn)(context)) {\n state = null;\n continue;\n }\n\n match = state;\n state = null;\n }\n\n this.state = state;\n this.match = match;\n this.lastProcessed = i;\n },\n\n push(fn, args) {\n this.queue.fnArray.push(fn);\n this.queue.argsArray.push(args);\n\n this._optimize();\n },\n\n flush() {\n while (this.match) {\n const length = this.queue.fnArray.length;\n this.lastProcessed = (0, this.match.processFn)(this.context, length);\n this.match = null;\n this.state = null;\n\n this._optimize();\n }\n },\n\n reset() {\n this.state = null;\n this.match = null;\n this.lastProcessed = 0;\n }\n\n };\n return QueueOptimizer;\n}();\n\nvar NullOptimizer = function NullOptimizerClosure() {\n function NullOptimizer(queue) {\n this.queue = queue;\n }\n\n NullOptimizer.prototype = {\n push(fn, args) {\n this.queue.fnArray.push(fn);\n this.queue.argsArray.push(args);\n },\n\n flush() {},\n\n reset() {}\n\n };\n return NullOptimizer;\n}();\n\nvar OperatorList = function OperatorListClosure() {\n var CHUNK_SIZE = 1000;\n var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;\n\n function OperatorList(intent, streamSink, pageIndex) {\n this._streamSink = streamSink;\n this.fnArray = [];\n this.argsArray = [];\n\n if (streamSink && intent !== \"oplist\") {\n this.optimizer = new QueueOptimizer(this);\n } else {\n this.optimizer = new NullOptimizer(this);\n }\n\n this.dependencies = Object.create(null);\n this._totalLength = 0;\n this.pageIndex = pageIndex;\n this.intent = intent;\n this.weight = 0;\n this._resolved = streamSink ? null : Promise.resolve();\n }\n\n OperatorList.prototype = {\n get length() {\n return this.argsArray.length;\n },\n\n get ready() {\n return this._resolved || this._streamSink.ready;\n },\n\n get totalLength() {\n return this._totalLength + this.length;\n },\n\n addOp(fn, args) {\n this.optimizer.push(fn, args);\n this.weight++;\n\n if (this._streamSink) {\n if (this.weight >= CHUNK_SIZE) {\n this.flush();\n } else if (this.weight >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {\n this.flush();\n }\n }\n },\n\n addDependency(dependency) {\n if (dependency in this.dependencies) {\n return;\n }\n\n this.dependencies[dependency] = true;\n this.addOp(_util.OPS.dependency, [dependency]);\n },\n\n addDependencies(dependencies) {\n for (var key in dependencies) {\n this.addDependency(key);\n }\n },\n\n addOpList(opList) {\n Object.assign(this.dependencies, opList.dependencies);\n\n for (var i = 0, ii = opList.length; i < ii; i++) {\n this.addOp(opList.fnArray[i], opList.argsArray[i]);\n }\n },\n\n getIR() {\n return {\n fnArray: this.fnArray,\n argsArray: this.argsArray,\n length: this.length\n };\n },\n\n get _transfers() {\n const transfers = [];\n const {\n fnArray,\n argsArray,\n length\n } = this;\n\n for (let i = 0; i < length; i++) {\n switch (fnArray[i]) {\n case _util.OPS.paintInlineImageXObject:\n case _util.OPS.paintInlineImageXObjectGroup:\n case _util.OPS.paintImageMaskXObject:\n const arg = argsArray[i][0];\n ;\n\n if (!arg.cached) {\n transfers.push(arg.data.buffer);\n }\n\n break;\n }\n }\n\n return transfers;\n },\n\n flush(lastChunk = false) {\n this.optimizer.flush();\n const length = this.length;\n this._totalLength += length;\n\n this._streamSink.enqueue({\n fnArray: this.fnArray,\n argsArray: this.argsArray,\n lastChunk,\n length\n }, 1, this._transfers);\n\n this.dependencies = Object.create(null);\n this.fnArray.length = 0;\n this.argsArray.length = 0;\n this.weight = 0;\n this.optimizer.reset();\n }\n\n };\n return OperatorList;\n}();\n\nexports.OperatorList = OperatorList;\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __w_pdfjs_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.PartialEvaluator = void 0;\n\nvar _util = __w_pdfjs_require__(2);\n\nvar _cmap = __w_pdfjs_require__(26);\n\nvar _primitives = __w_pdfjs_require__(4);\n\nvar _fonts = __w_pdfjs_require__(27);\n\nvar _encodings = __w_pdfjs_require__(30);\n\nvar _core_utils = __w_pdfjs_require__(7);\n\nvar _unicode = __w_pdfjs_require__(33);\n\nvar _standard_fonts = __w_pdfjs_require__(32);\n\nvar _pattern = __w_pdfjs_require__(36);\n\nvar _parser = __w_pdfjs_require__(10);\n\nvar _bidi = __w_pdfjs_require__(37);\n\nvar _colorspace = __w_pdfjs_require__(22);\n\nvar _stream = __w_pdfjs_require__(11);\n\nvar _glyphlist = __w_pdfjs_require__(31);\n\nvar _metrics = __w_pdfjs_require__(38);\n\nvar _function = __w_pdfjs_require__(39);\n\nvar _jpeg_stream = __w_pdfjs_require__(17);\n\nvar _murmurhash = __w_pdfjs_require__(41);\n\nvar _image_utils = __w_pdfjs_require__(42);\n\nvar _operator_list = __w_pdfjs_require__(24);\n\nvar _image = __w_pdfjs_require__(43);\n\nvar PartialEvaluator = function PartialEvaluatorClosure() {\n const DefaultPartialEvaluatorOptions = {\n forceDataSchema: false,\n maxImageSize: -1,\n disableFontFace: false,\n nativeImageDecoderSupport: _util.NativeImageDecoding.DECODE,\n ignoreErrors: false,\n isEvalSupported: true\n };\n\n function PartialEvaluator({\n xref,\n handler,\n pageIndex,\n idFactory,\n fontCache,\n builtInCMapCache,\n options = null,\n pdfFunctionFactory\n }) {\n this.xref = xref;\n this.handler = handler;\n this.pageIndex = pageIndex;\n this.idFactory = idFactory;\n this.fontCache = fontCache;\n this.builtInCMapCache = builtInCMapCache;\n this.options = options || DefaultPartialEvaluatorOptions;\n this.pdfFunctionFactory = pdfFunctionFactory;\n this.parsingType3Font = false;\n\n this.fetchBuiltInCMap = async name => {\n if (this.builtInCMapCache.has(name)) {\n return this.builtInCMapCache.get(name);\n }\n\n const readableStream = this.handler.sendWithStream(\"FetchBuiltInCMap\", {\n name\n });\n const reader = readableStream.getReader();\n const data = await new Promise(function (resolve, reject) {\n function pump() {\n reader.read().then(function ({\n value,\n done\n }) {\n if (done) {\n return;\n }\n\n resolve(value);\n pump();\n }, reject);\n }\n\n pump();\n });\n\n if (data.compressionType !== _util.CMapCompressionType.NONE) {\n this.builtInCMapCache.set(name, data);\n }\n\n return data;\n };\n }\n\n var TIME_SLOT_DURATION_MS = 20;\n var CHECK_TIME_EVERY = 100;\n\n function TimeSlotManager() {\n this.reset();\n }\n\n TimeSlotManager.prototype = {\n check: function TimeSlotManager_check() {\n if (++this.checked < CHECK_TIME_EVERY) {\n return false;\n }\n\n this.checked = 0;\n return this.endTime <= Date.now();\n },\n reset: function TimeSlotManager_reset() {\n this.endTime = Date.now() + TIME_SLOT_DURATION_MS;\n this.checked = 0;\n }\n };\n\n function normalizeBlendMode(value, parsingArray = false) {\n if (Array.isArray(value)) {\n for (let i = 0, ii = value.length; i < ii; i++) {\n const maybeBM = normalizeBlendMode(value[i], true);\n\n if (maybeBM) {\n return maybeBM;\n }\n }\n\n (0, _util.warn)(`Unsupported blend mode Array: ${value}`);\n return \"source-over\";\n }\n\n if (!(0, _primitives.isName)(value)) {\n if (parsingArray) {\n return null;\n }\n\n return \"source-over\";\n }\n\n switch (value.name) {\n case \"Normal\":\n case \"Compatible\":\n return \"source-over\";\n\n case \"Multiply\":\n return \"multiply\";\n\n case \"Screen\":\n return \"screen\";\n\n case \"Overlay\":\n return \"overlay\";\n\n case \"Darken\":\n return \"darken\";\n\n case \"Lighten\":\n return \"lighten\";\n\n case \"ColorDodge\":\n return \"color-dodge\";\n\n case \"ColorBurn\":\n return \"color-burn\";\n\n case \"HardLight\":\n return \"hard-light\";\n\n case \"SoftLight\":\n return \"soft-light\";\n\n case \"Difference\":\n return \"difference\";\n\n case \"Exclusion\":\n return \"exclusion\";\n\n case \"Hue\":\n return \"hue\";\n\n case \"Saturation\":\n return \"saturation\";\n\n case \"Color\":\n return \"color\";\n\n case \"Luminosity\":\n return \"luminosity\";\n }\n\n if (parsingArray) {\n return null;\n }\n\n (0, _util.warn)(`Unsupported blend mode: ${value.name}`);\n return \"source-over\";\n }\n\n var deferred = Promise.resolve();\n var TILING_PATTERN = 1,\n SHADING_PATTERN = 2;\n PartialEvaluator.prototype = {\n clone(newOptions = DefaultPartialEvaluatorOptions) {\n var newEvaluator = Object.create(this);\n newEvaluator.options = newOptions;\n return newEvaluator;\n },\n\n hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {\n if (!(resources instanceof _primitives.Dict)) {\n return false;\n }\n\n var processed = Object.create(null);\n\n if (resources.objId) {\n processed[resources.objId] = true;\n }\n\n var nodes = [resources],\n xref = this.xref;\n\n while (nodes.length) {\n var node = nodes.shift();\n var graphicStates = node.get(\"ExtGState\");\n\n if (graphicStates instanceof _primitives.Dict) {\n var graphicStatesKeys = graphicStates.getKeys();\n\n for (let i = 0, ii = graphicStatesKeys.length; i < ii; i++) {\n const key = graphicStatesKeys[i];\n let graphicState = graphicStates.getRaw(key);\n\n if (graphicState instanceof _primitives.Ref) {\n if (processed[graphicState.toString()]) {\n continue;\n }\n\n try {\n graphicState = xref.fetch(graphicState);\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n if (this.options.ignoreErrors) {\n if (graphicState instanceof _primitives.Ref) {\n processed[graphicState.toString()] = true;\n }\n\n this.handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.unknown\n });\n (0, _util.warn)(`hasBlendModes - ignoring ExtGState: \"${ex}\".`);\n continue;\n }\n\n throw ex;\n }\n }\n\n if (!(graphicState instanceof _primitives.Dict)) {\n continue;\n }\n\n if (graphicState.objId) {\n processed[graphicState.objId] = true;\n }\n\n const bm = graphicState.get(\"BM\");\n\n if (bm instanceof _primitives.Name) {\n if (bm.name !== \"Normal\") {\n return true;\n }\n\n continue;\n }\n\n if (bm !== undefined && Array.isArray(bm)) {\n for (let j = 0, jj = bm.length; j < jj; j++) {\n if (bm[j] instanceof _primitives.Name && bm[j].name !== \"Normal\") {\n return true;\n }\n }\n }\n }\n }\n\n var xObjects = node.get(\"XObject\");\n\n if (!(xObjects instanceof _primitives.Dict)) {\n continue;\n }\n\n var xObjectsKeys = xObjects.getKeys();\n\n for (let i = 0, ii = xObjectsKeys.length; i < ii; i++) {\n const key = xObjectsKeys[i];\n var xObject = xObjects.getRaw(key);\n\n if (xObject instanceof _primitives.Ref) {\n if (processed[xObject.toString()]) {\n continue;\n }\n\n try {\n xObject = xref.fetch(xObject);\n } catch (ex) {\n if (ex instanceof _core_utils.MissingDataException) {\n throw ex;\n }\n\n if (this.options.ignoreErrors) {\n if (xObject instanceof _primitives.Ref) {\n processed[xObject.toString()] = true;\n }\n\n this.handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.unknown\n });\n (0, _util.warn)(`hasBlendModes - ignoring XObject: \"${ex}\".`);\n continue;\n }\n\n throw ex;\n }\n }\n\n if (!(0, _primitives.isStream)(xObject)) {\n continue;\n }\n\n if (xObject.dict.objId) {\n if (processed[xObject.dict.objId]) {\n continue;\n }\n\n processed[xObject.dict.objId] = true;\n }\n\n var xResources = xObject.dict.get(\"Resources\");\n\n if (xResources instanceof _primitives.Dict && (!xResources.objId || !processed[xResources.objId])) {\n nodes.push(xResources);\n\n if (xResources.objId) {\n processed[xResources.objId] = true;\n }\n }\n }\n }\n\n return false;\n },\n\n async buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {\n var dict = xobj.dict;\n var matrix = dict.getArray(\"Matrix\");\n var bbox = dict.getArray(\"BBox\");\n\n if (Array.isArray(bbox) && bbox.length === 4) {\n bbox = _util.Util.normalizeRect(bbox);\n } else {\n bbox = null;\n }\n\n var group = dict.get(\"Group\");\n\n if (group) {\n var groupOptions = {\n matrix,\n bbox,\n smask,\n isolated: false,\n knockout: false\n };\n var groupSubtype = group.get(\"S\");\n var colorSpace = null;\n\n if ((0, _primitives.isName)(groupSubtype, \"Transparency\")) {\n groupOptions.isolated = group.get(\"I\") || false;\n groupOptions.knockout = group.get(\"K\") || false;\n\n if (group.has(\"CS\")) {\n colorSpace = await this.parseColorSpace({\n cs: group.get(\"CS\"),\n resources\n });\n }\n }\n\n if (smask && smask.backdrop) {\n colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;\n smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);\n }\n\n operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);\n }\n\n operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);\n return this.getOperatorList({\n stream: xobj,\n task,\n resources: dict.get(\"Resources\") || resources,\n operatorList,\n initialState\n }).then(function () {\n operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);\n\n if (group) {\n operatorList.addOp(_util.OPS.endGroup, [groupOptions]);\n }\n });\n },\n\n async buildPaintImageXObject({\n resources,\n image,\n isInline = false,\n operatorList,\n cacheKey,\n imageCache,\n forceDisableNativeImageDecoder = false\n }) {\n var dict = image.dict;\n var w = dict.get(\"Width\", \"W\");\n var h = dict.get(\"Height\", \"H\");\n\n if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {\n (0, _util.warn)(\"Image dimensions are missing, or not numbers.\");\n return undefined;\n }\n\n var maxImageSize = this.options.maxImageSize;\n\n if (maxImageSize !== -1 && w * h > maxImageSize) {\n (0, _util.warn)(\"Image exceeded maximum allowed size and was removed.\");\n return undefined;\n }\n\n var imageMask = dict.get(\"ImageMask\", \"IM\") || false;\n var imgData, args;\n\n if (imageMask) {\n var width = dict.get(\"Width\", \"W\");\n var height = dict.get(\"Height\", \"H\");\n var bitStrideLength = width + 7 >> 3;\n var imgArray = image.getBytes(bitStrideLength * height, true);\n var decode = dict.getArray(\"Decode\", \"D\");\n imgData = _image.PDFImage.createMask({\n imgArray,\n width,\n height,\n imageIsFromDecodeStream: image instanceof _stream.DecodeStream,\n inverseDecode: !!decode && decode[0] > 0\n });\n imgData.cached = !!cacheKey;\n args = [imgData];\n operatorList.addOp(_util.OPS.paintImageMaskXObject, args);\n\n if (cacheKey) {\n imageCache[cacheKey] = {\n fn: _util.OPS.paintImageMaskXObject,\n args\n };\n }\n\n return undefined;\n }\n\n var softMask = dict.get(\"SMask\", \"SM\") || false;\n var mask = dict.get(\"Mask\") || false;\n var SMALL_IMAGE_DIMENSIONS = 200;\n\n if (isInline && !softMask && !mask && !(image instanceof _jpeg_stream.JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {\n const imageObj = new _image.PDFImage({\n xref: this.xref,\n res: resources,\n image,\n isInline,\n pdfFunctionFactory: this.pdfFunctionFactory\n });\n imgData = imageObj.createImageData(true);\n operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);\n return undefined;\n }\n\n const nativeImageDecoderSupport = forceDisableNativeImageDecoder ? _util.NativeImageDecoding.NONE : this.options.nativeImageDecoderSupport;\n let objId = `img_${this.idFactory.createObjId()}`;\n\n if (this.parsingType3Font) {\n (0, _util.assert)(nativeImageDecoderSupport === _util.NativeImageDecoding.NONE, \"Type3 image resources should be completely decoded in the worker.\");\n objId = `${this.idFactory.getDocId()}_type3res_${objId}`;\n }\n\n if (nativeImageDecoderSupport !== _util.NativeImageDecoding.NONE && !softMask && !mask && image instanceof _jpeg_stream.JpegStream && _image_utils.NativeImageDecoder.isSupported(image, this.xref, resources, this.pdfFunctionFactory) && image.maybeValidDimensions) {\n return this.handler.sendWithPromise(\"obj\", [objId, this.pageIndex, \"JpegStream\", image.getIR(this.options.forceDataSchema)]).then(function () {\n operatorList.addDependency(objId);\n args = [objId, w, h];\n operatorList.addOp(_util.OPS.paintJpegXObject, args);\n\n if (cacheKey) {\n imageCache[cacheKey] = {\n fn: _util.OPS.paintJpegXObject,\n args\n };\n }\n }, reason => {\n (0, _util.warn)(\"Native JPEG decoding failed -- trying to recover: \" + (reason && reason.message));\n return this.buildPaintImageXObject({\n resources,\n image,\n isInline,\n operatorList,\n cacheKey,\n imageCache,\n forceDisableNativeImageDecoder: true\n });\n });\n }\n\n var nativeImageDecoder = null;\n\n if (nativeImageDecoderSupport === _util.NativeImageDecoding.DECODE && (image instanceof _jpeg_stream.JpegStream || mask instanceof _jpeg_stream.JpegStream || softMask instanceof _jpeg_stream.JpegStream)) {\n nativeImageDecoder = new _image_utils.NativeImageDecoder({\n xref: this.xref,\n resources,\n handler: this.handler,\n forceDataSchema: this.options.forceDataSchema,\n pdfFunctionFactory: this.pdfFunctionFactory\n });\n }\n\n operatorList.addDependency(objId);\n args = [objId, w, h];\n\n const imgPromise = _image.PDFImage.buildImage({\n handler: this.handler,\n xref: this.xref,\n res: resources,\n image,\n isInline,\n nativeDecoder: nativeImageDecoder,\n pdfFunctionFactory: this.pdfFunctionFactory\n }).then(imageObj => {\n var imgData = imageObj.createImageData(false);\n\n if (this.parsingType3Font) {\n return this.handler.sendWithPromise(\"commonobj\", [objId, \"FontType3Res\", imgData], [imgData.data.buffer]);\n }\n\n this.handler.send(\"obj\", [objId, this.pageIndex, \"Image\", imgData], [imgData.data.buffer]);\n return undefined;\n }).catch(reason => {\n (0, _util.warn)(\"Unable to decode image: \" + reason);\n\n if (this.parsingType3Font) {\n return this.handler.sendWithPromise(\"commonobj\", [objId, \"FontType3Res\", null]);\n }\n\n this.handler.send(\"obj\", [objId, this.pageIndex, \"Image\", null]);\n return undefined;\n });\n\n if (this.parsingType3Font) {\n await imgPromise;\n }\n\n operatorList.addOp(_util.OPS.paintImageXObject, args);\n\n if (cacheKey) {\n imageCache[cacheKey] = {\n fn: _util.OPS.paintImageXObject,\n args\n };\n }\n\n return undefined;\n },\n\n handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {\n var smaskContent = smask.get(\"G\");\n var smaskOptions = {\n subtype: smask.get(\"S\").name,\n backdrop: smask.get(\"BC\")\n };\n var transferObj = smask.get(\"TR\");\n\n if ((0, _function.isPDFFunction)(transferObj)) {\n const transferFn = this.pdfFunctionFactory.create(transferObj);\n var transferMap = new Uint8Array(256);\n var tmp = new Float32Array(1);\n\n for (var i = 0; i < 256; i++) {\n tmp[0] = i / 255;\n transferFn(tmp, 0, tmp, 0);\n transferMap[i] = tmp[0] * 255 | 0;\n }\n\n smaskOptions.transferMap = transferMap;\n }\n\n return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());\n },\n\n handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {\n const tilingOpList = new _operator_list.OperatorList();\n const resourcesArray = [patternDict.get(\"Resources\"), resources];\n\n const patternResources = _primitives.Dict.merge(this.xref, resourcesArray);\n\n return this.getOperatorList({\n stream: pattern,\n task,\n resources: patternResources,\n operatorList: tilingOpList\n }).then(function () {\n return (0, _pattern.getTilingPatternIR)({\n fnArray: tilingOpList.fnArray,\n argsArray: tilingOpList.argsArray\n }, patternDict, args);\n }).then(function (tilingPatternIR) {\n operatorList.addDependencies(tilingOpList.dependencies);\n operatorList.addOp(fn, tilingPatternIR);\n }, reason => {\n if (reason instanceof _util.AbortException) {\n return;\n }\n\n if (this.options.ignoreErrors) {\n this.handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.unknown\n });\n (0, _util.warn)(`handleTilingType - ignoring pattern: \"${reason}\".`);\n return;\n }\n\n throw reason;\n });\n },\n\n handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {\n var fontName;\n\n if (fontArgs) {\n fontArgs = fontArgs.slice();\n fontName = fontArgs[0].name;\n }\n\n return this.loadFont(fontName, fontRef, resources).then(translated => {\n if (!translated.font.isType3Font) {\n return translated;\n }\n\n return translated.loadType3Data(this, resources, operatorList, task).then(function () {\n return translated;\n }).catch(reason => {\n this.handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.font\n });\n return new TranslatedFont(\"g_font_error\", new _fonts.ErrorFont(\"Type3 font load error: \" + reason), translated.font);\n });\n }).then(translated => {\n state.font = translated.font;\n translated.send(this.handler);\n return translated.loadedName;\n });\n },\n\n handleText(chars, state) {\n const font = state.font;\n const glyphs = font.charsToGlyphs(chars);\n\n if (font.data) {\n const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);\n\n if (isAddToPathSet || state.fillColorSpace.name === \"Pattern\" || font.disableFontFace || this.options.disableFontFace) {\n PartialEvaluator.buildFontPaths(font, glyphs, this.handler);\n }\n }\n\n return glyphs;\n },\n\n ensureStateFont(state) {\n if (state.font) {\n return;\n }\n\n const reason = new _util.FormatError(\"Missing setFont (Tf) operator before text rendering operator.\");\n\n if (this.options.ignoreErrors) {\n this.handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.font\n });\n (0, _util.warn)(`ensureStateFont: \"${reason}\".`);\n return;\n }\n\n throw reason;\n },\n\n setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, stateManager) {\n var gStateObj = [];\n var gStateKeys = gState.getKeys();\n var promise = Promise.resolve();\n\n for (var i = 0, ii = gStateKeys.length; i < ii; i++) {\n const key = gStateKeys[i];\n const value = gState.get(key);\n\n switch (key) {\n case \"Type\":\n break;\n\n case \"LW\":\n case \"LC\":\n case \"LJ\":\n case \"ML\":\n case \"D\":\n case \"RI\":\n case \"FL\":\n case \"CA\":\n case \"ca\":\n gStateObj.push([key, value]);\n break;\n\n case \"Font\":\n promise = promise.then(() => {\n return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {\n operatorList.addDependency(loadedName);\n gStateObj.push([key, [loadedName, value[1]]]);\n });\n });\n break;\n\n case \"BM\":\n gStateObj.push([key, normalizeBlendMode(value)]);\n break;\n\n case \"SMask\":\n if ((0, _primitives.isName)(value, \"None\")) {\n gStateObj.push([key, false]);\n break;\n }\n\n if ((0, _primitives.isDict)(value)) {\n promise = promise.then(() => {\n return this.handleSMask(value, resources, operatorList, task, stateManager);\n });\n gStateObj.push([key, true]);\n } else {\n (0, _util.warn)(\"Unsupported SMask type\");\n }\n\n break;\n\n case \"OP\":\n case \"op\":\n case \"OPM\":\n case \"BG\":\n case \"BG2\":\n case \"UCR\":\n case \"UCR2\":\n case \"TR\":\n case \"TR2\":\n case \"HT\":\n case \"SM\":\n case \"SA\":\n case \"AIS\":\n case \"TK\":\n (0, _util.info)(\"graphic state operator \" + key);\n break;\n\n default:\n (0, _util.info)(\"Unknown graphic state operator \" + key);\n break;\n }\n }\n\n return promise.then(function () {\n if (gStateObj.length > 0) {\n operatorList.addOp(_util.OPS.setGState, [gStateObj]);\n }\n });\n },\n loadFont: function PartialEvaluator_loadFont(fontName, font, resources) {\n function errorFont() {\n return Promise.resolve(new TranslatedFont(\"g_font_error\", new _fonts.ErrorFont(\"Font \" + fontName + \" is not available\"), font));\n }\n\n var fontRef,\n xref = this.xref;\n\n if (font) {\n if (!(0, _primitives.isRef)(font)) {\n throw new _util.FormatError('The \"font\" object should be a reference.');\n }\n\n fontRef = font;\n } else {\n var fontRes = resources.get(\"Font\");\n\n if (fontRes) {\n fontRef = fontRes.getRaw(fontName);\n }\n }\n\n if (!fontRef) {\n const partialMsg = `Font \"${fontName || font && font.toString()}\" is not available`;\n\n if (!this.options.ignoreErrors && !this.parsingType3Font) {\n (0, _util.warn)(`${partialMsg}.`);\n return errorFont();\n }\n\n this.handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.font\n });\n (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);\n fontRef = PartialEvaluator.getFallbackFontDict();\n }\n\n if (this.fontCache.has(fontRef)) {\n return this.fontCache.get(fontRef);\n }\n\n font = xref.fetchIfRef(fontRef);\n\n if (!(0, _primitives.isDict)(font)) {\n return errorFont();\n }\n\n if (font.translated) {\n return font.translated;\n }\n\n var fontCapability = (0, _util.createPromiseCapability)();\n var preEvaluatedFont = this.preEvaluateFont(font);\n const {\n descriptor,\n hash\n } = preEvaluatedFont;\n var fontRefIsRef = (0, _primitives.isRef)(fontRef),\n fontID;\n\n if (fontRefIsRef) {\n fontID = fontRef.toString();\n }\n\n if (hash && (0, _primitives.isDict)(descriptor)) {\n if (!descriptor.fontAliases) {\n descriptor.fontAliases = Object.create(null);\n }\n\n var fontAliases = descriptor.fontAliases;\n\n if (fontAliases[hash]) {\n var aliasFontRef = fontAliases[hash].aliasRef;\n\n if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {\n this.fontCache.putAlias(fontRef, aliasFontRef);\n return this.fontCache.get(fontRef);\n }\n } else {\n fontAliases[hash] = {\n fontID: _fonts.Font.getFontID()\n };\n }\n\n if (fontRefIsRef) {\n fontAliases[hash].aliasRef = fontRef;\n }\n\n fontID = fontAliases[hash].fontID;\n }\n\n if (fontRefIsRef) {\n this.fontCache.put(fontRef, fontCapability.promise);\n } else {\n if (!fontID) {\n fontID = this.idFactory.createObjId();\n }\n\n this.fontCache.put(`id_${fontID}`, fontCapability.promise);\n }\n\n (0, _util.assert)(fontID, 'The \"fontID\" must be defined.');\n font.loadedName = `${this.idFactory.getDocId()}_f${fontID}`;\n font.translated = fontCapability.promise;\n var translatedPromise;\n\n try {\n translatedPromise = this.translateFont(preEvaluatedFont);\n } catch (e) {\n translatedPromise = Promise.reject(e);\n }\n\n translatedPromise.then(function (translatedFont) {\n if (translatedFont.fontType !== undefined) {\n var xrefFontStats = xref.stats.fontTypes;\n xrefFontStats[translatedFont.fontType] = true;\n }\n\n fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));\n }).catch(reason => {\n this.handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.font\n });\n\n try {\n var fontFile3 = descriptor && descriptor.get(\"FontFile3\");\n var subtype = fontFile3 && fontFile3.get(\"Subtype\");\n var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name);\n var xrefFontStats = xref.stats.fontTypes;\n xrefFontStats[fontType] = true;\n } catch (ex) {}\n\n fontCapability.resolve(new TranslatedFont(font.loadedName, new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), font));\n });\n return fontCapability.promise;\n },\n\n buildPath(operatorList, fn, args, parsingText = false) {\n var lastIndex = operatorList.length - 1;\n\n if (!args) {\n args = [];\n }\n\n if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {\n if (parsingText) {\n (0, _util.warn)(`Encountered path operator \"${fn}\" inside of a text object.`);\n operatorList.addOp(_util.OPS.save, null);\n }\n\n operatorList.addOp(_util.OPS.constructPath, [[fn], args]);\n\n if (parsingText) {\n operatorList.addOp(_util.OPS.restore, null);\n }\n } else {\n var opArgs = operatorList.argsArray[lastIndex];\n opArgs[0].push(fn);\n Array.prototype.push.apply(opArgs[1], args);\n }\n },\n\n parseColorSpace({\n cs,\n resources\n }) {\n return new Promise(resolve => {\n resolve(_colorspace.ColorSpace.parse(cs, this.xref, resources, this.pdfFunctionFactory));\n }).catch(reason => {\n if (reason instanceof _util.AbortException) {\n return null;\n }\n\n if (this.options.ignoreErrors) {\n this.handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.unknown\n });\n (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: \"${reason}\".`);\n return null;\n }\n\n throw reason;\n });\n },\n\n async handleColorN(operatorList, fn, args, cs, patterns, resources, task) {\n var patternName = args[args.length - 1];\n var pattern;\n\n if ((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name))) {\n var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;\n var typeNum = dict.get(\"PatternType\");\n\n if (typeNum === TILING_PATTERN) {\n var color = cs.base ? cs.base.getRgb(args, 0) : null;\n return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);\n } else if (typeNum === SHADING_PATTERN) {\n var shading = dict.get(\"Shading\");\n var matrix = dict.getArray(\"Matrix\");\n pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this.pdfFunctionFactory);\n operatorList.addOp(fn, pattern.getIR());\n return undefined;\n }\n\n throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);\n }\n\n throw new _util.FormatError(`Unknown PatternName: ${patternName}`);\n },\n\n getOperatorList({\n stream,\n task,\n resources,\n operatorList,\n initialState = null\n }) {\n resources = resources || _primitives.Dict.empty;\n initialState = initialState || new EvalState();\n\n if (!operatorList) {\n throw new Error('getOperatorList: missing \"operatorList\" parameter');\n }\n\n var self = this;\n var xref = this.xref;\n let parsingText = false;\n var imageCache = Object.create(null);\n\n var xobjs = resources.get(\"XObject\") || _primitives.Dict.empty;\n\n var patterns = resources.get(\"Pattern\") || _primitives.Dict.empty;\n\n var stateManager = new StateManager(initialState);\n var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);\n var timeSlotManager = new TimeSlotManager();\n\n function closePendingRestoreOPS(argument) {\n for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {\n operatorList.addOp(_util.OPS.restore, []);\n }\n }\n\n return new Promise(function promiseBody(resolve, reject) {\n const next = function (promise) {\n Promise.all([promise, operatorList.ready]).then(function () {\n try {\n promiseBody(resolve, reject);\n } catch (ex) {\n reject(ex);\n }\n }, reject);\n };\n\n task.ensureNotTerminated();\n timeSlotManager.reset();\n var stop,\n operation = {},\n i,\n ii,\n cs;\n\n while (!(stop = timeSlotManager.check())) {\n operation.args = null;\n\n if (!preprocessor.read(operation)) {\n break;\n }\n\n var args = operation.args;\n var fn = operation.fn;\n\n switch (fn | 0) {\n case _util.OPS.paintXObject:\n var name = args[0].name;\n\n if (name && imageCache[name] !== undefined) {\n operatorList.addOp(imageCache[name].fn, imageCache[name].args);\n args = null;\n continue;\n }\n\n next(new Promise(function (resolveXObject, rejectXObject) {\n if (!name) {\n throw new _util.FormatError(\"XObject must be referred to by name.\");\n }\n\n const xobj = xobjs.get(name);\n\n if (!xobj) {\n operatorList.addOp(fn, args);\n resolveXObject();\n return;\n }\n\n if (!(0, _primitives.isStream)(xobj)) {\n throw new _util.FormatError(\"XObject should be a stream\");\n }\n\n const type = xobj.dict.get(\"Subtype\");\n\n if (!(0, _primitives.isName)(type)) {\n throw new _util.FormatError(\"XObject should have a Name subtype\");\n }\n\n if (type.name === \"Form\") {\n stateManager.save();\n self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {\n stateManager.restore();\n resolveXObject();\n }, rejectXObject);\n return;\n } else if (type.name === \"Image\") {\n self.buildPaintImageXObject({\n resources,\n image: xobj,\n operatorList,\n cacheKey: name,\n imageCache\n }).then(resolveXObject, rejectXObject);\n return;\n } else if (type.name === \"PS\") {\n (0, _util.info)(\"Ignored XObject subtype PS\");\n } else {\n throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);\n }\n\n resolveXObject();\n }).catch(function (reason) {\n if (reason instanceof _util.AbortException) {\n return;\n }\n\n if (self.options.ignoreErrors) {\n self.handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.unknown\n });\n (0, _util.warn)(`getOperatorList - ignoring XObject: \"${reason}\".`);\n return;\n }\n\n throw reason;\n }));\n return;\n\n case _util.OPS.setFont:\n var fontSize = args[1];\n next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {\n operatorList.addDependency(loadedName);\n operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);\n }));\n return;\n\n case _util.OPS.beginText:\n parsingText = true;\n break;\n\n case _util.OPS.endText:\n parsingText = false;\n break;\n\n case _util.OPS.endInlineImage:\n var cacheKey = args[0].cacheKey;\n\n if (cacheKey) {\n var cacheEntry = imageCache[cacheKey];\n\n if (cacheEntry !== undefined) {\n operatorList.addOp(cacheEntry.fn, cacheEntry.args);\n args = null;\n continue;\n }\n }\n\n next(self.buildPaintImageXObject({\n resources,\n image: args[0],\n isInline: true,\n operatorList,\n cacheKey,\n imageCache\n }));\n return;\n\n case _util.OPS.showText:\n if (!stateManager.state.font) {\n self.ensureStateFont(stateManager.state);\n continue;\n }\n\n args[0] = self.handleText(args[0], stateManager.state);\n break;\n\n case _util.OPS.showSpacedText:\n if (!stateManager.state.font) {\n self.ensureStateFont(stateManager.state);\n continue;\n }\n\n var arr = args[0];\n var combinedGlyphs = [];\n var arrLength = arr.length;\n var state = stateManager.state;\n\n for (i = 0; i < arrLength; ++i) {\n var arrItem = arr[i];\n\n if ((0, _util.isString)(arrItem)) {\n Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));\n } else if ((0, _util.isNum)(arrItem)) {\n combinedGlyphs.push(arrItem);\n }\n }\n\n args[0] = combinedGlyphs;\n fn = _util.OPS.showText;\n break;\n\n case _util.OPS.nextLineShowText:\n if (!stateManager.state.font) {\n self.ensureStateFont(stateManager.state);\n continue;\n }\n\n operatorList.addOp(_util.OPS.nextLine);\n args[0] = self.handleText(args[0], stateManager.state);\n fn = _util.OPS.showText;\n break;\n\n case _util.OPS.nextLineSetSpacingShowText:\n if (!stateManager.state.font) {\n self.ensureStateFont(stateManager.state);\n continue;\n }\n\n operatorList.addOp(_util.OPS.nextLine);\n operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);\n operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);\n args[0] = self.handleText(args[0], stateManager.state);\n fn = _util.OPS.showText;\n break;\n\n case _util.OPS.setTextRenderingMode:\n stateManager.state.textRenderingMode = args[0];\n break;\n\n case _util.OPS.setFillColorSpace:\n next(self.parseColorSpace({\n cs: args[0],\n resources\n }).then(function (colorSpace) {\n if (colorSpace) {\n stateManager.state.fillColorSpace = colorSpace;\n }\n }));\n return;\n\n case _util.OPS.setStrokeColorSpace:\n next(self.parseColorSpace({\n cs: args[0],\n resources\n }).then(function (colorSpace) {\n if (colorSpace) {\n stateManager.state.strokeColorSpace = colorSpace;\n }\n }));\n return;\n\n case _util.OPS.setFillColor:\n cs = stateManager.state.fillColorSpace;\n args = cs.getRgb(args, 0);\n fn = _util.OPS.setFillRGBColor;\n break;\n\n case _util.OPS.setStrokeColor:\n cs = stateManager.state.strokeColorSpace;\n args = cs.getRgb(args, 0);\n fn = _util.OPS.setStrokeRGBColor;\n break;\n\n case _util.OPS.setFillGray:\n stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;\n args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);\n fn = _util.OPS.setFillRGBColor;\n break;\n\n case _util.OPS.setStrokeGray:\n stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;\n args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);\n fn = _util.OPS.setStrokeRGBColor;\n break;\n\n case _util.OPS.setFillCMYKColor:\n stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;\n args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);\n fn = _util.OPS.setFillRGBColor;\n break;\n\n case _util.OPS.setStrokeCMYKColor:\n stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;\n args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);\n fn = _util.OPS.setStrokeRGBColor;\n break;\n\n case _util.OPS.setFillRGBColor:\n stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;\n args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);\n break;\n\n case _util.OPS.setStrokeRGBColor:\n stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;\n args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);\n break;\n\n case _util.OPS.setFillColorN:\n cs = stateManager.state.fillColorSpace;\n\n if (cs.name === \"Pattern\") {\n next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task));\n return;\n }\n\n args = cs.getRgb(args, 0);\n fn = _util.OPS.setFillRGBColor;\n break;\n\n case _util.OPS.setStrokeColorN:\n cs = stateManager.state.strokeColorSpace;\n\n if (cs.name === \"Pattern\") {\n next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task));\n return;\n }\n\n args = cs.getRgb(args, 0);\n fn = _util.OPS.setStrokeRGBColor;\n break;\n\n case _util.OPS.shadingFill:\n var shadingRes = resources.get(\"Shading\");\n\n if (!shadingRes) {\n throw new _util.FormatError(\"No shading resource found\");\n }\n\n var shading = shadingRes.get(args[0].name);\n\n if (!shading) {\n throw new _util.FormatError(\"No shading object found\");\n }\n\n var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self.pdfFunctionFactory);\n\n var patternIR = shadingFill.getIR();\n args = [patternIR];\n fn = _util.OPS.shadingFill;\n break;\n\n case _util.OPS.setGState:\n var dictName = args[0];\n var extGState = resources.get(\"ExtGState\");\n\n if (!(0, _primitives.isDict)(extGState) || !extGState.has(dictName.name)) {\n break;\n }\n\n var gState = extGState.get(dictName.name);\n next(self.setGState(resources, gState, operatorList, task, stateManager));\n return;\n\n case _util.OPS.moveTo:\n case _util.OPS.lineTo:\n case _util.OPS.curveTo:\n case _util.OPS.curveTo2:\n case _util.OPS.curveTo3:\n case _util.OPS.closePath:\n case _util.OPS.rectangle:\n self.buildPath(operatorList, fn, args, parsingText);\n continue;\n\n case _util.OPS.markPoint:\n case _util.OPS.markPointProps:\n case _util.OPS.beginMarkedContent:\n case _util.OPS.beginMarkedContentProps:\n case _util.OPS.endMarkedContent:\n case _util.OPS.beginCompat:\n case _util.OPS.endCompat:\n continue;\n\n default:\n if (args !== null) {\n for (i = 0, ii = args.length; i < ii; i++) {\n if (args[i] instanceof _primitives.Dict) {\n break;\n }\n }\n\n if (i < ii) {\n (0, _util.warn)(\"getOperatorList - ignoring operator: \" + fn);\n continue;\n }\n }\n\n }\n\n operatorList.addOp(fn, args);\n }\n\n if (stop) {\n next(deferred);\n return;\n }\n\n closePendingRestoreOPS();\n resolve();\n }).catch(reason => {\n if (reason instanceof _util.AbortException) {\n return;\n }\n\n if (this.options.ignoreErrors) {\n this.handler.send(\"UnsupportedFeature\", {\n featureId: _util.UNSUPPORTED_FEATURES.unknown\n });\n (0, _util.warn)(`getOperatorList - ignoring errors during \"${task.name}\" ` + `task: \"${reason}\".`);\n closePendingRestoreOPS();\n return;\n }\n\n throw reason;\n });\n },\n\n getTextContent({\n stream,\n task,\n resources,\n stateManager = null,\n normalizeWhitespace = false,\n combineTextItems = false,\n sink,\n seenStyles = Object.create(null)\n }) {\n resources = resources || _primitives.Dict.empty;\n stateManager = stateManager || new StateManager(new TextState());\n var WhitespaceRegexp = /\\s/g;\n var textContent = {\n items: [],\n styles: Object.create(null)\n };\n var textContentItem = {\n initialized: false,\n str: [],\n width: 0,\n height: 0,\n vertical: false,\n lastAdvanceWidth: 0,\n lastAdvanceHeight: 0,\n textAdvanceScale: 0,\n spaceWidth: 0,\n fakeSpaceMin: Infinity,\n fakeMultiSpaceMin: Infinity,\n fakeMultiSpaceMax: -0,\n textRunBreakAllowed: false,\n transform: null,\n fontName: null\n };\n var SPACE_FACTOR = 0.3;\n var MULTI_SPACE_FACTOR = 1.5;\n var MULTI_SPACE_FACTOR_MAX = 4;\n var self = this;\n var xref = this.xref;\n var xobjs = null;\n var skipEmptyXObjs = Object.create(null);\n var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);\n var textState;\n\n function ensureTextContentItem() {\n if (textContentItem.initialized) {\n return textContentItem;\n }\n\n var font = textState.font;\n\n if (!(font.loadedName in seenStyles)) {\n seenStyles[font.loadedName] = true;\n textContent.styles[font.loadedName] = {\n fontFamily: font.fallbackName,\n ascent: font.ascent,\n descent: font.descent,\n vertical: !!font.vertical\n };\n }\n\n textContentItem.fontName = font.loadedName;\n var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];\n\n if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {\n const glyphHeight = font.bbox[3] - font.bbox[1];\n\n if (glyphHeight > 0) {\n tsm[3] *= glyphHeight * textState.fontMatrix[3];\n }\n }\n\n var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));\n\n textContentItem.transform = trm;\n\n if (!font.vertical) {\n textContentItem.width = 0;\n textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);\n textContentItem.vertical = false;\n } else {\n textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);\n textContentItem.height = 0;\n textContentItem.vertical = true;\n }\n\n var a = textState.textLineMatrix[0];\n var b = textState.textLineMatrix[1];\n var scaleLineX = Math.sqrt(a * a + b * b);\n a = textState.ctm[0];\n b = textState.ctm[1];\n var scaleCtmX = Math.sqrt(a * a + b * b);\n textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;\n textContentItem.lastAdvanceWidth = 0;\n textContentItem.lastAdvanceHeight = 0;\n var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;\n\n if (spaceWidth) {\n textContentItem.spaceWidth = spaceWidth;\n textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;\n textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;\n textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;\n textContentItem.textRunBreakAllowed = !font.isMonospace;\n } else {\n textContentItem.spaceWidth = 0;\n textContentItem.fakeSpaceMin = Infinity;\n textContentItem.fakeMultiSpaceMin = Infinity;\n textContentItem.fakeMultiSpaceMax = 0;\n textContentItem.textRunBreakAllowed = false;\n }\n\n textContentItem.initialized = true;\n return textContentItem;\n }\n\n function replaceWhitespace(str) {\n var i = 0,\n ii = str.length,\n code;\n\n while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) {\n i++;\n }\n\n return i < ii ? str.replace(WhitespaceRegexp, \" \") : str;\n }\n\n function runBidiTransform(textChunk) {\n var str = textChunk.str.join(\"\");\n var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical);\n return {\n str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,\n dir: bidiResult.dir,\n width: textChunk.width,\n height: textChunk.height,\n transform: textChunk.transform,\n fontName: textChunk.fontName\n };\n }\n\n function handleSetFont(fontName, fontRef) {\n return self.loadFont(fontName, fontRef, resources).then(function (translated) {\n textState.font = translated.font;\n textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;\n });\n }\n\n function buildTextContentItem(chars) {\n var font = textState.font;\n var textChunk = ensureTextContentItem();\n var width = 0;\n var height = 0;\n var glyphs = font.charsToGlyphs(chars);\n\n for (var i = 0; i < glyphs.length; i++) {\n var glyph = glyphs[i];\n var glyphWidth = null;\n\n if (font.vertical && glyph.vmetric) {\n glyphWidth = glyph.vmetric[0];\n } else {\n glyphWidth = glyph.width;\n }\n\n var glyphUnicode = glyph.unicode;\n var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();\n\n if (NormalizedUnicodes[glyphUnicode] !== undefined) {\n glyphUnicode = NormalizedUnicodes[glyphUnicode];\n }\n\n glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);\n var charSpacing = textState.charSpacing;\n\n if (glyph.isSpace) {\n var wordSpacing = textState.wordSpacing;\n charSpacing += wordSpacing;\n\n if (wordSpacing > 0) {\n addFakeSpaces(wordSpacing, textChunk.str);\n }\n }\n\n var tx = 0;\n var ty = 0;\n\n if (!font.vertical) {\n var w0 = glyphWidth * textState.fontMatrix[0];\n tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;\n width += tx;\n } else {\n var w1 = glyphWidth * textState.fontMatrix[0];\n ty = w1 * textState.fontSize + charSpacing;\n height += ty;\n }\n\n textState.translateTextMatrix(tx, ty);\n textChunk.str.push(glyphUnicode);\n }\n\n if (!font.vertical) {\n textChunk.lastAdvanceWidth = width;\n textChunk.width += width;\n } else {\n textChunk.lastAdvanceHeight = height;\n textChunk.height += Math.abs(height);\n }\n\n return textChunk;\n }\n\n function addFakeSpaces(width, strBuf) {\n if (width < textContentItem.fakeSpaceMin) {\n return;\n }\n\n if (width < textContentItem.fakeMultiSpaceMin) {\n strBuf.push(\" \");\n return;\n }\n\n var fakeSpaces = Math.round(width / textContentItem.spaceWidth);\n\n while (fakeSpaces-- > 0) {\n strBuf.push(\" \");\n }\n }\n\n function flushTextContentItem() {\n if (!textContentItem.initialized) {\n return;\n }\n\n if (!textContentItem.vertical) {\n textContentItem.width *= textContentItem.textAdvanceScale;\n } else {\n textContentItem.height *= textContentItem.textAdvanceScale;\n }\n\n textContent.items.push(runBidiTransform(textContentItem));\n textContentItem.initialized = false;\n textContentItem.str.length = 0;\n }\n\n function enqueueChunk() {\n const length = textContent.items.length;\n\n if (length > 0) {\n sink.enqueue(textContent, length);\n textContent.items = [];\n textContent.styles = Object.create(null);\n }\n }\n\n var timeSlotManager = new TimeSlotManager();\n return new Promise(function promiseBody(resolve, reject) {\n const next = function (promise) {\n enqueueChunk();\n Promise.all([promise, sink.ready]).then(function () {\n try {\n promiseBody(resolve, reject);\n } catch (ex) {\n reject(ex);\n }\n }, reject);\n };\n\n task.ensureNotTerminated();\n timeSlotManager.reset();\n var stop,\n operation = {},\n args = [];\n\n while (!(stop = timeSlotManager.check())) {\n args.length = 0;\n operation.args = args;\n\n if (!preprocessor.read(operation)) {\n break;\n }\n\n textState = stateManager.state;\n var fn = operation.fn;\n args = operation.args;\n var advance, diff;\n\n switch (fn | 0) {\n case _util.OPS.setFont:\n var fontNameArg = args[0].name,\n fontSizeArg = args[1];\n\n if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {\n break;\n }\n\n flushTextContentItem();\n textState.fontName = fontNameArg;\n textState.fontSize = fontSizeArg;\n next(handleSetFont(fontNameArg, null));\n return;\n\n case _util.OPS.setTextRise:\n flushTextContentItem();\n textState.textRise = args[0];\n break;\n\n case _util.OPS.setHScale:\n flushTextContentItem();\n textState.textHScale = args[0] / 100;\n break;\n\n case _util.OPS.setLeading:\n flushTextContentItem();\n textState.leading = args[0];\n break;\n\n case _util.OPS.moveText:\n var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;\n advance = args[0] - args[1];\n\n if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {\n textState.translateTextLineMatrix(args[0], args[1]);\n textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;\n textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;\n diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);\n addFakeSpaces(diff, textContentItem.str);\n break;\n }\n\n flushTextContentItem();\n textState.translateTextLineMatrix(args[0], args[1]);\n textState.textMatrix = textState.textLineMatrix.slice();\n break;\n\n case _util.OPS.setLeadingMoveText:\n flushTextContentItem();\n textState.leading = -args[1];\n textState.translateTextLineMatrix(args[0], args[1]);\n textState.textMatrix = textState.textLineMatrix.slice();\n break;\n\n case _util.OPS.nextLine:\n flushTextContentItem();\n textState.carriageReturn();\n break;\n\n case _util.OPS.setTextMatrix:\n advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);\n\n if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {\n textState.translateTextLineMatrix(advance.width, advance.height);\n textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;\n textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;\n diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);\n addFakeSpaces(diff, textContentItem.str);\n break;\n }\n\n flushTextContentItem();\n textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);\n textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);\n break;\n\n case _util.OPS.setCharSpacing:\n textState.charSpacing = args[0];\n break;\n\n case _util.OPS.setWordSpacing:\n textState.wordSpacing = args[0];\n break;\n\n case _util.OPS.beginText:\n flushTextContentItem();\n textState.textMatrix = _util.IDENTITY_MATRIX.slice();\n textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();\n break;\n\n case _util.OPS.showSpacedText:\n if (!stateManager.state.font) {\n self.ensureStateFont(stateManager.state);\n continue;\n }\n\n var items = args[0];\n var offset;\n\n for (var j = 0, jj = items.length; j < jj; j++) {\n if (typeof items[j] === \"string\") {\n buildTextContentItem(items[j]);\n } else if ((0, _util.isNum)(items[j])) {\n ensureTextContentItem();\n advance = items[j] * textState.fontSize / 1000;\n var breakTextRun = false;\n\n if (textState.font.vertical) {\n offset = advance;\n textState.translateTextMatrix(0, offset);\n breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;\n\n if (!breakTextRun) {\n textContentItem.height += offset;\n }\n } else {\n advance = -advance;\n offset = advance * textState.textHScale;\n textState.translateTextMatrix(offset, 0);\n breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;\n\n if (!breakTextRun) {\n textContentItem.width += offset;\n }\n }\n\n if (breakTextRun) {\n flushTextContentItem();\n } else if (advance > 0) {\n addFakeSpaces(advance, textContentItem.str);\n }\n }\n }\n\n break;\n\n case _util.OPS.showText:\n if (!stateManager.state.font) {\n self.ensureStateFont(stateManager.state);\n continue;\n }\n\n buildTextContentItem(args[0]);\n break;\n\n case _util.OPS.nextLineShowText:\n if (!stateManager.state.font) {\n self.ensureStateFont(stateManager.state);\n continue;\n }\n\n flushTextContentItem();\n textState.carriageReturn();\n buildTextContentItem(args[0]);\n break;\n\n case _util.OPS.nextLineSetSpacingShowText:\n if (!stateManager.state.font) {\n self.ensureStateFont(stateManager.state);\n continue;\n }\n\n flushTextContentItem();\n textState.wordSpacing = args[0];\n textState.charSpacing = args[1];\n textState.carriageReturn();\n buildTextContentItem(args[2]);\n break;\n\n case _util.OPS.paintXObject:\n flushTextContentItem();\n\n if (!xobjs) {\n xobjs = resources.get(\"XObject\") || _primitives.Dict.empty;\n }\n\n var name = args[0].name;\n\n if (name && skipEmptyXObjs[name] !== undefined) {\n break;\n }\n\n next(new Promise(function (resolveXObject, rejectXObject) {\n if (!name) {\n throw new _util.FormatError(\"XObject must be referred to by name.\");\n }\n\n const xobj = xobjs.get(name);\n\n if (!xobj) {\n resolveXObject();\n return;\n }\n\n if (!(0, _primitives.isStream)(xobj)) {\n throw new _util.FormatError(\"XObject should be a stream\");\n }\n\n const type = xobj.dict.get(\"Subtype\");\n\n if (!(0, _primitives.isName)(type)) {\n throw new _util.FormatError(\"XObject should have a Name subtype\");\n }\n\n if (type.name !== \"Form\") {\n skipEmptyXObjs[name] = true;\n resolveXObject();\n return;\n }\n\n const currentState = stateManager.state.clone();\n const xObjStateManager = new StateManager(currentState);\n const matrix = xobj.dict.getArray(\"Matrix\");\n\n if (Array.isArray(matrix) && matrix.length === 6) {\n xObjStateManager.transform(matrix);\n }\n\n enqueueChunk();\n const sinkWrapper = {\n enqueueInvoked: false,\n\n enqueue(chunk, size) {\n this.enqueueInvoked = true;\n sink.enqueue(chunk, size);\n },\n\n get desiredSize() {\n return sink.desiredSize;\n },\n\n get ready() {\n return sink.ready;\n }\n\n };\n self.getTextContent({\n stream: xobj,\n task,\n resources: xobj.dict.get(\"Resources\") || resources,\n stateManager: xObjStateManager,\n normalizeWhitespace,\n combineTextItems,\n sink: sinkWrapper,\n seenStyles\n }).then(function () {\n if (!sinkWrapper.enqueueInvoked) {\n skipEmptyXObjs[name] = true;\n }\n\n resolveXObject();\n }, rejectXObject);\n }).catch(function (reason) {\n if (reason instanceof _util.AbortException) {\n return;\n }\n\n if (self.options.ignoreErrors) {\n (0, _util.warn)(`getTextContent - ignoring XObject: \"${reason}\".`);\n return;\n }\n\n throw reason;\n }));\n return;\n\n case _util.OPS.setGState:\n flushTextContentItem();\n var dictName = args[0];\n var extGState = resources.get(\"ExtGState\");\n\n if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {\n break;\n }\n\n var gState = extGState.get(dictName.name);\n\n if (!(0, _primitives.isDict)(gState)) {\n break;\n }\n\n var gStateFont = gState.get(\"Font\");\n\n if (gStateFont) {\n textState.fontName = null;\n textState.fontSize = gStateFont[1];\n next(handleSetFont(null, gStateFont[0]));\n return;\n }\n\n break;\n }\n\n if (textContent.items.length >= sink.desiredSize) {\n stop = true;\n break;\n }\n }\n\n if (stop) {\n next(deferred);\n return;\n }\n\n flushTextContentItem();\n enqueueChunk();\n resolve();\n }).catch(reason => {\n if (reason instanceof _util.AbortException) {\n return;\n }\n\n if (this.options.ignoreErrors) {\n (0, _util.warn)(`getTextContent - ignoring errors during \"${task.name}\" ` + `task: \"${reason}\".`);\n flushTextContentItem();\n enqueueChunk();\n return;\n }\n\n throw reason;\n });\n },\n\n extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) {\n const xref = this.xref;\n let cidToGidBytes;\n var toUnicode = dict.get(\"ToUnicode\") || baseDict.get(\"ToUnicode\");\n var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);\n\n if (properties.composite) {\n var cidSystemInfo = dict.get(\"CIDSystemInfo\");\n\n if ((0, _primitives.isDict)(cidSystemInfo)) {\n properties.cidSystemInfo = {\n registry: (0, _util.stringToPDFString)(cidSystemInfo.get(\"Registry\")),\n ordering: (0, _util.stringToPDFString)(cidSystemInfo.get(\"Ordering\")),\n supplement: cidSystemInfo.get(\"Supplement\")\n };\n }\n\n var cidToGidMap = dict.get(\"CIDToGIDMap\");\n\n if ((0, _primitives.isStream)(cidToGidMap)) {\n cidToGidBytes = cidToGidMap.getBytes();\n }\n }\n\n var differences = [];\n var baseEncodingName = null;\n var encoding;\n\n if (dict.has(\"Encoding\")) {\n encoding = dict.get(\"Encoding\");\n\n if ((0, _primitives.isDict)(encoding)) {\n baseEncodingName = encoding.get(\"BaseEncoding\");\n baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;\n\n if (encoding.has(\"Differences\")) {\n var diffEncoding = encoding.get(\"Differences\");\n var index = 0;\n\n for (var j = 0, jj = diffEncoding.length; j < jj; j++) {\n var data = xref.fetchIfRef(diffEncoding[j]);\n\n if ((0, _util.isNum)(data)) {\n index = data;\n } else if ((0, _primitives.isName)(data)) {\n differences[index++] = data.name;\n } else {\n throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);\n }\n }\n }\n } else if ((0, _primitives.isName)(encoding)) {\n baseEncodingName = encoding.name;\n } else {\n throw new _util.FormatError(\"Encoding is not a Name nor a Dict\");\n }\n\n if (baseEncodingName !== \"MacRomanEncoding\" && baseEncodingName !== \"MacExpertEncoding\" && baseEncodingName !== \"WinAnsiEncoding\") {\n baseEncodingName = null;\n }\n }\n\n if (baseEncodingName) {\n properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice();\n } else {\n var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic);\n var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic);\n encoding = _encodings.StandardEncoding;\n\n if (properties.type === \"TrueType\" && !isNonsymbolicFont) {\n encoding = _encodings.WinAnsiEncoding;\n }\n\n if (isSymbolicFont) {\n encoding = _encodings.MacRomanEncoding;\n\n if (!properties.file) {\n if (/Symbol/i.test(properties.name)) {\n encoding = _encodings.SymbolSetEncoding;\n } else if (/Dingbats|Wingdings/i.test(properties.name)) {\n encoding = _encodings.ZapfDingbatsEncoding;\n }\n }\n }\n\n properties.defaultEncoding = encoding;\n }\n\n properties.differences = differences;\n properties.baseEncodingName = baseEncodingName;\n properties.hasEncoding = !!baseEncodingName || differences.length > 0;\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment