| 12345678 |
- var Vi=Object.defineProperty;var $i=(wt,h,ct)=>h in wt?Vi(wt,h,{enumerable:!0,configurable:!0,writable:!0,value:ct}):wt[h]=ct;var Yt=(wt,h,ct)=>($i(wt,typeof h!="symbol"?h+"":h,ct),ct),Fe=(wt,h,ct)=>{if(!h.has(wt))throw TypeError("Cannot "+ct)};var t=(wt,h,ct)=>(Fe(wt,h,"read from private field"),ct?ct.call(wt):h.get(wt)),I=(wt,h,ct)=>{if(h.has(wt))throw TypeError("Cannot add the same private member more than once");h instanceof WeakSet?h.add(wt):h.set(wt,ct)},st=(wt,h,ct,l)=>(Fe(wt,h,"write to private field"),l?l.call(wt,ct):h.set(wt,ct),ct);var he=(wt,h,ct,l)=>({set _(M){st(wt,h,M,ct)},get _(){return t(wt,h,l)}}),V=(wt,h,ct)=>(Fe(wt,h,"access private method"),ct);import{a as getAugmentedNamespace}from"./acebuilds-fbc0ccc6.js";function commonjsRequire(wt){throw new Error('Could not dynamically require "'+wt+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$5=getAugmentedNamespace(__viteBrowserExternal$1);(function(module,exports){(function(h,ct){module.exports=h.pdfjsLib=ct()})(globalThis,()=>(()=>{var __webpack_modules__=[,(wt,h)=>{var jt;Object.defineProperty(h,"__esModule",{value:!0}),h.VerbosityLevel=h.Util=h.UnknownErrorException=h.UnexpectedResponseException=h.TextRenderingMode=h.RenderingIntentFlag=h.PromiseCapability=h.PermissionFlag=h.PasswordResponses=h.PasswordException=h.PageActionEventType=h.OPS=h.MissingPDFException=h.MAX_IMAGE_SIZE_TO_CACHE=h.LINE_FACTOR=h.LINE_DESCENT_FACTOR=h.InvalidPDFException=h.ImageKind=h.IDENTITY_MATRIX=h.FormatError=h.FeatureTest=h.FONT_IDENTITY_MATRIX=h.DocumentActionEventType=h.CMapCompressionType=h.BaseException=h.BASELINE_FACTOR=h.AnnotationType=h.AnnotationReplyType=h.AnnotationMode=h.AnnotationFlag=h.AnnotationFieldFlag=h.AnnotationEditorType=h.AnnotationEditorPrefix=h.AnnotationEditorParamsType=h.AnnotationBorderStyleType=h.AnnotationActionEventType=h.AbortException=void 0,h.assert=O,h.bytesToString=Y,h.createValidAbsoluteUrl=rt,h.getModificationDate=Mt,h.getUuid=Gt,h.getVerbosityLevel=X,h.info=nt,h.isArrayBuffer=ft,h.isArrayEqual=Ft,h.isNodeJS=void 0,h.normalizeUnicode=Dt,h.objectFromMap=ut,h.objectSize=lt,h.setVerbosityLevel=E,h.shadow=mt,h.string32=at,h.stringToBytes=dt,h.stringToPDFString=Ct,h.stringToUTF8String=it,h.unreachable=u,h.utf8StringToString=tt,h.warn=ot;const ct=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");h.isNodeJS=ct;const l=[1,0,0,1,0,0];h.IDENTITY_MATRIX=l;const M=[.001,0,0,.001,0,0];h.FONT_IDENTITY_MATRIX=M;const ht=1e7;h.MAX_IMAGE_SIZE_TO_CACHE=ht;const K=1.35;h.LINE_FACTOR=K;const bt=.35;h.LINE_DESCENT_FACTOR=bt;const H=bt/K;h.BASELINE_FACTOR=H;const D={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};h.RenderingIntentFlag=D;const m={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};h.AnnotationMode=m;const L="pdfjs_internal_editor_";h.AnnotationEditorPrefix=L;const U={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};h.AnnotationEditorType=U;const R={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};h.AnnotationEditorParamsType=R;const S={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};h.PermissionFlag=S;const v={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};h.TextRenderingMode=v;const c={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};h.ImageKind=c;const _={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};h.AnnotationType=_;const w={GROUP:"Group",REPLY:"R"};h.AnnotationReplyType=w;const P={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};h.AnnotationFlag=P;const A={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};h.AnnotationFieldFlag=A;const n={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};h.AnnotationBorderStyleType=n;const r={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"};h.AnnotationActionEventType=r;const F={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};h.DocumentActionEventType=F;const f={O:"PageOpen",C:"PageClose"};h.PageActionEventType=f;const s={ERRORS:0,WARNINGS:1,INFOS:5};h.VerbosityLevel=s;const x={NONE:0,BINARY:1};h.CMapCompressionType=x;const g={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};h.OPS=g;const W={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};h.PasswordResponses=W;let z=s.WARNINGS;function E(pt){Number.isInteger(pt)&&(z=pt)}function X(){return z}function nt(pt){z>=s.INFOS&&console.log(`Info: ${pt}`)}function ot(pt){z>=s.WARNINGS&&console.log(`Warning: ${pt}`)}function u(pt){throw new Error(pt)}function O(pt,G){pt||u(G)}function $(pt){switch(pt==null?void 0:pt.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function rt(pt,G=null,J=null){if(!pt)return null;try{if(J&&typeof pt=="string"){if(J.addDefaultProtocol&&pt.startsWith("www.")){const zt=pt.match(/\./g);(zt==null?void 0:zt.length)>=2&&(pt=`http://${pt}`)}if(J.tryConvertEncoding)try{pt=it(pt)}catch{}}const Tt=G?new URL(pt,G):new URL(pt);if($(Tt))return Tt}catch{}return null}function mt(pt,G,J,Tt=!1){return Object.defineProperty(pt,G,{value:J,enumerable:!Tt,configurable:!0,writable:!1}),J}const d=function(){function G(J,Tt){this.constructor===G&&u("Cannot initialize BaseException."),this.message=J,this.name=Tt}return G.prototype=new Error,G.constructor=G,G}();h.BaseException=d;class e extends d{constructor(G,J){super(G,"PasswordException"),this.code=J}}h.PasswordException=e;class i extends d{constructor(G,J){super(G,"UnknownErrorException"),this.details=J}}h.UnknownErrorException=i;class o extends d{constructor(G){super(G,"InvalidPDFException")}}h.InvalidPDFException=o;class C extends d{constructor(G){super(G,"MissingPDFException")}}h.MissingPDFException=C;class y extends d{constructor(G,J){super(G,"UnexpectedResponseException"),this.status=J}}h.UnexpectedResponseException=y;class N extends d{constructor(G){super(G,"FormatError")}}h.FormatError=N;class j extends d{constructor(G){super(G,"AbortException")}}h.AbortException=j;function Y(pt){(typeof pt!="object"||(pt==null?void 0:pt.length)===void 0)&&u("Invalid argument for bytesToString");const G=pt.length,J=8192;if(G<J)return String.fromCharCode.apply(null,pt);const Tt=[];for(let zt=0;zt<G;zt+=J){const Nt=Math.min(zt+J,G),$t=pt.subarray(zt,Nt);Tt.push(String.fromCharCode.apply(null,$t))}return Tt.join("")}function dt(pt){typeof pt!="string"&&u("Invalid argument for stringToBytes");const G=pt.length,J=new Uint8Array(G);for(let Tt=0;Tt<G;++Tt)J[Tt]=pt.charCodeAt(Tt)&255;return J}function at(pt){return String.fromCharCode(pt>>24&255,pt>>16&255,pt>>8&255,pt&255)}function lt(pt){return Object.keys(pt).length}function ut(pt){const G=Object.create(null);for(const[J,Tt]of pt)G[J]=Tt;return G}function kt(){const pt=new Uint8Array(4);return pt[0]=1,new Uint32Array(pt.buffer,0,1)[0]===1}function Et(){try{return new Function(""),!0}catch{return!1}}class Ot{static get isLittleEndian(){return mt(this,"isLittleEndian",kt())}static get isEvalSupported(){return mt(this,"isEvalSupported",Et())}static get isOffscreenCanvasSupported(){return mt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?mt(this,"platform",{isWin:!1,isMac:!1}):mt(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){var G,J;return mt(this,"isCSSRoundSupported",(J=(G=globalThis.CSS)==null?void 0:G.supports)==null?void 0:J.call(G,"width: round(1.5px, 1px)"))}}h.FeatureTest=Ot;const Bt=[...Array(256).keys()].map(pt=>pt.toString(16).padStart(2,"0"));class xt{static makeHexColor(G,J,Tt){return`#${Bt[G]}${Bt[J]}${Bt[Tt]}`}static scaleMinMax(G,J){let Tt;G[0]?(G[0]<0&&(Tt=J[0],J[0]=J[1],J[1]=Tt),J[0]*=G[0],J[1]*=G[0],G[3]<0&&(Tt=J[2],J[2]=J[3],J[3]=Tt),J[2]*=G[3],J[3]*=G[3]):(Tt=J[0],J[0]=J[2],J[2]=Tt,Tt=J[1],J[1]=J[3],J[3]=Tt,G[1]<0&&(Tt=J[2],J[2]=J[3],J[3]=Tt),J[2]*=G[1],J[3]*=G[1],G[2]<0&&(Tt=J[0],J[0]=J[1],J[1]=Tt),J[0]*=G[2],J[1]*=G[2]),J[0]+=G[4],J[1]+=G[4],J[2]+=G[5],J[3]+=G[5]}static transform(G,J){return[G[0]*J[0]+G[2]*J[1],G[1]*J[0]+G[3]*J[1],G[0]*J[2]+G[2]*J[3],G[1]*J[2]+G[3]*J[3],G[0]*J[4]+G[2]*J[5]+G[4],G[1]*J[4]+G[3]*J[5]+G[5]]}static applyTransform(G,J){const Tt=G[0]*J[0]+G[1]*J[2]+J[4],zt=G[0]*J[1]+G[1]*J[3]+J[5];return[Tt,zt]}static applyInverseTransform(G,J){const Tt=J[0]*J[3]-J[1]*J[2],zt=(G[0]*J[3]-G[1]*J[2]+J[2]*J[5]-J[4]*J[3])/Tt,Nt=(-G[0]*J[1]+G[1]*J[0]+J[4]*J[1]-J[5]*J[0])/Tt;return[zt,Nt]}static getAxialAlignedBoundingBox(G,J){const Tt=this.applyTransform(G,J),zt=this.applyTransform(G.slice(2,4),J),Nt=this.applyTransform([G[0],G[3]],J),$t=this.applyTransform([G[2],G[1]],J);return[Math.min(Tt[0],zt[0],Nt[0],$t[0]),Math.min(Tt[1],zt[1],Nt[1],$t[1]),Math.max(Tt[0],zt[0],Nt[0],$t[0]),Math.max(Tt[1],zt[1],Nt[1],$t[1])]}static inverseTransform(G){const J=G[0]*G[3]-G[1]*G[2];return[G[3]/J,-G[1]/J,-G[2]/J,G[0]/J,(G[2]*G[5]-G[4]*G[3])/J,(G[4]*G[1]-G[5]*G[0])/J]}static singularValueDecompose2dScale(G){const J=[G[0],G[2],G[1],G[3]],Tt=G[0]*J[0]+G[1]*J[2],zt=G[0]*J[1]+G[1]*J[3],Nt=G[2]*J[0]+G[3]*J[2],$t=G[2]*J[1]+G[3]*J[3],Jt=(Tt+$t)/2,Q=Math.sqrt((Tt+$t)**2-4*(Tt*$t-Nt*zt))/2,vt=Jt+Q||1,Lt=Jt-Q||1;return[Math.sqrt(vt),Math.sqrt(Lt)]}static normalizeRect(G){const J=G.slice(0);return G[0]>G[2]&&(J[0]=G[2],J[2]=G[0]),G[1]>G[3]&&(J[1]=G[3],J[3]=G[1]),J}static intersect(G,J){const Tt=Math.max(Math.min(G[0],G[2]),Math.min(J[0],J[2])),zt=Math.min(Math.max(G[0],G[2]),Math.max(J[0],J[2]));if(Tt>zt)return null;const Nt=Math.max(Math.min(G[1],G[3]),Math.min(J[1],J[3])),$t=Math.min(Math.max(G[1],G[3]),Math.max(J[1],J[3]));return Nt>$t?null:[Tt,Nt,zt,$t]}static bezierBoundingBox(G,J,Tt,zt,Nt,$t,Jt,Q){const vt=[],Lt=[[],[]];let St,p,a,k,T,B,Z,_t;for(let yt=0;yt<2;++yt){if(yt===0?(p=6*G-12*Tt+6*Nt,St=-3*G+9*Tt-9*Nt+3*Jt,a=3*Tt-3*G):(p=6*J-12*zt+6*$t,St=-3*J+9*zt-9*$t+3*Q,a=3*zt-3*J),Math.abs(St)<1e-12){if(Math.abs(p)<1e-12)continue;k=-a/p,0<k&&k<1&&vt.push(k);continue}Z=p*p-4*a*St,_t=Math.sqrt(Z),!(Z<0)&&(T=(-p+_t)/(2*St),0<T&&T<1&&vt.push(T),B=(-p-_t)/(2*St),0<B&&B<1&&vt.push(B))}let b=vt.length,q;const et=b;for(;b--;)k=vt[b],q=1-k,Lt[0][b]=q*q*q*G+3*q*q*k*Tt+3*q*k*k*Nt+k*k*k*Jt,Lt[1][b]=q*q*q*J+3*q*q*k*zt+3*q*k*k*$t+k*k*k*Q;return Lt[0][et]=G,Lt[1][et]=J,Lt[0][et+1]=Jt,Lt[1][et+1]=Q,Lt[0].length=Lt[1].length=et+2,[Math.min(...Lt[0]),Math.min(...Lt[1]),Math.max(...Lt[0]),Math.max(...Lt[1])]}}h.Util=xt;const Ut=[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 Ct(pt){if(pt[0]>="ï"){let J;if(pt[0]==="þ"&&pt[1]==="ÿ"?J="utf-16be":pt[0]==="ÿ"&&pt[1]==="þ"?J="utf-16le":pt[0]==="ï"&&pt[1]==="»"&&pt[2]==="¿"&&(J="utf-8"),J)try{const Tt=new TextDecoder(J,{fatal:!0}),zt=dt(pt);return Tt.decode(zt)}catch(Tt){ot(`stringToPDFString: "${Tt}".`)}}const G=[];for(let J=0,Tt=pt.length;J<Tt;J++){const zt=Ut[pt.charCodeAt(J)];G.push(zt?String.fromCharCode(zt):pt.charAt(J))}return G.join("")}function it(pt){return decodeURIComponent(escape(pt))}function tt(pt){return unescape(encodeURIComponent(pt))}function ft(pt){return typeof pt=="object"&&(pt==null?void 0:pt.byteLength)!==void 0}function Ft(pt,G){if(pt.length!==G.length)return!1;for(let J=0,Tt=pt.length;J<Tt;J++)if(pt[J]!==G[J])return!1;return!0}function Mt(pt=new Date){return[pt.getUTCFullYear().toString(),(pt.getUTCMonth()+1).toString().padStart(2,"0"),pt.getUTCDate().toString().padStart(2,"0"),pt.getUTCHours().toString().padStart(2,"0"),pt.getUTCMinutes().toString().padStart(2,"0"),pt.getUTCSeconds().toString().padStart(2,"0")].join("")}class Ht{constructor(){I(this,jt,!1);this.promise=new Promise((G,J)=>{this.resolve=Tt=>{st(this,jt,!0),G(Tt)},this.reject=Tt=>{st(this,jt,!0),J(Tt)}})}get settled(){return t(this,jt)}}jt=new WeakMap,h.PromiseCapability=Ht;let Wt=null,Rt=null;function Dt(pt){return Wt||(Wt=/([\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,Rt=new Map([["ſt","ſt"]])),pt.replaceAll(Wt,(G,J,Tt)=>J?J.normalize("NFKC"):Rt.get(Tt))}function Gt(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const pt=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(pt);else for(let G=0;G<32;G++)pt[G]=Math.floor(Math.random()*255);return Y(pt)}},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{var wt,ct,l,M,re,K,_e,H,D,m,L,U,R,S,v,c,Ae,w,P,Re,n,r;Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultFilterFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,Object.defineProperty(exports,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports.build=void 0,exports.getDocument=getDocument,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(f){if(typeof f=="string"||f instanceof URL?f={url:f}:(0,_util.isArrayBuffer)(f)&&(f={data:f}),typeof f!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!f.url&&!f.data&&!f.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const s=new PDFDocumentLoadingTask,{docId:x}=s,g=f.url?getUrlProp(f.url):null,W=f.data?getDataProp(f.data):null,z=f.httpHeaders||null,E=f.withCredentials===!0,X=f.password??null,nt=f.range instanceof PDFDataRangeTransport?f.range:null,ot=Number.isInteger(f.rangeChunkSize)&&f.rangeChunkSize>0?f.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let u=f.worker instanceof PDFWorker?f.worker:null;const O=f.verbosity,$=typeof f.docBaseUrl=="string"&&!(0,_display_utils.isDataScheme)(f.docBaseUrl)?f.docBaseUrl:null,rt=typeof f.cMapUrl=="string"?f.cMapUrl:null,mt=f.cMapPacked!==!1,d=f.CMapReaderFactory||DefaultCMapReaderFactory,e=typeof f.standardFontDataUrl=="string"?f.standardFontDataUrl:null,i=f.StandardFontDataFactory||DefaultStandardFontDataFactory,o=f.stopAtErrors!==!0,C=Number.isInteger(f.maxImageSize)&&f.maxImageSize>-1?f.maxImageSize:-1,y=f.isEvalSupported!==!1,N=typeof f.isOffscreenCanvasSupported=="boolean"?f.isOffscreenCanvasSupported:!_util.isNodeJS,j=Number.isInteger(f.canvasMaxAreaInBytes)?f.canvasMaxAreaInBytes:-1,Y=typeof f.disableFontFace=="boolean"?f.disableFontFace:_util.isNodeJS,dt=f.fontExtraProperties===!0,at=f.enableXfa===!0,lt=f.ownerDocument||globalThis.document,ut=f.disableRange===!0,kt=f.disableStream===!0,Et=f.disableAutoFetch===!0,Ot=f.pdfBug===!0,Bt=nt?nt.length:f.length??NaN,xt=typeof f.useSystemFonts=="boolean"?f.useSystemFonts:!_util.isNodeJS&&!Y,Ut=typeof f.useWorkerFetch=="boolean"?f.useWorkerFetch:d===_display_utils.DOMCMapReaderFactory&&i===_display_utils.DOMStandardFontDataFactory&&rt&&e&&(0,_display_utils.isValidFetchUrl)(rt,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(e,document.baseURI),Ct=f.canvasFactory||new DefaultCanvasFactory({ownerDocument:lt}),it=f.filterFactory||new DefaultFilterFactory({docId:x,ownerDocument:lt}),tt=null;(0,_util.setVerbosityLevel)(O);const ft={canvasFactory:Ct,filterFactory:it};if(Ut||(ft.cMapReaderFactory=new d({baseUrl:rt,isCompressed:mt}),ft.standardFontDataFactory=new i({baseUrl:e})),!u){const Ht={verbosity:O,port:_worker_options.GlobalWorkerOptions.workerPort};u=Ht.port?PDFWorker.fromPort(Ht):new PDFWorker(Ht),s._worker=u}const Ft={docId:x,apiVersion:"3.10.111",data:W,password:X,disableAutoFetch:Et,rangeChunkSize:ot,length:Bt,docBaseUrl:$,enableXfa:at,evaluatorOptions:{maxImageSize:C,disableFontFace:Y,ignoreErrors:o,isEvalSupported:y,isOffscreenCanvasSupported:N,canvasMaxAreaInBytes:j,fontExtraProperties:dt,useSystemFonts:xt,cMapUrl:Ut?rt:null,standardFontDataUrl:Ut?e:null}},Mt={ignoreErrors:o,isEvalSupported:y,disableFontFace:Y,fontExtraProperties:dt,enableXfa:at,ownerDocument:lt,disableAutoFetch:Et,pdfBug:Ot,styleElement:tt};return u.promise.then(function(){if(s.destroyed)throw new Error("Loading aborted");const Ht=_fetchDocument(u,Ft),Wt=new Promise(function(Rt){let Dt;nt?Dt=new _transport_stream.PDFDataTransportStream({length:Bt,initialData:nt.initialData,progressiveDone:nt.progressiveDone,contentDispositionFilename:nt.contentDispositionFilename,disableRange:ut,disableStream:kt},nt):W||(Dt=(jt=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(jt):(0,_display_utils.isValidFetchUrl)(jt.url)?new _displayFetch_stream.PDFFetchStream(jt):new _displayNetwork.PDFNetworkStream(jt))({url:g,length:Bt,httpHeaders:z,withCredentials:E,rangeChunkSize:ot,disableRange:ut,disableStream:kt})),Rt(Dt)});return Promise.all([Ht,Wt]).then(function([Rt,Dt]){if(s.destroyed)throw new Error("Loading aborted");const Gt=new _message_handler.MessageHandler(x,Rt,u.port),jt=new WorkerTransport(Gt,s,Dt,Mt,ft);s._transport=jt,Gt.send("Ready",null)})}).catch(s._capability.reject),s}async function _fetchDocument(f,s){if(f.destroyed)throw new Error("Worker was destroyed");const x=await f.messageHandler.sendWithPromise("GetDocRequest",s,s.data?[s.data.buffer]:null);if(f.destroyed)throw new Error("Worker was destroyed");return x}function getUrlProp(f){if(f instanceof URL)return f.href;try{return new URL(f,window.location).href}catch{if(_util.isNodeJS&&typeof f=="string")return f}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(f){if(_util.isNodeJS&&typeof Buffer<"u"&&f instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(f instanceof Uint8Array&&f.byteLength===f.buffer.byteLength)return f;if(typeof f=="string")return(0,_util.stringToBytes)(f);if(typeof f=="object"&&!isNaN(f==null?void 0:f.length)||(0,_util.isArrayBuffer)(f))return new Uint8Array(f);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}const h=class h{constructor(){this._capability=new _util.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${he(h,wt)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var s,x,g;this.destroyed=!0;try{(s=this._worker)!=null&&s.port&&(this._worker._pendingDestroy=!0),await((x=this._transport)==null?void 0:x.destroy())}catch(W){throw(g=this._worker)!=null&&g.port&&delete this._worker._pendingDestroy,W}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};wt=new WeakMap,I(h,wt,0);let PDFDocumentLoadingTask=h;exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(s,x,g=!1,W=null){this.length=s,this.initialData=x,this.progressiveDone=g,this.contentDispositionFilename=W,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(s){this._rangeListeners.push(s)}addProgressListener(s){this._progressListeners.push(s)}addProgressiveReadListener(s){this._progressiveReadListeners.push(s)}addProgressiveDoneListener(s){this._progressiveDoneListeners.push(s)}onDataRange(s,x){for(const g of this._rangeListeners)g(s,x)}onDataProgress(s,x){this._readyCapability.promise.then(()=>{for(const g of this._progressListeners)g(s,x)})}onDataProgressiveRead(s){this._readyCapability.promise.then(()=>{for(const x of this._progressiveReadListeners)x(s)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const s of this._progressiveDoneListeners)s()})}transportReady(){this._readyCapability.resolve()}requestDataRange(s,x){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(s,x){this._pdfInfo=s,this._transport=x,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(g=>{if(!g)return g;const W=[];for(const z in g)W.push(...g[z]);return W}))})}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(s){return this._transport.getPage(s)}getPageIndex(s){return this._transport.getPageIndex(s)}getDestinations(){return this._transport.getDestinations()}getDestination(s){return this._transport.getDestination(s)}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(){return this._transport.getOptionalContentConfig()}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(s=!1){return this._transport.startCleanup(s||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}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()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(s,x,g,W=!1){I(this,M);I(this,K);I(this,ct,null);I(this,l,!1);this._pageIndex=s,this._pageInfo=x,this._transport=g,this._stats=W?new _display_utils.StatTimer:null,this._pdfBug=W,this.commonObjs=g.commonObjs,this.objs=new PDFObjects,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({scale:s,rotation:x=this.rotate,offsetX:g=0,offsetY:W=0,dontFlip:z=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:s,rotation:x,offsetX:g,offsetY:W,dontFlip:z})}getAnnotations({intent:s="display"}={}){const x=this._transport.getRenderingIntent(s);return this._transport.getAnnotations(this._pageIndex,x.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var s;return((s=this._transport._htmlForXfa)==null?void 0:s.children[this._pageIndex])||null}render({canvasContext:s,viewport:x,intent:g="display",annotationMode:W=_util.AnnotationMode.ENABLE,transform:z=null,background:E=null,optionalContentConfigPromise:X=null,annotationCanvasMap:nt=null,pageColors:ot=null,printAnnotationStorage:u=null}){var i,o;(i=this._stats)==null||i.time("Overall");const O=this._transport.getRenderingIntent(g,W,u);st(this,l,!1),V(this,K,_e).call(this),X||(X=this._transport.getOptionalContentConfig());let $=this._intentStates.get(O.cacheKey);$||($=Object.create(null),this._intentStates.set(O.cacheKey,$)),$.streamReaderCancelTimeout&&(clearTimeout($.streamReaderCancelTimeout),$.streamReaderCancelTimeout=null);const rt=!!(O.renderingIntent&_util.RenderingIntentFlag.PRINT);$.displayReadyCapability||($.displayReadyCapability=new _util.PromiseCapability,$.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(o=this._stats)==null||o.time("Page Request"),this._pumpOperatorList(O));const mt=C=>{var y,N;$.renderTasks.delete(d),(this._maybeCleanupAfterRender||rt)&&st(this,l,!0),V(this,M,re).call(this,!rt),C?(d.capability.reject(C),this._abortOperatorList({intentState:$,reason:C instanceof Error?C:new Error(C)})):d.capability.resolve(),(y=this._stats)==null||y.timeEnd("Rendering"),(N=this._stats)==null||N.timeEnd("Overall")},d=new InternalRenderTask({callback:mt,params:{canvasContext:s,viewport:x,transform:z,background:E},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:nt,operatorList:$.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!rt,pdfBug:this._pdfBug,pageColors:ot});($.renderTasks||($.renderTasks=new Set)).add(d);const e=d.task;return Promise.all([$.displayReadyCapability.promise,X]).then(([C,y])=>{var N;if(this.destroyed){mt();return}(N=this._stats)==null||N.time("Rendering"),d.initializeGraphics({transparency:C,optionalContentConfig:y}),d.operatorListChanged()}).catch(mt),e}getOperatorList({intent:s="display",annotationMode:x=_util.AnnotationMode.ENABLE,printAnnotationStorage:g=null}={}){var nt;function W(){E.operatorList.lastChunk&&(E.opListReadCapability.resolve(E.operatorList),E.renderTasks.delete(X))}const z=this._transport.getRenderingIntent(s,x,g,!0);let E=this._intentStates.get(z.cacheKey);E||(E=Object.create(null),this._intentStates.set(z.cacheKey,E));let X;return E.opListReadCapability||(X=Object.create(null),X.operatorListChanged=W,E.opListReadCapability=new _util.PromiseCapability,(E.renderTasks||(E.renderTasks=new Set)).add(X),E.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(nt=this._stats)==null||nt.time("Page Request"),this._pumpOperatorList(z)),E.opListReadCapability.promise}streamTextContent({includeMarkedContent:s=!1,disableNormalization:x=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:s===!0,disableNormalization:x===!0},{highWaterMark:100,size(W){return W.items.length}})}getTextContent(s={}){if(this._transport._htmlForXfa)return this.getXfa().then(g=>_xfa_text.XfaText.textContent(g));const x=this.streamTextContent(s);return new Promise(function(g,W){function z(){E.read().then(function({value:nt,done:ot}){if(ot){g(X);return}Object.assign(X.styles,nt.styles),X.items.push(...nt.items),z()},W)}const E=x.getReader(),X={items:[],styles:Object.create(null)};z()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const s=[];for(const x of this._intentStates.values())if(this._abortOperatorList({intentState:x,reason:new Error("Page was destroyed."),force:!0}),!x.opListReadCapability)for(const g of x.renderTasks)s.push(g.completed),g.cancel();return this.objs.clear(),st(this,l,!1),V(this,K,_e).call(this),Promise.all(s)}cleanup(s=!1){st(this,l,!0);const x=V(this,M,re).call(this,!1);return s&&x&&this._stats&&(this._stats=new _display_utils.StatTimer),x}_startRenderPage(s,x){var W,z;const g=this._intentStates.get(x);g&&((W=this._stats)==null||W.timeEnd("Page Request"),(z=g.displayReadyCapability)==null||z.resolve(s))}_renderPageChunk(s,x){for(let g=0,W=s.length;g<W;g++)x.operatorList.fnArray.push(s.fnArray[g]),x.operatorList.argsArray.push(s.argsArray[g]);x.operatorList.lastChunk=s.lastChunk,x.operatorList.separateAnnots=s.separateAnnots;for(const g of x.renderTasks)g.operatorListChanged();s.lastChunk&&V(this,M,re).call(this,!0)}_pumpOperatorList({renderingIntent:s,cacheKey:x,annotationStorageSerializable:g}){const{map:W,transfers:z}=g,X=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:s,cacheKey:x,annotationStorage:W},z).getReader(),nt=this._intentStates.get(x);nt.streamReader=X;const ot=()=>{X.read().then(({value:u,done:O})=>{if(O){nt.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,nt),ot())},u=>{if(nt.streamReader=null,!this._transport.destroyed){if(nt.operatorList){nt.operatorList.lastChunk=!0;for(const O of nt.renderTasks)O.operatorListChanged();V(this,M,re).call(this,!0)}if(nt.displayReadyCapability)nt.displayReadyCapability.reject(u);else if(nt.opListReadCapability)nt.opListReadCapability.reject(u);else throw u}})};ot()}_abortOperatorList({intentState:s,reason:x,force:g=!1}){if(s.streamReader){if(s.streamReaderCancelTimeout&&(clearTimeout(s.streamReaderCancelTimeout),s.streamReaderCancelTimeout=null),!g){if(s.renderTasks.size>0)return;if(x instanceof _display_utils.RenderingCancelledException){let W=RENDERING_CANCELLED_TIMEOUT;x.extraDelay>0&&x.extraDelay<1e3&&(W+=x.extraDelay),s.streamReaderCancelTimeout=setTimeout(()=>{s.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:s,reason:x,force:!0})},W);return}}if(s.streamReader.cancel(new _util.AbortException(x.message)).catch(()=>{}),s.streamReader=null,!this._transport.destroyed){for(const[W,z]of this._intentStates)if(z===s){this._intentStates.delete(W);break}this.cleanup()}}}get stats(){return this._stats}}ct=new WeakMap,l=new WeakMap,M=new WeakSet,re=function(s=!1){if(V(this,K,_e).call(this),!t(this,l)||this.destroyed)return!1;if(s)return st(this,ct,setTimeout(()=>{st(this,ct,null),V(this,M,re).call(this,!1)},DELAYED_CLEANUP_TIMEOUT)),!1;for(const{renderTasks:x,operatorList:g}of this._intentStates.values())if(x.size>0||!g.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),st(this,l,!1),!0},K=new WeakSet,_e=function(){t(this,ct)&&(clearTimeout(t(this,ct)),st(this,ct,null))},exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){I(this,H,new Set);I(this,D,Promise.resolve())}postMessage(s,x){const g={data:structuredClone(s,x?{transfer:x}:null)};t(this,D).then(()=>{for(const W of t(this,H))W.call(this,g)})}addEventListener(s,x){t(this,H).add(x)}removeEventListener(s,x){t(this,H).delete(x)}terminate(){t(this,H).clear()}}H=new WeakMap,D=new WeakMap,exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;{if(_util.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const f=(m=document==null?void 0:document.currentScript)==null?void 0:m.src;f&&(PDFWorkerUtil.fallbackWorkerSrc=f.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(f,s){let x;try{if(x=new URL(f),!x.origin||x.origin==="null")return!1}catch{return!1}const g=new URL(s,x);return x.origin===g.origin},PDFWorkerUtil.createCDNWrapper=function(f){const s=`importScripts("${f}");`;return URL.createObjectURL(new Blob([s]))}}const _PDFWorker=class _PDFWorker{constructor({name:f=null,port:s=null,verbosity:x=(0,_util.getVerbosityLevel)()}={}){var g;if(this.name=f,this.destroyed=!1,this.verbosity=x,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,s){if((g=t(_PDFWorker,L))!=null&&g.has(s))throw new Error("Cannot use more than one PDFWorker per port.");(t(_PDFWorker,L)||st(_PDFWorker,L,new WeakMap)).set(s,this),this._initializeFromPort(s);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(f){this._port=f,this._messageHandler=new _message_handler.MessageHandler("main","worker",f),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!_PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:f}=_PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,f)||(f=PDFWorkerUtil.createCDNWrapper(new URL(f,window.location).href));const s=new Worker(f),x=new _message_handler.MessageHandler("main","worker",s),g=()=>{s.removeEventListener("error",W),x.destroy(),s.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},W=()=>{this._webWorker||g()};s.addEventListener("error",W),x.on("test",E=>{if(s.removeEventListener("error",W),this.destroyed){g();return}E?(this._messageHandler=x,this._port=s,this._webWorker=s,this._readyCapability.resolve(),x.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),x.destroy(),s.terminate())}),x.on("ready",E=>{if(s.removeEventListener("error",W),this.destroyed){g();return}try{z()}catch{this._setupFakeWorker()}});const z=()=>{const E=new Uint8Array;x.send("test",E,[E.buffer])};z();return}catch{(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),_PDFWorker._setupFakeWorkerGlobal.then(f=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const s=new LoopbackPort;this._port=s;const x=`fake${PDFWorkerUtil.fakeWorkerId++}`,g=new _message_handler.MessageHandler(x+"_worker",x,s);f.setup(g,s);const W=new _message_handler.MessageHandler(x,x+"_worker",s);this._messageHandler=W,this._readyCapability.resolve(),W.send("configure",{verbosity:this.verbosity})}).catch(f=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${f.message}".`))})}destroy(){var f;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(f=t(_PDFWorker,L))==null||f.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(f){var x;if(!(f!=null&&f.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const s=(x=t(this,L))==null?void 0:x.get(f.port);if(s){if(s._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return s}return new _PDFWorker(f)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){var f;try{return((f=globalThis.pdfjsWorker)==null?void 0:f.WorkerMessageHandler)||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&typeof commonjsRequire=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}};L=new WeakMap,I(_PDFWorker,L,void 0);let PDFWorker=_PDFWorker;exports.PDFWorker=PDFWorker;class WorkerTransport{constructor(s,x,g,W,z){I(this,c);I(this,U,new Map);I(this,R,new Map);I(this,S,new Map);I(this,v,null);this.messageHandler=s,this.loadingTask=x,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:W.ownerDocument,styleElement:W.styleElement}),this._params=W,this.canvasFactory=z.canvasFactory,this.filterFactory=z.filterFactory,this.cMapReaderFactory=z.cMapReaderFactory,this.standardFontDataFactory=z.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=g,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(s,x=_util.AnnotationMode.ENABLE,g=null,W=!1){let z=_util.RenderingIntentFlag.DISPLAY,E=_annotation_storage.SerializableEmpty;switch(s){case"any":z=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":z=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${s}`)}switch(x){case _util.AnnotationMode.DISABLE:z+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:z+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:z+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,E=(z&_util.RenderingIntentFlag.PRINT&&g instanceof _annotation_storage.PrintAnnotationStorage?g:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${x}`)}return W&&(z+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:z,cacheKey:`${z}_${E.hash}`,annotationStorageSerializable:E}}destroy(){var g;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,(g=t(this,v))==null||g.reject(new Error("Worker was destroyed during onPassword callback"));const s=[];for(const W of t(this,R).values())s.push(W._destroy());t(this,R).clear(),t(this,S).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const x=this.messageHandler.sendWithPromise("Terminate",null);return s.push(x),Promise.all(s).then(()=>{var W;this.commonObjs.clear(),this.fontLoader.clear(),t(this,U).clear(),this.filterFactory.destroy(),(W=this._networkStream)==null||W.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:s,loadingTask:x}=this;s.on("GetReader",(g,W)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=z=>{this._lastProgress={loaded:z.loaded,total:z.total}},W.onPull=()=>{this._fullReader.read().then(function({value:z,done:E}){if(E){W.close();return}(0,_util.assert)(z instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),W.enqueue(new Uint8Array(z),1,[z])}).catch(z=>{W.error(z)})},W.onCancel=z=>{this._fullReader.cancel(z),W.ready.catch(E=>{if(!this.destroyed)throw E})}}),s.on("ReaderHeadersReady",g=>{const W=new _util.PromiseCapability,z=this._fullReader;return z.headersReady.then(()=>{var E;(!z.isStreamingSupported||!z.isRangeSupported)&&(this._lastProgress&&((E=x.onProgress)==null||E.call(x,this._lastProgress)),z.onProgress=X=>{var nt;(nt=x.onProgress)==null||nt.call(x,{loaded:X.loaded,total:X.total})}),W.resolve({isStreamingSupported:z.isStreamingSupported,isRangeSupported:z.isRangeSupported,contentLength:z.contentLength})},W.reject),W.promise}),s.on("GetRangeReader",(g,W)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const z=this._networkStream.getRangeReader(g.begin,g.end);if(!z){W.close();return}W.onPull=()=>{z.read().then(function({value:E,done:X}){if(X){W.close();return}(0,_util.assert)(E instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),W.enqueue(new Uint8Array(E),1,[E])}).catch(E=>{W.error(E)})},W.onCancel=E=>{z.cancel(E),W.ready.catch(X=>{if(!this.destroyed)throw X})}}),s.on("GetDoc",({pdfInfo:g})=>{this._numPages=g.numPages,this._htmlForXfa=g.htmlForXfa,delete g.htmlForXfa,x._capability.resolve(new PDFDocumentProxy(g,this))}),s.on("DocException",function(g){let W;switch(g.name){case"PasswordException":W=new _util.PasswordException(g.message,g.code);break;case"InvalidPDFException":W=new _util.InvalidPDFException(g.message);break;case"MissingPDFException":W=new _util.MissingPDFException(g.message);break;case"UnexpectedResponseException":W=new _util.UnexpectedResponseException(g.message,g.status);break;case"UnknownErrorException":W=new _util.UnknownErrorException(g.message,g.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}x._capability.reject(W)}),s.on("PasswordRequest",g=>{if(st(this,v,new _util.PromiseCapability),x.onPassword){const W=z=>{z instanceof Error?t(this,v).reject(z):t(this,v).resolve({password:z})};try{x.onPassword(W,g.code)}catch(z){t(this,v).reject(z)}}else t(this,v).reject(new _util.PasswordException(g.message,g.code));return t(this,v).promise}),s.on("DataLoaded",g=>{var W;(W=x.onProgress)==null||W.call(x,{loaded:g.length,total:g.length}),this.downloadInfoCapability.resolve(g)}),s.on("StartRenderPage",g=>{if(this.destroyed)return;t(this,R).get(g.pageIndex)._startRenderPage(g.transparency,g.cacheKey)}),s.on("commonobj",([g,W,z])=>{var E;if(!this.destroyed&&!this.commonObjs.has(g))switch(W){case"Font":const X=this._params;if("error"in z){const u=z.error;(0,_util.warn)(`Error during font loading: ${u}`),this.commonObjs.resolve(g,u);break}const nt=X.pdfBug&&((E=globalThis.FontInspector)!=null&&E.enabled)?(u,O)=>globalThis.FontInspector.fontAdded(u,O):null,ot=new _font_loader.FontFaceObject(z,{isEvalSupported:X.isEvalSupported,disableFontFace:X.disableFontFace,ignoreErrors:X.ignoreErrors,inspectFont:nt});this.fontLoader.bind(ot).catch(u=>s.sendWithPromise("FontFallback",{id:g})).finally(()=>{!X.fontExtraProperties&&ot.data&&(ot.data=null),this.commonObjs.resolve(g,ot)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(g,z);break;default:throw new Error(`Got unknown common object type ${W}`)}}),s.on("obj",([g,W,z,E])=>{var nt;if(this.destroyed)return;const X=t(this,R).get(W);if(!X.objs.has(g))switch(z){case"Image":if(X.objs.resolve(g,E),E){let ot;if(E.bitmap){const{width:u,height:O}=E;ot=u*O*4}else ot=((nt=E.data)==null?void 0:nt.length)||0;ot>_util.MAX_IMAGE_SIZE_TO_CACHE&&(X._maybeCleanupAfterRender=!0)}break;case"Pattern":X.objs.resolve(g,E);break;default:throw new Error(`Got unknown object type ${z}`)}}),s.on("DocProgress",g=>{var W;this.destroyed||(W=x.onProgress)==null||W.call(x,{loaded:g.loaded,total:g.total})}),s.on("FetchBuiltInCMap",g=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(g):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),s.on("FetchStandardFontData",g=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(g):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var g;this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:s,transfers:x}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:s,filename:((g=this._fullReader)==null?void 0:g.filename)??null},x).finally(()=>{this.annotationStorage.resetModified()})}getPage(s){if(!Number.isInteger(s)||s<=0||s>this._numPages)return Promise.reject(new Error("Invalid page request."));const x=s-1,g=t(this,S).get(x);if(g)return g;const W=this.messageHandler.sendWithPromise("GetPage",{pageIndex:x}).then(z=>{if(this.destroyed)throw new Error("Transport destroyed");const E=new PDFPageProxy(x,z,this,this._params.pdfBug);return t(this,R).set(x,E),E});return t(this,S).set(x,W),W}getPageIndex(s){return typeof s!="object"||s===null||!Number.isInteger(s.num)||s.num<0||!Number.isInteger(s.gen)||s.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:s.num,gen:s.gen})}getAnnotations(s,x){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:s,intent:x})}getFieldObjects(){return V(this,c,Ae).call(this,"GetFieldObjects")}hasJSActions(){return V(this,c,Ae).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(s){return typeof s!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:s})}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 V(this,c,Ae).call(this,"GetDocJSActions")}getPageJSActions(s){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:s})}getStructTree(s){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:s})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(s=>new _optional_content_config.OptionalContentConfig(s))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const s="GetMetadata",x=t(this,U).get(s);if(x)return x;const g=this.messageHandler.sendWithPromise(s,null).then(W=>{var z,E;return{info:W[0],metadata:W[1]?new _metadata.Metadata(W[1]):null,contentDispositionFilename:((z=this._fullReader)==null?void 0:z.filename)??null,contentLength:((E=this._fullReader)==null?void 0:E.contentLength)??null}});return t(this,U).set(s,g),g}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(s=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const x of t(this,R).values())if(!x.cleanup())throw new Error(`startCleanup: Page ${x.pageNumber} is currently rendering.`);this.commonObjs.clear(),s||this.fontLoader.clear(),t(this,U).clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:s,enableXfa:x}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:s,enableXfa:x})}}U=new WeakMap,R=new WeakMap,S=new WeakMap,v=new WeakMap,c=new WeakSet,Ae=function(s,x=null){const g=t(this,U).get(s);if(g)return g;const W=this.messageHandler.sendWithPromise(s,x);return t(this,U).set(s,W),W};class PDFObjects{constructor(){I(this,P);I(this,w,Object.create(null))}get(s,x=null){if(x){const W=V(this,P,Re).call(this,s);return W.capability.promise.then(()=>x(W.data)),null}const g=t(this,w)[s];if(!(g!=null&&g.capability.settled))throw new Error(`Requesting object that isn't resolved yet ${s}.`);return g.data}has(s){const x=t(this,w)[s];return(x==null?void 0:x.capability.settled)||!1}resolve(s,x=null){const g=V(this,P,Re).call(this,s);g.data=x,g.capability.resolve()}clear(){var s;for(const x in t(this,w)){const{data:g}=t(this,w)[x];(s=g==null?void 0:g.bitmap)==null||s.close()}st(this,w,Object.create(null))}}w=new WeakMap,P=new WeakSet,Re=function(s){var x;return(x=t(this,w))[s]||(x[s]={capability:new _util.PromiseCapability,data:null})};class RenderTask{constructor(s){I(this,n,null);st(this,n,s),this.onContinue=null}get promise(){return t(this,n).capability.promise}cancel(s=0){t(this,n).cancel(null,s)}get separateAnnots(){const{separateAnnots:s}=t(this,n).operatorList;if(!s)return!1;const{annotationCanvasMap:x}=t(this,n);return s.form||s.canvas&&(x==null?void 0:x.size)>0}}n=new WeakMap,exports.RenderTask=RenderTask;const F=class F{constructor({callback:s,params:x,objs:g,commonObjs:W,annotationCanvasMap:z,operatorList:E,pageIndex:X,canvasFactory:nt,filterFactory:ot,useRequestAnimationFrame:u=!1,pdfBug:O=!1,pageColors:$=null}){this.callback=s,this.params=x,this.objs=g,this.commonObjs=W,this.annotationCanvasMap=z,this.operatorListIdx=null,this.operatorList=E,this._pageIndex=X,this.canvasFactory=nt,this.filterFactory=ot,this._pdfBug=O,this.pageColors=$,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=u===!0&&typeof window<"u",this.cancelled=!1,this.capability=new _util.PromiseCapability,this.task=new RenderTask(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=x.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:s=!1,optionalContentConfig:x}){var X,nt;if(this.cancelled)return;if(this._canvas){if(t(F,r).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");t(F,r).add(this._canvas)}this._pdfBug&&((X=globalThis.StepperManager)!=null&&X.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:g,viewport:W,transform:z,background:E}=this.params;this.gfx=new _canvas.CanvasGraphics(g,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:x},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:z,viewport:W,transparency:s,background:E}),this.operatorListIdx=0,this.graphicsReady=!0,(nt=this.graphicsReadyCallback)==null||nt.call(this)}cancel(s=null,x=0){var g;this.running=!1,this.cancelled=!0,(g=this.gfx)==null||g.endDrawing(),this._canvas&&t(F,r).delete(this._canvas),this.callback(s||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,x))}operatorListChanged(){var s;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(s=this.stepper)==null||s.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?window.requestAnimationFrame(()=>{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(this.pageColors),this._canvas&&t(F,r).delete(this._canvas),this.callback())))}};r=new WeakMap,I(F,r,new WeakSet);let InternalRenderTask=F;const version="3.10.111";exports.version=version;const build="e142baecb";exports.build=build},(wt,h,ct)=>{var D,m,L,ci,R;Object.defineProperty(h,"__esModule",{value:!0}),h.SerializableEmpty=h.PrintAnnotationStorage=h.AnnotationStorage=void 0;var l=ct(1),M=ct(4),ht=ct(8);const K=Object.freeze({map:null,hash:"",transfers:void 0});h.SerializableEmpty=K;class bt{constructor(){I(this,L);I(this,D,!1);I(this,m,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(v,c){const _=t(this,m).get(v);return _===void 0?c:Object.assign(c,_)}getRawValue(v){return t(this,m).get(v)}remove(v){if(t(this,m).delete(v),t(this,m).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const c of t(this,m).values())if(c instanceof M.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(v,c){const _=t(this,m).get(v);let w=!1;if(_!==void 0)for(const[P,A]of Object.entries(c))_[P]!==A&&(w=!0,_[P]=A);else w=!0,t(this,m).set(v,c);w&&V(this,L,ci).call(this),c instanceof M.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(c.constructor._type)}has(v){return t(this,m).has(v)}getAll(){return t(this,m).size>0?(0,l.objectFromMap)(t(this,m)):null}setAll(v){for(const[c,_]of Object.entries(v))this.setValue(c,_)}get size(){return t(this,m).size}resetModified(){t(this,D)&&(st(this,D,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new H(this)}get serializable(){if(t(this,m).size===0)return K;const v=new Map,c=new ht.MurmurHash3_64,_=[],w=Object.create(null);let P=!1;for(const[A,n]of t(this,m)){const r=n instanceof M.AnnotationEditor?n.serialize(!1,w):n;r&&(v.set(A,r),c.update(`${A}:${JSON.stringify(r)}`),P||(P=!!r.bitmap))}if(P)for(const A of v.values())A.bitmap&&_.push(A.bitmap);return v.size>0?{map:v,hash:c.hexdigest(),transfers:_}:K}}D=new WeakMap,m=new WeakMap,L=new WeakSet,ci=function(){t(this,D)||(st(this,D,!0),typeof this.onSetModified=="function"&&this.onSetModified())},h.AnnotationStorage=bt;class H extends bt{constructor(c){super();I(this,R,void 0);const{map:_,hash:w,transfers:P}=c.serializable,A=structuredClone(_,P?{transfer:P}:null);st(this,R,{map:A,hash:w,transfers:P})}get print(){(0,l.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return t(this,R)}}R=new WeakMap,h.PrintAnnotationStorage=H},(wt,h,ct)=>{var bt,H,D,m,L,U,R,S,v,c,Me,w,De,A,Ie,r,hi,f,di,x,ui,W,fi,E,pi;Object.defineProperty(h,"__esModule",{value:!0}),h.AnnotationEditor=void 0;var l=ct(5),M=ct(1);const nt=class nt{constructor(u){I(this,c);I(this,A);I(this,f);I(this,x);I(this,W);I(this,E);I(this,bt,!1);I(this,H,null);I(this,D,this.focusin.bind(this));I(this,m,this.focusout.bind(this));I(this,L,!1);I(this,U,!1);I(this,R,!1);Yt(this,"_initialOptions",Object.create(null));Yt(this,"_uiManager",null);Yt(this,"_focusEventsAllowed",!0);I(this,S,!1);I(this,v,nt._zIndex++);this.constructor===nt&&(0,M.unreachable)("Cannot initialize AnnotationEditor."),this.parent=u.parent,this.id=u.id,this.width=this.height=null,this.pageIndex=u.parent.pageIndex,this.name=u.name,this.div=null,this._uiManager=u.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=u.isCentered;const{rotation:O,rawDims:{pageWidth:$,pageHeight:rt,pageX:mt,pageY:d}}=this.parent.viewport;this.rotation=O,this.pageRotation=(360+O-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[$,rt],this.pageTranslation=[mt,d];const[e,i]=this.parentDimensions;this.x=u.x/e,this.y=u.y/i,this.isAttachedToDOM=!1,this.deleted=!1}static get _defaultLineColor(){return(0,M.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(u){const O=new K({id:u.parent.getNextId(),parent:u.parent,uiManager:u._uiManager});O.annotationElementId=u.annotationElementId,O.deleted=!0,O._uiManager.addToAnnotationStorage(O)}static initialize(u){}static updateDefaultParams(u,O){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(u){return!1}static paste(u,O){(0,M.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return t(this,S)}set _isDraggable(u){var O;st(this,S,u),(O=this.div)==null||O.classList.toggle("draggable",u)}center(){const[u,O]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*O/(u*2),this.y+=this.width*u/(O*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*O/(u*2),this.y-=this.width*u/(O*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(u){this._uiManager.addCommands(u)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=t(this,v)}setParent(u){u!==null&&(this.pageIndex=u.pageIndex,this.pageDimensions=u.pageDimensions),this.parent=u}focusin(u){this._focusEventsAllowed&&(t(this,L)?st(this,L,!1):this.parent.setSelected(this))}focusout(u){var $;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const O=u.relatedTarget;O!=null&&O.closest(`#${this.id}`)||(u.preventDefault(),($=this.parent)!=null&&$.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(u,O,$,rt){const[mt,d]=this.parentDimensions;[$,rt]=this.screenToPageTranslation($,rt),this.x=(u+$)/mt,this.y=(O+rt)/d,this.fixAndSetPosition()}translate(u,O){V(this,c,Me).call(this,this.parentDimensions,u,O)}translateInPage(u,O){V(this,c,Me).call(this,this.pageDimensions,u,O),this.moveInDOM(),this.div.scrollIntoView({block:"nearest"})}drag(u,O){const[$,rt]=this.parentDimensions;if(this.x+=u/$,this.y+=O/rt,this.x<0||this.x>1||this.y<0||this.y>1){const{x:mt,y:d}=this.div.getBoundingClientRect();this.parent.findNewParent(this,mt,d)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}this.div.style.left=`${(100*this.x).toFixed(2)}%`,this.div.style.top=`${(100*this.y).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}fixAndSetPosition(){const[u,O]=this.pageDimensions;let{x:$,y:rt,width:mt,height:d}=this;switch(mt*=u,d*=O,$*=u,rt*=O,this.rotation){case 0:$=Math.max(0,Math.min(u-mt,$)),rt=Math.max(0,Math.min(O-d,rt));break;case 90:$=Math.max(0,Math.min(u-d,$)),rt=Math.min(O,Math.max(mt,rt));break;case 180:$=Math.min(u,Math.max(mt,$)),rt=Math.min(O,Math.max(d,rt));break;case 270:$=Math.min(u,Math.max(d,$)),rt=Math.max(0,Math.min(O-mt,rt));break}this.x=$/u,this.y=rt/O,this.div.style.left=`${(100*this.x).toFixed(2)}%`,this.div.style.top=`${(100*this.y).toFixed(2)}%`}screenToPageTranslation(u,O){var $;return V($=nt,w,De).call($,u,O,this.parentRotation)}pageTranslationToScreen(u,O){var $;return V($=nt,w,De).call($,u,O,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:u,pageDimensions:[O,$]}=this,rt=O*u,mt=$*u;return M.FeatureTest.isCSSRoundSupported?[Math.round(rt),Math.round(mt)]:[rt,mt]}setDims(u,O){const[$,rt]=this.parentDimensions;this.div.style.width=`${(100*u/$).toFixed(2)}%`,t(this,bt)||(this.div.style.height=`${(100*O/rt).toFixed(2)}%`)}fixDims(){const{style:u}=this.div,{height:O,width:$}=u,rt=$.endsWith("%"),mt=!t(this,bt)&&O.endsWith("%");if(rt&&mt)return;const[d,e]=this.parentDimensions;rt||(u.width=`${(100*parseFloat($)/d).toFixed(2)}%`),!t(this,bt)&&!mt&&(u.height=`${(100*parseFloat(O)/e).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",t(this,D)),this.div.addEventListener("focusout",t(this,m));const[u,O]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*O/u).toFixed(2)}%`,this.div.style.maxHeight=`${(100*u/O).toFixed(2)}%`);const[$,rt]=this.getInitialTranslation();return this.translate($,rt),(0,l.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(u){const{isMac:O}=M.FeatureTest.platform;if(u.button!==0||u.ctrlKey&&O){u.preventDefault();return}st(this,L,!0),V(this,E,pi).call(this,u)}moveInDOM(){this.parent.moveEditorInDOM(this)}_setParentAndPosition(u,O,$){u.changeParent(this),this.x=O,this.y=$,this.fixAndSetPosition(),this.moveInDOM()}getRect(u,O){const $=this.parentScale,[rt,mt]=this.pageDimensions,[d,e]=this.pageTranslation,i=u/$,o=O/$,C=this.x*rt,y=this.y*mt,N=this.width*rt,j=this.height*mt;switch(this.rotation){case 0:return[C+i+d,mt-y-o-j+e,C+i+N+d,mt-y-o+e];case 90:return[C+o+d,mt-y+i+e,C+o+j+d,mt-y+i+N+e];case 180:return[C-i-N+d,mt-y+o+e,C-i+d,mt-y+o+j+e];case 270:return[C-o-j+d,mt-y-i-N+e,C-o+d,mt-y-i+e];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(u,O){const[$,rt,mt,d]=u,e=mt-$,i=d-rt;switch(this.rotation){case 0:return[$,O-d,e,i];case 90:return[$,O-rt,i,e];case 180:return[mt,O-rt,e,i];case 270:return[mt,O-d,i,e];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){st(this,R,!0)}disableEditMode(){st(this,R,!1)}isInEditMode(){return t(this,R)}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var u,O;(u=this.div)==null||u.addEventListener("focusin",t(this,D)),(O=this.div)==null||O.addEventListener("focusout",t(this,m))}serialize(u=!1,O=null){(0,M.unreachable)("An editor must be serializable")}static deserialize(u,O,$){const rt=new this.prototype.constructor({parent:O,id:O.getNextId(),uiManager:$});rt.rotation=u.rotation;const[mt,d]=rt.pageDimensions,[e,i,o,C]=rt.getRectInCurrentCoords(u.rect,d);return rt.x=e/mt,rt.y=i/d,rt.width=o/mt,rt.height=C/d,rt}remove(){this.div.removeEventListener("focusin",t(this,D)),this.div.removeEventListener("focusout",t(this,m)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this)}get isResizable(){return!1}makeResizable(){this.isResizable&&(V(this,f,di).call(this),t(this,H).classList.remove("hidden"))}select(){var u;this.makeResizable(),(u=this.div)==null||u.classList.add("selectedEditor")}unselect(){var u,O,$;(u=t(this,H))==null||u.classList.add("hidden"),(O=this.div)==null||O.classList.remove("selectedEditor"),($=this.div)!=null&&$.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(u,O){}disableEditing(){}enableEditing(){}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return t(this,U)}set isEditing(u){st(this,U,u),this.parent&&(u?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(u,O){st(this,bt,!0);const $=u/O,{style:rt}=this.div;rt.aspectRatio=$,rt.height="auto"}static get MIN_SIZE(){return 16}};bt=new WeakMap,H=new WeakMap,D=new WeakMap,m=new WeakMap,L=new WeakMap,U=new WeakMap,R=new WeakMap,S=new WeakMap,v=new WeakMap,c=new WeakSet,Me=function([u,O],$,rt){[$,rt]=this.screenToPageTranslation($,rt),this.x+=$/u,this.y+=rt/O,this.fixAndSetPosition()},w=new WeakSet,De=function(u,O,$){switch($){case 90:return[O,-u];case 180:return[-u,-O];case 270:return[-O,u];default:return[u,O]}},A=new WeakSet,Ie=function(u){switch(u){case 90:{const[O,$]=this.pageDimensions;return[0,-O/$,$/O,0]}case 180:return[-1,0,0,-1];case 270:{const[O,$]=this.pageDimensions;return[0,O/$,-$/O,0]}default:return[1,0,0,1]}},r=new WeakSet,hi=function(u){u.preventDefault()},f=new WeakSet,di=function(){if(t(this,H))return;st(this,H,document.createElement("div")),t(this,H).classList.add("resizers");const u=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||u.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const O of u){const $=document.createElement("div");t(this,H).append($),$.classList.add("resizer",O),$.addEventListener("pointerdown",V(this,x,ui).bind(this,O)),$.addEventListener("contextmenu",V(nt,r,hi))}this.div.prepend(t(this,H))},x=new WeakSet,ui=function(u,O){O.preventDefault();const{isMac:$}=M.FeatureTest.platform;if(O.button!==0||O.ctrlKey&&$)return;const rt=V(this,W,fi).bind(this,u),mt=this._isDraggable;this._isDraggable=!1;const d={passive:!0,capture:!0};window.addEventListener("pointermove",rt,d);const e=this.x,i=this.y,o=this.width,C=this.height,y=this.parent.div.style.cursor,N=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(O.target).cursor;const j=()=>{this._isDraggable=mt,window.removeEventListener("pointerup",j),window.removeEventListener("blur",j),window.removeEventListener("pointermove",rt,d),this.parent.div.style.cursor=y,this.div.style.cursor=N;const Y=this.x,dt=this.y,at=this.width,lt=this.height;Y===e&&dt===i&&at===o&<===C||this.addCommands({cmd:()=>{this.width=at,this.height=lt,this.x=Y,this.y=dt;const[ut,kt]=this.parentDimensions;this.setDims(ut*at,kt*lt),this.fixAndSetPosition(),this.moveInDOM()},undo:()=>{this.width=o,this.height=C,this.x=e,this.y=i;const[ut,kt]=this.parentDimensions;this.setDims(ut*o,kt*C),this.fixAndSetPosition(),this.moveInDOM()},mustExec:!0})};window.addEventListener("pointerup",j),window.addEventListener("blur",j)},W=new WeakSet,fi=function(u,O){const[$,rt]=this.parentDimensions,mt=this.x,d=this.y,e=this.width,i=this.height,o=nt.MIN_SIZE/$,C=nt.MIN_SIZE/rt,y=Rt=>Math.round(Rt*1e4)/1e4,N=V(this,A,Ie).call(this,this.rotation),j=(Rt,Dt)=>[N[0]*Rt+N[2]*Dt,N[1]*Rt+N[3]*Dt],Y=V(this,A,Ie).call(this,360-this.rotation),dt=(Rt,Dt)=>[Y[0]*Rt+Y[2]*Dt,Y[1]*Rt+Y[3]*Dt];let at,lt,ut=!1,kt=!1;switch(u){case"topLeft":ut=!0,at=(Rt,Dt)=>[0,0],lt=(Rt,Dt)=>[Rt,Dt];break;case"topMiddle":at=(Rt,Dt)=>[Rt/2,0],lt=(Rt,Dt)=>[Rt/2,Dt];break;case"topRight":ut=!0,at=(Rt,Dt)=>[Rt,0],lt=(Rt,Dt)=>[0,Dt];break;case"middleRight":kt=!0,at=(Rt,Dt)=>[Rt,Dt/2],lt=(Rt,Dt)=>[0,Dt/2];break;case"bottomRight":ut=!0,at=(Rt,Dt)=>[Rt,Dt],lt=(Rt,Dt)=>[0,0];break;case"bottomMiddle":at=(Rt,Dt)=>[Rt/2,Dt],lt=(Rt,Dt)=>[Rt/2,0];break;case"bottomLeft":ut=!0,at=(Rt,Dt)=>[0,Dt],lt=(Rt,Dt)=>[Rt,0];break;case"middleLeft":kt=!0,at=(Rt,Dt)=>[0,Dt/2],lt=(Rt,Dt)=>[Rt,Dt/2];break}const Et=at(e,i),Ot=lt(e,i);let Bt=j(...Ot);const xt=y(mt+Bt[0]),Ut=y(d+Bt[1]);let Ct=1,it=1,[tt,ft]=this.screenToPageTranslation(O.movementX,O.movementY);if([tt,ft]=dt(tt/$,ft/rt),ut){const Rt=Math.hypot(e,i);Ct=it=Math.max(Math.min(Math.hypot(Ot[0]-Et[0]-tt,Ot[1]-Et[1]-ft)/Rt,1/e,1/i),o/e,C/i)}else kt?Ct=Math.max(o,Math.min(1,Math.abs(Ot[0]-Et[0]-tt)))/e:it=Math.max(C,Math.min(1,Math.abs(Ot[1]-Et[1]-ft)))/i;const Ft=y(e*Ct),Mt=y(i*it);Bt=j(...lt(Ft,Mt));const Ht=xt-Bt[0],Wt=Ut-Bt[1];this.width=Ft,this.height=Mt,this.x=Ht,this.y=Wt,this.setDims($*Ft,rt*Mt),this.fixAndSetPosition()},E=new WeakSet,pi=function(u){if(!this._isDraggable)return;const O=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let $,rt;O&&($={passive:!0,capture:!0},rt=d=>{const[e,i]=this.screenToPageTranslation(d.movementX,d.movementY);this._uiManager.dragSelectedEditors(e,i)},window.addEventListener("pointermove",rt,$));const mt=()=>{if(window.removeEventListener("pointerup",mt),window.removeEventListener("blur",mt),O&&window.removeEventListener("pointermove",rt,$),st(this,L,!1),!this._uiManager.endDragSession()){const{isMac:d}=M.FeatureTest.platform;u.ctrlKey&&!d||u.shiftKey||u.metaKey&&d?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",mt),window.addEventListener("blur",mt)},I(nt,w),I(nt,r),Yt(nt,"_colorManager",new l.ColorManager),Yt(nt,"_zIndex",1);let ht=nt;h.AnnotationEditor=ht;class K extends ht{constructor(u){super(u),this.annotationElementId=u.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}},(wt,h,ct)=>{var R,S,v,c,_,Oe,A,n,r,F,f,gi,g,W,z,E,X,nt,ot,u,O,$,rt,mt,d,e,i,o,C,y,N,j,Y,dt,at,lt,ut,kt,Et,Ot,Bt,xt,Ut,Ct,it,tt,ft,mi,Mt,Le,Wt,bi,Dt,Ne,jt,_i,G,Ai,Tt,ee,Nt,de,Jt,yi,vt,vi,St,Ue,a,ue,T,Be;Object.defineProperty(h,"__esModule",{value:!0}),h.KeyboardManager=h.CommandManager=h.ColorManager=h.AnnotationEditorUIManager=void 0,h.bindEvents=ht,h.opacityToHex=K;var l=ct(1),M=ct(6);function ht(_t,b,q){for(const et of q)b.addEventListener(et,_t[et].bind(_t))}function K(_t){return Math.round(Math.min(255,Math.max(1,255*_t))).toString(16).padStart(2,"0")}class bt{constructor(){I(this,R,0)}getId(){return`${l.AnnotationEditorPrefix}${he(this,R)._++}`}}R=new WeakMap;const P=class P{constructor(){I(this,_);I(this,S,(0,l.getUuid)());I(this,v,0);I(this,c,null)}static get _isSVGFittingCanvas(){const b='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',et=new OffscreenCanvas(1,3).getContext("2d"),yt=new Image;yt.src=b;const gt=yt.decode().then(()=>(et.drawImage(yt,0,0,1,1,0,0,1,3),new Uint32Array(et.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,l.shadow)(this,"_isSVGFittingCanvas",gt)}async getFromFile(b){const{lastModified:q,name:et,size:yt,type:gt}=b;return V(this,_,Oe).call(this,`${q}_${et}_${yt}_${gt}`,b)}async getFromUrl(b){return V(this,_,Oe).call(this,b,b)}async getFromId(b){t(this,c)||st(this,c,new Map);const q=t(this,c).get(b);return q?q.bitmap?(q.refCounter+=1,q):q.file?this.getFromFile(q.file):this.getFromUrl(q.url):null}getSvgUrl(b){const q=t(this,c).get(b);return q!=null&&q.isSvg?q.svgUrl:null}deleteId(b){t(this,c)||st(this,c,new Map);const q=t(this,c).get(b);q&&(q.refCounter-=1,q.refCounter===0&&(q.bitmap=null))}isValidId(b){return b.startsWith(`image_${t(this,S)}_`)}};S=new WeakMap,v=new WeakMap,c=new WeakMap,_=new WeakSet,Oe=async function(b,q){t(this,c)||st(this,c,new Map);let et=t(this,c).get(b);if(et===null)return null;if(et!=null&&et.bitmap)return et.refCounter+=1,et;try{et||(et={bitmap:null,id:`image_${t(this,S)}_${he(this,v)._++}`,refCounter:0,isSvg:!1});let yt;if(typeof q=="string"){et.url=q;const gt=await fetch(q);if(!gt.ok)throw new Error(gt.statusText);yt=await gt.blob()}else yt=et.file=q;if(yt.type==="image/svg+xml"){const gt=P._isSVGFittingCanvas,At=new FileReader,Pt=new Image,It=new Promise((Xt,qt)=>{Pt.onload=()=>{et.bitmap=Pt,et.isSvg=!0,Xt()},At.onload=async()=>{const Kt=et.svgUrl=At.result;Pt.src=await gt?`${Kt}#svgView(preserveAspectRatio(none))`:Kt},Pt.onerror=At.onerror=qt});At.readAsDataURL(yt),await It}else et.bitmap=await createImageBitmap(yt);et.refCounter=1}catch(yt){console.error(yt),et=null}return t(this,c).set(b,et),et&&t(this,c).set(et.id,et),et};let H=P;class D{constructor(b=128){I(this,A,[]);I(this,n,!1);I(this,r,void 0);I(this,F,-1);st(this,r,b)}add({cmd:b,undo:q,mustExec:et,type:yt=NaN,overwriteIfSameType:gt=!1,keepUndo:At=!1}){if(et&&b(),t(this,n))return;const Pt={cmd:b,undo:q,type:yt};if(t(this,F)===-1){t(this,A).length>0&&(t(this,A).length=0),st(this,F,0),t(this,A).push(Pt);return}if(gt&&t(this,A)[t(this,F)].type===yt){At&&(Pt.undo=t(this,A)[t(this,F)].undo),t(this,A)[t(this,F)]=Pt;return}const It=t(this,F)+1;It===t(this,r)?t(this,A).splice(0,1):(st(this,F,It),It<t(this,A).length&&t(this,A).splice(It)),t(this,A).push(Pt)}undo(){t(this,F)!==-1&&(st(this,n,!0),t(this,A)[t(this,F)].undo(),st(this,n,!1),st(this,F,t(this,F)-1))}redo(){t(this,F)<t(this,A).length-1&&(st(this,F,t(this,F)+1),st(this,n,!0),t(this,A)[t(this,F)].cmd(),st(this,n,!1))}hasSomethingToUndo(){return t(this,F)!==-1}hasSomethingToRedo(){return t(this,F)<t(this,A).length-1}destroy(){st(this,A,null)}}A=new WeakMap,n=new WeakMap,r=new WeakMap,F=new WeakMap,h.CommandManager=D;class m{constructor(b){I(this,f);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:q}=l.FeatureTest.platform;for(const[et,yt,gt={}]of b)for(const At of et){const Pt=At.startsWith("mac+");q&&Pt?(this.callbacks.set(At.slice(4),{callback:yt,options:gt}),this.allKeys.add(At.split("+").at(-1))):!q&&!Pt&&(this.callbacks.set(At,{callback:yt,options:gt}),this.allKeys.add(At.split("+").at(-1)))}}exec(b,q){if(!this.allKeys.has(q.key))return;const et=this.callbacks.get(V(this,f,gi).call(this,q));if(!et)return;const{callback:yt,options:{bubbles:gt=!1,args:At=[],checker:Pt=null}}=et;Pt&&!Pt(b,q)||(yt.bind(b,...At)(),gt||(q.stopPropagation(),q.preventDefault()))}}f=new WeakSet,gi=function(b){b.altKey&&this.buffer.push("alt"),b.ctrlKey&&this.buffer.push("ctrl"),b.metaKey&&this.buffer.push("meta"),b.shiftKey&&this.buffer.push("shift"),this.buffer.push(b.key);const q=this.buffer.join("+");return this.buffer.length=0,q},h.KeyboardManager=m;const x=class x{get _colors(){const b=new Map([["CanvasText",null],["Canvas",null]]);return(0,M.getColorValues)(b),(0,l.shadow)(this,"_colors",b)}convert(b){const q=(0,M.getRGB)(b);if(!window.matchMedia("(forced-colors: active)").matches)return q;for(const[et,yt]of this._colors)if(yt.every((gt,At)=>gt===q[At]))return x._colorsMapping.get(et);return q}getHexCode(b){const q=this._colors.get(b);return q?l.Util.makeHexColor(...q):b}};Yt(x,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let L=x;h.ColorManager=L;const Z=class Z{constructor(b,q,et,yt,gt){I(this,ft);I(this,Mt);I(this,Wt);I(this,Dt);I(this,jt);I(this,G);I(this,Tt);I(this,Nt);I(this,Jt);I(this,vt);I(this,St);I(this,a);I(this,T);I(this,g,null);I(this,W,new Map);I(this,z,new Map);I(this,E,null);I(this,X,new D);I(this,nt,0);I(this,ot,new Set);I(this,u,null);I(this,O,null);I(this,$,new Set);I(this,rt,null);I(this,mt,null);I(this,d,new bt);I(this,e,!1);I(this,i,!1);I(this,o,null);I(this,C,l.AnnotationEditorType.NONE);I(this,y,new Set);I(this,N,null);I(this,j,this.blur.bind(this));I(this,Y,this.focus.bind(this));I(this,dt,this.copy.bind(this));I(this,at,this.cut.bind(this));I(this,lt,this.paste.bind(this));I(this,ut,this.keydown.bind(this));I(this,kt,this.onEditingAction.bind(this));I(this,Et,this.onPageChanging.bind(this));I(this,Ot,this.onScaleChanging.bind(this));I(this,Bt,this.onRotationChanging.bind(this));I(this,xt,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1});I(this,Ut,[0,0]);I(this,Ct,null);I(this,it,null);I(this,tt,null);st(this,it,b),st(this,tt,q),st(this,rt,et),t(this,rt)._on("editingaction",t(this,kt)),t(this,rt)._on("pagechanging",t(this,Et)),t(this,rt)._on("scalechanging",t(this,Ot)),t(this,rt)._on("rotationchanging",t(this,Bt)),st(this,E,yt.annotationStorage),st(this,mt,yt.filterFactory),st(this,N,gt),this.viewParameters={realScale:M.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}static get _keyboardManager(){const b=Z.prototype,q=gt=>{const{activeElement:At}=document;return At&&t(gt,it).contains(At)&>.hasSomethingToControl()},et=this.TRANSLATE_SMALL,yt=this.TRANSLATE_BIG;return(0,l.shadow)(this,"_keyboardManager",new m([[["ctrl+a","mac+meta+a"],b.selectAll],[["ctrl+z","mac+meta+z"],b.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],b.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],b.delete],[["Escape","mac+Escape"],b.unselectAll],[["ArrowLeft","mac+ArrowLeft"],b.translateSelectedEditors,{args:[-et,0],checker:q}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],b.translateSelectedEditors,{args:[-yt,0],checker:q}],[["ArrowRight","mac+ArrowRight"],b.translateSelectedEditors,{args:[et,0],checker:q}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],b.translateSelectedEditors,{args:[yt,0],checker:q}],[["ArrowUp","mac+ArrowUp"],b.translateSelectedEditors,{args:[0,-et],checker:q}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],b.translateSelectedEditors,{args:[0,-yt],checker:q}],[["ArrowDown","mac+ArrowDown"],b.translateSelectedEditors,{args:[0,et],checker:q}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],b.translateSelectedEditors,{args:[0,yt],checker:q}]]))}destroy(){V(this,Dt,Ne).call(this),V(this,Mt,Le).call(this),t(this,rt)._off("editingaction",t(this,kt)),t(this,rt)._off("pagechanging",t(this,Et)),t(this,rt)._off("scalechanging",t(this,Ot)),t(this,rt)._off("rotationchanging",t(this,Bt));for(const b of t(this,z).values())b.destroy();t(this,z).clear(),t(this,W).clear(),t(this,$).clear(),st(this,g,null),t(this,y).clear(),t(this,X).destroy()}get hcmFilter(){return(0,l.shadow)(this,"hcmFilter",t(this,N)?t(this,mt).addHCMFilter(t(this,N).foreground,t(this,N).background):"none")}onPageChanging({pageNumber:b}){st(this,nt,b-1)}focusMainContainer(){t(this,it).focus()}findParent(b,q){for(const et of t(this,z).values()){const{x:yt,y:gt,width:At,height:Pt}=et.div.getBoundingClientRect();if(b>=yt&&b<=yt+At&&q>=gt&&q<=gt+Pt)return et}return null}disableUserSelect(b=!1){t(this,tt).classList.toggle("noUserSelect",b)}addShouldRescale(b){t(this,$).add(b)}removeShouldRescale(b){t(this,$).delete(b)}onScaleChanging({scale:b}){this.commitOrRemove(),this.viewParameters.realScale=b*M.PixelsPerInch.PDF_TO_CSS_UNITS;for(const q of t(this,$))q.onScaleChanging()}onRotationChanging({pagesRotation:b}){this.commitOrRemove(),this.viewParameters.rotation=b}addToAnnotationStorage(b){!b.isEmpty()&&t(this,E)&&!t(this,E).has(b.id)&&t(this,E).setValue(b.id,b)}blur(){if(!this.hasSelection)return;const{activeElement:b}=document;for(const q of t(this,y))if(q.div.contains(b)){st(this,o,[q,b]),q._focusEventsAllowed=!1;break}}focus(){if(!t(this,o))return;const[b,q]=t(this,o);st(this,o,null),q.addEventListener("focusin",()=>{b._focusEventsAllowed=!0},{once:!0}),q.focus()}copy(b){var et;if(b.preventDefault(),(et=t(this,g))==null||et.commitOrRemove(),!this.hasSelection)return;const q=[];for(const yt of t(this,y)){const gt=yt.serialize(!0);gt&&q.push(gt)}q.length!==0&&b.clipboardData.setData("application/pdfjs",JSON.stringify(q))}cut(b){this.copy(b),this.delete()}paste(b){b.preventDefault();const{clipboardData:q}=b;for(const gt of q.items)for(const At of t(this,O))if(At.isHandlingMimeForPasting(gt.type)){At.paste(gt,this.currentLayer);return}let et=q.getData("application/pdfjs");if(!et)return;try{et=JSON.parse(et)}catch(gt){(0,l.warn)(`paste: "${gt.message}".`);return}if(!Array.isArray(et))return;this.unselectAll();const yt=this.currentLayer;try{const gt=[];for(const It of et){const Xt=yt.deserialize(It);if(!Xt)return;gt.push(Xt)}const At=()=>{for(const It of gt)V(this,St,Ue).call(this,It);V(this,T,Be).call(this,gt)},Pt=()=>{for(const It of gt)It.remove()};this.addCommands({cmd:At,undo:Pt,mustExec:!0})}catch(gt){(0,l.warn)(`paste: "${gt.message}".`)}}keydown(b){var q;(q=this.getActive())!=null&&q.shouldGetKeyboardEvents()||Z._keyboardManager.exec(this,b)}onEditingAction(b){["undo","redo","delete","selectAll"].includes(b.name)&&this[b.name]()}setEditingState(b){b?(V(this,ft,mi).call(this),V(this,Wt,bi).call(this),V(this,jt,_i).call(this),V(this,Tt,ee).call(this,{isEditing:t(this,C)!==l.AnnotationEditorType.NONE,isEmpty:V(this,a,ue).call(this),hasSomethingToUndo:t(this,X).hasSomethingToUndo(),hasSomethingToRedo:t(this,X).hasSomethingToRedo(),hasSelectedEditor:!1})):(V(this,Mt,Le).call(this),V(this,Dt,Ne).call(this),V(this,G,Ai).call(this),V(this,Tt,ee).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(b){if(!t(this,O)){st(this,O,b);for(const q of t(this,O))V(this,Nt,de).call(this,q.defaultPropertiesToUpdate)}}getId(){return t(this,d).getId()}get currentLayer(){return t(this,z).get(t(this,nt))}getLayer(b){return t(this,z).get(b)}get currentPageIndex(){return t(this,nt)}addLayer(b){t(this,z).set(b.pageIndex,b),t(this,e)?b.enable():b.disable()}removeLayer(b){t(this,z).delete(b.pageIndex)}updateMode(b,q=null){if(t(this,C)!==b){if(st(this,C,b),b===l.AnnotationEditorType.NONE){this.setEditingState(!1),V(this,vt,vi).call(this);return}this.setEditingState(!0),V(this,Jt,yi).call(this),this.unselectAll();for(const et of t(this,z).values())et.updateMode(b);if(q){for(const et of t(this,W).values())if(et.annotationElementId===q){this.setSelected(et),et.enterInEditMode();break}}}}updateToolbar(b){b!==t(this,C)&&t(this,rt).dispatch("switchannotationeditormode",{source:this,mode:b})}updateParams(b,q){if(t(this,O)){if(b===l.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(b);return}for(const et of t(this,y))et.updateParams(b,q);for(const et of t(this,O))et.updateDefaultParams(b,q)}}enableWaiting(b=!1){if(t(this,i)!==b){st(this,i,b);for(const q of t(this,z).values())b?q.disableClick():q.enableClick(),q.div.classList.toggle("waiting",b)}}getEditors(b){const q=[];for(const et of t(this,W).values())et.pageIndex===b&&q.push(et);return q}getEditor(b){return t(this,W).get(b)}addEditor(b){t(this,W).set(b.id,b)}removeEditor(b){var q;t(this,W).delete(b.id),this.unselect(b),(!b.annotationElementId||!t(this,ot).has(b.annotationElementId))&&((q=t(this,E))==null||q.remove(b.id))}addDeletedAnnotationElement(b){t(this,ot).add(b.annotationElementId),b.deleted=!0}isDeletedAnnotationElement(b){return t(this,ot).has(b)}removeDeletedAnnotationElement(b){t(this,ot).delete(b.annotationElementId),b.deleted=!1}setActiveEditor(b){t(this,g)!==b&&(st(this,g,b),b&&V(this,Nt,de).call(this,b.propertiesToUpdate))}toggleSelected(b){if(t(this,y).has(b)){t(this,y).delete(b),b.unselect(),V(this,Tt,ee).call(this,{hasSelectedEditor:this.hasSelection});return}t(this,y).add(b),b.select(),V(this,Nt,de).call(this,b.propertiesToUpdate),V(this,Tt,ee).call(this,{hasSelectedEditor:!0})}setSelected(b){for(const q of t(this,y))q!==b&&q.unselect();t(this,y).clear(),t(this,y).add(b),b.select(),V(this,Nt,de).call(this,b.propertiesToUpdate),V(this,Tt,ee).call(this,{hasSelectedEditor:!0})}isSelected(b){return t(this,y).has(b)}unselect(b){b.unselect(),t(this,y).delete(b),V(this,Tt,ee).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return t(this,y).size!==0}undo(){t(this,X).undo(),V(this,Tt,ee).call(this,{hasSomethingToUndo:t(this,X).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:V(this,a,ue).call(this)})}redo(){t(this,X).redo(),V(this,Tt,ee).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:t(this,X).hasSomethingToRedo(),isEmpty:V(this,a,ue).call(this)})}addCommands(b){t(this,X).add(b),V(this,Tt,ee).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:V(this,a,ue).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const b=[...t(this,y)],q=()=>{for(const yt of b)yt.remove()},et=()=>{for(const yt of b)V(this,St,Ue).call(this,yt)};this.addCommands({cmd:q,undo:et,mustExec:!0})}commitOrRemove(){var b;(b=t(this,g))==null||b.commitOrRemove()}hasSomethingToControl(){return t(this,g)||this.hasSelection}selectAll(){for(const b of t(this,y))b.commit();V(this,T,Be).call(this,t(this,W).values())}unselectAll(){if(t(this,g)){t(this,g).commitOrRemove();return}if(this.hasSelection){for(const b of t(this,y))b.unselect();t(this,y).clear(),V(this,Tt,ee).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(b,q,et=!1){if(et||this.commitOrRemove(),!this.hasSelection)return;t(this,Ut)[0]+=b,t(this,Ut)[1]+=q;const[yt,gt]=t(this,Ut),At=[...t(this,y)],Pt=1e3;t(this,Ct)&&clearTimeout(t(this,Ct)),st(this,Ct,setTimeout(()=>{st(this,Ct,null),t(this,Ut)[0]=t(this,Ut)[1]=0,this.addCommands({cmd:()=>{for(const It of At)t(this,W).has(It.id)&&It.translateInPage(yt,gt)},undo:()=>{for(const It of At)t(this,W).has(It.id)&&It.translateInPage(-yt,-gt)},mustExec:!1})},Pt));for(const It of At)It.translateInPage(b,q)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),st(this,u,new Map);for(const b of t(this,y))t(this,u).set(b,{savedX:b.x,savedY:b.y,savedPageIndex:b.parent.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!t(this,u))return!1;this.disableUserSelect(!1);const b=t(this,u);st(this,u,null);let q=!1;for(const[{x:yt,y:gt,parent:At},Pt]of b)Pt.newX=yt,Pt.newY=gt,Pt.newPageIndex=At.pageIndex,q||(q=yt!==Pt.savedX||gt!==Pt.savedY||At.pageIndex!==Pt.savedPageIndex);if(!q)return!1;const et=(yt,gt,At,Pt)=>{if(t(this,W).has(yt.id)){const It=t(this,z).get(Pt);It?yt._setParentAndPosition(It,gt,At):(yt.pageIndex=Pt,yt.x=gt,yt.y=At)}};return this.addCommands({cmd:()=>{for(const[yt,{newX:gt,newY:At,newPageIndex:Pt}]of b)et(yt,gt,At,Pt)},undo:()=>{for(const[yt,{savedX:gt,savedY:At,savedPageIndex:Pt}]of b)et(yt,gt,At,Pt)},mustExec:!0}),!0}dragSelectedEditors(b,q){if(t(this,u))for(const et of t(this,u).keys())et.drag(b,q)}rebuild(b){if(b.parent===null){const q=this.getLayer(b.pageIndex);q?(q.changeParent(b),q.addOrRebuild(b)):(this.addEditor(b),this.addToAnnotationStorage(b),b.rebuild())}else b.parent.addOrRebuild(b)}isActive(b){return t(this,g)===b}getActive(){return t(this,g)}getMode(){return t(this,C)}get imageManager(){return(0,l.shadow)(this,"imageManager",new H)}};g=new WeakMap,W=new WeakMap,z=new WeakMap,E=new WeakMap,X=new WeakMap,nt=new WeakMap,ot=new WeakMap,u=new WeakMap,O=new WeakMap,$=new WeakMap,rt=new WeakMap,mt=new WeakMap,d=new WeakMap,e=new WeakMap,i=new WeakMap,o=new WeakMap,C=new WeakMap,y=new WeakMap,N=new WeakMap,j=new WeakMap,Y=new WeakMap,dt=new WeakMap,at=new WeakMap,lt=new WeakMap,ut=new WeakMap,kt=new WeakMap,Et=new WeakMap,Ot=new WeakMap,Bt=new WeakMap,xt=new WeakMap,Ut=new WeakMap,Ct=new WeakMap,it=new WeakMap,tt=new WeakMap,ft=new WeakSet,mi=function(){window.addEventListener("focus",t(this,Y)),window.addEventListener("blur",t(this,j))},Mt=new WeakSet,Le=function(){window.removeEventListener("focus",t(this,Y)),window.removeEventListener("blur",t(this,j))},Wt=new WeakSet,bi=function(){window.addEventListener("keydown",t(this,ut),{capture:!0})},Dt=new WeakSet,Ne=function(){window.removeEventListener("keydown",t(this,ut),{capture:!0})},jt=new WeakSet,_i=function(){document.addEventListener("copy",t(this,dt)),document.addEventListener("cut",t(this,at)),document.addEventListener("paste",t(this,lt))},G=new WeakSet,Ai=function(){document.removeEventListener("copy",t(this,dt)),document.removeEventListener("cut",t(this,at)),document.removeEventListener("paste",t(this,lt))},Tt=new WeakSet,ee=function(b){Object.entries(b).some(([et,yt])=>t(this,xt)[et]!==yt)&&t(this,rt).dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(t(this,xt),b)})},Nt=new WeakSet,de=function(b){t(this,rt).dispatch("annotationeditorparamschanged",{source:this,details:b})},Jt=new WeakSet,yi=function(){if(!t(this,e)){st(this,e,!0);for(const b of t(this,z).values())b.enable()}},vt=new WeakSet,vi=function(){if(this.unselectAll(),t(this,e)){st(this,e,!1);for(const b of t(this,z).values())b.disable()}},St=new WeakSet,Ue=function(b){const q=t(this,z).get(b.pageIndex);q?q.addOrRebuild(b):this.addEditor(b)},a=new WeakSet,ue=function(){if(t(this,W).size===0)return!0;if(t(this,W).size===1)for(const b of t(this,W).values())return b.isEmpty();return!1},T=new WeakSet,Be=function(b){t(this,y).clear();for(const q of b)q.isEmpty()||(t(this,y).add(q),q.select());V(this,Tt,ee).call(this,{hasSelectedEditor:!0})},Yt(Z,"TRANSLATE_SMALL",1),Yt(Z,"TRANSLATE_BIG",10);let U=Z;h.AnnotationEditorUIManager=U},(wt,h,ct)=>{var ot,u,O,$,rt,mt,d,e,i,o,C,y,ae,j,oe,dt,je,lt,ye,kt,ve,Ot,fe,xt,pe;Object.defineProperty(h,"__esModule",{value:!0}),h.StatTimer=h.RenderingCancelledException=h.PixelsPerInch=h.PageViewport=h.PDFDateString=h.DOMStandardFontDataFactory=h.DOMSVGFactory=h.DOMFilterFactory=h.DOMCanvasFactory=h.DOMCMapReaderFactory=h.AnnotationPrefix=void 0,h.deprecated=F,h.getColorValues=W,h.getCurrentTransform=z,h.getCurrentTransformInverse=E,h.getFilenameFromUrl=w,h.getPdfFilenameFromUrl=P,h.getRGB=g,h.getXfaPageViewport=x,h.isDataScheme=c,h.isPdfFile=_,h.isValidFetchUrl=n,h.loadScript=r,h.setLayerDimensions=X;var l=ct(7),M=ct(1);const ht="http://www.w3.org/2000/svg",K="pdfjs_internal_id_";h.AnnotationPrefix=K;const nt=class nt{};Yt(nt,"CSS",96),Yt(nt,"PDF",72),Yt(nt,"PDF_TO_CSS_UNITS",nt.CSS/nt.PDF);let bt=nt;h.PixelsPerInch=bt;class H extends l.BaseFilterFactory{constructor({docId:tt,ownerDocument:ft=globalThis.document}={}){super();I(this,y);I(this,j);I(this,dt);I(this,lt);I(this,kt);I(this,Ot);I(this,xt);I(this,ot,void 0);I(this,u,void 0);I(this,O,void 0);I(this,$,void 0);I(this,rt,void 0);I(this,mt,void 0);I(this,d,void 0);I(this,e,void 0);I(this,i,void 0);I(this,o,void 0);I(this,C,0);st(this,O,tt),st(this,$,ft)}addFilter(tt){if(!tt)return"none";let ft=t(this,y,ae).get(tt);if(ft)return ft;let Ft,Mt,Ht,Wt;if(tt.length===1){const jt=tt[0],pt=new Array(256);for(let G=0;G<256;G++)pt[G]=jt[G]/255;Wt=Ft=Mt=Ht=pt.join(",")}else{const[jt,pt,G]=tt,J=new Array(256),Tt=new Array(256),zt=new Array(256);for(let Nt=0;Nt<256;Nt++)J[Nt]=jt[Nt]/255,Tt[Nt]=pt[Nt]/255,zt[Nt]=G[Nt]/255;Ft=J.join(","),Mt=Tt.join(","),Ht=zt.join(","),Wt=`${Ft}${Mt}${Ht}`}if(ft=t(this,y,ae).get(Wt),ft)return t(this,y,ae).set(tt,ft),ft;const Rt=`g_${t(this,O)}_transfer_map_${he(this,C)._++}`,Dt=`url(#${Rt})`;t(this,y,ae).set(tt,Dt),t(this,y,ae).set(Wt,Dt);const Gt=V(this,lt,ye).call(this,Rt);return V(this,Ot,fe).call(this,Ft,Mt,Ht,Gt),Dt}addHCMFilter(tt,ft){var pt;const Ft=`${tt}-${ft}`;if(t(this,mt)===Ft)return t(this,d);if(st(this,mt,Ft),st(this,d,"none"),(pt=t(this,rt))==null||pt.remove(),!tt||!ft)return t(this,d);const Mt=V(this,xt,pe).call(this,tt);tt=M.Util.makeHexColor(...Mt);const Ht=V(this,xt,pe).call(this,ft);if(ft=M.Util.makeHexColor(...Ht),t(this,j,oe).style.color="",tt==="#000000"&&ft==="#ffffff"||tt===ft)return t(this,d);const Wt=new Array(256);for(let G=0;G<=255;G++){const J=G/255;Wt[G]=J<=.03928?J/12.92:((J+.055)/1.055)**2.4}const Rt=Wt.join(","),Dt=`g_${t(this,O)}_hcm_filter`,Gt=st(this,e,V(this,lt,ye).call(this,Dt));V(this,Ot,fe).call(this,Rt,Rt,Rt,Gt),V(this,dt,je).call(this,Gt);const jt=(G,J)=>{const Tt=Mt[G]/255,zt=Ht[G]/255,Nt=new Array(J+1);for(let $t=0;$t<=J;$t++)Nt[$t]=Tt+$t/J*(zt-Tt);return Nt.join(",")};return V(this,Ot,fe).call(this,jt(0,5),jt(1,5),jt(2,5),Gt),st(this,d,`url(#${Dt})`),t(this,d)}addHighlightHCMFilter(tt,ft,Ft,Mt){var zt;const Ht=`${tt}-${ft}-${Ft}-${Mt}`;if(t(this,i)===Ht)return t(this,o);if(st(this,i,Ht),st(this,o,"none"),(zt=t(this,e))==null||zt.remove(),!tt||!ft)return t(this,o);const[Wt,Rt]=[tt,ft].map(V(this,xt,pe).bind(this));let Dt=Math.round(.2126*Wt[0]+.7152*Wt[1]+.0722*Wt[2]),Gt=Math.round(.2126*Rt[0]+.7152*Rt[1]+.0722*Rt[2]),[jt,pt]=[Ft,Mt].map(V(this,xt,pe).bind(this));Gt<Dt&&([Dt,Gt,jt,pt]=[Gt,Dt,pt,jt]),t(this,j,oe).style.color="";const G=(Nt,$t,Jt)=>{const Q=new Array(256),vt=(Gt-Dt)/Jt,Lt=Nt/255,St=($t-Nt)/(255*Jt);let p=0;for(let a=0;a<=Jt;a++){const k=Math.round(Dt+a*vt),T=Lt+a*St;for(let B=p;B<=k;B++)Q[B]=T;p=k+1}for(let a=p;a<256;a++)Q[a]=Q[p-1];return Q.join(",")},J=`g_${t(this,O)}_hcm_highlight_filter`,Tt=st(this,e,V(this,lt,ye).call(this,J));return V(this,dt,je).call(this,Tt),V(this,Ot,fe).call(this,G(jt[0],pt[0],5),G(jt[1],pt[1],5),G(jt[2],pt[2],5),Tt),st(this,o,`url(#${J})`),t(this,o)}destroy(tt=!1){tt&&(t(this,d)||t(this,o))||(t(this,u)&&(t(this,u).parentNode.parentNode.remove(),st(this,u,null)),t(this,ot)&&(t(this,ot).clear(),st(this,ot,null)),st(this,C,0))}}ot=new WeakMap,u=new WeakMap,O=new WeakMap,$=new WeakMap,rt=new WeakMap,mt=new WeakMap,d=new WeakMap,e=new WeakMap,i=new WeakMap,o=new WeakMap,C=new WeakMap,y=new WeakSet,ae=function(){return t(this,ot)||st(this,ot,new Map)},j=new WeakSet,oe=function(){if(!t(this,u)){const tt=t(this,$).createElement("div"),{style:ft}=tt;ft.visibility="hidden",ft.contain="strict",ft.width=ft.height=0,ft.position="absolute",ft.top=ft.left=0,ft.zIndex=-1;const Ft=t(this,$).createElementNS(ht,"svg");Ft.setAttribute("width",0),Ft.setAttribute("height",0),st(this,u,t(this,$).createElementNS(ht,"defs")),tt.append(Ft),Ft.append(t(this,u)),t(this,$).body.append(tt)}return t(this,u)},dt=new WeakSet,je=function(tt){const ft=t(this,$).createElementNS(ht,"feColorMatrix");ft.setAttribute("type","matrix"),ft.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"),tt.append(ft)},lt=new WeakSet,ye=function(tt){const ft=t(this,$).createElementNS(ht,"filter");return ft.setAttribute("color-interpolation-filters","sRGB"),ft.setAttribute("id",tt),t(this,j,oe).append(ft),ft},kt=new WeakSet,ve=function(tt,ft,Ft){const Mt=t(this,$).createElementNS(ht,ft);Mt.setAttribute("type","discrete"),Mt.setAttribute("tableValues",Ft),tt.append(Mt)},Ot=new WeakSet,fe=function(tt,ft,Ft,Mt){const Ht=t(this,$).createElementNS(ht,"feComponentTransfer");Mt.append(Ht),V(this,kt,ve).call(this,Ht,"feFuncR",tt),V(this,kt,ve).call(this,Ht,"feFuncG",ft),V(this,kt,ve).call(this,Ht,"feFuncB",Ft)},xt=new WeakSet,pe=function(tt){return t(this,j,oe).style.color=tt,g(getComputedStyle(t(this,j,oe)).getPropertyValue("color"))},h.DOMFilterFactory=H;class D extends l.BaseCanvasFactory{constructor({ownerDocument:it=globalThis.document}={}){super(),this._document=it}_createCanvas(it,tt){const ft=this._document.createElement("canvas");return ft.width=it,ft.height=tt,ft}}h.DOMCanvasFactory=D;async function m(Ct,it=!1){if(n(Ct,document.baseURI)){const tt=await fetch(Ct);if(!tt.ok)throw new Error(tt.statusText);return it?new Uint8Array(await tt.arrayBuffer()):(0,M.stringToBytes)(await tt.text())}return new Promise((tt,ft)=>{const Ft=new XMLHttpRequest;Ft.open("GET",Ct,!0),it&&(Ft.responseType="arraybuffer"),Ft.onreadystatechange=()=>{if(Ft.readyState===XMLHttpRequest.DONE){if(Ft.status===200||Ft.status===0){let Mt;if(it&&Ft.response?Mt=new Uint8Array(Ft.response):!it&&Ft.responseText&&(Mt=(0,M.stringToBytes)(Ft.responseText)),Mt){tt(Mt);return}}ft(new Error(Ft.statusText))}},Ft.send(null)})}class L extends l.BaseCMapReaderFactory{_fetchData(it,tt){return m(it,this.isCompressed).then(ft=>({cMapData:ft,compressionType:tt}))}}h.DOMCMapReaderFactory=L;class U extends l.BaseStandardFontDataFactory{_fetchData(it){return m(it,!0)}}h.DOMStandardFontDataFactory=U;class R extends l.BaseSVGFactory{_createSVG(it){return document.createElementNS(ht,it)}}h.DOMSVGFactory=R;class S{constructor({viewBox:it,scale:tt,rotation:ft,offsetX:Ft=0,offsetY:Mt=0,dontFlip:Ht=!1}){this.viewBox=it,this.scale=tt,this.rotation=ft,this.offsetX=Ft,this.offsetY=Mt;const Wt=(it[2]+it[0])/2,Rt=(it[3]+it[1])/2;let Dt,Gt,jt,pt;switch(ft%=360,ft<0&&(ft+=360),ft){case 180:Dt=-1,Gt=0,jt=0,pt=1;break;case 90:Dt=0,Gt=1,jt=1,pt=0;break;case 270:Dt=0,Gt=-1,jt=-1,pt=0;break;case 0:Dt=1,Gt=0,jt=0,pt=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}Ht&&(jt=-jt,pt=-pt);let G,J,Tt,zt;Dt===0?(G=Math.abs(Rt-it[1])*tt+Ft,J=Math.abs(Wt-it[0])*tt+Mt,Tt=(it[3]-it[1])*tt,zt=(it[2]-it[0])*tt):(G=Math.abs(Wt-it[0])*tt+Ft,J=Math.abs(Rt-it[1])*tt+Mt,Tt=(it[2]-it[0])*tt,zt=(it[3]-it[1])*tt),this.transform=[Dt*tt,Gt*tt,jt*tt,pt*tt,G-Dt*tt*Wt-jt*tt*Rt,J-Gt*tt*Wt-pt*tt*Rt],this.width=Tt,this.height=zt}get rawDims(){const{viewBox:it}=this;return(0,M.shadow)(this,"rawDims",{pageWidth:it[2]-it[0],pageHeight:it[3]-it[1],pageX:it[0],pageY:it[1]})}clone({scale:it=this.scale,rotation:tt=this.rotation,offsetX:ft=this.offsetX,offsetY:Ft=this.offsetY,dontFlip:Mt=!1}={}){return new S({viewBox:this.viewBox.slice(),scale:it,rotation:tt,offsetX:ft,offsetY:Ft,dontFlip:Mt})}convertToViewportPoint(it,tt){return M.Util.applyTransform([it,tt],this.transform)}convertToViewportRectangle(it){const tt=M.Util.applyTransform([it[0],it[1]],this.transform),ft=M.Util.applyTransform([it[2],it[3]],this.transform);return[tt[0],tt[1],ft[0],ft[1]]}convertToPdfPoint(it,tt){return M.Util.applyInverseTransform([it,tt],this.transform)}}h.PageViewport=S;class v extends M.BaseException{constructor(it,tt=0){super(it,"RenderingCancelledException"),this.extraDelay=tt}}h.RenderingCancelledException=v;function c(Ct){const it=Ct.length;let tt=0;for(;tt<it&&Ct[tt].trim()==="";)tt++;return Ct.substring(tt,tt+5).toLowerCase()==="data:"}function _(Ct){return typeof Ct=="string"&&/\.pdf$/i.test(Ct)}function w(Ct,it=!1){return it||([Ct]=Ct.split(/[#?]/,1)),Ct.substring(Ct.lastIndexOf("/")+1)}function P(Ct,it="document.pdf"){if(typeof Ct!="string")return it;if(c(Ct))return(0,M.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),it;const tt=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,ft=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,Ft=tt.exec(Ct);let Mt=ft.exec(Ft[1])||ft.exec(Ft[2])||ft.exec(Ft[3]);if(Mt&&(Mt=Mt[0],Mt.includes("%")))try{Mt=ft.exec(decodeURIComponent(Mt))[0]}catch{}return Mt||it}class A{constructor(){Yt(this,"started",Object.create(null));Yt(this,"times",[])}time(it){it in this.started&&(0,M.warn)(`Timer is already running for ${it}`),this.started[it]=Date.now()}timeEnd(it){it in this.started||(0,M.warn)(`Timer has not been started for ${it}`),this.times.push({name:it,start:this.started[it],end:Date.now()}),delete this.started[it]}toString(){const it=[];let tt=0;for(const{name:ft}of this.times)tt=Math.max(ft.length,tt);for(const{name:ft,start:Ft,end:Mt}of this.times)it.push(`${ft.padEnd(tt)} ${Mt-Ft}ms
- `);return it.join("")}}h.StatTimer=A;function n(Ct,it){try{const{protocol:tt}=it?new URL(Ct,it):new URL(Ct);return tt==="http:"||tt==="https:"}catch{return!1}}function r(Ct,it=!1){return new Promise((tt,ft)=>{const Ft=document.createElement("script");Ft.src=Ct,Ft.onload=function(Mt){it&&Ft.remove(),tt(Mt)},Ft.onerror=function(){ft(new Error(`Cannot load script at: ${Ft.src}`))},(document.head||document.documentElement).append(Ft)})}function F(Ct){console.log("Deprecated API usage: "+Ct)}let f;class s{static toDateObject(it){if(!it||typeof it!="string")return null;f||(f=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const tt=f.exec(it);if(!tt)return null;const ft=parseInt(tt[1],10);let Ft=parseInt(tt[2],10);Ft=Ft>=1&&Ft<=12?Ft-1:0;let Mt=parseInt(tt[3],10);Mt=Mt>=1&&Mt<=31?Mt:1;let Ht=parseInt(tt[4],10);Ht=Ht>=0&&Ht<=23?Ht:0;let Wt=parseInt(tt[5],10);Wt=Wt>=0&&Wt<=59?Wt:0;let Rt=parseInt(tt[6],10);Rt=Rt>=0&&Rt<=59?Rt:0;const Dt=tt[7]||"Z";let Gt=parseInt(tt[8],10);Gt=Gt>=0&&Gt<=23?Gt:0;let jt=parseInt(tt[9],10)||0;return jt=jt>=0&&jt<=59?jt:0,Dt==="-"?(Ht+=Gt,Wt+=jt):Dt==="+"&&(Ht-=Gt,Wt-=jt),new Date(Date.UTC(ft,Ft,Mt,Ht,Wt,Rt))}}h.PDFDateString=s;function x(Ct,{scale:it=1,rotation:tt=0}){const{width:ft,height:Ft}=Ct.attributes.style,Mt=[0,0,parseInt(ft),parseInt(Ft)];return new S({viewBox:Mt,scale:it,rotation:tt})}function g(Ct){if(Ct.startsWith("#")){const it=parseInt(Ct.slice(1),16);return[(it&16711680)>>16,(it&65280)>>8,it&255]}return Ct.startsWith("rgb(")?Ct.slice(4,-1).split(",").map(it=>parseInt(it)):Ct.startsWith("rgba(")?Ct.slice(5,-1).split(",").map(it=>parseInt(it)).slice(0,3):((0,M.warn)(`Not a valid color format: "${Ct}"`),[0,0,0])}function W(Ct){const it=document.createElement("span");it.style.visibility="hidden",document.body.append(it);for(const tt of Ct.keys()){it.style.color=tt;const ft=window.getComputedStyle(it).color;Ct.set(tt,g(ft))}it.remove()}function z(Ct){const{a:it,b:tt,c:ft,d:Ft,e:Mt,f:Ht}=Ct.getTransform();return[it,tt,ft,Ft,Mt,Ht]}function E(Ct){const{a:it,b:tt,c:ft,d:Ft,e:Mt,f:Ht}=Ct.getTransform().invertSelf();return[it,tt,ft,Ft,Mt,Ht]}function X(Ct,it,tt=!1,ft=!0){if(it instanceof S){const{pageWidth:Ft,pageHeight:Mt}=it.rawDims,{style:Ht}=Ct,Wt=M.FeatureTest.isCSSRoundSupported,Rt=`var(--scale-factor) * ${Ft}px`,Dt=`var(--scale-factor) * ${Mt}px`,Gt=Wt?`round(${Rt}, 1px)`:`calc(${Rt})`,jt=Wt?`round(${Dt}, 1px)`:`calc(${Dt})`;!tt||it.rotation%180===0?(Ht.width=Gt,Ht.height=jt):(Ht.width=jt,Ht.height=Gt)}ft&&Ct.setAttribute("data-main-rotation",it.rotation)}},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.BaseStandardFontDataFactory=h.BaseSVGFactory=h.BaseFilterFactory=h.BaseCanvasFactory=h.BaseCMapReaderFactory=void 0;var l=ct(1);class M{constructor(){this.constructor===M&&(0,l.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(m){return"none"}addHCMFilter(m,L){return"none"}addHighlightHCMFilter(m,L,U,R){return"none"}destroy(m=!1){}}h.BaseFilterFactory=M;class ht{constructor(){this.constructor===ht&&(0,l.unreachable)("Cannot initialize BaseCanvasFactory.")}create(m,L){if(m<=0||L<=0)throw new Error("Invalid canvas size");const U=this._createCanvas(m,L);return{canvas:U,context:U.getContext("2d")}}reset(m,L,U){if(!m.canvas)throw new Error("Canvas is not specified");if(L<=0||U<=0)throw new Error("Invalid canvas size");m.canvas.width=L,m.canvas.height=U}destroy(m){if(!m.canvas)throw new Error("Canvas is not specified");m.canvas.width=0,m.canvas.height=0,m.canvas=null,m.context=null}_createCanvas(m,L){(0,l.unreachable)("Abstract method `_createCanvas` called.")}}h.BaseCanvasFactory=ht;class K{constructor({baseUrl:m=null,isCompressed:L=!0}){this.constructor===K&&(0,l.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=m,this.isCompressed=L}async fetch({name:m}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!m)throw new Error("CMap name must be specified.");const L=this.baseUrl+m+(this.isCompressed?".bcmap":""),U=this.isCompressed?l.CMapCompressionType.BINARY:l.CMapCompressionType.NONE;return this._fetchData(L,U).catch(R=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${L}`)})}_fetchData(m,L){(0,l.unreachable)("Abstract method `_fetchData` called.")}}h.BaseCMapReaderFactory=K;class bt{constructor({baseUrl:m=null}){this.constructor===bt&&(0,l.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=m}async fetch({filename:m}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!m)throw new Error("Font filename must be specified.");const L=`${this.baseUrl}${m}`;return this._fetchData(L).catch(U=>{throw new Error(`Unable to load font data at: ${L}`)})}_fetchData(m){(0,l.unreachable)("Abstract method `_fetchData` called.")}}h.BaseStandardFontDataFactory=bt;class H{constructor(){this.constructor===H&&(0,l.unreachable)("Cannot initialize BaseSVGFactory.")}create(m,L,U=!1){if(m<=0||L<=0)throw new Error("Invalid SVG dimensions");const R=this._createSVG("svg:svg");return R.setAttribute("version","1.1"),U||(R.setAttribute("width",`${m}px`),R.setAttribute("height",`${L}px`)),R.setAttribute("preserveAspectRatio","none"),R.setAttribute("viewBox",`0 0 ${m} ${L}`),R}createElement(m){if(typeof m!="string")throw new Error("Invalid SVG element type");return this._createSVG(m)}_createSVG(m){(0,l.unreachable)("Abstract method `_createSVG` called.")}}h.BaseSVGFactory=H},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.MurmurHash3_64=void 0;var l=ct(1);const M=3285377520,ht=4294901760,K=65535;class bt{constructor(D){this.h1=D?D&4294967295:M,this.h2=D?D&4294967295:M}update(D){let m,L;if(typeof D=="string"){m=new Uint8Array(D.length*2),L=0;for(let F=0,f=D.length;F<f;F++){const s=D.charCodeAt(F);s<=255?m[L++]=s:(m[L++]=s>>>8,m[L++]=s&255)}}else if((0,l.isArrayBuffer)(D))m=D.slice(),L=m.byteLength;else throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");const U=L>>2,R=L-U*4,S=new Uint32Array(m.buffer,0,U);let v=0,c=0,_=this.h1,w=this.h2;const P=3432918353,A=461845907,n=P&K,r=A&K;for(let F=0;F<U;F++)F&1?(v=S[F],v=v*P&ht|v*n&K,v=v<<15|v>>>17,v=v*A&ht|v*r&K,_^=v,_=_<<13|_>>>19,_=_*5+3864292196):(c=S[F],c=c*P&ht|c*n&K,c=c<<15|c>>>17,c=c*A&ht|c*r&K,w^=c,w=w<<13|w>>>19,w=w*5+3864292196);switch(v=0,R){case 3:v^=m[U*4+2]<<16;case 2:v^=m[U*4+1]<<8;case 1:v^=m[U*4],v=v*P&ht|v*n&K,v=v<<15|v>>>17,v=v*A&ht|v*r&K,U&1?_^=v:w^=v}this.h1=_,this.h2=w}hexdigest(){let D=this.h1,m=this.h2;return D^=m>>>1,D=D*3981806797&ht|D*36045&K,m=m*4283543511&ht|((m<<16|D>>>16)*2950163797&ht)>>>16,D^=m>>>1,D=D*444984403&ht|D*60499&K,m=m*3301882366&ht|((m<<16|D>>>16)*3120437893&ht)>>>16,D^=m>>>1,(D>>>0).toString(16).padStart(8,"0")+(m>>>0).toString(16).padStart(8,"0")}}h.MurmurHash3_64=bt},(wt,h,ct)=>{var K;Object.defineProperty(h,"__esModule",{value:!0}),h.FontLoader=h.FontFaceObject=void 0;var l=ct(1);class M{constructor({ownerDocument:H=globalThis.document,styleElement:D=null}){I(this,K,new Set);this._document=H,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(H){this.nativeFontFaces.add(H),this._document.fonts.add(H)}removeNativeFontFace(H){this.nativeFontFaces.delete(H),this._document.fonts.delete(H)}insertRule(H){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const D=this.styleElement.sheet;D.insertRule(H,D.cssRules.length)}clear(){for(const H of this.nativeFontFaces)this._document.fonts.delete(H);this.nativeFontFaces.clear(),t(this,K).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(H){if(!(!H||t(this,K).has(H.loadedName))){if((0,l.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:D,src:m,style:L}=H,U=new FontFace(D,m,L);this.addNativeFontFace(U);try{await U.load(),t(this,K).add(D)}catch{(0,l.warn)(`Cannot load system font: ${H.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(U)}return}(0,l.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(H){if(H.attached||H.missingFile&&!H.systemFontInfo)return;if(H.attached=!0,H.systemFontInfo){await this.loadSystemFont(H.systemFontInfo);return}if(this.isFontLoadingAPISupported){const m=H.createNativeFontFace();if(m){this.addNativeFontFace(m);try{await m.loaded}catch(L){throw(0,l.warn)(`Failed to load font '${m.family}': '${L}'.`),H.disableFontFace=!0,L}}return}const D=H.createFontFaceRule();if(D){if(this.insertRule(D),this.isSyncFontLoadingSupported)return;await new Promise(m=>{const L=this._queueLoadingCallback(m);this._prepareFontLoadEvent(H,L)})}}get isFontLoadingAPISupported(){var D;const H=!!((D=this._document)!=null&&D.fonts);return(0,l.shadow)(this,"isFontLoadingAPISupported",H)}get isSyncFontLoadingSupported(){let H=!1;return(l.isNodeJS||typeof navigator<"u"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(H=!0),(0,l.shadow)(this,"isSyncFontLoadingSupported",H)}_queueLoadingCallback(H){function D(){for((0,l.assert)(!L.done,"completeRequest() cannot be called twice."),L.done=!0;m.length>0&&m[0].done;){const U=m.shift();setTimeout(U.callback,0)}}const{loadingRequests:m}=this,L={done:!1,complete:D,callback:H};return m.push(L),L}get _loadTestFont(){const H=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,l.shadow)(this,"_loadTestFont",H)}_prepareFontLoadEvent(H,D){function m(g,W){return g.charCodeAt(W)<<24|g.charCodeAt(W+1)<<16|g.charCodeAt(W+2)<<8|g.charCodeAt(W+3)&255}function L(g,W,z,E){const X=g.substring(0,W),nt=g.substring(W+z);return X+E+nt}let U,R;const S=this._document.createElement("canvas");S.width=1,S.height=1;const v=S.getContext("2d");let c=0;function _(g,W){if(++c>30){(0,l.warn)("Load test font never loaded."),W();return}if(v.font="30px "+g,v.fillText(".",0,20),v.getImageData(0,0,1,1).data[3]>0){W();return}setTimeout(_.bind(null,g,W))}const w=`lt${Date.now()}${this.loadTestFontId++}`;let P=this._loadTestFont;P=L(P,976,w.length,w);const n=16,r=1482184792;let F=m(P,n);for(U=0,R=w.length-3;U<R;U+=4)F=F-r+m(w,U)|0;U<w.length&&(F=F-r+m(w+"XXX",U)|0),P=L(P,n,4,(0,l.string32)(F));const f=`url(data:font/opentype;base64,${btoa(P)});`,s=`@font-face {font-family:"${w}";src:${f}}`;this.insertRule(s);const x=this._document.createElement("div");x.style.visibility="hidden",x.style.width=x.style.height="10px",x.style.position="absolute",x.style.top=x.style.left="0px";for(const g of[H.loadedName,w]){const W=this._document.createElement("span");W.textContent="Hi",W.style.fontFamily=g,x.append(W)}this._document.body.append(x),_(w,()=>{x.remove(),D.complete()})}}K=new WeakMap,h.FontLoader=M;class ht{constructor(H,{isEvalSupported:D=!0,disableFontFace:m=!1,ignoreErrors:L=!1,inspectFont:U=null}){this.compiledGlyphs=Object.create(null);for(const R in H)this[R]=H[R];this.isEvalSupported=D!==!1,this.disableFontFace=m===!0,this.ignoreErrors=L===!0,this._inspectFont=U}createNativeFontFace(){var D;if(!this.data||this.disableFontFace)return null;let H;if(!this.cssFontInfo)H=new FontFace(this.loadedName,this.data,{});else{const m={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(m.style=`oblique ${this.cssFontInfo.italicAngle}deg`),H=new FontFace(this.cssFontInfo.fontFamily,this.data,m)}return(D=this._inspectFont)==null||D.call(this,this),H}createFontFaceRule(){var L;if(!this.data||this.disableFontFace)return null;const H=(0,l.bytesToString)(this.data),D=`url(data:${this.mimetype};base64,${btoa(H)});`;let m;if(!this.cssFontInfo)m=`@font-face {font-family:"${this.loadedName}";src:${D}}`;else{let U=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(U+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),m=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${U}src:${D}}`}return(L=this._inspectFont)==null||L.call(this,this,D),m}getPathGenerator(H,D){if(this.compiledGlyphs[D]!==void 0)return this.compiledGlyphs[D];let m;try{m=H.get(this.loadedName+"_path_"+D)}catch(L){if(!this.ignoreErrors)throw L;return(0,l.warn)(`getPathGenerator - ignoring character: "${L}".`),this.compiledGlyphs[D]=function(U,R){}}if(this.isEvalSupported&&l.FeatureTest.isEvalSupported){const L=[];for(const U of m){const R=U.args!==void 0?U.args.join(","):"";L.push("c.",U.cmd,"(",R,`);
- `)}return this.compiledGlyphs[D]=new Function("c","size",L.join(""))}return this.compiledGlyphs[D]=function(L,U){for(const R of m)R.cmd==="scale"&&(R.args=[U,-U]),L[R.cmd].apply(L,R.args)}}}h.FontFaceObject=ht},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.NodeStandardFontDataFactory=h.NodeFilterFactory=h.NodeCanvasFactory=h.NodeCMapReaderFactory=void 0;var l=ct(7);ct(1);const M=function(D){return new Promise((m,L)=>{require$$5.readFile(D,(R,S)=>{if(R||!S){L(new Error(R));return}m(new Uint8Array(S))})})};class ht extends l.BaseFilterFactory{}h.NodeFilterFactory=ht;class K extends l.BaseCanvasFactory{_createCanvas(m,L){return require$$5.createCanvas(m,L)}}h.NodeCanvasFactory=K;class bt extends l.BaseCMapReaderFactory{_fetchData(m,L){return M(m).then(U=>({cMapData:U,compressionType:L}))}}h.NodeCMapReaderFactory=bt;class H extends l.BaseStandardFontDataFactory{_fetchData(m){return M(m)}}h.NodeStandardFontDataFactory=H},(wt,h,ct)=>{var u,He,$,We;Object.defineProperty(h,"__esModule",{value:!0}),h.CanvasGraphics=void 0;var l=ct(1),M=ct(6),ht=ct(12),K=ct(13);const bt=16,H=100,D=4096,m=15,L=10,U=1e3,R=16;function S(d,e){if(d._removeMirroring)throw new Error("Context is already forwarding operations.");d.__originalSave=d.save,d.__originalRestore=d.restore,d.__originalRotate=d.rotate,d.__originalScale=d.scale,d.__originalTranslate=d.translate,d.__originalTransform=d.transform,d.__originalSetTransform=d.setTransform,d.__originalResetTransform=d.resetTransform,d.__originalClip=d.clip,d.__originalMoveTo=d.moveTo,d.__originalLineTo=d.lineTo,d.__originalBezierCurveTo=d.bezierCurveTo,d.__originalRect=d.rect,d.__originalClosePath=d.closePath,d.__originalBeginPath=d.beginPath,d._removeMirroring=()=>{d.save=d.__originalSave,d.restore=d.__originalRestore,d.rotate=d.__originalRotate,d.scale=d.__originalScale,d.translate=d.__originalTranslate,d.transform=d.__originalTransform,d.setTransform=d.__originalSetTransform,d.resetTransform=d.__originalResetTransform,d.clip=d.__originalClip,d.moveTo=d.__originalMoveTo,d.lineTo=d.__originalLineTo,d.bezierCurveTo=d.__originalBezierCurveTo,d.rect=d.__originalRect,d.closePath=d.__originalClosePath,d.beginPath=d.__originalBeginPath,delete d._removeMirroring},d.save=function(){e.save(),this.__originalSave()},d.restore=function(){e.restore(),this.__originalRestore()},d.translate=function(o,C){e.translate(o,C),this.__originalTranslate(o,C)},d.scale=function(o,C){e.scale(o,C),this.__originalScale(o,C)},d.transform=function(o,C,y,N,j,Y){e.transform(o,C,y,N,j,Y),this.__originalTransform(o,C,y,N,j,Y)},d.setTransform=function(o,C,y,N,j,Y){e.setTransform(o,C,y,N,j,Y),this.__originalSetTransform(o,C,y,N,j,Y)},d.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},d.rotate=function(o){e.rotate(o),this.__originalRotate(o)},d.clip=function(o){e.clip(o),this.__originalClip(o)},d.moveTo=function(i,o){e.moveTo(i,o),this.__originalMoveTo(i,o)},d.lineTo=function(i,o){e.lineTo(i,o),this.__originalLineTo(i,o)},d.bezierCurveTo=function(i,o,C,y,N,j){e.bezierCurveTo(i,o,C,y,N,j),this.__originalBezierCurveTo(i,o,C,y,N,j)},d.rect=function(i,o,C,y){e.rect(i,o,C,y),this.__originalRect(i,o,C,y)},d.closePath=function(){e.closePath(),this.__originalClosePath()},d.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class v{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,i,o){let C;return this.cache[e]!==void 0?(C=this.cache[e],this.canvasFactory.reset(C,i,o)):(C=this.canvasFactory.create(i,o),this.cache[e]=C),C}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const i=this.cache[e];this.canvasFactory.destroy(i),delete this.cache[e]}}}function c(d,e,i,o,C,y,N,j,Y,dt){const[at,lt,ut,kt,Et,Ot]=(0,M.getCurrentTransform)(d);if(lt===0&&ut===0){const Ut=N*at+Et,Ct=Math.round(Ut),it=j*kt+Ot,tt=Math.round(it),ft=(N+Y)*at+Et,Ft=Math.abs(Math.round(ft)-Ct)||1,Mt=(j+dt)*kt+Ot,Ht=Math.abs(Math.round(Mt)-tt)||1;return d.setTransform(Math.sign(at),0,0,Math.sign(kt),Ct,tt),d.drawImage(e,i,o,C,y,0,0,Ft,Ht),d.setTransform(at,lt,ut,kt,Et,Ot),[Ft,Ht]}if(at===0&&kt===0){const Ut=j*ut+Et,Ct=Math.round(Ut),it=N*lt+Ot,tt=Math.round(it),ft=(j+dt)*ut+Et,Ft=Math.abs(Math.round(ft)-Ct)||1,Mt=(N+Y)*lt+Ot,Ht=Math.abs(Math.round(Mt)-tt)||1;return d.setTransform(0,Math.sign(lt),Math.sign(ut),0,Ct,tt),d.drawImage(e,i,o,C,y,0,0,Ht,Ft),d.setTransform(at,lt,ut,kt,Et,Ot),[Ht,Ft]}d.drawImage(e,i,o,C,y,N,j,Y,dt);const Bt=Math.hypot(at,lt),xt=Math.hypot(ut,kt);return[Bt*Y,xt*dt]}function _(d){const{width:e,height:i}=d;if(e>U||i>U)return null;const o=1e3,C=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),y=e+1;let N=new Uint8Array(y*(i+1)),j,Y,dt;const at=e+7&-8;let lt=new Uint8Array(at*i),ut=0;for(const xt of d.data){let Ut=128;for(;Ut>0;)lt[ut++]=xt&Ut?0:255,Ut>>=1}let kt=0;for(ut=0,lt[ut]!==0&&(N[0]=1,++kt),Y=1;Y<e;Y++)lt[ut]!==lt[ut+1]&&(N[Y]=lt[ut]?2:1,++kt),ut++;for(lt[ut]!==0&&(N[Y]=2,++kt),j=1;j<i;j++){ut=j*at,dt=j*y,lt[ut-at]!==lt[ut]&&(N[dt]=lt[ut]?1:8,++kt);let xt=(lt[ut]?4:0)+(lt[ut-at]?8:0);for(Y=1;Y<e;Y++)xt=(xt>>2)+(lt[ut+1]?4:0)+(lt[ut-at+1]?8:0),C[xt]&&(N[dt+Y]=C[xt],++kt),ut++;if(lt[ut-at]!==lt[ut]&&(N[dt+Y]=lt[ut]?2:4,++kt),kt>o)return null}for(ut=at*(i-1),dt=j*y,lt[ut]!==0&&(N[dt]=8,++kt),Y=1;Y<e;Y++)lt[ut]!==lt[ut+1]&&(N[dt+Y]=lt[ut]?4:8,++kt),ut++;if(lt[ut]!==0&&(N[dt+Y]=4,++kt),kt>o)return null;const Et=new Int32Array([0,y,-1,0,-y,0,0,0,1]),Ot=new Path2D;for(j=0;kt&&j<=i;j++){let xt=j*y;const Ut=xt+e;for(;xt<Ut&&!N[xt];)xt++;if(xt===Ut)continue;Ot.moveTo(xt%y,j);const Ct=xt;let it=N[xt];do{const tt=Et[it];do xt+=tt;while(!N[xt]);const ft=N[xt];ft!==5&&ft!==10?(it=ft,N[xt]=0):(it=ft&51*it>>4,N[xt]&=it>>2|it<<2),Ot.lineTo(xt%y,xt/y|0),N[xt]||--kt}while(Ct!==xt);--j}return lt=null,N=null,function(xt){xt.save(),xt.scale(1/e,-1/i),xt.translate(0,-i),xt.fill(Ot),xt.beginPath(),xt.restore()}}class w{constructor(e,i){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=l.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=l.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=l.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,e,i])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,i){this.x=e,this.y=i}updatePathMinMax(e,i,o){[i,o]=l.Util.applyTransform([i,o],e),this.minX=Math.min(this.minX,i),this.minY=Math.min(this.minY,o),this.maxX=Math.max(this.maxX,i),this.maxY=Math.max(this.maxY,o)}updateRectMinMax(e,i){const o=l.Util.applyTransform(i,e),C=l.Util.applyTransform(i.slice(2),e);this.minX=Math.min(this.minX,o[0],C[0]),this.minY=Math.min(this.minY,o[1],C[1]),this.maxX=Math.max(this.maxX,o[0],C[0]),this.maxY=Math.max(this.maxY,o[1],C[1])}updateScalingPathMinMax(e,i){l.Util.scaleMinMax(e,i),this.minX=Math.min(this.minX,i[0]),this.maxX=Math.max(this.maxX,i[1]),this.minY=Math.min(this.minY,i[2]),this.maxY=Math.max(this.maxY,i[3])}updateCurvePathMinMax(e,i,o,C,y,N,j,Y,dt,at){const lt=l.Util.bezierBoundingBox(i,o,C,y,N,j,Y,dt);if(at){at[0]=Math.min(at[0],lt[0],lt[2]),at[1]=Math.max(at[1],lt[0],lt[2]),at[2]=Math.min(at[2],lt[1],lt[3]),at[3]=Math.max(at[3],lt[1],lt[3]);return}this.updateRectMinMax(e,lt)}getPathBoundingBox(e=ht.PathType.FILL,i=null){const o=[this.minX,this.minY,this.maxX,this.maxY];if(e===ht.PathType.STROKE){i||(0,l.unreachable)("Stroke bounding box must include transform.");const C=l.Util.singularValueDecompose2dScale(i),y=C[0]*this.lineWidth/2,N=C[1]*this.lineWidth/2;o[0]-=y,o[1]-=N,o[2]+=y,o[3]+=N}return o}updateClipFromPath(){const e=l.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(e=ht.PathType.FILL,i=null){return l.Util.intersect(this.clipBox,this.getPathBoundingBox(e,i))}}function P(d,e){if(typeof ImageData<"u"&&e instanceof ImageData){d.putImageData(e,0,0);return}const i=e.height,o=e.width,C=i%R,y=(i-C)/R,N=C===0?y:y+1,j=d.createImageData(o,R);let Y=0,dt;const at=e.data,lt=j.data;let ut,kt,Et,Ot;if(e.kind===l.ImageKind.GRAYSCALE_1BPP){const Bt=at.byteLength,xt=new Uint32Array(lt.buffer,0,lt.byteLength>>2),Ut=xt.length,Ct=o+7>>3,it=4294967295,tt=l.FeatureTest.isLittleEndian?4278190080:255;for(ut=0;ut<N;ut++){for(Et=ut<y?R:C,dt=0,kt=0;kt<Et;kt++){const ft=Bt-Y;let Ft=0;const Mt=ft>Ct?o:ft*8-7,Ht=Mt&-8;let Wt=0,Rt=0;for(;Ft<Ht;Ft+=8)Rt=at[Y++],xt[dt++]=Rt&128?it:tt,xt[dt++]=Rt&64?it:tt,xt[dt++]=Rt&32?it:tt,xt[dt++]=Rt&16?it:tt,xt[dt++]=Rt&8?it:tt,xt[dt++]=Rt&4?it:tt,xt[dt++]=Rt&2?it:tt,xt[dt++]=Rt&1?it:tt;for(;Ft<Mt;Ft++)Wt===0&&(Rt=at[Y++],Wt=128),xt[dt++]=Rt&Wt?it:tt,Wt>>=1}for(;dt<Ut;)xt[dt++]=0;d.putImageData(j,0,ut*R)}}else if(e.kind===l.ImageKind.RGBA_32BPP){for(kt=0,Ot=o*R*4,ut=0;ut<y;ut++)lt.set(at.subarray(Y,Y+Ot)),Y+=Ot,d.putImageData(j,0,kt),kt+=R;ut<N&&(Ot=o*C*4,lt.set(at.subarray(Y,Y+Ot)),d.putImageData(j,0,kt))}else if(e.kind===l.ImageKind.RGB_24BPP)for(Et=R,Ot=o*Et,ut=0;ut<N;ut++){for(ut>=y&&(Et=C,Ot=o*Et),dt=0,kt=Ot;kt--;)lt[dt++]=at[Y++],lt[dt++]=at[Y++],lt[dt++]=at[Y++],lt[dt++]=255;d.putImageData(j,0,ut*R)}else throw new Error(`bad image kind: ${e.kind}`)}function A(d,e){if(e.bitmap){d.drawImage(e.bitmap,0,0);return}const i=e.height,o=e.width,C=i%R,y=(i-C)/R,N=C===0?y:y+1,j=d.createImageData(o,R);let Y=0;const dt=e.data,at=j.data;for(let lt=0;lt<N;lt++){const ut=lt<y?R:C;({srcPos:Y}=(0,K.convertBlackAndWhiteToRGBA)({src:dt,srcPos:Y,dest:at,width:o,height:ut,nonBlackColor:0})),d.putImageData(j,0,lt*R)}}function n(d,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const o of i)d[o]!==void 0&&(e[o]=d[o]);d.setLineDash!==void 0&&(e.setLineDash(d.getLineDash()),e.lineDashOffset=d.lineDashOffset)}function r(d){if(d.strokeStyle=d.fillStyle="#000000",d.fillRule="nonzero",d.globalAlpha=1,d.lineWidth=1,d.lineCap="butt",d.lineJoin="miter",d.miterLimit=10,d.globalCompositeOperation="source-over",d.font="10px sans-serif",d.setLineDash!==void 0&&(d.setLineDash([]),d.lineDashOffset=0),!l.isNodeJS){const{filter:e}=d;e!=="none"&&e!==""&&(d.filter="none")}}function F(d,e,i,o){const C=d.length;for(let y=3;y<C;y+=4){const N=d[y];if(N===0)d[y-3]=e,d[y-2]=i,d[y-1]=o;else if(N<255){const j=255-N;d[y-3]=d[y-3]*N+e*j>>8,d[y-2]=d[y-2]*N+i*j>>8,d[y-1]=d[y-1]*N+o*j>>8}}}function f(d,e,i){const o=d.length,C=1/255;for(let y=3;y<o;y+=4){const N=i?i[d[y]]:d[y];e[y]=e[y]*N*C|0}}function s(d,e,i){const o=d.length;for(let C=3;C<o;C+=4){const y=d[C-3]*77+d[C-2]*152+d[C-1]*28;e[C]=i?e[C]*i[y>>8]>>8:e[C]*y>>16}}function x(d,e,i,o,C,y,N,j,Y,dt,at){const lt=!!y,ut=lt?y[0]:0,kt=lt?y[1]:0,Et=lt?y[2]:0,Ot=C==="Luminosity"?s:f,xt=Math.min(o,Math.ceil(1048576/i));for(let Ut=0;Ut<o;Ut+=xt){const Ct=Math.min(xt,o-Ut),it=d.getImageData(j-dt,Ut+(Y-at),i,Ct),tt=e.getImageData(j,Ut+Y,i,Ct);lt&&F(it.data,ut,kt,Et),Ot(it.data,tt.data,N),e.putImageData(tt,j,Ut+Y)}}function g(d,e,i,o){const C=o[0],y=o[1],N=o[2]-C,j=o[3]-y;N===0||j===0||(x(e.context,i,N,j,e.subtype,e.backdrop,e.transferMap,C,y,e.offsetX,e.offsetY),d.save(),d.globalAlpha=1,d.globalCompositeOperation="source-over",d.setTransform(1,0,0,1,0,0),d.drawImage(i.canvas,0,0),d.restore())}function W(d,e){const i=l.Util.singularValueDecompose2dScale(d);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const o=Math.fround((globalThis.devicePixelRatio||1)*M.PixelsPerInch.PDF_TO_CSS_UNITS);return e!==void 0?e:i[0]<=o||i[1]<=o}const z=["butt","round","square"],E=["miter","round","bevel"],X={},nt={},mt=class mt{constructor(e,i,o,C,y,{optionalContentConfig:N,markedContentStack:j=null},Y,dt){I(this,u);I(this,$);this.ctx=e,this.current=new w(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=i,this.objs=o,this.canvasFactory=C,this.filterFactory=y,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=j||[],this.optionalContentConfig=N,this.cachedCanvases=new v(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=Y,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=dt,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,i=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):i}beginDrawing({transform:e,viewport:i,transparency:o=!1,background:C=null}){const y=this.ctx.canvas.width,N=this.ctx.canvas.height,j=this.ctx.fillStyle;if(this.ctx.fillStyle=C||"#ffffff",this.ctx.fillRect(0,0,y,N),this.ctx.fillStyle=j,o){const Y=this.cachedCanvases.getCanvas("transparent",y,N);this.compositeCtx=this.ctx,this.transparentCanvas=Y.canvas,this.ctx=Y.context,this.ctx.save(),this.ctx.transform(...(0,M.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),r(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=(0,M.getCurrentTransform)(this.ctx)}executeOperatorList(e,i,o,C){const y=e.argsArray,N=e.fnArray;let j=i||0;const Y=y.length;if(Y===j)return j;const dt=Y-j>L&&typeof o=="function",at=dt?Date.now()+m:0;let lt=0;const ut=this.commonObjs,kt=this.objs;let Et;for(;;){if(C!==void 0&&j===C.nextBreakPoint)return C.breakIt(j,o),j;if(Et=N[j],Et!==l.OPS.dependency)this[Et].apply(this,y[j]);else for(const Ot of y[j]){const Bt=Ot.startsWith("g_")?ut:kt;if(!Bt.has(Ot))return Bt.get(Ot,o),j}if(j++,j===Y)return j;if(dt&&++lt>L){if(Date.now()>at)return o(),j;lt=0}}}endDrawing(){V(this,u,He).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const i of e.values())typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement&&(i.width=i.height=0);e.clear()}this._cachedBitmapsMap.clear(),V(this,$,We).call(this)}_scaleImage(e,i){const o=e.width,C=e.height;let y=Math.max(Math.hypot(i[0],i[1]),1),N=Math.max(Math.hypot(i[2],i[3]),1),j=o,Y=C,dt="prescale1",at,lt;for(;y>2&&j>1||N>2&&Y>1;){let ut=j,kt=Y;y>2&&j>1&&(ut=j>=16384?Math.floor(j/2)-1||1:Math.ceil(j/2),y/=j/ut),N>2&&Y>1&&(kt=Y>=16384?Math.floor(Y/2)-1||1:Math.ceil(Y)/2,N/=Y/kt),at=this.cachedCanvases.getCanvas(dt,ut,kt),lt=at.context,lt.clearRect(0,0,ut,kt),lt.drawImage(e,0,0,j,Y,0,0,ut,kt),e=at.canvas,j=ut,Y=kt,dt=dt==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:j,paintHeight:Y}}_createMaskCanvas(e){const i=this.ctx,{width:o,height:C}=e,y=this.current.fillColor,N=this.current.patternFill,j=(0,M.getCurrentTransform)(i);let Y,dt,at,lt;if((e.bitmap||e.data)&&e.count>1){const Ft=e.bitmap||e.data.buffer;dt=JSON.stringify(N?j:[j.slice(0,4),y]),Y=this._cachedBitmapsMap.get(Ft),Y||(Y=new Map,this._cachedBitmapsMap.set(Ft,Y));const Mt=Y.get(dt);if(Mt&&!N){const Ht=Math.round(Math.min(j[0],j[2])+j[4]),Wt=Math.round(Math.min(j[1],j[3])+j[5]);return{canvas:Mt,offsetX:Ht,offsetY:Wt}}at=Mt}at||(lt=this.cachedCanvases.getCanvas("maskCanvas",o,C),A(lt.context,e));let ut=l.Util.transform(j,[1/o,0,0,-1/C,0,0]);ut=l.Util.transform(ut,[1,0,0,1,0,-C]);const kt=l.Util.applyTransform([0,0],ut),Et=l.Util.applyTransform([o,C],ut),Ot=l.Util.normalizeRect([kt[0],kt[1],Et[0],Et[1]]),Bt=Math.round(Ot[2]-Ot[0])||1,xt=Math.round(Ot[3]-Ot[1])||1,Ut=this.cachedCanvases.getCanvas("fillCanvas",Bt,xt),Ct=Ut.context,it=Math.min(kt[0],Et[0]),tt=Math.min(kt[1],Et[1]);Ct.translate(-it,-tt),Ct.transform(...ut),at||(at=this._scaleImage(lt.canvas,(0,M.getCurrentTransformInverse)(Ct)),at=at.img,Y&&N&&Y.set(dt,at)),Ct.imageSmoothingEnabled=W((0,M.getCurrentTransform)(Ct),e.interpolate),c(Ct,at,0,0,at.width,at.height,0,0,o,C),Ct.globalCompositeOperation="source-in";const ft=l.Util.transform((0,M.getCurrentTransformInverse)(Ct),[1,0,0,1,-it,-tt]);return Ct.fillStyle=N?y.getPattern(i,this,ft,ht.PathType.FILL):y,Ct.fillRect(0,0,o,C),Y&&!N&&(this.cachedCanvases.delete("fillCanvas"),Y.set(dt,Ut.canvas)),{canvas:Ut.canvas,offsetX:Math.round(it),offsetY:Math.round(tt)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=z[e]}setLineJoin(e){this.ctx.lineJoin=E[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,i){const o=this.ctx;o.setLineDash!==void 0&&(o.setLineDash(e),o.lineDashOffset=i)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[i,o]of e)switch(i){case"LW":this.setLineWidth(o);break;case"LC":this.setLineCap(o);break;case"LJ":this.setLineJoin(o);break;case"ML":this.setMiterLimit(o);break;case"D":this.setDash(o[0],o[1]);break;case"RI":this.setRenderingIntent(o);break;case"FL":this.setFlatness(o);break;case"Font":this.setFont(o[0],o[1]);break;case"CA":this.current.strokeAlpha=o;break;case"ca":this.current.fillAlpha=o,this.ctx.globalAlpha=o;break;case"BM":this.ctx.globalCompositeOperation=o;break;case"SMask":this.current.activeSMask=o?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(o);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,i=this.ctx.canvas.height,o="smaskGroupAt"+this.groupLevel,C=this.cachedCanvases.getCanvas(o,e,i);this.suspendedCtx=this.ctx,this.ctx=C.context;const y=this.ctx;y.setTransform(...(0,M.getCurrentTransform)(this.suspendedCtx)),n(this.suspendedCtx,y),S(y,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),n(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];const i=this.current.activeSMask,o=this.suspendedCtx;g(o,i,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()}save(){this.inSMaskMode?(n(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),n(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,i,o,C,y,N){this.ctx.transform(e,i,o,C,y,N),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,i,o){const C=this.ctx,y=this.current;let N=y.x,j=y.y,Y,dt;const at=(0,M.getCurrentTransform)(C),lt=at[0]===0&&at[3]===0||at[1]===0&&at[2]===0,ut=lt?o.slice(0):null;for(let kt=0,Et=0,Ot=e.length;kt<Ot;kt++)switch(e[kt]|0){case l.OPS.rectangle:N=i[Et++],j=i[Et++];const Bt=i[Et++],xt=i[Et++],Ut=N+Bt,Ct=j+xt;C.moveTo(N,j),Bt===0||xt===0?C.lineTo(Ut,Ct):(C.lineTo(Ut,j),C.lineTo(Ut,Ct),C.lineTo(N,Ct)),lt||y.updateRectMinMax(at,[N,j,Ut,Ct]),C.closePath();break;case l.OPS.moveTo:N=i[Et++],j=i[Et++],C.moveTo(N,j),lt||y.updatePathMinMax(at,N,j);break;case l.OPS.lineTo:N=i[Et++],j=i[Et++],C.lineTo(N,j),lt||y.updatePathMinMax(at,N,j);break;case l.OPS.curveTo:Y=N,dt=j,N=i[Et+4],j=i[Et+5],C.bezierCurveTo(i[Et],i[Et+1],i[Et+2],i[Et+3],N,j),y.updateCurvePathMinMax(at,Y,dt,i[Et],i[Et+1],i[Et+2],i[Et+3],N,j,ut),Et+=6;break;case l.OPS.curveTo2:Y=N,dt=j,C.bezierCurveTo(N,j,i[Et],i[Et+1],i[Et+2],i[Et+3]),y.updateCurvePathMinMax(at,Y,dt,N,j,i[Et],i[Et+1],i[Et+2],i[Et+3],ut),N=i[Et+2],j=i[Et+3],Et+=4;break;case l.OPS.curveTo3:Y=N,dt=j,N=i[Et+2],j=i[Et+3],C.bezierCurveTo(i[Et],i[Et+1],N,j,N,j),y.updateCurvePathMinMax(at,Y,dt,i[Et],i[Et+1],N,j,N,j,ut),Et+=4;break;case l.OPS.closePath:C.closePath();break}lt&&y.updateScalingPathMinMax(at,ut),y.setCurrentPoint(N,j)}closePath(){this.ctx.closePath()}stroke(e=!0){const i=this.ctx,o=this.current.strokeColor;i.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof o=="object"&&(o!=null&&o.getPattern)?(i.save(),i.strokeStyle=o.getPattern(i,this,(0,M.getCurrentTransformInverse)(i),ht.PathType.STROKE),this.rescaleAndStroke(!1),i.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),i.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const i=this.ctx,o=this.current.fillColor,C=this.current.patternFill;let y=!1;C&&(i.save(),i.fillStyle=o.getPattern(i,this,(0,M.getCurrentTransformInverse)(i),ht.PathType.FILL),y=!0);const N=this.current.getClippedPathBoundingBox();this.contentVisible&&N!==null&&(this.pendingEOFill?(i.fill("evenodd"),this.pendingEOFill=!1):i.fill()),y&&i.restore(),e&&this.consumePath(N)}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=X}eoClip(){this.pendingClip=nt}beginText(){this.current.textMatrix=l.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,i=this.ctx;if(e===void 0){i.beginPath();return}i.save(),i.beginPath();for(const o of e)i.setTransform(...o.transform),i.translate(o.x,o.y),o.addToPath(i,o.fontSize);i.restore(),i.clip(),i.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,i){var at;const o=this.commonObjs.get(e),C=this.current;if(!o)throw new Error(`Can't find font for ${e}`);if(C.fontMatrix=o.fontMatrix||l.FONT_IDENTITY_MATRIX,(C.fontMatrix[0]===0||C.fontMatrix[3]===0)&&(0,l.warn)("Invalid font matrix for font "+e),i<0?(i=-i,C.fontDirection=-1):C.fontDirection=1,this.current.font=o,this.current.fontSize=i,o.isType3Font)return;const y=o.loadedName||"sans-serif",N=((at=o.systemFontInfo)==null?void 0:at.css)||`"${y}", ${o.fallbackName}`;let j="normal";o.black?j="900":o.bold&&(j="bold");const Y=o.italic?"italic":"normal";let dt=i;i<bt?dt=bt:i>H&&(dt=H),this.current.fontSizeScale=i/dt,this.ctx.font=`${Y} ${j} ${dt}px ${N}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,i){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(e,i){this.setLeading(-i),this.moveText(e,i)}setTextMatrix(e,i,o,C,y,N){this.current.textMatrix=[e,i,o,C,y,N],this.current.textMatrixScale=Math.hypot(e,i),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,i,o,C){const y=this.ctx,N=this.current,j=N.font,Y=N.textRenderingMode,dt=N.fontSize/N.fontSizeScale,at=Y&l.TextRenderingMode.FILL_STROKE_MASK,lt=!!(Y&l.TextRenderingMode.ADD_TO_PATH_FLAG),ut=N.patternFill&&!j.missingFile;let kt;(j.disableFontFace||lt||ut)&&(kt=j.getPathGenerator(this.commonObjs,e)),j.disableFontFace||ut?(y.save(),y.translate(i,o),y.beginPath(),kt(y,dt),C&&y.setTransform(...C),(at===l.TextRenderingMode.FILL||at===l.TextRenderingMode.FILL_STROKE)&&y.fill(),(at===l.TextRenderingMode.STROKE||at===l.TextRenderingMode.FILL_STROKE)&&y.stroke(),y.restore()):((at===l.TextRenderingMode.FILL||at===l.TextRenderingMode.FILL_STROKE)&&y.fillText(e,i,o),(at===l.TextRenderingMode.STROKE||at===l.TextRenderingMode.FILL_STROKE)&&y.strokeText(e,i,o)),lt&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,M.getCurrentTransform)(y),x:i,y:o,fontSize:dt,addToPath:kt})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const i=e.getImageData(0,0,10,10).data;let o=!1;for(let C=3;C<i.length;C+=4)if(i[C]>0&&i[C]<255){o=!0;break}return(0,l.shadow)(this,"isFontSubpixelAAEnabled",o)}showText(e){const i=this.current,o=i.font;if(o.isType3Font)return this.showType3Text(e);const C=i.fontSize;if(C===0)return;const y=this.ctx,N=i.fontSizeScale,j=i.charSpacing,Y=i.wordSpacing,dt=i.fontDirection,at=i.textHScale*dt,lt=e.length,ut=o.vertical,kt=ut?1:-1,Et=o.defaultVMetrics,Ot=C*i.fontMatrix[0],Bt=i.textRenderingMode===l.TextRenderingMode.FILL&&!o.disableFontFace&&!i.patternFill;y.save(),y.transform(...i.textMatrix),y.translate(i.x,i.y+i.textRise),dt>0?y.scale(at,-1):y.scale(at,1);let xt;if(i.patternFill){y.save();const ft=i.fillColor.getPattern(y,this,(0,M.getCurrentTransformInverse)(y),ht.PathType.FILL);xt=(0,M.getCurrentTransform)(y),y.restore(),y.fillStyle=ft}let Ut=i.lineWidth;const Ct=i.textMatrixScale;if(Ct===0||Ut===0){const ft=i.textRenderingMode&l.TextRenderingMode.FILL_STROKE_MASK;(ft===l.TextRenderingMode.STROKE||ft===l.TextRenderingMode.FILL_STROKE)&&(Ut=this.getSinglePixelWidth())}else Ut/=Ct;if(N!==1&&(y.scale(N,N),Ut/=N),y.lineWidth=Ut,o.isInvalidPDFjsFont){const ft=[];let Ft=0;for(const Mt of e)ft.push(Mt.unicode),Ft+=Mt.width;y.fillText(ft.join(""),0,0),i.x+=Ft*Ot*at,y.restore(),this.compose();return}let it=0,tt;for(tt=0;tt<lt;++tt){const ft=e[tt];if(typeof ft=="number"){it+=kt*ft*C/1e3;continue}let Ft=!1;const Mt=(ft.isSpace?Y:0)+j,Ht=ft.fontChar,Wt=ft.accent;let Rt,Dt,Gt=ft.width;if(ut){const pt=ft.vmetric||Et,G=-(ft.vmetric?pt[1]:Gt*.5)*Ot,J=pt[2]*Ot;Gt=pt?-pt[0]:Gt,Rt=G/N,Dt=(it+J)/N}else Rt=it/N,Dt=0;if(o.remeasure&&Gt>0){const pt=y.measureText(Ht).width*1e3/C*N;if(Gt<pt&&this.isFontSubpixelAAEnabled){const G=Gt/pt;Ft=!0,y.save(),y.scale(G,1),Rt/=G}else Gt!==pt&&(Rt+=(Gt-pt)/2e3*C/N)}if(this.contentVisible&&(ft.isInFont||o.missingFile)){if(Bt&&!Wt)y.fillText(Ht,Rt,Dt);else if(this.paintChar(Ht,Rt,Dt,xt),Wt){const pt=Rt+C*Wt.offset.x/N,G=Dt-C*Wt.offset.y/N;this.paintChar(Wt.fontChar,pt,G,xt)}}const jt=ut?Gt*Ot-Mt*dt:Gt*Ot+Mt*dt;it+=jt,Ft&&y.restore()}ut?i.y-=it:i.x+=it*at,y.restore(),this.compose()}showType3Text(e){const i=this.ctx,o=this.current,C=o.font,y=o.fontSize,N=o.fontDirection,j=C.vertical?1:-1,Y=o.charSpacing,dt=o.wordSpacing,at=o.textHScale*N,lt=o.fontMatrix||l.FONT_IDENTITY_MATRIX,ut=e.length,kt=o.textRenderingMode===l.TextRenderingMode.INVISIBLE;let Et,Ot,Bt,xt;if(!(kt||y===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),i.transform(...o.textMatrix),i.translate(o.x,o.y),i.scale(at,N),Et=0;Et<ut;++Et){if(Ot=e[Et],typeof Ot=="number"){xt=j*Ot*y/1e3,this.ctx.translate(xt,0),o.x+=xt*at;continue}const Ut=(Ot.isSpace?dt:0)+Y,Ct=C.charProcOperatorList[Ot.operatorListId];if(!Ct){(0,l.warn)(`Type3 character "${Ot.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=Ot,this.save(),i.scale(y,y),i.transform(...lt),this.executeOperatorList(Ct),this.restore()),Bt=l.Util.applyTransform([Ot.width,0],lt)[0]*y+Ut,i.translate(Bt,0),o.x+=Bt*at}i.restore(),this.processingType3=null}}setCharWidth(e,i){}setCharWidthAndBounds(e,i,o,C,y,N){this.ctx.rect(o,C,y-o,N-C),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let i;if(e[0]==="TilingPattern"){const o=e[1],C=this.baseTransform||(0,M.getCurrentTransform)(this.ctx),y={createCanvasGraphics:N=>new mt(N,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};i=new ht.TilingPattern(e,o,this.ctx,y,C)}else i=this._getPattern(e[1],e[2]);return i}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,i,o){const C=l.Util.makeHexColor(e,i,o);this.ctx.strokeStyle=C,this.current.strokeColor=C}setFillRGBColor(e,i,o){const C=l.Util.makeHexColor(e,i,o);this.ctx.fillStyle=C,this.current.fillColor=C,this.current.patternFill=!1}_getPattern(e,i=null){let o;return this.cachedPatterns.has(e)?o=this.cachedPatterns.get(e):(o=(0,ht.getShadingPattern)(this.getObject(e)),this.cachedPatterns.set(e,o)),i&&(o.matrix=i),o}shadingFill(e){if(!this.contentVisible)return;const i=this.ctx;this.save();const o=this._getPattern(e);i.fillStyle=o.getPattern(i,this,(0,M.getCurrentTransformInverse)(i),ht.PathType.SHADING);const C=(0,M.getCurrentTransformInverse)(i);if(C){const{width:y,height:N}=i.canvas,[j,Y,dt,at]=l.Util.getAxialAlignedBoundingBox([0,0,y,N],C);this.ctx.fillRect(j,Y,dt-j,at-Y)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,l.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,l.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(e,i){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&e.length===6&&this.transform(...e),this.baseTransform=(0,M.getCurrentTransform)(this.ctx),i)){const o=i[2]-i[0],C=i[3]-i[1];this.ctx.rect(i[0],i[1],o,C),this.current.updateRectMinMax((0,M.getCurrentTransform)(this.ctx),i),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);const i=this.ctx;e.isolated||(0,l.info)("TODO: Support non-isolated groups."),e.knockout&&(0,l.warn)("Knockout groups not supported.");const o=(0,M.getCurrentTransform)(i);if(e.matrix&&i.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let C=l.Util.getAxialAlignedBoundingBox(e.bbox,(0,M.getCurrentTransform)(i));const y=[0,0,i.canvas.width,i.canvas.height];C=l.Util.intersect(C,y)||[0,0,0,0];const N=Math.floor(C[0]),j=Math.floor(C[1]);let Y=Math.max(Math.ceil(C[2])-N,1),dt=Math.max(Math.ceil(C[3])-j,1),at=1,lt=1;Y>D&&(at=Y/D,Y=D),dt>D&&(lt=dt/D,dt=D),this.current.startNewPathAndClipBox([0,0,Y,dt]);let ut="groupAt"+this.groupLevel;e.smask&&(ut+="_smask_"+this.smaskCounter++%2);const kt=this.cachedCanvases.getCanvas(ut,Y,dt),Et=kt.context;Et.scale(1/at,1/lt),Et.translate(-N,-j),Et.transform(...o),e.smask?this.smaskStack.push({canvas:kt.canvas,context:Et,offsetX:N,offsetY:j,scaleX:at,scaleY:lt,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(i.setTransform(1,0,0,1,0,0),i.translate(N,j),i.scale(at,lt),i.save()),n(i,Et),this.ctx=Et,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(i),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const i=this.ctx,o=this.groupStack.pop();if(this.ctx=o,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const C=(0,M.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...C);const y=l.Util.getAxialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],C);this.ctx.drawImage(i.canvas,0,0),this.ctx.restore(),this.compose(y)}}beginAnnotation(e,i,o,C,y){if(V(this,u,He).call(this),r(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(i)&&i.length===4){const N=i[2]-i[0],j=i[3]-i[1];if(y&&this.annotationCanvasMap){o=o.slice(),o[4]-=i[0],o[5]-=i[1],i=i.slice(),i[0]=i[1]=0,i[2]=N,i[3]=j;const[Y,dt]=l.Util.singularValueDecompose2dScale((0,M.getCurrentTransform)(this.ctx)),{viewportScale:at}=this,lt=Math.ceil(N*this.outputScaleX*at),ut=Math.ceil(j*this.outputScaleY*at);this.annotationCanvas=this.canvasFactory.create(lt,ut);const{canvas:kt,context:Et}=this.annotationCanvas;this.annotationCanvasMap.set(e,kt),this.annotationCanvas.savedCtx=this.ctx,this.ctx=Et,this.ctx.save(),this.ctx.setTransform(Y,0,0,-dt,0,j*dt),r(this.ctx)}else r(this.ctx),this.ctx.rect(i[0],i[1],N,j),this.ctx.clip(),this.endPath()}this.current=new w(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...o),this.transform(...C)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),V(this,$,We).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const i=e.count;e=this.getObject(e.data,e),e.count=i;const o=this.ctx,C=this.processingType3;if(C&&(C.compiled===void 0&&(C.compiled=_(e)),C.compiled)){C.compiled(o);return}const y=this._createMaskCanvas(e),N=y.canvas;o.save(),o.setTransform(1,0,0,1,0,0),o.drawImage(N,y.offsetX,y.offsetY),o.restore(),this.compose()}paintImageMaskXObjectRepeat(e,i,o=0,C=0,y,N){if(!this.contentVisible)return;e=this.getObject(e.data,e);const j=this.ctx;j.save();const Y=(0,M.getCurrentTransform)(j);j.transform(i,o,C,y,0,0);const dt=this._createMaskCanvas(e);j.setTransform(1,0,0,1,dt.offsetX-Y[4],dt.offsetY-Y[5]);for(let at=0,lt=N.length;at<lt;at+=2){const ut=l.Util.transform(Y,[i,o,C,y,N[at],N[at+1]]),[kt,Et]=l.Util.applyTransform([0,0],ut);j.drawImage(dt.canvas,kt,Et)}j.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const i=this.ctx,o=this.current.fillColor,C=this.current.patternFill;for(const y of e){const{data:N,width:j,height:Y,transform:dt}=y,at=this.cachedCanvases.getCanvas("maskCanvas",j,Y),lt=at.context;lt.save();const ut=this.getObject(N,y);A(lt,ut),lt.globalCompositeOperation="source-in",lt.fillStyle=C?o.getPattern(lt,this,(0,M.getCurrentTransformInverse)(i),ht.PathType.FILL):o,lt.fillRect(0,0,j,Y),lt.restore(),i.save(),i.transform(...dt),i.scale(1,-1),c(i,at.canvas,0,0,j,Y,0,-1,1,1),i.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const i=this.getObject(e);if(!i){(0,l.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(i)}paintImageXObjectRepeat(e,i,o,C){if(!this.contentVisible)return;const y=this.getObject(e);if(!y){(0,l.warn)("Dependent image isn't ready yet");return}const N=y.width,j=y.height,Y=[];for(let dt=0,at=C.length;dt<at;dt+=2)Y.push({transform:[i,0,0,o,C[dt],C[dt+1]],x:0,y:0,w:N,h:j});this.paintInlineImageXObjectGroup(y,Y)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:i,width:o,height:C}=e,y=this.cachedCanvases.getCanvas("inlineImage",o,C),N=y.context;return N.filter=this.current.transferMaps,N.drawImage(i,0,0),N.filter="none",y.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const i=e.width,o=e.height,C=this.ctx;if(this.save(),!l.isNodeJS){const{filter:j}=C;j!=="none"&&j!==""&&(C.filter="none")}C.scale(1/i,-1/o);let y;if(e.bitmap)y=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)y=e;else{const Y=this.cachedCanvases.getCanvas("inlineImage",i,o).context;P(Y,e),y=this.applyTransferMapsToCanvas(Y)}const N=this._scaleImage(y,(0,M.getCurrentTransformInverse)(C));C.imageSmoothingEnabled=W((0,M.getCurrentTransform)(C),e.interpolate),c(C,N.img,0,0,N.paintWidth,N.paintHeight,0,-o,i,o),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,i){if(!this.contentVisible)return;const o=this.ctx;let C;if(e.bitmap)C=e.bitmap;else{const y=e.width,N=e.height,Y=this.cachedCanvases.getCanvas("inlineImage",y,N).context;P(Y,e),C=this.applyTransferMapsToCanvas(Y)}for(const y of i)o.save(),o.transform(...y.transform),o.scale(1,-1),c(o,C,y.x,y.y,y.w,y.h,0,-1,1,1),o.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,i){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,i){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const o=this.ctx;this.pendingClip&&(i||(this.pendingClip===nt?o.clip("evenodd"):o.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),o.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=(0,M.getCurrentTransform)(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const i=Math.abs(e[0]*e[3]-e[2]*e[1]),o=Math.hypot(e[0],e[2]),C=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(o,C)/i}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:i,b:o,c:C,d:y}=this.ctx.getTransform();let N,j;if(o===0&&C===0){const Y=Math.abs(i),dt=Math.abs(y);if(Y===dt)if(e===0)N=j=1/Y;else{const at=Y*e;N=j=at<1?1/at:1}else if(e===0)N=1/Y,j=1/dt;else{const at=Y*e,lt=dt*e;N=at<1?1/at:1,j=lt<1?1/lt:1}}else{const Y=Math.abs(i*y-o*C),dt=Math.hypot(i,o),at=Math.hypot(C,y);if(e===0)N=at/Y,j=dt/Y;else{const lt=e*Y;N=at>lt?at/lt:1,j=dt>lt?dt/lt:1}}this._cachedScaleForStroking[0]=N,this._cachedScaleForStroking[1]=j}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:i}=this,{lineWidth:o}=this.current,[C,y]=this.getScaleForStroking();if(i.lineWidth=o||1,C===1&&y===1){i.stroke();return}const N=i.getLineDash();if(e&&i.save(),i.scale(C,y),N.length>0){const j=Math.max(C,y);i.setLineDash(N.map(Y=>Y/j)),i.lineDashOffset/=j}i.stroke(),e&&i.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};u=new WeakSet,He=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();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)},$=new WeakSet,We=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const i=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=i}}};let ot=mt;h.CanvasGraphics=ot;for(const d in l.OPS)ot.prototype[d]!==void 0&&(ot.prototype[l.OPS[d]]=ot.prototype[d])},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.TilingPattern=h.PathType=void 0,h.getShadingPattern=R;var l=ct(1),M=ct(6);const ht={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};h.PathType=ht;function K(_,w){if(!w)return;const P=w[2]-w[0],A=w[3]-w[1],n=new Path2D;n.rect(w[0],w[1],P,A),_.clip(n)}class bt{constructor(){this.constructor===bt&&(0,l.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,l.unreachable)("Abstract method `getPattern` called.")}}class H extends bt{constructor(w){super(),this._type=w[1],this._bbox=w[2],this._colorStops=w[3],this._p0=w[4],this._p1=w[5],this._r0=w[6],this._r1=w[7],this.matrix=null}_createGradient(w){let P;this._type==="axial"?P=w.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(P=w.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const A of this._colorStops)P.addColorStop(A[0],A[1]);return P}getPattern(w,P,A,n){let r;if(n===ht.STROKE||n===ht.FILL){const F=P.current.getClippedPathBoundingBox(n,(0,M.getCurrentTransform)(w))||[0,0,0,0],f=Math.ceil(F[2]-F[0])||1,s=Math.ceil(F[3]-F[1])||1,x=P.cachedCanvases.getCanvas("pattern",f,s,!0),g=x.context;g.clearRect(0,0,g.canvas.width,g.canvas.height),g.beginPath(),g.rect(0,0,g.canvas.width,g.canvas.height),g.translate(-F[0],-F[1]),A=l.Util.transform(A,[1,0,0,1,F[0],F[1]]),g.transform(...P.baseTransform),this.matrix&&g.transform(...this.matrix),K(g,this._bbox),g.fillStyle=this._createGradient(g),g.fill(),r=w.createPattern(x.canvas,"no-repeat");const W=new DOMMatrix(A);r.setTransform(W)}else K(w,this._bbox),r=this._createGradient(w);return r}}function D(_,w,P,A,n,r,F,f){const s=w.coords,x=w.colors,g=_.data,W=_.width*4;let z;s[P+1]>s[A+1]&&(z=P,P=A,A=z,z=r,r=F,F=z),s[A+1]>s[n+1]&&(z=A,A=n,n=z,z=F,F=f,f=z),s[P+1]>s[A+1]&&(z=P,P=A,A=z,z=r,r=F,F=z);const E=(s[P]+w.offsetX)*w.scaleX,X=(s[P+1]+w.offsetY)*w.scaleY,nt=(s[A]+w.offsetX)*w.scaleX,ot=(s[A+1]+w.offsetY)*w.scaleY,u=(s[n]+w.offsetX)*w.scaleX,O=(s[n+1]+w.offsetY)*w.scaleY;if(X>=O)return;const $=x[r],rt=x[r+1],mt=x[r+2],d=x[F],e=x[F+1],i=x[F+2],o=x[f],C=x[f+1],y=x[f+2],N=Math.round(X),j=Math.round(O);let Y,dt,at,lt,ut,kt,Et,Ot;for(let Bt=N;Bt<=j;Bt++){if(Bt<ot){const tt=Bt<X?0:(X-Bt)/(X-ot);Y=E-(E-nt)*tt,dt=$-($-d)*tt,at=rt-(rt-e)*tt,lt=mt-(mt-i)*tt}else{let tt;Bt>O?tt=1:ot===O?tt=0:tt=(ot-Bt)/(ot-O),Y=nt-(nt-u)*tt,dt=d-(d-o)*tt,at=e-(e-C)*tt,lt=i-(i-y)*tt}let xt;Bt<X?xt=0:Bt>O?xt=1:xt=(X-Bt)/(X-O),ut=E-(E-u)*xt,kt=$-($-o)*xt,Et=rt-(rt-C)*xt,Ot=mt-(mt-y)*xt;const Ut=Math.round(Math.min(Y,ut)),Ct=Math.round(Math.max(Y,ut));let it=W*Bt+Ut*4;for(let tt=Ut;tt<=Ct;tt++)xt=(Y-tt)/(Y-ut),xt<0?xt=0:xt>1&&(xt=1),g[it++]=dt-(dt-kt)*xt|0,g[it++]=at-(at-Et)*xt|0,g[it++]=lt-(lt-Ot)*xt|0,g[it++]=255}}function m(_,w,P){const A=w.coords,n=w.colors;let r,F;switch(w.type){case"lattice":const f=w.verticesPerRow,s=Math.floor(A.length/f)-1,x=f-1;for(r=0;r<s;r++){let g=r*f;for(let W=0;W<x;W++,g++)D(_,P,A[g],A[g+1],A[g+f],n[g],n[g+1],n[g+f]),D(_,P,A[g+f+1],A[g+1],A[g+f],n[g+f+1],n[g+1],n[g+f])}break;case"triangles":for(r=0,F=A.length;r<F;r+=3)D(_,P,A[r],A[r+1],A[r+2],n[r],n[r+1],n[r+2]);break;default:throw new Error("illegal figure")}}class L extends bt{constructor(w){super(),this._coords=w[2],this._colors=w[3],this._figures=w[4],this._bounds=w[5],this._bbox=w[7],this._background=w[8],this.matrix=null}_createMeshCanvas(w,P,A){const f=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),x=Math.ceil(this._bounds[2])-f,g=Math.ceil(this._bounds[3])-s,W=Math.min(Math.ceil(Math.abs(x*w[0]*1.1)),3e3),z=Math.min(Math.ceil(Math.abs(g*w[1]*1.1)),3e3),E=x/W,X=g/z,nt={coords:this._coords,colors:this._colors,offsetX:-f,offsetY:-s,scaleX:1/E,scaleY:1/X},ot=W+2*2,u=z+2*2,O=A.getCanvas("mesh",ot,u,!1),$=O.context,rt=$.createImageData(W,z);if(P){const d=rt.data;for(let e=0,i=d.length;e<i;e+=4)d[e]=P[0],d[e+1]=P[1],d[e+2]=P[2],d[e+3]=255}for(const d of this._figures)m(rt,d,nt);return $.putImageData(rt,2,2),{canvas:O.canvas,offsetX:f-2*E,offsetY:s-2*X,scaleX:E,scaleY:X}}getPattern(w,P,A,n){K(w,this._bbox);let r;if(n===ht.SHADING)r=l.Util.singularValueDecompose2dScale((0,M.getCurrentTransform)(w));else if(r=l.Util.singularValueDecompose2dScale(P.baseTransform),this.matrix){const f=l.Util.singularValueDecompose2dScale(this.matrix);r=[r[0]*f[0],r[1]*f[1]]}const F=this._createMeshCanvas(r,n===ht.SHADING?null:this._background,P.cachedCanvases);return n!==ht.SHADING&&(w.setTransform(...P.baseTransform),this.matrix&&w.transform(...this.matrix)),w.translate(F.offsetX,F.offsetY),w.scale(F.scaleX,F.scaleY),w.createPattern(F.canvas,"no-repeat")}}class U extends bt{getPattern(){return"hotpink"}}function R(_){switch(_[0]){case"RadialAxial":return new H(_);case"Mesh":return new L(_);case"Dummy":return new U}throw new Error(`Unknown IR type: ${_[0]}`)}const S={COLORED:1,UNCOLORED:2},c=class c{constructor(w,P,A,n,r){this.operatorList=w[2],this.matrix=w[3]||[1,0,0,1,0,0],this.bbox=w[4],this.xstep=w[5],this.ystep=w[6],this.paintType=w[7],this.tilingType=w[8],this.color=P,this.ctx=A,this.canvasGraphicsFactory=n,this.baseTransform=r}createPatternCanvas(w){const P=this.operatorList,A=this.bbox,n=this.xstep,r=this.ystep,F=this.paintType,f=this.tilingType,s=this.color,x=this.canvasGraphicsFactory;(0,l.info)("TilingType: "+f);const g=A[0],W=A[1],z=A[2],E=A[3],X=l.Util.singularValueDecompose2dScale(this.matrix),nt=l.Util.singularValueDecompose2dScale(this.baseTransform),ot=[X[0]*nt[0],X[1]*nt[1]],u=this.getSizeAndScale(n,this.ctx.canvas.width,ot[0]),O=this.getSizeAndScale(r,this.ctx.canvas.height,ot[1]),$=w.cachedCanvases.getCanvas("pattern",u.size,O.size,!0),rt=$.context,mt=x.createCanvasGraphics(rt);mt.groupLevel=w.groupLevel,this.setFillAndStrokeStyleToContext(mt,F,s);let d=g,e=W,i=z,o=E;return g<0&&(d=0,i+=Math.abs(g)),W<0&&(e=0,o+=Math.abs(W)),rt.translate(-(u.scale*d),-(O.scale*e)),mt.transform(u.scale,0,0,O.scale,0,0),rt.save(),this.clipBbox(mt,d,e,i,o),mt.baseTransform=(0,M.getCurrentTransform)(mt.ctx),mt.executeOperatorList(P),mt.endDrawing(),{canvas:$.canvas,scaleX:u.scale,scaleY:O.scale,offsetX:d,offsetY:e}}getSizeAndScale(w,P,A){w=Math.abs(w);const n=Math.max(c.MAX_PATTERN_SIZE,P);let r=Math.ceil(w*A);return r>=n?r=n:A=r/w,{scale:A,size:r}}clipBbox(w,P,A,n,r){const F=n-P,f=r-A;w.ctx.rect(P,A,F,f),w.current.updateRectMinMax((0,M.getCurrentTransform)(w.ctx),[P,A,n,r]),w.clip(),w.endPath()}setFillAndStrokeStyleToContext(w,P,A){const n=w.ctx,r=w.current;switch(P){case S.COLORED:const F=this.ctx;n.fillStyle=F.fillStyle,n.strokeStyle=F.strokeStyle,r.fillColor=F.fillStyle,r.strokeColor=F.strokeStyle;break;case S.UNCOLORED:const f=l.Util.makeHexColor(A[0],A[1],A[2]);n.fillStyle=f,n.strokeStyle=f,r.fillColor=f,r.strokeColor=f;break;default:throw new l.FormatError(`Unsupported paint type: ${P}`)}}getPattern(w,P,A,n){let r=A;n!==ht.SHADING&&(r=l.Util.transform(r,P.baseTransform),this.matrix&&(r=l.Util.transform(r,this.matrix)));const F=this.createPatternCanvas(P);let f=new DOMMatrix(r);f=f.translate(F.offsetX,F.offsetY),f=f.scale(1/F.scaleX,1/F.scaleY);const s=w.createPattern(F.canvas,"repeat");return s.setTransform(f),s}};Yt(c,"MAX_PATTERN_SIZE",3e3);let v=c;h.TilingPattern=v},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.convertBlackAndWhiteToRGBA=ht,h.convertToRGBA=M,h.grayToRGBA=bt;var l=ct(1);function M(H){switch(H.kind){case l.ImageKind.GRAYSCALE_1BPP:return ht(H);case l.ImageKind.RGB_24BPP:return K(H)}return null}function ht({src:H,srcPos:D=0,dest:m,width:L,height:U,nonBlackColor:R=4294967295,inverseDecode:S=!1}){const v=l.FeatureTest.isLittleEndian?4278190080:255,[c,_]=S?[R,v]:[v,R],w=L>>3,P=L&7,A=H.length;m=new Uint32Array(m.buffer);let n=0;for(let r=0;r<U;r++){for(const f=D+w;D<f;D++){const s=D<A?H[D]:255;m[n++]=s&128?_:c,m[n++]=s&64?_:c,m[n++]=s&32?_:c,m[n++]=s&16?_:c,m[n++]=s&8?_:c,m[n++]=s&4?_:c,m[n++]=s&2?_:c,m[n++]=s&1?_:c}if(P===0)continue;const F=D<A?H[D++]:255;for(let f=0;f<P;f++)m[n++]=F&1<<7-f?_:c}return{srcPos:D,destPos:n}}function K({src:H,srcPos:D=0,dest:m,destPos:L=0,width:U,height:R}){let S=0;const v=H.length>>2,c=new Uint32Array(H.buffer,D,v);if(l.FeatureTest.isLittleEndian){for(;S<v-2;S+=3,L+=4){const _=c[S],w=c[S+1],P=c[S+2];m[L]=_|4278190080,m[L+1]=_>>>24|w<<8|4278190080,m[L+2]=w>>>16|P<<16|4278190080,m[L+3]=P>>>8|4278190080}for(let _=S*4,w=H.length;_<w;_+=3)m[L++]=H[_]|H[_+1]<<8|H[_+2]<<16|4278190080}else{for(;S<v-2;S+=3,L+=4){const _=c[S],w=c[S+1],P=c[S+2];m[L]=_|255,m[L+1]=_<<24|w>>>8|255,m[L+2]=w<<16|P>>>16|255,m[L+3]=P<<8|255}for(let _=S*4,w=H.length;_<w;_+=3)m[L++]=H[_]<<24|H[_+1]<<16|H[_+2]<<8|255}return{srcPos:D,destPos:L}}function bt(H,D){if(l.FeatureTest.isLittleEndian)for(let m=0,L=H.length;m<L;m++)D[m]=H[m]*65793|4278190080;else for(let m=0,L=H.length;m<L;m++)D[m]=H[m]*16843008|255}},(wt,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.GlobalWorkerOptions=void 0;const ct=Object.create(null);h.GlobalWorkerOptions=ct,ct.workerPort=null,ct.workerSrc=""},(wt,h,ct)=>{var H,Si,m,Ei,U,Se;Object.defineProperty(h,"__esModule",{value:!0}),h.MessageHandler=void 0;var l=ct(1);const M={UNKNOWN:0,DATA:1,ERROR:2},ht={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function K(S){switch(S instanceof Error||typeof S=="object"&&S!==null||(0,l.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),S.name){case"AbortException":return new l.AbortException(S.message);case"MissingPDFException":return new l.MissingPDFException(S.message);case"PasswordException":return new l.PasswordException(S.message,S.code);case"UnexpectedResponseException":return new l.UnexpectedResponseException(S.message,S.status);case"UnknownErrorException":return new l.UnknownErrorException(S.message,S.details);default:return new l.UnknownErrorException(S.message,S.toString())}}class bt{constructor(v,c,_){I(this,H);I(this,m);I(this,U);this.sourceName=v,this.targetName=c,this.comObj=_,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),this._onComObjOnMessage=w=>{const P=w.data;if(P.targetName!==this.sourceName)return;if(P.stream){V(this,m,Ei).call(this,P);return}if(P.callback){const n=P.callbackId,r=this.callbackCapabilities[n];if(!r)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],P.callback===M.DATA)r.resolve(P.data);else if(P.callback===M.ERROR)r.reject(K(P.reason));else throw new Error("Unexpected callback case");return}const A=this.actionHandler[P.action];if(!A)throw new Error(`Unknown action from worker: ${P.action}`);if(P.callbackId){const n=this.sourceName,r=P.sourceName;new Promise(function(F){F(A(P.data))}).then(function(F){_.postMessage({sourceName:n,targetName:r,callback:M.DATA,callbackId:P.callbackId,data:F})},function(F){_.postMessage({sourceName:n,targetName:r,callback:M.ERROR,callbackId:P.callbackId,reason:K(F)})});return}if(P.streamId){V(this,H,Si).call(this,P);return}A(P.data)},_.addEventListener("message",this._onComObjOnMessage)}on(v,c){const _=this.actionHandler;if(_[v])throw new Error(`There is already an actionName called "${v}"`);_[v]=c}send(v,c,_){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:v,data:c},_)}sendWithPromise(v,c,_){const w=this.callbackId++,P=new l.PromiseCapability;this.callbackCapabilities[w]=P;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:v,callbackId:w,data:c},_)}catch(A){P.reject(A)}return P.promise}sendWithStream(v,c,_,w){const P=this.streamId++,A=this.sourceName,n=this.targetName,r=this.comObj;return new ReadableStream({start:F=>{const f=new l.PromiseCapability;return this.streamControllers[P]={controller:F,startCall:f,pullCall:null,cancelCall:null,isClosed:!1},r.postMessage({sourceName:A,targetName:n,action:v,streamId:P,data:c,desiredSize:F.desiredSize},w),f.promise},pull:F=>{const f=new l.PromiseCapability;return this.streamControllers[P].pullCall=f,r.postMessage({sourceName:A,targetName:n,stream:ht.PULL,streamId:P,desiredSize:F.desiredSize}),f.promise},cancel:F=>{(0,l.assert)(F instanceof Error,"cancel must have a valid reason");const f=new l.PromiseCapability;return this.streamControllers[P].cancelCall=f,this.streamControllers[P].isClosed=!0,r.postMessage({sourceName:A,targetName:n,stream:ht.CANCEL,streamId:P,reason:K(F)}),f.promise}},_)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}H=new WeakSet,Si=function(v){const c=v.streamId,_=this.sourceName,w=v.sourceName,P=this.comObj,A=this,n=this.actionHandler[v.action],r={enqueue(F,f=1,s){if(this.isCancelled)return;const x=this.desiredSize;this.desiredSize-=f,x>0&&this.desiredSize<=0&&(this.sinkCapability=new l.PromiseCapability,this.ready=this.sinkCapability.promise),P.postMessage({sourceName:_,targetName:w,stream:ht.ENQUEUE,streamId:c,chunk:F},s)},close(){this.isCancelled||(this.isCancelled=!0,P.postMessage({sourceName:_,targetName:w,stream:ht.CLOSE,streamId:c}),delete A.streamSinks[c])},error(F){(0,l.assert)(F instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,P.postMessage({sourceName:_,targetName:w,stream:ht.ERROR,streamId:c,reason:K(F)}))},sinkCapability:new l.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:v.desiredSize,ready:null};r.sinkCapability.resolve(),r.ready=r.sinkCapability.promise,this.streamSinks[c]=r,new Promise(function(F){F(n(v.data,r))}).then(function(){P.postMessage({sourceName:_,targetName:w,stream:ht.START_COMPLETE,streamId:c,success:!0})},function(F){P.postMessage({sourceName:_,targetName:w,stream:ht.START_COMPLETE,streamId:c,reason:K(F)})})},m=new WeakSet,Ei=function(v){const c=v.streamId,_=this.sourceName,w=v.sourceName,P=this.comObj,A=this.streamControllers[c],n=this.streamSinks[c];switch(v.stream){case ht.START_COMPLETE:v.success?A.startCall.resolve():A.startCall.reject(K(v.reason));break;case ht.PULL_COMPLETE:v.success?A.pullCall.resolve():A.pullCall.reject(K(v.reason));break;case ht.PULL:if(!n){P.postMessage({sourceName:_,targetName:w,stream:ht.PULL_COMPLETE,streamId:c,success:!0});break}n.desiredSize<=0&&v.desiredSize>0&&n.sinkCapability.resolve(),n.desiredSize=v.desiredSize,new Promise(function(r){var F;r((F=n.onPull)==null?void 0:F.call(n))}).then(function(){P.postMessage({sourceName:_,targetName:w,stream:ht.PULL_COMPLETE,streamId:c,success:!0})},function(r){P.postMessage({sourceName:_,targetName:w,stream:ht.PULL_COMPLETE,streamId:c,reason:K(r)})});break;case ht.ENQUEUE:if((0,l.assert)(A,"enqueue should have stream controller"),A.isClosed)break;A.controller.enqueue(v.chunk);break;case ht.CLOSE:if((0,l.assert)(A,"close should have stream controller"),A.isClosed)break;A.isClosed=!0,A.controller.close(),V(this,U,Se).call(this,A,c);break;case ht.ERROR:(0,l.assert)(A,"error should have stream controller"),A.controller.error(K(v.reason)),V(this,U,Se).call(this,A,c);break;case ht.CANCEL_COMPLETE:v.success?A.cancelCall.resolve():A.cancelCall.reject(K(v.reason)),V(this,U,Se).call(this,A,c);break;case ht.CANCEL:if(!n)break;new Promise(function(r){var F;r((F=n.onCancel)==null?void 0:F.call(n,K(v.reason)))}).then(function(){P.postMessage({sourceName:_,targetName:w,stream:ht.CANCEL_COMPLETE,streamId:c,success:!0})},function(r){P.postMessage({sourceName:_,targetName:w,stream:ht.CANCEL_COMPLETE,streamId:c,reason:K(r)})}),n.sinkCapability.reject(K(v.reason)),n.isCancelled=!0,delete this.streamSinks[c];break;default:throw new Error("Unexpected stream case")}},U=new WeakSet,Se=async function(v,c){var _,w,P;await Promise.allSettled([(_=v.startCall)==null?void 0:_.promise,(w=v.pullCall)==null?void 0:w.promise,(P=v.cancelCall)==null?void 0:P.promise]),delete this.streamControllers[c]},h.MessageHandler=bt},(wt,h,ct)=>{var ht,K;Object.defineProperty(h,"__esModule",{value:!0}),h.Metadata=void 0;var l=ct(1);class M{constructor({parsedData:H,rawData:D}){I(this,ht,void 0);I(this,K,void 0);st(this,ht,H),st(this,K,D)}getRaw(){return t(this,K)}get(H){return t(this,ht).get(H)??null}getAll(){return(0,l.objectFromMap)(t(this,ht))}has(H){return t(this,ht).has(H)}}ht=new WeakMap,K=new WeakMap,h.Metadata=M},(wt,h,ct)=>{var H,D,m,L,U,R,Ge;Object.defineProperty(h,"__esModule",{value:!0}),h.OptionalContentConfig=void 0;var l=ct(1),M=ct(8);const ht=Symbol("INTERNAL");class K{constructor(c,_){I(this,H,!0);this.name=c,this.intent=_}get visible(){return t(this,H)}_setVisible(c,_){c!==ht&&(0,l.unreachable)("Internal method `_setVisible` called."),st(this,H,_)}}H=new WeakMap;class bt{constructor(c){I(this,R);I(this,D,null);I(this,m,new Map);I(this,L,null);I(this,U,null);if(this.name=null,this.creator=null,c!==null){this.name=c.name,this.creator=c.creator,st(this,U,c.order);for(const _ of c.groups)t(this,m).set(_.id,new K(_.name,_.intent));if(c.baseState==="OFF")for(const _ of t(this,m).values())_._setVisible(ht,!1);for(const _ of c.on)t(this,m).get(_)._setVisible(ht,!0);for(const _ of c.off)t(this,m).get(_)._setVisible(ht,!1);st(this,L,this.getHash())}}isVisible(c){if(t(this,m).size===0)return!0;if(!c)return(0,l.warn)("Optional content group not defined."),!0;if(c.type==="OCG")return t(this,m).has(c.id)?t(this,m).get(c.id).visible:((0,l.warn)(`Optional content group not found: ${c.id}`),!0);if(c.type==="OCMD"){if(c.expression)return V(this,R,Ge).call(this,c.expression);if(!c.policy||c.policy==="AnyOn"){for(const _ of c.ids){if(!t(this,m).has(_))return(0,l.warn)(`Optional content group not found: ${_}`),!0;if(t(this,m).get(_).visible)return!0}return!1}else if(c.policy==="AllOn"){for(const _ of c.ids){if(!t(this,m).has(_))return(0,l.warn)(`Optional content group not found: ${_}`),!0;if(!t(this,m).get(_).visible)return!1}return!0}else if(c.policy==="AnyOff"){for(const _ of c.ids){if(!t(this,m).has(_))return(0,l.warn)(`Optional content group not found: ${_}`),!0;if(!t(this,m).get(_).visible)return!0}return!1}else if(c.policy==="AllOff"){for(const _ of c.ids){if(!t(this,m).has(_))return(0,l.warn)(`Optional content group not found: ${_}`),!0;if(t(this,m).get(_).visible)return!1}return!0}return(0,l.warn)(`Unknown optional content policy ${c.policy}.`),!0}return(0,l.warn)(`Unknown group type ${c.type}.`),!0}setVisibility(c,_=!0){if(!t(this,m).has(c)){(0,l.warn)(`Optional content group not found: ${c}`);return}t(this,m).get(c)._setVisible(ht,!!_),st(this,D,null)}get hasInitialVisibility(){return t(this,L)===null||this.getHash()===t(this,L)}getOrder(){return t(this,m).size?t(this,U)?t(this,U).slice():[...t(this,m).keys()]:null}getGroups(){return t(this,m).size>0?(0,l.objectFromMap)(t(this,m)):null}getGroup(c){return t(this,m).get(c)||null}getHash(){if(t(this,D)!==null)return t(this,D);const c=new M.MurmurHash3_64;for(const[_,w]of t(this,m))c.update(`${_}:${w.visible}`);return st(this,D,c.hexdigest())}}D=new WeakMap,m=new WeakMap,L=new WeakMap,U=new WeakMap,R=new WeakSet,Ge=function(c){const _=c.length;if(_<2)return!0;const w=c[0];for(let P=1;P<_;P++){const A=c[P];let n;if(Array.isArray(A))n=V(this,R,Ge).call(this,A);else if(t(this,m).has(A))n=t(this,m).get(A).visible;else return(0,l.warn)(`Optional content group not found: ${A}`),!0;switch(w){case"And":if(!n)return!1;break;case"Or":if(n)return!0;break;case"Not":return!n;default:return!0}}return w==="And"},h.OptionalContentConfig=bt},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.PDFDataTransportStream=void 0;var l=ct(1),M=ct(6);class ht{constructor({length:D,initialData:m,progressiveDone:L=!1,contentDispositionFilename:U=null,disableRange:R=!1,disableStream:S=!1},v){if((0,l.assert)(v,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=L,this._contentDispositionFilename=U,(m==null?void 0:m.length)>0){const c=m instanceof Uint8Array&&m.byteLength===m.buffer.byteLength?m.buffer:new Uint8Array(m).buffer;this._queuedChunks.push(c)}this._pdfDataRangeTransport=v,this._isStreamingSupported=!S,this._isRangeSupported=!R,this._contentLength=D,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((c,_)=>{this._onReceiveData({begin:c,chunk:_})}),this._pdfDataRangeTransport.addProgressListener((c,_)=>{this._onProgress({loaded:c,total:_})}),this._pdfDataRangeTransport.addProgressiveReadListener(c=>{this._onReceiveData({chunk:c})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:D,chunk:m}){const L=m instanceof Uint8Array&&m.byteLength===m.buffer.byteLength?m.buffer:new Uint8Array(m).buffer;if(D===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(L):this._queuedChunks.push(L);else{const U=this._rangeReaders.some(function(R){return R._begin!==D?!1:(R._enqueue(L),!0)});(0,l.assert)(U,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var D;return((D=this._fullRequestReader)==null?void 0:D._loaded)??0}_onProgress(D){var m,L,U,R;D.total===void 0?(L=(m=this._rangeReaders[0])==null?void 0:m.onProgress)==null||L.call(m,{loaded:D.loaded}):(R=(U=this._fullRequestReader)==null?void 0:U.onProgress)==null||R.call(U,{loaded:D.loaded,total:D.total})}_onProgressiveDone(){var D;(D=this._fullRequestReader)==null||D.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(D){const m=this._rangeReaders.indexOf(D);m>=0&&this._rangeReaders.splice(m,1)}getFullReader(){(0,l.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const D=this._queuedChunks;return this._queuedChunks=null,new K(this,D,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(D,m){if(m<=this._progressiveDataLength)return null;const L=new bt(this,D,m);return this._pdfDataRangeTransport.requestDataRange(D,m),this._rangeReaders.push(L),L}cancelAllRequests(D){var m;(m=this._fullRequestReader)==null||m.cancel(D);for(const L of this._rangeReaders.slice(0))L.cancel(D);this._pdfDataRangeTransport.abort()}}h.PDFDataTransportStream=ht;class K{constructor(D,m,L=!1,U=null){this._stream=D,this._done=L||!1,this._filename=(0,M.isPdfFile)(U)?U:null,this._queuedChunks=m||[],this._loaded=0;for(const R of this._queuedChunks)this._loaded+=R.byteLength;this._requests=[],this._headersReady=Promise.resolve(),D._fullRequestReader=this,this.onProgress=null}_enqueue(D){this._done||(this._requests.length>0?this._requests.shift().resolve({value:D,done:!1}):this._queuedChunks.push(D),this._loaded+=D.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const D=new l.PromiseCapability;return this._requests.push(D),D.promise}cancel(D){this._done=!0;for(const m of this._requests)m.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class bt{constructor(D,m,L){this._stream=D,this._begin=m,this._end=L,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(D){if(!this._done){if(this._requests.length===0)this._queuedChunk=D;else{this._requests.shift().resolve({value:D,done:!1});for(const L of this._requests)L.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){const m=this._queuedChunk;return this._queuedChunk=null,{value:m,done:!1}}if(this._done)return{value:void 0,done:!0};const D=new l.PromiseCapability;return this._requests.push(D),D.promise}cancel(D){this._done=!0;for(const m of this._requests)m.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.PDFFetchStream=void 0;var l=ct(1),M=ct(20);function ht(L,U,R){return{method:"GET",headers:L,signal:R.signal,mode:"cors",credentials:U?"include":"same-origin",redirect:"follow"}}function K(L){const U=new Headers;for(const R in L){const S=L[R];S!==void 0&&U.append(R,S)}return U}function bt(L){return L instanceof Uint8Array?L.buffer:L instanceof ArrayBuffer?L:((0,l.warn)(`getArrayBuffer - unexpected data format: ${L}`),new Uint8Array(L).buffer)}class H{constructor(U){this.source=U,this.isHttp=/^https?:/i.test(U.url),this.httpHeaders=this.isHttp&&U.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var U;return((U=this._fullRequestReader)==null?void 0:U._loaded)??0}getFullReader(){return(0,l.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new D(this),this._fullRequestReader}getRangeReader(U,R){if(R<=this._progressiveDataLength)return null;const S=new m(this,U,R);return this._rangeRequestReaders.push(S),S}cancelAllRequests(U){var R;(R=this._fullRequestReader)==null||R.cancel(U);for(const S of this._rangeRequestReaders.slice(0))S.cancel(U)}}h.PDFFetchStream=H;class D{constructor(U){this._stream=U,this._reader=null,this._loaded=0,this._filename=null;const R=U.source;this._withCredentials=R.withCredentials||!1,this._contentLength=R.length,this._headersCapability=new l.PromiseCapability,this._disableRange=R.disableRange||!1,this._rangeChunkSize=R.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!R.disableStream,this._isRangeSupported=!R.disableRange,this._headers=K(this._stream.httpHeaders);const S=R.url;fetch(S,ht(this._headers,this._withCredentials,this._abortController)).then(v=>{if(!(0,M.validateResponseStatus)(v.status))throw(0,M.createResponseStatusError)(v.status,S);this._reader=v.body.getReader(),this._headersCapability.resolve();const c=P=>v.headers.get(P),{allowRangeRequests:_,suggestedLength:w}=(0,M.validateRangeRequestCapabilities)({getResponseHeader:c,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=_,this._contentLength=w||this._contentLength,this._filename=(0,M.extractFilenameFromHeader)(c),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new l.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(){var S;await this._headersCapability.promise;const{value:U,done:R}=await this._reader.read();return R?{value:U,done:R}:(this._loaded+=U.byteLength,(S=this.onProgress)==null||S.call(this,{loaded:this._loaded,total:this._contentLength}),{value:bt(U),done:!1})}cancel(U){var R;(R=this._reader)==null||R.cancel(U),this._abortController.abort()}}class m{constructor(U,R,S){this._stream=U,this._reader=null,this._loaded=0;const v=U.source;this._withCredentials=v.withCredentials||!1,this._readCapability=new l.PromiseCapability,this._isStreamingSupported=!v.disableStream,this._abortController=new AbortController,this._headers=K(this._stream.httpHeaders),this._headers.append("Range",`bytes=${R}-${S-1}`);const c=v.url;fetch(c,ht(this._headers,this._withCredentials,this._abortController)).then(_=>{if(!(0,M.validateResponseStatus)(_.status))throw(0,M.createResponseStatusError)(_.status,c);this._readCapability.resolve(),this._reader=_.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var S;await this._readCapability.promise;const{value:U,done:R}=await this._reader.read();return R?{value:U,done:R}:(this._loaded+=U.byteLength,(S=this.onProgress)==null||S.call(this,{loaded:this._loaded}),{value:bt(U),done:!1})}cancel(U){var R;(R=this._reader)==null||R.cancel(U),this._abortController.abort()}}},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.createResponseStatusError=H,h.extractFilenameFromHeader=bt,h.validateRangeRequestCapabilities=K,h.validateResponseStatus=D;var l=ct(1),M=ct(21),ht=ct(6);function K({getResponseHeader:m,isHttp:L,rangeChunkSize:U,disableRange:R}){const S={allowRangeRequests:!1,suggestedLength:void 0},v=parseInt(m("Content-Length"),10);return!Number.isInteger(v)||(S.suggestedLength=v,v<=2*U)||R||!L||m("Accept-Ranges")!=="bytes"||(m("Content-Encoding")||"identity")!=="identity"||(S.allowRangeRequests=!0),S}function bt(m){const L=m("Content-Disposition");if(L){let U=(0,M.getFilenameFromContentDispositionHeader)(L);if(U.includes("%"))try{U=decodeURIComponent(U)}catch{}if((0,ht.isPdfFile)(U))return U}return null}function H(m,L){return m===404||m===0&&L.startsWith("file:")?new l.MissingPDFException('Missing PDF "'+L+'".'):new l.UnexpectedResponseException(`Unexpected server response (${m}) while retrieving PDF "${L}".`,m)}function D(m){return m===200||m===206}},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.getFilenameFromContentDispositionHeader=M;var l=ct(1);function M(ht){let K=!0,bt=H("filename\\*","i").exec(ht);if(bt){bt=bt[1];let v=U(bt);return v=unescape(v),v=R(v),v=S(v),m(v)}if(bt=L(ht),bt){const v=S(bt);return m(v)}if(bt=H("filename","i").exec(ht),bt){bt=bt[1];let v=U(bt);return v=S(v),m(v)}function H(v,c){return new RegExp("(?:^|;)\\s*"+v+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',c)}function D(v,c){if(v){if(!/^[\x00-\xFF]+$/.test(c))return c;try{const _=new TextDecoder(v,{fatal:!0}),w=(0,l.stringToBytes)(c);c=_.decode(w),K=!1}catch{}}return c}function m(v){return K&&/[\x80-\xff]/.test(v)&&(v=D("utf-8",v),K&&(v=D("iso-8859-1",v))),v}function L(v){const c=[];let _;const w=H("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(_=w.exec(v))!==null;){let[,A,n,r]=_;if(A=parseInt(A,10),A in c){if(A===0)break;continue}c[A]=[n,r]}const P=[];for(let A=0;A<c.length&&A in c;++A){let[n,r]=c[A];r=U(r),n&&(r=unescape(r),A===0&&(r=R(r))),P.push(r)}return P.join("")}function U(v){if(v.startsWith('"')){const c=v.slice(1).split('\\"');for(let _=0;_<c.length;++_){const w=c[_].indexOf('"');w!==-1&&(c[_]=c[_].slice(0,w),c.length=_+1),c[_]=c[_].replaceAll(/\\(.)/g,"$1")}v=c.join('"')}return v}function R(v){const c=v.indexOf("'");if(c===-1)return v;const _=v.slice(0,c),P=v.slice(c+1).replace(/^[^']*'/,"");return D(_,P)}function S(v){return!v.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(v)?v:v.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(c,_,w,P){if(w==="q"||w==="Q")return P=P.replaceAll("_"," "),P=P.replaceAll(/=([0-9a-fA-F]{2})/g,function(A,n){return String.fromCharCode(parseInt(n,16))}),D(_,P);try{P=atob(P)}catch{}return D(_,P)})}return""}},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.PDFNetworkStream=void 0;var l=ct(1),M=ct(20);const ht=200,K=206;function bt(U){const R=U.response;return typeof R!="string"?R:(0,l.stringToBytes)(R).buffer}class H{constructor(R,S={}){this.url=R,this.isHttp=/^https?:/i.test(R),this.httpHeaders=this.isHttp&&S.httpHeaders||Object.create(null),this.withCredentials=S.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(R,S,v){const c={begin:R,end:S};for(const _ in v)c[_]=v[_];return this.request(c)}requestFull(R){return this.request(R)}request(R){const S=new XMLHttpRequest,v=this.currXhrId++,c=this.pendingRequests[v]={xhr:S};S.open("GET",this.url),S.withCredentials=this.withCredentials;for(const _ in this.httpHeaders){const w=this.httpHeaders[_];w!==void 0&&S.setRequestHeader(_,w)}return this.isHttp&&"begin"in R&&"end"in R?(S.setRequestHeader("Range",`bytes=${R.begin}-${R.end-1}`),c.expectedStatus=K):c.expectedStatus=ht,S.responseType="arraybuffer",R.onError&&(S.onerror=function(_){R.onError(S.status)}),S.onreadystatechange=this.onStateChange.bind(this,v),S.onprogress=this.onProgress.bind(this,v),c.onHeadersReceived=R.onHeadersReceived,c.onDone=R.onDone,c.onError=R.onError,c.onProgress=R.onProgress,S.send(null),v}onProgress(R,S){var c;const v=this.pendingRequests[R];v&&((c=v.onProgress)==null||c.call(v,S))}onStateChange(R,S){var A,n,r;const v=this.pendingRequests[R];if(!v)return;const c=v.xhr;if(c.readyState>=2&&v.onHeadersReceived&&(v.onHeadersReceived(),delete v.onHeadersReceived),c.readyState!==4||!(R in this.pendingRequests))return;if(delete this.pendingRequests[R],c.status===0&&this.isHttp){(A=v.onError)==null||A.call(v,c.status);return}const _=c.status||ht;if(!(_===ht&&v.expectedStatus===K)&&_!==v.expectedStatus){(n=v.onError)==null||n.call(v,c.status);return}const P=bt(c);if(_===K){const F=c.getResponseHeader("Content-Range"),f=/bytes (\d+)-(\d+)\/(\d+)/.exec(F);v.onDone({begin:parseInt(f[1],10),chunk:P})}else P?v.onDone({begin:0,chunk:P}):(r=v.onError)==null||r.call(v,c.status)}getRequestXhr(R){return this.pendingRequests[R].xhr}isPendingRequest(R){return R in this.pendingRequests}abortRequest(R){const S=this.pendingRequests[R].xhr;delete this.pendingRequests[R],S.abort()}}class D{constructor(R){this._source=R,this._manager=new H(R.url,{httpHeaders:R.httpHeaders,withCredentials:R.withCredentials}),this._rangeChunkSize=R.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(R){const S=this._rangeRequestReaders.indexOf(R);S>=0&&this._rangeRequestReaders.splice(S,1)}getFullReader(){return(0,l.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new m(this._manager,this._source),this._fullRequestReader}getRangeReader(R,S){const v=new L(this._manager,R,S);return v.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(v),v}cancelAllRequests(R){var S;(S=this._fullRequestReader)==null||S.cancel(R);for(const v of this._rangeRequestReaders.slice(0))v.cancel(R)}}h.PDFNetworkStream=D;class m{constructor(R,S){this._manager=R;const v={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=S.url,this._fullRequestId=R.requestFull(v),this._headersReceivedCapability=new l.PromiseCapability,this._disableRange=S.disableRange||!1,this._contentLength=S.length,this._rangeChunkSize=S.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const R=this._fullRequestId,S=this._manager.getRequestXhr(R),v=w=>S.getResponseHeader(w),{allowRangeRequests:c,suggestedLength:_}=(0,M.validateRangeRequestCapabilities)({getResponseHeader:v,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});c&&(this._isRangeSupported=!0),this._contentLength=_||this._contentLength,this._filename=(0,M.extractFilenameFromHeader)(v),this._isRangeSupported&&this._manager.abortRequest(R),this._headersReceivedCapability.resolve()}_onDone(R){if(R&&(this._requests.length>0?this._requests.shift().resolve({value:R.chunk,done:!1}):this._cachedChunks.push(R.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const S of this._requests)S.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(R){this._storedError=(0,M.createResponseStatusError)(R,this._url),this._headersReceivedCapability.reject(this._storedError);for(const S of this._requests)S.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(R){var S;(S=this.onProgress)==null||S.call(this,{loaded:R.loaded,total:R.lengthComputable?R.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const R=new l.PromiseCapability;return this._requests.push(R),R.promise}cancel(R){this._done=!0,this._headersReceivedCapability.reject(R);for(const S of this._requests)S.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(R,S,v){this._manager=R;const c={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=R.url,this._requestId=R.requestRange(S,v,c),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var R;(R=this.onClosed)==null||R.call(this,this)}_onDone(R){const S=R.chunk;this._requests.length>0?this._requests.shift().resolve({value:S,done:!1}):this._queuedChunk=S,this._done=!0;for(const v of this._requests)v.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(R){this._storedError=(0,M.createResponseStatusError)(R,this._url);for(const S of this._requests)S.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(R){var S;this.isStreamingSupported||(S=this.onProgress)==null||S.call(this,{loaded:R.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const S=this._queuedChunk;return this._queuedChunk=null,{value:S,done:!1}}if(this._done)return{value:void 0,done:!0};const R=new l.PromiseCapability;return this._requests.push(R),R.promise}cancel(R){this._done=!0;for(const S of this._requests)S.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.PDFNodeStream=void 0;var l=ct(1),M=ct(20);const ht=/^file:\/\/\/[a-zA-Z]:\//;function K(v){const c=require$$5,_=c.parse(v);return _.protocol==="file:"||_.host?_:/^[a-z]:[/\\]/i.test(v)?c.parse(`file:///${v}`):(_.host||(_.protocol="file:"),_)}class bt{constructor(c){this.source=c,this.url=K(c.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&c.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var c;return((c=this._fullRequestReader)==null?void 0:c._loaded)??0}getFullReader(){return(0,l.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new R(this):new L(this),this._fullRequestReader}getRangeReader(c,_){if(_<=this._progressiveDataLength)return null;const w=this.isFsUrl?new S(this,c,_):new U(this,c,_);return this._rangeRequestReaders.push(w),w}cancelAllRequests(c){var _;(_=this._fullRequestReader)==null||_.cancel(c);for(const w of this._rangeRequestReaders.slice(0))w.cancel(c)}}h.PDFNodeStream=bt;class H{constructor(c){this._url=c.url,this._done=!1,this._storedError=null,this.onProgress=null;const _=c.source;this._contentLength=_.length,this._loaded=0,this._filename=null,this._disableRange=_.disableRange||!1,this._rangeChunkSize=_.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!_.disableStream,this._isRangeSupported=!_.disableRange,this._readableStream=null,this._readCapability=new l.PromiseCapability,this._headersCapability=new l.PromiseCapability}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(){var w;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const c=this._readableStream.read();return c===null?(this._readCapability=new l.PromiseCapability,this.read()):(this._loaded+=c.length,(w=this.onProgress)==null||w.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(c).buffer,done:!1})}cancel(c){if(!this._readableStream){this._error(c);return}this._readableStream.destroy(c)}_error(c){this._storedError=c,this._readCapability.resolve()}_setReadableStream(c){this._readableStream=c,c.on("readable",()=>{this._readCapability.resolve()}),c.on("end",()=>{c.destroy(),this._done=!0,this._readCapability.resolve()}),c.on("error",_=>{this._error(_)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new l.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class D{constructor(c){this._url=c.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new l.PromiseCapability;const _=c.source;this._isStreamingSupported=!_.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var w;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const c=this._readableStream.read();return c===null?(this._readCapability=new l.PromiseCapability,this.read()):(this._loaded+=c.length,(w=this.onProgress)==null||w.call(this,{loaded:this._loaded}),{value:new Uint8Array(c).buffer,done:!1})}cancel(c){if(!this._readableStream){this._error(c);return}this._readableStream.destroy(c)}_error(c){this._storedError=c,this._readCapability.resolve()}_setReadableStream(c){this._readableStream=c,c.on("readable",()=>{this._readCapability.resolve()}),c.on("end",()=>{c.destroy(),this._done=!0,this._readCapability.resolve()}),c.on("error",_=>{this._error(_)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function m(v,c){return{protocol:v.protocol,auth:v.auth,host:v.hostname,port:v.port,path:v.path,method:"GET",headers:c}}class L extends H{constructor(c){super(c);const _=w=>{if(w.statusCode===404){const r=new l.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=r,this._headersCapability.reject(r);return}this._headersCapability.resolve(),this._setReadableStream(w);const P=r=>this._readableStream.headers[r.toLowerCase()],{allowRangeRequests:A,suggestedLength:n}=(0,M.validateRangeRequestCapabilities)({getResponseHeader:P,isHttp:c.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=A,this._contentLength=n||this._contentLength,this._filename=(0,M.extractFilenameFromHeader)(P)};if(this._request=null,this._url.protocol==="http:"){const w=require$$5;this._request=w.request(m(this._url,c.httpHeaders),_)}else{const w=require$$5;this._request=w.request(m(this._url,c.httpHeaders),_)}this._request.on("error",w=>{this._storedError=w,this._headersCapability.reject(w)}),this._request.end()}}class U extends D{constructor(c,_,w){super(c),this._httpHeaders={};for(const A in c.httpHeaders){const n=c.httpHeaders[A];n!==void 0&&(this._httpHeaders[A]=n)}this._httpHeaders.Range=`bytes=${_}-${w-1}`;const P=A=>{if(A.statusCode===404){const n=new l.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=n;return}this._setReadableStream(A)};if(this._request=null,this._url.protocol==="http:"){const A=require$$5;this._request=A.request(m(this._url,this._httpHeaders),P)}else{const A=require$$5;this._request=A.request(m(this._url,this._httpHeaders),P)}this._request.on("error",A=>{this._storedError=A}),this._request.end()}}class R extends H{constructor(c){super(c);let _=decodeURIComponent(this._url.path);ht.test(this._url.href)&&(_=_.replace(/^\//,""));const w=require$$5;w.lstat(_,(P,A)=>{if(P){P.code==="ENOENT"&&(P=new l.MissingPDFException(`Missing PDF "${_}".`)),this._storedError=P,this._headersCapability.reject(P);return}this._contentLength=A.size,this._setReadableStream(w.createReadStream(_)),this._headersCapability.resolve()})}}class S extends D{constructor(c,_,w){super(c);let P=decodeURIComponent(this._url.path);ht.test(this._url.href)&&(P=P.replace(/^\//,""));const A=require$$5;this._setReadableStream(A.createReadStream(P,{start:_,end:w-1}))}}},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.SVGGraphics=void 0;var l=ct(6),M=ct(1);const ht={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},K="http://www.w3.org/XML/1998/namespace",bt="http://www.w3.org/1999/xlink",H=["butt","round","square"],D=["miter","round","bevel"],m=function(A,n="",r=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!r)return URL.createObjectURL(new Blob([A],{type:n}));const F="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let f=`data:${n};base64,`;for(let s=0,x=A.length;s<x;s+=3){const g=A[s]&255,W=A[s+1]&255,z=A[s+2]&255,E=g>>2,X=(g&3)<<4|W>>4,nt=s+1<x?(W&15)<<2|z>>6:64,ot=s+2<x?z&63:64;f+=F[E]+F[X]+F[nt]+F[ot]}return f},L=function(){const A=new Uint8Array([137,80,78,71,13,10,26,10]),n=12,r=new Int32Array(256);for(let z=0;z<256;z++){let E=z;for(let X=0;X<8;X++)E=E&1?3988292384^E>>1&2147483647:E>>1&2147483647;r[z]=E}function F(z,E,X){let nt=-1;for(let ot=E;ot<X;ot++){const u=(nt^z[ot])&255,O=r[u];nt=nt>>>8^O}return nt^-1}function f(z,E,X,nt){let ot=nt;const u=E.length;X[ot]=u>>24&255,X[ot+1]=u>>16&255,X[ot+2]=u>>8&255,X[ot+3]=u&255,ot+=4,X[ot]=z.charCodeAt(0)&255,X[ot+1]=z.charCodeAt(1)&255,X[ot+2]=z.charCodeAt(2)&255,X[ot+3]=z.charCodeAt(3)&255,ot+=4,X.set(E,ot),ot+=E.length;const O=F(X,nt+4,ot);X[ot]=O>>24&255,X[ot+1]=O>>16&255,X[ot+2]=O>>8&255,X[ot+3]=O&255}function s(z,E,X){let nt=1,ot=0;for(let u=E;u<X;++u)nt=(nt+(z[u]&255))%65521,ot=(ot+nt)%65521;return ot<<16|nt}function x(z){if(!M.isNodeJS)return g(z);try{const E=parseInt(process.versions.node)>=8?z:Buffer.from(z),X=require$$5.deflateSync(E,{level:9});return X instanceof Uint8Array?X:new Uint8Array(X)}catch(E){(0,M.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+E)}return g(z)}function g(z){let E=z.length;const X=65535,nt=Math.ceil(E/X),ot=new Uint8Array(2+E+nt*5+4);let u=0;ot[u++]=120,ot[u++]=156;let O=0;for(;E>X;)ot[u++]=0,ot[u++]=255,ot[u++]=255,ot[u++]=0,ot[u++]=0,ot.set(z.subarray(O,O+X),u),u+=X,O+=X,E-=X;ot[u++]=1,ot[u++]=E&255,ot[u++]=E>>8&255,ot[u++]=~E&65535&255,ot[u++]=(~E&65535)>>8&255,ot.set(z.subarray(O),u),u+=z.length-O;const $=s(z,0,z.length);return ot[u++]=$>>24&255,ot[u++]=$>>16&255,ot[u++]=$>>8&255,ot[u++]=$&255,ot}function W(z,E,X,nt){const ot=z.width,u=z.height;let O,$,rt;const mt=z.data;switch(E){case M.ImageKind.GRAYSCALE_1BPP:$=0,O=1,rt=ot+7>>3;break;case M.ImageKind.RGB_24BPP:$=2,O=8,rt=ot*3;break;case M.ImageKind.RGBA_32BPP:$=6,O=8,rt=ot*4;break;default:throw new Error("invalid format")}const d=new Uint8Array((1+rt)*u);let e=0,i=0;for(let Y=0;Y<u;++Y)d[e++]=0,d.set(mt.subarray(i,i+rt),e),i+=rt,e+=rt;if(E===M.ImageKind.GRAYSCALE_1BPP&&nt){e=0;for(let Y=0;Y<u;Y++){e++;for(let dt=0;dt<rt;dt++)d[e++]^=255}}const o=new Uint8Array([ot>>24&255,ot>>16&255,ot>>8&255,ot&255,u>>24&255,u>>16&255,u>>8&255,u&255,O,$,0,0,0]),C=x(d),y=A.length+n*3+o.length+C.length,N=new Uint8Array(y);let j=0;return N.set(A,j),j+=A.length,f("IHDR",o,N,j),j+=n+o.length,f("IDATA",C,N,j),j+=n+C.length,f("IEND",new Uint8Array(0),N,j),m(N,"image/png",X)}return function(E,X,nt){const ot=E.kind===void 0?M.ImageKind.GRAYSCALE_1BPP:E.kind;return W(E,ot,X,nt)}}();class U{constructor(){this.fontSizeScale=1,this.fontWeight=ht.fontWeight,this.fontSize=0,this.textMatrix=M.IDENTITY_MATRIX,this.fontMatrix=M.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=M.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=ht.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(n,r){this.x=n,this.y=r}}function R(A){let n=[];const r=[];for(const F of A){if(F.fn==="save"){n.push({fnId:92,fn:"group",items:[]}),r.push(n),n=n.at(-1).items;continue}F.fn==="restore"?n=r.pop():n.push(F)}return n}function S(A){if(Number.isInteger(A))return A.toString();const n=A.toFixed(10);let r=n.length-1;if(n[r]!=="0")return n;do r--;while(n[r]==="0");return n.substring(0,n[r]==="."?r:r+1)}function v(A){if(A[4]===0&&A[5]===0){if(A[1]===0&&A[2]===0)return A[0]===1&&A[3]===1?"":`scale(${S(A[0])} ${S(A[3])})`;if(A[0]===A[3]&&A[1]===-A[2]){const n=Math.acos(A[0])*180/Math.PI;return`rotate(${S(n)})`}}else if(A[0]===1&&A[1]===0&&A[2]===0&&A[3]===1)return`translate(${S(A[4])} ${S(A[5])})`;return`matrix(${S(A[0])} ${S(A[1])} ${S(A[2])} ${S(A[3])} ${S(A[4])} ${S(A[5])})`}let c=0,_=0,w=0;class P{constructor(n,r,F=!1){(0,l.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new l.DOMSVGFactory,this.current=new U,this.transformMatrix=M.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=n,this.objs=r,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!F,this._operatorIdMapping=[];for(const f in M.OPS)this._operatorIdMapping[M.OPS[f]]=f}getObject(n,r=null){return typeof n=="string"?n.startsWith("g_")?this.commonObjs.get(n):this.objs.get(n):r}save(){this.transformStack.push(this.transformMatrix);const n=this.current;this.extraStack.push(n),this.current=n.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(n){this.save(),this.executeOpTree(n),this.restore()}loadDependencies(n){const r=n.fnArray,F=n.argsArray;for(let f=0,s=r.length;f<s;f++)if(r[f]===M.OPS.dependency)for(const x of F[f]){const g=x.startsWith("g_")?this.commonObjs:this.objs,W=new Promise(z=>{g.get(x,z)});this.current.dependencies.push(W)}return Promise.all(this.current.dependencies)}transform(n,r,F,f,s,x){const g=[n,r,F,f,s,x];this.transformMatrix=M.Util.transform(this.transformMatrix,g),this.tgrp=null}getSVG(n,r){this.viewport=r;const F=this._initialize(r);return this.loadDependencies(n).then(()=>(this.transformMatrix=M.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(n)),F))}convertOpList(n){const r=this._operatorIdMapping,F=n.argsArray,f=n.fnArray,s=[];for(let x=0,g=f.length;x<g;x++){const W=f[x];s.push({fnId:W,fn:r[W],args:F[x]})}return R(s)}executeOpTree(n){for(const r of n){const F=r.fn,f=r.fnId,s=r.args;switch(f|0){case M.OPS.beginText:this.beginText();break;case M.OPS.dependency:break;case M.OPS.setLeading:this.setLeading(s);break;case M.OPS.setLeadingMoveText:this.setLeadingMoveText(s[0],s[1]);break;case M.OPS.setFont:this.setFont(s);break;case M.OPS.showText:this.showText(s[0]);break;case M.OPS.showSpacedText:this.showText(s[0]);break;case M.OPS.endText:this.endText();break;case M.OPS.moveText:this.moveText(s[0],s[1]);break;case M.OPS.setCharSpacing:this.setCharSpacing(s[0]);break;case M.OPS.setWordSpacing:this.setWordSpacing(s[0]);break;case M.OPS.setHScale:this.setHScale(s[0]);break;case M.OPS.setTextMatrix:this.setTextMatrix(s[0],s[1],s[2],s[3],s[4],s[5]);break;case M.OPS.setTextRise:this.setTextRise(s[0]);break;case M.OPS.setTextRenderingMode:this.setTextRenderingMode(s[0]);break;case M.OPS.setLineWidth:this.setLineWidth(s[0]);break;case M.OPS.setLineJoin:this.setLineJoin(s[0]);break;case M.OPS.setLineCap:this.setLineCap(s[0]);break;case M.OPS.setMiterLimit:this.setMiterLimit(s[0]);break;case M.OPS.setFillRGBColor:this.setFillRGBColor(s[0],s[1],s[2]);break;case M.OPS.setStrokeRGBColor:this.setStrokeRGBColor(s[0],s[1],s[2]);break;case M.OPS.setStrokeColorN:this.setStrokeColorN(s);break;case M.OPS.setFillColorN:this.setFillColorN(s);break;case M.OPS.shadingFill:this.shadingFill(s[0]);break;case M.OPS.setDash:this.setDash(s[0],s[1]);break;case M.OPS.setRenderingIntent:this.setRenderingIntent(s[0]);break;case M.OPS.setFlatness:this.setFlatness(s[0]);break;case M.OPS.setGState:this.setGState(s[0]);break;case M.OPS.fill:this.fill();break;case M.OPS.eoFill:this.eoFill();break;case M.OPS.stroke:this.stroke();break;case M.OPS.fillStroke:this.fillStroke();break;case M.OPS.eoFillStroke:this.eoFillStroke();break;case M.OPS.clip:this.clip("nonzero");break;case M.OPS.eoClip:this.clip("evenodd");break;case M.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case M.OPS.paintImageXObject:this.paintImageXObject(s[0]);break;case M.OPS.paintInlineImageXObject:this.paintInlineImageXObject(s[0]);break;case M.OPS.paintImageMaskXObject:this.paintImageMaskXObject(s[0]);break;case M.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(s[0],s[1]);break;case M.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case M.OPS.closePath:this.closePath();break;case M.OPS.closeStroke:this.closeStroke();break;case M.OPS.closeFillStroke:this.closeFillStroke();break;case M.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case M.OPS.nextLine:this.nextLine();break;case M.OPS.transform:this.transform(s[0],s[1],s[2],s[3],s[4],s[5]);break;case M.OPS.constructPath:this.constructPath(s[0],s[1]);break;case M.OPS.endPath:this.endPath();break;case 92:this.group(r.items);break;default:(0,M.warn)(`Unimplemented operator ${F}`);break}}}setWordSpacing(n){this.current.wordSpacing=n}setCharSpacing(n){this.current.charSpacing=n}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(n,r,F,f,s,x){const g=this.current;g.textMatrix=g.lineMatrix=[n,r,F,f,s,x],g.textMatrixScale=Math.hypot(n,r),g.x=g.lineX=0,g.y=g.lineY=0,g.xcoords=[],g.ycoords=[],g.tspan=this.svgFactory.createElement("svg:tspan"),g.tspan.setAttributeNS(null,"font-family",g.fontFamily),g.tspan.setAttributeNS(null,"font-size",`${S(g.fontSize)}px`),g.tspan.setAttributeNS(null,"y",S(-g.y)),g.txtElement=this.svgFactory.createElement("svg:text"),g.txtElement.append(g.tspan)}beginText(){const n=this.current;n.x=n.lineX=0,n.y=n.lineY=0,n.textMatrix=M.IDENTITY_MATRIX,n.lineMatrix=M.IDENTITY_MATRIX,n.textMatrixScale=1,n.tspan=this.svgFactory.createElement("svg:tspan"),n.txtElement=this.svgFactory.createElement("svg:text"),n.txtgrp=this.svgFactory.createElement("svg:g"),n.xcoords=[],n.ycoords=[]}moveText(n,r){const F=this.current;F.x=F.lineX+=n,F.y=F.lineY+=r,F.xcoords=[],F.ycoords=[],F.tspan=this.svgFactory.createElement("svg:tspan"),F.tspan.setAttributeNS(null,"font-family",F.fontFamily),F.tspan.setAttributeNS(null,"font-size",`${S(F.fontSize)}px`),F.tspan.setAttributeNS(null,"y",S(-F.y))}showText(n){const r=this.current,F=r.font,f=r.fontSize;if(f===0)return;const s=r.fontSizeScale,x=r.charSpacing,g=r.wordSpacing,W=r.fontDirection,z=r.textHScale*W,E=F.vertical,X=E?1:-1,nt=F.defaultVMetrics,ot=f*r.fontMatrix[0];let u=0;for(const rt of n){if(rt===null){u+=W*g;continue}else if(typeof rt=="number"){u+=X*rt*f/1e3;continue}const mt=(rt.isSpace?g:0)+x,d=rt.fontChar;let e,i,o=rt.width;if(E){let y;const N=rt.vmetric||nt;y=rt.vmetric?N[1]:o*.5,y=-y*ot;const j=N[2]*ot;o=N?-N[0]:o,e=y/s,i=(u+j)/s}else e=u/s,i=0;(rt.isInFont||F.missingFile)&&(r.xcoords.push(r.x+e),E&&r.ycoords.push(-r.y+i),r.tspan.textContent+=d);const C=E?o*ot-mt*W:o*ot+mt*W;u+=C}r.tspan.setAttributeNS(null,"x",r.xcoords.map(S).join(" ")),E?r.tspan.setAttributeNS(null,"y",r.ycoords.map(S).join(" ")):r.tspan.setAttributeNS(null,"y",S(-r.y)),E?r.y-=u:r.x+=u*z,r.tspan.setAttributeNS(null,"font-family",r.fontFamily),r.tspan.setAttributeNS(null,"font-size",`${S(r.fontSize)}px`),r.fontStyle!==ht.fontStyle&&r.tspan.setAttributeNS(null,"font-style",r.fontStyle),r.fontWeight!==ht.fontWeight&&r.tspan.setAttributeNS(null,"font-weight",r.fontWeight);const O=r.textRenderingMode&M.TextRenderingMode.FILL_STROKE_MASK;if(O===M.TextRenderingMode.FILL||O===M.TextRenderingMode.FILL_STROKE?(r.fillColor!==ht.fillColor&&r.tspan.setAttributeNS(null,"fill",r.fillColor),r.fillAlpha<1&&r.tspan.setAttributeNS(null,"fill-opacity",r.fillAlpha)):r.textRenderingMode===M.TextRenderingMode.ADD_TO_PATH?r.tspan.setAttributeNS(null,"fill","transparent"):r.tspan.setAttributeNS(null,"fill","none"),O===M.TextRenderingMode.STROKE||O===M.TextRenderingMode.FILL_STROKE){const rt=1/(r.textMatrixScale||1);this._setStrokeAttributes(r.tspan,rt)}let $=r.textMatrix;r.textRise!==0&&($=$.slice(),$[5]+=r.textRise),r.txtElement.setAttributeNS(null,"transform",`${v($)} scale(${S(z)}, -1)`),r.txtElement.setAttributeNS(K,"xml:space","preserve"),r.txtElement.append(r.tspan),r.txtgrp.append(r.txtElement),this._ensureTransformGroup().append(r.txtElement)}setLeadingMoveText(n,r){this.setLeading(-r),this.moveText(n,r)}addFontStyle(n){if(!n.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const r=m(n.data,n.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${n.loadedName}"; src: url(${r}); }
- `}setFont(n){const r=this.current,F=this.commonObjs.get(n[0]);let f=n[1];r.font=F,this.embedFonts&&!F.missingFile&&!this.embeddedFonts[F.loadedName]&&(this.addFontStyle(F),this.embeddedFonts[F.loadedName]=F),r.fontMatrix=F.fontMatrix||M.FONT_IDENTITY_MATRIX;let s="normal";F.black?s="900":F.bold&&(s="bold");const x=F.italic?"italic":"normal";f<0?(f=-f,r.fontDirection=-1):r.fontDirection=1,r.fontSize=f,r.fontFamily=F.loadedName,r.fontWeight=s,r.fontStyle=x,r.tspan=this.svgFactory.createElement("svg:tspan"),r.tspan.setAttributeNS(null,"y",S(-r.y)),r.xcoords=[],r.ycoords=[]}endText(){var r;const n=this.current;n.textRenderingMode&M.TextRenderingMode.ADD_TO_PATH_FLAG&&((r=n.txtElement)!=null&&r.hasChildNodes())&&(n.element=n.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(n){n>0&&(this.current.lineWidth=n)}setLineCap(n){this.current.lineCap=H[n]}setLineJoin(n){this.current.lineJoin=D[n]}setMiterLimit(n){this.current.miterLimit=n}setStrokeAlpha(n){this.current.strokeAlpha=n}setStrokeRGBColor(n,r,F){this.current.strokeColor=M.Util.makeHexColor(n,r,F)}setFillAlpha(n){this.current.fillAlpha=n}setFillRGBColor(n,r,F){this.current.fillColor=M.Util.makeHexColor(n,r,F),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(n){this.current.strokeColor=this._makeColorN_Pattern(n)}setFillColorN(n){this.current.fillColor=this._makeColorN_Pattern(n)}shadingFill(n){const{width:r,height:F}=this.viewport,f=M.Util.inverseTransform(this.transformMatrix),[s,x,g,W]=M.Util.getAxialAlignedBoundingBox([0,0,r,F],f),z=this.svgFactory.createElement("svg:rect");z.setAttributeNS(null,"x",s),z.setAttributeNS(null,"y",x),z.setAttributeNS(null,"width",g-s),z.setAttributeNS(null,"height",W-x),z.setAttributeNS(null,"fill",this._makeShadingPattern(n)),this.current.fillAlpha<1&&z.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(z)}_makeColorN_Pattern(n){return n[0]==="TilingPattern"?this._makeTilingPattern(n):this._makeShadingPattern(n)}_makeTilingPattern(n){const r=n[1],F=n[2],f=n[3]||M.IDENTITY_MATRIX,[s,x,g,W]=n[4],z=n[5],E=n[6],X=n[7],nt=`shading${w++}`,[ot,u,O,$]=M.Util.normalizeRect([...M.Util.applyTransform([s,x],f),...M.Util.applyTransform([g,W],f)]),[rt,mt]=M.Util.singularValueDecompose2dScale(f),d=z*rt,e=E*mt,i=this.svgFactory.createElement("svg:pattern");i.setAttributeNS(null,"id",nt),i.setAttributeNS(null,"patternUnits","userSpaceOnUse"),i.setAttributeNS(null,"width",d),i.setAttributeNS(null,"height",e),i.setAttributeNS(null,"x",`${ot}`),i.setAttributeNS(null,"y",`${u}`);const o=this.svg,C=this.transformMatrix,y=this.current.fillColor,N=this.current.strokeColor,j=this.svgFactory.create(O-ot,$-u);if(this.svg=j,this.transformMatrix=f,X===2){const Y=M.Util.makeHexColor(...r);this.current.fillColor=Y,this.current.strokeColor=Y}return this.executeOpTree(this.convertOpList(F)),this.svg=o,this.transformMatrix=C,this.current.fillColor=y,this.current.strokeColor=N,i.append(j.childNodes[0]),this.defs.append(i),`url(#${nt})`}_makeShadingPattern(n){switch(typeof n=="string"&&(n=this.objs.get(n)),n[0]){case"RadialAxial":const r=`shading${w++}`,F=n[3];let f;switch(n[1]){case"axial":const s=n[4],x=n[5];f=this.svgFactory.createElement("svg:linearGradient"),f.setAttributeNS(null,"id",r),f.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),f.setAttributeNS(null,"x1",s[0]),f.setAttributeNS(null,"y1",s[1]),f.setAttributeNS(null,"x2",x[0]),f.setAttributeNS(null,"y2",x[1]);break;case"radial":const g=n[4],W=n[5],z=n[6],E=n[7];f=this.svgFactory.createElement("svg:radialGradient"),f.setAttributeNS(null,"id",r),f.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),f.setAttributeNS(null,"cx",W[0]),f.setAttributeNS(null,"cy",W[1]),f.setAttributeNS(null,"r",E),f.setAttributeNS(null,"fx",g[0]),f.setAttributeNS(null,"fy",g[1]),f.setAttributeNS(null,"fr",z);break;default:throw new Error(`Unknown RadialAxial type: ${n[1]}`)}for(const s of F){const x=this.svgFactory.createElement("svg:stop");x.setAttributeNS(null,"offset",s[0]),x.setAttributeNS(null,"stop-color",s[1]),f.append(x)}return this.defs.append(f),`url(#${r})`;case"Mesh":return(0,M.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${n[0]}`)}}setDash(n,r){this.current.dashArray=n,this.current.dashPhase=r}constructPath(n,r){const F=this.current;let f=F.x,s=F.y,x=[],g=0;for(const W of n)switch(W|0){case M.OPS.rectangle:f=r[g++],s=r[g++];const z=r[g++],E=r[g++],X=f+z,nt=s+E;x.push("M",S(f),S(s),"L",S(X),S(s),"L",S(X),S(nt),"L",S(f),S(nt),"Z");break;case M.OPS.moveTo:f=r[g++],s=r[g++],x.push("M",S(f),S(s));break;case M.OPS.lineTo:f=r[g++],s=r[g++],x.push("L",S(f),S(s));break;case M.OPS.curveTo:f=r[g+4],s=r[g+5],x.push("C",S(r[g]),S(r[g+1]),S(r[g+2]),S(r[g+3]),S(f),S(s)),g+=6;break;case M.OPS.curveTo2:x.push("C",S(f),S(s),S(r[g]),S(r[g+1]),S(r[g+2]),S(r[g+3])),f=r[g+2],s=r[g+3],g+=4;break;case M.OPS.curveTo3:f=r[g+2],s=r[g+3],x.push("C",S(r[g]),S(r[g+1]),S(f),S(s),S(f),S(s)),g+=4;break;case M.OPS.closePath:x.push("Z");break}x=x.join(" "),F.path&&n.length>0&&n[0]!==M.OPS.rectangle&&n[0]!==M.OPS.moveTo?x=F.path.getAttributeNS(null,"d")+x:(F.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(F.path)),F.path.setAttributeNS(null,"d",x),F.path.setAttributeNS(null,"fill","none"),F.element=F.path,F.setCurrentPoint(f,s)}endPath(){const n=this.current;if(n.path=null,!this.pendingClip)return;if(!n.element){this.pendingClip=null;return}const r=`clippath${c++}`,F=this.svgFactory.createElement("svg:clipPath");F.setAttributeNS(null,"id",r),F.setAttributeNS(null,"transform",v(this.transformMatrix));const f=n.element.cloneNode(!0);if(this.pendingClip==="evenodd"?f.setAttributeNS(null,"clip-rule","evenodd"):f.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,F.append(f),this.defs.append(F),n.activeClipUrl){n.clipGroup=null;for(const s of this.extraStack)s.clipGroup=null;F.setAttributeNS(null,"clip-path",n.activeClipUrl)}n.activeClipUrl=`url(#${r})`,this.tgrp=null}clip(n){this.pendingClip=n}closePath(){const n=this.current;if(n.path){const r=`${n.path.getAttributeNS(null,"d")}Z`;n.path.setAttributeNS(null,"d",r)}}setLeading(n){this.current.leading=-n}setTextRise(n){this.current.textRise=n}setTextRenderingMode(n){this.current.textRenderingMode=n}setHScale(n){this.current.textHScale=n/100}setRenderingIntent(n){}setFlatness(n){}setGState(n){for(const[r,F]of n)switch(r){case"LW":this.setLineWidth(F);break;case"LC":this.setLineCap(F);break;case"LJ":this.setLineJoin(F);break;case"ML":this.setMiterLimit(F);break;case"D":this.setDash(F[0],F[1]);break;case"RI":this.setRenderingIntent(F);break;case"FL":this.setFlatness(F);break;case"Font":this.setFont(F);break;case"CA":this.setStrokeAlpha(F);break;case"ca":this.setFillAlpha(F);break;default:(0,M.warn)(`Unimplemented graphic state operator ${r}`);break}}fill(){const n=this.current;n.element&&(n.element.setAttributeNS(null,"fill",n.fillColor),n.element.setAttributeNS(null,"fill-opacity",n.fillAlpha),this.endPath())}stroke(){const n=this.current;n.element&&(this._setStrokeAttributes(n.element),n.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(n,r=1){const F=this.current;let f=F.dashArray;r!==1&&f.length>0&&(f=f.map(function(s){return r*s})),n.setAttributeNS(null,"stroke",F.strokeColor),n.setAttributeNS(null,"stroke-opacity",F.strokeAlpha),n.setAttributeNS(null,"stroke-miterlimit",S(F.miterLimit)),n.setAttributeNS(null,"stroke-linecap",F.lineCap),n.setAttributeNS(null,"stroke-linejoin",F.lineJoin),n.setAttributeNS(null,"stroke-width",S(r*F.lineWidth)+"px"),n.setAttributeNS(null,"stroke-dasharray",f.map(S).join(" ")),n.setAttributeNS(null,"stroke-dashoffset",S(r*F.dashPhase)+"px")}eoFill(){var n;(n=this.current.element)==null||n.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){var n;(n=this.current.element)==null||n.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x","0"),n.setAttributeNS(null,"y","0"),n.setAttributeNS(null,"width","1px"),n.setAttributeNS(null,"height","1px"),n.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(n)}paintImageXObject(n){const r=this.getObject(n);if(!r){(0,M.warn)(`Dependent image with object ID ${n} is not ready yet`);return}this.paintInlineImageXObject(r)}paintInlineImageXObject(n,r){const F=n.width,f=n.height,s=L(n,this.forceDataSchema,!!r),x=this.svgFactory.createElement("svg:rect");x.setAttributeNS(null,"x","0"),x.setAttributeNS(null,"y","0"),x.setAttributeNS(null,"width",S(F)),x.setAttributeNS(null,"height",S(f)),this.current.element=x,this.clip("nonzero");const g=this.svgFactory.createElement("svg:image");g.setAttributeNS(bt,"xlink:href",s),g.setAttributeNS(null,"x","0"),g.setAttributeNS(null,"y",S(-f)),g.setAttributeNS(null,"width",S(F)+"px"),g.setAttributeNS(null,"height",S(f)+"px"),g.setAttributeNS(null,"transform",`scale(${S(1/F)} ${S(-1/f)})`),r?r.append(g):this._ensureTransformGroup().append(g)}paintImageMaskXObject(n){const r=this.getObject(n.data,n);if(r.bitmap){(0,M.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}const F=this.current,f=r.width,s=r.height,x=F.fillColor;F.maskId=`mask${_++}`;const g=this.svgFactory.createElement("svg:mask");g.setAttributeNS(null,"id",F.maskId);const W=this.svgFactory.createElement("svg:rect");W.setAttributeNS(null,"x","0"),W.setAttributeNS(null,"y","0"),W.setAttributeNS(null,"width",S(f)),W.setAttributeNS(null,"height",S(s)),W.setAttributeNS(null,"fill",x),W.setAttributeNS(null,"mask",`url(#${F.maskId})`),this.defs.append(g),this._ensureTransformGroup().append(W),this.paintInlineImageXObject(r,g)}paintFormXObjectBegin(n,r){if(Array.isArray(n)&&n.length===6&&this.transform(n[0],n[1],n[2],n[3],n[4],n[5]),r){const F=r[2]-r[0],f=r[3]-r[1],s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x",r[0]),s.setAttributeNS(null,"y",r[1]),s.setAttributeNS(null,"width",S(F)),s.setAttributeNS(null,"height",S(f)),this.current.element=s,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(n){const r=this.svgFactory.create(n.width,n.height),F=this.svgFactory.createElement("svg:defs");r.append(F),this.defs=F;const f=this.svgFactory.createElement("svg:g");return f.setAttributeNS(null,"transform",v(n.transform)),r.append(f),this.svg=f,r}_ensureClipGroup(){if(!this.current.clipGroup){const n=this.svgFactory.createElement("svg:g");n.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(n),this.current.clipGroup=n}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",v(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}h.SVGGraphics=P},(wt,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.XfaText=void 0;class ct{static textContent(M){const ht=[],K={items:ht,styles:Object.create(null)};function bt(H){var L;if(!H)return;let D=null;const m=H.name;if(m==="#text")D=H.value;else if(ct.shouldBuildText(m))(L=H==null?void 0:H.attributes)!=null&&L.textContent?D=H.attributes.textContent:H.value&&(D=H.value);else return;if(D!==null&&ht.push({str:D}),!!H.children)for(const U of H.children)bt(U)}return bt(M),K}static shouldBuildText(M){return!(M==="textarea"||M==="input"||M==="option"||M==="select")}}h.XfaText=ct},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.TextLayerRenderTask=void 0,h.renderTextLayer=v,h.updateTextLayer=c;var l=ct(1),M=ct(6);const ht=1e5,K=30,bt=.8,H=new Map;function D(_,w){let P;if(w&&l.FeatureTest.isOffscreenCanvasSupported)P=new OffscreenCanvas(_,_).getContext("2d",{alpha:!1});else{const A=document.createElement("canvas");A.width=A.height=_,P=A.getContext("2d",{alpha:!1})}return P}function m(_,w){const P=H.get(_);if(P)return P;const A=D(K,w);A.font=`${K}px ${_}`;const n=A.measureText("");let r=n.fontBoundingBoxAscent,F=Math.abs(n.fontBoundingBoxDescent);if(r){const s=r/(r+F);return H.set(_,s),A.canvas.width=A.canvas.height=0,s}A.strokeStyle="red",A.clearRect(0,0,K,K),A.strokeText("g",0,0);let f=A.getImageData(0,0,K,K).data;F=0;for(let s=f.length-1-3;s>=0;s-=4)if(f[s]>0){F=Math.ceil(s/4/K);break}A.clearRect(0,0,K,K),A.strokeText("A",0,K),f=A.getImageData(0,0,K,K).data,r=0;for(let s=0,x=f.length;s<x;s+=4)if(f[s]>0){r=K-Math.floor(s/4/K);break}if(A.canvas.width=A.canvas.height=0,r){const s=r/(r+F);return H.set(_,s),s}return H.set(_,bt),bt}function L(_,w,P){const A=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:w.str!=="",hasEOL:w.hasEOL,fontSize:0};_._textDivs.push(A);const r=l.Util.transform(_._transform,w.transform);let F=Math.atan2(r[1],r[0]);const f=P[w.fontName];f.vertical&&(F+=Math.PI/2);const s=Math.hypot(r[2],r[3]),x=s*m(f.fontFamily,_._isOffscreenCanvasSupported);let g,W;F===0?(g=r[4],W=r[5]-x):(g=r[4]+x*Math.sin(F),W=r[5]-x*Math.cos(F));const z="calc(var(--scale-factor)*",E=A.style;_._container===_._rootContainer?(E.left=`${(100*g/_._pageWidth).toFixed(2)}%`,E.top=`${(100*W/_._pageHeight).toFixed(2)}%`):(E.left=`${z}${g.toFixed(2)}px)`,E.top=`${z}${W.toFixed(2)}px)`),E.fontSize=`${z}${s.toFixed(2)}px)`,E.fontFamily=f.fontFamily,n.fontSize=s,A.setAttribute("role","presentation"),A.textContent=w.str,A.dir=w.dir,_._fontInspectorEnabled&&(A.dataset.fontName=w.fontName),F!==0&&(n.angle=F*(180/Math.PI));let X=!1;if(w.str.length>1)X=!0;else if(w.str!==" "&&w.transform[0]!==w.transform[3]){const nt=Math.abs(w.transform[0]),ot=Math.abs(w.transform[3]);nt!==ot&&Math.max(nt,ot)/Math.min(nt,ot)>1.5&&(X=!0)}X&&(n.canvasWidth=f.vertical?w.height:w.width),_._textDivProperties.set(A,n),_._isReadableStream&&_._layoutText(A)}function U(_){const{div:w,scale:P,properties:A,ctx:n,prevFontSize:r,prevFontFamily:F}=_,{style:f}=w;let s="";if(A.canvasWidth!==0&&A.hasText){const{fontFamily:x}=f,{canvasWidth:g,fontSize:W}=A;(r!==W||F!==x)&&(n.font=`${W*P}px ${x}`,_.prevFontSize=W,_.prevFontFamily=x);const{width:z}=n.measureText(w.textContent);z>0&&(s=`scaleX(${g*P/z})`)}A.angle!==0&&(s=`rotate(${A.angle}deg) ${s}`),s.length>0&&(f.transform=s)}function R(_){if(_._canceled)return;const w=_._textDivs,P=_._capability;if(w.length>ht){P.resolve();return}if(!_._isReadableStream)for(const n of w)_._layoutText(n);P.resolve()}class S{constructor({textContentSource:w,container:P,viewport:A,textDivs:n,textDivProperties:r,textContentItemsStr:F,isOffscreenCanvasSupported:f}){var z;this._textContentSource=w,this._isReadableStream=w instanceof ReadableStream,this._container=this._rootContainer=P,this._textDivs=n||[],this._textContentItemsStr=F||[],this._isOffscreenCanvasSupported=f,this._fontInspectorEnabled=!!((z=globalThis.FontInspector)!=null&&z.enabled),this._reader=null,this._textDivProperties=r||new WeakMap,this._canceled=!1,this._capability=new l.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:A.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:D(0,f)};const{pageWidth:s,pageHeight:x,pageX:g,pageY:W}=A.rawDims;this._transform=[1,0,0,-1,-g,W+x],this._pageWidth=s,this._pageHeight=x,(0,M.setLayerDimensions)(P,A),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new l.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new l.AbortException("TextLayer task cancelled."))}_processItems(w,P){for(const A of w){if(A.str===void 0){if(A.type==="beginMarkedContentProps"||A.type==="beginMarkedContent"){const n=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),A.id!==null&&this._container.setAttribute("id",`${A.id}`),n.append(this._container)}else A.type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(A.str),L(this,A,P)}}_layoutText(w){const P=this._layoutTextParams.properties=this._textDivProperties.get(w);if(this._layoutTextParams.div=w,U(this._layoutTextParams),P.hasText&&this._container.append(w),P.hasEOL){const A=document.createElement("br");A.setAttribute("role","presentation"),this._container.append(A)}}_render(){const w=new l.PromiseCapability;let P=Object.create(null);if(this._isReadableStream){const A=()=>{this._reader.read().then(({value:n,done:r})=>{if(r){w.resolve();return}Object.assign(P,n.styles),this._processItems(n.items,P),A()},w.reject)};this._reader=this._textContentSource.getReader(),A()}else if(this._textContentSource){const{items:A,styles:n}=this._textContentSource;this._processItems(A,n),w.resolve()}else throw new Error('No "textContentSource" parameter specified.');w.promise.then(()=>{P=null,R(this)},this._capability.reject)}}h.TextLayerRenderTask=S;function v(_){!_.textContentSource&&(_.textContent||_.textContentStream)&&((0,M.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),_.textContentSource=_.textContent||_.textContentStream);const{container:w,viewport:P}=_,A=getComputedStyle(w),n=A.getPropertyValue("visibility"),r=parseFloat(A.getPropertyValue("--scale-factor"));n==="visible"&&(!r||Math.abs(r-P.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");const F=new S(_);return F._render(),F}function c({container:_,viewport:w,textDivs:P,textDivProperties:A,isOffscreenCanvasSupported:n,mustRotate:r=!0,mustRescale:F=!0}){if(r&&(0,M.setLayerDimensions)(_,{rotation:w.rotation}),F){const f=D(0,n),x={prevFontSize:null,prevFontFamily:null,div:null,scale:w.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:f};for(const g of P)x.properties=A.get(g),x.div=g,U(x)}}},(wt,h,ct)=>{var m,L,U,R,S,v,c,_,w,P,A,ze,r,Ee,f,Xe,x,qe;Object.defineProperty(h,"__esModule",{value:!0}),h.AnnotationEditorLayer=void 0;var l=ct(1),M=ct(4),ht=ct(28),K=ct(33),bt=ct(6),H=ct(34);const W=class W{constructor({uiManager:E,pageIndex:X,div:nt,accessibilityManager:ot,annotationLayer:u,viewport:O,l10n:$}){I(this,A);I(this,r);I(this,f);I(this,x);I(this,m,void 0);I(this,L,!1);I(this,U,null);I(this,R,this.pointerup.bind(this));I(this,S,this.pointerdown.bind(this));I(this,v,new Map);I(this,c,!1);I(this,_,!1);I(this,w,!1);I(this,P,void 0);const rt=[ht.FreeTextEditor,K.InkEditor,H.StampEditor];if(!W._initialized){W._initialized=!0;for(const mt of rt)mt.initialize($)}E.registerEditorTypes(rt),st(this,P,E),this.pageIndex=X,this.div=nt,st(this,m,ot),st(this,U,u),this.viewport=O,t(this,P).addLayer(this)}get isEmpty(){return t(this,v).size===0}updateToolbar(E){t(this,P).updateToolbar(E)}updateMode(E=t(this,P).getMode()){V(this,x,qe).call(this),E===l.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),E!==l.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",E===l.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",E===l.AnnotationEditorType.INK),this.div.classList.toggle("stampEditing",E===l.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded(E){if(!E&&t(this,P).getMode()!==l.AnnotationEditorType.INK)return;if(!E){for(const nt of t(this,v).values())if(nt.isEmpty()){nt.setInBackground();return}}V(this,r,Ee).call(this,{offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(E){t(this,P).setEditingState(E)}addCommands(E){t(this,P).addCommands(E)}enable(){this.div.style.pointerEvents="auto";const E=new Set;for(const nt of t(this,v).values())nt.enableEditing(),nt.annotationElementId&&E.add(nt.annotationElementId);if(!t(this,U))return;const X=t(this,U).getEditableAnnotations();for(const nt of X){if(nt.hide(),t(this,P).isDeletedAnnotationElement(nt.data.id)||E.has(nt.data.id))continue;const ot=this.deserialize(nt);ot&&(this.addOrRebuild(ot),ot.enableEditing())}}disable(){var X;st(this,w,!0),this.div.style.pointerEvents="none";const E=new Set;for(const nt of t(this,v).values()){if(nt.disableEditing(),!nt.annotationElementId||nt.serialize()!==null){E.add(nt.annotationElementId);continue}(X=this.getEditableAnnotation(nt.annotationElementId))==null||X.show(),nt.remove()}if(t(this,U)){const nt=t(this,U).getEditableAnnotations();for(const ot of nt){const{id:u}=ot.data;E.has(u)||t(this,P).isDeletedAnnotationElement(u)||ot.show()}}V(this,x,qe).call(this),this.isEmpty&&(this.div.hidden=!0),st(this,w,!1)}getEditableAnnotation(E){var X;return((X=t(this,U))==null?void 0:X.getEditableAnnotation(E))||null}setActiveEditor(E){t(this,P).getActive()!==E&&t(this,P).setActiveEditor(E)}enableClick(){this.div.addEventListener("pointerdown",t(this,S)),this.div.addEventListener("pointerup",t(this,R))}disableClick(){this.div.removeEventListener("pointerdown",t(this,S)),this.div.removeEventListener("pointerup",t(this,R))}attach(E){t(this,v).set(E.id,E);const{annotationElementId:X}=E;X&&t(this,P).isDeletedAnnotationElement(X)&&t(this,P).removeDeletedAnnotationElement(E)}detach(E){var X;t(this,v).delete(E.id),(X=t(this,m))==null||X.removePointerInTextLayer(E.contentDiv),!t(this,w)&&E.annotationElementId&&t(this,P).addDeletedAnnotationElement(E)}remove(E){this.detach(E),t(this,P).removeEditor(E),E.div.contains(document.activeElement)&&setTimeout(()=>{t(this,P).focusMainContainer()},0),E.div.remove(),E.isAttachedToDOM=!1,t(this,_)||this.addInkEditorIfNeeded(!1)}changeParent(E){var X;E.parent!==this&&(E.annotationElementId&&(t(this,P).addDeletedAnnotationElement(E.annotationElementId),M.AnnotationEditor.deleteAnnotationElement(E),E.annotationElementId=null),this.attach(E),(X=E.parent)==null||X.detach(E),E.setParent(this),E.div&&E.isAttachedToDOM&&(E.div.remove(),this.div.append(E.div)))}add(E){if(this.changeParent(E),t(this,P).addEditor(E),this.attach(E),!E.isAttachedToDOM){const X=E.render();this.div.append(X),E.isAttachedToDOM=!0}this.moveEditorInDOM(E),E.onceAdded(),t(this,P).addToAnnotationStorage(E)}moveEditorInDOM(E){var nt;if(!E.isAttachedToDOM)return;const{activeElement:X}=document;E.div.contains(X)&&(E._focusEventsAllowed=!1,setTimeout(()=>{E.div.addEventListener("focusin",()=>{E._focusEventsAllowed=!0},{once:!0}),X.focus()},0)),(nt=t(this,m))==null||nt.moveElementInDOM(this.div,E.div,E.contentDiv,!0)}addOrRebuild(E){E.needsToBeRebuilt()?E.rebuild():this.add(E)}addUndoableEditor(E){const X=()=>E._uiManager.rebuild(E),nt=()=>{E.remove()};this.addCommands({cmd:X,undo:nt,mustExec:!1})}getNextId(){return t(this,P).getId()}pasteEditor(E,X){t(this,P).updateToolbar(E),t(this,P).updateMode(E);const{offsetX:nt,offsetY:ot}=V(this,f,Xe).call(this),u=this.getNextId(),O=V(this,A,ze).call(this,{parent:this,id:u,x:nt,y:ot,uiManager:t(this,P),isCentered:!0,...X});O&&this.add(O)}deserialize(E){switch(E.annotationType??E.annotationEditorType){case l.AnnotationEditorType.FREETEXT:return ht.FreeTextEditor.deserialize(E,this,t(this,P));case l.AnnotationEditorType.INK:return K.InkEditor.deserialize(E,this,t(this,P));case l.AnnotationEditorType.STAMP:return H.StampEditor.deserialize(E,this,t(this,P))}return null}addNewEditor(){V(this,r,Ee).call(this,V(this,f,Xe).call(this),!0)}setSelected(E){t(this,P).setSelected(E)}toggleSelected(E){t(this,P).toggleSelected(E)}isSelected(E){return t(this,P).isSelected(E)}unselect(E){t(this,P).unselect(E)}pointerup(E){const{isMac:X}=l.FeatureTest.platform;if(!(E.button!==0||E.ctrlKey&&X)&&E.target===this.div&&t(this,c)){if(st(this,c,!1),!t(this,L)){st(this,L,!0);return}if(t(this,P).getMode()===l.AnnotationEditorType.STAMP){t(this,P).unselectAll();return}V(this,r,Ee).call(this,E,!1)}}pointerdown(E){if(t(this,c)){st(this,c,!1);return}const{isMac:X}=l.FeatureTest.platform;if(E.button!==0||E.ctrlKey&&X||E.target!==this.div)return;st(this,c,!0);const nt=t(this,P).getActive();st(this,L,!nt||nt.isEmpty())}findNewParent(E,X,nt){const ot=t(this,P).findParent(X,nt);return ot===null||ot===this?!1:(ot.changeParent(E),!0)}destroy(){var E,X;((E=t(this,P).getActive())==null?void 0:E.parent)===this&&t(this,P).setActiveEditor(null);for(const nt of t(this,v).values())(X=t(this,m))==null||X.removePointerInTextLayer(nt.contentDiv),nt.setParent(null),nt.isAttachedToDOM=!1,nt.div.remove();this.div=null,t(this,v).clear(),t(this,P).removeLayer(this)}render({viewport:E}){this.viewport=E,(0,bt.setLayerDimensions)(this.div,E);for(const X of t(this,P).getEditors(this.pageIndex))this.add(X);this.updateMode()}update({viewport:E}){t(this,P).commitOrRemove(),this.viewport=E,(0,bt.setLayerDimensions)(this.div,{rotation:E.rotation}),this.updateMode()}get pageDimensions(){const{pageWidth:E,pageHeight:X}=this.viewport.rawDims;return[E,X]}};m=new WeakMap,L=new WeakMap,U=new WeakMap,R=new WeakMap,S=new WeakMap,v=new WeakMap,c=new WeakMap,_=new WeakMap,w=new WeakMap,P=new WeakMap,A=new WeakSet,ze=function(E){switch(t(this,P).getMode()){case l.AnnotationEditorType.FREETEXT:return new ht.FreeTextEditor(E);case l.AnnotationEditorType.INK:return new K.InkEditor(E);case l.AnnotationEditorType.STAMP:return new H.StampEditor(E)}return null},r=new WeakSet,Ee=function(E,X){const nt=this.getNextId(),ot=V(this,A,ze).call(this,{parent:this,id:nt,x:E.offsetX,y:E.offsetY,uiManager:t(this,P),isCentered:X});return ot&&this.add(ot),ot},f=new WeakSet,Xe=function(){const{x:E,y:X,width:nt,height:ot}=this.div.getBoundingClientRect(),u=Math.max(0,E),O=Math.max(0,X),$=Math.min(window.innerWidth,E+nt),rt=Math.min(window.innerHeight,X+ot),mt=(u+$)/2-E,d=(O+rt)/2-X,[e,i]=this.viewport.rotation%180===0?[mt,d]:[d,mt];return{offsetX:e,offsetY:i}},x=new WeakSet,qe=function(){st(this,_,!0);for(const E of t(this,v).values())E.isEmpty()&&E.remove();st(this,_,!1)},Yt(W,"_initialized",!1);let D=W;h.AnnotationEditorLayer=D},(wt,h,ct)=>{var H,D,m,L,U,R,S,v,c,_,wi,P,Ci,n,Ti,F,ge,s,Ve,g,xi,z,$e;Object.defineProperty(h,"__esModule",{value:!0}),h.FreeTextEditor=void 0;var l=ct(1),M=ct(5),ht=ct(4),K=ct(29);const X=class X extends ht.AnnotationEditor{constructor(u){super({...u,name:"freeTextEditor"});I(this,_);I(this,P);I(this,n);I(this,F);I(this,s);I(this,g);I(this,z);I(this,H,this.editorDivBlur.bind(this));I(this,D,this.editorDivFocus.bind(this));I(this,m,this.editorDivInput.bind(this));I(this,L,this.editorDivKeydown.bind(this));I(this,U,void 0);I(this,R,"");I(this,S,`${this.id}-editor`);I(this,v,void 0);I(this,c,null);st(this,U,u.color||X._defaultColor||ht.AnnotationEditor._defaultLineColor),st(this,v,u.fontSize||X._defaultFontSize)}static get _keyboardManager(){const u=X.prototype,O=mt=>mt.isEmpty(),$=M.AnnotationEditorUIManager.TRANSLATE_SMALL,rt=M.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,l.shadow)(this,"_keyboardManager",new M.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],u.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],u.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],u._translateEmpty,{args:[-$,0],checker:O}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],u._translateEmpty,{args:[-rt,0],checker:O}],[["ArrowRight","mac+ArrowRight"],u._translateEmpty,{args:[$,0],checker:O}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],u._translateEmpty,{args:[rt,0],checker:O}],[["ArrowUp","mac+ArrowUp"],u._translateEmpty,{args:[0,-$],checker:O}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],u._translateEmpty,{args:[0,-rt],checker:O}],[["ArrowDown","mac+ArrowDown"],u._translateEmpty,{args:[0,$],checker:O}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],u._translateEmpty,{args:[0,rt],checker:O}]]))}static initialize(u){this._l10nPromise=new Map(["free_text2_default_content","editor_free_text2_aria_label"].map($=>[$,u.get($)]));const O=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(O.getPropertyValue("--freetext-padding"))}static updateDefaultParams(u,O){switch(u){case l.AnnotationEditorParamsType.FREETEXT_SIZE:X._defaultFontSize=O;break;case l.AnnotationEditorParamsType.FREETEXT_COLOR:X._defaultColor=O;break}}updateParams(u,O){switch(u){case l.AnnotationEditorParamsType.FREETEXT_SIZE:V(this,_,wi).call(this,O);break;case l.AnnotationEditorParamsType.FREETEXT_COLOR:V(this,P,Ci).call(this,O);break}}static get defaultPropertiesToUpdate(){return[[l.AnnotationEditorParamsType.FREETEXT_SIZE,X._defaultFontSize],[l.AnnotationEditorParamsType.FREETEXT_COLOR,X._defaultColor||ht.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[l.AnnotationEditorParamsType.FREETEXT_SIZE,t(this,v)],[l.AnnotationEditorParamsType.FREETEXT_COLOR,t(this,U)]]}_translateEmpty(u,O){this._uiManager.translateSelectedEditors(u,O,!0)}getInitialTranslation(){const u=this.parentScale;return[-X._internalPadding*u,-(X._internalPadding+t(this,v))*u]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(l.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",t(this,L)),this.editorDiv.addEventListener("focus",t(this,D)),this.editorDiv.addEventListener("blur",t(this,H)),this.editorDiv.addEventListener("input",t(this,m)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",t(this,S)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",t(this,L)),this.editorDiv.removeEventListener("focus",t(this,D)),this.editorDiv.removeEventListener("blur",t(this,H)),this.editorDiv.removeEventListener("input",t(this,m)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}focusin(u){this._focusEventsAllowed&&(super.focusin(u),u.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var u;if(this.width){V(this,z,$e).call(this);return}this.enableEditMode(),this.editorDiv.focus(),(u=this._initialOptions)!=null&&u.isCentered&&this.center(),this._initialOptions=null}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freeTextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const u=t(this,R),O=st(this,R,V(this,n,Ti).call(this).trimEnd());if(u===O)return;const $=rt=>{if(st(this,R,rt),!rt){this.remove();return}V(this,s,Ve).call(this),this._uiManager.rebuild(this),V(this,F,ge).call(this)};this.addCommands({cmd:()=>{$(O)},undo:()=>{$(u)},mustExec:!1}),V(this,F,ge).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(u){this.enterInEditMode()}keydown(u){u.target===this.div&&u.key==="Enter"&&(this.enterInEditMode(),u.preventDefault())}editorDivKeydown(u){X._keyboardManager.exec(this,u)}editorDivFocus(u){this.isEditing=!0}editorDivBlur(u){this.isEditing=!1}editorDivInput(u){this.parent.div.classList.toggle("freeTextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let u,O;this.width&&(u=this.x,O=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",t(this,S)),this.enableEditing(),X._l10nPromise.get("editor_free_text2_aria_label").then(rt=>{var mt;return(mt=this.editorDiv)==null?void 0:mt.setAttribute("aria-label",rt)}),X._l10nPromise.get("free_text2_default_content").then(rt=>{var mt;return(mt=this.editorDiv)==null?void 0:mt.setAttribute("default-content",rt)}),this.editorDiv.contentEditable=!0;const{style:$}=this.editorDiv;if($.fontSize=`calc(${t(this,v)}px * var(--scale-factor))`,$.color=t(this,U),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,M.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[rt,mt]=this.parentDimensions;if(this.annotationElementId){const{position:d}=t(this,c);let[e,i]=this.getInitialTranslation();[e,i]=this.pageTranslationToScreen(e,i);const[o,C]=this.pageDimensions,[y,N]=this.pageTranslation;let j,Y;switch(this.rotation){case 0:j=u+(d[0]-y)/o,Y=O+this.height-(d[1]-N)/C;break;case 90:j=u+(d[0]-y)/o,Y=O-(d[1]-N)/C,[e,i]=[i,-e];break;case 180:j=u-this.width+(d[0]-y)/o,Y=O-(d[1]-N)/C,[e,i]=[-e,-i];break;case 270:j=u+(d[0]-y-this.height*C)/o,Y=O+(d[1]-N-this.width*o)/C,[e,i]=[-i,e];break}this.setAt(j*rt,Y*mt,e,i)}else this.setAt(u*rt,O*mt,this.width*rt,this.height*mt);V(this,s,Ve).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}get contentDiv(){return this.editorDiv}static deserialize(u,O,$){let rt=null;if(u instanceof K.FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:d,fontColor:e},rect:i,rotation:o,id:C},textContent:y,textPosition:N,parent:{page:{pageNumber:j}}}=u;if(!y||y.length===0)return null;rt=u={annotationType:l.AnnotationEditorType.FREETEXT,color:Array.from(e),fontSize:d,value:y.join(`
- `),position:N,pageIndex:j-1,rect:i,rotation:o,id:C,deleted:!1}}const mt=super.deserialize(u,O,$);return st(mt,v,u.fontSize),st(mt,U,l.Util.makeHexColor(...u.color)),st(mt,R,u.value),mt.annotationElementId=u.id||null,st(mt,c,rt),mt}serialize(u=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const O=X._internalPadding*this.parentScale,$=this.getRect(O,O),rt=ht.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:t(this,U)),mt={annotationType:l.AnnotationEditorType.FREETEXT,color:rt,fontSize:t(this,v),value:t(this,R),pageIndex:this.pageIndex,rect:$,rotation:this.rotation};return u?mt:this.annotationElementId&&!V(this,g,xi).call(this,mt)?null:(mt.id=this.annotationElementId,mt)}};H=new WeakMap,D=new WeakMap,m=new WeakMap,L=new WeakMap,U=new WeakMap,R=new WeakMap,S=new WeakMap,v=new WeakMap,c=new WeakMap,_=new WeakSet,wi=function(u){const O=rt=>{this.editorDiv.style.fontSize=`calc(${rt}px * var(--scale-factor))`,this.translate(0,-(rt-t(this,v))*this.parentScale),st(this,v,rt),V(this,F,ge).call(this)},$=t(this,v);this.addCommands({cmd:()=>{O(u)},undo:()=>{O($)},mustExec:!0,type:l.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},P=new WeakSet,Ci=function(u){const O=t(this,U);this.addCommands({cmd:()=>{st(this,U,this.editorDiv.style.color=u)},undo:()=>{st(this,U,this.editorDiv.style.color=O)},mustExec:!0,type:l.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},n=new WeakSet,Ti=function(){const u=this.editorDiv.getElementsByTagName("div");if(u.length===0)return this.editorDiv.innerText;const O=[];for(const $ of u)O.push($.innerText.replace(/\r\n?|\n/,""));return O.join(`
- `)},F=new WeakSet,ge=function(){const[u,O]=this.parentDimensions;let $;if(this.isAttachedToDOM)$=this.div.getBoundingClientRect();else{const{currentLayer:rt,div:mt}=this,d=mt.style.display;mt.style.display="hidden",rt.div.append(this.div),$=mt.getBoundingClientRect(),mt.remove(),mt.style.display=d}this.rotation%180===this.parentRotation%180?(this.width=$.width/u,this.height=$.height/O):(this.width=$.height/u,this.height=$.width/O),this.fixAndSetPosition()},s=new WeakSet,Ve=function(){if(this.editorDiv.replaceChildren(),!!t(this,R))for(const u of t(this,R).split(`
- `)){const O=document.createElement("div");O.append(u?document.createTextNode(u):document.createElement("br")),this.editorDiv.append(O)}},g=new WeakSet,xi=function(u){const{value:O,fontSize:$,color:rt,rect:mt,pageIndex:d}=t(this,c);return u.value!==O||u.fontSize!==$||u.rect.some((e,i)=>Math.abs(e-mt[i])>=1)||u.color.some((e,i)=>e!==rt[i])||u.pageIndex!==d},z=new WeakSet,$e=function(u=!1){if(!this.annotationElementId)return;if(V(this,F,ge).call(this),!u&&(this.width===0||this.height===0)){setTimeout(()=>V(this,z,$e).call(this,!0),0);return}const O=X._internalPadding*this.parentScale;t(this,c).rect=this.getRect(O,O)},Yt(X,"_freeTextDefaultContent",""),Yt(X,"_l10nPromise"),Yt(X,"_internalPadding",0),Yt(X,"_defaultColor",null),Yt(X,"_defaultFontSize",10),Yt(X,"_type","freetext");let bt=X;h.FreeTextEditor=bt},(wt,h,ct)=>{var i,o,ne,y,Pi,j,Y,dt,at,lt,ut,kt,Et,Ot,Bt,xt,Ut,Ct,it,tt,ft,Ft,Ye,Ht,Ke,Rt,Je,Gt,jt,pt,G,J,Tt,zt,Nt,$t,Jt,ki,vt,Qe;Object.defineProperty(h,"__esModule",{value:!0}),h.StampAnnotationElement=h.InkAnnotationElement=h.FreeTextAnnotationElement=h.AnnotationLayer=void 0;var l=ct(1),M=ct(6),ht=ct(3),K=ct(30),bt=ct(31),H=ct(32);const D=1e3,m=9,L=new WeakSet;function U(St){return{width:St[2]-St[0],height:St[3]-St[1]}}class R{static create(p){switch(p.data.annotationType){case l.AnnotationType.LINK:return new v(p);case l.AnnotationType.TEXT:return new c(p);case l.AnnotationType.WIDGET:switch(p.data.fieldType){case"Tx":return new w(p);case"Btn":return p.data.radioButton?new n(p):p.data.checkBox?new A(p):new r(p);case"Ch":return new F(p);case"Sig":return new P(p)}return new _(p);case l.AnnotationType.POPUP:return new f(p);case l.AnnotationType.FREETEXT:return new x(p);case l.AnnotationType.LINE:return new g(p);case l.AnnotationType.SQUARE:return new W(p);case l.AnnotationType.CIRCLE:return new z(p);case l.AnnotationType.POLYLINE:return new E(p);case l.AnnotationType.CARET:return new nt(p);case l.AnnotationType.INK:return new ot(p);case l.AnnotationType.POLYGON:return new X(p);case l.AnnotationType.HIGHLIGHT:return new u(p);case l.AnnotationType.UNDERLINE:return new O(p);case l.AnnotationType.SQUIGGLY:return new $(p);case l.AnnotationType.STRIKEOUT:return new rt(p);case l.AnnotationType.STAMP:return new mt(p);case l.AnnotationType.FILEATTACHMENT:return new d(p);default:return new S(p)}}}class S{constructor(p,{isRenderable:a=!1,ignoreBorder:k=!1,createQuadrilaterals:T=!1}={}){I(this,i,!1);this.isRenderable=a,this.data=p.data,this.layer=p.layer,this.linkService=p.linkService,this.downloadManager=p.downloadManager,this.imageResourcesPath=p.imageResourcesPath,this.renderForms=p.renderForms,this.svgFactory=p.svgFactory,this.annotationStorage=p.annotationStorage,this.enableScripting=p.enableScripting,this.hasJSActions=p.hasJSActions,this._fieldObjects=p.fieldObjects,this.parent=p.parent,a&&(this.container=this._createContainer(k)),T&&this._createQuadrilaterals()}_createContainer(p){const{data:a,parent:{page:k,viewport:T}}=this,B=document.createElement("section");B.setAttribute("data-annotation-id",a.id),B.style.zIndex=this.parent.zIndex++,this.data.popupRef&&B.setAttribute("aria-haspopup","dialog"),a.noRotate&&B.classList.add("norotate");const{pageWidth:Z,pageHeight:_t,pageX:b,pageY:q}=T.rawDims;if(!a.rect||this instanceof f){const{rotation:Pt}=a;return!a.hasOwnCanvas&&Pt!==0&&this.setRotation(Pt,B),B}const{width:et,height:yt}=U(a.rect),gt=l.Util.normalizeRect([a.rect[0],k.view[3]-a.rect[1]+k.view[1],a.rect[2],k.view[3]-a.rect[3]+k.view[1]]);if(!p&&a.borderStyle.width>0){B.style.borderWidth=`${a.borderStyle.width}px`;const Pt=a.borderStyle.horizontalCornerRadius,It=a.borderStyle.verticalCornerRadius;if(Pt>0||It>0){const qt=`calc(${Pt}px * var(--scale-factor)) / calc(${It}px * var(--scale-factor))`;B.style.borderRadius=qt}else if(this instanceof n){const qt=`calc(${et}px * var(--scale-factor)) / calc(${yt}px * var(--scale-factor))`;B.style.borderRadius=qt}switch(a.borderStyle.style){case l.AnnotationBorderStyleType.SOLID:B.style.borderStyle="solid";break;case l.AnnotationBorderStyleType.DASHED:B.style.borderStyle="dashed";break;case l.AnnotationBorderStyleType.BEVELED:(0,l.warn)("Unimplemented border style: beveled");break;case l.AnnotationBorderStyleType.INSET:(0,l.warn)("Unimplemented border style: inset");break;case l.AnnotationBorderStyleType.UNDERLINE:B.style.borderBottomStyle="solid";break}const Xt=a.borderColor||null;Xt?(st(this,i,!0),B.style.borderColor=l.Util.makeHexColor(Xt[0]|0,Xt[1]|0,Xt[2]|0)):B.style.borderWidth=0}B.style.left=`${100*(gt[0]-b)/Z}%`,B.style.top=`${100*(gt[1]-q)/_t}%`;const{rotation:At}=a;return a.hasOwnCanvas||At===0?(B.style.width=`${100*et/Z}%`,B.style.height=`${100*yt/_t}%`):this.setRotation(At,B),B}setRotation(p,a=this.container){if(!this.data.rect)return;const{pageWidth:k,pageHeight:T}=this.parent.viewport.rawDims,{width:B,height:Z}=U(this.data.rect);let _t,b;p%180===0?(_t=100*B/k,b=100*Z/T):(_t=100*Z/k,b=100*B/T),a.style.width=`${_t}%`,a.style.height=`${b}%`,a.setAttribute("data-main-rotation",(360-p)%360)}get _commonActions(){const p=(a,k,T)=>{const B=T.detail[a],Z=B[0],_t=B.slice(1);T.target.style[k]=K.ColorConverters[`${Z}_HTML`](_t),this.annotationStorage.setValue(this.data.id,{[k]:K.ColorConverters[`${Z}_rgb`](_t)})};return(0,l.shadow)(this,"_commonActions",{display:a=>{const{display:k}=a.detail,T=k%2===1;this.container.style.visibility=T?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:T,noPrint:k===1||k===2})},print:a=>{this.annotationStorage.setValue(this.data.id,{noPrint:!a.detail.print})},hidden:a=>{const{hidden:k}=a.detail;this.container.style.visibility=k?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:k,noView:k})},focus:a=>{setTimeout(()=>a.target.focus({preventScroll:!1}),0)},userName:a=>{a.target.title=a.detail.userName},readonly:a=>{a.target.disabled=a.detail.readonly},required:a=>{this._setRequired(a.target,a.detail.required)},bgColor:a=>{p("bgColor","backgroundColor",a)},fillColor:a=>{p("fillColor","backgroundColor",a)},fgColor:a=>{p("fgColor","color",a)},textColor:a=>{p("textColor","color",a)},borderColor:a=>{p("borderColor","borderColor",a)},strokeColor:a=>{p("strokeColor","borderColor",a)},rotation:a=>{const k=a.detail.rotation;this.setRotation(k),this.annotationStorage.setValue(this.data.id,{rotation:k})}})}_dispatchEventFromSandbox(p,a){const k=this._commonActions;for(const T of Object.keys(a.detail)){const B=p[T]||k[T];B==null||B(a)}}_setDefaultPropertiesFromJS(p){if(!this.enableScripting)return;const a=this.annotationStorage.getRawValue(this.data.id);if(!a)return;const k=this._commonActions;for(const[T,B]of Object.entries(a)){const Z=k[T];if(Z){const _t={detail:{[T]:B},target:p};Z(_t),delete a[T]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:p}=this.data;if(!p)return;const[a,k,T,B]=this.data.rect;if(p.length===1){const[,{x:It,y:Xt},{x:qt,y:Kt}]=p[0];if(T===It&&B===Xt&&a===qt&&k===Kt)return}const{style:Z}=this.container;let _t;if(t(this,i)){const{borderColor:It,borderWidth:Xt}=Z;Z.borderWidth=0,_t=["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="${It}" stroke-width="${Xt}">`],this.container.classList.add("hasBorder")}const b=T-a,q=B-k,{svgFactory:et}=this,yt=et.createElement("svg");yt.classList.add("quadrilateralsContainer"),yt.setAttribute("width",0),yt.setAttribute("height",0);const gt=et.createElement("defs");yt.append(gt);const At=et.createElement("clipPath"),Pt=`clippath_${this.data.id}`;At.setAttribute("id",Pt),At.setAttribute("clipPathUnits","objectBoundingBox"),gt.append(At);for(const[,{x:It,y:Xt},{x:qt,y:Kt}]of p){const Vt=et.createElement("rect"),Qt=(qt-a)/b,te=(B-Xt)/q,Zt=(It-qt)/b,se=(Xt-Kt)/q;Vt.setAttribute("x",Qt),Vt.setAttribute("y",te),Vt.setAttribute("width",Zt),Vt.setAttribute("height",se),At.append(Vt),_t==null||_t.push(`<rect vector-effect="non-scaling-stroke" x="${Qt}" y="${te}" width="${Zt}" height="${se}"/>`)}t(this,i)&&(_t.push("</g></svg>')"),Z.backgroundImage=_t.join("")),this.container.append(yt),this.container.style.clipPath=`url(#${Pt})`}_createPopup(){const{container:p,data:a}=this;p.setAttribute("aria-haspopup","dialog");const k=new f({data:{color:a.color,titleObj:a.titleObj,modificationDate:a.modificationDate,contentsObj:a.contentsObj,richText:a.richText,parentRect:a.rect,borderStyle:0,id:`popup_${a.id}`,rotation:a.rotation},parent:this.parent,elements:[this]});this.parent.div.append(k.render())}render(){(0,l.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(p,a=null){const k=[];if(this._fieldObjects){const T=this._fieldObjects[p];if(T)for(const{page:B,id:Z,exportValues:_t}of T){if(B===-1||Z===a)continue;const b=typeof _t=="string"?_t:null,q=document.querySelector(`[data-element-id="${Z}"]`);if(q&&!L.has(q)){(0,l.warn)(`_getElementsByName - element not allowed: ${Z}`);continue}k.push({id:Z,exportValue:b,domElement:q})}return k}for(const T of document.getElementsByName(p)){const{exportValue:B}=T,Z=T.getAttribute("data-element-id");Z!==a&&L.has(T)&&k.push({id:Z,exportValue:B,domElement:T})}return k}show(){var p;this.container&&(this.container.hidden=!1),(p=this.popup)==null||p.maybeShow()}hide(){var p;this.container&&(this.container.hidden=!0),(p=this.popup)==null||p.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const p=this.getElementsToTriggerPopup();if(Array.isArray(p))for(const a of p)a.classList.add("highlightArea");else p.classList.add("highlightArea")}_editOnDoubleClick(){const{annotationEditorType:p,data:{id:a}}=this;this.container.addEventListener("dblclick",()=>{var k;(k=this.linkService.eventBus)==null||k.dispatch("switchannotationeditormode",{source:this,mode:p,editId:a})})}}i=new WeakMap;class v extends S{constructor(a,k=null){super(a,{isRenderable:!0,ignoreBorder:!!(k!=null&&k.ignoreBorder),createQuadrilaterals:!0});I(this,o);I(this,y);this.isTooltipOnly=a.data.isTooltipOnly}render(){const{data:a,linkService:k}=this,T=document.createElement("a");T.setAttribute("data-element-id",a.id);let B=!1;return a.url?(k.addLinkAttributes(T,a.url,a.newWindow),B=!0):a.action?(this._bindNamedAction(T,a.action),B=!0):a.attachment?(this._bindAttachment(T,a.attachment),B=!0):a.setOCGState?(V(this,y,Pi).call(this,T,a.setOCGState),B=!0):a.dest?(this._bindLink(T,a.dest),B=!0):(a.actions&&(a.actions.Action||a.actions["Mouse Up"]||a.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(T,a),B=!0),a.resetForm?(this._bindResetFormAction(T,a.resetForm),B=!0):this.isTooltipOnly&&!B&&(this._bindLink(T,""),B=!0)),this.container.classList.add("linkAnnotation"),B&&this.container.append(T),this.container}_bindLink(a,k){a.href=this.linkService.getDestinationHash(k),a.onclick=()=>(k&&this.linkService.goToDestination(k),!1),(k||k==="")&&V(this,o,ne).call(this)}_bindNamedAction(a,k){a.href=this.linkService.getAnchorUrl(""),a.onclick=()=>(this.linkService.executeNamedAction(k),!1),V(this,o,ne).call(this)}_bindAttachment(a,k){a.href=this.linkService.getAnchorUrl(""),a.onclick=()=>{var T;return(T=this.downloadManager)==null||T.openOrDownloadData(this.container,k.content,k.filename),!1},V(this,o,ne).call(this)}_bindJSAction(a,k){a.href=this.linkService.getAnchorUrl("");const T=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const B of Object.keys(k.actions)){const Z=T.get(B);Z&&(a[Z]=()=>{var _t;return(_t=this.linkService.eventBus)==null||_t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:k.id,name:B}}),!1})}a.onclick||(a.onclick=()=>!1),V(this,o,ne).call(this)}_bindResetFormAction(a,k){const T=a.onclick;if(T||(a.href=this.linkService.getAnchorUrl("")),V(this,o,ne).call(this),!this._fieldObjects){(0,l.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),T||(a.onclick=()=>!1);return}a.onclick=()=>{var yt;T==null||T();const{fields:B,refs:Z,include:_t}=k,b=[];if(B.length!==0||Z.length!==0){const gt=new Set(Z);for(const At of B){const Pt=this._fieldObjects[At]||[];for(const{id:It}of Pt)gt.add(It)}for(const At of Object.values(this._fieldObjects))for(const Pt of At)gt.has(Pt.id)===_t&&b.push(Pt)}else for(const gt of Object.values(this._fieldObjects))b.push(...gt);const q=this.annotationStorage,et=[];for(const gt of b){const{id:At}=gt;switch(et.push(At),gt.type){case"text":{const It=gt.defaultValue||"";q.setValue(At,{value:It});break}case"checkbox":case"radiobutton":{const It=gt.defaultValue===gt.exportValues;q.setValue(At,{value:It});break}case"combobox":case"listbox":{const It=gt.defaultValue||"";q.setValue(At,{value:It});break}default:continue}const Pt=document.querySelector(`[data-element-id="${At}"]`);if(Pt){if(!L.has(Pt)){(0,l.warn)(`_bindResetFormAction - element not allowed: ${At}`);continue}}else continue;Pt.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((yt=this.linkService.eventBus)==null||yt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:et,name:"ResetForm"}})),!1}}}o=new WeakSet,ne=function(){this.container.setAttribute("data-internal-link","")},y=new WeakSet,Pi=function(a,k){a.href=this.linkService.getAnchorUrl(""),a.onclick=()=>(this.linkService.executeSetOCGState(k),!1),V(this,o,ne).call(this)};class c extends S{constructor(p){var k,T,B;const a=!!(p.data.popupRef||(k=p.data.titleObj)!=null&&k.str||(T=p.data.contentsObj)!=null&&T.str||(B=p.data.richText)!=null&&B.str);super(p,{isRenderable:a})}render(){this.container.classList.add("textAnnotation");const p=document.createElement("img");return p.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",p.alt="[{{type}} Annotation]",p.dataset.l10nId="text_annotation_type",p.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.popupRef||this._createPopup(),this.container.append(p),this.container}}class _ extends S{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(p){var a;this.data.hasOwnCanvas&&(((a=p.previousSibling)==null?void 0:a.nodeName)==="CANVAS"&&(p.previousSibling.hidden=!0),p.hidden=!1)}_getKeyModifier(p){const{isWin:a,isMac:k}=l.FeatureTest.platform;return a&&p.ctrlKey||k&&p.metaKey}_setEventListener(p,a,k,T){a.includes("mouse")?p.addEventListener(a,B=>{var Z;(Z=this.linkService.eventBus)==null||Z.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:k,value:T(B),shift:B.shiftKey,modifier:this._getKeyModifier(B)}})}):p.addEventListener(a,B=>{var Z;(Z=this.linkService.eventBus)==null||Z.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:k,value:T(B)}})})}_setEventListeners(p,a,k){var T;for(const[B,Z]of a)(Z==="Action"||(T=this.data.actions)!=null&&T[Z])&&this._setEventListener(p,B,Z,k)}_setBackgroundColor(p){const a=this.data.backgroundColor||null;p.style.backgroundColor=a===null?"transparent":l.Util.makeHexColor(a[0],a[1],a[2])}_setTextStyle(p){const a=["left","center","right"],{fontColor:k}=this.data.defaultAppearanceData,T=this.data.defaultAppearanceData.fontSize||m,B=p.style;let Z;const _t=2,b=q=>Math.round(10*q)/10;if(this.data.multiLine){const q=Math.abs(this.data.rect[3]-this.data.rect[1]-_t),et=Math.round(q/(l.LINE_FACTOR*T))||1,yt=q/et;Z=Math.min(T,b(yt/l.LINE_FACTOR))}else{const q=Math.abs(this.data.rect[3]-this.data.rect[1]-_t);Z=Math.min(T,b(q/l.LINE_FACTOR))}B.fontSize=`calc(${Z}px * var(--scale-factor))`,B.color=l.Util.makeHexColor(k[0],k[1],k[2]),this.data.textAlignment!==null&&(B.textAlign=a[this.data.textAlignment])}_setRequired(p,a){a?p.setAttribute("required",!0):p.removeAttribute("required"),p.setAttribute("aria-required",a)}}class w extends _{constructor(p){const a=p.renderForms||!p.data.hasAppearance&&!!p.data.fieldValue;super(p,{isRenderable:a})}setPropertyOnSiblings(p,a,k,T){const B=this.annotationStorage;for(const Z of this._getElementsByName(p.name,p.id))Z.domElement&&(Z.domElement[a]=k),B.setValue(Z.id,{[T]:k})}render(){var T,B;const p=this.annotationStorage,a=this.data.id;this.container.classList.add("textWidgetAnnotation");let k=null;if(this.renderForms){const Z=p.getValue(a,{value:this.data.fieldValue});let _t=Z.value||"";const b=p.getValue(a,{charLimit:this.data.maxLen}).charLimit;b&&_t.length>b&&(_t=_t.slice(0,b));let q=Z.formattedValue||((T=this.data.textContent)==null?void 0:T.join(`
- `))||null;q&&this.data.comb&&(q=q.replaceAll(/\s+/g,""));const et={userValue:_t,formattedValue:q,lastCommittedValue:null,commitKey:1};this.data.multiLine?(k=document.createElement("textarea"),k.textContent=q??_t,this.data.doNotScroll&&(k.style.overflowY="hidden")):(k=document.createElement("input"),k.type="text",k.setAttribute("value",q??_t),this.data.doNotScroll&&(k.style.overflowX="hidden")),this.data.hasOwnCanvas&&(k.hidden=!0),L.add(k),k.setAttribute("data-element-id",a),k.disabled=this.data.readOnly,k.name=this.data.fieldName,k.tabIndex=D,this._setRequired(k,this.data.required),b&&(k.maxLength=b),k.addEventListener("input",gt=>{p.setValue(a,{value:gt.target.value}),this.setPropertyOnSiblings(k,"value",gt.target.value,"value"),et.formattedValue=null}),k.addEventListener("resetform",gt=>{const At=this.data.defaultFieldValue??"";k.value=et.userValue=At,et.formattedValue=null});let yt=gt=>{const{formattedValue:At}=et;At!=null&&(gt.target.value=At),gt.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){k.addEventListener("focus",At=>{const{target:Pt}=At;et.userValue&&(Pt.value=et.userValue),et.lastCommittedValue=Pt.value,et.commitKey=1}),k.addEventListener("updatefromsandbox",At=>{this.showElementAndHideCanvas(At.target);const Pt={value(It){et.userValue=It.detail.value??"",p.setValue(a,{value:et.userValue.toString()}),It.target.value=et.userValue},formattedValue(It){const{formattedValue:Xt}=It.detail;et.formattedValue=Xt,Xt!=null&&It.target!==document.activeElement&&(It.target.value=Xt),p.setValue(a,{formattedValue:Xt})},selRange(It){It.target.setSelectionRange(...It.detail.selRange)},charLimit:It=>{var Vt;const{charLimit:Xt}=It.detail,{target:qt}=It;if(Xt===0){qt.removeAttribute("maxLength");return}qt.setAttribute("maxLength",Xt);let Kt=et.userValue;!Kt||Kt.length<=Xt||(Kt=Kt.slice(0,Xt),qt.value=et.userValue=Kt,p.setValue(a,{value:Kt}),(Vt=this.linkService.eventBus)==null||Vt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:Kt,willCommit:!0,commitKey:1,selStart:qt.selectionStart,selEnd:qt.selectionEnd}}))}};this._dispatchEventFromSandbox(Pt,At)}),k.addEventListener("keydown",At=>{var Xt;et.commitKey=1;let Pt=-1;if(At.key==="Escape"?Pt=0:At.key==="Enter"&&!this.data.multiLine?Pt=2:At.key==="Tab"&&(et.commitKey=3),Pt===-1)return;const{value:It}=At.target;et.lastCommittedValue!==It&&(et.lastCommittedValue=It,et.userValue=It,(Xt=this.linkService.eventBus)==null||Xt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:It,willCommit:!0,commitKey:Pt,selStart:At.target.selectionStart,selEnd:At.target.selectionEnd}}))});const gt=yt;yt=null,k.addEventListener("blur",At=>{var It;if(!At.relatedTarget)return;const{value:Pt}=At.target;et.userValue=Pt,et.lastCommittedValue!==Pt&&((It=this.linkService.eventBus)==null||It.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:Pt,willCommit:!0,commitKey:et.commitKey,selStart:At.target.selectionStart,selEnd:At.target.selectionEnd}})),gt(At)}),(B=this.data.actions)!=null&&B.Keystroke&&k.addEventListener("beforeinput",At=>{var te;et.lastCommittedValue=null;const{data:Pt,target:It}=At,{value:Xt,selectionStart:qt,selectionEnd:Kt}=It;let Vt=qt,Qt=Kt;switch(At.inputType){case"deleteWordBackward":{const Zt=Xt.substring(0,qt).match(/\w*[^\w]*$/);Zt&&(Vt-=Zt[0].length);break}case"deleteWordForward":{const Zt=Xt.substring(qt).match(/^[^\w]*\w*/);Zt&&(Qt+=Zt[0].length);break}case"deleteContentBackward":qt===Kt&&(Vt-=1);break;case"deleteContentForward":qt===Kt&&(Qt+=1);break}At.preventDefault(),(te=this.linkService.eventBus)==null||te.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:Xt,change:Pt||"",willCommit:!1,selStart:Vt,selEnd:Qt}})}),this._setEventListeners(k,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],At=>At.target.value)}if(yt&&k.addEventListener("blur",yt),this.data.comb){const At=(this.data.rect[2]-this.data.rect[0])/b;k.classList.add("comb"),k.style.letterSpacing=`calc(${At}px * var(--scale-factor) - 1ch)`}}else k=document.createElement("div"),k.textContent=this.data.fieldValue,k.style.verticalAlign="middle",k.style.display="table-cell";return this._setTextStyle(k),this._setBackgroundColor(k),this._setDefaultPropertiesFromJS(k),this.container.append(k),this.container}}class P extends _{constructor(p){super(p,{isRenderable:!!p.data.hasOwnCanvas})}}class A extends _{constructor(p){super(p,{isRenderable:p.renderForms})}render(){const p=this.annotationStorage,a=this.data,k=a.id;let T=p.getValue(k,{value:a.exportValue===a.fieldValue}).value;typeof T=="string"&&(T=T!=="Off",p.setValue(k,{value:T})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const B=document.createElement("input");return L.add(B),B.setAttribute("data-element-id",k),B.disabled=a.readOnly,this._setRequired(B,this.data.required),B.type="checkbox",B.name=a.fieldName,T&&B.setAttribute("checked",!0),B.setAttribute("exportValue",a.exportValue),B.tabIndex=D,B.addEventListener("change",Z=>{const{name:_t,checked:b}=Z.target;for(const q of this._getElementsByName(_t,k)){const et=b&&q.exportValue===a.exportValue;q.domElement&&(q.domElement.checked=et),p.setValue(q.id,{value:et})}p.setValue(k,{value:b})}),B.addEventListener("resetform",Z=>{const _t=a.defaultFieldValue||"Off";Z.target.checked=_t===a.exportValue}),this.enableScripting&&this.hasJSActions&&(B.addEventListener("updatefromsandbox",Z=>{const _t={value(b){b.target.checked=b.detail.value!=="Off",p.setValue(k,{value:b.target.checked})}};this._dispatchEventFromSandbox(_t,Z)}),this._setEventListeners(B,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],Z=>Z.target.checked)),this._setBackgroundColor(B),this._setDefaultPropertiesFromJS(B),this.container.append(B),this.container}}class n extends _{constructor(p){super(p,{isRenderable:p.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const p=this.annotationStorage,a=this.data,k=a.id;let T=p.getValue(k,{value:a.fieldValue===a.buttonValue}).value;typeof T=="string"&&(T=T!==a.buttonValue,p.setValue(k,{value:T}));const B=document.createElement("input");if(L.add(B),B.setAttribute("data-element-id",k),B.disabled=a.readOnly,this._setRequired(B,this.data.required),B.type="radio",B.name=a.fieldName,T&&B.setAttribute("checked",!0),B.tabIndex=D,B.addEventListener("change",Z=>{const{name:_t,checked:b}=Z.target;for(const q of this._getElementsByName(_t,k))p.setValue(q.id,{value:!1});p.setValue(k,{value:b})}),B.addEventListener("resetform",Z=>{const _t=a.defaultFieldValue;Z.target.checked=_t!=null&&_t===a.buttonValue}),this.enableScripting&&this.hasJSActions){const Z=a.buttonValue;B.addEventListener("updatefromsandbox",_t=>{const b={value:q=>{const et=Z===q.detail.value;for(const yt of this._getElementsByName(q.target.name)){const gt=et&&yt.id===k;yt.domElement&&(yt.domElement.checked=gt),p.setValue(yt.id,{value:gt})}}};this._dispatchEventFromSandbox(b,_t)}),this._setEventListeners(B,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],_t=>_t.target.checked)}return this._setBackgroundColor(B),this._setDefaultPropertiesFromJS(B),this.container.append(B),this.container}}class r extends v{constructor(p){super(p,{ignoreBorder:p.data.hasAppearance})}render(){const p=super.render();p.classList.add("buttonWidgetAnnotation","pushButton"),this.data.alternativeText&&(p.title=this.data.alternativeText);const a=p.lastChild;return this.enableScripting&&this.hasJSActions&&a&&(this._setDefaultPropertiesFromJS(a),a.addEventListener("updatefromsandbox",k=>{this._dispatchEventFromSandbox({},k)})),p}}class F extends _{constructor(p){super(p,{isRenderable:p.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const p=this.annotationStorage,a=this.data.id,k=p.getValue(a,{value:this.data.fieldValue}),T=document.createElement("select");L.add(T),T.setAttribute("data-element-id",a),T.disabled=this.data.readOnly,this._setRequired(T,this.data.required),T.name=this.data.fieldName,T.tabIndex=D;let B=this.data.combo&&this.data.options.length>0;this.data.combo||(T.size=this.data.options.length,this.data.multiSelect&&(T.multiple=!0)),T.addEventListener("resetform",et=>{const yt=this.data.defaultFieldValue;for(const gt of T.options)gt.selected=gt.value===yt});for(const et of this.data.options){const yt=document.createElement("option");yt.textContent=et.displayValue,yt.value=et.exportValue,k.value.includes(et.exportValue)&&(yt.setAttribute("selected",!0),B=!1),T.append(yt)}let Z=null;if(B){const et=document.createElement("option");et.value=" ",et.setAttribute("hidden",!0),et.setAttribute("selected",!0),T.prepend(et),Z=()=>{et.remove(),T.removeEventListener("input",Z),Z=null},T.addEventListener("input",Z)}const _t=et=>{const yt=et?"value":"textContent",{options:gt,multiple:At}=T;return At?Array.prototype.filter.call(gt,Pt=>Pt.selected).map(Pt=>Pt[yt]):gt.selectedIndex===-1?null:gt[gt.selectedIndex][yt]};let b=_t(!1);const q=et=>{const yt=et.target.options;return Array.prototype.map.call(yt,gt=>({displayValue:gt.textContent,exportValue:gt.value}))};return this.enableScripting&&this.hasJSActions?(T.addEventListener("updatefromsandbox",et=>{const yt={value(gt){Z==null||Z();const At=gt.detail.value,Pt=new Set(Array.isArray(At)?At:[At]);for(const It of T.options)It.selected=Pt.has(It.value);p.setValue(a,{value:_t(!0)}),b=_t(!1)},multipleSelection(gt){T.multiple=!0},remove(gt){const At=T.options,Pt=gt.detail.remove;At[Pt].selected=!1,T.remove(Pt),At.length>0&&Array.prototype.findIndex.call(At,Xt=>Xt.selected)===-1&&(At[0].selected=!0),p.setValue(a,{value:_t(!0),items:q(gt)}),b=_t(!1)},clear(gt){for(;T.length!==0;)T.remove(0);p.setValue(a,{value:null,items:[]}),b=_t(!1)},insert(gt){const{index:At,displayValue:Pt,exportValue:It}=gt.detail.insert,Xt=T.children[At],qt=document.createElement("option");qt.textContent=Pt,qt.value=It,Xt?Xt.before(qt):T.append(qt),p.setValue(a,{value:_t(!0),items:q(gt)}),b=_t(!1)},items(gt){const{items:At}=gt.detail;for(;T.length!==0;)T.remove(0);for(const Pt of At){const{displayValue:It,exportValue:Xt}=Pt,qt=document.createElement("option");qt.textContent=It,qt.value=Xt,T.append(qt)}T.options.length>0&&(T.options[0].selected=!0),p.setValue(a,{value:_t(!0),items:q(gt)}),b=_t(!1)},indices(gt){const At=new Set(gt.detail.indices);for(const Pt of gt.target.options)Pt.selected=At.has(Pt.index);p.setValue(a,{value:_t(!0)}),b=_t(!1)},editable(gt){gt.target.disabled=!gt.detail.editable}};this._dispatchEventFromSandbox(yt,et)}),T.addEventListener("input",et=>{var gt;const yt=_t(!0);p.setValue(a,{value:yt}),et.preventDefault(),(gt=this.linkService.eventBus)==null||gt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:b,changeEx:yt,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(T,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],et=>et.target.value)):T.addEventListener("input",function(et){p.setValue(a,{value:_t(!0)})}),this.data.combo&&this._setTextStyle(T),this._setBackgroundColor(T),this._setDefaultPropertiesFromJS(T),this.container.append(T),this.container}}class f extends S{constructor(p){var B,Z,_t;const{data:a,elements:k}=p,T=!!((B=a.titleObj)!=null&&B.str||(Z=a.contentsObj)!=null&&Z.str||(_t=a.richText)!=null&&_t.str);super(p,{isRenderable:T}),this.elements=k}render(){this.container.classList.add("popupAnnotation");const p=new s({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}),a=[];for(const k of this.elements)k.popup=p,a.push(k.data.id),k.addHighlightArea();return this.container.setAttribute("aria-controls",a.join(",")),this.container}}class s{constructor({container:p,color:a,elements:k,titleObj:T,modificationDate:B,contentsObj:Z,richText:_t,parent:b,rect:q,parentRect:et,open:yt}){I(this,Ft);I(this,Ht);I(this,Rt);I(this,j,null);I(this,Y,V(this,Rt,Je).bind(this));I(this,dt,V(this,Ht,Ke).bind(this));I(this,at,V(this,Ft,Ye).bind(this));I(this,lt,null);I(this,ut,null);I(this,kt,null);I(this,Et,null);I(this,Ot,null);I(this,Bt,null);I(this,xt,!1);I(this,Ut,null);I(this,Ct,null);I(this,it,null);I(this,tt,null);I(this,ft,!1);st(this,ut,p),st(this,tt,T),st(this,kt,Z),st(this,it,_t),st(this,Ot,b),st(this,lt,a),st(this,Ct,q),st(this,Bt,et),st(this,Et,k);const gt=M.PDFDateString.toDateObject(B);gt&&st(this,j,b.l10n.get("annotation_date_string",{date:gt.toLocaleDateString(),time:gt.toLocaleTimeString()})),this.trigger=k.flatMap(At=>At.getElementsToTriggerPopup());for(const At of this.trigger)At.addEventListener("click",t(this,at)),At.addEventListener("mouseenter",t(this,dt)),At.addEventListener("mouseleave",t(this,Y));t(this,ut).hidden=!0,yt&&V(this,Ft,Ye).call(this)}render(){if(t(this,Ut))return;const{page:{view:p},viewport:{rawDims:{pageWidth:a,pageHeight:k,pageX:T,pageY:B}}}=t(this,Ot),Z=st(this,Ut,document.createElement("div"));if(Z.className="popup",t(this,lt)){const Vt=Z.style.outlineColor=l.Util.makeHexColor(...t(this,lt));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?Z.style.backgroundColor=`color-mix(in srgb, ${Vt} 30%, white)`:Z.style.backgroundColor=l.Util.makeHexColor(...t(this,lt).map(te=>Math.floor(.7*(255-te)+te)))}const _t=document.createElement("span");_t.className="header";const b=document.createElement("h1");if(_t.append(b),{dir:b.dir,str:b.textContent}=t(this,tt),Z.append(_t),t(this,j)){const Vt=document.createElement("span");Vt.classList.add("popupDate"),t(this,j).then(Qt=>{Vt.textContent=Qt}),_t.append(Vt)}const q=t(this,kt),et=t(this,it);if(et!=null&&et.str&&(!(q!=null&&q.str)||q.str===et.str))H.XfaLayer.render({xfaHtml:et.html,intent:"richText",div:Z}),Z.lastChild.classList.add("richText","popupContent");else{const Vt=this._formatContents(q);Z.append(Vt)}let yt=!!t(this,Bt),gt=yt?t(this,Bt):t(this,Ct);for(const Vt of t(this,Et))if(!gt||l.Util.intersect(Vt.data.rect,gt)!==null){gt=Vt.data.rect,yt=!0;break}const At=l.Util.normalizeRect([gt[0],p[3]-gt[1]+p[1],gt[2],p[3]-gt[3]+p[1]]),Pt=5,It=yt?gt[2]-gt[0]+Pt:0,Xt=At[0]+It,qt=At[1],{style:Kt}=t(this,ut);Kt.left=`${100*(Xt-T)/a}%`,Kt.top=`${100*(qt-B)/k}%`,t(this,ut).append(Z)}_formatContents({str:p,dir:a}){const k=document.createElement("p");k.classList.add("popupContent"),k.dir=a;const T=p.split(/(?:\r\n?|\n)/);for(let B=0,Z=T.length;B<Z;++B){const _t=T[B];k.append(document.createTextNode(_t)),B<Z-1&&k.append(document.createElement("br"))}return k}forceHide(){st(this,ft,this.isVisible),t(this,ft)&&(t(this,ut).hidden=!0)}maybeShow(){t(this,ft)&&(st(this,ft,!1),t(this,ut).hidden=!1)}get isVisible(){return t(this,ut).hidden===!1}}j=new WeakMap,Y=new WeakMap,dt=new WeakMap,at=new WeakMap,lt=new WeakMap,ut=new WeakMap,kt=new WeakMap,Et=new WeakMap,Ot=new WeakMap,Bt=new WeakMap,xt=new WeakMap,Ut=new WeakMap,Ct=new WeakMap,it=new WeakMap,tt=new WeakMap,ft=new WeakMap,Ft=new WeakSet,Ye=function(){st(this,xt,!t(this,xt)),t(this,xt)?(V(this,Ht,Ke).call(this),t(this,ut).addEventListener("click",t(this,at))):(V(this,Rt,Je).call(this),t(this,ut).removeEventListener("click",t(this,at)))},Ht=new WeakSet,Ke=function(){t(this,Ut)||this.render(),this.isVisible?t(this,xt)&&t(this,ut).classList.add("focused"):(t(this,ut).hidden=!1,t(this,ut).style.zIndex=parseInt(t(this,ut).style.zIndex)+1e3)},Rt=new WeakSet,Je=function(){t(this,ut).classList.remove("focused"),!(t(this,xt)||!this.isVisible)&&(t(this,ut).hidden=!0,t(this,ut).style.zIndex=parseInt(t(this,ut).style.zIndex)-1e3)};class x extends S{constructor(p){var k,T,B;const a=!!(p.data.popupRef||(k=p.data.titleObj)!=null&&k.str||(T=p.data.contentsObj)!=null&&T.str||(B=p.data.richText)!=null&&B.str);super(p,{isRenderable:a,ignoreBorder:!0}),this.textContent=p.data.textContent,this.textPosition=p.data.textPosition,this.annotationEditorType=l.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const p=document.createElement("div");p.classList.add("annotationTextContent"),p.setAttribute("role","comment");for(const a of this.textContent){const k=document.createElement("span");k.textContent=a,p.append(k)}this.container.append(p)}return this.data.popupRef||this._createPopup(),this._editOnDoubleClick(),this.container}}h.FreeTextAnnotationElement=x;class g extends S{constructor(a){var T,B,Z;const k=!!(a.data.popupRef||(T=a.data.titleObj)!=null&&T.str||(B=a.data.contentsObj)!=null&&B.str||(Z=a.data.richText)!=null&&Z.str);super(a,{isRenderable:k,ignoreBorder:!0});I(this,Gt,null)}render(){this.container.classList.add("lineAnnotation");const a=this.data,{width:k,height:T}=U(a.rect),B=this.svgFactory.create(k,T,!0),Z=st(this,Gt,this.svgFactory.createElement("svg:line"));return Z.setAttribute("x1",a.rect[2]-a.lineCoordinates[0]),Z.setAttribute("y1",a.rect[3]-a.lineCoordinates[1]),Z.setAttribute("x2",a.rect[2]-a.lineCoordinates[2]),Z.setAttribute("y2",a.rect[3]-a.lineCoordinates[3]),Z.setAttribute("stroke-width",a.borderStyle.width||1),Z.setAttribute("stroke","transparent"),Z.setAttribute("fill","transparent"),B.append(Z),this.container.append(B),a.popupRef||this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,Gt)}addHighlightArea(){this.container.classList.add("highlightArea")}}Gt=new WeakMap;class W extends S{constructor(a){var T,B,Z;const k=!!(a.data.popupRef||(T=a.data.titleObj)!=null&&T.str||(B=a.data.contentsObj)!=null&&B.str||(Z=a.data.richText)!=null&&Z.str);super(a,{isRenderable:k,ignoreBorder:!0});I(this,jt,null)}render(){this.container.classList.add("squareAnnotation");const a=this.data,{width:k,height:T}=U(a.rect),B=this.svgFactory.create(k,T,!0),Z=a.borderStyle.width,_t=st(this,jt,this.svgFactory.createElement("svg:rect"));return _t.setAttribute("x",Z/2),_t.setAttribute("y",Z/2),_t.setAttribute("width",k-Z),_t.setAttribute("height",T-Z),_t.setAttribute("stroke-width",Z||1),_t.setAttribute("stroke","transparent"),_t.setAttribute("fill","transparent"),B.append(_t),this.container.append(B),a.popupRef||this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,jt)}addHighlightArea(){this.container.classList.add("highlightArea")}}jt=new WeakMap;class z extends S{constructor(a){var T,B,Z;const k=!!(a.data.popupRef||(T=a.data.titleObj)!=null&&T.str||(B=a.data.contentsObj)!=null&&B.str||(Z=a.data.richText)!=null&&Z.str);super(a,{isRenderable:k,ignoreBorder:!0});I(this,pt,null)}render(){this.container.classList.add("circleAnnotation");const a=this.data,{width:k,height:T}=U(a.rect),B=this.svgFactory.create(k,T,!0),Z=a.borderStyle.width,_t=st(this,pt,this.svgFactory.createElement("svg:ellipse"));return _t.setAttribute("cx",k/2),_t.setAttribute("cy",T/2),_t.setAttribute("rx",k/2-Z/2),_t.setAttribute("ry",T/2-Z/2),_t.setAttribute("stroke-width",Z||1),_t.setAttribute("stroke","transparent"),_t.setAttribute("fill","transparent"),B.append(_t),this.container.append(B),a.popupRef||this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,pt)}addHighlightArea(){this.container.classList.add("highlightArea")}}pt=new WeakMap;class E extends S{constructor(a){var T,B,Z;const k=!!(a.data.popupRef||(T=a.data.titleObj)!=null&&T.str||(B=a.data.contentsObj)!=null&&B.str||(Z=a.data.richText)!=null&&Z.str);super(a,{isRenderable:k,ignoreBorder:!0});I(this,G,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const a=this.data,{width:k,height:T}=U(a.rect),B=this.svgFactory.create(k,T,!0);let Z=[];for(const b of a.vertices){const q=b.x-a.rect[0],et=a.rect[3]-b.y;Z.push(q+","+et)}Z=Z.join(" ");const _t=st(this,G,this.svgFactory.createElement(this.svgElementName));return _t.setAttribute("points",Z),_t.setAttribute("stroke-width",a.borderStyle.width||1),_t.setAttribute("stroke","transparent"),_t.setAttribute("fill","transparent"),B.append(_t),this.container.append(B),a.popupRef||this._createPopup(_t,a),this.container}getElementsToTriggerPopup(){return t(this,G)}addHighlightArea(){this.container.classList.add("highlightArea")}}G=new WeakMap;class X extends E{constructor(p){super(p),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class nt extends S{constructor(p){var k,T,B;const a=!!(p.data.popupRef||(k=p.data.titleObj)!=null&&k.str||(T=p.data.contentsObj)!=null&&T.str||(B=p.data.richText)!=null&&B.str);super(p,{isRenderable:a,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),this.data.popupRef||this._createPopup(),this.container}}class ot extends S{constructor(a){var T,B,Z;const k=!!(a.data.popupRef||(T=a.data.titleObj)!=null&&T.str||(B=a.data.contentsObj)!=null&&B.str||(Z=a.data.richText)!=null&&Z.str);super(a,{isRenderable:k,ignoreBorder:!0});I(this,J,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=l.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);const a=this.data,{width:k,height:T}=U(a.rect),B=this.svgFactory.create(k,T,!0);for(const Z of a.inkLists){let _t=[];for(const q of Z){const et=q.x-a.rect[0],yt=a.rect[3]-q.y;_t.push(`${et},${yt}`)}_t=_t.join(" ");const b=this.svgFactory.createElement(this.svgElementName);t(this,J).push(b),b.setAttribute("points",_t),b.setAttribute("stroke-width",a.borderStyle.width||1),b.setAttribute("stroke","transparent"),b.setAttribute("fill","transparent"),a.popupRef||this._createPopup(b,a),B.append(b)}return this.container.append(B),this.container}getElementsToTriggerPopup(){return t(this,J)}addHighlightArea(){this.container.classList.add("highlightArea")}}J=new WeakMap,h.InkAnnotationElement=ot;class u extends S{constructor(p){var k,T,B;const a=!!(p.data.popupRef||(k=p.data.titleObj)!=null&&k.str||(T=p.data.contentsObj)!=null&&T.str||(B=p.data.richText)!=null&&B.str);super(p,{isRenderable:a,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.popupRef||this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class O extends S{constructor(p){var k,T,B;const a=!!(p.data.popupRef||(k=p.data.titleObj)!=null&&k.str||(T=p.data.contentsObj)!=null&&T.str||(B=p.data.richText)!=null&&B.str);super(p,{isRenderable:a,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.popupRef||this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class $ extends S{constructor(p){var k,T,B;const a=!!(p.data.popupRef||(k=p.data.titleObj)!=null&&k.str||(T=p.data.contentsObj)!=null&&T.str||(B=p.data.richText)!=null&&B.str);super(p,{isRenderable:a,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.popupRef||this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class rt extends S{constructor(p){var k,T,B;const a=!!(p.data.popupRef||(k=p.data.titleObj)!=null&&k.str||(T=p.data.contentsObj)!=null&&T.str||(B=p.data.richText)!=null&&B.str);super(p,{isRenderable:a,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.popupRef||this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class mt extends S{constructor(p){var k,T,B;const a=!!(p.data.popupRef||(k=p.data.titleObj)!=null&&k.str||(T=p.data.contentsObj)!=null&&T.str||(B=p.data.richText)!=null&&B.str);super(p,{isRenderable:a,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),this.data.popupRef||this._createPopup(),this.container}}h.StampAnnotationElement=mt;class d extends S{constructor(a){var B;super(a,{isRenderable:!0});I(this,Tt,null);const{filename:k,content:T}=this.data.file;this.filename=(0,M.getFilenameFromUrl)(k,!0),this.content=T,(B=this.linkService.eventBus)==null||B.dispatch("fileattachmentannotation",{source:this,filename:k,content:T})}render(){var T,B;this.container.classList.add("fileAttachmentAnnotation");const{data:a}=this;let k;return a.hasAppearance||a.fillAlpha===0?k=document.createElement("div"):(k=document.createElement("img"),k.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(a.name)?"paperclip":"pushpin"}.svg`,a.fillAlpha&&a.fillAlpha<1&&(k.style=`filter: opacity(${Math.round(a.fillAlpha*100)}%);`)),k.classList.add("popupTriggerArea"),k.addEventListener("dblclick",this._download.bind(this)),st(this,Tt,k),!a.popupRef&&((T=a.titleObj)!=null&&T.str||(B=a.contentsObj)!=null&&B.str||a.richText)&&this._createPopup(),this.container.append(k),this.container}getElementsToTriggerPopup(){return t(this,Tt)}addHighlightArea(){this.container.classList.add("highlightArea")}_download(){var a;(a=this.downloadManager)==null||a.openOrDownloadData(this.container,this.content,this.filename)}}Tt=new WeakMap;class e{constructor({div:p,accessibilityManager:a,annotationCanvasMap:k,l10n:T,page:B,viewport:Z}){I(this,Jt);I(this,vt);I(this,zt,null);I(this,Nt,null);I(this,$t,new Map);this.div=p,st(this,zt,a),st(this,Nt,k),this.l10n=T,this.page=B,this.viewport=Z,this.zIndex=0,this.l10n||(this.l10n=bt.NullL10n)}async render(p){const{annotations:a}=p,k=this.div;(0,M.setLayerDimensions)(k,this.viewport);const T=new Map,B={data:null,layer:k,linkService:p.linkService,downloadManager:p.downloadManager,imageResourcesPath:p.imageResourcesPath||"",renderForms:p.renderForms!==!1,svgFactory:new M.DOMSVGFactory,annotationStorage:p.annotationStorage||new ht.AnnotationStorage,enableScripting:p.enableScripting===!0,hasJSActions:p.hasJSActions,fieldObjects:p.fieldObjects,parent:this,elements:null};for(const Z of a){if(Z.noHTML)continue;const _t=Z.annotationType===l.AnnotationType.POPUP;if(_t){const et=T.get(Z.id);if(!et)continue;B.elements=et}else{const{width:et,height:yt}=U(Z.rect);if(et<=0||yt<=0)continue}B.data=Z;const b=R.create(B);if(!b.isRenderable)continue;if(!_t&&Z.popupRef){const et=T.get(Z.popupRef);et?et.push(b):T.set(Z.popupRef,[b])}b.annotationEditorType>0&&t(this,$t).set(b.data.id,b);const q=b.render();Z.hidden&&(q.style.visibility="hidden"),V(this,Jt,ki).call(this,q,Z.id)}V(this,vt,Qe).call(this),await this.l10n.translate(k)}update({viewport:p}){const a=this.div;this.viewport=p,(0,M.setLayerDimensions)(a,{rotation:p.rotation}),V(this,vt,Qe).call(this),a.hidden=!1}getEditableAnnotations(){return Array.from(t(this,$t).values())}getEditableAnnotation(p){return t(this,$t).get(p)}}zt=new WeakMap,Nt=new WeakMap,$t=new WeakMap,Jt=new WeakSet,ki=function(p,a){var T;const k=p.firstChild||p;k.id=`${M.AnnotationPrefix}${a}`,this.div.append(p),(T=t(this,zt))==null||T.moveElementInDOM(this.div,p,k,!1)},vt=new WeakSet,Qe=function(){if(!t(this,Nt))return;const p=this.div;for(const[a,k]of t(this,Nt)){const T=p.querySelector(`[data-annotation-id="${a}"]`);if(!T)continue;const{firstChild:B}=T;B?B.nodeName==="CANVAS"?B.replaceWith(k):B.before(k):T.append(k)}t(this,Nt).clear()},h.AnnotationLayer=e},(wt,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.ColorConverters=void 0;function ct(ht){return Math.floor(Math.max(0,Math.min(1,ht))*255).toString(16).padStart(2,"0")}function l(ht){return Math.max(0,Math.min(255,255*ht))}class M{static CMYK_G([K,bt,H,D]){return["G",1-Math.min(1,.3*K+.59*H+.11*bt+D)]}static G_CMYK([K]){return["CMYK",0,0,0,1-K]}static G_RGB([K]){return["RGB",K,K,K]}static G_rgb([K]){return K=l(K),[K,K,K]}static G_HTML([K]){const bt=ct(K);return`#${bt}${bt}${bt}`}static RGB_G([K,bt,H]){return["G",.3*K+.59*bt+.11*H]}static RGB_rgb(K){return K.map(l)}static RGB_HTML(K){return`#${K.map(ct).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([K,bt,H,D]){return["RGB",1-Math.min(1,K+D),1-Math.min(1,H+D),1-Math.min(1,bt+D)]}static CMYK_rgb([K,bt,H,D]){return[l(1-Math.min(1,K+D)),l(1-Math.min(1,H+D)),l(1-Math.min(1,bt+D))]}static CMYK_HTML(K){const bt=this.CMYK_RGB(K).slice(1);return this.RGB_HTML(bt)}static RGB_CMYK([K,bt,H]){const D=1-K,m=1-bt,L=1-H,U=Math.min(D,m,L);return["CMYK",D,m,L,U]}}h.ColorConverters=M},(wt,h)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.NullL10n=void 0,h.getL10nFallback=l;const ct={of_pages:"of {{pagesCount}}",page_of_pages:"({{pageNumber}} of {{pagesCount}})",document_properties_kb:"{{size_kb}} KB ({{size_b}} bytes)",document_properties_mb:"{{size_mb}} MB ({{size_b}} bytes)",document_properties_date_string:"{{date}}, {{time}}",document_properties_page_size_unit_inches:"in",document_properties_page_size_unit_millimeters:"mm",document_properties_page_size_orientation_portrait:"portrait",document_properties_page_size_orientation_landscape:"landscape",document_properties_page_size_name_a3:"A3",document_properties_page_size_name_a4:"A4",document_properties_page_size_name_letter:"Letter",document_properties_page_size_name_legal:"Legal",document_properties_page_size_dimension_string:"{{width}} × {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",document_properties_linearized_yes:"Yes",document_properties_linearized_no:"No",additional_layers:"Additional Layers",page_landmark:"Page {{page}}",thumb_page_title:"Page {{page}}",thumb_page_canvas:"Thumbnail of Page {{page}}",find_reached_top:"Reached top of document, continued from bottom",find_reached_bottom:"Reached end of document, continued from top","find_match_count[one]":"{{current}} of {{total}} match","find_match_count[other]":"{{current}} of {{total}} matches","find_match_count_limit[one]":"More than {{limit}} match","find_match_count_limit[other]":"More than {{limit}} matches",find_not_found:"Phrase not found",page_scale_width:"Page Width",page_scale_fit:"Page Fit",page_scale_auto:"Automatic Zoom",page_scale_actual:"Actual Size",page_scale_percent:"{{scale}}%",loading_error:"An error occurred while loading the PDF.",invalid_file_error:"Invalid or corrupted PDF file.",missing_file_error:"Missing PDF file.",unexpected_response_error:"Unexpected server response.",rendering_error:"An error occurred while rendering the page.",annotation_date_string:"{{date}}, {{time}}",printing_not_supported:"Warning: Printing is not fully supported by this browser.",printing_not_ready:"Warning: The PDF is not fully loaded for printing.",web_fonts_disabled:"Web fonts are disabled: unable to use embedded PDF fonts.",free_text2_default_content:"Start typing…",editor_free_text2_aria_label:"Text Editor",editor_ink2_aria_label:"Draw Editor",editor_ink_canvas_aria_label:"User-created image"};ct.print_progress_percent="{{progress}}%";function l(K,bt){switch(K){case"find_match_count":K=`find_match_count[${bt.total===1?"one":"other"}]`;break;case"find_match_count_limit":K=`find_match_count_limit[${bt.limit===1?"one":"other"}]`;break}return ct[K]||""}function M(K,bt){return bt?K.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,(H,D)=>D in bt?bt[D]:"{{"+D+"}}"):K}const ht={async getLanguage(){return"en-us"},async getDirection(){return"ltr"},async get(K,bt=null,H=l(K,bt)){return M(H,bt)},async translate(K){}};h.NullL10n=ht},(wt,h,ct)=>{Object.defineProperty(h,"__esModule",{value:!0}),h.XfaLayer=void 0;var l=ct(25);class M{static setupStorage(K,bt,H,D,m){const L=D.getValue(bt,{value:null});switch(H.name){case"textarea":if(L.value!==null&&(K.textContent=L.value),m==="print")break;K.addEventListener("input",U=>{D.setValue(bt,{value:U.target.value})});break;case"input":if(H.attributes.type==="radio"||H.attributes.type==="checkbox"){if(L.value===H.attributes.xfaOn?K.setAttribute("checked",!0):L.value===H.attributes.xfaOff&&K.removeAttribute("checked"),m==="print")break;K.addEventListener("change",U=>{D.setValue(bt,{value:U.target.checked?U.target.getAttribute("xfaOn"):U.target.getAttribute("xfaOff")})})}else{if(L.value!==null&&K.setAttribute("value",L.value),m==="print")break;K.addEventListener("input",U=>{D.setValue(bt,{value:U.target.value})})}break;case"select":if(L.value!==null){K.setAttribute("value",L.value);for(const U of H.children)U.attributes.value===L.value?U.attributes.selected=!0:U.attributes.hasOwnProperty("selected")&&delete U.attributes.selected}K.addEventListener("input",U=>{const R=U.target.options,S=R.selectedIndex===-1?"":R[R.selectedIndex].value;D.setValue(bt,{value:S})});break}}static setAttributes({html:K,element:bt,storage:H=null,intent:D,linkService:m}){const{attributes:L}=bt,U=K instanceof HTMLAnchorElement;L.type==="radio"&&(L.name=`${L.name}-${D}`);for(const[R,S]of Object.entries(L))if(S!=null)switch(R){case"class":S.length&&K.setAttribute(R,S.join(" "));break;case"dataId":break;case"id":K.setAttribute("data-element-id",S);break;case"style":Object.assign(K.style,S);break;case"textContent":K.textContent=S;break;default:(!U||R!=="href"&&R!=="newWindow")&&K.setAttribute(R,S)}U&&m.addLinkAttributes(K,L.href,L.newWindow),H&&L.dataId&&this.setupStorage(K,L.dataId,bt,H)}static render(K){var v;const bt=K.annotationStorage,H=K.linkService,D=K.xfaHtml,m=K.intent||"display",L=document.createElement(D.name);D.attributes&&this.setAttributes({html:L,element:D,intent:m,linkService:H});const U=[[D,-1,L]],R=K.div;if(R.append(L),K.viewport){const c=`matrix(${K.viewport.transform.join(",")})`;R.style.transform=c}m!=="richText"&&R.setAttribute("class","xfaLayer xfaFont");const S=[];for(;U.length>0;){const[c,_,w]=U.at(-1);if(_+1===c.children.length){U.pop();continue}const P=c.children[++U.at(-1)[1]];if(P===null)continue;const{name:A}=P;if(A==="#text"){const r=document.createTextNode(P.value);S.push(r),w.append(r);continue}const n=(v=P==null?void 0:P.attributes)!=null&&v.xmlns?document.createElementNS(P.attributes.xmlns,A):document.createElement(A);if(w.append(n),P.attributes&&this.setAttributes({html:n,element:P,storage:bt,intent:m,linkService:H}),P.children&&P.children.length>0)U.push([P,-1,n]);else if(P.value){const r=document.createTextNode(P.value);l.XfaText.shouldBuildText(A)&&S.push(r),n.append(r)}}for(const c of R.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))c.setAttribute("readOnly",!0);return{textDivs:S}}static update(K){const bt=`matrix(${K.viewport.transform.join(",")})`;K.div.style.transform=bt,K.div.hidden=!1}}h.XfaLayer=M},(wt,h,ct)=>{var H,D,m,L,U,R,S,v,c,_,w,P,A,n,r,F,Fi,s,Ri,g,Mi,z,Di,X,Ze,ot,Ii,O,ti,rt,Oi,d,Li,i,Ni,C,Ui,N,Bi,Y,ie,at,ei,ut,we,Et,Ce,Bt,le,Ut,ii,it,Te,ft,ji,Mt,si,Wt,Hi,Dt,Wi,jt,ni,G,xe,Tt,ce;Object.defineProperty(h,"__esModule",{value:!0}),h.InkEditor=void 0;var l=ct(1),M=ct(4),ht=ct(29),K=ct(5);const Nt=class Nt extends M.AnnotationEditor{constructor(Q){super({...Q,name:"inkEditor"});I(this,F);I(this,s);I(this,g);I(this,z);I(this,X);I(this,ot);I(this,O);I(this,rt);I(this,d);I(this,i);I(this,C);I(this,N);I(this,Y);I(this,at);I(this,ut);I(this,Et);I(this,Bt);I(this,Ut);I(this,it);I(this,Dt);I(this,jt);I(this,G);I(this,Tt);I(this,H,0);I(this,D,0);I(this,m,this.canvasContextMenu.bind(this));I(this,L,this.canvasPointermove.bind(this));I(this,U,this.canvasPointerleave.bind(this));I(this,R,this.canvasPointerup.bind(this));I(this,S,this.canvasPointerdown.bind(this));I(this,v,new Path2D);I(this,c,!1);I(this,_,!1);I(this,w,!1);I(this,P,null);I(this,A,0);I(this,n,0);I(this,r,null);this.color=Q.color||null,this.thickness=Q.thickness||null,this.opacity=Q.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(Q){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink2_aria_label"].map(vt=>[vt,Q.get(vt)]))}static updateDefaultParams(Q,vt){switch(Q){case l.AnnotationEditorParamsType.INK_THICKNESS:Nt._defaultThickness=vt;break;case l.AnnotationEditorParamsType.INK_COLOR:Nt._defaultColor=vt;break;case l.AnnotationEditorParamsType.INK_OPACITY:Nt._defaultOpacity=vt/100;break}}updateParams(Q,vt){switch(Q){case l.AnnotationEditorParamsType.INK_THICKNESS:V(this,F,Fi).call(this,vt);break;case l.AnnotationEditorParamsType.INK_COLOR:V(this,s,Ri).call(this,vt);break;case l.AnnotationEditorParamsType.INK_OPACITY:V(this,g,Mi).call(this,vt);break}}static get defaultPropertiesToUpdate(){return[[l.AnnotationEditorParamsType.INK_THICKNESS,Nt._defaultThickness],[l.AnnotationEditorParamsType.INK_COLOR,Nt._defaultColor||M.AnnotationEditor._defaultLineColor],[l.AnnotationEditorParamsType.INK_OPACITY,Math.round(Nt._defaultOpacity*100)]]}get propertiesToUpdate(){return[[l.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||Nt._defaultThickness],[l.AnnotationEditorParamsType.INK_COLOR,this.color||Nt._defaultColor||M.AnnotationEditor._defaultLineColor],[l.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??Nt._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(V(this,ut,we).call(this),V(this,Et,Ce).call(this)),this.isAttachedToDOM||(this.parent.add(this),V(this,Bt,le).call(this)),V(this,Tt,ce).call(this)))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,t(this,P).disconnect(),st(this,P,null),super.remove())}setParent(Q){!this.parent&&Q?this._uiManager.removeShouldRescale(this):this.parent&&Q===null&&this._uiManager.addShouldRescale(this),super.setParent(Q)}onScaleChanging(){const[Q,vt]=this.parentDimensions,Lt=this.width*Q,St=this.height*vt;this.setDimensions(Lt,St)}enableEditMode(){t(this,c)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",t(this,S)))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",t(this,S)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){t(this,c)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),st(this,c,!0),this.div.classList.add("disabled"),V(this,Tt,ce).call(this,!0),this.makeResizable(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(Q){this._focusEventsAllowed&&(super.focusin(Q),this.enableEditMode())}canvasPointerdown(Q){Q.button!==0||!this.isInEditMode()||t(this,c)||(this.setInForeground(),Q.preventDefault(),Q.type!=="mouse"&&this.div.focus(),V(this,ot,Ii).call(this,Q.offsetX,Q.offsetY))}canvasContextMenu(Q){Q.preventDefault()}canvasPointermove(Q){Q.preventDefault(),V(this,O,ti).call(this,Q.offsetX,Q.offsetY)}canvasPointerup(Q){Q.preventDefault(),V(this,at,ei).call(this,Q)}canvasPointerleave(Q){V(this,at,ei).call(this,Q)}get isResizable(){return!this.isEmpty()&&t(this,c)}render(){if(this.div)return this.div;let Q,vt;this.width&&(Q=this.x,vt=this.y),super.render(),Nt._l10nPromise.get("editor_ink2_aria_label").then(k=>{var T;return(T=this.div)==null?void 0:T.setAttribute("aria-label",k)});const[Lt,St,p,a]=V(this,z,Di).call(this);if(this.setAt(Lt,St,0,0),this.setDims(p,a),V(this,ut,we).call(this),this.width){const[k,T]=this.parentDimensions;this.setAspectRatio(this.width*k,this.height*T),this.setAt(Q*k,vt*T,this.width*k,this.height*T),st(this,w,!0),V(this,Bt,le).call(this),this.setDims(this.width*k,this.height*T),V(this,Y,ie).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return V(this,Et,Ce).call(this),this.div}setDimensions(Q,vt){const Lt=Math.round(Q),St=Math.round(vt);if(t(this,A)===Lt&&t(this,n)===St)return;st(this,A,Lt),st(this,n,St),this.canvas.style.visibility="hidden";const[p,a]=this.parentDimensions;this.width=Q/p,this.height=vt/a,this.fixAndSetPosition(),t(this,c)&&V(this,Ut,ii).call(this,Q,vt),V(this,Bt,le).call(this),V(this,Y,ie).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(Q,vt,Lt){var yt,gt,At;if(Q instanceof ht.InkAnnotationElement)return null;const St=super.deserialize(Q,vt,Lt);St.thickness=Q.thickness,St.color=l.Util.makeHexColor(...Q.color),St.opacity=Q.opacity;const[p,a]=St.pageDimensions,k=St.width*p,T=St.height*a,B=St.parentScale,Z=Q.thickness/2;st(St,c,!0),st(St,A,Math.round(k)),st(St,n,Math.round(T));const{paths:_t,rect:b,rotation:q}=Q;for(let{bezier:Pt}of _t){Pt=V(yt=Nt,Wt,Hi).call(yt,Pt,b,q);const It=[];St.paths.push(It);let Xt=B*(Pt[0]-Z),qt=B*(Pt[1]-Z);for(let Vt=2,Qt=Pt.length;Vt<Qt;Vt+=6){const te=B*(Pt[Vt]-Z),Zt=B*(Pt[Vt+1]-Z),se=B*(Pt[Vt+2]-Z),qi=B*(Pt[Vt+3]-Z),oi=B*(Pt[Vt+4]-Z),li=B*(Pt[Vt+5]-Z);It.push([[Xt,qt],[te,Zt],[se,qi],[oi,li]]),Xt=oi,qt=li}const Kt=V(this,ft,ji).call(this,It);St.bezierPath2D.push(Kt)}const et=V(gt=St,jt,ni).call(gt);return st(St,D,Math.max(M.AnnotationEditor.MIN_SIZE,et[2]-et[0])),st(St,H,Math.max(M.AnnotationEditor.MIN_SIZE,et[3]-et[1])),V(At=St,Ut,ii).call(At,k,T),St}serialize(){if(this.isEmpty())return null;const Q=this.getRect(0,0),vt=M.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:l.AnnotationEditorType.INK,color:vt,thickness:this.thickness,opacity:this.opacity,paths:V(this,Dt,Wi).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,Q),pageIndex:this.pageIndex,rect:Q,rotation:this.rotation}}};H=new WeakMap,D=new WeakMap,m=new WeakMap,L=new WeakMap,U=new WeakMap,R=new WeakMap,S=new WeakMap,v=new WeakMap,c=new WeakMap,_=new WeakMap,w=new WeakMap,P=new WeakMap,A=new WeakMap,n=new WeakMap,r=new WeakMap,F=new WeakSet,Fi=function(Q){const vt=this.thickness;this.addCommands({cmd:()=>{this.thickness=Q,V(this,Tt,ce).call(this)},undo:()=>{this.thickness=vt,V(this,Tt,ce).call(this)},mustExec:!0,type:l.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},s=new WeakSet,Ri=function(Q){const vt=this.color;this.addCommands({cmd:()=>{this.color=Q,V(this,Y,ie).call(this)},undo:()=>{this.color=vt,V(this,Y,ie).call(this)},mustExec:!0,type:l.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},g=new WeakSet,Mi=function(Q){Q/=100;const vt=this.opacity;this.addCommands({cmd:()=>{this.opacity=Q,V(this,Y,ie).call(this)},undo:()=>{this.opacity=vt,V(this,Y,ie).call(this)},mustExec:!0,type:l.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},z=new WeakSet,Di=function(){const{parentRotation:Q,parentDimensions:[vt,Lt]}=this;switch(Q){case 90:return[0,Lt,Lt,vt];case 180:return[vt,Lt,vt,Lt];case 270:return[vt,0,Lt,vt];default:return[0,0,vt,Lt]}},X=new WeakSet,Ze=function(){const{ctx:Q,color:vt,opacity:Lt,thickness:St,parentScale:p,scaleFactor:a}=this;Q.lineWidth=St*p/a,Q.lineCap="round",Q.lineJoin="round",Q.miterLimit=10,Q.strokeStyle=`${vt}${(0,K.opacityToHex)(Lt)}`},ot=new WeakSet,Ii=function(Q,vt){this.canvas.addEventListener("contextmenu",t(this,m)),this.canvas.addEventListener("pointerleave",t(this,U)),this.canvas.addEventListener("pointermove",t(this,L)),this.canvas.addEventListener("pointerup",t(this,R)),this.canvas.removeEventListener("pointerdown",t(this,S)),this.isEditing=!0,t(this,w)||(st(this,w,!0),V(this,Bt,le).call(this),this.thickness||(this.thickness=Nt._defaultThickness),this.color||(this.color=Nt._defaultColor||M.AnnotationEditor._defaultLineColor),this.opacity??(this.opacity=Nt._defaultOpacity)),this.currentPath.push([Q,vt]),st(this,_,!1),V(this,X,Ze).call(this),st(this,r,()=>{V(this,i,Ni).call(this),t(this,r)&&window.requestAnimationFrame(t(this,r))}),window.requestAnimationFrame(t(this,r))},O=new WeakSet,ti=function(Q,vt){const[Lt,St]=this.currentPath.at(-1);if(this.currentPath.length>1&&Q===Lt&&vt===St)return;const p=this.currentPath;let a=t(this,v);if(p.push([Q,vt]),st(this,_,!0),p.length<=2){a.moveTo(...p[0]),a.lineTo(Q,vt);return}p.length===3&&(st(this,v,a=new Path2D),a.moveTo(...p[0])),V(this,C,Ui).call(this,a,...p.at(-3),...p.at(-2),Q,vt)},rt=new WeakSet,Oi=function(){if(this.currentPath.length===0)return;const Q=this.currentPath.at(-1);t(this,v).lineTo(...Q)},d=new WeakSet,Li=function(Q,vt){st(this,r,null),Q=Math.min(Math.max(Q,0),this.canvas.width),vt=Math.min(Math.max(vt,0),this.canvas.height),V(this,O,ti).call(this,Q,vt),V(this,rt,Oi).call(this);let Lt;if(this.currentPath.length!==1)Lt=V(this,N,Bi).call(this);else{const T=[Q,vt];Lt=[[T,T.slice(),T.slice(),T]]}const St=t(this,v),p=this.currentPath;this.currentPath=[],st(this,v,new Path2D);const a=()=>{this.allRawPaths.push(p),this.paths.push(Lt),this.bezierPath2D.push(St),this.rebuild()},k=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(V(this,ut,we).call(this),V(this,Et,Ce).call(this)),V(this,Tt,ce).call(this))};this.addCommands({cmd:a,undo:k,mustExec:!0})},i=new WeakSet,Ni=function(){if(!t(this,_))return;st(this,_,!1);const Q=Math.ceil(this.thickness*this.parentScale),vt=this.currentPath.slice(-3),Lt=vt.map(a=>a[0]),St=vt.map(a=>a[1]);Math.min(...Lt)-Q,Math.max(...Lt)+Q,Math.min(...St)-Q,Math.max(...St)+Q;const{ctx:p}=this;p.save(),p.clearRect(0,0,this.canvas.width,this.canvas.height);for(const a of this.bezierPath2D)p.stroke(a);p.stroke(t(this,v)),p.restore()},C=new WeakSet,Ui=function(Q,vt,Lt,St,p,a,k){const T=(vt+St)/2,B=(Lt+p)/2,Z=(St+a)/2,_t=(p+k)/2;Q.bezierCurveTo(T+2*(St-T)/3,B+2*(p-B)/3,Z+2*(St-Z)/3,_t+2*(p-_t)/3,Z,_t)},N=new WeakSet,Bi=function(){const Q=this.currentPath;if(Q.length<=2)return[[Q[0],Q[0],Q.at(-1),Q.at(-1)]];const vt=[];let Lt,[St,p]=Q[0];for(Lt=1;Lt<Q.length-2;Lt++){const[b,q]=Q[Lt],[et,yt]=Q[Lt+1],gt=(b+et)/2,At=(q+yt)/2,Pt=[St+2*(b-St)/3,p+2*(q-p)/3],It=[gt+2*(b-gt)/3,At+2*(q-At)/3];vt.push([[St,p],Pt,It,[gt,At]]),[St,p]=[gt,At]}const[a,k]=Q[Lt],[T,B]=Q[Lt+1],Z=[St+2*(a-St)/3,p+2*(k-p)/3],_t=[T+2*(a-T)/3,B+2*(k-B)/3];return vt.push([[St,p],Z,_t,[T,B]]),vt},Y=new WeakSet,ie=function(){if(this.isEmpty()){V(this,it,Te).call(this);return}V(this,X,Ze).call(this);const{canvas:Q,ctx:vt}=this;vt.setTransform(1,0,0,1,0,0),vt.clearRect(0,0,Q.width,Q.height),V(this,it,Te).call(this);for(const Lt of this.bezierPath2D)vt.stroke(Lt)},at=new WeakSet,ei=function(Q){this.canvas.removeEventListener("pointerleave",t(this,U)),this.canvas.removeEventListener("pointermove",t(this,L)),this.canvas.removeEventListener("pointerup",t(this,R)),this.canvas.addEventListener("pointerdown",t(this,S)),setTimeout(()=>{this.canvas.removeEventListener("contextmenu",t(this,m))},10),V(this,d,Li).call(this,Q.offsetX,Q.offsetY),this.addToAnnotationStorage(),this.setInBackground()},ut=new WeakSet,we=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",Nt._l10nPromise.get("editor_ink_canvas_aria_label").then(Q=>{var vt;return(vt=this.canvas)==null?void 0:vt.setAttribute("aria-label",Q)}),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},Et=new WeakSet,Ce=function(){st(this,P,new ResizeObserver(Q=>{const vt=Q[0].contentRect;vt.width&&vt.height&&this.setDimensions(vt.width,vt.height)})),t(this,P).observe(this.div)},Bt=new WeakSet,le=function(){if(!t(this,w))return;const[Q,vt]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*Q),this.canvas.height=Math.ceil(this.height*vt),V(this,it,Te).call(this)},Ut=new WeakSet,ii=function(Q,vt){const Lt=V(this,G,xe).call(this),St=(Q-Lt)/t(this,D),p=(vt-Lt)/t(this,H);this.scaleFactor=Math.min(St,p)},it=new WeakSet,Te=function(){const Q=V(this,G,xe).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+Q,this.translationY*this.scaleFactor+Q)},ft=new WeakSet,ji=function(Q){const vt=new Path2D;for(let Lt=0,St=Q.length;Lt<St;Lt++){const[p,a,k,T]=Q[Lt];Lt===0&&vt.moveTo(...p),vt.bezierCurveTo(a[0],a[1],k[0],k[1],T[0],T[1])}return vt},Mt=new WeakSet,si=function(Q,vt,Lt){const[St,p,a,k]=vt;switch(Lt){case 0:for(let T=0,B=Q.length;T<B;T+=2)Q[T]+=St,Q[T+1]=k-Q[T+1];break;case 90:for(let T=0,B=Q.length;T<B;T+=2){const Z=Q[T];Q[T]=Q[T+1]+St,Q[T+1]=Z+p}break;case 180:for(let T=0,B=Q.length;T<B;T+=2)Q[T]=a-Q[T],Q[T+1]+=p;break;case 270:for(let T=0,B=Q.length;T<B;T+=2){const Z=Q[T];Q[T]=a-Q[T+1],Q[T+1]=k-Z}break;default:throw new Error("Invalid rotation")}return Q},Wt=new WeakSet,Hi=function(Q,vt,Lt){const[St,p,a,k]=vt;switch(Lt){case 0:for(let T=0,B=Q.length;T<B;T+=2)Q[T]-=St,Q[T+1]=k-Q[T+1];break;case 90:for(let T=0,B=Q.length;T<B;T+=2){const Z=Q[T];Q[T]=Q[T+1]-p,Q[T+1]=Z-St}break;case 180:for(let T=0,B=Q.length;T<B;T+=2)Q[T]=a-Q[T],Q[T+1]-=p;break;case 270:for(let T=0,B=Q.length;T<B;T+=2){const Z=Q[T];Q[T]=k-Q[T+1],Q[T+1]=a-Z}break;default:throw new Error("Invalid rotation")}return Q},Dt=new WeakSet,Wi=function(Q,vt,Lt,St){var B,Z;const p=[],a=this.thickness/2,k=Q*vt+a,T=Q*Lt+a;for(const _t of this.paths){const b=[],q=[];for(let et=0,yt=_t.length;et<yt;et++){const[gt,At,Pt,It]=_t[et],Xt=Q*gt[0]+k,qt=Q*gt[1]+T,Kt=Q*At[0]+k,Vt=Q*At[1]+T,Qt=Q*Pt[0]+k,te=Q*Pt[1]+T,Zt=Q*It[0]+k,se=Q*It[1]+T;et===0&&(b.push(Xt,qt),q.push(Xt,qt)),b.push(Kt,Vt,Qt,te,Zt,se),q.push(Kt,Vt),et===yt-1&&q.push(Zt,se)}p.push({bezier:V(B=Nt,Mt,si).call(B,b,St,this.rotation),points:V(Z=Nt,Mt,si).call(Z,q,St,this.rotation)})}return p},jt=new WeakSet,ni=function(){let Q=1/0,vt=-1/0,Lt=1/0,St=-1/0;for(const p of this.paths)for(const[a,k,T,B]of p){const Z=l.Util.bezierBoundingBox(...a,...k,...T,...B);Q=Math.min(Q,Z[0]),Lt=Math.min(Lt,Z[1]),vt=Math.max(vt,Z[2]),St=Math.max(St,Z[3])}return[Q,Lt,vt,St]},G=new WeakSet,xe=function(){return t(this,c)?Math.ceil(this.thickness*this.parentScale):0},Tt=new WeakSet,ce=function(Q=!1){if(this.isEmpty())return;if(!t(this,c)){V(this,Y,ie).call(this);return}const vt=V(this,jt,ni).call(this),Lt=V(this,G,xe).call(this);st(this,D,Math.max(M.AnnotationEditor.MIN_SIZE,vt[2]-vt[0])),st(this,H,Math.max(M.AnnotationEditor.MIN_SIZE,vt[3]-vt[1]));const St=Math.ceil(Lt+t(this,D)*this.scaleFactor),p=Math.ceil(Lt+t(this,H)*this.scaleFactor),[a,k]=this.parentDimensions;this.width=St/a,this.height=p/k,this.setAspectRatio(St,p);const T=this.translationX,B=this.translationY;this.translationX=-vt[0],this.translationY=-vt[1],V(this,Bt,le).call(this),V(this,Y,ie).call(this),st(this,A,St),st(this,n,p),this.setDims(St,p);const Z=Q?Lt/this.scaleFactor/2:0;this.translate(T-this.translationX-Z,B-this.translationY-Z)},I(Nt,ft),I(Nt,Mt),I(Nt,Wt),Yt(Nt,"_defaultColor",null),Yt(Nt,"_defaultOpacity",1),Yt(Nt,"_defaultThickness",1),Yt(Nt,"_l10nPromise"),Yt(Nt,"_type","ink");let bt=Nt;h.InkEditor=bt},(wt,h,ct)=>{var H,D,m,L,U,R,S,v,c,_,w,me,A,be,r,Pe,f,ri,x,Gi,W,zi,E,ai,nt,ke,u,Xi;Object.defineProperty(h,"__esModule",{value:!0}),h.StampEditor=void 0;var l=ct(1),M=ct(4),ht=ct(6),K=ct(29);const $=class $ extends M.AnnotationEditor{constructor(d){super({...d,name:"stampEditor"});I(this,w);I(this,A);I(this,r);I(this,f);I(this,x);I(this,W);I(this,E);I(this,nt);I(this,u);I(this,H,null);I(this,D,null);I(this,m,null);I(this,L,null);I(this,U,null);I(this,R,null);I(this,S,null);I(this,v,null);I(this,c,!1);I(this,_,!1);st(this,L,d.bitmapUrl),st(this,U,d.bitmapFile)}static get supportedTypes(){const d=["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"];return(0,l.shadow)(this,"supportedTypes",d.map(e=>`image/${e}`))}static get supportedTypesStr(){return(0,l.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(d){return this.supportedTypes.includes(d)}static paste(d,e){e.pasteEditor(l.AnnotationEditorType.STAMP,{bitmapFile:d.getAsFile()})}remove(){var d,e;t(this,D)&&(st(this,H,null),this._uiManager.imageManager.deleteId(t(this,D)),(d=t(this,R))==null||d.remove(),st(this,R,null),(e=t(this,S))==null||e.disconnect(),st(this,S,null)),super.remove()}rebuild(){if(!this.parent){t(this,D)&&V(this,r,Pe).call(this);return}super.rebuild(),this.div!==null&&(t(this,D)&&V(this,r,Pe).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(t(this,m)||t(this,H)||t(this,L)||t(this,U))}get isResizable(){return!0}render(){if(this.div)return this.div;let d,e;if(this.width&&(d=this.x,e=this.y),super.render(),this.div.hidden=!0,t(this,H)?V(this,f,ri).call(this):V(this,r,Pe).call(this),this.width){const[i,o]=this.parentDimensions;this.setAt(d*i,e*o,this.width*i,this.height*o)}return this.div}static deserialize(d,e,i){if(d instanceof K.StampAnnotationElement)return null;const o=super.deserialize(d,e,i),{rect:C,bitmapUrl:y,bitmapId:N,isSvg:j}=d;N&&i.imageManager.isValidId(N)?st(o,D,N):st(o,L,y),st(o,c,j);const[Y,dt]=o.pageDimensions;return o.width=(C[2]-C[0])/Y,o.height=(C[3]-C[1])/dt,o}serialize(d=!1,e=null){if(this.isEmpty())return null;const i={annotationType:l.AnnotationEditorType.STAMP,bitmapId:t(this,D),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:t(this,c)};if(d)return i.bitmapUrl=V(this,nt,ke).call(this,!0),i;if(e===null)return i;e.stamps||(e.stamps=new Map);const o=t(this,c)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!e.stamps.has(t(this,D)))e.stamps.set(t(this,D),{area:o,serialized:i}),i.bitmap=V(this,nt,ke).call(this,!1);else if(t(this,c)){const C=e.stamps.get(t(this,D));o>C.area&&(C.area=o,C.serialized.bitmap.close(),C.serialized.bitmap=V(this,nt,ke).call(this,!1))}return i}};H=new WeakMap,D=new WeakMap,m=new WeakMap,L=new WeakMap,U=new WeakMap,R=new WeakMap,S=new WeakMap,v=new WeakMap,c=new WeakMap,_=new WeakMap,w=new WeakSet,me=function(d,e=!1){if(!d){this.remove();return}st(this,H,d.bitmap),e||(st(this,D,d.id),st(this,c,d.isSvg)),V(this,f,ri).call(this)},A=new WeakSet,be=function(){st(this,m,null),this._uiManager.enableWaiting(!1),t(this,R)&&this.div.focus()},r=new WeakSet,Pe=function(){if(t(this,D)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(t(this,D)).then(e=>V(this,w,me).call(this,e,!0)).finally(()=>V(this,A,be).call(this));return}if(t(this,L)){const e=t(this,L);st(this,L,null),this._uiManager.enableWaiting(!0),st(this,m,this._uiManager.imageManager.getFromUrl(e).then(i=>V(this,w,me).call(this,i)).finally(()=>V(this,A,be).call(this)));return}if(t(this,U)){const e=t(this,U);st(this,U,null),this._uiManager.enableWaiting(!0),st(this,m,this._uiManager.imageManager.getFromFile(e).then(i=>V(this,w,me).call(this,i)).finally(()=>V(this,A,be).call(this)));return}const d=document.createElement("input");d.type="file",d.accept=$.supportedTypesStr,st(this,m,new Promise(e=>{d.addEventListener("change",async()=>{if(!d.files||d.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(d.files[0]);V(this,w,me).call(this,i)}e()}),d.addEventListener("cancel",()=>{this.remove(),e()})}).finally(()=>V(this,A,be).call(this))),d.click()},f=new WeakSet,ri=function(){const{div:d}=this;let{width:e,height:i}=t(this,H);const[o,C]=this.pageDimensions,y=.75;if(this.width)e=this.width*o,i=this.height*C;else if(e>y*o||i>y*C){const dt=Math.min(y*o/e,y*C/i);e*=dt,i*=dt}const[N,j]=this.parentDimensions;this.setDims(e*N/o,i*j/C),this._uiManager.enableWaiting(!1);const Y=st(this,R,document.createElement("canvas"));d.append(Y),d.hidden=!1,V(this,E,ai).call(this,e,i),V(this,u,Xi).call(this),t(this,_)||(this.parent.addUndoableEditor(this),st(this,_,!0))},x=new WeakSet,Gi=function(d,e){var y;const[i,o]=this.parentDimensions;this.width=d/i,this.height=e/o,this.setDims(d,e),(y=this._initialOptions)!=null&&y.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,t(this,v)!==null&&clearTimeout(t(this,v)),st(this,v,setTimeout(()=>{st(this,v,null),V(this,E,ai).call(this,d,e)},200))},W=new WeakSet,zi=function(d,e){const{width:i,height:o}=t(this,H);let C=i,y=o,N=t(this,H);for(;C>2*d||y>2*e;){const j=C,Y=y;C>2*d&&(C=C>=16384?Math.floor(C/2)-1:Math.ceil(C/2)),y>2*e&&(y=y>=16384?Math.floor(y/2)-1:Math.ceil(y/2));const dt=new OffscreenCanvas(C,y);dt.getContext("2d").drawImage(N,0,0,j,Y,0,0,C,y),N=dt.transferToImageBitmap()}return N},E=new WeakSet,ai=function(d,e){d=Math.ceil(d),e=Math.ceil(e);const i=t(this,R);if(!i||i.width===d&&i.height===e)return;i.width=d,i.height=e;const o=t(this,c)?t(this,H):V(this,W,zi).call(this,d,e),C=i.getContext("2d");C.filter=this._uiManager.hcmFilter,C.drawImage(o,0,0,o.width,o.height,0,0,d,e)},nt=new WeakSet,ke=function(d){if(d){if(t(this,c)){const o=this._uiManager.imageManager.getSvgUrl(t(this,D));if(o)return o}const e=document.createElement("canvas");return{width:e.width,height:e.height}=t(this,H),e.getContext("2d").drawImage(t(this,H),0,0),e.toDataURL()}if(t(this,c)){const[e,i]=this.pageDimensions,o=Math.round(this.width*e*ht.PixelsPerInch.PDF_TO_CSS_UNITS),C=Math.round(this.height*i*ht.PixelsPerInch.PDF_TO_CSS_UNITS),y=new OffscreenCanvas(o,C);return y.getContext("2d").drawImage(t(this,H),0,0,t(this,H).width,t(this,H).height,0,0,o,C),y.transferToImageBitmap()}return structuredClone(t(this,H))},u=new WeakSet,Xi=function(){st(this,S,new ResizeObserver(d=>{const e=d[0].contentRect;e.width&&e.height&&V(this,x,Gi).call(this,e.width,e.height)})),t(this,S).observe(this.div)},Yt($,"_type","stamp");let bt=$;h.StampEditor=bt}],__webpack_module_cache__={};function __w_pdfjs_require__(wt){var h=__webpack_module_cache__[wt];if(h!==void 0)return h.exports;var ct=__webpack_module_cache__[wt]={exports:{}};return __webpack_modules__[wt](ct,ct.exports,__w_pdfjs_require__),ct.exports}var __webpack_exports__={};return(()=>{var wt=__webpack_exports__;Object.defineProperty(wt,"__esModule",{value:!0}),Object.defineProperty(wt,"AbortException",{enumerable:!0,get:function(){return h.AbortException}}),Object.defineProperty(wt,"AnnotationEditorLayer",{enumerable:!0,get:function(){return ht.AnnotationEditorLayer}}),Object.defineProperty(wt,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return h.AnnotationEditorParamsType}}),Object.defineProperty(wt,"AnnotationEditorType",{enumerable:!0,get:function(){return h.AnnotationEditorType}}),Object.defineProperty(wt,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return K.AnnotationEditorUIManager}}),Object.defineProperty(wt,"AnnotationLayer",{enumerable:!0,get:function(){return bt.AnnotationLayer}}),Object.defineProperty(wt,"AnnotationMode",{enumerable:!0,get:function(){return h.AnnotationMode}}),Object.defineProperty(wt,"CMapCompressionType",{enumerable:!0,get:function(){return h.CMapCompressionType}}),Object.defineProperty(wt,"FeatureTest",{enumerable:!0,get:function(){return h.FeatureTest}}),Object.defineProperty(wt,"GlobalWorkerOptions",{enumerable:!0,get:function(){return H.GlobalWorkerOptions}}),Object.defineProperty(wt,"ImageKind",{enumerable:!0,get:function(){return h.ImageKind}}),Object.defineProperty(wt,"InvalidPDFException",{enumerable:!0,get:function(){return h.InvalidPDFException}}),Object.defineProperty(wt,"MissingPDFException",{enumerable:!0,get:function(){return h.MissingPDFException}}),Object.defineProperty(wt,"OPS",{enumerable:!0,get:function(){return h.OPS}}),Object.defineProperty(wt,"PDFDataRangeTransport",{enumerable:!0,get:function(){return ct.PDFDataRangeTransport}}),Object.defineProperty(wt,"PDFDateString",{enumerable:!0,get:function(){return l.PDFDateString}}),Object.defineProperty(wt,"PDFWorker",{enumerable:!0,get:function(){return ct.PDFWorker}}),Object.defineProperty(wt,"PasswordResponses",{enumerable:!0,get:function(){return h.PasswordResponses}}),Object.defineProperty(wt,"PermissionFlag",{enumerable:!0,get:function(){return h.PermissionFlag}}),Object.defineProperty(wt,"PixelsPerInch",{enumerable:!0,get:function(){return l.PixelsPerInch}}),Object.defineProperty(wt,"PromiseCapability",{enumerable:!0,get:function(){return h.PromiseCapability}}),Object.defineProperty(wt,"RenderingCancelledException",{enumerable:!0,get:function(){return l.RenderingCancelledException}}),Object.defineProperty(wt,"SVGGraphics",{enumerable:!0,get:function(){return ct.SVGGraphics}}),Object.defineProperty(wt,"UnexpectedResponseException",{enumerable:!0,get:function(){return h.UnexpectedResponseException}}),Object.defineProperty(wt,"Util",{enumerable:!0,get:function(){return h.Util}}),Object.defineProperty(wt,"VerbosityLevel",{enumerable:!0,get:function(){return h.VerbosityLevel}}),Object.defineProperty(wt,"XfaLayer",{enumerable:!0,get:function(){return D.XfaLayer}}),Object.defineProperty(wt,"build",{enumerable:!0,get:function(){return ct.build}}),Object.defineProperty(wt,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return h.createValidAbsoluteUrl}}),Object.defineProperty(wt,"getDocument",{enumerable:!0,get:function(){return ct.getDocument}}),Object.defineProperty(wt,"getFilenameFromUrl",{enumerable:!0,get:function(){return l.getFilenameFromUrl}}),Object.defineProperty(wt,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return l.getPdfFilenameFromUrl}}),Object.defineProperty(wt,"getXfaPageViewport",{enumerable:!0,get:function(){return l.getXfaPageViewport}}),Object.defineProperty(wt,"isDataScheme",{enumerable:!0,get:function(){return l.isDataScheme}}),Object.defineProperty(wt,"isPdfFile",{enumerable:!0,get:function(){return l.isPdfFile}}),Object.defineProperty(wt,"loadScript",{enumerable:!0,get:function(){return l.loadScript}}),Object.defineProperty(wt,"normalizeUnicode",{enumerable:!0,get:function(){return h.normalizeUnicode}}),Object.defineProperty(wt,"renderTextLayer",{enumerable:!0,get:function(){return M.renderTextLayer}}),Object.defineProperty(wt,"setLayerDimensions",{enumerable:!0,get:function(){return l.setLayerDimensions}}),Object.defineProperty(wt,"shadow",{enumerable:!0,get:function(){return h.shadow}}),Object.defineProperty(wt,"updateTextLayer",{enumerable:!0,get:function(){return M.updateTextLayer}}),Object.defineProperty(wt,"version",{enumerable:!0,get:function(){return ct.version}});var h=__w_pdfjs_require__(1),ct=__w_pdfjs_require__(2),l=__w_pdfjs_require__(6),M=__w_pdfjs_require__(26),ht=__w_pdfjs_require__(27),K=__w_pdfjs_require__(5),bt=__w_pdfjs_require__(29),H=__w_pdfjs_require__(14),D=__w_pdfjs_require__(32)})(),__webpack_exports__})())})(pdf);var pdfExports=pdf.exports;export{commonjsRequire as c,pdfExports as p};
|