← Back
Editing: pdf.min.js
!/** * @licstart The following is the entire license notice for the * JavaScript code in this page * * Copyright 2024 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=e.pdfjsLib=t():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],()=>e.pdfjsLib=t()):"object"==typeof exports?exports["pdfjs-dist/build/pdf"]=e.pdfjsLib=t():e["pdfjs-dist/build/pdf"]=e.pdfjsLib=t()}(globalThis,()=>(()=>{"use strict";var e=[,(e,t,s)=>{s.r(t),s.d(t,{AbortException:()=>B,AnnotationActionEventType:()=>x,AnnotationBorderStyleType:()=>C,AnnotationEditorParamsType:()=>g,AnnotationEditorPrefix:()=>u,AnnotationEditorType:()=>p,AnnotationFieldFlag:()=>v,AnnotationFlag:()=>_,AnnotationMode:()=>d,AnnotationPrefix:()=>q,AnnotationReplyType:()=>y,AnnotationType:()=>b,BASELINE_FACTOR:()=>h,BaseException:()=>k,DocumentActionEventType:()=>S,FONT_IDENTITY_MATRIX:()=>a,FeatureTest:()=>N,FormatError:()=>O,IDENTITY_MATRIX:()=>i,ImageKind:()=>A,InvalidPDFException:()=>I,LINE_DESCENT_FACTOR:()=>l,LINE_FACTOR:()=>o,MAX_IMAGE_SIZE_TO_CACHE:()=>n,MissingPDFException:()=>L,OPS:()=>R,PageActionEventType:()=>w,PasswordException:()=>P,PasswordResponses:()=>E,PermissionFlag:()=>f,RenderingIntentFlag:()=>c,TextRenderingMode:()=>m,UnexpectedResponseException:()=>D,UnknownErrorException:()=>M,Util:()=>j,VerbosityLevel:()=>T,assert:()=>assert,bytesToString:()=>bytesToString,createValidAbsoluteUrl:()=>createValidAbsoluteUrl,fromBase64Util:()=>fromBase64Util,getModificationDate:()=>getModificationDate,getUuid:()=>getUuid,getVerbosityLevel:()=>getVerbosityLevel,hexNumbers:()=>U,info:()=>info,isArrayEqual:()=>isArrayEqual,isNodeJS:()=>r,normalizeUnicode:()=>normalizeUnicode,objectFromMap:()=>objectFromMap,objectSize:()=>objectSize,setVerbosityLevel:()=>setVerbosityLevel,shadow:()=>shadow,string32:()=>string32,stringToBytes:()=>stringToBytes,stringToPDFString:()=>stringToPDFString,stringToUTF8String:()=>stringToUTF8String,toBase64Util:()=>toBase64Util,toHexUtil:()=>toHexUtil,unreachable:()=>unreachable,utf8StringToString:()=>utf8StringToString,warn:()=>warn});let r="object"==typeof process&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),i=[1,0,0,1,0,0],a=[.001,0,0,.001,0,0],n=1e7,o=1.35,l=.35,h=.25925925925925924,c={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},d={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},u="pdfjs_internal_editor_",p={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},g={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},f={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},m={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},A={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},b={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},y={GROUP:"Group",REPLY:"R"},_={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},v={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},C={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},x={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"},S={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},w={O:"PageOpen",C:"PageClose"},T={ERRORS:0,WARNINGS:1,INFOS:5},R={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,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},E={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},F=T.WARNINGS;function setVerbosityLevel(e){Number.isInteger(e)&&(F=e)}function getVerbosityLevel(){return F}function info(e){F>=T.INFOS&&console.log(`Info: ${e}`)}function warn(e){F>=T.WARNINGS&&console.log(`Warning: ${e}`)}function unreachable(e){throw Error(e)}function assert(e,t){e||unreachable(t)}function _isValidProtocol(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function createValidAbsoluteUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return null;try{if(s&&"string"==typeof e){if(s.addDefaultProtocol&&e.startsWith("www.")){let t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(s.tryConvertEncoding)try{e=stringToUTF8String(e)}catch{}}let r=t?new URL(e,t):new URL(e);if(_isValidProtocol(r))return r}catch{}return null}function shadow(e,t,s){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(e,t,{value:s,enumerable:!r,configurable:!0,writable:!1}),s}let k=function BaseExceptionClosure(){function BaseException(e,t){this.message=e,this.name=t}return BaseException.prototype=Error(),BaseException.constructor=BaseException,BaseException}();class P extends k{constructor(e,t){super(e,"PasswordException"),this.code=t}}class M extends k{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class I extends k{constructor(e){super(e,"InvalidPDFException")}}class L extends k{constructor(e){super(e,"MissingPDFException")}}class D extends k{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}}class O extends k{constructor(e){super(e,"FormatError")}}class B extends k{constructor(e){super(e,"AbortException")}}function bytesToString(e){("object"!=typeof e||e?.length===void 0)&&unreachable("Invalid argument for bytesToString");let t=e.length;if(t<8192)return String.fromCharCode.apply(null,e);let s=[];for(let r=0;r<t;r+=8192){let i=Math.min(r+8192,t),a=e.subarray(r,i);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function stringToBytes(e){"string"!=typeof e&&unreachable("Invalid argument for stringToBytes");let t=e.length,s=new Uint8Array(t);for(let r=0;r<t;++r)s[r]=255&e.charCodeAt(r);return s}function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}function objectSize(e){return Object.keys(e).length}function objectFromMap(e){let t=Object.create(null);for(let[s,r]of e)t[s]=r;return t}function isLittleEndian(){let e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]}function isEvalSupported(){try{return Function(""),!0}catch{return!1}}class N{static get isLittleEndian(){return shadow(this,"isLittleEndian",isLittleEndian())}static get isEvalSupported(){return shadow(this,"isEvalSupported",isEvalSupported())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return shadow(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?shadow(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):shadow(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return shadow(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}let U=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0"));class j{static makeHexColor(e,t,s){return`#${U[e]}${U[t]}${U[s]}`}static scaleMinMax(e,t){let s;e[0]?(e[0]<0&&(s=t[0],t[0]=t[2],t[2]=s),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(s=t[1],t[1]=t[3],t[3]=s),t[1]*=e[3],t[3]*=e[3]):(s=t[0],t[0]=t[1],t[1]=s,s=t[2],t[2]=t[3],t[3]=s,e[1]<0&&(s=t[1],t[1]=t[3],t[3]=s),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(s=t[0],t[0]=t[2],t[2]=s),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}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){let s=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])/s,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/s]}static getAxialAlignedBoundingBox(e,t){let s=this.applyTransform(e,t),r=this.applyTransform(e.slice(2,4),t),i=this.applyTransform([e[0],e[3]],t),a=this.applyTransform([e[2],e[1]],t);return[Math.min(s[0],r[0],i[0],a[0]),Math.min(s[1],r[1],i[1],a[1]),Math.max(s[0],r[0],i[0],a[0]),Math.max(s[1],r[1],i[1],a[1])]}static inverseTransform(e){let 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 singularValueDecompose2dScale(e){let t=[e[0],e[2],e[1],e[3]],s=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],a=e[2]*t[1]+e[3]*t[3],n=(s+a)/2,o=Math.sqrt((s+a)**2-4*(s*a-i*r))/2;return[Math.sqrt(n+o||1),Math.sqrt(n-o||1)]}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let s=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(s>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[s,i,r,a]}static #e(e,t,s,r,i,a,n,o,l,h){if(l<=0||l>=1)return;let c=1-l,d=l*l,u=d*l,p=c*(c*(c*e+3*l*t)+3*d*s)+u*r,g=c*(c*(c*i+3*l*a)+3*d*n)+u*o;h[0]=Math.min(h[0],p),h[1]=Math.min(h[1],g),h[2]=Math.max(h[2],p),h[3]=Math.max(h[3],g)}static #t(e,t,s,r,i,a,n,o,l,h,c,d){if(1e-12>Math.abs(l)){Math.abs(h)>=1e-12&&this.#e(e,t,s,r,i,a,n,o,-c/h,d);return}let u=h**2-4*c*l;if(u<0)return;let p=Math.sqrt(u),g=2*l;this.#e(e,t,s,r,i,a,n,o,(-h+p)/g,d),this.#e(e,t,s,r,i,a,n,o,(-h-p)/g,d)}static bezierBoundingBox(e,t,s,r,i,a,n,o,l){return l?(l[0]=Math.min(l[0],e,n),l[1]=Math.min(l[1],t,o),l[2]=Math.max(l[2],e,n),l[3]=Math.max(l[3],t,o)):l=[Math.min(e,n),Math.min(t,o),Math.max(e,n),Math.max(t,o)],this.#t(e,s,i,n,t,r,a,o,3*(-e+3*(s-i)+n),6*(e-2*s+i),3*(s-e),l),this.#t(e,s,i,n,t,r,a,o,3*(-t+3*(r-a)+o),6*(t-2*r+a),3*(r-t),l),l}}let V=[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 stringToPDFString(e){if(e[0]>="\xef"){let t;if("\xfe"===e[0]&&"\xff"===e[1]?(t="utf-16be",e.length%2==1&&(e=e.slice(0,-1))):"\xff"===e[0]&&"\xfe"===e[1]?(t="utf-16le",e.length%2==1&&(e=e.slice(0,-1))):"\xef"===e[0]&&"\xbb"===e[1]&&"\xbf"===e[2]&&(t="utf-8"),t)try{let s=new TextDecoder(t,{fatal:!0}),r=stringToBytes(e),i=s.decode(r);if(!i.includes("\x1b"))return i;return i.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g,"")}catch(e){warn(`stringToPDFString: "${e}".`)}}let t=[];for(let s=0,r=e.length;s<r;s++){let i=e.charCodeAt(s);if(27===i){for(;++s<r&&27!==e.charCodeAt(s););continue}let a=V[i];t.push(a?String.fromCharCode(a):e.charAt(s))}return t.join("")}function stringToUTF8String(e){return decodeURIComponent(escape(e))}function utf8StringToString(e){return unescape(encodeURIComponent(e))}function isArrayEqual(e,t){if(e.length!==t.length)return!1;for(let s=0,r=e.length;s<r;s++)if(e[s]!==t[s])return!1;return!0}function getModificationDate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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("")}let H=null,G=null;function normalizeUnicode(e){return H||(H=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,G=new Map([["ſt","ſt"]])),e.replaceAll(H,(e,t,s)=>t?t.normalize("NFKC"):G.get(s))}function getUuid(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),bytesToString(e)}let q="pdfjs_internal_id_";function toHexUtil(e){return Uint8Array.prototype.toHex?e.toHex():Array.from(e,e=>U[e]).join("")}function toBase64Util(e){return Uint8Array.prototype.toBase64?e.toBase64():btoa(bytesToString(e))}function fromBase64Util(e){return Uint8Array.fromBase64?Uint8Array.fromBase64(e):stringToBytes(atob(e))}},(e,t,s)=>{s.r(t),s.d(t,{DefaultCMapReaderFactory:()=>C,DefaultCanvasFactory:()=>v,DefaultFilterFactory:()=>x,DefaultStandardFontDataFactory:()=>S,LoopbackPort:()=>F,PDFDataRangeTransport:()=>T,PDFDocumentLoadingTask:()=>w,PDFDocumentProxy:()=>R,PDFPageProxy:()=>E,PDFWorker:()=>k,RenderTask:()=>L,build:()=>B,getDocument:()=>getDocument,version:()=>O});var r=s(1),i=s(3),a=s(5),n=s(6),o=s(7),l=s(8),h=s(13),c=s(9),d=s(10),u=s(11),p=s(12),g=s(16),f=s(17),m=s(18),A=s(19),b=s(20),y=s(23),_=s(24);let v=r.isNodeJS?l.NodeCanvasFactory:c.DOMCanvasFactory,C=r.isNodeJS?l.NodeCMapReaderFactory:d.DOMCMapReaderFactory,x=r.isNodeJS?l.NodeFilterFactory:u.DOMFilterFactory,S=r.isNodeJS?l.NodeStandardFontDataFactory:p.DOMStandardFontDataFactory;function getDocument(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"==typeof e||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t=new w,{docId:s}=t,i=e.url?getUrlProp(e.url):null,a=e.data?getDataProp(e.data):null,l=e.httpHeaders||null,h=!0===e.withCredentials,c=e.password??null,u=e.range instanceof T?e.range:null,f=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:65536,m=e.worker instanceof k?e.worker:null,_=e.verbosity,R="string"!=typeof e.docBaseUrl||(0,n.isDataScheme)(e.docBaseUrl)?null:e.docBaseUrl,E="string"==typeof e.cMapUrl?e.cMapUrl:null,F=!1!==e.cMapPacked,M=e.CMapReaderFactory||C,I="string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,L=e.StandardFontDataFactory||S,D=!0!==e.stopAtErrors,O=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,B=!1!==e.isEvalSupported,N="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!r.isNodeJS,U="boolean"==typeof e.isImageDecoderSupported?e.isImageDecoderSupported:!r.isNodeJS&&(r.FeatureTest.platform.isFirefox||!globalThis.chrome),j=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,V="boolean"==typeof e.disableFontFace?e.disableFontFace:r.isNodeJS,H=!0===e.fontExtraProperties,G=!0===e.enableXfa,q=e.ownerDocument||globalThis.document,$=!0===e.disableRange,W=!0===e.disableStream,z=!0===e.disableAutoFetch,X=!0===e.pdfBug,Y=e.CanvasFactory||v,K=e.FilterFactory||x,Q=!0===e.enableHWA,J=u?u.length:e.length??NaN,Z="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!r.isNodeJS&&!V,ee="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:M===d.DOMCMapReaderFactory&&L===p.DOMStandardFontDataFactory&&E&&I&&(0,n.isValidFetchUrl)(E,document.baseURI)&&(0,n.isValidFetchUrl)(I,document.baseURI);(0,r.setVerbosityLevel)(_);let et={canvasFactory:new Y({ownerDocument:q,enableHWA:Q}),filterFactory:new K({docId:s,ownerDocument:q}),cMapReaderFactory:ee?null:new M({baseUrl:E,isCompressed:F}),standardFontDataFactory:ee?null:new L({baseUrl:I})};if(!m){let e={verbosity:_,port:g.GlobalWorkerOptions.workerPort};m=e.port?k.fromPort(e):new k(e),t._worker=m}let es={docId:s,apiVersion:"4.10.39",data:a,password:c,disableAutoFetch:z,rangeChunkSize:f,length:J,docBaseUrl:R,enableXfa:G,evaluatorOptions:{maxImageSize:O,disableFontFace:V,ignoreErrors:D,isEvalSupported:B,isOffscreenCanvasSupported:N,isImageDecoderSupported:U,canvasMaxAreaInBytes:j,fontExtraProperties:H,useSystemFonts:Z,cMapUrl:ee?E:null,standardFontDataUrl:ee?I:null}},er={disableFontFace:V,fontExtraProperties:H,ownerDocument:q,pdfBug:X,styleElement:null,loadingParams:{disableAutoFetch:z,enableXfa:G}};return m.promise.then(function(){let e;if(t.destroyed)throw Error("Loading aborted");if(m.destroyed)throw Error("Worker was destroyed");let c=m.messageHandler.sendWithPromise("GetDocRequest",es,a?[a.buffer]:null);if(u)e=new A.PDFDataTransportStream(u,{disableRange:$,disableStream:W});else if(!a){let t;if(!i)throw Error("getDocument - no `url` parameter provided.");if(r.isNodeJS){if((0,n.isValidFetchUrl)(i)){if("undefined"==typeof fetch||"undefined"==typeof Response||!("body"in Response.prototype))throw Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");t=b.PDFFetchStream}}else t=(0,n.isValidFetchUrl)(i)?b.PDFFetchStream:y.PDFNetworkStream;e=new t({url:i,length:J,httpHeaders:l,withCredentials:h,rangeChunkSize:f,disableRange:$,disableStream:W})}return c.then(r=>{if(t.destroyed)throw Error("Loading aborted");if(m.destroyed)throw Error("Worker was destroyed");let i=new o.MessageHandler(s,r,m.port),a=new P(i,t,e,er,et);t._transport=a,i.send("Ready",null)})}).catch(t._capability.reject),t}function getUrlProp(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(r.isNodeJS&&"string"==typeof e)return e}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(e){if(r.isNodeJS&&"undefined"!=typeof Buffer&&e instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return(0,r.stringToBytes)(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||"object"==typeof e&&!isNaN(e?.length))return new Uint8Array(e);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function isRefProxy(e){return"object"==typeof e&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class w{static #s=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${w.#s++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}}class T{constructor(e,t,s=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=s,this.contentDispositionFilename=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}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(let s of this._rangeListeners)s(e,t)}onDataProgress(e,t){this._readyCapability.promise.then(()=>{for(let s of this._progressListeners)s(e,t)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(let t of this._progressiveReadListeners)t(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(let e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){(0,r.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class R{constructor(e,t){this._pdfInfo=e,this._transport=t}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,r.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:e="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class E{#r=null;#i=!1;constructor(e,t,s,r=!1){this._pageIndex=e,this._pageInfo=t,this._transport=s,this._stats=r?new n.StatTimer:null,this._pdfBug=r,this.commonObjs=s.commonObjs,this.objs=new I,this._maybeCleanupAfterRender=!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(){let{scale:e,rotation:t=this.rotate,offsetX:s=0,offsetY:r=0,dontFlip:i=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new n.PageViewport({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:s,offsetY:r,dontFlip:i})}getAnnotations(){let{intent:e="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,r.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render(e){let{canvasContext:t,viewport:s,intent:i="display",annotationMode:a=r.AnnotationMode.ENABLE,transform:n=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:h=null,pageColors:c=null,printAnnotationStorage:d=null,isEditing:u=!1}=e;this._stats?.time("Overall");let p=this._transport.getRenderingIntent(i,a,d,u),{renderingIntent:g,cacheKey:f}=p;this.#i=!1,this.#a(),l||=this._transport.getOptionalContentConfig(g);let m=this._intentStates.get(f);m||(m=Object.create(null),this._intentStates.set(f,m)),m.streamReaderCancelTimeout&&(clearTimeout(m.streamReaderCancelTimeout),m.streamReaderCancelTimeout=null);let A=!!(g&r.RenderingIntentFlag.PRINT);m.displayReadyCapability||(m.displayReadyCapability=Promise.withResolvers(),m.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(p));let complete=e=>{m.renderTasks.delete(b),(this._maybeCleanupAfterRender||A)&&(this.#i=!0),this.#n(!A),e?(b.capability.reject(e),this._abortOperatorList({intentState:m,reason:e instanceof Error?e:Error(e)})):b.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},b=new D({callback:complete,params:{canvasContext:t,viewport:s,transform:n,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:m.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!A,pdfBug:this._pdfBug,pageColors:c});(m.renderTasks||=new Set).add(b);let y=b.task;return Promise.all([m.displayReadyCapability.promise,l]).then(e=>{let[t,s]=e;if(this.destroyed){complete();return}if(this._stats?.time("Rendering"),!(s.renderingIntent&g))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");b.initializeGraphics({transparency:t,optionalContentConfig:s}),b.operatorListChanged()}).catch(complete),y}getOperatorList(){let e,{intent:t="display",annotationMode:s=r.AnnotationMode.ENABLE,printAnnotationStorage:i=null,isEditing:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};function operatorListChanged(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(e))}let n=this._transport.getRenderingIntent(t,s,i,a,!0),o=this._intentStates.get(n.cacheKey);return o||(o=Object.create(null),this._intentStates.set(n.cacheKey,o)),o.opListReadCapability||((e=Object.create(null)).operatorListChanged=operatorListChanged,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(e),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(n)),o.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:e=!1,disableNormalization:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.streamTextContent(e);return new Promise(function(e,s){function pump(){r.read().then(function(t){let{value:s,done:r}=t;if(r){e(i);return}i.lang??=s.lang,Object.assign(i.styles,s.styles),i.items.push(...s.items),pump()},s)}let r=t.getReader(),i={items:[],styles:Object.create(null),lang:null};pump()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let e=[];for(let t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(let s of t.renderTasks)e.push(s.completed),s.cancel();return this.objs.clear(),this.#i=!1,this.#a(),Promise.all(e)}cleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#i=!0;let t=this.#n(!1);return e&&t&&(this._stats&&=new n.StatTimer),t}#n(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.#a(),!this.#i||this.destroyed)return!1;if(e)return this.#r=setTimeout(()=>{this.#r=null,this.#n(!1)},5e3),!1;for(let{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#i=!1,!0}#a(){this.#r&&(clearTimeout(this.#r),this.#r=null)}_startRenderPage(e,t){let s=this._intentStates.get(t);s&&(this._stats?.timeEnd("Page Request"),s.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let s=0,r=e.length;s<r;s++)t.operatorList.fnArray.push(e.fnArray[s]),t.operatorList.argsArray.push(e.argsArray[s]);for(let s of(t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots,t.renderTasks))s.operatorListChanged();e.lastChunk&&this.#n(!0)}_pumpOperatorList(e){let{renderingIntent:t,cacheKey:s,annotationStorageSerializable:r,modifiedIds:i}=e,{map:a,transfer:n}=r,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:s,annotationStorage:a,modifiedIds:i},n).getReader(),l=this._intentStates.get(s);l.streamReader=o;let pump=()=>{o.read().then(e=>{let{value:t,done:s}=e;if(s){l.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(t,l),pump())},e=>{if(l.streamReader=null,!this._transport.destroyed){if(l.operatorList){for(let e of(l.operatorList.lastChunk=!0,l.renderTasks))e.operatorListChanged();this.#n(!0)}if(l.displayReadyCapability)l.displayReadyCapability.reject(e);else if(l.opListReadCapability)l.opListReadCapability.reject(e);else throw e}})};pump()}_abortOperatorList(e){let{intentState:t,reason:s,force:i=!1}=e;if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(s instanceof n.RenderingCancelledException){let e=100;s.extraDelay>0&&s.extraDelay<1e3&&(e+=s.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:s,force:!0})},e);return}}if(t.streamReader.cancel(new r.AbortException(s.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[e,s]of this._intentStates)if(s===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}class F{#o=new Map;#l=Promise.resolve();postMessage(e,t){let s={data:structuredClone(e,t?{transfer:t}:null)};this.#l.then(()=>{for(let[e]of this.#o)e.call(this,s)})}addEventListener(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=null;if(s?.signal instanceof AbortSignal){let{signal:a}=s;if(a.aborted){(0,r.warn)("LoopbackPort - cannot use an `aborted` signal.");return}let onAbort=()=>this.removeEventListener(e,t);i=()=>a.removeEventListener("abort",onAbort),a.addEventListener("abort",onAbort)}this.#o.set(t,i)}removeEventListener(e,t){let s=this.#o.get(t);s?.(),this.#o.delete(t)}terminate(){for(let[,e]of this.#o)e?.();this.#o.clear()}}class k{static #h=0;static #c=!1;static #d;static #u=(()=>{r.isNodeJS&&(this.#c=!0,g.GlobalWorkerOptions.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(e,t)=>{let s;try{if(!(s=new URL(e)).origin||"null"===s.origin)return!1}catch{return!1}let r=new URL(t,s);return s.origin===r.origin},this._createCDNWrapper=e=>{let t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))}})();constructor({name:e=null,port:t=null,verbosity:s=(0,r.getVerbosityLevel)()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=s,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,t){if(k.#d?.has(t))throw Error("Cannot use more than one PDFWorker per port.");(k.#d||=new WeakMap).set(t,this),this._initializeFromPort(t);return}this._initialize()}get promise(){return this._readyCapability.promise}#p(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new o.MessageHandler("main","worker",e),this._messageHandler.on("ready",function(){}),this.#p()}_initialize(){if(k.#c||k.#g){this._setupFakeWorker();return}let{workerSrc:e}=k;try{k._isSameOrigin(window.location.href,e)||(e=k._createCDNWrapper(new URL(e,window.location).href));let t=new Worker(e,{type:"module"}),s=new o.MessageHandler("main","worker",t),terminateEarly=()=>{r.abort(),s.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(Error("Worker was destroyed")):this._setupFakeWorker()},r=new AbortController;t.addEventListener("error",()=>{this._webWorker||terminateEarly()},{signal:r.signal}),s.on("test",e=>{if(r.abort(),this.destroyed||!e){terminateEarly();return}this._messageHandler=s,this._port=t,this._webWorker=t,this.#p()}),s.on("ready",e=>{if(r.abort(),this.destroyed){terminateEarly();return}try{sendTest()}catch{this._setupFakeWorker()}});let sendTest=()=>{let e=new Uint8Array;s.send("test",e,[e.buffer])};sendTest();return}catch{(0,r.info)("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){k.#c||((0,r.warn)("Setting up fake worker."),k.#c=!0),k._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(Error("Worker was destroyed"));return}let t=new F;this._port=t;let s=`fake${k.#h++}`,r=new o.MessageHandler(s+"_worker",s,t);e.setup(r,t),this._messageHandler=new o.MessageHandler(s,s+"_worker",t),this.#p()}).catch(e=>{this._readyCapability.reject(Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this._webWorker?.terminate(),this._webWorker=null,k.#d?.delete(this._port),this._port=null,this._messageHandler?.destroy(),this._messageHandler=null}static fromPort(e){if(!e?.port)throw Error("PDFWorker.fromPort - invalid method signature.");let t=this.#d?.get(e.port);if(t){if(t._pendingDestroy)throw Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new k(e)}static get workerSrc(){if(g.GlobalWorkerOptions.workerSrc)return g.GlobalWorkerOptions.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get #g(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){let loader=async()=>this.#g?this.#g:(await import(this.workerSrc)).WorkerMessageHandler;return(0,r.shadow)(this,"_setupFakeWorkerGlobal",loader())}}class P{#f=new Map;#m=new Map;#A=new Map;#b=new Map;#y=null;constructor(e,t,s,r,i){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new I,this.fontLoader=new a.FontLoader({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#_(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=this.#f.get(e);if(s)return s;let r=this.messageHandler.sendWithPromise(e,t);return this.#f.set(e,r),r}get annotationStorage(){return(0,r.shadow)(this,"annotationStorage",new i.AnnotationStorage)}getRenderingIntent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.AnnotationMode.ENABLE,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=r.RenderingIntentFlag.DISPLAY,l=i.SerializableEmpty;switch(e){case"any":o=r.RenderingIntentFlag.ANY;break;case"display":break;case"print":o=r.RenderingIntentFlag.PRINT;break;default:(0,r.warn)(`getRenderingIntent - invalid intent: ${e}`)}let h=o&r.RenderingIntentFlag.PRINT&&s instanceof i.PrintAnnotationStorage?s:this.annotationStorage;switch(t){case r.AnnotationMode.DISABLE:o+=r.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case r.AnnotationMode.ENABLE:break;case r.AnnotationMode.ENABLE_FORMS:o+=r.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case r.AnnotationMode.ENABLE_STORAGE:o+=r.RenderingIntentFlag.ANNOTATIONS_STORAGE,l=h.serializable;break;default:(0,r.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}a&&(o+=r.RenderingIntentFlag.IS_EDITING),n&&(o+=r.RenderingIntentFlag.OPLIST);let{ids:c,hash:d}=h.modifiedIds,u=[o,l.hash,d];return{renderingIntent:o,cacheKey:u.join("_"),annotationStorageSerializable:l,modifiedIds:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#y?.reject(Error("Worker was destroyed during onPassword callback"));let e=[];for(let t of this.#m.values())e.push(t._destroy());this.#m.clear(),this.#A.clear(),this.#b.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#f.clear(),this.filterFactory.destroy(),_.TextLayer.cleanup(),this._networkStream?.cancelAllRequests(new r.AbortException("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(e,t)=>{(0,r.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(e){let{value:s,done:i}=e;if(i){t.close();return}(0,r.assert)(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(s),1,[s])}).catch(e=>{t.error(e)})},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on("ReaderHeadersReady",async e=>{await this._fullReader.headersReady;let{isStreamingSupported:s,isRangeSupported:r,contentLength:i}=this._fullReader;return s&&r||(this._lastProgress&&t.onProgress?.(this._lastProgress),this._fullReader.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),{isStreamingSupported:s,isRangeSupported:r,contentLength:i}}),e.on("GetRangeReader",(e,t)=>{(0,r.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let s=this._networkStream.getRangeReader(e.begin,e.end);if(!s){t.close();return}t.onPull=()=>{s.read().then(function(e){let{value:s,done:i}=e;if(i){t.close();return}(0,r.assert)(s instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(s),1,[s])}).catch(e=>{t.error(e)})},t.onCancel=e=>{s.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on("GetDoc",e=>{let{pdfInfo:s}=e;this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,t._capability.resolve(new R(s,this))}),e.on("DocException",e=>{t._capability.reject((0,o.wrapReason)(e))}),e.on("PasswordRequest",e=>{this.#y=Promise.withResolvers();try{if(!t.onPassword)throw(0,o.wrapReason)(e);t.onPassword(e=>{e instanceof Error?this.#y.reject(e):this.#y.resolve({password:e})},e.code)}catch(e){this.#y.reject(e)}return this.#y.promise}),e.on("DataLoaded",e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)}),e.on("StartRenderPage",e=>{this.destroyed||this.#m.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)}),e.on("commonobj",t=>{let[s,i,n]=t;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":let{disableFontFace:o,fontExtraProperties:l,pdfBug:h}=this._params;if("error"in n){let e=n.error;(0,r.warn)(`Error during font loading: ${e}`),this.commonObjs.resolve(s,e);break}let c=h&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,d=new a.FontFaceObject(n,{disableFontFace:o,fontExtraProperties:l,inspectFont:c});this.fontLoader.bind(d).catch(()=>e.sendWithPromise("FontFallback",{id:s})).finally(()=>{!l&&d.data&&(d.data=null),this.commonObjs.resolve(s,d)});break;case"CopyLocalImage":let{imageRef:u}=n;for(let e of((0,r.assert)(u,"The imageRef must be defined."),this.#m.values()))for(let[,t]of e.objs)if(t?.ref===u){if(!t.dataLen)return null;return this.commonObjs.resolve(s,structuredClone(t)),t.dataLen}break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,n);break;default:throw Error(`Got unknown common object type ${i}`)}return null}),e.on("obj",e=>{let[t,s,i,a]=e;if(this.destroyed)return;let n=this.#m.get(s);if(!n.objs.has(t)){if(0===n._intentStates.size){a?.bitmap?.close();return}switch(i){case"Image":n.objs.resolve(t,a),a?.dataLen,r.MAX_IMAGE_SIZE_TO_CACHE;break;case"Pattern":n.objs.resolve(t,a);break;default:throw Error(`Got unknown object type ${i}`)}}}),e.on("DocProgress",e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})}),e.on("FetchBuiltInCMap",async e=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(e)}),e.on("FetchStandardFontData",async e=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(e)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&(0,r.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(Error("Invalid page request."));let t=e-1,s=this.#A.get(t);if(s)return s;let r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then(s=>{if(this.destroyed)throw Error("Transport destroyed");s.refStr&&this.#b.set(s.refStr,e);let r=new E(t,s,this,this._params.pdfBug);return this.#m.set(t,r),r});return this.#A.set(t,r),r}getPageIndex(e){return isRefProxy(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(Error("Invalid pageIndex request."))}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return this.#_("GetFieldObjects")}hasJSActions(){return this.#_("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(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)}getDocJSActions(){return this.#_("GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return this.#_("GetOptionalContentConfig").then(t=>new m.OptionalContentConfig(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let e="GetMetadata",t=this.#f.get(e);if(t)return t;let s=this.messageHandler.sendWithPromise(e,null).then(e=>({info:e[0],metadata:e[1]?new f.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#f.set(e,s),s}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){for(let e of(await this.messageHandler.sendWithPromise("Cleanup",null),this.#m.values()))if(!e.cleanup())throw Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#f.clear(),this.filterFactory.destroy(!0),_.TextLayer.cleanup()}}cachedPageNumber(e){if(!isRefProxy(e))return null;let t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#b.get(t)??null}}let M=Symbol("INITIAL_DATA");class I{#v=Object.create(null);#C(e){return this.#v[e]||={...Promise.withResolvers(),data:M}}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t){let s=this.#C(e);return s.promise.then(()=>t(s.data)),null}let s=this.#v[e];if(!s||s.data===M)throw Error(`Requesting object that isn't resolved yet ${e}.`);return s.data}has(e){let t=this.#v[e];return!!t&&t.data!==M}delete(e){let t=this.#v[e];return!!t&&t.data!==M&&(delete this.#v[e],!0)}resolve(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=this.#C(e);s.data=t,s.resolve()}clear(){for(let e in this.#v){let{data:t}=this.#v[e];t?.bitmap?.close()}this.#v=Object.create(null)}*[Symbol.iterator](){for(let e in this.#v){let{data:t}=this.#v[e];t!==M&&(yield[e,t])}}}class L{#x=null;constructor(e){this.#x=e,this.onContinue=null}get promise(){return this.#x.capability.promise}cancel(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.#x.cancel(null,e)}get separateAnnots(){let{separateAnnots:e}=this.#x.operatorList;if(!e)return!1;let{annotationCanvasMap:t}=this.#x;return e.form||e.canvas&&t?.size>0}}class D{#S=null;static #w=new WeakSet;constructor({callback:e,params:t,objs:s,commonObjs:r,annotationCanvasMap:i,operatorList:a,pageIndex:n,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:c=!1,pageColors:d=null}){this.callback=e,this.params=t,this.objs=s,this.commonObjs=r,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=n,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=c,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new L(this),this._cancelBound=this.cancel.bind(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(e){let{transparency:t=!1,optionalContentConfig:s}=e;if(this.cancelled)return;if(this._canvas){if(D.#w.has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");D.#w.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{canvasContext:r,viewport:i,transform:a,background:n}=this.params;this.gfx=new h.CanvasGraphics(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:s},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:a,viewport:i,transparency:t,background:n}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#S&&(window.cancelAnimationFrame(this.#S),this.#S=null),D.#w.delete(this._canvas),this.callback(e||new n.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#S=window.requestAnimationFrame(()=>{this.#S=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){!this.cancelled&&(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),D.#w.delete(this._canvas),this.callback())))}}let O="4.10.39",B="f9bea397f"},(e,t,s)=>{s.r(t),s.d(t,{AnnotationStorage:()=>n,PrintAnnotationStorage:()=>o,SerializableEmpty:()=>a});var r=s(1),i=s(4);let a=Object.freeze({map:null,hash:"",transfer:void 0});class n{#T=!1;#R=null;#E=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){let s=this.#E.get(e);return void 0===s?t:Object.assign(t,s)}getRawValue(e){return this.#E.get(e)}remove(e){if(this.#E.delete(e),0===this.#E.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(let e of this.#E.values())if(e instanceof AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t){let s=this.#E.get(e),r=!1;if(void 0!==s)for(let[e,i]of Object.entries(t))s[e]!==i&&(r=!0,s[e]=i);else r=!0,this.#E.set(e,t);r&&this.#F(),t instanceof AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#E.has(e)}getAll(){return this.#E.size>0?(0,r.objectFromMap)(this.#E):null}setAll(e){for(let[t,s]of Object.entries(e))this.setValue(t,s)}get size(){return this.#E.size}#F(){this.#T||(this.#T=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#T&&(this.#T=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new o(this)}get serializable(){if(0===this.#E.size)return a;let e=new Map,t=new i.MurmurHash3_64,s=[],r=Object.create(null),n=!1;for(let[s,i]of this.#E){let a=i instanceof AnnotationEditor?i.serialize(!1,r):i;a&&(e.set(s,a),t.update(`${s}:${JSON.stringify(a)}`),n||=!!a.bitmap)}if(n)for(let t of e.values())t.bitmap&&s.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:s}:a}get editorStats(){let e=null,t=new Map;for(let s of this.#E.values()){if(!(s instanceof AnnotationEditor))continue;let r=s.telemetryFinalData;if(!r)continue;let{type:i}=r;t.has(i)||t.set(i,Object.getPrototypeOf(s).constructor),e||=Object.create(null);let a=e[i]||=new Map;for(let[e,t]of Object.entries(r)){if("type"===e)continue;let s=a.get(e);s||(s=new Map,a.set(e,s));let r=s.get(t)??0;s.set(t,r+1)}}for(let[s,r]of t)e[s]=r.computeTelemetryFinalData(e[s]);return e}resetModifiedIds(){this.#R=null}get modifiedIds(){if(this.#R)return this.#R;let e=[];for(let t of this.#E.values())t instanceof AnnotationEditor&&t.annotationElementId&&t.serialize()&&e.push(t.annotationElementId);return this.#R={ids:new Set(e),hash:e.join(",")}}}class o extends n{#k;constructor(e){super();let{map:t,hash:s,transfer:r}=e.serializable,i=structuredClone(t,r?{transfer:r}:null);this.#k={map:i,hash:s,transfer:r}}get print(){(0,r.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#k}get modifiedIds(){return(0,r.shadow)(this,"modifiedIds",{ids:new Set,hash:""})}}},(e,t,s)=>{s.r(t),s.d(t,{MurmurHash3_64:()=>r});class r{constructor(e){this.h1=e?4294967295&e:3285377520,this.h2=e?4294967295&e:3285377520}update(e){let t,s;if("string"==typeof e){t=new Uint8Array(2*e.length),s=0;for(let r=0,i=e.length;r<i;r++){let i=e.charCodeAt(r);i<=255?t[s++]=i:(t[s++]=i>>>8,t[s++]=255&i)}}else if(ArrayBuffer.isView(e))s=(t=e.slice()).byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let r=s>>2,i=s-4*r,a=new Uint32Array(t.buffer,0,r),n=0,o=0,l=this.h1,h=this.h2;for(let e=0;e<r;e++)1&e?(l^=n=461845907*(n=(n=3432918353*(n=a[e])&4294901760|11601*n&65535)<<15|n>>>17)&4294901760|13715*n&65535,l=5*(l=l<<13|l>>>19)+3864292196):(h^=o=461845907*(o=(o=3432918353*(o=a[e])&4294901760|11601*o&65535)<<15|o>>>17)&4294901760|13715*o&65535,h=5*(h=h<<13|h>>>19)+3864292196);switch(n=0,i){case 3:n^=t[4*r+2]<<16;case 2:n^=t[4*r+1]<<8;case 1:n^=t[4*r],n=461845907*(n=(n=3432918353*n&4294901760|11601*n&65535)<<15|n>>>17)&4294901760|13715*n&65535,1&r?l^=n:h^=n}this.h1=l,this.h2=h}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,t=4283543511*t&4294901760|((t<<16|(e=3981806797*e&4294901760|36045*e&65535)>>>16)*2950163797&4294901760)>>>16,e^=t>>>1,t=3301882366*t&4294901760|((t<<16|(e=444984403*e&4294901760|60499*e&65535)>>>16)*3120437893&4294901760)>>>16,((e^=t>>>1)>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}},(e,t,s)=>{s.r(t),s.d(t,{FontFaceObject:()=>a,FontLoader:()=>i});var r=s(1);class i{#P=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#P.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(e){let{systemFontInfo:t,_inspectFont:s}=e;if(!(!t||this.#P.has(t.loadedName))){if((0,r.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:e,src:i,style:a}=t,n=new FontFace(e,i,a);this.addNativeFontFace(n);try{await n.load(),this.#P.add(e),s?.(t)}catch{(0,r.warn)(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(n)}return}(0,r.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(s){throw(0,r.warn)(`Failed to load font '${t.family}': '${s}'.`),e.disableFontFace=!0,s}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(t=>{let s=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,s)})}}get isFontLoadingAPISupported(){let e=!!this._document?.fonts;return(0,r.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){let e=!1;return r.isNodeJS?e=!0:"undefined"!=typeof navigator&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)&&(e=!0),(0,r.shadow)(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){let{loadingRequests:t}=this,s={done:!1,complete:function completeRequest(){for((0,r.assert)(!s.done,"completeRequest() cannot be called twice."),s.done=!0;t.length>0&&t[0].done;)setTimeout(t.shift().callback,0)},callback:e};return t.push(s),s}get _loadTestFont(){let e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,r.shadow)(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){let s,i;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,s,r){return e.substring(0,t)+r+e.substring(t+s)}let a=this._document.createElement("canvas");a.width=1,a.height=1;let n=a.getContext("2d"),o=0;function isFontReady(e,t){if(++o>30){(0,r.warn)("Load test font never loaded."),t();return}if(n.font="30px "+e,n.fillText(".",0,20),n.getImageData(0,0,1,1).data[3]>0){t();return}setTimeout(isFontReady.bind(null,e,t))}let l=`lt${Date.now()}${this.loadTestFontId++}`,h=this._loadTestFont,c=int32(h=spliceString(h,976,l.length,l),16);for(s=0,i=l.length-3;s<i;s+=4)c=c-1482184792+int32(l,s)|0;s<l.length&&(c=c-1482184792+int32(l+"XXX",s)|0),h=spliceString(h,16,4,(0,r.string32)(c));let d=`url(data:font/opentype;base64,${btoa(h)});`,u=`@font-face {font-family:"${l}";src:${d}}`;this.insertRule(u);let p=this._document.createElement("div");for(let t of(p.style.visibility="hidden",p.style.width=p.style.height="10px",p.style.position="absolute",p.style.top=p.style.left="0px",[e.loadedName,l])){let e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,p.append(e)}this._document.body.append(p),isFontReady(l,()=>{p.remove(),t.complete()})}}class a{constructor(e,{disableFontFace:t=!1,fontExtraProperties:s=!1,inspectFont:r=null}){for(let t in this.compiledGlyphs=Object.create(null),e)this[t]=e[t];this.disableFontFace=!0===t,this.fontExtraProperties=!0===s,this._inspectFont=r}createNativeFontFace(){let e;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){let t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),e}createFontFaceRule(){let e;if(!this.data||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${(0,r.toBase64Util)(this.data)});`;if(this.cssFontInfo){let s=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(s+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${s}src:${t}}`}else e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;return this._inspectFont?.(this,t),e}getPathGenerator(e,t){let s;if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let i=this.loadedName+"_path_"+t;try{s=e.get(i)}catch(e){(0,r.warn)(`getPathGenerator - ignoring character: "${e}".`)}let a=new Path2D(s||"");return this.fontExtraProperties||e.delete(i),this.compiledGlyphs[t]=a}}},(e,t,s)=>{s.r(t),s.d(t,{OutputScale:()=>c,PDFDateString:()=>h,PageViewport:()=>n,PixelsPerInch:()=>a,RenderingCancelledException:()=>o,SVG_NS:()=>i,StatTimer:()=>l,deprecated:()=>deprecated,fetchData:()=>fetchData,getColorValues:()=>getColorValues,getCurrentTransform:()=>getCurrentTransform,getCurrentTransformInverse:()=>getCurrentTransformInverse,getFilenameFromUrl:()=>getFilenameFromUrl,getPdfFilenameFromUrl:()=>getPdfFilenameFromUrl,getRGB:()=>getRGB,getXfaPageViewport:()=>getXfaPageViewport,isDataScheme:()=>isDataScheme,isPdfFile:()=>isPdfFile,isValidFetchUrl:()=>isValidFetchUrl,noContextMenu:()=>noContextMenu,setLayerDimensions:()=>setLayerDimensions,stopEvent:()=>stopEvent});var r=s(1);let i="http://www.w3.org/2000/svg";class a{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function fetchData(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(isValidFetchUrl(e,document.baseURI)){let s=await fetch(e);if(!s.ok)throw Error(s.statusText);switch(t){case"arraybuffer":return s.arrayBuffer();case"blob":return s.blob();case"json":return s.json()}return s.text()}return new Promise((s,r)=>{let i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(200===i.status||0===i.status){switch(t){case"arraybuffer":case"blob":case"json":s(i.response);return}s(i.responseText);return}r(Error(i.statusText))}},i.send(null)})}class n{constructor({viewBox:e,userUnit:t,scale:s,rotation:r,offsetX:i=0,offsetY:a=0,dontFlip:n=!1}){let o,l,h,c,d,u,p,g;this.viewBox=e,this.userUnit=t,this.scale=s,this.rotation=r,this.offsetX=i,this.offsetY=a,s*=t;let f=(e[2]+e[0])/2,m=(e[3]+e[1])/2;switch((r%=360)<0&&(r+=360),r){case 180:o=-1,l=0,h=0,c=1;break;case 90:o=0,l=1,h=1,c=0;break;case 270:o=0,l=-1,h=-1,c=0;break;case 0:o=1,l=0,h=0,c=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}n&&(h=-h,c=-c),0===o?(d=Math.abs(m-e[1])*s+i,u=Math.abs(f-e[0])*s+a,p=(e[3]-e[1])*s,g=(e[2]-e[0])*s):(d=Math.abs(f-e[0])*s+i,u=Math.abs(m-e[1])*s+a,p=(e[2]-e[0])*s,g=(e[3]-e[1])*s),this.transform=[o*s,l*s,h*s,c*s,d-o*s*f-h*s*m,u-l*s*f-c*s*m],this.width=p,this.height=g}get rawDims(){let{userUnit:e,viewBox:t}=this,s=t.map(t=>t*e);return(0,r.shadow)(this,"rawDims",{pageWidth:s[2]-s[0],pageHeight:s[3]-s[1],pageX:s[0],pageY:s[1]})}clone(){let{scale:e=this.scale,rotation:t=this.rotation,offsetX:s=this.offsetX,offsetY:r=this.offsetY,dontFlip:i=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new n({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:s,offsetY:r,dontFlip:i})}convertToViewportPoint(e,t){return r.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){let t=r.Util.applyTransform([e[0],e[1]],this.transform),s=r.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],s[0],s[1]]}convertToPdfPoint(e,t){return r.Util.applyInverseTransform([e,t],this.transform)}}class o extends r.BaseException{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function isDataScheme(e){let t=e.length,s=0;for(;s<t&&""===e[s].trim();)s++;return"data:"===e.substring(s,s+5).toLowerCase()}function isPdfFile(e){return"string"==typeof e&&/\.pdf$/i.test(e)}function getFilenameFromUrl(e){return[e]=e.split(/[#?]/,1),e.substring(e.lastIndexOf("/")+1)}function getPdfFilenameFromUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!=typeof e)return t;if(isDataScheme(e))return(0,r.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;let s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e),a=s.exec(i[1])||s.exec(i[2])||s.exec(i[3]);if(a&&(a=a[0]).includes("%"))try{a=s.exec(decodeURIComponent(a))[0]}catch{}return a||t}class l{started=Object.create(null);times=[];time(e){e in this.started&&(0,r.warn)(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,r.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(){let e=[],t=0;for(let{name:e}of this.times)t=Math.max(e.length,t);for(let{name:s,start:r,end:i}of this.times)e.push(`${s.padEnd(t)} ${i-r}ms `);return e.join("")}}function isValidFetchUrl(e,t){try{let{protocol:s}=t?new URL(e,t):new URL(e);return"http:"===s||"https:"===s}catch{return!1}}function noContextMenu(e){e.preventDefault()}function stopEvent(e){e.preventDefault(),e.stopPropagation()}function deprecated(e){console.log("Deprecated API usage: "+e)}class h{static #M;static toDateObject(e){if(!e||"string"!=typeof e)return null;this.#M||=RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");let t=this.#M.exec(e);if(!t)return null;let s=parseInt(t[1],10),r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let n=parseInt(t[5],10);n=n>=0&&n<=59?n:0;let o=parseInt(t[6],10);o=o>=0&&o<=59?o:0;let l=t[7]||"Z",h=parseInt(t[8],10);h=h>=0&&h<=23?h:0;let c=parseInt(t[9],10)||0;return c=c>=0&&c<=59?c:0,"-"===l?(a+=h,n+=c):"+"===l&&(a-=h,n-=c),new Date(Date.UTC(s,r,i,a,n,o))}}function getXfaPageViewport(e,t){let{scale:s=1,rotation:r=0}=t,{width:i,height:a}=e.attributes.style;return new n({viewBox:[0,0,parseInt(i),parseInt(a)],userUnit:1,scale:s,rotation:r})}function getRGB(e){if(e.startsWith("#")){let t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map(e=>parseInt(e)):e.startsWith("rgba(")?e.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):((0,r.warn)(`Not a valid color format: "${e}"`),[0,0,0])}function getColorValues(e){let t=document.createElement("span");for(let s of(t.style.visibility="hidden",document.body.append(t),e.keys())){t.style.color=s;let r=window.getComputedStyle(t).color;e.set(s,getRGB(r))}t.remove()}function getCurrentTransform(e){let{a:t,b:s,c:r,d:i,e:a,f:n}=e.getTransform();return[t,s,r,i,a,n]}function getCurrentTransformInverse(e){let{a:t,b:s,c:r,d:i,e:a,f:n}=e.getTransform().invertSelf();return[t,s,r,i,a,n]}function setLayerDimensions(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!(arguments.length>3)||void 0===arguments[3]||arguments[3];if(t instanceof n){let{pageWidth:i,pageHeight:a}=t.rawDims,{style:n}=e,o=r.FeatureTest.isCSSRoundSupported,l=`var(--scale-factor) * ${i}px`,h=`var(--scale-factor) * ${a}px`,c=o?`round(down, ${l}, var(--scale-round-x, 1px))`:`calc(${l})`,d=o?`round(down, ${h}, var(--scale-round-y, 1px))`:`calc(${h})`;s&&t.rotation%180!=0?(n.width=d,n.height=c):(n.width=c,n.height=d)}i&&e.setAttribute("data-main-rotation",t.rotation)}class c{constructor(){let e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}},(e,t,s)=>{s.r(t),s.d(t,{MessageHandler:()=>n,wrapReason:()=>wrapReason});var r=s(1);let i={DATA:1,ERROR:2},a={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function onFn(){}function wrapReason(e){if(e instanceof r.AbortException||e instanceof r.InvalidPDFException||e instanceof r.MissingPDFException||e instanceof r.PasswordException||e instanceof r.UnexpectedResponseException||e instanceof r.UnknownErrorException)return e;switch(e instanceof Error||"object"==typeof e&&null!==e||(0,r.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new r.AbortException(e.message);case"InvalidPDFException":return new r.InvalidPDFException(e.message);case"MissingPDFException":return new r.MissingPDFException(e.message);case"PasswordException":return new r.PasswordException(e.message,e.code);case"UnexpectedResponseException":return new r.UnexpectedResponseException(e.message,e.status);case"UnknownErrorException":return new r.UnknownErrorException(e.message,e.details)}return new r.UnknownErrorException(e.message,e.toString())}class n{#I=new AbortController;constructor(e,t,s){this.sourceName=e,this.targetName=t,this.comObj=s,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),s.addEventListener("message",this.#L.bind(this),{signal:this.#I.signal})}#L(e){let{data:t}=e;if(t.targetName!==this.sourceName)return;if(t.stream){this.#D(t);return}if(t.callback){let e=t.callbackId,s=this.callbackCapabilities[e];if(!s)throw Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],t.callback===i.DATA)s.resolve(t.data);else if(t.callback===i.ERROR)s.reject(wrapReason(t.reason));else throw Error("Unexpected callback case");return}let s=this.actionHandler[t.action];if(!s)throw Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let e=this.sourceName,r=t.sourceName,a=this.comObj;Promise.try(s,t.data).then(function(s){a.postMessage({sourceName:e,targetName:r,callback:i.DATA,callbackId:t.callbackId,data:s})},function(s){a.postMessage({sourceName:e,targetName:r,callback:i.ERROR,callbackId:t.callbackId,reason:wrapReason(s)})});return}if(t.streamId){this.#O(t);return}s(t.data)}on(e,t){let s=this.actionHandler;if(s[e])throw Error(`There is already an actionName called "${e}"`);s[e]=t}send(e,t,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},s)}sendWithPromise(e,t,s){let r=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[r]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},s)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,s,i){let n=this.streamId++,o=this.sourceName,l=this.targetName,h=this.comObj;return new ReadableStream({start:s=>{let r=Promise.withResolvers();return this.streamControllers[n]={controller:s,startCall:r,pullCall:null,cancelCall:null,isClosed:!1},h.postMessage({sourceName:o,targetName:l,action:e,streamId:n,data:t,desiredSize:s.desiredSize},i),r.promise},pull:e=>{let t=Promise.withResolvers();return this.streamControllers[n].pullCall=t,h.postMessage({sourceName:o,targetName:l,stream:a.PULL,streamId:n,desiredSize:e.desiredSize}),t.promise},cancel:e=>{(0,r.assert)(e instanceof Error,"cancel must have a valid reason");let t=Promise.withResolvers();return this.streamControllers[n].cancelCall=t,this.streamControllers[n].isClosed=!0,h.postMessage({sourceName:o,targetName:l,stream:a.CANCEL,streamId:n,reason:wrapReason(e)}),t.promise}},s)}#O(e){let t=e.streamId,s=this.sourceName,i=e.sourceName,n=this.comObj,o=this,l=this.actionHandler[e.action],h={enqueue(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;let l=this.desiredSize;this.desiredSize-=r,l>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:a.ENQUEUE,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:a.CLOSE,streamId:t}),delete o.streamSinks[t])},error(e){(0,r.assert)(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:a.ERROR,streamId:t,reason:wrapReason(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};h.sinkCapability.resolve(),h.ready=h.sinkCapability.promise,this.streamSinks[t]=h,Promise.try(l,e.data,h).then(function(){n.postMessage({sourceName:s,targetName:i,stream:a.START_COMPLETE,streamId:t,success:!0})},function(e){n.postMessage({sourceName:s,targetName:i,stream:a.START_COMPLETE,streamId:t,reason:wrapReason(e)})})}#D(e){let t=e.streamId,s=this.sourceName,i=e.sourceName,n=this.comObj,o=this.streamControllers[t],l=this.streamSinks[t];switch(e.stream){case a.START_COMPLETE:e.success?o.startCall.resolve():o.startCall.reject(wrapReason(e.reason));break;case a.PULL_COMPLETE:e.success?o.pullCall.resolve():o.pullCall.reject(wrapReason(e.reason));break;case a.PULL:if(!l){n.postMessage({sourceName:s,targetName:i,stream:a.PULL_COMPLETE,streamId:t,success:!0});break}l.desiredSize<=0&&e.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=e.desiredSize,Promise.try(l.onPull||onFn).then(function(){n.postMessage({sourceName:s,targetName:i,stream:a.PULL_COMPLETE,streamId:t,success:!0})},function(e){n.postMessage({sourceName:s,targetName:i,stream:a.PULL_COMPLETE,streamId:t,reason:wrapReason(e)})});break;case a.ENQUEUE:if((0,r.assert)(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(e.chunk);break;case a.CLOSE:if((0,r.assert)(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),this.#B(o,t);break;case a.ERROR:(0,r.assert)(o,"error should have stream controller"),o.controller.error(wrapReason(e.reason)),this.#B(o,t);break;case a.CANCEL_COMPLETE:e.success?o.cancelCall.resolve():o.cancelCall.reject(wrapReason(e.reason)),this.#B(o,t);break;case a.CANCEL:if(!l)break;let h=wrapReason(e.reason);Promise.try(l.onCancel||onFn,h).then(function(){n.postMessage({sourceName:s,targetName:i,stream:a.CANCEL_COMPLETE,streamId:t,success:!0})},function(e){n.postMessage({sourceName:s,targetName:i,stream:a.CANCEL_COMPLETE,streamId:t,reason:wrapReason(e)})}),l.sinkCapability.reject(h),l.isCancelled=!0,delete this.streamSinks[t];break;default:throw Error("Unexpected stream case")}}async #B(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.#I?.abort(),this.#I=null}}},(e,t,s)=>{s.r(t),s.d(t,{NodeCMapReaderFactory:()=>c,NodeCanvasFactory:()=>h,NodeFilterFactory:()=>l,NodeStandardFontDataFactory:()=>d,fetchData:()=>fetchData});var r=s(1),i=s(9),a=s(10),n=s(11),o=s(12);if(r.isNodeJS){let e;try{let t=process.getBuiltinModule("module").createRequire("file:///C:/laragon/www/git/dearviewer/ref/pdf.js/src/display/node_utils.js");try{e=t("@napi-rs/canvas")}catch(e){(0,r.warn)(`Cannot load "@napi-rs/canvas" package: "${e}".`)}}catch(e){(0,r.warn)(`Cannot access the \`require\` function: "${e}".`)}globalThis.DOMMatrix||(e?.DOMMatrix?globalThis.DOMMatrix=e.DOMMatrix:(0,r.warn)("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.ImageData||(e?.ImageData?globalThis.ImageData=e.ImageData:(0,r.warn)("Cannot polyfill `ImageData`, rendering may be broken.")),globalThis.Path2D||(e?.Path2D?globalThis.Path2D=e.Path2D:(0,r.warn)("Cannot polyfill `Path2D`, rendering may be broken."))}async function fetchData(e){let t=process.getBuiltinModule("fs");return new Uint8Array(await t.promises.readFile(e))}class l extends n.BaseFilterFactory{}class h extends i.BaseCanvasFactory{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire("file:///C:/laragon/www/git/dearviewer/ref/pdf.js/src/display/node_utils.js")("@napi-rs/canvas").createCanvas(e,t)}}class c extends a.BaseCMapReaderFactory{async _fetch(e){return fetchData(e)}}class d extends o.BaseStandardFontDataFactory{async _fetch(e){return fetchData(e)}}},(e,t,s)=>{s.r(t),s.d(t,{BaseCanvasFactory:()=>i,DOMCanvasFactory:()=>a});var r=s(1);class i{#N=!1;constructor({enableHWA:e=!1}){this.#N=e}create(e,t){if(e<=0||t<=0)throw Error("Invalid canvas size");let s=this._createCanvas(e,t);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!this.#N})}}reset(e,t,s){if(!e.canvas)throw Error("Canvas is not specified");if(t<=0||s<=0)throw Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=s}destroy(e){if(!e.canvas)throw Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){(0,r.unreachable)("Abstract method `_createCanvas` called.")}}class a extends i{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let s=this._document.createElement("canvas");return s.width=e,s.height=t,s}}},(e,t,s)=>{s.r(t),s.d(t,{BaseCMapReaderFactory:()=>a,DOMCMapReaderFactory:()=>n});var r=s(1),i=s(6);class a{constructor({baseUrl:e=null,isCompressed:t=!0}){this.baseUrl=e,this.isCompressed=t}async fetch(e){let{name:t}=e;if(!this.baseUrl)throw Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw Error("CMap name must be specified.");let s=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(s).then(e=>({cMapData:e,isCompressed:this.isCompressed})).catch(e=>{throw Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${s}`)})}async _fetch(e){(0,r.unreachable)("Abstract method `_fetch` called.")}}class n extends a{async _fetch(e){let t=await (0,i.fetchData)(e,this.isCompressed?"arraybuffer":"text");return t instanceof ArrayBuffer?new Uint8Array(t):(0,r.stringToBytes)(t)}}},(e,t,s)=>{s.r(t),s.d(t,{BaseFilterFactory:()=>a,DOMFilterFactory:()=>n});var r=s(6),i=s(1);class a{constructor(){}addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,t,s,r,i){return"none"}destroy(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]}}class n extends a{#U;#j;#V;#s;#H;#G;#q=0;constructor({docId:e,ownerDocument:t=globalThis.document}){super(),this.#s=e,this.#H=t}get #$(){return this.#j||=new Map}get #W(){return this.#G||=new Map}get #z(){if(!this.#V){let e=this.#H.createElement("div"),{style:t}=e;t.visibility="hidden",t.contain="strict",t.width=t.height=0,t.position="absolute",t.top=t.left=0,t.zIndex=-1;let s=this.#H.createElementNS(r.SVG_NS,"svg");s.setAttribute("width",0),s.setAttribute("height",0),this.#V=this.#H.createElementNS(r.SVG_NS,"defs"),e.append(s),s.append(this.#V),this.#H.body.append(e)}return this.#V}#X(e){if(1===e.length){let t=e[0],s=Array(256);for(let e=0;e<256;e++)s[e]=t[e]/255;let r=s.join(",");return[r,r,r]}let[t,s,r]=e,i=Array(256),a=Array(256),n=Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255,a[e]=s[e]/255,n[e]=r[e]/255;return[i.join(","),a.join(","),n.join(",")]}#Y(e){if(void 0===this.#U){this.#U="";let e=this.#H.URL;e!==this.#H.baseURI&&((0,r.isDataScheme)(e)?(0,i.warn)('#createUrl: ignore "data:"-URL for performance reasons.'):this.#U=e.split("#",1)[0])}return`url(${this.#U}#${e})`}addFilter(e){if(!e)return"none";let t=this.#$.get(e);if(t)return t;let[s,r,i]=this.#X(e),a=1===e.length?s:`${s}${r}${i}`;if(t=this.#$.get(a))return this.#$.set(e,t),t;let n=`g_${this.#s}_transfer_map_${this.#q++}`,o=this.#Y(n);this.#$.set(e,o),this.#$.set(a,o);let l=this.#K(n);return this.#Q(s,r,i,l),o}addHCMFilter(e,t){let s=`${e}-${t}`,r="base",a=this.#W.get(r);if(a?.key===s||(a?(a.filter?.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},this.#W.set(r,a)),!e||!t))return a.url;let n=this.#J(e);e=i.Util.makeHexColor(...n);let o=this.#J(t);if(t=i.Util.makeHexColor(...o),this.#z.style.color="","#000000"===e&&"#ffffff"===t||e===t)return a.url;let l=Array(256);for(let e=0;e<=255;e++){let t=e/255;l[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}let h=l.join(","),c=`g_${this.#s}_hcm_filter`,d=a.filter=this.#K(c);this.#Q(h,h,h,d),this.#Z(d);let getSteps=(e,t)=>{let s=n[e]/255,r=o[e]/255,i=Array(t+1);for(let e=0;e<=t;e++)i[e]=s+e/t*(r-s);return i.join(",")};return this.#Q(getSteps(0,5),getSteps(1,5),getSteps(2,5),d),a.url=this.#Y(c),a.url}addAlphaFilter(e){let t=this.#$.get(e);if(t)return t;let[s]=this.#X([e]),r=`alpha_${s}`;if(t=this.#$.get(r))return this.#$.set(e,t),t;let i=`g_${this.#s}_alpha_map_${this.#q++}`,a=this.#Y(i);this.#$.set(e,a),this.#$.set(r,a);let n=this.#K(i);return this.#ee(s,n),a}addLuminosityFilter(e){let t,s,r=this.#$.get(e||"luminosity");if(r)return r;if(e?([t]=this.#X([e]),s=`luminosity_${t}`):s="luminosity",r=this.#$.get(s))return this.#$.set(e,r),r;let i=`g_${this.#s}_luminosity_map_${this.#q++}`,a=this.#Y(i);this.#$.set(e,a),this.#$.set(s,a);let n=this.#K(i);return this.#et(n),e&&this.#ee(t,n),a}addHighlightHCMFilter(e,t,s,r,i){let a=`${t}-${s}-${r}-${i}`,n=this.#W.get(e);if(n?.key===a||(n?(n.filter?.remove(),n.key=a,n.url="none",n.filter=null):(n={key:a,url:"none",filter:null},this.#W.set(e,n)),!t||!s))return n.url;let[o,l]=[t,s].map(this.#J.bind(this)),h=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),c=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[d,u]=[r,i].map(this.#J.bind(this));c<h&&([h,c,d,u]=[c,h,u,d]),this.#z.style.color="";let getSteps=(e,t,s)=>{let r=Array(256),i=(c-h)/s,a=e/255,n=(t-e)/(255*s),o=0;for(let e=0;e<=s;e++){let t=Math.round(h+e*i),s=a+e*n;for(let e=o;e<=t;e++)r[e]=s;o=t+1}for(let e=o;e<256;e++)r[e]=r[o-1];return r.join(",")},p=`g_${this.#s}_hcm_${e}_filter`,g=n.filter=this.#K(p);return this.#Z(g),this.#Q(getSteps(d[0],u[0],5),getSteps(d[1],u[1],5),getSteps(d[2],u[2],5),g),n.url=this.#Y(p),n.url}destroy(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&this.#G?.size||(this.#V?.parentNode.parentNode.remove(),this.#V=null,this.#j?.clear(),this.#j=null,this.#G?.clear(),this.#G=null,this.#q=0)}#et(e){let t=this.#H.createElementNS(r.SVG_NS,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(t)}#Z(e){let t=this.#H.createElementNS(r.SVG_NS,"feColorMatrix");t.setAttribute("type","matrix"),t.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(t)}#K(e){let t=this.#H.createElementNS(r.SVG_NS,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",e),this.#z.append(t),t}#es(e,t,s){let i=this.#H.createElementNS(r.SVG_NS,t);i.setAttribute("type","discrete"),i.setAttribute("tableValues",s),e.append(i)}#Q(e,t,s,i){let a=this.#H.createElementNS(r.SVG_NS,"feComponentTransfer");i.append(a),this.#es(a,"feFuncR",e),this.#es(a,"feFuncG",t),this.#es(a,"feFuncB",s)}#ee(e,t){let s=this.#H.createElementNS(r.SVG_NS,"feComponentTransfer");t.append(s),this.#es(s,"feFuncA",e)}#J(e){return this.#z.style.color=e,(0,r.getRGB)(getComputedStyle(this.#z).getPropertyValue("color"))}}},(e,t,s)=>{s.r(t),s.d(t,{BaseStandardFontDataFactory:()=>a,DOMStandardFontDataFactory:()=>n});var r=s(6),i=s(1);class a{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch(e){let{filename:t}=e;if(!this.baseUrl)throw Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw Error("Font filename must be specified.");let s=`${this.baseUrl}${t}`;return this._fetch(s).catch(e=>{throw Error(`Unable to load font data at: ${s}`)})}async _fetch(e){(0,i.unreachable)("Abstract method `_fetch` called.")}}class n extends a{async _fetch(e){return new Uint8Array(await (0,r.fetchData)(e,"arraybuffer"))}}},(e,t,s)=>{s.r(t),s.d(t,{CanvasGraphics:()=>p});var r=s(1),i=s(6),a=s(14),n=s(15);function mirrorContextOperations(e,t){if(e._removeMirroring)throw Error("Context is already forwarding operations.");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.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function ctxSave(){t.save(),this.__originalSave()},e.restore=function ctxRestore(){t.restore(),this.__originalRestore()},e.translate=function ctxTranslate(e,s){t.translate(e,s),this.__originalTranslate(e,s)},e.scale=function ctxScale(e,s){t.scale(e,s),this.__originalScale(e,s)},e.transform=function ctxTransform(e,s,r,i,a,n){t.transform(e,s,r,i,a,n),this.__originalTransform(e,s,r,i,a,n)},e.setTransform=function ctxSetTransform(e,s,r,i,a,n){t.setTransform(e,s,r,i,a,n),this.__originalSetTransform(e,s,r,i,a,n)},e.resetTransform=function ctxResetTransform(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function ctxRotate(e){t.rotate(e),this.__originalRotate(e)},e.clip=function ctxRotate(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,s){t.moveTo(e,s),this.__originalMoveTo(e,s)},e.lineTo=function(e,s){t.lineTo(e,s),this.__originalLineTo(e,s)},e.bezierCurveTo=function(e,s,r,i,a,n){t.bezierCurveTo(e,s,r,i,a,n),this.__originalBezierCurveTo(e,s,r,i,a,n)},e.rect=function(e,s,r,i){t.rect(e,s,r,i),this.__originalRect(e,s,r,i)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class o{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,s){let r;return void 0!==this.cache[e]?(r=this.cache[e],this.canvasFactory.reset(r,t,s)):(r=this.canvasFactory.create(t,s),this.cache[e]=r),r}delete(e){delete this.cache[e]}clear(){for(let e in this.cache){let t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function drawImageAtIntegerCoords(e,t,s,r,a,n,o,l,h,c){let[d,u,p,g,f,m]=(0,i.getCurrentTransform)(e);if(0===u&&0===p){let i=Math.round(o*d+f),A=Math.round(l*g+m),b=Math.abs(Math.round((o+h)*d+f)-i)||1,y=Math.abs(Math.round((l+c)*g+m)-A)||1;return e.setTransform(Math.sign(d),0,0,Math.sign(g),i,A),e.drawImage(t,s,r,a,n,0,0,b,y),e.setTransform(d,u,p,g,f,m),[b,y]}if(0===d&&0===g){let i=Math.round(l*p+f),A=Math.round(o*u+m),b=Math.abs(Math.round((l+c)*p+f)-i)||1,y=Math.abs(Math.round((o+h)*u+m)-A)||1;return e.setTransform(0,Math.sign(u),Math.sign(p),0,i,A),e.drawImage(t,s,r,a,n,0,0,y,b),e.setTransform(d,u,p,g,f,m),[y,b]}return e.drawImage(t,s,r,a,n,o,l,h,c),[Math.hypot(d,u)*h,Math.hypot(p,g)*c]}function compileType3Glyph(e){let t,s,r;let{width:i,height:a}=e;if(i>1e3||a>1e3)return null;let n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),o=i+1,l=new Uint8Array(o*(a+1)),h=i+7&-8,c=new Uint8Array(h*a),d=0;for(let t of e.data){let e=128;for(;e>0;)c[d++]=t&e?0:255,e>>=1}let u=0;for(0!==c[d=0]&&(l[0]=1,++u),s=1;s<i;s++)c[d]!==c[d+1]&&(l[s]=c[d]?2:1,++u),d++;for(0!==c[d]&&(l[s]=2,++u),t=1;t<a;t++){d=t*h,r=t*o,c[d-h]!==c[d]&&(l[r]=c[d]?1:8,++u);let e=(c[d]?4:0)+(c[d-h]?8:0);for(s=1;s<i;s++)n[e=(e>>2)+(c[d+1]?4:0)+(c[d-h+1]?8:0)]&&(l[r+s]=n[e],++u),d++;if(c[d-h]!==c[d]&&(l[r+s]=c[d]?2:4,++u),u>1e3)return null}for(d=h*(a-1),r=t*o,0!==c[d]&&(l[r]=8,++u),s=1;s<i;s++)c[d]!==c[d+1]&&(l[r+s]=c[d]?4:8,++u),d++;if(0!==c[d]&&(l[r+s]=4,++u),u>1e3)return null;let p=new Int32Array([0,o,-1,0,-o,0,0,0,1]),g=new Path2D;for(t=0;u&&t<=a;t++){let e=t*o,s=e+i;for(;e<s&&!l[e];)e++;if(e===s)continue;g.moveTo(e%o,t);let r=e,a=l[e];do{let t=p[a];do e+=t;while(!l[e]);let s=l[e];5!==s&&10!==s?(a=s,l[e]=0):(a=s&51*a>>4,l[e]&=a>>2|a<<2),g.lineTo(e%o,e/o|0),!l[e]&&--u}while(r!==e);--t}return c=null,l=null,function(e){e.save(),e.scale(1/i,-1/a),e.translate(0,-a),e.fill(g),e.beginPath(),e.restore()}}class l{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=r.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=r.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=r.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.patternStroke=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,t])}clone(){let e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,s){[t,s]=r.Util.applyTransform([t,s],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,s),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,s)}updateRectMinMax(e,t){let s=r.Util.applyTransform(t,e),i=r.Util.applyTransform(t.slice(2),e),a=r.Util.applyTransform([t[0],t[3]],e),n=r.Util.applyTransform([t[2],t[1]],e);this.minX=Math.min(this.minX,s[0],i[0],a[0],n[0]),this.minY=Math.min(this.minY,s[1],i[1],a[1],n[1]),this.maxX=Math.max(this.maxX,s[0],i[0],a[0],n[0]),this.maxY=Math.max(this.maxY,s[1],i[1],a[1],n[1])}updateScalingPathMinMax(e,t){r.Util.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.minY=Math.min(this.minY,t[1]),this.maxX=Math.max(this.maxX,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,s,i,a,n,o,l,h,c){let d=r.Util.bezierBoundingBox(t,s,i,a,n,o,l,h,c);c||this.updateRectMinMax(e,d)}getPathBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.PathType.FILL,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=[this.minX,this.minY,this.maxX,this.maxY];if(e===a.PathType.STROKE){t||(0,r.unreachable)("Stroke bounding box must include transform.");let e=r.Util.singularValueDecompose2dScale(t),i=e[0]*this.lineWidth/2,a=e[1]*this.lineWidth/2;s[0]-=i,s[1]-=a,s[2]+=i,s[3]+=a}return s}updateClipFromPath(){let e=r.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.PathType.FILL,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r.Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function putBinaryImageData(e,t){let s,i,a,n;if(t instanceof ImageData){e.putImageData(t,0,0);return}let o=t.height,l=t.width,h=o%16,c=(o-h)/16,d=0===h?c:c+1,u=e.createImageData(l,16),p=0,g,f=t.data,m=u.data;if(t.kind===r.ImageKind.GRAYSCALE_1BPP){let t=f.byteLength,n=new Uint32Array(m.buffer,0,m.byteLength>>2),o=n.length,A=l+7>>3,b=r.FeatureTest.isLittleEndian?4278190080:255;for(s=0;s<d;s++){for(i=0,a=s<c?16:h,g=0;i<a;i++){let e=t-p,s=0,r=e>A?l:8*e-7,i=-8&r,a=0,o=0;for(;s<i;s+=8)o=f[p++],n[g++]=128&o?4294967295:b,n[g++]=64&o?4294967295:b,n[g++]=32&o?4294967295:b,n[g++]=16&o?4294967295:b,n[g++]=8&o?4294967295:b,n[g++]=4&o?4294967295:b,n[g++]=2&o?4294967295:b,n[g++]=1&o?4294967295:b;for(;s<r;s++)0===a&&(o=f[p++],a=128),n[g++]=o&a?4294967295:b,a>>=1}for(;g<o;)n[g++]=0;e.putImageData(u,0,16*s)}}else if(t.kind===r.ImageKind.RGBA_32BPP){for(s=0,i=0,n=64*l;s<c;s++)m.set(f.subarray(p,p+n)),p+=n,e.putImageData(u,0,i),i+=16;s<d&&(n=l*h*4,m.set(f.subarray(p,p+n)),e.putImageData(u,0,i))}else if(t.kind===r.ImageKind.RGB_24BPP)for(s=0,n=l*(a=16);s<d;s++){for(s>=c&&(n=l*(a=h)),g=0,i=n;i--;)m[g++]=f[p++],m[g++]=f[p++],m[g++]=f[p++],m[g++]=255;e.putImageData(u,0,16*s)}else throw Error(`bad image kind: ${t.kind}`)}function putBinaryImageMask(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}let s=t.height,r=t.width,i=s%16,a=(s-i)/16,o=0===i?a:a+1,l=e.createImageData(r,16),h=0,c=t.data,d=l.data;for(let t=0;t<o;t++){let s=t<a?16:i;({srcPos:h}=(0,n.convertBlackAndWhiteToRGBA)({src:c,srcPos:h,dest:d,width:r,height:s,nonBlackColor:0})),e.putImageData(l,0,16*t)}}function copyCtxState(e,t){for(let s of["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"])void 0!==e[s]&&(t[s]=e[s]);void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function resetCtxToDefault(e){if(e.strokeStyle=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",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0),!r.isNodeJS){let{filter:t}=e;"none"!==t&&""!==t&&(e.filter="none")}}function getImageSmoothingEnabled(e,t){if(t)return!0;let s=r.Util.singularValueDecompose2dScale(e);s[0]=Math.fround(s[0]),s[1]=Math.fround(s[1]);let a=Math.fround((globalThis.devicePixelRatio||1)*i.PixelsPerInch.PDF_TO_CSS_UNITS);return s[0]<=a&&s[1]<=a}let h=["butt","round","square"],c=["miter","round","bevel"],d={},u={};class p{constructor(e,t,s,r,i,{optionalContentConfig:a,markedContentStack:n=null},h,c){this.ctx=e,this.current=new l(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=s,this.canvasFactory=r,this.filterFactory=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=n||[],this.optionalContentConfig=a,this.cachedCanvases=new o(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=h,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing(e){let{transform:t,viewport:s,transparency:r=!1,background:a=null}=e,n=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,n,o),this.ctx.fillStyle=l,r){let e=this.cachedCanvases.getCanvas("transparent",n,o);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...(0,i.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),resetCtxToDefault(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...s.transform),this.viewportScale=s.scale,this.baseTransform=(0,i.getCurrentTransform)(this.ctx)}executeOperatorList(e,t,s,i){let a;let n=e.argsArray,o=e.fnArray,l=t||0,h=n.length;if(h===l)return l;let c=h-l>10&&"function"==typeof s,d=c?Date.now()+15:0,u=0,p=this.commonObjs,g=this.objs;for(;;){if(void 0!==i&&l===i.nextBreakPoint)return i.breakIt(l,s),l;if((a=o[l])!==r.OPS.dependency)this[a].apply(this,n[l]);else for(let e of n[l]){let t=e.startsWith("g_")?p:g;if(!t.has(e))return t.get(e,s),l}if(++l===h)return l;if(c&&++u>10){if(Date.now()>d)return s(),l;u=0}}}#er(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){for(let e of(this.#er(),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#ei()}#ei(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==e){let t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){let s,r;let i=e.width??e.displayWidth,a=e.height??e.displayHeight,n=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=i,h=a,c="prescale1";for(;n>2&&l>1||o>2&&h>1;){let t=l,i=h;n>2&&l>1&&(t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),n/=l/t),o>2&&h>1&&(i=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/i),(r=(s=this.cachedCanvases.getCanvas(c,t,i)).context).clearRect(0,0,t,i),r.drawImage(e,0,0,l,h,0,0,t,i),e=s.canvas,l=t,h=i,c="prescale1"===c?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:h}}_createMaskCanvas(e){let t,s,n,o;let l=this.ctx,{width:h,height:c}=e,d=this.current.fillColor,u=this.current.patternFill,p=(0,i.getCurrentTransform)(l);if((e.bitmap||e.data)&&e.count>1){let r=e.bitmap||e.data.buffer;s=JSON.stringify(u?p:[p.slice(0,4),d]),(t=this._cachedBitmapsMap.get(r))||(t=new Map,this._cachedBitmapsMap.set(r,t));let i=t.get(s);if(i&&!u)return{canvas:i,offsetX:Math.round(Math.min(p[0],p[2])+p[4]),offsetY:Math.round(Math.min(p[1],p[3])+p[5])};n=i}n||putBinaryImageMask((o=this.cachedCanvases.getCanvas("maskCanvas",h,c)).context,e);let g=r.Util.transform(p,[1/h,0,0,-1/c,0,0]);g=r.Util.transform(g,[1,0,0,1,0,-c]);let[f,m,A,b]=r.Util.getAxialAlignedBoundingBox([0,0,h,c],g),y=Math.round(A-f)||1,_=Math.round(b-m)||1,v=this.cachedCanvases.getCanvas("fillCanvas",y,_),C=v.context;C.translate(-f,-m),C.transform(...g),!n&&(n=(n=this._scaleImage(o.canvas,(0,i.getCurrentTransformInverse)(C))).img,t&&u&&t.set(s,n)),C.imageSmoothingEnabled=getImageSmoothingEnabled((0,i.getCurrentTransform)(C),e.interpolate),drawImageAtIntegerCoords(C,n,0,0,n.width,n.height,0,0,h,c),C.globalCompositeOperation="source-in";let x=r.Util.transform((0,i.getCurrentTransformInverse)(C),[1,0,0,1,-f,-m]);return C.fillStyle=u?d.getPattern(l,this,x,a.PathType.FILL):d,C.fillRect(0,0,h,c),t&&!u&&(this.cachedCanvases.delete("fillCanvas"),t.set(s,v.canvas)),{canvas:v.canvas,offsetX:Math.round(f),offsetY:Math.round(m)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=h[e]}setLineJoin(e){this.ctx.lineJoin=c[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){let s=this.ctx;void 0!==s.setLineDash&&(s.setLineDash(e),s.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(let[t,s]of e)switch(t){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=s;break;case"ca":this.current.fillAlpha=s,this.ctx.globalAlpha=s;break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask=s?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let e=this.ctx.canvas.width,t=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,r=this.cachedCanvases.getCanvas(s,e,t);this.suspendedCtx=this.ctx,this.ctx=r.context;let a=this.ctx;a.setTransform(...(0,i.getCurrentTransform)(this.suspendedCtx)),copyCtxState(this.suspendedCtx,a),mirrorContextOperations(a,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),copyCtxState(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let t=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(e,t,s,r){let i=r[0],a=r[1],n=r[2]-i,o=r[3]-a;0!==n&&0!==o&&(this.genericComposeSMask(t.context,s,n,o,t.subtype,t.backdrop,t.transferMap,i,a,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(s.canvas,0,0),e.restore())}genericComposeSMask(e,t,s,i,a,n,o,l,h,c,d){let u=e.canvas,p=l-c,g=h-d;if(n){let t=r.Util.makeHexColor(...n);if(p<0||g<0||p+s>u.width||g+i>u.height){let e=this.cachedCanvases.getCanvas("maskExtension",s,i),r=e.context;r.drawImage(u,-p,-g),r.globalCompositeOperation="destination-atop",r.fillStyle=t,r.fillRect(0,0,s,i),r.globalCompositeOperation="source-over",u=e.canvas,p=g=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);let r=new Path2D;r.rect(p,g,s,i),e.clip(r),e.globalCompositeOperation="destination-atop",e.fillStyle=t,e.fillRect(p,g,s,i),e.restore()}}t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0),"Alpha"===a&&o?t.filter=this.filterFactory.addAlphaFilter(o):"Luminosity"===a&&(t.filter=this.filterFactory.addLuminosityFilter(o));let f=new Path2D;f.rect(l,h,s,i),t.clip(f),t.globalCompositeOperation="destination-in",t.drawImage(u,p,g,s,i,l,h,s,i),t.restore()}save(){this.inSMaskMode?(copyCtxState(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),copyCtxState(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,s,r,i,a){this.ctx.transform(e,t,s,r,i,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,s){let a,n;let o=this.ctx,l=this.current,h=l.x,c=l.y,d=(0,i.getCurrentTransform)(o),u=0===d[0]&&0===d[3]||0===d[1]&&0===d[2],p=u?s.slice(0):null;for(let s=0,i=0,g=e.length;s<g;s++)switch(0|e[s]){case r.OPS.rectangle:h=t[i++],c=t[i++];let g=t[i++],f=t[i++],m=h+g,A=c+f;o.moveTo(h,c),0===g||0===f?o.lineTo(m,A):(o.lineTo(m,c),o.lineTo(m,A),o.lineTo(h,A)),u||l.updateRectMinMax(d,[h,c,m,A]),o.closePath();break;case r.OPS.moveTo:h=t[i++],c=t[i++],o.moveTo(h,c),u||l.updatePathMinMax(d,h,c);break;case r.OPS.lineTo:h=t[i++],c=t[i++],o.lineTo(h,c),u||l.updatePathMinMax(d,h,c);break;case r.OPS.curveTo:a=h,n=c,h=t[i+4],c=t[i+5],o.bezierCurveTo(t[i],t[i+1],t[i+2],t[i+3],h,c),l.updateCurvePathMinMax(d,a,n,t[i],t[i+1],t[i+2],t[i+3],h,c,p),i+=6;break;case r.OPS.curveTo2:a=h,n=c,o.bezierCurveTo(h,c,t[i],t[i+1],t[i+2],t[i+3]),l.updateCurvePathMinMax(d,a,n,h,c,t[i],t[i+1],t[i+2],t[i+3],p),h=t[i+2],c=t[i+3],i+=4;break;case r.OPS.curveTo3:a=h,n=c,h=t[i+2],c=t[i+3],o.bezierCurveTo(t[i],t[i+1],h,c,h,c),l.updateCurvePathMinMax(d,a,n,t[i],t[i+1],h,c,h,c,p),i+=4;break;case r.OPS.closePath:o.closePath()}u&&l.updateScalingPathMinMax(d,p),l.setCurrentPoint(h,c)}closePath(){this.ctx.closePath()}stroke(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=this.ctx,s=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof s&&s?.getPattern?(t.save(),t.strokeStyle=s.getPattern(t,this,(0,i.getCurrentTransformInverse)(t),a.PathType.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=this.ctx,s=this.current.fillColor,r=this.current.patternFill,n=!1;r&&(t.save(),t.fillStyle=s.getPattern(t,this,(0,i.getCurrentTransformInverse)(t),a.PathType.FILL),n=!0);let o=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==o&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),n&&t.restore(),e&&this.consumePath(o)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=d}eoClip(){this.pendingClip=u}beginText(){this.current.textMatrix=r.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){let e=this.pendingTextPaths,t=this.ctx;if(void 0===e){t.beginPath();return}let s=new Path2D,r=t.getTransform().invertSelf();for(let{transform:t,x:i,y:a,fontSize:n,path:o}of e)s.addPath(o,new DOMMatrix(t).preMultiplySelf(r).translate(i,a).scale(n,-n));t.clip(s),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){let s=this.commonObjs.get(e),i=this.current;if(!s)throw Error(`Can't find font for ${e}`);if(i.fontMatrix=s.fontMatrix||r.FONT_IDENTITY_MATRIX,(0===i.fontMatrix[0]||0===i.fontMatrix[3])&&(0,r.warn)("Invalid font matrix for font "+e),t<0?(t=-t,i.fontDirection=-1):i.fontDirection=1,this.current.font=s,this.current.fontSize=t,s.isType3Font)return;let a=s.loadedName||"sans-serif",n=s.systemFontInfo?.css||`"${a}", ${s.fallbackName}`,o="normal";s.black?o="900":s.bold&&(o="bold");let l=s.italic?"italic":"normal",h=t;t<16?h=16:t>100&&(h=100),this.current.fontSizeScale=t/h,this.ctx.font=`${l} ${o} ${h}px ${n}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,s,r,i,a){this.current.textMatrix=[e,t,s,r,i,a],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}#ea(e,t,s){let r=new Path2D;return r.addPath(e,new DOMMatrix(s).invertSelf().multiplySelf(t)),r}paintChar(e,t,s,a,n){let o;let l=this.ctx,h=this.current,c=h.font,d=h.textRenderingMode,u=h.fontSize/h.fontSizeScale,p=d&r.TextRenderingMode.FILL_STROKE_MASK,g=!!(d&r.TextRenderingMode.ADD_TO_PATH_FLAG),f=h.patternFill&&!c.missingFile,m=h.patternStroke&&!c.missingFile;if((c.disableFontFace||g||f||m)&&(o=c.getPathGenerator(this.commonObjs,e)),c.disableFontFace||f||m){if(l.save(),l.translate(t,s),l.scale(u,-u),p===r.TextRenderingMode.FILL||p===r.TextRenderingMode.FILL_STROKE){if(a){let e=l.getTransform();l.setTransform(...a),l.fill(this.#ea(o,e,a))}else l.fill(o)}if(p===r.TextRenderingMode.STROKE||p===r.TextRenderingMode.FILL_STROKE){if(n){let e=l.getTransform();l.setTransform(...n),l.stroke(this.#ea(o,e,n))}else l.lineWidth/=u,l.stroke(o)}l.restore()}else(p===r.TextRenderingMode.FILL||p===r.TextRenderingMode.FILL_STROKE)&&l.fillText(e,t,s),(p===r.TextRenderingMode.STROKE||p===r.TextRenderingMode.FILL_STROKE)&&l.strokeText(e,t,s);g&&(this.pendingTextPaths||=[]).push({transform:(0,i.getCurrentTransform)(l),x:t,y:s,fontSize:u,path:o})}get isFontSubpixelAAEnabled(){let{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);let t=e.getImageData(0,0,10,10).data,s=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){s=!0;break}return(0,r.shadow)(this,"isFontSubpixelAAEnabled",s)}showText(e){let t,s;let n=this.current,o=n.font;if(o.isType3Font)return this.showType3Text(e);let l=n.fontSize;if(0===l)return;let h=this.ctx,c=n.fontSizeScale,d=n.charSpacing,u=n.wordSpacing,p=n.fontDirection,g=n.textHScale*p,f=e.length,m=o.vertical,A=m?1:-1,b=o.defaultVMetrics,y=l*n.fontMatrix[0],_=n.textRenderingMode===r.TextRenderingMode.FILL&&!o.disableFontFace&&!n.patternFill;if(h.save(),h.transform(...n.textMatrix),h.translate(n.x,n.y+n.textRise),p>0?h.scale(g,-1):h.scale(g,1),n.patternFill){h.save();let e=n.fillColor.getPattern(h,this,(0,i.getCurrentTransformInverse)(h),a.PathType.FILL);t=(0,i.getCurrentTransform)(h),h.restore(),h.fillStyle=e}if(n.patternStroke){h.save();let e=n.strokeColor.getPattern(h,this,(0,i.getCurrentTransformInverse)(h),a.PathType.STROKE);s=(0,i.getCurrentTransform)(h),h.restore(),h.strokeStyle=e}let v=n.lineWidth,C=n.textMatrixScale;if(0===C||0===v){let e=n.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;(e===r.TextRenderingMode.STROKE||e===r.TextRenderingMode.FILL_STROKE)&&(v=this.getSinglePixelWidth())}else v/=C;if(1!==c&&(h.scale(c,c),v/=c),h.lineWidth=v,o.isInvalidPDFjsFont){let t=[],s=0;for(let r of e)t.push(r.unicode),s+=r.width;h.fillText(t.join(""),0,0),n.x+=s*y*g,h.restore(),this.compose();return}let x=0,S;for(S=0;S<f;++S){let r,i;let a=e[S];if("number"==typeof a){x+=A*a*l/1e3;continue}let n=!1,g=(a.isSpace?u:0)+d,f=a.fontChar,v=a.accent,C=a.width;if(m){let e=a.vmetric||b,t=-(a.vmetric?e[1]:.5*C)*y,s=e[2]*y;C=e?-e[0]:C,r=t/c,i=(x+s)/c}else r=x/c,i=0;if(o.remeasure&&C>0){let e=1e3*h.measureText(f).width/l*c;if(C<e&&this.isFontSubpixelAAEnabled){let t=C/e;n=!0,h.save(),h.scale(t,1),r/=t}else C!==e&&(r+=(C-e)/2e3*l/c)}if(this.contentVisible&&(a.isInFont||o.missingFile)){if(_&&!v)h.fillText(f,r,i);else if(this.paintChar(f,r,i,t,s),v){let e=r+l*v.offset.x/c,a=i-l*v.offset.y/c;this.paintChar(v.fontChar,e,a,t,s)}}x+=m?C*y-g*p:C*y+g*p,n&&h.restore()}m?n.y-=x:n.x+=x*g,h.restore(),this.compose()}showType3Text(e){let t,s,i,a;let n=this.ctx,o=this.current,l=o.font,h=o.fontSize,c=o.fontDirection,d=l.vertical?1:-1,u=o.charSpacing,p=o.wordSpacing,g=o.textHScale*c,f=o.fontMatrix||r.FONT_IDENTITY_MATRIX,m=e.length;if(o.textRenderingMode!==r.TextRenderingMode.INVISIBLE&&0!==h){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),n.transform(...o.textMatrix),n.translate(o.x,o.y),n.scale(g,c),t=0;t<m;++t){if("number"==typeof(s=e[t])){a=d*s*h/1e3,this.ctx.translate(a,0),o.x+=a*g;continue}let c=(s.isSpace?p:0)+u,m=l.charProcOperatorList[s.operatorListId];if(!m){(0,r.warn)(`Type3 character "${s.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=s,this.save(),n.scale(h,h),n.transform(...f),this.executeOperatorList(m),this.restore()),i=r.Util.applyTransform([s.width,0],f)[0]*h+c,n.translate(i,0),o.x+=i*g}n.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,s,r,i,a){this.ctx.rect(s,r,i-s,a-r),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){let s=e[1],r=this.baseTransform||(0,i.getCurrentTransform)(this.ctx);t=new a.TilingPattern(e,s,this.ctx,{createCanvasGraphics:e=>new p(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})},r)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,s){this.ctx.strokeStyle=this.current.strokeColor=r.Util.makeHexColor(e,t,s),this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,t,s){this.ctx.fillStyle=this.current.fillColor=r.Util.makeHexColor(e,t,s),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e){let t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(e)?t=this.cachedPatterns.get(e):(t=(0,a.getShadingPattern)(this.getObject(e)),this.cachedPatterns.set(e,t)),s&&(t.matrix=s),t}shadingFill(e){if(!this.contentVisible)return;let t=this.ctx;this.save();let s=this._getPattern(e);t.fillStyle=s.getPattern(t,this,(0,i.getCurrentTransformInverse)(t),a.PathType.SHADING);let n=(0,i.getCurrentTransformInverse)(t);if(n){let{width:e,height:s}=t.canvas,[i,a,o,l]=r.Util.getAxialAlignedBoundingBox([0,0,e,s],n);this.ctx.fillRect(i,a,o-i,l-a)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,r.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,r.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=(0,i.getCurrentTransform)(this.ctx),t)){let e=t[2]-t[0],s=t[3]-t[1];this.ctx.rect(t[0],t[1],e,s),this.current.updateRectMinMax((0,i.getCurrentTransform)(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let t=this.ctx;e.isolated||(0,r.info)("TODO: Support non-isolated groups."),e.knockout&&(0,r.warn)("Knockout groups not supported.");let s=(0,i.getCurrentTransform)(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw Error("Bounding box is required.");let a=r.Util.getAxialAlignedBoundingBox(e.bbox,(0,i.getCurrentTransform)(t)),n=[0,0,t.canvas.width,t.canvas.height],o=Math.floor((a=r.Util.intersect(a,n)||[0,0,0,0])[0]),l=Math.floor(a[1]),h=Math.max(Math.ceil(a[2])-o,1),c=Math.max(Math.ceil(a[3])-l,1);this.current.startNewPathAndClipBox([0,0,h,c]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);let u=this.cachedCanvases.getCanvas(d,h,c),p=u.context;p.translate(-o,-l),p.transform(...s),e.smask?this.smaskStack.push({canvas:u.canvas,context:p,offsetX:o,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(o,l),t.save()),copyCtxState(t,p),this.ctx=p,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;let t=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();let e=(0,i.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);let s=r.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(e,t,s,a,n){if(this.#er(),resetCtxToDefault(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),t){let a=t[2]-t[0],o=t[3]-t[1];if(n&&this.annotationCanvasMap){s=s.slice(),s[4]-=t[0],s[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=a,t[3]=o;let[n,l]=r.Util.singularValueDecompose2dScale((0,i.getCurrentTransform)(this.ctx)),{viewportScale:h}=this,c=Math.ceil(a*this.outputScaleX*h),d=Math.ceil(o*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(c,d);let{canvas:u,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(n,0,0,-l,0,o*l),resetCtxToDefault(this.ctx)}else resetCtxToDefault(this.ctx),this.endPath(),this.ctx.rect(t[0],t[1],a,o),this.ctx.clip(),this.ctx.beginPath()}this.current=new l(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...a)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#ei(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;let t=e.count;(e=this.getObject(e.data,e)).count=t;let s=this.ctx,r=this.processingType3;if(r&&(void 0===r.compiled&&(r.compiled=compileType3Glyph(e)),r.compiled)){r.compiled(s);return}let i=this._createMaskCanvas(e),a=i.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(a,i.offsetX,i.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;e=this.getObject(e.data,e);let l=this.ctx;l.save();let h=(0,i.getCurrentTransform)(l);l.transform(t,s,a,n,0,0);let c=this._createMaskCanvas(e);l.setTransform(1,0,0,1,c.offsetX-h[4],c.offsetY-h[5]);for(let e=0,i=o.length;e<i;e+=2){let i=r.Util.transform(h,[t,s,a,n,o[e],o[e+1]]),[d,u]=r.Util.applyTransform([0,0],i);l.drawImage(c.canvas,d,u)}l.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;let t=this.ctx,s=this.current.fillColor,r=this.current.patternFill;for(let n of e){let{data:e,width:o,height:l,transform:h}=n,c=this.cachedCanvases.getCanvas("maskCanvas",o,l),d=c.context;d.save(),putBinaryImageMask(d,this.getObject(e,n)),d.globalCompositeOperation="source-in",d.fillStyle=r?s.getPattern(d,this,(0,i.getCurrentTransformInverse)(t),a.PathType.FILL):s,d.fillRect(0,0,o,l),d.restore(),t.save(),t.transform(...h),t.scale(1,-1),drawImageAtIntegerCoords(t,c.canvas,0,0,o,l,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;let t=this.getObject(e);if(!t){(0,r.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(e,t,s,i){if(!this.contentVisible)return;let a=this.getObject(e);if(!a){(0,r.warn)("Dependent image isn't ready yet");return}let n=a.width,o=a.height,l=[];for(let e=0,r=i.length;e<r;e+=2)l.push({transform:[t,0,0,s,i[e],i[e+1]],x:0,y:0,w:n,h:o});this.paintInlineImageXObjectGroup(a,l)}applyTransferMapsToCanvas(e){return"none"!==this.current.transferMaps&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return e.bitmap;let{bitmap:t,width:s,height:r}=e,i=this.cachedCanvases.getCanvas("inlineImage",s,r),a=i.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter="none",i.canvas}paintInlineImageXObject(e){let t;if(!this.contentVisible)return;let s=e.width,a=e.height,n=this.ctx;if(this.save(),!r.isNodeJS){let{filter:e}=n;"none"!==e&&""!==e&&(n.filter="none")}if(n.scale(1/s,-1/a),e.bitmap)t=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)t=e;else{let r=this.cachedCanvases.getCanvas("inlineImage",s,a).context;putBinaryImageData(r,e),t=this.applyTransferMapsToCanvas(r)}let o=this._scaleImage(t,(0,i.getCurrentTransformInverse)(n));n.imageSmoothingEnabled=getImageSmoothingEnabled((0,i.getCurrentTransform)(n),e.interpolate),drawImageAtIntegerCoords(n,o.img,0,0,o.paintWidth,o.paintHeight,0,-a,s,a),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){let s;if(!this.contentVisible)return;let r=this.ctx;if(e.bitmap)s=e.bitmap;else{let t=e.width,r=e.height,i=this.cachedCanvases.getCanvas("inlineImage",t,r).context;putBinaryImageData(i,e),s=this.applyTransferMapsToCanvas(i)}for(let e of t)r.save(),r.transform(...e.transform),r.scale(1,-1),drawImageAtIntegerCoords(r,s,e.x,e.y,e.w,e.h,0,-1,1,1),r.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){let t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);let s=this.ctx;this.pendingClip&&(t||(this.pendingClip===u?s.clip("evenodd"):s.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),s.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let e=(0,i.getCurrentTransform)(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{let t=Math.abs(e[0]*e[3]-e[2]*e[1]),s=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(s,r)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){let e,t;let{lineWidth:s}=this.current,{a:r,b:i,c:a,d:n}=this.ctx.getTransform();if(0===i&&0===a){let i=Math.abs(r),a=Math.abs(n);if(i===a){if(0===s)e=t=1/i;else{let r=i*s;e=t=r<1?1/r:1}}else if(0===s)e=1/i,t=1/a;else{let r=i*s,n=a*s;e=r<1?1/r:1,t=n<1?1/n:1}}else{let o=Math.abs(r*n-i*a),l=Math.hypot(r,i),h=Math.hypot(a,n);if(0===s)e=h/o,t=l/o;else{let r=s*o;e=h>r?h/r:1,t=l>r?l/r:1}}this._cachedScaleForStroking[0]=e,this._cachedScaleForStroking[1]=t}return this._cachedScaleForStroking}rescaleAndStroke(e){let{ctx:t}=this,{lineWidth:s}=this.current,[r,i]=this.getScaleForStroking();if(t.lineWidth=s||1,1===r&&1===i){t.stroke();return}let a=t.getLineDash();if(e&&t.save(),t.scale(r,i),a.length>0){let e=Math.max(r,i);t.setLineDash(a.map(t=>t/e)),t.lineDashOffset/=e}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(let e in r.OPS)void 0!==p.prototype[e]&&(p.prototype[r.OPS[e]]=p.prototype[e])},(e,t,s)=>{s.r(t),s.d(t,{PathType:()=>a,TilingPattern:()=>d,getShadingPattern:()=>getShadingPattern});var r=s(1),i=s(6);let a={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function applyBoundingBox(e,t){if(!t)return;let s=t[2]-t[0],r=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],s,r),e.clip(i)}class n{constructor(){}getPattern(){(0,r.unreachable)("Abstract method `getPattern` called.")}}class o extends n{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;for(let s of("axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1)),this._colorStops))t.addColorStop(s[0],s[1]);return t}getPattern(e,t,s,n){let o;if(n===a.STROKE||n===a.FILL){let a=t.current.getClippedPathBoundingBox(n,(0,i.getCurrentTransform)(e))||[0,0,0,0],l=Math.ceil(a[2]-a[0])||1,h=Math.ceil(a[3]-a[1])||1,c=t.cachedCanvases.getCanvas("pattern",l,h),d=c.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-a[0],-a[1]),s=r.Util.transform(s,[1,0,0,1,a[0],a[1]]),d.transform(...t.baseTransform),this.matrix&&d.transform(...this.matrix),applyBoundingBox(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),o=e.createPattern(c.canvas,"no-repeat");let u=new DOMMatrix(s);o.setTransform(u)}else applyBoundingBox(e,this._bbox),o=this._createGradient(e);return o}}function drawTriangle(e,t,s,r,i,a,n,o){let l,h,c,d,u,p,g,f,m;let A=t.coords,b=t.colors,y=e.data,_=4*e.width;A[s+1]>A[r+1]&&(l=s,s=r,r=l,l=a,a=n,n=l),A[r+1]>A[i+1]&&(l=r,r=i,i=l,l=n,n=o,o=l),A[s+1]>A[r+1]&&(l=s,s=r,r=l,l=a,a=n,n=l);let v=(A[s]+t.offsetX)*t.scaleX,C=(A[s+1]+t.offsetY)*t.scaleY,x=(A[r]+t.offsetX)*t.scaleX,S=(A[r+1]+t.offsetY)*t.scaleY,w=(A[i]+t.offsetX)*t.scaleX,T=(A[i+1]+t.offsetY)*t.scaleY;if(C>=T)return;let R=b[a],E=b[a+1],F=b[a+2],k=b[n],P=b[n+1],M=b[n+2],I=b[o],L=b[o+1],D=b[o+2],O=Math.round(C),B=Math.round(T);for(let e=O;e<=B;e++){let t;if(e<S){let t=e<C?0:(C-e)/(C-S);h=v-(v-x)*t,c=R-(R-k)*t,d=E-(E-P)*t,u=F-(F-M)*t}else{let t;h=x-(x-w)*(t=e>T?1:S===T?0:(S-e)/(S-T)),c=k-(k-I)*t,d=P-(P-L)*t,u=M-(M-D)*t}p=v-(v-w)*(t=e<C?0:e>T?1:(C-e)/(C-T)),g=R-(R-I)*t,f=E-(E-L)*t,m=F-(F-D)*t;let s=Math.round(Math.min(h,p)),r=Math.round(Math.max(h,p)),i=_*e+4*s;for(let e=s;e<=r;e++)(t=(h-e)/(h-p))<0?t=0:t>1&&(t=1),y[i++]=c-(c-g)*t|0,y[i++]=d-(d-f)*t|0,y[i++]=u-(u-m)*t|0,y[i++]=255}}function drawFigure(e,t,s){let r,i;let a=t.coords,n=t.colors;switch(t.type){case"lattice":let o=t.verticesPerRow,l=Math.floor(a.length/o)-1,h=o-1;for(r=0;r<l;r++){let t=r*o;for(let r=0;r<h;r++,t++)drawTriangle(e,s,a[t],a[t+1],a[t+o],n[t],n[t+1],n[t+o]),drawTriangle(e,s,a[t+o+1],a[t+1],a[t+o],n[t+o+1],n[t+1],n[t+o])}break;case"triangles":for(r=0,i=a.length;r<i;r+=3)drawTriangle(e,s,a[r],a[r+1],a[r+2],n[r],n[r+1],n[r+2]);break;default:throw Error("illegal figure")}}class l extends n{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,s){let r=Math.floor(this._bounds[0]),i=Math.floor(this._bounds[1]),a=Math.ceil(this._bounds[2])-r,n=Math.ceil(this._bounds[3])-i,o=Math.min(Math.ceil(Math.abs(a*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(n*e[1]*1.1)),3e3),h=a/o,c=n/l,d={coords:this._coords,colors:this._colors,offsetX:-r,offsetY:-i,scaleX:1/h,scaleY:1/c},u=o+4,p=l+4,g=s.getCanvas("mesh",u,p),f=g.context,m=f.createImageData(o,l);if(t){let e=m.data;for(let s=0,r=e.length;s<r;s+=4)e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=255}for(let e of this._figures)drawFigure(m,e,d);return f.putImageData(m,2,2),{canvas:g.canvas,offsetX:r-2*h,offsetY:i-2*c,scaleX:h,scaleY:c}}getPattern(e,t,s,n){let o;if(applyBoundingBox(e,this._bbox),n===a.SHADING)o=r.Util.singularValueDecompose2dScale((0,i.getCurrentTransform)(e));else if(o=r.Util.singularValueDecompose2dScale(t.baseTransform),this.matrix){let e=r.Util.singularValueDecompose2dScale(this.matrix);o=[o[0]*e[0],o[1]*e[1]]}let l=this._createMeshCanvas(o,n===a.SHADING?null:this._background,t.cachedCanvases);return n!==a.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(l.offsetX,l.offsetY),e.scale(l.scaleX,l.scaleY),e.createPattern(l.canvas,"no-repeat")}}class h extends n{getPattern(){return"hotpink"}}function getShadingPattern(e){switch(e[0]){case"RadialAxial":return new o(e);case"Mesh":return new l(e);case"Dummy":return new h}throw Error(`Unknown IR type: ${e[0]}`)}let c={COLORED:1,UNCOLORED:2};class d{static MAX_PATTERN_SIZE=3e3;constructor(e,t,s,r,i){this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=s,this.canvasGraphicsFactory=r,this.baseTransform=i}createPatternCanvas(e){let{bbox:t,operatorList:s,paintType:a,tilingType:n,color:o,canvasGraphicsFactory:l}=this,{xstep:h,ystep:c}=this;h=Math.abs(h),c=Math.abs(c),(0,r.info)("TilingType: "+n);let d=t[0],u=t[1],p=t[2],g=t[3],f=p-d,m=g-u,A=r.Util.singularValueDecompose2dScale(this.matrix),b=r.Util.singularValueDecompose2dScale(this.baseTransform),y=A[0]*b[0],_=A[1]*b[1],v=f,C=m,x=!1,S=!1,w=Math.ceil(c*_),T=Math.ceil(m*_);Math.ceil(h*y)>=Math.ceil(f*y)?v=h:x=!0,w>=T?C=c:S=!0;let R=this.getSizeAndScale(v,this.ctx.canvas.width,y),E=this.getSizeAndScale(C,this.ctx.canvas.height,_),F=e.cachedCanvases.getCanvas("pattern",R.size,E.size),k=F.context,P=l.createCanvasGraphics(k);if(P.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(P,a,o),k.translate(-R.scale*d,-E.scale*u),P.transform(R.scale,0,0,E.scale,0,0),k.save(),this.clipBbox(P,d,u,p,g),P.baseTransform=(0,i.getCurrentTransform)(P.ctx),P.executeOperatorList(s),P.endDrawing(),k.restore(),x||S){let t=F.canvas;x&&(v=h),S&&(C=c);let s=this.getSizeAndScale(v,this.ctx.canvas.width,y),r=this.getSizeAndScale(C,this.ctx.canvas.height,_),i=s.size,a=r.size,n=e.cachedCanvases.getCanvas("pattern-workaround",i,a),o=n.context,l=x?Math.floor(f/h):0,p=S?Math.floor(m/c):0;for(let e=0;e<=l;e++)for(let s=0;s<=p;s++)o.drawImage(t,i*e,a*s,i,a,0,0,i,a);return{canvas:n.canvas,scaleX:s.scale,scaleY:r.scale,offsetX:d,offsetY:u}}return{canvas:F.canvas,scaleX:R.scale,scaleY:E.scale,offsetX:d,offsetY:u}}getSizeAndScale(e,t,s){let r=Math.max(d.MAX_PATTERN_SIZE,t),i=Math.ceil(e*s);return i>=r?i=r:s=i/e,{scale:s,size:i}}clipBbox(e,t,s,r,a){let n=r-t,o=a-s;e.ctx.rect(t,s,n,o),e.current.updateRectMinMax((0,i.getCurrentTransform)(e.ctx),[t,s,r,a]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,s){let i=e.ctx,a=e.current;switch(t){case c.COLORED:let n=this.ctx;i.fillStyle=n.fillStyle,i.strokeStyle=n.strokeStyle,a.fillColor=n.fillStyle,a.strokeColor=n.strokeStyle;break;case c.UNCOLORED:let o=r.Util.makeHexColor(s[0],s[1],s[2]);i.fillStyle=o,i.strokeStyle=o,a.fillColor=o,a.strokeColor=o;break;default:throw new r.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,s,i){let n=s;i!==a.SHADING&&(n=r.Util.transform(n,t.baseTransform),this.matrix&&(n=r.Util.transform(n,this.matrix)));let o=this.createPatternCanvas(t),l=new DOMMatrix(n);l=(l=l.translate(o.offsetX,o.offsetY)).scale(1/o.scaleX,1/o.scaleY);let h=e.createPattern(o.canvas,"repeat");return h.setTransform(l),h}}},(e,t,s)=>{s.r(t),s.d(t,{convertBlackAndWhiteToRGBA:()=>convertBlackAndWhiteToRGBA,convertToRGBA:()=>convertToRGBA,grayToRGBA:()=>grayToRGBA});var r=s(1);function convertToRGBA(e){switch(e.kind){case r.ImageKind.GRAYSCALE_1BPP:return convertBlackAndWhiteToRGBA(e);case r.ImageKind.RGB_24BPP:return convertRGBToRGBA(e)}return null}function convertBlackAndWhiteToRGBA(e){let{src:t,srcPos:s=0,dest:i,width:a,height:n,nonBlackColor:o=4294967295,inverseDecode:l=!1}=e,h=r.FeatureTest.isLittleEndian?4278190080:255,[c,d]=l?[o,h]:[h,o],u=a>>3,p=7&a,g=t.length;i=new Uint32Array(i.buffer);let f=0;for(let e=0;e<n;e++){for(let e=s+u;s<e;s++){let e=s<g?t[s]:255;i[f++]=128&e?d:c,i[f++]=64&e?d:c,i[f++]=32&e?d:c,i[f++]=16&e?d:c,i[f++]=8&e?d:c,i[f++]=4&e?d:c,i[f++]=2&e?d:c,i[f++]=1&e?d:c}if(0===p)continue;let e=s<g?t[s++]:255;for(let t=0;t<p;t++)i[f++]=e&1<<7-t?d:c}return{srcPos:s,destPos:f}}function convertRGBToRGBA(e){let{src:t,srcPos:s=0,dest:i,destPos:a=0,width:n,height:o}=e,l=0,h=n*o*3,c=h>>2,d=new Uint32Array(t.buffer,s,c);if(r.FeatureTest.isLittleEndian){for(;l<c-2;l+=3,a+=4){let e=d[l],t=d[l+1],s=d[l+2];i[a]=4278190080|e,i[a+1]=e>>>24|t<<8|4278190080,i[a+2]=t>>>16|s<<16|4278190080,i[a+3]=s>>>8|4278190080}for(let e=4*l,r=s+h;e<r;e+=3)i[a++]=t[e]|t[e+1]<<8|t[e+2]<<16|4278190080}else{for(;l<c-2;l+=3,a+=4){let e=d[l],t=d[l+1],s=d[l+2];i[a]=255|e,i[a+1]=e<<24|t>>>8|255,i[a+2]=t<<16|s>>>16|255,i[a+3]=s<<8|255}for(let e=4*l,r=s+h;e<r;e+=3)i[a++]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|255}return{srcPos:s+h,destPos:a}}function grayToRGBA(e,t){if(r.FeatureTest.isLittleEndian)for(let s=0,r=e.length;s<r;s++)t[s]=65793*e[s]|4278190080;else for(let s=0,r=e.length;s<r;s++)t[s]=16843008*e[s]|255}},(e,t,s)=>{s.r(t),s.d(t,{GlobalWorkerOptions:()=>r});class r{static #en=null;static #eo="";static get workerPort(){return this.#en}static set workerPort(e){if(!("undefined"!=typeof Worker&&e instanceof Worker)&&null!==e)throw Error("Invalid `workerPort` type.");this.#en=e}static get workerSrc(){return this.#eo}static set workerSrc(e){if("string"!=typeof e)throw Error("Invalid `workerSrc` type.");this.#eo=e}}},(e,t,s)=>{s.r(t),s.d(t,{Metadata:()=>i});var r=s(1);class i{#el;#eh;constructor({parsedData:e,rawData:t}){this.#el=e,this.#eh=t}getRaw(){return this.#eh}get(e){return this.#el.get(e)??null}getAll(){return(0,r.objectFromMap)(this.#el)}has(e){return this.#el.has(e)}}},(e,t,s)=>{s.r(t),s.d(t,{OptionalContentConfig:()=>o});var r=s(1),i=s(4);let a=Symbol("INTERNAL");class n{#ec=!1;#ed=!1;#eu=!1;#ep=!0;constructor(e,{name:t,intent:s,usage:i,rbGroups:a}){this.#ec=!!(e&r.RenderingIntentFlag.DISPLAY),this.#ed=!!(e&r.RenderingIntentFlag.PRINT),this.name=t,this.intent=s,this.usage=i,this.rbGroups=a}get visible(){if(this.#eu)return this.#ep;if(!this.#ep)return!1;let{print:e,view:t}=this.usage;return this.#ec?t?.viewState!=="OFF":!this.#ed||e?.printState!=="OFF"}_setVisible(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e!==a&&(0,r.unreachable)("Internal method `_setVisible` called."),this.#eu=s,this.#ep=t}}class o{#eg=null;#ef=new Map;#em=null;#eA=null;constructor(e,t=r.RenderingIntentFlag.DISPLAY){if(this.renderingIntent=t,this.name=null,this.creator=null,null===e)return;for(let s of(this.name=e.name,this.creator=e.creator,this.#eA=e.order,e.groups))this.#ef.set(s.id,new n(t,s));if("OFF"===e.baseState)for(let e of this.#ef.values())e._setVisible(a,!1);for(let t of e.on)this.#ef.get(t)._setVisible(a,!0);for(let t of e.off)this.#ef.get(t)._setVisible(a,!1);this.#em=this.getHash()}#eb(e){let t=e.length;if(t<2)return!0;let s=e[0];for(let i=1;i<t;i++){let t;let a=e[i];if(Array.isArray(a))t=this.#eb(a);else{if(!this.#ef.has(a))return(0,r.warn)(`Optional content group not found: ${a}`),!0;t=this.#ef.get(a).visible}switch(s){case"And":if(!t)return!1;break;case"Or":if(t)return!0;break;case"Not":return!t;default:return!0}}return"And"===s}isVisible(e){if(0===this.#ef.size)return!0;if(!e)return(0,r.info)("Optional content group not defined."),!0;if("OCG"===e.type)return this.#ef.has(e.id)?this.#ef.get(e.id).visible:((0,r.warn)(`Optional content group not found: ${e.id}`),!0);if("OCMD"===e.type){if(e.expression)return this.#eb(e.expression);if(e.policy&&"AnyOn"!==e.policy){if("AllOn"===e.policy){for(let t of e.ids){if(!this.#ef.has(t)){(0,r.warn)(`Optional content group not found: ${t}`);break}if(!this.#ef.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(let t of e.ids){if(!this.#ef.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(!this.#ef.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(let t of e.ids){if(!this.#ef.has(t)){(0,r.warn)(`Optional content group not found: ${t}`);break}if(this.#ef.get(t).visible)return!1}return!0}}else{for(let t of e.ids){if(!this.#ef.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(this.#ef.get(t).visible)return!0}return!1}return(0,r.warn)(`Unknown optional content policy ${e.policy}.`),!0}return(0,r.warn)(`Unknown group type ${e.type}.`),!0}setVisibility(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],s=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=this.#ef.get(e);if(!i){(0,r.warn)(`Optional content group not found: ${e}`);return}if(s&&t&&i.rbGroups.length)for(let t of i.rbGroups)for(let s of t)s!==e&&this.#ef.get(s)?._setVisible(a,!1,!0);i._setVisible(a,!!t,!0),this.#eg=null}setOCGState(e){let t,{state:s,preserveRB:r}=e;for(let e of s){switch(e){case"ON":case"OFF":case"Toggle":t=e;continue}let s=this.#ef.get(e);if(s)switch(t){case"ON":this.setVisibility(e,!0,r);break;case"OFF":this.setVisibility(e,!1,r);break;case"Toggle":this.setVisibility(e,!s.visible,r)}}this.#eg=null}get hasInitialVisibility(){return null===this.#em||this.getHash()===this.#em}getOrder(){return this.#ef.size?this.#eA?this.#eA.slice():[...this.#ef.keys()]:null}getGroups(){return this.#ef.size>0?(0,r.objectFromMap)(this.#ef):null}getGroup(e){return this.#ef.get(e)||null}getHash(){if(null!==this.#eg)return this.#eg;let e=new i.MurmurHash3_64;for(let[t,s]of this.#ef)e.update(`${t}:${s.visible}`);return this.#eg=e.hexdigest()}}},(e,t,s)=>{s.r(t),s.d(t,{PDFDataTransportStream:()=>a});var r=s(1),i=s(6);class a{constructor(e,{disableRange:t=!1,disableStream:s=!1}){(0,r.assert)(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');let{length:i,initialData:a,progressiveDone:n,contentDispositionFilename:o}=e;if(this._queuedChunks=[],this._progressiveDone=n,this._contentDispositionFilename=o,a?.length>0){let e=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!s,this._isRangeSupported=!t,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((e,t)=>{this._onReceiveData({begin:e,chunk:t})}),e.addProgressListener((e,t)=>{this._onProgress({loaded:e,total:t})}),e.addProgressiveReadListener(e=>{this._onReceiveData({chunk:e})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData(e){let{begin:t,chunk:s}=e,i=s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer;if(void 0===t)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{let e=this._rangeReaders.some(function(e){return e._begin===t&&(e._enqueue(i),!0)});(0,r.assert)(e,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){let t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,r.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let e=this._queuedChunks;return this._queuedChunks=null,new n(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let s=new o(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(s),s}cancelAllRequests(e){for(let t of(this._fullRequestReader?.cancel(e),this._rangeReaders.slice(0)))t.cancel(e);this._pdfDataRangeTransport.abort()}}class n{constructor(e,t,s=!1,r=null){for(let a of(this._stream=e,this._done=s||!1,this._filename=(0,i.isPdfFile)(r)?r:null,this._queuedChunks=t||[],this._loaded=0,this._queuedChunks))this._loaded+=a.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):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};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){for(let e of(this._done=!0,this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class o{constructor(e,t,s){this._stream=e,this._begin=t,this._end=s,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{for(let t of(this._requests.shift().resolve({value:e,done:!1}),this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){for(let e of(this._done=!0,this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},(e,t,s)=>{s.r(t),s.d(t,{PDFFetchStream:()=>a});var r=s(1),i=s(21);function createFetchOptions(e,t,s){return{method:"GET",headers:e,signal:s.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function getArrayBuffer(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:((0,r.warn)(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class a{_responseOrigin=null;constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=(0,i.createHeaders)(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,r.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new n(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let s=new o(this,e,t);return this._rangeRequestReaders.push(s),s}cancelAllRequests(e){for(let t of(this._fullRequestReader?.cancel(e),this._rangeRequestReaders.slice(0)))t.cancel(e)}}class n{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;let t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=Promise.withResolvers(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange;let s=new Headers(e.headers),a=t.url;fetch(a,createFetchOptions(s,this._withCredentials,this._abortController)).then(t=>{if(e._responseOrigin=(0,i.getResponseOrigin)(t.url),!(0,i.validateResponseStatus)(t.status))throw(0,i.createResponseStatusError)(t.status,a);this._reader=t.body.getReader(),this._headersCapability.resolve();let s=t.headers,{allowRangeRequests:n,suggestedLength:o}=(0,i.validateRangeRequestCapabilities)({responseHeaders:s,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=o||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(s),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new r.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;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:getArrayBuffer(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class o{constructor(e,t,s){this._stream=e,this._reader=null,this._loaded=0;let r=e.source;this._withCredentials=r.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!r.disableStream,this._abortController=new AbortController;let a=new Headers(e.headers);a.append("Range",`bytes=${t}-${s-1}`);let n=r.url;fetch(n,createFetchOptions(a,this._withCredentials,this._abortController)).then(t=>{let s=(0,i.getResponseOrigin)(t.url);if(s!==e._responseOrigin)throw Error(`Expected range response-origin "${s}" to match "${e._responseOrigin}".`);if(!(0,i.validateResponseStatus)(t.status))throw(0,i.createResponseStatusError)(t.status,n);this._readCapability.resolve(),this._reader=t.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:getArrayBuffer(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}},(e,t,s)=>{s.r(t),s.d(t,{createHeaders:()=>createHeaders,createResponseStatusError:()=>createResponseStatusError,extractFilenameFromHeader:()=>extractFilenameFromHeader,getResponseOrigin:()=>getResponseOrigin,validateRangeRequestCapabilities:()=>validateRangeRequestCapabilities,validateResponseStatus:()=>validateResponseStatus});var r=s(1),i=s(22),a=s(6);function createHeaders(e,t){let s=new Headers;if(!e||!t||"object"!=typeof t)return s;for(let e in t){let r=t[e];void 0!==r&&s.append(e,r)}return s}function getResponseOrigin(e){try{return new URL(e).origin}catch{}return null}function validateRangeRequestCapabilities(e){let{responseHeaders:t,isHttp:s,rangeChunkSize:r,disableRange:i}=e,a={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(t.get("Content-Length"),10);return Number.isInteger(n)&&(a.suggestedLength=n,n<=2*r||i||!s||"bytes"!==t.get("Accept-Ranges")||"identity"!==(t.get("Content-Encoding")||"identity")||(a.allowRangeRequests=!0)),a}function extractFilenameFromHeader(e){let t=e.get("Content-Disposition");if(t){let e=(0,i.getFilenameFromContentDispositionHeader)(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if((0,a.isPdfFile)(e))return e}return null}function createResponseStatusError(e,t){return 404===e||0===e&&t.startsWith("file:")?new r.MissingPDFException('Missing PDF "'+t+'".'):new r.UnexpectedResponseException(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function validateResponseStatus(e){return 200===e||206===e}},(e,t,s)=>{s.r(t),s.d(t,{getFilenameFromContentDispositionHeader:()=>getFilenameFromContentDispositionHeader});var r=s(1);function getFilenameFromContentDispositionHeader(e){let t=!0,s=toParamRegExp("filename\\*","i").exec(e);if(s){let e=rfc2616unquote(s=s[1]);return fixupEncoding(e=rfc2047decode(e=rfc5987decode(e=unescape(e))))}if(s=rfc2231getparam(e))return fixupEncoding(rfc2047decode(s));if(s=toParamRegExp("filename","i").exec(e)){let e=rfc2616unquote(s=s[1]);return fixupEncoding(e=rfc2047decode(e))}function toParamRegExp(e,t){return RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function textdecode(e,s){if(e){if(!/^[\x00-\xFF]+$/.test(s))return s;try{let i=new TextDecoder(e,{fatal:!0}),a=(0,r.stringToBytes)(s);s=i.decode(a),t=!1}catch{}}return s}function fixupEncoding(e){return t&&/[\x80-\xff]/.test(e)&&(e=textdecode("utf-8",e),t&&(e=textdecode("iso-8859-1",e))),e}function rfc2231getparam(e){let t;let s=[],r=toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(t=r.exec(e));){let[,e,r,i]=t;if((e=parseInt(e,10))in s){if(0===e)break;continue}s[e]=[r,i]}let i=[];for(let e=0;e<s.length&&e in s;++e){let[t,r]=s[e];r=rfc2616unquote(r),t&&(r=unescape(r),0===e&&(r=rfc5987decode(r))),i.push(r)}return i.join("")}function rfc2616unquote(e){if(e.startsWith('"')){let t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){let s=t[e].indexOf('"');-1!==s&&(t[e]=t[e].slice(0,s),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,"$1")}e=t.join('"')}return e}function rfc5987decode(e){let t=e.indexOf("'");return -1===t?e:textdecode(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function rfc2047decode(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(e,t,s,r){if("q"===s||"Q"===s)return textdecode(t,r=(r=r.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))}));try{r=atob(r)}catch{}return textdecode(t,r)})}return""}},(e,t,s)=>{s.r(t),s.d(t,{PDFNetworkStream:()=>n});var r=s(1),i=s(21);function getArrayBuffer(e){let t=e.response;return"string"!=typeof t?t:(0,r.stringToBytes)(t).buffer}class a{_responseOrigin=null;constructor({url:e,httpHeaders:t,withCredentials:s}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=(0,i.createHeaders)(this.isHttp,t),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(e){let t=new XMLHttpRequest,s=this.currXhrId++,i=this.pendingRequests[s]={xhr:t};for(let[e,s]of(t.open("GET",this.url),t.withCredentials=this.withCredentials,this.headers))t.setRequestHeader(e,s);return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),i.expectedStatus=206):i.expectedStatus=200,t.responseType="arraybuffer",(0,r.assert)(e.onError,"Expected `onError` callback to be provided."),t.onerror=()=>{e.onError(t.status)},t.onreadystatechange=this.onStateChange.bind(this,s),t.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=e.onHeadersReceived,i.onDone=e.onDone,i.onError=e.onError,i.onProgress=e.onProgress,t.send(null),s}onProgress(e,t){let s=this.pendingRequests[e];s&&s.onProgress?.(t)}onStateChange(e,t){let s=this.pendingRequests[e];if(!s)return;let i=s.xhr;if(i.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),4!==i.readyState||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===i.status&&this.isHttp){s.onError(i.status);return}let a=i.status||200;if(!(200===a&&206===s.expectedStatus)&&a!==s.expectedStatus){s.onError(i.status);return}let n=getArrayBuffer(i);if(206===a){let e=i.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);t?s.onDone({begin:parseInt(t[1],10),chunk:n}):((0,r.warn)('Missing or invalid "Content-Range" header.'),s.onError(0))}else n?s.onDone({begin:0,chunk:n}):s.onError(i.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){let t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class n{constructor(e){this._source=e,this._manager=new a(e),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){let t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return(0,r.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new o(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){let s=new l(this._manager,e,t);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(e){for(let t of(this._fullRequestReader?.cancel(e),this._rangeRequestReaders.slice(0)))t.cancel(e)}}class o{constructor(e,t){this._manager=e,this._url=t.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),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(){let e=this._fullRequestId,t=this._manager.getRequestXhr(e);this._manager._responseOrigin=(0,i.getResponseOrigin)(t.responseURL);let s=t.getAllResponseHeaders(),r=new Headers(s?s.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(e=>{let[t,...s]=e.split(": ");return[t,s.join(": ")]}):[]),{allowRangeRequests:a,suggestedLength:n}=(0,i.validateRangeRequestCapabilities)({responseHeaders:r,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(r),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){for(let t of(this._storedError=(0,i.createResponseStatusError)(e,this._url),this._headersCapability.reject(this._storedError),this._requests))t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){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._headersCapability.promise}async read(){if(await this._headersCapability.promise,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};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){for(let t of(this._done=!0,this._headersCapability.reject(e),this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class l{constructor(e,t,s){this._manager=e,this._url=e.url,this._requestId=e.request({begin:t,end:s,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){let e=(0,i.getResponseOrigin)(this._manager.getRequestXhr(this._requestId)?.responseURL);e!==this._manager._responseOrigin&&(this._storedError=Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){this.onClosed?.(this)}_onDone(e){let t=e.chunk;for(let e of(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0,this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){for(let t of(this._storedError??=(0,i.createResponseStatusError)(e,this._url),this._requests))t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){for(let e of(this._done=!0,this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(e,t,s)=>{s.r(t),s.d(t,{TextLayer:()=>a});var r=s(1),i=s(6);class a{#ey=Promise.withResolvers();#e_=null;#ev=!1;#eC=!!globalThis.FontInspector?.enabled;#ex=null;#eS=null;#ew=0;#eT=0;#eR=null;#eE=null;#eF=0;#ek=0;#eP=Object.create(null);#eM=[];#eI=null;#eL=[];#eD=new WeakMap;#eO=null;static #eB=new Map;static #eN=new Map;static #eU=new WeakMap;static #ej=null;static #eV=new Set;constructor({textContentSource:e,container:t,viewport:s}){if(e instanceof ReadableStream)this.#eI=e;else if("object"==typeof e)this.#eI=new ReadableStream({start(t){t.enqueue(e),t.close()}});else throw Error('No "textContentSource" parameter specified.');this.#e_=this.#eE=t,this.#ek=s.scale*(globalThis.devicePixelRatio||1),this.#eF=s.rotation,this.#eS={div:null,properties:null,ctx:null};let{pageWidth:r,pageHeight:n,pageX:o,pageY:l}=s.rawDims;this.#eO=[1,0,0,-1,-o,l+n],this.#eT=r,this.#ew=n,a.#eH(),(0,i.setLayerDimensions)(t,s),this.#ey.promise.finally(()=>{a.#eV.delete(this),this.#eS=null,this.#eP=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:e,isFirefox:t}=r.FeatureTest.platform;return(0,r.shadow)(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){let pump=()=>{this.#eR.read().then(e=>{let{value:t,done:s}=e;if(s){this.#ey.resolve();return}this.#ex??=t.lang,Object.assign(this.#eP,t.styles),this.#eG(t.items),pump()},this.#ey.reject)};return this.#eR=this.#eI.getReader(),a.#eV.add(this),pump(),this.#ey.promise}update(e){let{viewport:t,onBefore:s=null}=e,r=t.scale*(globalThis.devicePixelRatio||1),n=t.rotation;if(n!==this.#eF&&(s?.(),this.#eF=n,(0,i.setLayerDimensions)(this.#eE,{rotation:n})),r!==this.#ek){s?.(),this.#ek=r;let e={div:null,properties:null,ctx:a.#eq(this.#ex)};for(let t of this.#eL)e.properties=this.#eD.get(t),e.div=t,this.#e$(e)}}cancel(){let e=new r.AbortException("TextLayer task cancelled.");this.#eR?.cancel(e).catch(()=>{}),this.#eR=null,this.#ey.reject(e)}get textDivs(){return this.#eL}get textContentItemsStr(){return this.#eM}#eG(e){if(this.#ev)return;this.#eS.ctx??=a.#eq(this.#ex);let t=this.#eL,s=this.#eM;for(let i of e){if(t.length>1e5){(0,r.warn)("Ignoring additional textDivs for performance reasons."),this.#ev=!0;return}if(void 0===i.str){if("beginMarkedContentProps"===i.type||"beginMarkedContent"===i.type){let e=this.#e_;this.#e_=document.createElement("span"),this.#e_.classList.add("markedContent"),null!==i.id&&this.#e_.setAttribute("id",`${i.id}`),e.append(this.#e_)}else"endMarkedContent"===i.type&&(this.#e_=this.#e_.parentNode);continue}s.push(i.str),this.#eW(i)}}#eW(e){let t,s;let i=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,fontSize:0};this.#eL.push(i);let o=r.Util.transform(this.#eO,e.transform),l=Math.atan2(o[1],o[0]),h=this.#eP[e.fontName];h.vertical&&(l+=Math.PI/2);let c=this.#eC&&h.fontSubstitution||h.fontFamily;c=a.fontFamilyMap.get(c)||c;let d=Math.hypot(o[2],o[3]),u=d*a.#ez(c,this.#ex);0===l?(t=o[4],s=o[5]-u):(t=o[4]+u*Math.sin(l),s=o[5]-u*Math.cos(l));let p="calc(var(--scale-factor)*",g=i.style;this.#e_===this.#eE?(g.left=`${(100*t/this.#eT).toFixed(2)}%`,g.top=`${(100*s/this.#ew).toFixed(2)}%`):(g.left=`${p}${t.toFixed(2)}px)`,g.top=`${p}${s.toFixed(2)}px)`),g.fontSize=`${p}${(a.#ej*d).toFixed(2)}px)`,g.fontFamily=c,n.fontSize=d,i.setAttribute("role","presentation"),i.textContent=e.str,i.dir=e.dir,this.#eC&&(i.dataset.fontName=h.fontSubstitutionLoadedName||e.fontName),0!==l&&(n.angle=180/Math.PI*l);let f=!1;if(e.str.length>1)f=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){let t=Math.abs(e.transform[0]),s=Math.abs(e.transform[3]);t!==s&&Math.max(t,s)/Math.min(t,s)>1.5&&(f=!0)}if(f&&(n.canvasWidth=h.vertical?e.height:e.width),this.#eD.set(i,n),this.#eS.div=i,this.#eS.properties=n,this.#e$(this.#eS),n.hasText&&this.#e_.append(i),n.hasEOL){let e=document.createElement("br");e.setAttribute("role","presentation"),this.#e_.append(e)}}#e$(e){let{div:t,properties:s,ctx:r}=e,{style:i}=t,n="";if(a.#ej>1&&(n=`scale(${1/a.#ej})`),0!==s.canvasWidth&&s.hasText){let{fontFamily:e}=i,{canvasWidth:o,fontSize:l}=s;a.#eX(r,l*this.#ek,e);let{width:h}=r.measureText(t.textContent);h>0&&(n=`scaleX(${o*this.#ek/h}) ${n}`)}0!==s.angle&&(n=`rotate(${s.angle}deg) ${n}`),n.length>0&&(i.transform=n)}static cleanup(){if(!(this.#eV.size>0)){for(let{canvas:e}of(this.#eB.clear(),this.#eN.values()))e.remove();this.#eN.clear()}}static #eq(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.#eN.get(e||="");if(!t){let s=document.createElement("canvas");s.className="hiddenCanvasElement",s.lang=e,document.body.append(s),t=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#eN.set(e,t),this.#eU.set(t,{size:0,family:""})}return t}static #eX(e,t,s){let r=this.#eU.get(e);(t!==r.size||s!==r.family)&&(e.font=`${t}px ${s}`,r.size=t,r.family=s)}static #eH(){if(null!==this.#ej)return;let e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#ej=e.getBoundingClientRect().height,e.remove()}static #ez(e,t){let s=this.#eB.get(e);if(s)return s;let r=this.#eq(t);r.canvas.width=r.canvas.height=30,this.#eX(r,30,e);let i=r.measureText(""),a=i.fontBoundingBoxAscent,n=Math.abs(i.fontBoundingBoxDescent);if(a){let t=a/(a+n);return this.#eB.set(e,t),r.canvas.width=r.canvas.height=0,t}r.strokeStyle="red",r.clearRect(0,0,30,30),r.strokeText("g",0,0);let o=r.getImageData(0,0,30,30).data;n=0;for(let e=o.length-1-3;e>=0;e-=4)if(o[e]>0){n=Math.ceil(e/4/30);break}r.clearRect(0,0,30,30),r.strokeText("A",0,30),o=r.getImageData(0,0,30,30).data,a=0;for(let e=0,t=o.length;e<t;e+=4)if(o[e]>0){a=30-Math.floor(e/4/30);break}r.canvas.width=r.canvas.height=0;let l=a?a/(a+n):.8;return this.#eB.set(e,l),l}}},(e,t,s)=>{s.r(t),s.d(t,{AnnotationLayer:()=>B,FreeTextAnnotationElement:()=>x,HighlightAnnotationElement:()=>P,InkAnnotationElement:()=>k,StampAnnotationElement:()=>D});var r=s(1),i=s(6),a=s(3),n=s(26),o=s(27),l=s(28);let h=new WeakSet;function getRectDims(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class c{static create(e){switch(e.data.annotationType){case r.AnnotationType.LINK:return new u(e);case r.AnnotationType.TEXT:return new p(e);case r.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new f(e);case"Btn":if(e.data.radioButton)return new b(e);if(e.data.checkBox)return new A(e);return new y(e);case"Ch":return new _(e);case"Sig":return new m(e)}return new g(e);case r.AnnotationType.POPUP:return new v(e);case r.AnnotationType.FREETEXT:return new x(e);case r.AnnotationType.LINE:return new S(e);case r.AnnotationType.SQUARE:return new w(e);case r.AnnotationType.CIRCLE:return new T(e);case r.AnnotationType.POLYLINE:return new R(e);case r.AnnotationType.CARET:return new F(e);case r.AnnotationType.INK:return new k(e);case r.AnnotationType.POLYGON:return new E(e);case r.AnnotationType.HIGHLIGHT:return new P(e);case r.AnnotationType.UNDERLINE:return new M(e);case r.AnnotationType.SQUIGGLY:return new I(e);case r.AnnotationType.STRIKEOUT:return new L(e);case r.AnnotationType.STAMP:return new D(e);case r.AnnotationType.FILEATTACHMENT:return new O(e);default:return new d(e)}}}class d{#eY=null;#eK=!1;#eQ=null;constructor(e,{isRenderable:t=!1,ignoreBorder:s=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(s)),r&&this._createQuadrilaterals()}static _hasPopupData(e){let{titleObj:t,contentsObj:s,richText:r}=e;return!!(t?.str||s?.str||r?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return d._hasPopupData(this.data)}updateEdited(e){if(!this.container)return;this.#eY||={rect:this.data.rect.slice(0)};let{rect:t}=e;t&&this.#eJ(t),this.#eQ?.popup.updateEdited(e)}resetEdited(){this.#eY&&(this.#eJ(this.#eY.rect),this.#eQ?.popup.resetEdited(),this.#eY=null)}#eJ(e){let{container:{style:t},data:{rect:s,rotation:r},parent:{viewport:{rawDims:{pageWidth:i,pageHeight:a,pageX:n,pageY:o}}}}=this;s?.splice(0,4,...e);let{width:l,height:h}=getRectDims(e);t.left=`${100*(e[0]-n)/i}%`,t.top=`${100*(a-e[3]+o)/a}%`,0===r?(t.width=`${100*l/i}%`,t.height=`${100*h/a}%`):this.setRotation(r)}_createContainer(e){let{data:t,parent:{page:s,viewport:i}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",t.id),this instanceof g||(a.tabIndex=1e3);let{style:n}=a;if(n.zIndex=this.parent.zIndex++,t.alternativeText&&(a.title=t.alternativeText),t.noRotate&&a.classList.add("norotate"),!t.rect||this instanceof v){let{rotation:e}=t;return t.hasOwnCanvas||0===e||this.setRotation(e,a),a}let{width:o,height:l}=getRectDims(t.rect);if(!e&&t.borderStyle.width>0){n.borderWidth=`${t.borderStyle.width}px`;let e=t.borderStyle.horizontalCornerRadius,s=t.borderStyle.verticalCornerRadius;if(e>0||s>0){let t=`calc(${e}px * var(--scale-factor)) / calc(${s}px * var(--scale-factor))`;n.borderRadius=t}else if(this instanceof b){let e=`calc(${o}px * var(--scale-factor)) / calc(${l}px * var(--scale-factor))`;n.borderRadius=e}switch(t.borderStyle.style){case r.AnnotationBorderStyleType.SOLID:n.borderStyle="solid";break;case r.AnnotationBorderStyleType.DASHED:n.borderStyle="dashed";break;case r.AnnotationBorderStyleType.BEVELED:(0,r.warn)("Unimplemented border style: beveled");break;case r.AnnotationBorderStyleType.INSET:(0,r.warn)("Unimplemented border style: inset");break;case r.AnnotationBorderStyleType.UNDERLINE:n.borderBottomStyle="solid"}let i=t.borderColor||null;i?(this.#eK=!0,n.borderColor=r.Util.makeHexColor(0|i[0],0|i[1],0|i[2])):n.borderWidth=0}let h=r.Util.normalizeRect([t.rect[0],s.view[3]-t.rect[1]+s.view[1],t.rect[2],s.view[3]-t.rect[3]+s.view[1]]),{pageWidth:c,pageHeight:d,pageX:u,pageY:p}=i.rawDims;n.left=`${100*(h[0]-u)/c}%`,n.top=`${100*(h[1]-p)/d}%`;let{rotation:f}=t;return t.hasOwnCanvas||0===f?(n.width=`${100*o/c}%`,n.height=`${100*l/d}%`):this.setRotation(f,a),a}setRotation(e){let t,s,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;let{pageWidth:i,pageHeight:a}=this.parent.viewport.rawDims,{width:n,height:o}=getRectDims(this.data.rect);e%180==0?(t=100*n/i,s=100*o/a):(t=100*o/i,s=100*n/a),r.style.width=`${t}%`,r.style.height=`${s}%`,r.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){let setColor=(e,t,s)=>{let r=s.detail[e],i=r[0],a=r.slice(1);s.target.style[t]=n.ColorConverters[`${i}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[t]:n.ColorConverters[`${i}_rgb`](a)})};return(0,r.shadow)(this,"_commonActions",{display:e=>{let{display:t}=e.detail,s=t%2==1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:1===t||2===t})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:t}=e.detail;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{setColor("bgColor","backgroundColor",e)},fillColor:e=>{setColor("fillColor","backgroundColor",e)},fgColor:e=>{setColor("fgColor","color",e)},textColor:e=>{setColor("textColor","color",e)},borderColor:e=>{setColor("borderColor","borderColor",e)},strokeColor:e=>{setColor("strokeColor","borderColor",e)},rotation:e=>{let t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){let s=this._commonActions;for(let r of Object.keys(t.detail)){let i=e[r]||s[r];i?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;let s=this._commonActions;for(let[r,i]of Object.entries(t)){let a=s[r];a&&(a({detail:{[r]:i},target:e}),delete t[r])}}_createQuadrilaterals(){let e;if(!this.container)return;let{quadPoints:t}=this.data;if(!t)return;let[s,r,i,a]=this.data.rect.map(e=>Math.fround(e));if(8===t.length){let[e,n,o,l]=t.subarray(2,6);if(i===e&&a===n&&s===o&&r===l)return}let{style:n}=this.container;if(this.#eK){let{borderColor:t,borderWidth:s}=n;n.borderWidth=0,e=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${t}" stroke-width="${s}">`],this.container.classList.add("hasBorder")}let o=i-s,l=a-r,{svgFactory:h}=this,c=h.createElement("svg");c.classList.add("quadrilateralsContainer"),c.setAttribute("width",0),c.setAttribute("height",0);let d=h.createElement("defs");c.append(d);let u=h.createElement("clipPath"),p=`clippath_${this.data.id}`;u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(let r=2,i=t.length;r<i;r+=8){let i=t[r],n=t[r+1],c=t[r+2],d=t[r+3],p=h.createElement("rect"),g=(c-s)/o,f=(a-n)/l,m=(i-c)/o,A=(n-d)/l;p.setAttribute("x",g),p.setAttribute("y",f),p.setAttribute("width",m),p.setAttribute("height",A),u.append(p),e?.push(`<rect vector-effect="non-scaling-stroke" x="${g}" y="${f}" width="${m}" height="${A}"/>`)}this.#eK&&(e.push("</g></svg>')"),n.backgroundImage=e.join("")),this.container.append(c),this.container.style.clipPath=`url(#${p})`}_createPopup(){let{data:e}=this,t=this.#eQ=new v({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]});this.parent.div.append(t.render())}render(){(0,r.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=[];if(this._fieldObjects){let i=this._fieldObjects[e];if(i)for(let{page:e,id:a,exportValues:n}of i){if(-1===e||a===t)continue;let i="string"==typeof n?n:null,o=document.querySelector(`[data-element-id="${a}"]`);if(o&&!h.has(o)){(0,r.warn)(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:i,domElement:o})}return s}for(let r of document.getElementsByName(e)){let{exportValue:e}=r,i=r.getAttribute("data-element-id");i!==t&&h.has(r)&&s.push({id:i,exportValue:e,domElement:r})}return s}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})})}}class u extends d{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:t}=this,s=document.createElement("a");s.setAttribute("data-element-id",e.id);let r=!1;return e.url?(t.addLinkAttributes(s,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(s,e.action),r=!0):e.attachment?(this.#eZ(s,e.attachment,e.attachmentDest),r=!0):e.setOCGState?(this.#e0(s,e.setOCGState),r=!0):e.dest?(this._bindLink(s,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,e),r=!0),e.resetForm?(this._bindResetFormAction(s,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(s,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&this.container.append(s),this.container}#e1(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&this.#e1()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#e1()}#eZ(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.href=this.linkService.getAnchorUrl(""),t.description&&(e.title=t.description),e.onclick=()=>(this.downloadManager?.openOrDownloadData(t.content,t.filename,s),!1),this.#e1()}#e0(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#e1()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");let s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let r of Object.keys(t.actions)){let i=s.get(r);i&&(e[i]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:r}}),!1))}e.onclick||(e.onclick=()=>!1),this.#e1()}_bindResetFormAction(e,t){let s=e.onclick;if(s||(e.href=this.linkService.getAnchorUrl("")),this.#e1(),!this._fieldObjects){(0,r.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(e.onclick=()=>!1);return}e.onclick=()=>{s?.();let{fields:e,refs:i,include:a}=t,n=[];if(0!==e.length||0!==i.length){let t=new Set(i);for(let s of e)for(let{id:e}of this._fieldObjects[s]||[])t.add(e);for(let e of Object.values(this._fieldObjects))for(let s of e)t.has(s.id)===a&&n.push(s)}else for(let e of Object.values(this._fieldObjects))n.push(...e);let o=this.annotationStorage,l=[];for(let e of n){let{id:t}=e;switch(l.push(t),e.type){case"text":{let s=e.defaultValue||"";o.setValue(t,{value:s});break}case"checkbox":case"radiobutton":{let s=e.defaultValue===e.exportValues;o.setValue(t,{value:s});break}case"combobox":case"listbox":{let s=e.defaultValue||"";o.setValue(t,{value:s});break}default:continue}let s=document.querySelector(`[data-element-id="${t}"]`);if(s){if(!h.has(s)){(0,r.warn)(`_bindResetFormAction - element not allowed: ${t}`);continue}s.dispatchEvent(new Event("resetform"))}}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}}),!1}}}class p extends d{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class g extends d{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&(e.previousSibling?.nodeName==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return r.FeatureTest.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,s,r,i){s.includes("mouse")?e.addEventListener(s,e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:i(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})}):e.addEventListener(s,e=>{if("blur"===s){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if("focus"===s){if(t.focused)return;t.focused=!0}i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:i(e)}})})}_setEventListeners(e,t,s,r){for(let[i,a]of s)("Action"===a||this.data.actions?.[a])&&(("Focus"===a||"Blur"===a)&&(t||={focused:!1}),this._setEventListener(e,t,i,a,r),"Focus"!==a||this.data.actions?.Blur?"Blur"!==a||this.data.actions?.Focus||this._setEventListener(e,t,"focus","Focus",null):this._setEventListener(e,t,"blur","Blur",null))}_setBackgroundColor(e){let t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":r.Util.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){let t;let{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,a=e.style,roundToOneDecimal=e=>Math.round(10*e)/10;if(this.data.multiLine){let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),s=Math.round(e/(r.LINE_FACTOR*i))||1;t=Math.min(i,roundToOneDecimal(e/s/r.LINE_FACTOR))}else t=Math.min(i,roundToOneDecimal(Math.abs(this.data.rect[3]-this.data.rect[1]-2)/r.LINE_FACTOR));a.fontSize=`calc(${t}px * var(--scale-factor))`,a.color=r.Util.makeHexColor(s[0],s[1],s[2]),null!==this.data.textAlignment&&(a.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class f extends g{constructor(e){super(e,{isRenderable:e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,s,r){let i=this.annotationStorage;for(let a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=s),i.setValue(a.id,{[r]:s})}render(){let e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){let r=e.getValue(t,{value:this.data.fieldValue}),i=r.value||"",a=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;a&&i.length>a&&(i=i.slice(0,a));let n=r.formattedValue||this.data.textContent?.join("\n")||null;n&&this.data.comb&&(n=n.replaceAll(/\s+/g,""));let o={userValue:i,formattedValue:n,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?((s=document.createElement("textarea")).textContent=n??i,this.data.doNotScroll&&(s.style.overflowY="hidden")):((s=document.createElement("input")).type="text",s.setAttribute("value",n??i),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),h.add(s),s.setAttribute("data-element-id",t),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=1e3,this._setRequired(s,this.data.required),a&&(s.maxLength=a),s.addEventListener("input",r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(s,"value",r.target.value,"value"),o.formattedValue=null}),s.addEventListener("resetform",e=>{let t=this.data.defaultFieldValue??"";s.value=o.userValue=t,o.formattedValue=null});let blurListener=e=>{let{formattedValue:t}=o;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",e=>{if(o.focused)return;let{target:t}=e;o.userValue&&(t.value=o.userValue),o.lastCommittedValue=t.value,o.commitKey=1,this.data.actions?.Focus||(o.focused=!0)}),s.addEventListener("updatefromsandbox",s=>{this.showElementAndHideCanvas(s.target),this._dispatchEventFromSandbox({value(s){o.userValue=s.detail.value??"",e.setValue(t,{value:o.userValue.toString()}),s.target.value=o.userValue},formattedValue(s){let{formattedValue:r}=s.detail;o.formattedValue=r,null!=r&&s.target!==document.activeElement&&(s.target.value=r),e.setValue(t,{formattedValue:r})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:s=>{let{charLimit:r}=s.detail,{target:i}=s;if(0===r){i.removeAttribute("maxLength");return}i.setAttribute("maxLength",r);let a=o.userValue;a&&!(a.length<=r)&&(a=a.slice(0,r),i.value=o.userValue=a,e.setValue(t,{value:a}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:a,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}},s)}),s.addEventListener("keydown",e=>{o.commitKey=1;let s=-1;if("Escape"===e.key?s=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(o.commitKey=3):s=2,-1===s)return;let{value:r}=e.target;o.lastCommittedValue!==r&&(o.lastCommittedValue=r,o.userValue=r,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:s,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))});let r=blurListener;blurListener=null,s.addEventListener("blur",e=>{if(!o.focused||!e.relatedTarget)return;this.data.actions?.Blur||(o.focused=!1);let{value:s}=e.target;o.userValue=s,o.lastCommittedValue!==s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,willCommit:!0,commitKey:o.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)}),this.data.actions?.Keystroke&&s.addEventListener("beforeinput",e=>{o.lastCommittedValue=null;let{data:s,target:r}=e,{value:i,selectionStart:a,selectionEnd:n}=r,l=a,h=n;switch(e.inputType){case"deleteWordBackward":{let e=i.substring(0,a).match(/\w*[^\w]*$/);e&&(l-=e[0].length);break}case"deleteWordForward":{let e=i.substring(a).match(/^[^\w]*\w*/);e&&(h+=e[0].length);break}case"deleteContentBackward":a===n&&(l-=1);break;case"deleteContentForward":a===n&&(h+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,change:s||"",willCommit:!1,selStart:l,selEnd:h}})}),this._setEventListeners(s,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],e=>e.target.value)}if(blurListener&&s.addEventListener("blur",blurListener),this.data.comb){let e=(this.data.rect[2]-this.data.rect[0])/a;s.classList.add("comb"),s.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else(s=document.createElement("div")).textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class m extends g{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class A extends g{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,t=this.data,s=t.id,r=e.getValue(s,{value:t.exportValue===t.fieldValue}).value;"string"==typeof r&&(r="Off"!==r,e.setValue(s,{value:r})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let i=document.createElement("input");return h.add(i),i.setAttribute("data-element-id",s),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=t.fieldName,r&&i.setAttribute("checked",!0),i.setAttribute("exportValue",t.exportValue),i.tabIndex=1e3,i.addEventListener("change",r=>{let{name:i,checked:a}=r.target;for(let r of this._getElementsByName(i,s)){let s=a&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=s),e.setValue(r.id,{value:s})}e.setValue(s,{value:a})}),i.addEventListener("resetform",e=>{let s=t.defaultFieldValue||"Off";e.target.checked=s===t.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({value(t){t.target.checked="Off"!==t.detail.value,e.setValue(s,{value:t.target.checked})}},t)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],e=>e.target.checked)),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class b extends g{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let e=this.annotationStorage,t=this.data,s=t.id,r=e.getValue(s,{value:t.fieldValue===t.buttonValue}).value;if("string"==typeof r&&(r=r!==t.buttonValue,e.setValue(s,{value:r})),r)for(let r of this._getElementsByName(t.fieldName,s))e.setValue(r.id,{value:!1});let i=document.createElement("input");if(h.add(i),i.setAttribute("data-element-id",s),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=t.fieldName,r&&i.setAttribute("checked",!0),i.tabIndex=1e3,i.addEventListener("change",t=>{let{name:r,checked:i}=t.target;for(let t of this._getElementsByName(r,s))e.setValue(t.id,{value:!1});e.setValue(s,{value:i})}),i.addEventListener("resetform",e=>{let s=t.defaultFieldValue;e.target.checked=null!=s&&s===t.buttonValue}),this.enableScripting&&this.hasJSActions){let r=t.buttonValue;i.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({value:t=>{let i=r===t.detail.value;for(let r of this._getElementsByName(t.target.name)){let t=i&&r.id===s;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}},t)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],e=>e.target.checked)}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class y extends u{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");let t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({},e)})),e}}class _ extends g{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let e=this.annotationStorage,t=this.data.id,s=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement("select");h.add(r),r.setAttribute("data-element-id",t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=1e3;let i=this.data.combo&&this.data.options.length>0;for(let e of(!this.data.combo&&(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener("resetform",e=>{let t=this.data.defaultFieldValue;for(let e of r.options)e.selected=e.value===t}),this.data.options)){let t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,s.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),i=!1),r.append(t)}let a=null;if(i){let e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),r.prepend(e),a=()=>{e.remove(),r.removeEventListener("input",a),a=null},r.addEventListener("input",a)}let getValue=e=>{let t=e?"value":"textContent",{options:s,multiple:i}=r;return i?Array.prototype.filter.call(s,e=>e.selected).map(e=>e[t]):-1===s.selectedIndex?null:s[s.selectedIndex][t]},n=getValue(!1),getItems=e=>{let t=e.target.options;return Array.prototype.map.call(t,e=>({displayValue:e.textContent,exportValue:e.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({value(s){a?.();let i=s.detail.value,o=new Set(Array.isArray(i)?i:[i]);for(let e of r.options)e.selected=o.has(e.value);e.setValue(t,{value:getValue(!0)}),n=getValue(!1)},multipleSelection(e){r.multiple=!0},remove(s){let i=r.options,a=s.detail.remove;i[a].selected=!1,r.remove(a),i.length>0&&-1===Array.prototype.findIndex.call(i,e=>e.selected)&&(i[0].selected=!0),e.setValue(t,{value:getValue(!0),items:getItems(s)}),n=getValue(!1)},clear(s){for(;0!==r.length;)r.remove(0);e.setValue(t,{value:null,items:[]}),n=getValue(!1)},insert(s){let{index:i,displayValue:a,exportValue:o}=s.detail.insert,l=r.children[i],h=document.createElement("option");h.textContent=a,h.value=o,l?l.before(h):r.append(h),e.setValue(t,{value:getValue(!0),items:getItems(s)}),n=getValue(!1)},items(s){let{items:i}=s.detail;for(;0!==r.length;)r.remove(0);for(let e of i){let{displayValue:t,exportValue:s}=e,i=document.createElement("option");i.textContent=t,i.value=s,r.append(i)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:getValue(!0),items:getItems(s)}),n=getValue(!1)},indices(s){let r=new Set(s.detail.indices);for(let e of s.target.options)e.selected=r.has(e.index);e.setValue(t,{value:getValue(!0)}),n=getValue(!1)},editable(e){e.target.disabled=!e.detail.editable}},s)}),r.addEventListener("input",s=>{let r=getValue(!0),i=getValue(!1);e.setValue(t,{value:r}),s.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,change:i,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],e=>e.target.value)):r.addEventListener("input",function(s){e.setValue(t,{value:getValue(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class v extends d{constructor(e){let{data:t,elements:s}=e;super(e,{isRenderable:d._hasPopupData(t)}),this.elements=s,this.popup=null}render(){this.container.classList.add("popupAnnotation");let e=this.popup=new C({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(let s of this.elements)s.popup=e,s.container.ariaHasPopup="dialog",t.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",t.map(e=>`${r.AnnotationPrefix}${e}`).join(",")),this.container}}class C{#e2=this.#e3.bind(this);#e5=this.#e4.bind(this);#e6=this.#e8.bind(this);#e9=this.#e7.bind(this);#te=null;#e_=null;#tt=null;#ts=null;#tr=null;#ti=null;#ta=null;#tn=!1;#to=null;#tl=null;#th=null;#tc=null;#td=null;#eY=null;#tu=!1;constructor({container:e,color:t,elements:s,titleObj:r,modificationDate:a,contentsObj:n,richText:o,parent:l,rect:h,parentRect:c,open:d}){for(let d of(this.#e_=e,this.#td=r,this.#tt=n,this.#tc=o,this.#ti=l,this.#te=t,this.#th=h,this.#ta=c,this.#tr=s,this.#ts=i.PDFDateString.toDateObject(a),this.trigger=s.flatMap(e=>e.getElementsToTriggerPopup()),this.trigger))d.addEventListener("click",this.#e9),d.addEventListener("mouseenter",this.#e6),d.addEventListener("mouseleave",this.#e5),d.classList.add("popupTriggerArea");for(let e of s)e.container?.addEventListener("keydown",this.#e2);this.#e_.hidden=!0,d&&this.#e7()}render(){if(this.#to)return;let e=this.#to=document.createElement("div");if(e.className="popup",this.#te){let t=e.style.outlineColor=r.Util.makeHexColor(...this.#te);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?e.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`:e.style.backgroundColor=r.Util.makeHexColor(...this.#te.map(e=>Math.floor(.7*(255-e)+e)))}let t=document.createElement("span");t.className="header";let s=document.createElement("h1");if(t.append(s),{dir:s.dir,str:s.textContent}=this.#td,e.append(t),this.#ts){let e=document.createElement("span");e.classList.add("popupDate"),e.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),e.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#ts.valueOf()})),t.append(e)}let i=this.#tp;if(i)l.XfaLayer.render({xfaHtml:i,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{let t=this._formatContents(this.#tt);e.append(t)}this.#e_.append(e)}get #tp(){let e=this.#tc,t=this.#tt;return e?.str&&(!t?.str||t.str===e.str)&&this.#tc.html||null}get #tg(){return this.#tp?.attributes?.style?.fontSize||0}get #tf(){return this.#tp?.attributes?.style?.color||null}#tm(e){let t=[],s={style:{color:this.#tf,fontSize:this.#tg?`calc(${this.#tg}px * var(--scale-factor))`:""}};for(let r of e.split("\n"))t.push({name:"span",value:r,attributes:s});return{str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}}}_formatContents(e){let{str:t,dir:s}=e,r=document.createElement("p");r.classList.add("popupContent"),r.dir=s;let i=t.split(/(?:\r\n?|\n)/);for(let e=0,t=i.length;e<t;++e){let s=i[e];r.append(document.createTextNode(s)),e<t-1&&r.append(document.createElement("br"))}return r}#e3(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||"Enter"!==e.key&&("Escape"!==e.key||!this.#tn)||this.#e7()}updateEdited(e){let{rect:t,popupContent:s}=e;this.#eY||={contentsObj:this.#tt,richText:this.#tc},t&&(this.#tl=null),s&&(this.#tc=this.#tm(s),this.#tt=null),this.#to?.remove(),this.#to=null}resetEdited(){this.#eY&&({contentsObj:this.#tt,richText:this.#tc}=this.#eY,this.#eY=null,this.#to?.remove(),this.#to=null,this.#tl=null)}#tA(){if(null!==this.#tl)return;let{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:s,pageX:i,pageY:a}}}=this.#ti,n=!!this.#ta,o=n?this.#ta:this.#th;for(let e of this.#tr)if(!o||null!==r.Util.intersect(e.data.rect,o)){o=e.data.rect,n=!0;break}let l=r.Util.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),h=n?o[2]-o[0]+5:0,c=l[0]+h,d=l[1];this.#tl=[100*(c-i)/t,100*(d-a)/s];let{style:u}=this.#e_;u.left=`${this.#tl[0]}%`,u.top=`${this.#tl[1]}%`}#e7(){this.#tn=!this.#tn,this.#tn?(this.#e8(),this.#e_.addEventListener("click",this.#e9),this.#e_.addEventListener("keydown",this.#e2)):(this.#e4(),this.#e_.removeEventListener("click",this.#e9),this.#e_.removeEventListener("keydown",this.#e2))}#e8(){this.#to||this.render(),this.isVisible?this.#tn&&this.#e_.classList.add("focused"):(this.#tA(),this.#e_.hidden=!1,this.#e_.style.zIndex=parseInt(this.#e_.style.zIndex)+1e3)}#e4(){this.#e_.classList.remove("focused"),!this.#tn&&this.isVisible&&(this.#e_.hidden=!0,this.#e_.style.zIndex=parseInt(this.#e_.style.zIndex)-1e3)}forceHide(){this.#tu=this.isVisible,this.#tu&&(this.#e_.hidden=!0)}maybeShow(){this.#tu&&(this.#to||this.#e8(),this.#tu=!1,this.#e_.hidden=!1)}get isVisible(){return!1===this.#e_.hidden}}class x extends d{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=r.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let e=document.createElement("div");for(let t of(e.classList.add("annotationTextContent"),e.setAttribute("role","comment"),this.textContent)){let s=document.createElement("span");s.textContent=t,e.append(s)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class S extends d{#tb=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let e=this.data,{width:t,height:s}=getRectDims(e.rect),r=this.svgFactory.create(t,s,!0),i=this.#tb=this.svgFactory.createElement("svg:line");return i.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),i.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),i.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),i.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),i.setAttribute("stroke-width",e.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),r.append(i),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#tb}addHighlightArea(){this.container.classList.add("highlightArea")}}class w extends d{#ty=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let e=this.data,{width:t,height:s}=getRectDims(e.rect),r=this.svgFactory.create(t,s,!0),i=e.borderStyle.width,a=this.#ty=this.svgFactory.createElement("svg:rect");return a.setAttribute("x",i/2),a.setAttribute("y",i/2),a.setAttribute("width",t-i),a.setAttribute("height",s-i),a.setAttribute("stroke-width",i||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#ty}addHighlightArea(){this.container.classList.add("highlightArea")}}class T extends d{#t_=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let e=this.data,{width:t,height:s}=getRectDims(e.rect),r=this.svgFactory.create(t,s,!0),i=e.borderStyle.width,a=this.#t_=this.svgFactory.createElement("svg:ellipse");return a.setAttribute("cx",t/2),a.setAttribute("cy",s/2),a.setAttribute("rx",t/2-i/2),a.setAttribute("ry",s/2-i/2),a.setAttribute("stroke-width",i||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t_}addHighlightArea(){this.container.classList.add("highlightArea")}}class R extends d{#tv=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:t,borderStyle:s,popupRef:r}}=this;if(!t)return this.container;let{width:i,height:a}=getRectDims(e),n=this.svgFactory.create(i,a,!0),o=[];for(let s=0,r=t.length;s<r;s+=2){let r=t[s]-e[0],i=e[3]-t[s+1];o.push(`${r},${i}`)}o=o.join(" ");let l=this.#tv=this.svgFactory.createElement(this.svgElementName);return l.setAttribute("points",o),l.setAttribute("stroke-width",s.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),n.append(l),this.container.append(n),!r&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#tv}addHighlightArea(){this.container.classList.add("highlightArea")}}class E extends R{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class F extends d{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class k extends d{#tC=null;#tx=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?r.AnnotationEditorType.HIGHLIGHT:r.AnnotationEditorType.INK}#tS(e,t){switch(e){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:t,inkLists:s,borderStyle:r,popupRef:i}}=this,{transform:a,width:n,height:o}=this.#tS(t,e),l=this.svgFactory.create(n,o,!0),h=this.#tC=this.svgFactory.createElement("svg:g");l.append(h),h.setAttribute("stroke-width",r.width||1),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round"),h.setAttribute("stroke-miterlimit",10),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),h.setAttribute("transform",a);for(let e=0,t=s.length;e<t;e++){let t=this.svgFactory.createElement(this.svgElementName);this.#tx.push(t),t.setAttribute("points",s[e].join(",")),h.append(t)}return!i&&this.hasPopupData&&this._createPopup(),this.container.append(l),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:t,points:s,rect:r}=e,i=this.#tC;if(t>=0&&i.setAttribute("stroke-width",t||1),s)for(let e=0,t=this.#tx.length;e<t;e++)this.#tx[e].setAttribute("points",s[e].join(","));if(r){let{transform:e,width:t,height:s}=this.#tS(this.data.rotation,r);i.parentElement.setAttribute("viewBox",`0 0 ${t} ${s}`),i.setAttribute("transform",e)}}getElementsToTriggerPopup(){return this.#tx}addHighlightArea(){this.container.classList.add("highlightArea")}}class P extends d{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=r.AnnotationEditorType.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class M extends d{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class I extends d{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class L extends d{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class D extends d{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=r.AnnotationEditorType.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class O extends d{#tw=null;constructor(e){super(e,{isRenderable:!0});let{file:t}=this.data;this.filename=t.filename,this.content=t.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...t})}render(){let e;this.container.classList.add("fileAttachmentAnnotation");let{container:t,data:s}=this;s.hasAppearance||0===s.fillAlpha?e=document.createElement("div"):((e=document.createElement("img")).src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(s.name)?"paperclip":"pushpin"}.svg`,s.fillAlpha&&s.fillAlpha<1&&(e.style=`filter: opacity(${Math.round(100*s.fillAlpha)}%);`)),e.addEventListener("dblclick",this.#tT.bind(this)),this.#tw=e;let{isMac:i}=r.FeatureTest.platform;return t.addEventListener("keydown",e=>{"Enter"===e.key&&(i?e.metaKey:e.ctrlKey)&&this.#tT()}),!s.popupRef&&this.hasPopupData?this._createPopup():e.classList.add("popupTriggerArea"),t.append(e),t}getElementsToTriggerPopup(){return this.#tw}addHighlightArea(){this.container.classList.add("highlightArea")}#tT(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class B{#tR=null;#tE=null;#tF=new Map;#tk=null;constructor({div:e,accessibilityManager:t,annotationCanvasMap:s,annotationEditorUIManager:r,page:i,viewport:a,structTreeLayer:n}){this.div=e,this.#tR=t,this.#tE=s,this.#tk=n||null,this.page=i,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=r}hasEditableAnnotations(){return this.#tF.size>0}async #tP(e,t){let s=e.firstChild||e,i=s.id=`${r.AnnotationPrefix}${t}`,a=await this.#tk?.getAriaAttributes(i);if(a)for(let[e,t]of a)s.setAttribute(e,t);this.div.append(e),this.#tR?.moveElementInDOM(this.div,e,s,!1)}async render(e){let{annotations:t}=e,s=this.div;(0,i.setLayerDimensions)(s,this.viewport);let n=new Map,l={data:null,layer:s,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new o.DOMSVGFactory,annotationStorage:e.annotationStorage||new a.AnnotationStorage,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let e of t){if(e.noHTML)continue;let t=e.annotationType===r.AnnotationType.POPUP;if(t){let t=n.get(e.id);if(!t)continue;l.elements=t}else{let{width:t,height:s}=getRectDims(e.rect);if(t<=0||s<=0)continue}l.data=e;let s=c.create(l);if(!s.isRenderable)continue;if(!t&&e.popupRef){let t=n.get(e.popupRef);t?t.push(s):n.set(e.popupRef,[s])}let i=s.render();e.hidden&&(i.style.visibility="hidden"),await this.#tP(i,e.id),s._isEditable&&(this.#tF.set(s.data.id,s),this._annotationEditorUIManager?.renderAnnotationElement(s))}this.#tM()}update(e){let{viewport:t}=e,s=this.div;this.viewport=t,(0,i.setLayerDimensions)(s,{rotation:t.rotation}),this.#tM(),s.hidden=!1}#tM(){if(!this.#tE)return;let e=this.div;for(let[t,s]of this.#tE){let r=e.querySelector(`[data-annotation-id="${t}"]`);if(!r)continue;s.className="annotationContent";let{firstChild:i}=r;i?"CANVAS"===i.nodeName?i.replaceWith(s):i.classList.contains("annotationContent")?i.after(s):i.before(s):r.append(s)}this.#tE.clear()}getEditableAnnotations(){return Array.from(this.#tF.values())}getEditableAnnotation(e){return this.#tF.get(e)}}},(e,t,s)=>{function makeColorComp(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}function scaleAndClamp(e){return Math.max(0,Math.min(255,255*e))}s.r(t),s.d(t,{ColorConverters:()=>r});class r{static CMYK_G(e){let[t,s,r,i]=e;return["G",1-Math.min(1,.3*t+.59*r+.11*s+i)]}static G_CMYK(e){let[t]=e;return["CMYK",0,0,0,1-t]}static G_RGB(e){let[t]=e;return["RGB",t,t,t]}static G_rgb(e){let[t]=e;return[t=scaleAndClamp(t),t,t]}static G_HTML(e){let[t]=e,s=makeColorComp(t);return`#${s}${s}${s}`}static RGB_G(e){let[t,s,r]=e;return["G",.3*t+.59*s+.11*r]}static RGB_rgb(e){return e.map(scaleAndClamp)}static RGB_HTML(e){return`#${e.map(makeColorComp).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(e){let[t,s,r,i]=e;return["RGB",1-Math.min(1,t+i),1-Math.min(1,r+i),1-Math.min(1,s+i)]}static CMYK_rgb(e){let[t,s,r,i]=e;return[scaleAndClamp(1-Math.min(1,t+i)),scaleAndClamp(1-Math.min(1,r+i)),scaleAndClamp(1-Math.min(1,s+i))]}static CMYK_HTML(e){let t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK(e){let[t,s,r]=e,i=1-t,a=1-s,n=1-r,o=Math.min(i,a,n);return["CMYK",i,a,n,o]}}},(e,t,s)=>{s.r(t),s.d(t,{BaseSVGFactory:()=>a,DOMSVGFactory:()=>n});var r=s(6),i=s(1);class a{constructor(){}create(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e<=0||t<=0)throw Error("Invalid SVG dimensions");let r=this._createSVG("svg:svg");return r.setAttribute("version","1.1"),s||(r.setAttribute("width",`${e}px`),r.setAttribute("height",`${t}px`)),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e} ${t}`),r}createElement(e){if("string"!=typeof e)throw Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){(0,i.unreachable)("Abstract method `_createSVG` called.")}}class n extends a{_createSVG(e){return document.createElementNS(r.SVG_NS,e)}}},(e,t,s)=>{s.r(t),s.d(t,{XfaLayer:()=>i});var r=s(29);class i{static setupStorage(e,t,s,r,i){let a=r.getValue(t,{value:null});switch(s.name){case"textarea":if(null!==a.value&&(e.textContent=a.value),"print"===i)break;e.addEventListener("input",e=>{r.setValue(t,{value:e.target.value})});break;case"input":if("radio"===s.attributes.type||"checkbox"===s.attributes.type){if(a.value===s.attributes.xfaOn?e.setAttribute("checked",!0):a.value===s.attributes.xfaOff&&e.removeAttribute("checked"),"print"===i)break;e.addEventListener("change",e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})})}else{if(null!==a.value&&e.setAttribute("value",a.value),"print"===i)break;e.addEventListener("input",e=>{r.setValue(t,{value:e.target.value})})}break;case"select":if(null!==a.value)for(let t of(e.setAttribute("value",a.value),s.children))t.attributes.value===a.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected;e.addEventListener("input",e=>{let s=e.target.options,i=-1===s.selectedIndex?"":s[s.selectedIndex].value;r.setValue(t,{value:i})})}}static setAttributes(e){let{html:t,element:s,storage:r=null,intent:i,linkService:a}=e,{attributes:n}=s,o=t instanceof HTMLAnchorElement;for(let[e,s]of("radio"===n.type&&(n.name=`${n.name}-${i}`),Object.entries(n)))if(null!=s)switch(e){case"class":s.length&&t.setAttribute(e,s.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",s);break;case"style":Object.assign(t.style,s);break;case"textContent":t.textContent=s;break;default:o&&("href"===e||"newWindow"===e)||t.setAttribute(e,s)}o&&a.addLinkAttributes(t,n.href,n.newWindow),r&&n.dataId&&this.setupStorage(t,n.dataId,s,r)}static render(e){let t=e.annotationStorage,s=e.linkService,i=e.xfaHtml,a=e.intent||"display",n=document.createElement(i.name);i.attributes&&this.setAttributes({html:n,element:i,intent:a,linkService:s});let o="richText"!==a,l=e.div;if(l.append(n),e.viewport){let t=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=t}o&&l.setAttribute("class","xfaLayer xfaFont");let h=[];if(0===i.children.length){if(i.value){let e=document.createTextNode(i.value);n.append(e),o&&r.XfaText.shouldBuildText(i.name)&&h.push(e)}return{textDivs:h}}let c=[[i,-1,n]];for(;c.length>0;){let[e,i,n]=c.at(-1);if(i+1===e.children.length){c.pop();continue}let l=e.children[++c.at(-1)[1]];if(null===l)continue;let{name:d}=l;if("#text"===d){let e=document.createTextNode(l.value);h.push(e),n.append(e);continue}let u=l?.attributes?.xmlns?document.createElementNS(l.attributes.xmlns,d):document.createElement(d);if(n.append(u),l.attributes&&this.setAttributes({html:u,element:l,storage:t,intent:a,linkService:s}),l.children?.length>0)c.push([l,-1,u]);else if(l.value){let e=document.createTextNode(l.value);o&&r.XfaText.shouldBuildText(d)&&h.push(e),u.append(e)}}for(let e of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:h}}static update(e){let t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}},(e,t,s)=>{s.r(t),s.d(t,{XfaText:()=>r});class r{static textContent(e){let t=[],s={items:t,styles:Object.create(null)};function walk(e){if(!e)return;let s=null,i=e.name;if("#text"===i)s=e.value;else{if(!r.shouldBuildText(i))return;e?.attributes?.textContent?s=e.attributes.textContent:e.value&&(s=e.value)}if(null!==s&&t.push({str:s}),e.children)for(let t of e.children)walk(t)}return walk(e),s}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}},(e,t,s)=>{s.r(t),s.d(t,{DrawLayer:()=>a});var r=s(27),i=s(1);class a{#ti=null;#q=0;#tI=new Map;#tL=new Map;constructor({pageIndex:e}){this.pageIndex=e}setParent(e){if(!this.#ti){this.#ti=e;return}if(this.#ti!==e){if(this.#tI.size>0)for(let t of this.#tI.values())t.remove(),e.append(t);this.#ti=e}}static get _svgFactory(){return(0,i.shadow)(this,"_svgFactory",new r.DOMSVGFactory)}static #tD(e,t){let[s,r,i,a]=t,{style:n}=e;n.top=`${100*r}%`,n.left=`${100*s}%`,n.width=`${100*i}%`,n.height=`${100*a}%`}#tO(){let e=a._svgFactory.create(1,1,!0);return this.#ti.append(e),e.setAttribute("aria-hidden",!0),e}#tB(e,t){let s=a._svgFactory.createElement("clipPath");e.append(s);let r=`clip_${t}`;s.setAttribute("id",r),s.setAttribute("clipPathUnits","objectBoundingBox");let i=a._svgFactory.createElement("use");return s.append(i),i.setAttribute("href",`#${t}`),i.classList.add("clip"),r}#tN(e,t){for(let[s,r]of Object.entries(t))null===r?e.removeAttribute(s):e.setAttribute(s,r)}draw(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.#q++,i=this.#tO(),n=a._svgFactory.createElement("defs");i.append(n);let o=a._svgFactory.createElement("path");n.append(o);let l=`path_p${this.pageIndex}_${r}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),t&&this.#tL.set(r,o);let h=s?this.#tB(n,l):null,c=a._svgFactory.createElement("use");return i.append(c),c.setAttribute("href",`#${l}`),this.updateProperties(i,e),this.#tI.set(r,i),{id:r,clipPathId:`url(#${h})`}}drawOutline(e,t){let s;let r=this.#q++,i=this.#tO(),n=a._svgFactory.createElement("defs");i.append(n);let o=a._svgFactory.createElement("path");n.append(o);let l=`path_p${this.pageIndex}_${r}`;if(o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),t){let e=a._svgFactory.createElement("mask");n.append(e),s=`mask_p${this.pageIndex}_${r}`,e.setAttribute("id",s),e.setAttribute("maskUnits","objectBoundingBox");let t=a._svgFactory.createElement("rect");e.append(t),t.setAttribute("width","1"),t.setAttribute("height","1"),t.setAttribute("fill","white");let i=a._svgFactory.createElement("use");e.append(i),i.setAttribute("href",`#${l}`),i.setAttribute("stroke","none"),i.setAttribute("fill","black"),i.setAttribute("fill-rule","nonzero"),i.classList.add("mask")}let h=a._svgFactory.createElement("use");i.append(h),h.setAttribute("href",`#${l}`),s&&h.setAttribute("mask",`url(#${s})`);let c=h.cloneNode();return i.append(c),h.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(i,e),this.#tI.set(r,i),r}finalizeDraw(e,t){this.#tL.delete(e),this.updateProperties(e,t)}updateProperties(e,t){if(!t)return;let{root:s,bbox:r,rootClass:i,path:n}=t,o="number"==typeof e?this.#tI.get(e):e;if(o){if(s&&this.#tN(o,s),r&&a.#tD(o,r),i){let{classList:e}=o;for(let[t,s]of Object.entries(i))e.toggle(t,s)}if(n){let e=o.firstChild.firstChild;this.#tN(e,n)}}}updateParent(e,t){if(t===this)return;let s=this.#tI.get(e);s&&(t.#ti.append(s),this.#tI.delete(e),t.#tI.set(e,s))}remove(e){this.#tL.delete(e),null!==this.#ti&&(this.#tI.get(e).remove(),this.#tI.delete(e))}destroy(){for(let e of(this.#ti=null,this.#tI.values()))e.remove();this.#tI.clear(),this.#tL.clear()}}}],t={};function __w_pdfjs_require__(s){var r=t[s];if(void 0!==r)return r.exports;var i=t[s]={exports:{}};return e[s](i,i.exports,__w_pdfjs_require__),i.exports}__w_pdfjs_require__.d=(e,t)=>{for(var s in t)__w_pdfjs_require__.o(t,s)&&!__w_pdfjs_require__.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},__w_pdfjs_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__w_pdfjs_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{__w_pdfjs_require__.r(s),__w_pdfjs_require__.d(s,{AbortException:()=>e.AbortException,AnnotationLayer:()=>i.AnnotationLayer,AnnotationMode:()=>e.AnnotationMode,DOMSVGFactory:()=>a.DOMSVGFactory,DrawLayer:()=>n.DrawLayer,FeatureTest:()=>e.FeatureTest,GlobalWorkerOptions:()=>o.GlobalWorkerOptions,ImageKind:()=>e.ImageKind,InvalidPDFException:()=>e.InvalidPDFException,MissingPDFException:()=>e.MissingPDFException,OPS:()=>e.OPS,OutputScale:()=>r.OutputScale,PDFDataRangeTransport:()=>t.PDFDataRangeTransport,PDFDateString:()=>r.PDFDateString,PDFWorker:()=>t.PDFWorker,PasswordResponses:()=>e.PasswordResponses,PermissionFlag:()=>e.PermissionFlag,PixelsPerInch:()=>r.PixelsPerInch,RenderingCancelledException:()=>r.RenderingCancelledException,TextLayer:()=>l.TextLayer,UnexpectedResponseException:()=>e.UnexpectedResponseException,Util:()=>e.Util,VerbosityLevel:()=>e.VerbosityLevel,build:()=>t.build,createValidAbsoluteUrl:()=>e.createValidAbsoluteUrl,fetchData:()=>r.fetchData,getDocument:()=>t.getDocument,getFilenameFromUrl:()=>r.getFilenameFromUrl,getPdfFilenameFromUrl:()=>r.getPdfFilenameFromUrl,getXfaPageViewport:()=>r.getXfaPageViewport,isDataScheme:()=>r.isDataScheme,isPdfFile:()=>r.isPdfFile,noContextMenu:()=>r.noContextMenu,normalizeUnicode:()=>e.normalizeUnicode,setLayerDimensions:()=>r.setLayerDimensions,shadow:()=>e.shadow,stopEvent:()=>r.stopEvent,version:()=>t.version});var e=__w_pdfjs_require__(1),t=__w_pdfjs_require__(2),r=__w_pdfjs_require__(6),i=__w_pdfjs_require__(25),a=__w_pdfjs_require__(27),n=__w_pdfjs_require__(30),o=__w_pdfjs_require__(16),l=__w_pdfjs_require__(24)})(),s})());
Save File
Cancel