text: /**
   * @licstart The following is the entire license notice for the
   * Javascript code in this page
   *
   * Copyright 2020 Mozilla Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   * @licend The above is the entire license notice for the
   * Javascript code in this page
   */
  !function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],t):"object"==typeof exports?exports["pdfjs-dist/build/pdf"]=t():e["pdfjs-dist/build/pdf"]=e.pdfjsLib=t()}(this,(function(){return(()=>{"use strict";var __webpack_modules__=[(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"addLinkAttributes",{enumerable:!0,get:function(){return i.addLinkAttributes}});Object.defineProperty(t,"getFilenameFromUrl",{enumerable:!0,get:function(){return i.getFilenameFromUrl}});Object.defineProperty(t,"LinkTarget",{enumerable:!0,get:function(){return i.LinkTarget}});Object.defineProperty(t,"loadScript",{enumerable:!0,get:function(){return i.loadScript}});Object.defineProperty(t,"PDFDateString",{enumerable:!0,get:function(){return i.PDFDateString}});Object.defineProperty(t,"RenderingCancelledException",{enumerable:!0,get:function(){return i.RenderingCancelledException}});Object.defineProperty(t,"build",{enumerable:!0,get:function(){return s.build}});Object.defineProperty(t,"getDocument",{enumerable:!0,get:function(){return s.getDocument}});Object.defineProperty(t,"LoopbackPort",{enumerable:!0,get:function(){return s.LoopbackPort}});Object.defineProperty(t,"PDFDataRangeTransport",{enumerable:!0,get:function(){return s.PDFDataRangeTransport}});Object.defineProperty(t,"PDFWorker",{enumerable:!0,get:function(){return s.PDFWorker}});Object.defineProperty(t,"version",{enumerable:!0,get:function(){return s.version}});Object.defineProperty(t,"CMapCompressionType",{enumerable:!0,get:function(){return r.CMapCompressionType}});Object.defineProperty(t,"createObjectURL",{enumerable:!0,get:function(){return r.createObjectURL}});Object.defineProperty(t,"createPromiseCapability",{enumerable:!0,get:function(){return r.createPromiseCapability}});Object.defineProperty(t,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return r.createValidAbsoluteUrl}});Object.defineProperty(t,"InvalidPDFException",{enumerable:!0,get:function(){return r.InvalidPDFException}});Object.defineProperty(t,"MissingPDFException",{enumerable:!0,get:function(){return r.MissingPDFException}});Object.defineProperty(t,"OPS",{enumerable:!0,get:function(){return r.OPS}});Object.defineProperty(t,"PasswordResponses",{enumerable:!0,get:function(){return r.PasswordResponses}});Object.defineProperty(t,"PermissionFlag",{enumerable:!0,get:function(){return r.PermissionFlag}});Object.defineProperty(t,"removeNullCharacters",{enumerable:!0,get:function(){return r.removeNullCharacters}});Object.defineProperty(t,"shadow",{enumerable:!0,get:function(){return r.shadow}});Object.defineProperty(t,"UnexpectedResponseException",{enumerable:!0,get:function(){return r.UnexpectedResponseException}});Object.defineProperty(t,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return r.UNSUPPORTED_FEATURES}});Object.defineProperty(t,"Util",{enumerable:!0,get:function(){return r.Util}});Object.defineProperty(t,"VerbosityLevel",{enumerable:!0,get:function(){return r.VerbosityLevel}});Object.defineProperty(t,"AnnotationLayer",{enumerable:!0,get:function(){return a.AnnotationLayer}});Object.defineProperty(t,"GlobalWorkerOptions",{enumerable:!0,get:function(){return o.GlobalWorkerOptions}});Object.defineProperty(t,"renderTextLayer",{enumerable:!0,get:function(){return l.renderTextLayer}});Object.defineProperty(t,"SVGGraphics",{enumerable:!0,get:function(){return c.SVGGraphics}});var i=n(1),s=n(4),r=n(2),a=n(19),o=n(12),l=n(21),c=n(22);{const e=n(23).PDFNetworkStream;let t;(0,i.isFetchSupported)()&&(t=n(26).PDFFetchStream);(0,s.setPDFNetworkStreamFactory)((n=>t&&(0,i.isValidFetchUrl)(n.url)?new t(n):new e(n)))}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.addLinkAttributes=function addLinkAttributes(e,{url:t,target:n,rel:r,enabled:o=!0}={}){(0,i.assert)(t&&"string"==typeof t,'addLinkAttributes: A valid "url" parameter must provided.');const l=(0,i.removeNullCharacters)(t);if(o)e.href=e.title=l;else{e.href="";e.title=`Disabled: ${l}`;e.onclick=()=>!1}let c="";switch(n){case a.NONE:break;case a.SELF:c="_self";break;case a.BLANK:c="_blank";break;case a.PARENT:c="_parent";break;case a.TOP:c="_top"}e.target=c;e.rel="string"==typeof r?r:s};t.getFilenameFromUrl=function getFilenameFromUrl(e){const t=e.indexOf("#"),n=e.indexOf("?"),i=Math.min(t>0?t:e.length,n>0?n:e.length);return e.substring(e.lastIndexOf("/",i)+1,i)};t.isFetchSupported=isFetchSupported;t.isValidFetchUrl=isValidFetchUrl;t.loadScript=function loadScript(e,t=!1){return new Promise(((n,i)=>{const s=document.createElement("script");s.src=e;s.onload=function(e){t&&s.remove();n(e)};s.onerror=function(){i(new Error(`Cannot load script at: ${s.src}`))};(document.head||document.documentElement).appendChild(s)}))};t.deprecated=function deprecated(e){console.log("Deprecated API usage: "+e)};t.PDFDateString=t.StatTimer=t.DOMSVGFactory=t.DOMCMapReaderFactory=t.BaseCMapReaderFactory=t.DOMCanvasFactory=t.BaseCanvasFactory=t.DEFAULT_LINK_REL=t.LinkTarget=t.RenderingCancelledException=t.PageViewport=void 0;var i=n(2);const s="noopener noreferrer nofollow";t.DEFAULT_LINK_REL=s;const r="http://www.w3.org/2000/svg";class BaseCanvasFactory{constructor(){this.constructor===BaseCanvasFactory&&(0,i.unreachable)("Cannot initialize BaseCanvasFactory.")}create(e,t){(0,i.unreachable)("Abstract method `create` called.")}reset(e,t,n){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=t;e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0;e.canvas.height=0;e.canvas=null;e.context=null}}t.BaseCanvasFactory=BaseCanvasFactory;t.DOMCanvasFactory=class DOMCanvasFactory extends BaseCanvasFactory{constructor({ownerDocument:e=globalThis.document}={}){super();this._document=e}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const n=this._document.createElement("canvas"),i=n.getContext("2d");n.width=e;n.height=t;return{canvas:n,context:i}}};class BaseCMapReaderFactory{constructor({baseUrl:e=null,isCompressed:t=!1}){this.constructor===BaseCMapReaderFactory&&(0,i.unreachable)("Cannot initialize BaseCMapReaderFactory.");this.baseUrl=e;this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":""),n=this.isCompressed?i.CMapCompressionType.BINARY:i.CMapCompressionType.NONE;return this._fetchData(t,n).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}_fetchData(e,t){(0,i.unreachable)("Abstract method `_fetchData` called.")}}t.BaseCMapReaderFactory=BaseCMapReaderFactory;t.DOMCMapReaderFactory=class DOMCMapReaderFactory extends BaseCMapReaderFactory{_fetchData(e,t){return isFetchSupported()&&isValidFetchUrl(e,document.baseURI)?fetch(e).then((async e=>{if(!e.ok)throw new Error(e.statusText);let n;n=this.isCompressed?new Uint8Array(await e.arrayBuffer()):(0,i.stringToBytes)(await e.text());return{cMapData:n,compressionType:t}})):new Promise(((n,s)=>{const r=new XMLHttpRequest;r.open("GET",e,!0);this.isCompressed&&(r.responseType="arraybuffer");r.onreadystatechange=()=>{if(r.readyState===XMLHttpRequest.DONE){if(200===r.status||0===r.status){let e;this.isCompressed&&r.response?e=new Uint8Array(r.response):!this.isCompressed&&r.responseText&&(e=(0,i.stringToBytes)(r.responseText));if(e){n({cMapData:e,compressionType:t});return}}s(new Error(r.statusText))}};r.send(null)}))}};t.DOMSVGFactory=class DOMSVGFactory{create(e,t){(0,i.assert)(e>0&&t>0,"Invalid SVG dimensions");const n=document.createElementNS(r,"svg:svg");n.setAttribute("version","1.1");n.setAttribute("width",e+"px");n.setAttribute("height",t+"px");n.setAttribute("preserveAspectRatio","none");n.setAttribute("viewBox","0 0 "+e+" "+t);return n}createElement(e){(0,i.assert)("string"==typeof e,"Invalid SVG element type");return document.createElementNS(r,e)}};class PageViewport{constructor({viewBox:e,scale:t,rotation:n,offsetX:i=0,offsetY:s=0,dontFlip:r=!1}){this.viewBox=e;this.scale=t;this.rotation=n;this.offsetX=i;this.offsetY=s;const a=(e[2]+e[0])/2,o=(e[3]+e[1])/2;let l,c,h,d,u,p,g,f;switch(n=(n%=360)<0?n+360:n){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;case 0:l=1;c=0;h=0;d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(r){h=-h;d=-d}if(0===l){u=Math.abs(o-e[1])*t+i;p=Math.abs(a-e[0])*t+s;g=Math.abs(e[3]-e[1])*t;f=Math.abs(e[2]-e[0])*t}else{u=Math.abs(a-e[0])*t+i;p=Math.abs(o-e[1])*t+s;g=Math.abs(e[2]-e[0])*t;f=Math.abs(e[3]-e[1])*t}this.transform=[l*t,c*t,h*t,d*t,u-l*t*a-h*t*o,p-c*t*a-d*t*o];this.width=g;this.height=f}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:n=this.offsetX,offsetY:i=this.offsetY,dontFlip:s=!1}={}){return new PageViewport({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:n,offsetY:i,dontFlip:s})}convertToViewportPoint(e,t){return i.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=i.Util.applyTransform([e[0],e[1]],this.transform),n=i.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){return i.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=PageViewport;class RenderingCancelledException extends i.BaseException{constructor(e,t){super(e);this.type=t}}t.RenderingCancelledException=RenderingCancelledException;const a={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};t.LinkTarget=a;t.StatTimer=class StatTimer{constructor(){this.started=Object.create(null);this.times=[]}time(e){e in this.started&&(0,i.warn)(`Timer is already running for ${e}`);this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,i.warn)(`Timer has not been started for ${e}`);this.times.push({name:e,start:this.started[e],end:Date.now()});delete this.started[e]}toString(){const e=[];let t=0;for(const e of this.times){const n=e.name;n.length>t&&(t=n.length)}for(const n of this.times){const i=n.end-n.start;e.push(`${n.name.padEnd(t)} ${i}ms\n`)}return e.join("")}};function isFetchSupported(){return"undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&"undefined"!=typeof ReadableStream}function isValidFetchUrl(e,t){try{const{protocol:n}=t?new URL(e,t):new URL(e);return"http:"===n||"https:"===n}catch(e){return!1}}let o;t.PDFDateString=class PDFDateString{static toDateObject(e){if(!e||!(0,i.isString)(e))return null;o||(o=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=o.exec(e);if(!t)return null;const n=parseInt(t[1],10);let s=parseInt(t[2],10);s=s>=1&&s<=12?s-1:0;let r=parseInt(t[3],10);r=r>=1&&r<=31?r:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let l=parseInt(t[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(t[6],10);c=c>=0&&c<=59?c:0;const h=t[7]||"Z";let d=parseInt(t[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(t[9],10)||0;u=u>=0&&u<=59?u:0;if("-"===h){a+=d;l+=u}else if("+"===h){a-=d;l-=u}return new Date(Date.UTC(n,s,r,a,l,c))}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.arrayByteLength=arrayByteLength;t.arraysToBytes=function arraysToBytes(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let n=0;for(let i=0;i<t;i++)n+=arrayByteLength(e[i]);let i=0;const s=new Uint8Array(n);for(let n=0;n<t;n++){let t=e[n];t instanceof Uint8Array||(t="string"==typeof t?stringToBytes(t):new Uint8Array(t));const r=t.byteLength;s.set(t,i);i+=r}return s};t.assert=assert;t.bytesToString=function bytesToString(e){assert(null!==e&&"object"==typeof e&&void 0!==e.length,"Invalid argument for bytesToString");const t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);const i=[];for(let s=0;s<t;s+=n){const r=Math.min(s+n,t),a=e.subarray(s,r);i.push(String.fromCharCode.apply(null,a))}return i.join("")};t.createPromiseCapability=function createPromiseCapability(){const e=Object.create(null);let t=!1;Object.defineProperty(e,"settled",{get:()=>t});e.promise=new Promise((function(n,i){e.resolve=function(e){t=!0;n(e)};e.reject=function(e){t=!0;i(e)}}));return e};t.escapeString=function escapeString(e){return e.replace(/([()\\\n\r])/g,(e=>"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))};t.encodeToXmlString=function encodeToXmlString(e){const t=[];let n=0;for(let i=0,s=e.length;i<s;i++){const s=e.codePointAt(i);if(32<=s&&s<=126){const r=u[s];if(r){n<i&&t.push(e.substring(n,i));t.push(r);n=i+1}}else{n<i&&t.push(e.substring(n,i));t.push(`&#x${s.toString(16).toUpperCase()};`);s>55295&&(s<57344||s>65533)&&i++;n=i+1}}if(0===t.length)return e;n<e.length&&t.push(e.substring(n,e.length));return t.join("")};t.getModificationDate=function getModificationDate(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")};t.getVerbosityLevel=function getVerbosityLevel(){return s};t.info=function info(e){s>=i.INFOS&&console.log(`Info: ${e}`)};t.isArrayBuffer=function isArrayBuffer(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength};t.isArrayEqual=function isArrayEqual(e,t){if(e.length!==t.length)return!1;return e.every((function(e,n){return e===t[n]}))};t.isBool=function isBool(e){return"boolean"==typeof e};t.isNum=function isNum(e){return"number"==typeof e};t.isString=function isString(e){return"string"==typeof e};t.isSameOrigin=function isSameOrigin(e,t){let n;try{n=new URL(e);if(!n.origin||"null"===n.origin)return!1}catch(e){return!1}const i=new URL(t,n);return n.origin===i.origin};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e,t){if(!e)return null;try{const n=t?new URL(e,t):new URL(e);if(function _isValidProtocol(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch(e){}return null};t.objectSize=function objectSize(e){return Object.keys(e).length};t.objectFromEntries=function objectFromEntries(e){return Object.assign(Object.create(null),Object.fromEntries(e))};t.removeNullCharacters=function removeNullCharacters(e){if("string"!=typeof e){warn("The argument for removeNullCharacters must be a string.");return e}return e.replace(a,"")};t.setVerbosityLevel=function setVerbosityLevel(e){Number.isInteger(e)&&(s=e)};t.shadow=shadow;t.string32=function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)};t.stringToBytes=stringToBytes;t.stringToPDFString=function stringToPDFString(e){const t=e.length,n=[];if("þ"===e[0]&&"ÿ"===e[1])for(let i=2;i<t;i+=2)n.push(String.fromCharCode(e.charCodeAt(i)<<8|e.charCodeAt(i+1)));else if("ÿ"===e[0]&&"þ"===e[1])for(let i=2;i<t;i+=2)n.push(String.fromCharCode(e.charCodeAt(i+1)<<8|e.charCodeAt(i)));else for(let i=0;i<t;++i){const t=h[e.charCodeAt(i)];n.push(t?String.fromCharCode(t):e.charAt(i))}return n.join("")};t.stringToUTF8String=function stringToUTF8String(e){return decodeURIComponent(escape(e))};t.utf8StringToString=function utf8StringToString(e){return unescape(encodeURIComponent(e))};t.warn=warn;t.unreachable=unreachable;t.IsEvalSupportedCached=t.IsLittleEndianCached=t.createObjectURL=t.FormatError=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.StreamType=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.MissingPDFException=t.InvalidPDFException=t.AbortException=t.DocumentActionEventType=t.CMapCompressionType=t.ImageKind=t.FontType=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.UNSUPPORTED_FEATURES=t.VerbosityLevel=t.OPS=t.IDENTITY_MATRIX=t.FONT_IDENTITY_MATRIX=t.BaseException=void 0;n(3);t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.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};t.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};t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};t.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};t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};t.AnnotationReplyType={GROUP:"Group",REPLY:"R"};t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};t.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};t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};t.AnnotationActionEventType={E:"MouseEnter",X:"MouseExit",D:"MouseDown",U:"MouseUp",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};t.PageActionEventType={O:"PageOpen",C:"PageClose"};t.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};t.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const i={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=i;t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2};t.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};t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent"};t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let s=i.WARNINGS;function warn(e){s>=i.WARNINGS&&console.log(`Warning: ${e}`)}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function shadow(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!1});return n}const r=function BaseExceptionClosure(){function BaseException(e){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=e;this.name=this.constructor.name}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();t.BaseException=r;t.PasswordException=class PasswordException extends r{constructor(e,t){super(e);this.code=t}};t.UnknownErrorException=class UnknownErrorException extends r{constructor(e,t){super(e);this.details=t}};t.InvalidPDFException=class InvalidPDFException extends r{};t.MissingPDFException=class MissingPDFException extends r{};t.UnexpectedResponseException=class UnexpectedResponseException extends r{constructor(e,t){super(e);this.status=t}};t.FormatError=class FormatError extends r{};t.AbortException=class AbortException extends r{};const a=/\x00/g;function stringToBytes(e){assert("string"==typeof e,"Invalid argument for stringToBytes");const t=e.length,n=new Uint8Array(t);for(let i=0;i<t;++i)n[i]=255&e.charCodeAt(i);return n}function arrayByteLength(e){if(void 0!==e.length)return e.length;assert(void 0!==e.byteLength,"arrayByteLength - invalid argument.");return e.byteLength}const o={get value(){return shadow(this,"value",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}};t.IsLittleEndianCached=o;const l={get value(){return shadow(this,"value",function isEvalSupported(){try{new Function("");return!0}catch(e){return!1}}())}};t.IsEvalSupportedCached=l;const c=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,n){return`#${c[e]}${c[t]}${c[n]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]}static getAxialAlignedBoundingBox(e,t){const n=Util.applyTransform(e,t),i=Util.applyTransform(e.slice(2,4),t),s=Util.applyTransform([e[0],e[3]],t),r=Util.applyTransform([e[2],e[1]],t);return[Math.min(n[0],i[0],s[0],r[0]),Math.min(n[1],i[1],s[1],r[1]),Math.max(n[0],i[0],s[0],r[0]),Math.max(n[1],i[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static apply3dTransform(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],i=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],a=(n+r)/2,o=Math.sqrt((n+r)*(n+r)-4*(n*r-s*i))/2,l=a+o||1,c=a-o||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){function compare(e,t){return e-t}const n=[e[0],e[2],t[0],t[2]].sort(compare),i=[e[1],e[3],t[1],t[3]].sort(compare),s=[];e=Util.normalizeRect(e);t=Util.normalizeRect(t);if(!(n[0]===e[0]&&n[1]===t[0]||n[0]===t[0]&&n[1]===e[0]))return null;s[0]=n[1];s[2]=n[2];if(!(i[0]===e[1]&&i[1]===t[1]||i[0]===t[1]&&i[1]===e[1]))return null;s[1]=i[1];s[3]=i[2];return s}}t.Util=Util;const h=[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];const d=function createObjectURLClosure(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return function createObjectURL(t,n,i=!1){if(!i&&URL.createObjectURL){const e=new Blob([t],{type:n});return URL.createObjectURL(e)}let s=`data:${n};base64,`;for(let n=0,i=t.length;n<i;n+=3){const r=255&t[n],a=255&t[n+1],o=255&t[n+2];s+=e[r>>2]+e[(3&r)<<4|a>>4]+e[n+1<i?(15&a)<<2|o>>6:64]+e[n+2<i?63&o:64]}return s}}();t.createObjectURL=d;const u={60:"&lt;",62:"&gt;",38:"&amp;",34:"&quot;",39:"&apos;"}},()=>{},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{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__(2),_display_utils=__w_pdfjs_require__(1),_font_loader=__w_pdfjs_require__(5),_node_utils=__w_pdfjs_require__(6),_annotation_storage=__w_pdfjs_require__(8),_api_compatibility=__w_pdfjs_require__(9),_canvas=__w_pdfjs_require__(10),_worker_options=__w_pdfjs_require__(12),_is_node=__w_pdfjs_require__(7),_message_handler=__w_pdfjs_require__(13),_metadata=__w_pdfjs_require__(14),_optional_content_config=__w_pdfjs_require__(16),_transport_stream=__w_pdfjs_require__(17),_webgl=__w_pdfjs_require__(18);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,ServiceWorkerOptions={showUnverifiedSignatures:!1};window.ServiceWorkerOptions=ServiceWorkerOptions;const DefaultCanvasFactory=_is_node.isNodeJS?_node_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory,DefaultCMapReaderFactory=_is_node.isNodeJS?_node_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;let createPDFNetworkStream;function setPDFNetworkStreamFactory(e){createPDFNetworkStream=e}function getDocument(e){const t=new PDFDocumentLoadingTask;let n;if("string"==typeof e)n={url:e};else if((0,_util.isArrayBuffer)(e))n={data:e};else if(e instanceof PDFDataRangeTransport)n={range:e};else{if("object"!=typeof e)throw new Error("Invalid parameter in getDocument, need either Uint8Array, string or a parameter object");if(!e.url&&!e.data&&!e.range)throw new Error("Invalid parameter object: need either .data, .range or .url");n=e}const i=Object.create(null);let s=null,r=null;for(const e in n)if("url"!==e||"undefined"==typeof window)if("range"!==e)if("worker"!==e)if("data"!==e||n[e]instanceof Uint8Array)i[e]=n[e];else{const t=n[e];if("string"==typeof t)i[e]=(0,_util.stringToBytes)(t);else if("object"!=typeof t||null===t||isNaN(t.length)){if(!(0,_util.isArrayBuffer)(t))throw new Error("Invalid PDF binary data: either typed array, string or array-like object is expected in the data property.");i[e]=new Uint8Array(t)}else i[e]=new Uint8Array(t)}else r=n[e];else s=n[e];else i[e]=new URL(n[e],window.location).href;i.rangeChunkSize=i.rangeChunkSize||DEFAULT_RANGE_CHUNK_SIZE;i.CMapReaderFactory=i.CMapReaderFactory||DefaultCMapReaderFactory;i.ignoreErrors=!0!==i.stopAtErrors;i.fontExtraProperties=!0===i.fontExtraProperties;i.pdfBug=!0===i.pdfBug;Number.isInteger(i.maxImageSize)||(i.maxImageSize=-1);"boolean"!=typeof i.isEvalSupported&&(i.isEvalSupported=!0);"boolean"!=typeof i.disableFontFace&&(i.disableFontFace=_api_compatibility.apiCompatibilityParams.disableFontFace||!1);void 0===i.ownerDocument&&(i.ownerDocument=globalThis.document);"boolean"!=typeof i.disableRange&&(i.disableRange=!1);"boolean"!=typeof i.disableStream&&(i.disableStream=!1);"boolean"!=typeof i.disableAutoFetch&&(i.disableAutoFetch=!1);(0,_util.setVerbosityLevel)(i.verbosity);if(!r){const e={verbosity:i.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};r=e.port?PDFWorker.fromPort(e):new PDFWorker(e);t._worker=r}const a=t.docId;r.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");const e=_fetchDocument(r,i,s,a),n=new Promise((function(e){let t;s?t=new _transport_stream.PDFDataTransportStream({length:i.length,initialData:i.initialData,progressiveDone:i.progressiveDone,disableRange:i.disableRange,disableStream:i.disableStream},s):i.data||(t=createPDFNetworkStream({url:i.url,length:i.length,httpHeaders:i.httpHeaders,withCredentials:i.withCredentials,rangeChunkSize:i.rangeChunkSize,disableRange:i.disableRange,disableStream:i.disableStream}));e(t)}));return Promise.all([e,n]).then((function([e,n]){if(t.destroyed)throw new Error("Loading aborted");const s=new _message_handler.MessageHandler(a,e,r.port);s.postMessageTransfers=r.postMessageTransfers;const o=new WorkerTransport(s,t,n,i);t._transport=o;s.send("showUnverifiedSignatures",window.ServiceWorkerOptions.showUnverifiedSignatures);s.send("Ready",null)}))})).catch(t._capability.reject);return t}function _fetchDocument(e,t,n,i){if(e.destroyed)return Promise.reject(new Error("Worker was destroyed"));if(n){t.length=n.length;t.initialData=n.initialData;t.progressiveDone=n.progressiveDone}return e.messageHandler.sendWithPromise("GetDocRequest",{docId:i,apiVersion:"2.7.536",source:{data:t.data,url:t.url,password:t.password,disableAutoFetch:t.disableAutoFetch,rangeChunkSize:t.rangeChunkSize,length:t.length},maxImageSize:t.maxImageSize,disableFontFace:t.disableFontFace,postMessageTransfers:e.postMessageTransfers,docBaseUrl:t.docBaseUrl,ignoreErrors:t.ignoreErrors,isEvalSupported:t.isEvalSupported,fontExtraProperties:t.fontExtraProperties}).then((function(t){if(e.destroyed)throw new Error("Worker was destroyed");return t}))}const PDFDocumentLoadingTask=function PDFDocumentLoadingTaskClosure(){let e=0;return class PDFDocumentLoadingTask{constructor(){this._capability=(0,_util.createPromiseCapability)();this._transport=null;this._worker=null;this.docId="d"+e++;this.destroyed=!1;this.onPassword=null;this.onProgress=null;this.onUnsupportedFeature=null}get promise(){return this._capability.promise}destroy(){this.destroyed=!0;return(this._transport?this._transport.destroy():Promise.resolve()).then((()=>{this._transport=null;if(this._worker){this._worker.destroy();this._worker=null}}))}}}();class PDFDataRangeTransport{constructor(e,t,n=!1){this.length=e;this.initialData=t;this.progressiveDone=n;this._rangeListeners=[];this._progressListeners=[];this._progressiveReadListeners=[];this._progressiveDoneListeners=[];this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const n of this._rangeListeners)n(e,t)}onDataProgress(e,t){this._readyCapability.promise.then((()=>{for(const n of this._progressListeners)n(e,t)}))}onDataProgressiveRead(e){this._readyCapability.promise.then((()=>{for(const t of this._progressiveReadListeners)t(e)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const e of this._progressiveDoneListeners)e()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(e,t){this._pdfInfo=e;this._transport=t}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}get numPages(){return this._pdfInfo.numPages}get fingerprint(){return this._pdfInfo.fingerprint}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}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()}getAttachments(){return this._transport.getAttachments()}getJavaScript(){return this._transport.getJavaScript()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}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}saveDocument(e){return this._transport.saveDocument(e)}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(e,t,n,i,s=!1){this._pageIndex=e;this._pageInfo=t;this._ownerDocument=i;this._transport=n;this._stats=s?new _display_utils.StatTimer:null;this._pdfBug=s;this.commonObjs=n.commonObjs;this.objs=new PDFObjects;this.cleanupAfterRender=!1;this.pendingCleanup=!1;this._intentStates=new Map;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:e,rotation:t=this.rotate,offsetX:n=0,offsetY:i=0,dontFlip:s=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:n,offsetY:i,dontFlip:s})}getAnnotations({intent:e=null}={}){if(!this.annotationsPromise||this.annotationsIntent!==e){this.annotationsPromise=this._transport.getAnnotations(this._pageIndex,e);this.annotationsIntent=e}return this.annotationsPromise}getJSActions(){this._jsActionsPromise||(this._jsActionsPromise=this._transport.getPageJSActions(this._pageIndex));return this._jsActionsPromise}render({canvasContext:e,viewport:t,intent:n="display",enableWebGL:i=!1,renderInteractiveForms:s=!1,transform:r=null,imageLayer:a=null,canvasFactory:o=null,background:l=null,annotationStorage:c=null,optionalContentConfigPromise:h=null}){this._stats&&this._stats.time("Overall");const d="print"===n?"print":"display";this.pendingCleanup=!1;h||(h=this._transport.getOptionalContentConfig());let u=this._intentStates.get(d);if(!u){u=Object.create(null);this._intentStates.set(d,u)}if(u.streamReaderCancelTimeout){clearTimeout(u.streamReaderCancelTimeout);u.streamReaderCancelTimeout=null}const p=o||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),g=new _webgl.WebGLContext({enable:i});if(!u.displayReadyCapability){u.displayReadyCapability=(0,_util.createPromiseCapability)();u.operatorList={fnArray:[],argsArray:[],lastChunk:!1};this._stats&&this._stats.time("Page Request");this._pumpOperatorList({pageIndex:this._pageIndex,intent:d,renderInteractiveForms:!0===s,annotationStorage:c?.getAll()||null})}const complete=e=>{const t=u.renderTasks.indexOf(f);t>=0&&u.renderTasks.splice(t,1);(this.cleanupAfterRender||"print"===d)&&(this.pendingCleanup=!0);this._tryCleanup();if(e){f.capability.reject(e);this._abortOperatorList({intentState:u,reason:e})}else f.capability.resolve();if(this._stats){this._stats.timeEnd("Rendering");this._stats.timeEnd("Overall")}},f=new InternalRenderTask({callback:complete,params:{canvasContext:e,viewport:t,transform:r,imageLayer:a,background:l},objs:this.objs,commonObjs:this.commonObjs,operatorList:u.operatorList,pageIndex:this._pageIndex,canvasFactory:p,webGLContext:g,useRequestAnimationFrame:"print"!==d,pdfBug:this._pdfBug});u.renderTasks||(u.renderTasks=[]);u.renderTasks.push(f);const m=f.task;Promise.all([u.displayReadyCapability.promise,h]).then((([e,t])=>{if(this.pendingCleanup)complete();else{this._stats&&this._stats.time("Rendering");f.initializeGraphics({transparency:e,optionalContentConfig:t});f.operatorListChanged()}})).catch(complete);return m}getOperatorList(){const e="oplist";let t,n=this._intentStates.get(e);if(!n){n=Object.create(null);this._intentStates.set(e,n)}if(!n.opListReadCapability){t=Object.create(null);t.operatorListChanged=function operatorListChanged(){if(n.operatorList.lastChunk){n.opListReadCapability.resolve(n.operatorList);const e=n.renderTasks.indexOf(t);e>=0&&n.renderTasks.splice(e,1)}};n.opListReadCapability=(0,_util.createPromiseCapability)();n.renderTasks=[];n.renderTasks.push(t);n.operatorList={fnArray:[],argsArray:[],lastChunk:!1};this._stats&&this._stats.time("Page Request");this._pumpOperatorList({pageIndex:this._pageIndex,intent:e})}return n.opListReadCapability.promise}streamTextContent({normalizeWhitespace:e=!1,disableCombineTextItems:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,normalizeWhitespace:!0===e,combineTextItems:!0!==t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){const t=this.streamTextContent(e);return new Promise((function(e,n){const i=t.getReader(),s={items:[],styles:Object.create(null)};!function pump(){i.read().then((function({value:t,done:n}){if(n)e(s);else{Object.assign(s.styles,t.styles);s.items.push(...t.items);pump()}}),n)}()}))}_destroy(){this.destroyed=!0;this._transport.pageCache[this._pageIndex]=null;const e=[];for(const[t,n]of this._intentStates){this._abortOperatorList({intentState:n,reason:new Error("Page was destroyed."),force:!0});if("oplist"!==t)for(const t of n.renderTasks){e.push(t.completed);t.cancel()}}this.objs.clear();this.annotationsPromise=null;this._jsActionsPromise=null;this.pendingCleanup=!1;return Promise.all(e)}cleanup(e=!1){this.pendingCleanup=!0;return this._tryCleanup(e)}_tryCleanup(e=!1){if(!this.pendingCleanup)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(0!==e.length||!t.lastChunk)return!1;this._intentStates.clear();this.objs.clear();this.annotationsPromise=null;this._jsActionsPromise=null;e&&this._stats&&(this._stats=new _display_utils.StatTimer);this.pendingCleanup=!1;return!0}_startRenderPage(e,t){const n=this._intentStates.get(t);if(n){this._stats&&this._stats.timeEnd("Page Request");n.displayReadyCapability&&n.displayReadyCapability.resolve(e)}}_renderPageChunk(e,t){for(let n=0,i=e.length;n<i;n++){t.operatorList.fnArray.push(e.fnArray[n]);t.operatorList.argsArray.push(e.argsArray[n])}t.operatorList.lastChunk=e.lastChunk;for(let e=0;e<t.renderTasks.length;e++)t.renderTasks[e].operatorListChanged();e.lastChunk&&this._tryCleanup()}_pumpOperatorList(e){(0,_util.assert)(e.intent,'PDFPageProxy._pumpOperatorList: Expected "intent" argument.');const t=this._transport.messageHandler.sendWithStream("GetOperatorList",e).getReader(),n=this._intentStates.get(e.intent);n.streamReader=t;const pump=()=>{t.read().then((({value:e,done:t})=>{if(t)n.streamReader=null;else if(!this._transport.destroyed){this._renderPageChunk(e,n);pump()}}),(e=>{n.streamReader=null;if(!this._transport.destroyed){if(n.operatorList){n.operatorList.lastChunk=!0;for(let e=0;e<n.renderTasks.length;e++)n.renderTasks[e].operatorListChanged();this._tryCleanup()}if(n.displayReadyCapability)n.displayReadyCapability.reject(e);else{if(!n.opListReadCapability)throw e;n.opListReadCapability.reject(e)}}}))};pump()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){(0,_util.assert)(t instanceof Error||"object"==typeof t&&null!==t,'PDFPageProxy._abortOperatorList: Expected "reason" argument.');if(e.streamReader){if(!n){if(0!==e.renderTasks.length)return;if(t instanceof _display_utils.RenderingCancelledException){e.streamReaderCancelTimeout=setTimeout((()=>{this._abortOperatorList({intentState:e,reason:t,force:!0});e.streamReaderCancelTimeout=null}),RENDERING_CANCELLED_TIMEOUT);return}}e.streamReader.cancel(new _util.AbortException(t?.message));e.streamReader=null;if(!this._transport.destroyed){for(const[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(e=!0){this._listeners=[];this._defer=e;this._deferred=Promise.resolve(void 0)}postMessage(e,t){if(!this._defer){this._listeners.forEach((t=>{t.call(this,{data:e})}));return}const n=new WeakMap,i={data:function cloneValue(e){if("object"!=typeof e||null===e)return e;if(n.has(e))return n.get(e);let i,s;if((i=e.buffer)&&(0,_util.isArrayBuffer)(i)){s=t?.includes(i)?new e.constructor(i,e.byteOffset,e.byteLength):new e.constructor(e);n.set(e,s);return s}s=Array.isArray(e)?[]:{};n.set(e,s);for(const t in e){let n,i=e;for(;!(n=Object.getOwnPropertyDescriptor(i,t));)i=Object.getPrototypeOf(i);if(void 0!==n.value)if("function"!=typeof n.value)s[t]=cloneValue(n.value);else if(e.hasOwnProperty&&e.hasOwnProperty(t))throw new Error(`LoopbackPort.postMessage - cannot clone: ${e[t]}`)}return s}(e)};this._deferred.then((()=>{this._listeners.forEach((e=>{e.call(this,i)}))}))}addEventListener(e,t){this._listeners.push(t)}removeEventListener(e,t){const n=this._listeners.indexOf(t);this._listeners.splice(n,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&&"function"==typeof require){isWorkerDisabled=!0;fallbackWorkerSrc="./pdf.worker.js"}else if("object"==typeof document&&"currentScript"in document){const e=document.currentScript?.src;e&&(fallbackWorkerSrc=e.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}function getWorkerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return"Function"===_worker_options.GlobalWorkerOptions.workerSrc.constructor.name?_worker_options.GlobalWorkerOptions.workerSrc():_worker_options.GlobalWorkerOptions.workerSrc;if(void 0!==fallbackWorkerSrc){_is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.');return fallbackWorkerSrc}throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}function getMainThreadWorkerMessageHandler(){let e;try{e=globalThis.pdfjsWorker?.WorkerMessageHandler}catch(e){}return e||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&&"function"==typeof require){const worker=eval("require")(getWorkerSrc());return worker.WorkerMessageHandler}await(0,_display_utils.loadScript)(getWorkerSrc());return window.pdfjsWorker.WorkerMessageHandler};loader().then(fakeWorkerCapability.resolve,fakeWorkerCapability.reject);return fakeWorkerCapability.promise}function createCDNWrapper(e){const t="importScripts('"+e+"');";return URL.createObjectURL(new Blob([t]))}class PDFWorker{constructor({name:e=null,port:t=null,verbosity:n=(0,_util.getVerbosityLevel)()}={}){if(t&&pdfWorkerPorts.has(t))throw new Error("Cannot use more than one PDFWorker per port");this.name=e;this.destroyed=!1;this.postMessageTransfers=!0;this.verbosity=n;this._readyCapability=(0,_util.createPromiseCapability)();this._port=null;this._webWorker=null;this._messageHandler=null;if(t){pdfWorkerPorts.set(t,this);this._initializeFromPort(t)}else this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e;this._messageHandler=new _message_handler.MessageHandler("main","worker",e);this._messageHandler.on("ready",(function(){}));this._readyCapability.resolve()}_initialize(){if("undefined"!=typeof Worker&&!isWorkerDisabled&&!getMainThreadWorkerMessageHandler()){let e=getWorkerSrc();try{(0,_util.isSameOrigin)(window.location.href,e)||(e=createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e),n=new _message_handler.MessageHandler("main","worker",t),terminateEarly=()=>{t.removeEventListener("error",onWorkerError);n.destroy();t.terminate();this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},onWorkerError=()=>{this._webWorker||terminateEarly()};t.addEventListener("error",onWorkerError);n.on("test",(e=>{t.removeEventListener("error",onWorkerError);if(this.destroyed)terminateEarly();else if(e){this._messageHandler=n;this._port=t;this._webWorker=t;e.supportTransfers||(this.postMessageTransfers=!1);this._readyCapability.resolve();n.send("configure",{verbosity:this.verbosity})}else{this._setupFakeWorker();n.destroy();t.terminate()}}));n.on("ready",(e=>{t.removeEventListener("error",onWorkerError);if(this.destroyed)terminateEarly();else try{sendTest()}catch(e){this._setupFakeWorker()}}));const sendTest=()=>{const e=new Uint8Array([this.postMessageTransfers?255:0]);try{n.send("test",e,[e.buffer])}catch(t){(0,_util.warn)("Cannot use postMessage transfers.");e[0]=0;n.send("test",e)}};sendTest();return}catch(e){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){if(!isWorkerDisabled){(0,_util.warn)("Setting up fake worker.");isWorkerDisabled=!0}setupFakeWorkerGlobal().then((e=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const t=new LoopbackPort;this._port=t;const n="fake"+nextFakeWorkerId++,i=new _message_handler.MessageHandler(n+"_worker",n,t);e.setup(i,t);const s=new _message_handler.MessageHandler(n,n+"_worker",t);this._messageHandler=s;this._readyCapability.resolve();s.send("configure",{verbosity:this.verbosity})})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0;if(this._webWorker){this._webWorker.terminate();this._webWorker=null}pdfWorkerPorts.delete(this._port);this._port=null;if(this._messageHandler){this._messageHandler.destroy();this._messageHandler=null}}static fromPort(e){if(!e||!e.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return pdfWorkerPorts.has(e.port)?pdfWorkerPorts.get(e.port):new PDFWorker(e)}static getWorkerSrc(){return getWorkerSrc()}}return PDFWorker}();exports.PDFWorker=PDFWorker;class WorkerTransport{constructor(e,t,n,i){this.messageHandler=e;this.loadingTask=t;this.commonObjs=new PDFObjects;this.fontLoader=new _font_loader.FontLoader({docId:t.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:i.ownerDocument});this._params=i;let s=i.cMapUrl;"Function"===s.constructor.name&&(s=s());this.CMapReaderFactory=new i.CMapReaderFactory({baseUrl:s,isCompressed:i.cMapPacked});this.destroyed=!1;this.destroyCapability=null;this._passwordCapability=null;this._networkStream=n;this._fullReader=null;this._lastProgress=null;this.pageCache=[];this.pagePromises=[];this.downloadInfoCapability=(0,_util.createPromiseCapability)();this.setupMessageHandler()}get loadingTaskSettled(){return this.loadingTask._capability.settled}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 e=[];this.pageCache.forEach((function(t){t&&e.push(t._destroy())}));this.pageCache.length=0;this.pagePromises.length=0;const t=this.messageHandler.sendWithPromise("Terminate",null);e.push(t);if(this.loadingTaskSettled){const t=this.loadingTask.promise.then((e=>{e.hasOwnProperty("annotationStorage")&&e.annotationStorage.resetModified()})).catch((()=>{}));e.push(t)}Promise.all(e).then((()=>{this.commonObjs.clear();this.fontLoader.clear();this._hasJSActionsPromise=null;this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated."));if(this.messageHandler){this.messageHandler.destroy();this.messageHandler=null}this.destroyCapability.resolve()}),this.destroyCapability.reject);return this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available.");this._fullReader=this._networkStream.getFullReader();this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}};t.onPull=()=>{this._fullReader.read().then((function({value:e,done:n}){if(n)t.close();else{(0,_util.assert)((0,_util.isArrayBuffer)(e),"GetReader - expected an ArrayBuffer.");t.enqueue(new Uint8Array(e),1,[e])}})).catch((e=>{t.error(e)}))};t.onCancel=e=>{this._fullReader.cancel(e);t.ready.catch((e=>{if(!this.destroyed)throw e}))}}));e.on("ReaderHeadersReady",(e=>{const n=(0,_util.createPromiseCapability)(),i=this._fullReader;i.headersReady.then((()=>{if(!i.isStreamingSupported||!i.isRangeSupported){this._lastProgress&&t.onProgress&&t.onProgress(this._lastProgress);i.onProgress=e=>{t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}}n.resolve({isStreamingSupported:i.isStreamingSupported,isRangeSupported:i.isRangeSupported,contentLength:i.contentLength})}),n.reject);return n.promise}));e.on("GetRangeReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(e.begin,e.end);if(n){t.onPull=()=>{n.read().then((function({value:e,done:n}){if(n)t.close();else{(0,_util.assert)((0,_util.isArrayBuffer)(e),"GetRangeReader - expected an ArrayBuffer.");t.enqueue(new Uint8Array(e),1,[e])}})).catch((e=>{t.error(e)}))};t.onCancel=e=>{n.cancel(e);t.ready.catch((e=>{if(!this.destroyed)throw e}))}}else t.close()}));e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages;t._capability.resolve(new PDFDocumentProxy(e,this))}));e.on("DocException",(function(e){let n;switch(e.name){case"PasswordException":n=new _util.PasswordException(e.message,e.code);break;case"InvalidPDFException":n=new _util.InvalidPDFException(e.message);break;case"MissingPDFException":n=new _util.MissingPDFException(e.message);break;case"UnexpectedResponseException":n=new _util.UnexpectedResponseException(e.message,e.status);break;case"UnknownErrorException":n=new _util.UnknownErrorException(e.message,e.details)}if(!(n instanceof Error)){const e="DocException - expected a valid Error.";(0,_util.warn)(e)}t._capability.reject(n)}));e.on("PasswordRequest",(e=>{this._passwordCapability=(0,_util.createPromiseCapability)();if(t.onPassword){const updatePassword=e=>{this._passwordCapability.resolve({password:e})};try{t.onPassword(updatePassword,e.code)}catch(e){this._passwordCapability.reject(e)}}else this._passwordCapability.reject(new _util.PasswordException(e.message,e.code));return this._passwordCapability.promise}));e.on("DataLoaded",(e=>{t.onProgress&&t.onProgress({loaded:e.length,total:e.length});this.downloadInfoCapability.resolve(e)}));e.on("StartRenderPage",(e=>{if(this.destroyed)return;this.pageCache[e.pageIndex]._startRenderPage(e.transparency,e.intent)}));e.on("commonobj",(t=>{if(this.destroyed)return;const[n,i,s]=t;if(!this.commonObjs.has(n))switch(i){case"Font":const t=this._params;if("error"in s){const e=s.error;(0,_util.warn)(`Error during font loading: ${e}`);this.commonObjs.resolve(n,e);break}let r=null;t.pdfBug&&globalThis.FontInspector?.enabled&&(r={registerFont(e,t){globalThis.FontInspector.fontAdded(e,t)}});const a=new _font_loader.FontFaceObject(s,{isEvalSupported:t.isEvalSupported,disableFontFace:t.disableFontFace,ignoreErrors:t.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:r});this.fontLoader.bind(a).catch((t=>e.sendWithPromise("FontFallback",{id:n}))).finally((()=>{!t.fontExtraProperties&&a.data&&(a.data=null);this.commonObjs.resolve(n,a)}));break;case"FontPath":case"Image":this.commonObjs.resolve(n,s);break;default:throw new Error(`Got unknown common object type ${i}`)}}));e.on("obj",(e=>{if(this.destroyed)return;const[t,n,i,s]=e,r=this.pageCache[n];if(!r.objs.has(t))switch(i){case"Image":r.objs.resolve(t,s);const e=8e6;s?.data?.length>e&&(r.cleanupAfterRender=!0);break;default:throw new Error(`Got unknown object type ${i}`)}}));e.on("DocProgress",(e=>{this.destroyed||t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}));e.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this));e.on("FetchBuiltInCMap",((e,t)=>{if(this.destroyed){t.error(new Error("Worker was destroyed"));return}let n=!1;t.onPull=()=>{if(n)t.close();else{n=!0;this.CMapReaderFactory.fetch(e).then((function(e){t.enqueue(e,1,[e.cMapData.buffer])})).catch((function(e){t.error(e)}))}}}))}_onUnsupportedFeature({featureId:e}){this.destroyed||this.loadingTask.onUnsupportedFeature&&this.loadingTask.onUnsupportedFeature(e)}getData(){return this.messageHandler.sendWithPromise("GetData",null)}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request"));const t=e-1;if(t in this.pagePromises)return this.pagePromises[t];const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((e=>{if(this.destroyed)throw new Error("Transport destroyed");const n=new PDFPageProxy(t,e,this,this._params.ownerDocument,this._params.pdfBug);this.pageCache[t]=n;return n}));this.pagePromises[t]=n;return n}getPageIndex(e){return this.messageHandler.sendWithPromise("GetPageIndex",{ref:e}).catch((function(e){return Promise.reject(new Error(e))}))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}saveDocument(e){return this.messageHandler.sendWithPromise("SaveDocument",{numPages:this._numPages,annotationStorage:e?.getAll()||null,filename:this._fullReader?this._fullReader.filename:null}).finally((()=>{e&&e.resetModified()}))}getFieldObjects(){return this.messageHandler.sendWithPromise("GetFieldObjects",null)}hasJSActions(){return this._hasJSActionsPromise||(this._hasJSActionsPromise=this.messageHandler.sendWithPromise("HasJSActions",null))}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}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)}getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then((e=>new _optional_content_config.OptionalContentConfig(e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return this.messageHandler.sendWithPromise("GetMetadata",null).then((e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getStats(){return this.messageHandler.sendWithPromise("GetStats",null)}startCleanup(){return this.messageHandler.sendWithPromise("Cleanup",null).then((()=>{for(let e=0,t=this.pageCache.length;e<t;e++){const t=this.pageCache[e];if(t){if(!t.cleanup())throw new Error(`startCleanup: Page ${e+1} is currently rendering.`)}}this.commonObjs.clear();this.fontLoader.clear();this._hasJSActionsPromise=null}))}get loadingParams(){const e=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:e.disableAutoFetch,disableFontFace:e.disableFontFace})}}class PDFObjects{constructor(){this._objs=Object.create(null)}_ensureObj(e){return this._objs[e]?this._objs[e]:this._objs[e]={capability:(0,_util.createPromiseCapability)(),data:null,resolved:!1}}get(e,t=null){if(t){this._ensureObj(e).capability.promise.then(t);return null}const n=this._objs[e];if(!n||!n.resolved)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){const t=this._objs[e];return!!t&&t.resolved}resolve(e,t){const n=this._ensureObj(e);n.resolved=!0;n.data=t;n.capability.resolve(t)}clear(){this._objs=Object.create(null)}}class RenderTask{constructor(e){this._internalRenderTask=e;this.onContinue=null}get promise(){return this._internalRenderTask.capability.promise}cancel(){this._internalRenderTask.cancel()}}const InternalRenderTask=function InternalRenderTaskClosure(){const e=new WeakSet;return class InternalRenderTask{constructor({callback:e,params:t,objs:n,commonObjs:i,operatorList:s,pageIndex:r,canvasFactory:a,webGLContext:o,useRequestAnimationFrame:l=!1,pdfBug:c=!1}){this.callback=e;this.params=t;this.objs=n;this.commonObjs=i;this.operatorListIdx=null;this.operatorList=s;this._pageIndex=r;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=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:t=!1,optionalContentConfig:n}){if(this.cancelled)return;if(this._canvas){if(e.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.");e.add(this._canvas)}if(this._pdfBug&&globalThis.StepperManager?.enabled){this.stepper=globalThis.StepperManager.create(this._pageIndex);this.stepper.init(this.operatorList);this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint()}const{canvasContext:i,viewport:s,transform:r,imageLayer:a,background:o}=this.params;this.gfx=new _canvas.CanvasGraphics(i,this.commonObjs,this.objs,this.canvasFactory,this.webGLContext,a,n);this.gfx.beginDrawing({transform:r,viewport:s,transparency:t,background:o});this.operatorListIdx=0;this.graphicsReady=!0;this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(t=null){this.running=!1;this.cancelled=!0;this.gfx&&this.gfx.endDrawing();this._canvas&&e.delete(this._canvas);this.callback(t||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas"))}operatorListChanged(){if(this.graphicsReady){this.stepper&&this.stepper.updateOperatorList(this.operatorList);this.running||this._continue()}else 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(){if(!this.cancelled){this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper);if(this.operatorListIdx===this.operatorList.argsArray.length){this.running=!1;if(this.operatorList.lastChunk){this.gfx.endDrawing();this._canvas&&e.delete(this._canvas);this.callback()}}}}}}(),version="2.7.536";exports.version=version;const build="3124b643e";exports.build=build},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.FontLoader=t.FontFaceObject=void 0;var i=n(2);class BaseFontLoader{constructor({docId:e,onUnsupportedFeature:t,ownerDocument:n=globalThis.document}){this.constructor===BaseFontLoader&&(0,i.unreachable)("Cannot initialize BaseFontLoader.");this.docId=e;this._onUnsupportedFeature=t;this._document=n;this.nativeFontFaces=[];this.styleElement=null}addNativeFontFace(e){this.nativeFontFaces.push(e);this._document.fonts.add(e)}insertRule(e){let t=this.styleElement;if(!t){t=this.styleElement=this._document.createElement("style");t.id=`PDFJS_FONT_STYLE_TAG_${this.docId}`;this._document.documentElement.getElementsByTagName("head")[0].appendChild(t)}const n=t.sheet;n.insertRule(e,n.cssRules.length)}clear(){this.nativeFontFaces.forEach((e=>{this._document.fonts.delete(e)}));this.nativeFontFaces.length=0;if(this.styleElement){this.styleElement.remove();this.styleElement=null}}async bind(e){if(e.attached||e.missingFile)return;e.attached=!0;if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){this._onUnsupportedFeature({featureId:i.UNSUPPORTED_FEATURES.errorFontLoadNative});(0,i.warn)(`Failed to load font '${t.family}': '${n}'.`);e.disableFontFace=!0;throw n}}return}const t=e.createFontFaceRule();if(t){this.insertRule(t);if(this.isSyncFontLoadingSupported)return;await new Promise((n=>{const i=this._queueLoadingCallback(n);this._prepareFontLoadEvent([t],[e],i)}))}}_queueLoadingCallback(e){(0,i.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){return(0,i.shadow)(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){(0,i.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,i.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(e,t,n){(0,i.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let s;t.FontLoader=s;t.FontLoader=s=class GenericFontLoader extends BaseFontLoader{constructor(e){super(e);this.loadingContext={requests:[],nextRequestId:0};this.loadTestFontId=0}get isSyncFontLoadingSupported(){let e=!1;if("undefined"==typeof navigator)e=!0;else{/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent)?.[1]>=14&&(e=!0)}return(0,i.shadow)(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const t=this.loadingContext,n={id:"pdfjs-font-loading-"+t.nextRequestId++,done:!1,complete:function completeRequest(){(0,i.assert)(!n.done,"completeRequest() cannot be called twice.");n.done=!0;for(;t.requests.length>0&&t.requests[0].done;){const e=t.requests.shift();setTimeout(e.callback,0)}},callback:e};t.requests.push(n);return n}get _loadTestFont(){return(0,i.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t,n){function int32(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function spliceString(e,t,n,i){return e.substring(0,t)+i+e.substring(t+n)}let s,r;const a=this._document.createElement("canvas");a.width=1;a.height=1;const o=a.getContext("2d");let l=0;const c=`lt${Date.now()}${this.loadTestFontId++}`;let h=this._loadTestFont;h=spliceString(h,976,c.length,c);const d=1482184792;let u=int32(h,16);for(s=0,r=c.length-3;s<r;s+=4)u=u-d+int32(c,s)|0;s<c.length&&(u=u-d+int32(c+"XXX",s)|0);h=spliceString(h,16,4,(0,i.string32)(u));const p=`@font-face {font-family:"${c}";src:${`url(data:font/opentype;base64,${btoa(h)});`}}`;this.insertRule(p);const g=[];for(s=0,r=t.length;s<r;s++)g.push(t[s].loadedName);g.push(c);const f=this._document.createElement("div");f.style.visibility="hidden";f.style.width=f.style.height="10px";f.style.position="absolute";f.style.top=f.style.left="0px";for(s=0,r=g.length;s<r;++s){const e=this._document.createElement("span");e.textContent="Hi";e.style.fontFamily=g[s];f.appendChild(e)}this._document.body.appendChild(f);!function isFontReady(e,t){l++;if(l>30){(0,i.warn)("Load test font never loaded.");t();return}o.font="30px "+e;o.fillText(".",0,20);o.getImageData(0,0,1,1).data[3]>0?t():setTimeout(isFontReady.bind(null,e,t))}(c,(()=>{this._document.body.removeChild(f);n.complete()}))}};t.FontFaceObject=class FontFaceObject{constructor(e,{isEvalSupported:t=!0,disableFontFace:n=!1,ignoreErrors:i=!1,onUnsupportedFeature:s=null,fontRegistry:r=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.isEvalSupported=!1!==t;this.disableFontFace=!0===n;this.ignoreErrors=!0===i;this._onUnsupportedFeature=s;this.fontRegistry=r}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;const e=new FontFace(this.loadedName,this.data,{});this.fontRegistry&&this.fontRegistry.registerFont(this);return e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=(0,i.bytesToString)(new Uint8Array(this.data)),t=`url(data:${this.mimetype};base64,${btoa(e)});`,n=`@font-face {font-family:"${this.loadedName}";src:${t}}`;this.fontRegistry&&this.fontRegistry.registerFont(this,t);return n}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let n,s;try{n=e.get(this.loadedName+"_path_"+t)}catch(e){if(!this.ignoreErrors)throw e;this._onUnsupportedFeature&&this._onUnsupportedFeature({featureId:i.UNSUPPORTED_FEATURES.errorFontGetPath});(0,i.warn)(`getPathGenerator - ignoring character: "${e}".`);return this.compiledGlyphs[t]=function(e,t){}}if(this.isEvalSupported&&i.IsEvalSupportedCached.value){let e,i="";for(let t=0,r=n.length;t<r;t++){s=n[t];e=void 0!==s.args?s.args.join(","):"";i+="c."+s.cmd+"("+e+");\n"}return this.compiledGlyphs[t]=new Function("c","size",i)}return this.compiledGlyphs[t]=function(e,t){for(let i=0,r=n.length;i<r;i++){s=n[i];"scale"===s.cmd&&(s.args=[t,-t]);e[s.cmd].apply(e,s.args)}}}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.NodeCMapReaderFactory=t.NodeCanvasFactory=void 0;var i=n(1),s=n(7),r=n(2);let a=class{constructor(){(0,r.unreachable)("Not implemented: NodeCanvasFactory")}};t.NodeCanvasFactory=a;let o=class{constructor(){(0,r.unreachable)("Not implemented: NodeCMapReaderFactory")}};t.NodeCMapReaderFactory=o;if(s.isNodeJS){t.NodeCanvasFactory=a=class extends i.BaseCanvasFactory{create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const n=require("canvas").createCanvas(e,t);return{canvas:n,context:n.getContext("2d")}}};t.NodeCMapReaderFactory=o=class extends i.BaseCMapReaderFactory{_fetchData(e,t){return new Promise(((n,i)=>{require("fs").readFile(e,((e,s)=>{!e&&s?n({cMapData:new Uint8Array(s),compressionType:t}):i(new Error(e))}))}))}}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.isNodeJS=void 0;const n=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);t.isNodeJS=n},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationStorage=void 0;var i=n(2);t.AnnotationStorage=class AnnotationStorage{constructor(){this._storage=new Map;this._modified=!1;this.onSetModified=null;this.onResetModified=null}getOrCreateValue(e,t){if(this._storage.has(e))return this._storage.get(e);this._storage.set(e,t);return t}setValue(e,t){const n=this._storage.get(e);let i=!1;if(void 0!==n){for(const[e,s]of Object.entries(t))if(n[e]!==s){i=!0;n[e]=s}}else{this._storage.set(e,t);i=!0}i&&this._setModified()}getAll(){return 0===this._storage.size?null:(0,i.objectFromEntries)(this._storage)}get size(){return this._storage.size}_setModified(){if(!this._modified){this._modified=!0;"function"==typeof this.onSetModified&&this.onSetModified()}}resetModified(){if(this._modified){this._modified=!1;"function"==typeof this.onResetModified&&this.onResetModified()}}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.apiCompatibilityParams=void 0;var i=n(7);const s=Object.create(null);!function checkFontFace(){i.isNodeJS&&(s.disableFontFace=!0)}();const r=Object.freeze(s);t.apiCompatibilityParams=r},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.CanvasGraphics=void 0;var i=n(2),s=n(11);const r=4096,a=.65,o=16;function addContextCurrentTransform(e){if(!e.mozCurrentTransform){e._originalSave=e.save;e._originalRestore=e.restore;e._originalRotate=e.rotate;e._originalScale=e.scale;e._originalTranslate=e.translate;e._originalTransform=e.transform;e._originalSetTransform=e.setTransform;e._transformMatrix=e._transformMatrix||[1,0,0,1,0,0];e._transformStack=[];Object.defineProperty(e,"mozCurrentTransform",{get:function getCurrentTransform(){return this._transformMatrix}});Object.defineProperty(e,"mozCurrentTransformInverse",{get:function getCurrentTransformInverse(){const e=this._transformMatrix,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],o=t*s-n*i,l=n*i-t*s;return[s/o,n/l,i/l,t/o,(s*r-i*a)/l,(n*r-t*a)/o]}});e.save=function ctxSave(){const e=this._transformMatrix;this._transformStack.push(e);this._transformMatrix=e.slice(0,6);this._originalSave()};e.restore=function ctxRestore(){const e=this._transformStack.pop();if(e){this._transformMatrix=e;this._originalRestore()}};e.translate=function ctxTranslate(e,t){const n=this._transformMatrix;n[4]=n[0]*e+n[2]*t+n[4];n[5]=n[1]*e+n[3]*t+n[5];this._originalTranslate(e,t)};e.scale=function ctxScale(e,t){const n=this._transformMatrix;n[0]=n[0]*e;n[1]=n[1]*e;n[2]=n[2]*t;n[3]=n[3]*t;this._originalScale(e,t)};e.transform=function ctxTransform(t,n,i,s,r,a){const o=this._transformMatrix;this._transformMatrix=[o[0]*t+o[2]*n,o[1]*t+o[3]*n,o[0]*i+o[2]*s,o[1]*i+o[3]*s,o[0]*r+o[2]*a+o[4],o[1]*r+o[3]*a+o[5]];e._originalTransform(t,n,i,s,r,a)};e.setTransform=function ctxSetTransform(t,n,i,s,r,a){this._transformMatrix=[t,n,i,s,r,a];e._originalSetTransform(t,n,i,s,r,a)};e.rotate=function ctxRotate(e){const t=Math.cos(e),n=Math.sin(e),i=this._transformMatrix;this._transformMatrix=[i[0]*t+i[2]*n,i[1]*t+i[3]*n,i[0]*-n+i[2]*t,i[1]*-n+i[3]*t,i[4],i[5]];this._originalRotate(e)}}}const l=function CachedCanvasesClosure(){function CachedCanvases(e){this.canvasFactory=e;this.cache=Object.create(null)}CachedCanvases.prototype={getCanvas:function CachedCanvases_getCanvas(e,t,n,i){let s;if(void 0!==this.cache[e]){s=this.cache[e];this.canvasFactory.reset(s,t,n);s.context.setTransform(1,0,0,1,0,0)}else{s=this.canvasFactory.create(t,n);this.cache[e]=s}i&&addContextCurrentTransform(s.context);return s},clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t);delete this.cache[e]}}};return CachedCanvases}();const c=function CanvasExtraStateClosure(){function CanvasExtraState(){this.alphaIsShape=!1;this.fontSize=0;this.fontSizeScale=1;this.textMatrix=i.IDENTITY_MATRIX;this.textMatrixScale=1;this.fontMatrix=i.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=i.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;this.transferMaps=null}CanvasExtraState.prototype={clone:function CanvasExtraState_clone(){return Object.create(this)},setCurrentPoint:function CanvasExtraState_setCurrentPoint(e,t){this.x=e;this.y=t}};return CanvasExtraState}(),h=function CanvasGraphicsClosure(){function CanvasGraphics(e,t,n,i,s,r,a){this.ctx=e;this.current=new c;this.stateStack=[];this.pendingClip=null;this.pendingEOFill=!1;this.res=null;this.xobjs=null;this.commonObjs=t;this.objs=n;this.canvasFactory=i;this.webGLContext=s;this.imageLayer=r;this.groupStack=[];this.processingType3=null;this.baseTransform=null;this.baseTransformStack=[];this.groupLevel=0;this.smaskStack=[];this.smaskCounter=0;this.tempSMask=null;this.contentVisible=!0;this.markedContentStack=[];this.optionalContentConfig=a;this.cachedCanvases=new l(this.canvasFactory);e&&addContextCurrentTransform(e);this._cachedGetSinglePixelWidth=null}function putBinaryImageData(e,t,n=null){if("undefined"!=typeof ImageData&&t instanceof ImageData){e.putImageData(t,0,0);return}const s=t.height,r=t.width,a=s%o,l=(s-a)/o,c=0===a?l:l+1,h=e.createImageData(r,o);let d,u=0;const p=t.data,g=h.data;let f,m,b,_,v,w,y,S;if(n)switch(n.length){case 1:v=n[0];w=n[0];y=n[0];S=n[0];break;case 4:v=n[0];w=n[1];y=n[2];S=n[3]}if(t.kind===i.ImageKind.GRAYSCALE_1BPP){const t=p.byteLength,n=new Uint32Array(g.buffer,0,g.byteLength>>2),s=n.length,_=r+7>>3;let v=4294967295,w=i.IsLittleEndianCached.value?4278190080:255;S&&255===S[0]&&0===S[255]&&([v,w]=[w,v]);for(f=0;f<c;f++){b=f<l?o:a;d=0;for(m=0;m<b;m++){const e=t-u;let i=0;const s=e>_?r:8*e-7,a=-8&s;let o=0,l=0;for(;i<a;i+=8){l=p[u++];n[d++]=128&l?v:w;n[d++]=64&l?v:w;n[d++]=32&l?v:w;n[d++]=16&l?v:w;n[d++]=8&l?v:w;n[d++]=4&l?v:w;n[d++]=2&l?v:w;n[d++]=1&l?v:w}for(;i<s;i++){if(0===o){l=p[u++];o=128}n[d++]=l&o?v:w;o>>=1}}for(;d<s;)n[d++]=0;e.putImageData(h,0,f*o)}}else if(t.kind===i.ImageKind.RGBA_32BPP){const t=!!(v||w||y);m=0;_=r*o*4;for(f=0;f<l;f++){g.set(p.subarray(u,u+_));u+=_;if(t)for(let e=0;e<_;e+=4){v&&(g[e+0]=v[g[e+0]]);w&&(g[e+1]=w[g[e+1]]);y&&(g[e+2]=y[g[e+2]])}e.putImageData(h,0,m);m+=o}if(f<c){_=r*a*4;g.set(p.subarray(u,u+_));if(t)for(let e=0;e<_;e+=4){v&&(g[e+0]=v[g[e+0]]);w&&(g[e+1]=w[g[e+1]]);y&&(g[e+2]=y[g[e+2]])}e.putImageData(h,0,m)}}else{if(t.kind!==i.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);{const t=!!(v||w||y);b=o;_=r*b;for(f=0;f<c;f++){if(f>=l){b=a;_=r*b}d=0;for(m=_;m--;){g[d++]=p[u++];g[d++]=p[u++];g[d++]=p[u++];g[d++]=255}if(t)for(let e=0;e<d;e+=4){v&&(g[e+0]=v[g[e+0]]);w&&(g[e+1]=w[g[e+1]]);y&&(g[e+2]=y[g[e+2]])}e.putImageData(h,0,f*o)}}}}function putBinaryImageMask(e,t){const n=t.height,i=t.width,s=n%o,r=(n-s)/o,a=0===s?r:r+1,l=e.createImageData(i,o);let c=0;const h=t.data,d=l.data;for(let t=0;t<a;t++){const n=t<r?o:s;let a=3;for(let e=0;e<n;e++){let e,t=0;for(let n=0;n<i;n++){if(!t){e=h[c++];t=128}d[a]=e&t?0:255;a+=4;t>>=1}}e.putImageData(l,0,t*o)}}function copyCtxState(e,t){const n=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let i=0,s=n.length;i<s;i++){const s=n[i];void 0!==e[s]&&(t[s]=e[s])}if(void 0!==e.setLineDash){t.setLineDash(e.getLineDash());t.lineDashOffset=e.lineDashOffset}}function resetCtxToDefault(e){e.strokeStyle="#000000";e.fillStyle="#000000";e.fillRule="nonzero";e.globalAlpha=1;e.lineWidth=1;e.lineCap="butt";e.lineJoin="miter";e.miterLimit=10;e.globalCompositeOperation="source-over";e.font="10px sans-serif";if(void 0!==e.setLineDash){e.setLineDash([]);e.lineDashOffset=0}}function composeSMaskBackdrop(e,t,n,i){const s=e.length;for(let r=3;r<s;r+=4){const s=e[r];if(0===s){e[r-3]=t;e[r-2]=n;e[r-1]=i}else if(s<255){const a=255-s;e[r-3]=e[r-3]*s+t*a>>8;e[r-2]=e[r-2]*s+n*a>>8;e[r-1]=e[r-1]*s+i*a>>8}}}function composeSMaskAlpha(e,t,n){const i=e.length;for(let s=3;s<i;s+=4){const i=n?n[e[s]]:e[s];t[s]=t[s]*i*.00392156862745098|0}}function composeSMaskLuminosity(e,t,n){const i=e.length;for(let s=3;s<i;s+=4){const i=77*e[s-3]+152*e[s-2]+28*e[s-1];t[s]=n?t[s]*n[i>>8]>>8:t[s]*i>>16}}function composeSMask(e,t,n,i){const s=t.canvas,r=t.context;e.setTransform(t.scaleX,0,0,t.scaleY,t.offsetX,t.offsetY);const a=t.backdrop||null;if(t.transferMap||!i.isEnabled){!function genericComposeSMask(e,t,n,i,s,r,a){const o=!!r,l=o?r[0]:0,c=o?r[1]:0,h=o?r[2]:0;let d;d="Luminosity"===s?composeSMaskLuminosity:composeSMaskAlpha;const u=Math.min(i,Math.ceil(1048576/n));for(let s=0;s<i;s+=u){const r=Math.min(u,i-s),p=e.getImageData(0,s,n,r),g=t.getImageData(0,s,n,r);o&&composeSMaskBackdrop(p.data,l,c,h);d(p.data,g.data,a);e.putImageData(g,0,s)}}(r,n,s.width,s.height,t.subtype,a,t.transferMap);e.drawImage(s,0,0)}else{const r=i.composeSMask({layer:n.canvas,mask:s,properties:{subtype:t.subtype,backdrop:a}});e.setTransform(1,0,0,1,0,0);e.drawImage(r,t.offsetX,t.offsetY)}}const e=["butt","round","square"],t=["miter","round","bevel"],n={},h={};CanvasGraphics.prototype={beginDrawing({transform:e,viewport:t,transparency:n=!1,background:i=null}){const s=this.ctx.canvas.width,r=this.ctx.canvas.height;this.ctx.save();this.ctx.fillStyle=i||"rgb(255, 255, 255)";this.ctx.fillRect(0,0,s,r);this.ctx.restore();if(n){const e=this.cachedCanvases.getCanvas("transparent",s,r,!0);this.compositeCtx=this.ctx;this.transparentCanvas=e.canvas;this.ctx=e.context;this.ctx.save();this.ctx.transform.apply(this.ctx,this.compositeCtx.mozCurrentTransform)}this.ctx.save();resetCtxToDefault(this.ctx);e&&this.ctx.transform.apply(this.ctx,e);this.ctx.transform.apply(this.ctx,t.transform);this.baseTransform=this.ctx.mozCurrentTransform.slice();this.imageLayer&&this.imageLayer.beginLayout()},executeOperatorList:function CanvasGraphics_executeOperatorList(e,t,n,s){const r=e.argsArray,a=e.fnArray;let o=t||0;const l=r.length;if(l===o)return o;const c=l-o>10&&"function"==typeof n,h=c?Date.now()+15:0;let d=0;const u=this.commonObjs,p=this.objs;let g;for(;;){if(void 0!==s&&o===s.nextBreakPoint){s.breakIt(o,n);return o}g=a[o];if(g!==i.OPS.dependency)this[g].apply(this,r[o]);else for(const e of r[o]){const t=e.startsWith("g_")?u:p;if(!t.has(e)){t.get(e,n);return o}}o++;if(o===l)return o;if(c&&++d>10){if(Date.now()>h){n();return o}d=0}}},endDrawing:function CanvasGraphics_endDrawing(){for(;this.stateStack.length||null!==this.current.activeSMask;)this.restore();this.ctx.restore();if(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 CanvasGraphics_setLineWidth(e){this.current.lineWidth=e;this.ctx.lineWidth=e},setLineCap:function CanvasGraphics_setLineCap(t){this.ctx.lineCap=e[t]},setLineJoin:function CanvasGraphics_setLineJoin(e){this.ctx.lineJoin=t[e]},setMiterLimit:function CanvasGraphics_setMiterLimit(e){this.ctx.miterLimit=e},setDash:function CanvasGraphics_setDash(e,t){const n=this.ctx;if(void 0!==n.setLineDash){n.setLineDash(e);n.lineDashOffset=t}},setRenderingIntent(e){},setFlatness(e){},setGState:function CanvasGraphics_setGState(e){for(let t=0,n=e.length;t<n;t++){const n=e[t],i=n[0],s=n[1];switch(i){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=n[1];break;case"ca":this.current.fillAlpha=n[1];this.ctx.globalAlpha=n[1];break;case"BM":this.ctx.globalCompositeOperation=s;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=s?this.tempSMask:null;this.current.activeSMask&&this.beginSMaskGroup();this.tempSMask=null;break;case"TR":this.current.transferMaps=s}}},beginSMaskGroup:function CanvasGraphics_beginSMaskGroup(){const e=this.current.activeSMask,t=e.canvas.width,n=e.canvas.height,i="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(i,t,n,!0),r=this.ctx,a=r.mozCurrentTransform;this.ctx.save();const o=s.context;o.scale(1/e.scaleX,1/e.scaleY);o.translate(-e.offsetX,-e.offsetY);o.transform.apply(o,a);e.startTransformInverse=o.mozCurrentTransformInverse;copyCtxState(r,o);this.ctx=o;this.setGState([["BM","source-over"],["ca",1],["CA",1]]);this.groupStack.push(r);this.groupLevel++},suspendSMaskGroup:function CanvasGraphics_endSMaskGroup(){const e=this.ctx;this.groupLevel--;this.ctx=this.groupStack.pop();composeSMask(this.ctx,this.current.activeSMask,e,this.webGLContext);this.ctx.restore();this.ctx.save();copyCtxState(e,this.ctx);this.current.resumeSMaskCtx=e;const t=i.Util.transform(this.current.activeSMask.startTransformInverse,e.mozCurrentTransform);this.ctx.transform.apply(this.ctx,t);e.save();e.setTransform(1,0,0,1,0,0);e.clearRect(0,0,e.canvas.width,e.canvas.height);e.restore()},resumeSMaskGroup:function CanvasGraphics_resumeSMaskGroup(){const e=this.current.resumeSMaskCtx,t=this.ctx;this.ctx=e;this.groupStack.push(t);this.groupLevel++},endSMaskGroup:function CanvasGraphics_endSMaskGroup(){const e=this.ctx;this.groupLevel--;this.ctx=this.groupStack.pop();composeSMask(this.ctx,this.current.activeSMask,e,this.webGLContext);this.ctx.restore();copyCtxState(e,this.ctx);const t=i.Util.transform(this.current.activeSMask.startTransformInverse,e.mozCurrentTransform);this.ctx.transform.apply(this.ctx,t)},save:function CanvasGraphics_save(){this.ctx.save();const e=this.current;this.stateStack.push(e);this.current=e.clone();this.current.resumeSMaskCtx=null},restore:function CanvasGraphics_restore(){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();if(0!==this.stateStack.length){this.current=this.stateStack.pop();this.ctx.restore();this.pendingClip=null;this._cachedGetSinglePixelWidth=null}else this.current.activeSMask=null},transform:function CanvasGraphics_transform(e,t,n,i,s,r){this.ctx.transform(e,t,n,i,s,r);this._cachedGetSinglePixelWidth=null},constructPath:function CanvasGraphics_constructPath(e,t){const n=this.ctx,s=this.current;let r=s.x,a=s.y;for(let s=0,o=0,l=e.length;s<l;s++)switch(0|e[s]){case i.OPS.rectangle:r=t[o++];a=t[o++];let e=t[o++],s=t[o++];0===e&&n.lineWidth<this.getSinglePixelWidth()&&(e=this.getSinglePixelWidth());0===s&&n.lineWidth<this.getSinglePixelWidth()&&(s=this.getSinglePixelWidth());const l=r+e,c=a+s;n.moveTo(r,a);n.lineTo(l,a);n.lineTo(l,c);n.lineTo(r,c);n.lineTo(r,a);n.closePath();break;case i.OPS.moveTo:r=t[o++];a=t[o++];n.moveTo(r,a);break;case i.OPS.lineTo:r=t[o++];a=t[o++];n.lineTo(r,a);break;case i.OPS.curveTo:r=t[o+4];a=t[o+5];n.bezierCurveTo(t[o],t[o+1],t[o+2],t[o+3],r,a);o+=6;break;case i.OPS.curveTo2:n.bezierCurveTo(r,a,t[o],t[o+1],t[o+2],t[o+3]);r=t[o+2];a=t[o+3];o+=4;break;case i.OPS.curveTo3:r=t[o+2];a=t[o+3];n.bezierCurveTo(t[o],t[o+1],r,a,r,a);o+=4;break;case i.OPS.closePath:n.closePath()}s.setCurrentPoint(r,a)},closePath:function CanvasGraphics_closePath(){this.ctx.closePath()},stroke:function CanvasGraphics_stroke(e){e=void 0===e||e;const t=this.ctx,n=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha;if(this.contentVisible)if("object"==typeof n&&n?.getPattern){t.save();const e=t.mozCurrentTransform,s=i.Util.singularValueDecompose2dScale(e)[0];t.strokeStyle=n.getPattern(t,this);t.lineWidth=Math.max(this.getSinglePixelWidth()*a,this.current.lineWidth*s);t.stroke();t.restore()}else{t.lineWidth=Math.max(this.getSinglePixelWidth()*a,this.current.lineWidth);t.stroke()}e&&this.consumePath();t.globalAlpha=this.current.fillAlpha},closeStroke:function CanvasGraphics_closeStroke(){this.closePath();this.stroke()},fill:function CanvasGraphics_fill(e){e=void 0===e||e;const t=this.ctx,n=this.current.fillColor;let i=!1;if(this.current.patternFill){t.save();this.baseTransform&&t.setTransform.apply(t,this.baseTransform);t.fillStyle=n.getPattern(t,this);i=!0}if(this.contentVisible)if(this.pendingEOFill){t.fill("evenodd");this.pendingEOFill=!1}else t.fill();i&&t.restore();e&&this.consumePath()},eoFill:function CanvasGraphics_eoFill(){this.pendingEOFill=!0;this.fill()},fillStroke:function CanvasGraphics_fillStroke(){this.fill(!1);this.stroke(!1);this.consumePath()},eoFillStroke:function CanvasGraphics_eoFillStroke(){this.pendingEOFill=!0;this.fillStroke()},closeFillStroke:function CanvasGraphics_closeFillStroke(){this.closePath();this.fillStroke()},closeEOFillStroke:function CanvasGraphics_closeEOFillStroke(){this.pendingEOFill=!0;this.closePath();this.fillStroke()},endPath:function CanvasGraphics_endPath(){this.consumePath()},clip:function CanvasGraphics_clip(){this.pendingClip=n},eoClip:function CanvasGraphics_eoClip(){this.pendingClip=h},beginText:function CanvasGraphics_beginText(){this.current.textMatrix=i.IDENTITY_MATRIX;this.current.textMatrixScale=1;this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0},endText:function CanvasGraphics_endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save();t.beginPath();for(let n=0;n<e.length;n++){const i=e[n];t.setTransform.apply(t,i.transform);t.translate(i.x,i.y);i.addToPath(t,i.fontSize)}t.restore();t.clip();t.beginPath();delete this.pendingTextPaths}else t.beginPath()},setCharSpacing:function CanvasGraphics_setCharSpacing(e){this.current.charSpacing=e},setWordSpacing:function CanvasGraphics_setWordSpacing(e){this.current.wordSpacing=e},setHScale:function CanvasGraphics_setHScale(e){this.current.textHScale=e/100},setLeading:function CanvasGraphics_setLeading(e){this.current.leading=-e},setFont:function CanvasGraphics_setFont(e,t){const n=this.commonObjs.get(e),s=this.current;if(!n)throw new Error(`Can't find font for ${e}`);s.fontMatrix=n.fontMatrix?n.fontMatrix:i.FONT_IDENTITY_MATRIX;0!==s.fontMatrix[0]&&0!==s.fontMatrix[3]||(0,i.warn)("Invalid font matrix for font "+e);if(t<0){t=-t;s.fontDirection=-1}else s.fontDirection=1;this.current.font=n;this.current.fontSize=t;if(n.isType3Font)return;const r=n.loadedName||"sans-serif";let a="normal";n.black?a="900":n.bold&&(a="bold");const o=n.italic?"italic":"normal",l=`"${r}", ${n.fallbackName}`;let c=t;t<16?c=16:t>100&&(c=100);this.current.fontSizeScale=t/c;this.ctx.font=`${o} ${a} ${c}px ${l}`},setTextRenderingMode:function CanvasGraphics_setTextRenderingMode(e){this.current.textRenderingMode=e},setTextRise:function CanvasGraphics_setTextRise(e){this.current.textRise=e},moveText:function CanvasGraphics_moveText(e,t){this.current.x=this.current.lineX+=e;this.current.y=this.current.lineY+=t},setLeadingMoveText:function CanvasGraphics_setLeadingMoveText(e,t){this.setLeading(-t);this.moveText(e,t)},setTextMatrix:function CanvasGraphics_setTextMatrix(e,t,n,i,s,r){this.current.textMatrix=[e,t,n,i,s,r];this.current.textMatrixScale=Math.sqrt(e*e+t*t);this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0},nextLine:function CanvasGraphics_nextLine(){this.moveText(0,this.current.leading)},paintChar(e,t,n,s){const r=this.ctx,a=this.current,o=a.font,l=a.textRenderingMode,c=a.fontSize/a.fontSizeScale,h=l&i.TextRenderingMode.FILL_STROKE_MASK,d=!!(l&i.TextRenderingMode.ADD_TO_PATH_FLAG),u=a.patternFill&&!o.missingFile;let p;(o.disableFontFace||d||u)&&(p=o.getPathGenerator(this.commonObjs,e));if(o.disableFontFace||u){r.save();r.translate(t,n);r.beginPath();p(r,c);s&&r.setTransform.apply(r,s);h!==i.TextRenderingMode.FILL&&h!==i.TextRenderingMode.FILL_STROKE||r.fill();h!==i.TextRenderingMode.STROKE&&h!==i.TextRenderingMode.FILL_STROKE||r.stroke();r.restore()}else{h!==i.TextRenderingMode.FILL&&h!==i.TextRenderingMode.FILL_STROKE||r.fillText(e,t,n);h!==i.TextRenderingMode.STROKE&&h!==i.TextRenderingMode.FILL_STROKE||r.strokeText(e,t,n)}if(d){(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:r.mozCurrentTransform,x:t,y:n,fontSize:c,addToPath:p})}},get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1);e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let n=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){n=!0;break}return(0,i.shadow)(this,"isFontSubpixelAAEnabled",n)},showText:function CanvasGraphics_showText(e){const t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);const s=t.fontSize;if(0===s)return;const r=this.ctx,o=t.fontSizeScale,l=t.charSpacing,c=t.wordSpacing,h=t.fontDirection,d=t.textHScale*h,u=e.length,p=n.vertical,g=p?1:-1,f=n.defaultVMetrics,m=s*t.fontMatrix[0],b=t.textRenderingMode===i.TextRenderingMode.FILL&&!n.disableFontFace&&!t.patternFill;r.save();let _;if(t.patternFill){r.save();const e=t.fillColor.getPattern(r,this);_=r.mozCurrentTransform;r.restore();r.fillStyle=e}r.transform.apply(r,t.textMatrix);r.translate(t.x,t.y+t.textRise);h>0?r.scale(d,-1):r.scale(d,1);let v=t.lineWidth;const w=t.textMatrixScale;if(0===w||0===v){const e=t.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;if(e===i.TextRenderingMode.STROKE||e===i.TextRenderingMode.FILL_STROKE){this._cachedGetSinglePixelWidth=null;v=this.getSinglePixelWidth()*a}}else v/=w;if(1!==o){r.scale(o,o);v/=o}r.lineWidth=v;let y,S=0;for(y=0;y<u;++y){const t=e[y];if((0,i.isNum)(t)){S+=g*t*s/1e3;continue}let a=!1;const d=(t.isSpace?c:0)+l,u=t.fontChar,v=t.accent;let w,A,P,C=t.width;if(p){const e=t.vmetric||f,n=-(t.vmetric?e[1]:.5*C)*m,i=e[2]*m;C=e?-e[0]:C;w=n/o;A=(S+i)/o}else{w=S/o;A=0}if(n.remeasure&&C>0){const e=1e3*r.measureText(u).width/s*o;if(C<e&&this.isFontSubpixelAAEnabled){const t=C/e;a=!0;r.save();r.scale(t,1);w/=t}else C!==e&&(w+=(C-e)/2e3*s/o)}if(this.contentVisible&&(t.isInFont||n.missingFile))if(b&&!v)r.fillText(u,w,A);else{this.paintChar(u,w,A,_);if(v){const e=w+s*v.offset.x/o,t=A-s*v.offset.y/o;this.paintChar(v.fontChar,e,t,_)}}P=p?C*m-d*h:C*m+d*h;S+=P;a&&r.restore()}p?t.y-=S:t.x+=S*d;r.restore()},showType3Text:function CanvasGraphics_showType3Text(e){const t=this.ctx,n=this.current,s=n.font,r=n.fontSize,a=n.fontDirection,o=s.vertical?1:-1,l=n.charSpacing,c=n.wordSpacing,h=n.textHScale*a,d=n.fontMatrix||i.FONT_IDENTITY_MATRIX,u=e.length;let p,g,f,m;if(!(n.textRenderingMode===i.TextRenderingMode.INVISIBLE)&&0!==r){this._cachedGetSinglePixelWidth=null;t.save();t.transform.apply(t,n.textMatrix);t.translate(n.x,n.y);t.scale(h,a);for(p=0;p<u;++p){g=e[p];if((0,i.isNum)(g)){m=o*g*r/1e3;this.ctx.translate(m,0);n.x+=m*h;continue}const a=(g.isSpace?c:0)+l,u=s.charProcOperatorList[g.operatorListId];if(!u){(0,i.warn)(`Type3 character "${g.operatorListId}" is not available.`);continue}if(this.contentVisible){this.processingType3=g;this.save();t.scale(r,r);t.transform.apply(t,d);this.executeOperatorList(u);this.restore()}f=i.Util.applyTransform([g.width,0],d)[0]*r+a;t.translate(f,0);n.x+=f*h}t.restore();this.processingType3=null}},setCharWidth:function CanvasGraphics_setCharWidth(e,t){},setCharWidthAndBounds:function CanvasGraphics_setCharWidthAndBounds(e,t,n,i,s,r){this.ctx.rect(n,i,s-n,r-i);this.clip();this.endPath()},getColorN_Pattern:function CanvasGraphics_getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const n=e[1],i=this.baseTransform||this.ctx.mozCurrentTransform.slice(),r={createCanvasGraphics:e=>new CanvasGraphics(e,this.commonObjs,this.objs,this.canvasFactory,this.webGLContext)};t=new s.TilingPattern(e,n,this.ctx,r,i)}else t=(0,s.getShadingPatternFromIR)(e);return t},setStrokeColorN:function CanvasGraphics_setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)},setFillColorN:function CanvasGraphics_setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments);this.current.patternFill=!0},setStrokeRGBColor:function CanvasGraphics_setStrokeRGBColor(e,t,n){const s=i.Util.makeHexColor(e,t,n);this.ctx.strokeStyle=s;this.current.strokeColor=s},setFillRGBColor:function CanvasGraphics_setFillRGBColor(e,t,n){const s=i.Util.makeHexColor(e,t,n);this.ctx.fillStyle=s;this.current.fillColor=s;this.current.patternFill=!1},shadingFill:function CanvasGraphics_shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const n=(0,s.getShadingPatternFromIR)(e);t.fillStyle=n.getPattern(t,this,!0);const r=t.mozCurrentTransformInverse;if(r){const e=t.canvas,n=e.width,s=e.height,a=i.Util.applyTransform([0,0],r),o=i.Util.applyTransform([0,s],r),l=i.Util.applyTransform([n,0],r),c=i.Util.applyTransform([n,s],r),h=Math.min(a[0],o[0],l[0],c[0]),d=Math.min(a[1],o[1],l[1],c[1]),u=Math.max(a[0],o[0],l[0],c[0]),p=Math.max(a[1],o[1],l[1],c[1]);this.ctx.fillRect(h,d,u-h,p-d)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.restore()},beginInlineImage:function CanvasGraphics_beginInlineImage(){(0,i.unreachable)("Should not call beginInlineImage")},beginImageData:function CanvasGraphics_beginImageData(){(0,i.unreachable)("Should not call beginImageData")},paintFormXObjectBegin:function CanvasGraphics_paintFormXObjectBegin(e,t){if(this.contentVisible){this.save();this.baseTransformStack.push(this.baseTransform);Array.isArray(e)&&6===e.length&&this.transform.apply(this,e);this.baseTransform=this.ctx.mozCurrentTransform;if(t){const e=t[2]-t[0],n=t[3]-t[1];this.ctx.rect(t[0],t[1],e,n);this.clip();this.endPath()}}},paintFormXObjectEnd:function CanvasGraphics_paintFormXObjectEnd(){if(this.contentVisible){this.restore();this.baseTransform=this.baseTransformStack.pop()}},beginGroup:function CanvasGraphics_beginGroup(e){if(!this.contentVisible)return;this.save();const t=this.ctx;e.isolated||(0,i.info)("TODO: Support non-isolated groups.");e.knockout&&(0,i.warn)("Knockout groups not supported.");const n=t.mozCurrentTransform;e.matrix&&t.transform.apply(t,e.matrix);if(!e.bbox)throw new Error("Bounding box is required.");let s=i.Util.getAxialAlignedBoundingBox(e.bbox,t.mozCurrentTransform);const a=[0,0,t.canvas.width,t.canvas.height];s=i.Util.intersect(s,a)||[0,0,0,0];const o=Math.floor(s[0]),l=Math.floor(s[1]);let c=Math.max(Math.ceil(s[2])-o,1),h=Math.max(Math.ceil(s[3])-l,1),d=1,u=1;if(c>r){d=c/r;c=r}if(h>r){u=h/r;h=r}let p="groupAt"+this.groupLevel;e.smask&&(p+="_smask_"+this.smaskCounter++%2);const g=this.cachedCanvases.getCanvas(p,c,h,!0),f=g.context;f.scale(1/d,1/u);f.translate(-o,-l);f.transform.apply(f,n);if(e.smask)this.smaskStack.push({canvas:g.canvas,context:f,offsetX:o,offsetY:l,scaleX:d,scaleY:u,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null});else{t.setTransform(1,0,0,1,0,0);t.translate(o,l);t.scale(d,u)}copyCtxState(t,f);this.ctx=f;this.setGState([["BM","source-over"],["ca",1],["CA",1]]);this.groupStack.push(t);this.groupLevel++;this.current.activeSMask=null},endGroup:function CanvasGraphics_endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx;this.ctx=this.groupStack.pop();void 0!==this.ctx.imageSmoothingEnabled?this.ctx.imageSmoothingEnabled=!1:this.ctx.mozImageSmoothingEnabled=!1;e.smask?this.tempSMask=this.smaskStack.pop():this.ctx.drawImage(t.canvas,0,0);this.restore()},beginAnnotations:function CanvasGraphics_beginAnnotations(){this.save();this.baseTransform&&this.ctx.setTransform.apply(this.ctx,this.baseTransform)},endAnnotations:function CanvasGraphics_endAnnotations(){this.restore()},beginAnnotation:function CanvasGraphics_beginAnnotation(e,t,n){this.save();resetCtxToDefault(this.ctx);this.current=new c;if(Array.isArray(e)&&4===e.length){const t=e[2]-e[0],n=e[3]-e[1];this.ctx.rect(e[0],e[1],t,n);this.clip();this.endPath()}this.transform.apply(this,t);this.transform.apply(this,n)},endAnnotation:function CanvasGraphics_endAnnotation(){this.restore()},paintImageMaskXObject:function CanvasGraphics_paintImageMaskXObject(e){if(!this.contentVisible)return;const t=this.ctx,n=e.width,i=e.height,s=this.current.fillColor,r=this.current.patternFill,a=this.processingType3;a&&void 0===a.compiled&&(a.compiled=n<=1e3&&i<=1e3?function compileType3Glyph(e){const t=e.width,n=e.height,i=t+1;let s,r,a,o;const l=new Uint8Array(i*(n+1)),c=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),h=t+7&-8,d=e.data,u=new Uint8Array(h*n);let p=0;for(s=0,r=d.length;s<r;s++){const e=d[s];let t=128;for(;t>0;){u[p++]=e&t?0:255;t>>=1}}let g=0;p=0;if(0!==u[p]){l[0]=1;++g}for(a=1;a<t;a++){if(u[p]!==u[p+1]){l[a]=u[p]?2:1;++g}p++}if(0!==u[p]){l[a]=2;++g}for(s=1;s<n;s++){p=s*h;o=s*i;if(u[p-h]!==u[p]){l[o]=u[p]?1:8;++g}let e=(u[p]?4:0)+(u[p-h]?8:0);for(a=1;a<t;a++){e=(e>>2)+(u[p+1]?4:0)+(u[p-h+1]?8:0);if(c[e]){l[o+a]=c[e];++g}p++}if(u[p-h]!==u[p]){l[o+a]=u[p]?2:4;++g}if(g>1e3)return null}p=h*(n-1);o=s*i;if(0!==u[p]){l[o]=8;++g}for(a=1;a<t;a++){if(u[p]!==u[p+1]){l[o+a]=u[p]?4:8;++g}p++}if(0!==u[p]){l[o+a]=4;++g}if(g>1e3)return null;const f=new Int32Array([0,i,-1,0,-i,0,0,0,1]),m=[];for(s=0;g&&s<=n;s++){let e=s*i;const n=e+t;for(;e<n&&!l[e];)e++;if(e===n)continue;const r=[e%i,s],a=e;let o=l[e];do{const t=f[o];do{e+=t}while(!l[e]);const n=l[e];if(5!==n&&10!==n){o=n;l[e]=0}else{o=n&51*o>>4;l[e]&=o>>2|o<<2}r.push(e%i);r.push(e/i|0);l[e]||--g}while(a!==e);m.push(r);--s}return function(e){e.save();e.scale(1/t,-1/n);e.translate(0,-n);e.beginPath();for(let t=0,n=m.length;t<n;t++){const n=m[t];e.moveTo(n[0],n[1]);for(let t=2,i=n.length;t<i;t+=2)e.lineTo(n[t],n[t+1])}e.fill();e.beginPath();e.restore()}}({data:e.data,width:n,height:i}):null);if(a?.compiled){a.compiled(t);return}const o=this.cachedCanvases.getCanvas("maskCanvas",n,i),l=o.context;l.save();putBinaryImageMask(l,e);l.globalCompositeOperation="source-in";l.fillStyle=r?s.getPattern(l,this):s;l.fillRect(0,0,n,i);l.restore();this.paintInlineImageXObject(o.canvas)},paintImageMaskXObjectRepeat(e,t,n=0,i=0,s,r){if(!this.contentVisible)return;const a=e.width,o=e.height,l=this.current.fillColor,c=this.current.patternFill,h=this.cachedCanvases.getCanvas("maskCanvas",a,o),d=h.context;d.save();putBinaryImageMask(d,e);d.globalCompositeOperation="source-in";d.fillStyle=c?l.getPattern(d,this):l;d.fillRect(0,0,a,o);d.restore();const u=this.ctx;for(let e=0,l=r.length;e<l;e+=2){u.save();u.transform(t,n,i,s,r[e],r[e+1]);u.scale(1,-1);u.drawImage(h.canvas,0,0,a,o,0,-1,1,1);u.restore()}},paintImageMaskXObjectGroup:function CanvasGraphics_paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,n=this.current.fillColor,i=this.current.patternFill;for(let s=0,r=e.length;s<r;s++){const r=e[s],a=r.width,o=r.height,l=this.cachedCanvases.getCanvas("maskCanvas",a,o),c=l.context;c.save();putBinaryImageMask(c,r);c.globalCompositeOperation="source-in";c.fillStyle=i?n.getPattern(c,this):n;c.fillRect(0,0,a,o);c.restore();t.save();t.transform.apply(t,r.transform);t.scale(1,-1);t.drawImage(l.canvas,0,0,a,o,0,-1,1,1);t.restore()}},paintImageXObject:function CanvasGraphics_paintImageXObject(e){if(!this.contentVisible)return;const t=e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e);t?this.paintInlineImageXObject(t):(0,i.warn)("Dependent image isn't ready yet")},paintImageXObjectRepeat:function CanvasGraphics_paintImageXObjectRepeat(e,t,n,s){if(!this.contentVisible)return;const r=e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e);if(!r){(0,i.warn)("Dependent image isn't ready yet");return}const a=r.width,o=r.height,l=[];for(let e=0,i=s.length;e<i;e+=2)l.push({transform:[t,0,0,n,s[e],s[e+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(r,l)},paintInlineImageXObject:function CanvasGraphics_paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,n=e.height,i=this.ctx;this.save();i.scale(1/t,-1/n);const s=i.mozCurrentTransformInverse,r=s[0],a=s[1];let o=Math.max(Math.sqrt(r*r+a*a),1);const l=s[2],c=s[3];let h,d,u,p=Math.max(Math.sqrt(l*l+c*c),1);if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)h=e;else{d=this.cachedCanvases.getCanvas("inlineImage",t,n);u=d.context;putBinaryImageData(u,e,this.current.transferMaps);h=d.canvas}let g=t,f=n,m="prescale1";for(;o>2&&g>1||p>2&&f>1;){let e=g,t=f;if(o>2&&g>1){e=Math.ceil(g/2);o/=g/e}if(p>2&&f>1){t=Math.ceil(f/2);p/=f/t}d=this.cachedCanvases.getCanvas(m,e,t);u=d.context;u.clearRect(0,0,e,t);u.drawImage(h,0,0,g,f,0,0,e,t);h=d.canvas;g=e;f=t;m="prescale1"===m?"prescale2":"prescale1"}i.drawImage(h,0,0,g,f,0,-n,t,n);if(this.imageLayer){const i=this.getCanvasPosition(0,-n);this.imageLayer.appendImage({imgData:e,left:i[0],top:i[1],width:t/s[0],height:n/s[3]})}this.restore()},paintInlineImageXObjectGroup:function CanvasGraphics_paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const n=this.ctx,i=e.width,s=e.height,r=this.cachedCanvases.getCanvas("inlineImage",i,s);putBinaryImageData(r.context,e,this.current.transferMaps);for(let a=0,o=t.length;a<o;a++){const o=t[a];n.save();n.transform.apply(n,o.transform);n.scale(1,-1);n.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,-1,1,1);if(this.imageLayer){const t=this.getCanvasPosition(o.x,o.y);this.imageLayer.appendImage({imgData:e,left:t[0],top:t[1],width:i,height:s})}n.restore()}},paintSolidColorImageMask:function CanvasGraphics_paintSolidColorImageMask(){this.contentVisible&&this.ctx.fillRect(0,0,1,1)},markPoint:function CanvasGraphics_markPoint(e){},markPointProps:function CanvasGraphics_markPointProps(e,t){},beginMarkedContent:function CanvasGraphics_beginMarkedContent(e){this.markedContentStack.push({visible:!0})},beginMarkedContentProps:function CanvasGraphics_beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0});this.contentVisible=this.isContentVisible()},endMarkedContent:function CanvasGraphics_endMarkedContent(){this.markedContentStack.pop();this.contentVisible=this.isContentVisible()},beginCompat:function CanvasGraphics_beginCompat(){},endCompat:function CanvasGraphics_endCompat(){},consumePath:function CanvasGraphics_consumePath(){const e=this.ctx;if(this.pendingClip){this.pendingClip===h?e.clip("evenodd"):e.clip();this.pendingClip=null}e.beginPath()},getSinglePixelWidth(e){if(null===this._cachedGetSinglePixelWidth){const e=this.ctx.mozCurrentTransformInverse;this._cachedGetSinglePixelWidth=Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1],e[2]*e[2]+e[3]*e[3]))}return this._cachedGetSinglePixelWidth},getCanvasPosition:function CanvasGraphics_getCanvasPosition(e,t){const n=this.ctx.mozCurrentTransform;return[n[0]*e+n[2]*t+n[4],n[1]*e+n[3]*t+n[5]]},isContentVisible:function CanvasGraphics_isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};for(const e in i.OPS)CanvasGraphics.prototype[i.OPS[e]]=CanvasGraphics.prototype[e];return CanvasGraphics}();t.CanvasGraphics=h},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.getShadingPatternFromIR=function getShadingPatternFromIR(e){const t=s[e[0]];if(!t)throw new Error(`Unknown IR type: ${e[0]}`);return t.fromIR(e)};t.TilingPattern=void 0;var i=n(2);const s={};function applyBoundingBox(e,t){if(!t||"undefined"==typeof Path2D)return;const n=t[2]-t[0],i=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],n,i);e.clip(s)}s.RadialAxial={fromIR:function RadialAxial_fromIR(e){const t=e[1],n=e[2],i=e[3],s=e[4],r=e[5],a=e[6],o=e[7];return{getPattern:function RadialAxial_getPattern(e){applyBoundingBox(e,n);let l;"axial"===t?l=e.createLinearGradient(s[0],s[1],r[0],r[1]):"radial"===t&&(l=e.createRadialGradient(s[0],s[1],a,r[0],r[1],o));for(let e=0,t=i.length;e<t;++e){const t=i[e];l.addColorStop(t[0],t[1])}return l}}}};const r=function createMeshCanvasClosure(){function drawTriangle(e,t,n,i,s,r,a,o){const l=t.coords,c=t.colors,h=e.data,d=4*e.width;let u;if(l[n+1]>l[i+1]){u=n;n=i;i=u;u=r;r=a;a=u}if(l[i+1]>l[s+1]){u=i;i=s;s=u;u=a;a=o;o=u}if(l[n+1]>l[i+1]){u=n;n=i;i=u;u=r;r=a;a=u}const p=(l[n]+t.offsetX)*t.scaleX,g=(l[n+1]+t.offsetY)*t.scaleY,f=(l[i]+t.offsetX)*t.scaleX,m=(l[i+1]+t.offsetY)*t.scaleY,b=(l[s]+t.offsetX)*t.scaleX,_=(l[s+1]+t.offsetY)*t.scaleY;if(g>=_)return;const v=c[r],w=c[r+1],y=c[r+2],S=c[a],A=c[a+1],P=c[a+2],C=c[o],E=c[o+1],T=c[o+2],x=Math.round(g),L=Math.round(_);let k,R,I,M,F,D,N,O;for(let e=x;e<=L;e++){if(e<m){let t;t=e<g?0:g===m?1:(g-e)/(g-m);k=p-(p-f)*t;R=v-(v-S)*t;I=w-(w-A)*t;M=y-(y-P)*t}else{let t;t=e>_?1:m===_?0:(m-e)/(m-_);k=f-(f-b)*t;R=S-(S-C)*t;I=A-(A-E)*t;M=P-(P-T)*t}let t;t=e<g?0:e>_?1:(g-e)/(g-_);F=p-(p-b)*t;D=v-(v-C)*t;N=w-(w-E)*t;O=y-(y-T)*t;const n=Math.round(Math.min(k,F)),i=Math.round(Math.max(k,F));let s=d*e+4*n;for(let e=n;e<=i;e++){t=(k-e)/(k-F);t<0?t=0:t>1&&(t=1);h[s++]=R-(R-D)*t|0;h[s++]=I-(I-N)*t|0;h[s++]=M-(M-O)*t|0;h[s++]=255}}}function drawFigure(e,t,n){const i=t.coords,s=t.colors;let r,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(i.length/o)-1,c=o-1;for(r=0;r<l;r++){let t=r*o;for(let r=0;r<c;r++,t++){drawTriangle(e,n,i[t],i[t+1],i[t+o],s[t],s[t+1],s[t+o]);drawTriangle(e,n,i[t+o+1],i[t+1],i[t+o],s[t+o+1],s[t+1],s[t+o])}}break;case"triangles":for(r=0,a=i.length;r<a;r+=3)drawTriangle(e,n,i[r],i[r+1],i[r+2],s[r],s[r+1],s[r+2]);break;default:throw new Error("illegal figure")}}return function createMeshCanvas(e,t,n,i,s,r,a,o){const l=Math.floor(e[0]),c=Math.floor(e[1]),h=Math.ceil(e[2])-l,d=Math.ceil(e[3])-c,u=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3),p=Math.min(Math.ceil(Math.abs(d*t[1]*1.1)),3e3),g=h/u,f=d/p,m={coords:n,colors:i,offsetX:-l,offsetY:-c,scaleX:1/g,scaleY:1/f},b=u+4,_=p+4;let v,w,y,S;if(o.isEnabled){v=o.drawFigures({width:u,height:p,backgroundColor:r,figures:s,context:m});w=a.getCanvas("mesh",b,_,!1);w.context.drawImage(v,2,2);v=w.canvas}else{w=a.getCanvas("mesh",b,_,!1);const e=w.context,t=e.createImageData(u,p);if(r){const e=t.data;for(y=0,S=e.length;y<S;y+=4){e[y]=r[0];e[y+1]=r[1];e[y+2]=r[2];e[y+3]=255}}for(y=0;y<s.length;y++)drawFigure(t,s[y],m);e.putImageData(t,2,2);v=w.canvas}return{canvas:v,offsetX:l-2*g,offsetY:c-2*f,scaleX:g,scaleY:f}}}();s.Mesh={fromIR:function Mesh_fromIR(e){const t=e[2],n=e[3],s=e[4],a=e[5],o=e[6],l=e[7],c=e[8];return{getPattern:function Mesh_getPattern(e,h,d){applyBoundingBox(e,l);let u;if(d)u=i.Util.singularValueDecompose2dScale(e.mozCurrentTransform);else{u=i.Util.singularValueDecompose2dScale(h.baseTransform);if(o){const e=i.Util.singularValueDecompose2dScale(o);u=[u[0]*e[0],u[1]*e[1]]}}const p=r(a,u,t,n,s,d?null:c,h.cachedCanvases,h.webGLContext);if(!d){e.setTransform.apply(e,h.baseTransform);o&&e.transform.apply(e,o)}e.translate(p.offsetX,p.offsetY);e.scale(p.scaleX,p.scaleY);return e.createPattern(p.canvas,"no-repeat")}}}};s.Dummy={fromIR:function Dummy_fromIR(){return{getPattern:function Dummy_fromIR_getPattern(){return"hotpink"}}}};const a=function TilingPatternClosure(){const e=1,t=2;function TilingPattern(e,t,n,i,s){this.operatorList=e[2];this.matrix=e[3]||[1,0,0,1,0,0];this.bbox=e[4];this.xstep=e[5];this.ystep=e[6];this.paintType=e[7];this.tilingType=e[8];this.color=t;this.canvasGraphicsFactory=i;this.baseTransform=s;this.ctx=n}TilingPattern.prototype={createPatternCanvas:function TilinPattern_createPatternCanvas(e){const t=this.operatorList,n=this.bbox,s=this.xstep,r=this.ystep,a=this.paintType,o=this.tilingType,l=this.color,c=this.canvasGraphicsFactory;(0,i.info)("TilingType: "+o);const h=n[0],d=n[1],u=n[2],p=n[3],g=i.Util.singularValueDecompose2dScale(this.matrix),f=i.Util.singularValueDecompose2dScale(this.baseTransform),m=[g[0]*f[0],g[1]*f[1]],b=this.getSizeAndScale(s,this.ctx.canvas.width,m[0]),_=this.getSizeAndScale(r,this.ctx.canvas.height,m[1]),v=e.cachedCanvases.getCanvas("pattern",b.size,_.size,!0),w=v.context,y=c.createCanvasGraphics(w);y.groupLevel=e.groupLevel;this.setFillAndStrokeStyleToContext(y,a,l);y.transform(b.scale,0,0,_.scale,0,0);y.transform(1,0,0,1,-h,-d);this.clipBbox(y,n,h,d,u,p);y.executeOperatorList(t);this.ctx.transform(1,0,0,1,h,d);this.ctx.scale(1/b.scale,1/_.scale);return v.canvas},getSizeAndScale:function TilingPattern_getSizeAndScale(e,t,n){e=Math.abs(e);const i=Math.max(3e3,t);let s=Math.ceil(e*n);s>=i?s=i:n=s/e;return{scale:n,size:s}},clipBbox:function clipBbox(e,t,n,i,s,r){if(Array.isArray(t)&&4===t.length){const t=s-n,a=r-i;e.ctx.rect(n,i,t,a);e.clip();e.endPath()}},setFillAndStrokeStyleToContext:function setFillAndStrokeStyleToContext(n,s,r){const a=n.ctx,o=n.current;switch(s){case e:const n=this.ctx;a.fillStyle=n.fillStyle;a.strokeStyle=n.strokeStyle;o.fillColor=n.fillStyle;o.strokeColor=n.strokeStyle;break;case t:const l=i.Util.makeHexColor(r[0],r[1],r[2]);a.fillStyle=l;a.strokeStyle=l;o.fillColor=l;o.strokeColor=l;break;default:throw new i.FormatError(`Unsupported paint type: ${s}`)}},getPattern:function TilingPattern_getPattern(e,t){(e=this.ctx).setTransform.apply(e,this.baseTransform);e.transform.apply(e,this.matrix);const n=this.createPatternCanvas(t);return e.createPattern(n,"repeat")}};return TilingPattern}();t.TilingPattern=a},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GlobalWorkerOptions=void 0;const n=Object.create(null);t.GlobalWorkerOptions=n;n.workerPort=void 0===n.workerPort?null:n.workerPort;n.workerSrc=void 0===n.workerSrc?"":n.workerSrc},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.MessageHandler=void 0;var i=n(2);const s=1,r=2,a=1,o=2,l=3,c=4,h=5,d=6,u=7,p=8;function wrapReason(e){if("object"!=typeof e||null===e)return e;switch(e.name){case"AbortException":return new i.AbortException(e.message);case"MissingPDFException":return new i.MissingPDFException(e.message);case"UnexpectedResponseException":return new i.UnexpectedResponseException(e.message,e.status);case"UnknownErrorException":return new i.UnknownErrorException(e.message,e.details);default:return new i.UnknownErrorException(e.message,e.toString())}}t.MessageHandler=class MessageHandler{constructor(e,t,n){this.sourceName=e;this.targetName=t;this.comObj=n;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=e=>{const t=e.data;if(t.targetName!==this.sourceName)return;if(t.stream){this._processStreamMessage(t);return}if(t.callback){const e=t.callbackId,n=this.callbackCapabilities[e];if(!n)throw new Error(`Cannot resolve callback ${e}`);delete this.callbackCapabilities[e];if(t.callback===s)n.resolve(t.data);else{if(t.callback!==r)throw new Error("Unexpected callback case");n.reject(wrapReason(t.reason))}return}const i=this.actionHandler[t.action];if(!i)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const e=this.sourceName,a=t.sourceName;new Promise((function(e){e(i(t.data))})).then((function(i){n.postMessage({sourceName:e,targetName:a,callback:s,callbackId:t.callbackId,data:i})}),(function(i){n.postMessage({sourceName:e,targetName:a,callback:r,callbackId:t.callbackId,reason:wrapReason(i)})}))}else t.streamId?this._createStreamSink(t):i(t.data)};n.addEventListener("message",this._onComObjOnMessage)}on(e,t){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){const s=this.callbackId++,r=(0,i.createPromiseCapability)();this.callbackCapabilities[s]=r;try{this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:t},n)}catch(e){r.reject(e)}return r.promise}sendWithStream(e,t,n,s){const r=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:n=>{const a=(0,i.createPromiseCapability)();this.streamControllers[r]={controller:n,startCall:a,pullCall:null,cancelCall:null,isClosed:!1};this._postMessage({sourceName:o,targetName:l,action:e,streamId:r,data:t,desiredSize:n.desiredSize},s);return a.promise},pull:e=>{const t=(0,i.createPromiseCapability)();this.streamControllers[r].pullCall=t;c.postMessage({sourceName:o,targetName:l,stream:d,streamId:r,desiredSize:e.desiredSize});return t.promise},cancel:e=>{(0,i.assert)(e instanceof Error,"cancel must have a valid reason");const t=(0,i.createPromiseCapability)();this.streamControllers[r].cancelCall=t;this.streamControllers[r].isClosed=!0;c.postMessage({sourceName:o,targetName:l,stream:a,streamId:r,reason:wrapReason(e)});return t.promise}},n)}_createStreamSink(e){const t=this,n=this.actionHandler[e.action],s=e.streamId,r=this.sourceName,a=e.sourceName,o=this.comObj,d={enqueue(e,n=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=n;if(l>0&&this.desiredSize<=0){this.sinkCapability=(0,i.createPromiseCapability)();this.ready=this.sinkCapability.promise}t._postMessage({sourceName:r,targetName:a,stream:c,streamId:s,chunk:e},o)},close(){if(!this.isCancelled){this.isCancelled=!0;o.postMessage({sourceName:r,targetName:a,stream:l,streamId:s});delete t.streamSinks[s]}},error(e){(0,i.assert)(e instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;o.postMessage({sourceName:r,targetName:a,stream:h,streamId:s,reason:wrapReason(e)})}},sinkCapability:(0,i.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve();d.ready=d.sinkCapability.promise;this.streamSinks[s]=d;new Promise((function(t){t(n(e.data,d))})).then((function(){o.postMessage({sourceName:r,targetName:a,stream:p,streamId:s,success:!0})}),(function(e){o.postMessage({sourceName:r,targetName:a,stream:p,streamId:s,reason:wrapReason(e)})}))}_processStreamMessage(e){const t=e.streamId,n=this.sourceName,s=e.sourceName,r=this.comObj;switch(e.stream){case p:e.success?this.streamControllers[t].startCall.resolve():this.streamControllers[t].startCall.reject(wrapReason(e.reason));break;case u:e.success?this.streamControllers[t].pullCall.resolve():this.streamControllers[t].pullCall.reject(wrapReason(e.reason));break;case d:if(!this.streamSinks[t]){r.postMessage({sourceName:n,targetName:s,stream:u,streamId:t,success:!0});break}this.streamSinks[t].desiredSize<=0&&e.desiredSize>0&&this.streamSinks[t].sinkCapability.resolve();this.streamSinks[t].desiredSize=e.desiredSize;const{onPull:g}=this.streamSinks[e.streamId];new Promise((function(e){e(g&&g())})).then((function(){r.postMessage({sourceName:n,targetName:s,stream:u,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:n,targetName:s,stream:u,streamId:t,reason:wrapReason(e)})}));break;case c:(0,i.assert)(this.streamControllers[t],"enqueue should have stream controller");if(this.streamControllers[t].isClosed)break;this.streamControllers[t].controller.enqueue(e.chunk);break;case l:(0,i.assert)(this.streamControllers[t],"close should have stream controller");if(this.streamControllers[t].isClosed)break;this.streamControllers[t].isClosed=!0;this.streamControllers[t].controller.close();this._deleteStreamController(t);break;case h:(0,i.assert)(this.streamControllers[t],"error should have stream controller");this.streamControllers[t].controller.error(wrapReason(e.reason));this._deleteStreamController(t);break;case o:e.success?this.streamControllers[t].cancelCall.resolve():this.streamControllers[t].cancelCall.reject(wrapReason(e.reason));this._deleteStreamController(t);break;case a:if(!this.streamSinks[t])break;const{onCancel:f}=this.streamSinks[e.streamId];new Promise((function(t){t(f&&f(wrapReason(e.reason)))})).then((function(){r.postMessage({sourceName:n,targetName:s,stream:o,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:n,targetName:s,stream:o,streamId:t,reason:wrapReason(e)})}));this.streamSinks[t].sinkCapability.reject(wrapReason(e.reason));this.streamSinks[t].isCancelled=!0;delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(e){await Promise.allSettled([this.streamControllers[e].startCall,this.streamControllers[e].pullCall,this.streamControllers[e].cancelCall].map((function(e){return e&&e.promise})));delete this.streamControllers[e]}_postMessage(e,t){t&&this.postMessageTransfers?this.comObj.postMessage(e,t):this.comObj.postMessage(e)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Metadata=void 0;var i=n(2),s=n(15);t.Metadata=class Metadata{constructor(e){(0,i.assert)("string"==typeof e,"Metadata: input is not a string");e=this._repair(e);const t=(new s.SimpleXMLParser).parseFromString(e);this._metadataMap=new Map;t&&this._parse(t)}_repair(e){return e.replace(/^[^<]+/,"").replace(/>\\376\\377([^<]+)/g,(function(e,t){const n=t.replace(/\\([0-3])([0-7])([0-7])/g,(function(e,t,n,i){return String.fromCharCode(64*t+8*n+1*i)})).replace(/&(amp|apos|gt|lt|quot);/g,(function(e,t){switch(t){case"amp":return"&";case"apos":return"'";case"gt":return">";case"lt":return"<";case"quot":return'"'}throw new Error(`_repair: ${t} isn't defined.`)}));let i="";for(let e=0,t=n.length;e<t;e+=2){const t=256*n.charCodeAt(e)+n.charCodeAt(e+1);i+=t>=32&&t<127&&60!==t&&62!==t&&38!==t?String.fromCharCode(t):"&#x"+(65536+t).toString(16).substring(1)+";"}return">"+i}))}_parse(e){let t=e.documentElement;if("rdf:rdf"!==t.nodeName.toLowerCase()){t=t.firstChild;for(;t&&"rdf:rdf"!==t.nodeName.toLowerCase();)t=t.nextSibling}const n=t?t.nodeName.toLowerCase():null;if(!t||"rdf:rdf"!==n||!t.hasChildNodes())return;const i=t.childNodes;for(let e=0,t=i.length;e<t;e++){const t=i[e];if("rdf:description"===t.nodeName.toLowerCase())for(let e=0,n=t.childNodes.length;e<n;e++)if("#text"!==t.childNodes[e].nodeName.toLowerCase()){const n=t.childNodes[e],i=n.nodeName.toLowerCase();this._metadataMap.set(i,n.textContent.trim())}}}get(e){return this._metadataMap.has(e)?this._metadataMap.get(e):null}getAll(){return(0,i.objectFromEntries)(this._metadataMap)}has(e){return this._metadataMap.has(e)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SimpleXMLParser=t.SimpleDOMNode=void 0;var i=n(2);const s=0,r=-2,a=-3,o=-4,l=-5,c=-6,h=-9;function isWhitespace(e,t){const n=e[t];return" "===n||"\n"===n||"\r"===n||"\t"===n}class SimpleDOMNode{constructor(e,t){this.nodeName=e;this.nodeValue=t;Object.defineProperty(this,"parentNode",{value:null,writable:!0})}get firstChild(){return this.childNodes&&this.childNodes[0]}get nextSibling(){const e=this.parentNode.childNodes;if(!e)return;const t=e.indexOf(this);return-1!==t?e[t+1]:void 0}get textContent(){return this.childNodes?this.childNodes.map((function(e){return e.textContent})).join(""):this.nodeValue||""}hasChildNodes(){return this.childNodes&&this.childNodes.length>0}searchNode(e,t){if(t>=e.length)return this;const n=e[t],i=[];let s=this;for(;;){if(n.name===s.nodeName){if(0!==n.pos){if(0===i.length)return null;{const[r]=i.pop();let a=0;for(const i of r.childNodes)if(n.name===i.nodeName){if(a===n.pos)return i.searchNode(e,t+1);a++}return s.searchNode(e,t+1)}}{const n=s.searchNode(e,t+1);if(null!==n)return n}}if(s.childNodes&&0!==s.childNodes.length){i.push([s,0]);s=s.childNodes[0]}else{if(0===i.length)return null;for(;0!==i.length;){const[e,t]=i.pop(),n=t+1;if(n<e.childNodes.length){i.push([e,n]);s=e.childNodes[n];break}}if(0===i.length)return null}}}dump(e){if("#text"!==this.nodeName){e.push(`<${this.nodeName}`);if(this.attributes)for(const t of this.attributes)e.push(` ${t.name}="${(0,i.encodeToXmlString)(t.value)}"`);if(this.hasChildNodes()){e.push(">");for(const t of this.childNodes)t.dump(e);e.push(`</${this.nodeName}>`)}else this.nodeValue?e.push(`>${(0,i.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`):e.push("/>")}else e.push((0,i.encodeToXmlString)(this.nodeValue))}}t.SimpleDOMNode=SimpleDOMNode;t.SimpleXMLParser=class SimpleXMLParser extends class XMLParserBase{_resolveEntities(e){return e.replace(/&([^;]+);/g,((e,t)=>{if("#x"===t.substring(0,2))return String.fromCodePoint(parseInt(t.substring(2),16));if("#"===t.substring(0,1))return String.fromCodePoint(parseInt(t.substring(1),10));switch(t){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"'}return this.onResolveEntity(t)}))}_parseContent(e,t){const n=[];let i=t;function skipWs(){for(;i<e.length&&isWhitespace(e,i);)++i}for(;i<e.length&&!isWhitespace(e,i)&&">"!==e[i]&&"/"!==e[i];)++i;const s=e.substring(t,i);skipWs();for(;i<e.length&&">"!==e[i]&&"/"!==e[i]&&"?"!==e[i];){skipWs();let t="",s="";for(;i<e.length&&!isWhitespace(e,i)&&"="!==e[i];){t+=e[i];++i}skipWs();if("="!==e[i])return null;++i;skipWs();const r=e[i];if('"'!==r&&"'"!==r)return null;const a=e.indexOf(r,++i);if(a<0)return null;s=e.substring(i,a);n.push({name:t,value:this._resolveEntities(s)});i=a+1;skipWs()}return{name:s,attributes:n,parsed:i-t}}_parseProcessingInstruction(e,t){let n=t;for(;n<e.length&&!isWhitespace(e,n)&&">"!==e[n]&&"/"!==e[n];)++n;const i=e.substring(t,n);!function skipWs(){for(;n<e.length&&isWhitespace(e,n);)++n}();const s=n;for(;n<e.length&&("?"!==e[n]||">"!==e[n+1]);)++n;return{name:i,value:e.substring(s,n),parsed:n-t}}parseXml(e){let t=0;for(;t<e.length;){let n=t;if("<"===e[t]){++n;let t;switch(e[n]){case"/":++n;t=e.indexOf(">",n);if(t<0){this.onError(h);return}this.onEndElement(e.substring(n,t));n=t+1;break;case"?":++n;const i=this._parseProcessingInstruction(e,n);if("?>"!==e.substring(n+i.parsed,n+i.parsed+2)){this.onError(a);return}this.onPi(i.name,i.value);n+=i.parsed+2;break;case"!":if("--"===e.substring(n+1,n+3)){t=e.indexOf("--\x3e",n+3);if(t<0){this.onError(l);return}this.onComment(e.substring(n+3,t));n=t+3}else if("[CDATA["===e.substring(n+1,n+8)){t=e.indexOf("]]>",n+8);if(t<0){this.onError(r);return}this.onCdata(e.substring(n+8,t));n=t+3}else{if("DOCTYPE"!==e.substring(n+1,n+8)){this.onError(c);return}{const i=e.indexOf("[",n+8);let s=!1;t=e.indexOf(">",n+8);if(t<0){this.onError(o);return}if(i>0&&t>i){t=e.indexOf("]>",n+8);if(t<0){this.onError(o);return}s=!0}const r=e.substring(n+8,t+(s?1:0));this.onDoctype(r);n=t+(s?2:1)}}break;default:const s=this._parseContent(e,n);if(null===s){this.onError(c);return}let d=!1;if("/>"===e.substring(n+s.parsed,n+s.parsed+2))d=!0;else if(">"!==e.substring(n+s.parsed,n+s.parsed+1)){this.onError(h);return}this.onBeginElement(s.name,s.attributes,d);n+=s.parsed+(d?2:1)}}else{for(;n<e.length&&"<"!==e[n];)n++;const i=e.substring(t,n);this.onText(this._resolveEntities(i))}t=n}}onResolveEntity(e){return`&${e};`}onPi(e,t){}onComment(e){}onCdata(e){}onDoctype(e){}onText(e){}onBeginElement(e,t,n){}onEndElement(e){}onError(e){}}{constructor(e=!1){super();this._currentFragment=null;this._stack=null;this._errorCode=s;this._hasAttributes=e}parseFromString(e){this._currentFragment=[];this._stack=[];this._errorCode=s;this.parseXml(e);if(this._errorCode!==s)return;const[t]=this._currentFragment;return t?{documentElement:t}:void 0}onResolveEntity(e){switch(e){case"apos":return"'"}return super.onResolveEntity(e)}onText(e){if(function isWhitespaceString(e){for(let t=0,n=e.length;t<n;t++)if(!isWhitespace(e,t))return!1;return!0}(e))return;const t=new SimpleDOMNode("#text",e);this._currentFragment.push(t)}onCdata(e){const t=new SimpleDOMNode("#text",e);this._currentFragment.push(t)}onBeginElement(e,t,n){const i=new SimpleDOMNode(e);i.childNodes=[];this._hasAttributes&&(i.attributes=t);this._currentFragment.push(i);if(!n){this._stack.push(this._currentFragment);this._currentFragment=i.childNodes}}onEndElement(e){this._currentFragment=this._stack.pop()||[];const t=this._currentFragment[this._currentFragment.length-1];if(t)for(let e=0,n=t.childNodes.length;e<n;e++)t.childNodes[e].parentNode=t}onError(e){this._errorCode=e}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.OptionalContentConfig=void 0;var i=n(2);class OptionalContentGroup{constructor(e,t){this.visible=!0;this.name=e;this.intent=t}}t.OptionalContentConfig=class OptionalContentConfig{constructor(e){this.name=null;this.creator=null;this._order=null;this._groups=new Map;if(null!==e){this.name=e.name;this.creator=e.creator;this._order=e.order;for(const t of e.groups)this._groups.set(t.id,new OptionalContentGroup(t.name,t.intent));if("OFF"===e.baseState)for(const e of this._groups)e.visible=!1;for(const t of e.on)this._groups.get(t).visible=!0;for(const t of e.off)this._groups.get(t).visible=!1}}isVisible(e){if("OCG"===e.type){if(!this._groups.has(e.id)){(0,i.warn)(`Optional content group not found: ${e.id}`);return!0}return this._groups.get(e.id).visible}if("OCMD"===e.type){e.expression&&(0,i.warn)("Visibility expression not supported yet.");if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this._groups.has(t)){(0,i.warn)(`Optional content group not found: ${t}`);return!0}if(this._groups.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this._groups.has(t)){(0,i.warn)(`Optional content group not found: ${t}`);return!0}if(!this._groups.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this._groups.has(t)){(0,i.warn)(`Optional content group not found: ${t}`);return!0}if(!this._groups.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this._groups.has(t)){(0,i.warn)(`Optional content group not found: ${t}`);return!0}if(this._groups.get(t).visible)return!1}return!0}(0,i.warn)(`Unknown optional content policy ${e.policy}.`);return!0}(0,i.warn)(`Unknown group type ${e.type}.`);return!0}setVisibility(e,t=!0){this._groups.has(e)?this._groups.get(e).visible=!!t:(0,i.warn)(`Optional content group not found: ${e}`)}getOrder(){return this._groups.size?this._order?this._order.slice():Array.from(this._groups.keys()):null}getGroups(){return this._groups.size?(0,i.objectFromEntries)(this._groups):null}getGroup(e){return this._groups.get(e)||null}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFDataTransportStream=void 0;var i=n(2);t.PDFDataTransportStream=class PDFDataTransportStream{constructor(e,t){(0,i.assert)(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');this._queuedChunks=[];this._progressiveDone=e.progressiveDone||!1;const n=e.initialData;if(n?.length>0){const e=new Uint8Array(n).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=t;this._isStreamingSupported=!e.disableStream;this._isRangeSupported=!e.disableRange;this._contentLength=e.length;this._fullRequestReader=null;this._rangeReaders=[];this._pdfDataRangeTransport.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})}));this._pdfDataRangeTransport.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})}));this._pdfDataRangeTransport.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})}));this._pdfDataRangeTransport.addProgressiveDoneListener((()=>{this._onProgressiveDone()}));this._pdfDataRangeTransport.transportReady()}_onReceiveData(e){const t=new Uint8Array(e.chunk).buffer;if(void 0===e.begin)this._fullRequestReader?this._fullRequestReader._enqueue(t):this._queuedChunks.push(t);else{const n=this._rangeReaders.some((function(n){if(n._begin!==e.begin)return!1;n._enqueue(t);return!0}));(0,i.assert)(n,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?this._fullRequestReader._loaded:0}_onProgress(e){if(void 0===e.total){const t=this._rangeReaders[0];t?.onProgress&&t.onProgress({loaded:e.loaded})}else{const t=this._fullRequestReader;t?.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone();this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,i.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;this._queuedChunks=null;return new PDFDataTransportStreamReader(this,e,this._progressiveDone)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new PDFDataTransportStreamRangeReader(this,e,t);this._pdfDataRangeTransport.requestDataRange(e,t);this._rangeReaders.push(n);return n}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);this._rangeReaders.slice(0).forEach((function(t){t.cancel(e)}));this._pdfDataRangeTransport.abort()}};class PDFDataTransportStreamReader{constructor(e,t,n=!1){this._stream=e;this._done=n||!1;this._filename=null;this._queuedChunks=t||[];this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[];this._headersReady=Promise.resolve();e._fullRequestReader=this;this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunks.push(e);this._loaded+=e.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 e=(0,i.createPromiseCapability)();this._requests.push(e);return e.promise}cancel(e){this._done=!0;this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})}));this._requests=[]}progressiveDone(){this._done||(this._done=!0)}}class PDFDataTransportStreamRangeReader{constructor(e,t,n){this._stream=e;this._begin=t;this._end=n;this._queuedChunk=null;this._requests=[];this._done=!1;this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});this._requests.forEach((function(e){e.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 e=this._queuedChunk;this._queuedChunk=null;return{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,i.createPromiseCapability)();this._requests.push(e);return e.promise}cancel(e){this._done=!0;this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})}));this._requests=[];this._stream._removeRangeReader(this)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.WebGLContext=void 0;var i=n(2);t.WebGLContext=class WebGLContext{constructor({enable:e=!1}){this._enabled=!0===e}get isEnabled(){let e=this._enabled;e&&(e=s.tryInitGL());return(0,i.shadow)(this,"isEnabled",e)}composeSMask({layer:e,mask:t,properties:n}){return s.composeSMask(e,t,n)}drawFigures({width:e,height:t,backgroundColor:n,figures:i,context:r}){return s.drawFigures(e,t,n,i,r)}clear(){s.cleanup()}};const s=function WebGLUtilsClosure(){function loadShader(e,t,n){const i=e.createShader(n);e.shaderSource(i,t);e.compileShader(i);if(!e.getShaderParameter(i,e.COMPILE_STATUS)){const t=e.getShaderInfoLog(i);throw new Error("Error during shader compilation: "+t)}return i}function createVertexShader(e,t){return loadShader(e,t,e.VERTEX_SHADER)}function createFragmentShader(e,t){return loadShader(e,t,e.FRAGMENT_SHADER)}function createProgram(e,t){const n=e.createProgram();for(let i=0,s=t.length;i<s;++i)e.attachShader(n,t[i]);e.linkProgram(n);if(!e.getProgramParameter(n,e.LINK_STATUS)){const t=e.getProgramInfoLog(n);throw new Error("Error during program linking: "+t)}return n}function createTexture(e,t,n){e.activeTexture(n);const i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);return i}let e,t;function generateGL(){if(!e){t=document.createElement("canvas");e=t.getContext("webgl",{premultipliedalpha:!1})}}let n=null;let i=null;return{tryInitGL(){try{generateGL();return!!e}catch(e){}return!1},composeSMask:function composeSMask(i,s,r){const a=i.width,o=i.height;n||function initSmaskGL(){generateGL();const i=t;t=null;const s=e;e=null;const r=createProgram(s,[createVertexShader(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;                                      }                                                             "),createFragmentShader(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(r);const a={};a.gl=s;a.canvas=i;a.resolutionLocation=s.getUniformLocation(r,"u_resolution");a.positionLocation=s.getAttribLocation(r,"a_position");a.backdropLocation=s.getUniformLocation(r,"u_backdrop");a.subtypeLocation=s.getUniformLocation(r,"u_subtype");const o=s.getAttribLocation(r,"a_texCoord"),l=s.getUniformLocation(r,"u_image"),c=s.getUniformLocation(r,"u_mask"),h=s.createBuffer();s.bindBuffer(s.ARRAY_BUFFER,h);s.bufferData(s.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),s.STATIC_DRAW);s.enableVertexAttribArray(o);s.vertexAttribPointer(o,2,s.FLOAT,!1,0,0);s.uniform1i(l,0);s.uniform1i(c,1);n=a}();const l=n,c=l.canvas,h=l.gl;c.width=a;c.height=o;h.viewport(0,0,h.drawingBufferWidth,h.drawingBufferHeight);h.uniform2f(l.resolutionLocation,a,o);r.backdrop?h.uniform4f(l.resolutionLocation,r.backdrop[0],r.backdrop[1],r.backdrop[2],1):h.uniform4f(l.resolutionLocation,0,0,0,0);h.uniform1i(l.subtypeLocation,"Luminosity"===r.subtype?1:0);const d=createTexture(h,i,h.TEXTURE0),u=createTexture(h,s,h.TEXTURE1),p=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,p);h.bufferData(h.ARRAY_BUFFER,new Float32Array([0,0,a,0,0,o,0,o,a,0,a,o]),h.STATIC_DRAW);h.enableVertexAttribArray(l.positionLocation);h.vertexAttribPointer(l.positionLocation,2,h.FLOAT,!1,0,0);h.clearColor(0,0,0,0);h.enable(h.BLEND);h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA);h.clear(h.COLOR_BUFFER_BIT);h.drawArrays(h.TRIANGLES,0,6);h.flush();h.deleteTexture(d);h.deleteTexture(u);h.deleteBuffer(p);return c},drawFigures:function drawFigures(n,s,r,a,o){i||function initFiguresGL(){generateGL();const n=t;t=null;const s=e;e=null;const r=createProgram(s,[createVertexShader(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);                         }                                                             "),createFragmentShader(s,"  precision mediump float;                                                                                                        varying vec4 v_color;                                                                                                           void main() {                                                     gl_FragColor = v_color;                                       }                                                             ")]);s.useProgram(r);const a={};a.gl=s;a.canvas=n;a.resolutionLocation=s.getUniformLocation(r,"u_resolution");a.scaleLocation=s.getUniformLocation(r,"u_scale");a.offsetLocation=s.getUniformLocation(r,"u_offset");a.positionLocation=s.getAttribLocation(r,"a_position");a.colorLocation=s.getAttribLocation(r,"a_color");i=a}();const l=i,c=l.canvas,h=l.gl;c.width=n;c.height=s;h.viewport(0,0,h.drawingBufferWidth,h.drawingBufferHeight);h.uniform2f(l.resolutionLocation,n,s);let d=0;for(let e=0,t=a.length;e<t;e++)switch(a[e].type){case"lattice":d+=((a[e].coords.length/a[e].verticesPerRow|0)-1)*(a[e].verticesPerRow-1)*6;break;case"triangles":d+=a[e].coords.length}const u=new Float32Array(2*d),p=new Uint8Array(3*d),g=o.coords,f=o.colors;let m=0,b=0;for(let e=0,t=a.length;e<t;e++){const t=a[e],n=t.coords,i=t.colors;switch(t.type){case"lattice":const e=t.verticesPerRow,s=n.length/e|0;for(let t=1;t<s;t++){let s=t*e+1;for(let t=1;t<e;t++,s++){u[m]=g[n[s-e-1]];u[m+1]=g[n[s-e-1]+1];u[m+2]=g[n[s-e]];u[m+3]=g[n[s-e]+1];u[m+4]=g[n[s-1]];u[m+5]=g[n[s-1]+1];p[b]=f[i[s-e-1]];p[b+1]=f[i[s-e-1]+1];p[b+2]=f[i[s-e-1]+2];p[b+3]=f[i[s-e]];p[b+4]=f[i[s-e]+1];p[b+5]=f[i[s-e]+2];p[b+6]=f[i[s-1]];p[b+7]=f[i[s-1]+1];p[b+8]=f[i[s-1]+2];u[m+6]=u[m+2];u[m+7]=u[m+3];u[m+8]=u[m+4];u[m+9]=u[m+5];u[m+10]=g[n[s]];u[m+11]=g[n[s]+1];p[b+9]=p[b+3];p[b+10]=p[b+4];p[b+11]=p[b+5];p[b+12]=p[b+6];p[b+13]=p[b+7];p[b+14]=p[b+8];p[b+15]=f[i[s]];p[b+16]=f[i[s]+1];p[b+17]=f[i[s]+2];m+=12;b+=18}}break;case"triangles":for(let e=0,t=n.length;e<t;e++){u[m]=g[n[e]];u[m+1]=g[n[e]+1];p[b]=f[i[e]];p[b+1]=f[i[e]+1];p[b+2]=f[i[e]+2];m+=2;b+=3}}}r?h.clearColor(r[0]/255,r[1]/255,r[2]/255,1):h.clearColor(0,0,0,0);h.clear(h.COLOR_BUFFER_BIT);const _=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,_);h.bufferData(h.ARRAY_BUFFER,u,h.STATIC_DRAW);h.enableVertexAttribArray(l.positionLocation);h.vertexAttribPointer(l.positionLocation,2,h.FLOAT,!1,0,0);const v=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,v);h.bufferData(h.ARRAY_BUFFER,p,h.STATIC_DRAW);h.enableVertexAttribArray(l.colorLocation);h.vertexAttribPointer(l.colorLocation,3,h.UNSIGNED_BYTE,!1,0,0);h.uniform2f(l.scaleLocation,o.scaleX,o.scaleY);h.uniform2f(l.offsetLocation,o.offsetX,o.offsetY);h.drawArrays(h.TRIANGLES,0,d);h.flush();h.deleteBuffer(_);h.deleteBuffer(v);return c},cleanup(){if(n?.canvas){n.canvas.width=0;n.canvas.height=0}if(i?.canvas){i.canvas.width=0;i.canvas.height=0}n=null;i=null}}}()},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationLayer=void 0;var i=n(1),s=n(2),r=n(8),a=n(20);class AnnotationElementFactory{static create(e){switch(e.data.annotationType){case s.AnnotationType.LINK:return new LinkAnnotationElement(e);case s.AnnotationType.TEXT:return new TextAnnotationElement(e);case s.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new TextWidgetAnnotationElement(e);case"Btn":return e.data.radioButton?new RadioButtonWidgetAnnotationElement(e):e.data.checkBox?new CheckboxWidgetAnnotationElement(e):new PushButtonWidgetAnnotationElement(e);case"Ch":return new ChoiceWidgetAnnotationElement(e)}return new WidgetAnnotationElement(e);case s.AnnotationType.POPUP:return new PopupAnnotationElement(e);case s.AnnotationType.FREETEXT:return new FreeTextAnnotationElement(e);case s.AnnotationType.LINE:return new LineAnnotationElement(e);case s.AnnotationType.SQUARE:return new SquareAnnotationElement(e);case s.AnnotationType.CIRCLE:return new CircleAnnotationElement(e);case s.AnnotationType.POLYLINE:return new PolylineAnnotationElement(e);case s.AnnotationType.CARET:return new CaretAnnotationElement(e);case s.AnnotationType.INK:return new InkAnnotationElement(e);case s.AnnotationType.POLYGON:return new PolygonAnnotationElement(e);case s.AnnotationType.HIGHLIGHT:return new HighlightAnnotationElement(e);case s.AnnotationType.UNDERLINE:return new UnderlineAnnotationElement(e);case s.AnnotationType.SQUIGGLY:return new SquigglyAnnotationElement(e);case s.AnnotationType.STRIKEOUT:return new StrikeOutAnnotationElement(e);case s.AnnotationType.STAMP:return new StampAnnotationElement(e);case s.AnnotationType.FILEATTACHMENT:return new FileAttachmentAnnotationElement(e);default:return new AnnotationElement(e)}}}class AnnotationElement{constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:i=!1}={}){this.isRenderable=t;this.data=e.data;this.layer=e.layer;this.page=e.page;this.viewport=e.viewport;this.linkService=e.linkService;this.downloadManager=e.downloadManager;this.imageResourcesPath=e.imageResourcesPath;this.renderInteractiveForms=e.renderInteractiveForms;this.svgFactory=e.svgFactory;this.annotationStorage=e.annotationStorage;this.enableScripting=e.enableScripting;this.hasJSActions=e.hasJSActions;this._mouseState=e.mouseState;t&&(this.container=this._createContainer(n));i&&(this.quadrilaterals=this._createQuadrilaterals(n))}_createContainer(e=!1){const t=this.data,n=this.page,i=this.viewport,r=document.createElement("section");let a=t.rect[2]-t.rect[0],o=t.rect[3]-t.rect[1];r.setAttribute("data-annotation-id",t.id);const l=s.Util.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]);r.style.transform=`matrix(${i.transform.join(",")})`;r.style.transformOrigin=`${-l[0]}px ${-l[1]}px`;if(!e&&t.borderStyle.width>0){r.style.borderWidth=`${t.borderStyle.width}px`;if(t.borderStyle.style!==s.AnnotationBorderStyleType.UNDERLINE){a-=2*t.borderStyle.width;o-=2*t.borderStyle.width}const e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;if(e>0||n>0){const t=`${e}px / ${n}px`;r.style.borderRadius=t}switch(t.borderStyle.style){case s.AnnotationBorderStyleType.SOLID:r.style.borderStyle="solid";break;case s.AnnotationBorderStyleType.DASHED:r.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:r.style.borderBottomStyle="solid"}t.color?r.style.borderColor=s.Util.makeHexColor(0|t.color[0],0|t.color[1],0|t.color[2]):r.style.borderWidth=0}r.style.left=`${l[0]}px`;r.style.top=`${l[1]}px`;r.style.width=`${a}px`;r.style.height=`${o}px`;return r}_createQuadrilaterals(e=!1){if(!this.data.quadPoints)return null;const t=[],n=this.data.rect;for(const n of this.data.quadPoints){this.data.rect=[n[2].x,n[2].y,n[1].x,n[1].y];t.push(this._createContainer(e))}this.data.rect=n;return t}_createPopup(e,t){let n=this.container;if(this.quadrilaterals){e=e||this.quadrilaterals;n=this.quadrilaterals[0]}if(!e){(e=document.createElement("div")).style.height=n.style.height;e.style.width=n.style.width;n.appendChild(e)}const i=new PopupElement({container:n,trigger:e,color:t.color,title:t.title,modificationDate:t.modificationDate,contents:t.contents,hideWrapper:!0}).render();i.style.left=n.style.width;n.appendChild(i)}_renderQuadrilaterals(e){this.quadrilaterals.forEach((t=>{t.className=e}));return this.quadrilaterals}render(){(0,s.unreachable)("Abstract method `AnnotationElement.render` called")}}class LinkAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.url||e.data.dest||e.data.action||e.data.isTooltipOnly||e.data.actions&&(e.data.actions.Action||e.data.actions.MouseUp||e.data.actions.MouseDown)),createQuadrilaterals:!0})}render(){const{data:e,linkService:t}=this,n=document.createElement("a");e.url?(0,i.addLinkAttributes)(n,{url:e.url,target:e.newWindow?i.LinkTarget.BLANK:t.externalLinkTarget,rel:t.externalLinkRel,enabled:t.externalLinkEnabled}):e.action?this._bindNamedAction(n,e.action):e.dest?this._bindLink(n,e.dest):e.actions&&(e.actions.Action||e.actions.MouseUp||e.actions.MouseDown)&&this.enableScripting&&this.hasJSActions?this._bindJSAction(n,e):this._bindLink(n,"");if(this.quadrilaterals)return this._renderQuadrilaterals("linkAnnotation").map(((e,t)=>{const i=0===t?n:n.cloneNode();e.appendChild(i);return e}));this.container.className="linkAnnotation";this.container.appendChild(n);return this.container}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t);e.onclick=()=>{t&&this.linkService.goToDestination(t);return!1};(t||""===t)&&(e.className="internalLink")}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.linkService.executeNamedAction(t);return!1};e.className="internalLink"}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["MouseUp","onmouseup"],["MouseDown","onmousedown"]]);for(const i of Object.keys(t.actions)){const s=n.get(i);s&&(e[s]=()=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:i}});return!1})}e.className="internalLink"}}class TextAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents)})}render(){this.container.className="textAnnotation";const e=document.createElement("img");e.style.height=this.container.style.height;e.style.width=this.container.style.width;e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg";e.alt="[{{type}} Annotation]";e.dataset.l10nId="text_annotation_type";e.dataset.l10nArgs=JSON.stringify({type:this.data.name});this.data.hasPopup||this._createPopup(e,this.data);this.container.appendChild(e);return this.container}}class WidgetAnnotationElement extends AnnotationElement{render(){this.data.alternativeText&&(this.container.title=this.data.alternativeText);return this.container}_getKeyModifier(e){return navigator.platform.includes("Win")&&e.ctrlKey||navigator.platform.includes("Mac")&&e.metaKey}_setEventListener(e,t,n,i){void 0!==this.data.actions[n.replace(" ","")]&&(t.includes("mouse")?e.addEventListener(t,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:i(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(t,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:e.target.checked}})})))}_setEventListeners(e,t,n){if(this.data.actions)for(const[i,s]of t)this._setEventListener(e,i,s,n)}}class TextWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderInteractiveForms||!e.data.hasAppearance&&!!e.data.fieldValue})}render(){const e=["left","center","right"],t=this.annotationStorage,n=this.data.id;this.container.className="textWidgetAnnotation";let i=null;if(this.renderInteractiveForms){const e=t.getOrCreateValue(n,{value:this.data.fieldValue}).value,s={userValue:null,formattedValue:null,beforeInputSelectionRange:null,beforeInputValue:null};if(this.data.multiLine){i=document.createElement("textarea");i.textContent=e}else{i=document.createElement("input");i.type="text";i.setAttribute("value",e)}s.userValue=e;i.setAttribute("id",n);i.addEventListener("input",(function(e){t.setValue(n,{value:e.target.value})}));let blurListener=e=>{s.formattedValue&&(e.target.value=s.formattedValue);e.target.setSelectionRange(0,0);s.beforeInputSelectionRange=null};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(e=>{s.userValue&&(e.target.value=s.userValue)}));i.addEventListener("updatefromsandbox",(function(e){const{detail:i}=e,r={value(){s.userValue=i.value||"";t.setValue(n,{value:s.userValue.toString()});s.formattedValue||(e.target.value=s.userValue)},valueAsString(){s.formattedValue=i.valueAsString||"";e.target!==document.activeElement&&(e.target.value=s.formattedValue);t.setValue(n,{formattedValue:s.formattedValue})},focus(){setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName(){e.target.title=i.userName},hidden(){e.target.style.visibility=i.hidden?"hidden":"visible";t.setValue(n,{hidden:i.hidden})},editable(){e.target.disabled=!i.editable},selRange(){const[t,n]=i.selRange;t>=0&&n<e.target.value.length&&e.target.setSelectionRange(t,n)},strokeColor(){const t=i.strokeColor;e.target.style.color=a.ColorConverters[`${t[0]}_HTML`](t.slice(1))}};Object.keys(i).filter((e=>e in r)).forEach((e=>r[e]()))}));if(this.data.actions){i.addEventListener("keydown",(e=>{s.beforeInputValue=e.target.value;let t=-1;"Escape"===e.key?t=0:"Enter"===e.key?t=2:"Tab"===e.key&&(t=3);if(-1!==t){s.userValue=e.target.value;this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:e.target.value,willCommit:!0,commitKey:t,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}})}}));const e=blurListener;blurListener=null;i.addEventListener("blur",(t=>{if(this._mouseState.isDown){s.userValue=t.target.value;this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:t.target.value,willCommit:!0,commitKey:1,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})}e(t)}));i.addEventListener("mousedown",(e=>{s.beforeInputValue=e.target.value;s.beforeInputSelectionRange=null}));i.addEventListener("keyup",(e=>{e.target.selectionStart===e.target.selectionEnd&&(s.beforeInputSelectionRange=null)}));i.addEventListener("select",(e=>{s.beforeInputSelectionRange=[e.target.selectionStart,e.target.selectionEnd]}));"Keystroke"in this.data.actions&&i.addEventListener("input",(e=>{let t=-1,i=-1;s.beforeInputSelectionRange&&([t,i]=s.beforeInputSelectionRange);this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:n,name:"Keystroke",value:s.beforeInputValue,change:e.data,willCommit:!1,selStart:t,selEnd:i}})}));this._setEventListeners(i,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","MouseUp"]],(e=>e.target.value))}}blurListener&&i.addEventListener("blur",blurListener);i.disabled=this.data.readOnly;i.name=this.data.fieldName;null!==this.data.maxLen&&(i.maxLength=this.data.maxLen);if(this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/this.data.maxLen;i.classList.add("comb");i.style.letterSpacing=`calc(${e}px - 1ch)`}}else{i=document.createElement("div");i.textContent=this.data.fieldValue;i.style.verticalAlign="middle";i.style.display="table-cell";let e=null;this.data.fontRefName&&this.page.commonObjs.has(this.data.fontRefName)&&(e=this.page.commonObjs.get(this.data.fontRefName));this._setTextStyle(i,e)}null!==this.data.textAlignment&&(i.style.textAlign=e[this.data.textAlignment]);this.container.appendChild(i);return this.container}_setTextStyle(e,t){const n=e.style;n.fontSize=`${this.data.fontSize}px`;n.direction=this.data.fontDirection<0?"rtl":"ltr";if(!t)return;let i="normal";t.black?i="900":t.bold&&(i="bold");n.fontWeight=i;n.fontStyle=t.italic?"italic":"normal";const s=t.loadedName?`"${t.loadedName}", `:"",r=t.fallbackName||"Helvetica, sans-serif";n.fontFamily=s+r}}class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderInteractiveForms})}render(){const e=this.annotationStorage,t=this.data,n=t.id,i=e.getOrCreateValue(n,{value:t.fieldValue&&"Off"!==t.fieldValue}).value;this.container.className="buttonWidgetAnnotation checkBox";const s=document.createElement("input");s.disabled=t.readOnly;s.type="checkbox";s.name=this.data.fieldName;i&&s.setAttribute("checked",!0);s.setAttribute("id",n);s.addEventListener("change",(function(t){const i=t.target.name;for(const n of document.getElementsByName(i))if(n!==t.target){n.checked=!1;e.setValue(n.parentNode.getAttribute("data-annotation-id"),{value:!1})}e.setValue(n,{value:t.target.checked})}));if(this.enableScripting&&this.hasJSActions){s.addEventListener("updatefromsandbox",(t=>{const{detail:i}=t,s={value(){t.target.checked="Off"!==i.value;e.setValue(n,{value:t.target.checked})},focus(){setTimeout((()=>t.target.focus({preventScroll:!1})),0)},hidden(){t.target.style.visibility=i.hidden?"hidden":"visible";e.setValue(n,{hidden:i.hidden})},editable(){t.target.disabled=!i.editable}};Object.keys(i).filter((e=>e in s)).forEach((e=>s[e]()))}));this._setEventListeners(s,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","MouseUp"]],(e=>e.target.checked))}this.container.appendChild(s);return this.container}}class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderInteractiveForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const e=this.annotationStorage,t=this.data,n=t.id,i=e.getOrCreateValue(n,{value:t.fieldValue===t.buttonValue}).value,s=document.createElement("input");s.disabled=t.readOnly;s.type="radio";s.name=t.fieldName;i&&s.setAttribute("checked",!0);s.setAttribute("pdfButtonValue",t.buttonValue);s.setAttribute("id",n);s.addEventListener("change",(function(t){const{target:i}=t;for(const t of document.getElementsByName(i.name))t!==i&&e.setValue(t.getAttribute("id"),{value:!1});e.setValue(n,{value:i.checked})}));if(this.enableScripting&&this.hasJSActions){s.addEventListener("updatefromsandbox",(t=>{const{detail:i}=t,s={value(){const n=i.value;for(const i of document.getElementsByName(t.target.name)){const t=i.getAttribute("id");if(n===i.getAttribute("pdfButtonValue")){i.setAttribute("checked",!0);e.setValue(t,{value:!0})}else e.setValue(t,{value:!1})}},focus(){setTimeout((()=>t.target.focus({preventScroll:!1})),0)},hidden(){t.target.style.visibility=i.hidden?"hidden":"visible";e.setValue(n,{hidden:i.hidden})},editable(){t.target.disabled=!i.editable}};Object.keys(i).filter((e=>e in s)).forEach((e=>s[e]()))}));this._setEventListeners(s,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","MouseUp"]],(e=>e.target.checked))}this.container.appendChild(s);return this.container}}class PushButtonWidgetAnnotationElement extends LinkAnnotationElement{render(){const e=super.render();e.className="buttonWidgetAnnotation pushButton";this.data.alternativeText&&(e.title=this.data.alternativeText);return e}}class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderInteractiveForms})}render(){this.container.className="choiceWidgetAnnotation";const e=this.annotationStorage,t=this.data.id;e.getOrCreateValue(t,{value:this.data.fieldValue.length>0?this.data.fieldValue[0]:void 0});const n=document.createElement("select");n.disabled=this.data.readOnly;n.name=this.data.fieldName;n.setAttribute("id",t);if(!this.data.combo){n.size=this.data.options.length;this.data.multiSelect&&(n.multiple=!0)}for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue;t.value=e.exportValue;this.data.fieldValue.includes(e.exportValue)&&t.setAttribute("selected",!0);n.appendChild(t)}function getValue(e){const t=e.target.options;return t[t.selectedIndex].value}if(this.enableScripting&&this.hasJSActions){n.addEventListener("updatefromsandbox",(n=>{const{detail:i}=n,s={value(){const s=n.target.options,r=i.value,a=s.indexOf(r);if(-1!==a){s.selectedIndex=a;e.setValue(t,{value:r})}},focus(){setTimeout((()=>n.target.focus({preventScroll:!1})),0)},hidden(){n.target.style.visibility=i.hidden?"hidden":"visible";e.setValue(t,{hidden:i.hidden})},editable(){n.target.disabled=!i.editable}};Object.keys(i).filter((e=>e in s)).forEach((e=>s[e]()))}));n.addEventListener("input",(n=>{const i=getValue(n);e.setValue(t,{value:i});this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",changeEx:i,willCommit:!0,commitKey:1,keyDown:!1}})}));this._setEventListeners(n,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","MouseUp"]],(e=>e.target.checked))}else n.addEventListener("input",(function(n){e.setValue(t,{value:getValue(n)})}));this.container.appendChild(n);return this.container}}class PopupAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!(!e.data.title&&!e.data.contents)})}render(){this.container.className="popupAnnotation";if(["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;const e=`[data-annotation-id="${this.data.parentId}"]`,t=this.layer.querySelectorAll(e);if(0===t.length)return this.container;const n=new PopupElement({container:this.container,trigger:Array.from(t),color:this.data.color,title:this.data.title,modificationDate:this.data.modificationDate,contents:this.data.contents}),i=this.page,r=s.Util.normalizeRect([this.data.parentRect[0],i.view[3]-this.data.parentRect[1]+i.view[1],this.data.parentRect[2],i.view[3]-this.data.parentRect[3]+i.view[1]]),a=r[0]+this.data.parentRect[2]-this.data.parentRect[0],o=r[1];this.container.style.transformOrigin=`${-a}px ${-o}px`;this.container.style.left=`${a}px`;this.container.style.top=`${o}px`;this.container.appendChild(n.render());return this.container}}class PopupElement{constructor(e){this.container=e.container;this.trigger=e.trigger;this.color=e.color;this.title=e.title;this.modificationDate=e.modificationDate;this.contents=e.contents;this.hideWrapper=e.hideWrapper||!1;this.pinned=!1}render(){const e=document.createElement("div");e.className="popupWrapper";this.hideElement=this.hideWrapper?e:this.container;this.hideElement.setAttribute("hidden",!0);const t=document.createElement("div");t.className="popup";const n=this.color;if(n){const e=.7*(255-n[0])+n[0],i=.7*(255-n[1])+n[1],r=.7*(255-n[2])+n[2];t.style.backgroundColor=s.Util.makeHexColor(0|e,0|i,0|r)}const r=document.createElement("h1");r.textContent=this.title;t.appendChild(r);const a=i.PDFDateString.toDateObject(this.modificationDate);if(a){const e=document.createElement("span");e.textContent="{{date}}, {{time}}";e.dataset.l10nId="annotation_date_string";e.dataset.l10nArgs=JSON.stringify({date:a.toLocaleDateString(),time:a.toLocaleTimeString()});t.appendChild(e)}const o=this._formatContents(this.contents);t.appendChild(o);Array.isArray(this.trigger)||(this.trigger=[this.trigger]);this.trigger.forEach((e=>{e.addEventListener("click",this._toggle.bind(this));e.addEventListener("mouseover",this._show.bind(this,!1));e.addEventListener("mouseout",this._hide.bind(this,!1))}));t.addEventListener("click",this._hide.bind(this,!0));e.appendChild(t);return e}_formatContents(e){const t=document.createElement("p"),n=e.split(/(?:\r\n?|\n)/);for(let e=0,i=n.length;e<i;++e){const s=n[e];t.appendChild(document.createTextNode(s));e<i-1&&t.appendChild(document.createElement("br"))}return t}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(e=!1){e&&(this.pinned=!0);if(this.hideElement.hasAttribute("hidden")){this.hideElement.removeAttribute("hidden");this.container.style.zIndex+=1}}_hide(e=!0){e&&(this.pinned=!1);if(!this.hideElement.hasAttribute("hidden")&&!this.pinned){this.hideElement.setAttribute("hidden",!0);this.container.style.zIndex-=1}}}class FreeTextAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0})}render(){this.container.className="freeTextAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class LineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const e=this.data,t=e.rect[2]-e.rect[0],n=e.rect[3]-e.rect[1],i=this.svgFactory.create(t,n),s=this.svgFactory.createElement("svg:line");s.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]);s.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]);s.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]);s.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]);s.setAttribute("stroke-width",e.borderStyle.width||1);s.setAttribute("stroke","transparent");i.appendChild(s);this.container.append(i);this._createPopup(s,e);return this.container}}class SquareAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const e=this.data,t=e.rect[2]-e.rect[0],n=e.rect[3]-e.rect[1],i=this.svgFactory.create(t,n),s=e.borderStyle.width,r=this.svgFactory.createElement("svg:rect");r.setAttribute("x",s/2);r.setAttribute("y",s/2);r.setAttribute("width",t-s);r.setAttribute("height",n-s);r.setAttribute("stroke-width",s||1);r.setAttribute("stroke","transparent");r.setAttribute("fill","none");i.appendChild(r);this.container.append(i);this._createPopup(r,e);return this.container}}class CircleAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const e=this.data,t=e.rect[2]-e.rect[0],n=e.rect[3]-e.rect[1],i=this.svgFactory.create(t,n),s=e.borderStyle.width,r=this.svgFactory.createElement("svg:ellipse");r.setAttribute("cx",t/2);r.setAttribute("cy",n/2);r.setAttribute("rx",t/2-s/2);r.setAttribute("ry",n/2-s/2);r.setAttribute("stroke-width",s||1);r.setAttribute("stroke","transparent");r.setAttribute("fill","none");i.appendChild(r);this.container.append(i);this._createPopup(r,e);return this.container}}class PolylineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0});this.containerClassName="polylineAnnotation";this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const e=this.data,t=e.rect[2]-e.rect[0],n=e.rect[3]-e.rect[1],i=this.svgFactory.create(t,n);let s=[];for(const t of e.vertices){const n=t.x-e.rect[0],i=e.rect[3]-t.y;s.push(n+","+i)}s=s.join(" ");const r=this.svgFactory.createElement(this.svgElementName);r.setAttribute("points",s);r.setAttribute("stroke-width",e.borderStyle.width||1);r.setAttribute("stroke","transparent");r.setAttribute("fill","none");i.appendChild(r);this.container.append(i);this._createPopup(r,e);return this.container}}class PolygonAnnotationElement extends PolylineAnnotationElement{constructor(e){super(e);this.containerClassName="polygonAnnotation";this.svgElementName="svg:polygon"}}class CaretAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0})}render(){this.container.className="caretAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class InkAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0});this.containerClassName="inkAnnotation";this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const e=this.data,t=e.rect[2]-e.rect[0],n=e.rect[3]-e.rect[1],i=this.svgFactory.create(t,n);for(const t of e.inkLists){let n=[];for(const i of t){const t=i.x-e.rect[0],s=e.rect[3]-i.y;n.push(`${t},${s}`)}n=n.join(" ");const s=this.svgFactory.createElement(this.svgElementName);s.setAttribute("points",n);s.setAttribute("stroke-width",e.borderStyle.width||1);s.setAttribute("stroke","transparent");s.setAttribute("fill","none");this._createPopup(s,e);i.appendChild(s)}this.container.append(i);return this.container}}class HighlightAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("highlightAnnotation");this.container.className="highlightAnnotation";return this.container}}class UnderlineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("underlineAnnotation");this.container.className="underlineAnnotation";return this.container}}class SquigglyAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("squigglyAnnotation");this.container.className="squigglyAnnotation";return this.container}}class StrikeOutAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("strikeoutAnnotation");this.container.className="strikeoutAnnotation";return this.container}}class StampAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.title||e.data.contents),ignoreBorder:!0})}render(){this.container.className="stampAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class FileAttachmentAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0});const{filename:t,content:n}=this.data.file;this.filename=(0,i.getFilenameFromUrl)(t);this.content=n;this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,id:(0,s.stringToPDFString)(t),filename:t,content:n})}render(){this.container.className="fileAttachmentAnnotation";const e=document.createElement("div");e.style.height=this.container.style.height;e.style.width=this.container.style.width;e.addEventListener("dblclick",this._download.bind(this));this.data.hasPopup||!this.data.title&&!this.data.contents||this._createPopup(e,this.data);this.container.appendChild(e);return this.container}_download(){this.downloadManager?this.downloadManager.downloadData(this.content,this.filename,""):(0,s.warn)("Download cannot be started due to unavailable download manager")}}t.AnnotationLayer=class AnnotationLayer{static render(e){const t=[],n=[];for(const i of e.annotations)i&&(i.annotationType!==s.AnnotationType.POPUP?t.push(i):n.push(i));n.length&&t.push(...n);for(const n of t){const t=AnnotationElementFactory.create({data:n,layer:e.div,page:e.page,viewport:e.viewport,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderInteractiveForms:"boolean"!=typeof e.renderInteractiveForms||e.renderInteractiveForms,svgFactory:new i.DOMSVGFactory,annotationStorage:e.annotationStorage||new r.AnnotationStorage,enableScripting:e.enableScripting,hasJSActions:e.hasJSActions,mouseState:e.mouseState||{isDown:!1}});if(t.isRenderable){const i=t.render();n.hidden&&(i.style.visibility="hidden");if(Array.isArray(i))for(const t of i)e.div.appendChild(t);else t instanceof PopupAnnotationElement?e.div.prepend(i):e.div.appendChild(i)}}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;for(const n of e.annotations){const i=e.div.querySelectorAll(`[data-annotation-id="${n.id}"]`);i&&i.forEach((e=>{e.style.transform=t}))}e.div.removeAttribute("hidden")}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.ColorConverters=void 0;function makeColorComp(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}t.ColorConverters=class ColorConverters{static CMYK_G([e,t,n,i]){return["G",1-Math.min(1,.3*e+.59*n+.11*t+i)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_HTML([e]){const t=makeColorComp(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return["G",.3*e+.59*t+.11*n]}static RGB_HTML([e,t,n]){return`#${makeColorComp(e)}${makeColorComp(t)}${makeColorComp(n)}`}static T_HTML(){return"#00000000"}static CMYK_RGB([e,t,n,i]){return["RGB",1-Math.min(1,e+i),1-Math.min(1,n+i),1-Math.min(1,t+i)]}static CMYK_HTML(e){return this.RGB_HTML(this.CMYK_RGB(e))}static RGB_CMYK([e,t,n]){const i=1-e,s=1-t,r=1-n;return["CMYK",i,s,r,Math.min(i,s,r)]}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.renderTextLayer=void 0;var i=n(2);const s=function renderTextLayerClosure(){const e=/\S/;function appendText(t,n,s){const r=document.createElement("span"),a={angle:0,canvasWidth:0,isWhitespace:!1,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1};t._textDivs.push(r);if(function isAllWhitespace(t){return!e.test(t)}(n.str)){a.isWhitespace=!0;t._textDivProperties.set(r,a);return}const o=i.Util.transform(t._viewport.transform,n.transform);let l=Math.atan2(o[1],o[0]);const c=s[n.fontName];c.vertical&&(l+=Math.PI/2);const h=Math.sqrt(o[2]*o[2]+o[3]*o[3]);let d,u,p=h;c.ascent?p=c.ascent*p:c.descent&&(p=(1+c.descent)*p);if(0===l){d=o[4];u=o[5]-p}else{d=o[4]+p*Math.sin(l);u=o[5]-p*Math.cos(l)}r.style.left=`${d}px`;r.style.top=`${u}px`;r.style.fontSize=`${h}px`;r.style.fontFamily=c.fontFamily;r.textContent=n.str;t._fontInspectorEnabled&&(r.dataset.fontName=n.fontName);0!==l&&(a.angle=l*(180/Math.PI));let g=!1;if(n.str.length>1)g=!0;else if(n.transform[0]!==n.transform[3]){const e=Math.abs(n.transform[0]),t=Math.abs(n.transform[3]);e!==t&&Math.max(e,t)/Math.min(e,t)>1.5&&(g=!0)}g&&(c.vertical?a.canvasWidth=n.height*t._viewport.scale:a.canvasWidth=n.width*t._viewport.scale);t._textDivProperties.set(r,a);t._textContentStream&&t._layoutText(r);if(t._enhanceTextSelection){let e=1,s=0;if(0!==l){e=Math.cos(l);s=Math.sin(l)}const a=(c.vertical?n.height:n.width)*t._viewport.scale,o=h;let p,g;if(0!==l){p=[e,s,-s,e,d,u];g=i.Util.getAxialAlignedBoundingBox([0,0,a,o],p)}else g=[d,u,d+a,u+o];t._bounds.push({left:g[0],top:g[1],right:g[2],bottom:g[3],div:r,size:[a,o],m:p})}}function render(e){if(e._canceled)return;const t=e._textDivs,n=e._capability,i=t.length;if(i>1e5){e._renderingDone=!0;n.resolve()}else{if(!e._textContentStream)for(let n=0;n<i;n++)e._layoutText(t[n]);e._renderingDone=!0;n.resolve()}}function findPositiveMin(e,t,n){let i=0;for(let s=0;s<n;s++){const n=e[t++];n>0&&(i=i?Math.min(n,i):n)}return i}function expand(e){const t=e._bounds,n=e._viewport,s=function expandBounds(e,t,n){const i=n.map((function(e,t){return{x1:e.left,y1:e.top,x2:e.right,y2:e.bottom,index:t,x1New:void 0,x2New:void 0}}));expandBoundsLTR(e,i);const s=new Array(n.length);i.forEach((function(e){const t=e.index;s[t]={left:e.x1New,top:0,right:e.x2New,bottom:0}}));n.map((function(t,n){const r=s[n],a=i[n];a.x1=t.top;a.y1=e-r.right;a.x2=t.bottom;a.y2=e-r.left;a.index=n;a.x1New=void 0;a.x2New=void 0}));expandBoundsLTR(t,i);i.forEach((function(e){const t=e.index;s[t].top=e.x1New;s[t].bottom=e.x2New}));return s}(n.width,n.height,t);for(let n=0;n<s.length;n++){const r=t[n].div,a=e._textDivProperties.get(r);if(0===a.angle){a.paddingLeft=t[n].left-s[n].left;a.paddingTop=t[n].top-s[n].top;a.paddingRight=s[n].right-t[n].right;a.paddingBottom=s[n].bottom-t[n].bottom;e._textDivProperties.set(r,a);continue}const o=s[n],l=t[n],c=l.m,h=c[0],d=c[1],u=[[0,0],[0,l.size[1]],[l.size[0],0],l.size],p=new Float64Array(64);u.forEach((function(e,t){const n=i.Util.applyTransform(e,c);p[t+0]=h&&(o.left-n[0])/h;p[t+4]=d&&(o.top-n[1])/d;p[t+8]=h&&(o.right-n[0])/h;p[t+12]=d&&(o.bottom-n[1])/d;p[t+16]=d&&(o.left-n[0])/-d;p[t+20]=h&&(o.top-n[1])/h;p[t+24]=d&&(o.right-n[0])/-d;p[t+28]=h&&(o.bottom-n[1])/h;p[t+32]=h&&(o.left-n[0])/-h;p[t+36]=d&&(o.top-n[1])/-d;p[t+40]=h&&(o.right-n[0])/-h;p[t+44]=d&&(o.bottom-n[1])/-d;p[t+48]=d&&(o.left-n[0])/d;p[t+52]=h&&(o.top-n[1])/-h;p[t+56]=d&&(o.right-n[0])/d;p[t+60]=h&&(o.bottom-n[1])/-h}));const g=1+Math.min(Math.abs(h),Math.abs(d));a.paddingLeft=findPositiveMin(p,32,16)/g;a.paddingTop=findPositiveMin(p,48,16)/g;a.paddingRight=findPositiveMin(p,0,16)/g;a.paddingBottom=findPositiveMin(p,16,16)/g;e._textDivProperties.set(r,a)}}function expandBoundsLTR(e,t){t.sort((function(e,t){return e.x1-t.x1||e.index-t.index}));const n=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];t.forEach((function(e){let t=0;for(;t<n.length&&n[t].end<=e.y1;)t++;let i,s,r=n.length-1;for(;r>=0&&n[r].start>=e.y2;)r--;let a,o,l=-1/0;for(a=t;a<=r;a++){i=n[a];s=i.boundary;let t;t=s.x2>e.x1?s.index>e.index?s.x1New:e.x1:void 0===s.x2New?(s.x2+e.x1)/2:s.x2New;t>l&&(l=t)}e.x1New=l;for(a=t;a<=r;a++){i=n[a];s=i.boundary;void 0===s.x2New?s.x2>e.x1?s.index>e.index&&(s.x2New=s.x2):s.x2New=l:s.x2New>l&&(s.x2New=Math.max(l,s.x2))}const c=[];let h=null;for(a=t;a<=r;a++){i=n[a];s=i.boundary;const t=s.x2>e.x2?s:e;if(h===t)c[c.length-1].end=i.end;else{c.push({start:i.start,end:i.end,boundary:t});h=t}}if(n[t].start<e.y1){c[0].start=e.y1;c.unshift({start:n[t].start,end:e.y1,boundary:n[t].boundary})}if(e.y2<n[r].end){c[c.length-1].end=e.y2;c.push({start:e.y2,end:n[r].end,boundary:n[r].boundary})}for(a=t;a<=r;a++){i=n[a];s=i.boundary;if(void 0!==s.x2New)continue;let e=!1;for(o=t-1;!e&&o>=0&&n[o].start>=s.y1;o--)e=n[o].boundary===s;for(o=r+1;!e&&o<n.length&&n[o].end<=s.y2;o++)e=n[o].boundary===s;for(o=0;!e&&o<c.length;o++)e=c[o].boundary===s;e||(s.x2New=l)}Array.prototype.splice.apply(n,[t,r-t+1].concat(c))}));n.forEach((function(t){const n=t.boundary;void 0===n.x2New&&(n.x2New=Math.max(e,n.x2))}))}function TextLayerRenderTask({textContent:e,textContentStream:t,container:n,viewport:s,textDivs:r,textContentItemsStr:a,enhanceTextSelection:o}){this._textContent=e;this._textContentStream=t;this._container=n;this._document=n.ownerDocument;this._viewport=s;this._textDivs=r||[];this._textContentItemsStr=a||[];this._enhanceTextSelection=!!o;this._fontInspectorEnabled=!!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,i.createPromiseCapability)();this._renderTimer=null;this._bounds=[];this._capability.promise.finally((()=>{if(this._layoutTextCtx){this._layoutTextCtx.canvas.width=0;this._layoutTextCtx.canvas.height=0;this._layoutTextCtx=null}})).catch((()=>{}))}TextLayerRenderTask.prototype={get promise(){return this._capability.promise},cancel:function TextLayer_cancel(){this._canceled=!0;if(this._reader){this._reader.cancel(new i.AbortException("TextLayer task cancelled."));this._reader=null}if(null!==this._renderTimer){clearTimeout(this._renderTimer);this._renderTimer=null}this._capability.reject(new Error("TextLayer task cancelled."))},_processItems(e,t){for(let n=0,i=e.length;n<i;n++){this._textContentItemsStr.push(e[n].str);appendText(this,e[n],t)}},_layoutText(e){const t=this._textDivProperties.get(e);if(t.isWhitespace)return;let n="";if(0!==t.canvasWidth){const{fontSize:i,fontFamily:s}=e.style;if(i!==this._layoutTextLastFontSize||s!==this._layoutTextLastFontFamily){this._layoutTextCtx.font=`${i} ${s}`;this._layoutTextLastFontSize=i;this._layoutTextLastFontFamily=s}const{width:r}=this._layoutTextCtx.measureText(e.textContent);if(r>0){t.scale=t.canvasWidth/r;n=`scaleX(${t.scale})`}}0!==t.angle&&(n=`rotate(${t.angle}deg) ${n}`);if(n.length>0){this._enhanceTextSelection&&(t.originalTransform=n);e.style.transform=n}this._textDivProperties.set(e,t);this._container.appendChild(e)},_render:function TextLayer_render(e){const t=(0,i.createPromiseCapability)();let n=Object.create(null);const s=this._document.createElement("canvas");s.mozOpaque=!0;this._layoutTextCtx=s.getContext("2d",{alpha:!1});if(this._textContent){const e=this._textContent.items,n=this._textContent.styles;this._processItems(e,n);t.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');{const pump=()=>{this._reader.read().then((({value:e,done:i})=>{if(i)t.resolve();else{Object.assign(n,e.styles);this._processItems(e.items,n);pump()}}),t.reject)};this._reader=this._textContentStream.getReader();pump()}}t.promise.then((()=>{n=null;e?this._renderTimer=setTimeout((()=>{render(this);this._renderTimer=null}),e):render(this)}),this._capability.reject)},expandTextDivs:function TextLayer_expandTextDivs(e){if(!this._enhanceTextSelection||!this._renderingDone)return;if(null!==this._bounds){expand(this);this._bounds=null}const t=[],n=[];for(let i=0,s=this._textDivs.length;i<s;i++){const s=this._textDivs[i],r=this._textDivProperties.get(s);if(!r.isWhitespace)if(e){t.length=0;n.length=0;r.originalTransform&&t.push(r.originalTransform);if(r.paddingTop>0){n.push(`${r.paddingTop}px`);t.push(`translateY(${-r.paddingTop}px)`)}else n.push(0);r.paddingRight>0?n.push(r.paddingRight/r.scale+"px"):n.push(0);r.paddingBottom>0?n.push(`${r.paddingBottom}px`):n.push(0);if(r.paddingLeft>0){n.push(r.paddingLeft/r.scale+"px");t.push(`translateX(${-r.paddingLeft/r.scale}px)`)}else n.push(0);s.style.padding=n.join(" ");t.length&&(s.style.transform=t.join(" "))}else{s.style.padding=null;s.style.transform=r.originalTransform}}}};return function renderTextLayer(e){const t=new TextLayerRenderTask({textContent:e.textContent,textContentStream:e.textContentStream,container:e.container,viewport:e.viewport,textDivs:e.textDivs,textContentItemsStr:e.textContentItemsStr,enhanceTextSelection:e.enhanceTextSelection});t._render(e.timeout);return t}}();t.renderTextLayer=s},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SVGGraphics=void 0;var i=n(2),s=n(1);let SVGGraphics=function(){throw new Error("Not implemented: SVGGraphics")};t.SVGGraphics=SVGGraphics;{const e={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},n="http://www.w3.org/XML/1998/namespace",r="http://www.w3.org/1999/xlink",a=["butt","round","square"],o=["miter","round","bevel"],l=function(){const e=new Uint8Array([137,80,78,71,13,10,26,10]),t=new Int32Array(256);for(let e=0;e<256;e++){let n=e;for(let e=0;e<8;e++)n=1&n?3988292384^n>>1&2147483647:n>>1&2147483647;t[e]=n}function writePngChunk(e,n,i,s){let r=s;const a=n.length;i[r]=a>>24&255;i[r+1]=a>>16&255;i[r+2]=a>>8&255;i[r+3]=255&a;r+=4;i[r]=255&e.charCodeAt(0);i[r+1]=255&e.charCodeAt(1);i[r+2]=255&e.charCodeAt(2);i[r+3]=255&e.charCodeAt(3);r+=4;i.set(n,r);r+=n.length;const o=function crc32(e,n,i){let s=-1;for(let r=n;r<i;r++){const n=255&(s^e[r]);s=s>>>8^t[n]}return-1^s}(i,s+4,r);i[r]=o>>24&255;i[r+1]=o>>16&255;i[r+2]=o>>8&255;i[r+3]=255&o}function deflateSync(e){return function deflateSyncUncompressed(e){let t=e.length;const n=65535,i=Math.ceil(t/n),s=new Uint8Array(2+t+5*i+4);let r=0;s[r++]=120;s[r++]=156;let a=0;for(;t>n;){s[r++]=0;s[r++]=255;s[r++]=255;s[r++]=0;s[r++]=0;s.set(e.subarray(a,a+n),r);r+=n;a+=n;t-=n}s[r++]=1;s[r++]=255&t;s[r++]=t>>8&255;s[r++]=255&~t;s[r++]=(65535&~t)>>8&255;s.set(e.subarray(a),r);r+=e.length-a;const o=function adler32(e,t,n){let i=1,s=0;for(let r=t;r<n;++r){i=(i+(255&e[r]))%65521;s=(s+i)%65521}return s<<16|i}(e,0,e.length);s[r++]=o>>24&255;s[r++]=o>>16&255;s[r++]=o>>8&255;s[r++]=255&o;return s}(e)}return function convertImgDataToPng(t,n,s){return function encode(t,n,s,r){const a=t.width,o=t.height;let l,c,h;const d=t.data;switch(n){case i.ImageKind.GRAYSCALE_1BPP:c=0;l=1;h=a+7>>3;break;case i.ImageKind.RGB_24BPP:c=2;l=8;h=3*a;break;case i.ImageKind.RGBA_32BPP:c=6;l=8;h=4*a;break;default:throw new Error("invalid format")}const u=new Uint8Array((1+h)*o);let p=0,g=0;for(let e=0;e<o;++e){u[p++]=0;u.set(d.subarray(g,g+h),p);g+=h;p+=h}if(n===i.ImageKind.GRAYSCALE_1BPP&&r){p=0;for(let e=0;e<o;e++){p++;for(let e=0;e<h;e++)u[p++]^=255}}const f=new Uint8Array([a>>24&255,a>>16&255,a>>8&255,255&a,o>>24&255,o>>16&255,o>>8&255,255&o,l,c,0,0,0]),m=deflateSync(u),b=e.length+36+f.length+m.length,_=new Uint8Array(b);let v=0;_.set(e,v);v+=e.length;writePngChunk("IHDR",f,_,v);v+=12+f.length;writePngChunk("IDATA",m,_,v);v+=12+m.length;writePngChunk("IEND",new Uint8Array(0),_,v);return(0,i.createObjectURL)(_,"image/png",s)}(t,void 0===t.kind?i.ImageKind.GRAYSCALE_1BPP:t.kind,n,s)}}();class SVGExtraState{constructor(){this.fontSizeScale=1;this.fontWeight=e.fontWeight;this.fontSize=0;this.textMatrix=i.IDENTITY_MATRIX;this.fontMatrix=i.FONT_IDENTITY_MATRIX;this.leading=0;this.textRenderingMode=i.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=e.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(e,t){this.x=e;this.y=t}}function pf(e){if(Number.isInteger(e))return e.toString();const t=e.toFixed(10);let n=t.length-1;if("0"!==t[n])return t;do{n--}while("0"===t[n]);return t.substring(0,"."===t[n]?n:n+1)}function pm(e){if(0===e[4]&&0===e[5]){if(0===e[1]&&0===e[2])return 1===e[0]&&1===e[3]?"":`scale(${pf(e[0])} ${pf(e[3])})`;if(e[0]===e[3]&&e[1]===-e[2]){return`rotate(${pf(180*Math.acos(e[0])/Math.PI)})`}}else if(1===e[0]&&0===e[1]&&0===e[2]&&1===e[3])return`translate(${pf(e[4])} ${pf(e[5])})`;return`matrix(${pf(e[0])} ${pf(e[1])} ${pf(e[2])} ${pf(e[3])} ${pf(e[4])} ${pf(e[5])})`}let c=0,h=0,d=0;t.SVGGraphics=SVGGraphics=class SVGGraphics{constructor(e,t,n=!1){this.svgFactory=new s.DOMSVGFactory;this.current=new SVGExtraState;this.transformMatrix=i.IDENTITY_MATRIX;this.transformStack=[];this.extraStack=[];this.commonObjs=e;this.objs=t;this.pendingClip=null;this.pendingEOFill=!1;this.embedFonts=!1;this.embeddedFonts=Object.create(null);this.cssStyle=null;this.forceDataSchema=!!n;this._operatorIdMapping=[];for(const e in i.OPS)this._operatorIdMapping[i.OPS[e]]=e}save(){this.transformStack.push(this.transformMatrix);const e=this.current;this.extraStack.push(e);this.current=e.clone()}restore(){this.transformMatrix=this.transformStack.pop();this.current=this.extraStack.pop();this.pendingClip=null;this.tgrp=null}group(e){this.save();this.executeOpTree(e);this.restore()}loadDependencies(e){const t=e.fnArray,n=e.argsArray;for(let e=0,s=t.length;e<s;e++)if(t[e]===i.OPS.dependency)for(const t of n[e]){const e=t.startsWith("g_")?this.commonObjs:this.objs,n=new Promise((n=>{e.get(t,n)}));this.current.dependencies.push(n)}return Promise.all(this.current.dependencies)}transform(e,t,n,s,r,a){const o=[e,t,n,s,r,a];this.transformMatrix=i.Util.transform(this.transformMatrix,o);this.tgrp=null}getSVG(e,t){this.viewport=t;const n=this._initialize(t);return this.loadDependencies(e).then((()=>{this.transformMatrix=i.IDENTITY_MATRIX;this.executeOpTree(this.convertOpList(e));return n}))}convertOpList(e){const t=this._operatorIdMapping,n=e.argsArray,i=e.fnArray,s=[];for(let e=0,r=i.length;e<r;e++){const r=i[e];s.push({fnId:r,fn:t[r],args:n[e]})}return function opListToTree(e){let t=[];const n=[];for(const i of e)if("save"!==i.fn)"restore"===i.fn?t=n.pop():t.push(i);else{t.push({fnId:92,fn:"group",items:[]});n.push(t);t=t[t.length-1].items}return t}(s)}executeOpTree(e){for(const t of e){const e=t.fn,n=t.fnId,s=t.args;switch(0|n){case i.OPS.beginText:this.beginText();break;case i.OPS.dependency:break;case i.OPS.setLeading:this.setLeading(s);break;case i.OPS.setLeadingMoveText:this.setLeadingMoveText(s[0],s[1]);break;case i.OPS.setFont:this.setFont(s);break;case i.OPS.showText:case i.OPS.showSpacedText:this.showText(s[0]);break;case i.OPS.endText:this.endText();break;case i.OPS.moveText:this.moveText(s[0],s[1]);break;case i.OPS.setCharSpacing:this.setCharSpacing(s[0]);break;case i.OPS.setWordSpacing:this.setWordSpacing(s[0]);break;case i.OPS.setHScale:this.setHScale(s[0]);break;case i.OPS.setTextMatrix:this.setTextMatrix(s[0],s[1],s[2],s[3],s[4],s[5]);break;case i.OPS.setTextRise:this.setTextRise(s[0]);break;case i.OPS.setTextRenderingMode:this.setTextRenderingMode(s[0]);break;case i.OPS.setLineWidth:this.setLineWidth(s[0]);break;case i.OPS.setLineJoin:this.setLineJoin(s[0]);break;case i.OPS.setLineCap:this.setLineCap(s[0]);break;case i.OPS.setMiterLimit:this.setMiterLimit(s[0]);break;case i.OPS.setFillRGBColor:this.setFillRGBColor(s[0],s[1],s[2]);break;case i.OPS.setStrokeRGBColor:this.setStrokeRGBColor(s[0],s[1],s[2]);break;case i.OPS.setStrokeColorN:this.setStrokeColorN(s);break;case i.OPS.setFillColorN:this.setFillColorN(s);break;case i.OPS.shadingFill:this.shadingFill(s[0]);break;case i.OPS.setDash:this.setDash(s[0],s[1]);break;case i.OPS.setRenderingIntent:this.setRenderingIntent(s[0]);break;case i.OPS.setFlatness:this.setFlatness(s[0]);break;case i.OPS.setGState:this.setGState(s[0]);break;case i.OPS.fill:this.fill();break;case i.OPS.eoFill:this.eoFill();break;case i.OPS.stroke:this.stroke();break;case i.OPS.fillStroke:this.fillStroke();break;case i.OPS.eoFillStroke:this.eoFillStroke();break;case i.OPS.clip:this.clip("nonzero");break;case i.OPS.eoClip:this.clip("evenodd");break;case i.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case i.OPS.paintImageXObject:this.paintImageXObject(s[0]);break;case i.OPS.paintInlineImageXObject:this.paintInlineImageXObject(s[0]);break;case i.OPS.paintImageMaskXObject:this.paintImageMaskXObject(s[0]);break;case i.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(s[0],s[1]);break;case i.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case i.OPS.closePath:this.closePath();break;case i.OPS.closeStroke:this.closeStroke();break;case i.OPS.closeFillStroke:this.closeFillStroke();break;case i.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case i.OPS.nextLine:this.nextLine();break;case i.OPS.transform:this.transform(s[0],s[1],s[2],s[3],s[4],s[5]);break;case i.OPS.constructPath:this.constructPath(s[0],s[1]);break;case i.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,i.warn)(`Unimplemented operator ${e}`)}}}setWordSpacing(e){this.current.wordSpacing=e}setCharSpacing(e){this.current.charSpacing=e}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(e,t,n,i,s,r){const a=this.current;a.textMatrix=a.lineMatrix=[e,t,n,i,s,r];a.textMatrixScale=Math.sqrt(e*e+t*t);a.x=a.lineX=0;a.y=a.lineY=0;a.xcoords=[];a.ycoords=[];a.tspan=this.svgFactory.createElement("svg:tspan");a.tspan.setAttributeNS(null,"font-family",a.fontFamily);a.tspan.setAttributeNS(null,"font-size",`${pf(a.fontSize)}px`);a.tspan.setAttributeNS(null,"y",pf(-a.y));a.txtElement=this.svgFactory.createElement("svg:text");a.txtElement.appendChild(a.tspan)}beginText(){const e=this.current;e.x=e.lineX=0;e.y=e.lineY=0;e.textMatrix=i.IDENTITY_MATRIX;e.lineMatrix=i.IDENTITY_MATRIX;e.textMatrixScale=1;e.tspan=this.svgFactory.createElement("svg:tspan");e.txtElement=this.svgFactory.createElement("svg:text");e.txtgrp=this.svgFactory.createElement("svg:g");e.xcoords=[];e.ycoords=[]}moveText(e,t){const n=this.current;n.x=n.lineX+=e;n.y=n.lineY+=t;n.xcoords=[];n.ycoords=[];n.tspan=this.svgFactory.createElement("svg:tspan");n.tspan.setAttributeNS(null,"font-family",n.fontFamily);n.tspan.setAttributeNS(null,"font-size",`${pf(n.fontSize)}px`);n.tspan.setAttributeNS(null,"y",pf(-n.y))}showText(t){const s=this.current,r=s.font,a=s.fontSize;if(0===a)return;const o=s.fontSizeScale,l=s.charSpacing,c=s.wordSpacing,h=s.fontDirection,d=s.textHScale*h,u=r.vertical,p=u?1:-1,g=r.defaultVMetrics,f=a*s.fontMatrix[0];let m=0;for(const e of t){if(null===e){m+=h*c;continue}if((0,i.isNum)(e)){m+=p*e*a/1e3;continue}const t=(e.isSpace?c:0)+l,n=e.fontChar;let d,b,_,v=e.width;if(u){let t;const n=e.vmetric||g;t=e.vmetric?n[1]:.5*v;t=-t*f;const i=n[2]*f;v=n?-n[0]:v;d=t/o;b=(m+i)/o}else{d=m/o;b=0}if(e.isInFont||r.missingFile){s.xcoords.push(s.x+d);u&&s.ycoords.push(-s.y+b);s.tspan.textContent+=n}_=u?v*f-t*h:v*f+t*h;m+=_}s.tspan.setAttributeNS(null,"x",s.xcoords.map(pf).join(" "));u?s.tspan.setAttributeNS(null,"y",s.ycoords.map(pf).join(" ")):s.tspan.setAttributeNS(null,"y",pf(-s.y));u?s.y-=m:s.x+=m*d;s.tspan.setAttributeNS(null,"font-family",s.fontFamily);s.tspan.setAttributeNS(null,"font-size",`${pf(s.fontSize)}px`);s.fontStyle!==e.fontStyle&&s.tspan.setAttributeNS(null,"font-style",s.fontStyle);s.fontWeight!==e.fontWeight&&s.tspan.setAttributeNS(null,"font-weight",s.fontWeight);const b=s.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;if(b===i.TextRenderingMode.FILL||b===i.TextRenderingMode.FILL_STROKE){s.fillColor!==e.fillColor&&s.tspan.setAttributeNS(null,"fill",s.fillColor);s.fillAlpha<1&&s.tspan.setAttributeNS(null,"fill-opacity",s.fillAlpha)}else s.textRenderingMode===i.TextRenderingMode.ADD_TO_PATH?s.tspan.setAttributeNS(null,"fill","transparent"):s.tspan.setAttributeNS(null,"fill","none");if(b===i.TextRenderingMode.STROKE||b===i.TextRenderingMode.FILL_STROKE){const e=1/(s.textMatrixScale||1);this._setStrokeAttributes(s.tspan,e)}let _=s.textMatrix;if(0!==s.textRise){_=_.slice();_[5]+=s.textRise}s.txtElement.setAttributeNS(null,"transform",`${pm(_)} scale(${pf(d)}, -1)`);s.txtElement.setAttributeNS(n,"xml:space","preserve");s.txtElement.appendChild(s.tspan);s.txtgrp.appendChild(s.txtElement);this._ensureTransformGroup().appendChild(s.txtElement)}setLeadingMoveText(e,t){this.setLeading(-t);this.moveText(e,t)}addFontStyle(e){if(!e.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');if(!this.cssStyle){this.cssStyle=this.svgFactory.createElement("svg:style");this.cssStyle.setAttributeNS(null,"type","text/css");this.defs.appendChild(this.cssStyle)}const t=(0,i.createObjectURL)(e.data,e.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${e.loadedName}"; src: url(${t}); }\n`}setFont(e){const t=this.current,n=this.commonObjs.get(e[0]);let s=e[1];t.font=n;if(this.embedFonts&&!n.missingFile&&!this.embeddedFonts[n.loadedName]){this.addFontStyle(n);this.embeddedFonts[n.loadedName]=n}t.fontMatrix=n.fontMatrix?n.fontMatrix:i.FONT_IDENTITY_MATRIX;let r="normal";n.black?r="900":n.bold&&(r="bold");const a=n.italic?"italic":"normal";if(s<0){s=-s;t.fontDirection=-1}else t.fontDirection=1;t.fontSize=s;t.fontFamily=n.loadedName;t.fontWeight=r;t.fontStyle=a;t.tspan=this.svgFactory.createElement("svg:tspan");t.tspan.setAttributeNS(null,"y",pf(-t.y));t.xcoords=[];t.ycoords=[]}endText(){const e=this.current;if(e.textRenderingMode&i.TextRenderingMode.ADD_TO_PATH_FLAG&&e.txtElement?.hasChildNodes()){e.element=e.txtElement;this.clip("nonzero");this.endPath()}}setLineWidth(e){e>0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=a[e]}setLineJoin(e){this.current.lineJoin=o[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,n){this.current.strokeColor=i.Util.makeHexColor(e,t,n)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,n){this.current.fillColor=i.Util.makeHexColor(e,t,n);this.current.tspan=this.svgFactory.createElement("svg:tspan");this.current.xcoords=[];this.current.ycoords=[]}setStrokeColorN(e){this.current.strokeColor=this._makeColorN_Pattern(e)}setFillColorN(e){this.current.fillColor=this._makeColorN_Pattern(e)}shadingFill(e){const t=this.viewport.width,n=this.viewport.height,s=i.Util.inverseTransform(this.transformMatrix),r=i.Util.applyTransform([0,0],s),a=i.Util.applyTransform([0,n],s),o=i.Util.applyTransform([t,0],s),l=i.Util.applyTransform([t,n],s),c=Math.min(r[0],a[0],o[0],l[0]),h=Math.min(r[1],a[1],o[1],l[1]),d=Math.max(r[0],a[0],o[0],l[0]),u=Math.max(r[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(e));this.current.fillAlpha<1&&p.setAttributeNS(null,"fill-opacity",this.current.fillAlpha);this._ensureTransformGroup().appendChild(p)}_makeColorN_Pattern(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){const t=e[1],n=e[2],s=e[3]||i.IDENTITY_MATRIX,[r,a,o,l]=e[4],c=e[5],h=e[6],u=e[7],p="shading"+d++,[g,f]=i.Util.applyTransform([r,a],s),[m,b]=i.Util.applyTransform([o,l],s),[_,v]=i.Util.singularValueDecompose2dScale(s),w=c*_,y=h*v,S=this.svgFactory.createElement("svg:pattern");S.setAttributeNS(null,"id",p);S.setAttributeNS(null,"patternUnits","userSpaceOnUse");S.setAttributeNS(null,"width",w);S.setAttributeNS(null,"height",y);S.setAttributeNS(null,"x",`${g}`);S.setAttributeNS(null,"y",`${f}`);const A=this.svg,P=this.transformMatrix,C=this.current.fillColor,E=this.current.strokeColor,T=this.svgFactory.create(m-g,b-f);this.svg=T;this.transformMatrix=s;if(2===u){const e=i.Util.makeHexColor(...t);this.current.fillColor=e;this.current.strokeColor=e}this.executeOpTree(this.convertOpList(n));this.svg=A;this.transformMatrix=P;this.current.fillColor=C;this.current.strokeColor=E;S.appendChild(T.childNodes[0]);this.defs.appendChild(S);return`url(#${p})`}_makeShadingPattern(e){switch(e[0]){case"RadialAxial":const t="shading"+d++,n=e[3];let s;switch(e[1]){case"axial":const n=e[4],i=e[5];s=this.svgFactory.createElement("svg:linearGradient");s.setAttributeNS(null,"id",t);s.setAttributeNS(null,"gradientUnits","userSpaceOnUse");s.setAttributeNS(null,"x1",n[0]);s.setAttributeNS(null,"y1",n[1]);s.setAttributeNS(null,"x2",i[0]);s.setAttributeNS(null,"y2",i[1]);break;case"radial":const r=e[4],a=e[5],o=e[6],l=e[7];s=this.svgFactory.createElement("svg:radialGradient");s.setAttributeNS(null,"id",t);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",r[0]);s.setAttributeNS(null,"fy",r[1]);s.setAttributeNS(null,"fr",o);break;default:throw new Error(`Unknown RadialAxial type: ${e[1]}`)}for(const e of n){const t=this.svgFactory.createElement("svg:stop");t.setAttributeNS(null,"offset",e[0]);t.setAttributeNS(null,"stop-color",e[1]);s.appendChild(t)}this.defs.appendChild(s);return`url(#${t})`;case"Mesh":(0,i.warn)("Unimplemented pattern Mesh");return null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${e[0]}`)}}setDash(e,t){this.current.dashArray=e;this.current.dashPhase=t}constructPath(e,t){const n=this.current;let s=n.x,r=n.y,a=[],o=0;for(const n of e)switch(0|n){case i.OPS.rectangle:s=t[o++];r=t[o++];const e=s+t[o++],n=r+t[o++];a.push("M",pf(s),pf(r),"L",pf(e),pf(r),"L",pf(e),pf(n),"L",pf(s),pf(n),"Z");break;case i.OPS.moveTo:s=t[o++];r=t[o++];a.push("M",pf(s),pf(r));break;case i.OPS.lineTo:s=t[o++];r=t[o++];a.push("L",pf(s),pf(r));break;case i.OPS.curveTo:s=t[o+4];r=t[o+5];a.push("C",pf(t[o]),pf(t[o+1]),pf(t[o+2]),pf(t[o+3]),pf(s),pf(r));o+=6;break;case i.OPS.curveTo2:a.push("C",pf(s),pf(r),pf(t[o]),pf(t[o+1]),pf(t[o+2]),pf(t[o+3]));s=t[o+2];r=t[o+3];o+=4;break;case i.OPS.curveTo3:s=t[o+2];r=t[o+3];a.push("C",pf(t[o]),pf(t[o+1]),pf(s),pf(r),pf(s),pf(r));o+=4;break;case i.OPS.closePath:a.push("Z")}a=a.join(" ");if(n.path&&e.length>0&&e[0]!==i.OPS.rectangle&&e[0]!==i.OPS.moveTo)a=n.path.getAttributeNS(null,"d")+a;else{n.path=this.svgFactory.createElement("svg:path");this._ensureTransformGroup().appendChild(n.path)}n.path.setAttributeNS(null,"d",a);n.path.setAttributeNS(null,"fill","none");n.element=n.path;n.setCurrentPoint(s,r)}endPath(){const e=this.current;e.path=null;if(!this.pendingClip)return;if(!e.element){this.pendingClip=null;return}const t="clippath"+c++,n=this.svgFactory.createElement("svg:clipPath");n.setAttributeNS(null,"id",t);n.setAttributeNS(null,"transform",pm(this.transformMatrix));const i=e.element.cloneNode(!0);"evenodd"===this.pendingClip?i.setAttributeNS(null,"clip-rule","evenodd"):i.setAttributeNS(null,"clip-rule","nonzero");this.pendingClip=null;n.appendChild(i);this.defs.appendChild(n);if(e.activeClipUrl){e.clipGroup=null;this.extraStack.forEach((function(e){e.clipGroup=null}));n.setAttributeNS(null,"clip-path",e.activeClipUrl)}e.activeClipUrl=`url(#${t})`;this.tgrp=null}clip(e){this.pendingClip=e}closePath(){const e=this.current;if(e.path){const t=`${e.path.getAttributeNS(null,"d")}Z`;e.path.setAttributeNS(null,"d",t)}}setLeading(e){this.current.leading=-e}setTextRise(e){this.current.textRise=e}setTextRenderingMode(e){this.current.textRenderingMode=e}setHScale(e){this.current.textHScale=e/100}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,n]of e)switch(t){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n);break;case"CA":this.setStrokeAlpha(n);break;case"ca":this.setFillAlpha(n);break;default:(0,i.warn)(`Unimplemented graphic state operator ${t}`)}}fill(){const e=this.current;if(e.element){e.element.setAttributeNS(null,"fill",e.fillColor);e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha);this.endPath()}}stroke(){const e=this.current;if(e.element){this._setStrokeAttributes(e.element);e.element.setAttributeNS(null,"fill","none");this.endPath()}}_setStrokeAttributes(e,t=1){const n=this.current;let i=n.dashArray;1!==t&&i.length>0&&(i=i.map((function(e){return t*e})));e.setAttributeNS(null,"stroke",n.strokeColor);e.setAttributeNS(null,"stroke-opacity",n.strokeAlpha);e.setAttributeNS(null,"stroke-miterlimit",pf(n.miterLimit));e.setAttributeNS(null,"stroke-linecap",n.lineCap);e.setAttributeNS(null,"stroke-linejoin",n.lineJoin);e.setAttributeNS(null,"stroke-width",pf(t*n.lineWidth)+"px");e.setAttributeNS(null,"stroke-dasharray",i.map(pf).join(" "));e.setAttributeNS(null,"stroke-dashoffset",pf(t*n.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 e=this.svgFactory.createElement("svg:rect");e.setAttributeNS(null,"x","0");e.setAttributeNS(null,"y","0");e.setAttributeNS(null,"width","1px");e.setAttributeNS(null,"height","1px");e.setAttributeNS(null,"fill",this.current.fillColor);this._ensureTransformGroup().appendChild(e)}paintImageXObject(e){const t=e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e);t?this.paintInlineImageXObject(t):(0,i.warn)(`Dependent image with object ID ${e} is not ready yet`)}paintInlineImageXObject(e,t){const n=e.width,i=e.height,s=l(e,this.forceDataSchema,!!t),a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x","0");a.setAttributeNS(null,"y","0");a.setAttributeNS(null,"width",pf(n));a.setAttributeNS(null,"height",pf(i));this.current.element=a;this.clip("nonzero");const o=this.svgFactory.createElement("svg:image");o.setAttributeNS(r,"xlink:href",s);o.setAttributeNS(null,"x","0");o.setAttributeNS(null,"y",pf(-i));o.setAttributeNS(null,"width",pf(n)+"px");o.setAttributeNS(null,"height",pf(i)+"px");o.setAttributeNS(null,"transform",`scale(${pf(1/n)} ${pf(-1/i)})`);t?t.appendChild(o):this._ensureTransformGroup().appendChild(o)}paintImageMaskXObject(e){const t=this.current,n=e.width,i=e.height,s=t.fillColor;t.maskId="mask"+h++;const r=this.svgFactory.createElement("svg:mask");r.setAttributeNS(null,"id",t.maskId);const a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x","0");a.setAttributeNS(null,"y","0");a.setAttributeNS(null,"width",pf(n));a.setAttributeNS(null,"height",pf(i));a.setAttributeNS(null,"fill",s);a.setAttributeNS(null,"mask",`url(#${t.maskId})`);this.defs.appendChild(r);this._ensureTransformGroup().appendChild(a);this.paintInlineImageXObject(e,r)}paintFormXObjectBegin(e,t){Array.isArray(e)&&6===e.length&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]);if(t){const e=t[2]-t[0],n=t[3]-t[1],i=this.svgFactory.createElement("svg:rect");i.setAttributeNS(null,"x",t[0]);i.setAttributeNS(null,"y",t[1]);i.setAttributeNS(null,"width",pf(e));i.setAttributeNS(null,"height",pf(n));this.current.element=i;this.clip("nonzero");this.endPath()}}paintFormXObjectEnd(){}_initialize(e){const t=this.svgFactory.create(e.width,e.height),n=this.svgFactory.createElement("svg:defs");t.appendChild(n);this.defs=n;const i=this.svgFactory.createElement("svg:g");i.setAttributeNS(null,"transform",pm(e.transform));t.appendChild(i);this.svg=i;return t}_ensureClipGroup(){if(!this.current.clipGroup){const e=this.svgFactory.createElement("svg:g");e.setAttributeNS(null,"clip-path",this.current.activeClipUrl);this.svg.appendChild(e);this.current.clipGroup=e}return this.current.clipGroup}_ensureTransformGroup(){if(!this.tgrp){this.tgrp=this.svgFactory.createElement("svg:g");this.tgrp.setAttributeNS(null,"transform",pm(this.transformMatrix));this.current.activeClipUrl?this._ensureClipGroup().appendChild(this.tgrp):this.svg.appendChild(this.tgrp)}return this.tgrp}}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFNetworkStream=void 0;var i=n(2),s=n(24);class NetworkManager{constructor(e,t){this.url=e;t=t||{};this.isHttp=/^https?:/i.test(e);this.httpHeaders=this.isHttp&&t.httpHeaders||{};this.withCredentials=t.withCredentials||!1;this.getXhr=t.getXhr||function NetworkManager_getXhr(){return new XMLHttpRequest};this.currXhrId=0;this.pendingRequests=Object.create(null)}requestRange(e,t,n){const i={begin:e,end:t};for(const e in n)i[e]=n[e];return this.request(i)}requestFull(e){return this.request(e)}request(e){const t=this.getXhr(),n=this.currXhrId++,i=this.pendingRequests[n]={xhr:t};t.open("GET",this.url);t.withCredentials=this.withCredentials;for(const e in this.httpHeaders){const n=this.httpHeaders[e];void 0!==n&&t.setRequestHeader(e,n)}if(this.isHttp&&"begin"in e&&"end"in e){t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`);i.expectedStatus=206}else i.expectedStatus=200;t.responseType="arraybuffer";e.onError&&(t.onerror=function(n){e.onError(t.status)});t.onreadystatechange=this.onStateChange.bind(this,n);t.onprogress=this.onProgress.bind(this,n);i.onHeadersReceived=e.onHeadersReceived;i.onDone=e.onDone;i.onError=e.onError;i.onProgress=e.onProgress;t.send(null);return n}onProgress(e,t){const n=this.pendingRequests[e];n&&n.onProgress&&n.onProgress(t)}onStateChange(e,t){const n=this.pendingRequests[e];if(!n)return;const s=n.xhr;if(s.readyState>=2&&n.onHeadersReceived){n.onHeadersReceived();delete n.onHeadersReceived}if(4!==s.readyState)return;if(!(e in this.pendingRequests))return;delete this.pendingRequests[e];if(0===s.status&&this.isHttp){n.onError&&n.onError(s.status);return}const r=s.status||200;if(!(200===r&&206===n.expectedStatus)&&r!==n.expectedStatus){n.onError&&n.onError(s.status);return}const a=function getArrayBuffer(e){const t=e.response;return"string"!=typeof t?t:(0,i.stringToBytes)(t).buffer}(s);if(206===r){const e=s.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);n.onDone({begin:parseInt(t[1],10),chunk:a})}else a?n.onDone({begin:0,chunk:a}):n.onError&&n.onError(s.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e];t.abort()}}t.PDFNetworkStream=class PDFNetworkStream{constructor(e){this._source=e;this._manager=new NetworkManager(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials});this._rangeChunkSize=e.rangeChunkSize;this._fullRequestReader=null;this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){(0,i.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once.");this._fullRequestReader=new PDFNetworkStreamFullRequestReader(this._manager,this._source);return this._fullRequestReader}getRangeReader(e,t){const n=new PDFNetworkStreamRangeRequestReader(this._manager,e,t);n.onClosed=this._onRangeRequestReaderClosed.bind(this);this._rangeRequestReaders.push(n);return n}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);this._rangeRequestReaders.slice(0).forEach((function(t){t.cancel(e)}))}};class PDFNetworkStreamFullRequestReader{constructor(e,t){this._manager=e;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url;this._fullRequestId=e.requestFull(n);this._headersReceivedCapability=(0,i.createPromiseCapability)();this._disableRange=t.disableRange||!1;this._contentLength=t.length;this._rangeChunkSize=t.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 e=this._fullRequestId,t=this._manager.getRequestXhr(e),getResponseHeader=e=>t.getResponseHeader(e),{allowRangeRequests:n,suggestedLength:i}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:getResponseHeader,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0);this._contentLength=i||this._contentLength;this._filename=(0,s.extractFilenameFromHeader)(getResponseHeader);this._isRangeSupported&&this._manager.abortRequest(e);this._headersReceivedCapability.resolve()}_onDone(e){if(e)if(this._requests.length>0){this._requests.shift().resolve({value:e.chunk,done:!1})}else this._cachedChunks.push(e.chunk);this._done=!0;if(!(this._cachedChunks.length>0)){this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})}));this._requests=[]}}_onError(e){const t=this._url,n=(0,s.createResponseStatusError)(e,t);this._storedError=n;this._headersReceivedCapability.reject(n);this._requests.forEach((function(e){e.reject(n)}));this._requests=[];this._cachedChunks=[]}_onProgress(e){this.onProgress&&this.onProgress({loaded:e.loaded,total:e.lengthComputable?e.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 e=(0,i.createPromiseCapability)();this._requests.push(e);return e.promise}cancel(e){this._done=!0;this._headersReceivedCapability.reject(e);this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})}));this._requests=[];this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId);this._fullRequestReader=null}}class PDFNetworkStreamRangeRequestReader{constructor(e,t,n){this._manager=e;const i={onDone:this._onDone.bind(this),onProgress:this._onProgress.bind(this)};this._requestId=e.requestRange(t,n,i);this._requests=[];this._queuedChunk=null;this._done=!1;this.onProgress=null;this.onClosed=null}_close(){this.onClosed&&this.onClosed(this)}_onDone(e){const t=e.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunk=t;this._done=!0;this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})}));this._requests=[];this._close()}_onProgress(e){!this.isStreamingSupported&&this.onProgress&&this.onProgress({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(null!==this._queuedChunk){const e=this._queuedChunk;this._queuedChunk=null;return{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,i.createPromiseCapability)();this._requests.push(e);return e.promise}cancel(e){this._done=!0;this._requests.forEach((function(e){e.resolve({value:void 0,done:!0})}));this._requests=[];this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId);this._close()}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.createResponseStatusError=function createResponseStatusError(e,t){if(404===e||0===e&&t.startsWith("file:"))return new i.MissingPDFException('Missing PDF "'+t+'".');return new i.UnexpectedResponseException("Unexpected server response ("+e+') while retrieving PDF "'+t+'".',e)};t.extractFilenameFromHeader=function extractFilenameFromHeader(e){const t=e("Content-Disposition");if(t){let e=(0,s.getFilenameFromContentDispositionHeader)(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch(e){}if(/\.pdf$/i.test(e))return e}return null};t.validateRangeRequestCapabilities=function validateRangeRequestCapabilities({getResponseHeader:e,isHttp:t,rangeChunkSize:n,disableRange:s}){(0,i.assert)(n>0,"Range chunk size must be larger than zero");const r={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e("Content-Length"),10);if(!Number.isInteger(a))return r;r.suggestedLength=a;if(a<=2*n)return r;if(s||!t)return r;if("bytes"!==e("Accept-Ranges"))return r;if("identity"!==(e("Content-Encoding")||"identity"))return r;r.allowRangeRequests=!0;return r};t.validateResponseStatus=function validateResponseStatus(e){return 200===e||206===e};var i=n(2),s=n(25)},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.getFilenameFromContentDispositionHeader=function getFilenameFromContentDispositionHeader(e){let t=!0,n=toParamRegExp("filename\\*","i").exec(e);if(n){n=n[1];let e=rfc2616unquote(n);e=unescape(e);e=rfc5987decode(e);e=rfc2047decode(e);return fixupEncoding(e)}n=function rfc2231getparam(e){const t=[];let n;const i=toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(n=i.exec(e));){let[,e,i,s]=n;e=parseInt(e,10);if(e in t){if(0===e)break}else t[e]=[i,s]}const s=[];for(let e=0;e<t.length&&e in t;++e){let[n,i]=t[e];i=rfc2616unquote(i);if(n){i=unescape(i);0===e&&(i=rfc5987decode(i))}s.push(i)}return s.join("")}(e);if(n){return fixupEncoding(rfc2047decode(n))}n=toParamRegExp("filename","i").exec(e);if(n){n=n[1];let e=rfc2616unquote(n);e=rfc2047decode(e);return fixupEncoding(e)}function toParamRegExp(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function textdecode(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{const i=new TextDecoder(e,{fatal:!0}),s=Array.from(n,(function(e){return 255&e.charCodeAt(0)}));n=i.decode(new Uint8Array(s));t=!1}catch(i){if(/^utf-?8$/i.test(e))try{n=decodeURIComponent(escape(n));t=!1}catch(e){}}}return n}function fixupEncoding(e){if(t&&/[\x80-\xff]/.test(e)){e=textdecode("utf-8",e);t&&(e=textdecode("iso-8859-1",e))}return e}function rfc2616unquote(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const n=t[e].indexOf('"');if(-1!==n){t[e]=t[e].slice(0,n);t.length=e+1}t[e]=t[e].replace(/\\(.)/g,"$1")}e=t.join('"')}return e}function rfc5987decode(e){const t=e.indexOf("'");if(-1===t)return e;return textdecode(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function rfc2047decode(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,n,i){if("q"===n||"Q"===n)return textdecode(t,i=(i=i.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})));try{i=atob(i)}catch(e){}return textdecode(t,i)}))}return""}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFFetchStream=void 0;var i=n(2),s=n(24);function createFetchOptions(e,t,n){return{method:"GET",headers:e,signal:n?.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function createHeaders(e){const t=new Headers;for(const n in e){const i=e[n];void 0!==i&&t.append(n,i)}return t}t.PDFFetchStream=class PDFFetchStream{constructor(e){this.source=e;this.isHttp=/^https?:/i.test(e.url);this.httpHeaders=this.isHttp&&e.httpHeaders||{};this._fullRequestReader=null;this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?this._fullRequestReader._loaded:0}getFullReader(){(0,i.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once.");this._fullRequestReader=new PDFFetchStreamReader(this);return this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new PDFFetchStreamRangeReader(this,e,t);this._rangeRequestReaders.push(n);return n}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);this._rangeRequestReaders.slice(0).forEach((function(t){t.cancel(e)}))}};class PDFFetchStreamReader{constructor(e){this._stream=e;this._reader=null;this._loaded=0;this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1;this._contentLength=t.length;this._headersCapability=(0,i.createPromiseCapability)();this._disableRange=t.disableRange||!1;this._rangeChunkSize=t.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);"undefined"!=typeof AbortController&&(this._abortController=new AbortController);this._isStreamingSupported=!t.disableStream;this._isRangeSupported=!t.disableRange;this._headers=createHeaders(this._stream.httpHeaders);const n=t.url;fetch(n,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,s.validateResponseStatus)(e.status))throw(0,s.createResponseStatusError)(e.status,n);this._reader=e.body.getReader();this._headersCapability.resolve();const getResponseHeader=t=>e.headers.get(t),{allowRangeRequests:t,suggestedLength:r}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:getResponseHeader,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=t;this._contentLength=r||this._contentLength;this._filename=(0,s.extractFilenameFromHeader)(getResponseHeader);!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new i.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:e,done:t}=await this._reader.read();if(t)return{value:e,done:t};this._loaded+=e.byteLength;this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._reader&&this._reader.cancel(e);this._abortController&&this._abortController.abort()}}class PDFFetchStreamRangeReader{constructor(e,t,n){this._stream=e;this._reader=null;this._loaded=0;const r=e.source;this._withCredentials=r.withCredentials||!1;this._readCapability=(0,i.createPromiseCapability)();this._isStreamingSupported=!r.disableStream;"undefined"!=typeof AbortController&&(this._abortController=new AbortController);this._headers=createHeaders(this._stream.httpHeaders);this._headers.append("Range",`bytes=${t}-${n-1}`);const a=r.url;fetch(a,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,s.validateResponseStatus)(e.status))throw(0,s.createResponseStatusError)(e.status,a);this._readCapability.resolve();this._reader=e.body.getReader()})).catch((e=>{if("AbortError"!==e?.name)throw e}));this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();if(t)return{value:e,done:t};this._loaded+=e.byteLength;this.onProgress&&this.onProgress({loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._reader&&this._reader.cancel(e);this._abortController&&this._abortController.abort()}}}],__webpack_module_cache__={};function __w_pdfjs_require__(e){if(__webpack_module_cache__[e])return __webpack_module_cache__[e].exports;var t=__webpack_module_cache__[e]={exports:{}};__webpack_modules__[e](t,t.exports,__w_pdfjs_require__);return t.exports}return __w_pdfjs_require__(0)})()}));
  /**
   * @licstart The following is the entire license notice for the
   * Javascript code in this page
   *
   * Copyright 2020 Mozilla Foundation
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   *
   * @licend The above is the entire license notice for the
   * Javascript code in this page
   */(()=>{"use strict";var e=[(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});Object.defineProperty(t,"PDFViewerApplicationOptions",{enumerable:!0,get:function(){return i.AppOptions}});Object.defineProperty(t,"PDFViewerApplication",{enumerable:!0,get:function(){return s.PDFViewerApplication}});var i=n(1),s=n(3);window.PDFViewerApplication=s.PDFViewerApplication;window.PDFViewerApplicationOptions=i.AppOptions;HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator]);"function"!=typeof window.CustomEvent&&(window.CustomEvent=function CustomEvent(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};const n=document.createEvent("CustomEvent");n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail);return n});n(40);n(46);window.webViewerLoad=function webViewerLoad(){const e=function getViewerConfiguration(){return{appContainer:document.body,mainContainer:document.getElementById("viewerContainer"),viewerContainer:document.getElementById("viewer"),eventBus:null,toolbar:{container:document.getElementById("toolbarViewer"),numPages:document.getElementById("numPages"),pageNumber:document.getElementById("pageNumber"),scaleSelectContainer:document.getElementById("scaleSelectContainer"),scaleSelect:document.getElementById("scaleSelect"),customScaleOption:document.getElementById("customScaleOption"),previous:document.getElementById("previous"),next:document.getElementById("next"),zoomIn:document.getElementById("zoomIn"),zoomOut:document.getElementById("zoomOut"),viewFind:document.getElementById("viewFind"),openFile:document.getElementById("openFile"),print:document.getElementById("print"),presentationModeButton:document.getElementById("presentationMode"),download:document.getElementById("download"),viewBookmark:document.getElementById("viewBookmark")},secondaryToolbar:{toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggle"),toolbarButtonContainer:document.getElementById("secondaryToolbarButtonContainer"),presentationModeButton:document.getElementById("secondaryPresentationMode"),openFileButton:document.getElementById("secondaryOpenFile"),printButton:document.getElementById("secondaryPrint"),downloadButton:document.getElementById("secondaryDownload"),viewBookmarkButton:document.getElementById("secondaryViewBookmark"),firstPageButton:document.getElementById("firstPage"),lastPageButton:document.getElementById("lastPage"),pageRotateCwButton:document.getElementById("pageRotateCw"),pageRotateCcwButton:document.getElementById("pageRotateCcw"),cursorSelectToolButton:document.getElementById("cursorSelectTool"),cursorHandToolButton:document.getElementById("cursorHandTool"),scrollVerticalButton:document.getElementById("scrollVertical"),scrollHorizontalButton:document.getElementById("scrollHorizontal"),scrollWrappedButton:document.getElementById("scrollWrapped"),spreadNoneButton:document.getElementById("spreadNone"),spreadOddButton:document.getElementById("spreadOdd"),spreadEvenButton:document.getElementById("spreadEven"),documentPropertiesButton:document.getElementById("documentProperties")},fullscreen:{contextFirstPage:document.getElementById("contextFirstPage"),contextLastPage:document.getElementById("contextLastPage"),contextPageRotateCw:document.getElementById("contextPageRotateCw"),contextPageRotateCcw:document.getElementById("contextPageRotateCcw")},sidebar:{outerContainer:document.getElementById("outerContainer"),viewerContainer:document.getElementById("viewerContainer"),toggleButton:document.getElementById("sidebarToggle"),thumbnailButton:document.getElementById("viewThumbnail"),outlineButton:document.getElementById("viewOutline"),attachmentsButton:document.getElementById("viewAttachments"),layersButton:document.getElementById("viewLayers"),thumbnailView:document.getElementById("thumbnailView"),outlineView:document.getElementById("outlineView"),attachmentsView:document.getElementById("attachmentsView"),layersView:document.getElementById("layersView")},sidebarResizer:{outerContainer:document.getElementById("outerContainer"),resizer:document.getElementById("sidebarResizer")},findBar:{bar:document.getElementById("findbar"),toggleButton:document.getElementById("viewFind"),findField:document.getElementById("findInput"),findFieldMultiline:document.getElementById("findInputMultiline"),highlightAllCheckbox:document.getElementById("findHighlightAll"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),entireWordCheckbox:document.getElementById("findEntireWord"),findMultipleSearchTextsCheckbox:document.getElementById("findMultipleSearchTexts"),ignoreAccentsCheckbox:document.getElementById("findIgnoreAccents"),fuzzyCheckbox:document.getElementById("findFuzzy"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findPreviousButton:document.getElementById("findPrevious"),findNextButton:document.getElementById("findNext")},passwordOverlay:{overlayName:"passwordOverlay",container:document.getElementById("passwordOverlay"),label:document.getElementById("passwordText"),input:document.getElementById("password"),submitButton:document.getElementById("passwordSubmit"),cancelButton:document.getElementById("passwordCancel")},documentProperties:{overlayName:"documentPropertiesOverlay",container:document.getElementById("documentPropertiesOverlay"),closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"),creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField"),pageSize:document.getElementById("pageSizeField"),linearized:document.getElementById("linearizedField")}},errorWrapper:{container:document.getElementById("errorWrapper"),errorMessage:document.getElementById("errorMessage"),closeButton:document.getElementById("errorClose"),errorMoreInfo:document.getElementById("errorMoreInfo"),moreInfoButton:document.getElementById("errorShowMore"),lessInfoButton:document.getElementById("errorShowLess")},printContainer:document.getElementById("printContainer"),openFileInputName:"fileInput",debuggerScriptPath:"./debugger.js"}}(),t=document.createEvent("CustomEvent");t.initCustomEvent("webviewerloaded",!0,!0,{source:window});try{parent.document.dispatchEvent(t)}catch(e){console.error(`webviewerloaded: ${e}`);document.dispatchEvent(t)}s.PDFViewerApplication.run(e)}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.OptionKind=t.AppOptions=void 0;var i=n(2);const s={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};t.OptionKind=s;const r={cursorToolOnLoad:{value:0,kind:s.VIEWER+s.PREFERENCE},defaultUrl:{value:"",kind:s.VIEWER},defaultZoomValue:{value:"",kind:s.VIEWER+s.PREFERENCE},disableHistory:{value:!1,kind:s.VIEWER},disablePageLabels:{value:!1,kind:s.VIEWER+s.PREFERENCE},enablePermissions:{value:!1,kind:s.VIEWER+s.PREFERENCE},enablePrintAutoRotate:{value:!1,kind:s.VIEWER+s.PREFERENCE},enableScripting:{value:!1,kind:s.VIEWER+s.PREFERENCE},enableWebGL:{value:!1,kind:s.VIEWER+s.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:s.VIEWER},externalLinkTarget:{value:0,kind:s.VIEWER+s.PREFERENCE},historyUpdateUrl:{value:!1,kind:s.VIEWER+s.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:s.VIEWER+s.PREFERENCE},imageResourcesPath:{value:"./images/",kind:s.VIEWER},maxCanvasPixels:{value:16777216,compatibility:i.viewerCompatibilityParams.maxCanvasPixels,kind:s.VIEWER},pdfBugEnabled:{value:!1,kind:s.VIEWER+s.PREFERENCE},printResolution:{value:150,kind:s.VIEWER},removePageBorders:{value:!1,kind:s.VIEWER+s.PREFERENCE},renderer:{value:"canvas",kind:s.VIEWER+s.PREFERENCE},renderInteractiveForms:{value:!0,kind:s.VIEWER+s.PREFERENCE},sidebarViewOnLoad:{value:-1,kind:s.VIEWER+s.PREFERENCE},scrollModeOnLoad:{value:-1,kind:s.VIEWER+s.PREFERENCE},spreadModeOnLoad:{value:-1,kind:s.VIEWER+s.PREFERENCE},textLayerMode:{value:1,kind:s.VIEWER+s.PREFERENCE},useOnlyCssZoom:{value:!1,kind:s.VIEWER+s.PREFERENCE},viewerCssTheme:{value:0,kind:s.VIEWER+s.PREFERENCE},viewOnLoad:{value:0,kind:s.VIEWER+s.PREFERENCE},cMapPacked:{value:!0,kind:s.API},cMapUrl:{value:"../web/cmaps/",kind:s.API},disableAutoFetch:{value:!1,kind:s.API+s.PREFERENCE},disableFontFace:{value:!1,kind:s.API+s.PREFERENCE},disableRange:{value:!1,kind:s.API+s.PREFERENCE},disableStream:{value:!1,kind:s.API+s.PREFERENCE},docBaseUrl:{value:"",kind:s.API},fontExtraProperties:{value:!1,kind:s.API},isEvalSupported:{value:!0,kind:s.API},maxImageSize:{value:-1,kind:s.API},pdfBug:{value:!1,kind:s.API},verbosity:{value:1,kind:s.API},workerPort:{value:null,kind:s.WORKER},workerSrc:{value:"./assets/pdf.worker.js",kind:s.WORKER}};r.disablePreferences={value:!1,kind:s.VIEWER};r.locale={value:"undefined"!=typeof navigator?navigator.language:"en-US",kind:s.VIEWER};r.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:s.VIEWER};const a=Object.create(null);t.AppOptions=class AppOptions{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=a[e];if(void 0!==t)return t;const n=r[e];return void 0!==n?n.compatibility||n.value:void 0}static getAll(e=null){const t=Object.create(null);for(const n in r){const i=r[n];if(e){if(0==(e&i.kind))continue;if(e===s.PREFERENCE){const e=i.value,s=typeof e;if("boolean"===s||"string"===s||"number"===s&&Number.isInteger(e)){t[n]=e;continue}throw new Error(`Invalid type for preference: ${n}`)}}const o=a[n];t[n]=void 0!==o?o:i.compatibility||i.value}return t}static set(e,t){a[e]=t}static setAll(e){for(const t in e)a[t]=e[t]}static remove(e){delete a[e]}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.viewerCompatibilityParams=void 0;const n=Object.create(null);{const e="undefined"!=typeof navigator&&navigator.userAgent||"",t="undefined"!=typeof navigator&&navigator.platform||"",i="undefined"!=typeof navigator&&navigator.maxTouchPoints||1,s=/Android/.test(e),r=/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&i>1,a=/CriOS/.test(e);!function checkOnBlobSupport(){a&&(n.disableCreateObjectURL=!0)}();!function checkCanvasSizeLimitation(){(r||s)&&(n.maxCanvasPixels=5242880)}()}const i=Object.freeze(n);t.viewerCompatibilityParams=i},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPrintServiceFactory=t.DefaultExternalServices=t.PDFViewerApplication=void 0;var i=n(4),s=n(1),r=n(5),a=n(6),o=n(8),l=n(9),c=n(10),h=n(11),d=n(12),u=n(14),p=n(15),g=n(16),f=n(20),m=n(21),b=n(22),_=n(23),v=n(24),w=n(25),y=n(26),S=n(28),A=n(36),P=n(38),C=n(2),E=n(39);const T="enablePermissions",x=-1,L=1,k={AUTOMATIC:0,LIGHT:1,DARK:2},R=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.9","2.0","2.1","2.2","2.3"],I=["acrobat distiller","acrobat pdfwriter","adobe livecycle","adobe pdf library","adobe photoshop","ghostscript","tcpdf","cairo","dvipdfm","dvips","pdftex","pdfkit","itext","prince","quarkxpress","mac os x","microsoft","openoffice","oracle","luradocument","pdf-xchange","antenna house","aspose.cells","fpdf"];class DefaultExternalServices{constructor(){throw new Error("Cannot initialize DefaultExternalServices.")}static updateFindControlState(e){}static updateFindMatchesCount(e){}static initPassiveLoading(e){}static fallback(e,t){}static reportTelemetry(e){}static createDownloadManager(e){throw new Error("Not implemented: createDownloadManager")}static createPreferences(){throw new Error("Not implemented: createPreferences")}static createL10n(e){throw new Error("Not implemented: createL10n")}static createScripting(e){throw new Error("Not implemented: createScripting")}static get supportsIntegratedFind(){return(0,r.shadow)(this,"supportsIntegratedFind",!1)}static get supportsDocumentFonts(){return(0,r.shadow)(this,"supportsDocumentFonts",!0)}static get supportedMouseWheelZoomModifierKeys(){return(0,r.shadow)(this,"supportedMouseWheelZoomModifierKeys",{ctrlKey:!0,metaKey:!0})}static get isInAutomation(){return(0,r.shadow)(this,"isInAutomation",!1)}}t.DefaultExternalServices=DefaultExternalServices;const M={initialBookmark:document.location.hash.substring(1),_initializedCapability:(0,r.createPromiseCapability)(),fellback:!1,appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfHistory:null,pdfSidebar:null,pdfSidebarResizer:null,pdfOutlineViewer:null,pdfAttachmentViewer:null,pdfLayerViewer:null,pdfCursorTools:null,store:null,downloadManager:null,overlayManager:null,preferences:null,toolbar:null,secondaryToolbar:null,eventBus:null,l10n:null,isInitialViewSet:!1,downloadComplete:!1,isViewerEmbedded:window.parent!==window,url:"",baseUrl:"",externalServices:DefaultExternalServices,_boundEvents:Object.create(null),documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,triggerDelayedFallback:null,_saveInProgress:!1,_wheelUnusedTicks:0,_idleCallbacks:new Set,_scriptingInstance:null,_mouseState:Object.create(null),async initialize(e){this.preferences=this.externalServices.createPreferences();this.appConfig=e;await this._readPreferences();await this._parseHashParameters();this._forceCssTheme();await this._initializeL10n();this.isViewerEmbedded&&s.AppOptions.get("externalLinkTarget")===r.LinkTarget.NONE&&s.AppOptions.set("externalLinkTarget",r.LinkTarget.TOP);await this._initializeViewerComponents();this.bindEvents();this.bindWindowEvents();const t=e.appContainer||document.documentElement;this.l10n.translate(t).then((()=>{this.eventBus.dispatch("localized",{source:this})}));this._initializedCapability.resolve()},async _readPreferences(){if(!s.AppOptions.get("disablePreferences"))try{s.AppOptions.setAll(await this.preferences.getAll())}catch(e){console.error(`_readPreferences: "${e?.message}".`)}},async _parseHashParameters(){if(!s.AppOptions.get("pdfBugEnabled"))return;const e=document.location.hash.substring(1);if(!e)return;const t=(0,i.parseQueryString)(e),n=[];"disableworker"in t&&"true"===t.disableworker&&n.push(async function loadFakeWorker(){r.GlobalWorkerOptions.workerSrc||(r.GlobalWorkerOptions.workerSrc=s.AppOptions.get("workerSrc"));return(0,r.loadScript)(r.PDFWorker.getWorkerSrc())}());"disablerange"in t&&s.AppOptions.set("disableRange","true"===t.disablerange);"disablestream"in t&&s.AppOptions.set("disableStream","true"===t.disablestream);"disableautofetch"in t&&s.AppOptions.set("disableAutoFetch","true"===t.disableautofetch);"disablefontface"in t&&s.AppOptions.set("disableFontFace","true"===t.disablefontface);"disablehistory"in t&&s.AppOptions.set("disableHistory","true"===t.disablehistory);"webgl"in t&&s.AppOptions.set("enableWebGL","true"===t.webgl);"removepageborders"in t&&s.AppOptions.set("removePageBorders","true"===t.removepageborders);"verbosity"in t&&s.AppOptions.set("verbosity",0|t.verbosity);if("textlayer"in t)switch(t.textlayer){case"off":s.AppOptions.set("textLayerMode",i.TextLayerMode.DISABLE);break;case"visible":case"shadow":case"hover":this.appConfig.viewerContainer.classList.add("textLayer-"+t.textlayer)}if("pdfbug"in t){s.AppOptions.set("pdfBug",!0);s.AppOptions.set("fontExtraProperties",!0);const e=t.pdfbug.split(",");n.push(function loadAndEnablePDFBug(e){const t=M.appConfig;return(0,r.loadScript)(t.debuggerScriptPath).then((function(){PDFBug.enable(e);PDFBug.init({OPS:r.OPS},t.mainContainer)}))}(e))}"locale"in t&&s.AppOptions.set("locale",t.locale);return 0!==n.length?Promise.all(n).catch((e=>{console.error(`_parseHashParameters: "${e.message}".`)})):void 0},async _initializeL10n(){this.l10n=this.externalServices.createL10n({locale:s.AppOptions.get("locale")});const e=await this.l10n.getDirection();document.getElementsByTagName("html")[0].dir=e},_forceCssTheme(){const e=s.AppOptions.get("viewerCssTheme");if(e!==k.AUTOMATIC&&Object.values(k).includes(e))try{const t=document.styleSheets[0],n=t?.cssRules||[];for(let i=0,s=n.length;i<s;i++){const s=n[i];if(s instanceof CSSMediaRule&&"(prefers-color-scheme: dark)"===s.media?.[0]){if(e===k.LIGHT){t.deleteRule(i);return}const n=/^@media \(prefers-color-scheme: dark\) {\n\s*([\w\s-.,:;/\\{}()]+)\n}$/.exec(s.cssText);if(n?.[1]){t.deleteRule(i);t.insertRule(n[1],i)}return}}}catch(e){console.error(`_forceCssTheme: "${e?.message}".`)}},async _initializeViewerComponents(){const e=this.appConfig,t=e.eventBus||new i.EventBus({isInAutomation:this.externalServices.isInAutomation});this.eventBus=t;this.overlayManager=new c.OverlayManager;const n=new o.PDFRenderingQueue;n.onIdle=this.cleanup.bind(this);this.pdfRenderingQueue=n;const r=new b.PDFLinkService({eventBus:t,externalLinkTarget:s.AppOptions.get("externalLinkTarget"),externalLinkRel:s.AppOptions.get("externalLinkRel"),ignoreDestinationZoom:s.AppOptions.get("ignoreDestinationZoom")});this.pdfLinkService=r;const C=this.externalServices.createDownloadManager();this.downloadManager=C;const E=new g.PDFFindController({linkService:r,eventBus:t,pageViewMode:s.AppOptions.get("pageViewMode")});this.findController=E;const T=e.mainContainer,x=e.viewerContainer;this.pdfViewer=new S.PDFViewer({container:T,viewer:x,eventBus:t,renderingQueue:n,linkService:r,downloadManager:C,findController:E,renderer:s.AppOptions.get("renderer"),enableWebGL:s.AppOptions.get("enableWebGL"),l10n:this.l10n,textLayerMode:s.AppOptions.get("textLayerMode"),imageResourcesPath:s.AppOptions.get("imageResourcesPath"),removePageBorders:s.AppOptions.get("removePageBorders"),renderInteractiveForms:s.AppOptions.get("renderInteractiveForms"),enablePrintAutoRotate:s.AppOptions.get("enablePrintAutoRotate"),useOnlyCssZoom:s.AppOptions.get("useOnlyCssZoom"),maxCanvasPixels:s.AppOptions.get("maxCanvasPixels"),pageViewMode:s.AppOptions.get("pageViewMode"),enableScripting:s.AppOptions.get("enableScripting"),mouseState:this._mouseState});n.setViewer(this.pdfViewer);r.setViewer(this.pdfViewer);this.pdfThumbnailViewer=new y.PDFThumbnailViewer({container:e.sidebar.thumbnailView,eventBus:t,renderingQueue:n,linkService:r,l10n:this.l10n});n.setThumbnailViewer(this.pdfThumbnailViewer);this.pdfHistory=new f.PDFHistory({linkService:r,eventBus:t});r.setHistory(this.pdfHistory);this.supportsIntegratedFind||(this.findBar=new p.PDFFindBar(e.findBar,t,this.l10n));this.pdfDocumentProperties=new u.PDFDocumentProperties(e.documentProperties,this.overlayManager,t,this.l10n);this.pdfCursorTools=new a.PDFCursorTools({container:T,eventBus:t,cursorToolOnLoad:s.AppOptions.get("cursorToolOnLoad")});this.toolbar=new P.Toolbar(e.toolbar,t,this.l10n);this.secondaryToolbar=new A.SecondaryToolbar(e.secondaryToolbar,T,t);this.supportsFullscreen&&(this.pdfPresentationMode=new v.PDFPresentationMode({container:T,pdfViewer:this.pdfViewer,eventBus:t,contextMenuItems:e.fullscreen}));this.passwordPrompt=new h.PasswordPrompt(e.passwordOverlay,this.overlayManager,this.l10n);this.pdfOutlineViewer=new _.PDFOutlineViewer({container:e.sidebar.outlineView,eventBus:t,linkService:r});this.pdfAttachmentViewer=new d.PDFAttachmentViewer({container:e.sidebar.attachmentsView,eventBus:t,downloadManager:C});this.pdfLayerViewer=new m.PDFLayerViewer({container:e.sidebar.layersView,eventBus:t,l10n:this.l10n});this.pdfSidebar=new l.PDFSidebar({elements:e.sidebar,pdfViewer:this.pdfViewer,pdfThumbnailViewer:this.pdfThumbnailViewer,eventBus:t,l10n:this.l10n});this.pdfSidebar.onToggled=this.forceRendering.bind(this);this.pdfSidebarResizer=new w.PDFSidebarResizer(e.sidebarResizer,t,this.l10n)},run(e){this.initialize(e).then(webViewerInitialized)},get initialized(){return this._initializedCapability.settled},get initializedPromise(){return this._initializedCapability.promise},zoomIn(e){if(this.pdfViewer.isInPresentationMode)return;let t=this.pdfViewer.currentScale;const n=Number(s.AppOptions.get("maxZoom"));n||(n=i.MAX_SCALE);do{t=(1.1*t).toFixed(2);t=Math.ceil(10*t)/10;t=Math.min(n,t)}while(--e>0&&t<n);this.pdfViewer.currentScaleValue=t},zoomOut(e){if(this.pdfViewer.isInPresentationMode)return;let t=this.pdfViewer.currentScale;const n=Number(s.AppOptions.get("minZoom"));n||(n=i.MIN_SCALE);do{t=(t/1.1).toFixed(2);t=Math.floor(10*t)/10;t=Math.max(n,t)}while(--e>0&&t>n);this.pdfViewer.currentScaleValue=t},zoomReset(){this.pdfViewer.isInPresentationMode||(this.pdfViewer.currentScaleValue=i.DEFAULT_SCALE_VALUE)},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0},get page(){return this.pdfViewer.currentPageNumber},set page(e){this.pdfViewer.currentPageNumber=e},get supportsPrinting(){return V.instance.supportsPrinting},get supportsFullscreen(){let e;const t=document.documentElement;e=!!(t.requestFullscreen||t.mozRequestFullScreen||t.webkitRequestFullScreen);!1!==document.fullscreenEnabled&&!1!==document.mozFullScreenEnabled&&!1!==document.webkitFullscreenEnabled||(e=!1);return(0,r.shadow)(this,"supportsFullscreen",e)},get supportsIntegratedFind(){return this.externalServices.supportsIntegratedFind},get supportsDocumentFonts(){return this.externalServices.supportsDocumentFonts},get loadingBar(){const e=new i.ProgressBar("#loadingBar");return(0,r.shadow)(this,"loadingBar",e)},get supportedMouseWheelZoomModifierKeys(){return this.externalServices.supportedMouseWheelZoomModifierKeys},initPassiveLoading(){throw new Error("Not implemented: initPassiveLoading")},setTitleUsingUrl(e=""){this.url=e;this.baseUrl=e.split("#")[0];let t=(0,i.getPDFFileNameFromURL)(e,"");if(!t)try{t=decodeURIComponent((0,r.getFilenameFromUrl)(e))||e}catch(n){t=e}this.setTitle(t)},setTitle(e){this.isViewerEmbedded||(document.title=e)},_cancelIdleCallbacks(){if(this._idleCallbacks.size){for(const e of this._idleCallbacks)window.cancelIdleCallback(e);this._idleCallbacks.clear()}},async _destroyScriptingInstance(){if(!this._scriptingInstance)return;const{scripting:e,internalEvents:t,domEvents:n}=this._scriptingInstance;try{await e.destroySandbox()}catch(e){}for(const[e,n]of t)this.eventBus._off(e,n);t.clear();for(const[e,t]of n)window.removeEventListener(e,t);n.clear();delete this._mouseState.isDown;this._scriptingInstance=null},async close(){this.appConfig.errorWrapper.container.setAttribute("hidden","true");if(!this.pdfLoadingTask)return;const e=[];e.push(this.pdfLoadingTask.destroy());this.pdfLoadingTask=null;if(this.pdfDocument){this.pdfDocument=null;this.pdfThumbnailViewer.setDocument(null);this.pdfViewer.setDocument(null);this.pdfLinkService.setDocument(null);this.pdfDocumentProperties.setDocument(null)}!function webViewerResetPermissions(){const{appConfig:e}=M;if(!e)return;e.viewerContainer.classList.remove(T)}();this.store=null;this.isInitialViewSet=!1;this.downloadComplete=!1;this.url="";this.baseUrl="";this.documentInfo=null;this.metadata=null;this._contentDispositionFilename=null;this._contentLength=null;this.triggerDelayedFallback=null;this._saveInProgress=!1;this._cancelIdleCallbacks();e.push(this._destroyScriptingInstance());this.pdfSidebar.reset();this.pdfOutlineViewer.reset();this.pdfAttachmentViewer.reset();this.pdfLayerViewer.reset();this.pdfHistory&&this.pdfHistory.reset();this.findBar&&this.findBar.reset();this.toolbar.reset();this.secondaryToolbar.reset();"undefined"!=typeof PDFBug&&PDFBug.cleanup();return Promise.all(e)},async open(e,t){this.pdfLoadingTask&&await this.close();const n=s.AppOptions.getAll(s.OptionKind.WORKER);for(const e in n)r.GlobalWorkerOptions[e]=n[e];const i=Object.create(null);if("string"==typeof e){this.setTitleUsingUrl(e);i.url=e}else if(e&&"byteLength"in e)i.data=e;else if(e.url&&e.originalUrl){this.setTitleUsingUrl(e.originalUrl);i.url=e.url}const a=s.AppOptions.getAll(s.OptionKind.API);for(const e in a){let t=a[e];i[e]=t}if(t)for(const e in t)i[e]=t[e];const o=(0,r.getDocument)(i);this.pdfLoadingTask=o;o.onPassword=(e,t)=>{this.pdfLinkService.externalLinkEnabled=!1;this.passwordPrompt.setUpdateCallback(e,t);this.passwordPrompt.open()};o.onProgress=({loaded:e,total:t})=>{this.progress(e/t);this.eventBus.dispatch("progress",{source:this,type:"load",total:t,loaded:e,percent:100*e/t})};o.onUnsupportedFeature=this.fallback.bind(this);return o.promise.then((e=>{this.load(e)}),(e=>{if(o!==this.pdfLoadingTask)return;const t=e?.message;let n;n=e instanceof r.InvalidPDFException?this.l10n.get("invalid_file_error",null,"Invalid or corrupted PDF file."):e instanceof r.MissingPDFException?this.l10n.get("missing_file_error",null,"Missing PDF file."):e instanceof r.UnexpectedResponseException?this.l10n.get("unexpected_response_error",null,"Unexpected server response."):this.l10n.get("loading_error",null,"An error occurred while loading the PDF.");return n.then((n=>{this.error(n,{message:t});this.onError(e);throw e}))}))},download({sourceEventType:e="download"}={}){function downloadByUrl(){s.downloadUrl(t,n)}const t=this.baseUrl,n=this._contentDispositionFilename||(0,i.getPDFFileNameFromURL)(this.url),s=this.downloadManager;s.onerror=e=>{this.error(`PDF failed to download: ${e}`)};this.pdfDocument&&this.downloadComplete?this.pdfDocument.getData().then((function(i){const r=new Blob([i],{type:"application/pdf"});s.download(r,t,n,e)})).catch(downloadByUrl):downloadByUrl()},async save({sourceEventType:e="download"}={}){if(this._saveInProgress)return;const t=this.baseUrl,n=this._contentDispositionFilename||(0,i.getPDFFileNameFromURL)(this.url),s=this.downloadManager;s.onerror=e=>{this.error(`PDF failed to be saved: ${e}`)};if(this.pdfDocument&&this.downloadComplete){this._saveInProgress=!0;await(this._scriptingInstance?.scripting.dispatchEventInSandbox({id:"doc",name:"WillSave"}));this.pdfDocument.saveDocument(this.pdfDocument.annotationStorage).then((i=>{const r=new Blob([i],{type:"application/pdf"});s.download(r,t,n,e)})).catch((()=>{this.download({sourceEventType:e})})).finally((async()=>{await(this._scriptingInstance?.scripting.dispatchEventInSandbox({id:"doc",name:"DidSave"}));this._saveInProgress=!1}))}else this.download({sourceEventType:e})},downloadOrSave(e){this.pdfDocument?.annotationStorage.size>0?this.save(e):this.download(e)},_delayedFallback(e){this.externalServices.reportTelemetry({type:"unsupportedFeature",featureId:e});this.triggerDelayedFallback||(this.triggerDelayedFallback=()=>{this.fallback(e);this.triggerDelayedFallback=null})},fallback(e){this.externalServices.reportTelemetry({type:"unsupportedFeature",featureId:e});if(!this.fellback){this.fellback=!0;this.externalServices.fallback({featureId:e,url:this.baseUrl},(function response(e){e&&M.download({sourceEventType:"download"})}))}},error(e,t){const n=[this.l10n.get("error_version_info",{version:r.version||"?",build:r.build||"?"},"PDF.js v{{version}} (build: {{build}})")];if(t){n.push(this.l10n.get("error_message",{message:t.message},"Message: {{message}}"));if(t.stack)n.push(this.l10n.get("error_stack",{stack:t.stack},"Stack: {{stack}}"));else{t.filename&&n.push(this.l10n.get("error_file",{file:t.filename},"File: {{file}}"));t.lineNumber&&n.push(this.l10n.get("error_line",{line:t.lineNumber},"Line: {{line}}"))}}const s=this.appConfig.errorWrapper,a=s.container;a.removeAttribute("hidden");s.errorMessage.textContent=e;const o=s.closeButton;o.onclick=function(){a.setAttribute("hidden","true")};const l=s.errorMoreInfo,c=s.moreInfoButton,h=s.lessInfoButton;c.onclick=function(){l.removeAttribute("hidden");c.setAttribute("hidden","true");h.removeAttribute("hidden");l.style.height=l.scrollHeight+"px"};h.onclick=function(){l.setAttribute("hidden","true");c.removeAttribute("hidden");h.setAttribute("hidden","true")};c.oncontextmenu=i.noContextMenuHandler;h.oncontextmenu=i.noContextMenuHandler;o.oncontextmenu=i.noContextMenuHandler;c.removeAttribute("hidden");h.setAttribute("hidden","true");Promise.all(n).then((e=>{l.value=e.join("\n")}))},progress(e){if(this.downloadComplete)return;const t=Math.round(100*e);if(t>this.loadingBar.percent||isNaN(t)){this.loadingBar.percent=t;if((this.pdfDocument?this.pdfDocument.loadingParams.disableAutoFetch:s.AppOptions.get("disableAutoFetch"))&&t){if(this.disableAutoFetchLoadingBarTimeout){clearTimeout(this.disableAutoFetchLoadingBarTimeout);this.disableAutoFetchLoadingBarTimeout=null}this.loadingBar.show();this.disableAutoFetchLoadingBarTimeout=setTimeout((()=>{this.loadingBar.hide();this.disableAutoFetchLoadingBarTimeout=null}),5e3)}}},load(e){this.pdfDocument=e;e.getDownloadInfo().then((()=>{this.downloadComplete=!0;this.loadingBar.hide();c.then((()=>{this.eventBus.dispatch("documentloaded",{source:this})}))}));const t=e.getPageLayout().catch((function(){})),n=e.getPageMode().catch((function(){})),r=e.getOpenAction().catch((function(){}));this.toolbar.setPagesCount(e.numPages,!1);this.secondaryToolbar.setPagesCount(e.numPages);let a;a=null;this.pdfLinkService.setDocument(e,null);this.pdfDocumentProperties.setDocument(e,this.url);const o=this.pdfViewer;o.setDocument(e);const{firstPagePromise:c,onePageRendered:h,pagesPromise:d}=o;this.pdfThumbnailViewer.setDocument(e);const u=(this.store=new E.ViewHistory(e.fingerprint)).getMultiple({page:null,zoom:i.DEFAULT_SCALE_VALUE,scrollLeft:"0",scrollTop:"0",rotation:null,sidebarView:l.SidebarView.UNKNOWN,scrollMode:i.ScrollMode.UNKNOWN,spreadMode:i.SpreadMode.UNKNOWN}).catch((()=>Object.create(null)));c.then((a=>{this.loadingBar.setWidth(this.appConfig.viewerContainer);this._initializeAnnotationStorageCallbacks(e);Promise.all([i.animationStarted,u,t,n,r]).then((async([t,n,r,a,c])=>{const h=s.AppOptions.get("viewOnLoad");this._initializePdfHistory({fingerprint:e.fingerprint,viewOnLoad:h,initialDest:c&&c.dest});const u=this.initialBookmark,p=s.AppOptions.get("defaultZoomValue");let g=p?`zoom=${p}`:null,f=null,m=s.AppOptions.get("sidebarViewOnLoad"),b=s.AppOptions.get("scrollModeOnLoad"),_=s.AppOptions.get("spreadModeOnLoad");if(n.page&&h!==L){g=`page=${n.page}&zoom=${p||n.zoom},${n.scrollLeft},${n.scrollTop}`;f=parseInt(n.rotation,10);m===l.SidebarView.UNKNOWN&&(m=0|n.sidebarView);b===i.ScrollMode.UNKNOWN&&(b=0|n.scrollMode);_===i.SpreadMode.UNKNOWN&&(_=0|n.spreadMode)}a&&m===l.SidebarView.UNKNOWN&&(m=function apiPageModeToSidebarView(e){switch(e){case"UseNone":return l.SidebarView.NONE;case"UseThumbs":return l.SidebarView.THUMBS;case"UseOutlines":return l.SidebarView.OUTLINE;case"UseAttachments":return l.SidebarView.ATTACHMENTS;case"UseOC":return l.SidebarView.LAYERS}return l.SidebarView.NONE}(a));r&&_===i.SpreadMode.UNKNOWN&&(_=apiPageLayoutToSpreadMode(r));this.setInitialView(g,{rotation:f,sidebarView:m,scrollMode:b,spreadMode:_});this.eventBus.dispatch("documentinit",{source:this});this.isViewerEmbedded||o.focus();this._initializePermissions(e);await Promise.race([d,new Promise((e=>{setTimeout(e,1e4)}))]);if((u||g)&&!o.hasEqualPageSizes){this.initialBookmark=u;o.currentScaleValue=o.currentScaleValue;this.setInitialView(g)}})).catch((()=>{this.setInitialView()})).then((function(){o.update()}))}));d.then((()=>{this._initializeAutoPrint(e,r)}));h.then((()=>{e.getOutline().then((e=>{this.pdfOutlineViewer.render({outline:e})}));e.getAttachments().then((e=>{this.pdfAttachmentViewer.render({attachments:e})}));o.optionalContentConfigPromise.then((t=>{this.pdfLayerViewer.render({optionalContentConfig:t,pdfDocument:e})}));if("requestIdleCallback"in window){const t=window.requestIdleCallback((()=>{this._collectTelemetry(e);this._idleCallbacks.delete(t)}),{timeout:1e3});this._idleCallbacks.add(t)}this._initializeJavaScript(e)}));this._initializePageLabels(e);this._initializeMetadata(e)},async _initializeJavaScript(e){if(!s.AppOptions.get("enableScripting"))return;const[t,n,r]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(!t&&!r)return;if(e!==this.pdfDocument)return;const a=this.externalServices.createScripting({sandboxBundleSrc:s.AppOptions.get("sandboxBundleSrc")}),o=new Map,l=new Map;this._scriptingInstance={scripting:a,ready:!1,internalEvents:o,domEvents:l};if(!this.documentInfo){await new Promise((e=>{this.eventBus._on("metadataloaded",(t=>{e()}),{once:!0})}));if(e!==this.pdfDocument)return}o.set("updatefromsandbox",(({detail:t})=>{const{id:n,command:i,value:s}=t;if(!n){switch(i){case"clear":console.clear();break;case"error":console.error(s);break;case"layout":this.pdfViewer.spreadMode=apiPageLayoutToSpreadMode(s);break;case"page-num":this.pdfViewer.currentPageNumber=s+1;break;case"print":this.pdfViewer.pagesPromise.then((()=>{this.triggerPrinting()}));break;case"println":console.log(s);break;case"zoom":this.pdfViewer.currentScaleValue=s}return}const r=document.getElementById(n);r?r.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:t})):null!=s&&e.annotationStorage.setValue(n,s)}));o.set("dispatcheventinsandbox",(({detail:e})=>{a.dispatchEventInSandbox(e)}));l.set("mousedown",(e=>{this._mouseState.isDown=!0}));l.set("mouseup",(e=>{this._mouseState.isDown=!1}));for(const[e,t]of o)this.eventBus._on(e,t);for(const[e,t]of l)window.addEventListener(e,t);if(!this._contentLength){const{length:t}=await e.getDownloadInfo();if(e!==this.pdfDocument)return;this._contentLength=t}const c=this._contentDispositionFilename||(0,i.getPDFFileNameFromURL)(this.url);try{await a.createSandbox({objects:t,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...this.documentInfo,baseURL:this.baseUrl,filesize:this._contentLength,filename:c,metadata:this.metadata,numPages:e.numPages,URL:this.url,actions:r}});this.externalServices.isInAutomation&&this.eventBus.dispatch("sandboxcreated",{source:this})}catch(e){console.error(`_initializeJavaScript: "${e?.message}".`);this._destroyScriptingInstance();return}await a.dispatchEventInSandbox({id:"doc",name:"Open"});Promise.resolve().then((()=>{this._scriptingInstance&&(this._scriptingInstance.ready=!0)}))},async _collectTelemetry(e){const t=await this.pdfDocument.getMarkInfo();if(e!==this.pdfDocument)return;const n=t?.Marked||!1;this.externalServices.reportTelemetry({type:"tagged",tagged:n})},async _initializeAutoPrint(e,t){const[n,a]=await Promise.all([t,s.AppOptions.get("enableScripting")?null:e.getJavaScript()]);if(e!==this.pdfDocument)return;let o=!1;"Print"===n?.action&&(o=!0);if(a){a.some((e=>{if(!e)return!1;console.warn("Warning: JavaScript is not supported");this._delayedFallback(r.UNSUPPORTED_FEATURES.javaScript);return!0}));if(!o)for(const e of a)if(e&&i.AutoPrintRegExp.test(e)){o=!0;break}}o&&this.triggerPrinting()},async _initializeMetadata(e){const{info:t,metadata:n,contentDispositionFilename:i,contentLength:s}=await e.getMetadata();if(e!==this.pdfDocument)return;this.documentInfo=t;this.metadata=n;this._contentDispositionFilename=i;this._contentLength=s;const a=window.PDFViewerApplicationOptions;if(!a||a.get("verbosity")>0){console.log("PDF viewer: ngx-extended-pdf-viewer running on pdf.js "+(window["pdfjs-dist/build/pdf"]?window["pdfjs-dist/build/pdf"].version:" developer version (?)"));console.log(`PDF ${e.fingerprint} [${t.PDFFormatVersion} ${(t.Producer||"-").trim()} / ${(t.Creator||"-").trim()}] (PDF.js: ${r.version||"-"}`+(this.pdfViewer.enableWebGL?" [WebGL]":"")+") modified by ngx-extended-pdf-viewer)")}let o;const l=t&&t.Title;l&&(o=l);const c=n&&n.get("dc:title");c&&("Untitled"===c||/[\uFFF0-\uFFFF]/g.test(c)||(o=c));o?this.setTitle(`${o} - ${i||document.title}`):i&&this.setTitle(i);if(t.IsXFAPresent&&!t.IsAcroFormPresent){console.warn("Warning: XFA is not supported");this._delayedFallback(r.UNSUPPORTED_FEATURES.forms)}else if((t.IsAcroFormPresent||t.IsXFAPresent)&&!this.pdfViewer.renderInteractiveForms){console.warn("Warning: Interactive form support is not enabled");this._delayedFallback(r.UNSUPPORTED_FEATURES.forms)}let h="other";R.includes(t.PDFFormatVersion)&&(h=`v${t.PDFFormatVersion.replace(".","_")}`);let d="other";if(t.Producer){const e=t.Producer.toLowerCase();I.some((function(t){if(!e.includes(t))return!1;d=t.replace(/[ .-]/g,"_");return!0}))}let u=null;t.IsXFAPresent?u="xfa":t.IsAcroFormPresent&&(u="acroform");this.externalServices.reportTelemetry({type:"documentInfo",version:h,generator:d,formType:u});this.eventBus.dispatch("metadataloaded",{source:this})},async _initializePageLabels(e){const t=await e.getPageLabels();if(e!==this.pdfDocument)return;if(!t||s.AppOptions.get("disablePageLabels"))return;const n=t.length;if(n!==this.pagesCount){console.error("The number of Page Labels does not match the number of pages in the document.");return}let i=0;for(;i<n&&t[i]===(i+1).toString();)i++;if(i===n)return;const{pdfViewer:r,pdfThumbnailViewer:a,toolbar:o}=this;r.setPageLabels(t);a.setPageLabels(t);o.setPagesCount(n,!0);o.setPageNumber(r.currentPageNumber,r.currentPageLabel)},_initializePdfHistory({fingerprint:e,viewOnLoad:t,initialDest:n=null}){if(!this.isViewerEmbedded&&!s.AppOptions.get("disableHistory")){this.pdfHistory.initialize({fingerprint:e,resetHistory:t===L,updateUrl:s.AppOptions.get("historyUpdateUrl")});if(this.pdfHistory.initialBookmark){this.initialBookmark=this.pdfHistory.initialBookmark;this.initialRotation=this.pdfHistory.initialRotation}if(n&&!this.initialBookmark&&t===x){this.initialBookmark=JSON.stringify(n);this.pdfHistory.push({explicitDest:n,pageNumber:null})}}},async _initializePermissions(e){const t=await e.getPermissions();e===this.pdfDocument&&t&&s.AppOptions.get("enablePermissions")&&(t.includes(r.PermissionFlag.COPY)||this.appConfig.viewerContainer.classList.add(T))},_initializeAnnotationStorageCallbacks(e){if(e!==this.pdfDocument)return;const{annotationStorage:t}=e;t.onSetModified=function(){window.addEventListener("beforeunload",beforeUnload)};t.onResetModified=function(){window.removeEventListener("beforeunload",beforeUnload)}},setInitialView(e,{rotation:t,sidebarView:n,scrollMode:s,spreadMode:r}={}){const setRotation=e=>{(0,i.isValidRotation)(e)&&(this.pdfViewer.pagesRotation=e)};this.isInitialViewSet=!0;this.pdfSidebar.setInitialView(n);((e,t)=>{(0,i.isValidScrollMode)(e)&&(this.pdfViewer.scrollMode=e);(0,i.isValidSpreadMode)(t)&&(this.pdfViewer.spreadMode=t)})(s,r);if(this.initialBookmark){setRotation(this.initialRotation);delete this.initialRotation;this.pdfLinkService.setHash(this.initialBookmark);this.initialBookmark=null}else if(e){setRotation(t);this.pdfLinkService.setHash(e)}this.toolbar.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel);this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber);if(!this.pdfViewer.currentScaleValue){const e=PDFViewerApplicationOptions.get("defaultZoomValue");this.pdfViewer.currentScaleValue=e||i.DEFAULT_SCALE_VALUE}},cleanup(){if(this.pdfDocument){this.pdfViewer.cleanup();this.pdfThumbnailViewer.cleanup();this.pdfViewer.renderer!==i.RendererType.SVG&&this.pdfDocument.cleanup()}},forceRendering(){this.pdfRenderingQueue.printing=!!this.printService;this.pdfRenderingQueue.isThumbnailViewEnabled=this.pdfSidebar.isThumbnailViewVisible;this.pdfRenderingQueue.renderHighestPriority()},beforePrint(){this._scriptingInstance?.scripting.dispatchEventInSandbox({id:"doc",name:"WillPrint"});if(this.printService)return;if(!this.supportsPrinting){this.l10n.get("printing_not_supported",null,"Warning: Printing is not fully supported by this browser.").then((e=>{this.error(e)}));return}if(!this.pdfViewer.pageViewsReady){this.l10n.get("printing_not_ready",null,"Warning: The PDF is not fully loaded for printing.").then((e=>{window.alert(e)}));return}const e=this.pdfViewer.getPagesOverview(),t=this.appConfig.printContainer,n=s.AppOptions.get("printResolution"),i=this.pdfViewer.optionalContentConfigPromise,r=V.instance.createPrintService(this.pdfDocument,e,t,n,i,this.l10n,this.pdfViewer.eventBus);this.printService=r;this.forceRendering();r.layout();this.externalServices.reportTelemetry({type:"print"})},afterPrint(){this._scriptingInstance?.scripting.dispatchEventInSandbox({id:"doc",name:"DidPrint"});if(this.printService){document.body.removeAttribute("data-pdfjsprinting");this.printService.destroy();this.printService=null;this.pdfDocument&&this.pdfDocument.annotationStorage.resetModified()}this.forceRendering()},rotatePages(e){if(!this.pdfDocument)return;const t=(this.pdfViewer.pagesRotation+360+e)%360;this.pdfViewer.pagesRotation=t},requestPresentationMode(){this.pdfPresentationMode&&this.pdfPresentationMode.request()},triggerPrinting(){this.supportsPrinting&&window.printPDF()},bindEvents(){const{eventBus:e,_boundEvents:t}=this;t.beforePrint=this.beforePrint.bind(this);t.afterPrint=this.afterPrint.bind(this);e._on("resize",webViewerResize);e._on("hashchange",webViewerHashchange);e._on("beforeprint",t.beforePrint);e._on("afterprint",t.afterPrint);e._on("pagerendered",webViewerPageRendered);e._on("updateviewarea",webViewerUpdateViewarea);e._on("pagechanging",webViewerPageChanging);e._on("scalechanging",webViewerScaleChanging);e._on("rotationchanging",webViewerRotationChanging);e._on("sidebarviewchanged",webViewerSidebarViewChanged);e._on("pagemode",webViewerPageMode);e._on("namedaction",webViewerNamedAction);e._on("presentationmodechanged",webViewerPresentationModeChanged);e._on("presentationmode",webViewerPresentationMode);e._on("print",webViewerPrint);e._on("download",webViewerDownload);e._on("save",webViewerSave);e._on("firstpage",webViewerFirstPage);e._on("lastpage",webViewerLastPage);e._on("nextpage",webViewerNextPage);e._on("previouspage",webViewerPreviousPage);e._on("zoomin",webViewerZoomIn);e._on("zoomout",webViewerZoomOut);e._on("zoomreset",webViewerZoomReset);e._on("pagenumberchanged",webViewerPageNumberChanged);e._on("scalechanged",webViewerScaleChanged);e._on("rotatecw",webViewerRotateCw);e._on("rotateccw",webViewerRotateCcw);e._on("optionalcontentconfig",webViewerOptionalContentConfig);e._on("switchscrollmode",webViewerSwitchScrollMode);e._on("scrollmodechanged",webViewerScrollModeChanged);e._on("switchspreadmode",webViewerSwitchSpreadMode);e._on("spreadmodechanged",webViewerSpreadModeChanged);e._on("documentproperties",webViewerDocumentProperties);e._on("find",webViewerFind);e._on("findfromurlhash",webViewerFindFromUrlHash);e._on("updatefindmatchescount",webViewerUpdateFindMatchesCount);e._on("updatefindcontrolstate",webViewerUpdateFindControlState);if(s.AppOptions.get("pdfBug")){t.reportPageStatsPDFBug=reportPageStatsPDFBug;e._on("pagerendered",t.reportPageStatsPDFBug);e._on("pagechanging",t.reportPageStatsPDFBug)}e._on("fileinputchange",N);e._on("openfile",O)},bindWindowEvents(){const{eventBus:e,_boundEvents:t}=this;t.windowResize=()=>{e.dispatch("resize",{source:window})};t.windowHashChange=()=>{e.dispatch("hashchange",{source:window,hash:document.location.hash.substring(1)})};t.windowBeforePrint=()=>{e.dispatch("beforeprint",{source:window})};t.windowAfterPrint=()=>{e.dispatch("afterprint",{source:window})};t.windowUpdateFromSandbox=t=>{e.dispatch("updatefromsandbox",{source:window,detail:t.detail})};window.addEventListener("visibilitychange",webViewerVisibilityChange);window.addEventListener("wheel",webViewerWheel,{passive:!1});window.addEventListener("touchstart",webViewerTouchStart,{passive:!1});window.addEventListener("click",webViewerClick);window.addEventListener("keydown",webViewerKeyDown);window.addEventListener("keyup",webViewerKeyUp);window.addEventListener("resize",t.windowResize);window.addEventListener("hashchange",t.windowHashChange);window.addEventListener("beforeprint",t.windowBeforePrint);window.addEventListener("afterprint",t.windowAfterPrint);window.addEventListener("updatefromsandbox",t.windowUpdateFromSandbox)},unbindEvents(){const{eventBus:e,_boundEvents:t}=this;e._off("resize",webViewerResize);e._off("hashchange",webViewerHashchange);e._off("beforeprint",t.beforePrint);e._off("afterprint",t.afterPrint);e._off("pagerendered",webViewerPageRendered);e._off("updateviewarea",webViewerUpdateViewarea);e._off("pagechanging",webViewerPageChanging);e._off("scalechanging",webViewerScaleChanging);e._off("rotationchanging",webViewerRotationChanging);e._off("sidebarviewchanged",webViewerSidebarViewChanged);e._off("pagemode",webViewerPageMode);e._off("namedaction",webViewerNamedAction);e._off("presentationmodechanged",webViewerPresentationModeChanged);e._off("presentationmode",webViewerPresentationMode);e._off("print",webViewerPrint);e._off("download",webViewerDownload);e._off("save",webViewerSave);e._off("firstpage",webViewerFirstPage);e._off("lastpage",webViewerLastPage);e._off("nextpage",webViewerNextPage);e._off("previouspage",webViewerPreviousPage);e._off("zoomin",webViewerZoomIn);e._off("zoomout",webViewerZoomOut);e._off("zoomreset",webViewerZoomReset);e._off("pagenumberchanged",webViewerPageNumberChanged);e._off("scalechanged",webViewerScaleChanged);e._off("rotatecw",webViewerRotateCw);e._off("rotateccw",webViewerRotateCcw);e._off("optionalcontentconfig",webViewerOptionalContentConfig);e._off("switchscrollmode",webViewerSwitchScrollMode);e._off("scrollmodechanged",webViewerScrollModeChanged);e._off("switchspreadmode",webViewerSwitchSpreadMode);e._off("spreadmodechanged",webViewerSpreadModeChanged);e._off("documentproperties",webViewerDocumentProperties);e._off("find",webViewerFind);e._off("findfromurlhash",webViewerFindFromUrlHash);e._off("updatefindmatchescount",webViewerUpdateFindMatchesCount);e._off("updatefindcontrolstate",webViewerUpdateFindControlState);if(t.reportPageStatsPDFBug){e._off("pagerendered",t.reportPageStatsPDFBug);e._off("pagechanging",t.reportPageStatsPDFBug);t.reportPageStatsPDFBug=null}e._off("fileinputchange",N);e._off("openfile",O);t.beforePrint=null;t.afterPrint=null},unbindWindowEvents(){const{_boundEvents:e}=this;window.removeEventListener("visibilitychange",webViewerVisibilityChange);window.removeEventListener("wheel",webViewerWheel,{passive:!1});window.removeEventListener("touchstart",webViewerTouchStart,{passive:!1});window.removeEventListener("click",webViewerClick);window.removeEventListener("keydown",webViewerKeyDown);window.removeEventListener("keyup",webViewerKeyUp);window.removeEventListener("resize",e.windowResize);window.removeEventListener("hashchange",e.windowHashChange);window.removeEventListener("beforeprint",e.windowBeforePrint);window.removeEventListener("afterprint",e.windowAfterPrint);window.removeEventListener("updatefromsandbox",e.windowUpdateFromSandbox);e.windowResize=null;e.windowHashChange=null;e.windowBeforePrint=null;e.windowAfterPrint=null;e.windowUpdateFromSandbox=null},accumulateWheelTicks(e){(this._wheelUnusedTicks>0&&e<0||this._wheelUnusedTicks<0&&e>0)&&(this._wheelUnusedTicks=0);this._wheelUnusedTicks+=e;const t=Math.sign(this._wheelUnusedTicks)*Math.floor(Math.abs(this._wheelUnusedTicks));this._wheelUnusedTicks-=t;return t},get scriptingReady(){return this._scriptingInstance?.ready||!1}};t.PDFViewerApplication=M;let F,D,N,O;{const e=["null","http://mozilla.github.io","https://mozilla.github.io"];F=function(t){if(void 0!==t)try{const n=new URL(window.location.href).origin||"null";if(e.includes(n))return;const{origin:i,protocol:s}=new URL(t,window.location.href);if(i!==n&&"blob:"!==s)throw new Error("file origin does not match viewer's")}catch(e){const t=e&&e.message;M.l10n.get("loading_error",null,"An error occurred while loading the PDF.").then((e=>{M.error(e,{message:t})}));throw e}}}function reportPageStatsPDFBug({pageNumber:e}){if("undefined"==typeof Stats||!Stats.enabled)return;const t=M.pdfViewer.getPageView(e-1),n=t&&t.pdfPage&&t.pdfPage.stats;n&&Stats.add(e,n)}function webViewerInitialized(){const e=M.appConfig;let t;const n=document.location.search.substring(1),r=(0,i.parseQueryString)(n);t="file"in r?r.file:s.AppOptions.get("defaultUrl");F(t);const a=document.createElement("input");a.id=e.openFileInputName;a.className="fileInput";a.setAttribute("accept",".pdf,application/pdf");a.setAttribute("type","file");a.oncontextmenu=i.noContextMenuHandler;document.body.appendChild(a);if(window.File&&window.FileReader&&window.FileList&&window.Blob)a.value=null;else{e.toolbar.openFile.setAttribute("hidden","true");e.secondaryToolbar.openFileButton.setAttribute("hidden","true")}a.addEventListener("change",(function(e){const t=e.target.files;t&&0!==t.length&&M.eventBus.dispatch("fileinputchange",{source:this,fileInput:e.target})}));e.mainContainer.addEventListener("dragover",(function(e){e.preventDefault();e.dataTransfer.dropEffect="move"}));e.mainContainer.addEventListener("drop",(function(e){e.preventDefault();const t=e.dataTransfer.files;t&&0!==t.length&&M.eventBus.dispatch("fileinputchange",{source:this,fileInput:e.dataTransfer})}));if(!M.supportsDocumentFonts){s.AppOptions.set("disableFontFace",!0);M.l10n.get("web_fonts_disabled",null,"Web fonts are disabled: unable to use embedded PDF fonts.").then((e=>{console.warn(e)}))}if(!M.supportsPrinting){e.toolbar.print.classList.add("hidden");e.secondaryToolbar.printButton.classList.add("hidden")}if(!M.supportsFullscreen){e.toolbar.presentationModeButton.classList.add("hidden");e.secondaryToolbar.presentationModeButton.classList.add("hidden")}M.supportsIntegratedFind&&e.toolbar.viewFind.classList.add("hidden");e.mainContainer.addEventListener("transitionend",(function(e){e.target===this&&M.eventBus.dispatch("resize",{source:this})}),!0);try{D(t)}catch(e){M.l10n.get("loading_error",null,"An error occurred while loading the PDF.").then((t=>{M.error(t,e)}))}}D=function(e){if(e&&0===e.lastIndexOf("file:",0)){M.setTitleUsingUrl(e);const t=new XMLHttpRequest;t.onload=function(){M.open(new Uint8Array(t.response))};t.open("GET",e);t.responseType="arraybuffer";t.send()}else e&&M.open(e)};function webViewerPageRendered({pageNumber:e,timestamp:t,error:n}){e===M.page&&M.toolbar.updateLoadingIndicatorState(!1);if(M.pdfSidebar.isThumbnailViewVisible){const t=M.pdfViewer.getPageView(e-1),n=M.pdfThumbnailViewer.getThumbnail(e-1);t&&n&&n.setImage(t)}n&&M.l10n.get("rendering_error",null,"An error occurred while rendering the page.").then((e=>{M.error(e,n)}));M.externalServices.reportTelemetry({type:"pageInfo",timestamp:t});M.pdfDocument.getStats().then((function(e){M.externalServices.reportTelemetry({type:"documentStats",stats:e})}))}function webViewerPageMode({mode:e}){let t;switch(e){case"thumbs":t=l.SidebarView.THUMBS;break;case"bookmarks":case"outline":t=l.SidebarView.OUTLINE;break;case"attachments":t=l.SidebarView.ATTACHMENTS;break;case"layers":t=l.SidebarView.LAYERS;break;case"none":t=l.SidebarView.NONE;break;default:console.error('Invalid "pagemode" hash parameter: '+e);return}M.pdfSidebar.switchView(t,!0)}function webViewerNamedAction(e){switch(e.action){case"GoToPage":M.appConfig.toolbar.pageNumber.select();break;case"Find":M.supportsIntegratedFind||M.findBar.toggle();break;case"Print":M.triggerPrinting();break;case"SaveAs":webViewerSave()}}function webViewerPresentationModeChanged(e){M.pdfViewer.presentationModeState=e.state}function webViewerSidebarViewChanged(e){M.pdfRenderingQueue.isThumbnailViewEnabled=M.pdfSidebar.isThumbnailViewVisible;const t=M.store;t&&M.isInitialViewSet&&t.set("sidebarView",e.view).catch((function(){}))}function webViewerUpdateViewarea(e){const t=e.location,n=M.store;n&&M.isInitialViewSet&&n.setMultiple({page:t.pageNumber,zoom:t.scale,scrollLeft:t.left,scrollTop:t.top,rotation:t.rotation}).catch((function(){}));const i=M.pdfLinkService.getAnchorUrl(t.pdfOpenParams);M.appConfig.toolbar.viewBookmark.href=i;M.appConfig.secondaryToolbar.viewBookmarkButton.href=i;const s=M.pdfViewer.getPageView(M.page-1),r=(s&&s.renderingState)!==o.RenderingStates.FINISHED;M.toolbar.updateLoadingIndicatorState(r)}function webViewerScrollModeChanged(e){const t=M.store;t&&M.isInitialViewSet&&t.set("scrollMode",e.mode).catch((function(){}))}function webViewerSpreadModeChanged(e){const t=M.store;t&&M.isInitialViewSet&&t.set("spreadMode",e.mode).catch((function(){}))}function webViewerResize(){const{pdfDocument:e,pdfViewer:t}=M;if(!e)return;const n=t.currentScaleValue;"auto"!==n&&"page-fit"!==n&&"page-width"!==n||(t.currentScaleValue=n);t.update()}function webViewerHashchange(e){const t=e.hash;t&&(M.isInitialViewSet?M.pdfHistory.popStateInProgress||M.pdfLinkService.setHash(t):M.initialBookmark=t)}N=function(e){if(M.pdfViewer&&M.pdfViewer.isInPresentationMode)return;const t=e.fileInput.files[0];if(C.viewerCompatibilityParams.disableCreateObjectURL){M.setTitleUsingUrl(t.name);const e=new FileReader;e.onload=function webViewerChangeFileReaderOnload(e){const t=e.target.result;M.open(new Uint8Array(t))};e.readAsArrayBuffer(t)}else{let e=URL.createObjectURL(t);t.name&&(e={url:e,originalUrl:t.name});M.open(e)}const n=M.appConfig;n.toolbar.viewBookmark.setAttribute("hidden","true");n.secondaryToolbar.viewBookmarkButton.setAttribute("hidden","true");n.toolbar.download.setAttribute("hidden","true");n.secondaryToolbar.downloadButton.setAttribute("hidden","true")};O=function(e){const t=M.appConfig.openFileInputName;document.getElementById(t).click()};function webViewerPresentationMode(){M.requestPresentationMode()}function webViewerPrint(){M.triggerPrinting()}function webViewerDownload(){M.downloadOrSave({sourceEventType:"download"})}function webViewerSave(){M.downloadOrSave({sourceEventType:"save"})}function webViewerFirstPage(){M.pdfDocument&&(M.page=1)}function webViewerLastPage(){if(M.pdfDocument){M.page=M.pagesCount;"single"===M.pageViewMode&&M.pdfViewer&&M.pdfViewer.container&&(M.pdfViewer.container.scrollTop=0)}}function webViewerNextPage(){M.page++;"single"===M.pageViewMode&&M.pdfViewer&&M.pdfViewer.container&&(M.pdfViewer.container.scrollTop=0)}function webViewerPreviousPage(){M.page--}function webViewerZoomIn(){M.zoomIn()}function webViewerZoomOut(){M.zoomOut()}function webViewerZoomReset(){M.zoomReset()}function webViewerPageNumberChanged(e){const t=M.pdfViewer;""!==e.value&&M.pdfLinkService.goToPage(e.value);e.value!==t.currentPageNumber.toString()&&e.value!==t.currentPageLabel&&M.toolbar.setPageNumber(t.currentPageNumber,t.currentPageLabel)}function webViewerScaleChanged(e){M.pdfViewer.currentScaleValue=e.value}function webViewerRotateCw(){M.rotatePages(90)}function webViewerRotateCcw(){M.rotatePages(-90)}function webViewerOptionalContentConfig(e){M.pdfViewer.optionalContentConfigPromise=e.promise}function webViewerSwitchScrollMode(e){M.pdfViewer.scrollMode=e.mode}function webViewerSwitchSpreadMode(e){M.pdfViewer.spreadMode=e.mode}function webViewerDocumentProperties(){M.pdfDocumentProperties.open()}function webViewerFind(e){M.findController.executeCommand("find"+e.type,{query:e.query,phraseSearch:e.phraseSearch,caseSensitive:e.caseSensitive,entireWord:e.entireWord,ignoreAccents:e.ignoreAccents,fuzzySearch:e.fuzzySearch,highlightAll:e.highlightAll,findPrevious:e.findPrevious})}function webViewerFindFromUrlHash(e){M.findController.executeCommand("find",{query:e.query,phraseSearch:e.phraseSearch,caseSensitive:!1,entireWord:!1,ignoreAccents:!1,fuzzySearch:!1,highlightAll:!0,findPrevious:!1})}function webViewerUpdateFindMatchesCount({matchesCount:e}){M.supportsIntegratedFind?M.externalServices.updateFindMatchesCount(e):M.findBar.updateResultsCount(e)}function webViewerUpdateFindControlState({state:e,previous:t,matchesCount:n,rawQuery:i}){M.supportsIntegratedFind?M.externalServices.updateFindControlState({result:e,findPrevious:t,matchesCount:n,rawQuery:i}):M.findBar.updateUIState(e,t,n)}function webViewerScaleChanging(e){M.toolbar.setPageScale(e.presetValue,e.scale);M.pdfViewer.update()}function webViewerRotationChanging(e){M.pdfThumbnailViewer.pagesRotation=e.pagesRotation;M.forceRendering();M.pdfViewer.currentPageNumber=e.pageNumber}function webViewerPageChanging({pageNumber:e,pageLabel:t}){M.toolbar.setPageNumber(e,t);M.secondaryToolbar.setPageNumber(e);M.pdfSidebar.isThumbnailViewVisible&&M.pdfThumbnailViewer.scrollThumbnailIntoView(e);const n=document.getElementById("pageNumber");if(n){const e=new CustomEvent("page-change");n.dispatchEvent(e)}}function webViewerVisibilityChange(e){"visible"===document.visibilityState&&setZoomDisabledTimeout()}let B=null;function setZoomDisabledTimeout(){B&&clearTimeout(B);B=setTimeout((function(){B=null}),1e3)}function webViewerWheel(e){const{pdfViewer:t,supportedMouseWheelZoomModifierKeys:n}=M;if(t.isInPresentationMode)return;const s=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(!window.isKeyIgnored||!window.isKeyIgnored(s,"WHEEL"))if(e.ctrlKey&&n.ctrlKey||e.metaKey&&n.metaKey){e.preventDefault();if(B||"hidden"===document.visibilityState)return;const n=t.currentScale,s=(0,i.normalizeWheelEventDirection)(e);let r=0;if(e.deltaMode===WheelEvent.DOM_DELTA_LINE||e.deltaMode===WheelEvent.DOM_DELTA_PAGE)r=Math.abs(s)>=1?Math.sign(s):M.accumulateWheelTicks(s);else{const e=30;r=M.accumulateWheelTicks(s/e)}r<0?M.zoomOut(-r):r>0&&M.zoomIn(r);const a=t.currentScale;if(n!==a){const i=a/n-1,s=t.container.getBoundingClientRect(),r=e.clientX-s.left,o=e.clientY-s.top;t.container.scrollLeft+=r*i;t.container.scrollTop+=o*i}}else setZoomDisabledTimeout()}function webViewerTouchStart(e){e.touches.length>1&&e.preventDefault()}function webViewerClick(e){M.triggerDelayedFallback&&M.pdfViewer.containsElement(e.target)&&M.triggerDelayedFallback();if(!M.secondaryToolbar.isOpen)return;const t=M.appConfig;if(M.pdfViewer.containsElement(e.target)||t.toolbar.container.contains(e.target)&&e.target!==t.secondaryToolbar.toggleButton){if(e.target&&e.target.parentElement===t.secondaryToolbar.toggleButton)return;if(e.target&&e.target.parentElement&&e.target.parentElement.parentElement===t.secondaryToolbar.toggleButton)return;M.secondaryToolbar.close()}}function webViewerKeyUp(e){9===e.keyCode&&M.triggerDelayedFallback&&M.triggerDelayedFallback()}function webViewerKeyDown(e){if(M.overlayManager.active)return;let t=!1,n=!1;const s=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0),r=M.pdfViewer,o=r&&r.isInPresentationMode;if(window.isKeyIgnored&&window.isKeyIgnored(s,e.keyCode))return;if(1===s||8===s||5===s||12===s)switch(e.keyCode){case 70:if(!M.supportsIntegratedFind&&!e.shiftKey){M.findBar.open();t=!0}break;case 71:if(!M.supportsIntegratedFind){const e=M.findController.state;e&&M.findController.executeCommand("findagain",{query:e.query,phraseSearch:e.phraseSearch,caseSensitive:e.caseSensitive,entireWord:e.entireWord,ignoreAccents:e.ignoreAccents,fuzzySearch:e.fuzzySearch,highlightAll:e.highlightAll,findPrevious:5===s||12===s});t=!0}break;case 61:case 107:case 187:case 171:o||M.zoomIn();t=!0;break;case 173:case 109:case 189:o||M.zoomOut();t=!0;break;case 48:case 96:if(!o){setTimeout((function(){M.zoomReset()}));t=!1}break;case 38:if(o||M.page>1){M.page=1;t=!0;n=!0}break;case 40:if(o||M.page<M.pagesCount){M.page=M.pagesCount;t=!0;n=!0}}const{eventBus:l}=M;if(1===s||8===s)switch(e.keyCode){case 83:l.dispatch("download",{source:window});t=!0;break;case 79:l.dispatch("openfile",{source:window});t=!0}if(3===s||10===s)switch(e.keyCode){case 80:M.requestPresentationMode();t=!0;break;case 71:M.appConfig.toolbar.pageNumber.select();t=!0}if(t){n&&!o&&r.focus();e.preventDefault();return}const c=(0,i.getActiveOrFocusedElement)(),h=c&&c.tagName.toUpperCase();if(!("INPUT"===h||"TEXTAREA"===h||"SELECT"===h||c&&c.isContentEditable)||27===e.keyCode){if(0===s){let i=0,s=!1;switch(e.keyCode){case 38:case 33:r.isVerticalScrollbarEnabled&&(s=!0);i=-1;break;case 8:o||(s=!0);i=-1;break;case 37:r.isHorizontalScrollbarEnabled&&(s=!0);case 75:case 80:i=-1;break;case 27:if(M.secondaryToolbar.isOpen){M.secondaryToolbar.close();t=!0}if(!M.supportsIntegratedFind&&M.findBar.opened){M.findBar.close();t=!0}break;case 40:case 34:r.isVerticalScrollbarEnabled&&(s=!0);i=1;break;case 13:case 32:o||(s=!0);i=1;break;case 39:r.isHorizontalScrollbarEnabled&&(s=!0);case 74:case 78:i=1;break;case 36:if(o||M.page>1){M.page=1;t=!0;n=!0}break;case 35:if(o||M.page<M.pagesCount){M.page=M.pagesCount;t=!0;n=!0}break;case 83:M.pdfCursorTools.switchTool(a.CursorTool.SELECT);break;case 72:M.pdfCursorTools.switchTool(a.CursorTool.HAND);break;case 82:M.rotatePages(90);break;case 115:M.pdfSidebar.toggle()}if(0!==i&&(!s||"page-fit"===r.currentScaleValue)){i>0?M.page<M.pagesCount&&M.page++:M.page>1&&M.page--;t=!0}}if(4===s)switch(e.keyCode){case 13:case 32:if(!o&&"page-fit"!==r.currentScaleValue)break;M.page>1&&M.page--;t=!0;break;case 82:M.rotatePages(-90)}n&&!r.containsElement(c)&&r.focus();t&&e.preventDefault()}}function beforeUnload(e){e.preventDefault();e.returnValue="";return!1}function apiPageLayoutToSpreadMode(e){switch(e){case"SinglePage":case"OneColumn":return i.SpreadMode.NONE;case"TwoColumnLeft":case"TwoPageLeft":return i.SpreadMode.ODD;case"TwoColumnRight":case"TwoPageRight":return i.SpreadMode.EVEN}return i.SpreadMode.NONE}const V={instance:{supportsPrinting:!1,createPrintService(){throw new Error("Not implemented: createPrintService")}}};t.PDFPrintServiceFactory=V},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.isValidRotation=function isValidRotation(e){return Number.isInteger(e)&&e%90==0};t.isValidScrollMode=function isValidScrollMode(e){return Number.isInteger(e)&&Object.values(n).includes(e)&&e!==n.UNKNOWN};t.isValidSpreadMode=function isValidSpreadMode(e){return Number.isInteger(e)&&Object.values(i).includes(e)&&e!==i.UNKNOWN};t.isPortraitOrientation=function isPortraitOrientation(e){return e.width<=e.height};t.getPDFFileNameFromURL=function getPDFFileNameFromURL(e,t="document.pdf"){if(window.PDFViewerApplication.appConfig.filenameForDownload)return window.PDFViewerApplication.appConfig.filenameForDownload;if("string"!=typeof e)return t;if(function isDataSchema(e){let t=0;const n=e.length;for(;t<n&&""===e[t].trim();)t++;return"data:"===e.substring(t,t+5).toLowerCase()}(e)){console.warn('getPDFFileNameFromURL: ignoring "data:" URL for performance reasons.');return t}const n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let s=n.exec(i[1])||n.exec(i[2])||n.exec(i[3]);if(s){s=s[0];if(s.includes("%"))try{s=n.exec(decodeURIComponent(s))[0]}catch(e){}}return s||t};t.noContextMenuHandler=function noContextMenuHandler(e){e.preventDefault()};t.parseQueryString=function parseQueryString(e){const t=e.split("&"),n=Object.create(null);for(let e=0,i=t.length;e<i;++e){const i=t[e].split("="),s=i[0].toLowerCase(),r=i.length>1?i[1]:null;n[decodeURIComponent(s)]=decodeURIComponent(r)}return n};t.backtrackBeforeAllVisibleElements=backtrackBeforeAllVisibleElements;t.getVisibleElements=function getVisibleElements({scrollEl:e,views:t,sortByVisibility:n=!1,horizontal:i=!1,rtl:s=!1}){const r=e.scrollTop,a=r+e.clientHeight,o=e.scrollLeft,l=o+e.clientWidth;const c=[],h=t.length;let d=binarySearchFirstItem(t,i?function isElementNextAfterViewHorizontally(e){const t=e.div,n=t.offsetLeft+t.clientLeft,i=n+t.clientWidth;return s?n<l:i>o}:function isElementBottomAfterViewTop(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});d>0&&d<h&&!i&&(d=backtrackBeforeAllVisibleElements(d,t,r));let u=i?l:-1;for(let e=d;e<h;e++){const n=t[e],s=n.div,h=s.offsetLeft+s.clientLeft,d=s.offsetTop+s.clientTop,p=s.clientWidth,g=s.clientHeight,f=h+p,m=d+g;if(-1===u)m>=a&&(u=m);else if((i?h:d)>u)break;if(m<=r||d>=a||f<=o||h>=l)continue;const b=Math.max(0,r-d)+Math.max(0,m-a),_=Math.max(0,o-h)+Math.max(0,f-l),v=(g-b)*(p-_)*100/g/p|0;c.push({id:n.id,x:h,y:d,view:n,percent:v})}const p=c[0],g=c[c.length-1];n&&c.sort((function(e,t){const n=e.percent-t.percent;return Math.abs(n)>.001?-n:e.id-t.id}));return{first:p,last:g,views:c}};t.roundToDivide=function roundToDivide(e,t){const n=e%t;return 0===n?e:Math.round(e-n+t)};t.getPageSizeInches=function getPageSizeInches({view:e,userUnit:t,rotate:n}){const[i,s,r,a]=e,o=n%180!=0,l=(r-i)/72*t,c=(a-s)/72*t;return{width:o?c:l,height:o?l:c}};t.approximateFraction=function approximateFraction(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const n=e>1?t:e;let i,s=0,r=1,a=1,o=1;for(;;){const e=s+a,t=r+o;if(t>8)break;if(n<=e/t){a=e;o=t}else{s=e;r=t}}i=n-s/r<a/o-n?n===e?[s,r]:[r,s]:n===e?[a,o]:[o,a];return i};t.getOutputScale=function getOutputScale(e){const t=window.devicePixelRatio||1,n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.backingStorePixelRatio||1,i=t/n;return{sx:i,sy:i,scaled:1!==i}};t.scrollIntoView=function scrollIntoView(e,t,n=!1,i=!1){let s=e.offsetParent;if(!s){console.error("offsetParent is not set -- cannot scroll");return}let r=e.offsetTop+e.clientTop,a=e.offsetLeft+e.clientLeft;for(;s.clientHeight===s.scrollHeight&&s.clientWidth===s.scrollWidth||n&&"hidden"===getComputedStyle(s).overflow;){if(s.dataset._scaleY){r/=s.dataset._scaleY;a/=s.dataset._scaleX}r+=s.offsetTop;a+=s.offsetLeft;s=s.offsetParent;if(!s){if(i&&document.body.clientHeight>r){r-=32;window.scrollTo(window.scrollX,r)}return}}if(t){void 0!==t.top&&(r+=t.top);if(void 0!==t.left){a+=t.left;s.scrollLeft=a}}s.scrollTop=r};t.watchScroll=function watchScroll(e,t){const debounceScroll=function(s){i||(i=window.requestAnimationFrame((function viewAreaElementScrolled(){i=null;const s=e.scrollLeft,r=n.lastX;s!==r&&(n.right=s>r);n.lastX=s;const a=e.scrollTop,o=n.lastY;a!==o&&(n.down=a>o);n.lastY=a;t(n)})))},n={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:debounceScroll};let i=null;e.addEventListener("scroll",debounceScroll,!0);return n};t.binarySearchFirstItem=binarySearchFirstItem;t.normalizeWheelEventDirection=normalizeWheelEventDirection;t.normalizeWheelEventDelta=function normalizeWheelEventDelta(e){let t=normalizeWheelEventDirection(e);0===e.deltaMode?t/=900:1===e.deltaMode&&(t/=30);return t};t.waitOnEventOrTimeout=function waitOnEventOrTimeout({target:e,name:t,delay:n=0}){return new Promise((function(i,s){if("object"!=typeof e||!t||"string"!=typeof t||!(Number.isInteger(n)&&n>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function handler(n){e instanceof EventBus?e._off(t,a):e.removeEventListener(t,a);l&&clearTimeout(l);i(n)}const a=handler.bind(null,r.EVENT);e instanceof EventBus?e._on(t,a):e.addEventListener(t,a);const o=handler.bind(null,r.TIMEOUT),l=setTimeout(o,n)}))};t.moveToEndOfArray=function moveToEndOfArray(e,t){const n=[],i=e.length;let s=0;for(let r=0;r<i;++r)if(t(e[r]))n.push(e[r]);else{e[s]=e[r];++s}for(let t=0;s<i;++t,++s)e[s]=n[t]};t.getActiveOrFocusedElement=function getActiveOrFocusedElement(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t&&t.shadowRoot;){e=t.shadowRoot;t=e.activeElement||e.querySelector(":focus")}return t};t.WaitOnType=t.animationStarted=t.ProgressBar=t.EventBus=t.NullL10n=t.SpreadMode=t.ScrollMode=t.TextLayerMode=t.RendererType=t.PresentationModeState=t.VERTICAL_PADDING=t.SCROLLBAR_PADDING=t.MAX_AUTO_SCALE=t.UNKNOWN_SCALE=t.MAX_SCALE=t.MIN_SCALE=t.DEFAULT_SCALE=t.DEFAULT_SCALE_VALUE=t.CSS_UNITS=t.AutoPrintRegExp=void 0;t.CSS_UNITS=96/72;t.DEFAULT_SCALE_VALUE="auto";t.DEFAULT_SCALE=1;t.MIN_SCALE=.1;t.MAX_SCALE=10;t.UNKNOWN_SCALE=0;t.MAX_AUTO_SCALE=1.25;t.SCROLLBAR_PADDING=40;t.VERTICAL_PADDING=5;t.PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3};t.RendererType={CANVAS:"canvas",SVG:"svg"};t.TextLayerMode={DISABLE:0,ENABLE:1,ENABLE_ENHANCE:2};const n={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2};t.ScrollMode=n;const i={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};t.SpreadMode=i;t.AutoPrintRegExp=/\bprint\s*\(/;const s={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(e,t,n)=>function formatL10nValue(e,t){return t?e.replace(/\{\{\s*(\w+)\s*\}\}/g,((e,n)=>n in t?t[n]:"{{"+n+"}}")):e}(n,t),async translate(e){}};t.NullL10n=s;function binarySearchFirstItem(e,t){let n=0,i=e.length-1;if(i<0||!t(e[i]))return e.length;if(t(e[n]))return n;for(;n<i;){const s=n+i>>1;t(e[s])?i=s:n=s+1}return n}function backtrackBeforeAllVisibleElements(e,t,n){if(e<2)return e;let i=t[e].div,s=i.offsetTop+i.clientTop;if(s>=n){i=t[e-1].div;s=i.offsetTop+i.clientTop}for(let n=e-2;n>=0;--n){i=t[n].div;if(i.offsetTop+i.clientTop+i.clientHeight<=s)break;e=n}return e}function normalizeWheelEventDirection(e){let t=Math.sqrt(e.deltaX*e.deltaX+e.deltaY*e.deltaY);const n=Math.atan2(e.deltaY,e.deltaX);-.25*Math.PI<n&&n<.75*Math.PI&&(t=-t);return t}const r={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=r;const a=new Promise((function(e){window.requestAnimationFrame(e)}));t.animationStarted=a;class EventBus{constructor(e){this._listeners=Object.create(null)}on(e,t,n=null){this._on(e,t,{external:!0,once:n?.once})}off(e,t,n=null){this._off(e,t,{external:!0,once:n?.once})}dispatch(e){const t=this._listeners[e];if(!t||0===t.length)return;const n=Array.prototype.slice.call(arguments,1);let i;t.slice(0).forEach((({listener:t,external:s,once:r})=>{r&&this._off(e,t);s?(i||(i=[])).push(t):t.apply(null,n)}));if(i){i.forEach((e=>{e.apply(null,n)}));i=null}}_on(e,t,n=null){var i;((i=this._listeners)[e]||(i[e]=[])).push({listener:t,external:!0===n?.external,once:!0===n?.once})}_off(e,t,n=null){const i=this._listeners[e];if(i)for(let e=0,n=i.length;e<n;e++)if(i[e].listener===t){i.splice(e,1);return}}}t.EventBus=EventBus;t.ProgressBar=class ProgressBar{constructor(e,{height:t,width:n,units:i}={}){this.visible=!0;this.div=document.querySelector(e+" .progress");this.div&&(this.bar=this.div.parentNode);this.height=t||100;this.width=n||100;this.units=i||"%";this.div&&(this.div.style.height=this.height+this.units);this.percent=0}_updateBar(){if(this._indeterminate){this.div.classList.add("indeterminate");this.div.style.width=this.width+this.units;return}this.div&&this.div.classList.remove("indeterminate");const e=this.width*this._percent/100;this.div&&(this.div.style.width=e+this.units)}get percent(){return this._percent}set percent(e){this._indeterminate=isNaN(e);this._percent=function clamp(e,t,n){return Math.min(Math.max(e,t),n)}(e,0,100);this._updateBar()}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;if(t>0){document.documentElement.style.setProperty("--loadingBar-end-offset",`${t}px`)}}hide(){if(this.visible){this.visible=!1;this.div=document.querySelector(".body #mainContainer .progress");if(this.div){this.bar=this.div.parentNode;this.bar.classList.add("hidden")}document.body.classList.remove("loadingInProgress")}}show(){if(!this.visible){this.visible=!0;this.bar.classList.remove("hidden")}}}},e=>{e.exports=window["pdfjs-dist/build/pdf"]},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFCursorTools=t.CursorTool=void 0;var i=n(7),s=n(4);const r={SELECT:0,HAND:1,ZOOM:2};t.CursorTool=r;t.PDFCursorTools=class PDFCursorTools{constructor({container:e,eventBus:t,cursorToolOnLoad:n=r.SELECT}){this.container=e;this.eventBus=t;this.active=r.SELECT;this.activeBeforePresentationMode=null;this.handTool=new i.GrabToPan({element:this.container});this._addEventListeners();Promise.resolve().then((()=>{this.switchTool(n)}))}get activeTool(){return this.active}switchTool(e){if(null!==this.activeBeforePresentationMode)return;if(e===this.active)return;const disableActiveTool=()=>{switch(this.active){case r.SELECT:break;case r.HAND:this.handTool.deactivate()}};switch(e){case r.SELECT:disableActiveTool();break;case r.HAND:disableActiveTool();this.handTool.activate();break;case r.ZOOM:default:console.error(`switchTool: "${e}" is an unsupported value.`);return}this.active=e;this._dispatchEvent()}_dispatchEvent(){this.eventBus.dispatch("cursortoolchanged",{source:this,tool:this.active})}_addEventListeners(){this.eventBus._on("switchcursortool",(e=>{this.switchTool(e.tool)}));this.eventBus._on("presentationmodechanged",(e=>{switch(e.state){case s.PresentationModeState.CHANGING:break;case s.PresentationModeState.FULLSCREEN:{const e=this.active;this.switchTool(r.SELECT);this.activeBeforePresentationMode=e;break}case s.PresentationModeState.NORMAL:{const e=this.activeBeforePresentationMode;this.activeBeforePresentationMode=null;this.switchTool(e);break}}}))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GrabToPan=GrabToPan;function GrabToPan(e){this.element=e.element;this.document=e.element.ownerDocument;"function"==typeof e.ignoreTarget&&(this.ignoreTarget=e.ignoreTarget);this.onActiveChanged=e.onActiveChanged;this.activate=this.activate.bind(this);this.deactivate=this.deactivate.bind(this);this.toggle=this.toggle.bind(this);this._onmousedown=this._onmousedown.bind(this);this._onmousemove=this._onmousemove.bind(this);this._endPan=this._endPan.bind(this);(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}GrabToPan.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function GrabToPan_activate(){if(!this.active){this.active=!0;this.element.addEventListener("mousedown",this._onmousedown,!0);this.element.classList.add(this.CSS_CLASS_GRAB);this.onActiveChanged&&this.onActiveChanged(!0)}},deactivate:function GrabToPan_deactivate(){if(this.active){this.active=!1;this.element.removeEventListener("mousedown",this._onmousedown,!0);this._endPan();this.element.classList.remove(this.CSS_CLASS_GRAB);this.onActiveChanged&&this.onActiveChanged(!1)}},toggle:function GrabToPan_toggle(){this.active?this.deactivate():this.activate()},ignoreTarget:function GrabToPan_ignoreTarget(e){return e[n]("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function GrabToPan__onmousedown(e){if(0!==e.button||this.ignoreTarget(e.target))return;if(e.originalTarget)try{e.originalTarget.tagName}catch(e){return}this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=e.clientX;this.clientYStart=e.clientY;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-x"))return;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-y"))return;this.document.addEventListener("mousemove",this._onmousemove,!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);e.preventDefault();e.stopPropagation();const t=document.activeElement;t&&!t.contains(e.target)&&t.blur()},_onmousemove:function GrabToPan__onmousemove(e){this.element.removeEventListener("scroll",this._endPan,!0);if(function isLeftMouseReleased(e){if("buttons"in e&&i)return!(1&e.buttons);if(r||a)return 0===e.which;return!1}(e)){this._endPan();return}const t=e.clientX-this.clientXStart,n=e.clientY-this.clientYStart,s=this.scrollTopStart-n,o=this.scrollLeftStart-t;if(this.element.scrollTo)this.element.scrollTo({top:s,left:o,behavior:"instant"});else{this.element.scrollTop=s;this.element.scrollLeft=o}this.overlay.parentNode||document.body.appendChild(this.overlay)},_endPan:function GrabToPan__endPan(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onmousemove,!0);this.document.removeEventListener("mouseup",this._endPan,!0);this.overlay.remove()}};let n;["webkitM","mozM","m"].some((function(e){let t=e+"atches";t in document.documentElement&&(n=t);t+="Selector";t in document.documentElement&&(n=t);return n}));const i=!document.documentMode||document.documentMode>9,s=window.chrome,r=s&&(s.webstore||s.app),a=/Apple/.test(navigator.vendor)&&/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);function isOverPerfectScrollbar(e,t,n){const i=document.getElementsByClassName(n);if(i&&1===i.length){var{top:s,right:r,bottom:a,left:o}=i[0].getBoundingClientRect();if(t>=s&&t<=a&&e<=r&&e>=o)return!0}return!1}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFRenderingQueue=t.RenderingStates=void 0;var i=n(5);const s={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};t.RenderingStates=s;t.PDFRenderingQueue=class PDFRenderingQueue{constructor(){this.pdfViewer=null;this.pdfThumbnailViewer=null;this.onIdle=null;this.highestPriorityPage=null;this.idleTimeout=null;this.printing=!1;this.isThumbnailViewEnabled=!1}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}renderHighestPriority(e){if(this.idleTimeout){clearTimeout(this.idleTimeout);this.idleTimeout=null}this.pdfViewer.forceRendering(e)||this.pdfThumbnailViewer&&this.isThumbnailViewEnabled&&this.pdfThumbnailViewer.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,n){const i=e.views,s=i.length;if(0===s)return null;for(let e=0;e<s;++e){const t=i[e].view;if(!this.isViewFinished(t))return t}if(n){const n=e.last.id;if(t[n]&&!this.isViewFinished(t[n]))return t[n]}else{const n=e.first.id-2;if(t[n]&&!this.isViewFinished(t[n]))return t[n]}return null}isViewFinished(e){return e.renderingState===s.FINISHED}renderView(e){switch(e.renderingState){case s.FINISHED:return!1;case s.PAUSED:this.highestPriorityPage=e.renderingId;e.resume();break;case s.RUNNING:this.highestPriorityPage=e.renderingId;break;case s.INITIAL:this.highestPriorityPage=e.renderingId;e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof i.RenderingCancelledException||console.error(`renderView: "${e}"`)}))}return!0}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFSidebar=t.SidebarView=void 0;var i=n(4),s=n(8);const r="pdfSidebarNotification",a={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4};t.SidebarView=a;t.PDFSidebar=class PDFSidebar{constructor({elements:e,pdfViewer:t,pdfThumbnailViewer:n,eventBus:s,l10n:r=i.NullL10n,disableNotification:o=!1}){this.isOpen=!1;this.active=a.THUMBS;this.isInitialViewSet=!1;this.onToggled=null;this.pdfViewer=t;this.pdfThumbnailViewer=n;this.outerContainer=e.outerContainer;this.viewerContainer=e.viewerContainer;this.toggleButton=e.toggleButton;this.thumbnailButton=e.thumbnailButton;this.outlineButton=e.outlineButton;this.attachmentsButton=e.attachmentsButton;this.layersButton=e.layersButton;this.thumbnailView=e.thumbnailView;this.outlineView=e.outlineView;this.attachmentsView=e.attachmentsView;this.layersView=e.layersView;this.eventBus=s;this.l10n=r;this._disableNotification=o;this._addEventListeners()}reset(){this.isInitialViewSet=!1;this._hideUINotification(null);this.switchView(a.THUMBS);this.outlineButton.disabled=!1;this.attachmentsButton.disabled=!1;this.layersButton.disabled=!1;this.outlineButton.hidden=!1;this.attachmentsButton.hidden=!1;this.layersButton.hidden=!1}get visibleView(){return this.isOpen?this.active:a.NONE}get isThumbnailViewVisible(){return this.isOpen&&this.active===a.THUMBS}get isOutlineViewVisible(){return this.isOpen&&this.active===a.OUTLINE}get isAttachmentsViewVisible(){return this.isOpen&&this.active===a.ATTACHMENTS}get isLayersViewVisible(){return this.isOpen&&this.active===a.LAYERS}setInitialView(e=a.NONE){if(!this.isInitialViewSet){this.isInitialViewSet=!0;e!==a.NONE&&e!==a.UNKNOWN&&this._switchView(e,!0)||this._dispatchEvent()}}switchView(e,t=!1){this._switchView(e,t)}_switchView(e,t=!1){const n=e!==this.active;let i=!1;switch(e){case a.NONE:if(this.isOpen){this.close();return!0}return!1;case a.THUMBS:this.isOpen&&n&&(i=!0);break;case a.OUTLINE:if(this.outlineButton.disabled)return!1;break;case a.ATTACHMENTS:if(this.attachmentsButton.disabled)return!1;break;case a.LAYERS:if(this.layersButton.disabled)return!1;break;default:console.error(`PDFSidebar._switchView: "${e}" is not a valid view.`);return!1}this.active=e;this.thumbnailButton.classList.toggle("toggled",e===a.THUMBS);this.outlineButton.classList.toggle("toggled",e===a.OUTLINE);this.attachmentsButton.classList.toggle("toggled",e===a.ATTACHMENTS);this.layersButton.classList.toggle("toggled",e===a.LAYERS);this.thumbnailView.classList.toggle("hidden",e!==a.THUMBS);this.outlineView.classList.toggle("hidden",e!==a.OUTLINE);this.attachmentsView.classList.toggle("hidden",e!==a.ATTACHMENTS);this.layersView.classList.toggle("hidden",e!==a.LAYERS);if(t&&!this.isOpen){this.open();return!0}if(i){this._updateThumbnailViewer();this._forceRendering()}n&&this._dispatchEvent();this._hideUINotification(this.active);return n}open(){if(!this.isOpen){this.isOpen=!0;this.toggleButton.classList.add("toggled");this.outerContainer.classList.add("sidebarMoving","sidebarOpen");this.active===a.THUMBS&&this._updateThumbnailViewer();this._forceRendering();this._dispatchEvent();this._hideUINotification(this.active)}}close(){if(this.isOpen){this.isOpen=!1;this.toggleButton.classList.remove("toggled");this.outerContainer.classList.add("sidebarMoving");this.outerContainer.classList.remove("sidebarOpen");this._forceRendering();this._dispatchEvent()}}toggle(){this.isOpen?this.close():this.open()}_dispatchEvent(){this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}_forceRendering(){if(this.onToggled)this.onToggled();else{this.pdfViewer.forceRendering();this.pdfThumbnailViewer.forceRendering()}}_updateThumbnailViewer(){const{pdfViewer:e,pdfThumbnailViewer:t}=this,n=e.pagesCount;for(let i=0;i<n;i++){const n=e.getPageView(i);if(n&&n.renderingState===s.RenderingStates.FINISHED){t.getThumbnail(i).setImage(n)}}t.scrollThumbnailIntoView(e.currentPageNumber)}_showUINotification(e){if(!this._disableNotification){this.l10n.get("toggle_sidebar_notification2.title",null,"Toggle Sidebar (document contains outline/attachments/layers)").then((e=>{this.toggleButton.title=e}));if(this.isOpen){if(e===this.active)return}else this.toggleButton.classList.add(r);switch(e){case a.OUTLINE:this.outlineButton.classList.add(r);break;case a.ATTACHMENTS:this.attachmentsButton.classList.add(r);break;case a.LAYERS:this.layersButton.classList.add(r)}}}_hideUINotification(e){if(this._disableNotification)return;const removeNotification=e=>{switch(e){case a.OUTLINE:this.outlineButton.classList.remove(r);break;case a.ATTACHMENTS:this.attachmentsButton.classList.remove(r);break;case a.LAYERS:this.layersButton.classList.remove(r)}};if(this.isOpen||null===e){this.toggleButton.classList.remove(r);if(null===e){for(e in a)removeNotification(a[e]);this.l10n.get("toggle_sidebar.title",null,"Toggle Sidebar").then((e=>{this.toggleButton.title=e}))}else removeNotification(e)}}_addEventListeners(){this.viewerContainer.addEventListener("transitionend",(e=>{e.target===this.viewerContainer&&this.outerContainer.classList.remove("sidebarMoving")}));this.toggleButton.addEventListener("click",(()=>{this.toggle()}));this.thumbnailButton.addEventListener("click",(()=>{this.switchView(a.THUMBS)}));this.outlineButton.addEventListener("click",(()=>{this.switchView(a.OUTLINE)}));this.outlineButton.addEventListener("dblclick",(()=>{this.eventBus.dispatch("toggleoutlinetree",{source:this})}));this.attachmentsButton.addEventListener("click",(()=>{this.switchView(a.ATTACHMENTS)}));this.layersButton.addEventListener("click",(()=>{this.switchView(a.LAYERS)}));this.layersButton.addEventListener("dblclick",(()=>{this.eventBus.dispatch("resetlayers",{source:this})}));const onTreeLoaded=(e,t,n)=>{t.disabled=!e;t.hidden=!e;e?this._showUINotification(n):this.active===n&&this.switchView(a.THUMBS)};this.eventBus._on("outlineloaded",(e=>{onTreeLoaded(e.outlineCount,this.outlineButton,a.OUTLINE)}));this.eventBus._on("attachmentsloaded",(e=>{onTreeLoaded(e.attachmentsCount,this.attachmentsButton,a.ATTACHMENTS)}));this.eventBus._on("layersloaded",(e=>{onTreeLoaded(e.layersCount,this.layersButton,a.LAYERS)}));this.eventBus._on("presentationmodechanged",(e=>{e.state===i.PresentationModeState.NORMAL&&this.isThumbnailViewVisible&&this._updateThumbnailViewer()}))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.OverlayManager=void 0;t.OverlayManager=class OverlayManager{constructor(){this._overlays={};this._active=null;this._keyDownBound=this._keyDown.bind(this)}get active(){return this._active}async register(e,t,n=null,i=!1){let s;if(!(e&&t&&(s=t.parentNode)))throw new Error("Not enough parameters.");if(this._overlays[e])throw new Error("The overlay is already registered.");this._overlays[e]={element:t,container:s,callerCloseMethod:n,canForceClose:i}}async unregister(e){if(!this._overlays[e])throw new Error("The overlay does not exist.");if(this._active===e)throw new Error("The overlay cannot be removed while it is active.");delete this._overlays[e]}async open(e){if(!this._overlays[e])throw new Error("The overlay does not exist.");if(this._active){if(!this._overlays[e].canForceClose)throw this._active===e?new Error("The overlay is already active."):new Error("Another overlay is currently active.");this._closeThroughCaller()}this._active=e;this._overlays[this._active].element.classList.remove("hidden");this._overlays[this._active].container.classList.remove("hidden");window.addEventListener("keydown",this._keyDownBound)}async close(e){if(!this._overlays[e])throw new Error("The overlay does not exist.");if(!this._active)throw new Error("The overlay is currently not active.");if(this._active!==e)throw new Error("Another overlay is currently active.");this._overlays[this._active].container.classList.add("hidden");this._overlays[this._active].element.classList.add("hidden");this._active=null;window.removeEventListener("keydown",this._keyDownBound)}_keyDown(e){if(this._active&&27===e.keyCode){this._closeThroughCaller();e.preventDefault()}}_closeThroughCaller(){this._overlays[this._active].callerCloseMethod&&this._overlays[this._active].callerCloseMethod();this._active&&this.close(this._active)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PasswordPrompt=void 0;var i=n(4),s=n(5);t.PasswordPrompt=class PasswordPrompt{constructor(e,t,n=i.NullL10n){this.overlayName=e.overlayName;this.container=e.container;this.label=e.label;this.input=e.input;this.submitButton=e.submitButton;this.cancelButton=e.cancelButton;this.overlayManager=t;this.l10n=n;this.updateCallback=null;this.reason=null;this.submitButton.addEventListener("click",this.verify.bind(this));this.cancelButton.addEventListener("click",this.close.bind(this));this.input.addEventListener("keydown",(e=>{13===e.keyCode&&this.verify()}));this.overlayManager.register(this.overlayName,this.container,this.close.bind(this),!0)}open(){this.overlayManager.open(this.overlayName).then((()=>{this.input.type="password";this.input.focus();let e;e=this.reason===s.PasswordResponses.INCORRECT_PASSWORD?this.l10n.get("password_invalid",null,"Invalid password. Please try again."):this.l10n.get("password_label",null,"Enter the password to open this PDF file.");e.then((e=>{this.label.textContent=e}))}))}close(){this.overlayManager.close(this.overlayName).then((()=>{this.input.type="";this.input.value=""}))}verify(){const e=this.input.value;if(e&&e.length>0){this.close();this.updateCallback(e)}}setUpdateCallback(e,t){this.updateCallback=e;this.reason=t}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFAttachmentViewer=void 0;var i=n(5),s=n(13),r=n(2);const a=/\.pdf$/i;class PDFAttachmentViewer extends s.BaseTreeViewer{constructor(e){super(e);this.downloadManager=e.downloadManager;this.eventBus._on("fileattachmentannotation",this._appendAttachment.bind(this))}reset(e=!1){super.reset();this._attachments=null;e||(this._renderedCapability=(0,i.createPromiseCapability)());this._pendingDispatchEvent&&clearTimeout(this._pendingDispatchEvent);this._pendingDispatchEvent=null}_dispatchEvent(e){this._renderedCapability.resolve();if(this._pendingDispatchEvent){clearTimeout(this._pendingDispatchEvent);this._pendingDispatchEvent=null}0!==e?this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:e}):this._pendingDispatchEvent=setTimeout((()=>{this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:0});this._pendingDispatchEvent=null}))}_bindPdfLink(e,{content:t,filename:n}){let i;e.onclick=()=>{i||(i=URL.createObjectURL(new Blob([t],{type:"application/pdf"})));let e;e="?file="+encodeURIComponent(i+"#"+n);try{window.open(e)}catch(e){console.error(`_bindPdfLink: ${e}`);URL.revokeObjectURL(i);i=null;this.downloadManager.downloadData(t,n,"application/pdf")}return!1}}_bindLink(e,{content:t,filename:n}){e.onclick=()=>{const e=a.test(n)?"application/pdf":"";this.downloadManager.downloadData(t,n,e);return!1}}render({attachments:e,keepRenderedCapability:t=!1}){this._attachments&&this.reset(t);this._attachments=e||null;if(!e){this._dispatchEvent(0);return}const n=Object.keys(e).sort((function(e,t){return e.toLowerCase().localeCompare(t.toLowerCase())})),s=document.createDocumentFragment();let o=0;for(const t of n){const n=e[t],l=(0,i.getFilenameFromUrl)(n.filename),c=document.createElement("div");c.className="treeItem";const h=document.createElement("a");a.test(l)&&!r.viewerCompatibilityParams.disableCreateObjectURL?this._bindPdfLink(h,{content:n.content,filename:l}):this._bindLink(h,{content:n.content,filename:l});h.textContent=this._normalizeTextContent(l);c.appendChild(h);s.appendChild(c);o++}this._finishRendering(s,o)}_appendAttachment({id:e,filename:t,content:n}){const i=this._renderedCapability.promise;i.then((()=>{if(i!==this._renderedCapability.promise)return;let s=this._attachments;if(s){for(const t in s)if(e===t)return}else s=Object.create(null);s[e]={filename:t,content:n};this.render({attachments:s,keepRenderedCapability:!0})}))}}t.PDFAttachmentViewer=PDFAttachmentViewer},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BaseTreeViewer=void 0;var i=n(5);class BaseTreeViewer{constructor(e){if(this.constructor===BaseTreeViewer)throw new Error("Cannot initialize BaseTreeViewer.");this.container=e.container;this.eventBus=e.eventBus;this.reset()}reset(){this._lastToggleIsShow=!0;this.container.textContent="";this.container.classList.remove("treeWithDeepNesting")}_dispatchEvent(e){throw new Error("Not implemented: _dispatchEvent")}_bindLink(e,t){throw new Error("Not implemented: _bindLink")}_normalizeTextContent(e){return(0,i.removeNullCharacters)(e)||"–"}_addToggleButton(e,t=!1){const n=document.createElement("div");n.className="treeItemToggler";t&&n.classList.add("treeItemsHidden");n.onclick=t=>{t.stopPropagation();n.classList.toggle("treeItemsHidden");if(t.shiftKey){const t=!n.classList.contains("treeItemsHidden");this._toggleTreeItem(e,t)}};e.insertBefore(n,e.firstChild)}_toggleTreeItem(e,t=!1){this._lastToggleIsShow=t;for(const n of e.querySelectorAll(".treeItemToggler"))n.classList.toggle("treeItemsHidden",!t)}_toggleAllTreeItems(){this._toggleTreeItem(this.container,!this._lastToggleIsShow)}_finishRendering(e,t,n=!1){if(n){this.container.classList.add("treeWithDeepNesting");this._lastToggleIsShow=!e.querySelector(".treeItemsHidden")}this.container.appendChild(e);this._dispatchEvent(t)}render(e){throw new Error("Not implemented: render")}}t.BaseTreeViewer=BaseTreeViewer},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFDocumentProperties=void 0;var i=n(5),s=n(4);const r=["en-us","en-lr","my"],a={"8.5x11":"Letter","8.5x14":"Legal"},o={"297x420":"A3","210x297":"A4"};function getPageName(e,t,n){return n[`${t?e.width:e.height}x${t?e.height:e.width}`]}t.PDFDocumentProperties=class PDFDocumentProperties{constructor({overlayName:e,fields:t,container:n,closeButton:i},a,o,l=s.NullL10n){this.overlayName=e;this.fields=t;this.container=n;this.overlayManager=a;this.l10n=l;this._reset();i.addEventListener("click",this.close.bind(this));this.overlayManager.register(this.overlayName,this.container,this.close.bind(this));o._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));o._on("rotationchanging",(e=>{this._pagesRotation=e.pagesRotation}));this._isNonMetricLocale=!0;l.getLanguage().then((e=>{this._isNonMetricLocale=r.includes(e)}))}async open(){const freezeFieldData=e=>{Object.defineProperty(this,"fieldData",{value:Object.freeze(e),writable:!1,enumerable:!0,configurable:!0})};await Promise.all([this.overlayManager.open(this.overlayName),this._dataAvailableCapability.promise]);const e=this._currentPageNumber,t=this._pagesRotation;if(this.fieldData&&e===this.fieldData._currentPageNumber&&t===this.fieldData._pagesRotation){this._updateUI();return}const{info:n,contentDispositionFilename:i,contentLength:r}=await this.pdfDocument.getMetadata(),[a,o,l,c,h,d]=await Promise.all([i||(0,s.getPDFFileNameFromURL)(this.url),this._parseFileSize(r),this._parseDate(n.CreationDate),this._parseDate(n.ModDate),this.pdfDocument.getPage(e).then((e=>this._parsePageSize((0,s.getPageSizeInches)(e),t))),this._parseLinearization(n.IsLinearized)]);freezeFieldData({fileName:a,fileSize:o,title:n.Title,author:n.Author,subject:n.Subject,keywords:n.Keywords,creationDate:l,modificationDate:c,creator:n.Creator,producer:n.Producer,version:n.PDFFormatVersion,pageCount:this.pdfDocument.numPages,pageSize:h,linearized:d,_currentPageNumber:e,_pagesRotation:t});this._updateUI();const{length:u}=await this.pdfDocument.getDownloadInfo();if(r===u)return;const p=Object.assign(Object.create(null),this.fieldData);p.fileSize=await this._parseFileSize(u);freezeFieldData(p);this._updateUI()}close(){this.overlayManager.close(this.overlayName)}setDocument(e,t=null){if(this.pdfDocument){this._reset();this._updateUI(!0)}if(e){this.pdfDocument=e;this.url=t;this._dataAvailableCapability.resolve()}}_reset(){this.pdfDocument=null;this.url=null;delete this.fieldData;this._dataAvailableCapability=(0,i.createPromiseCapability)();this._currentPageNumber=1;this._pagesRotation=0}_updateUI(e=!1){if(!e&&this.fieldData){if(this.overlayManager.active===this.overlayName)for(const e in this.fields){const t=this.fieldData[e];this.fields[e].textContent=t||0===t?t:"-"}}else for(const e in this.fields)this.fields[e].textContent="-"}async _parseFileSize(e=0){const t=e/1024;if(t)return t<1024?this.l10n.get("document_properties_kb",{size_kb:(+t.toPrecision(3)).toLocaleString(),size_b:e.toLocaleString()},"{{size_kb}} KB ({{size_b}} bytes)"):this.l10n.get("document_properties_mb",{size_mb:(+(t/1024).toPrecision(3)).toLocaleString(),size_b:e.toLocaleString()},"{{size_mb}} MB ({{size_b}} bytes)")}async _parsePageSize(e,t){if(!e)return;t%180!=0&&(e={width:e.height,height:e.width});const n=(0,s.isPortraitOrientation)(e);let i={width:Math.round(100*e.width)/100,height:Math.round(100*e.height)/100},r={width:Math.round(25.4*e.width*10)/10,height:Math.round(25.4*e.height*10)/10},l=null,c=getPageName(i,n,a)||getPageName(r,n,o);if(!(c||Number.isInteger(r.width)&&Number.isInteger(r.height))){const t={width:25.4*e.width,height:25.4*e.height},s={width:Math.round(r.width),height:Math.round(r.height)};if(Math.abs(t.width-s.width)<.1&&Math.abs(t.height-s.height)<.1){c=getPageName(s,n,o);if(c){i={width:Math.round(s.width/25.4*100)/100,height:Math.round(s.height/25.4*100)/100};r=s}}}c&&(l=this.l10n.get("document_properties_page_size_name_"+c.toLowerCase(),null,c));return Promise.all([this._isNonMetricLocale?i:r,this.l10n.get("document_properties_page_size_unit_"+(this._isNonMetricLocale?"inches":"millimeters"),null,this._isNonMetricLocale?"in":"mm"),l,this.l10n.get("document_properties_page_size_orientation_"+(n?"portrait":"landscape"),null,n?"portrait":"landscape")]).then((([{width:e,height:t},n,i,s])=>this.l10n.get("document_properties_page_size_dimension_"+(i?"name_":"")+"string",{width:e.toLocaleString(),height:t.toLocaleString(),unit:n,name:i,orientation:s},"{{width}} × {{height}} {{unit}} ("+(i?"{{name}}, ":"")+"{{orientation}})")))}async _parseDate(e){const t=i.PDFDateString.toDateObject(e);if(t)return this.l10n.get("document_properties_date_string",{date:t.toLocaleDateString(),time:t.toLocaleTimeString()},"{{date}}, {{time}}")}_parseLinearization(e){return this.l10n.get("document_properties_linearized_"+(e?"yes":"no"),null,e?"Yes":"No")}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFFindBar=void 0;var i=n(16),s=n(4);t.PDFFindBar=class PDFFindBar{constructor(e,t,n=s.NullL10n){this.opened=!1;this.bar=e.bar||null;this.toggleButton=e.toggleButton||null;this.findField=e.findField||null;this.findFieldMultiline=e.findFieldMultiline||null;this.highlightAll=e.highlightAllCheckbox||null;this.caseSensitive=e.caseSensitiveCheckbox||null;this.entireWord=e.entireWordCheckbox||null;this.multipleSearchTexts=e.findMultipleSearchTextsCheckbox||null;this.ignoreAccents=e.ignoreAccentsCheckbox||null;this.fuzzySearch=e.fuzzyCheckbox||null;this.findMsg=e.findMsg||null;this.findResultsCount=e.findResultsCount||null;this.findPreviousButton=e.findPreviousButton||null;this.findNextButton=e.findNextButton||null;this.eventBus=t;this.l10n=n;this.toggleButton.addEventListener("click",(()=>{this.toggle()}));this.findFieldMultiline.addEventListener("input",(()=>{this.dispatchEvent("")}));this.findField.addEventListener("input",(()=>{this.dispatchEvent("")}));this.bar.addEventListener("keydown",(e=>{switch(e.keyCode){case 13:e.target===this.findField&&this.dispatchEvent("again",e.shiftKey);break;case 27:this.close()}}));this.findPreviousButton.addEventListener("click",(()=>{this.dispatchEvent("again",!0)}));this.findNextButton.addEventListener("click",(()=>{this.dispatchEvent("again",!1)}));this.highlightAll.addEventListener("click",(()=>{this.dispatchEvent("highlightallchange")}));this.caseSensitive.addEventListener("click",(()=>{this.dispatchEvent("casesensitivitychange")}));this.entireWord.addEventListener("click",(()=>{this.dispatchEvent("entirewordchange")}));this.multipleSearchTexts.addEventListener("click",(()=>{this.dispatchEvent("multiplesearchtextschange")}));this.ignoreAccents.addEventListener("click",(()=>{this.dispatchEvent("ignoreAccentsChange")}));this.fuzzySearch.addEventListener("click",(()=>{this.dispatchEvent("fuzzySearchChange")}));this.eventBus._on("resize",this._adjustWidth.bind(this))}reset(){this.updateUIState()}dispatchEvent(e,t){this.eventBus.dispatch("find",{source:this,type:e,query:this.findFieldMultiline.classList.contains("hidden")?this.findField.value:this.findFieldMultiline.value,phraseSearch:!this.multipleSearchTexts.checked,caseSensitive:this.caseSensitive.checked,entireWord:this.entireWord.checked,ignoreAccents:this.ignoreAccents.checked,fuzzySearch:this.fuzzySearch.checked,highlightAll:this.highlightAll.checked,findPrevious:t})}updateUIState(e,t,n){let s="",r="";switch(e){case i.FindState.FOUND:break;case i.FindState.PENDING:r="pending";break;case i.FindState.NOT_FOUND:s=this.l10n.get("find_not_found",null,"Phrase not found");r="notFound";break;case i.FindState.WRAPPED:s=t?this.l10n.get("find_reached_top",null,"Reached top of document, continued from bottom"):this.l10n.get("find_reached_bottom",null,"Reached end of document, continued from top")}this.findField.setAttribute("data-status",r);this.findFieldMultiline.classList.toggle("notFound","notFound"===r);this.findFieldMultiline.setAttribute("data-status",r);Promise.resolve(s).then((e=>{this.findMsg.textContent=e;this._adjustWidth()}));this.updateResultsCount(n)}updateResultsCount({current:e=0,total:t=0}={}){if(!this.findResultsCount)return;const n=1e3;let i="";t>0&&(i=t>n?this.l10n.get("find_match_count_limit",{limit:n},"More than {{limit}} matches"):this.l10n.get("find_match_count",{current:e,total:t},"{{current}} of {{total}} match"+(1!==t?"es":"")));Promise.resolve(i).then((e=>{this.findResultsCount.textContent=e;this.findResultsCount.classList.toggle("hidden",!t);this._adjustWidth()}))}open(){if(!this.opened){this.opened=!0;this.toggleButton.classList.add("toggled");this.bar.classList.remove("hidden")}this.findField.select();this.findField.focus();this.dispatchEvent("");this._adjustWidth()}close(){if(this.opened){this.opened=!1;this.toggleButton.classList.remove("toggled");this.bar.classList.add("hidden");this.eventBus.dispatch("findbarclose",{source:this})}}toggle(){this.opened?this.close():this.open()}_adjustWidth(){if(!this.opened)return;this.bar.classList.remove("wrapContainers");this.bar.clientHeight>this.bar.firstElementChild.clientHeight&&this.bar.classList.add("wrapContainers")}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFFindController=t.FindState=void 0;var i=n(5),s=n(17),r=n(18),a=n(19),o=n(4);const l={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};t.FindState=l;const c={"‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"};let h=null;function normalize(e){if(!h){const e=Object.keys(c).join("");h=new RegExp(`[${e}]`,"g")}return e.replace(h,(function(e){return c[e]}))}t.PDFFindController=class PDFFindController{constructor({linkService:e,eventBus:t,pageViewMode:n}){this._linkService=e;this._eventBus=t;this._pageViewMode=n;this._reset();t._on("findbarclose",this._onFindBarClose.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesColor(){return this._pageMatchesColor}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this._state}setDocument(e){this._pdfDocument&&this._reset();if(e){this._pdfDocument=e;this._firstPageCapability.resolve()}}executeCommand(e,t){if(!t)return;const n=this._pdfDocument;(null===this._state||this._shouldDirtyMatch(e,t))&&(this._dirtyMatch=!0);this._state=t;"findhighlightallchange"!==e&&this._updateUIState(l.PENDING);this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||n&&this._pdfDocument!==n)return;this._extractText();const t=!this._highlightMatches,i=!!this._findTimeout;if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if("find"===e)this._findTimeout=setTimeout((()=>{this._nextMatch();this._findTimeout=null}),250);else if(this._dirtyMatch)this._nextMatch();else if("findagain"===e){this._nextMatch();t&&this._state.highlightAll&&this._updateAllPages()}else if("findhighlightallchange"===e){i?this._nextMatch():this._highlightMatches=!0;this._updateAllPages()}else this._nextMatch()}))}scrollMatchIntoView({element:e=null,pageIndex:t=-1,matchIndex:n=-1}){if(!this._scrollMatches||!e)return;if(-1===n||n!==this._selected.matchIdx)return;if(-1===t||t!==this._selected.pageIdx)return;this._scrollMatches=!1;const i={top:-50,left:-400};(0,o.scrollIntoView)(e,i,!0,"infinite-scroll"===this._pageViewMode)}_reset(){this._highlightMatches=!1;this._scrollMatches=!1;this._pdfDocument=null;this._pageMatches=[];this._pageMatchesLength=[];this._pageMatchesColor=[];this._state=null;this._selected={pageIdx:-1,matchIdx:-1};this._offset={pageIdx:null,matchIdx:null,wrapped:!1};this._extractTextPromises=[];this._pageContents=[];this._matchesCountTotal=0;this._pagesToSearch=null;this._pendingFindMatches=Object.create(null);this._resumePageIdx=null;this._dirtyMatch=!1;clearTimeout(this._findTimeout);this._findTimeout=null;this._firstPageCapability=(0,i.createPromiseCapability)()}get _query(){if(this._state.query!==this._rawQuery){this._rawQuery=this._state.query;this._normalizedQuery=normalize(this._state.query)}return this._normalizedQuery}_shouldDirtyMatch(e,t){if(t.query!==this._state.query)return!0;switch(e){case"findagain":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!t.isPageVisible(e);case"findhighlightallchange":return!1}return!0}_prepareMatches(e,t,n,i){function isSubTerm(t){const n=e[t],i=e[t+1];if(t<e.length-1&&n.match===i.match){n.skipped=!0;return!0}for(let i=t-1;i>=0;i--){const t=e[i];if(!t.skipped){if(t.match+t.matchLength<n.match)break;if(t.match+t.matchLength>=n.match+n.matchLength){n.skipped=!0;return!0}}}return!1}e.sort((function(e,t){return e.match===t.match?e.matchLength-t.matchLength:e.match-t.match}));for(let s=0,r=e.length;s<r;s++)if(!isSubTerm(s)){t.push(e[s].match);n.push(e[s].matchLength);i.push(e[s].color)}}_isEntireWord(e,t,n){if(t>0){const n=e.charCodeAt(t),i=e.charCodeAt(t-1);if((0,r.getCharacterType)(n)===(0,r.getCharacterType)(i))return!1}const i=t+n-1;if(i<e.length-1){const t=e.charCodeAt(i),n=e.charCodeAt(i+1);if((0,r.getCharacterType)(t)===(0,r.getCharacterType)(n))return!1}return!0}_calculateFuzzyMatch(e,t,n){const i=[],s=e.length,r=s<5?s:5,o=Math.round(s/5),l=e.substring(0,r),c={useCollator:!0};for(let t=0;t<n.length-s;t++){const h=n.substring(t,t+r);if(a.Levenshtein.distance(l,h,c)<3){const r=n.substring(t,t+s);if(a.Levenshtein.distance(e,r,c)<=o){i.push(t);t+=s-1}}}this._pageMatches[t]=i}_calculatePhraseMatch(e,t,n,i,r){if(r){n=(0,s.deburr)(n);e=(0,s.deburr)(e)}const a=[],o=e.length;let l=-o;for(;;){l=n.indexOf(e,l+o);if(-1===l)break;i&&!this._isEntireWord(n,l,o)||a.push(l)}this._pageMatches[t]=a}_calculateWordMatch(e,t,n,i,r){if(r){n=(0,s.deburr)(n);e=(0,s.deburr)(e)}const a=[],o=e.includes("\n")?e.trim().split(/\n+/g):e.trim().match(/\S+/g);for(let e=0,t=o.length;e<t;e++){const t=o[e],s=t.length;if(0===s)continue;let r=-s;for(;;){r=n.indexOf(t,r+s);if(-1===r)break;i&&!this._isEntireWord(n,r,s)||a.push({match:r,matchLength:s,skipped:!1,color:e})}}this._pageMatchesLength[t]=[];this._pageMatchesColor[t]=[];this._pageMatches[t]=[];this._prepareMatches(a,this._pageMatches[t],this._pageMatchesLength[t],this._pageMatchesColor[t])}_calculateMatch(e){let t=this._pageContents[e],n=this._query;const{caseSensitive:i,entireWord:s,ignoreAccents:r,fuzzySearch:a,phraseSearch:o}=this._state;if(0===n.length)return;if(!i){t=t.toLowerCase();n=n.toLowerCase()}a?n.length<=2?this._calculatePhraseMatch(n,e,t,!1):this._calculateFuzzyMatch(n,e,t):o?this._calculatePhraseMatch(n,e,t,s,r):this._calculateWordMatch(n,e,t,s,r);this._state.highlightAll&&this._updatePage(e);if(this._resumePageIdx===e){this._resumePageIdx=null;this._nextPageMatch()}const l=this._pageMatches[e].length;if(l>0){this._matchesCountTotal+=l;this._updateUIResultsCount()}}_extractText(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();for(let t=0,n=this._linkService.pagesCount;t<n;t++){const n=(0,i.createPromiseCapability)();this._extractTextPromises[t]=n.promise;e=e.then((()=>this._pdfDocument.getPage(t+1).then((e=>e.getTextContent({normalizeWhitespace:!0}))).then((e=>{const i=e.items,s=[];for(let e=0,t=i.length;e<t;e++)s.push(i[e].str);this._pageContents[t]=normalize(s.join(""));n.resolve(t)}),(e=>{console.error(`Unable to get text content for page ${t+1}`,e);this._pageContents[t]="";n.resolve(t)}))))}}_updatePage(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1);this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}_updateAllPages(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}_nextMatch(){const e=this._state.findPrevious,t=this._linkService.page-1,n=this._linkService.pagesCount;this._highlightMatches=!0;if(this._dirtyMatch){this._dirtyMatch=!1;this._selected.pageIdx=this._selected.matchIdx=-1;this._offset.pageIdx=t;this._offset.matchIdx=null;this._offset.wrapped=!1;this._resumePageIdx=null;this._pageMatches.length=0;this._pageMatchesLength.length=0;this._pageMatchesColor.length=0;this._matchesCountTotal=0;this._updateAllPages();for(let e=0;e<n;e++)if(!0!==this._pendingFindMatches[e]){this._pendingFindMatches[e]=!0;this._extractTextPromises[e].then((e=>{delete this._pendingFindMatches[e];this._calculateMatch(e)}))}}if(""===this._query){this._updateUIState(l.FOUND);return}if(this._resumePageIdx)return;const i=this._offset;this._pagesToSearch=n;if(null!==i.matchIdx){const t=this._pageMatches[i.pageIdx].length;if(!e&&i.matchIdx+1<t||e&&i.matchIdx>0){i.matchIdx=e?i.matchIdx-1:i.matchIdx+1;this._updateMatch(!0);return}this._advanceOffsetPage(e)}this._nextPageMatch()}_matchesReady(e){const t=this._offset,n=e.length,i=this._state.findPrevious;if(n){t.matchIdx=i?n-1:0;this._updateMatch(!0);return!0}this._advanceOffsetPage(i);if(t.wrapped){t.matchIdx=null;if(this._pagesToSearch<0){this._updateMatch(!1);return!0}}return!1}_nextPageMatch(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;e=this._pageMatches[t];if(!e){this._resumePageIdx=t;break}}while(!this._matchesReady(e))}_advanceOffsetPage(e){const t=this._offset,n=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1;t.matchIdx=null;this._pagesToSearch--;if(t.pageIdx>=n||t.pageIdx<0){t.pageIdx=e?n-1:0;t.wrapped=!0}}_updateMatch(e=!1){let t=l.NOT_FOUND;const n=this._offset.wrapped;this._offset.wrapped=!1;if(e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx;this._selected.matchIdx=this._offset.matchIdx;t=n?l.WRAPPED:l.FOUND;-1!==e&&e!==this._selected.pageIdx&&this._updatePage(e)}this._updateUIState(t,this._state.findPrevious);if(-1!==this._selected.pageIdx){this._scrollMatches=!0;this._updatePage(this._selected.pageIdx)}}_onFindBarClose(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{if(this._pdfDocument&&(!t||this._pdfDocument===t)){if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(this._resumePageIdx){this._resumePageIdx=null;this._dirtyMatch=!0}this._updateUIState(l.FOUND);this._highlightMatches=!1;this._updateAllPages()}}))}_requestMatchesCount(){const{pageIdx:e,matchIdx:t}=this._selected;let n=0,i=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)n+=this._pageMatches[t]&&this._pageMatches[t].length||0;n+=t+1}(n<1||n>i)&&(n=i=0);return{current:n,total:i}}_updateUIResultsCount(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this._requestMatchesCount()})}_updateUIState(e,t){this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this._requestMatchesCount(),rawQuery:this._state?this._state.query:null})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.deburr=function deburr(e){return(e=function toString(e){return null==e?"":function baseToString(e){if("string"==typeof e)return e;if(function isSymbol(e){return"symbol"==typeof e||function isObjectLike(e){return!!e&&"object"==typeof e}(e)&&c.call(e)==n}(e))return u?u.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(e))&&e.replace(i,l).replace(s,"")};var n="[object Symbol]",i=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,s=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),r="object"==typeof global&&global&&global.Object===Object&&global,a="object"==typeof self&&self&&self.Object===Object&&self,o=r||a||Function("return this")();var l=function basePropertyOf(e){return function(t){return null==e?void 0:e[t]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","Ĳ":"IJ","ĳ":"ij","Œ":"Oe","œ":"oe","ŉ":"'n","ſ":"ss"}),c=Object.prototype.toString,h=o.Symbol,d=h?h.prototype:void 0,u=d?d.toString:void 0},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.getCharacterType=function getCharacterType(e){if(function isAlphabeticalScript(e){return e<11904}(e))return function isAscii(e){return 0==(65408&e)}(e)?function isAsciiSpace(e){return 32===e||9===e||13===e||10===e}(e)?n.SPACE:function isAsciiAlpha(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function isAsciiDigit(e){return e>=48&&e<=57}(e)||95===e?n.ALPHA_LETTER:n.PUNCT:function isThai(e){return 3584==(65408&e)}(e)?n.THAI_LETTER:160===e?n.SPACE:n.ALPHA_LETTER;if(function isHan(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e))return n.HAN_LETTER;if(function isKatakana(e){return e>=12448&&e<=12543}(e))return n.KATAKANA_LETTER;if(function isHiragana(e){return e>=12352&&e<=12447}(e))return n.HIRAGANA_LETTER;if(function isHalfwidthKatakana(e){return e>=65376&&e<=65439}(e))return n.HALFWIDTH_KATAKANA_LETTER;return n.ALPHA_LETTER};t.CharacterType=void 0;const n={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};t.CharacterType=n},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Levenshtein=void 0;let n;try{n=Intl.Collator("und",{sensitivity:"base"})}catch(e){try{n=Intl.Collator("generic",{sensitivity:"base"})}catch(e){n=void 0}}const i=[],s=[];t.Levenshtein=class Levenshtein{static distance(e,t,r){const a=r&&n&&r.useCollator,o=e.length,l=t.length;if(0===o)return l;if(0===l)return o;let c,h,d,u,p,g;for(d=0;d<l;++d){i[d]=d;s[d]=t.charCodeAt(d)}i[l]=l;if(a)for(d=0;d<o;++d){h=d+1;for(u=0;u<l;++u){c=h;g=0===n.compare(e.charAt(d),String.fromCharCode(s[u]));h=i[u]+(g?0:1);p=c+1;h>p&&(h=p);p=i[u+1]+1;h>p&&(h=p);i[u]=c}i[u]=h}else for(d=0;d<o;++d){h=d+1;for(u=0;u<l;++u){c=h;g=e.charCodeAt(d)===s[u];h=i[u]+(g?0:1);p=c+1;h>p&&(h=p);p=i[u+1]+1;h>p&&(h=p);i[u]=c}i[u]=h}return h}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.isDestHashesEqual=isDestHashesEqual;t.isDestArraysEqual=isDestArraysEqual;t.PDFHistory=void 0;var i=n(4);function getCurrentHash(){return document.location.hash}t.PDFHistory=class PDFHistory{constructor({linkService:e,eventBus:t}){this.linkService=e;this.eventBus=t;this._initialized=!1;this._fingerprint="";this.reset();this._boundEvents=null;this._isViewerInPresentationMode=!1;this.eventBus._on("presentationmodechanged",(e=>{this._isViewerInPresentationMode=e.state!==i.PresentationModeState.NORMAL}));this.eventBus._on("pagesinit",(()=>{this._isPagesLoaded=!1;this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount}),{once:!0})}))}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:n=!1}){if(!e||"string"!=typeof e){console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const i=""!==this._fingerprint&&this._fingerprint!==e;this._fingerprint=e;this._updateUrl=!0===n;this._initialized=!0;this._bindEvents();const s=window.history.state;this._popStateInProgress=!1;this._blockHashChange=0;this._currentHash=getCurrentHash();this._numPositionUpdates=0;this._uid=this._maxUid=0;this._destination=null;this._position=null;if(!this._isValidState(s,!0)||t){const{hash:e,page:n,rotation:s}=this._parseCurrentHash(!0);if(!e||i||t){this._pushOrReplaceState(null,!0);return}this._pushOrReplaceState({hash:e,page:n,rotation:s},!0);return}const r=s.destination;this._updateInternalState(r,s.uid,!0);void 0!==r.rotation&&(this._initialRotation=r.rotation);if(r.dest){this._initialBookmark=JSON.stringify(r.dest);this._destination.page=null}else r.hash?this._initialBookmark=r.hash:r.page&&(this._initialBookmark=`page=${r.page}`)}reset(){if(this._initialized){this._pageHide();this._initialized=!1;this._unbindEvents()}if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._initialBookmark=null;this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:n}){if(!this._initialized)return;if(e&&"string"!=typeof e){console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);return}if(!Array.isArray(t)){console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}if(!(Number.isInteger(n)&&n>0&&n<=this.linkService.pagesCount)&&(null!==n||this._destination)){console.error(`PDFHistory.push: "${n}" is not a valid pageNumber parameter.`);return}const i=e||JSON.stringify(t);if(!i)return;let s=!1;if(this._destination&&(isDestHashesEqual(this._destination.hash,i)||isDestArraysEqual(this._destination.dest,t))){if(this._destination.page)return;s=!0}if(!this._popStateInProgress||s){this._pushOrReplaceState({dest:t,hash:i,page:n,rotation:this.linkService.rotation},s);if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}pushPage(e){if(this._initialized)if(Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount){if(this._destination?.page!==e&&!this._popStateInProgress){this._pushOrReplaceState({hash:`page=${e}`,page:e,rotation:this.linkService.rotation});if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}else console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`)}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){const n=t||!this._destination,i={fingerprint:this._fingerprint,uid:n?this._uid:this._uid+1,destination:e};this._updateInternalState(e,i.uid);let s;if(this._updateUrl&&e?.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(s=`${t}#${e.hash}`)}n?window.history.replaceState(i,"",s):window.history.pushState(i,"",s)}_tryPushCurrentPosition(e=!1){if(!this._position)return;let t=this._position;if(e){t=Object.assign(Object.create(null),this._position);t.temporary=!0}if(!this._destination){this._pushOrReplaceState(t);return}if(this._destination.temporary){this._pushOrReplaceState(t,!0);return}if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let n=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(this._destination.dest||!this._destination.first)return;n=!0}this._pushOrReplaceState(t,n)}_isValidState(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&(null!==e.destination&&"object"==typeof e.destination)}_updateInternalState(e,t,n=!1){if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}n&&e?.temporary&&delete e.temporary;this._destination=e;this._uid=t;this._maxUid=Math.max(this._maxUid,t);this._numPositionUpdates=0}_parseCurrentHash(e=!1){const t=unescape(getCurrentHash()).substring(1),n=(0,i.parseQueryString)(t),s=n.nameddest||"";let r=0|n.page;Number.isInteger(r)&&r>0&&r<=this.linkService.pagesCount&&!(e&&s.length>0)||(r=null);return{hash:t,page:r,rotation:this.linkService.rotation}}_updateViewarea({location:e}){if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._position={hash:this._isViewerInPresentationMode?`page=${e.pageNumber}`:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation};if(!this._popStateInProgress){this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++;this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0);this._updateViewareaTimeout=null}),1e3)}}_popState({state:e}){const t=getCurrentHash(),n=this._currentHash!==t;this._currentHash=t;if(!e){this._uid++;const{hash:e,page:t,rotation:n}=this._parseCurrentHash();this._pushOrReplaceState({hash:e,page:t,rotation:n},!0);return}if(!this._isValidState(e))return;this._popStateInProgress=!0;if(n){this._blockHashChange++;(0,i.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--}))}const s=e.destination;this._updateInternalState(s,e.uid,!0);(0,i.isValidRotation)(s.rotation)&&(this.linkService.rotation=s.rotation);s.dest?this.linkService.goToDestination(s.dest):s.hash?this.linkService.setHash(s.hash):s.page&&(this.linkService.page=s.page);Promise.resolve().then((()=>{this._popStateInProgress=!1}))}_pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}_bindEvents(){if(!this._boundEvents){this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)};this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea);window.addEventListener("popstate",this._boundEvents.popState);window.addEventListener("pagehide",this._boundEvents.pageHide)}}_unbindEvents(){if(this._boundEvents){this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea);window.removeEventListener("popstate",this._boundEvents.popState);window.removeEventListener("pagehide",this._boundEvents.pageHide);this._boundEvents=null}}};function isDestHashesEqual(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;if(e===t)return!0;const{nameddest:n}=(0,i.parseQueryString)(e);return n===t}function isDestArraysEqual(e,t){function isEntryEqual(e,t){if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"==typeof e&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!isEntryEqual(e[n],t[n]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(!isEntryEqual(e[n],t[n]))return!1;return!0}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFLayerViewer=void 0;var i=n(13);class PDFLayerViewer extends i.BaseTreeViewer{constructor(e){super(e);this.l10n=e.l10n;this.eventBus._on("resetlayers",this._resetLayers.bind(this));this.eventBus._on("togglelayerstree",this._toggleAllTreeItems.bind(this))}reset(){super.reset();this._optionalContentConfig=null;this._pdfDocument=null}_dispatchEvent(e){this.eventBus.dispatch("layersloaded",{source:this,layersCount:e})}_bindLink(e,{groupId:t,input:n}){const setVisibility=()=>{this._optionalContentConfig.setVisibility(t,n.checked);this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(this._optionalContentConfig)})};e.onclick=t=>{if(t.target===n){setVisibility();return!0}if(t.target!==e)return!0;n.checked=!n.checked;setVisibility();return!1}}async _setNestedName(e,{name:t=null}){if("string"!=typeof t){e.textContent=await this.l10n.get("additional_layers",null,"Additional Layers");e.style.fontStyle="italic"}else e.textContent=this._normalizeTextContent(t)}_addToggleButton(e,{name:t=null}){super._addToggleButton(e,null===t)}_toggleAllTreeItems(){this._optionalContentConfig&&super._toggleAllTreeItems()}render({optionalContentConfig:e,pdfDocument:t}){this._optionalContentConfig&&this.reset();this._optionalContentConfig=e||null;this._pdfDocument=t||null;const n=e&&e.getOrder();if(!n){this._dispatchEvent(0);return}const i=document.createDocumentFragment(),s=[{parent:i,groups:n}];let r=0,a=!1;for(;s.length>0;){const t=s.shift();for(const n of t.groups){const i=document.createElement("div");i.className="treeItem";const o=document.createElement("a");i.appendChild(o);if("object"==typeof n){a=!0;this._addToggleButton(i,n);this._setNestedName(o,n);const e=document.createElement("div");e.className="treeItems";i.appendChild(e);s.push({parent:e,groups:n.order})}else{const t=e.getGroup(n),i=document.createElement("input");this._bindLink(o,{groupId:n,input:i});i.type="checkbox";i.id=n;i.checked=t.visible;const s=document.createElement("label");s.setAttribute("for",n);s.textContent=this._normalizeTextContent(t.name);o.appendChild(i);o.appendChild(s);r++}t.parent.appendChild(i)}}this._finishRendering(i,r,a)}async _resetLayers(){if(!this._optionalContentConfig)return;const e=await this._pdfDocument.getOptionalContentConfig();this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(e)});this.render({optionalContentConfig:e,pdfDocument:this._pdfDocument})}}t.PDFLayerViewer=PDFLayerViewer},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SimpleLinkService=t.PDFLinkService=void 0;var i=n(4);t.PDFLinkService=class PDFLinkService{constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:n=null,externalLinkEnabled:i=!0,ignoreDestinationZoom:s=!1}={}){this.eventBus=e;this.externalLinkTarget=t;this.externalLinkRel=n;this.externalLinkEnabled=i;this._ignoreDestinationZoom=s;this.baseUrl=null;this.pdfDocument=null;this.pdfViewer=null;this.pdfHistory=null;this._pagesRefCache=null}setDocument(e,t=null){this.baseUrl=t;this.pdfDocument=e;this._pagesRefCache=Object.create(null)}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfViewer.currentPageNumber}set page(e){this.pdfViewer.currentPageNumber=e}get rotation(){return this.pdfViewer.pagesRotation}set rotation(e){this.pdfViewer.pagesRotation=e}navigateTo(e){console.error("Deprecated method: `navigateTo`, use `goToDestination` instead.");this.goToDestination(e)}_goToDestinationHelper(e,t=null,n){const i=n[0];let s;if(i instanceof Object){s=this._cachedPageNumber(i);if(null===s){this.pdfDocument.getPageIndex(i).then((s=>{this.cachePageRef(s+1,i);this._goToDestinationHelper(e,t,n)})).catch((()=>{console.error(`PDFLinkService._goToDestinationHelper: "${i}" is not a valid page reference, for dest="${e}".`)}));return}}else{if(!Number.isInteger(i)){console.error(`PDFLinkService._goToDestinationHelper: "${i}" is not a valid destination reference, for dest="${e}".`);return}s=i+1}if(!s||s<1||s>this.pagesCount)console.error(`PDFLinkService._goToDestinationHelper: "${s}" is not a valid page number, for dest="${e}".`);else{if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.push({namedDest:t,explicitDest:n,pageNumber:s})}this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:n,ignoreDestinationZoom:this._ignoreDestinationZoom})}}async goToDestination(e){if(!this.pdfDocument)return;let t,n;if("string"==typeof e){t=e;n=await this.pdfDocument.getDestination(e)}else{t=null;n=await e}Array.isArray(n)?this._goToDestinationHelper(e,t,n):console.error(`PDFLinkService.goToDestination: "${n}" is not a valid destination array, for dest="${e}".`)}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;if(Number.isInteger(t)&&t>0&&t<=this.pagesCount){if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.pushPage(t)}this.pdfViewer.scrollPageIntoView({pageNumber:t})}else console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return(this.baseUrl||"")+e}setHash(e){if(!this.pdfDocument)return;let t,n;if(e.includes("=")){const s=(0,i.parseQueryString)(e);"search"in s&&this.eventBus.dispatch("findfromurlhash",{source:this,query:s.search.replace(/"/g,""),phraseSearch:"true"===s.phrase});"page"in s&&(t=0|s.page||1);if("zoom"in s){const e=s.zoom.split(","),t=e[0],i=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?n=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?n=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):n=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:console.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):n=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,i?i/100:t]}n?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:n,allowNegativeOffset:!0}):t&&(this.page=t);"pagemode"in s&&this.eventBus.dispatch("pagemode",{source:this,mode:s.pagemode});"nameddest"in s&&this.goToDestination(s.nameddest)}else{n=unescape(e);try{n=JSON.parse(n);Array.isArray(n)||(n=n.toString())}catch(e){}if("string"==typeof n||function isValidExplicitDestination(e){if(!Array.isArray(e))return!1;const t=e.length;if(t<2)return!1;const n=e[0];if(!("object"==typeof n&&Number.isInteger(n.num)&&Number.isInteger(n.gen)||Number.isInteger(n)&&n>=0))return!1;const i=e[1];if("object"!=typeof i||"string"!=typeof i.name)return!1;let s=!0;switch(i.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;s=!1;break;default:return!1}for(let n=2;n<t;n++){const t=e[n];if(!("number"==typeof t||s&&null===t))return!1}return!0}(n)){this.goToDestination(n);return}console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){switch(e){case"GoBack":this.pdfHistory&&this.pdfHistory.back();break;case"GoForward":this.pdfHistory&&this.pdfHistory.forward();break;case"NextPage":this.page<this.pagesCount&&this.page++;break;case"PrevPage":this.page>1&&this.page--;break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}cachePageRef(e,t){if(!t)return;const n=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;this._pagesRefCache[n]=e}_cachedPageNumber(e){const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this._pagesRefCache&&this._pagesRefCache[t]||null}isPageVisible(e){return this.pdfViewer.isPageVisible(e)}isPageCached(e){return this.pdfViewer.isPageCached(e)}};t.SimpleLinkService=class SimpleLinkService{constructor(){this.externalLinkTarget=null;this.externalLinkRel=null;this.externalLinkEnabled=!0;this._ignoreDestinationZoom=!1}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}async goToDestination(e){}goToPage(e){}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}cachePageRef(e,t){}isPageVisible(e){return!0}isPageCached(e){return!0}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFOutlineViewer=void 0;var i=n(5),s=n(13);class PDFOutlineViewer extends s.BaseTreeViewer{constructor(e){super(e);this.linkService=e.linkService;this.eventBus._on("toggleoutlinetree",this._toggleAllTreeItems.bind(this))}reset(){super.reset();this._outline=null}_dispatchEvent(e){this.eventBus.dispatch("outlineloaded",{source:this,outlineCount:e})}_bindLink(e,{url:t,newWindow:n,dest:s}){const{linkService:r}=this;if(t)(0,i.addLinkAttributes)(e,{url:t,target:n?i.LinkTarget.BLANK:r.externalLinkTarget,rel:r.externalLinkRel,enabled:r.externalLinkEnabled});else{e.href=r.getDestinationHash(s);e.onclick=()=>{s&&r.goToDestination(s);return!1}}}_setStyles(e,{bold:t,italic:n}){t&&(e.style.fontWeight="bold");n&&(e.style.fontStyle="italic")}_addToggleButton(e,{count:t,items:n}){let i=!1;if(t<0){let e=n.length;if(e>0){const t=[...n];for(;t.length>0;){const{count:n,items:i}=t.shift();if(n>0&&i.length>0){e+=i.length;t.push(...i)}}}Math.abs(t)===e&&(i=!0)}super._addToggleButton(e,i)}_toggleAllTreeItems(){this._outline&&super._toggleAllTreeItems()}render({outline:e}){this._outline&&this.reset();this._outline=e||null;if(!e){this._dispatchEvent(0);return}const t=document.createDocumentFragment(),n=[{parent:t,items:e}];let i=0,s=!1;for(;n.length>0;){const e=n.shift();for(const t of e.items){const r=document.createElement("div");r.className="treeItem";const a=document.createElement("a");this._bindLink(a,t);this._setStyles(a,t);a.textContent=this._normalizeTextContent(t.title);r.appendChild(a);if(t.items.length>0){s=!0;this._addToggleButton(r,t);const e=document.createElement("div");e.className="treeItems";r.appendChild(e);n.push({parent:e,items:t.items})}e.parent.appendChild(r);i++}}this._finishRendering(t,i,s)}}t.PDFOutlineViewer=PDFOutlineViewer},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPresentationMode=void 0;var i=n(4);const s="pdfPresentationMode",r="pdfPresentationModeControls",a=Math.PI/6;t.PDFPresentationMode=class PDFPresentationMode{constructor({container:e,pdfViewer:t,eventBus:n,contextMenuItems:i=null}){this.container=e;this.pdfViewer=t;this.eventBus=n;this.active=!1;this.args=null;this.contextMenuOpen=!1;this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0;this.touchSwipeState=null;if(i){i.contextFirstPage.addEventListener("click",(()=>{this.contextMenuOpen=!1;this.eventBus.dispatch("firstpage",{source:this})}));i.contextLastPage.addEventListener("click",(()=>{this.contextMenuOpen=!1;this.eventBus.dispatch("lastpage",{source:this})}));i.contextPageRotateCw.addEventListener("click",(()=>{this.contextMenuOpen=!1;this.eventBus.dispatch("rotatecw",{source:this})}));i.contextPageRotateCcw.addEventListener("click",(()=>{this.contextMenuOpen=!1;this.eventBus.dispatch("rotateccw",{source:this})}))}}request(){if(this.switchInProgress||this.active||!this.pdfViewer.pagesCount)return!1;this._addFullscreenChangeListeners();this._setSwitchInProgress();this._notifyStateChange();if(this.container.requestFullscreen)this.container.requestFullscreen();else if(this.container.mozRequestFullScreen)this.container.mozRequestFullScreen();else{if(!this.container.webkitRequestFullscreen)return!1;this.container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}this.args={page:this.pdfViewer.currentPageNumber,previousScale:this.pdfViewer.currentScaleValue};return!0}_mouseWheel(e){if(!this.active)return;e.preventDefault();const t=(0,i.normalizeWheelEventDelta)(e),n=(new Date).getTime(),s=this.mouseScrollTimeStamp;if(!(n>s&&n-s<50)){(this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&this._resetMouseScrollState();this.mouseScrollDelta+=t;if(Math.abs(this.mouseScrollDelta)>=.1){const e=this.mouseScrollDelta;this._resetMouseScrollState();(e>0?this._goToPreviousPage():this._goToNextPage())&&(this.mouseScrollTimeStamp=n)}}}get isFullscreen(){return!!(document.fullscreenElement||document.mozFullScreen||document.webkitIsFullScreen)}_goToPreviousPage(){const e=this.pdfViewer.currentPageNumber;if(e<=1)return!1;this.pdfViewer.currentPageNumber=e-1;return!0}_goToNextPage(){const e=this.pdfViewer.currentPageNumber;if(e>=this.pdfViewer.pagesCount)return!1;this.pdfViewer.currentPageNumber=e+1;return!0}_notifyStateChange(){let e=i.PresentationModeState.NORMAL;this.switchInProgress?e=i.PresentationModeState.CHANGING:this.active&&(e=i.PresentationModeState.FULLSCREEN);this.eventBus.dispatch("presentationmodechanged",{source:this,state:e,get active(){throw new Error("Deprecated parameter: `active`, please use `state` instead.")},get switchInProgress(){throw new Error("Deprecated parameter: `switchInProgress`, please use `state` instead.")}})}_setSwitchInProgress(){this.switchInProgress&&clearTimeout(this.switchInProgress);this.switchInProgress=setTimeout((()=>{this._removeFullscreenChangeListeners();delete this.switchInProgress;this._notifyStateChange()}),1500)}_resetSwitchInProgress(){if(this.switchInProgress){clearTimeout(this.switchInProgress);delete this.switchInProgress}}_enter(){this.active=!0;this._resetSwitchInProgress();this._notifyStateChange();this.container.classList.add(s);setTimeout((()=>{this.pdfViewer.currentPageNumber=this.args.page;this.pdfViewer.currentScaleValue="page-fit"}),0);this._addWindowListeners();this._showControls();this.contextMenuOpen=!1;this.container.setAttribute("contextmenu","viewerContextMenu");window.getSelection().removeAllRanges()}_exit(){const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(s);setTimeout((()=>{this.active=!1;this._removeFullscreenChangeListeners();this._notifyStateChange();this.pdfViewer.currentScaleValue=this.args.previousScale;this.pdfViewer.currentPageNumber=e;this.args=null}),0);this._removeWindowListeners();this._hideControls();this._resetMouseScrollState();this.container.removeAttribute("contextmenu");this.contextMenuOpen=!1}_mouseDown(e){if(this.contextMenuOpen){this.contextMenuOpen=!1;e.preventDefault()}else if(0===e.button){if(!(e.target.href&&e.target.classList.contains("internalLink"))){e.preventDefault();e.shiftKey?this._goToPreviousPage():this._goToNextPage()}}}_contextMenu(){this.contextMenuOpen=!0}_showControls(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(r);this.controlsTimeout=setTimeout((()=>{this.container.classList.remove(r);delete this.controlsTimeout}),3e3)}_hideControls(){if(this.controlsTimeout){clearTimeout(this.controlsTimeout);this.container.classList.remove(r);delete this.controlsTimeout}}_resetMouseScrollState(){this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0}_touchSwipe(e){if(this.active)if(e.touches.length>1)this.touchSwipeState=null;else switch(e.type){case"touchstart":this.touchSwipeState={startX:e.touches[0].pageX,startY:e.touches[0].pageY,endX:e.touches[0].pageX,endY:e.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=e.touches[0].pageX;this.touchSwipeState.endY=e.touches[0].pageY;e.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;let t=0;const n=this.touchSwipeState.endX-this.touchSwipeState.startX,i=this.touchSwipeState.endY-this.touchSwipeState.startY,s=Math.abs(Math.atan2(i,n));Math.abs(n)>50&&(s<=a||s>=Math.PI-a)?t=n:Math.abs(i)>50&&Math.abs(s-Math.PI/2)<=a&&(t=i);t>0?this._goToPreviousPage():t<0&&this._goToNextPage()}}_addWindowListeners(){this.showControlsBind=this._showControls.bind(this);this.mouseDownBind=this._mouseDown.bind(this);this.mouseWheelBind=this._mouseWheel.bind(this);this.resetMouseScrollStateBind=this._resetMouseScrollState.bind(this);this.contextMenuBind=this._contextMenu.bind(this);this.touchSwipeBind=this._touchSwipe.bind(this);window.addEventListener("mousemove",this.showControlsBind);window.addEventListener("mousedown",this.mouseDownBind);window.addEventListener("wheel",this.mouseWheelBind,{passive:!1});window.addEventListener("keydown",this.resetMouseScrollStateBind);window.addEventListener("contextmenu",this.contextMenuBind);window.addEventListener("touchstart",this.touchSwipeBind);window.addEventListener("touchmove",this.touchSwipeBind);window.addEventListener("touchend",this.touchSwipeBind)}_removeWindowListeners(){window.removeEventListener("mousemove",this.showControlsBind);window.removeEventListener("mousedown",this.mouseDownBind);window.removeEventListener("wheel",this.mouseWheelBind,{passive:!1});window.removeEventListener("keydown",this.resetMouseScrollStateBind);window.removeEventListener("contextmenu",this.contextMenuBind);window.removeEventListener("touchstart",this.touchSwipeBind);window.removeEventListener("touchmove",this.touchSwipeBind);window.removeEventListener("touchend",this.touchSwipeBind);delete this.showControlsBind;delete this.mouseDownBind;delete this.mouseWheelBind;delete this.resetMouseScrollStateBind;delete this.contextMenuBind;delete this.touchSwipeBind}_fullscreenChange(){this.isFullscreen?this._enter():this._exit()}_addFullscreenChangeListeners(){this.fullscreenChangeBind=this._fullscreenChange.bind(this);window.addEventListener("fullscreenchange",this.fullscreenChangeBind);window.addEventListener("mozfullscreenchange",this.fullscreenChangeBind);window.addEventListener("webkitfullscreenchange",this.fullscreenChangeBind)}_removeFullscreenChangeListeners(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind);window.removeEventListener("mozfullscreenchange",this.fullscreenChangeBind);window.removeEventListener("webkitfullscreenchange",this.fullscreenChangeBind);delete this.fullscreenChangeBind}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFSidebarResizer=void 0;var i=n(4);const s="sidebarResizing";t.PDFSidebarResizer=class PDFSidebarResizer{constructor(e,t,n=i.NullL10n){this.isRTL=!1;this.sidebarOpen=!1;this.doc=document.documentElement;this._width=null;this._outerContainerWidth=null;this._boundEvents=Object.create(null);this.outerContainer=e.outerContainer;this.resizer=e.resizer;this.eventBus=t;n.getDirection().then((e=>{this.isRTL="rtl"===e}));this._addEventListeners()}get outerContainerWidth(){this._outerContainerWidth||(this._outerContainerWidth=this.outerContainer.clientWidth);return this._outerContainerWidth}_updateWidth(e=0){const t=Math.floor(this.outerContainerWidth/2);e>t&&(e=t);e<200&&(e=200);if(e===this._width)return!1;this._width=e;this.doc.style.setProperty("--sidebar-width",`${e}px`);return!0}_mouseMove(e){let t=e.clientX;this.isRTL&&(t=this.outerContainerWidth-t);this._updateWidth(t)}_mouseUp(e){this.outerContainer.classList.remove(s);this.eventBus.dispatch("resize",{source:this});const t=this._boundEvents;window.removeEventListener("mousemove",t.mouseMove);window.removeEventListener("mouseup",t.mouseUp)}_addEventListeners(){const e=this._boundEvents;e.mouseMove=this._mouseMove.bind(this);e.mouseUp=this._mouseUp.bind(this);this.resizer.addEventListener("mousedown",(t=>{if(0===t.button){this.outerContainer.classList.add(s);window.addEventListener("mousemove",e.mouseMove);window.addEventListener("mouseup",e.mouseUp)}}));this.eventBus._on("sidebarviewchanged",(e=>{this.sidebarOpen=!(!e||!e.view)}));this.eventBus._on("resize",(e=>{if(!e||e.source!==window)return;this._outerContainerWidth=null;if(!this._width)return;if(!this.sidebarOpen){this._updateWidth(this._width);return}this.outerContainer.classList.add(s);const t=this._updateWidth(this._width);Promise.resolve().then((()=>{this.outerContainer.classList.remove(s);t&&this.eventBus.dispatch("resize",{source:this})}))}))}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFThumbnailViewer=void 0;var i=n(4),s=n(27),r=n(8);const a="selected";t.PDFThumbnailViewer=class PDFThumbnailViewer{constructor({container:e,eventBus:t,linkService:n,renderingQueue:s,l10n:r=i.NullL10n}){this.container=e;this.linkService=n;this.renderingQueue=s;this.l10n=r;this.scroll=(0,i.watchScroll)(this.container,this._scrollUpdated.bind(this));this._resetView();t._on("optionalcontentconfigchanged",(()=>{this._setImageDisabled=!0}))}_scrollUpdated(){this.renderingQueue.renderHighestPriority()}getThumbnail(e){return this._thumbnails[e]}_getVisibleThumbs(){return(0,i.getVisibleElements)({scrollEl:this.container,views:this._thumbnails})}scrollThumbnailIntoView(e){if(!this.pdfDocument)return;const t=this._thumbnails[e-1];if(!t){console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');return}if(e!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(a);t.div.classList.add(a)}const n=this._getVisibleThumbs(),s=n.views.length;if(s>0){const r=n.first.id,a=s>1?n.last.id:r;let o=!1;e<=r||e>=a?o=!0:n.views.some((function(t){if(t.id!==e)return!1;o=t.percent<100;return!0}));o&&(0,i.scrollIntoView)(t.div,{top:-19})}this._currentPageNumber=e}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,i.isValidRotation)(e))throw new Error("Invalid thumbnails rotation angle.");if(this.pdfDocument&&this._pagesRotation!==e){this._pagesRotation=e;for(let t=0,n=this._thumbnails.length;t<n;t++)this._thumbnails[t].update(e)}}cleanup(){for(let e=0,t=this._thumbnails.length;e<t;e++)this._thumbnails[e]&&this._thumbnails[e].renderingState!==r.RenderingStates.FINISHED&&this._thumbnails[e].reset();s.TempImageFactory.destroyCanvas()}_resetView(){this._thumbnails=[];this._currentPageNumber=1;this._pageLabels=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._pagesRequests=new WeakMap;this._setImageDisabled=!1;this.container.textContent=""}setDocument(e){if(this.pdfDocument){this._cancelRendering();this._resetView()}this.pdfDocument=e;if(!e)return;const t=e.getPage(1),n=e.getOptionalContentConfig();t.then((t=>{this._optionalContentConfigPromise=n;const i=e.numPages,r=t.getViewport({scale:1}),checkSetImageDisabled=()=>this._setImageDisabled;for(let e=1;e<=i;++e){const t=new s.PDFThumbnailView({container:this.container,id:e,defaultViewport:r.clone(),optionalContentConfigPromise:n,linkService:this.linkService,renderingQueue:this.renderingQueue,checkSetImageDisabled:checkSetImageDisabled,disableCanvasToImageConversion:!1,l10n:this.l10n});this._thumbnails.push(t)}const o=this._thumbnails[0];o&&o.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].div.classList.add(a)})).catch((e=>{console.error("Unable to initialize thumbnail viewer",e)}))}_cancelRendering(){for(let e=0,t=this._thumbnails.length;e<t;e++)this._thumbnails[e]&&this._thumbnails[e].cancelRendering()}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._thumbnails.length;e<t;e++){const t=this._pageLabels&&this._pageLabels[e];this._thumbnails[e].setPageLabel(t)}}}_ensurePdfPageLoaded(e){if(e.pdfPage)return Promise.resolve(e.pdfPage);if(this._pagesRequests.has(e))return this._pagesRequests.get(e);const t=this.pdfDocument.getPage(e.id).then((t=>{e.pdfPage||e.setPdfPage(t);this._pagesRequests.delete(e);return t})).catch((t=>{console.error("Unable to get page for thumb view",t);this._pagesRequests.delete(e)}));this._pagesRequests.set(e,t);return t}forceRendering(){const e=this._getVisibleThumbs(),t=this.renderingQueue.getHighestPriority(e,this._thumbnails,this.scroll.down);if(t){this._ensurePdfPageLoaded(t).then((()=>{this.renderingQueue.renderView(t)}));return!0}return!1}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TempImageFactory=t.PDFThumbnailView=void 0;var i=n(4),s=n(5),r=n(8);const a=function TempImageFactoryClosure(){let e=null;return{getCanvas(t,n){let i=e;if(!i){i=document.createElement("canvas");e=i}i.width=t;i.height=n;i.mozOpaque=!0;const s=i.getContext("2d",{alpha:!1});s.save();s.fillStyle="rgb(255, 255, 255)";s.fillRect(0,0,t,n);s.restore();return i},destroyCanvas(){const t=e;if(t){t.width=0;t.height=0}e=null}}}();t.TempImageFactory=a;t.PDFThumbnailView=class PDFThumbnailView{constructor({container:e,id:t,defaultViewport:n,optionalContentConfigPromise:s,linkService:a,renderingQueue:o,checkSetImageDisabled:l,disableCanvasToImageConversion:c=!1,l10n:h=i.NullL10n}){this.id=t;this.renderingId="thumbnail"+t;this.pageLabel=null;this.pdfPage=null;this.rotation=0;this.viewport=n;this.pdfPageRotate=n.rotation;this._optionalContentConfigPromise=s||null;this.linkService=a;this.renderingQueue=o;this.renderTask=null;this.renderingState=r.RenderingStates.INITIAL;this.resume=null;this._checkSetImageDisabled=l||function(){return!1};this.disableCanvasToImageConversion=c;this.pageWidth=this.viewport.width;this.pageHeight=this.viewport.height;this.pageRatio=this.pageWidth/this.pageHeight;this.canvasWidth=98;this.canvasHeight=this.canvasWidth/this.pageRatio|0;this.scale=this.canvasWidth/this.pageWidth;this.l10n=h;window.pdfThumbnailGenerator?window.pdfThumbnailGenerator(this,a,t,e,this._thumbPageTitle):this.createThumbnail(this,a,t,e,this._thumbPageTitle)}createThumbnail(e,t,n,i,s){const r=document.createElement("a");r.href=t.getAnchorUrl("#page="+n);s.then((e=>{r.title=e}));r.onclick=function(){t.goToPage(n);return!1};e.anchor=r;const a=document.createElement("div");a.className="thumbnail";a.setAttribute("data-page-number",this.id);e.div=a;const o=document.createElement("div");o.className="thumbnailSelectionRing";o.style.width=this.canvasWidth+2+"px";o.style.height=this.canvasHeight+2+"px";e.ring=o;a.appendChild(o);r.appendChild(a);i.appendChild(r)}setPdfPage(e){this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:1,rotation:t});this.reset()}reset(){this.cancelRendering();this.renderingState=r.RenderingStates.INITIAL;this.pageWidth=this.viewport.width;this.pageHeight=this.viewport.height;this.pageRatio=this.pageWidth/this.pageHeight;this.canvasHeight=this.canvasWidth/this.pageRatio|0;this.scale=this.canvasWidth/this.pageWidth;this.div.removeAttribute("data-loaded");const e=this.ring,t=e.childNodes;for(let n=t.length-1;n>=0;n--)e.removeChild(t[n]);e.style.width=this.canvasWidth+2+"px";e.style.height=this.canvasHeight+2+"px";if(this.canvas){this.canvas.width=0;this.canvas.height=0;delete this.canvas}if(this.image){this.image.removeAttribute("src");delete this.image}}update(e){void 0!==e&&(this.rotation=e);const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:t});this.reset()}cancelRendering(){if(this.renderTask){this.renderTask.cancel();this.renderTask=null}this.resume=null}_getPageDrawContext(){const e=document.createElement("canvas");this.canvas=e;e.mozOpaque=!0;const t=e.getContext("2d",{alpha:!1}),n=(0,i.getOutputScale)(t);e.width=this.canvasWidth*n.sx|0;e.height=this.canvasHeight*n.sy|0;e.style.width=this.canvasWidth+"px";e.style.height=this.canvasHeight+"px";return[t,n.scaled?[n.sx,0,0,n.sy,0,0]:null]}_convertCanvasToImage(){if(!this.canvas)return;if(this.renderingState!==r.RenderingStates.FINISHED)return;const e="thumbnailImage";if(this.disableCanvasToImageConversion){this.canvas.className=e;this._thumbPageCanvas.then((e=>{this.canvas.setAttribute("aria-label",e)}));this.div.setAttribute("data-loaded",!0);this.ring.appendChild(this.canvas);return}const t=document.createElement("img");t.className=e;this._thumbPageCanvas.then((e=>{t.setAttribute("aria-label",e)}));t.style.width=this.canvasWidth+"px";t.style.height=this.canvasHeight+"px";t.src=this.canvas.toDataURL();this.image=t;this.div.setAttribute("data-loaded",!0);this.ring.appendChild(t);this.canvas.width=0;this.canvas.height=0;delete this.canvas}draw(){if(this.renderingState!==r.RenderingStates.INITIAL){console.error("Must be in new state before drawing");return Promise.resolve(void 0)}const{pdfPage:e}=this;if(!e){this.renderingState=r.RenderingStates.FINISHED;return Promise.reject(new Error("pdfPage is not loaded"))}this.renderingState=r.RenderingStates.RUNNING;const finishRenderTask=async(e=null)=>{a===this.renderTask&&(this.renderTask=null);if(!(e instanceof s.RenderingCancelledException)){this.renderingState=r.RenderingStates.FINISHED;this._convertCanvasToImage();if(e)throw e}},[t,n]=this._getPageDrawContext(),i={canvasContext:t,transform:n,viewport:this.viewport.clone({scale:this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise},a=this.renderTask=e.render(i);a.onContinue=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=r.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=r.RenderingStates.RUNNING;e()}}};const o=a.promise.then((function(){finishRenderTask(null)}),(function(e){finishRenderTask(e)}));o.finally((()=>{this.linkService.isPageCached(this.id)||this.pdfPage?.cleanup()}));return o}setImage(e){if(this._checkSetImageDisabled())return;if(this.renderingState!==r.RenderingStates.INITIAL)return;const t=e.canvas;if(!t)return;this.pdfPage||this.setPdfPage(e.pdfPage);this.renderingState=r.RenderingStates.FINISHED;const[n]=this._getPageDrawContext(),i=n.canvas;if(t.width<=2*i.width){n.drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height);this._convertCanvasToImage();return}let s=i.width<<3,o=i.height<<3;const l=a.getCanvas(s,o),c=l.getContext("2d");for(;s>t.width||o>t.height;){s>>=1;o>>=1}c.drawImage(t,0,0,t.width,t.height,0,0,s,o);for(;s>2*i.width;){c.drawImage(l,0,0,s,o,0,0,s>>1,o>>1);s>>=1;o>>=1}n.drawImage(l,0,0,s,o,0,0,i.width,i.height);this._convertCanvasToImage()}get _thumbPageTitle(){return this.l10n.get("thumb_page_title",{page:this.pageLabel??this.id},"Page {{page}}")}get _thumbPageCanvas(){return this.l10n.get("thumb_page_canvas",{page:this.pageLabel??this.id},"Thumbnail of Page {{page}}")}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;this._thumbPageTitle.then((e=>{this.anchor.title=e}));this.renderingState===r.RenderingStates.FINISHED&&this._thumbPageCanvas.then((e=>{this.image?this.image.setAttribute("aria-label",e):this.disableCanvasToImageConversion&&this.canvas&&this.canvas.setAttribute("aria-label",e)}))}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFViewer=void 0;var i=n(29),s=n(5);class PDFViewer extends i.BaseViewer{get _viewerElement(){return(0,s.shadow)(this,"_viewerElement",this.viewer)}_scrollIntoView({pageDiv:e,pageSpot:t=null,pageNumber:n=null}){if(!t&&!this.isInPresentationMode){const n=e.offsetLeft+e.clientLeft,i=n+e.clientWidth,{scrollLeft:s,clientWidth:r}=this.container;(this._isScrollModeHorizontal||n<s||i>s+r)&&(t={left:0,top:0})}super._scrollIntoView({pageDiv:e,pageSpot:t,pageNumber:n})}_getVisiblePages(){return this.isInPresentationMode?this._getCurrentVisiblePage():super._getVisiblePages()}_updateHelper(e){if(this.isInPresentationMode)return;let t=this._currentPageNumber,n=!1;for(const i of e){if(i.percent<100)break;if(i.id===t){n=!0;break}}n||(t=e[0].id);this._setCurrentPageNumber(t)}}t.PDFViewer=PDFViewer},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BaseViewer=void 0;var i=n(5),s=n(4),r=n(8),a=n(30),o=n(31),l=n(22),c=n(35);function PDFPageViewBuffer(e){const t=[];this.push=function(n){const i=t.indexOf(n);i>=0&&t.splice(i,1);t.push(n);t.length>e&&t.shift().destroy()};this.resize=function(n,i){e=n;if(i){const e=new Set;for(let t=0,n=i.length;t<n;++t)e.add(i[t].id);(0,s.moveToEndOfArray)(t,(function(t){return e.has(t.id)}))}for(;t.length>e;)t.shift().destroy()};this.has=function(e){return t.includes(e)}}class BaseViewer{constructor(e){if(this.constructor===BaseViewer)throw new Error("Cannot initialize BaseViewer.");const t="2.7.536";if(i.version!==t)throw new Error(`The API version "${i.version}" does not match the Viewer version "2.7.536".`);this._name=this.constructor.name;this.container=e.container;this.viewer=e.viewer||e.container.firstElementChild;this.pageViewMode=e.pageViewMode||"single";if("DIV"!==this.container?.tagName.toUpperCase()||"DIV"!==this.viewer?.tagName.toUpperCase())throw new Error("Invalid `container` and/or `viewer` option.");if("absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.eventBus=e.eventBus;this.linkService=e.linkService||new l.SimpleLinkService;this.downloadManager=e.downloadManager||null;this.findController=e.findController||null;this.removePageBorders=e.removePageBorders||!1;this.textLayerMode=Number.isInteger(e.textLayerMode)?e.textLayerMode:s.TextLayerMode.ENABLE;this.imageResourcesPath=e.imageResourcesPath||"";this.renderInteractiveForms="boolean"!=typeof e.renderInteractiveForms||e.renderInteractiveForms;this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1;this.renderer=e.renderer||s.RendererType.CANVAS;this.enableWebGL=e.enableWebGL||!1;this.useOnlyCssZoom=e.useOnlyCssZoom||!1;this.maxCanvasPixels=e.maxCanvasPixels;this.l10n=e.l10n||s.NullL10n;this.enableScripting=e.enableScripting||!1;this._mouseState=e.mouseState||null;this.defaultRenderingQueue=!e.renderingQueue;if(this.defaultRenderingQueue){this.renderingQueue=new r.PDFRenderingQueue;this.renderingQueue.setViewer(this)}else this.renderingQueue=e.renderingQueue;this.scroll=(0,s.watchScroll)(this.container,this._scrollUpdate.bind(this));this.presentationModeState=s.PresentationModeState.UNKNOWN;this._onBeforeDraw=this._onAfterDraw=null;this._resetView();this.removePageBorders&&this.viewer.classList.add("removePageBorders");this._initializeScriptingEvents();Promise.resolve().then((()=>{this.eventBus.dispatch("baseviewerinit",{source:this})}))}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}get pageViewsReady(){return!!this._pagesCapability.settled&&this._pages.every((function(e){return e&&e.pdfPage}))}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(e,!0)||console.error(`${this._name}.currentPageNumber: "${e}" is not a valid page.`))}hidePagesDependingOnpageViewMode(){"single"===this.pageViewMode&&this._pages.forEach((e=>{e.div.style.display=e.id===this.currentPageNumber?"block":"none"}))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e){t&&this._resetCurrentPageView();return!0}if(!(0<e&&e<=this.pagesCount))return!1;const n=this._currentPageNumber;this._currentPageNumber=e;this.hidePagesDependingOnpageViewMode();if("single"===this.pageViewMode||"infinite-scroll"===this.pageViewMode){const e=this._pages[this.currentPageNumber-1];this._ensurePdfPageLoaded(e).then((()=>{this.renderingQueue.renderView(e)}))}this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels&&this._pageLabels[e-1],previous:n});t&&this._resetCurrentPageView();return!0}get currentPageLabel(){return this._pageLabels&&this._pageLabels[this._currentPageNumber-1]}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const n=this._pageLabels.indexOf(e);n>=0&&(t=n+1)}this._setCurrentPageNumber(t,!0)||console.error(`${this._name}.currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==s.UNKNOWN_SCALE?this._currentScale:s.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this._setScale(e,"single"===this.pageViewMode)}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this._setScale(e,"single"===this.pageViewMode)}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,s.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;if(this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber;for(let t=0,n=this._pages.length;t<n;t++){const n=this._pages[t];n.update(n.scale,e)}this._currentScaleValue&&this._setScale(this._currentScaleValue,!0);this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:e,pageNumber:t});this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _viewerElement(){throw new Error("Not implemented: _viewerElement")}_onePageRenderedOrForceFetch(){return this.container.offsetParent&&0!==this._getVisiblePages().views.length?this._onePageRenderedCapability.promise:Promise.resolve()}setDocument(e){if(this.pdfDocument){this.eventBus.dispatch("pagesdestroy",{source:this});this._cancelRendering();this._resetView();this.findController&&this.findController.setDocument(null)}this.pdfDocument=e;if(!e)return;const t=e.numPages,n=e.getPage(1),i=e.getOptionalContentConfig();this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:t})}));this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this._buffer.push(t)};this.eventBus._on("pagerender",this._onBeforeDraw);this._onAfterDraw=e=>{if(!e.cssTransform&&!this._onePageRenderedCapability.settled){this._onePageRenderedCapability.resolve();this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null}};this.eventBus._on("pagerendered",this._onAfterDraw);n.then((n=>{this._firstPageCapability.resolve(n);this._optionalContentConfigPromise=i;const r=this.currentScale,a=n.getViewport({scale:r*s.CSS_UNITS}),l=this.textLayerMode!==s.TextLayerMode.DISABLE?this:null;for(let e=1;e<=t;++e){const t=new o.PDFPageView({container:this._viewerElement,eventBus:this.eventBus,id:e,scale:r,defaultViewport:a.clone(),optionalContentConfigPromise:i,renderingQueue:this.renderingQueue,textLayerFactory:l,textLayerMode:this.textLayerMode,annotationLayerFactory:this,imageResourcesPath:this.imageResourcesPath,removePageBorders:this.removePageBorders,renderInteractiveForms:this.renderInteractiveForms,renderer:this.renderer,enableWebGL:this.enableWebGL,useOnlyCssZoom:this.useOnlyCssZoom,maxCanvasPixels:this.maxCanvasPixels,l10n:this.l10n,enableScripting:this.enableScripting});this._pages.push(t)}const c=this._pages[0];if(c){c.setPdfPage(n);this.linkService.cachePageRef(1,n.ref)}this._spreadMode!==s.SpreadMode.NONE&&this._updateSpreadMode();this._onePageRenderedOrForceFetch().then((()=>{this.findController&&this.findController.setDocument(e);if(e.loadingParams.disableAutoFetch||t>7500){this._pagesCapability.resolve();return}let n=t-1;if(n<=0)this._pagesCapability.resolve();else for(let i=2;i<=t;++i)e.getPage(i).then((e=>{const t=this._pages[i-1];t.pdfPage||t.setPdfPage(e);this.linkService.cachePageRef(i,e.ref);0==--n&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${i} to initialize viewer`,e);0==--n&&this._pagesCapability.resolve()}))}));this.hidePagesDependingOnpageViewMode();this.eventBus.dispatch("pagesinit",{source:this});this.defaultRenderingQueue&&this.update()})).catch((e=>{console.error("Unable to initialize viewer",e)}))}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;console.error(`${this._name}.setPageLabels: Invalid page labels.`)}else this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++){const t=this._pages[e],n=this._pageLabels&&this._pageLabels[e];t.setPageLabel(n)}}}_resetView(){this._pages=[];this._currentPageNumber=1;this._currentScale=s.UNKNOWN_SCALE;this._currentScaleValue=null;this._pageLabels=null;this._buffer=new PDFPageViewBuffer(10);this._location=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._pagesRequests=new WeakMap;this._firstPageCapability=(0,i.createPromiseCapability)();this._onePageRenderedCapability=(0,i.createPromiseCapability)();this._pagesCapability=(0,i.createPromiseCapability)();this._scrollMode=s.ScrollMode.VERTICAL;this._spreadMode=s.SpreadMode.NONE;this._pageOpenPendingSet=null;if(this._onBeforeDraw){this.eventBus._off("pagerender",this._onBeforeDraw);this._onBeforeDraw=null}if(this._onAfterDraw){this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null}this.viewer.textContent="";this._updateScrollMode()}_scrollUpdate(){0!==this.pagesCount&&this.update()}_scrollIntoView({pageDiv:e,pageSpot:t=null,pageNumber:n=null}){"single"===this.pageViewMode&&this._pages.forEach((()=>{e.style.display="block"}));(0,s.scrollIntoView)(e,t,!1,"infinite-scroll"===this.pageViewMode)}_setScaleUpdatePages(e,t,n=!1,i=!1){this._currentScaleValue=t.toString();if(function isSameScale(e,t){return t===e||Math.abs(t-e)<1e-15}(this._currentScale,e))i&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t});else{for(let t=0,n=this._pages.length;t<n;t++)this._pages[t].update(e);this._currentScale=e;if(!n){let e,t=this._currentPageNumber;if(this._location&&!this.isInPresentationMode&&!this.isChangingPresentationMode){t=this._location.pageNumber;e=[null,{name:"XYZ"},this._location.left,this._location.top,null]}this.scrollPageIntoView({pageNumber:t,destArray:e,allowNegativeOffset:!0})}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:i?t:void 0});this.defaultRenderingQueue&&this.update()}}get _pageWidthScaleFactor(){return this.spreadMode===s.SpreadMode.NONE||this.scrollMode===s.ScrollMode.HORIZONTAL||this.isInPresentationMode?1:2}_setScale(e,t=!1){let n=parseFloat(e);if(n>0)this._setScaleUpdatePages(n,e,t,!1);else{const i=this._pages[this._currentPageNumber-1];if(!i)return;const r=this.isInPresentationMode||this.removePageBorders;let a=s.VERTICAL_PADDING;"single"===this.pageViewMode&&(a+=15);let o=r?0:s.SCROLLBAR_PADDING,l=r?"single"===this.pageViewMode?10:0:a;!r&&this._isScrollModeHorizontal&&([o,l]=[l,o]);const c=(this.container.clientWidth-o)/i.width*i.scale/this._pageWidthScaleFactor,h=(this.container.clientHeight-l)/i.height*i.scale;switch(e){case"page-actual":n=1;break;case"page-width":n=c;break;case"page-height":n=h;break;case"page-fit":n=Math.min(c,h);break;case"auto":const t=(0,s.isPortraitOrientation)(i)?c:Math.min(h,c);n=Math.min(s.MAX_AUTO_SCALE,t);break;default:console.error(`${this._name}._setScale: "${e}" is an unknown zoom value.`);return}this._setScaleUpdatePages(n,e,t,!0)}}_resetCurrentPageView(){this.isInPresentationMode&&this._setScale(this._currentScaleValue,!0);const e=this._pages[this._currentPageNumber-1];this._scrollIntoView({pageDiv:e.div})}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:n=!1,ignoreDestinationZoom:i=!1}){if(!this.pdfDocument)return;const r=Number.isInteger(e)&&this._pages[e-1];if(!r){console.error(`${this._name}.scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!t){this._setCurrentPageNumber(e,!0);return}let a,o,l=0,c=0,h=0,d=0;const u=r.rotation%180!=0,p=(u?r.height:r.width)/r.scale/s.CSS_UNITS,g=(u?r.width:r.height)/r.scale/s.CSS_UNITS;let f=0;switch(t[1].name){case"XYZ":l=t[2];c=t[3];f=t[4];l=null!==l?l:0;c=null!==c?c:g;break;case"Fit":case"FitB":f="page-fit";break;case"FitH":case"FitBH":c=t[2];f="page-width";if(null===c&&this._location){l=this._location.left;c=this._location.top}else"number"!=typeof c&&(c=g);break;case"FitV":case"FitBV":l=t[2];h=p;d=g;f="page-height";break;case"FitR":l=t[2];c=t[3];h=t[4]-l;d=t[5]-c;const e=this.removePageBorders?0:s.SCROLLBAR_PADDING,n=this.removePageBorders?0:s.VERTICAL_PADDING;a=(this.container.clientWidth-e)/h/s.CSS_UNITS;o=(this.container.clientHeight-n)/d/s.CSS_UNITS;f=Math.min(Math.abs(a),Math.abs(o));break;default:console.error(`${this._name}.scrollPageIntoView: "${t[1].name}" is not a valid destination type.`);return}i||(f&&f!==this._currentScale?this.currentScaleValue=f:this._currentScale===s.UNKNOWN_SCALE&&(this.currentScaleValue=s.DEFAULT_SCALE_VALUE));this._ensurePdfPageLoaded(r).then((()=>{this.renderingQueue.renderView(r);this.currentPageNumber!==e&&(this.currentPageNumber=e)}));if("page-fit"===f&&!t[4]){this._scrollIntoView({pageDiv:r.div,pageNumber:e});return}const m=[r.viewport.convertToViewportPoint(l,c),r.viewport.convertToViewportPoint(l+h,c+d)];let b=Math.min(m[0][0],m[1][0]),_=Math.min(m[0][1],m[1][1]);if(!n){b=Math.max(b,0);_=Math.max(_,0)}this._scrollIntoView({pageDiv:r.div,pageSpot:{left:b,top:_},pageNumber:e})}_updateLocation(e){const t=this._currentScale,n=this._currentScaleValue,i=parseFloat(n)===t?Math.round(1e4*t)/100:n,s=e.id;let r="#page="+s;r+="&zoom="+i;const a=this._pages[s-1],o=this.container,l=a.getPagePoint(o.scrollLeft-e.x,o.scrollTop-e.y),c=Math.round(l[0]),h=Math.round(l[1]);r+=","+c+","+h;this._location={pageNumber:s,scale:i,top:h,left:c,rotation:this._pagesRotation,pdfOpenParams:r}}_updateHelper(e){throw new Error("Not implemented: _updateHelper")}update(){const e=this._getVisiblePages(),t=e.views,n=t.length;if(0===n)return;const i=Math.max(10,2*n+1);this._buffer.resize(i,t);this.renderingQueue.renderHighestPriority(e);this._updateHelper(t);this._updateLocation(e.first);this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isScrollModeHorizontal(){return!this.isInPresentationMode&&this._scrollMode===s.ScrollMode.HORIZONTAL}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===s.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===s.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getCurrentVisiblePage(){if(!this.pagesCount)return{views:[]};const e=this._pages[this._currentPageNumber-1],t=e.div,n={id:e.id,x:t.offsetLeft+t.clientLeft,y:t.offsetTop+t.clientTop,view:e};return{first:n,last:n,views:[n]}}_getVisiblePages(){return"single"===this.pageViewMode?this._getCurrentVisiblePage():(0,s.getVisibleElements)({scrollEl:this.container,views:this._pages,sortByVisibility:!0,horizontal:this._isScrollModeHorizontal,rtl:this._isScrollModeHorizontal&&this._isContainerRtl})}isPageVisible(e){if(!this.pdfDocument)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){console.error(`${this._name}.isPageVisible: "${e}" is not a valid page.`);return!1}return this._getVisiblePages().views.some((function(t){return t.id===e}))}isPageCached(e){if(!this.pdfDocument||!this._buffer)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){console.error(`${this._name}.isPageCached: "${e}" is not a valid page.`);return!1}const t=this._pages[e-1];return!!t&&this._buffer.has(t)}cleanup(){for(let e=0,t=this._pages.length;e<t;e++)this._pages[e]&&this._pages[e].renderingState!==r.RenderingStates.FINISHED&&this._pages[e].reset()}_cancelRendering(){for(let e=0,t=this._pages.length;e<t;e++)this._pages[e]&&this._pages[e].cancelRendering()}_ensurePdfPageLoaded(e){if(e.pdfPage)return Promise.resolve(e.pdfPage);if(this._pagesRequests.has(e))return this._pagesRequests.get(e);const t=this.pdfDocument.getPage(e.id).then((t=>{e.pdfPage||e.setPdfPage(t);this._pagesRequests.delete(e);return t})).catch((t=>{console.error("Unable to get page for page view",t);this._pagesRequests.delete(e)}));this._pagesRequests.set(e,t);return t}forceRendering(e){const t=e||this._getVisiblePages(),n=this._isScrollModeHorizontal?this.scroll.right:this.scroll.down,i=this.renderingQueue.getHighestPriority(t,this._pages,n);if(i){this._ensurePdfPageLoaded(i).then((()=>{this.renderingQueue.renderView(i)}));return!0}return!1}createTextLayerBuilder(e,t,n,i=!1,s){return new c.TextLayerBuilder({textLayerDiv:e,eventBus:s,pageIndex:t,viewport:n,findController:this.isInPresentationMode?null:this.findController,enhanceTextSelection:!this.isInPresentationMode&&i})}createAnnotationLayerBuilder(e,t,n=null,i="",r=!1,o=s.NullL10n,l=!1,c=null,h=null){return new a.AnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n||this.pdfDocument?.annotationStorage,imageResourcesPath:i,renderInteractiveForms:r,linkService:this.linkService,downloadManager:this.downloadManager,l10n:o,enableScripting:l,hasJSActionsPromise:c||this.pdfDocument?.hasJSActions(),mouseState:h||this._mouseState})}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,n=this._pages.length;t<n;++t){const n=this._pages[t];if(n.width!==e.width||n.height!==e.height)return!1}return!0}getPagesOverview(){const e=this._pages.map((function(e){const t=e.pdfPage.getViewport({scale:1});return{width:t.width,height:t.height,rotation:t.rotation}}));return this.enablePrintAutoRotate?e.map((function(e){return(0,s.isPortraitOrientation)(e)?e:{width:e.height,height:e.width,rotation:(e.rotation+90)%360}})):e}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:this.pdfDocument.getOptionalContentConfig():Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);if(this.pdfDocument&&this._optionalContentConfigPromise){this._optionalContentConfigPromise=e;for(const t of this._pages)t.update(t.scale,t.rotation,e);this.update();this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e})}}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,s.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);this._scrollMode=e;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e});this._updateScrollMode(this._currentPageNumber)}}_updateScrollMode(e=null){const t=this._scrollMode,n=this.viewer;n.classList.toggle("scrollHorizontal",t===s.ScrollMode.HORIZONTAL);n.classList.toggle("scrollWrapped",t===s.ScrollMode.WRAPPED);if(this.pdfDocument&&e){this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0);this._setCurrentPageNumber(e,!0);this.update()}}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,s.isValidSpreadMode)(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e;this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e});this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,n=this._pages;t.textContent="";if(this._spreadMode===s.SpreadMode.NONE)for(let e=0,i=n.length;e<i;++e)t.appendChild(n[e].div);else{const e=this._spreadMode-1;let i=null;for(let s=0,r=n.length;s<r;++s){if(null===i){i=document.createElement("div");i.className="spread";t.appendChild(i)}else if(s%2===e){i=i.cloneNode(!1);t.appendChild(i)}i.appendChild(n[s].div)}}if(e){this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0);this._setCurrentPageNumber(e,!0);this.update()}}_initializeScriptingEvents(){if(!this.enableScripting)return;const{eventBus:e}=this,dispatchPageClose=t=>{e.dispatch("pageclose",{source:this,pageNumber:t})},dispatchPageOpen=(t,n=!1)=>{const i=this._pages[t-1];if(n||i?.renderingState===r.RenderingStates.FINISHED){this._pageOpenPendingSet?.delete(t);e.dispatch("pageopen",{source:this,pageNumber:t})}else{this._pageOpenPendingSet||(this._pageOpenPendingSet=new Set);this._pageOpenPendingSet.add(t)}};e._on("pagechanging",(({pageNumber:e,previous:t})=>{if(e!==t){dispatchPageClose(t);dispatchPageOpen(e)}}));e._on("pagerendered",(({pageNumber:e})=>{this._pageOpenPendingSet&&this._pageOpenPendingSet.has(e)&&e===this._currentPageNumber&&dispatchPageOpen(e,!0)}));e._on("pagesinit",(()=>{dispatchPageOpen(this._currentPageNumber)}));e._on("pagesdestroy",(()=>{dispatchPageClose(this._currentPageNumber)}))}}t.BaseViewer=BaseViewer},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.DefaultAnnotationLayerFactory=t.AnnotationLayerBuilder=void 0;var i=n(5),s=n(4),r=n(22);class AnnotationLayerBuilder{constructor({pageDiv:e,pdfPage:t,linkService:n,downloadManager:i,annotationStorage:r=null,imageResourcesPath:a="",renderInteractiveForms:o=!0,l10n:l=s.NullL10n,enableScripting:c=!1,hasJSActionsPromise:h=null,mouseState:d=null}){this.pageDiv=e;this.pdfPage=t;this.linkService=n;this.downloadManager=i;this.imageResourcesPath=a;this.renderInteractiveForms=o;this.l10n=l;this.annotationStorage=r;this.enableScripting=c;this._hasJSActionsPromise=h;this._mouseState=d;this.div=null;this._cancelled=!1}render(e,t="display"){return Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise]).then((([t,n=!1])=>{if(this._cancelled)return;if(0===t.length)return;const s={viewport:e.clone({dontFlip:!0}),div:this.div,annotations:t,page:this.pdfPage,imageResourcesPath:this.imageResourcesPath,removePageBorders:this.removePageBorders,renderInteractiveForms:this.renderInteractiveForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:n,mouseState:this._mouseState};if(this.div)i.AnnotationLayer.update(s);else{this.div=document.createElement("div");this.div.className="annotationLayer";this.pageDiv.appendChild(this.div);s.div=this.div;i.AnnotationLayer.render(s);this.l10n.translate(this.div)}}))}cancel(){this._cancelled=!0}hide(){this.div&&this.div.setAttribute("hidden","true")}}t.AnnotationLayerBuilder=AnnotationLayerBuilder;t.DefaultAnnotationLayerFactory=class DefaultAnnotationLayerFactory{createAnnotationLayerBuilder(e,t,n=null,i="",a=!0,o=s.NullL10n,l=!1,c=null,h=null){return new AnnotationLayerBuilder({pageDiv:e,pdfPage:t,imageResourcesPath:i,renderInteractiveForms:a,linkService:new r.SimpleLinkService,l10n:o,annotationStorage:n,enableScripting:l,hasJSActionsPromise:c,mouseState:h})}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPageView=void 0;var i=n(4),s=n(5),r=n(8),a=n(2),o=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n(32)),l=n(33);const c=a.viewerCompatibilityParams.maxCanvasPixels||16777216;t.PDFPageView=class PDFPageView{constructor(e){const t=e.container,n=e.defaultViewport;this.id=e.id;this.renderingId="page"+this.id;this.pdfPage=null;this.pageLabel=null;this.rotation=0;this.scale=e.scale||i.DEFAULT_SCALE;this.viewport=n;this.pdfPageRotate=n.rotation;this._optionalContentConfigPromise=e.optionalContentConfigPromise||null;this.hasRestrictedScaling=!1;this.textLayerMode=Number.isInteger(e.textLayerMode)?e.textLayerMode:i.TextLayerMode.ENABLE;this.imageResourcesPath=e.imageResourcesPath||"";this.renderInteractiveForms="boolean"!=typeof e.renderInteractiveForms||e.renderInteractiveForms;this.useOnlyCssZoom=e.useOnlyCssZoom||!1;this.maxCanvasPixels=e.maxCanvasPixels||c;this.eventBus=e.eventBus;this.renderingQueue=e.renderingQueue;this.textLayerFactory=e.textLayerFactory;this.annotationLayerFactory=e.annotationLayerFactory;this.renderer=e.renderer||i.RendererType.CANVAS;this.enableWebGL=e.enableWebGL||!1;this.l10n=e.l10n||i.NullL10n;this.enableScripting=e.enableScripting||!1;this.paintTask=null;this.paintedViewportMap=new WeakMap;this.renderingState=r.RenderingStates.INITIAL;this.resume=null;this._renderError=null;this.annotationLayer=null;this.textLayer=null;this.zoomLayer=null;const s=document.createElement("div");s.className="page";s.style.width=Math.floor(this.viewport.width)+"px";s.style.height=Math.floor(this.viewport.height)+"px";s.setAttribute("data-page-number",this.id);this.div=s;t.appendChild(s)}setPdfPage(e){this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*i.CSS_UNITS,rotation:t});this.reset()}destroy(){this.reset();this.pdfPage&&this.pdfPage.cleanup()}async _renderAnnotationLayer(){let e=null;try{await this.annotationLayer.render(this.viewport,"display")}catch(t){e=t}finally{this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:e})}}_resetZoomLayer(e=!1){if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.paintedViewportMap.delete(t);t.width=0;t.height=0;e&&this.zoomLayer.remove();this.zoomLayer=null}reset(e=!1,t=!1){this.cancelRendering(t);this.renderingState=r.RenderingStates.INITIAL;const n=this.div;n.style.width=Math.floor(this.viewport.width)+"px";n.style.height=Math.floor(this.viewport.height)+"px";const i=n.childNodes,s=e&&this.zoomLayer||null,a=t&&this.annotationLayer&&this.annotationLayer.div||null;for(let e=i.length-1;e>=0;e--){const t=i[e];s!==t&&a!==t&&n.removeChild(t)}n.removeAttribute("data-loaded");if(a)this.annotationLayer.hide();else if(this.annotationLayer){this.annotationLayer.cancel();this.annotationLayer=null}if(!s){if(this.canvas){this.paintedViewportMap.delete(this.canvas);this.canvas.width=0;this.canvas.height=0;delete this.canvas}this._resetZoomLayer()}if(this.svg){this.paintedViewportMap.delete(this.svg);delete this.svg}this.loadingIconDiv=document.createElement("div");this.loadingIconDiv.className="loadingIcon";n.appendChild(this.loadingIconDiv)}update(e,t,n=null){this.scale=e||this.scale;void 0!==t&&(this.rotation=t);n instanceof Promise&&(this._optionalContentConfigPromise=n);const s=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:this.scale*i.CSS_UNITS,rotation:s});if(this.svg){this.cssTransform(this.svg,!0);this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}let r=!1;if(this.canvas&&this.maxCanvasPixels>0){const e=this.outputScale;(Math.floor(this.viewport.width)*e.sx|0)*(Math.floor(this.viewport.height)*e.sy|0)>this.maxCanvasPixels&&(r=!0)}if(this.canvas){if(this.useOnlyCssZoom||this.hasRestrictedScaling&&r){this.cssTransform(this.canvas,!0);this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}if(!this.zoomLayer&&!this.canvas.hasAttribute("hidden")){this.zoomLayer=this.canvas.parentNode;this.zoomLayer.style.position="absolute"}}this.zoomLayer&&this.cssTransform(this.zoomLayer.firstChild);this.reset(!0,!0)}cancelRendering(e=!1){if(this.paintTask){this.paintTask.cancel();this.paintTask=null}this.resume=null;if(this.textLayer){this.textLayer.cancel();this.textLayer=null}if(!e&&this.annotationLayer){this.annotationLayer.cancel();this.annotationLayer=null}}cssTransform(e,t=!1){const n=this.viewport.width,i=this.viewport.height,s=this.div;e.style.width=e.parentNode.style.width=s.style.width=Math.floor(n)+"px";e.style.height=e.parentNode.style.height=s.style.height=Math.floor(i)+"px";const r=this.viewport.rotation-this.paintedViewportMap.get(e).rotation,a=Math.abs(r);let o=1,l=1;if(90===a||270===a){o=i/n;l=n/i}e.style.transform=`rotate(${r}deg) scale(${o}, ${l})`;if(this.textLayer){const e=this.textLayer.viewport,t=this.viewport.rotation-e.rotation,i=Math.abs(t);let s=n/e.width;90!==i&&270!==i||(s=n/e.height);const r=this.textLayer.textLayerDiv;let a,o;switch(i){case 0:a=o=0;break;case 90:a=0;o="-"+r.style.height;break;case 180:a="-"+r.style.width;o="-"+r.style.height;break;case 270:a="-"+r.style.width;o=0;break;default:console.error("Bad rotation value.")}r.style.transform=`rotate(${i}deg) scale(${s}) translate(${a}, ${o})`;r.style.transformOrigin="0% 0%"}t&&this.annotationLayer&&this._renderAnnotationLayer()}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}draw(){if(this.renderingState!==r.RenderingStates.INITIAL){console.error("Must be in new state before drawing");this.reset()}const{div:e,pdfPage:t}=this;if(!t){this.renderingState=r.RenderingStates.FINISHED;if(this.loadingIconDiv){e.removeChild(this.loadingIconDiv);delete this.loadingIconDiv}return Promise.reject(new Error("pdfPage is not loaded"))}this.renderingState=r.RenderingStates.RUNNING;const n=document.createElement("div");n.style.width=e.style.width;n.style.height=e.style.height;n.classList.add("canvasWrapper");this.annotationLayer&&this.annotationLayer.div?e.insertBefore(n,this.annotationLayer.div):e.appendChild(n);let a=null;if(this.textLayerMode!==i.TextLayerMode.DISABLE&&this.textLayerFactory){const t=document.createElement("div");t.className="textLayer";t.style.width=n.style.width;t.style.height=n.style.height;this.annotationLayer&&this.annotationLayer.div?e.insertBefore(t,this.annotationLayer.div):e.appendChild(t);a=this.textLayerFactory.createTextLayerBuilder(t,this.id-1,this.viewport,this.textLayerMode===i.TextLayerMode.ENABLE_ENHANCE,this.eventBus)}this.textLayer=a;let o=null;this.renderingQueue&&(o=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=r.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=r.RenderingStates.RUNNING;e()}}});const finishPaintTask=async(t=null)=>{l===this.paintTask&&(this.paintTask=null);if(t instanceof s.RenderingCancelledException)this._renderError=null;else{this._renderError=t;this.renderingState=r.RenderingStates.FINISHED;if(this.loadingIconDiv){e.removeChild(this.loadingIconDiv);delete this.loadingIconDiv}this._resetZoomLayer(!0);this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this._renderError});if(t)throw t}},l=this.renderer===i.RendererType.SVG?this.paintOnSvg(n):this.paintOnCanvas(n);l.onRenderContinue=o;this.paintTask=l;const c=l.promise.then((function(){return finishPaintTask(null).then((function(){if(a){const e=t.streamTextContent({normalizeWhitespace:!0});a.setTextContentStream(e);a.render()}}))}),(function(e){return finishPaintTask(e)}));if(this.annotationLayerFactory){this.annotationLayer||(this.annotationLayer=this.annotationLayerFactory.createAnnotationLayerBuilder(e,t,null,this.imageResourcesPath,this.renderInteractiveForms,this.l10n,this.enableScripting,null,null));this._renderAnnotationLayer()}e.setAttribute("data-loaded",!0);this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id});return c}paintOnCanvas(e){const t=(0,s.createPromiseCapability)(),n={promise:t.promise,onRenderContinue(e){e()},cancel(){b.cancel()}},r=this.viewport,a=document.createElement("canvas");this.l10n.get("page_canvas",{page:this.id},"Page {{page}}").then((e=>{a.setAttribute("aria-label",e)}));a.setAttribute("hidden","hidden");let c=!0;const showCanvas=function(){if(c){a.removeAttribute("hidden");c=!1}};e.appendChild(a);this.canvas=a;a.mozOpaque=!0;const h=a.getContext("2d",{alpha:!1}),d=(0,i.getOutputScale)(h);this.outputScale=d;if(this.useOnlyCssZoom){const e=r.clone({scale:i.CSS_UNITS});d.sx*=e.width/r.width;d.sy*=e.height/r.height;d.scaled=!0}if(this.maxCanvasPixels>0){const e=r.width*r.height,t=Math.sqrt(this.maxCanvasPixels/e);if(d.sx>t||d.sy>t){d.sx=t;d.sy=t;d.scaled=!0;this.hasRestrictedScaling=!0}else this.hasRestrictedScaling=!1}const u=(0,i.approximateFraction)(d.sx),p=(0,i.approximateFraction)(d.sy),g=(0,i.roundToDivide)(r.width*d.sx,u[0]),f=(0,i.roundToDivide)(r.height*d.sy,p[0]);if((g>=4096||f>=4096)&&(this.maxWidth||!o.default.test({width:g,height:f}))){const e=this.determineMaxDimensions();let t=Math.max(g/e,f/e);const n=Math.floor(100*this.scale/t)/100;t=this.scale/n;this.scale=n;window.PDFViewerApplicationOptions.set("maxZoom",n);PDFViewerApplication.pdfViewer.currentScaleValue=this.scale;r.width/=t;r.height/=t;(0,l.warn)("Page "+this.id+": Reduced the maximum zoom to "+n+" because the browser can't render larger canvases.")}a.width=(0,i.roundToDivide)(r.width*d.sx,u[0]);a.height=(0,i.roundToDivide)(r.height*d.sy,p[0]);a.style.width=(0,i.roundToDivide)(r.width,u[1])+"px";a.style.height=(0,i.roundToDivide)(r.height,p[1])+"px";this.paintedViewportMap.set(a,r);const m={canvasContext:h,transform:d.scaled?[d.sx,0,0,d.sy,0,0]:null,viewport:this.viewport,enableWebGL:this.enableWebGL,renderInteractiveForms:this.renderInteractiveForms,optionalContentConfigPromise:this._optionalContentConfigPromise},b=this.pdfPage.render(m);b.onContinue=function(e){showCanvas();n.onRenderContinue?n.onRenderContinue(e):e()};b.promise.then((function(){showCanvas();t.resolve(void 0)}),(function(e){showCanvas();t.reject(e)}));return n}paintOnSvg(e){let t=!1;const ensureNotCancelled=()=>{if(t)throw new s.RenderingCancelledException(`Rendering cancelled, page ${this.id}`,"svg")},n=this.pdfPage,a=this.viewport.clone({scale:i.CSS_UNITS});return{promise:n.getOperatorList().then((t=>{ensureNotCancelled();return new s.SVGGraphics(n.commonObjs,n.objs).getSVG(t,a).then((t=>{ensureNotCancelled();this.svg=t;this.paintedViewportMap.set(t,a);t.style.width=e.style.width;t.style.height=e.style.height;this.renderingState=r.RenderingStates.FINISHED;e.appendChild(t)}))})),onRenderContinue(e){e()},cancel(){t=!0}}}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}determineMaxDimensions(){if(this.maxWidth)return this.maxWidth;const e=[4096,8192,10836,11180,11402,14188,16384];for(let t of e)if(!o.default.test({width:t+1,height:t+1})){this.maxWidth=t;return this.maxWidth}return 16384}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=void 0;function _defineProperty(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n;return e}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})));n.push.apply(n,i)}return n}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _objectWithoutProperties(e,t){if(null==e)return{};var n,i,s=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var n,i,s={},r=Object.keys(e);for(i=0;i<r.length;i++){n=r[i];t.indexOf(n)>=0||(s[n]=e[n])}return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++){n=r[i];t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}}return s}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,s=!1,r=void 0;try{for(var a,o=e[Symbol.iterator]();!(i=(a=o.next()).done);i=!0){n.push(a.value);if(t&&n.length===t)break}}catch(e){s=!0;r=e}finally{try{i||null==o.return||o.return()}finally{if(s)throw r}}return n}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);return"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function canvasTest(e){var t,n,i=e.sizes.shift(),s=i[0],r=i[1],a=[s-1,r-1,1,1],o=Date.now(),l="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;if(l){t=new OffscreenCanvas(1,1);n=new OffscreenCanvas(s,r)}else{(t=document.createElement("canvas")).width=1;t.height=1;(n=document.createElement("canvas")).width=s;n.height=r}var c=t.getContext("2d"),h=n.getContext("2d");if(h){h.fillRect.apply(h,a);c.drawImage(n,s-1,r-1,1,1,0,0,1,1)}var d=c&&0!==c.getImageData(0,0,1,1).data[3],u=Date.now()-o;if(l){postMessage({width:s,height:r,benchmark:u,isTestPass:d});!d&&e.sizes.length&&canvasTest(e)}else if(d)e.onSuccess(s,r,u);else{e.onError(s,r,u);e.sizes.length&&canvasTest(e)}return d}var n=[16384,14188,11402,10836,11180,8192,4096,1],i=[8388607,65535,32767,16384,8192,4096,1],s=[4194303,65535,32767,16384,8192,4096,1],r={max:null,min:1,sizes:[],step:1024,usePromise:!1,useWorker:!1,onError:Function.prototype,onSuccess:Function.prototype},a={};function createSizesArray(e){var t=e.width===e.height,n=1===e.height,i=1===e.width,s=[];if(e.width&&e.height)for(var a=e.min||r.min,o=e.step||r.step,l=Math.max(e.width,e.height);l>=a;){var c=t||n?l:1,h=t||i?l:1;s.push([c,h]);l-=o}else e.sizes.forEach((function(e){var r=t||n?e:1,a=t||i?e:1;s.push([r,a])}));return s}function handleMethod(e){var t=window&&"HTMLCanvasElement"in window,n=window&&"OffscreenCanvas"in window,i=Date.now(),s=e.onError,r=e.onSuccess,o=_objectWithoutProperties(e,["onError","onSuccess"]),l=null;if(!t)return!1;if(e.useWorker&&n){var c="\n            ".concat(canvasTest.toString(),"\n            onmessage = function(e) {\n                canvasTest(e.data);\n            };\n        "),h=new Blob([c],{type:"application/javascript"}),d=URL.createObjectURL(h);l=new Worker(d);URL.revokeObjectURL(d);l.onmessage=function(e){var t=e.data,n=t.width,s=t.height,r=t.benchmark;if(t.isTestPass){a[i].onSuccess(n,s,r);delete a[i]}else a[i].onError(n,s,r)}}if(e.usePromise)return new Promise((function(t,n){var c=_objectSpread2(_objectSpread2({},e),{},{onError:function onError(t,i,r){var a;if(0===e.sizes.length)a=!0;else{var o=_slicedToArray(e.sizes.slice(-1),1),l=_slicedToArray(o[0],2),c=l[0],h=l[1];a=t===c&&i===h}s(t,i,r);a&&n({width:t,height:i,benchmark:r})},onSuccess:function onSuccess(e,n,i){r(e,n,i);t({width:e,height:n,benchmark:i})}});if(l){var h=c.onError,d=c.onSuccess;a[i]={onError:h,onSuccess:d};l.postMessage(o)}else canvasTest(c)}));if(!l)return canvasTest(e);a[i]={onError:s,onSuccess:r};l.postMessage(o)}var o={maxArea:function maxArea(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:e.max,height:e.max,min:e.min,step:e.step,sizes:_toConsumableArray(n)}),i=_objectSpread2(_objectSpread2(_objectSpread2({},r),e),{},{sizes:t});return handleMethod(i)},maxHeight:function maxHeight(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:1,height:e.max,min:e.min,step:e.step,sizes:_toConsumableArray(i)}),n=_objectSpread2(_objectSpread2(_objectSpread2({},r),e),{},{sizes:t});return handleMethod(n)},maxWidth:function maxWidth(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:e.max,height:1,min:e.min,step:e.step,sizes:_toConsumableArray(s)}),n=_objectSpread2(_objectSpread2(_objectSpread2({},r),e),{},{sizes:t});return handleMethod(n)},test:function test(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=_objectSpread2(_objectSpread2({},r),e);t.sizes=_toConsumableArray(t.sizes);t.width&&t.height&&(t.sizes=[[t.width,t.height]]);return handleMethod(t)}};t.default=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.arrayByteLength=arrayByteLength;t.arraysToBytes=function arraysToBytes(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let n=0;for(let i=0;i<t;i++)n+=arrayByteLength(e[i]);let i=0;const s=new Uint8Array(n);for(let n=0;n<t;n++){let t=e[n];t instanceof Uint8Array||(t="string"==typeof t?stringToBytes(t):new Uint8Array(t));const r=t.byteLength;s.set(t,i);i+=r}return s};t.assert=assert;t.bytesToString=function bytesToString(e){assert(null!==e&&"object"==typeof e&&void 0!==e.length,"Invalid argument for bytesToString");const t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);const i=[];for(let s=0;s<t;s+=n){const r=Math.min(s+n,t),a=e.subarray(s,r);i.push(String.fromCharCode.apply(null,a))}return i.join("")};t.createPromiseCapability=function createPromiseCapability(){const e=Object.create(null);let t=!1;Object.defineProperty(e,"settled",{get:()=>t});e.promise=new Promise((function(n,i){e.resolve=function(e){t=!0;n(e)};e.reject=function(e){t=!0;i(e)}}));return e};t.escapeString=function escapeString(e){return e.replace(/([()\\\n\r])/g,(e=>"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))};t.encodeToXmlString=function encodeToXmlString(e){const t=[];let n=0;for(let i=0,s=e.length;i<s;i++){const s=e.codePointAt(i);if(32<=s&&s<=126){const r=u[s];if(r){n<i&&t.push(e.substring(n,i));t.push(r);n=i+1}}else{n<i&&t.push(e.substring(n,i));t.push(`&#x${s.toString(16).toUpperCase()};`);s>55295&&(s<57344||s>65533)&&i++;n=i+1}}if(0===t.length)return e;n<e.length&&t.push(e.substring(n,e.length));return t.join("")};t.getModificationDate=function getModificationDate(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")};t.getVerbosityLevel=function getVerbosityLevel(){return s};t.info=function info(e){s>=i.INFOS&&console.log(`Info: ${e}`)};t.isArrayBuffer=function isArrayBuffer(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength};t.isArrayEqual=function isArrayEqual(e,t){if(e.length!==t.length)return!1;return e.every((function(e,n){return e===t[n]}))};t.isBool=function isBool(e){return"boolean"==typeof e};t.isNum=function isNum(e){return"number"==typeof e};t.isString=function isString(e){return"string"==typeof e};t.isSameOrigin=function isSameOrigin(e,t){let n;try{n=new URL(e);if(!n.origin||"null"===n.origin)return!1}catch(e){return!1}const i=new URL(t,n);return n.origin===i.origin};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e,t){if(!e)return null;try{const n=t?new URL(e,t):new URL(e);if(function _isValidProtocol(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch(e){}return null};t.objectSize=function objectSize(e){return Object.keys(e).length};t.objectFromEntries=function objectFromEntries(e){return Object.assign(Object.create(null),Object.fromEntries(e))};t.removeNullCharacters=function removeNullCharacters(e){if("string"!=typeof e){warn("The argument for removeNullCharacters must be a string.");return e}return e.replace(a,"")};t.setVerbosityLevel=function setVerbosityLevel(e){Number.isInteger(e)&&(s=e)};t.shadow=shadow;t.string32=function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)};t.stringToBytes=stringToBytes;t.stringToPDFString=function stringToPDFString(e){const t=e.length,n=[];if("þ"===e[0]&&"ÿ"===e[1])for(let i=2;i<t;i+=2)n.push(String.fromCharCode(e.charCodeAt(i)<<8|e.charCodeAt(i+1)));else if("ÿ"===e[0]&&"þ"===e[1])for(let i=2;i<t;i+=2)n.push(String.fromCharCode(e.charCodeAt(i+1)<<8|e.charCodeAt(i)));else for(let i=0;i<t;++i){const t=h[e.charCodeAt(i)];n.push(t?String.fromCharCode(t):e.charAt(i))}return n.join("")};t.stringToUTF8String=function stringToUTF8String(e){return decodeURIComponent(escape(e))};t.utf8StringToString=function utf8StringToString(e){return unescape(encodeURIComponent(e))};t.warn=warn;t.unreachable=unreachable;t.IsEvalSupportedCached=t.IsLittleEndianCached=t.createObjectURL=t.FormatError=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.StreamType=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.MissingPDFException=t.InvalidPDFException=t.AbortException=t.DocumentActionEventType=t.CMapCompressionType=t.ImageKind=t.FontType=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.UNSUPPORTED_FEATURES=t.VerbosityLevel=t.OPS=t.IDENTITY_MATRIX=t.FONT_IDENTITY_MATRIX=t.BaseException=void 0;n(34);t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.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};t.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};t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};t.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};t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};t.AnnotationReplyType={GROUP:"Group",REPLY:"R"};t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};t.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};t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};t.AnnotationActionEventType={E:"MouseEnter",X:"MouseExit",D:"MouseDown",U:"MouseUp",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};t.PageActionEventType={O:"PageOpen",C:"PageClose"};t.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};t.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const i={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=i;t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2};t.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};t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent"};t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let s=i.WARNINGS;function warn(e){s>=i.WARNINGS&&console.log(`Warning: ${e}`)}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function shadow(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!1});return n}const r=function BaseExceptionClosure(){function BaseException(e){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=e;this.name=this.constructor.name}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();t.BaseException=r;t.PasswordException=class PasswordException extends r{constructor(e,t){super(e);this.code=t}};t.UnknownErrorException=class UnknownErrorException extends r{constructor(e,t){super(e);this.details=t}};t.InvalidPDFException=class InvalidPDFException extends r{};t.MissingPDFException=class MissingPDFException extends r{};t.UnexpectedResponseException=class UnexpectedResponseException extends r{constructor(e,t){super(e);this.status=t}};t.FormatError=class FormatError extends r{};t.AbortException=class AbortException extends r{};const a=/\x00/g;function stringToBytes(e){assert("string"==typeof e,"Invalid argument for stringToBytes");const t=e.length,n=new Uint8Array(t);for(let i=0;i<t;++i)n[i]=255&e.charCodeAt(i);return n}function arrayByteLength(e){if(void 0!==e.length)return e.length;assert(void 0!==e.byteLength,"arrayByteLength - invalid argument.");return e.byteLength}const o={get value(){return shadow(this,"value",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}};t.IsLittleEndianCached=o;const l={get value(){return shadow(this,"value",function isEvalSupported(){try{new Function("");return!0}catch(e){return!1}}())}};t.IsEvalSupportedCached=l;const c=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,n){return`#${c[e]}${c[t]}${c[n]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]}static getAxialAlignedBoundingBox(e,t){const n=Util.applyTransform(e,t),i=Util.applyTransform(e.slice(2,4),t),s=Util.applyTransform([e[0],e[3]],t),r=Util.applyTransform([e[2],e[1]],t);return[Math.min(n[0],i[0],s[0],r[0]),Math.min(n[1],i[1],s[1],r[1]),Math.max(n[0],i[0],s[0],r[0]),Math.max(n[1],i[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static apply3dTransform(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],i=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],a=(n+r)/2,o=Math.sqrt((n+r)*(n+r)-4*(n*r-s*i))/2,l=a+o||1,c=a-o||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){function compare(e,t){return e-t}const n=[e[0],e[2],t[0],t[2]].sort(compare),i=[e[1],e[3],t[1],t[3]].sort(compare),s=[];e=Util.normalizeRect(e);t=Util.normalizeRect(t);if(!(n[0]===e[0]&&n[1]===t[0]||n[0]===t[0]&&n[1]===e[0]))return null;s[0]=n[1];s[2]=n[2];if(!(i[0]===e[1]&&i[1]===t[1]||i[0]===t[1]&&i[1]===e[1]))return null;s[1]=i[1];s[3]=i[2];return s}}t.Util=Util;const h=[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];const d=function createObjectURLClosure(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";return function createObjectURL(t,n,i=!1){if(!i&&URL.createObjectURL){const e=new Blob([t],{type:n});return URL.createObjectURL(e)}let s=`data:${n};base64,`;for(let n=0,i=t.length;n<i;n+=3){const r=255&t[n],a=255&t[n+1],o=255&t[n+2];s+=e[r>>2]+e[(3&r)<<4|a>>4]+e[n+1<i?(15&a)<<2|o>>6:64]+e[n+2<i?63&o:64]}return s}}();t.createObjectURL=d;const u={60:"&lt;",62:"&gt;",38:"&amp;",34:"&quot;",39:"&apos;"}},()=>{},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.DefaultTextLayerFactory=t.TextLayerBuilder=void 0;var i=n(5);class TextLayerBuilder{constructor({textLayerDiv:e,eventBus:t,pageIndex:n,viewport:i,findController:s=null,enhanceTextSelection:r=!1}){this.textLayerDiv=e;this.eventBus=t;this.textContent=null;this.textContentItemsStr=[];this.textContentStream=null;this.renderingDone=!1;this.pageIdx=n;this.pageNumber=this.pageIdx+1;this.matches=[];this.viewport=i;this.textDivs=[];this.findController=s;this.textLayerRenderTask=null;this.enhanceTextSelection=r;this._onUpdateTextLayerMatches=null;this._bindMouse()}_finishRendering(){this.renderingDone=!0;if(!this.enhanceTextSelection){const e=document.createElement("div");e.className="endOfContent";this.textLayerDiv.appendChild(e)}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.pageNumber,numTextDivs:this.textDivs.length})}render(e=0){if(!this.textContent&&!this.textContentStream||this.renderingDone)return;this.cancel();this.textDivs=[];const t=document.createDocumentFragment();this.textLayerRenderTask=(0,i.renderTextLayer)({textContent:this.textContent,textContentStream:this.textContentStream,container:t,viewport:this.viewport,textDivs:this.textDivs,textContentItemsStr:this.textContentItemsStr,timeout:e,enhanceTextSelection:this.enhanceTextSelection});this.textLayerRenderTask.promise.then((()=>{this.textLayerDiv.appendChild(t);this._finishRendering();this._updateMatches()}),(function(e){}));if(!this._onUpdateTextLayerMatches){this._onUpdateTextLayerMatches=e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()};this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)}}cancel(){if(this.textLayerRenderTask){this.textLayerRenderTask.cancel();this.textLayerRenderTask=null}if(this._onUpdateTextLayerMatches){this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches);this._onUpdateTextLayerMatches=null}}setTextContentStream(e){this.cancel();this.textContentStream=e}setTextContent(e){this.cancel();this.textContent=e}_convertMatches(e,t,n){if(!e)return[];const{findController:i,textContentItemsStr:s}=this;let r=0,a=0;const o=s.length-1,l=i.state.query.length,c=[];for(let i=0,h=e.length;i<h;i++){let h=e[i];for(;r!==o&&h>=a+s[r].length;){a+=s[r].length;r++}r===s.length&&console.error("Could not find a matching mapping");const d={color:n?n[i]:0,begin:{divIdx:r,offset:h-a}};h+=t?t[i]:l;for(;r!==o&&h>a+s[r].length;){a+=s[r].length;r++}d.end={divIdx:r,offset:h-a};c.push(d)}return c}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:n,textContentItemsStr:i,textDivs:s}=this,r=n===t.selected.pageIdx,a=t.selected.matchIdx;let o=null;const l={divIdx:-1,offset:void 0};function beginText(e,t){const n=e.divIdx;s[n].textContent="";appendTextToDiv(n,0,e.offset,t)}function appendTextToDiv(e,t,n,r){const a=s[e],o=i[e].substring(t,n),l=document.createTextNode(o);if(r){const e=document.createElement("span");e.className=r;e.appendChild(l);a.appendChild(e)}else a.appendChild(l)}let c=a,h=c+1;if(t.state.highlightAll){c=0;h=e.length}else if(!r)return;for(let i=c;i<h;i++){const c=e[i],h=c.begin,d=c.end,u=r&&i===a,p=(u?" selected":"")+" color"+c.color;u&&t.scrollMatchIntoView({element:s[h.divIdx],pageIndex:n,matchIndex:a});if(o&&h.divIdx===o.divIdx)appendTextToDiv(o.divIdx,o.offset,h.offset);else{null!==o&&appendTextToDiv(o.divIdx,o.offset,l.offset);beginText(h)}if(h.divIdx===d.divIdx)appendTextToDiv(h.divIdx,h.offset,d.offset,"highlight"+p);else{appendTextToDiv(h.divIdx,h.offset,l.offset,"highlight begin"+p);for(let e=h.divIdx+1,t=d.divIdx;e<t;e++)s[e].className="highlight middle"+p;beginText(d,"highlight end"+p)}o=d}o&&appendTextToDiv(o.divIdx,o.offset,l.offset)}_updateMatches(){if(!this.renderingDone)return;const{findController:e,matches:t,pageIdx:n,textContentItemsStr:i,textDivs:s}=this;let r=-1;for(let e=0,n=t.length;e<n;e++){const n=t[e];for(let e=Math.max(r,n.begin.divIdx),t=n.end.divIdx;e<=t;e++){const t=s[e];t.textContent=i[e];t.className=""}r=n.end.divIdx+1}if(!e||!e.highlightMatches)return;const a=e.pageMatches[n]||null,o=e.pageMatchesLength[n]||null,l=e.pageMatchesColor[n]||null;this.matches=this._convertMatches(a,o,l);this._renderMatches(this.matches)}_bindMouse(){const e=this.textLayerDiv;let t=null;e.addEventListener("mousedown",(n=>{if(this.enhanceTextSelection&&this.textLayerRenderTask){this.textLayerRenderTask.expandTextDivs(!0);if(t){clearTimeout(t);t=null}return}const i=e.querySelector(".endOfContent");if(!i)return;let s=n.target!==e;s=s&&"none"!==window.getComputedStyle(i).getPropertyValue("-moz-user-select");if(s){const t=e.getBoundingClientRect(),s=Math.max(0,(n.pageY-t.top)/t.height);i.style.top=(100*s).toFixed(2)+"%"}i.classList.add("active")}));e.addEventListener("mouseup",(()=>{if(this.enhanceTextSelection&&this.textLayerRenderTask){t=setTimeout((()=>{this.textLayerRenderTask&&this.textLayerRenderTask.expandTextDivs(!1);t=null}),300);return}const n=e.querySelector(".endOfContent");if(n){n.style.top="";n.classList.remove("active")}}))}}t.TextLayerBuilder=TextLayerBuilder;t.DefaultTextLayerFactory=class DefaultTextLayerFactory{createTextLayerBuilder(e,t,n,i=!1,s){return new TextLayerBuilder({textLayerDiv:e,pageIndex:t,viewport:n,enhanceTextSelection:i,eventBus:s})}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SecondaryToolbar=void 0;var i=n(4),s=n(6),r=n(37);t.SecondaryToolbar=class SecondaryToolbar{constructor(e,t,n){this.toolbar=e.toolbar;this.toggleButton=e.toggleButton;this.toolbarButtonContainer=e.toolbarButtonContainer;this.buttons=[{element:e.presentationModeButton,eventName:"presentationmode",close:!0},{element:e.openFileButton,eventName:"openfile",close:!0},{element:e.printButton,eventName:"print",close:!0},{element:e.downloadButton,eventName:"download",close:!0},{element:e.viewBookmarkButton,eventName:null,close:!0},{element:e.firstPageButton,eventName:"firstpage",close:!0},{element:e.lastPageButton,eventName:"lastpage",close:!0},{element:e.pageRotateCwButton,eventName:"rotatecw",close:!1},{element:e.pageRotateCcwButton,eventName:"rotateccw",close:!1},{element:e.cursorSelectToolButton,eventName:"switchcursortool",eventDetails:{tool:s.CursorTool.SELECT},close:!0},{element:e.cursorHandToolButton,eventName:"switchcursortool",eventDetails:{tool:s.CursorTool.HAND},close:!0},{element:e.scrollVerticalButton,eventName:"switchscrollmode",eventDetails:{mode:i.ScrollMode.VERTICAL},close:!0},{element:e.scrollHorizontalButton,eventName:"switchscrollmode",eventDetails:{mode:i.ScrollMode.HORIZONTAL},close:!0},{element:e.scrollWrappedButton,eventName:"switchscrollmode",eventDetails:{mode:i.ScrollMode.WRAPPED},close:!0},{element:e.spreadNoneButton,eventName:"switchspreadmode",eventDetails:{mode:i.SpreadMode.NONE},close:!0},{element:e.spreadOddButton,eventName:"switchspreadmode",eventDetails:{mode:i.SpreadMode.ODD},close:!0},{element:e.spreadEvenButton,eventName:"switchspreadmode",eventDetails:{mode:i.SpreadMode.EVEN},close:!0},{element:e.documentPropertiesButton,eventName:"documentproperties",close:!0}];this.items={firstPage:e.firstPageButton,lastPage:e.lastPageButton,pageRotateCw:e.pageRotateCwButton,pageRotateCcw:e.pageRotateCcwButton};this.mainContainer=t;this.eventBus=n;this.opened=!1;this.containerHeight=null;this.previousContainerHeight=null;this.reset();this._bindClickListeners();this._bindCursorToolsListener(e);this._bindScrollModeListener(e);this._bindSpreadModeListener(e);this.eventBus._on("resize",this._setMaxHeight.bind(this));this.eventBus._on("baseviewerinit",(e=>{e.source instanceof r.PDFSinglePageViewer?this.toolbarButtonContainer.classList.add("hiddenScrollModeButtons","hiddenSpreadModeButtons"):this.toolbarButtonContainer.classList.remove("hiddenScrollModeButtons","hiddenSpreadModeButtons")}))}get isOpen(){return this.opened}setPageNumber(e){this.pageNumber=e;this._updateUIState()}setPagesCount(e){this.pagesCount=e;this._updateUIState()}reset(){this.pageNumber=0;this.pagesCount=0;this._updateUIState();this.eventBus.dispatch("secondarytoolbarreset",{source:this})}_updateUIState(){this.items.firstPage.disabled=this.pageNumber<=1;document.getElementById("previousPage")&&(document.getElementById("previousPage").disabled=this.pageNumber<=1);this.items.lastPage.disabled=this.pageNumber>=this.pagesCount;document.getElementById("nextPage")&&(document.getElementById("nextPage").disabled=this.pageNumber>=this.pagesCount);this.items.pageRotateCw.disabled=0===this.pagesCount;this.items.pageRotateCcw.disabled=0===this.pagesCount;this.eventBus.dispatch("updateuistate",{source:this,widget:"SecondaryToolbar",pageNumber:this.pageNumber,pagesCount:this.pagesCount})}_bindClickListeners(){this.toggleButton.addEventListener("click",this.toggle.bind(this));for(const{element:e,eventName:t,close:n,eventDetails:i}of this.buttons)e.addEventListener("click",(e=>{if(null!==t){const e={source:this};for(const t in i)e[t]=i[t];this.eventBus.dispatch(t,e)}n&&this.close()}))}_bindCursorToolsListener(e){this.eventBus._on("cursortoolchanged",(function({tool:t}){e.cursorSelectToolButton.classList.toggle("toggled",t===s.CursorTool.SELECT);e.cursorHandToolButton.classList.toggle("toggled",t===s.CursorTool.HAND)}))}_bindScrollModeListener(e){function scrollModeChanged({mode:t}){e.scrollVerticalButton.classList.toggle("toggled",t===i.ScrollMode.VERTICAL);e.scrollHorizontalButton.classList.toggle("toggled",t===i.ScrollMode.HORIZONTAL);e.scrollWrappedButton.classList.toggle("toggled",t===i.ScrollMode.WRAPPED);const n=t===i.ScrollMode.HORIZONTAL;e.spreadNoneButton.disabled=n;e.spreadOddButton.disabled=n;e.spreadEvenButton.disabled=n}this.eventBus._on("scrollmodechanged",scrollModeChanged);this.eventBus._on("secondarytoolbarreset",(e=>{e.source===this&&scrollModeChanged({mode:i.ScrollMode.VERTICAL})}))}_bindSpreadModeListener(e){function spreadModeChanged({mode:t}){e.spreadNoneButton.classList.toggle("toggled",t===i.SpreadMode.NONE);e.spreadOddButton.classList.toggle("toggled",t===i.SpreadMode.ODD);e.spreadEvenButton.classList.toggle("toggled",t===i.SpreadMode.EVEN)}this.eventBus._on("spreadmodechanged",spreadModeChanged);this.eventBus._on("secondarytoolbarreset",(e=>{e.source===this&&spreadModeChanged({mode:i.SpreadMode.NONE})}))}open(){if(!this.opened){this.opened=!0;this._setMaxHeight();this.toggleButton.classList.add("toggled");this.toolbar.classList.remove("hidden")}}close(){if(this.opened){this.opened=!1;this.toolbar.classList.add("hidden");this.toggleButton.classList.remove("toggled")}}toggle(){this.opened?this.close():this.open()}_setMaxHeight(){if(this.opened){this.containerHeight=this.mainContainer.clientHeight;if(this.containerHeight!==this.previousContainerHeight){this.toolbarButtonContainer.style.maxHeight=this.containerHeight-i.SCROLLBAR_PADDING+"px";this.previousContainerHeight=this.containerHeight}}}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFSinglePageViewer=void 0;var i=n(29),s=n(5);class PDFSinglePageViewer extends i.BaseViewer{constructor(e){super(e);this.eventBus._on("pagesinit",(e=>{this._ensurePageViewVisible()}))}get _viewerElement(){return(0,s.shadow)(this,"_viewerElement",this._shadowViewer)}get _pageWidthScaleFactor(){return 1}_resetView(){super._resetView();this._previousPageNumber=1;this._shadowViewer=document.createDocumentFragment();this._updateScrollDown=null}_ensurePageViewVisible(){const e=this._pages[this._currentPageNumber-1],t=this._pages[this._previousPageNumber-1],n=this.viewer.childNodes;switch(n.length){case 0:this.viewer.appendChild(e.div);break;case 1:if(n[0]!==t.div)throw new Error("_ensurePageViewVisible: Unexpected previously visible page.");if(e===t)break;this._shadowViewer.appendChild(t.div);this.viewer.appendChild(e.div);this.container.scrollTop=0;break;default:throw new Error("_ensurePageViewVisible: Only one page should be visible at a time.")}this._previousPageNumber=this._currentPageNumber}_scrollUpdate(){this._updateScrollDown&&this._updateScrollDown();super._scrollUpdate()}_scrollIntoView({pageDiv:e,pageSpot:t=null,pageNumber:n=null}){n&&this._setCurrentPageNumber(n);const i=this._currentPageNumber>=this._previousPageNumber;this._ensurePageViewVisible();this.update();super._scrollIntoView({pageDiv:e,pageSpot:t,pageNumber:n});this._updateScrollDown=()=>{this.scroll.down=i;this._updateScrollDown=null}}_getVisiblePages(){return this._getCurrentVisiblePage()}_updateHelper(e){}get _isScrollModeHorizontal(){return(0,s.shadow)(this,"_isScrollModeHorizontal",!1)}_updateScrollMode(){}_updateSpreadMode(){}}t.PDFSinglePageViewer=PDFSinglePageViewer},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Toolbar=void 0;var i=n(4);t.Toolbar=class Toolbar{constructor(e,t,n=i.NullL10n){this.toolbar=e.container;this.eventBus=t;this.l10n=n;this.buttons=[{element:e.previous,eventName:"previouspage"},{element:e.next,eventName:"nextpage"},{element:e.zoomIn,eventName:"zoomin"},{element:e.zoomOut,eventName:"zoomout"},{element:e.openFile,eventName:"openfile"},{element:e.print,eventName:"print"},{element:e.presentationModeButton,eventName:"presentationmode"},{element:e.download,eventName:"download"},{element:e.viewBookmark,eventName:null}];this.items={numPages:e.numPages,pageNumber:e.pageNumber,scaleSelectContainer:e.scaleSelectContainer,scaleSelect:e.scaleSelect,customScaleOption:e.customScaleOption,previous:e.previous,next:e.next,zoomIn:e.zoomIn,zoomOut:e.zoomOut};this._wasLocalized=!1;this.reset();this._bindListeners()}setPageNumber(e,t){this.pageNumber=e;this.pageLabel=t;this._updateUIState(!1)}setPagesCount(e,t){this.pagesCount=e;this.hasPageLabels=t;this._updateUIState(!0)}setPageScale(e,t){this.pageScaleValue=(e||t).toString();this.pageScale=t;this._updateUIState(!1)}reset(){this.pageNumber=0;this.pageLabel=null;this.hasPageLabels=!1;this.pagesCount=0;const e=PDFViewerApplicationOptions.get("defaultZoomValue");if(e){this.pageScaleValue=e;Number(e)&&(this.pageScale=Number(e))}else{this.pageScaleValue=i.DEFAULT_SCALE_VALUE;this.pageScale=i.DEFAULT_SCALE}this._updateUIState(!0);this.updateLoadingIndicatorState()}_bindListeners(){const{pageNumber:e,scaleSelect:t}=this.items,n=this;for(const{element:e,eventName:t}of this.buttons)e.addEventListener("click",(e=>{null!==t&&this.eventBus.dispatch(t,{source:this})}));e.addEventListener("click",(function(){this.select()}));e.addEventListener("change",(function(){n.eventBus.dispatch("pagenumberchanged",{source:n,value:this.value})}));t.addEventListener("change",(function(){"custom"!==this.value&&n.eventBus.dispatch("scalechanged",{source:n,value:this.value})}));t.oncontextmenu=i.noContextMenuHandler;this.eventBus._on("localized",(()=>{this._wasLocalized=!0;this._updateUIState(!0)}))}_updateUIState(e=!1){if(!this._wasLocalized)return;const{pageNumber:t,pagesCount:n,pageScaleValue:s,pageScale:r,items:a}=this;if(e){if(this.hasPageLabels)a.pageNumber.type="text";else{a.pageNumber.type="number";this.l10n.get("of_pages",{pagesCount:n},"of {{pagesCount}}").then((e=>{a.numPages.textContent=e}))}a.pageNumber.max=n}if(this.hasPageLabels){a.pageNumber.value=this.pageLabel;this.l10n.get("page_of_pages",{pageNumber:t,pagesCount:n},"({{pageNumber}} of {{pagesCount}})").then((e=>{a.numPages.textContent=e}))}else a.pageNumber.value=t;a.previous.disabled=t<=1;a.next.disabled=t>=n;a.zoomOut.disabled=r<=i.MIN_SCALE;a.zoomIn.disabled=r>=i.MAX_SCALE;const o=Math.round(1e4*r)/100;this.l10n.get("page_scale_percent",{scale:o},"{{scale}}%").then((e=>{let t=!1;for(const e of a.scaleSelect.options)if(e.value===s){e.selected=!0;t=!0}else e.selected=!1;if(!t){a.customScaleOption.textContent=e;a.customScaleOption.selected=!0}}));this.eventBus.dispatch("updateuistate",{source:this,widget:"Toolbar",pageNumber:t,pagesCount:n,pageScaleValue:s,pageScale:r})}updateLoadingIndicatorState(e=!1){this.items.pageNumber.classList.toggle("visiblePageIsLoading",e)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.ViewHistory=void 0;t.ViewHistory=class ViewHistory{constructor(e,t=20){this.fingerprint=e;this.cacheSize=t;this._initializedPromise=this._readFromStorage().then((e=>{const t=JSON.parse(e||"{}");let n=-1;if(Array.isArray(t.files)){for(;t.files.length>=this.cacheSize;)t.files.shift();for(let e=0,i=t.files.length;e<i;e++){if(t.files[e].fingerprint===this.fingerprint){n=e;break}}}else t.files=[];-1===n&&(n=t.files.push({fingerprint:this.fingerprint})-1);this.file=t.files[n];this.database=t}))}async _writeToStorage(){const e=JSON.stringify(this.database);localStorage.setItem("pdfjs.history",e)}async _readFromStorage(){return localStorage.getItem("pdfjs.history")}async set(e,t){await this._initializedPromise;this.file[e]=t;return this._writeToStorage()}async setMultiple(e){await this._initializedPromise;for(const t in e)this.file[t]=e[t];return this._writeToStorage()}async get(e,t){await this._initializedPromise;const n=this.file[e];return void 0!==n?n:t}async getMultiple(e){await this._initializedPromise;const t=Object.create(null);for(const n in e){const i=this.file[n];t[n]=void 0!==i?i:e[n]}return t}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GenericCom=void 0;var i=n(3),s=n(41),r=n(42),a=n(43),o=n(45);t.GenericCom={};class GenericPreferences extends s.BasePreferences{async _writeToStorage(e){localStorage.setItem("pdfjs.preferences",JSON.stringify(e))}async _readFromStorage(e){return JSON.parse(localStorage.getItem("pdfjs.preferences"))}}class GenericExternalServices extends i.DefaultExternalServices{static createDownloadManager(e){return new r.DownloadManager}static createPreferences(){return new GenericPreferences}static createL10n({locale:e="en-US"}){return new a.GenericL10n(e)}static createScripting({sandboxBundleSrc:e}){return new o.GenericScripting(e)}}i.PDFViewerApplication.externalServices=GenericExternalServices},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BasePreferences=void 0;n(1);class BasePreferences{constructor(){if(this.constructor===BasePreferences)throw new Error("Cannot initialize BasePreferences.");Object.defineProperty(this,"defaults",{value:Object.freeze({cursorToolOnLoad:0,defaultZoomValue:"",disablePageLabels:!1,enablePermissions:!1,enablePrintAutoRotate:!1,enableScripting:!1,enableWebGL:!1,externalLinkTarget:0,historyUpdateUrl:!1,ignoreDestinationZoom:!1,pdfBugEnabled:!1,removePageBorders:!1,renderer:"canvas",renderInteractiveForms:!0,sidebarViewOnLoad:-1,scrollModeOnLoad:-1,spreadModeOnLoad:-1,textLayerMode:1,useOnlyCssZoom:!1,viewerCssTheme:0,viewOnLoad:0,disableAutoFetch:!1,disableFontFace:!1,disableRange:!1,disableStream:!1}),writable:!1,enumerable:!0,configurable:!1});this.prefs=Object.assign(Object.create(null),this.defaults);this._initializedPromise=this._readFromStorage(this.defaults).then((e=>{if(e)for(const t in e){const n=this.defaults[t],i=e[t];void 0!==n&&typeof i==typeof n&&(this.prefs[t]=i)}}))}async _writeToStorage(e){throw new Error("Not implemented: _writeToStorage")}async _readFromStorage(e){throw new Error("Not implemented: _readFromStorage")}async reset(){await this._initializedPromise;this.prefs=Object.assign(Object.create(null),this.defaults);return this._writeToStorage(this.defaults)}async set(e,t){await this._initializedPromise;const n=this.defaults[e];if(void 0===n)throw new Error(`Set preference: "${e}" is undefined.`);if(void 0===t)throw new Error("Set preference: no value is specified.");const i=typeof t,s=typeof n;if(i!==s){if("number"!==i||"string"!==s)throw new Error(`Set preference: "${t}" is a ${i}, expected a ${s}.`);t=t.toString()}else if("number"===i&&!Number.isInteger(t))throw new Error(`Set preference: "${t}" must be an integer.`);this.prefs[e]=t;return this._writeToStorage(this.prefs)}async get(e){await this._initializedPromise;const t=this.defaults[e];if(void 0===t)throw new Error(`Get preference: "${e}" is undefined.`);{const t=this.prefs[e];if(void 0!==t)return t}return t}async getAll(){await this._initializedPromise;return Object.assign(Object.create(null),this.defaults,this.prefs)}}t.BasePreferences=BasePreferences},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.DownloadManager=void 0;var i=n(5),s=n(2);function download(e,t){const n=document.createElement("a");if(!n.click)throw new Error('DownloadManager: "a.click()" is not supported.');n.href=e;n.target="_parent";"download"in n&&(n.download=t);(document.body||document.documentElement).appendChild(n);n.click();n.remove()}t.DownloadManager=class DownloadManager{downloadUrl(e,t){(0,i.createValidAbsoluteUrl)(e,"http://example.com")&&download(e+"#pdfjs.action=download",t)}downloadData(e,t,n){download((0,i.createObjectURL)(e,n,s.viewerCompatibilityParams.disableCreateObjectURL),t)}download(e,t,n,i="download"){if(s.viewerCompatibilityParams.disableCreateObjectURL){this.downloadUrl(t,n);return}download(URL.createObjectURL(e),n)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GenericL10n=void 0;n(44);const i=document.webL10n;t.GenericL10n=class GenericL10n{constructor(e){this._lang=e;this._ready=new Promise(((t,n)=>{i.setLanguage(e,(()=>{t(i)}))}))}async getLanguage(){return(await this._ready).getLanguage()}async getDirection(){return(await this._ready).getDirection()}async get(e,t,n){return(await this._ready).get(e,t,n)}async translate(e){return(await this._ready).translate(e)}}},()=>{document.webL10n=function(e,t,n){var i={},s="",r="textContent",a="",o={},l="loading";function fireL10nReadyEvent(e){var n=t.createEvent("Event");n.initEvent("localized",!0,!1);n.language=e;t.dispatchEvent(n)}function xhrLoadText(e,t,n){t=t||function _onSuccess(e){};n=n||function _onFailure(){};var i=new XMLHttpRequest;i.open("GET",e,true);i.overrideMimeType&&i.overrideMimeType("text/plain; charset=utf-8");i.onreadystatechange=function(){4==i.readyState&&(200==i.status||0===i.status?t(i.responseText):n())};i.onerror=n;i.ontimeout=n;try{i.send(null)}catch(e){n()}}function parseResource(t,n,a,o){var l=t.replace(/[^\/]*$/,"")||"./";function evalString(e){return e.lastIndexOf("\\")<0?e:e.replace(/\\\\/g,"\\").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}xhrLoadText(t,(function(t){s+=t;!function parseProperties(t,i){var s={},r=/^\s*|\s*$/,a=/^\s*#|^\s*$/,o=/^\s*\[(.*)\]\s*$/,c=/^\s*@import\s+url\((.*)\)\s*$/i,h=/^([^=\s]*)\s*=\s*(.+)$/;function parseRawLines(e,t,i){var d=e.replace(r,"").split(/[\r\n]+/),u="*",p=n.split("-",1)[0],g=!1,f="",m=!1;!function nextEntry(){for(var e=void 0;;){if(!d.length&&e){m?nextEntry():loadImport(e,nextEntry);return}if(!d.length){i();return}var r=d.shift();if(!a.test(r)){if(t){if(f=o.exec(r)){u=f[1].toLowerCase();g="*"!==u&&u!==n&&u!==p;continue}if(g)continue;if(f=c.exec(r)){if("*"===u||u===n){loadImport(l+f[1],nextEntry);m=!0;return}e=l+f[1]}}var b=r.match(h);b&&3==b.length&&(s[b[1]]=evalString(b[2]))}}}()}function loadImport(t,n){xhrLoadText(t,(function(e){parseRawLines(e,!1,n)}),(function(){const i=e.PDFViewerApplicationOptions;(!i||i.get("verbosity")>0)&&console.warn(t+" not found.");n()}))}parseRawLines(t,!0,(function(){i(s)}))}(t,(function(e){for(var t in e){var n,s,o=t.lastIndexOf(".");if(o>0){n=t.substring(0,o);s=t.substring(o+1)}else{n=t;s=r}i[n]||(i[n]={});i[n][s]=e[t]}a&&a()}))}),o)}function loadLocale(n,r){let o=n;n&&(n=n.toLowerCase());r=r||function _callback(){};!function clear(){i={};s="";a=""}();a=n;var c=function getL10nResourceLinks(){return t.querySelectorAll('link[type="application/l10n"]')}(),h=c.length;if(0!==h){var d,u=0;d=function(){if(++u>=h){r();fireL10nReadyEvent(n);l="complete"}};for(var p=0;p<h;p++){new L10nResourceLink(c[p]).load(n,d)}}else{var g=function getL10nDictionary(){var e=t.querySelector('script[type="application/l10n"]');return e?JSON.parse(e.innerHTML):null}();if(g&&g.locales&&g.default_locale){console.log("The PDF viewer uses the pre-compiled language bundle stored in the HTML page.");if(!(i=g.locales[o])){var f=g.default_locale.toLowerCase();for(var m in g.locales){o=m;if((m=m.toLowerCase())===n){i=g.locales[o];break}m===f&&(i=g.locales[o])}}r()}else console.log("Could not load the translation files for the PDF viewer. Check the flag useBrowserLocale, check the locales subfolder of the assets folder, or add the locale definition to the index.html");fireL10nReadyEvent(n);l="complete"}function L10nResourceLink(t){var n=t.href;this.load=function(t,i){parseResource(n,t,i,(function(){const s=e.PDFViewerApplicationOptions;if(!s||s.get("verbosity")>0){console.warn(n+" not found.");console.warn('"'+t+'" resource not found')}a="";i()}))}}}o.plural=function(t,n,s,l){var c=parseFloat(n);if(isNaN(c))return t;if(l!=r)return t;o._pluralRules||(o._pluralRules=function getPluralRules(t){function isIn(e,t){return-1!==t.indexOf(e)}function isBetween(e,t,n){return t<=e&&e<=n}var n={0:function(e){return"other"},1:function(e){return isBetween(e%100,3,10)?"few":0===e?"zero":isBetween(e%100,11,99)?"many":2==e?"two":1==e?"one":"other"},2:function(e){return 0!==e&&e%10==0?"many":2==e?"two":1==e?"one":"other"},3:function(e){return 1==e?"one":"other"},4:function(e){return isBetween(e,0,1)?"one":"other"},5:function(e){return isBetween(e,0,2)&&2!=e?"one":"other"},6:function(e){return 0===e?"zero":e%10==1&&e%100!=11?"one":"other"},7:function(e){return 2==e?"two":1==e?"one":"other"},8:function(e){return isBetween(e,3,6)?"few":isBetween(e,7,10)?"many":2==e?"two":1==e?"one":"other"},9:function(e){return 0===e||1!=e&&isBetween(e%100,1,19)?"few":1==e?"one":"other"},10:function(e){return isBetween(e%10,2,9)&&!isBetween(e%100,11,19)?"few":e%10!=1||isBetween(e%100,11,19)?"other":"one"},11:function(e){return isBetween(e%10,2,4)&&!isBetween(e%100,12,14)?"few":e%10==0||isBetween(e%10,5,9)||isBetween(e%100,11,14)?"many":e%10==1&&e%100!=11?"one":"other"},12:function(e){return isBetween(e,2,4)?"few":1==e?"one":"other"},13:function(e){return isBetween(e%10,2,4)&&!isBetween(e%100,12,14)?"few":1!=e&&isBetween(e%10,0,1)||isBetween(e%10,5,9)||isBetween(e%100,12,14)?"many":1==e?"one":"other"},14:function(e){return isBetween(e%100,3,4)?"few":e%100==2?"two":e%100==1?"one":"other"},15:function(e){return 0===e||isBetween(e%100,2,10)?"few":isBetween(e%100,11,19)?"many":1==e?"one":"other"},16:function(e){return e%10==1&&11!=e?"one":"other"},17:function(e){return 3==e?"few":0===e?"zero":6==e?"many":2==e?"two":1==e?"one":"other"},18:function(e){return 0===e?"zero":isBetween(e,0,2)&&0!==e&&2!=e?"one":"other"},19:function(e){return isBetween(e,2,10)?"few":isBetween(e,0,1)?"one":"other"},20:function(e){return!isBetween(e%10,3,4)&&e%10!=9||isBetween(e%100,10,19)||isBetween(e%100,70,79)||isBetween(e%100,90,99)?e%1e6==0&&0!==e?"many":e%10!=2||isIn(e%100,[12,72,92])?e%10!=1||isIn(e%100,[11,71,91])?"other":"one":"two":"few"},21:function(e){return 0===e?"zero":1==e?"one":"other"},22:function(e){return isBetween(e,0,1)||isBetween(e,11,99)?"one":"other"},23:function(e){return isBetween(e%10,1,2)||e%20==0?"one":"other"},24:function(e){return isBetween(e,3,10)||isBetween(e,13,19)?"few":isIn(e,[2,12])?"two":isIn(e,[1,11])?"one":"other"}},i={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3}[t.replace(/-.*$/,"")];if(!(i in n)){const n=e.PDFViewerApplicationOptions;(!n||n.get("verbosity")>0)&&console.warn("plural form unknown for ["+t+"]");return function(){return"other"}}return n[i]}(a));var h="["+o._pluralRules(c)+"]";0===c&&s+"[zero]"in i?t=i[s+"[zero]"][l]:1==c&&s+"[one]"in i?t=i[s+"[one]"][l]:2==c&&s+"[two]"in i?t=i[s+"[two]"][l]:s+h in i?t=i[s+h][l]:s+"[other]"in i&&(t=i[s+"[other]"][l]);return t};function getL10nData(t,n,s){var r=i[t];if(!r){const n=e.PDFViewerApplicationOptions;(!n||n.get("verbosity")>0)&&console.warn("Translation for the key #"+t+" is missing.");if(!s)return null;r=s}var a={};for(var o in r){var l=r[o];l=substArguments(l=substIndexes(l,n,t,o),n,t);a[o]=l}return a}function substIndexes(e,t,n,s){var r=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(e);if(!r||!r.length)return e;var a,l=r[1],c=r[2];t&&c in t?a=t[c]:c in i&&(a=i[c]);if(l in o){e=(0,o[l])(e,a,n,s)}return e}function substArguments(e,t,n){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,(function(e,s){if(t&&s in t)return t[s];if(s in i)return i[s];console.log("argument {{"+s+"}} for #"+n+" is undefined.");return e}))}function translateElement(n){var i=function getL10nAttributes(t){if(!t)return{};var n=t.getAttribute("data-l10n-id"),i=t.getAttribute("data-l10n-args"),s={};if(i)try{s=JSON.parse(i)}catch(t){const i=e.PDFViewerApplicationOptions;(!i||i.get("verbosity")>0)&&console.warn("could not parse arguments for #"+n)}return{id:n,args:s}}(n);if(i.id){var s=getL10nData(i.id,i.args);if(s){if(s[r]){if(0===function getChildElementCount(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,n=0;n<e.childNodes.length;n++)t+=1===e.nodeType?1:0;return t}(n))n[r]=s[r];else{for(var a=n.childNodes,o=!1,l=0,c=a.length;l<c;l++)if(3===a[l].nodeType&&/\S/.test(a[l].nodeValue))if(o)a[l].nodeValue="";else{a[l].nodeValue=s[r];o=!0}if(!o){var h=t.createTextNode(s[r]);n.insertBefore(h,n.firstChild)}}delete s[r]}for(var d in s)n[d]=s[d]}else{const t=e.PDFViewerApplicationOptions;(!t||t.get("verbosity")>0)&&console.warn("#"+i.id+" is undefined.")}}}return{get:function(e,t,n){var i,s=e.lastIndexOf("."),a=r;if(s>0){a=e.substring(s+1);e=e.substring(0,s)}n&&((i={})[a]=n);var o=getL10nData(e,t,i);return o&&a in o?o[a]:"{{"+e+"}}"},getData:function(){return i},getText:function(){return s},getLanguage:function(){return a},setLanguage:function(e,t){loadLocale(e,(function(){t&&t()}))},getDirection:function(){var e=a.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(e)>=0?"rtl":"ltr"},translate:function translateFragment(e){for(var n=function getTranslatableChildren(e){return e?e.querySelectorAll("*[data-l10n-id]"):[]}(e=e||t.documentElement),i=n.length,s=0;s<i;s++)translateElement(n[s]);translateElement(e)},getReadyState:function(){return l},ready:function(n){n&&("complete"==l||"interactive"==l?e.setTimeout((function(){n()})):t.addEventListener&&t.addEventListener("localized",(function once(){t.removeEventListener("localized",once);n()})))}}}(window,document)},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GenericScripting=void 0;var i=n(5);t.GenericScripting=class GenericScripting{constructor(e){this._ready=(0,i.loadScript)(e,!0).then((()=>window.pdfjsSandbox.QuickJSSandbox()))}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){(await this._ready).dispatchEvent(e)}async destroySandbox(){(await this._ready).nukeSandbox()}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPrintService=PDFPrintService;var i=n(4),s=n(3),r=n(2),a=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n(32)),o=n(33);let l=null,c=null;function renderPage(e,t,n,s,r,c){const h=l.scratchCanvas;let d=r/72,u=1;const p=Math.floor(s.width*d),g=Math.floor(s.height*d);if(p>=4096||g>=4096){if(!a.default.test({width:p,height:g})){const e=function determineMaxDimensions(){const e=[4096,8192,10836,11180,11402,14188,16384];for(let t of e)if(!a.default.test({width:t+1,height:t+1}))return t;return 16384}();u=.95*Math.min(e/p,e/g)}(0,o.warn)("Page "+n+": Reduced the [printResolution] to "+Math.floor(r*u)+" because the browser can't render larger canvases. If you see blank page in the print preview, reduce [printResolution] manually to a lower value.")}d*=u;h.width=Math.floor(s.width*d);h.height=Math.floor(s.height*d);const f=Math.floor(s.width*i.CSS_UNITS)+"px",m=Math.floor(s.height*i.CSS_UNITS)+"px",b=h.getContext("2d");b.save();b.fillStyle="rgb(255, 255, 255)";b.fillRect(0,0,h.width,h.height);b.restore();return t.getPage(n).then((function(e){const n={canvasContext:b,transform:[d,0,0,d,0,0],viewport:e.getViewport({scale:1,rotation:s.rotation}),intent:"print",annotationStorage:t.annotationStorage,optionalContentConfigPromise:c};return e.render(n).promise})).then((function(){return{width:f,height:m}}))}function PDFPrintService(e,t,n,s,r=null,a,o){this.pdfDocument=e;this.pagesOverview=t;this.printContainer=n;this._printResolution=s||150;this._optionalContentConfigPromise=r||e.getOptionalContentConfig();this.l10n=a||i.NullL10n;this.currentPage=-1;this.scratchCanvas=document.createElement("canvas");this.eventBus=o}PDFPrintService.prototype={layout(){this.throwIfInactive();const e=document.querySelector("body");e.setAttribute("data-pdfjsprinting",!0);this.pagesOverview.every((function(e){return e.width===this.pagesOverview[0].width&&e.height===this.pagesOverview[0].height}),this)||console.warn("Not all pages have the same size. The printed result may be incorrect!");this.pageStyleSheet=document.createElement("style");const t=this.pagesOverview[0];this.pageStyleSheet.textContent="@supports ((size:A4) and (size:1pt 1pt)) {@page { size: "+t.width+"pt "+t.height+"pt;}}";e.appendChild(this.pageStyleSheet)},destroy(){if(l!==this)return;this.printContainer.textContent="";document.querySelector("body").removeAttribute("data-pdfjsprinting");if(this.pageStyleSheet){this.pageStyleSheet.remove();this.pageStyleSheet=null}this.scratchCanvas.width=this.scratchCanvas.height=0;this.scratchCanvas=null;l=null;ensureOverlay().then((function(){if("printServiceOverlay"===c.active){c.close("printServiceOverlay");c.unregister("printServiceOverlay")}}));d=void 0},renderPages(){const e=this.pagesOverview.length,renderNextPage=(t,n)=>{this.throwIfInactive();for(;;){++this.currentPage;if(this.currentPage>=e)break;if(!window.isInPDFPrintRange||window.isInPDFPrintRange(this.currentPage))break}if(this.currentPage>=e){renderProgress(window.filteredPageCount|e,window.filteredPageCount|e,this.l10n,this.eventBus);t();return}const i=this.currentPage;renderProgress(i,window.filteredPageCount|e,this.l10n,this.eventBus);renderPage(0,this.pdfDocument,i+1,this.pagesOverview[i],this._printResolution,this._optionalContentConfigPromise).then(this.useRenderedPage.bind(this)).then((function(){renderNextPage(t,n)}),n)};return new Promise(renderNextPage)},useRenderedPage(e){this.throwIfInactive();const t=document.createElement("img");t.style.width=e.width;t.style.height=e.height;const n=this.scratchCanvas;"toBlob"in n&&!r.viewerCompatibilityParams.disableCreateObjectURL?n.toBlob((function(e){t.src=URL.createObjectURL(e)})):t.src=n.toDataURL();const i=document.createElement("div");i.appendChild(t);this.printContainer.appendChild(i);return new Promise((function(e,n){t.onload=e;t.onerror=n}))},performPrint(){this.throwIfInactive();return new Promise((e=>{setTimeout((()=>{if(this.active){h.call(window);setTimeout(e,20)}else e()}),0)}))},get active(){return this===l},throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}};const h=window.print;window.printPDF=function(){if(s.PDFViewerApplication.enablePrint)if(l)console.warn("Ignored window.printPDF() because of a pending print job.");else{ensureOverlay().then((function(){l&&c.open("printServiceOverlay")}));try{dispatchEvent("beforeprint")}finally{if(!l){console.error("Expected print service to be initialized.");ensureOverlay().then((function(){"printServiceOverlay"===c.active&&c.close("printServiceOverlay")}));return}const e=l;l.renderPages().then((function(){return e.performPrint()})).catch((function(){})).then((function(){e.active&&abort()}))}}};function dispatchEvent(e){const t=document.createEvent("CustomEvent");t.initCustomEvent(e,!1,!1,"custom");window.dispatchEvent(t)}function abort(){if(l){l.destroy();dispatchEvent("afterprint")}}function renderProgress(e,t,n,i){const s=document.getElementById("printServiceOverlay"),r=Math.round(100*e/t),a=s.querySelector("progress"),o=s.querySelector(".relative-progress");a.value=r;n.get("print_progress_percent",{progress:r},r+"%").then((e=>{o.textContent=e}));i.dispatch("progress",{source:this,type:"print",total:t,page:e,percent:100*e/t})}s.PDFViewerApplication.printKeyDownListener=function(e){if(80===e.keyCode&&(e.ctrlKey||e.metaKey)&&!e.altKey&&(!e.shiftKey||window.chrome||window.opera)){window.printPDF();e.preventDefault();e.stopImmediatePropagation?e.stopImmediatePropagation():e.stopPropagation()}};if("onbeforeprint"in window){const stopPropagationIfNeeded=function(e){"custom"!==e.detail&&e.stopImmediatePropagation&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",stopPropagationIfNeeded);window.addEventListener("afterprint",stopPropagationIfNeeded)}let d;function ensureOverlay(){if(!d){c=s.PDFViewerApplication.overlayManager;if(!c)throw new Error("The overlay manager has not yet been initialized.");d=c.register("printServiceOverlay",document.getElementById("printServiceOverlay"),abort,!0);document.getElementById("printCancel").onclick=abort}return d}s.PDFPrintServiceFactory.instance={supportsPrinting:!0,createPrintService(e,t,n,i,s,r,a){if(l)throw new Error("The print service is created and active.");l=new PDFPrintService(e,t,n,i,s,r,a);return l}}}],t={};!function __webpack_require__(n){if(t[n])return t[n].exports;var i=t[n]={exports:{}};e[n](i,i.exports,__webpack_require__);return i.exports}(0)})();
  //# sourceMappingURL=viewer.min.js.map