UNPKG

ngx-extended-pdf-viewer

Version:

Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.

22 lines 1.04 MB
/** * @licstart The following is the entire license notice for the * Javascript code in this page * * Copyright 2021 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.worker",[],t):"object"==typeof exports?exports["pdfjs-dist/build/pdf.worker"]=t():e["pdfjs-dist/build/pdf.worker"]=e.pdfjsWorker=t()}(this,(function(){return(()=>{"use strict";var e=[,(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});t.WorkerTask=t.WorkerMessageHandler=void 0;var a=r(2),i=r(4),n=r(6),s=r(70),o=r(98),c=r(99),l=r(8);Promise.allSettled||(Promise.allSettled=function(e){const t=e.filter((e=>!!e)).map((e=>e.then((e=>({status:"fulfilled",value:e}))).catch((e=>({status:"rejected",reason:e})))));return Promise.all(t)});class WorkerTask{constructor(e){this.name=e;this.terminated=!1;this._capability=(0,a.createPromiseCapability)()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}t.WorkerTask=WorkerTask;class WorkerMessageHandler{static setup(e,t){let r=!1;e.on("test",(function wphSetupTest(t){if(!r){r=!0;e.send("test",t instanceof Uint8Array&&255===t[0])}}));e.on("configure",(function wphConfigure(e){(0,a.setVerbosityLevel)(e.verbosity)}));e.on("GetDocRequest",(function wphSetupDoc(e){return WorkerMessageHandler.createDocumentHandler(e,t)}))}static createDocumentHandler(e,t){let r,h=!1,u=null;const d=[],f=(0,a.getVerbosityLevel)(),g=e.apiVersion,p="2.12.557";if(g!==p)throw new Error(`The API version "${g}" does not match the Worker version "2.12.557".`);const m=[];for(const e in[])m.push(e);if(m.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+m.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");if("undefined"==typeof ReadableStream)throw new Error("The browser/environment lacks native support for critical functionality used by the PDF.js library (e.g. `ReadableStream`); please use a `legacy`-build instead.");const b=e.docId,y=e.docBaseUrl,w=e.docId+"_worker";let S=new o.MessageHandler(w,b,t);function ensureNotTerminated(){if(h)throw new Error("Worker was terminated")}function startWorkerTask(e){d.push(e)}function finishWorkerTask(e){e.finish();const t=d.indexOf(e);d.splice(t,1)}async function loadDocument(e){await r.ensureDoc("checkHeader");await r.ensureDoc("parseStartXRef");await r.ensureDoc("parse",[e]);await r.ensureDoc("checkFirstPage",[e]);await r.ensureDoc("checkLastPage",[e]);const t=await r.ensureDoc("isPureXfa");if(t){const e=new WorkerTask("loadXfaFonts");startWorkerTask(e);await Promise.all([r.loadXfaFonts(S,e).catch((e=>{})).then((()=>finishWorkerTask(e))),r.loadXfaImages()])}const[a,i]=await Promise.all([r.ensureDoc("numPages"),r.ensureDoc("fingerprints")]);return{numPages:a,fingerprints:i,htmlForXfa:t?await r.ensureDoc("htmlForXfa"):null}}function getPdfManager(e,t,r){const i=(0,a.createPromiseCapability)();let s;const o=e.source;if(o.data){try{s=new n.LocalPdfManager(b,o.data,o.password,S,t,r,y);i.resolve(s)}catch(e){i.reject(e)}return i.promise}let l,h=[];try{l=new c.PDFWorkerStream(S)}catch(e){i.reject(e);return i.promise}const d=l.getFullReader();d.headersReady.then((function(){if(!d.isRangeSupported)return;const e=o.disableAutoFetch||d.isStreamingSupported;s=new n.NetworkPdfManager(b,l,{msgHandler:S,password:o.password,length:d.contentLength,disableAutoFetch:e,rangeChunkSize:o.rangeChunkSize},t,r,y);for(let e=0;e<h.length;e++)s.sendProgressiveData(h[e]);h=[];i.resolve(s);u=null})).catch((function(e){i.reject(e);u=null}));let f=0;new Promise((function(e,c){const readChunk=function({value:e,done:l}){try{ensureNotTerminated();if(l){s||function(){const e=(0,a.arraysToBytes)(h);o.length&&e.length!==o.length&&(0,a.warn)("reported HTTP length is different from actual");try{s=new n.LocalPdfManager(b,e,o.password,S,t,r,y);i.resolve(s)}catch(e){i.reject(e)}h=[]}();u=null;return}f+=(0,a.arrayByteLength)(e);d.isStreamingSupported||S.send("DocProgress",{loaded:f,total:Math.max(f,d.contentLength||0)});s?s.sendProgressiveData(e):h.push(e);d.read().then(readChunk,c)}catch(e){c(e)}};d.read().then(readChunk,c)})).catch((function(e){i.reject(e);u=null}));u=function(e){l.cancelAllRequests(e)};return i.promise}S.on("GetPage",(function wphSetupGetPage(e){return r.getPage(e.pageIndex).then((function(e){return Promise.all([r.ensure(e,"rotate"),r.ensure(e,"ref"),r.ensure(e,"userUnit"),r.ensure(e,"view")]).then((function([e,t,r,a]){return{rotate:e,ref:t,userUnit:r,view:a}}))}))}));S.on("GetPageIndex",(function wphSetupGetPageIndex({ref:e}){const t=i.Ref.get(e.num,e.gen);return r.ensureCatalog("getPageIndex",[t])}));S.on("GetDestinations",(function wphSetupGetDestinations(e){return r.ensureCatalog("destinations")}));S.on("GetDestination",(function wphSetupGetDestination(e){return r.ensureCatalog("getDestination",[e.id])}));S.on("GetPageLabels",(function wphSetupGetPageLabels(e){return r.ensureCatalog("pageLabels")}));S.on("GetPageLayout",(function wphSetupGetPageLayout(e){return r.ensureCatalog("pageLayout")}));S.on("GetPageMode",(function wphSetupGetPageMode(e){return r.ensureCatalog("pageMode")}));S.on("GetViewerPreferences",(function(e){return r.ensureCatalog("viewerPreferences")}));S.on("GetOpenAction",(function(e){return r.ensureCatalog("openAction")}));S.on("GetAttachments",(function wphSetupGetAttachments(e){return r.ensureCatalog("attachments")}));S.on("GetJavaScript",(function wphSetupGetJavaScript(e){return r.ensureCatalog("javaScript")}));S.on("GetDocJSActions",(function wphSetupGetDocJSActions(e){return r.ensureCatalog("jsActions")}));S.on("GetPageJSActions",(function({pageIndex:e}){return r.getPage(e).then((function(e){return r.ensure(e,"jsActions")}))}));S.on("GetOutline",(function wphSetupGetOutline(e){return r.ensureCatalog("documentOutline")}));S.on("GetOptionalContentConfig",(function(e){return r.ensureCatalog("optionalContentConfig")}));S.on("GetPermissions",(function(e){return r.ensureCatalog("permissions")}));S.on("GetMetadata",(function wphSetupGetMetadata(e){return Promise.all([r.ensureDoc("documentInfo"),r.ensureCatalog("metadata")])}));S.on("GetMarkInfo",(function wphSetupGetMarkInfo(e){return r.ensureCatalog("markInfo")}));S.on("GetData",(function wphSetupGetData(e){r.requestLoadedStream();return r.onLoadedStream().then((function(e){return e.bytes}))}));S.on("GetAnnotations",(function({pageIndex:e,intent:t}){return r.getPage(e).then((function(e){return e.getAnnotationsData(t)}))}));S.on("GetFieldObjects",(function(e){return r.ensureDoc("fieldObjects")}));S.on("HasJSActions",(function(e){return r.ensureDoc("hasJSActions")}));S.on("GetCalculationOrderIds",(function(e){return r.ensureDoc("calculationOrderIds")}));S.on("SaveDocument",(function({isPureXfa:e,numPages:t,annotationStorage:n,filename:o}){r.requestLoadedStream();const c=[r.onLoadedStream(),r.ensureCatalog("acroForm"),r.ensureCatalog("acroFormRef"),r.ensureDoc("xref"),r.ensureDoc("startXRef")];if(e)c.push(r.serializeXfaData(n));else for(let e=0;e<t;e++)c.push(r.getPage(e).then((function(t){const r=new WorkerTask(`Save: page ${e}`);return t.save(S,r,n).finally((function(){finishWorkerTask(r)}))})));return Promise.all(c).then((function([t,r,n,c,l,...h]){let u=[],d=null;if(e){d=h[0];if(!d)return t.bytes}else{for(const e of h)u=e.filter((e=>null!==e)).reduce(((e,t)=>e.concat(t)),u);if(0===u.length)return t.bytes}const f=r instanceof i.Dict&&r.get("XFA")||null;let g=null,p=!1;if(Array.isArray(f)){for(let e=0,t=f.length;e<t;e+=2)if("datasets"===f[e]){g=f[e+1];n=null;p=!0}null===g&&(g=c.getNewRef())}else if(f){n=null;(0,a.warn)("Unsupported XFA type.")}let m=Object.create(null);if(c.trailer){const e=Object.create(null),t=c.trailer.get("Info")||null;t instanceof i.Dict&&t.forEach(((t,r)=>{(0,a.isString)(t)&&(0,a.isString)(r)&&(e[t]=(0,a.stringToPDFString)(r))}));m={rootRef:c.trailer.getRaw("Root")||null,encryptRef:c.trailer.getRaw("Encrypt")||null,newRef:c.getNewRef(),infoRef:c.trailer.getRaw("Info")||null,info:e,fileIds:c.trailer.get("ID")||null,startXRef:l,filename:o}}c.resetNewRef();return(0,s.incrementalUpdate)({originalData:t.bytes,xrefInfo:m,newRefs:u,xref:c,hasXfa:!!f,xfaDatasetsRef:g,hasXfaDatasetsEntry:p,acroFormRef:n,acroForm:r,xfaData:d})}))}));S.on("GetOperatorList",(function wphSetupRenderPage(e,t){const i=e.pageIndex;r.getPage(i).then((function(r){const n=new WorkerTask(`GetOperatorList: page ${i}`);startWorkerTask(n);const s=f>=a.VerbosityLevel.INFOS?Date.now():0;r.getOperatorList({handler:S,sink:t,task:n,intent:e.intent,cacheKey:e.cacheKey,annotationStorage:e.annotationStorage}).then((function(e){finishWorkerTask(n);s&&(0,a.info)(`page=${i+1} - getOperatorList: time=${Date.now()-s}ms, len=${e.length}`);t.close()}),(function(e){finishWorkerTask(n);if(!n.terminated){S.send("UnsupportedFeature",{featureId:a.UNSUPPORTED_FEATURES.errorOperatorList});t.error(e)}}))}))}));S.on("GetTextContent",(function wphExtractText(e,t){const i=e.pageIndex;r.getPage(i).then((function(r){const n=new WorkerTask("GetTextContent: page "+i);startWorkerTask(n);const s=f>=a.VerbosityLevel.INFOS?Date.now():0;r.extractTextContent({handler:S,task:n,sink:t,normalizeWhitespace:e.normalizeWhitespace,includeMarkedContent:e.includeMarkedContent,combineTextItems:e.combineTextItems}).then((function(){finishWorkerTask(n);s&&(0,a.info)(`page=${i+1} - getTextContent: time=`+(Date.now()-s)+"ms");t.close()}),(function(e){finishWorkerTask(n);n.terminated||t.error(e)}))}))}));S.on("GetStructTree",(function wphGetStructTree(e){return r.getPage(e.pageIndex).then((function(e){return r.ensure(e,"getStructTree")}))}));S.on("FontFallback",(function(e){return r.fontFallback(e.id,S)}));S.on("Cleanup",(function wphCleanup(e){return r.cleanup(!0)}));S.on("Terminate",(function wphTerminate(e){h=!0;const t=[];if(r){r.terminate(new a.AbortException("Worker was terminated."));const e=r.cleanup();t.push(e);r=null}else(0,i.clearPrimitiveCaches)();u&&u(new a.AbortException("Worker was terminated."));for(const e of d){t.push(e.finished);e.terminate()}return Promise.all(t).then((function(){S.destroy();S=null}))}));S.on("Ready",(function wphReady(t){!function setupDoc(e){function onSuccess(e){ensureNotTerminated();S.send("GetDoc",{pdfInfo:e})}function onFailure(e){ensureNotTerminated();if(e instanceof a.PasswordException){const t=new WorkerTask(`PasswordException: response ${e.code}`);startWorkerTask(t);S.sendWithPromise("PasswordRequest",e).then((function({password:e}){finishWorkerTask(t);r.updatePassword(e);pdfManagerReady()})).catch((function(){finishWorkerTask(t);S.send("DocException",e)}))}else e instanceof a.InvalidPDFException||e instanceof a.MissingPDFException||e instanceof a.UnexpectedResponseException||e instanceof a.UnknownErrorException?S.send("DocException",e):S.send("DocException",new a.UnknownErrorException(e.message,e.toString()))}function pdfManagerReady(){ensureNotTerminated();loadDocument(!1).then(onSuccess,(function(e){ensureNotTerminated();if(e instanceof l.XRefParseException){r.requestLoadedStream();r.onLoadedStream().then((function(){ensureNotTerminated();loadDocument(!0).then(onSuccess,onFailure)}))}else onFailure(e)}))}ensureNotTerminated();const t={maxImageSize:e.maxImageSize,disableFontFace:e.disableFontFace,ignoreErrors:e.ignoreErrors,isEvalSupported:e.isEvalSupported,fontExtraProperties:e.fontExtraProperties,useSystemFonts:e.useSystemFonts,cMapUrl:e.cMapUrl,standardFontDataUrl:e.standardFontDataUrl};let i=t.cMapUrl;"Function"===i.constructor.name&&(t.cMapUrl=i());getPdfManager(e,t,e.enableXfa).then((function(e){if(h){e.terminate(new a.AbortException("Worker was terminated."));throw new Error("Worker was terminated")}r=e;r.onLoadedStream().then((function(e){S.send("DataLoaded",{length:e.bytes.byteLength})}))})).then(pdfManagerReady,onFailure)}(e);e=null}));S.on("showUnverifiedSignatures",(function wphReady(e){e&&(0,a.info)("showUnverifiedSignatures="+e+". This is an incompletely implemented feature. Signatures cannot be validated, so use it at own risk.");self.showUnverifiedSignatures=e}));return w}static initializeFromPort(e){const t=new o.MessageHandler("worker","main",e);WorkerMessageHandler.setup(t,e);t.send("ready",null)}}t.WorkerMessageHandler=WorkerMessageHandler;"undefined"==typeof window&&"undefined"!=typeof self&&function isMessagePort(e){return"function"==typeof e.postMessage&&"onmessage"in e}(self)&&WorkerMessageHandler.initializeFromPort(self)},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.UNSUPPORTED_FEATURES=t.TextRenderingMode=t.StreamType=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.IsLittleEndianCached=t.IsEvalSupportedCached=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FontType=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0;t.arrayByteLength=arrayByteLength;t.arraysToBytes=function arraysToBytes(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let r=0;for(let a=0;a<t;a++)r+=arrayByteLength(e[a]);let a=0;const i=new Uint8Array(r);for(let r=0;r<t;r++){let t=e[r];t instanceof Uint8Array||(t="string"==typeof t?stringToBytes(t):new Uint8Array(t));const n=t.byteLength;i.set(t,a);a+=n}return i};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,r=8192;if(t<r)return String.fromCharCode.apply(null,e);const a=[];for(let i=0;i<t;i+=r){const n=Math.min(i+r,t),s=e.subarray(i,n);a.push(String.fromCharCode.apply(null,s))}return a.join("")};t.createObjectURL=function createObjectURL(e,t="",r=!1){if(URL.createObjectURL&&"undefined"!=typeof Blob&&!r)return URL.createObjectURL(new Blob([e],{type:t}));const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let i=`data:${t};base64,`;for(let t=0,r=e.length;t<r;t+=3){const n=255&e[t],s=255&e[t+1],o=255&e[t+2];i+=a[n>>2]+a[(3&n)<<4|s>>4]+a[t+1<r?(15&s)<<2|o>>6:64]+a[t+2<r?63&o:64]}return i};t.createPromiseCapability=function createPromiseCapability(){const e=Object.create(null);let t=!1;Object.defineProperty(e,"settled",{get:()=>t});e.promise=new Promise((function(r,a){e.resolve=function(e){t=!0;r(e)};e.reject=function(e){t=!0;a(e)}}));return e};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e,t=null,r=null){if(!e)return null;try{if(r&&"string"==typeof e){if(r.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t&&t.length>=2&&(e=`http://${e}`)}if(r.tryConvertEncoding)try{e=stringToUTF8String(e)}catch(e){}}const a=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:":case"capacitor":return!0;default:return!1}}(a))return a}catch(e){}return null};t.escapeString=function escapeString(e){return e.replace(/([()\\\n\r])/g,(e=>"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))};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 i};t.info=function info(e){i>=a.INFOS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Info: ${e}`):Window&&Window.ngxConsole?Window.ngxConsole.log(`Info: ${e}`):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;for(let r=0,a=e.length;r<a;r++)if(e[r]!==t[r])return!1;return!0};t.isAscii=function isAscii(e){return/^[\x00-\x7F]*$/.test(e)};t.isBool=function isBool(e){return"boolean"==typeof e};t.isNum=function isNum(e){return"number"==typeof e};t.isSameOrigin=function isSameOrigin(e,t){let r;try{r=new URL(e);if(!r.origin||"null"===r.origin)return!1}catch(e){return!1}const a=new URL(t,r);return r.origin===a.origin};t.isString=function isString(e){return"string"==typeof e};t.objectFromMap=function objectFromMap(e){const t=Object.create(null);for(const[r,a]of e)t[r]=a;return t};t.objectSize=function objectSize(e){return Object.keys(e).length};t.removeNullCharacters=function removeNullCharacters(e,t=!1){if("string"!=typeof e){warn("The argument for removeNullCharacters must be a string.");return e}t&&(e=e.replace(o," "));return e.replace(s,"")};t.setVerbosityLevel=function setVerbosityLevel(e){Number.isInteger(e)&&(i=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,r=[];if("þ"===e[0]&&"ÿ"===e[1])for(let a=2;a<t;a+=2)r.push(String.fromCharCode(e.charCodeAt(a)<<8|e.charCodeAt(a+1)));else if("ÿ"===e[0]&&"þ"===e[1])for(let a=2;a<t;a+=2)r.push(String.fromCharCode(e.charCodeAt(a+1)<<8|e.charCodeAt(a)));else for(let a=0;a<t;++a){const t=u[e.charCodeAt(a)];r.push(t?String.fromCharCode(t):e.charAt(a))}return r.join("")};t.stringToUTF16BEString=function stringToUTF16BEString(e){const t=["þÿ"];for(let r=0,a=e.length;r<a;r++){const a=e.charCodeAt(r);t.push(String.fromCharCode(a>>8&255),String.fromCharCode(255&a))}return t.join("")};t.stringToUTF8String=stringToUTF8String;t.unreachable=unreachable;t.utf8StringToString=function utf8StringToString(e){return unescape(encodeURIComponent(e))};t.warn=warn;r(3);t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};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:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",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",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const a={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=a;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",signatures:"signatures",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",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"};t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let i=a.WARNINGS;function warn(e){i>=a.WARNINGS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Warning: ${e}`):Window&&Window.ngxConsole?Window.ngxConsole.log(`Warning: ${e}`):console.log(`Warning: ${e}`))}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function shadow(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!1});return r}const n=function BaseExceptionClosure(){function BaseException(e,t){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();t.BaseException=n;t.PasswordException=class PasswordException extends n{constructor(e,t){super(e,"PasswordException");this.code=t}};t.UnknownErrorException=class UnknownErrorException extends n{constructor(e,t){super(e,"UnknownErrorException");this.details=t}};t.InvalidPDFException=class InvalidPDFException extends n{constructor(e){super(e,"InvalidPDFException")}};t.MissingPDFException=class MissingPDFException extends n{constructor(e){super(e,"MissingPDFException")}};t.UnexpectedResponseException=class UnexpectedResponseException extends n{constructor(e,t){super(e,"UnexpectedResponseException");this.status=t}};t.FormatError=class FormatError extends n{constructor(e){super(e,"FormatError")}};t.AbortException=class AbortException extends n{constructor(e){super(e,"AbortException")}};const s=/\x00+/g,o=/[\x01-\x1F]/g;function stringToBytes(e){assert("string"==typeof e,"Invalid argument for stringToBytes");const t=e.length,r=new Uint8Array(t);for(let a=0;a<t;++a)r[a]=255&e.charCodeAt(a);return r}function arrayByteLength(e){if(void 0!==e.length)return e.length;assert(void 0!==e.byteLength,"arrayByteLength - invalid argument.");return e.byteLength}const c={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=c;const l={get value(){return shadow(this,"value",function isEvalSupported(){try{new Function("");return!0}catch(e){return!1}}())}};t.IsEvalSupportedCached=l;const h=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,r){return`#${h[e]}${h[t]}${h[r]}`}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 r=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])/r,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/r]}static getAxialAlignedBoundingBox(e,t){const r=Util.applyTransform(e,t),a=Util.applyTransform(e.slice(2,4),t),i=Util.applyTransform([e[0],e[3]],t),n=Util.applyTransform([e[2],e[1]],t);return[Math.min(r[0],a[0],i[0],n[0]),Math.min(r[1],a[1],i[1],n[1]),Math.max(r[0],a[0],i[0],n[0]),Math.max(r[1],a[1],i[1],n[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]],r=e[0]*t[0]+e[1]*t[2],a=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],n=e[2]*t[1]+e[3]*t[3],s=(r+n)/2,o=Math.sqrt((r+n)**2-4*(r*n-i*a))/2,c=s+o||1,l=s-o||1;return[Math.sqrt(c),Math.sqrt(l)]}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 r=[e[0],e[2],t[0],t[2]].sort(compare),a=[e[1],e[3],t[1],t[3]].sort(compare),i=[];e=Util.normalizeRect(e);t=Util.normalizeRect(t);if(!(r[0]===e[0]&&r[1]===t[0]||r[0]===t[0]&&r[1]===e[0]))return null;i[0]=r[1];i[2]=r[2];if(!(a[0]===e[1]&&a[1]===t[1]||a[0]===t[1]&&a[1]===e[1]))return null;i[1]=a[1];i[3]=a[2];return i}static bezierBoundingBox(e,t,r,a,i,n,s,o){const c=[],l=[[],[]];let h,u,d,f,g,p,m,b;for(let l=0;l<2;++l){if(0===l){u=6*e-12*r+6*i;h=-3*e+9*r-9*i+3*s;d=3*r-3*e}else{u=6*t-12*a+6*n;h=-3*t+9*a-9*n+3*o;d=3*a-3*t}if(Math.abs(h)<1e-12){if(Math.abs(u)<1e-12)continue;f=-d/u;0<f&&f<1&&c.push(f)}else{m=u*u-4*d*h;b=Math.sqrt(m);if(!(m<0)){g=(-u+b)/(2*h);0<g&&g<1&&c.push(g);p=(-u-b)/(2*h);0<p&&p<1&&c.push(p)}}}let y,w=c.length;const S=w;for(;w--;){f=c[w];y=1-f;l[0][w]=y*y*y*e+3*y*y*f*r+3*y*f*f*i+f*f*f*s;l[1][w]=y*y*y*t+3*y*y*f*a+3*y*f*f*n+f*f*f*o}l[0][S]=e;l[1][S]=t;l[0][S+1]=s;l[1][S+1]=o;l[0].length=l[1].length=S+2;return[Math.min(...l[0]),Math.min(...l[1]),Math.max(...l[0]),Math.max(...l[1])]}}t.Util=Util;const u=[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];function stringToUTF8String(e){return decodeURIComponent(escape(e))}},()=>{},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});t.RefSetCache=t.RefSet=t.Ref=t.Name=t.EOF=t.Dict=t.Cmd=t.CIRCULAR_REF=void 0;t.clearPrimitiveCaches=function clearPrimitiveCaches(){c._clearCache();o._clearCache();h._clearCache()};t.isCmd=function isCmd(e,t){return e instanceof c&&(void 0===t||e.cmd===t)};t.isDict=function isDict(e,t){return e instanceof Dict&&(void 0===t||isName(e.get("Type"),t))};t.isName=isName;t.isRef=function isRef(e){return e instanceof h};t.isRefsEqual=function isRefsEqual(e,t){return e.num===t.num&&e.gen===t.gen};t.isStream=function isStream(e){return e instanceof i.BaseStream};var a=r(2),i=r(5);const n=Symbol("CIRCULAR_REF");t.CIRCULAR_REF=n;const s=Symbol("EOF");t.EOF=s;const o=function NameClosure(){let e=Object.create(null);class Name{constructor(e){this.name=e}static get(t){const r=e[t];return r||(e[t]=new Name(t))}static _clearCache(){e=Object.create(null)}}return Name}();t.Name=o;const c=function CmdClosure(){let e=Object.create(null);class Cmd{constructor(e){this.cmd=e}static get(t){const r=e[t];return r||(e[t]=new Cmd(t))}static _clearCache(){e=Object.create(null)}}return Cmd}();t.Cmd=c;const l=function nonSerializableClosure(){return l};class Dict{constructor(e=null){this._map=Object.create(null);this.xref=e;this.objId=null;this.suppressEncryption=!1;this.__nonSerializable__=l}assignXref(e){this.xref=e}get size(){return Object.keys(this._map).length}get(e,t,r){let a=this._map[e];if(void 0===a&&void 0!==t){a=this._map[t];void 0===a&&void 0!==r&&(a=this._map[r])}return a instanceof h&&this.xref?this.xref.fetch(a,this.suppressEncryption):a}async getAsync(e,t,r){let a=this._map[e];if(void 0===a&&void 0!==t){a=this._map[t];void 0===a&&void 0!==r&&(a=this._map[r])}return a instanceof h&&this.xref?this.xref.fetchAsync(a,this.suppressEncryption):a}getArray(e,t,r){let a=this._map[e];if(void 0===a&&void 0!==t){a=this._map[t];void 0===a&&void 0!==r&&(a=this._map[r])}a instanceof h&&this.xref&&(a=this.xref.fetch(a,this.suppressEncryption));if(Array.isArray(a)){a=a.slice();for(let e=0,t=a.length;e<t;e++)a[e]instanceof h&&this.xref&&(a[e]=this.xref.fetch(a[e],this.suppressEncryption))}return a}getRaw(e){return this._map[e]}getKeys(){return Object.keys(this._map)}getRawValues(){return Object.values(this._map)}set(e,t){this._map[e]=t}has(e){return void 0!==this._map[e]}forEach(e){for(const t in this._map)e(t,this.get(t))}static get empty(){const e=new Dict(null);e.set=(e,t)=>{(0,a.unreachable)("Should not call `set` on the empty dictionary.")};return(0,a.shadow)(this,"empty",e)}static merge({xref:e,dictArray:t,mergeSubDicts:r=!1}){const a=new Dict(e),i=new Map;for(const e of t)if(e instanceof Dict)for(const[t,a]of Object.entries(e._map)){let e=i.get(t);if(void 0===e){e=[];i.set(t,e)}else if(!(r&&a instanceof Dict))continue;e.push(a)}for(const[t,r]of i){if(1===r.length||!(r[0]instanceof Dict)){a._map[t]=r[0];continue}const i=new Dict(e);for(const e of r)for(const[t,r]of Object.entries(e._map))void 0===i._map[t]&&(i._map[t]=r);i.size>0&&(a._map[t]=i)}i.clear();return a.size>0?a:Dict.empty}}t.Dict=Dict;const h=function RefClosure(){let e=Object.create(null);class Ref{constructor(e,t){this.num=e;this.gen=t}toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}static get(t,r){const a=0===r?`${t}R`:`${t}R${r}`,i=e[a];return i||(e[a]=new Ref(t,r))}static _clearCache(){e=Object.create(null)}}return Ref}();t.Ref=h;t.RefSet=class RefSet{constructor(e=null){this._set=new Set(e&&e._set)}has(e){return this._set.has(e.toString())}put(e){this._set.add(e.toString())}remove(e){this._set.delete(e.toString())}forEach(e){for(const t of this._set.values())e(t)}clear(){this._set.clear()}};t.RefSetCache=class RefSetCache{constructor(){this._map=new Map}get size(){return this._map.size}get(e){return this._map.get(e.toString())}has(e){return this._map.has(e.toString())}put(e,t){this._map.set(e.toString(),t)}putAlias(e,t){this._map.set(e.toString(),this.get(t))}forEach(e){for(const t of this._map.values())e(t)}clear(){this._map.clear()}};function isName(e,t){return e instanceof o&&(void 0===t||e.name===t)}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BaseStream=void 0;var a=r(2);class BaseStream{constructor(){this.constructor===BaseStream&&(0,a.unreachable)("Cannot initialize BaseStream.")}get length(){(0,a.unreachable)("Abstract getter `length` accessed")}get isEmpty(){(0,a.unreachable)("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return(0,a.shadow)(this,"isDataLoaded",!0)}getByte(){(0,a.unreachable)("Abstract method `getByte` called")}getBytes(e,t=!1){(0,a.unreachable)("Abstract method `getBytes` called")}peekByte(){const e=this.getByte();-1!==e&&this.pos--;return e}peekBytes(e,t=!1){const r=this.getBytes(e,t);this.pos-=r.length;return r}getUint16(){const e=this.getByte(),t=this.getByte();return-1===e||-1===t?-1:(e<<8)+t}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(e,t){(0,a.unreachable)("Abstract method `getByteRange` called")}getString(e){return(0,a.bytesToString)(this.getBytes(e,!1))}skip(e){this.pos+=e||1}reset(){(0,a.unreachable)("Abstract method `reset` called")}moveStart(){(0,a.unreachable)("Abstract method `moveStart` called")}makeSubStream(e,t,r=null){(0,a.unreachable)("Abstract method `makeSubStream` called")}getBaseStreams(){return null}}t.BaseStream=BaseStream},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});t.NetworkPdfManager=t.LocalPdfManager=void 0;var a=r(2),i=r(7),n=r(8),s=r(10),o=r(9);function parseDocBaseUrl(e){if(e){const t=(0,a.createValidAbsoluteUrl)(e);if(t)return t.href;(0,a.warn)(`Invalid absolute docBaseUrl: "${e}".`)}return null}class BasePdfManager{constructor(){this.constructor===BasePdfManager&&(0,a.unreachable)("Cannot initialize BasePdfManager.")}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}onLoadedStream(){(0,a.unreachable)("Abstract method `onLoadedStream` called")}ensureDoc(e,t){return this.ensure(this.pdfDocument,e,t)}ensureXRef(e,t){return this.ensure(this.pdfDocument.xref,e,t)}ensureCatalog(e,t){return this.ensure(this.pdfDocument.catalog,e,t)}getPage(e){return this.pdfDocument.getPage(e)}fontFallback(e,t){return this.pdfDocument.fontFallback(e,t)}loadXfaFonts(e,t){return this.pdfDocument.loadXfaFonts(e,t)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(e){return this.pdfDocument.serializeXfaData(e)}cleanup(e=!1){return this.pdfDocument.cleanup(e)}async ensure(e,t,r){(0,a.unreachable)("Abstract method `ensure` called")}requestRange(e,t){(0,a.unreachable)("Abstract method `requestRange` called")}requestLoadedStream(){(0,a.unreachable)("Abstract method `requestLoadedStream` called")}sendProgressiveData(e){(0,a.unreachable)("Abstract method `sendProgressiveData` called")}updatePassword(e){this._password=e}terminate(e){(0,a.unreachable)("Abstract method `terminate` called")}}t.LocalPdfManager=class LocalPdfManager extends BasePdfManager{constructor(e,t,r,a,i,n,c){super();this._docId=e;this._password=r;this._docBaseUrl=parseDocBaseUrl(c);this.msgHandler=a;this.evaluatorOptions=i;this.enableXfa=n;const l=new o.Stream(t);this.pdfDocument=new s.PDFDocument(this,l);this._loadedStreamPromise=Promise.resolve(l)}async ensure(e,t,r){const a=e[t];return"function"==typeof a?a.apply(e,r):a}requestRange(e,t){return Promise.resolve()}requestLoadedStream(){}onLoadedStream(){return this._loadedStreamPromise}terminate(e){}};t.NetworkPdfManager=class NetworkPdfManager extends BasePdfManager{constructor(e,t,r,a,n,o){super();this._docId=e;this._password=r.password;this._docBaseUrl=parseDocBaseUrl(o);this.msgHandler=r.msgHandler;this.evaluatorOptions=a;this.enableXfa=n;this.streamManager=new i.ChunkedStreamManager(t,{msgHandler:r.msgHandler,length:r.length,disableAutoFetch:r.disableAutoFetch,rangeChunkSize:r.rangeChunkSize});this.pdfDocument=new s.PDFDocument(this,this.streamManager.getStream())}async ensure(e,t,r){try{const a=e[t];return"function"==typeof a?a.apply(e,r):a}catch(a){if(!(a instanceof n.MissingDataException))throw a;await this.requestRange(a.begin,a.end);return this.ensure(e,t,r)}}requestRange(e,t){return this.streamManager.requestRange(e,t)}requestLoadedStream(){this.streamManager.requestAllChunks()}sendProgressiveData(e){this.streamManager.onReceiveData({chunk:e})}onLoadedStream(){return this.streamManager.onLoadedStream()}terminate(e){this.streamManager.abort(e)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});t.ChunkedStreamManager=t.ChunkedStream=void 0;var a=r(2),i=r(8),n=r(9);class ChunkedStream extends n.Stream{constructor(e,t,r){super(new Uint8Array(e),0,e,null);this.chunkSize=t;this._loadedChunks=new Set;this.numChunks=Math.ceil(e/t);this.manager=r;this.progressiveDataLength=0;this.lastSuccessfulEnsureByteChunk=-1}getMissingChunks(){const e=[];for(let t=0,r=this.numChunks;t<r;++t)this._loadedChunks.has(t)||e.push(t);return e}get numChunksLoaded(){return this._loadedChunks.size}get isDataLoaded(){return this.numChunksLoaded===this.numChunks}onReceiveData(e,t){const r=this.chunkSize;if(e%r!=0)throw new Error(`Bad begin offset: ${e}`);const a=e+t.byteLength;if(a%r!=0&&a!==this.bytes.length)throw new Error(`Bad end offset: ${a}`);this.bytes.set(new Uint8Array(t),e);const i=Math.floor(e/r),n=Math.floor((a-1)/r)+1;for(let e=i;e<n;++e)this._loadedChunks.add(e)}onReceiveProgressiveData(e){let t=this.progressiveDataLength;const r=Math.floor(t/this.chunkSize);this.bytes.set(new Uint8Array(e),t);t+=e.byteLength;this.progressiveDataLength=t;const a=t>=this.end?this.numChunks:Math.floor(t/this.chunkSize);for(let e=r;e<a;++e)this._loadedChunks.add(e)}ensureByte(e){if(e<this.progressiveDataLength)return;const t=Math.floor(e/this.chunkSize);if(!(t>this.numChunks)&&t!==this.lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(t))throw new i.MissingDataException(e,e+1);this.lastSuccessfulEnsureByteChunk=t}}ensureRange(e,t){if(e>=t)return;if(t<=this.progressiveDataLength)return;const r=Math.floor(e/this.chunkSize);if(r>this.numChunks)return;const a=Math.min(Math.floor((t-1)/this.chunkSize)+1,this.numChunks);for(let n=r;n<a;++n)if(!this._loadedChunks.has(n))throw new i.MissingDataException(e,t)}nextEmptyChunk(e){const t=this.numChunks;for(let r=0;r<t;++r){const a=(e+r)%t;if(!this._loadedChunks.has(a))return a}return null}hasChunk(e){return this._loadedChunks.has(e)}getByte(){const e=this.pos;if(e>=this.end)return-1;e>=this.progressiveDataLength&&this.ensureByte(e);return this.bytes[this.pos++]}getBytes(e,t=!1){const r=this.bytes,a=this.pos,i=this.end;if(!e){i>this.progressiveDataLength&&this.ensureRange(a,i);const e=r.subarray(a,i);return t?new Uint8ClampedArray(e):e}let n=a+e;n>i&&(n=i);n>this.progressiveDataLength&&this.ensureRange(a,n);this.pos=n;const s=r.subarray(a,n);return t?new Uint8ClampedArray(s):s}getByteRange(e,t){e<0&&(e=0);t>this.end&&(t=this.end);t>this.progressiveDataLength&&this.ensureRange(e,t);return this.bytes.subarray(e,t)}makeSubStream(e,t,r=null){t?e+t>this.progressiveDataLength&&this.ensureRange(e,e+t):e>=this.progressiveDataLength&&this.ensureByte(e);function ChunkedStreamSubstream(){}ChunkedStreamSubstream.prototype=Object.create(this);ChunkedStreamSubstream.prototype.getMissingChunks=function(){const e=this.chunkSize,t=Math.floor(this.start/e),r=Math.floor((this.end-1)/e)+1,a=[];for(let e=t;e<r;++e)this._loadedChunks.has(e)||a.push(e);return a};Object.defineProperty(ChunkedStreamSubstream.prototype,"isDataLoaded",{get(){return this.numChunksLoaded===this.numChunks||0===this.getMissingChunks().length},configurable:!0});const a=new ChunkedStreamSubstream;a.pos=a.start=e;a.end=e+t||this.end;a.dict=r;return a}getBaseStreams(){return[this]}}t.ChunkedStream=ChunkedStream;t.ChunkedStreamManager=class ChunkedStreamManager{constructor(e,t){this.length=t.length;this.chunkSize=t.rangeChunkSize;this.stream=new ChunkedStream(this.length,this.chunkSize,this);this.pdfNetworkStream=e;this.disableAutoFetch=t.disableAutoFetch;this.msgHandler=t.msgHandler;this.currRequestId=0;this._chunksNeededByRequest=new Map;this._requestsByChunk=new Map;this._promisesByRequest=new Map;this.progressiveDataLength=0;this.aborted=!1;this._loadedStreamCapability=(0,a.createPromiseCapability)()}onLoadedStream(){return this._loadedStreamCapability.promise}sendRequest(e,t){const r=this.pdfNetworkStream.getRangeReader(e,t);r.isStreamingSupported||(r.onProgress=this.onProgress.bind(this));let i=[],n=0;return new Promise(((e,t)=>{const readChunk=s=>{try{if(!s.done){const e=s.value;i.push(e);n+=(0,a.arrayByteLength)(e);r.isStreamingSupported&&this.onProgress({loaded:n});r.read().then(readChunk,t);return}const o=(0,a.arraysToBytes)(i);i=null;e(o)}catch(e){t(e)}};r.read().then(readChunk,t)})).then((t=>{this.aborted||this.onReceiveData({chunk:t,begin:e})}))}requestAllChunks(){const e=this.stream.getMissingChunks();this._requestChunks(e);return this._loadedStreamCapability.promise}_requestChunks(e){const t=this.currRequestId++,r=new Set;this._chunksNeededByRequest.set(t,r);for(const t of e)this.stream.hasChunk(t)||r.add(t);if(0===r.size)return Promise.resolve();const i=(0,a.createPromiseCapability)();this._promisesByRequest.set(t,i);const n=[];for(const e of r){let r=this._requestsByChunk.get(e);if(!r){r=[];this._requestsByChunk.set(e,r);n.push(e)}r.push(t)}if(n.length>0){const e=this.groupChunks(n);for(const t of e){const e=t.beginChunk*this.chunkSize,r=Math.min(t.endChunk*this.chunkSize,this.length);this.sendRequest(e,r).catch(i.reject)}}return i.promise.catch((e=>{if(!this.aborted)throw e}))}getStream(){return this.stream}requestRange(e,t){t=Math.min(t,this.length);const r=this.getBeginChunk(e),a=this.getEndChunk(t),i=[];for(let e=r;e<a;++e)i.push(e);return this._requestChunks(i)}requestRanges(e=[]){const t=[];for(const r of e){const e=this.getBeginChunk(r.begin),a=this.getEndChunk(r.end);for(let r=e;r<a;++r)t.includes(r)||t.push(r)}t.sort((function(e,t){return e-t}));return this._requestChunks(t)}groupChunks(e){const t=[];let r=-1,a=-1;for(let i=0,n=e.length;i<n;++i){const n=e[i];r<0&&(r=n);if(a>=0&&a+1!==n){t.push({beginChunk:r,endChunk:a+1});r=n}i+1===e.length&&t.push({beginChunk:r,endChunk:n+1});a=n}return t}onProgress(e){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+e.loaded,total:this.length})}onReceiveData(e){const t=e.chunk,r=void 0===e.begin,a=r?this.progressiveDataLength:e.begin,i=a+t.byteLength,n=Math.floor(a/this.chunkSize),s=i<this.length?Math.floor(i/this.chunkSize):Math.ceil(i/this.chunkSize);if(r){this.stream.onReceiveProgressiveData(t);this.progressiveDataLength=i}else this.stream.onReceiveData(a,t);this.stream.isDataLoaded&&this._loadedStreamCapability.resolve(this.stream);const o=[];for(let e=n;e<s;++e){const t=this._requestsByChunk.get(e);if(t){this._requestsByChunk.delete(e);for(const r of t){const t=this._chunksNeededByRequest.get(r);t.has(e)&&t.delete(e);t.size>0||o.push(r)}}}if(!this.disableAutoFetch&&0===this._requestsByChunk.size){let e;if(1===this.stream.numChunksLoaded){const t=this.stream.numChunks-1;this.stream.hasChunk(t)||(e=t)}else e=this.stream.nextEmptyChunk(s);Number.isInteger(e)&&this._requestChunks([e])}for(const e of o){const t=this._promisesByRequest.get(e);this._promisesByRequest.delete(e);t.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})}onError(e){this._loadedStreamCapability.reject(e)}getBeginChunk(e){return Math.floor(e/this.chunkSize)}getEndChunk(e){return Math.floor((e-1)/this.chunkSize)+1}abort(e){this.aborted=!0;this.pdfNetworkStream&&this.pdfNetworkStream.cancelAllRequests(e);for(const t of this._promisesByRequest.values())t.reject(e)}}},(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});t.XRefParseException=t.XRefEntryException=t.ParserEOFException=t.MissingDataException=t.DocStats=void 0;t.collectActions=function collectActions(e,t,r){const n=Object.create(null),s=getInheritableProperty({dict:t,key:"AA",stopWhenFound:!1});if(s)for(let t=s.length-1;t>=0;t--){const a=s[t];if(a instanceof i.Dict)for(const t of a.getKeys()){const s=r[t];if(!s)continue;const o=a.getRaw(t),c=new i.RefSet,l=[];_collectJS(o,e,l,c);l.length>0&&(n[s]=l)}}if(t.has("A")){const r=t.get("A"),a=new i.RefSet,s=[];_collectJS(r,e,s,a);s.length>0&&(n.Action=s)}return(0,a.objectSize)(n)>0?n:null};t.encodeToXmlString=function encodeToXmlString(e){const t=[];let r=0;for(let a=0,i=e.length;a<i;a++){const i=e.codePointAt(a);if(32<=i&&i<=126){const n=s[i];if(n){r<a&&t.push(e.substring(r,a));t.push(n);r=a+1}}else{r<a&&t.push(e.substring(r,a));t.push(`&#x${i.toString(16).toUpperCase()};`);i>55295&&(i<57344||i>65533)&&a++;r=a+1}}if(0===t.length)return e;r<e.length&&t.push(e.substring(r,e.length));return t.join("")};t.escapePDFName=function escapePDFName(e){const t=[];let r=0;for(let a=0,i=e.length;a<i;a++){const i=e.charCodeAt(a);if(i<33||i>126||35===i||40===i||41===i||60===i||62===i||91===i||93===i||123===i||125===i||47===i||37===i){r<a&&t.push(e.substring(r,a));t.push(`#${i.toString(16)}`);r=a+1}}if(0===t.length)return e;r<e.length&&t.push(e.substring(r,e.length));return t.join("")};t.getArrayLookupTableFactory=function getArrayLookupTableFactory(e){let t;return function(){if(e){let r=e();e=null;t=Object.create(null);for(let e=0,a=r.length;e<a;e+=2)t[r[e]]=r[e+1];r=null}return t}};t.getInheritableProperty=getInheritableProperty;t.getLookupTableFactory=function getLookupTableFactory(e){let t;return function(){if(e){t=Object.create(null);e(t);e=null}return t}};t.isWhiteSpace=function isWhiteSpace(e){return 32===e||9===e||13===e||10===e};t.log2=function log2(e){if(e<=0)return 0;return Math.ceil(Math.log2(e))};t.parseXFAPath=function parseXFAPath(e){const t=/(.+)\[(\d+)\]$/;return e.split(".").map((e=>{const r=e.match(t);return r?{name:r[1],pos:parseInt(r[2],10)}:{name:e,pos:0}}))};t.readInt8=function readInt8(e,t){return e[t]<<24>>24};t.readUint16=function readUint16(e,t){return e[t]<<8|e[t+1]};t.readUint32=function readUint32(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0};t.recoverJsURL=function recoverJsURL(e){const t=new RegExp("^\\s*("+["app.launchURL","window.open","xfa.host.gotoURL"].join("|").split(".").join("\\.")+")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))","i").exec(e);if(t&&t[2]){const e=t[2];let r=!1;"true"===t[3]&&"app.launchURL"===t[1]&&(r=!0);return{url:e,newWindow:r}}return null};t.toRomanNumerals=function toRomanNumerals(e,t=!1){(0,a.assert)(Number.isInteger(e)&&e>0,"The number should be a positive integer.");const r=[];let i;for(;e>=1e3;){e-=1e3;r.push("M")}i=e/100|0;e%=100;r.push(n[i]);i=e/10|0;e%=10;r.push(n[10+i]);r.push(n[20+e]);const s=r.join("");return t?s.toLowerCase():s};t.validateCSSFont=function validateCSSFont(e){const t=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:r,fontWeight:i,italicAngle:n}=e;if(/^".*"$/.test(r)){if(/[^\\]"/.test(r.slice(1,r.length-1))){(0,a.warn)(`XFA - FontFamily contains some unescaped ": ${r}.`);return!1}}else if(/^'.*'$/.test(r)){if(/[^\\]'/.test(r.slice(1,r.length-1))){(0,a.warn)(`XFA - FontFamily contains some unescaped ': ${r}.`);return!1}}else for(const e of r.split(/[ \t]+/))if(/^(\d|(-(\d|-)))/.test(e)||!/^[\w-\\]+$/.test(e)){(0,a.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${r}.`);return!1}const s=i?i.toString():"";e.fontWeight=t.has(s)?s:"400";const o=parseFloat(n);e.italicAngle=isNaN(o)||o<-90||o>90?"14":n.toString();return!0};var a=r(2),i=r(4);class MissingDataException extends a.BaseException{constructor(e,t){super(`Missing data [${e}, ${t})`,"MissingDataException");this.begin=e;this.end=t}}t.MissingDataException=MissingDataException;class ParserEOFException extends a.BaseException{constructor(e){super(e,"ParserEOFException")}}t.ParserEOFException=ParserEOFException;class XRefEntryException extends a.BaseException{constructor(e){super(e,"XRefEntryException")}}t.XRefEntryException=XRefEntryException;class XRefParseException extends a.BaseException{constructor(e){super(e,"XRefParseException")}}t.XRefParseException=XRefParseException;t.DocStats=class DocStats{constructor(e){this._handler=e;this._streamTypes=new Set;this._fontTypes=new Set}_send(){const e=Object.create(null),t=Object.create(null);for(const t of this._streamTypes)e[t]=!0;for(const e of this._fontTypes)t[e]=!0;this._handler.send("DocStats",{streamTypes:e,fontTypes:t})}addStreamType(e){if(!this._streamTypes.has(e)){this._streamTypes.add(e);this._send()}}addFontType(e){if(!this._fontTypes.has(e)){this._fontTypes.add(e);this._send()}}};function getInheritableProperty({dict:e,key:t,getArray:r=!1,stopWhenFound:a=!0}){let n;const s=new i.RefSet;for(;e instanceof i.Dict&&(!e.objId||!s.has(e.objId));){e.objId&&s.put(e.objId);const i=r?e.getArray(t):e.get(t);if(void 0!==i){if(a)return i;n||(n=[]);n.push(i)}e=e.get("P