PageSourceSearch

https://app.discuss.io/assets/dio-ui/static/js/6902.7a92c128.chunk.js

js discuss.io collected 2026-09-25 14:18:57 UTC 409,070 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdio_ui=self.webpackChunkdio_ui||[]).push([[6902],{86902(t,e,i){i.d(e,{EA:()=>cv,YE:()=>dv});var s=i(89379);var n=i(38458);function a(t,e){return function(t,e){if(e.set)return"__destrObj"in e||(e.__destrObj={set value(i){e.set.call(t,i)}}),e.__destrObj;if(!e.writable)throw new TypeError("attempted to set read only private field");return e}(t,(0,n.A)(e,t))}var r=i(87695),o=i(39790),l=i(55149),h=i(61187),c=i(21114),d=i(806),u=i(7658),A=i(26562);function p(t,e){if(void 0===t)throw new TypeError("attempted to "+e+" private static field before its declaration")}function g(t,e,i,s){return(0,A.A)(e,t),p(i,"set"),(0,u.A)(t,i,s),s}var f=i(82390);function v(t,e,i){return(0,A.A)(e,t),p(i,"get"),(0,f.A)(t,i)}var m=i(64467);function w(t,e,i){return(0,A.A)(e,t),i}var b=i(5544),_={d:(t,e)=>{for(var i in e)_.o(e,i)&&!_.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},y=globalThis.pdfjsLib={};_.d(y,{AbortException:()=>Dt,AnnotationEditorLayer:()=>Uf,AnnotationEditorParamsType:()=>N,AnnotationEditorType:()=>W,AnnotationEditorUIManager:()=>fs,AnnotationLayer:()=>Gd,AnnotationMode:()=>F,ColorPicker:()=>BA,DOMSVGFactory:()=>tc,DrawLayer:()=>av,FeatureTest:()=>Ot,GlobalWorkerOptions:()=>Do,ImageKind:()=>U,InvalidPDFException:()=>Rt,MissingPDFException:()=>Pt,OPS:()=>ft,OutputScale:()=>pe,PDFDataRangeTransport:()=>dh,PDFDateString:()=>oe,PDFWorker:()=>Sh,PasswordResponses:()=>vt,PermissionFlag:()=>O,PixelsPerInch:()=>Kt,RenderingCancelledException:()=>Zt,TextLayer:()=>Gl,TouchManager:()=>vn,UnexpectedResponseException:()=>It,Util:()=>Ht,VerbosityLevel:()=>gt,XfaLayer:()=>ec,build:()=>Kh,createValidAbsoluteUrl:()=>xt,fetchData:()=>Qt,getDocument:()=>oh,getFilenameFromUrl:()=>ee,getPdfFilenameFromUrl:()=>ie,getXfaPageViewport:()=>he,isDataScheme:()=>$t,isPdfFile:()=>te,noContextMenu:()=>ae,normalizeUnicode:()=>Ut,setLayerDimensions:()=>Ae,shadow:()=>Mt,stopEvent:()=>re,version:()=>Yh});const k="object"===typeof process&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),S=[1,0,0,1,0,0],x=[.001,0,0,.001,0,0],M=1.35,E=1,C=2,T=4,R=16,P=32,I=64,L=128,D=256,F={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},W={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},N={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35,DRAW_STEP:41},O={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},B=0,H=1,z=2,j=3,G=3,V=4,U={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},q=1,X=2,Y=3,K=4,Q=5,J=6,Z=7,$=8,tt=9,et=10,it=11,st=12,nt=13,at=14,rt=15,ot=16,lt=17,ht=20,ct=1,dt=2,ut=3,At=4,pt=5,gt={ERRORS:0,WARNINGS:1,INFOS:5},ft={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},vt={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let mt=gt.WARNINGS;function wt(t){Number.isInteger(t)&&(mt=t)}function bt(){return mt}function _t(t){mt>=gt.INFOS&&console.log("Info: ".concat(t))}function yt(t){mt>=gt.WARNINGS&&console.log("Warning: ".concat(t))}function kt(t){throw new Error(t)}function St(t,e){t||kt(e)}function xt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(i&&"string"===typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);(null===e||void 0===e?void 0:e.length)>=2&&(t="http://".concat(t))}
1if(i.tryConvertEncoding)try{t=decodeURIComponent(escape(t))}catch(s){}}const n=e?new URL(t,e):new URL(t);if(function(t){switch(null===t||void 0===t?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch(n){}return null}function Mt(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(t,e,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}const Et=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=new Error,t.constructor=t,t}();class Ct extends Et{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Tt extends Et{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class Rt extends Et{constructor(t){super(t,"InvalidPDFException")}}class Pt extends Et{constructor(t){super(t,"MissingPDFException")}}class It extends Et{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class Lt extends Et{constructor(t){super(t,"FormatError")}}class Dt extends Et{constructor(t){super(t,"AbortException")}}function Ft(t){"object"===typeof t&&void 0!==(null===t||void 0===t?void 0:t.length)||kt("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const s=[];for(let n=0;n<e;n+=i){const a=Math.min(n+i,e),r=t.subarray(n,a);s.push(String.fromCharCode.apply(null,r))}return s.join("")}function Wt(t){"string"!==typeof t&&kt("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let s=0;s<e;++s)i[s]=255&t.charCodeAt(s);return i}function Nt(t){const e=Object.create(null);for(const s of t){var i=(0,b.A)(s,2);const t=i[0],n=i[1];e[t]=n}return e}class Ot{static get isLittleEndian(){return Mt(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return Mt(this,"isEvalSupported",function(){try{return new Function(""),!0}catch(t){return!1}}())}static get isOffscreenCanvasSupported(){return Mt(this,"isOffscreenCanvasSupported","undefined"!==typeof OffscreenCanvas)}static get isImageDecoderSupported(){return Mt(this,"isImageDecoderSupported","undefined"!==typeof ImageDecoder)}static get platform(){var t,e;return"undefined"!==typeof navigator&&"string"===typeof(null===(t=navigator)||void 0===t?void 0:t.platform)?Mt(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"===typeof(null===(e=navigator)||void 0===e?void 0:e.userAgent)&&navigator.userAgent.includes("Firefox")}):Mt(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var t,e;return Mt(this,"isCSSRoundSupported",null===(t=globalThis.CSS)||void 0===t||null===(e=t.supports)||void 0===e?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const Bt=Array.from(Array(256).keys(),(t=>t.toString(16).padStart(2,"0")));class Ht{static makeHexColor(t,e,i){return"#".concat(Bt[t]).concat(Bt[e]).concat(Bt[i])}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){const i=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(t,e){const i=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],s[0],n[0],a[0]),Math.min(i[1],s[1],n[1],a[1]),Math.max(i[0],s[0],n[0],a[0]),Math.max(i[1],s[1],n[1],a[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],s=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],r=(i+a)/2,o=Math.sqrt((i+a)**2-4*(i*a-n*s))/2,l=r+o||1,h=r-o||1;return[Math.sqrt(l),Math.sqrt(h)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>a?null:[i,n,s,a]}static bezierBoundingBox(t,e,i,s,n,a,r,o,l){return l?(l[0]=Math.min(l[0],t,r),l[1]=Math.min(l[1],e,o),l[2]=Math.max(l[2],t,r),l[3]=Math.max(l[3],e,o)):l=[Math.min(t,r),Math.min(e,o),Math.max(t,r),Math.max(e,o)],w(this,Ht,jt).call(this,t,i,n,r,e,s,a,o,3*(3*(i-n)-t+r),6*(t-2*i+n),3*(i-t),l),w(this,Ht,jt).call(this,t,i,n,r,e,s,a,o,3*(3*(s-a)-e+o),6*(e-2*s+a),3*(s-e),l),l}}function zt(t,e,i,s,n,a,r,o,l,h){if(l<=0||l>=1)return;const c=1-l,d=l*l,u=d*l,A=c*(c*(c*t+3*l*e)+3*d*i)+u*s,p=c*(c*(c*n+3*l*a)+3*d*r)+u*o;h[0]=Math.min(h[0],A),h[1]=Math.min(h[1],p),h[2]=Math.max(h[2],A),h[3]=Math.max(h[3],p)}function jt(t,e,i,s,n,a,r,o,l,h,c,d){if(Math.abs(l)<1e-12)return void(Math.abs(h)>=1e-12&&w(this,Ht,zt).call(this,t,e,i,s,n,a,r,o,-c/h,d));const u=h**2-4*c*l;if(u<0)return;const A=Math.sqrt(u),p=2*l;w(this,Ht,zt).call(this,t,e,i,s,n,a,r,o,(-h+A)/p,d),w(this,Ht,zt).call(this,t,e,i,s,n,a,r,o,(-h-A)/p,d)}let Gt=null,Vt=null;function Ut(t){return Gt||(Gt=/([\xA0\xB5\u037E\u0EB3\u2000-\u200A\u202F\u2126\uFB00-\uFB04\uFB06\uFB20-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBA1\uFBA4-\uFBA9\uFBAE-\uFBB1\uFB
1D3-\uFBDC\uFBDE-\uFBE7\uFBEA-\uFBF8\uFBFC\uFBFD\uFC00-\uFC5D\uFC64-\uFCF1\uFCF5-\uFD3D\uFD88\uFDF4\uFDFA\uFDFB\uFE71\uFE77\uFE79\uFE7B\uFE7D]+)|(\uFB05+)/g,Vt=new Map([["\ufb05","\u017ft"]])),t.replaceAll(Gt,((t,e,i)=>e?e.normalize("NFKC"):Vt.get(i)))}function qt(){if("function"===typeof crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),Ft(t)}const Xt="pdfjs_internal_id_";"function"!==typeof Promise.try&&(Promise.try=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];return new Promise((e=>{e(t(...i))}))});const Yt="http://www.w3.org/2000/svg";class Kt{}async function Qt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(ne(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise(((i,s)=>{const n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType=e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE)if(200!==n.status&&0!==n.status)s(new Error(n.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void i(n.response)}i(n.responseText)}},n.send(null)}))}(0,m.A)(Kt,"CSS",96),(0,m.A)(Kt,"PDF",72),(0,m.A)(Kt,"PDF_TO_CSS_UNITS",Kt.CSS/Kt.PDF);class Jt{constructor(t){let e=t.viewBox,i=t.userUnit,s=t.scale,n=t.rotation,a=t.offsetX,r=void 0===a?0:a,o=t.offsetY,l=void 0===o?0:o,h=t.dontFlip,c=void 0!==h&&h;this.viewBox=e,this.userUnit=i,this.scale=s,this.rotation=n,this.offsetX=r,this.offsetY=l,s*=i;const d=(e[2]+e[0])/2,u=(e[3]+e[1])/2;let A,p,g,f,v,m,w,b;switch(n%=360,n<0&&(n+=360),n){case 180:A=-1,p=0,g=0,f=1;break;case 90:A=0,p=1,g=1,f=0;break;case 270:A=0,p=-1,g=-1,f=0;break;case 0:A=1,p=0,g=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}c&&(g=-g,f=-f),0===A?(v=Math.abs(u-e[1])*s+r,m=Math.abs(d-e[0])*s+l,w=(e[3]-e[1])*s,b=(e[2]-e[0])*s):(v=Math.abs(d-e[0])*s+r,m=Math.abs(u-e[1])*s+l,w=(e[2]-e[0])*s,b=(e[3]-e[1])*s),this.transform=[A*s,p*s,g*s,f*s,v-A*s*d-g*s*u,m-p*s*d-f*s*u],this.width=w,this.height=b}get rawDims(){const t=this.userUnit,e=this.viewBox.map((e=>e*t));return Mt(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.scale,i=void 0===e?this.scale:e,s=t.rotation,n=void 0===s?this.rotation:s,a=t.offsetX,r=void 0===a?this.offsetX:a,o=t.offsetY,l=void 0===o?this.offsetY:o,h=t.dontFlip,c=void 0!==h&&h;return new Jt({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:i,rotation:n,offsetX:r,offsetY:l,dontFlip:c})}convertToViewportPoint(t,e){return Ht.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=Ht.applyTransform([t[0],t[1]],this.transform),i=Ht.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return Ht.applyInverseTransform([t,e],this.transform)}}class Zt extends Et{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t,"RenderingCancelledException"),this.extraDelay=e}}function $t(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function te(t){return"string"===typeof t&&/\.pdf$/i.test(t)}function ee(t){var e=t.split(/[#?]/,1);return(t=(0,b.A)(e,1)[0]).substring(t.lastIndexOf("/")+1)}function ie(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!==typeof t)return e;if($t(t))return yt('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t);let n=i.exec(s[1])||i.exec(s[2])||i.exec(s[3]);if(n&&(n=n[0],n.includes("%")))try{n=i.exec(decodeURIComponent(n))[0]}catch(a){}return n||e}class se{constructor(){(0,m.A)(this,"started",Object.create(null)),(0,m.A)(this,"times",[])}time(t){t in this.started&&yt("Timer is already running for ".concat(t)),this.started[t]=Date.now()}timeEnd(t){t in this.started||yt("Timer has not been started for ".concat(t)),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const i of this.times){const t=i.name;e=Math.max(t.length,e)}for(const i of this.times){const s=i.name,n=i.start,a=i.end;t.push("".concat(s.padEnd(e)," ").concat(a-n,"ms\n"))}return t.join("")}}function ne(t,e){try{const i=(e?new URL(t,e):new URL(t)).protocol;return"http:"===i||"https:"===i}catch(i){return!1}}function ae(t){t.preventDefault()}function re(t){t.preventDefault(),t.stopPropagation()}class oe{static toDateObject(t){if(!t||"string"!==typeof t)return null;v(this,oe,le)||g(this,oe,le,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=v(this,oe,le).exec(t);if(!e)return null;const i=parseInt(e[1],10);let s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let r=parseInt(e[5],10);r=r>=0&&r<=59?r:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;const l=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let c=parseInt(e[9],10)||0;return c=c>=0&&c<=59?c:0,"-"===l?(a+=h,r+=c):"+"===l&&(a-=h,r-=c),new Date(Date.UTC(i,s,n,a,r,o))}}var le={writable:!0,value:void 0};function he(t,e){let i=e.scale,s=void 0===i?1:i,n=e.rotation,a=void 0===n?0:n;const r=t.attributes.style,o=r.width,l=r.height,h=[0,0,parseInt(o),parseInt(l)];return new Jt({viewBox:h,userUnit:1,scale:s,rotation:a})}function ce(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map((t=>parseInt(t))):t.startsWith("rgba(")?t.slice(5,-1).split(",").map((t=>parseInt(t))).slice(0,3):(yt('Not a valid color format: "'.concat(t,'"')),[0,0,0])}function de(t){const e=t.getTransform();return[e.a,e.b,e.c,e.d,e.e,e.f]}function ue(t){const e=t.getTransform().invertSelf();return[e.a,e.b,e.c,e.d,e.e,e.f]}function Ae(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e instanceof Jt){const s=e.rawDims,n=s.pageWidth,a=s.pageHeight,r=t.style,o=Ot.isCSSRoundSupported,l="var(--scale-factor) * ".concat(n,"px"),h="var(--scale-factor) * ".concat(a,"px"),c=o?"round(down, ".concat(l,", var(--scale-round-x, 1px))"):"calc(".concat(l,")"),d=o?"round(down, ".concat(h,", var(--scale-round-y, 1px))"):"calc(".concat(h,")");
1i&&e.rotation%180!==0?(r.width=d,r.height=c):(r.width=c,r.height=d)}s&&t.setAttribute("data-main-rotation",e.rotation)}class pe{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}var ge=new WeakMap,fe=new WeakMap,ve=new WeakMap,me=new WeakMap,we=new WeakMap,be=new WeakSet,_e=new WeakSet,ye=new WeakSet,ke=new WeakSet,Se=new WeakMap;class xe{constructor(t){(0,l.A)(this,Se,{get:Pe,set:void 0}),(0,o.A)(this,ke),(0,o.A)(this,ye),(0,o.A)(this,_e),(0,o.A)(this,be),(0,l.A)(this,ge,{writable:!0,value:null}),(0,l.A)(this,fe,{writable:!0,value:null}),(0,l.A)(this,ve,{writable:!0,value:void 0}),(0,l.A)(this,me,{writable:!0,value:null}),(0,l.A)(this,we,{writable:!0,value:null}),(0,d.A)(this,ve,t),v(xe,xe,Ie)||g(xe,xe,Ie,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const t=(0,d.A)(this,ge,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=(0,c.A)(this,ve)._uiManager._signal;t.addEventListener("contextmenu",ae,{signal:e}),t.addEventListener("pointerdown",w(xe,xe,Me),{signal:e});const i=(0,d.A)(this,me,document.createElement("div"));i.className="buttons",t.append(i);const s=(0,c.A)(this,ve).toolbarPosition;if(s){const e=t.style,i="ltr"===(0,c.A)(this,ve)._uiManager.direction?1-s[0]:s[0];e.insetInlineEnd="".concat(100*i,"%"),e.top="calc(".concat(100*s[1],"% + var(--editor-toolbar-vert-offset))")}return(0,h.A)(this,ke,Re).call(this),t}get div(){return(0,c.A)(this,ge)}hide(){var t;(0,c.A)(this,ge).classList.add("hidden"),null===(t=(0,c.A)(this,fe))||void 0===t||t.hideDropdown()}show(){var t;(0,c.A)(this,ge).classList.remove("hidden"),null===(t=(0,c.A)(this,we))||void 0===t||t.shown()}async addAltText(t){const e=await t.render();(0,h.A)(this,ye,Te).call(this,e),(0,c.A)(this,me).prepend(e,(0,c.A)(this,Se)),(0,d.A)(this,we,t)}addColorPicker(t){(0,d.A)(this,fe,t);const e=t.renderButton();(0,h.A)(this,ye,Te).call(this,e),(0,c.A)(this,me).prepend(e,(0,c.A)(this,Se))}remove(){var t;(0,c.A)(this,ge).remove(),null===(t=(0,c.A)(this,fe))||void 0===t||t.destroy(),(0,d.A)(this,fe,null)}}function Me(t){t.stopPropagation()}function Ee(t){(0,c.A)(this,ve)._focusEventsAllowed=!1,re(t)}function Ce(t){(0,c.A)(this,ve)._focusEventsAllowed=!0,re(t)}function Te(t){const e=(0,c.A)(this,ve)._uiManager._signal;t.addEventListener("focusin",(0,h.A)(this,be,Ee).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",(0,h.A)(this,_e,Ce).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",ae,{signal:e})}function Re(){const t=(0,c.A)(this,ve),e=t.editorType,i=t._uiManager,s=document.createElement("button");s.className="delete",s.tabIndex=0,s.setAttribute("data-l10n-id",v(xe,xe,Ie)[e]),(0,h.A)(this,ye,Te).call(this,s),s.addEventListener("click",(t=>{i.delete()}),{signal:i._signal}),(0,c.A)(this,me).append(s)}function Pe(){const t=document.createElement("div");return t.className="divider",t}var Ie={writable:!0,value:null},Le=new WeakMap,De=new WeakMap,Fe=new WeakMap,We=new WeakSet,Ne=new WeakSet,Oe=new WeakSet;class Be{constructor(t){(0,o.A)(this,Oe),(0,o.A)(this,Ne),(0,o.A)(this,We),(0,l.A)(this,Le,{writable:!0,value:null}),(0,l.A)(this,De,{writable:!0,value:null}),(0,l.A)(this,Fe,{writable:!0,value:void 0}),(0,d.A)(this,Fe,t)}show(t,e,i){const s=(0,h.A)(this,Ne,ze).call(this,e,i),n=(0,b.A)(s,2),a=n[0],r=n[1],o=((0,c.A)(this,De)||(0,d.A)(this,De,(0,h.A)(this,We,He).call(this))).style;t.append((0,c.A)(this,De)),o.insetInlineEnd="".concat(100*a,"%"),o.top="calc(".concat(100*r,"% + var(--editor-toolbar-vert-offset))")}hide(){(0,c.A)(this,De).remove()}}function He(){const t=(0,d.A)(this,De,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",ae,{signal:(0,c.A)(this,Fe)._signal});const e=(0,d.A)(this,Le,document.createElement("div"));return e.className="buttons",t.append(e),(0,h.A)(this,Oe,je).call(this),t}function ze(t,e){let i=0,s=0;for(const n of t){const t=n.y+n.height;if(t<i)continue;const a=n.x+(e?n.width:0);t>i?(s=a,i=t):e?a>s&&(s=a):a<s&&(s=a)}return[e?1-s:s,i]}function je(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=(0,c.A)(this,Fe)._signal;t.addEventListener("contextmenu",ae,{signal:i}),t.addEventListener("click",(()=>{(0,c.A)(this,Fe).highlightSelection("floating_button")}),{signal:i}),(0,c.A)(this,Le).append(t)}function Ge(t,e,i){for(const s of i)e.addEventListener(s,t[s].bind(t))}var Ve=new WeakMap;
1class Ue{constructor(){(0,l.A)(this,Ve,{writable:!0,value:0})}get id(){var t,e;return"".concat("pdfjs_internal_editor_").concat(((0,d.A)(this,Ve,(t=(0,c.A)(this,Ve),e=t++,t)),e))}}var qe=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Ke=new WeakSet;class Qe{constructor(){(0,o.A)(this,Ke),(0,l.A)(this,qe,{writable:!0,value:qt()}),(0,l.A)(this,Xe,{writable:!0,value:0}),(0,l.A)(this,Ye,{writable:!0,value:null})}static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;e.src='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>';return Mt(this,"_isSVGFittingCanvas",e.decode().then((()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]))))}async getFromFile(t){const e=t.lastModified,i=t.name,s=t.size,n=t.type;return(0,h.A)(this,Ke,Je).call(this,"".concat(e,"_").concat(i,"_").concat(s,"_").concat(n),t)}async getFromUrl(t){return(0,h.A)(this,Ke,Je).call(this,t,t)}async getFromBlob(t,e){const i=await e;return(0,h.A)(this,Ke,Je).call(this,t,i)}async getFromId(t){(0,c.A)(this,Ye)||(0,d.A)(this,Ye,new Map);const e=(0,c.A)(this,Ye).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const t=e.blobPromise;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){var i,s,n;(0,c.A)(this,Ye)||(0,d.A)(this,Ye,new Map);let a=(0,c.A)(this,Ye).get(t);if(null!==(n=a)&&void 0!==n&&n.bitmap)return a.refCounter+=1,a;const r=new OffscreenCanvas(e.width,e.height);return r.getContext("2d").drawImage(e,0,0),a={bitmap:r.transferToImageBitmap(),id:"image_".concat((0,c.A)(this,qe),"_").concat(((0,d.A)(this,Xe,(i=(0,c.A)(this,Xe),s=i++,i)),s)),refCounter:1,isSvg:!1},(0,c.A)(this,Ye).set(t,a),(0,c.A)(this,Ye).set(a.id,a),a}getSvgUrl(t){const e=(0,c.A)(this,Ye).get(t);return null!==e&&void 0!==e&&e.isSvg?e.svgUrl:null}deleteId(t){var e;(0,c.A)(this,Ye)||(0,d.A)(this,Ye,new Map);const i=(0,c.A)(this,Ye).get(t);if(!i)return;if(i.refCounter-=1,0!==i.refCounter)return;const s=i.bitmap;if(!i.url&&!i.file){const t=new OffscreenCanvas(s.width,s.height);t.getContext("bitmaprenderer").transferFromImageBitmap(s),i.blobPromise=t.convertToBlob()}null===(e=s.close)||void 0===e||e.call(s),i.bitmap=null}isValidId(t){return t.startsWith("image_".concat((0,c.A)(this,qe),"_"))}}async function Je(t,e){var i;(0,c.A)(this,Ye)||(0,d.A)(this,Ye,new Map);let s=(0,c.A)(this,Ye).get(t);if(null===s)return null;if(null!==(i=s)&&void 0!==i&&i.bitmap)return s.refCounter+=1,s;try{var n,a;let t;if(s||(s={bitmap:null,id:"image_".concat((0,c.A)(this,qe),"_").concat(((0,d.A)(this,Xe,(n=(0,c.A)(this,Xe),a=n++,n)),a)),refCounter:0,isSvg:!1}),"string"===typeof e?(s.url=e,t=await Qt(e,"blob")):e instanceof File?t=s.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){const e=Qe._isSVGFittingCanvas,i=new FileReader,n=new Image,a=new Promise(((t,a)=>{n.onload=()=>{s.bitmap=n,s.isSvg=!0,t()},i.onload=async()=>{const t=s.svgUrl=i.result;n.src=await e?"".concat(t,"#svgView(preserveAspectRatio(none))"):t},n.onerror=i.onerror=a}));i.readAsDataURL(t),await a}else s.bitmap=await createImageBitmap(t);s.refCounter=1}catch(r){yt(r),s=null}return(0,c.A)(this,Ye).set(t,s),s&&(0,c.A)(this,Ye).set(s.id,s),s}var Ze=new WeakMap,$e=new WeakMap,ti=new WeakMap,ei=new WeakMap;class ii{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;(0,l.A)(this,Ze,{writable:!0,value:[]}),(0,l.A)(this,$e,{writable:!0,value:!1}),(0,l.A)(this,ti,{writable:!0,value:void 0}),(0,l.A)(this,ei,{writable:!0,value:-1}),(0,d.A)(this,ti,t)}add(t){let e=t.cmd,i=t.undo,s=t.post,n=t.mustExec,a=t.type,r=void 0===a?NaN:a,o=t.overwriteIfSameType,l=void 0!==o&&o,h=t.keepUndo,u=void 0!==h&&h;if(n&&e(),(0,c.A)(this,$e))return;const A={cmd:e,undo:i,post:s,type:r};if(-1===(0,c.A)(this,ei))return(0,c.A)(this,Ze).length>0&&((0,c.A)(this,Ze).length=0),(0,d.A)(this,ei,0),void(0,c.A)(this,Ze).push(A);if(l&&(0,c.A)(this,Ze)[(0,c.A)(this,ei)].type===r)return u&&(A.undo=(0,c.A)(this,Ze)[(0,c.A)(this,ei)].undo),void((0,c.A)(this,Ze)[(0,c.A)(this,ei)]=A);const p=(0,c.A)(this,ei)+1;p===(0,c.A)(this,ti)?(0,c.A)(this,Ze).splice(0,1):((0,d.A)(this,ei,p),p<(0,c.A)(this,Ze).length&&(0,c.A)(this,Ze).splice(p)),(0,c.A)(this,Ze).push(A)}undo(){if(-1===(0,c.A)(this,ei))return;(0,d.A)(this,$e,!0);const t=(0,c.A)(this,Ze)[(0,c.A)(this,ei)],e=t.undo,i=t.post;e(),null===i||void 0===i||i(),(0,d.A)(this,$e,!1),(0,d.A)(this,ei,(0,c.A)(this,ei)-1)}redo(){if((0,c.A)(this,ei)<(0,c.A)(this,Ze).length-1){(0,d.A)(this,ei,(0,c.A)(this,ei)+1),(0,d.A)(this,$e,!0);const t=(0,c.A)(this,Ze)[(0,c.A)(this,ei)],e=t.cmd,i=t.post;e(),null===i||void 0===i||i(),(0,d.A)(this,$e,!1)}}hasSomethingToUndo(){return-1!==(0,c.A)(this,ei)}hasSomethingToRedo(){return(0,c.A)(this,ei)<(0,c.A)(this,Ze).length-1}cleanType(t){if(-1!==(0,c.A)(this,ei)){for(let e=(0,c.A)(this,ei);e>=0;e--)if((0,c.A)(this,Ze)[e].type!==t)return(0,c.A)(this,Ze).splice(e+1,(0,c.A)(this,ei)-e),void(0,d.A)(this,ei,e);(0,c.A)(this,Ze).length=0,(0,d.A)(this,ei,-1)}}destroy(){(0,d.A)(this,Ze,null)}}var si=new WeakSet;class ni{constructor(t){(0,o.A)(this,si),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const e=Ot.platform.isMac;for(const n of t){var i=(0,b.A)(n,3);const t=i[0],a=i[1];var s=i[2];const r=void 0===s?{}:s;for(const i of t){const t=i.startsWith("mac+");e&&t?(this.callbacks.set(i.slice(4),{callback:a,options:r}),this.allKeys.add(i.split("+").at(-1))):e||t||(this.callbacks.set(i,{callback:a,options:r}),this.allKeys.add(i.split("+").at(-1)))}}}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get((0,h.A)(this,si,ai).call(this,e));if(!i)return;
1const s=i.callback,n=i.options,a=n.bubbles,r=void 0!==a&&a,o=n.args,l=void 0===o?[]:o,c=n.checker,d=void 0===c?null:c;d&&!d(t,e)||(s.bind(t,...l,e)(),r||re(e))}}function ai(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e}class ri{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function(t){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const i of t.keys()){e.style.color=i;const s=window.getComputedStyle(e).color;t.set(i,ce(s))}e.remove()}(t),Mt(this,"_colors",t)}convert(t){const e=ce(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const s of this._colors){var i=(0,b.A)(s,2);const t=i[0];if(i[1].every(((t,i)=>t===e[i])))return ri._colorsMapping.get(t)}return e}getHexCode(t){const e=this._colors.get(t);return e?Ht.makeHexColor(...e):t}}(0,m.A)(ri,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var oi=new WeakMap,li=new WeakMap,hi=new WeakMap,ci=new WeakMap,di=new WeakMap,ui=new WeakMap,Ai=new WeakMap,pi=new WeakMap,gi=new WeakMap,fi=new WeakMap,vi=new WeakMap,mi=new WeakMap,wi=new WeakMap,bi=new WeakMap,_i=new WeakMap,yi=new WeakMap,ki=new WeakMap,Si=new WeakMap,xi=new WeakMap,Mi=new WeakMap,Ei=new WeakMap,Ci=new WeakMap,Ti=new WeakMap,Ri=new WeakMap,Pi=new WeakMap,Ii=new WeakMap,Li=new WeakMap,Di=new WeakMap,Fi=new WeakMap,Wi=new WeakMap,Ni=new WeakMap,Oi=new WeakMap,Bi=new WeakMap,Hi=new WeakMap,zi=new WeakMap,ji=new WeakMap,Gi=new WeakMap,Vi=new WeakMap,Ui=new WeakMap,qi=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,Ki=new WeakSet,Qi=new WeakSet,Ji=new WeakSet,Zi=new WeakSet,$i=new WeakSet,ts=new WeakSet,es=new WeakSet,is=new WeakSet,ss=new WeakSet,ns=new WeakSet,as=new WeakSet,rs=new WeakSet,os=new WeakSet,ls=new WeakSet,hs=new WeakSet,cs=new WeakSet,ds=new WeakSet,us=new WeakSet,As=new WeakMap,ps=new WeakSet,gs=new WeakSet;class fs{static get _keyboardManager(){const t=fs.prototype,e=t=>(0,c.A)(t,qi).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,e)=>{let i=e.target;if(i instanceof HTMLInputElement){const t=i.type;return"text"!==t&&"number"!==t}return!0},s=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return Mt(this,"_keyboardManager",new ni([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let i=e.target;return!(i instanceof HTMLButtonElement)&&(0,c.A)(t,qi).contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>!(e.target instanceof HTMLButtonElement)&&(0,c.A)(t,qi).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}constructor(t,e,i,s,n,a,r,u,A,p,g,f,v){(0,o.A)(this,gs),(0,o.A)(this,ps),(0,l.A)(this,As,{get:Fs,set:void 0}),(0,o.A)(this,us),(0,o.A)(this,ds),(0,o.A)(this,cs),(0,o.A)(this,hs),(0,o.A)(this,ls),(0,o.A)(this,os),(0,o.A)(this,rs),(0,o.A)(this,as),(0,o.A)(this,ns),(0,o.A)(this,ss),(0,o.A)(this,is),(0,o.A)(this,es),(0,o.A)(this,ts),(0,o.A)(this,$i),(0,o.A)(this,Zi),(0,o.A)(this,Ji),(0,o.A)(this,Qi),(0,o.A)(this,Ki),(0,l.A)(this,oi,{writable:!0,value:new AbortController}),(0,l.A)(this,li,{writable:!0,value:null}),(0,l.A)(this,hi,{writable:!0,value:new Map}),(0,l.A)(this,ci,{writable:!0,value:new Map}),(0,l.A)(this,di,{writable:!0,value:null}),(0,l.A)(this,ui,{writable:!0,value:null}),(0,l.A)(this,Ai,{writable:!0,value:null}),(0,l.A)(this,pi,{writable:!0,value:new ii}),(0,l.A)(this,gi,{writable:!0,value:null}),(0,l.A)(this,fi,{writable:!0,value:null}),(0,l.A)(this,vi,{writable:!0,value:0}),(0,l.A)(this,mi,{writable:!0,value:new Set}),(0,l.A)(this,wi,{writable:!0,value:null}),(0,l.A)(this,bi,{writable:!0,value:null}),(0,l.A)(this,_i,{writable:!0,value:new Set}),(0,m.A)(this,"_editorUndoBar",null),(0,l.A)(this,yi,{writable:!0,value:!1}),(0,l.A)(this,ki,{writable:!0,value:!1}),(0,l.A)(this,Si,{writable:!0,value:!1}),(0,l.A)(this,xi,{writable:!0,value:null}),(0,l.A)(this,Mi,{writable:!0,value:null}),(0,l.A)(this,Ei,{writable:!0,value:null}),(0,l.A)(this,Ci,{writable:!0,value:null}),(0,l.A)(this,Ti,{writable:!0,value:!1}),(0,l.A)(this,Ri,{writable:!0,value:null}),(0,l.A)(this,Pi,{writable:!0,value:new Ue}),(0,l.A)(this,Ii,{writable:!0,value:!1}),(0,l.A)(this,Li,{writable:!0,value:!1}),(0,l.A)(this,Di,{writable:!0,value:null}),(0,l.A)(this,Fi,{writable:!0,value:null}),(0,l.A)(this,Wi,{writable:!0,value:null}),(0,l.A)(this,Ni,{writable:!0,value:null}),(0,l.A)(this,Oi,{writable:!0,value:W.NONE}),(0,l.A)(this,Bi,{writable:!0,value:new Set}),(0,l.A)(this,Hi,{writable:!0,value:null}),(0,l.A)(this,zi,{writable:!0,value:null}),(0,l.A)(this,ji,{writable:!0,value:null}),(0,l.A)(this,Gi,{writable:!0,value:{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}}),(0,l.A)(this,Vi,{writable:!0,value:[0,0]}),(0,l.A)(this,Ui,{writable:!0,value:null}),(0,l.A)(this,qi,{writable:!0,value:null}),(0,l.A)(this,Xi,{writable:!0,value:null}),(0,l.A)(this,Yi,{writable:!0,value:null});const w=this._signal=(0,c.A)(this,oi).signal;(0,d.A)(this,qi,t),(0,d.A)(this,Xi,e),(0,d.A)(this,di,i),this._eventBus=s,s._on("editingaction",this.onEditingAction.bind(this),{signal:w}),s._on("pagechanging",this.onPageChanging.bind(this),{signal:w}),s._on("scalechanging",this.onScaleChanging.bind(this),{signal:w}),s._on("rotationchanging",this.onRotationChanging.bind(this),{signal:w}),s._on("setpreference",this.onSetPreference.bind(this),{signal:w}),s._on("switchannotationeditorparams",(t=>this.updateParams(t.type,t.value)),{signal:w}),(0,h.A)(this,ts,ys).call(this),(0,h.A)(this,os,Ts).call(this),(0,h.A)(this,ss,xs).call(this),(0,d.A)(this,ui,n.annotationStorage),(0,d.A)(this,xi,n.filterFactory),(0,d.A)(this,zi,a),(0,d.A)(this,Ci,r||null),(0,d.A)(this,yi,u),(0,d.A)(this,ki,A),(0,d.A)(this,Si,p),(0,d.A)(this,Ni,g||null),this.viewParameters={realScale:Kt.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=f||null,this._supportsPinchToZoom=!1!==v}destroy(){var t,e,i,s,n;null===(t=(0,c.A)(this,Yi))||void 0===t||t.resolve(),(0,d.A)(this,Yi,null),null===(e=(0,c.A)(this,oi))||void 0===e||e.abort(),(0,d.A)(this,oi,null),this._signal=null;for(const a of(0,c.A)(this,ci).values())a.destroy();(0,c.A)(this,ci).clear(),(0,c.A)(this,hi).clear(),(0,c.A)(this,_i).clear(),(0,d.A)(this,li,null),(0,c.A)(this,Bi).clear(),(0,c.A)(this,pi).destroy(),null===(i=(0,c.A)(this,di))||void 0===i||i.destroy(),null===(s=(0,c.A)(this,Ri))||void 0===s||s.hide(),(0,d.A)(this,Ri,null),(0,c.A)(this,Mi)&&(clearTimeout((0,c.A)(this,Mi)),(0,d.A)(this,Mi,null)),(0,c.A)(this,Ui)&&(clearTimeout((0,c.A)(this,Ui)),(0,d.A)(this,Ui,null)),null===(n=this._editorUndoBar)||void 0===n||n.destroy()}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return(0,c.A)(this,Ni)}get useNewAltTextFlow(){return(0,c.A)(this,ki)}get useNewAltTextWhenAddingImage(){return(0,c.A)(this,Si)}get hcmFilter(){return Mt(this,"hcmFilter",(0,c.A)(this,zi)?(0,c.A)(this,xi).addHCMFilter((0,c.A)(this,zi).foreground,(0,c.A)(this,zi).background):"none")}get direction(){return Mt(this,"direction",getComputedStyle((0,c.A)(this,qi)).direction)}get highlightColors(){return Mt(this,"highlightColors",(0,c.A)(this,Ci)?new Map((0,c.A)(this,Ci).split(",").map((t=>t.split("=").map((t=>t.trim()))))):null)}get highlightColorNames(){return Mt(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(t=>t.reverse()))):null)}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),(0,d.A)(this,fi,t)}setMainHighlightColorPicker(t){(0,d.A)(this,Wi,t)}editAltText(t){var e;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null===(e=(0,c.A)(this,di))||void 0===e||e.editAltText(this,t,i)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference(t){let e=t.name,i=t.value;if("enableNewAltTextWhenAddingImage"===e)(0,d.A)(this,Si,i)}onPageChanging(t){let e=t.pageNumber;(0,d.A)(this,vi,e-1)}focusMainContainer(){(0,c.A)(this,qi).focus()}findParent(t,e){for(const i of(0,c.A)(this,ci).values()){const s=i.div.getBoundingClientRect(),n=s.x,a=s.y,r=s.width,o=s.height;if(t>=n&&t<=n+r&&e>=a&&e<=a+o)return i}return null}disableUserSelect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,c.A)(this,Xi).classList.toggle("noUserSelect",t)}addShouldRescale(t){(0,c.A)(this,_i).add(t)}removeShouldRescale(t){(0,c.A)(this,_i).delete(t)}onScaleChanging(t){var e;let i=t.scale;this.commitOrRemove(),this.viewParameters.realScale=i*Kt.PDF_TO_CSS_UNITS;
1for(const s of(0,c.A)(this,_i))s.onScaleChanging();null===(e=(0,c.A)(this,fi))||void 0===e||e.onScaleChanging()}onRotationChanging(t){let e=t.pagesRotation;this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const e=document.getSelection();if(!e||e.isCollapsed)return;const i=e.anchorNode,s=e.anchorOffset,n=e.focusNode,a=e.focusOffset,r=e.toString(),o=(0,h.A)(this,Ki,vs).call(this,e).closest(".textLayer"),l=this.getSelectionBoxes(o);if(!l)return;e.empty();const d=(0,h.A)(this,Qi,ms).call(this,o),u=(0,c.A)(this,Oi)===W.NONE,A=()=>{null===d||void 0===d||d.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:l,anchorNode:i,anchorOffset:s,focusNode:n,focusOffset:a,text:r}),u&&this.showAllEditors("highlight",!0,!0)};u?this.switchToMode(W.HIGHLIGHT,A):A()}addToAnnotationStorage(t){t.isEmpty()||!(0,c.A)(this,ui)||(0,c.A)(this,ui).has(t.id)||(0,c.A)(this,ui).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,(0,c.A)(this,Ti)&&((0,d.A)(this,Ti,!1),(0,h.A)(this,$i,_s).call(this,"main_toolbar")),!this.hasSelection)return;const t=document.activeElement;for(const e of(0,c.A)(this,Bi))if(e.div.contains(t)){(0,d.A)(this,Fi,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!(0,c.A)(this,Fi))return;const t=(0,c.A)(this,Fi),e=(0,b.A)(t,2),i=e[0],s=e[1];(0,d.A)(this,Fi,null),s.addEventListener("focusin",(()=>{i._focusEventsAllowed=!0}),{once:!0,signal:this._signal}),s.focus()}addEditListeners(){(0,h.A)(this,ss,xs).call(this),(0,h.A)(this,as,Es).call(this)}removeEditListeners(){(0,h.A)(this,ns,Ms).call(this),(0,h.A)(this,rs,Cs).call(this)}dragOver(t){for(const e of t.dataTransfer.items){const i=e.type;for(const e of(0,c.A)(this,bi))if(e.isHandlingMimeForPasting(i))return t.dataTransfer.dropEffect="copy",void t.preventDefault()}}drop(t){for(const e of t.dataTransfer.items)for(const i of(0,c.A)(this,bi))if(i.isHandlingMimeForPasting(e.type))return i.paste(e,this.currentLayer),void t.preventDefault()}copy(t){var e;if(t.preventDefault(),null===(e=(0,c.A)(this,li))||void 0===e||e.commitOrRemove(),!this.hasSelection)return;const i=[];for(const s of(0,c.A)(this,Bi)){const t=s.serialize(!0);t&&i.push(t)}0!==i.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const e=t.clipboardData;for(const a of e.items)for(const t of(0,c.A)(this,bi))if(t.isHandlingMimeForPasting(a.type))return void t.paste(a,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(n){return void yt('paste: "'.concat(n.message,'".'))}if(!Array.isArray(i))return;this.unselectAll();const s=this.currentLayer;try{const t=[];for(const a of i){const e=await s.deserialize(a);if(!e)return;t.push(e)}const e=()=>{for(const e of t)(0,h.A)(this,us,Ds).call(this,e);(0,h.A)(this,gs,Ns).call(this,t)},n=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:n,mustExec:!0})}catch(n){yt('paste: "'.concat(n.message,'".'))}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),(0,c.A)(this,Oi)===W.NONE||this.isEditorHandlingKeyboard||fs._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,(0,c.A)(this,Ti)&&((0,d.A)(this,Ti,!1),(0,h.A)(this,$i,_s).call(this,"main_toolbar")))}onEditingAction(t){let e=t.name;switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}setEditingState(t){t?((0,h.A)(this,es,ks).call(this),(0,h.A)(this,as,Es).call(this),(0,h.A)(this,ls,Rs).call(this,{isEditing:(0,c.A)(this,Oi)!==W.NONE,isEmpty:(0,h.A)(this,ps,Ws).call(this),hasSomethingToUndo:(0,c.A)(this,pi).hasSomethingToUndo(),hasSomethingToRedo:(0,c.A)(this,pi).hasSomethingToRedo(),hasSelectedEditor:!1})):((0,h.A)(this,is,Ss).call(this),(0,h.A)(this,rs,Cs).call(this),(0,h.A)(this,ls,Rs).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!(0,c.A)(this,bi)){(0,d.A)(this,bi,t);for(const t of(0,c.A)(this,bi))(0,h.A)(this,hs,Ps).call(this,t.defaultPropertiesToUpdate)}}getId(){return(0,c.A)(this,Pi).id}get currentLayer(){return(0,c.A)(this,ci).get((0,c.A)(this,vi))}getLayer(t){return(0,c.A)(this,ci).get(t)}get currentPageIndex(){return(0,c.A)(this,vi)}addLayer(t){(0,c.A)(this,ci).set(t.pageIndex,t),(0,c.A)(this,Ii)?t.enable():t.disable()}removeLayer(t){(0,c.A)(this,ci).delete(t.pageIndex)}async updateMode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if((0,c.A)(this,Oi)!==t&&(!(0,c.A)(this,Yi)||(await(0,c.A)(this,Yi).promise,(0,c.A)(this,Yi)))){var s;if((0,d.A)(this,Yi,Promise.withResolvers()),(0,d.A)(this,Oi,t),t===W.NONE)return this.setEditingState(!1),(0,h.A)(this,ds,Ls).call(this),null===(s=this._editorUndoBar)||void 0===s||s.hide(),void(0,c.A)(this,Yi).resolve();this.setEditingState(!0),await(0,h.A)(this,cs,Is).call(this),this.unselectAll();for(const e of(0,c.A)(this,ci).values())e.updateMode(t);if(!e)return i&&this.addNewEditorFromKeyboard(),void(0,c.A)(this,Yi).resolve();for(const t of(0,c.A)(this,hi).values())t.annotationElementId===e?(this.setSelected(t),t.enterInEditMode()):t.unselect();(0,c.A)(this,Yi).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==(0,c.A)(this,Oi)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var i;if((0,c.A)(this,bi)){switch(t){case N.CREATE:return void this.currentLayer.addNewEditor();case N.HIGHLIGHT_DEFAULT_COLOR:null===(i=(0,c.A)(this,Wi))||void 0===i||i.updateColor(e);break;case N.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),((0,c.A)(this,ji)||(0,d.A)(this,ji,new Map)).set(t,e),this.showAllEditors("highlight",e)}for(const i of(0,c.A)(this,Bi))i.updateParams(t,e);for(const i of(0,c.A)(this,bi))i.updateDefaultParams(t,e)}}showAllEditors(t,e){var i,s;for(const n of(0,c.A)(this,hi).values())n.editorType===t&&n.show(e);(null===(i=null===(s=(0,c.A)(this,ji))||void 0===s?void 0:s.get(N.HIGHLIGHT_SHOW_ALL))||void 0===i||i)!==e&&(0,h.A)(this,hs,Ps).call(this,[[N.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,c.A)(this,Li)!==t){(0,d.A)(this,Li,t);for(const e of(0,c.A)(this,ci).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const i of(0,c.A)(this,hi).values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return(0,c.A)(this,hi).get(t)}addEditor(t){(0,c.A)(this,hi).set(t.id,t)}removeEditor(t){var e;(t.div.contains(document.activeElement)&&((0,c.A)(this,Mi)&&clearTimeout((0,c.A)(this,Mi)),(0,d.A)(this,Mi,setTimeout((()=>{this.focusMainContainer(),(0,d.A)(this,Mi,null)}),0))),(0,c.A)(this,hi).delete(t.id),this.unselect(t),t.annotationElementId&&(0,c.A)(this,mi).has(t.annotationElementId))||(null===(e=(0,c.A)(this,ui))||void 0===e||e.remove(t.id))}addDeletedAnnotationElement(t){(0,c.A)(this,mi).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}
1isDeletedAnnotationElement(t){return(0,c.A)(this,mi).has(t)}removeDeletedAnnotationElement(t){(0,c.A)(this,mi).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){(0,c.A)(this,li)!==t&&((0,d.A)(this,li,t),t&&(0,h.A)(this,hs,Ps).call(this,t.propertiesToUpdate))}updateUI(t){(0,c.A)(this,As)===t&&(0,h.A)(this,hs,Ps).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){(0,h.A)(this,hs,Ps).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if((0,c.A)(this,Bi).has(t))return(0,c.A)(this,Bi).delete(t),t.unselect(),void(0,h.A)(this,ls,Rs).call(this,{hasSelectedEditor:this.hasSelection});(0,c.A)(this,Bi).add(t),t.select(),(0,h.A)(this,hs,Ps).call(this,t.propertiesToUpdate),(0,h.A)(this,ls,Rs).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;null===(e=(0,c.A)(this,fi))||void 0===e||e.commitOrRemove();for(const i of(0,c.A)(this,Bi))i!==t&&i.unselect();(0,c.A)(this,Bi).clear(),(0,c.A)(this,Bi).add(t),t.select(),(0,h.A)(this,hs,Ps).call(this,t.propertiesToUpdate),(0,h.A)(this,ls,Rs).call(this,{hasSelectedEditor:!0})}isSelected(t){return(0,c.A)(this,Bi).has(t)}get firstSelectedEditor(){return(0,c.A)(this,Bi).values().next().value}unselect(t){t.unselect(),(0,c.A)(this,Bi).delete(t),(0,h.A)(this,ls,Rs).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==(0,c.A)(this,Bi).size}get isEnterHandled(){return 1===(0,c.A)(this,Bi).size&&this.firstSelectedEditor.isEnterHandled}undo(){var t;(0,c.A)(this,pi).undo(),(0,h.A)(this,ls,Rs).call(this,{hasSomethingToUndo:(0,c.A)(this,pi).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:(0,h.A)(this,ps,Ws).call(this)}),null===(t=this._editorUndoBar)||void 0===t||t.hide()}redo(){(0,c.A)(this,pi).redo(),(0,h.A)(this,ls,Rs).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:(0,c.A)(this,pi).hasSomethingToRedo(),isEmpty:(0,h.A)(this,ps,Ws).call(this)})}addCommands(t){(0,c.A)(this,pi).add(t),(0,h.A)(this,ls,Rs).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:(0,h.A)(this,ps,Ws).call(this)})}cleanUndoStack(t){(0,c.A)(this,pi).cleanType(t)}delete(){var t;this.commitOrRemove();const e=null===(t=this.currentLayer)||void 0===t?void 0:t.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const i=e?[e]:[...(0,c.A)(this,Bi)],s=()=>{for(const t of i)(0,h.A)(this,us,Ds).call(this,t)};this.addCommands({cmd:()=>{var t;null===(t=this._editorUndoBar)||void 0===t||t.show(s,1===i.length?i[0].editorType:i.length);for(const e of i)e.remove()},undo:s,mustExec:!0})}commitOrRemove(){var t;null===(t=(0,c.A)(this,li))||void 0===t||t.commitOrRemove()}hasSomethingToControl(){return(0,c.A)(this,li)||this.hasSelection}selectAll(){for(const t of(0,c.A)(this,Bi))t.commit();(0,h.A)(this,gs,Ns).call(this,(0,c.A)(this,hi).values())}unselectAll(){var t;if((!(0,c.A)(this,li)||((0,c.A)(this,li).commitOrRemove(),(0,c.A)(this,Oi)===W.NONE))&&(null===(t=(0,c.A)(this,fi))||void 0===t||!t.commitOrRemove())&&this.hasSelection){for(const t of(0,c.A)(this,Bi))t.unselect();(0,c.A)(this,Bi).clear(),(0,h.A)(this,ls,Rs).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove(),!this.hasSelection)return;(0,c.A)(this,Vi)[0]+=t,(0,c.A)(this,Vi)[1]+=e;const i=(0,c.A)(this,Vi),s=(0,b.A)(i,2),n=s[0],a=s[1],r=[...(0,c.A)(this,Bi)];(0,c.A)(this,Ui)&&clearTimeout((0,c.A)(this,Ui)),(0,d.A)(this,Ui,setTimeout((()=>{(0,d.A)(this,Ui,null),(0,c.A)(this,Vi)[0]=(0,c.A)(this,Vi)[1]=0,this.addCommands({cmd:()=>{for(const t of r)(0,c.A)(this,hi).has(t.id)&&t.translateInPage(n,a)},undo:()=>{for(const t of r)(0,c.A)(this,hi).has(t.id)&&t.translateInPage(-n,-a)},mustExec:!1})}),1e3));for(const o of r)o.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),(0,d.A)(this,wi,new Map);for(const t of(0,c.A)(this,Bi))(0,c.A)(this,wi).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!(0,c.A)(this,wi))return!1;this.disableUserSelect(!1);const t=(0,c.A)(this,wi);(0,d.A)(this,wi,null);let e=!1;for(const a of t){var i=(0,b.A)(a,2),s=i[0];const t=s.x,n=s.y,r=s.pageIndex,o=i[1];o.newX=t,o.newY=n,o.newPageIndex=r,e||(e=t!==o.savedX||n!==o.savedY||r!==o.savedPageIndex)}if(!e)return!1;const n=(t,e,i,s)=>{if((0,c.A)(this,hi).has(t.id)){const n=(0,c.A)(this,ci).get(s);n?t._setParentAndPosition(n,e,i):(t.pageIndex=s,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(const s of t){var e=(0,b.A)(s,2);const t=e[0];var i=e[1];const a=i.newX,r=i.newY,o=i.newPageIndex;n(t,a,r,o)}},undo:()=>{for(const s of t){var e=(0,b.A)(s,2);const t=e[0];var i=e[1];const a=i.savedX,r=i.savedY,o=i.savedPageIndex;n(t,a,r,o)}},mustExec:!0}),!0}dragSelectedEditors(t,e){if((0,c.A)(this,wi))for(const i of(0,c.A)(this,wi).keys())i.drag(t,e)}rebuild(t){if(null===t.parent){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return(null===(t=this.getActive())||void 0===t?void 0:t.shouldGetKeyboardEvents())||1===(0,c.A)(this,Bi).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return(0,c.A)(this,li)===t}getActive(){return(0,c.A)(this,li)}getMode(){return(0,c.A)(this,Oi)}get imageManager(){return Mt(this,"imageManager",new Qe)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,c=e.rangeCount;h<c;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;const i=t.getBoundingClientRect(),s=i.x,n=i.y,a=i.width,r=i.height;let o;
1switch(t.getAttribute("data-main-rotation")){case"90":o=(t,e,i,o)=>({x:(e-n)/r,y:1-(t+i-s)/a,width:o/r,height:i/a});break;case"180":o=(t,e,i,o)=>({x:1-(t+i-s)/a,y:1-(e+o-n)/r,width:i/a,height:o/r});break;case"270":o=(t,e,i,o)=>({x:1-(e+o-n)/r,y:(t-s)/a,width:o/r,height:i/a});break;default:o=(t,e,i,o)=>({x:(t-s)/a,y:(e-n)/r,width:i/a,height:o/r})}const l=[];for(let h=0,c=e.rangeCount;h<c;h++){const t=e.getRangeAt(h);if(!t.collapsed)for(const e of t.getClientRects()){const t=e.x,i=e.y,s=e.width,n=e.height;0!==s&&0!==n&&l.push(o(t,i,s,n))}}return 0===l.length?null:l}addChangedExistingAnnotation(t){let e=t.annotationElementId,i=t.id;((0,c.A)(this,Ai)||(0,d.A)(this,Ai,new Map)).set(e,i)}removeChangedExistingAnnotation(t){var e;let i=t.annotationElementId;null===(e=(0,c.A)(this,Ai))||void 0===e||e.delete(i)}renderAnnotationElement(t){var e;const i=null===(e=(0,c.A)(this,Ai))||void 0===e?void 0:e.get(t.data.id);if(!i)return;const s=(0,c.A)(this,ui).getRawValue(i);s&&((0,c.A)(this,Oi)!==W.NONE||s.hasBeenModified)&&s.renderAnnotationElement(t)}}function vs(t){let e=t.anchorNode;return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function ms(t){const e=this.currentLayer;if(e.hasTextLayer(t))return e;for(const i of(0,c.A)(this,ci).values())if(i.hasTextLayer(t))return i;return null}function ws(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=(0,h.A)(this,Ki,vs).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&((0,c.A)(this,Ri)||(0,d.A)(this,Ri,new Be(this)),(0,c.A)(this,Ri).show(e,i,"ltr"===this.direction))}function bs(){var t;const e=document.getSelection();if(!e||e.isCollapsed){var i;if((0,c.A)(this,Hi))null===(i=(0,c.A)(this,Ri))||void 0===i||i.hide(),(0,d.A)(this,Hi,null),(0,h.A)(this,ls,Rs).call(this,{hasSelectedText:!1});return}const s=e.anchorNode;if(s===(0,c.A)(this,Hi))return;const n=(0,h.A)(this,Ki,vs).call(this,e).closest(".textLayer");var a;if(n){if(null===(t=(0,c.A)(this,Ri))||void 0===t||t.hide(),(0,d.A)(this,Hi,s),(0,h.A)(this,ls,Rs).call(this,{hasSelectedText:!0}),((0,c.A)(this,Oi)===W.HIGHLIGHT||(0,c.A)(this,Oi)===W.NONE)&&((0,c.A)(this,Oi)===W.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),(0,d.A)(this,Ti,this.isShiftKeyDown),!this.isShiftKeyDown)){const t=(0,c.A)(this,Oi)===W.HIGHLIGHT?(0,h.A)(this,Qi,ms).call(this,n):null;null===t||void 0===t||t.toggleDrawing();const e=new AbortController,i=this.combinedSignal(e),s=i=>{"pointerup"===i.type&&0!==i.button||(e.abort(),null===t||void 0===t||t.toggleDrawing(!0),"pointerup"===i.type&&(0,h.A)(this,$i,_s).call(this,"main_toolbar"))};window.addEventListener("pointerup",s,{signal:i}),window.addEventListener("blur",s,{signal:i})}}else(0,c.A)(this,Hi)&&(null===(a=(0,c.A)(this,Ri))||void 0===a||a.hide(),(0,d.A)(this,Hi,null),(0,h.A)(this,ls,Rs).call(this,{hasSelectedText:!1}))}function _s(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";(0,c.A)(this,Oi)===W.HIGHLIGHT?this.highlightSelection(t):(0,c.A)(this,yi)&&(0,h.A)(this,Ji,ws).call(this)}function ys(){document.addEventListener("selectionchange",(0,h.A)(this,Zi,bs).bind(this),{signal:this._signal})}function ks(){if((0,c.A)(this,Ei))return;(0,d.A)(this,Ei,new AbortController);const t=this.combinedSignal((0,c.A)(this,Ei));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}function Ss(){var t;null===(t=(0,c.A)(this,Ei))||void 0===t||t.abort(),(0,d.A)(this,Ei,null)}function xs(){if((0,c.A)(this,Di))return;(0,d.A)(this,Di,new AbortController);const t=this.combinedSignal((0,c.A)(this,Di));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}function Ms(){var t;null===(t=(0,c.A)(this,Di))||void 0===t||t.abort(),(0,d.A)(this,Di,null)}function Es(){if((0,c.A)(this,gi))return;(0,d.A)(this,gi,new AbortController);const t=this.combinedSignal((0,c.A)(this,gi));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}function Cs(){var t;null===(t=(0,c.A)(this,gi))||void 0===t||t.abort(),(0,d.A)(this,gi,null)}function Ts(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}function Rs(t){Object.entries(t).some((t=>{let e=(0,b.A)(t,2),i=e[0],s=e[1];return(0,c.A)(this,Gi)[i]!==s}))&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign((0,c.A)(this,Gi),t)}),(0,c.A)(this,Oi)===W.HIGHLIGHT&&!1===t.hasSelectedEditor&&(0,h.A)(this,hs,Ps).call(this,[[N.HIGHLIGHT_FREE,!0]]))}function Ps(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}async function Is(){if(!(0,c.A)(this,Ii)){(0,d.A)(this,Ii,!0);const t=[];for(const e of(0,c.A)(this,ci).values())t.push(e.enable());await Promise.all(t);for(const e of(0,c.A)(this,hi).values())e.enable()}}function Ls(){if(this.unselectAll(),(0,c.A)(this,Ii)){(0,d.A)(this,Ii,!1);for(const t of(0,c.A)(this,ci).values())t.disable();for(const t of(0,c.A)(this,hi).values())t.disable()}}function Ds(t){const e=(0,c.A)(this,ci).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}function Fs(){let t=null;for(t of(0,c.A)(this,Bi));return t}function Ws(){if(0===(0,c.A)(this,hi).size)return!0;
1if(1===(0,c.A)(this,hi).size)for(const t of(0,c.A)(this,hi).values())return t.isEmpty();return!1}function Ns(t){for(const e of(0,c.A)(this,Bi))e.unselect();(0,c.A)(this,Bi).clear();for(const e of t)e.isEmpty()||((0,c.A)(this,Bi).add(e),e.select());(0,h.A)(this,ls,Rs).call(this,{hasSelectedEditor:this.hasSelection})}(0,m.A)(fs,"TRANSLATE_SMALL",1),(0,m.A)(fs,"TRANSLATE_BIG",10);var Os=new WeakMap,Bs=new WeakMap,Hs=new WeakMap,zs=new WeakMap,js=new WeakMap,Gs=new WeakMap,Vs=new WeakMap,Us=new WeakMap,qs=new WeakMap,Xs=new WeakMap,Ys=new WeakMap,Ks=new WeakMap,Qs=new WeakMap,Js=new WeakSet;class Zs{constructor(t){(0,o.A)(this,Js),(0,l.A)(this,Qs,{get:$s,set:void 0}),(0,l.A)(this,Os,{writable:!0,value:null}),(0,l.A)(this,Bs,{writable:!0,value:!1}),(0,l.A)(this,Hs,{writable:!0,value:null}),(0,l.A)(this,zs,{writable:!0,value:null}),(0,l.A)(this,js,{writable:!0,value:null}),(0,l.A)(this,Gs,{writable:!0,value:null}),(0,l.A)(this,Vs,{writable:!0,value:!1}),(0,l.A)(this,Us,{writable:!0,value:null}),(0,l.A)(this,qs,{writable:!0,value:null}),(0,l.A)(this,Xs,{writable:!0,value:null}),(0,l.A)(this,Ys,{writable:!0,value:null}),(0,l.A)(this,Ks,{writable:!0,value:!1}),(0,d.A)(this,qs,t),(0,d.A)(this,Ks,t._uiManager.useNewAltTextFlow),v(Zs,Zs,en)||g(Zs,Zs,en,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){var e;null!==(e=Zs._l10n)&&void 0!==e||(Zs._l10n=t)}async render(){const t=(0,d.A)(this,Hs,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=(0,d.A)(this,zs,document.createElement("span"));t.append(e),(0,c.A)(this,Ks)?(t.classList.add("new"),t.setAttribute("data-l10n-id",v(Zs,Zs,en).missing),e.setAttribute("data-l10n-id",v(Zs,Zs,en)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const i=(0,c.A)(this,qs)._uiManager._signal;t.addEventListener("contextmenu",ae,{signal:i}),t.addEventListener("pointerdown",(t=>t.stopPropagation()),{signal:i});const s=t=>{t.preventDefault(),(0,c.A)(this,qs)._uiManager.editAltText((0,c.A)(this,qs)),(0,c.A)(this,Ks)&&(0,c.A)(this,qs)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:(0,c.A)(this,Qs)}})};return t.addEventListener("click",s,{capture:!0,signal:i}),t.addEventListener("keydown",(e=>{e.target===t&&"Enter"===e.key&&((0,d.A)(this,Vs,!0),s(e))}),{signal:i}),await(0,h.A)(this,Js,tn).call(this),t}finish(){(0,c.A)(this,Hs)&&((0,c.A)(this,Hs).focus({focusVisible:(0,c.A)(this,Vs)}),(0,d.A)(this,Vs,!1))}isEmpty(){return(0,c.A)(this,Ks)?null===(0,c.A)(this,Os):!(0,c.A)(this,Os)&&!(0,c.A)(this,Bs)}hasData(){return(0,c.A)(this,Ks)?null!==(0,c.A)(this,Os)||!!(0,c.A)(this,Xs):this.isEmpty()}get guessedText(){return(0,c.A)(this,Xs)}async setGuessedText(t){null===(0,c.A)(this,Os)&&((0,d.A)(this,Xs,t),(0,d.A)(this,Ys,await Zs._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),(0,h.A)(this,Js,tn).call(this))}toggleAltTextBadge(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e;if(!(0,c.A)(this,Ks)||(0,c.A)(this,Os))return null===(e=(0,c.A)(this,Us))||void 0===e||e.remove(),void(0,d.A)(this,Us,null);if(!(0,c.A)(this,Us)){const t=(0,d.A)(this,Us,document.createElement("div"));t.className="noAltTextBadge",(0,c.A)(this,qs).div.append(t)}(0,c.A)(this,Us).classList.toggle("hidden",!t)}serialize(t){let e=(0,c.A)(this,Os);return t||(0,c.A)(this,Xs)!==e||(e=(0,c.A)(this,Ys)),{altText:e,decorative:(0,c.A)(this,Bs),guessedText:(0,c.A)(this,Xs),textWithDisclaimer:(0,c.A)(this,Ys)}}get data(){return{altText:(0,c.A)(this,Os),decorative:(0,c.A)(this,Bs)}}set data(t){let e=t.altText,i=t.decorative,s=t.guessedText,n=t.textWithDisclaimer,a=t.cancel,r=void 0!==a&&a;s&&((0,d.A)(this,Xs,s),(0,d.A)(this,Ys,n)),(0,c.A)(this,Os)===e&&(0,c.A)(this,Bs)===i||(r||((0,d.A)(this,Os,e),(0,d.A)(this,Bs,i)),(0,h.A)(this,Js,tn).call(this))}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,c.A)(this,Hs)&&(!t&&(0,c.A)(this,Gs)&&(clearTimeout((0,c.A)(this,Gs)),(0,d.A)(this,Gs,null)),(0,c.A)(this,Hs).disabled=!t)}shown(){(0,c.A)(this,qs)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:(0,c.A)(this,Qs)}})}destroy(){var t,e;null===(t=(0,c.A)(this,Hs))||void 0===t||t.remove(),(0,d.A)(this,Hs,null),(0,d.A)(this,zs,null),(0,d.A)(this,js,null),null===(e=(0,c.A)(this,Us))||void 0===e||e.remove(),(0,d.A)(this,Us,null)}}function $s(){return((0,c.A)(this,Os)?"added":null===(0,c.A)(this,Os)&&this.guessedText&&"review")||"missing"}async function tn(){const t=(0,c.A)(this,Hs);if(!t)return;if((0,c.A)(this,Ks)){var e,i;if(t.classList.toggle("done",!!(0,c.A)(this,Os)),t.setAttribute("data-l10n-id",v(Zs,Zs,en)[(0,c.A)(this,Qs)]),null===(e=(0,c.A)(this,zs))||void 0===e||e.setAttribute("data-l10n-id",v(Zs,Zs,en)["".concat((0,c.A)(this,Qs),"-label")]),!(0,c.A)(this,Os))return void(null===(i=(0,c.A)(this,js))||void 0===i||i.remove())}else{var s;if(!(0,c.A)(this,Os)&&!(0,c.A)(this,Bs))return t.classList.remove("done"),void(null===(s=(0,c.A)(this,js))||void 0===s||s.remove());t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let n=(0,c.A)(this,js);if(!n){(0,d.A)(this,js,n=document.createElement("span")),n.className="tooltip",n.setAttribute("role","tooltip"),n.id="alt-text-tooltip-".concat((0,c.A)(this,qs).id);const e=100,i=(0,c.A)(this,qs)._uiManager._signal;i.addEventListener("abort",(()=>{clearTimeout((0,c.A)(this,Gs)),(0,d.A)(this,Gs,null)}),{once:!0}),t.addEventListener("mouseenter",(()=>{(0,d.A)(this,Gs,setTimeout((()=>{(0,d.A)(this,Gs,null),(0,c.A)(this,js).classList.add("show"),(0,c.A)(this,qs)._reportTelemetry({action:"alt_text_tooltip"})}),e))}),{signal:i}),t.addEventListener("mouseleave",(()=>{var t;(0,c.A)(this,Gs)&&(clearTimeout((0,c.A)(this,Gs)),(0,d.A)(this,Gs,null)),null===(t=(0,c.A)(this,js))||void 0===t||t.classList.remove("show")}),{signal:i})}(0,c.A)(this,Bs)?n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(n.removeAttribute("data-l10n-id"),n.textContent=(0,c.A)(this,Os)),n.parentNode||t.append(n);const a=(0,c.A)(this,qs).getImageForAltText();null===a||void 0===a||a.setAttribute("aria-describedby",n.id)}var en={writable:!0,value:null};(0,m.A)(Zs,"_l10n",null);var sn=new WeakMap,nn=new WeakMap,an=new WeakMap,rn=new WeakMap,on=new WeakMap,ln=new WeakMap,hn=new WeakMap,cn=new WeakMap,dn=new WeakMap,un=new WeakMap,An=new WeakMap,pn=new WeakSet,gn=new WeakSet,fn=new WeakSet;class vn{constructor(t){let e=t.container,i=t.isPinchingDisabled,s=void 0===i?null:i,n=t.isPinchingStopped,a=void 0===n?null:n,r=t.onPinchStart,u=void 0===r?null:r,A=t.onPinching,p=void 0===A?null:A,g=t.onPinchEnd,f=void 0===g?null:g,v=t.signal;(0,o.A)(this,fn),(0,o.A)(this,gn),(0,o.A)(this,pn),(0,l.A)(this,sn,{writable:!0,value:void 0}),(0,l.A)(this,nn,{writable:!0,value:!1}),(0,l.A)(this,an,{writable:!0,value:null}),(0,l.A)(this,rn,{writable:!0,value:void 0}),(0,l.A)(this,on,{writable:!0,value:void 0}),(0,l.A)(this,ln,{writable:!0,value:void 0}),(0,l.A)(this,hn,{writable:!0,value:void 0}),(0,l.A)(this,cn,{writable:!0,value:void 0}),(0,l.A)(this,dn,{writable:!0,value:null}),(0,l.A)(this,un,{writable:!0,value:void 0}),(0,l.A)(this,An,{writable:!0,value:null}),(0,d.A)(this,sn,e),(0,d.A)(this,an,a),(0,d.A)(this,rn,s),(0,d.A)(this,on,u),(0,d.A)(this,ln,p),(0,d.A)(this,hn,f),(0,d.A)(this,un,new AbortController),(0,d.A)(this,cn,AbortSignal.any([v,(0,c.A)(this,un).signal])),e.addEventListener("touchstart",(0,h.A)(this,pn,mn).bind(this),{passive:!1,signal:(0,c.A)(this,cn)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return Mt(this,"MIN_TOUCH_DISTANCE_TO_PINCH",35/(window.devicePixelRatio||1))}destroy(){var t;null===(t=(0,c.A)(this,un))||void 0===t||t.abort(),(0,d.A)(this,un,null)}}function mn(t){var e,i;if(null!==(e=(0,c.A)(this,rn))&&void 0!==e&&e.call(this)||t.touches.length<2)return;if(!(0,c.A)(this,An)){var s;(0,d.A)(this,An,new AbortController);const t=AbortSignal.any([(0,c.A)(this,cn),(0,c.A)(this,An).signal]),e=(0,c.A)(this,sn),i={signal:t,passive:!1};e.addEventListener("touchmove",(0,h.A)(this,gn,wn).bind(this),i),e.addEventListener("touchend",(0,h.A)(this,fn,bn).bind(this),i),e.addEventListener("touchcancel",(0,h.A)(this,fn,bn).bind(this),i),null===(s=(0,c.A)(this,on))||void 0===s||s.call(this)}if(re(t),2!==t.touches.length||null!==(i=(0,c.A)(this,an))&&void 0!==i&&i.call(this))return void(0,d.A)(this,dn,null);let n=(0,b.A)(t.touches,2),a=n[0],r=n[1];if(a.identifier>r.identifier){var o=[r,a];a=o[0],r=o[1]}(0,d.A)(this,dn,{touch0X:a.screenX,touch0Y:a.screenY,touch1X:r.screenX,touch1Y:r.screenY})}function wn(t){var e;if(!(0,c.A)(this,dn)||2!==t.touches.length)return;let i=(0,b.A)(t.touches,2),s=i[0],n=i[1];if(s.identifier>n.identifier){var a=[n,s];s=a[0],n=a[1]}const r=s,o=r.screenX,l=r.screenY,h=n,u=h.screenX,A=h.screenY,p=(0,c.A)(this,dn),g=p.touch0X,f=p.touch0Y,v=p.touch1X-g,m=p.touch1Y-f,w=u-o,_=A-l,y=Math.hypot(w,_)||1,k=Math.hypot(v,m)||1;if(!(0,c.A)(this,nn)&&Math.abs(k-y)<=vn.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(p.touch0X=o,p.touch0Y=l,p.touch1X=u,p.touch1Y=A,t.preventDefault(),!(0,c.A)(this,nn))return void(0,d.A)(this,nn,!0);const S=[(o+u)/2,(l+A)/2];null===(e=(0,c.A)(this,ln))||void 0===e||e.call(this,S,k,y)}function bn(t){var e;(0,c.A)(this,An).abort(),(0,d.A)(this,An,null),null===(e=(0,c.A)(this,hn))||void 0===e||e.call(this),(0,c.A)(this,dn)&&(t.preventDefault(),(0,d.A)(this,dn,null),(0,d.A)(this,nn,!1))}var _n=new WeakMap,yn=new WeakMap,kn=new WeakMap,Sn=new WeakMap,xn=new WeakMap,Mn=new WeakMap,En=new WeakMap,Cn=new WeakMap,Tn=new WeakMap,Rn=new WeakMap,Pn=new WeakMap,In=new WeakMap,Ln=new WeakMap,Dn=new WeakMap,Fn=new WeakMap,Wn=new WeakMap,Nn=new WeakMap,On=new WeakMap,Bn=new WeakMap,Hn=new WeakMap,zn=new WeakMap,jn=new WeakMap,Gn=new WeakMap,Vn=new WeakMap,Un=new WeakSet,qn=new WeakSet,Xn=new WeakSet,Yn=new WeakSet,Kn=new WeakSet,Qn=new WeakSet,Jn=new WeakSet,Zn=new WeakSet,$n=new WeakSet,ta=new WeakSet,ea=new WeakSet,ia=new WeakSet,sa=new WeakSet,na=new WeakSet,aa=new WeakSet,ra=new WeakSet,oa=new WeakSet,la=new WeakSet;class ha{static get _resizerKeyboardManager(){const t=ha.prototype._resizeWithKeyboard,e=fs.TRANSLATE_SMALL,i=fs.TRANSLATE_BIG;return Mt(this,"_resizerKeyboardManager",new ni([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],ha.prototype._stopResizingWithKeyboard]]))}constructor(t){(0,o.A)(this,la),(0,o.A)(this,oa),(0,o.A)(this,ra),(0,o.A)(this,aa),(0,o.A)(this,na),(0,o.A)(this,sa),(0,o.A)(this,ia),(0,o.A)(this,ea),(0,o.A)(this,ta),(0,o.A)(this,$n),(0,o.A)(this,Zn),(0,o.A)(this,Jn),(0,o.A)(this,Qn),(0,o.A)(this,Kn),(0,o.A)(this,Yn),(0,o.A)(this,Xn),(0,o.A)(this,qn),(0,o.A)(this,Un),(0,l.A)(this,_n,{writable:!0,value:null}),(0,l.A)(this,yn,{writable:!0,value:null}),(0,l.A)(this,kn,{writable:!0,value:null}),(0,l.A)(this,Sn,{writable:!0,value:!1}),(0,l.A)(this,xn,{writable:!0,value:null}),(0,l.A)(this,Mn,{writable:!0,value:""}),(0,l.A)(this,En,{writable:!0,value:!1}),(0,l.A)(this,Cn,{writable:!0,value:null}),(0,l.A)(this,Tn,{writable:!0,value:null}),(0,l.A)(this,Rn,{writable:!0,value:null}),(0,l.A)(this,Pn,{writable:!0,value:null}),(0,l.A)(this,In,{writable:!0,value:""}),(0,l.A)(this,Ln,{writable:!0,value:!1}),(0,l.A)(this,Dn,{writable:!0,value:null}),(0,l.A)(this,Fn,{writable:!0,value:!1}),(0,l.A)(this,Wn,{writable:!0,value:!1}),(0,l.A)(this,Nn,{writable:!0,value:!1}),(0,l.A)(this,On,{writable:!0,value:null}),(0,l.A)(this,Bn,{writable:!0,value:0}),(0,l.A)(this,Hn,{writable:!0,value:0}),(0,l.A)(this,zn,{writable:!0,value:null}),(0,l.A)(this,jn,{writable:!0,value:null}),(0,m.A)(this,"_editToolbar",null),(0,m.A)(this,"_initialOptions",Object.create(null)),(0,m.A)(this,"_initialData",null),(0,m.A)(this,"_isVisible",!0),(0,m.A)(this,"_uiManager",null),(0,m.A)(this,"_focusEventsAllowed",!0),(0,l.A)(this,Gn,{writable:!0,value:!1}),(0,l.A)(this,Vn,{writable:!0,value:ha._zIndex++}),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const e=this.parent.viewport,i=e.rotation,s=e.rawDims,n=s.pageWidth,a=s.pageHeight,r=s.pageX,h=s.pageY;this.rotation=i,this.pageRotation=(360+i-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,a],this.pageTranslation=[r,h];const c=(0,b.A)(this.parentDimensions,2),d=c[0],u=c[1];this.x=t.x/d,this.y=t.y/u,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get isDrawer(){return!1}static get _defaultLineColor(){return Mt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new Ta({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){var i;if(null!==(i=ha._l10n)&&void 0!==i||(ha._l10n=t),ha._l10nResizer||(ha._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),-1!==ha._borderLineWidth)return;const s=getComputedStyle(document.documentElement);ha._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){kt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return(0,c.A)(this,Gn)}set _isDraggable(t){var e;(0,d.A)(this,Gn,t),null===(e=this.div)||void 0===e||e.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const t=(0,b.A)(this.pageDimensions,2),e=t[0],i=t[1];switch(this.parentRotation){case 90:this.x-=this.height*i/(2*e),this.y+=this.width*e/(2*i);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*i/(2*e),this.y-=this.width*e/(2*i);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}
1setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=(0,c.A)(this,Vn)}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(0,h.A)(this,la,Ca).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&((0,c.A)(this,Ln)?(0,d.A)(this,Ln,!1):this.parent.setSelected(this))}focusout(t){var e;if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const i=t.relatedTarget;null!==i&&void 0!==i&&i.closest("#".concat(this.id))||(t.preventDefault(),null!==(e=this.parent)&&void 0!==e&&e.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){const n=(0,b.A)(this.parentDimensions,2),a=n[0],r=n[1];var o=this.screenToPageTranslation(i,s),l=(0,b.A)(o,2);i=l[0],s=l[1],this.x=(t+i)/a,this.y=(e+s)/r,this.fixAndSetPosition()}translate(t,e){(0,h.A)(this,Un,ca).call(this,this.parentDimensions,t,e)}translateInPage(t,e){(0,c.A)(this,Dn)||(0,d.A)(this,Dn,[this.x,this.y,this.width,this.height]),(0,h.A)(this,Un,ca).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){(0,c.A)(this,Dn)||(0,d.A)(this,Dn,[this.x,this.y,this.width,this.height]);const i=this.div,s=(0,b.A)(this.parentDimensions,2),n=s[0],a=s[1];if(this.x+=t/n,this.y+=e/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const t=this.div.getBoundingClientRect(),e=t.x,i=t.y;this.parent.findNewParent(this,e,i)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let r=this.x,o=this.y;const l=this.getBaseTranslation(),h=(0,b.A)(l,2);r+=h[0],o+=h[1];const u=i.style;u.left="".concat((100*r).toFixed(2),"%"),u.top="".concat((100*o).toFixed(2),"%"),this._onTranslating(r,o),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!(0,c.A)(this,Dn)&&((0,c.A)(this,Dn)[0]!==this.x||(0,c.A)(this,Dn)[1]!==this.y)}get _hasBeenResized(){return!!(0,c.A)(this,Dn)&&((0,c.A)(this,Dn)[2]!==this.width||(0,c.A)(this,Dn)[3]!==this.height)}getBaseTranslation(){const t=(0,b.A)(this.parentDimensions,2),e=t[0],i=t[1],s=ha._borderLineWidth,n=s/e,a=s/i;switch(this.rotation){case 90:return[-n,a];case 180:return[n,a];case 270:return[n,-a];default:return[-n,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const e=this.div.style,i=(0,b.A)(this.pageDimensions,2),s=i[0],n=i[1];let a=this.x,r=this.y,o=this.width,l=this.height;if(o*=s,l*=n,a*=s,r*=n,this._mustFixPosition)switch(t){case 0:a=Math.max(0,Math.min(s-o,a)),r=Math.max(0,Math.min(n-l,r));break;case 90:a=Math.max(0,Math.min(s-l,a)),r=Math.min(n,Math.max(o,r));break;case 180:a=Math.min(s,Math.max(o,a)),r=Math.min(n,Math.max(l,r));break;case 270:a=Math.min(s,Math.max(l,a)),r=Math.max(0,Math.min(n-o,r))}this.x=a/=s,this.y=r/=n;const h=this.getBaseTranslation(),c=(0,b.A)(h,2);a+=c[0],r+=c[1],e.left="".concat((100*a).toFixed(2),"%"),e.top="".concat((100*r).toFixed(2),"%"),this.moveInDOM()}screenToPageTranslation(t,e){return w(ha,ha,da).call(ha,t,e,this.parentRotation)}pageTranslationToScreen(t,e){return w(ha,ha,da).call(ha,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const t=this.parentScale,e=(0,b.A)(this.pageDimensions,2);return[e[0]*t,e[1]*t]}setDims(t,e){const i=(0,b.A)(this.parentDimensions,2),s=i[0],n=i[1],a=this.div.style;a.width="".concat((100*t/s).toFixed(2),"%"),(0,c.A)(this,En)||(a.height="".concat((100*e/n).toFixed(2),"%"))}fixDims(){const t=this.div.style,e=t.height,i=t.width,s=i.endsWith("%"),n=!(0,c.A)(this,En)&&e.endsWith("%");if(s&&n)return;const a=(0,b.A)(this.parentDimensions,2),r=a[0],o=a[1];s||(t.width="".concat((100*parseFloat(i)/r).toFixed(2),"%")),(0,c.A)(this,En)||n||(t.height="".concat((100*parseFloat(e)/o).toFixed(2),"%"))}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(1e4*t)/1e4}_onResizing(){}altTextFinish(){var t;null===(t=(0,c.A)(this,kn))||void 0===t||t.finish()}async addEditToolbar(){return this._editToolbar||(0,c.A)(this,Wn)||(this._editToolbar=ne
1w xe(this),this.div.append(this._editToolbar.render()),(0,c.A)(this,kn)&&await this._editToolbar.addAltText((0,c.A)(this,kn))),this._editToolbar}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,null===(t=(0,c.A)(this,kn))||void 0===t||t.destroy())}addContainer(t){var e;const i=null===(e=this._editToolbar)||void 0===e?void 0:e.div;i?i.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){(0,c.A)(this,kn)||(Zs.initialize(ha._l10n),(0,d.A)(this,kn,new Zs(this)),(0,c.A)(this,_n)&&((0,c.A)(this,kn).data=(0,c.A)(this,_n),(0,d.A)(this,_n,null)),await this.addEditToolbar())}get altTextData(){var t;return null===(t=(0,c.A)(this,kn))||void 0===t?void 0:t.data}set altTextData(t){(0,c.A)(this,kn)&&((0,c.A)(this,kn).data=t)}get guessedAltText(){var t;return null===(t=(0,c.A)(this,kn))||void 0===t?void 0:t.guessedText}async setGuessedAltText(t){var e;await(null===(e=(0,c.A)(this,kn))||void 0===e?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return null===(e=(0,c.A)(this,kn))||void 0===e?void 0:e.serialize(t)}hasAltText(){return!!(0,c.A)(this,kn)&&!(0,c.A)(this,kn).isEmpty()}hasAltTextData(){var t,e;return null!==(t=null===(e=(0,c.A)(this,kn))||void 0===e?void 0:e.hasData())&&void 0!==t&&t}render(){var t;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.tabIndex=(0,c.A)(this,Sn)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),(0,h.A)(this,sa,ka).call(this);const e=(0,b.A)(this.parentDimensions,2),i=e[0],s=e[1];this.parentRotation%180!==0&&(this.div.style.maxWidth="".concat((100*s/i).toFixed(2),"%"),this.div.style.maxHeight="".concat((100*i/s).toFixed(2),"%"));const n=this.getInitialTranslation(),a=(0,b.A)(n,2),r=a[0],o=a[1];return this.translate(r,o),Ge(this,this.div,["pointerdown"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&((0,c.A)(this,jn)||(0,d.A)(this,jn,new vn({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:(0,h.A)(this,Zn,ma).bind(this),onPinching:(0,h.A)(this,$n,wa).bind(this),onPinchEnd:(0,h.A)(this,ta,ba).bind(this),signal:this._uiManager._signal}))),null===(t=this._uiManager._editorUndoBar)||void 0===t||t.hide(),this.div}pointerdown(t){const e=Ot.platform.isMac;0!==t.button||t.ctrlKey&&e?t.preventDefault():((0,d.A)(this,Ln,!0),this._isDraggable?(0,h.A)(this,ia,ya).call(this,t):(0,h.A)(this,ea,_a).call(this,t))}get isSelected(){return this._uiManager.isSelected(this)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){(0,c.A)(this,On)&&clearTimeout((0,c.A)(this,On)),(0,d.A)(this,On,setTimeout((()=>{var t;(0,d.A)(this,On,null),null===(t=this.parent)||void 0===t||t.moveEditorInDOM(this)}),0))}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const s=this.parentScale,n=(0,b.A)(this.pageDimensions,2),a=n[0],r=n[1],o=(0,b.A)(this.pageTranslation,2),l=o[0],h=o[1],c=t/s,d=e/s,u=this.x*a,A=this.y*r,p=this.width*a,g=this.height*r;switch(i){case 0:return[u+c+l,r-A-d-g+h,u+c+p+l,r-A-d+h];case 90:return[u+d+l,r-A+c+h,u+d+g+l,r-A+c+p+h];case 180:return[u-c-p+l,r-A+d+h,u-c+l,r-A+d+g+h];case 270:return[u-d-g+l,r-A-c-p+h,u-d+l,r-A-c+h];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const i=(0,b.A)(t,4),s=i[0],n=i[1],a=i[2],r=i[3],o=a-s,l=r-n;switch(this.rotation){case 0:return[s,e-r,o,l];case 90:return[s,e-n,l,o];case 180:return[a,e-n,o,l];case 270:return[a,e-r,l,o];default:throw new Error("Invalid rotation")}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){(0,d.A)(this,Wn,!0)}disableEditMode(){(0,d.A)(this,Wn,!1)}isInEditMode(){return(0,c.A)(this,Wn)}shouldGetKeyboardEvents(){return(0,c.A)(this,Nn)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const t=this.getClientDimensions(),e=t.top,i=t.left,s=t.bottom,n=t.right,a=window,r=a.innerHeight;return i<a.innerWidth&&n>0&&e<r&&s>0}rebuild(){(0,h.A)(this,sa,ka).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:(null===(t=this._initialData)||void 0===t?void 0:t.popupRef)||""}}serialize(){kt("An editor must be serializable")}static async deserialize(t,e,i){const s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation,(0,d.A)(s,_n,t.accessibilityData);const n=(0,b.A)(s.pageDimensions,2),a=n[0],r=n[1],o=s.getRectInCurrentCoords(t.rect,r),l=(0,b.A)(o,4),h=l[0],c=l[1],u=l[2],A=l[3];return s.x=h/a,s.y=c/r,s.width=u/a,s.height=A/r,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){var t,e;if(null===(t=(0,c.A)(this,Pn))||void 0===t||t.abort(),(0,d.A)(this,Pn,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),(0,c.A)(this,On)&&(clearTimeout((0,c.A)(this,On)),(0,d.A)(this,On,null)),(0,h.A)(this,la,Ca).call(this),this.removeEditToolbar(),(0,c.A)(this,zn)){for(const t of(0,c.A)(this,zn).values())clearTimeout(t);(0,d.A)(this,zn,null)}this.parent=null,null===(e=(0,c.A)(this,jn))||void 0===e||e.destroy(),(0,d.A)(this,jn,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&((0,h.A)(this,Xn,Aa).call(this),(0,c.A)(this,Cn).classList.remove("hidden"),Ge(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),(0,d.A)(this,Rn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=(0,c.A)(this,Cn).children;if(!(0,c.A)(this,yn)){(0,d.A)(this,yn,Array.from(e));const t=(0,h.A)(this,na,Sa).bind(this),i=(0,h.A)(this,aa,xa).bind(this),s=this._uiManager._signal;for(const e of(0,c.A)(this,yn)){const n=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:s}),e.addEventListener("blur",i,{signal:s}),e.addEventListener("focus",(0,h.A)(this,ra,Ma).bind(this,n),{signal:s}),e.setAttribute("data-l10n-id",ha._l10nResizer[n])}}const i=(0,c.A)(this,yn)[0];let s=0;for(const a of e){if(a===i)break;s++}const n=(360-this.rotation+this.parentRotation)%360/90*((0,c.A)(this,yn).length/4);if(n!==s){if(n<s)for(let e=0;e<s-n;e++)(0,c.A)(this,Cn).append((0,c.A)(this,Cn).firstChild);else if(n>s)for(let e=0;e<n-s;e++)(0,c.A)(this,Cn).firstChild.before((0,c.A)(this,Cn).lastChild);let t=0;for(const i of e){const e=(0,c.A)(this,yn)[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",ha._l10nResizer[e])}}(0,h.A)(this,oa,Ea).call(this,0),(0,d.A)(this,Nn,!0),(0,c.A)(this,Cn).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){(0,c.A)(this,Nn)&&(0,h.A)(this,Jn,va).call(this,(0,c.A)(this,In),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){(0,h.A)(this,la,Ca).call(this),this.div.focus()}select(){var t,e,i;this.makeResizable(),null===(t=this.div)||void 0===t||t.classList.add("selectedEditor"),this._editToolbar?(null===(e=this._editToolbar)||void 0===e||e.show(),null===(i=(0,c.A)(this,kn))||void 0===i||i.toggleAltTextBadge(!1)):this.addEditToolbar().then((()=>{var t,e;null!==(t=this.div)&&void 0!==t&&t.classList.contains("selectedEditor")&&(null===(e=this._editToolbar)||void 0===e||e.show())}))}unselect(){var t,e,i,s,n;null===(t=(0,c.A)(this,Cn))||void 0===t||t.classList.add("hidden"),null===(e=this.div)||void 0===e||e.classList.remove("selectedEditor"),null!==(i=this.div)&&void 0!==i&&i.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),null===(s=this._editToolbar)||void 0===s||s.hide(),null===(n=(0,c.A)(this,kn))||void 0===n||n.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return(0,c.A)(this,Fn)}set isEditing(t){(0,d.A)(this,Fn,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){(0,d.A)(this,En,!0);const i=t/e,s=this.div.style;s.aspectRatio=i,s.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){(0,c.A)(this,zn)||(0,d.A)(this,zn,new Map);const e=t.action;let i=(0,c.A)(this,zn).get(e);return i&&clearTimeout(i),i=setTimeout((()=>{this._reportTelemetry(t),(0,c.A)(this,zn).delete(e),0===(0,c.A)(this,zn).size&&(0,d.A)(this,zn,null)}),ha._telemetryTimeout),void(0,c.A)(this,zn).set(e,i)}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
1show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),(0,d.A)(this,Sn,!1)}disable(){this.div&&(this.div.tabIndex=-1),(0,d.A)(this,Sn,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){const t=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const e=t.container.firstChild;"DIV"===(null===e||void 0===e?void 0:e.nodeName)&&e.classList.contains("annotationContent")&&e.remove()}}function ca(t,e,i){let s=(0,b.A)(t,2),n=s[0],a=s[1];var r=this.screenToPageTranslation(e,i),o=(0,b.A)(r,2);e=o[0],i=o[1],this.x+=e/n,this.y+=i/a,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}function da(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}function ua(t){switch(t){case 90:{const t=(0,b.A)(this.pageDimensions,2),e=t[0],i=t[1];return[0,-e/i,i/e,0]}case 180:return[-1,0,0,-1];case 270:{const t=(0,b.A)(this.pageDimensions,2),e=t[0],i=t[1];return[0,e/i,-i/e,0]}default:return[1,0,0,1]}}function Aa(){if((0,c.A)(this,Cn))return;(0,d.A)(this,Cn,document.createElement("div")),(0,c.A)(this,Cn).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const t=document.createElement("div");(0,c.A)(this,Cn).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",(0,h.A)(this,Yn,pa).bind(this,i),{signal:e}),t.addEventListener("contextmenu",ae,{signal:e}),t.tabIndex=-1}this.div.prepend((0,c.A)(this,Cn))}function pa(t,e){var i;e.preventDefault();const s=Ot.platform.isMac;if(0!==e.button||e.ctrlKey&&s)return;null===(i=(0,c.A)(this,kn))||void 0===i||i.toggle(!1);const n=this._isDraggable;this._isDraggable=!1,(0,d.A)(this,Tn,[e.screenX,e.screenY]);const a=new AbortController,r=this._uiManager.combinedSignal(a);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",(0,h.A)(this,Jn,va).bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("touchmove",re,{passive:!1,signal:r}),window.addEventListener("contextmenu",ae,{signal:r}),(0,d.A)(this,Rn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const u=()=>{var t;a.abort(),this.parent.togglePointerEvents(!0),null===(t=(0,c.A)(this,kn))||void 0===t||t.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=o,this.div.style.cursor=l,(0,h.A)(this,Qn,fa).call(this)};window.addEventListener("pointerup",u,{signal:r}),window.addEventListener("blur",u,{signal:r})}function ga(t,e,i,s){this.width=i,this.height=s,this.x=t,this.y=e;const n=(0,b.A)(this.parentDimensions,2),a=n[0],r=n[1];this.setDims(a*i,r*s),this.fixAndSetPosition(),this._onResized()}function fa(){if(!(0,c.A)(this,Rn))return;const t=(0,c.A)(this,Rn),e=t.savedX,i=t.savedY,s=t.savedWidth,n=t.savedHeight;(0,d.A)(this,Rn,null);const a=this.x,r=this.y,o=this.width,l=this.height;a===e&&r===i&&o===s&&l===n||this.addCommands({cmd:(0,h.A)(this,Kn,ga).bind(this,a,r,o,l),undo:(0,h.A)(this,Kn,ga).bind(this,e,i,s,n),mustExec:!0})}function va(t,e){const i=(0,b.A)(this.parentDimensions,2),s=i[0],n=i[1],a=this.x,r=this.y,o=this.width,l=this.height,u=ha.MIN_SIZE/s,A=ha.MIN_SIZE/n,p=(0,h.A)(this,qn,ua).call(this,this.rotation),g=(t,e)=>[p[0]*t+p[2]*e,p[1]*t+p[3]*e],f=(0,h.A)(this,qn,ua).call(this,360-this.rotation);let v,m,w=!1,_=!1;switch(t){case"topLeft":w=!0,v=(t,e)=>[0,0],m=(t,e)=>[t,e];break;case"topMiddle":v=(t,e)=>[t/2,0],m=(t,e)=>[t/2,e];break;case"topRight":w=!0,v=(t,e)=>[t,0],m=(t,e)=>
1[0,e];break;case"middleRight":_=!0,v=(t,e)=>[t,e/2],m=(t,e)=>[0,e/2];break;case"bottomRight":w=!0,v=(t,e)=>[t,e],m=(t,e)=>[0,0];break;case"bottomMiddle":v=(t,e)=>[t/2,e],m=(t,e)=>[t/2,0];break;case"bottomLeft":w=!0,v=(t,e)=>[0,e],m=(t,e)=>[t,0];break;case"middleLeft":_=!0,v=(t,e)=>[0,e/2],m=(t,e)=>[t,e/2]}const y=v(o,l),k=m(o,l);let S=g(...k);const x=ha._round(a+S[0]),M=ha._round(r+S[1]);let E,C,T=1,R=1;if(e.fromKeyboard)E=e.deltaX,C=e.deltaY;else{const t=e.screenX,i=e.screenY,s=(0,c.A)(this,Tn),n=(0,b.A)(s,2),a=n[0],r=n[1];var P=this.screenToPageTranslation(t-a,i-r),I=(0,b.A)(P,2);E=I[0],C=I[1],(0,c.A)(this,Tn)[0]=t,(0,c.A)(this,Tn)[1]=i}var L,D,F=(L=E/s,D=C/n,[f[0]*L+f[2]*D,f[1]*L+f[3]*D]),W=(0,b.A)(F,2);if(E=W[0],C=W[1],w){const t=Math.hypot(o,l);T=R=Math.max(Math.min(Math.hypot(k[0]-y[0]-E,k[1]-y[1]-C)/t,1/o,1/l),u/o,A/l)}else _?T=Math.max(u,Math.min(1,Math.abs(k[0]-y[0]-E)))/o:R=Math.max(A,Math.min(1,Math.abs(k[1]-y[1]-C)))/l;const N=ha._round(o*T),O=ha._round(l*R);S=g(...m(N,O));const B=x-S[0],H=M-S[1];(0,c.A)(this,Dn)||(0,d.A)(this,Dn,[this.x,this.y,this.width,this.height]),this.width=N,this.height=O,this.x=B,this.y=H,this.setDims(s*N,n*O),this.fixAndSetPosition(),this._onResizing()}function ma(){var t;(0,d.A)(this,Rn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),null===(t=(0,c.A)(this,kn))||void 0===t||t.toggle(!1),this.parent.togglePointerEvents(!1)}function wa(t,e,i){let s=i/e*.7+1-.7;if(1===s)return;const n=(0,h.A)(this,qn,ua).call(this,this.rotation),a=(t,e)=>[n[0]*t+n[2]*e,n[1]*t+n[3]*e],r=(0,b.A)(this.parentDimensions,2),o=r[0],l=r[1],u=this.x,A=this.y,p=this.width,g=this.height,f=ha.MIN_SIZE/o,v=ha.MIN_SIZE/l;s=Math.max(Math.min(s,1/p,1/g),f/p,v/g);const m=ha._round(p*s),w=ha._round(g*s);if(m===p&&w===g)return;(0,c.A)(this,Dn)||(0,d.A)(this,Dn,[u,A,p,g]);const _=a(p/2,g/2),y=ha._round(u+_[0]),k=ha._round(A+_[1]),S=a(m/2,w/2);this.x=y-S[0],this.y=k-S[1],this.width=m,this.height=w,this.setDims(o*m,l*w),this.fixAndSetPosition(),this._onResizing()}function ba(){var t;null===(t=(0,c.A)(this,kn))||void 0===t||t.toggle(!0),this.parent.togglePointerEvents(!0),(0,h.A)(this,Qn,fa).call(this)}function _a(t){const e=Ot.platform.isMac;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}function ya(t){const e=this.isSelected;this._uiManager.setUpDragSession();let i=!1;const s=new AbortController,n=this._uiManager.combinedSignal(s),a={capture:!0,passive:!1,signal:n},r=t=>{s.abort(),(0,d.A)(this,xn,null),(0,d.A)(this,Ln,!1),this._uiManager.endDragSession()||(0,h.A)(this,ea,_a).call(this,t),i&&this._onStopDragging()};e&&((0,d.A)(this,Bn,t.clientX),(0,d.A)(this,Hn,t.clientY),(0,d.A)(this,xn,t.pointerId),(0,d.A)(this,Mn,t.pointerType),window.addEventListener("pointermove",(t=>{i||(i=!0,this._onStartDragging());const e=t.clientX,s=t.clientY;if(t.pointerId!==(0,c.A)(this,xn))return void re(t);const n=this.screenToPageTranslation(e-(0,c.A)(this,Bn),s-(0,c.A)(this,Hn)),a=(0,b.A)(n,2),r=a[0],o=a[1];(0,d.A)(this,Bn,e),(0,d.A)(this,Hn,s),this._uiManager.dragSelectedEditors(r,o)}),a),window.addEventListener("touchmove",re,a),window.addEventListener("pointerdown",(t=>{t.pointerType===(0,c.A)(this,Mn)&&((0,c.A)(this,jn)||t.isPrimary)&&r(t),re(t)}),a));const o=t=>{(0,c.A)(this,xn)&&(0,c.A)(this,xn)!==t.pointerId?re(t):r(t)};window.addEventListener("pointerup",o,{signal:n}),window.addEventListener("blur",o,{signal:n})}function ka(){if((0,c.A)(this,Pn)||!this.div)return;(0,d.A)(this,Pn,new AbortController);const t=this._uiManager.combinedSignal((0,c.A)(this,Pn));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}function Sa(t){ha._resizerKeyboardManager.exec(this,t)}function xa(t){var e;(0,c.A)(this,Nn)&&(null===(e=t.relatedTarget)||void 0===e?void 0:e.parentNode)!==(0,c.A)(this,Cn)&&(0,h.A)(this,la,Ca).call(this)}function Ma(t){(0,d.A)(this,In,(0,c.A)(this,Nn)?t:"")}function Ea(t){if((0,c.A)(this,yn))for(const e of(0,c.A)(this,yn))e.tabIndex=t}function Ca(){(0,d.A)(this,Nn,!1),(0,h.A)(this,oa,Ea).call(this,-1),(0,h.A)(this,Qn,fa).call(this)}(0,m.A)(ha,"_l10n",null),(0,m.A)(ha,"_l10nResizer",null),(0,m.A)(ha,"_borderLineWidth",-1),(0,m.A)(ha,"_colorManager",new ri),(0,m.A)(ha,"_zIndex",1),(0,m.A)(ha,"_telemetryTimeout",1e3);class Ta extends ha{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}
1serialize(){return this.serializeDeleted()}}const Ra=3285377520,Pa=4294901760,Ia=65535;class La{constructor(t){this.h1=t?4294967295&t:Ra,this.h2=t?4294967295&t:Ra}update(t){let e,i;if("string"===typeof t){e=new Uint8Array(2*t.length),i=0;for(let s=0,n=t.length;s<n;s++){const n=t.charCodeAt(s);n<=255?e[i++]=n:(e[i++]=n>>>8,e[i++]=255&n)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const s=i>>2,n=i-4*s,a=new Uint32Array(e.buffer,0,s);let r=0,o=0,l=this.h1,h=this.h2;const c=3432918353,d=461845907,u=11601,A=13715;for(let p=0;p<s;p++)1&p?(r=a[p],r=r*c&Pa|r*u&Ia,r=r<<15|r>>>17,r=r*d&Pa|r*A&Ia,l^=r,l=l<<13|l>>>19,l=5*l+3864292196):(o=a[p],o=o*c&Pa|o*u&Ia,o=o<<15|o>>>17,o=o*d&Pa|o*A&Ia,h^=o,h=h<<13|h>>>19,h=5*h+3864292196);switch(r=0,n){case 3:r^=e[4*s+2]<<16;case 2:r^=e[4*s+1]<<8;case 1:r^=e[4*s],r=r*c&Pa|r*u&Ia,r=r<<15|r>>>17,r=r*d&Pa|r*A&Ia,1&s?l^=r:h^=r}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&Pa|36045*t&Ia,e=4283543511*e&Pa|(2950163797*(e<<16|t>>>16)&Pa)>>>16,t^=e>>>1,t=444984403*t&Pa|60499*t&Ia,e=3301882366*e&Pa|(3120437893*(e<<16|t>>>16)&Pa)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Da=Object.freeze({map:null,hash:"",transfer:void 0});var Fa=new WeakMap,Wa=new WeakMap,Na=new WeakMap,Oa=new WeakSet;class Ba{constructor(){(0,o.A)(this,Oa),(0,l.A)(this,Fa,{writable:!0,value:!1}),(0,l.A)(this,Wa,{writable:!0,value:null}),(0,l.A)(this,Na,{writable:!0,value:new Map}),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=(0,c.A)(this,Na).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return(0,c.A)(this,Na).get(t)}remove(t){if((0,c.A)(this,Na).delete(t),0===(0,c.A)(this,Na).size&&this.resetModified(),"function"===typeof this.onAnnotationEditor){for(const t of(0,c.A)(this,Na).values())if(t instanceof ha)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=(0,c.A)(this,Na).get(t);let s=!1;if(void 0!==i)for(const a of Object.entries(e)){var n=(0,b.A)(a,2);const t=n[0],e=n[1];i[t]!==e&&(s=!0,i[t]=e)}else s=!0,(0,c.A)(this,Na).set(t,e);s&&(0,h.A)(this,Oa,Ha).call(this),e instanceof ha&&"function"===typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return(0,c.A)(this,Na).has(t)}getAll(){return(0,c.A)(this,Na).size>0?Nt((0,c.A)(this,Na)):null}setAll(t){for(const i of Object.entries(t)){var e=(0,b.A)(i,2);const t=e[0],s=e[1];this.setValue(t,s)}}get size(){return(0,c.A)(this,Na).size}resetModified(){(0,c.A)(this,Fa)&&((0,d.A)(this,Fa,!1),"function"===typeof this.onResetModified&&this.onResetModified())}get print(){return new ja(this)}get serializable(){if(0===(0,c.A)(this,Na).size)return Da;const t=new Map,e=new La,i=[],s=Object.create(null);let n=!1;for(const r of(0,c.A)(this,Na)){var a=(0,b.A)(r,2);const i=a[0],o=a[1],l=o instanceof ha?o.serialize(!1,s):o;l&&(t.set(i,l),e.update("".concat(i,":").concat(JSON.stringify(l))),n||(n=!!l.bitmap))}if(n)for(const r of t.values())r.bitmap&&i.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:Da}get editorStats(){let t=null;const e=new Map;for(const r of(0,c.A)(this,Na).values()){var i;if(!(r instanceof ha))continue;const a=r.telemetryFinalData;if(!a)continue;const o=a.type;e.has(o)||e.set(o,Object.getPrototypeOf(r).constructor),t||(t=Object.create(null));const l=(i=t)[o]||(i[o]=new Map);for(const t of Object.entries(a)){var s,n=(0,b.A)(t,2);const e=n[0],i=n[1];if("type"===e)continue;let a=l.get(e);a||(a=new Map,l.set(e,a));const r=null!==(s=a.get(i))&&void 0!==s?s:0;a.set(i,r+1)}}for(const r of e){var a=(0,b.A)(r,2);const e=a[0],i=a[1];t[e]=i.computeTelemetryFinalData(t[e])}return t}resetModifiedIds(){(0,d.A)(this,Wa,null)}get modifiedIds(){if((0,c.A)(this,Wa))return(0,c.A)(this,Wa);const t=[];for(const e of(0,c.A)(this,Na).values())e instanceof ha&&e.annotationElementId&&e.serialize()&&t.push(e.annotationElementId);return(0,d.A)(this,Wa,{ids:new Set(t),hash:t.join(",")})}}function Ha(){(0,c.A)(this,Fa)||((0,d.A)(this,Fa,!0),"function"===typeof this.onSetModified&&this.onSetModified())}var za=new WeakMap;
1class ja extends Ba{constructor(t){super(),(0,l.A)(this,za,{writable:!0,value:void 0});const e=t.serializable,i=e.map,s=e.hash,n=e.transfer,a=structuredClone(i,n?{transfer:n}:null);(0,d.A)(this,za,{map:a,hash:s,transfer:n})}get print(){kt("Should not call PrintAnnotationStorage.print")}get serializable(){return(0,c.A)(this,za)}get modifiedIds(){return Mt(this,"modifiedIds",{ids:new Set,hash:""})}}var Ga=new WeakMap;class Va{constructor(t){let e=t.ownerDocument,i=void 0===e?globalThis.document:e;t.styleElement;(0,l.A)(this,Ga,{writable:!0,value:new Set}),this._document=i,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),(0,c.A)(this,Ga).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let e=t.systemFontInfo,i=t._inspectFont;if(e&&!(0,c.A)(this,Ga).has(e.loadedName))if(St(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const t=e.loadedName,n=e.src,a=e.style,r=new FontFace(t,n,a);this.addNativeFontFace(r);try{await r.load(),(0,c.A)(this,Ga).add(t),null===i||void 0===i||i(e)}catch(s){yt("Cannot load system font: ".concat(e.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(r)}}else kt("Not implemented: loadSystemFont without the Font Loading API.")}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw yt("Failed to load font '".concat(e.family,"': '").concat(i,"'.")),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise((e=>{const i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)}))}}get isFontLoadingAPISupported(){var t;return Mt(this,"isFontLoadingAPISupported",!(null===(t=this._document)||void 0===t||!t.fonts))}get isSyncFontLoadingSupported(){var t;let e=!1;return(k||"undefined"!==typeof navigator&&"string"===typeof(null===(t=navigator)||void 0===t?void 0:t.userAgent)&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),Mt(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(t){const e=this.loadingRequests,i={done:!1,complete:function(){for(St(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(i),i}get _loadTestFont(){return Mt(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function i(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function s(t,e,i,s){return t.substring(0,e)+s+t.substring(e+i)}let n,a;const r=this._document.createElement("canvas");r.width=1,r.height=1;const o=r.getContext("2d");let l=0;const h="lt".concat(Date.now()).concat(this.loadTestFontId++);let c=this._loadTestFont;c=s(c,976,h.length,h);const d=1482184792;let u=i(c,16);for(n=0,a=h.length-3;n<a;n+=4)u=u-d+i(h,n)|0;var A;n<h.length&&(u=u-d+i(h+"XXX",n)|0),c=s(c,16,4,(A=u,String.fromCharCode(A>>24&255,A>>16&255,A>>8&255,255&A)));const p="url(data:font/opentype;base64,".concat(btoa(c),");"),g='@font-face {font-family:"'.concat(h,'";src:').concat(p,"}");this.insertRule(g);const f=this._document.createElement("div");f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px";for(const v of[t.loadedName,h]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=v,f.append(t)}this._document.body.append(f),function t(e,i){if(++l>30)return yt("Load test font never loaded."),void i();o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i))}(h,(()=>{f.remove(),e.complete()}
1))}}class Ua{constructor(t,e){let i=e.disableFontFace,s=void 0!==i&&i,n=e.fontExtraProperties,a=void 0!==n&&n,r=e.inspectFont,o=void 0===r?null:r;this.compiledGlyphs=Object.create(null);for(const l in t)this[l]=t[l];this.disableFontFace=!0===s,this.fontExtraProperties=!0===a,this._inspectFont=o}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return null===(t=this._inspectFont)||void 0===t||t.call(this,this),e}createFontFaceRule(){var t;if(!this.data||this.disableFontFace)return null;const e="url(data:".concat(this.mimetype,";base64,").concat((i=this.data,Uint8Array.prototype.toBase64?i.toBase64():btoa(Ft(i))),");");var i;let s;if(this.cssFontInfo){let t="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(t+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),s='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(t,"src:").concat(e,"}")}else s='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(e,"}");return null===(t=this._inspectFont)||void 0===t||t.call(this,this,e),s}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];const i=this.loadedName+"_path_"+e;let s;try{s=t.get(i)}catch(a){yt('getPathGenerator - ignoring character: "'.concat(a,'".'))}const n=new Path2D(s||"");return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=n}}const qa=1,Xa=2,Ya=1,Ka=2,Qa=3,Ja=4,Za=5,$a=6,tr=7,er=8;function ir(){}function sr(t){if(t instanceof Dt||t instanceof Rt||t instanceof Pt||t instanceof Ct||t instanceof It||t instanceof Tt)return t;switch(t instanceof Error||"object"===typeof t&&null!==t||kt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new Dt(t.message);case"InvalidPDFException":return new Rt(t.message);case"MissingPDFException":return new Pt(t.message);case"PasswordException":return new Ct(t.message,t.code);case"UnexpectedResponseException":return new It(t.message,t.status);case"UnknownErrorException":return new Tt(t.message,t.details)}return new Tt(t.message,t.toString())}var nr=new WeakMap,ar=new WeakSet,rr=new WeakSet,or=new WeakSet,lr=new WeakSet;class hr{constructor(t,e,i){(0,o.A)(this,lr),(0,o.A)(this,or),(0,o.A)(this,rr),(0,o.A)(this,ar),(0,l.A)(this,nr,{writable:!0,value:new AbortController}),this.sourceName=t,this.targetName=e,this.comObj=i,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),i.addEventListener("message",(0,h.A)(this,ar,cr).bind(this),{signal:(0,c.A)(this,nr).signal})}on(t,e){const i=this.actionHandler;if(i[t])throw new Error('There is already an actionName called "'.concat(t,'"'));i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const s=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[s]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,i,s){const n=this.streamId++,a=this.sourceName,r=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();return this.streamControllers[n]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:a,targetName:r,action:t,streamId:n,data:e,desiredSize:i.desiredSize},s),l.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[n].pullCall=e,o.postMessage({sourceName:a,targetName:r,stream:$a,streamId:n,desiredSize:t.desiredSize}),e.promise},cancel:t=>{St(t instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[n].cancelCall=e,this.streamControllers[n].isClosed=!0,o.postMessage({sourceName:a,targetName:r,stream
1:Ya,streamId:n,reason:sr(t)}),e.promise}},i)}destroy(){var t;null===(t=(0,c.A)(this,nr))||void 0===t||t.abort(),(0,d.A)(this,nr,null)}}function cr(t){let e=t.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void(0,h.A)(this,or,ur).call(this,e);if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error("Cannot resolve callback ".concat(t));if(delete this.callbackCapabilities[t],e.callback===qa)i.resolve(e.data);else{if(e.callback!==Xa)throw new Error("Unexpected callback case");i.reject(sr(e.reason))}return}const i=this.actionHandler[e.action];if(!i)throw new Error("Unknown action from worker: ".concat(e.action));if(e.callbackId){const t=this.sourceName,s=e.sourceName,n=this.comObj;Promise.try(i,e.data).then((function(i){n.postMessage({sourceName:t,targetName:s,callback:qa,callbackId:e.callbackId,data:i})}),(function(i){n.postMessage({sourceName:t,targetName:s,callback:Xa,callbackId:e.callbackId,reason:sr(i)})}))}else e.streamId?(0,h.A)(this,rr,dr).call(this,e):i(e.data)}function dr(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this,r=this.actionHandler[t.action],o={enqueue(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=a,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:i,targetName:s,stream:Ja,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:Qa,streamId:e}),delete a.streamSinks[e])},error(t){St(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:Za,streamId:e,reason:sr(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,Promise.try(r,t.data,o).then((function(){n.postMessage({sourceName:i,targetName:s,stream:er,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:i,targetName:s,stream:er,streamId:e,reason:sr(t)})}))}function ur(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this.streamControllers[e],r=this.streamSinks[e];switch(t.stream){case er:t.success?a.startCall.resolve():a.startCall.reject(sr(t.reason));break;case tr:t.success?a.pullCall.resolve():a.pullCall.reject(sr(t.reason));break;case $a:if(!r){n.postMessage({sourceName:i,targetName:s,stream:tr,streamId:e,success:!0});break}r.desiredSize<=0&&t.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=t.desiredSize,Promise.try(r.onPull||ir).then((function(){n.postMessage({sourceName:i,targetName:s,stream:tr,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:i,targetName:s,stream:tr,streamId:e,reason:sr(t)})}));break;case Ja:if(St(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case Qa:if(St(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),(0,h.A)(this,lr,Ar).call(this,a,e);break;case Za:St(a,"error should have stream controller"),a.controller.error(sr(t.reason)),(0,h.A)(this,lr,Ar).call(this,a,e);break;case Ka:t.success?a.cancelCall.resolve():a.cancelCall.reject(sr(t.reason)),(0,h.A)(this,lr,Ar).call(this,a,e);break;case Ya:if(!r)break;const o=sr(t.reason);Promise.try(r.onCancel||ir,o).then((function(){n.postMessage({sourceName:i,targetName:s,stream:Ka,streamId:e,success:!0})}),(function(t){n.postMessage({sourceName:i,targetName:s,stream:Ka,streamId:e,reason:sr(t)})})),r.sinkCapability.reject(o),r.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async function Ar(t,e){var i,s,n;await Promise.allSettled([null===(i=t.startCall)||void 0===i?void 0:i.promise,null===(s=t.pullCall)||void 0===s?void 0:s.promise,null===(n=t.cancelCall)||void 0===n?void 0:n.promise]),delete this.streamControllers[e]}var pr=new WeakMap;class gr{constructor(t){let e=t.enableHWA,i=void 0!==e&&e;(0,l.A)(this,pr,{writable:!0,value:!1}),(0,d.A)(this,pr,i)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!(0,c.A)(this,pr)})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){kt("Abstract method `_createCanvas` called.")}}
1class fr{constructor(t){let e=t.baseUrl,i=void 0===e?null:e,s=t.isCompressed,n=void 0===s||s;this.baseUrl=i,this.isCompressed=n}async fetch(t){let e=t.name;if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(i).then((t=>({cMapData:t,isCompressed:this.isCompressed}))).catch((t=>{throw new Error("Unable to load ".concat(this.isCompressed?"binary ":"","CMap at: ").concat(i))}))}async _fetch(t){kt("Abstract method `_fetch` called.")}}class vr extends fr{async _fetch(t){const e=await Qt(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Wt(e)}}class mr{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,s,n){return"none"}destroy(){}}var wr=new WeakMap,br=new WeakMap,_r=new WeakMap,yr=new WeakMap,kr=new WeakMap,Sr=new WeakMap,xr=new WeakMap,Mr=new WeakMap,Er=new WeakMap,Cr=new WeakMap,Tr=new WeakSet,Rr=new WeakSet,Pr=new WeakSet,Ir=new WeakSet,Lr=new WeakSet,Dr=new WeakSet,Fr=new WeakSet,Wr=new WeakSet,Nr=new WeakSet;function Or(){return(0,c.A)(this,br)||(0,d.A)(this,br,new Map)}function Br(){return(0,c.A)(this,Sr)||(0,d.A)(this,Sr,new Map)}function Hr(){if(!(0,c.A)(this,_r)){const t=(0,c.A)(this,kr).createElement("div"),e=t.style;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;const i=(0,c.A)(this,kr).createElementNS(Yt,"svg");i.setAttribute("width",0),i.setAttribute("height",0),(0,d.A)(this,_r,(0,c.A)(this,kr).createElementNS(Yt,"defs")),t.append(i),i.append((0,c.A)(this,_r)),(0,c.A)(this,kr).body.append(t)}return(0,c.A)(this,_r)}function zr(t){if(1===t.length){const e=t[0],i=new Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;const s=i.join(",");return[s,s,s]}const e=(0,b.A)(t,3),i=e[0],s=e[1],n=e[2],a=new Array(256),r=new Array(256),o=new Array(256);for(let l=0;l<256;l++)a[l]=i[l]/255,r[l]=s[l]/255,o[l]=n[l]/255;return[a.join(","),r.join(","),o.join(",")]}function jr(t){if(void 0===(0,c.A)(this,wr)){(0,d.A)(this,wr,"");const t=(0,c.A)(this,kr).URL;t!==(0,c.A)(this,kr).baseURI&&($t(t)?yt('#createUrl: ignore "data:"-URL for performance reasons.'):(0,d.A)(this,wr,t.split("#",1)[0]))}return"url(".concat((0,c.A)(this,wr),"#").concat(t,")")}function Gr(t){const e=(0,c.A)(this,kr).createElementNS(Yt,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}function Vr(t){const e=(0,c.A)(this,kr).createElementNS(Yt,"feColorMatrix");e.setAttribute("type","matrix"),e.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"),t.append(e)}function Ur(t){const e=(0,c.A)(this,kr).createElementNS(Yt,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),(0,c.A)(this,Cr).append(e),e}function qr(t,e,i){const s=(0,c.A)(this,kr).createElementNS(Yt,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),t.append(s)}function Xr(t,e,i,s){const n=(0,c.A)(this,kr).createElementNS(Yt,"feComponentTransfer");
1s.append(n),(0,h.A)(this,Dr,qr).call(this,n,"feFuncR",t),(0,h.A)(this,Dr,qr).call(this,n,"feFuncG",e),(0,h.A)(this,Dr,qr).call(this,n,"feFuncB",i)}function Yr(t,e){const i=(0,c.A)(this,kr).createElementNS(Yt,"feComponentTransfer");e.append(i),(0,h.A)(this,Dr,qr).call(this,i,"feFuncA",t)}function Kr(t){return(0,c.A)(this,Cr).style.color=t,ce(getComputedStyle((0,c.A)(this,Cr)).getPropertyValue("color"))}class Qr{constructor(t){let e=t.baseUrl,i=void 0===e?null:e;this.baseUrl=i}async fetch(t){let e=t.filename;if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const i="".concat(this.baseUrl).concat(e);return this._fetch(i).catch((t=>{throw new Error("Unable to load font data at: ".concat(i))}))}async _fetch(t){kt("Abstract method `_fetch` called.")}}class Jr extends Qr{async _fetch(t){const e=await Qt(t,"arraybuffer");return new Uint8Array(e)}}async function Zr(t){const e=process.getBuiltinModule("fs"),i=await e.promises.readFile(t);return new Uint8Array(i)}k&&yt("Please use the `legacy` build in Node.js environments.");const $r="Fill",to="Stroke",eo="Shading";function io(t,e){if(!e)return;const i=e[2]-e[0],s=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],i,s),t.clip(n)}class so{getPattern(){kt("Abstract method `getPattern` called.")}}class no extends so{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,s){let n;if(s===to||s===$r){const a=e.current.getClippedPathBoundingBox(s,de(t))||[0,0,0,0],r=Math.ceil(a[2]-a[0])||1,o=Math.ceil(a[3]-a[1])||1,l=e.cachedCanvases.getCanvas("pattern",r,o),h=l.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-a[0],-a[1]),i=Ht.transform(i,[1,0,0,1,a[0],a[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),io(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),n=t.createPattern(l.canvas,"no-repeat");const c=new DOMMatrix(i);n.setTransform(c)}else io(t,this._bbox),n=this._createGradient(t);return n}}function ao(t,e,i,s,n,a,r,o){const l=e.coords,h=e.colors,c=t.data,d=4*t.width;let u;l[i+1]>l[s+1]&&(u=i,i=s,s=u,u=a,a=r,r=u),l[s+1]>l[n+1]&&(u=s,s=n,n=u,u=r,r=o,o=u),l[i+1]>l[s+1]&&(u=i,i=s,s=u,u=a,a=r,r=u);const A=(l[i]+e.offsetX)*e.scaleX,p=(l[i+1]+e.offsetY)*e.scaleY,g=(l[s]+e.offsetX)*e.scaleX,f=(l[s+1]+e.offsetY)*e.scaleY,v=(l[n]+e.offsetX)*e.scaleX,m=(l[n+1]+e.offsetY)*e.scaleY;if(p>=m)return;const w=h[a],b=h[a+1],_=h[a+2],y=h[r],k=h[r+1],S=h[r+2],x=h[o],M=h[o+1],E=h[o+2],C=Math.round(p),T=Math.round(m);let R,P,I,L,D,F,W,N;for(let O=C;O<=T;O++){if(O<f){const t=O<p?0:(p-O)/(p-f);R=A-(A-g)*t,P=w-(w-y)*t,I=b-(b-k)*t,L=_-(_-S)*t}else{let t;t=O>m?1:f===m?0:(f-O)/(f-m),R=g-(g-v)*t,P=y-(y-x)*t,I=k-(k-M)*t,L=S-(S-E)*t}let t;t=O<p?0:O>m?1:(p-O)/(p-m),D=A-(A-v)*t,F=w-(w-x)*t,W=b-(b-M)*t,N=_-(_-E)*t;const e=Math.round(Math.min(R,D)),i=Math.round(Math.max(R,D));let s=d*O+4*e;for(let n=e;n<=i;n++)t=(R-n)/(R-D),t<0?t=0:t>1&&(t=1),c[s++]=P-(P-F)*t|0,c[s++]=I-(I-W)*t|0,c[s++]=L-(L-N)*t|0,c[s++]=255}}function ro(t,e,i){const s=e.coords,n=e.colors;let a,r;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(s.length/o)-1,h=o-1;for(a=0;a<l;a++){let e=a*o;for(let a=0;a<h;a++,e++)ao(t,i,s[e],s[e+1],s[e+o],n[e],n[e+1],n[e+o]),ao(t,i,s[e+o+1],s[e+1],s[e+o],n[e+o+1],n[e+1],n[e+o])}break;case"triangles":for(a=0,r=s.length;a<r;a+=3)ao(t,i,s[a],s[a+1],s[a+2],n[a],n[a+1],n[a+2]);break;default:throw new Error("illegal figure")}}class oo extends so{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,i){const s=Math.floor(this._bounds[0]),n=Math.floor(this._bounds[1]),a=Math.ceil(this._bounds[2])-s,r=Math.ceil(this._bounds[3])-n,o=Math.min(Math.ceil(Math.abs(a*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(r*t[1]*1.1)),3e3),h=a/o,c=r/l,d={coords:this._coords,colors:this._colors,offsetX:-s,offsetY:-n,scaleX:1/h,scaleY:1/c}
1,u=o+4,A=l+4,p=i.getCanvas("mesh",u,A),g=p.context,f=g.createImageData(o,l);if(e){const t=f.data;for(let i=0,s=t.length;i<s;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(const v of this._figures)ro(f,v,d);g.putImageData(f,2,2);return{canvas:p.canvas,offsetX:s-2*h,offsetY:n-2*c,scaleX:h,scaleY:c}}getPattern(t,e,i,s){let n;if(io(t,this._bbox),s===eo)n=Ht.singularValueDecompose2dScale(de(t));else if(n=Ht.singularValueDecompose2dScale(e.baseTransform),this.matrix){const t=Ht.singularValueDecompose2dScale(this.matrix);n=[n[0]*t[0],n[1]*t[1]]}const a=this._createMeshCanvas(n,s===eo?null:this._background,e.cachedCanvases);return s!==eo&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY),t.createPattern(a.canvas,"no-repeat")}}class lo extends so{getPattern(){return"hotpink"}}const ho=1,co=2;class uo{constructor(t,e,i,s,n){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=i,this.canvasGraphicsFactory=s,this.baseTransform=n}createPatternCanvas(t){const e=this.bbox,i=this.operatorList,s=this.paintType,n=this.tilingType,a=this.color,r=this.canvasGraphicsFactory;let o=this.xstep,l=this.ystep;o=Math.abs(o),l=Math.abs(l),_t("TilingType: "+n);const h=e[0],c=e[1],d=e[2],u=e[3],A=d-h,p=u-c,g=Ht.singularValueDecompose2dScale(this.matrix),f=Ht.singularValueDecompose2dScale(this.baseTransform),v=g[0]*f[0],m=g[1]*f[1];let w=A,b=p,_=!1,y=!1;const k=Math.ceil(o*v),S=Math.ceil(l*m);k>=Math.ceil(A*v)?w=o:_=!0,S>=Math.ceil(p*m)?b=l:y=!0;const x=this.getSizeAndScale(w,this.ctx.canvas.width,v),M=this.getSizeAndScale(b,this.ctx.canvas.height,m),E=t.cachedCanvases.getCanvas("pattern",x.size,M.size),C=E.context,T=r.createCanvasGraphics(C);if(T.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(T,s,a),C.translate(-x.scale*h,-M.scale*c),T.transform(x.scale,0,0,M.scale,0,0),C.save(),this.clipBbox(T,h,c,d,u),T.baseTransform=de(T.ctx),T.executeOperatorList(i),T.endDrawing(),C.restore(),_||y){const e=E.canvas;_&&(w=o),y&&(b=l);const i=this.getSizeAndScale(w,this.ctx.canvas.width,v),s=this.getSizeAndScale(b,this.ctx.canvas.height,m),n=i.size,a=s.size,r=t.cachedCanvases.getCanvas("pattern-workaround",n,a),d=r.context,u=_?Math.floor(A/o):0,g=y?Math.floor(p/l):0;for(let t=0;t<=u;t++)for(let i=0;i<=g;i++)d.drawImage(e,n*t,a*i,n,a,0,0,n,a);return{canvas:r.canvas,scaleX:i.scale,scaleY:s.scale,offsetX:h,offsetY:c}}return{canvas:E.canvas,scaleX:x.scale,scaleY:M.scale,offsetX:h,offsetY:c}}getSizeAndScale(t,e,i){const s=Math.max(uo.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*i);return n>=s?n=s:i=n/t,{scale:i,size:n}}clipBbox(t,e,i,s,n){const a=s-e,r=n-i;t.ctx.rect(e,i,a,r),t.current.updateRectMinMax(de(t.ctx),[e,i,s,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const s=t.ctx,n=t.current;switch(e){case ho:const t=this.ctx;s.fillStyle=t.fillStyle,s.strokeStyle=t.strokeStyle,n.fillColor=t.fillStyle,n.strokeColor=t.strokeStyle;break;case co:const a=Ht.makeHexColor(i[0],i[1],i[2]);s.fillStyle=a,s.strokeStyle=a,n.fillColor=a,n.strokeColor=a;break;default:throw new Lt("Unsupported paint type: ".concat(e))}}getPattern(t,e,i,s){let n=i;s!==eo&&(n=Ht.transform(n,e.baseTransform),this.matrix&&(n=Ht.transform(n,this.matrix)));const a=this.createPatternCanvas(e);let r=new DOMMatrix(n);r=r.translate(a.offsetX,a.offsetY),r=r.scale(1/a.scaleX,1/a.scaleY);const o=t.createPattern(a.canvas,"repeat");return o.setTransform(r),o}}function Ao(t){let e=t.src,i=t.srcPos,s=void 0===i?0:i,n=t.dest,a=t.width,r=t.height,o=t.nonBlackColor,l=void 0===o?4294967295:o,h=t.inverseDecode;const c=Ot.isLittleEndian?4278190080:255,d=void 0!==h&&h?[l,c]:[c,l],u=(0,b.A)(d,2),A=u[0],p=u[1],g=a>>3,f=7&a,v=e.length;n=new Uint32Array(n.buffer);let m=0;for(let w=0;w<r;w++){for(const i=s+g;s<i;s++){const t=s<v?e[s]:255;n[m++]=128&t?p:A,n[m++]=64&t?p:A,n[m++]=32&t?p:A,n[m++]=16&t?p:A,n[m++]=8&t?p:A,n[m++]=4&t?p:A,n[m++]=2&t?p:A,n[m++]=1&t?p:A}if(0===f)continue;const t=s<v?e[s++]:255;for(let e=0;e<f;e++)n[m++]=t&1<<7-e?p:A}return{srcPos:s,destPos:m}}(0,m.A)(uo,"MAX_PATTERN_SIZE",3e3);const po=16;class go{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let s;return void 0!==this.cache[t]?(s=this.cache[t],this.canvasFactory.reset(s,e,i)):(s=this.canvasFactory.create(e,i),this.cache[t]=s),s}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function fo(t,e,i,s,n,a,r,o,l,h){const c=de(t),d=(0,b.A)(c,6),u=d[0],A=d[1],p=d[2],g=d[3],f=d[4],v=d[5];if(0===A&&0===p){const c=r*u+f,d=Math.round(c),m=o*g+v,w=Math.round(m),b=(r+l)*u+f,_=Math.abs(Math.round(b)-d)||1,y=(o+h)*g+v,k=Math.abs(Math.round(y)-w)||1;return t.setTransform(Math.sign(u),0,0,Math.sign(g),d,w),t.drawImage(e,i,s,n,a,0,0,_,k),t.setTransform(u,A,p,g,f,v),[_,k]}if(0===u&&0===g){const c=o*p+f,d=Math.round(c),m=r*A+v,w=Math.round(m),b=(o+h)*p+f,_=Math.abs(Math.round(b)-d)||1,y=(r+l)*A+v,k=Math.abs(Math.round(y)-w)||1;return t.setTransform(0,Math.sign(A),Math.sign(p),0,d,w),t.drawImage(e,i,s,n,a,0,0,k,_),t.setTransform(u,A,p,g,f,v),[k,_]}t.drawImage(e,i,s,n,a,r,o,l,h);return[Math.hypot(u,A)*l,Math.hypot(p,g)*h]}class vo{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=S,this.textMatrixScale=1,this.fontMatrix=x,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=B,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.patternStroke=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,i){var s=Ht.applyTransform([e,i],t),n=(0,b.A)(s,2);e=n[0],i=n[1],this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,e){const i=Ht.applyTransform(e,t),s=Ht.applyTransform(e.slice(2),t),n=Ht.applyTransform([e[0],e[3]],t),a=Ht.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],s[0],n[0],a[0]),this.minY=Math.min(this.minY,i[1],s[1],n[1],a[1]),this.maxX=Math.max(this.maxX,i[0],s[0],n[0],a[0]),this.maxY=Math.max(this.maxY,i[1],s[1],n[1],a[1])}updateScalingPathMinMax(t,e){Ht.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,i,s,n,a,r,o,l,h){const c=Ht.bezierBoundingBox(e,i,s,n,a,r,o,l,h);h||this.updateRectMinMax(t,c)}getPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$r,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[this.minX,this.minY,this.maxX,this.maxY];if(t===to){e||kt("Stroke bounding box must include transform.");const t=Ht.singularValueDecompose2dScale(e),s=t[0]*this.lineWidth/2,n=t[1]*this.lineWidth/2;i[0]-=s,i[1]-=n,i[2]+=s,i[3]+=n}return i}updateClipFromPath(){const t=Ht.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$r,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Ht.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function mo(t,e){if(e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,s=e.width,n=i%po,a=(i-n)/po,r=0===n?a:a+1,o=t.createImageData(s,po);let l,h=0;const c=e.data,d=o.data;let u,A,p,g;if(e.kind===U.GRAYSCALE_1BPP){const e=c.byteLength,i=new Uint32Array(d.buffer,0,d.byteLength>>2),g=i.length,f=s+7>>3,v=4294967295,m=Ot.isLittleEndian?4278190080:255;for(u=0;
1u<r;u++){for(p=u<a?po:n,l=0,A=0;A<p;A++){const t=e-h;let n=0;const a=t>f?s:8*t-7,r=-8&a;let o=0,d=0;for(;n<r;n+=8)d=c[h++],i[l++]=128&d?v:m,i[l++]=64&d?v:m,i[l++]=32&d?v:m,i[l++]=16&d?v:m,i[l++]=8&d?v:m,i[l++]=4&d?v:m,i[l++]=2&d?v:m,i[l++]=1&d?v:m;for(;n<a;n++)0===o&&(d=c[h++],o=128),i[l++]=d&o?v:m,o>>=1}for(;l<g;)i[l++]=0;t.putImageData(o,0,u*po)}}else if(e.kind===U.RGBA_32BPP){for(A=0,g=s*po*4,u=0;u<a;u++)d.set(c.subarray(h,h+g)),h+=g,t.putImageData(o,0,A),A+=po;u<r&&(g=s*n*4,d.set(c.subarray(h,h+g)),t.putImageData(o,0,A))}else{if(e.kind!==U.RGB_24BPP)throw new Error("bad image kind: ".concat(e.kind));for(p=po,g=s*p,u=0;u<r;u++){for(u>=a&&(p=n,g=s*p),l=0,A=g;A--;)d[l++]=c[h++],d[l++]=c[h++],d[l++]=c[h++],d[l++]=255;t.putImageData(o,0,u*po)}}}function wo(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,s=e.width,n=i%po,a=(i-n)/po,r=0===n?a:a+1,o=t.createImageData(s,po);let l=0;const h=e.data,c=o.data;for(let d=0;d<r;d++){l=Ao({src:h,srcPos:l,dest:c,width:s,height:d<a?po:n,nonBlackColor:0}).srcPos,t.putImageData(o,0,d*po)}}function bo(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of i)void 0!==t[s]&&(e[s]=t[s]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function _o(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0),!k){const e=t.filter;"none"!==e&&""!==e&&(t.filter="none")}}function yo(t,e){if(e)return!0;const i=Ht.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*Kt.PDF_TO_CSS_UNITS);return i[0]<=s&&i[1]<=s}const ko=["butt","round","square"],So=["miter","round","bevel"],xo={},Mo={};var Eo=new WeakSet,Co=new WeakSet,To=new WeakSet;class Ro{constructor(t,e,i,s,n,a,r,l){let h=a.optionalContentConfig,c=a.markedContentStack,d=void 0===c?null:c;(0,o.A)(this,To),(0,o.A)(this,Co),(0,o.A)(this,Eo),this.ctx=t,this.current=new vo(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=s,this.filterFactory=n,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=d||[],this.optionalContentConfig=h,this.cachedCanvases=new go(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=r,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"===typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let e=t.transform,i=t.viewport,s=t.transparency,n=void 0!==s&&s,a=t.background,r=void 0===a?null:a;const o=this.ctx.canvas.width,l=this.ctx.canvas.height,h=this.ctx.fillStyle;if(this.ctx.fillStyle=r||"#ffffff",this.ctx.fillRect(0,0,o,l),this.ctx.fillStyle=h,n){const t=this.cachedCanvases.getCanvas("transparent",o,l);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...de(this.compositeCtx))}this.ctx.save(),_o(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=de(this.ctx)}executeOperatorList(t,e,i,s){const n=t.argsArray,a=t.fnArray;let r=e||0;const o=n.length;if(o===r)return r;const l=o-r>10&&"function"===typeof i,h=l?Date.now()+15:0;let c=0;const d=this.commonObjs,u=this.objs;let A;for(;;){if(void 0!==s&&r===s.nextBreakPoint)return s.breakIt(r,i),r;
1if(A=a[r],A!==ft.dependency)this[A].apply(this,n[r]);else for(const t of n[r]){const e=t.startsWith("g_")?d:u;if(!e.has(t))return e.get(t,i),r}if(r++,r===o)return r;if(l&&++c>10){if(Date.now()>h)return i(),r;c=0}}}endDrawing(){(0,h.A)(this,Eo,Po).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),(0,h.A)(this,Co,Io).call(this)}_scaleImage(t,e){var i,s;const n=null!==(i=t.width)&&void 0!==i?i:t.displayWidth,a=null!==(s=t.height)&&void 0!==s?s:t.displayHeight;let r,o,l=Math.max(Math.hypot(e[0],e[1]),1),h=Math.max(Math.hypot(e[2],e[3]),1),c=n,d=a,u="prescale1";for(;l>2&&c>1||h>2&&d>1;){let e=c,i=d;l>2&&c>1&&(e=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c/2),l/=c/e),h>2&&d>1&&(i=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,h/=d/i),r=this.cachedCanvases.getCanvas(u,e,i),o=r.context,o.clearRect(0,0,e,i),o.drawImage(t,0,0,c,d,0,0,e,i),t=r.canvas,c=e,d=i,u="prescale1"===u?"prescale2":"prescale1"}return{img:t,paintWidth:c,paintHeight:d}}_createMaskCanvas(t){const e=this.ctx,i=t.width,s=t.height,n=this.current.fillColor,a=this.current.patternFill,r=de(e);let o,l,h,c;if((t.bitmap||t.data)&&t.count>1){const e=t.bitmap||t.data.buffer;l=JSON.stringify(a?r:[r.slice(0,4),n]),o=this._cachedBitmapsMap.get(e),o||(o=new Map,this._cachedBitmapsMap.set(e,o));const i=o.get(l);if(i&&!a){return{canvas:i,offsetX:Math.round(Math.min(r[0],r[2])+r[4]),offsetY:Math.round(Math.min(r[1],r[3])+r[5])}}h=i}h||(c=this.cachedCanvases.getCanvas("maskCanvas",i,s),wo(c.context,t));let d=Ht.transform(r,[1/i,0,0,-1/s,0,0]);d=Ht.transform(d,[1,0,0,1,0,-s]);const u=Ht.getAxialAlignedBoundingBox([0,0,i,s],d),A=(0,b.A)(u,4),p=A[0],g=A[1],f=A[2],v=A[3],m=Math.round(f-p)||1,w=Math.round(v-g)||1,_=this.cachedCanvases.getCanvas("fillCanvas",m,w),y=_.context,k=p,S=g;y.translate(-k,-S),y.transform(...d),h||(h=this._scaleImage(c.canvas,ue(y)),h=h.img,o&&a&&o.set(l,h)),y.imageSmoothingEnabled=yo(de(y),t.interpolate),fo(y,h,0,0,h.width,h.height,0,0,i,s),y.globalCompositeOperation="source-in";const x=Ht.transform(ue(y),[1,0,0,1,-k,-S]);return y.fillStyle=a?n.getPattern(e,this,x,$r):n,y.fillRect(0,0,i,s),o&&!a&&(this.cachedCanvases.delete("fillCanvas"),o.set(l,_.canvas)),{canvas:_.canvas,offsetX:Math.round(k),offsetY:Math.round(S)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=ko[t]}setLineJoin(t){this.ctx.lineJoin=So[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const i of t){var e=(0,b.A)(i,2);const t=e[0],s=e[1];switch(t){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=s;break;case"ca":this.current.fillAlpha=s,this.ctx.globalAlpha=s;break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask=s?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s)}}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(i,t,e);this.suspendedCtx=this.ctx,this.ctx=s.context;const n=this.ctx;n.setTransform(...de(this.suspendedCtx)),bo(this.suspendedCtx,n),function(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()}
1,t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,s,n,a,r){e.transform(t,i,s,n,a,r),this.__originalTransform(t,i,s,n,a,r)},t.setTransform=function(t,i,s,n,a,r){e.setTransform(t,i,s,n,a,r),this.__originalSetTransform(t,i,s,n,a,r)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,s,n,a,r){e.bezierCurveTo(t,i,s,n,a,r),this.__originalBezierCurveTo(t,i,s,n,a,r)},t.rect=function(t,i,s,n){e.rect(t,i,s,n),this.__originalRect(t,i,s,n)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(n,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(),bo(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,i,s){const n=s[0],a=s[1],r=s[2]-n,o=s[3]-a;0!==r&&0!==o&&(this.genericComposeSMask(e.context,i,r,o,e.subtype,e.backdrop,e.transferMap,n,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,s,n,a,r,o,l,h,c){let d=t.canvas,u=o-h,A=l-c;if(a){const e=Ht.makeHexColor(...a);if(u<0||A<0||u+i>d.width||A+s>d.height){const t=this.cachedCanvases.getCanvas("maskExtension",i,s),n=t.context;n.drawImage(d,-u,-A),n.globalCompositeOperation="destination-atop",n.fillStyle=e,n.fillRect(0,0,i,s),n.globalCompositeOperation="source-over",d=t.canvas,u=A=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const n=new Path2D;n.rect(u,A,i,s),t.clip(n),t.globalCompositeOperation="destination-atop",t.fillStyle=e,t.fillRect(u,A,i,s),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===n&&r?e.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===n&&(e.filter=this.filterFactory.addLuminosityFilter(r));const p=new Path2D;p.rect(o,l,i,s),e.clip(p),e.globalCompositeOperation="destination-in",e.drawImage(d,u,A,i,s,o,l,i,s),e.restore()}save(){this.inSMaskMode?(bo(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),bo(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,s,n,a){this.ctx.transform(t,e,i,s,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){const s=this.ctx,n=this.current;let a,r,o=n.x,l=n.y;const h=de(s),c=0===h[0]&&0===h[3]||0===h[1]&&0===h[2],d=c?i.slice(0):null;for(let u=0,A=0,p=t.length;u<p;u++)switch(0|t[u]){case ft.rectangle:o=e[A++],l=e[A++];const t=e[A++],i=e[A++],u=o+t,p=l+i;s.moveTo(o,l),0===t||0===i?s.lineTo(u,p):(s.lineTo(u,l),s.lineTo(u,p),s.lineTo(o,p)),c||n.updateRectMinMax(h,[o,l,u,p]),s.closePath();break;case ft.moveTo:o=e[A++],l=e[A++],s.moveTo(o,l),c||n.updatePathMinMax(h,o,l);break;case ft.lineTo:o=e[A++],l=e[A++],s.lineTo(o,l),c||n.updatePathMinMax(h,o,l);break;case ft.curveTo:a=o,r=l,o=e[A+4],l=e[A+5],s.bezierCurveTo(e[A],e[A+1],e[A+2],e[A+3],o,l),n.updateCurvePathMinMax(h,a,r,e[A],e[A+1],e[A+2],e[A+3],o,l,d),A+=6;break;case ft.curveTo2:a=o,r=l,s.bezierCurveTo(o,l,e[A],e[A+1],e[A+2],e[A+3]),n.updateCurvePathMinMax(h,a,r,o,l,e[A],e[A+1],e[A+2],e[A+3],d),o=e[A+2],l=e[A+3],A+=4;break;case ft.curveTo3:a=o,r=l,o=e[A+2],l=e[A+3],s.bezierCurveTo(e[A],e[A+1],o,l,o,l),n.updateCurvePathMinMax(h,a,r,e[A],e[A+1],o,l,o,l,d),A+=4;break;case ft.closePath:s.closePath()}c&&n.updateScalingPathMinMax(h,d),n.setCurrentPoint(o,l)}closePath(){this.ctx.closePath()}stroke(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"===typeof i&&null!==i&&void 0!==i&&i.getPattern?(e.save(),e.strokeStyle=i.getPattern(e,this,ue(e),to),this.rescaleAndStroke(!1),e.restore(
1)):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.ctx,i=this.current.fillColor;let s=!1;this.current.patternFill&&(e.save(),e.fillStyle=i.getPattern(e,this,ue(e),$r),s=!0);const n=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==n&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),s&&e.restore(),t&&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=xo}eoClip(){this.pendingClip=Mo}beginText(){this.current.textMatrix=S,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(void 0===t)return void e.beginPath();const i=new Path2D,s=e.getTransform().invertSelf();for(const n of t){const t=n.transform,e=n.x,a=n.y,r=n.fontSize,o=n.path;i.addPath(o,new DOMMatrix(t).preMultiplySelf(s).translate(e,a).scale(r,-r))}e.clip(i),e.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var i;const s=this.commonObjs.get(t),n=this.current;if(!s)throw new Error("Can't find font for ".concat(t));if(n.fontMatrix=s.fontMatrix||x,0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||yt("Invalid font matrix for font "+t),e<0?(e=-e,n.fontDirection=-1):n.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;const a=s.loadedName||"sans-serif",r=(null===(i=s.systemFontInfo)||void 0===i?void 0:i.css)||'"'.concat(a,'", ').concat(s.fallbackName);let o="normal";s.black?o="900":s.bold&&(o="bold");const l=s.italic?"italic":"normal";let h=e;e<16?h=16:e>100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font="".concat(l," ").concat(o," ").concat(h,"px ").concat(r)}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,i,s,n,a){this.current.textMatrix=[t,e,i,s,n,a],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,s,n){const a=this.ctx,r=this.current,o=r.font,l=r.textRenderingMode,c=r.fontSize/r.fontSizeScale,d=l&G,u=!!(l&V),A=r.patternFill&&!o.missingFile,p=r.patternStroke&&!o.missingFile;let g;if((o.disableFontFace||u||A||p)&&(g=o.getPathGenerator(this.commonObjs,t)),o.disableFontFace||A||p){if(a.save(),a.translate(e,i),a.scale(c,-c),d===B||d===z)if(s){const t=a.getTransform();a.setTransform(...s),a.fill((0,h.A)(this,To,Lo).call(this,g,t,s))}else a.fill(g);if(d===H||d===z)if(n){const t=a.getTransform();a.setTransform(...n),a.stroke((0,h.A)(this,To,Lo).call(this,g,t,n))}else a.lineWidth/=c,a.stroke(g);a.restore()}else d!==B&&d!==z||a.fillText(t,e,i),d!==H&&d!==z||a.strokeText(t,e,i);if(u){(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:de(a),x:e,y:i,fontSize:c,path:g})}}get isFontSubpixelAAEnabled(){const t=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10).context;t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let i=!1;for(let s=3;s<e.length;s+=4)if(e[s]>0&&e[s]<255){i=!0;break}return Mt(this,"isFontSubpixelAAEnabled",i)}showText(t){const e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(t);const s=e.fontSize;if(0===s)return;const n=this.ctx,a=e.fontSizeScale,r=e.charSpacing,o=e.wordSpacing,l=e.fontDirection,h=e.textHScale*l,c=t.length,d=i.vertical,u=d?1:-1,A=i.defaultVMetrics,p=s*e.fontMatrix[0],g=e.textRenderingMode===B&&
1!i.disableFontFace&&!e.patternFill;let f,v;if(n.save(),n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),l>0?n.scale(h,-1):n.scale(h,1),e.patternFill){n.save();const t=e.fillColor.getPattern(n,this,ue(n),$r);f=de(n),n.restore(),n.fillStyle=t}if(e.patternStroke){n.save();const t=e.strokeColor.getPattern(n,this,ue(n),to);v=de(n),n.restore(),n.strokeStyle=t}let m=e.lineWidth;const w=e.textMatrixScale;if(0===w||0===m){const t=e.textRenderingMode&G;t!==H&&t!==z||(m=this.getSinglePixelWidth())}else m/=w;if(1!==a&&(n.scale(a,a),m/=a),n.lineWidth=m,i.isInvalidPDFjsFont){const i=[];let s=0;for(const e of t)i.push(e.unicode),s+=e.width;return n.fillText(i.join(""),0,0),e.x+=s*p*h,n.restore(),void this.compose()}let b,_=0;for(b=0;b<c;++b){const e=t[b];if("number"===typeof e){_+=u*e*s/1e3;continue}let h=!1;const c=(e.isSpace?o:0)+r,m=e.fontChar,w=e.accent;let y,k,S=e.width;if(d){const t=e.vmetric||A,i=-(e.vmetric?t[1]:.5*S)*p,s=t[2]*p;S=t?-t[0]:S,y=i/a,k=(_+s)/a}else y=_/a,k=0;if(i.remeasure&&S>0){const t=1e3*n.measureText(m).width/s*a;if(S<t&&this.isFontSubpixelAAEnabled){const e=S/t;h=!0,n.save(),n.scale(e,1),y/=e}else S!==t&&(y+=(S-t)/2e3*s/a)}if(this.contentVisible&&(e.isInFont||i.missingFile))if(g&&!w)n.fillText(m,y,k);else if(this.paintChar(m,y,k,f,v),w){const t=y+s*w.offset.x/a,e=k-s*w.offset.y/a;this.paintChar(w.fontChar,t,e,f,v)}_+=d?S*p-c*l:S*p+c*l,h&&n.restore()}d?e.y-=_:e.x+=_*h,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,i=this.current,s=i.font,n=i.fontSize,a=i.fontDirection,r=s.vertical?1:-1,o=i.charSpacing,l=i.wordSpacing,h=i.textHScale*a,c=i.fontMatrix||x,d=t.length;let u,A,p,g;if(!(i.textRenderingMode===j)&&0!==n){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...i.textMatrix),e.translate(i.x,i.y),e.scale(h,a),u=0;u<d;++u){if(A=t[u],"number"===typeof A){g=r*A*n/1e3,this.ctx.translate(g,0),i.x+=g*h;continue}const a=(A.isSpace?l:0)+o,d=s.charProcOperatorList[A.operatorListId];if(!d){yt('Type3 character "'.concat(A.operatorListId,'" is not available.'));continue}this.contentVisible&&(this.processingType3=A,this.save(),e.scale(n,n),e.transform(...c),this.executeOperatorList(d),this.restore());p=Ht.applyTransform([A.width,0],c)[0]*n+a,e.translate(p,0),i.x+=p*h}e.restore(),this.processingType3=null}}setCharWidth(t,e){}
1setCharWidthAndBounds(t,e,i,s,n,a){this.ctx.rect(i,s,n-i,a-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){const i=t[1],s=this.baseTransform||de(this.ctx),n={createCanvasGraphics:t=>new Ro(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new uo(t,i,this.ctx,n,s)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){this.ctx.strokeStyle=this.current.strokeColor=Ht.makeHexColor(t,e,i),this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e,i){this.ctx.fillStyle=this.current.fillColor=Ht.makeHexColor(t,e,i),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(t)?e=this.cachedPatterns.get(t):(e=function(t){switch(t[0]){case"RadialAxial":return new no(t);case"Mesh":return new oo(t);case"Dummy":return new lo}throw new Error("Unknown IR type: ".concat(t[0]))}(this.getObject(t)),this.cachedPatterns.set(t,e)),i&&(e.matrix=i),e}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,ue(e),eo);const s=ue(e);if(s){const t=e.canvas,i=t.width,n=t.height,a=Ht.getAxialAlignedBoundingBox([0,0,i,n],s),r=(0,b.A)(a,4),o=r[0],l=r[1],h=r[2],c=r[3];this.ctx.fillRect(o,l,h-o,c-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){kt("Should not call beginInlineImage")}beginImageData(){kt("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=de(this.ctx),e)){const t=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],t,i),this.current.updateRectMinMax(de(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;
1t.isolated||_t("TODO: Support non-isolated groups."),t.knockout&&yt("Knockout groups not supported.");const i=de(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let s=Ht.getAxialAlignedBoundingBox(t.bbox,de(e));const n=[0,0,e.canvas.width,e.canvas.height];s=Ht.intersect(s,n)||[0,0,0,0];const a=Math.floor(s[0]),r=Math.floor(s[1]),o=Math.max(Math.ceil(s[2])-a,1),l=Math.max(Math.ceil(s[3])-r,1);this.current.startNewPathAndClipBox([0,0,o,l]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const c=this.cachedCanvases.getCanvas(h,o,l),d=c.context;d.translate(-a,-r),d.transform(...i),t.smask?this.smaskStack.push({canvas:c.canvas,context:d,offsetX:a,offsetY:r,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,r),e.save()),bo(e,d),this.ctx=d,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const t=de(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);const i=Ht.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,s,n){if((0,h.A)(this,Eo,Po).call(this),_o(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const s=e[2]-e[0],a=e[3]-e[1];if(n&&this.annotationCanvasMap){(i=i.slice())[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=s,e[3]=a;const n=Ht.singularValueDecompose2dScale(de(this.ctx)),r=(0,b.A)(n,2),o=r[0],l=r[1],h=this.viewportScale,c=Math.ceil(s*this.outputScaleX*h),d=Math.ceil(a*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(c,d);const u=this.annotationCanvas,A=u.canvas,p=u.context;this.annotationCanvasMap.set(t,A),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(o,0,0,-l,0,a*l),_o(this.ctx)}else _o(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],s,a),this.ctx.clip(),this.ctx.beginPath()}this.current=new vo(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),(0,h.A)(this,Co,Io).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;(t=this.getObject(t.data,t)).count=e;const i=this.ctx,s=this.processingType3;if(s&&(void 0===s.compiled&&(s.compiled=function(t){const e=t.width,i=t.height;if(e>1e3||i>1e3)return null;const s=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=e+1;let a,r,o,l=new Uint8Array(n*(i+1));const h=e+7&-8;let c=new Uint8Array(h*i),d=0;for(const g of t.data){let t=128;for(;t>0;)c[d++]=g&t?0:255,t>>=1}let u=0;for(d=0,0!==c[d]&&(l[0]=1,++u),r=1;r<e;r++)c[d]!==c[d+1]&&(l[r]=c[d]?2:1,++u),d++;for(0!==c[d]&&(l[r]=2,++u),a=1;a<i;a++){d=a*h,o=a*n,c[d-h]!==c[d]&&(l[o]=c[d]?1:8,++u);let t=(c[d]?4:0)+(c[d-h]?8:0);for(r=1;r<e;r++)t=(t>>2)+(c[d+1]?4:0)+(c[d-h+1]?8:0),s[t]&&(l[o+r]=s[t],++u),d++;if(c[d-h]!==c[d]&&(l[o+r]=c[d]?2:4,++u),u>1e3)return null}for(d=h*(i-1),o=a*n,0!==c[d]&&(l[o]=8,++u),r=1;r<e;r++)c[d]!==c[d+1]&&(l[o+r]=c[d]?4:8,++u),d++;if(0!==c[d]&&(l[o+r]=4,++u),u>1e3)return null;const A=new Int32Array([0,n,-1,0,-n,0,0,0,1]),p=new Path2D;for(a=0;u&&a<=i;a++){let t=a*n;const i=t+e;for(;t<i&&!l[t];)t++;if(t===i)continue;p.moveTo(t%n,a);const s=t;let r=l[t];do{const e=A[r];do{t+=e}while(!l[t]);const i=l[t];5!==i&&10!==i?(r=i,l[t]=0):(r=i&51*r>>4,l[t]&=r>>2|r<<2),p.lineTo(t%n,t/n|0),l[t]||--u}while(s!==t);--a}return c=null,l=null,function(t){t.save(),t.scale(1/e,-1/i),t.translate(0,-i),t.fill(p),t.beginPath(),t.restore()}}(t)),s.compiled))return void s.compiled(i);const n=this._createMaskCanvas(t),a=n.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,n.offsetX,n.offsetY),i.restore(
1),this.compose()}paintImageMaskXObjectRepeat(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;t=this.getObject(t.data,t);const r=this.ctx;r.save();const o=de(r);r.transform(e,i,s,n,0,0);const l=this._createMaskCanvas(t);r.setTransform(1,0,0,1,l.offsetX-o[4],l.offsetY-o[5]);for(let h=0,c=a.length;h<c;h+=2){const t=Ht.transform(o,[e,i,s,n,a[h],a[h+1]]),c=Ht.applyTransform([0,0],t),d=(0,b.A)(c,2),u=d[0],A=d[1];r.drawImage(l.canvas,u,A)}r.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;for(const n of t){const t=n.data,a=n.width,r=n.height,o=n.transform,l=this.cachedCanvases.getCanvas("maskCanvas",a,r),h=l.context;h.save();wo(h,this.getObject(t,n)),h.globalCompositeOperation="source-in",h.fillStyle=s?i.getPattern(h,this,ue(e),$r):i,h.fillRect(0,0,a,r),h.restore(
1),e.save(),e.transform(...o),e.scale(1,-1),fo(e,l.canvas,0,0,a,r,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):yt("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,s){if(!this.contentVisible)return;const n=this.getObject(t);if(!n)return void yt("Dependent image isn't ready yet");const a=n.width,r=n.height,o=[];for(let l=0,h=s.length;l<h;l+=2)o.push({transform:[e,0,0,i,s[l],s[l+1]],x:0,y:0,w:a,h:r});this.paintInlineImageXObjectGroup(n,o)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;const e=t.bitmap,i=t.width,s=t.height,n=this.cachedCanvases.getCanvas("inlineImage",i,s),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,i=t.height,s=this.ctx;if(this.save(),!k){const t=s.filter;"none"!==t&&""!==t&&(s.filter="none")}let n;if(s.scale(1/e,-1/i),t.bitmap)n=this.applyTransferMapsToBitmap(t);else if("function"===typeof HTMLElement&&t instanceof HTMLElement||!t.data)n=t;else{const s=this.cachedCanvases.getCanvas("inlineImage",e,i).context;mo(s,t),n=this.applyTransferMapsToCanvas(s)}const a=this._scaleImage(n,ue(s));s.imageSmoothingEnabled=yo(de(s),t.interpolate),fo(s,a.img,0,0,a.paintWidth,a.paintHeight,0,-i,e,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const i=this.ctx;let s;if(t.bitmap)s=t.bitmap;else{const e=t.width,i=t.height,n=this.cachedCanvases.getCanvas("inlineImage",e,i).context;mo(n,t),s=this.applyTransferMapsToCanvas(n)}for(const n of e)i.save(),i.transform(...n.transform),i.scale(1,-1),fo(i,s,n.x,n.y,n.w,n.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const i=this.ctx;this.pendingClip&&(e||(this.pendingClip===Mo?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=de(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const t=this.current.lineWidth,e=this.ctx.getTransform(),i=e.a,s=e.b,n=e.c,a=e.d;let r,o;if(0===s&&0===n){const e=Math.abs(i),s=Math.abs(a);if(e===s)if(0===t)r=o=1/e;else{const i=e*t;r=o=i<1?1/i:1}else if(0===t)r=1/e,o=1/s;else{const i=e*t,n=s*t;r=i<1?1/i:1,o=n<1?1/n:1}}else{const e=Math.abs(i*a-s*n),l=Math.hypot(i,s),h=Math.hypot(n,a);if(0===t)r=h/e,o=l/e;else{const i=t*e;r=h>i?h/i:1,o=l>i?l/i:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t){const e=this.ctx,i=this.current.lineWidth,s=this.getScaleForStroking(),n=(0,b.A)(s,2),a=n[0],r=n[1];if(e.lineWidth=i||1,1===a&&1===r)return void e.stroke();const o=e.getLineDash();if(t&&e.save(),e.scale(a,r),o.length>0){const t=Math.max(a,r);e.setLineDash(o.map((e=>e/t))),e.lineDashOffset/=t}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}function Po(){for(;this.stateStack.length||this.inSMaskMode;
1)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}function Io(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}function Lo(t,e,i){const s=new Path2D;return s.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),s}for(const uv in ft)void 0!==Ro.prototype[uv]&&(Ro.prototype[ft[uv]]=Ro.prototype[uv]);class Do{static get workerPort(){return v(this,Do,Fo)}static set workerPort(t){if(!("undefined"!==typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");g(this,Do,Fo,t)}static get workerSrc(){return v(this,Do,Wo)}static set workerSrc(t){if("string"!==typeof t)throw new Error("Invalid `workerSrc` type.");g(this,Do,Wo,t)}}var Fo={writable:!0,value:null},Wo={writable:!0,value:""},No=new WeakMap,Oo=new WeakMap;class Bo{constructor(t){let e=t.parsedData,i=t.rawData;(0,l.A)(this,No,{writable:!0,value:void 0}),(0,l.A)(this,Oo,{writable:!0,value:void 0}),(0,d.A)(this,No,e),(0,d.A)(this,Oo,i)}getRaw(){return(0,c.A)(this,Oo)}get(t){var e;return null!==(e=(0,c.A)(this,No).get(t))&&void 0!==e?e:null}getAll(){return Nt((0,c.A)(this,No))}has(t){return(0,c.A)(this,No).has(t)}}const Ho=Symbol("INTERNAL");var zo=new WeakMap,jo=new WeakMap,Go=new WeakMap,Vo=new WeakMap;class Uo{constructor(t,e){let i=e.name,s=e.intent,n=e.usage,a=e.rbGroups;(0,l.A)(this,zo,{writable:!0,value:!1}),(0,l.A)(this,jo,{writable:!0,value:!1}),(0,l.A)(this,Go,{writable:!0,value:!1}),(0,l.A)(this,Vo,{writable:!0,value:!0}),(0,d.A)(this,zo,!!(t&C)),(0,d.A)(this,jo,!!(t&T)),this.name=i,this.intent=s,this.usage=n,this.rbGroups=a}get visible(){if((0,c.A)(this,Go))return(0,c.A)(this,Vo);if(!(0,c.A)(this,Vo))return!1;const t=this.usage,e=t.print,i=t.view;return(0,c.A)(this,zo)?"OFF"!==(null===i||void 0===i?void 0:i.viewState):!(0,c.A)(this,jo)||"OFF"!==(null===e||void 0===e?void 0:e.printState)}_setVisible(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t!==Ho&&kt("Internal method `_setVisible` called."),(0,d.A)(this,Go,i),(0,d.A)(this,Vo,e)}}var qo=new WeakMap,Xo=new WeakMap,Yo=new WeakMap,Ko=new WeakMap,Qo=new WeakSet;class Jo{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C;if((0,o.A)(this,Qo),(0,l.A)(this,qo,{writable:!0,value:null}),(0,l.A)(this,Xo,{writable:!0,value:new Map}),(0,l.A)(this,Yo,{writable:!0,value:null}),(0,l.A)(this,Ko,{writable:!0,value:null}),this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,(0,d.A)(this,Ko,t.order);for(const i of t.groups)(0,c.A)(this,Xo).set(i.id,new Uo(e,i));if("OFF"===t.baseState)for(const t of(0,c.A)(this,Xo).values())t._setVisible(Ho,!1);for(const e of t.on)(0,c.A)(this,Xo).get(e)._setVisible(Ho,!0);for(const e of t.off)(0,c.A)(this,Xo).get(e)._setVisible(Ho,!1);(0,d.A)(this,Yo,this.getHash())}}isVisible(t){if(0===(0,c.A)(this,Xo).size)return!0;if(!t)return _t("Optional content group not defined."),!0;if("OCG"===t.type)return(0,c.A)(this,Xo).has(t.id)?(0,c.A)(this,Xo).get(t.id).visible:(yt("Optional content group not found: ".concat(t.id)),!0);if("OCMD"===t.type){if(t.expression)return(0,h.A)(this,Qo,Zo).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!(0,c.A)(this,Xo).has(e))return yt("Optional content group not found: ".concat(e)),!0;if((0,c.A)(this,Xo).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!(0,c.A)(this,Xo).has(e))return yt("Optional content group not found: ".concat(e)),!0;if(!(0,c.A)(this,Xo).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!(0,c.A)(this,Xo).has(e))return yt("Optional content group not found: ".concat(e)),!0;if(!(0,c.A)(this,Xo).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!(0,c.A)(this,Xo).has(e))return yt("Optional content group not found: ".concat(e)),!0;if((0,c.A)(this,Xo).get(e).visible)return!1}return!0}return yt("Unknown optional content policy ".concat(t.policy,".")),!0}return yt("Unknown group type ".concat(t.type,".")),!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=(0,c.A)(this,Xo).get(t);if(s){if(i&&e&&s.rbGroups.length)for(const e of s.rbGroups)for(const i of e){var n;if(i!==t)null===(n=(0,c.A)(this,Xo).get(i))||void 0===n||n._setVisible(Ho,!1,!0)}s._setVisible(Ho,!!e,!0),(0,d.A)(this,qo,null)}else yt("Optional content group not found: ".concat(t))}setOCGState(t){let e,i=t.state,s=t.preserveRB;for(const n of i){switch(n){case"ON":case"OFF":case"Toggle":e=n;continue}const t=(0,c.A)(this,Xo).get(n);if(t)switch(e){case"ON":this.setVisibility(n,!0,s);break;case"OFF":this.setVisibility(n,!1,s);break;case"Toggle":this.setVisibility(n,!t.visible,s)}}(0,d.A)(this,qo,null)}get hasInitialVisibility(){return null===(0,c.A)(this,Yo)||this.getHash()===(0,c.A)(this,Yo)}getOrder(){return(0,c.A)(this,Xo).size?(0,c.A)(this,Ko)?(0,c.A)(this,Ko).slice():[...(0,c.A)(this,Xo).keys()]:null}getGroups(){return(0,c.A)(this,Xo).size>0?Nt((0,c.A)(this,Xo)):null}getGroup(t){return(0,c.A)(this,Xo).get(t)||null}getHash(){if(null!==(0,c.A)(this,qo))return(0,c.A)(this,qo);const t=new La;for(const i of(0,c.A)(this,Xo)){var e=(0,b.A)(i,2);const s=e[0],n=e[1];t.update("".concat(s,":").concat(n.visible))}return(0,d.A)(this,qo,t.hexdigest())}}function Zo(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let s=1;s<e;s++){const e=t[s];let n;if(Array.isArray(e))n=(0,h.A)(this,Qo,Zo).call(this,e);else{if(!(0,c.A)(this,Xo).has(e))return yt("Optional content group not found: ".concat(e)),!0;n=(0,c.A)(this,Xo).get(e).visible}switch(i){case"And":if(!n)return!1;break;case"Or":if(n)return!0;break;case"Not":return!n;default:return!0}}return"And"===i}class $o{constructor(t,e){let i=e.disableRange,s=void 0!==i&&i,n=e.disableStream,a=void 0!==n&&n;St(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const r=t.length,o=t.initialData,l=t.progressiveDone,h=t.contentDispositionFilename;if(this._queuedChunks=[],this._progressiveDone=l,this._contentDispositionFilename=h,(null===o||void 0===o?void 0:o.length)>0){const t=o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!a,this._isRangeSupported=!s,this._contentLength=r,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener(((t,e)=>{this._onReceiveData({begin:t,chunk:e})})),t.addProgressListener(((t,e)=>{this._onProgress({loaded:t,total:e})})),t.addProgressiveReadListener((t=>{this._onReceiveData({chunk:t})})),t.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),t.transportReady()}_onReceiveData(t){let e=t.begin,i=t.chunk;const s=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{St(this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(s),!0)})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}_onProgress(t){var e,i,s,n;void 0===t.total?null===(e=this._rangeReaders[0])||void 0===e||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded}):null===(s=this._fullRequestReader)||void 0===s||null===(n=s.onProgress)||void 0===n||n.call(s,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;null===(t=this._fullRequestReader)||void 0===t||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){St(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new tl(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new el(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeReaders.slice(0))i.cancel(t);this._pdfDataRangeTransport.abort()}}class tl{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=t,this._done=i||!1,this._filename=te(s)?s:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;
1this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunks.push(t);this._loaded+=t.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class el{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function il(t,e){const i=new Headers;if(!t||!e||"object"!==typeof e)return i;for(const s in e){const t=e[s];void 0!==t&&i.append(s,t)}return i}function sl(t){try{return new URL(t).origin}catch(e){}return null}function nl(t){let e=t.responseHeaders,i=t.isHttp,s=t.rangeChunkSize,n=t.disableRange;const a={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e.get("Content-Length"),10);if(!Number.isInteger(r))return a;if(a.suggestedLength=r,r<=2*s)return a;if(n||!i)return a;if("bytes"!==e.get("Accept-Ranges"))return a;return"identity"!==(e.get("Content-Encoding")||"identity")||(a.allowRangeRequests=!0),a}function al(t){const e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=s("filename\\*","i").exec(t);if(i){i=i[1];let t=r(i);return t=unescape(t),t=o(t),t=l(t),a(t)}if(i=function(t){const e=[];let i;const n=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=n.exec(t));){let t=i,s=(0,b.A)(t,4),n=s[1],a=s[2],r=s[3];if(n=parseInt(n,10),n in e){if(0===n)break}else e[n]=[a,r]}const a=[];for(let s=0;s<e.length&&s in e;++s){let t=(0,b.A)(e[s],2),i=t[0],n=t[1];n=r(n),i&&(n=unescape(n),0===s&&(n=o(n))),a.push(n)}return a.join("")}(t),i)return a(l(i));if(i=s("filename","i").exec(t),i){i=i[1];let t=r(i);return t=l(t),a(t)}function s(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function n(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const s=new TextDecoder(t,{fatal:!0}),n=Wt(i);i=s.decode(n),e=!1}catch(s){}}return i}function a(t){return e&&/[\x80-\xff]/.test(t)&&(t=n("utf-8",t),e&&(t=n("iso-8859-1",t))),t}function r(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){const e=t.indexOf("'");return-1===e?t:n(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(t,e,i,s){if("q"===i||"Q"===i)return n(e,s=(s=s.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(t,e){return String.fromCharCode(parseInt(e,16))})));try{s=atob(s)}catch(a){}return n(e,s)}))}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(i){}if(te(t))return t}return null}function rl(t,e){return 404===t||0===t&&e.startsWith("file:")?new Pt('Missing PDF "'+e+'".'):new It("Unexpected server response 
1(".concat(t,') while retrieving PDF "').concat(e,'".'),t)}function ol(t){return 200===t||206===t}function ll(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function hl(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(yt("getArrayBuffer - unexpected data format: ".concat(t)),new Uint8Array(t).buffer)}class cl{constructor(t){(0,m.A)(this,"_responseOrigin",null),this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=il(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return St(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new dl(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new ul(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class dl{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const i=new Headers(t.headers),s=e.url;fetch(s,ll(i,this._withCredentials,this._abortController)).then((e=>{if(t._responseOrigin=sl(e.url),!ol(e.status))throw rl(e.status,s);this._reader=e.body.getReader(),this._headersCapability.resolve();const i=e.headers,n=nl({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange}),a=n.allowRangeRequests,r=n.suggestedLength;this._isRangeSupported=a,this._contentLength=r||this._contentLength,this._filename=al(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Dt("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 t;await this._headersCapability.promise;const e=await this._reader.read(),i=e.value,s=e.done;return s?{value:i,done:s}:(this._loaded+=i.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:hl(i),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class ul{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController;const n=new Headers(t.headers);n.append("Range","bytes=".concat(e,"-").concat(i-1));const a=s.url;fetch(a,ll(n,this._withCredentials,this._abortController)).then((e=>{const i=sl(e.url);if(i!==t._responseOrigin)throw new Error('Expected range response-origin "'.concat(i,'" to match "').concat(t._responseOrigin,'".'));if(!ol(e.status))throw rl(e.status,a);this._readCapability.resolve(),this._reader=e.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;const e=await this._reader.read(),i=e.value,s=e.done;return s?{value:i,done:s}:(this._loaded+=i.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),{value:hl(i),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class Al{constructor(t){let e=t.url,i=t.httpHeaders,s=t.withCredentials;(0,m.A)(this,"_responseOrigin",null),this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=il(this.isHttp,i),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,s=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const a of this.headers){var n=(0,b.A)(a,2);const t=n[0],i=n[1];e.setRequestHeader(t,i)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range","bytes=".concat(t.begin,"-").concat(t.end-1)),s.expectedStatus=206):s.expectedStatus=200,e.responseType="arraybuffer",St(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{t.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),s.onHeadersReceived=t.onHeadersReceived,s.onDone=t.onDone,s.onError=t.onError,s.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;const s=this.pendingRequests[t];s&&(null===(i=s.onProgress)||void 0===i||i.call(s,e))}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const s=i.xhr;if(s.readyState>
1=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==s.readyState)return;if(!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===s.status&&this.isHttp)return void i.onError(s.status);const n=s.status||200;if(!(200===n&&206===i.expectedStatus)&&n!==i.expectedStatus)return void i.onError(s.status);const a=function(t){const e=t.response;return"string"!==typeof e?e:Wt(e).buffer}(s);if(206===n){const t=s.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);e?i.onDone({begin:parseInt(e[1],10),chunk:a}):(yt('Missing or invalid "Content-Range" header.'),i.onError(0))}else a?i.onDone({begin:0,chunk:a}):i.onError(s.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class pl{constructor(t){this._source=t,this._manager=new Al(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return St(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new gl(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new fl(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class gl{constructor(t,e){this._manager=t,this._url=e.url,this._fullRequestId=t.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t);this._manager._responseOrigin=sl(e.responseURL);const i=e.getAllResponseHeaders(),s=new Headers(i?i.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map((t=>{const e=t.split(": "),i=(0,r.A)(e);return[i[0],i.slice(1).join(": ")]})):[]),n=nl({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange}),a=n.allowRangeRequests,o=n.suggestedLength;a&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=al(s),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t)if(this._requests.length>0){this._requests.shift().resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);if(this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=rl(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest
1(this._fullRequestId),this._fullRequestReader=null}}class fl{constructor(t,e,i){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:i,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var t;const e=sl(null===(t=this._manager.getRequestXhr(this._requestId))||void 0===t?void 0:t.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error('Expected range response-origin "'.concat(e,'" to match "').concat(this._manager._responseOrigin,'".')),this._onError(0))}_close(){var t;null===(t=this.onClosed)||void 0===t||t.call(this,this)}_onDone(t){const e=t.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunk=e;this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){var e;null!==(e=this._storedError)&&void 0!==e||(this._storedError=rl(t,this._url));for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded}))}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const vl=/^[a-z][a-z0-9\-+.]+:/i;class ml{constructor(t){this.source=t,this.url=function(t){if(vl.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}(t.url),St("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return St(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new wl(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new bl(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class wl{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const i=process.getBuiltinModule("fs");i.promises.lstat(this._url).then((t=>{this._contentLength=t.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()}),(t=>{"ENOENT"===t.code&&(t=new Pt('Missing PDF "'.concat(this._url,'".'))),this._storedError=t,this._headersCapability.reject(t)}))}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 t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",(()=>{this._readCapability.resolve()})),t.on("end",(()=>{t.destroy(),this._done=!0,this._readCapability.resolve()})),t.on("error",(t=>{this._error(t)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Dt("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class bl{constructor(t,e,i){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const s=t.source;this._isStreamingSupported=!s.disableStream;const n=process.getBuiltinModule("fs");this._setReadableStream(n.createReadStream(this._url,{start:e,end:i-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",(()=>{this._readCapability.resolve()})),t.on("end",(()=>{t.destroy(),this._done=!0,this._readCapability.resolve()})),t.on("error",(t=>{this._error(t)})),this._storedError&&this._readableStream.destroy(this._storedError)}}const _l=30;var yl=new WeakMap,kl=new WeakMap,Sl=new WeakMap,xl=new WeakMap,Ml=new WeakMap,El=new WeakMap,Cl=new WeakMap,Tl=new WeakMap,Rl=new WeakMap,Pl=new WeakMap,Il=new WeakMap,Ll=new WeakMap,Dl=new WeakMap,Fl=new WeakMap,Wl=new WeakMap,Nl=new WeakMap,Ol=new WeakMap,Bl=new WeakMap,Hl
1=new WeakSet,zl=new WeakSet,jl=new WeakSet;class Gl{constructor(t){var e;let i=t.textContentSource,s=t.container,n=t.viewport;if((0,o.A)(this,jl),(0,o.A)(this,zl),(0,o.A)(this,Hl),(0,l.A)(this,yl,{writable:!0,value:Promise.withResolvers()}),(0,l.A)(this,kl,{writable:!0,value:null}),(0,l.A)(this,Sl,{writable:!0,value:!1}),(0,l.A)(this,xl,{writable:!0,value:!(null===(e=globalThis.FontInspector)||void 0===e||!e.enabled)}),(0,l.A)(this,Ml,{writable:!0,value:null}),(0,l.A)(this,El,{writable:!0,value:null}),(0,l.A)(this,Cl,{writable:!0,value:0}),(0,l.A)(this,Tl,{writable:!0,value:0}),(0,l.A)(this,Rl,{writable:!0,value:null}),(0,l.A)(this,Pl,{writable:!0,value:null}),(0,l.A)(this,Il,{writable:!0,value:0}),(0,l.A)(this,Ll,{writable:!0,value:0}),(0,l.A)(this,Dl,{writable:!0,value:Object.create(null)}),(0,l.A)(this,Fl,{writable:!0,value:[]}),(0,l.A)(this,Wl,{writable:!0,value:null}),(0,l.A)(this,Nl,{writable:!0,value:[]}),(0,l.A)(this,Ol,{writable:!0,value:new WeakMap}),(0,l.A)(this,Bl,{writable:!0,value:null}),i instanceof ReadableStream)(0,d.A)(this,Wl,i);else{if("object"!==typeof i)throw new Error('No "textContentSource" parameter specified.');(0,d.A)(this,Wl,new ReadableStream({start(t){t.enqueue(i),t.close()}}))}(0,d.A)(this,kl,(0,d.A)(this,Pl,s)),(0,d.A)(this,Ll,n.scale*(globalThis.devicePixelRatio||1)),(0,d.A)(this,Il,n.rotation),(0,d.A)(this,El,{div:null,properties:null,ctx:null});const a=n.rawDims,r=a.pageWidth,h=a.pageHeight,u=a.pageX,A=a.pageY;(0,d.A)(this,Bl,[1,0,0,-1,-u,A+h]),(0,d.A)(this,Tl,r),(0,d.A)(this,Cl,h),w(Gl,Gl,Kl).call(Gl),Ae(s,n),(0,c.A)(this,yl).promise.finally((()=>{v(Gl,Gl,eh).delete(this),(0,d.A)(this,El,null),(0,d.A)(this,Dl,null)})).catch((()=>{}))}static get fontFamilyMap(){const t=Ot.platform,e=t.isWindows,i=t.isFirefox;return Mt(this,"fontFamilyMap",new Map([["sans-serif","".concat(e&&i?"Calibri, ":"","sans-serif")],["monospace","".concat(e&&i?"Lucida Console, ":"","monospace")]]))}render(){const t=()=>{(0,c.A)(this,Rl).read().then((e=>{var i;let s=e.value;e.done?(0,c.A)(this,yl).resolve():(null!==(i=(0,c.A)(this,Ml))&&void 0!==i||(0,d.A)(this,Ml,s.lang),Object.assign((0,c.A)(this,Dl),s.styles),(0,h.A)(this,Hl,Vl).call(this,s.items),t())}),(0,c.A)(this,yl).reject)};return(0,d.A)(this,Rl,(0,c.A)(this,Wl).getReader()),v(Gl,Gl,eh).add(this),t(),(0,c.A)(this,yl).promise}update(t){let e=t.viewport,i=t.onBefore,s=void 0===i?null:i;const n=e.scale*(globalThis.devicePixelRatio||1),a=e.rotation;if(a!==(0,c.A)(this,Il)&&(null===s||void 0===s||s(),(0,d.A)(this,Il,a),Ae((0,c.A)(this,Pl),{rotation:a})),n!==(0,c.A)(this,Ll)){null===s||void 0===s||s(),(0,d.A)(this,Ll,n);const t={div:null,properties:null,ctx:w(Gl,Gl,Xl).call(Gl,(0,c.A)(this,Ml))};for(const e of(0,c.A)(this,Nl))t.properties=(0,c.A)(this,Ol).get(e),t.div=e,(0,h.A)(this,jl,ql).call(this,t)}}cancel(){var t;const e=new Dt("TextLayer task cancelled.");null===(t=(0,c.A)(this,Rl))||void 0===t||t.cancel(e).catch((()=>{})),(0,d.A)(this,Rl,null),(0,c.A)(this,yl).reject(e)}get textDivs(){return(0,c.A)(this,Nl)}get textContentItemsStr(){return(0,c.A)(this,Fl)}static cleanup(){if(!(v(this,Gl,eh).size>0)){v(this,Gl,Jl).clear();for(const t of v(this,Gl,Zl).values()){t.canvas.remove()}v(this,Gl,Zl).clear()}}}function Vl(t){var e,i;if((0,c.A)(this,Sl))return;null!==(i=(e=(0,c.A)(this,El)).ctx)&&void 0!==i||(e.ctx=w(Gl,Gl,Xl).call(Gl,(0,c.A)(this,Ml)));const s=(0,c.A)(this,Nl),n=(0,c.A)(this,Fl);for(const a of t){if(s.length>1e5)return yt("Ignoring additional textDivs for performance reasons."),void(0,d.A)(this,Sl,!0);if(void 0!==a.str)n.push(a.str),(0,h.A)(this,zl,Ul).call(this,a);else if("beginMarkedContentProps"===a.type||"beginMarkedContent"===a.type){const t=(0,c.A)(this,kl);(0,d.A)(this,kl,document.createElement("span")),(0,c.A)(this,kl).classList.add("markedContent"),null!==a.id&&(0,c.A)(this,kl).setAttribute("id","".concat(a.id)),t.append((0,c.A)(this,kl))}else"endMarkedContent"===a.type&&(0,d.A)(this,kl,(0,c.A)(this,kl).parentNode)}}function Ul(t){const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};(0,c.A)(this,Nl).push(e);const s=Ht.transform((0,c.A)(this,Bl),t.transform);let n=Math.atan2(s[1],s[0]);const a=(0,c.A)(this,Dl)[t.fontName];a.vertical&&(n+=Math.PI/2);let r=(0,c.A)(this,xl)&&a.fontSubstitution||a.fontFamily;r=Gl.fontFamilyMap.get(r)||r;const o=Math.hypot(s[2],s[3]),l=o*w(Gl,Gl,Ql).call(Gl,r,(0,c.A)(this,Ml));let d,u;0===n?(d=s[4],u=s[5]-l):(d=s[4]+l*Math.sin(n),u=s[5]-l*Math.cos(n));const A="calc(var(--scale-factor)*",p=e.style;(0,c.A)(this,kl)===(0,c.A)(this,Pl)?(p.left="".concat((100*d/(0,c.A)(this,Tl)).toFixed(2),"%"),p.top="".concat((100*u/(0,c.A)(this,Cl)).toFixed(2),"%")):(p.left="".concat(A).
1concat(d.toFixed(2),"px)"),p.top="".concat(A).concat(u.toFixed(2),"px)")),p.fontSize="".concat(A).concat((v(Gl,Gl,th)*o).toFixed(2),"px)"),p.fontFamily=r,i.fontSize=o,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,(0,c.A)(this,xl)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),0!==n&&(i.angle=n*(180/Math.PI));let g=!1;if(t.str.length>1)g=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(g=!0)}if(g&&(i.canvasWidth=a.vertical?t.height:t.width),(0,c.A)(this,Ol).set(e,i),(0,c.A)(this,El).div=e,(0,c.A)(this,El).properties=i,(0,h.A)(this,jl,ql).call(this,(0,c.A)(this,El)),i.hasText&&(0,c.A)(this,kl).append(e),i.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),(0,c.A)(this,kl).append(t)}}function ql(t){const e=t.div,i=t.properties,s=t.ctx,n=e.style;let a="";if(v(Gl,Gl,th)>1&&(a="scale(".concat(1/v(Gl,Gl,th),")")),0!==i.canvasWidth&&i.hasText){const t=n.fontFamily,r=i.canvasWidth,o=i.fontSize;w(Gl,Gl,Yl).call(Gl,s,o*(0,c.A)(this,Ll),t);const l=s.measureText(e.textContent).width;l>0&&(a="scaleX(".concat(r*(0,c.A)(this,Ll)/l,") ").concat(a))}0!==i.angle&&(a="rotate(".concat(i.angle,"deg) ").concat(a)),a.length>0&&(n.transform=a)}function Xl(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=v(this,Gl,Zl).get(t||(t=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),v(this,Gl,Zl).set(t,e),v(this,Gl,$l).set(e,{size:0,family:""})}return e}function Yl(t,e,i){const s=v(this,Gl,$l).get(t);e===s.size&&i===s.family||(t.font="".concat(e,"px ").concat(i),s.size=e,s.family=i)}function Kl(){if(null!==v(this,Gl,th))return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),g(this,Gl,th,t.getBoundingClientRect().height),t.remove()}function Ql(t,e){const i=v(this,Gl,Jl).get(t);if(i)return i;const s=w(this,Gl,Xl).call(this,e);s.canvas.width=s.canvas.height=_l,w(this,Gl,Yl).call(this,s,_l,t);const n=s.measureText("");let a=n.fontBoundingBoxAscent,r=Math.abs(n.fontBoundingBoxDescent);if(a){const e=a/(a+r);return v(this,Gl,Jl).set(t,e),s.canvas.width=s.canvas.height=0,e}s.strokeStyle="red",s.clearRect(0,0,_l,_l),s.strokeText("g",0,0);let o=s.getImageData(0,0,_l,_l).data;r=0;for(let h=o.length-1-3;h>=0;h-=4)if(o[h]>0){r=Math.ceil(h/4/_l);break}s.clearRect(0,0,_l,_l),s.strokeText("A",0,_l),o=s.getImageData(0,0,_l,_l).data,a=0;for(let h=0,c=o.length;h<c;h+=4)if(o[h]>0){a=_l-Math.floor(h/4/_l);break}s.canvas.width=s.canvas.height=0;const l=a?a/(a+r):.8;return v(this,Gl,Jl).set(t,l),l}var Jl={writable:!0,value:new Map},Zl={writable:!0,value:new Map},$l={writable:!0,value:new WeakMap},th={writable:!0,value:null},eh={writable:!0,value:new Set};class ih{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function t(i){var s;if(!i)return;let n=null;const a=i.name;if("#text"===a)n=i.value;else{if(!ih.shouldBuildText(a))return;null!==i&&void 0!==i&&null!==(s=i.attributes)&&void 0!==s&&s.textContent?n=i.attributes.textContent:i.value&&(n=i.value)}if(null!==n&&e.push({str:n}),i.children)for(const e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}const sh=k?class extends gr{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire("file:///dio-ui/node_modules/pdfjs-dist/build/pdf.mjs")("@napi-rs/canvas").createCanvas(t,e)}}:class extends gr{constructor(t){let e=t.ownerDocument,i=void 0===e?globalThis.document:e,s=t.enableHWA;super({enableHWA:void 0!==s&&s}),this._document=i}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},nh=k?class extends fr{async _fetch(t){return Zr(t)}}:vr,ah=k?class extends mr{}:class extends mr{constructor(t){let e=t.docId,i=t.ownerDocument,s=void 0===i?globalThis.document:i;super(),(0,o.A)(this,Nr),(0,o.A)(this,Wr),(0,o.A)(this,Fr),(0,o.A)(this,Dr),(0,o.A)(this,Lr),(0,o.A)(this,Ir),(0,o.A)(this,Pr),(0,o.A)(this,Rr),(0,o.A)(this,Tr),(0,l.A)(this,Cr,{get:Hr,set:void 0}),(0,l.A)(this,Er,{get:Br,set:void 0}),(0,l.A)(this,Mr,{get:Or,set:void 0}),(0,l.A)(this,wr,{writable:!0,value:void 0}),(0,l.A)(this,br,{writable:!0,value:void 0}),(0,l.A)(this,_r,{writable:!0,value:void 0}),(0,l.A)(this,yr,{writable:!0,value:void 0}),(0,l.A)(this,kr,{writable:!0,value:void 0}),(0,l.A)(this,Sr,{writable:!0,value:void 0}),(0,l.A)(this,xr,{writable:!0,value:0}
1),(0,d.A)(this,yr,e),(0,d.A)(this,kr,s)}addFilter(t){var e,i;if(!t)return"none";let s=(0,c.A)(this,Mr).get(t);if(s)return s;const n=(0,h.A)(this,Tr,zr).call(this,t),a=(0,b.A)(n,3),r=a[0],o=a[1],l=a[2],u=1===t.length?r:"".concat(r).concat(o).concat(l);if(s=(0,c.A)(this,Mr).get(u),s)return(0,c.A)(this,Mr).set(t,s),s;const A="g_".concat((0,c.A)(this,yr),"_transfer_map_").concat(((0,d.A)(this,xr,(e=(0,c.A)(this,xr),i=e++,e)),i)),p=(0,h.A)(this,Rr,jr).call(this,A);(0,c.A)(this,Mr).set(t,p),(0,c.A)(this,Mr).set(u,p);const g=(0,h.A)(this,Lr,Ur).call(this,A);return(0,h.A)(this,Fr,Xr).call(this,r,o,l,g),p}addHCMFilter(t,e){var i;const s="".concat(t,"-").concat(e),n="base";let a=(0,c.A)(this,Er).get(n);if((null===(i=a)||void 0===i?void 0:i.key)===s)return a.url;var r;a?(null===(r=a.filter)||void 0===r||r.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},(0,c.A)(this,Er).set(n,a));if(!t||!e)return a.url;const o=(0,h.A)(this,Nr,Kr).call(this,t);t=Ht.makeHexColor(...o);const l=(0,h.A)(this,Nr,Kr).call(this,e);if(e=Ht.makeHexColor(...l),(0,c.A)(this,Cr).style.color="","#000000"===t&&"#ffffff"===e||t===e)return a.url;const d=new Array(256);for(let h=0;h<=255;h++){const t=h/255;d[h]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const u=d.join(","),A="g_".concat((0,c.A)(this,yr),"_hcm_filter"),p=a.filter=(0,h.A)(this,Lr,Ur).call(this,A);(0,h.A)(this,Fr,Xr).call(this,u,u,u,p),(0,h.A)(this,Ir,Vr).call(this,p);const g=(t,e)=>{const i=o[t]/255,s=l[t]/255,n=new Array(e+1);for(let a=0;a<=e;a++)n[a]=i+a/e*(s-i);return n.join(",")};return(0,h.A)(this,Fr,Xr).call(this,g(0,5),g(1,5),g(2,5),p),a.url=(0,h.A)(this,Rr,jr).call(this,A),a.url}addAlphaFilter(t){var e,i;let s=(0,c.A)(this,Mr).get(t);if(s)return s;const n=(0,h.A)(this,Tr,zr).call(this,[t]),a=(0,b.A)(n,1)[0],r="alpha_".concat(a);if(s=(0,c.A)(this,Mr).get(r),s)return(0,c.A)(this,Mr).set(t,s),s;const o="g_".concat((0,c.A)(this,yr),"_alpha_map_").concat(((0,d.A)(this,xr,(e=(0,c.A)(this,xr),i=e++,e)),i)),l=(0,h.A)(this,Rr,jr).call(this,o);(0,c.A)(this,Mr).set(t,l),(0,c.A)(this,Mr).set(r,l);const u=(0,h.A)(this,Lr,Ur).call(this,o);return(0,h.A)(this,Wr,Yr).call(this,a,u),l}addLuminosityFilter(t){var e,i;let s,n,a=(0,c.A)(this,Mr).get(t||"luminosity");if(a)return a;if(t){var r=(0,h.A)(this,Tr,zr).call(this,[t]);s=(0,b.A)(r,1)[0],n="luminosity_".concat(s)}else n="luminosity";if(a=(0,c.A)(this,Mr).get(n),a)return(0,c.A)(this,Mr).set(t,a),a;const o="g_".concat((0,c.A)(this,yr),"_luminosity_map_").concat(((0,d.A)(this,xr,(e=(0,c.A)(this,xr),i=e++,e)),i)),l=(0,h.A)(this,Rr,jr).call(this,o);(0,c.A)(this,Mr).set(t,l),(0,c.A)(this,Mr).set(n,l);const u=(0,h.A)(this,Lr,Ur).call(this,o);return(0,h.A)(this,Pr,Gr).call(this,u),t&&(0,h.A)(this,Wr,Yr).call(this,s,u),l}addHighlightHCMFilter(t,e,i,s,n){var a;const r="".concat(e,"-").concat(i,"-").concat(s,"-").concat(n);let o=(0,c.A)(this,Er).get(t);if((null===(a=o)||void 0===a?void 0:a.key)===r)return o.url;var l;o?(null===(l=o.filter)||void 0===l||l.remove(),o.key=r,o.url="none",o.filter=null):(o={key:r,url:"none",filter:null},(0,c.A)(this,Er).set(t,o));if(!e||!i)return o.url;const d=[e,i].map((0,h.A)(this,Nr,Kr).bind(this)),u=(0,b.A)(d,2),A=u[0],p=u[1];let g=Math.round(.2126*A[0]+.7152*A[1]+.0722*A[2]),f=Math.round(.2126*p[0]+.7152*p[1]+.0722*p[2]),v=[s,n].map((0,h.A)(this,Nr,Kr).bind(this)),m=(0,b.A)(v,2),w=m[0],_=m[1];if(f<g){var y=[f,g,_,w];g=y[0],f=y[1],w=y[2],_=y[3]}(0,c.A)(this,Cr).style.color="";const k=(t,e,i)=>{const s=new Array(256),n=(f-g)/i,a=t/255,r=(e-t)/(255*i);let o=0;for(let l=0;l<=i;l++){const t=Math.round(g+l*n),e=a+l*r;for(let i=o;i<=t;i++)s[i]=e;o=t+1}for(let l=o;l<256;l++)s[l]=s[o-1];return s.join(",")},S="g_".concat((0,c.A)(this,yr),"_hcm_").concat(t,"_filter"),x=o.filter=(0,h.A)(this,Lr,Ur).call(this,S);return(0,h.A)(this,Ir,Vr).call(this,x),(0,h.A)(this,Fr,Xr).call(this,k(w[0],_[0],5),k(w[1],_[1],5),k(w[2],_[2],5),x),o.url=(0,h.A)(this,Rr,jr).call(this,S),o.url}destroy(){var t,e,i,s;arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&null!==(t=(0,c.A)(this,Sr))&&void 0!==t&&t.size||(null===(e=(0,c.A)(this,_r))||void 0===e||e.parentNode.parentNode.remove(),(0,d.A)(this,_r,null),null===(i=(0,c.A)(this,br))||void 0===i||i.clear(),(0,d.A)(this,br,null),null===(s=(0,c.A)(this,Sr))||void 0===s||s.clear(),(0,d.A)(this,Sr,null),(0,d.A)(this,xr,0))}},rh=k?class extends Qr{async _fetch(t){return Zr(t)}}:Jr;function oh(){var t,e;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"===typeof i||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i});const s=new hh,n=s.docId,a=i.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch(e){if(k&&"string"===typeof t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(i.url):null,r=i.data?function(t){if(k&&"undefined"!==typeof Buffer&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"===typeof t)return Wt(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"===typeof t&&!isNaN(null===t||void 0===t?void 0:t.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(i.data):null,o=i.httpHeaders||null,l=!0===i.withCredentials,h=null!==(t=i.password)&&void 0!==t?t:null,c=i.range instanceof dh?i.range:null,d=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:65536;let u=i.worker instanceof Sh?i.worker:null;const A=i.verbosity,p="string"!==typeof i.docBaseUrl||$t(i.docBaseUrl)?null:i.docBaseUrl,g="string"===typeof i.cMapUrl?i.cMapUrl:null,f=!1!==i.cMapPacked,v=i.CMapReaderFactory||nh,m="string"===typeof i.standardFontDataUrl?i.standardFontDataUrl:null,w=i.StandardFontDataFactory||rh,b=!0!==i.stopAtErrors,_=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,y=!1!==i.isEvalSupported,S="boolean"===typeof i.isOffscreenCanvasSupported?i.isOffscreenCanvasSupported:!k,x="boolean"===typeof i.isImageDecoderSupported?i.isImageDecoderSupported:!k&&(Ot.platform.isFirefox||!globalThis.chrome),M=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,E="boolean"===typeof i.disableFontFace?i.disableFontFace:k,C=!0===i.fontExtraProperties,T=!0===i.enableXfa,R=i.ownerDocument||globalThis.document,P=!0===i.disableRange,I=!0===i.disableStream,L=!0===i.disableAutoFetch,D=!0===i.pdfBug,F=i.CanvasFactory||sh,W=i.FilterFactory||ah,N=!0===i.enableHWA,O=c?c.length:null!==(e=i.length)&&void 0!==e?e:NaN,B="boolean"===typeof i.useSystemFonts?i.useSystemFonts:!k&&!E,H="boolean"===typeof i.useWorkerFetch?i.useWorkerFetch:v===vr&&w===Jr&&g&&m&&ne(g,document.baseURI)&&ne(m,document.baseURI);wt(A);const z={canvasFactory:new F({ownerDocument:R,enableHWA:N}),filterFactory:new W({docId:n,ownerDocument:R}),cMapReaderFactory:H?null:new v({baseUrl:g,isCompressed:f}),standardFontDataFactory:H?null:new w({baseUrl:m})};if(!u){const t={verbosity:A,port:Do.workerPort};u=t.port?Sh.fromPort(t):new Sh(t),s._worker=u}const j={docId:n,apiVersion:"4.10.38",data:r,password:h,disableAutoFetch:L,rangeChunkSize:d,length:O,docBaseUrl:p,enableXfa:T,evaluatorOptions:{maxImageSize:_,disableFontFace:E,ignoreErrors:b,isEvalSupported:y,isOffscreenCanvasSupported:S,isImageDecoderSupported:x,canvasMaxAreaInBytes:M,fontExtraProperties:C,useSystemFonts:B,cMapUrl:H?g:null,standardFontDataUrl:H?m:null}},G={disableFontFace:E,fontExtraProperties:C,ownerDocument:R,pdfBug:D,styleElement:null,loadingParams:{disableAutoFetch:L,enableXfa:T}};return u.promise.then((function(){if(s.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");
1const t=u.messageHandler.sendWithPromise("GetDocRequest",j,r?[r.buffer]:null);let e;if(c)e=new $o(c,{disableRange:P,disableStream:I});else if(!r){if(!a)throw new Error("getDocument - no `url` parameter provided.");let t;if(k)if(ne(a)){if("undefined"===typeof fetch||"undefined"===typeof Response||!("body"in Response.prototype))throw new Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");t=cl}else t=ml;else t=ne(a)?cl:pl;e=new t({url:a,length:O,httpHeaders:o,withCredentials:l,rangeChunkSize:d,disableRange:P,disableStream:I})}return t.then((t=>{if(s.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const i=new hr(n,t,u.port),a=new Wh(i,s,e,G,z);s._transport=a,i.send("Ready",null)}))})).catch(s._capability.reject),s}function lh(t){return"object"===typeof t&&Number.isInteger(null===t||void 0===t?void 0:t.num)&&t.num>=0&&Number.isInteger(null===t||void 0===t?void 0:t.gen)&&t.gen>=0}class hh{constructor(){var t,e;this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d".concat((g(hh,hh,ch,(t=v(hh,hh,ch),e=t++,t)),e)),this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var t;this.destroyed=!0;try{var e,i;null!==(e=this._worker)&&void 0!==e&&e.port&&(this._worker._pendingDestroy=!0),await(null===(i=this._transport)||void 0===i?void 0:i.destroy())}catch(n){var s;throw null!==(s=this._worker)&&void 0!==s&&s.port&&delete this._worker._pendingDestroy,n}this._transport=null,null===(t=this._worker)||void 0===t||t.destroy(),this._worker=null}}var ch={writable:!0,value:0};class dh{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=s,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then((()=>{for(const i of this._progressListeners)i(t,e)}))}onDataProgressiveRead(t){this._readyCapability.promise.then((()=>{for(const e of this._progressiveReadListeners)e(t)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const t of this._progressiveDoneListeners)t()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){kt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class uh{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Mt(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).intent,e=void 0===t?"display":t;
1const i=this._transport.getRenderingIntent(e).renderingIntent;return this._transport.getOptionalContentConfig(i)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}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()}}var Ah=new WeakMap,ph=new WeakMap,gh=new WeakSet,fh=new WeakSet;class vh{constructor(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(0,o.A)(this,fh),(0,o.A)(this,gh),(0,l.A)(this,Ah,{writable:!0,value:null}),(0,l.A)(this,ph,{writable:!0,value:!1}),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new se:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new zh,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.scale,i=t.rotation,s=void 0===i?this.rotate:i,n=t.offsetX,a=void 0===n?0:n,r=t.offsetY,o=void 0===r?0:r,l=t.dontFlip,h=void 0!==l&&l;return new Jt({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:s,offsetX:a,offsetY:o,dontFlip:h})}getAnnotations(){let t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).intent,e=void 0===t?"display":t;const i=this._transport.getRenderingIntent(e).renderingIntent;return this._transport.getAnnotations(this._pageIndex,i)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Mt(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null}render(t){var e,i;let s=t.canvasContext,n=t.viewport,a=t.intent,r=void 0===a?"display":a,o=t.annotationMode,l=void 0===o?F.ENABLE:o,c=t.transform,u=void 0===c?null:c,A=t.background,p=void 0===A?null:A,g=t.optionalContentConfigPromise,f=void 0===g?null:g,v=t.annotationCanvasMap,m=void 0===v?null:v,w=t.pageColors,_=void 0===w?null:w,y=t.printAnnotationStorage,k=void 0===y?null:y,S=t.isEditing,x=void 0!==S&&S;null===(e=this._stats)||void 0===e||e.time("Overall");const M=this._transport.getRenderingIntent(r,l,k,x),E=M.renderingIntent,C=M.cacheKey;(0,d.A)(this,ph,!1),(0,h.A)(this,fh,wh).call(this),f||(f=this._transport.getOptionalContentConfig(E));let R=this._intentStates.get(C);R||(R=Object.create(null),this._intentStates.set(C,R)),R.streamReaderCancelTimeout&&(clearTimeout(R.streamReaderCancelTimeout),R.streamReaderCancelTimeout=null);const P=!!(E&T);var I;R.displayReadyCapability||(R.displayReadyCapability=Promise.withResolvers(),R.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(I=this._stats)||void 0===I||I.time("Page Request"),this._pumpOperatorList(M));const L=t=>{var e;(R.renderTasks.delete(D),(this._maybeCleanupAfterRender||P)&&(0,d.A)(this,ph,!0),(0,h.A)(this,gh,mh).call(this,!P),t?(D.capability.reject(t),this._abortOperatorList({intentState:R,reason:t instanceof Error?t:new Error(t)})):D.capability.resolve(),this._stats)&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),null!==(e=globalThis.Stats)&&void 0!==e&&e.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},D=new qh({callback:L,params:{canvasContext:s,viewport:n,transform:u,background:p},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:m,operatorList:R.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!P,pdfBug:this._pdfBug,page
1Colors:_});((i=R).renderTasks||(i.renderTasks=new Set)).add(D);const W=D.task;return Promise.all([R.displayReadyCapability.promise,f]).then((t=>{var e;let i=(0,b.A)(t,2),s=i[0],n=i[1];if(this.destroyed)L();else{if(null===(e=this._stats)||void 0===e||e.time("Rendering"),!(n.renderingIntent&E))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");D.initializeGraphics({transparency:s,optionalContentConfig:n}),D.operatorListChanged()}})).catch(L),W}getOperatorList(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.intent,i=void 0===e?"display":e,s=t.annotationMode,n=void 0===s?F.ENABLE:s,a=t.printAnnotationStorage,r=void 0===a?null:a,o=t.isEditing,l=void 0!==o&&o;const h=this._transport.getRenderingIntent(i,n,r,l,!0);let c,d=this._intentStates.get(h.cacheKey);var u,A;(d||(d=Object.create(null),this._intentStates.set(h.cacheKey,d)),d.opListReadCapability)||(c=Object.create(null),c.operatorListChanged=function(){d.operatorList.lastChunk&&(d.opListReadCapability.resolve(d.operatorList),d.renderTasks.delete(c))},d.opListReadCapability=Promise.withResolvers(),((u=d).renderTasks||(u.renderTasks=new Set)).add(c),d.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(A=this._stats)||void 0===A||A.time("Page Request"),this._pumpOperatorList(h));return d.opListReadCapability.promise}streamTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.includeMarkedContent,i=void 0!==e&&e,s=t.disableNormalization,n=void 0!==s&&s;return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===i,disableNormalization:!0===n},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then((t=>ih.textContent(t)));const e=this.streamTextContent(t);return new Promise((function(t,i){const s=e.getReader(),n={items:[],styles:Object.create(null),lang:null};!function e(){s.read().then((function(i){var s;let a=i.value;i.done?t(n):(null!==(s=n.lang)&&void 0!==s||(n.lang=a.lang),Object.assign(n.styles,a.styles),n.items.push(...a.items),e())}),i)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),(0,d.A)(this,ph,!1),(0,h.A)(this,fh,wh).call(this),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,d.A)(this,ph,!0);const e=(0,h.A)(this,gh,mh).call(this,!1);return t&&e&&this._stats&&(this._stats=new se),e}_startRenderPage(t,e){var i,s;const n=this._intentStates.get(e);n&&(null===(i=this._stats)||void 0===i||i.timeEnd("Page Request"),null===(s=n.displayReadyCapability)||void 0===s||s.resolve(t))}_renderPageChunk(t,e){for(let i=0,s=t.length;i<s;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&(0,h.A)(this,gh,mh).call(this,!0)}_pumpOperatorList(t){let e=t.renderingIntent,i=t.cacheKey,s=t.annotationStorageSerializable,n=t.modifiedIds;const a=s.map,r=s.transfer,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:a,modifiedIds:n},r).getReader(),l=this._intentStates.get(i);l.streamReader=o;const c=()=>{o.read().then((t=>{let e=t.value;t.done?l.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,l),c())}),(t=>{if(l.streamReader=null,!this._transport.destroyed){if(l.operatorList){l.operatorList.lastChunk=!0;for(const t of l.renderTasks)t.operatorListChanged();(0,h.A)(this,gh,mh).call(this,!0)}
1if(l.displayReadyCapability)l.displayReadyCapability.reject(t);else{if(!l.opListReadCapability)throw t;l.opListReadCapability.reject(t)}}}))};c()}_abortOperatorList(t){let e=t.intentState,i=t.reason,s=t.force,n=void 0!==s&&s;if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!n){if(e.renderTasks.size>0)return;if(i instanceof Zt){let t=100;return i.extraDelay>0&&i.extraDelay<1e3&&(t+=i.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})}),t))}}if(e.streamReader.cancel(new Dt(i.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const t of this._intentStates){var a=(0,b.A)(t,2);const i=a[0];if(a[1]===e){this._intentStates.delete(i);break}}this.cleanup()}}}get stats(){return this._stats}}function mh(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,h.A)(this,fh,wh).call(this),!(0,c.A)(this,ph)||this.destroyed)return!1;if(t)return(0,d.A)(this,Ah,setTimeout((()=>{(0,d.A)(this,Ah,null),(0,h.A)(this,gh,mh).call(this,!1)}),5e3)),!1;for(const e of this._intentStates.values()){const t=e.renderTasks,i=e.operatorList;if(t.size>0||!i.lastChunk)return!1}return this._intentStates.clear(),this.objs.clear(),(0,d.A)(this,ph,!1),!0}function wh(){(0,c.A)(this,Ah)&&(clearTimeout((0,c.A)(this,Ah)),(0,d.A)(this,Ah,null))}var bh=new WeakMap,_h=new WeakMap;class yh{constructor(){(0,l.A)(this,bh,{writable:!0,value:new Map}),(0,l.A)(this,_h,{writable:!0,value:Promise.resolve()})}postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};(0,c.A)(this,_h).then((()=>{for(const t of(0,c.A)(this,bh)){(0,b.A)(t,1)[0].call(this,i)}}))}addEventListener(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=null;if((null===i||void 0===i?void 0:i.signal)instanceof AbortSignal){const n=i.signal;if(n.aborted)return void yt("LoopbackPort - cannot use an `aborted` signal.");const a=()=>this.removeEventListener(t,e);s=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}(0,c.A)(this,bh).set(e,s)}removeEventListener(t,e){const i=(0,c.A)(this,bh).get(e);null===i||void 0===i||i(),(0,c.A)(this,bh).delete(e)}terminate(){for(const t of(0,c.A)(this,bh)){const e=(0,b.A)(t,2)[1];null===e||void 0===e||e()}(0,c.A)(this,bh).clear()}}var kh=new WeakSet;class Sh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.name,i=void 0===e?null:e,s=t.port,n=void 0===s?null:s,a=t.verbosity,r=void 0===a?bt():a;if((0,o.A)(this,kh),this.name=i,this.destroyed=!1,this.verbosity=r,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,n){var l;if(null!==(l=v(Sh,Sh,Th))&&void 0!==l&&l.has(n))throw new Error("Cannot use more than one PDFWorker per port.");return(v(Sh,Sh,Th)||g(Sh,Sh,Th,new WeakMap)).set(n,this),void this._initializeFromPort(n)}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new hr("main","worker",t),this._messageHandler.on("ready",(function(){})),(0,h.A)(this,kh,xh).call(this)}_initialize(){if(v(Sh,Sh,Ch)||v(Sh,Sh,Mh))return void this._setupFakeWorker();let t=Sh.workerSrc;try{Sh._isSameOrigin(window.location.href,t)||(t=Sh._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new hr("main","worker",e),s=()=>{n.abort(),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;e.addEventListener("error",(()=>{this._webWorker||s()}),{signal:n.signal}),i.on("test",(t=>{n.abort(),!this.destroyed&&t?(this._messageHandler=i,this._port=e,this._webWorker=e,(0,h.A)(this,kh,xh).call(this)):s()})),i.on("ready",(t=>{if(n.abort(),this.destroyed)s();else try{a()}catch(e){this._setupFakeWorker()}}));const a=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void a()}catch(e){_t("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){v(Sh,Sh,Ch)||(yt("Setting up fake worker."),g(Sh,Sh,Ch,!0)),Sh._setupFakeWorkerGlobal.then((t=>{var e,i;if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const s=new yh;this._port=s;const n="fake".concat((g(Sh,Sh,Eh,(e=v(Sh,Sh,Eh),i=e++,e)),i)),a=new hr(n+"_worker",n,s);t.setup(a,s),this._messageHandler=new hr(n,n+"_worker",s),(0,h.A)(this,kh,xh).call(this)})).catch((t=>{this._readyCapability.reject(new Error('Setting up fake worker failed: "'.concat(t.message,'".')))}))}destroy(){var t,e,i;this.destroyed=!0,null===(t=this._webWorker)||void 0===t||t.terminate(),this._webWorker=null,null===(e=v(Sh,Sh,Th))||void 0===e||e.delete(this._port),this._port=null,null===(i=this._messageHandler)||void 0===i||i.destroy(),this._messageHandler=null}static fromPort(t){var e;if(null===t||void 0===t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const i=null===(e=v(this,Sh,Th))||void 0===e?void 0:e.get(t.port);
1if(i){if(i._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return i}return new Sh(t)}static get workerSrc(){if(Do.workerSrc)return Do.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Mt(this,"_setupFakeWorkerGlobal",(async()=>{if(v(this,Sh,Mh))return v(this,Sh,Mh);return(await import(this.workerSrc)).WorkerMessageHandler})())}}function xh(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}var Mh={get:function(){try{var t;return(null===(t=globalThis.pdfjsWorker)||void 0===t?void 0:t.WorkerMessageHandler)||null}catch(e){return null}},set:void 0},Eh={writable:!0,value:0},Ch={writable:!0,value:!1},Th={writable:!0,value:void 0};k&&(g(Sh,Sh,Ch,!0),Do.workerSrc||(Do.workerSrc="./pdf.worker.mjs")),Sh._isSameOrigin=(t,e)=>{let i;try{if(i=new URL(t),!i.origin||"null"===i.origin)return!1}catch(n){return!1}const s=new URL(e,i);return i.origin===s.origin},Sh._createCDNWrapper=t=>{const e='await import("'.concat(t,'");');return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};var Rh=new WeakMap,Ph=new WeakMap,Ih=new WeakMap,Lh=new WeakMap,Dh=new WeakMap,Fh=new WeakSet;class Wh{constructor(t,e,i,s,n){(0,o.A)(this,Fh),(0,l.A)(this,Rh,{writable:!0,value:new Map}),(0,l.A)(this,Ph,{writable:!0,value:new Map}),(0,l.A)(this,Ih,{writable:!0,value:new Map}),(0,l.A)(this,Lh,{writable:!0,value:new Map}),(0,l.A)(this,Dh,{writable:!0,value:null}),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new zh,this.fontLoader=new Va({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return Mt(this,"annotationStorage",new Ba)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=C,r=Da;switch(t){case"any":a=E;break;case"display":break;case"print":a=T;break;default:yt("getRenderingIntent - invalid intent: ".concat(t))}const o=a&T&&i instanceof ja?i:this.annotationStorage;switch(e){case F.DISABLE:a+=I;break;case F.ENABLE:break;case F.ENABLE_FORMS:a+=R;break;case F.ENABLE_STORAGE:a+=P,r=o.serializable;break;default:yt("getRenderingIntent - invalid annotationMode: ".concat(e))}s&&(a+=L),n&&(a+=D);const l=o.modifiedIds,h=l.ids,c=l.hash;return{renderingIntent:a,cacheKey:[a,r.hash,c].join("_"),annotationStorageSerializable:r,modifiedIds:h}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null===(t=(0,c.A)(this,Dh))||void 0===t||t.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const s of(0,c.A)(this,Ph).values())e.push(s._destroy());(0,c.A)(this,Ph).clear(),(0,c.A)(this,Ih).clear(),(0,c.A)(this,Lh).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then((()=>{var t,e;this.commonObjs.clear(),this.fontLoader.clear(),(0,c.A)(this,Rh).clear(),this.filterFactory.destroy(),Gl.cleanup(),null===(t=this._networkStream)||void 0===t||t.cancelAllRequests(new Dt("Worker was terminated.")),null===(e=this.messageHandler)||void 0===e||e.destroy(),this.messageHandler=null,this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const t=this.messageHandler,e=this.loadingTask;t.on("GetReader",((t,e)=>{St(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then((function(t){let i=t.value;t.done?e.close():(St(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}})),t.on("ReaderHeadersReady",(async t=>{await this._fullReader.headersReady;const i=this._fullReader,s=i.isStreamingSupported,n=i.isRangeSupported,a=i.contentLength;if(!s||!n){var r;if(this._lastProgress)null===(r=e.onProgress)||void 0===r||r.call(e,this._lastProgress);this._fullReader.onProgress=t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}}return{isStreamingSupported:s,isRangeSupported:n,contentLength:a}})),t.on("GetRangeReader",((t,e)=>{St(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then((function(t){let i=t.value;t.done?e.close():(St(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{i.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}):e.close()})),t.on("GetDoc",(t=>{let i=t.pdfInfo;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new uh(i,this))})),t.on("DocException",(t=>{e._capability.reject(sr(t))})),t.on("PasswordRequest",(t=>{(0,d.A)(this,Dh,Promise.withResolvers());try{if(!e.onPassword)throw sr(t);const i=t=>{t instanceof Error?(0,c.A)(this,Dh).reject(t):(0,c.A)(this,Dh).resolve({password:t})};e.onPassword(i,t.code)}catch(i){(0,c.A)(this,Dh).reject(i)}return(0,c.A)(this,Dh).promise})),t.on("DataLoaded",(t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)})),t.on("StartRenderPage",(t=>{if(this.destroyed)return;(0,c.A)(this,Ph).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)})),t.on("commonobj",(e=>{var i;let s=(0,b.A)(e,3),n=s[0],a=s[1],r=s[2];if(this.destroyed)return null;if(this.commonObjs.has(n))return null;switch(a){case"Font":const e=this._params,s=e.disableFontFace,o=e.fontExtraProperties,l=e.pdfBug;if("error"in r){const t=r.error;yt("Error during font loading: ".concat(t)),this.commonObjs.resolve(n,t);break}const h=l&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,d=new Ua(r,{disableFontFace:s,fontExtraProperties:o,inspectFont:h});this.fontLoader.bind(d).catch((()=>
1t.sendWithPromise("FontFallback",{id:n}))).finally((()=>{!o&&d.data&&(d.data=null),this.commonObjs.resolve(n,d)}));break;case"CopyLocalImage":const u=r.imageRef;St(u,"The imageRef must be defined.");for(const t of(0,c.A)(this,Ph).values())for(const e of t.objs){const t=(0,b.A)(e,2)[1];if((null===t||void 0===t?void 0:t.ref)===u)return t.dataLen?(this.commonObjs.resolve(n,structuredClone(t)),t.dataLen):null}break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,r);break;default:throw new Error("Got unknown common object type ".concat(a))}return null})),t.on("obj",(t=>{let e=(0,b.A)(t,4),i=e[0],s=e[1],n=e[2],a=e[3];if(this.destroyed)return;const r=(0,c.A)(this,Ph).get(s);var o;if(!r.objs.has(i))if(0!==r._intentStates.size)switch(n){case"Image":r.objs.resolve(i,a),(null===a||void 0===a?void 0:a.dataLen)>1e7&&(r._maybeCleanupAfterRender=!0);break;case"Pattern":r.objs.resolve(i,a);break;default:throw new Error("Got unknown object type ".concat(n))}else null===a||void 0===a||null===(o=a.bitmap)||void 0===o||o.close()})),t.on("DocProgress",(t=>{var i;this.destroyed||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})})),t.on("FetchBuiltInCMap",(async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(t)})),t.on("FetchStandardFontData",(async t=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(t)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t,e;this.annotationStorage.size<=0&&yt("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const i=this.annotationStorage.serializable,s=i.map,n=i.transfer;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:s,filename:null!==(t=null===(e=this._fullReader)||void 0===e?void 0:e.filename)&&void 0!==t?t:null},n).finally((()=>{this.annotationStorage.resetModified()}))}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,i=(0,c.A)(this,Ih).get(e);if(i)return i;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then((i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&(0,c.A)(this,Lh).set(i.refStr,t);const s=new vh(e,i,this,this._params.pdfBug);return(0,c.A)(this,Ph).set(e,s),s}));return(0,c.A)(this,Ih).set(e,s),s}getPageIndex(t){return lh(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return(0,h.A)(this,Fh,Nh).call(this,"GetFieldObjects")}hasJSActions(){return(0,h.A)(this,Fh,Nh).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!==typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return(0,h.A)(this,Fh,Nh).call(this,"GetDocJSActions")}
1getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return(0,h.A)(this,Fh,Nh).call(this,"GetOptionalContentConfig").then((e=>new Jo(e,t)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=(0,c.A)(this,Rh).get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then((t=>{var e,i,s,n;return{info:t[0],metadata:t[1]?new Bo(t[1]):null,contentDispositionFilename:null!==(e=null===(i=this._fullReader)||void 0===i?void 0:i.filename)&&void 0!==e?e:null,contentLength:null!==(s=null===(n=this._fullReader)||void 0===n?void 0:n.contentLength)&&void 0!==s?s:null}}));return(0,c.A)(this,Rh).set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of(0,c.A)(this,Ph).values()){if(!t.cleanup())throw new Error("startCleanup: Page ".concat(t.pageNumber," is currently rendering."))}this.commonObjs.clear(),t||this.fontLoader.clear(),(0,c.A)(this,Rh).clear(),this.filterFactory.destroy(!0),Gl.cleanup()}}cachedPageNumber(t){var e;if(!lh(t))return null;const i=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return null!==(e=(0,c.A)(this,Lh).get(i))&&void 0!==e?e:null}}function Nh(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=(0,c.A)(this,Rh).get(t);if(i)return i;const s=this.messageHandler.sendWithPromise(t,e);return(0,c.A)(this,Rh).set(t,s),s}const Oh=Symbol("INITIAL_DATA");var Bh=new WeakMap,Hh=new WeakSet;class zh{constructor(){(0,o.A)(this,Hh),(0,l.A)(this,Bh,{writable:!0,value:Object.create(null)})}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const i=(0,h.A)(this,Hh,jh).call(this,t);return i.promise.then((()=>e(i.data))),null}const i=(0,c.A)(this,Bh)[t];if(!i||i.data===Oh)throw new Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){const e=(0,c.A)(this,Bh)[t];return!!e&&e.data!==Oh}delete(t){const e=(0,c.A)(this,Bh)[t];return!(!e||e.data===Oh)&&(delete(0,c.A)(this,Bh)[t],!0)}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=(0,h.A)(this,Hh,jh).call(this,t);i.data=e,i.resolve()}clear(){for(const e in(0,c.A)(this,Bh)){var t;const i=(0,c.A)(this,Bh)[e].data;null===i||void 0===i||null===(t=i.bitmap)||void 0===t||t.close()}(0,d.A)(this,Bh,Object.create(null))}*[Symbol.iterator](){for(const t in(0,c.A)(this,Bh)){const e=(0,c.A)(this,Bh)[t].data;e!==Oh&&(yield[t,e])}}}function jh(t){var e;return(e=(0,c.A)(this,Bh))[t]||(e[t]=(0,s.A)((0,s.A)({},Promise.withResolvers()),{},{data:Oh}))}var Gh=new WeakMap;class Vh{constructor(t){(0,l.A)(this,Gh,{writable:!0,value:null}),(0,d.A)(this,Gh,t),this.onContinue=null}get promise(){return(0,c.A)(this,Gh).capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(0,c.A)(this,Gh).cancel(null,t)}get separateAnnots(){const t=(0,c.A)(this,Gh).operatorList.separateAnnots;if(!t)return!1;const e=(0,c.A)(this,Gh).annotationCanvasMap;return t.form||t.canvas&&(null===e||void 0===e?void 0:e.size)>0}}var Uh=new WeakMap;class qh{constructor(t){let e=t.callback,i=t.params,s=t.objs,n=t.commonObjs,a=t.annotationCanvasMap,r=t.operatorList,o=t.pageIndex,h=t.canvasFactory,c=t.filterFactory,d=t.useRequestAnimationFrame,u=void 0!==d&&d,A=t.pdfBug,p=void 0!==A&&A,g=t.pageColors,f=void 0===g?null:g;(0,l.A)(this,Uh,{writable:!0,value:null}),this.callback=e,this.params=i,this.objs=s,this.commonObjs=n,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=o,this.canvasFactory=h,this.filterFactory=c,this._pdfBug=p,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===u&&"undefined"!==typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new Vh(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=i.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics(t){var e,i;let s=t.transparency,n=void 0!==s&&s,a=t.optionalContentConfig;if(this.cancelled)return;
1if(this._canvas){if(v(qh,qh,Xh).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.");v(qh,qh,Xh).add(this._canvas)}this._pdfBug&&null!==(e=globalThis.StepperManager)&&void 0!==e&&e.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const r=this.params,o=r.canvasContext,l=r.viewport,h=r.transform,c=r.background;this.gfx=new Ro(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:a},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:h,viewport:l,transparency:n,background:c}),this.operatorListIdx=0,this.graphicsReady=!0,null===(i=this.graphicsReadyCallback)||void 0===i||i.call(this)}cancel(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,null===(t=this.gfx)||void 0===t||t.endDrawing(),(0,c.A)(this,Uh)&&(window.cancelAnimationFrame((0,c.A)(this,Uh)),(0,d.A)(this,Uh,null)),v(qh,qh,Xh).delete(this._canvas),this.callback(e||new Zt("Rendering cancelled, page ".concat(this._pageIndex+1),i))}operatorListChanged(){var t;this.graphicsReady?(null===(t=this.stepper)||void 0===t||t.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?(0,d.A)(this,Uh,window.requestAnimationFrame((()=>{(0,d.A)(this,Uh,null),this._nextBound().catch(this._cancelBound)}))):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),v(qh,qh,Xh).delete(this._canvas),this.callback())))}}var Xh={writable:!0,value:new WeakSet};const Yh="4.10.38",Kh="f9bea397f";function Qh(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function Jh(t){return Math.max(0,Math.min(255,255*t))}class Zh{static CMYK_G(t){let e=(0,b.A)(t,4),i=e[0],s=e[1],n=e[2],a=e[3];return["G",1-Math.min(1,.3*i+.59*n+.11*s+a)]}static G_CMYK(t){return["CMYK",0,0,0,1-(0,b.A)(t,1)[0]]}static G_RGB(t){let e=(0,b.A)(t,1)[0];return["RGB",e,e,e]}static G_rgb(t){let e=(0,b.A)(t,1)[0];return e=Jh(e),[e,e,e]}static G_HTML(t){const e=Qh((0,b.A)(t,1)[0]);return"#".concat(e).concat(e).concat(e)}static RGB_G(t){let e=(0,b.A)(t,3);return["G",.3*e[0]+.59*e[1]+.11*e[2]]}static RGB_rgb(t){return t.map(Jh)}static RGB_HTML(t){return"#".concat(t.map(Qh).join(""))}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(t){let e=(0,b.A)(t,4),i=e[0],s=e[1],n=e[2],a=e[3];return["RGB",1-Math.min(1,i+a),1-Math.min(1,n+a),1-Math.min(1,s+a)]}static CMYK_rgb(t){let e=(0,b.A)(t,4),i=e[0],s=e[1],n=e[2],a=e[3];return[Jh(1-Math.min(1,i+a)),Jh(1-Math.min(1,n+a)),Jh(1-Math.min(1,s+a))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let e=(0,b.A)(t,3);const i=1-e[0],s=1-e[1],n=1-e[2];return["CMYK",i,s,n,Math.min(i,s,n)]}}class $h{create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width","".concat(t,"px")),s.setAttribute("height","".concat(e,"px"))),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),s}createElement(t){if("string"!==typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){kt("Abstract method `_createSVG` called.")}}class tc extends $h{_createSVG(t){return document.createElementNS(Yt,t)}}class ec{static setupStorage(t,e,i,s,n){const a=s.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==a.value&&(t.textContent=a.value),"print"===n)break;t.addEventListener("input",(t=>{s.setValue(e,{value:t.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(a.value===i.attributes.xfaOn?t.setAttribute("checked",!0):a.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===n)break;t.addEventListener("change",(t=>{s.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})}))}else{if(null!==a.value&&t.setAttribute("value",a.value),"print"===n)break;t.addEventListener("input",(t=>{s.setValue(e,{value:t.target.value})}))}break;case"select":if(null!==a.value){t.setAttribute("value",a.value);for(const t of i.children)t.attributes.value===a.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",(t=>{const i=t.target.options,n=-1===i.selectedIndex?"":i[i.selectedIndex].value;s.setValue(e,{value:n})}
1))}}static setAttributes(t){let e=t.html,i=t.element,s=t.storage,n=void 0===s?null:s,a=t.intent,r=t.linkService;const o=i.attributes,l=e instanceof HTMLAnchorElement;"radio"===o.type&&(o.name="".concat(o.name,"-").concat(a));for(const c of Object.entries(o)){var h=(0,b.A)(c,2);const t=h[0],i=h[1];if(null!==i&&void 0!==i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:(!l||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,i)}}l&&r.addLinkAttributes(e,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(e,o.dataId,i,n)}static render(t){const e=t.annotationStorage,i=t.linkService,s=t.xfaHtml,n=t.intent||"display",a=document.createElement(s.name);s.attributes&&this.setAttributes({html:a,element:s,intent:n,linkService:i});const r="richText"!==n,o=t.div;if(o.append(a),t.viewport){const e="matrix(".concat(t.viewport.transform.join(","),")");o.style.transform=e}r&&o.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===s.children.length){if(s.value){const t=document.createTextNode(s.value);a.append(t),r&&ih.shouldBuildText(s.name)&&l.push(t)}return{textDivs:l}}const h=[[s,-1,a]];for(;h.length>0;){var c,d;const t=h.at(-1),s=(0,b.A)(t,3),a=s[0],o=s[1],u=s[2];if(o+1===a.children.length){h.pop();continue}const A=a.children[++h.at(-1)[1]];if(null===A)continue;const p=A.name;if("#text"===p){const t=document.createTextNode(A.value);l.push(t),u.append(t);continue}const g=null!==A&&void 0!==A&&null!==(c=A.attributes)&&void 0!==c&&c.xmlns?document.createElementNS(A.attributes.xmlns,p):document.createElement(p);if(u.append(g),A.attributes&&this.setAttributes({html:g,element:A,storage:e,intent:n,linkService:i}),(null===(d=A.children)||void 0===d?void 0:d.length)>0)h.push([A,-1,g]);else if(A.value){const t=document.createTextNode(A.value);r&&ih.shouldBuildText(p)&&l.push(t),g.append(t)}}for(const u of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))u.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const e="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=e,t.div.hidden=!1}}const ic=1e3,sc=new WeakSet;function nc(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class ac{static create(t){switch(t.data.annotationType){case X:return new gc(t);case q:return new wc(t);case ht:switch(t.data.fieldType){case"Tx":return new _c(t);case"Btn":return t.data.radioButton?new Sc(t):t.data.checkBox?new kc(t):new xc(t);case"Ch":return new Mc(t);case"Sig":return new yc(t)}return new bc(t);case ot:return new Ec(t);case Y:return new ud(t);case K:return new pd(t);case Q:return new fd(t);case J:return new md(t);case $:return new bd(t);case at:return new yd(t);case rt:return new Md(t);case Z:return new _d(t);case tt:return new Cd(t);case et:return new Td(t);case it:return new Rd(t);case st:return new Pd(t);case nt:return new Id(t);case lt:return new Fd(t);default:return new cc(t)}}}var rc=new WeakMap,oc=new WeakMap,lc=new WeakMap,hc=new WeakSet;class cc{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.isRenderable,s=void 0!==i&&i,n=e.ignoreBorder,a=void 0!==n&&n,r=e.createQuadrilaterals,h=void 0!==r&&r;(0,o.A)(this,hc),(0,l.A)(this,rc,{writable:!0,value:null}),(0,l.A)(this,oc,{writable:!0,value:!1}),(0,l.A)(this,lc,{writable:!0,value:null}),this.isRenderable=s,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,s&&(this.container=this._createContainer(a)),h&&this._createQuadrilaterals()}static _hasPopupData(t){let e=t.titleObj,i=t.contentsObj,s=t.richText;return!!(null!==e&&void 0!==e&&e.str||null!==i&&void 0!==i&&i.str||null!==s&&void 0!==s&&s.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return cc._hasPopupData(this.data)}updateEdited(t){var e;if(!this.container)return;(0,c.A)(this,rc)||(0,d.A)(this,rc,{rect:this.data.rect.slice(0)});const i=t.rect;i&&(0,h.A)(this,hc,dc).call(this,i),null===(e=(0,c.A)(this,lc))||void 0===e||e.popup.updateEdited(t)}resetEdited(){var t;(0,c.A)(this,rc)&&((0,h.A)(this,hc,dc).call(this,(0,c.A)(this,rc).rect),null===(t=(0,c.A)(this,lc))||void 0===t||t.popup.resetEdited(),(0,d.A)(this,rc,null))}_createContainer(t){const e=this.data,i=this.parent,s=i.page,n=i.viewport,a=document.createElement("section");a.setAttribute("data-annotation-id",e.id),this instanceof bc||(a.tabIndex=ic);const r=a.style;if(r.zIndex=this.parent.zIndex++,e.alternativeText&&(a.title=e.alternativeText),e.noRotate&&a.classList.add("norotate"),!e.rect||this instanceof Ec){const t=e.rotation;return e.hasOwnCanvas||0===t||this.setRotation(t,a),a}const o=nc(e.rect),l=o.width,h=o.height;if(!t&&e.borderStyle.width>0){r.borderWidth="".concat(e.borderStyle.width,"px");const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){const e="calc(".concat(t,"px * var(--scale-factor)) / calc(").concat(i,"px * var(--scale-factor))");r.borderRadius=e}else if(this instanceof Sc){const t="calc(".concat(l,"px * var(--scale-factor)) / calc(").concat(h,"px * var(--scale-factor))");r.borderRadius=t}switch(e.borderStyle.style){case ct:r.borderStyle="solid";break;case dt:r.borderStyle="dashed";break;case ut:yt("Unimplemented border style: beveled");break;case At:yt("Unimplemented border style: inset");break;case pt:r.borderBottomStyle="solid"}const s=e.borderColor||null;s?((0,d.A)(this,oc,!0),r.borderColor=Ht.makeHexColor(0|s[0],0|s[1],0|s[2])):r.borderWidth=0}const c=Ht.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),u=n.rawDims,A=u.pageWidth,p=u.pageHeight,g=u.pageX,f=u.pageY;r.left="".concat(100*(c[0]-g)/A,"%"),r.top="".concat(100*(c[1]-f)/p,"%");const v=e.rotation;return e.hasOwnCanvas||0===v?(r.width="".concat(100*l/A,"%"),r.height="".concat(100*h/p,"%")):this.setRotation(v,a),a}setRotation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;const i=this.parent.viewport.rawDims,s=i.pageWidth,n=i.pageHeight,a=nc(this.data.rect),r=a.width,o=a.height;let l,h;t%180===0?(l=100*r/s,h=100*o/n):(l=100*o/s,h=100*r/n),e.style.width="".concat(l,"%"),e.style.height="".concat(h,"%"),e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const s=i.detail[t],n=s[0],a=s.slice(1);i.target.style[e]=Zh["".concat(n,"_HTML")](a),this.annotationStorage.setValue(this.data.id,{[e]:Zh["".concat(n,"_rgb")](a)})};return Mt(this,"_commonActions",{display:t=>{const e=t.detail.display,i=e%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const e=t.detail.hidden;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout((()=>
1t.target.focus({preventScroll:!1})),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const s of Object.keys(e.detail)){const n=t[s]||i[s];null===n||void 0===n||n(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const n of Object.entries(e)){var s=(0,b.A)(n,2);const a=s[0],r=s[1],o=i[a];if(o){o({detail:{[a]:r},target:t}),delete e[a]}}}_createQuadrilaterals(){
1if(!this.container)return;const t=this.data.quadPoints;if(!t)return;const e=this.data.rect.map((t=>Math.fround(t))),i=(0,b.A)(e,4),s=i[0],n=i[1],a=i[2],r=i[3];if(8===t.length){const e=t.subarray(2,6),i=(0,b.A)(e,4),o=i[0],l=i[1],h=i[2],c=i[3];if(a===o&&r===l&&s===h&&n===c)return}const o=this.container.style;let l;if((0,c.A)(this,oc)){const t=o.borderColor,e=o.borderWidth;o.borderWidth=0,l=["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="'.concat(t,'" stroke-width="').concat(e,'">')],this.container.classList.add("hasBorder")}const h=a-s,d=r-n,u=this.svgFactory,A=u.createElement("svg");A.classList.add("quadrilateralsContainer"),A.setAttribute("width",0),A.setAttribute("height",0);const p=u.createElement("defs");A.append(p);const g=u.createElement("clipPath"),f="clippath_".concat(this.data.id);g.setAttribute("id",f),g.setAttribute("clipPathUnits","objectBoundingBox"),p.append(g);for(let c=2,m=t.length;c<m;c+=8){var v;const e=t[c],i=t[c+1],n=t[c+2],a=t[c+3],o=u.createElement("rect"),A=(n-s)/h,p=(r-i)/d,f=(e-n)/h,m=(i-a)/d;o.setAttribute("x",A),o.setAttribute("y",p),o.setAttribute("width",f),o.setAttribute("height",m),g.append(o),null===(v=l)||void 0===v||v.push('<rect vector-effect="non-scaling-stroke" x="'.concat(A,'" y="').concat(p,'" width="').concat(f,'" height="').concat(m,'"/>'))}(0,c.A)(this,oc)&&(l.push("</g></svg>')"),o.backgroundImage=l.join("")),this.container.append(A),this.container.style.clipPath="url(#".concat(f,")")}_createPopup(){const t=this.data,e=(0,d.A)(this,lc,new Ec({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:"popup_".concat(t.id),rotation:t.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(e.render())}render(){kt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const s=this._fieldObjects[t];if(s)for(const t of s){const s=t.page,n=t.id,a=t.exportValues;if(-1===s)continue;if(n===e)continue;const r="string"===typeof a?a:null,o=document.querySelector('[data-element-id="'.concat(n,'"]'));!o||sc.has(o)?i.push({id:n,exportValue:r,domElement:o}):yt("_getElementsByName - element not allowed: ".concat(n))}return i}for(const s of document.getElementsByName(t)){const t=s.exportValue,n=s.getAttribute("data-element-id");n!==e&&(sc.has(s)&&i.push({id:n,exportValue:t,domElement:s}))}return i}show(){var t;this.container&&(this.container.hidden=!1),null===(t=this.popup)||void 0===t||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),null===(t=this.popup)||void 0===t||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const t=this.annotationEditorType,e=this.data.id;this.container.addEventListener("dblclick",(()=>{var i;null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})}))}}function dc(t){const e=this.container.style,i=this.data,s=i.rect,n=i.rotation,a=this.parent.viewport.rawDims,r=a.pageWidth,o=a.pageHeight,l=a.pageX,h=a.pageY;null===s||void 0===s||s.splice(0,4,...t);const c=nc(t),d=c.width,u=c.height;e.left="".concat(100*(t[0]-l)/r,"%"),e.top="".concat(100*(o-t[3]+h)/o,"%"),0===n?(e.width="".concat(100*d/r,"%"),e.height="".concat(100*u/o,"%")):this.setRotation(n)}var uc=new WeakSet,Ac=new WeakSet,pc=new WeakSet;class gc extends cc{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(t,{isRenderable:!0,ignoreBorder:!(null===e||void 0===e||!e.ignoreBorder),createQuadrilaterals:!0}),(0,o.A)(this,pc),(0,o.A)(this,Ac),(0,o.A)(this,uc),this.isTooltipOnly=t.data.isTooltipOnly}render(){const t=this.data,e=this.linkService,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let s=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(i,t.action),s=!0):t.attachment?((0,h.A)(this,Ac,vc).call(this,i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?((0,h.A)(this,pc,mc).call(this,i,t.setOCGState),s=!0):t.dest?(this._bindLink(i,t.dest),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),s=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(i,""),s=!0)),this.container.classList.add("linkA
1nnotation"),s&&this.container.append(i),this.container}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&(0,h.A)(this,uc,fc).call(this)}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),(0,h.A)(this,uc,fc).call(this)}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const s of Object.keys(e.actions)){const n=i.get(s);n&&(t[n]=()=>{var t;return null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1})}t.onclick||(t.onclick=()=>!1),(0,h.A)(this,uc,fc).call(this)}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),(0,h.A)(this,uc,fc).call(this),!this._fieldObjects)return yt('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{null===i||void 0===i||i();const t=e.fields,s=e.refs,n=e.include,a=[];if(0!==t.length||0!==s.length){const e=new Set(s);for(const i of t){const t=this._fieldObjects[i]||[];for(const i of t){const t=i.id;e.add(t)}}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===n&&a.push(i)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const r=this.annotationStorage,o=[];for(const e of a){const t=e.id;switch(o.push(t),e.type){case"text":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;r.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}default:continue}const i=document.querySelector('[data-element-id="'.concat(t,'"]'));i&&(sc.has(i)?i.dispatchEvent(new Event("resetform")):yt("_bindResetFormAction - element not allowed: ".concat(t)))}var l;this.enableScripting&&(null===(l=this.linkService.eventBus)||void 0===l||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}));return!1}}}function fc(){this.container.setAttribute("data-internal-link","")}function vc(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>{var t;return null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(e.content,e.filename,i),!1},(0,h.A)(this,uc,fc).call(this)}function mc(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),(0,h.A)(this,uc,fc).call(this)}class wc extends cc{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class bc extends cc{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&("CANVAS"===(null===(e=t.previousSibling)||void 0===e?void 0:e.nodeName)&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Ot.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,n){i.includes("mouse")?t.addEventListener(i,(t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})})):t.addEventListener(i,(t=>{var a;if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}n&&(null===(a=this.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(t)}}))}))}_setEventListeners(t,e,i,s){for(const l of i){var n,a=(0,b.A)(l,2);const i=a[0],h=a[1];var r,o;
1if("Action"===h||null!==(n=this.data.actions)&&void 0!==n&&n[h])"Focus"!==h&&"Blur"!==h||e||(e={focused:!1}),this._setEventListener(t,e,i,h,s),"Focus"!==h||null!==(r=this.data.actions)&&void 0!==r&&r.Blur?"Blur"!==h||null!==(o=this.data.actions)&&void 0!==o&&o.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null)}}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":Ht.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],i=this.data.defaultAppearanceData.fontColor,s=this.data.defaultAppearanceData.fontSize||9,n=t.style;let a;const r=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),e=t/(Math.round(t/(M*s))||1);a=Math.min(s,r(e/M))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(s,r(t/M))}n.fontSize="calc(".concat(a,"px * var(--scale-factor))"),n.color=Ht.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class _c extends bc{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,s){const n=this.annotationStorage;
1for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=i),n.setValue(a.id,{[s]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){var s;const o=t.getValue(e,{value:this.data.fieldValue});let l=o.value||"";const h=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;h&&l.length>h&&(l=l.slice(0,h));let c=o.formattedValue||(null===(s=this.data.textContent)||void 0===s?void 0:s.join("\n"))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const d={userValue:l,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};var n,a;if(this.data.multiLine)i=document.createElement("textarea"),i.textContent=null!==(n=c)&&void 0!==n?n:l,this.data.doNotScroll&&(i.style.overflowY="hidden");else i=document.createElement("input"),i.type="text",i.setAttribute("value",null!==(a=c)&&void 0!==a?a:l),this.data.doNotScroll&&(i.style.overflowX="hidden");this.data.hasOwnCanvas&&(i.hidden=!0),sc.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=ic,this._setRequired(i,this.data.required),h&&(i.maxLength=h),i.addEventListener("input",(s=>{t.setValue(e,{value:s.target.value}),this.setPropertyOnSiblings(i,"value",s.target.value,"value"),d.formattedValue=null})),i.addEventListener("resetform",(t=>{var e;const s=null!==(e=this.data.defaultFieldValue)&&void 0!==e?e:"";i.value=d.userValue=s,d.formattedValue=null}));let u=t=>{const e=d.formattedValue;null!==e&&void 0!==e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var r;i.addEventListener("focus",(t=>{var e;if(d.focused)return;const i=t.target;d.userValue&&(i.value=d.userValue),d.lastCommittedValue=i.value,d.commitKey=1,null!==(e=this.data.actions)&&void 0!==e&&e.Focus||(d.focused=!0)})),i.addEventListener("updatefromsandbox",(i=>{this.showElementAndHideCanvas(i.target);const s={value(i){var s;d.userValue=null!==(s=i.detail.value)&&void 0!==s?s:"",t.setValue(e,{value:d.userValue.toString()}),i.target.value=d.userValue},formattedValue(i){const s=i.detail.formattedValue;d.formattedValue=s,null!==s&&void 0!==s&&i.target!==document.activeElement&&(i.target.value=s),t.setValue(e,{formattedValue:s})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{var s;const n=i.detail.charLimit,a=i.target;if(0===n)return void a.removeAttribute("maxLength");a.setAttribute("maxLength",n);let r=d.userValue;!r||r.length<=n||(r=r.slice(0,n),a.value=d.userValue=r,t.setValue(e,{value:r}),null===(s=this.linkService.eventBus)||void 0===s||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:a.selectionStart,selEnd:a.selectionEnd}}))}};this._dispatchEventFromSandbox(s,i)})),i.addEventListener("keydown",(t=>{var i;d.commitKey=1;let s=-1;if("Escape"===t.key?s=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(d.commitKey=3):s=2,-1===s)return;const n=t.target.value;d.lastCommittedValue!==n&&(d.lastCommittedValue=n,d.userValue=n,null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:s,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))}));const s=u;u=null,i.addEventListener("blur",(t=>{var i;if(!d.focused||!t.relatedTarget)return;null!==(i=this.data.actions)&&void 0!==i&&i.Blur||(d.focused=!1);const n=t.target.value;var a;(d.userValue=n,d.lastCommittedValue!==n)&&(null===(a=this.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:d.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}));s(t)})),null!==(r=this.data.actions)&&void 0!==r&&r.Keystroke&&i.addEventListener("beforeinput",(t=>{var i;d.lastCommittedValue=null;const s=t.data,n=t.target,a=n.value,r=n.selectionStart,o=n.selectionEnd;let l=r,h=o;switch(t.inputType){case"deleteWordBackward":{const t=a.substring(0,r).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}
1case"deleteWordForward":{const t=a.substring(r).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":r===o&&(l-=1);break;case"deleteContentForward":r===o&&(h+=1)}t.preventDefault(),null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,change:s||"",willCommit:!1,selStart:l,selEnd:h}})})),this._setEventListeners(i,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.value))}if(u&&i.addEventListener("blur",u),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/h;i.classList.add("comb"),i.style.letterSpacing="calc(".concat(t,"px * var(--scale-factor) - 1ch)")}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class yc extends bc{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class kc extends bc{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"===typeof s&&(s="Off"!==s,t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return sc.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=ic,n.addEventListener("change",(s=>{const n=s.target,a=n.name,r=n.checked;for(const o of this._getElementsByName(a,i)){const i=r&&o.exportValue===e.exportValue;o.domElement&&(o.domElement.checked=i),t.setValue(o.id,{value:i})}t.setValue(i,{value:r})})),n.addEventListener("resetform",(t=>{const i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue})),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",(e=>{const s={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}};this._dispatchEventFromSandbox(s,e)})),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.checked))),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Sc extends bc{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"===typeof s&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(const a of this._getElementsByName(e.fieldName,i))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(sc.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.tabIndex=ic,n.addEventListener("change",(e=>{const s=e.target,n=s.name,a=s.checked;for(const r of this._getElementsByName(n,i))t.setValue(r.id,{value:!1});t.setValue(i,{value:a})})),n.addEventListener("resetform",(t=>{const i=e.defaultFieldValue;t.target.checked=null!==i&&void 0!==i&&i===e.buttonValue})),this.enableScripting&&this.hasJSActions){const s=e.buttonValue;n.addEventListener("updatefromsandbox",(e=>{const n={value:e=>{const n=s===e.detail.value;for(const s of this._getElementsByName(e.target.name)){const e=n&&s.id===i;s.domElement&&(s.domElement.checked=e),t.setValue(s.id,{value:e})}}};this._dispatchEventFromSandbox(n,e)})),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(t=>t.target.checked))}
1return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class xc extends gc{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",(t=>{this._dispatchEventFromSandbox({},t)}))),t}}class Mc extends bc{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");sc.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=ic;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",(t=>{const e=this.data.defaultFieldValue;for(const i of s.options)i.selected=i.value===e}));for(const h of this.data.options){const t=document.createElement("option");t.textContent=h.displayValue,t.value=h.exportValue,i.value.includes(h.exportValue)&&(t.setAttribute("selected",!0),n=!1),s.append(t)}let a=null;if(n){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),s.prepend(t),a=()=>{t.remove(),s.removeEventListener("input",a),a=null},s.addEventListener("input",a)}const r=t=>{const e=t?"value":"textContent",i=s.options;return s.multiple?Array.prototype.filter.call(i,(t=>t.selected)).map((t=>t[e])):-1===i.selectedIndex?null:i[i.selectedIndex][e]};let o=r(!1);const l=t=>{const e=t.target.options;return Array.prototype.map.call(e,(t=>({displayValue:t.textContent,exportValue:t.value})))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",(i=>{const n={value(i){var n;null===(n=a)||void 0===n||n();const l=i.detail.value,h=new Set(Array.isArray(l)?l:[l]);for(const t of s.options)t.selected=h.has(t.value);t.setValue(e,{value:r(!0)}),o=r(!1)},multipleSelection(t){s.multiple=!0},remove(i){const n=s.options,a=i.detail.remove;if(n[a].selected=!1,s.remove(a),n.length>0){-1===Array.prototype.findIndex.call(n,(t=>t.selected))&&(n[0].selected=!0)}t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},clear(i){for(;0!==s.length;)s.remove(0);t.setValue(e,{value:null,items:[]}),o=r(!1)},insert(i){const n=i.detail.insert,a=n.index,h=n.displayValue,c=n.exportValue,d=s.children[a],u=document.createElement("option");u.textContent=h,u.value=c,d?d.before(u):s.append(u),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},items(i){const n=i.detail.items;for(;0!==s.length;)s.remove(0);for(const t of n){const e=t.displayValue,i=t.exportValue,n=document.createElement("option");n.textContent=e,n.value=i,s.append(n)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},indices(i){const s=new Set(i.detail.indices);for(const t of i.target.options)t.selected=s.has(t.index);t.setValue(e,{value:r(!0)}),o=r(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(n,i)})),s.addEventListener("input",(i=>{var s;const n=r(!0),a=r(!1);t.setValue(e,{value:n}),i.preventDefault(),null===(s=this.linkService.eventBus)||void 0===s||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:a,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(t=>t.target.value))):s.addEventListener("input",(function(i){t.setValue(e,{value:r(!0)})})),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Ec extends cc{constructor(t){const e=t.data,i=t.elements;super(t,{isRenderable:cc._hasPopupData(e)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new id({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}),e=[];for(const i of this.elements)i.popup=t,i.container.ariaHasPopup="dialog",e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map((t=>"".concat(Xt).concat(t))).join(",")),this.container}}
1var Cc=new WeakMap,Tc=new WeakMap,Rc=new WeakMap,Pc=new WeakMap,Ic=new WeakMap,Lc=new WeakMap,Dc=new WeakMap,Fc=new WeakMap,Wc=new WeakMap,Nc=new WeakMap,Oc=new WeakMap,Bc=new WeakMap,Hc=new WeakMap,zc=new WeakMap,jc=new WeakMap,Gc=new WeakMap,Vc=new WeakMap,Uc=new WeakMap,qc=new WeakMap,Xc=new WeakMap,Yc=new WeakMap,Kc=new WeakMap,Qc=new WeakSet,Jc=new WeakSet,Zc=new WeakSet,$c=new WeakSet,td=new WeakSet,ed=new WeakSet;class id{constructor(t){let e=t.container,i=t.color,s=t.elements,n=t.titleObj,a=t.modificationDate,r=t.contentsObj,u=t.richText,A=t.parent,p=t.rect,g=t.parentRect,f=t.open;(0,o.A)(this,ed),(0,o.A)(this,td),(0,o.A)(this,$c),(0,o.A)(this,Zc),(0,o.A)(this,Jc),(0,o.A)(this,Qc),(0,l.A)(this,Kc,{get:ad,set:void 0}),(0,l.A)(this,Yc,{get:nd,set:void 0}),(0,l.A)(this,Xc,{get:sd,set:void 0}),(0,l.A)(this,Cc,{writable:!0,value:(0,h.A)(this,Jc,od).bind(this)}),(0,l.A)(this,Tc,{writable:!0,value:(0,h.A)(this,ed,dd).bind(this)}),(0,l.A)(this,Rc,{writable:!0,value:(0,h.A)(this,td,cd).bind(this)}),(0,l.A)(this,Pc,{writable:!0,value:(0,h.A)(this,$c,hd).bind(this)}),(0,l.A)(this,Ic,{writable:!0,value:null}),(0,l.A)(this,Lc,{writable:!0,value:null}),(0,l.A)(this,Dc,{writable:!0,value:null}),(0,l.A)(this,Fc,{writable:!0,value:null}),(0,l.A)(this,Wc,{writable:!0,value:null}),(0,l.A)(this,Nc,{writable:!0,value:null}),(0,l.A)(this,Oc,{writable:!0,value:null}),(0,l.A)(this,Bc,{writable:!0,value:!1}),(0,l.A)(this,Hc,{writable:!0,value:null}),(0,l.A)(this,zc,{writable:!0,value:null}),(0,l.A)(this,jc,{writable:!0,value:null}),(0,l.A)(this,Gc,{writable:!0,value:null}),(0,l.A)(this,Vc,{writable:!0,value:null}),(0,l.A)(this,Uc,{writable:!0,value:null}),(0,l.A)(this,qc,{writable:!0,value:!1}),(0,d.A)(this,Lc,e),(0,d.A)(this,Vc,n),(0,d.A)(this,Dc,r),(0,d.A)(this,Gc,u),(0,d.A)(this,Nc,A),(0,d.A)(this,Ic,i),(0,d.A)(this,jc,p),(0,d.A)(this,Oc,g),(0,d.A)(this,Wc,s),(0,d.A)(this,Fc,oe.toDateObject(a)),this.trigger=s.flatMap((t=>t.getElementsToTriggerPopup()));for(const o of this.trigger)o.addEventListener("click",(0,c.A)(this,Pc)),o.addEventListener("mouseenter",(0,c.A)(this,Rc)),o.addEventListener("mouseleave",(0,c.A)(this,Tc)),o.classList.add("popupTriggerArea");for(const o of s){var v;null===(v=o.container)||void 0===v||v.addEventListener("keydown",(0,c.A)(this,Cc))}(0,c.A)(this,Lc).hidden=!0,f&&(0,h.A)(this,$c,hd).call(this)}render(){if((0,c.A)(this,Hc))return;const t=(0,d.A)(this,Hc,document.createElement("div"));if(t.className="popup",(0,c.A)(this,Ic)){const e=t.style.outlineColor=Ht.makeHexColor(...(0,c.A)(this,Ic));if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))t.style.backgroundColor="color-mix(in srgb, ".concat(e," 30%, white)");else{const e=.7;t.style.backgroundColor=Ht.makeHexColor(...(0,c.A)(this,Ic).map((t=>Math.floor(e*(255-t)+t))))}}const e=document.createElement("span");e.className="header";const i=document.createElement("h1");e.append(i);var s=(0,c.A)(this,Vc);if(i.dir=s.dir,i.textContent=s.str,t.append(e),(0,c.A)(this,Fc)){const t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:(0,c.A)(this,Fc).valueOf()})),e.append(t)}const n=(0,c.A)(this,Xc);if(n)ec.render({xfaHtml:n,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const e=this._formatContents((0,c.A)(this,Dc));t.append(e)}(0,c.A)(this,Lc).append(t)}_formatContents(t){let e=t.str,i=t.dir;const s=document.createElement("p");s.classList.add("popupContent"),s.dir=i;const n=e.split(/(?:\r\n?|\n)/);for(let a=0,r=n.length;a<r;++a){const t=n[a];s.append(document.createTextNode(t)),a<r-1&&s.append(document.createElement("br"))}return s}updateEdited(t){var e;let i=t.rect,s=t.popupContent;(0,c.A)(this,Uc)||(0,d.A)(this,Uc,{contentsObj:(0,c.A)(this,Dc),richText:(0,c.A)(this,Gc)}),i&&(0,d.A)(this,zc,null),s&&((0,d.A)(this,Gc,(0,h.A)(this,Qc,rd).call(this,s)),(0,d.A)(this,Dc,null)),null===(e=(0,c.A)(this,Hc))||void 0===e||e.remove(),(0,d.A)(this,Hc,null)}resetEdited(){var t;if((0,c.A)(this,Uc)){var e=(0,c.A)(this,Uc);a(this,Dc).value=e.contentsObj,a(this,Gc).value=e.richText,(0,d.A)(this,Uc,null),null===(t=(0,c.A)(this,Hc))||void 0===t||t.remove(),(0,d.A)(this,Hc,null),(0,d.A)(this,zc,null)}}forceHide(){(0,d.A)(this,qc,this.isVisible),(0,c.A)(this,qc)&&((0,c.A)(this,Lc).hidden=!0)}maybeShow(){(0,c.A)(this,qc)&&((0,c.A)(this,Hc)||(0,h.A)(this,td,cd).call(this),(0,d.A)(this,qc,!1),(0,c.A)(this,Lc).hidden=!1)}get isVisible(){return!1===(0,c.A)(this,Lc).hidden}}function sd(){const t=(0,c.A)(this,Gc),e=(0,c.A)(this,Dc);return null===t||void 0===t||!t.str||null!==e&&void 0!==e&&e.str&&e.str!==t.str?null:(0,c.A)(this,Gc).html||null}
1function nd(){var t,e,i;return(null===(t=(0,c.A)(this,Xc))||void 0===t||null===(e=t.attributes)||void 0===e||null===(i=e.style)||void 0===i?void 0:i.fontSize)||0}function ad(){var t,e,i;return(null===(t=(0,c.A)(this,Xc))||void 0===t||null===(e=t.attributes)||void 0===e||null===(i=e.style)||void 0===i?void 0:i.color)||null}function rd(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:(0,c.A)(this,Kc),fontSize:(0,c.A)(this,Yc)?"calc(".concat((0,c.A)(this,Yc),"px * var(--scale-factor))"):""}};for(const n of t.split("\n"))e.push({name:"span",value:n,attributes:s});return i}function od(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&(0,c.A)(this,Bc))&&(0,h.A)(this,$c,hd).call(this)}function ld(){if(null!==(0,c.A)(this,zc))return;const t=(0,c.A)(this,Nc),e=t.page.view,i=t.viewport.rawDims,s=i.pageWidth,n=i.pageHeight,a=i.pageX,r=i.pageY;let o=!!(0,c.A)(this,Oc),l=o?(0,c.A)(this,Oc):(0,c.A)(this,jc);for(const d of(0,c.A)(this,Wc))if(!l||null!==Ht.intersect(d.data.rect,l)){l=d.data.rect,o=!0;break}const h=Ht.normalizeRect([l[0],e[3]-l[1]+e[1],l[2],e[3]-l[3]+e[1]]),u=o?l[2]-l[0]+5:0,A=h[0]+u,p=h[1];(0,d.A)(this,zc,[100*(A-a)/s,100*(p-r)/n]);const g=(0,c.A)(this,Lc).style;g.left="".concat((0,c.A)(this,zc)[0],"%"),g.top="".concat((0,c.A)(this,zc)[1],"%")}function hd(){(0,d.A)(this,Bc,!(0,c.A)(this,Bc)),(0,c.A)(this,Bc)?((0,h.A)(this,td,cd).call(this),(0,c.A)(this,Lc).addEventListener("click",(0,c.A)(this,Pc)),(0,c.A)(this,Lc).addEventListener("keydown",(0,c.A)(this,Cc))):((0,h.A)(this,ed,dd).call(this),(0,c.A)(this,Lc).removeEventListener("click",(0,c.A)(this,Pc)),(0,c.A)(this,Lc).removeEventListener("keydown",(0,c.A)(this,Cc)))}function cd(){(0,c.A)(this,Hc)||this.render(),this.isVisible?(0,c.A)(this,Bc)&&(0,c.A)(this,Lc).classList.add("focused"):((0,h.A)(this,Zc,ld).call(this),(0,c.A)(this,Lc).hidden=!1,(0,c.A)(this,Lc).style.zIndex=parseInt((0,c.A)(this,Lc).style.zIndex)+1e3)}function dd(){(0,c.A)(this,Lc).classList.remove("focused"),!(0,c.A)(this,Bc)&&this.isVisible&&((0,c.A)(this,Lc).hidden=!0,(0,c.A)(this,Lc).style.zIndex=parseInt((0,c.A)(this,Lc).style.zIndex)-1e3)}class ud extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=W.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Ad=new WeakMap;class pd extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,l.A)(this,Ad,{writable:!0,value:null})}render(){this.container.classList.add("lineAnnotation");const t=this.data,e=nc(t.rect),i=e.width,s=e.height,n=this.svgFactory.create(i,s,!0),a=(0,d.A)(this,Ad,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,c.A)(this,Ad)}addHighlightArea(){this.container.classList.add("highlightArea")}}var gd=new WeakMap;class fd extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,l.A)(this,gd,{writable:!0,value:null})}render(){this.container.classList.add("squareAnnotation");const t=this.data,e=nc(t.rect),i=e.width,s=e.height,n=this.svgFactory.create(i,s,!0),a=t.borderStyle.width,r=(0,d.A)(this,gd,this.svgFactory.createElement("svg:rect"));return r.setAttribute("x",a/2),r.setAttribute("y",a/2),r.setAttribute("width",i-a),r.setAttribute("height",s-a),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,c.A)(this,gd)}addHighlightArea(){this.container.classList.add("highlightArea")}}var vd=new WeakMap;class md extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,l.A)(this,vd,{writable:!0,value:null})}render(){this.container.classList.add("circleAnnotation");
1const t=this.data,e=nc(t.rect),i=e.width,s=e.height,n=this.svgFactory.create(i,s,!0),a=t.borderStyle.width,r=(0,d.A)(this,vd,this.svgFactory.createElement("svg:ellipse"));return r.setAttribute("cx",i/2),r.setAttribute("cy",s/2),r.setAttribute("rx",i/2-a/2),r.setAttribute("ry",s/2-a/2),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,c.A)(this,vd)}addHighlightArea(){this.container.classList.add("highlightArea")}}var wd=new WeakMap;class bd extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,l.A)(this,wd,{writable:!0,value:null}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const t=this.data,e=t.rect,i=t.vertices,s=t.borderStyle,n=t.popupRef;if(!i)return this.container;const a=nc(e),r=a.width,o=a.height,l=this.svgFactory.create(r,o,!0);let h=[];for(let d=0,u=i.length;d<u;d+=2){const t=i[d]-e[0],s=e[3]-i[d+1];h.push("".concat(t,",").concat(s))}h=h.join(" ");const c=(0,d.A)(this,wd,this.svgFactory.createElement(this.svgElementName));return c.setAttribute("points",h),c.setAttribute("stroke-width",s.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),l.append(c),this.container.append(l),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,c.A)(this,wd)}addHighlightArea(){this.container.classList.add("highlightArea")}}class _d extends bd{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class yd extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var kd=new WeakMap,Sd=new WeakMap,xd=new WeakSet;class Md extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,o.A)(this,xd),(0,l.A)(this,kd,{writable:!0,value:null}),(0,l.A)(this,Sd,{writable:!0,value:[]}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?W.HIGHLIGHT:W.INK}render(){this.container.classList.add(this.containerClassName);const t=this.data,e=t.rect,i=t.rotation,s=t.inkLists,n=t.borderStyle,a=t.popupRef,r=(0,h.A)(this,xd,Ed).call(this,i,e),o=r.transform,l=r.width,u=r.height,A=this.svgFactory.create(l,u,!0),p=(0,d.A)(this,kd,this.svgFactory.createElement("svg:g"));A.append(p),p.setAttribute("stroke-width",n.width||1),p.setAttribute("stroke-linecap","round"),p.setAttribute("stroke-linejoin","round"),p.setAttribute("stroke-miterlimit",10),p.setAttribute("stroke","transparent"),p.setAttribute("fill","transparent"),p.setAttribute("transform",o);for(let h=0,d=s.length;h<d;h++){const t=this.svgFactory.createElement(this.svgElementName);(0,c.A)(this,Sd).push(t),t.setAttribute("points",s[h].join(",")),p.append(t)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(A),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const e=t.thickness,i=t.points,s=t.rect,n=(0,c.A)(this,kd);if(e>=0&&n.setAttribute("stroke-width",e||1),i)for(let a=0,r=(0,c.A)(this,Sd).length;a<r;a++)(0,c.A)(this,Sd)[a].setAttribute("points",i[a].join(","));if(s){const t=(0,h.A)(this,xd,Ed).call(this,this.data.rotation,s),e=t.transform,i=t.width,a=t.height;n.parentElement.setAttribute("viewBox","0 0 ".concat(i," ").concat(a)),n.setAttribute("transform",e)}}getElementsToTriggerPopup(){return(0,c.A)(this,Sd)}addHighlightArea(){this.container.classList.add("highlightArea")}}function Ed(t,e){switch(t){case 90:return{transform:"rotate(90) translate(".concat(-e[0],",").concat(e[1],") scale(1,-1)"),width:e[3]-e[1],height:e[2]-e[0]};case 180:return{transform:"rotate(180) translate(".concat(-e[2],",").concat(e[1],") scale(1,-1)"),width:e[2]-e[0],height:e[3]-e[1]};case 270:return{transform:"rotate(270) translate(".concat(-e[2],",").concat(e[3],") scale(1,-1)"),width:e[3]-e[1],height:e[2]-e[0]};default:return{transform:"translate(".concat(-e[0],",").concat(e[3],") scale(1,-1)"),width:e[2]-e[0],height:e[3]-e[1]}}}class Cd extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=W.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}
1class Td extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class Rd extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class Pd extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class Id extends cc{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=W.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Ld=new WeakMap,Dd=new WeakSet;class Fd extends cc{constructor(t){var e;super(t,{isRenderable:!0}),(0,o.A)(this,Dd),(0,l.A)(this,Ld,{writable:!0,value:null});const i=this.data.file;this.filename=i.filename,this.content=i.content,null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("fileattachmentannotation",(0,s.A)({source:this},i))}render(){this.container.classList.add("fileAttachmentAnnotation");const t=this.container,e=this.data;let i;e.hasAppearance||0===e.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(e.name)?"paperclip":"pushpin",".svg"),e.fillAlpha&&e.fillAlpha<1&&(i.style="filter: opacity(".concat(Math.round(100*e.fillAlpha),"%);"))),i.addEventListener("dblclick",(0,h.A)(this,Dd,Wd).bind(this)),(0,d.A)(this,Ld,i);const s=Ot.platform.isMac;return t.addEventListener("keydown",(t=>{"Enter"===t.key&&(s?t.metaKey:t.ctrlKey)&&(0,h.A)(this,Dd,Wd).call(this)})),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return(0,c.A)(this,Ld)}addHighlightArea(){this.container.classList.add("highlightArea")}}function Wd(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.content,this.filename)}var Nd=new WeakMap,Od=new WeakMap,Bd=new WeakMap,Hd=new WeakMap,zd=new WeakSet,jd=new WeakSet;class Gd{constructor(t){let e=t.div,i=t.accessibilityManager,s=t.annotationCanvasMap,n=t.annotationEditorUIManager,a=t.page,r=t.viewport,h=t.structTreeLayer;(0,o.A)(this,jd),(0,o.A)(this,zd),(0,l.A)(this,Nd,{writable:!0,value:null}),(0,l.A)(this,Od,{writable:!0,value:null}),(0,l.A)(this,Bd,{writable:!0,value:new Map}),(0,l.A)(this,Hd,{writable:!0,value:null}),this.div=e,(0,d.A)(this,Nd,i),(0,d.A)(this,Od,s),(0,d.A)(this,Hd,h||null),this.page=a,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=n}hasEditableAnnotations(){return(0,c.A)(this,Bd).size>0}async render(t){const e=t.annotations,i=this.div;Ae(i,this.viewport);const s=new Map,n={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new tc,annotationStorage:t.annotationStorage||new Ba,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const r of e){if(r.noHTML)continue;const t=r.annotationType===ot;if(t){const t=s.get(r.id);if(!t)continue;n.elements=t}else{const t=nc(r.rect),e=t.width,i=t.height;if(e<=0||i<=0)continue}n.data=r;const e=ac.create(n);if(!e.isRenderable)continue;if(!t&&r.popupRef){const t=s.get(r.popupRef);t?t.push(e):s.set(r.popupRef,[e])}const i=e.render();var a;if(r.hidden&&(i.style.visibility="hidden"),await(0,h.A)(this,zd,Vd).call(this,i,r.id),e._isEditable)(0,c.A)(this,Bd).set(e.data.id,e),null===(a=this._annotationEditorUIManager)||void 0===a||a.renderAnnotationElement(e)}(0,h.A)(this,jd,Ud).call(this)}update(t){let e=t.viewport;const i=this.div;this.viewport=e,Ae(i,{rotation:e.rotation}
1),(0,h.A)(this,jd,Ud).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from((0,c.A)(this,Bd).values())}getEditableAnnotation(t){return(0,c.A)(this,Bd).get(t)}}async function Vd(t,e){var i,s;const n=t.firstChild||t,a=n.id="".concat(Xt).concat(e),r=await(null===(i=(0,c.A)(this,Hd))||void 0===i?void 0:i.getAriaAttributes(a));if(r)for(const l of r){var o=(0,b.A)(l,2);const t=o[0],e=o[1];n.setAttribute(t,e)}this.div.append(t),null===(s=(0,c.A)(this,Nd))||void 0===s||s.moveElementInDOM(this.div,t,n,!1)}function Ud(){if(!(0,c.A)(this,Od))return;const t=this.div;for(const i of(0,c.A)(this,Od)){var e=(0,b.A)(i,2);const s=e[0],n=e[1],a=t.querySelector('[data-annotation-id="'.concat(s,'"]'));if(!a)continue;n.className="annotationContent";const r=a.firstChild;r?"CANVAS"===r.nodeName?r.replaceWith(n):r.classList.contains("annotationContent")?r.after(n):r.before(n):a.append(n)}(0,c.A)(this,Od).clear()}const qd=/\r\n?|\n/g;var Xd=new WeakMap,Yd=new WeakMap,Kd=new WeakMap,Qd=new WeakMap,Jd=new WeakMap,Zd=new WeakSet,$d=new WeakSet,tu=new WeakSet,eu=new WeakSet,iu=new WeakSet,su=new WeakSet,nu=new WeakSet;class au extends ha{static get _keyboardManager(){const t=au.prototype,e=t=>t.isEmpty(),i=fs.TRANSLATE_SMALL,s=fs.TRANSLATE_BIG;return Mt(this,"_keyboardManager",new ni([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}]]))}constructor(t){super((0,s.A)((0,s.A)({},t),{},{name:"freeTextEditor"})),(0,o.A)(this,nu),(0,o.A)(this,su),(0,o.A)(this,iu),(0,o.A)(this,eu),(0,o.A)(this,tu),(0,o.A)(this,$d),(0,o.A)(this,Zd),(0,l.A)(this,Xd,{writable:!0,value:void 0}),(0,l.A)(this,Yd,{writable:!0,value:""}),(0,l.A)(this,Kd,{writable:!0,value:"".concat(this.id,"-editor")}),(0,l.A)(this,Qd,{writable:!0,value:null}),(0,l.A)(this,Jd,{writable:!0,value:void 0}),(0,d.A)(this,Xd,t.color||au._defaultColor||ha._defaultLineColor),(0,d.A)(this,Jd,t.fontSize||au._defaultFontSize)}static initialize(t,e){ha.initialize(t,e);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case N.FREETEXT_SIZE:au._defaultFontSize=e;break;case N.FREETEXT_COLOR:au._defaultColor=e}}updateParams(t,e){switch(t){case N.FREETEXT_SIZE:(0,h.A)(this,Zd,ru).call(this,e);break;case N.FREETEXT_COLOR:(0,h.A)(this,$d,ou).call(this,e)}}static get defaultPropertiesToUpdate(){return[[N.FREETEXT_SIZE,au._defaultFontSize],[N.FREETEXT_COLOR,au._defaultColor||ha._defaultLineColor]]}get propertiesToUpdate(){return[[N.FREETEXT_SIZE,(0,c.A)(this,Jd)],[N.FREETEXT_COLOR,(0,c.A)(this,Xd)]]}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-au._internalPadding*t,-(au._internalPadding+(0,c.A)(this,Jd))*t]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(W.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),(0,d.A)(this,Qd,new AbortController);const t=this._uiManager.combinedSignal((0,c.A)(this,Qd));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t})}disableEditMode(){var t;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",(0,c.A)(this,Kd)),this._isDraggable=!0,null===(t=(0,c.A)(this,Qd)
1)||void 0===t||t.abort(),(0,d.A)(this,Qd,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var e;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),null!==(e=this._initialOptions)&&void 0!==e&&e.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 t=(0,c.A)(this,Yd),e=(0,d.A)(this,Yd,(0,h.A)(this,tu,lu).call(this).trimEnd());if(t===e)return;const i=t=>{(0,d.A)(this,Yd,t),t?((0,h.A)(this,iu,du).call(this),this._uiManager.rebuild(this),(0,h.A)(this,eu,hu).call(this)):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),(0,h.A)(this,eu,hu).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){au._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){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 t,e;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",(0,c.A)(this,Kd)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const i=this.editorDiv.style;if(i.fontSize="calc(".concat((0,c.A)(this,Jd),"px * var(--scale-factor))"),i.color=(0,c.A)(this,Xd),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Ge(this,this.div,["dblclick","keydown"]),this.width){const i=(0,b.A)(this.parentDimensions,2),l=i[0],c=i[1];if(this.annotationElementId){const i=this._initialData.position;let h=this.getInitialTranslation(),d=(0,b.A)(h,2),u=d[0],A=d[1];var s=this.pageTranslationToScreen(u,A),n=(0,b.A)(s,2);u=n[0],A=n[1];const p=(0,b.A)(this.pageDimensions,2),g=p[0],f=p[1],v=(0,b.A)(this.pageTranslation,2),m=v[0],w=v[1];let _,y;switch(this.rotation){case 0:_=t+(i[0]-m)/g,y=e+this.height-(i[1]-w)/f;break;case 90:_=t+(i[0]-m)/g,y=e-(i[1]-w)/f;var a=[A,-u];u=a[0],A=a[1];break;case 180:_=t-this.width+(i[0]-m)/g,y=e-(i[1]-w)/f;var r=[-u,-A];u=r[0],A=r[1];break;case 270:_=t+(i[0]-m-this.height*f)/g,y=e+(i[1]-w-this.width*g)/f;var o=[-A,u];u=o[0],A=o[1]}this.setAt(_*l,y*c,u,A)}else this.setAt(t*l,e*c,this.width*l,this.height*c);(0,h.A)(this,iu,du).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,i=e.types;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();const s=w(au,au,Au).call(au,e.getData("text")||"").replaceAll(qd,"\n");if(!s)return;const n=window.getSelection();if(!n.rangeCount)return;this.editorDiv.normalize(),n.deleteFromDocument();const a=n.getRangeAt(0);if(!s.includes("\n"))return a.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),void n.collapseToStart();const r=a.startContainer,o=a.startOffset,l=[],c=[];if(r.nodeType===Node.TEXT_NODE){const t=r.parentElement;if(c.push(r.nodeValue.slice(o).replaceAll(qd,"")),t!==this.editorDiv){let e=l;for(const i of this.editorDiv.childNodes)i!==t?e.push(w(au,au,cu).call(au,i)):e=c}l.push(r.nodeValue.slice(0,o).replaceAll(qd,""))}else if(r===this.editorDiv){let t=l,e=0;for(const i of this.editorDiv.childNodes)e++===o&&(t=c),t.push(w(au,au,cu).call(au,i))}(0,d.A)(this,Yd,"".concat(l.join("\n")).concat(s).concat(c.join("\n"))),(0,h.A)(this,iu,du).call(this);const u=new Range;let A=l.reduce(((t,e)=>t+e.length),0);for(const h of this.editorDiv.childNodes){const t=h.firstChild;
1if(t.nodeType===Node.TEXT_NODE){const e=t.nodeValue.length;if(A<=e){u.setStart(t,A),u.setEnd(t,A);break}A-=e}}n.removeAllRanges(),n.addRange(u)}get contentDiv(){return this.editorDiv}static async deserialize(t,e,i){let s=null;if(t instanceof ud){const e=t,i=e.data,n=i.defaultAppearanceData,a=n.fontSize,r=n.fontColor,o=i.rect,l=i.rotation,h=i.id,c=i.popupRef,d=e.textContent,u=e.textPosition,A=e.parent.page.pageNumber;if(!d||0===d.length)return null;s=t={annotationType:W.FREETEXT,color:Array.from(r),fontSize:a,value:d.join("\n"),position:u,pageIndex:A-1,rect:o.slice(0),rotation:l,id:h,deleted:!1,popupRef:c}}const n=await super.deserialize(t,e,i);return(0,d.A)(n,Jd,t.fontSize),(0,d.A)(n,Xd,Ht.makeHexColor(...t.color)),(0,d.A)(n,Yd,w(au,au,Au).call(au,t.value)),n.annotationElementId=t.id||null,n._initialData=s,n}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=au._internalPadding*this.parentScale,i=this.getRect(e,e),s=ha._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:(0,c.A)(this,Xd)),n={annotationType:W.FREETEXT,color:s,fontSize:(0,c.A)(this,Jd),value:(0,h.A)(this,su,uu).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!(0,h.A)(this,nu,pu).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(this.deleted)return e;const i=e.style;i.fontSize="calc(".concat((0,c.A)(this,Jd),"px * var(--scale-factor))"),i.color=(0,c.A)(this,Xd),e.replaceChildren();for(const n of(0,c.A)(this,Yd).split("\n")){const t=document.createElement("div");t.append(n?document.createTextNode(n):document.createElement("br")),e.append(t)}const s=au._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(s,s),popupContent:(0,c.A)(this,Yd)}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}function ru(t){const e=t=>{this.editorDiv.style.fontSize="calc(".concat(t,"px * var(--scale-factor))"),this.translate(0,-(t-(0,c.A)(this,Jd))*this.parentScale),(0,d.A)(this,Jd,t),(0,h.A)(this,eu,hu).call(this)},i=(0,c.A)(this,Jd);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:N.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function ou(t){const e=t=>{(0,d.A)(this,Xd,this.editorDiv.style.color=t)},i=(0,c.A)(this,Xd);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:N.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function lu(){const t=[];this.editorDiv.normalize();let e=null;for(const s of this.editorDiv.childNodes){var i;(null===(i=e)||void 0===i?void 0:i.nodeType)===Node.TEXT_NODE&&"BR"===s.nodeName||(t.push(w(au,au,cu).call(au,s)),e=s)}return t.join("\n")}function hu(){const t=(0,b.A)(this.parentDimensions,2),e=t[0],i=t[1];let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const t=this.currentLayer,e=this.div,i=e.style.display,n=e.classList.contains("hidden");e.classList.remove("hidden"),e.style.display="hidden",t.div.append(this.div),s=e.getBoundingClientRect(),e.remove(),e.style.display=i,e.classList.toggle("hidden",n)}this.rotation%180===this.parentRotation%180?(this.width=s.width/e,this.height=s.height/i):(this.width=s.height/e,this.height=s.width/i),this.fixAndSetPosition()}function cu(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(qd,"")}function du(){if(this.editorDiv.replaceChildren(),(0,c.A)(this,Yd))for(const t of(0,c.A)(this,Yd).split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}function uu(){return(0,c.A)(this,Yd).replaceAll("\xa0"," ")}function Au(t){return t.replaceAll(" ","\xa0")}function pu(t){const e=this._initialData,i=e.value,s=e.fontSize,n=e.color,a=e.pageIndex;return this._hasBeenMoved||t.value!==i||t.fontSize!==s||t.color.some(((t,e)=>t!==n[e]))||t.pageIndex!==a}(0,m.A)(au,"_freeTextDefaultContent",""),(0,m.A)(au,"_internalPadding",0),(0,m.A)(au,"_defaultColor",null),(0,m.A)(au,"_defaultFontSize",10),(0,m.A)(au,"_type","freetext"),(0,m.A)(au,"_editorType",W.FREETEXT);class gu{toSVGPath(){kt("Abstract method `toSVGPath` must be implemented.")}get box(){kt("Abstract getter `box` must be implemented.")}serialize(t,e){kt("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,s,n,a){a||(a=new Float32Array(t.length));for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r]*s,a[r+1]=i+t[r+1]*n;return a}static _rescaleAndSwap(t,e,i,s,n,a){a||(a=new Float32Array(t.length));for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r+1]*s,a[r+1]=i+t[r]*n;return a}static _translate(t,e,i,s){s||(s=new Float32Array(t.length));for(let n=0,a=t.length;n<a;n+=2)s[n]=e+t[n],s[n+1]=i+t[n+1];return s}static svgRound(t){return Math.round(1e4*t)}static _normalizePoint(t,e,i,s,n){switch(n){case 90:return[1-e/i,t/s];case 180:return[1-t/i,1-e/s];case 270:return[e/i,1-t/s];default:return[t/i,e/s]}}static _normalizePagePoint(t,e,i){switch(i){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,i,s,n,a){return[(t+5*i)/6,(e+5*s)/6,(5*i+n)/6,(5*s+a)/6,(i+n)/2,(s+a)/2]}}(0,m.A)(gu,"PRECISION",1e-4);var fu=new WeakMap,vu=new WeakMap,mu=new WeakMap,wu=new WeakMap,bu=new WeakMap,_u=new WeakMap,yu=new WeakMap,ku=new WeakMap,Su=new WeakMap,xu=new WeakMap,Mu=new WeakMap,Eu=new WeakMap,Cu=new WeakMap,Tu=new WeakSet,Ru=new WeakSet,Pu=new WeakSet,Iu=new WeakSet,Lu=new WeakSet,Du=new WeakSet,Fu=new WeakSet;class Wu{constructor(t,e,i,s,n){let a=t.x,r=t.y,h=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;(0,o.A)(this,Fu),(0,o.A)(this,Du),(0,o.A)(this,Lu),(0,o.A)(this,Iu),(0,o.A)(this,Pu),(0,o.A)(this,Ru),(0,o.A)(this,Tu),(0,l.A)(this,fu,{writable:!0,value:void 0}),(0,l.A)(this,vu,{writable:!0,value:[]}),(0,l.A)(this,mu,{writable:!0,value:void 0}),(0,l.A)(this,wu,{writable:!0,value:void 0}),(0,l.A)(this,bu,{writable:!0,value:[]}),(0,l.A)(this,_u,{writable:!0,value:new Float32Array(18)}),(0,l.A)(this,yu,{writable:!0,value:void 0}),(0,l.A)(this,ku,{writable:!0,value:void 0}),(0,l.A)(this,Su,{writable:!0,value:void 0}),(0,l.A)(this,xu,{writable:!0,value:void 0}),(0,l.A)(this,Mu,{writable:!0,value:void 0}),(0,l.A)(this,Eu,{writable:!0,value:void 0}),(0,l.A)(this,Cu,{writable:!0,value:[]}),(0,d.A)(this,fu,e),(0,d.A)(this,Eu,s*i),(0,d.A)(this,wu,n),(0,c.A)(this,_u).set([NaN,NaN,NaN,NaN,a,r],6),(0,d.A)(this,mu,h),(0,d.A)(this,xu,v(Wu,Wu,Vu)*i),(0,d.A)(this,Su,v(Wu,Wu,Uu)*i),(0,d.A)(this,Mu,i),(0,c.A)(this,Cu).push(a,r)}isEmpty(){return isNaN((0,c.A)(this,_u)[8])}add(t){var e;let i=t.x,s=t.y;(0,d.A)(this,yu,i),(0,d.A)(this,ku,s);const n=(0,c.A)(this,fu),a=(0,b.A)(n,4),r=a[0],o=a[1],l=a[2],h=a[3];let u=(0,c.A)(this,_u).subarray(8,12),A=(0,b.A)(u,4),p=A[0],g=A[1],f=A[2],v=A[3];const m=i-f,w=s-v,_=Math.hypot(m,w);if(_<(0,c.A)(this,Su))return!1;const y=_-(0,c.A)(this,xu),k=y/_,S=k*m,x=k*w;let M=p,E=g;p=f,g=v,f+=S,v+=x,null===(e=(0,c.A)(this,Cu))||void 0===e||e.push(i,s);const C=S/y,T=-x/y*(0,c.A)(this,Eu),R=C*(0,c.A)(this,Eu);if((0,c.A)(this,_u).set((0,c.A)(this,_u).subarray(2,8),0),(0,c.A)(this,_u).set([f+T,v+R],4),(0,c.A)(this,_u).set((0,c.A)(this,_u).subarray(14,18),12),(0,c.A)(this,_u).set([f-T,v-R],16),isNaN((0,c.A)(this,_u)[6]))return 0===(0,c.A)(this,bu).length&&((0,c.A)(this,_u).set([p+T,g+R],2),(0,c.A)(this,bu).push(NaN,NaN,NaN,NaN,(p+T-r)/l,(g+R-o)/h),(0,c.A)(this,_u).set([p-T,g-R],14),(0,c.A)(this,vu).push(NaN,NaN,NaN,NaN,(p-T-r)/l,(g-R-o)/h)),(0,c.A)(this,_u).set([M,E,p,g,f,v],6),!this.isEmpty();(0,c.A)(this,_u).set([M,E,p,g,f,v],6);if(Math.abs(Math.atan2(E-g,M-p)-Math.atan2(x,S))<Math.PI/2){var P=(0,c.A)(this,_u).subarray(2,6),I=(0,b.A)(P,4);p=I[0],g=I[1],f=I[2],v=I[3],(0,c.A)(this,bu).push(NaN,NaN,NaN,NaN,((p+f)/2-r)/l,((g+v)/2-o)/h);var L=(0,c.A)(this,_u).subarray(14,18),D=(0,b.A)(L,4);return p=D[0],g=D[1],M=D[2],E=D[3],(0,c.A)(this,vu).push(NaN,NaN,NaN,NaN,((M+p)/2-r)/l,((E+g)/2-o)
1/h),!0}var F=(0,c.A)(this,_u).subarray(0,6),W=(0,b.A)(F,6);M=W[0],E=W[1],p=W[2],g=W[3],f=W[4],v=W[5],(0,c.A)(this,bu).push(((M+5*p)/6-r)/l,((E+5*g)/6-o)/h,((5*p+f)/6-r)/l,((5*g+v)/6-o)/h,((p+f)/2-r)/l,((g+v)/2-o)/h);var N=(0,c.A)(this,_u).subarray(12,18),O=(0,b.A)(N,6);return f=O[0],v=O[1],p=O[2],g=O[3],M=O[4],E=O[5],(0,c.A)(this,vu).push(((M+5*p)/6-r)/l,((E+5*g)/6-o)/h,((5*p+f)/6-r)/l,((5*g+v)/6-o)/h,((p+f)/2-r)/l,((g+v)/2-o)/h),!0}toSVGPath(){if(this.isEmpty())return"";const t=(0,c.A)(this,bu),e=(0,c.A)(this,vu);if(isNaN((0,c.A)(this,_u)[6])&&!this.isEmpty())return(0,h.A)(this,Ru,Ou).call(this);const i=[];i.push("M".concat(t[4]," ").concat(t[5]));for(let s=6;s<t.length;s+=6)isNaN(t[s])?i.push("L".concat(t[s+4]," ").concat(t[s+5])):i.push("C".concat(t[s]," ").concat(t[s+1]," ").concat(t[s+2]," ").concat(t[s+3]," ").concat(t[s+4]," ").concat(t[s+5]));(0,h.A)(this,Iu,Hu).call(this,i);for(let s=e.length-6;s>=6;s-=6)isNaN(e[s])?i.push("L".concat(e[s+4]," ").concat(e[s+5])):i.push("C".concat(e[s]," ").concat(e[s+1]," ").concat(e[s+2]," ").concat(e[s+3]," ").concat(e[s+4]," ").concat(e[s+5]));return(0,h.A)(this,Pu,Bu).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,s,n,a){return new tA(t,e,i,s,n,a)}getOutlines(){var t,e;const i=(0,c.A)(this,bu),s=(0,c.A)(this,vu),n=(0,c.A)(this,_u),a=(0,c.A)(this,fu),r=(0,b.A)(a,4),o=r[0],l=r[1],d=r[2],u=r[3],A=new Float32Array((null!==(t=null===(e=(0,c.A)(this,Cu))||void 0===e?void 0:e.length)&&void 0!==t?t:0)+2);for(let h=0,f=A.length-2;h<f;h+=2)A[h]=((0,c.A)(this,Cu)[h]-o)/d,A[h+1]=((0,c.A)(this,Cu)[h+1]-l)/u;if(A[A.length-2]=((0,c.A)(this,yu)-o)/d,A[A.length-1]=((0,c.A)(this,ku)-l)/u,isNaN(n[6])&&!this.isEmpty())return(0,h.A)(this,Lu,zu).call(this,A);const p=new Float32Array((0,c.A)(this,bu).length+24+(0,c.A)(this,vu).length);let g=i.length;for(let h=0;h<g;h+=2)isNaN(i[h])?p[h]=p[h+1]=NaN:(p[h]=i[h],p[h+1]=i[h+1]);g=(0,h.A)(this,Fu,Gu).call(this,p,g);for(let h=s.length-6;h>=6;h-=6)for(let t=0;t<6;t+=2)isNaN(s[h+t])?(p[g]=p[g+1]=NaN,g+=2):(p[g]=s[h+t],p[g+1]=s[h+t+1],g+=2);return(0,h.A)(this,Du,ju).call(this,p,g),this.newFreeDrawOutline(p,A,(0,c.A)(this,fu),(0,c.A)(this,Mu),(0,c.A)(this,mu),(0,c.A)(this,wu))}}function Nu(){const t=(0,c.A)(this,_u).subarray(4,6),e=(0,c.A)(this,_u).subarray(16,18),i=(0,c.A)(this,fu),s=(0,b.A)(i,4),n=s[0],a=s[1],r=s[2],o=s[3];return[((0,c.A)(this,yu)+(t[0]-e[0])/2-n)/r,((0,c.A)(this,ku)+(t[1]-e[1])/2-a)/o,((0,c.A)(this,yu)+(e[0]-t[0])/2-n)/r,((0,c.A)(this,ku)+(e[1]-t[1])/2-a)/o]}function Ou(){const t=(0,c.A)(this,fu),e=(0,b.A)(t,4),i=e[0],s=e[1],n=e[2],a=e[3],r=(0,h.A)(this,Tu,Nu).call(this),o=(0,b.A)(r,4),l=o[0],d=o[1],u=o[2],A=o[3];return"M".concat(((0,c.A)(this,_u)[2]-i)/n," ").concat(((0,c.A)(this,_u)[3]-s)/a," L").concat(((0,c.A)(this,_u)[4]-i)/n," ").concat(((0,c.A)(this,_u)[5]-s)/a," L").concat(l," ").concat(d," L").concat(u," ").concat(A," L").concat(((0,c.A)(this,_u)[16]-i)/n," ").concat(((0,c.A)(this,_u)[17]-s)/a," L").concat(((0,c.A)(this,_u)[14]-i)/n," ").concat(((0,c.A)(this,_u)[15]-s)/a," Z")}function Bu(t){const e=(0,c.A)(this,vu);t.push("L".concat(e[4]," ").concat(e[5]," Z"))}function Hu(t){const e=(0,c.A)(this,fu),i=(0,b.A)(e,4),s=i[0],n=i[1],a=i[2],r=i[3],o=(0,c.A)(this,_u).subarray(4,6),l=(0,c.A)(this,_u).subarray(16,18),d=(0,h.A)(this,Tu,Nu).call(this),u=(0,b.A)(d,4),A=u[0],p=u[1],g=u[2],f=u[3];t.push("L".concat((o[0]-s)/a," ").concat((o[1]-n)/r," L").concat(A," ").concat(p," L").concat(g," ").concat(f," L").concat((l[0]-s)/a," ").concat((l[1]-n)/r))}function zu(t){const e=(0,c.A)(this,_u),i=(0,c.A)(this,fu),s=(0,b.A)(i,4),n=s[0],a=s[1],r=s[2],o=s[3],l=(0,h.A)(this,Tu,Nu).call(this),d=(0,b.A)(l,4),u=d[0],A=d[1],p=d[2],g=d[3],f=new Float32Array(36);return f.set([NaN,NaN,NaN,NaN,(e[2]-n)/r,(e[3]-a)/o,NaN,NaN,NaN,NaN,(e[4]-n)/r,(e[5]-a)/o,NaN,NaN,NaN,NaN,u,A,NaN,NaN,NaN,NaN,p,g,NaN,NaN,NaN,NaN,(e[16]-n)/r,(e[17]-a)/o,NaN,NaN,NaN,NaN,(e[14]-n)/r,(e[15]-a)/o],0),this.newFreeDrawOutline(f,t,(0,c.A)(this,fu),(0,c.A)(this,Mu),(0,c.A)(this,mu),(0,c.A)(this,wu))}function ju(t,e){const i=(0,c.A)(this,vu);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6}function Gu(t,e){const i=(0,c.A)(this,_u).subarray(4,6),s=(0,c.A)(this,_u).subarray(16,18),n=(0,c.A)(this,fu),a=(0,b.A)(n,4),r=a[0],o=a[1],l=a[2],d=a[3],u=(0,h.A)(this,Tu,Nu).call(this),A=(0,b.A)(u,4),p=A[0],g=A[1],f=A[2],v=A[3];return t.set([NaN,NaN,NaN,NaN,(i[0]-r)/l,(i[1]-o)/d,NaN,NaN,NaN,NaN,p,g,NaN,NaN,NaN,NaN,f,v,N
1aN,NaN,NaN,NaN,(s[0]-r)/l,(s[1]-o)/d],e),e+24}var Vu={writable:!0,value:8},Uu={writable:!0,value:v(Wu,Wu,Vu)+v(Wu,Wu,{writable:!0,value:2})},qu=new WeakMap,Xu=new WeakMap,Yu=new WeakMap,Ku=new WeakMap,Qu=new WeakMap,Ju=new WeakMap,Zu=new WeakMap,$u=new WeakSet;class tA extends gu{constructor(t,e,i,s,n,a){super(),(0,o.A)(this,$u),(0,l.A)(this,qu,{writable:!0,value:void 0}),(0,l.A)(this,Xu,{writable:!0,value:new Float32Array(4)}),(0,l.A)(this,Yu,{writable:!0,value:void 0}),(0,l.A)(this,Ku,{writable:!0,value:void 0}),(0,l.A)(this,Qu,{writable:!0,value:void 0}),(0,l.A)(this,Ju,{writable:!0,value:void 0}),(0,l.A)(this,Zu,{writable:!0,value:void 0}),(0,d.A)(this,Zu,t),(0,d.A)(this,Qu,e),(0,d.A)(this,qu,i),(0,d.A)(this,Ju,s),(0,d.A)(this,Yu,n),(0,d.A)(this,Ku,a),this.lastPoint=[NaN,NaN],(0,h.A)(this,$u,eA).call(this,a);const r=(0,c.A)(this,Xu),u=(0,b.A)(r,4),A=u[0],p=u[1],g=u[2],f=u[3];for(let o=0,l=t.length;o<l;o+=2)t[o]=(t[o]-A)/g,t[o+1]=(t[o+1]-p)/f;for(let o=0,l=e.length;o<l;o+=2)e[o]=(e[o]-A)/g,e[o+1]=(e[o+1]-p)/f}toSVGPath(){const t=["M".concat((0,c.A)(this,Zu)[4]," ").concat((0,c.A)(this,Zu)[5])];for(let e=6,i=(0,c.A)(this,Zu).length;e<i;e+=6)isNaN((0,c.A)(this,Zu)[e])?t.push("L".concat((0,c.A)(this,Zu)[e+4]," ").concat((0,c.A)(this,Zu)[e+5])):t.push("C".concat((0,c.A)(this,Zu)[e]," ").concat((0,c.A)(this,Zu)[e+1]," ").concat((0,c.A)(this,Zu)[e+2]," ").concat((0,c.A)(this,Zu)[e+3]," ").concat((0,c.A)(this,Zu)[e+4]," ").concat((0,c.A)(this,Zu)[e+5]));return t.push("Z"),t.join(" ")}serialize(t,e){let i=(0,b.A)(t,4),s=i[0],n=i[1],a=i[2],r=i[3];const o=a-s,l=r-n;let h,d;switch(e){case 0:h=gu._rescale((0,c.A)(this,Zu),s,r,o,-l),d=gu._rescale((0,c.A)(this,Qu),s,r,o,-l);break;case 90:h=gu._rescaleAndSwap((0,c.A)(this,Zu),s,n,o,l),d=gu._rescaleAndSwap((0,c.A)(this,Qu),s,n,o,l);break;case 180:h=gu._rescale((0,c.A)(this,Zu),a,n,-o,l),d=gu._rescale((0,c.A)(this,Qu),a,n,-o,l);break;case 270:h=gu._rescaleAndSwap((0,c.A)(this,Zu),a,r,-o,-l),d=gu._rescaleAndSwap((0,c.A)(this,Qu),a,r,-o,-l)}return{outline:Array.from(h),points:[Array.from(d)]}}get box(){return(0,c.A)(this,Xu)}newOutliner(t,e,i,s,n){return new Wu(t,e,i,s,n,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}getNewOutline(t,e){const i=(0,c.A)(this,Xu),s=(0,b.A)(i,4),n=s[0],a=s[1],r=s[2],o=s[3],l=(0,c.A)(this,qu),h=(0,b.A)(l,4),d=h[0],u=h[1],A=h[2],p=h[3],g=r*A,f=o*p,v=n*A+d,m=a*p+u,w=this.newOutliner({x:(0,c.A)(this,Qu)[0]*g+v,y:(0,c.A)(this,Qu)[1]*f+m},(0,c.A)(this,qu),(0,c.A)(this,Ju),t,(0,c.A)(this,Ku),null!==e&&void 0!==e?e:(0,c.A)(this,Yu));for(let b=2;b<(0,c.A)(this,Qu).length;b+=2)w.add({x:(0,c.A)(this,Qu)[b]*g+v,y:(0,c.A)(this,Qu)[b+1]*f+m});return w.getOutlines()}}function eA(t){const e=(0,c.A)(this,Zu);let i=e[4],s=e[5],n=i,a=s,r=i,o=s,l=i,h=s;const d=t?Math.max:Math.min;for(let c=6,A=e.length;c<A;c+=6){if(isNaN(e[c]))n=Math.min(n,e[c+4]),a=Math.min(a,e[c+5]),r=Math.max(r,e[c+4]),o=Math.max(o,e[c+5]),h<e[c+5]?(l=e[c+4],h=e[c+5]):h===e[c+5]&&(l=d(l,e[c+4]));else{const t=Ht.bezierBoundingBox(i,s,...e.slice(c,c+6));n=Math.min(n,t[0]),a=Math.min(a,t[1]),r=Math.max(r,t[2]),o=Math.max(o,t[3]),h<t[3]?(l=t[2],h=t[3]):h===t[3]&&(l=d(l,t[2]))}i=e[c+4],s=e[c+5]}const u=(0,c.A)(this,Xu);u[0]=n-(0,c.A)(this,Yu),u[1]=a-(0,c.A)(this,Yu),u[2]=r-n+2*(0,c.A)(this,Yu),u[3]=o-a+2*(0,c.A)(this,Yu),this.lastPoint=[l,h]}var iA=new WeakMap,sA=new WeakMap,nA=new WeakMap,aA=new WeakMap,rA=new WeakSet,oA=new WeakSet,lA=new WeakSet,hA=new WeakSet,cA=new WeakSet;class dA{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];(0,o.A)(this,cA),(0,o.A)(this,hA),(0,o.A)(this,lA),(0,o.A)(this,oA),(0,o.A)(this,rA),(0,l.A)(this,iA,{writable:!0,value:void 0}),(0,l.A)(this,sA,{writable:!0,value:void 0}),(0,l.A)(this,nA,{writable:!0,value:[]}),(0,l.A)(this,aA,{writable:!0,value:[]});let n=1/0,a=-1/0,r=1/0,h=-1/0;const u=1e-4;for(const o of t){const t=o.x,i=o.y,s=o.width,l=o.height,d=Math.floor((t-e)/u)*u,A=Math.ceil((t+s+e)/u)*u,p=Math.floor((i-e)/u)*u,g=Math.ceil((i+l+e)/u)*u,f=[d,p,g,!0],v=[A,p,g,!1];(0,c.A)(this,nA).push(f,v),n=Math.min(n,d),a=Math.max(a,A),r=Math.min(r,p),h=Math.max(h,g)}const A=a-n+2*i,p=h-r+2*i,g=n-i,f=r-i,v=(0,c.A)(this,nA).at(s?-1:-2),m=[v[0],v[2]];for(const o of(0,c.A)(this,nA)){const t=(0,b.A)(o,3),e=t[0],i=t[1],s=t[2];o[0]=(e-g)/A,o[1]=(i-f)/p,o[2]=(s-f)/p}(0,d.A)(this,iA,new Float32Array([g,f,A,p])),(0,d.A)(this,sA,m)}getOutlines(){(0,c.A)(this,nA).sort(((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]));const t=[];for(const e of(0,c.A)(this,nA))e[3]?(t.push(...(0,h.A)(this,cA,fA).call(this,e)),(0,h.A)(this,lA,pA).call(this,e)):((0,h.A)(this,hA,gA).call(this,e),t.push(...(0,h.A)(this,cA,fA).call(this,e)));return(0,h.A)(this,rA,uA).call(this,t)}}function uA(t){const e=[],i=new Set;for(const o of t){const t=(0,b.A)(o,3),i=t[0],s=t[1],n=t[2];
1e.push([i,s,o],[i,n,o])}e.sort(((t,e)=>t[1]-e[1]||t[0]-e[0]));for(let o=0,l=e.length;o<l;o+=2){const t=e[o][2],s=e[o+1][2];t.push(s),s.push(t),i.add(t),i.add(s)}const s=[];let n;for(;i.size>0;){const t=i.values().next().value;let e=(0,b.A)(t,5),o=e[0],l=e[1],h=e[2],c=e[3],d=e[4];i.delete(t);let u=o,A=l;for(n=[o,h],s.push(n);;){let t;if(i.has(c))t=c;else{if(!i.has(d))break;t=d}i.delete(t);var a=t,r=(0,b.A)(a,5);o=r[0],l=r[1],h=r[2],c=r[3],d=r[4],u!==o&&(n.push(u,A,o,A===l?l:h),u=o),A=A===l?h:l}n.push(u,A)}return new wA(s,(0,c.A)(this,iA),(0,c.A)(this,sA))}function AA(t){const e=(0,c.A)(this,aA);let i=0,s=e.length-1;for(;i<=s;){const n=i+s>>1,a=e[n][0];if(a===t)return n;a<t?i=n+1:s=n-1}return s+1}function pA(t){let e=(0,b.A)(t,3),i=e[1],s=e[2];const n=(0,h.A)(this,oA,AA).call(this,i);(0,c.A)(this,aA).splice(n,0,[i,s])}function gA(t){let e=(0,b.A)(t,3),i=e[1],s=e[2];const n=(0,h.A)(this,oA,AA).call(this,i);for(let a=n;a<(0,c.A)(this,aA).length;a++){const t=(0,b.A)((0,c.A)(this,aA)[a],2),e=t[0],n=t[1];if(e!==i)break;if(e===i&&n===s)return void(0,c.A)(this,aA).splice(a,1)}for(let a=n-1;a>=0;a--){const t=(0,b.A)((0,c.A)(this,aA)[a],2),e=t[0],n=t[1];if(e!==i)break;if(e===i&&n===s)return void(0,c.A)(this,aA).splice(a,1)}}function fA(t){const e=(0,b.A)(t,3),i=e[0],s=e[1],n=e[2],a=[[i,s,n]],r=(0,h.A)(this,oA,AA).call(this,n);for(let o=0;o<r;o++){const t=(0,b.A)((0,c.A)(this,aA)[o],2),e=t[0],s=t[1];for(let n=0,r=a.length;n<r;n++){const t=(0,b.A)(a[n],3),o=t[1],l=t[2];if(!(s<=o||l<=e))if(o>=e)if(l>s)a[n][1]=s;else{if(1===r)return[];a.splice(n,1),n--,r--}else a[n][2]=e,l>s&&a.push([i,s,l])}}return a}var vA=new WeakMap,mA=new WeakMap;class wA extends gu{constructor(t,e,i){super(),(0,l.A)(this,vA,{writable:!0,value:void 0}),(0,l.A)(this,mA,{writable:!0,value:void 0}),(0,d.A)(this,mA,t),(0,d.A)(this,vA,e),this.lastPoint=i}toSVGPath(){const t=[];for(const e of(0,c.A)(this,mA)){let i=(0,b.A)(e,2),s=i[0],n=i[1];t.push("M".concat(s," ").concat(n));for(let a=2;a<e.length;a+=2){const i=e[a],r=e[a+1];i===s?(t.push("V".concat(r)),n=r):r===n&&(t.push("H".concat(i)),s=i)}t.push("Z")}return t.join(" ")}serialize(t,e){let i=(0,b.A)(t,4),s=i[0],n=i[1],a=i[2],r=i[3];const o=[],l=a-s,h=r-n;for(const d of(0,c.A)(this,mA)){const t=new Array(d.length);for(let e=0;e<d.length;e+=2)t[e]=s+d[e]*l,t[e+1]=r-d[e+1]*h;o.push(t)}return o}get box(){return(0,c.A)(this,vA)}get classNamesForOutlining(){return["highlightOutline"]}}class bA extends Wu{newFreeDrawOutline(t,e,i,s,n,a){return new _A(t,e,i,s,n,a)}}class _A extends tA{newOutliner(t,e,i,s,n){return new bA(t,e,i,s,n,arguments.length>5&&void 0!==arguments[5]?arguments[5]:0)}}var yA=new WeakMap,kA=new WeakMap,SA=new WeakMap,xA=new WeakMap,MA=new WeakMap,EA=new WeakMap,CA=new WeakMap,TA=new WeakMap,RA=new WeakMap,PA=new WeakMap,IA=new WeakMap,LA=new WeakSet,DA=new WeakSet,FA=new WeakSet,WA=new WeakSet,NA=new WeakSet,OA=new WeakMap;class BA{static get _keyboardManager(){return Mt(this,"_keyboardManager",new ni([[["Escape","mac+Escape"],BA.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],BA.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],BA.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],BA.prototype._moveToPrevious],[["Home","mac+Home"],BA.prototype._moveToBeginning],[["End","mac+End"],BA.prototype._moveToEnd]]))}constructor(t){var e;let i=t.editor,s=void 0===i?null:i,n=t.uiManager,a=void 0===n?null:n;(0,l.A)(this,OA,{get:UA,set:void 0}),(0,o.A)(this,NA),(0,o.A)(this,WA),(0,o.A)(this,FA),(0,o.A)(this,DA),(0,o.A)(this,LA),(0,l.A)(this,yA,{writable:!0,value:null}),(0,l.A)(this,kA,{writable:!0,value:null}),(0,l.A)(this,SA,{writable:!0,value:void 0}),(0,l.A)(this,xA,{writable:!0,value:null}),(0,l.A)(this,MA,{writable:!0,value:!1}),(0,l.A)(this,EA,{writable:!0,value:!1}),(0,l.A)(this,CA,{writable:!0,value:null}),(0,l.A)(this,TA,{writable:!0,value:void 0}),(0,l.A)(this,RA,{writable:!0,value:null}),(0,l.A)(this,PA,{writable:!0,value:null}),(0,l.A)(this,IA,{writable:!0,value:void 0}),s?((0,d.A)(this,EA,!1),(0,d.A)(this,IA,N.HIGHLIGHT_COLOR),(0,d.A)(this,CA,s)):((0,d.A)(this,EA,!0),(0,d.A)(this,IA,N.HIGHLIGHT_DEFAULT_COLOR)),(0,d.A)(this,PA,(null===s||void 0===s?void 0:s._uiManager)||a),(0,d.A)(this,TA,(0,c.A)(this,PA)._eventBus),(0,d.A)(this,SA,(null===s||void 0===s?void 0:s.color)||(null===(e=(0,c.A)(this,PA))||void 0===e?void 0:e.highlightColors.values().next().value)||"#FFFF98"),v(BA,BA,qA)||g(BA,BA,qA,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}renderButton(){const t=(0,d.A)(this,yA,document.createElement("button"));
1t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=(0,c.A)(this,PA)._signal;t.addEventListener("click",(0,h.A)(this,WA,GA).bind(this),{signal:e}),t.addEventListener("keydown",(0,h.A)(this,FA,jA).bind(this),{signal:e});const i=(0,d.A)(this,kA,document.createElement("span"));return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=(0,c.A)(this,SA),t.append(i),t}renderMainDropdown(){const t=(0,d.A)(this,xA,(0,h.A)(this,LA,HA).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===(0,c.A)(this,yA))return void(0,h.A)(this,WA,GA).call(this,t);const e=t.target.getAttribute("data-color");e&&(0,h.A)(this,DA,zA).call(this,e,t)}_moveToNext(t){var e,i;(0,c.A)(this,OA)?t.target!==(0,c.A)(this,yA)?null===(e=t.target.nextSibling)||void 0===e||e.focus():null===(i=(0,c.A)(this,xA).firstChild)||void 0===i||i.focus():(0,h.A)(this,WA,GA).call(this,t)}_moveToPrevious(t){var e,i;t.target!==(null===(e=(0,c.A)(this,xA))||void 0===e?void 0:e.firstChild)&&t.target!==(0,c.A)(this,yA)?((0,c.A)(this,OA)||(0,h.A)(this,WA,GA).call(this,t),null===(i=t.target.previousSibling)||void 0===i||i.focus()):(0,c.A)(this,OA)&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){var e;(0,c.A)(this,OA)?null===(e=(0,c.A)(this,xA).firstChild)||void 0===e||e.focus():(0,h.A)(this,WA,GA).call(this,t)}_moveToEnd(t){var e;(0,c.A)(this,OA)?null===(e=(0,c.A)(this,xA).lastChild)||void 0===e||e.focus():(0,h.A)(this,WA,GA).call(this,t)}hideDropdown(){var t,e;null===(t=(0,c.A)(this,xA))||void 0===t||t.classList.add("hidden"),null===(e=(0,c.A)(this,RA))||void 0===e||e.abort(),(0,d.A)(this,RA,null)}_hideDropdownFromKeyboard(){var t;(0,c.A)(this,EA)||((0,c.A)(this,OA)?(this.hideDropdown(),(0,c.A)(this,yA).focus({preventScroll:!0,focusVisible:(0,c.A)(this,MA)})):null===(t=(0,c.A)(this,CA))||void 0===t||t.unselect())}updateColor(t){if((0,c.A)(this,kA)&&((0,c.A)(this,kA).style.backgroundColor=t),!(0,c.A)(this,xA))return;const e=(0,c.A)(this,PA).highlightColors.values();for(const i of(0,c.A)(this,xA).children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;null===(t=(0,c.A)(this,yA))||void 0===t||t.remove(),(0,d.A)(this,yA,null),(0,d.A)(this,kA,null),null===(e=(0,c.A)(this,xA))||void 0===e||e.remove(),(0,d.A)(this,xA,null)}}function HA(){const t=document.createElement("div"),e=(0,c.A)(this,PA)._signal;t.addEventListener("contextmenu",ae,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const s of(0,c.A)(this,PA).highlightColors){var i=(0,b.A)(s,2);const n=i[0],a=i[1],r=document.createElement("button");r.tabIndex="0",r.role="option",r.setAttribute("data-color",a),r.title=n,r.setAttribute("data-l10n-id",v(BA,BA,qA)[n]);const o=document.createElement("span");r.append(o),o.className="swatch",o.style.backgroundColor=a,r.setAttribute("aria-selected",a===(0,c.A)(this,SA)),r.addEventListener("click",(0,h.A)(this,DA,zA).bind(this,a),{signal:e}),t.append(r)}return t.addEventListener("keydown",(0,h.A)(this,FA,jA).bind(this),{signal:e}),t}function zA(t,e){e.stopPropagation(),(0,c.A)(this,TA).dispatch("switchannotationeditorparams",{source:this,type:(0,c.A)(this,IA),value:t})}function jA(t){BA._keyboardManager.exec(this,t)}function GA(t){if((0,c.A)(this,OA))return void this.hideDropdown();if((0,d.A)(this,MA,0===t.detail),(0,c.A)(this,RA)||((0,d.A)(this,RA,new AbortController),window.addEventListener("pointerdown",(0,h.A)(this,NA,VA).bind(this),{signal:(0,c.A)(this,PA).combinedSignal((0,c.A)(this,RA))})),(0,c.A)(this,xA))return void(0,c.A)(this,xA).classList.remove("hidden");const e=(0,d.A)(this,xA,(0,h.A)(this,LA,HA).call(this));(0,c.A)(this,yA).append(e)}function VA(t){var e;null!==(e=(0,c.A)(this,xA))&&void 0!==e&&e.contains(t.target)||this.hideDropdown()}function UA(){return(0,c.A)(this,xA)&&!(0,c.A)(this,xA).classList.contains("hidden")}var qA={writable:!0,value:null},XA=new WeakMap,YA=new WeakMap,KA=new WeakMap,QA=new WeakMap,JA=new WeakMap,ZA=new WeakMap,$A=ne
1w WeakMap,tp=new WeakMap,ep=new WeakMap,ip=new WeakMap,sp=new WeakMap,np=new WeakMap,ap=new WeakMap,rp=new WeakMap,op=new WeakMap,lp=new WeakMap,hp=new WeakMap,cp=new WeakMap,dp=new WeakSet,up=new WeakSet,Ap=new WeakSet,pp=new WeakSet,gp=new WeakSet,fp=new WeakSet,vp=new WeakSet,mp=new WeakSet,wp=new WeakSet,bp=new WeakSet,_p=new WeakSet,yp=new WeakSet,kp=new WeakSet;class Sp extends ha{static get _keyboardManager(){const t=Sp.prototype;return Mt(this,"_keyboardManager",new ni([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super((0,s.A)((0,s.A)({},t),{},{name:"highlightEditor"})),(0,o.A)(this,kp),(0,o.A)(this,yp),(0,o.A)(this,_p),(0,o.A)(this,bp),(0,o.A)(this,wp),(0,o.A)(this,mp),(0,o.A)(this,vp),(0,o.A)(this,fp),(0,o.A)(this,gp),(0,o.A)(this,pp),(0,o.A)(this,Ap),(0,o.A)(this,up),(0,o.A)(this,dp),(0,l.A)(this,XA,{writable:!0,value:null}),(0,l.A)(this,YA,{writable:!0,value:0}),(0,l.A)(this,KA,{writable:!0,value:void 0}),(0,l.A)(this,QA,{writable:!0,value:null}),(0,l.A)(this,JA,{writable:!0,value:null}),(0,l.A)(this,ZA,{writable:!0,value:null}),(0,l.A)(this,$A,{writable:!0,value:null}),(0,l.A)(this,tp,{writable:!0,value:0}),(0,l.A)(this,ep,{writable:!0,value:null}),(0,l.A)(this,ip,{writable:!0,value:null}),(0,l.A)(this,sp,{writable:!0,value:null}),(0,l.A)(this,np,{writable:!0,value:!1}),(0,l.A)(this,ap,{writable:!0,value:null}),(0,l.A)(this,rp,{writable:!0,value:void 0}),(0,l.A)(this,op,{writable:!0,value:null}),(0,l.A)(this,lp,{writable:!0,value:""}),(0,l.A)(this,hp,{writable:!0,value:void 0}),(0,l.A)(this,cp,{writable:!0,value:""}),this.color=t.color||Sp._defaultColor,(0,d.A)(this,hp,t.thickness||Sp._defaultThickness),(0,d.A)(this,rp,t.opacity||Sp._defaultOpacity),(0,d.A)(this,KA,t.boxes||null),(0,d.A)(this,cp,t.methodOfCreation||""),(0,d.A)(this,lp,t.text||""),this._isDraggable=!1,t.highlightId>-1?((0,d.A)(this,np,!0),(0,h.A)(this,up,Mp).call(this,t),(0,h.A)(this,vp,Pp).call(this)):(0,c.A)(this,KA)&&((0,d.A)(this,XA,t.anchorNode),(0,d.A)(this,YA,t.anchorOffset),(0,d.A)(this,$A,t.focusNode),(0,d.A)(this,tp,t.focusOffset),(0,h.A)(this,dp,xp).call(this),(0,h.A)(this,vp,Pp).call(this),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:(0,c.A)(this,np)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:(0,c.A)(this,hp),methodOfCreation:(0,c.A)(this,cp)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,e){var i;ha.initialize(t,e),Sp._defaultColor||(Sp._defaultColor=(null===(i=e.highlightColors)||void 0===i?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case N.HIGHLIGHT_DEFAULT_COLOR:Sp._defaultColor=e;break;case N.HIGHLIGHT_THICKNESS:Sp._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return(0,c.A)(this,ap)}updateParams(t,e){switch(t){case N.HIGHLIGHT_COLOR:(0,h.A)(this,Ap,Ep).call(this,e);break;case N.HIGHLIGHT_THICKNESS:(0,h.A)(this,pp,Cp).call(this,e)}}static get defaultPropertiesToUpdate(){return[[N.HIGHLIGHT_DEFAULT_COLOR,Sp._defaultColor],[N.HIGHLIGHT_THICKNESS,Sp._defaultThickness]]}get propertiesToUpdate(){return[[N.HIGHLIGHT_COLOR,this.color||Sp._defaultColor],[N.HIGHLIGHT_THICKNESS,(0,c.A)(this,hp)||Sp._defaultThickness],[N.HIGHLIGHT_FREE,(0,c.A)(this,np)]]}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&((0,d.A)(this,JA,new BA({editor:this})),t.addColorPicker((0,c.A)(this,JA))),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition((0,h.A)(this,bp,Fp).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,(0,h.A)(this,bp,Fp).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){(0,h.A)(this,fp,Rp).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&((0,h.A)(this,vp,Pp).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)(0,h.A)(this,fp,Rp).call(this);else if(t){var i;(0,h.A)(this,vp,Pp).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),this.show(this._isVisible),e&&this.select()}rotate(t){const e=this.parent.drawLayer;let i;(0,c.A)(this,np)?(t=(t-this.rotation+360)%360,i=w(Sp,Sp,Ip).call(Sp,(0,c.A)(this,ip).box,t)):i=w(Sp,Sp,Ip).call(Sp,[this.x,this.y,this.width,this.height],t),e.updateProperties((0,c.A)(this,sp),{bbox:i,root:{"data-main-rotation":t}}),e.updateProperties((0,c.A)(this,op),{bbox:w(Sp,Sp,Ip).call(Sp,(0,c.A)(this,ZA).box,t),root:{"data-main-rotation":t}})}
1render(){if(this.div)return this.div;const t=super.render();(0,c.A)(this,lp)&&(t.setAttribute("aria-label",(0,c.A)(this,lp)),t.setAttribute("role","mark")),(0,c.A)(this,np)?t.classList.add("free"):this.div.addEventListener("keydown",(0,h.A)(this,mp,Lp).bind(this),{signal:this._uiManager._signal});const e=(0,d.A)(this,ep,document.createElement("div"));t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=(0,c.A)(this,QA);const i=(0,b.A)(this.parentDimensions,2),s=i[0],n=i[1];return this.setDims(this.width*s,this.height*n),Ge(this,(0,c.A)(this,ep),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,c.A)(this,op),{rootClass:{hovered:!0}}))}pointerleave(){var t;this.isSelected||(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,c.A)(this,op),{rootClass:{hovered:!1}}))}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:(0,h.A)(this,wp,Dp).call(this,!0);break;case 1:case 3:(0,h.A)(this,wp,Dp).call(this,!1)}}select(){var t;super.select(),(0,c.A)(this,op)&&(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,c.A)(this,op),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),(0,c.A)(this,op)&&(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,c.A)(this,op),{rootClass:{selected:!1}}),(0,c.A)(this,np)||(0,h.A)(this,wp,Dp).call(this,!1))}get _mustFixPosition(){return!(0,c.A)(this,np)}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.updateProperties((0,c.A)(this,sp),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties((0,c.A)(this,op),{rootClass:{hidden:!t}}))}static startHighlighting(t,e,i){let s=i.target,n=i.x,a=i.y;const r=s.getBoundingClientRect(),o=r.x,l=r.y,h=r.width,c=r.height,d=new AbortController,u=t.combinedSignal(d),A=e=>{d.abort(),w(this,Sp,Bp).call(this,t,e)};window.addEventListener("blur",A,{signal:u}),window.addEventListener("pointerup",A,{signal:u}),window.addEventListener("pointerdown",re,{capture:!0,passive:!1,signal:u}),window.addEventListener("contextmenu",ae,{signal:u}),s.addEventListener("pointermove",w(this,Sp,Op).bind(this,t),{signal:u}),this._freeHighlight=new bA({x:n,y:a},[o,l,h,c],t.scale,this._defaultThickness/2,e,.001);var p=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0);this._freeHighlightId=p.id,this._freeHighlightClipId=p.clipPathId}static async deserialize(t,e,i){let s=null;if(t instanceof Cd){const e=t,i=e.data,n=i.quadPoints,a=i.rect,r=i.rotation,o=i.id,l=i.color,h=i.opacity,c=i.popupRef,d=e.parent.page.pageNumber;s=t={annotationType:W.HIGHLIGHT,color:Array.from(l),opacity:h,quadPoints:n,boxes:null,pageIndex:d-1,rect:a.slice(0),rotation:r,id:o,deleted:!1,popupRef:c}}else if(t instanceof Md){const e=t,i=e.data,n=i.inkLists,a=i.rect,r=i.rotation,o=i.id,l=i.color,h=i.borderStyle.rawWidth,c=i.popupRef,d=e.parent.page.pageNumber;s=t={annotationType:W.HIGHLIGHT,color:Array.from(l),thickness:h,inkLists:n,boxes:null,pageIndex:d-1,rect:a.slice(0),rotation:r,id:o,deleted:!1,popupRef:c}}const n=t,a=n.color,r=n.quadPoints,o=n.inkLists,l=n.opacity,u=await super.deserialize(t,e,i);u.color=Ht.makeHexColor(...a),(0,d.A)(u,rp,l||1),o&&(0,d.A)(u,hp,t.thickness),u.annotationElementId=t.id||null,u._initialData=s;const A=(0,b.A)(u.pageDimensions,2),p=A[0],g=A[1],f=(0,b.A)(u.pageTranslation,2),v=f[0],m=f[1];if(r){const t=(0,d.A)(u,KA,[]);for(let e=0;e<r.length;e+=8)t.push({x:(r[e]-v)/p,y:1-(r[e+1]-m)/g,width:(r[e+2]-r[e])/p,height:(r[e+1]-r[e+5])/g});(0,h.A)(u,dp,xp).call(u),(0,h.A)(u,vp,Pp).call(u),u.rotate(u.rotation)}else if(o){(0,d.A)(u,np,!0);const t=o[0],i={x:t[0]-v,y:g-(t[1]-m)},s=new bA(i,[0,0,p,g],1,(0,c.A)(u,hp)/2,!0,.001);for(let e=0,o=t.length;e<o;e+=2)i.x=t[e]-v,i.y=g-(t[e+1]-m),s.add(i);const n=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:u.color,"fill-opacity":u._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:s.toSVGPath()}},!0,!0),a=n.id,r=n.clipPathId;(0,h.A)(u,up,Mp).call(u,{highlightOutlines:s.getOutlines(),highlightId:a,clipPathId:r}),(0,h.A)(u,vp,Pp).call(u)}return u}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const e=this.getRect(0,0),i=ha._colorManager.convert(this.color),s={annotationType:W.HIGHLIGHT,color:i,opacity:(0,c.A)(this,rp),thickness:(0,c.A)(this,hp),quadPoints:(0,h.A)(this,_p,Wp).call(this),outlines:(0,h.A)(this,yp,Np).call(this,e),pageIndex:this.pageIndex,rect:e,rotation:(0,h.A)(this,bp,Fp).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!(0,h.A)(this,kp,Hp).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}function xp(){const t=new dA((0,c.A)(this,KA),.001);(0,d.A)(this,ip,t.getOutlines());var e=(0,b.A)((0,c.A)(this,ip).box,4);this.x=e[0],this.y=e[1],this.width=e[2],this.height=e[3];const i=new dA((0,c.A)(this,KA),.0025,.001,"ltr"===this._uiManager.direction);(0,d.A)(this,ZA,i.getOutlines());const s=(0,c.A)(this,ZA).lastPoint;(0,d.A)(this,ap,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])}function Mp(t){let e=t.highlightOutlines,i=t.highlightId,s=t.clipPathId;(0,d.A)(this,ip,e);if((0,d.A)(this,ZA,e.getNewOutline((0,c.A)(this,hp)/2+1.5,.0025)),i>=0)(0,d.A)(this,sp,i),(0,d.A)(this,QA,s),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),(0,d.A)(this,op,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:(0,c.A)(this,ZA).box,path:{d:(0,c.A)(this,ZA).toSVGPath()}},!0));else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties((0,c.A)(this,sp),{bbox:w(Sp,Sp,Ip).call(Sp,(0,c.A)(this,ip).box,(t-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties((0,c.A)(this,op),{bbox:w(Sp,Sp,Ip).call(Sp,(0,c.A)(this,ZA).box,t),path:{d:(0,c.A)(this,ZA).toSVGPath()}})}const n=(0,b.A)(e.box,4),a=n[0],r=n[1],o=n[2],l=n[3];switch(this.rotation){case 0:this.x=a,this.y=r,this.width=o,this.height=l;break;case 90:{const t=(0,b.A)(this.parentDimensions,2),e=t[0],i=t[1];this.x=r,this.y=1-a,this.width=o*i/e,this.height=l*e/i;break}case 180:this.x=1-a,this.y=1-r,this.width=o,this.height=l;break;case 270:{const t=(0,b.A)(this.parentDimensions,2),e=t[0],i=t[1];this.x=1-r,this.y=a,this.width=o*i/e,this.height=l*e/i;break}}const h=(0,c.A)(this,ZA).lastPoint;(0,d.A)(this,ap,[(h[0]-a)/o,(h[1]-r)/l])}function Ep(t){const e=(t,e)=>{var i,s;this.color=t,(0,d.A)(this,rp,e),null===(i=this.parent)||void 0===i||i.drawLayer.updateProperties((0,c.A)(this,sp),{root:{fill:t,"fill-opacity":e}}),null===(s=(0,c.A)(this,JA))||void 0===s||s.updateColor(t)},i=this.color,s=(0,c.A)(this,rp);this.addCommands({cmd:e.bind(this,t,Sp._defaultOpacity),undo:e.bind(this,i,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:N.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}function Cp(t){const e=(0,c.A)(this,hp),i=t=>{(0,d.A)(this,hp,t),(0,h.A)(this,gp,Tp).call(this,t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:N.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}function Tp(t){if(!(0,c.A)(this,np))return;(0,h.A)(this,up,Mp).call(this,{highlightOutlines:(0,c.A)(this,ip).getNewOutline(t/2)}),this.fixAndSetPosition();const e=(0,b.A)(this.parentDimensions,2),i=e[0],s=e[1];this.setDims(this.width*i,this.height*s)}function Rp(){null!==(0,c.A)(this,sp)&&this.parent&&(this.parent.drawLayer.remove((0,c.A)(this,sp)),(0,d.A)(this,sp,null),this.parent.drawLayer.remove((0,c.A)(this,op)),(0,d.A)(this,op,null))}function Pp(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;if(null===(0,c.A)(this,sp)){var e=t.drawLayer.draw({bbox:(0,c.A)(this,ip).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":(0,
1c.A)(this,rp)},rootClass:{highlight:!0,free:(0,c.A)(this,np)},path:{d:(0,c.A)(this,ip).toSVGPath()}},!1,!0);a(this,sp).value=e.id,a(this,QA).value=e.clipPathId,(0,d.A)(this,op,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:(0,c.A)(this,np)},bbox:(0,c.A)(this,ZA).box,path:{d:(0,c.A)(this,ZA).toSVGPath()}},(0,c.A)(this,np))),(0,c.A)(this,ep)&&((0,c.A)(this,ep).style.clipPath=(0,c.A)(this,QA))}}function Ip(t,e){let i=(0,b.A)(t,4),s=i[0],n=i[1],a=i[2],r=i[3];switch(e){case 90:return[1-n-r,s,r,a];case 180:return[1-s-a,1-n-r,a,r];case 270:return[n,1-s-a,r,a]}return[s,n,a,r]}function Lp(t){Sp._keyboardManager.exec(this,t)}function Dp(t){if(!(0,c.A)(this,XA))return;const e=window.getSelection();t?e.setPosition((0,c.A)(this,XA),(0,c.A)(this,YA)):e.setPosition((0,c.A)(this,$A),(0,c.A)(this,tp))}function Fp(){return(0,c.A)(this,np)?this.rotation:0}function Wp(){if((0,c.A)(this,np))return null;const t=(0,b.A)(this.pageDimensions,2),e=t[0],i=t[1],s=(0,b.A)(this.pageTranslation,2),n=s[0],a=s[1],r=(0,c.A)(this,KA),o=new Float32Array(8*r.length);let l=0;for(const h of r){const t=h.x,s=h.y,r=h.width,c=h.height,d=t*e+n,u=(1-s)*i+a;o[l]=o[l+4]=d,o[l+1]=o[l+3]=u,o[l+2]=o[l+6]=d+r*e,o[l+5]=o[l+7]=u-c*i,l+=8}return o}function Np(t){return(0,c.A)(this,ip).serialize(t,(0,h.A)(this,bp,Fp).call(this))}function Op(t,e){this._freeHighlight.add(e)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}function Bp(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}function Hp(t){const e=this._initialData.color;return t.color.some(((t,i)=>t!==e[i]))}(0,m.A)(Sp,"_defaultColor",null),(0,m.A)(Sp,"_defaultOpacity",1),(0,m.A)(Sp,"_defaultThickness",12),(0,m.A)(Sp,"_type","highlight"),(0,m.A)(Sp,"_editorType",W.HIGHLIGHT),(0,m.A)(Sp,"_freeHighlightId",-1),(0,m.A)(Sp,"_freeHighlight",null),(0,m.A)(Sp,"_freeHighlightClipId","");var zp=new WeakMap;class jp{constructor(){(0,l.A)(this,zp,{writable:!0,value:Object.create(null)})}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const i of Object.entries(t)){var e=(0,b.A)(i,2);const t=e[0],s=e[1];this.updateProperty(t,s)}}updateSVGProperty(t,e){(0,c.A)(this,zp)[t]=e}toSVGProperties(){const t=(0,c.A)(this,zp);return(0,d.A)(this,zp,Object.create(null)),{root:t}}reset(){(0,d.A)(this,zp,Object.create(null))}updateAll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;this.updateProperties(t)}clone(){kt("Not implemented")}}var Gp=new WeakMap,Vp=new WeakMap,Up=new WeakSet,qp=new WeakSet,Xp=new WeakSet,Yp=new WeakSet,Kp=new WeakSet,Qp=new WeakSet,Jp=new WeakSet,Zp=new WeakSet;class $p extends ha{constructor(t){super(t),(0,o.A)(this,Zp),(0,o.A)(this,Jp),(0,o.A)(this,Qp),(0,o.A)(this,Kp),(0,o.A)(this,Yp),(0,o.A)(this,Xp),(0,o.A)(this,qp),(0,o.A)(this,Up),(0,l.A)(this,Gp,{writable:!0,value:null}),(0,l.A)(this,Vp,{writable:!0,value:void 0}),(0,m.A)(this,"_drawId",null),(0,d.A)(this,Vp,t.mustBeCommitted||!1),t.drawOutlines&&((0,h.A)(this,Up,tg).call(this,t),(0,h.A)(this,Yp,sg).call(this))}static _mergeSVGProperties(t,e){const i=new Set(Object.keys(t));for(const n of Object.entries(e)){var s=(0,b.A)(n,2);const e=s[0],a=s[1];i.has(e)?Object.assign(t[e],a):t[e]=a}return t}static getDefaultDrawingOptions(t){kt("Not implemented")}static get typesMap(){kt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){const i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,e),this._currentParent&&(v($p,$p,lg).updateProperty(i,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){const i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,e)}static get defaultPropertiesToUpdate(){const t=[],e=this._defaultDrawingOptions;for(const s of this.typesMap){var i=(0,b.A)(s,2);const n=i[0],a=i[1];t.push([n,e[a]])}return t}get propertiesToUpdate(){const t=[],e=this._drawingOptions;for(const s of this.constructor.typesMap){var i=(0,b.A)(s,2);const n=i[0],a=i[1];t.push([n,e[a]])}return t}_updateProperty(t,e,i){const s=this._drawingOptions,n=s[e],a=t=>{var i;s.updateProperty(e,t);const n=(0,c.A)(this,Gp).updateProperty(e,t);n&&(0,h.A)(this,Jp,rg).call(this,n),null===(i=this.parent)||void 0===i||i.drawLayer.updateProperties(this._drawId,s.toSVGProperties())};this.addCommands({cmd:a.bind(this,i),undo:a.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,$p._mergeSVGProperties((0,c.A)(this,Gp).getPathResizingSVGProperties((0,h.A)(this,Q
1p,ag).call(this)),{bbox:(0,h.A)(this,Zp,og).call(this)}))}_onResized(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,$p._mergeSVGProperties((0,c.A)(this,Gp).getPathResizedSVGProperties((0,h.A)(this,Qp,ag).call(this)),{bbox:(0,h.A)(this,Zp,og).call(this)}))}_onTranslating(t,e){var i;null===(i=this.parent)||void 0===i||i.drawLayer.updateProperties(this._drawId,{bbox:(0,h.A)(this,Zp,og).call(this,t,e)})}_onTranslated(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,$p._mergeSVGProperties((0,c.A)(this,Gp).getPathTranslatedSVGProperties((0,h.A)(this,Qp,ag).call(this),this.parentDimensions),{bbox:(0,h.A)(this,Zp,og).call(this)}))}_onStartDragging(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,(0,c.A)(this,Vp)&&((0,d.A)(this,Vp,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){(0,h.A)(this,Xp,ig).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&((0,h.A)(this,Yp,sg).call(this),(0,h.A)(this,Jp,rg).call(this,(0,c.A)(this,Gp).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)this._uiManager.removeShouldRescale(this),(0,h.A)(this,Xp,ig).call(this);else if(t){var i;this._uiManager.addShouldRescale(this),(0,h.A)(this,Yp,sg).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),e&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,$p._mergeSVGProperties({bbox:(0,h.A)(this,Zp,og).call(this)},(0,c.A)(this,Gp).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&(0,h.A)(this,Jp,rg).call(this,(0,c.A)(this,Gp).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;const t=super.render();t.classList.add("draw");const e=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal";const i=(0,b.A)(this.parentDimensions,2),s=i[0],n=i[1];return this.setDims(this.width*s,this.height*n),this._uiManager.addShouldRescale(this),this.disableEditing(),t}static createDrawerInstance(t,e,i,s,n){kt("Not implemented")}static startDrawing(t,e,i,s){var n,a;const r=s.target,o=s.offsetX,l=s.offsetY,h=s.pointerId,c=s.pointerType;if(v($p,$p,ug)&&v($p,$p,ug)!==c)return;const d=t.viewport.rotation,u=r.getBoundingClientRect(),A=u.width,p=u.height,f=g($p,$p,hg,new AbortController),m=t.combinedSignal(f);if(v($p,$p,dg)||g($p,$p,dg,h),null!==(n=v($p,$p,ug))&&void 0!==n||g($p,$p,ug,c),window.addEventListener("pointerup",(t=>{var e;v($p,$p,dg)===t.pointerId?this._endDraw(t):null===(e=v($p,$p,Ag))||void 0===e||e.delete(t.pointerId)}),{signal:m}),window.addEventListener("pointercancel",(t=>{var e;v($p,$p,dg)===t.pointerId?this._currentParent.endDrawingSession():null===(e=v($p,$p,Ag))||void 0===e||e.delete(t.pointerId)}),{signal:m}),window.addEventListener("pointerdown",(t=>{v($p,$p,ug)===t.pointerType&&((v($p,$p,Ag)||g($p,$p,Ag,new Set)).add(t.pointerId),v($p,$p,lg).isCancellable()&&(v($p,$p,lg).removeLastElement(),v($p,$p,lg).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))}),{capture:!0,passive:!1,signal:m}),window.addEventListener("contextmenu",ae,{signal:m}),r.addEventListener("pointermove",this._drawMove.bind(this),{signal:m}),r.addEventListener("touchmove",(t=>{t.timeStamp===v($p,$p,pg)&&re(t)}),{signal:m}),t.toggleDrawing(),null===(a=e._editorUndoBar)||void 0===a||a.hide(),v($p,$p,lg))t.drawLayer.updateProperties(this._currentDrawId,v($p,$p,lg).startNew(o,l,A,p,d));else{e.updateUIForDefaultProperties(this),g($p,$p,lg,this.createDrawerInstance(o,l,A,p,d)),g($p,$p,
1cg,this.getDefaultDrawingOptions()),this._currentParent=t;var w=t.drawLayer.draw(this._mergeSVGProperties(v($p,$p,cg).toSVGProperties(),v($p,$p,lg).defaultSVGProperties),!0,!1);this._currentDrawId=w.id}}static _drawMove(t){var e;if(g($p,$p,pg,-1),!v($p,$p,lg))return;const i=t.offsetX,s=t.offsetY,n=t.pointerId;v($p,$p,dg)===n&&((null===(e=v($p,$p,Ag))||void 0===e?void 0:e.size)>=1?this._endDraw(t):(this._currentParent.drawLayer.updateProperties(this._currentDrawId,v($p,$p,lg).add(i,s)),g($p,$p,pg,t.timeStamp),re(t)))}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,g($p,$p,lg,null),g($p,$p,cg,null),g($p,$p,ug,null),g($p,$p,pg,NaN)),v($p,$p,hg)&&(v($p,$p,hg).abort(),g($p,$p,hg,null),g($p,$p,dg,NaN),g($p,$p,Ag,null))}static _endDraw(t){const e=this._currentParent;if(e)if(e.toggleDrawing(!0),this._cleanup(!1),t&&e.drawLayer.updateProperties(this._currentDrawId,v($p,$p,lg).end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const t=v($p,$p,lg),i=this._currentDrawId,s=t.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,t.setLastElement(s))},undo:()=>{e.drawLayer.updateProperties(i,t.removeLastElement())},mustExec:!1,type:N.DRAW_STEP})}else this.endDrawing(!1)}static endDrawing(t){const e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(N.DRAW_STEP),!v($p,$p,lg).isEmpty()){const i=(0,b.A)(e.pageDimensions,2),s=i[0],n=i[1],a=e.scale,r=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:v($p,$p,lg).getOutlines(s*a,n*a,a,this._INNER_MARGIN),drawingOptions:v($p,$p,cg),mustBeCommitted:!t});return this._cleanup(!0),r}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,i,s,n,a){kt("Not implemented")}static async deserialize(t,e,i){const s=e.viewport.rawDims,n=s.pageWidth,a=s.pageHeight,r=s.pageX,o=s.pageY,l=this.deserializeDraw(r,o,n,a,this._INNER_MARGIN,t),c=await super.deserialize(t,e,i);return c.createDrawingOptions(t),(0,h.A)(c,Up,tg).call(c,{drawOutlines:l}),(0,h.A)(c,Yp,sg).call(c),c.onScaleChanging(),c.rotate(),c}serializeDraw(t){const e=(0,b.A)(this.pageTranslation,2),i=e[0],s=e[1],n=(0,b.A)(this.pageDimensions,2),a=n[0],r=n[1];return(0,c.A)(this,Gp).serialize([i,s,a,r],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}function tg(t){let e=t.drawOutlines,i=t.drawId,s=t.drawingOptions;(0,d.A)(this,Gp,e),this._drawingOptions||(this._drawingOptions=s),i>=0?(this._drawId=i,this.parent.drawLayer.finalizeDraw(i,e.defaultProperties)):this._drawId=(0,h.A)(this,qp,eg).call(this,e,this.parent),(0,h.A)(this,Jp,rg).call(this,e.box)}function eg(t,e){return e.drawLayer.draw($p._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1).id}function ig(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}function sg(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null!==this._drawId&&this.parent===t||(null===this._drawId?(this._drawingOptions.updateAll(),this._drawId=(0,h.A)(this,qp,eg).call(this,(0,c.A)(this,Gp),t)):this.parent.drawLayer.updateParent(this._drawId,t.drawLayer))}function ng(t){let e=(0,b.A)(t,4),i=e[0],s=e[1],n=e[2],a=e[3];const r=(0,b.A)(this.parentDimensions,2),o=r[0],l=r[1];switch(this.rotation){case 90:return[s,1-i,n*(l/o),a*(o/l)];case 180:return[1-i,1-s,n,a];case 270:return[1-s,i,n*(l/o),a*(o/l)];default:return[i,s,n,a]}}function ag(){const t=this.x,e=this.y,i=this.width,s=this.height,n=(0,b.A)(this.parentDimensions,2),a=n[0],r=n[1];switch(this.rotation){case 90:return[1-e,t,i*(a/r),s*(r/a)];case 180:return[1-t,1-e,i,s];case 270:return[e,1-t,i*(a/r),s*(r/a)];default:return[t,e,i,s]}}function rg(t){var e=(0,h.A)(this,Kp,ng).call(this,t),i=(0,b.A)(e,4);if(this.x=i[0],this.y=i[1],this.width=i[2],this.height=i[3],this.div){this.fixAndSetPosition();const t=(0,b.A)(this.parentDimensions,2),e=t[0],i=t[1];this.setDims(this.width*e,this.height*i)}this._onResized()}function og(){const t=this.x,e=this.y,i=this.width,s=this.height,n=this.rotation,a=this.parentRotation,r=(0,b.A)(this.parentDimensions,2),o=r[0],l=r[1];switch((4*n+a)/90){case 1:return[1-e-s,t,s,i];case 2:return[1-t-i,1-e-s,i,s];case 3:return[e,1-t-i,s,i];case 4:return[t,e-i*(o/l),s*(l/o),i*(o/l)];case 5:return[1-e,t,i*(o/l),s*(l/o)];case 6:return[1-t-s*(l/o),1-e,s*(l/o),i*(o/l)];case 7:return[e-i*(o/l),1-t-s*(l/o),i*(o/l),s*(l/o)];case 8:return[t-i,e-s,i,s];case 9:return[1-e,t-i,s,i];case 10:return[1-t,1-e,i,s];case 11:return[e-s,1-t,s,i];case 12:return[t-s*(l/o),e,s*(l/o),i*(o/l)];case 13:return[1-e-i*(o/l),t-s*(l/o),i*(o/l),s*(l/o)];case 14:return[1-t,1-e-i*(o/l),s*(l/o),i*(o/l)];case 15:return[e,1-t,i*(o/l),s*(l/o)];default:return[t,e,i,s]}}(0,m.A)($p,"_currentDrawId",-1),(0,m.A)($p,"_currentParent",null);var lg={writable:!0,value:null},hg={writable:!0,value:null},cg={writable:!0,value:null},dg={writable:!0,value:NaN},ug={writable:!0,value:null},Ag={writable:!0,value:null},pg={writable:!0,value:NaN};(0,m.A)($p,"_INNER_MARGIN",3);var gg=new WeakMap,fg=new WeakMap,vg=new WeakMap,mg=new WeakMap,wg=new WeakMap,bg=new WeakMap,_g=new WeakMap,yg=new WeakMap,kg=new WeakMap,Sg=new WeakMap,xg=new WeakMap,Mg=new WeakSet;class Eg{constructor(t,e,i,s,n,a){(0,o.A)(this,Mg),(0,l.A)(this,gg,{writable:!0,value:new Float64Array(6)}),(0,l.A)(this,fg,{writable:!0,value:void 0}),(0,l.A)(this,vg,{writable:!0,value:void 0}),(0,l.A)(this,mg,{writable:!0,value:void 0}),(0,l.A)(this,wg,{writable:!0,value:void 0}),(0,l.A)(this,bg,{writable:!0,value:void 0}),(0,l.A)(this,_g,{writable:!0,value:""}),(0,l.A)(this,yg,{writable:!0,value:0}),(0,l.A)(this,kg,{writable:!0,value:new jg}),(0,l.A)(this,Sg,{writable:!0,value:void 0}),(0,l.A)(this,xg,{writable:!0,value:void 0}),(0,d.A)(this,Sg,i),(0,d.A)(this,xg,s),(0,d.A)(this,mg,n),(0,d.A)(this,wg,a);var r=(0,h.A)(this,Mg,Cg).call(this,t,e),u=(0,b.A)(r,2);t=u[0],e=u[1];const A=(0,d.A)(this,fg,[NaN,NaN,NaN,NaN,t,e]);(0,d.A)(this,bg,[t,e]),(0,d.A)(this,vg,[{line:A,points:(0,c.A)(this,bg)}]),(0,c.A)(this,gg).set(A,0)}updateProperty(t,e){"stroke-width"===t&&(0,d.A)(this,wg,e)}isEmpty(){return!(0,c.A)(this,vg)||0===(0,c.A)(this,vg).length}isCancellable(){return(0,c.A)(this,bg).length<=10}add(t,e){var i=(0,h.A)(this,Mg,Cg).call(this,t,e),s=(0,b.A)(i,2);t=s[0],e=s[1];const n=(0,c.A)(this,gg).subarray(2,6),a=(0,b.A)(n,4),r=a[0],o=a[1],l=a[2],d=a[3],u=t-l,A=e-d;return Math.hypot((0,c.A)(this,Sg)*u,(0,c.A)(this,xg)*A)<=2?null:((0,c.A)(this,bg).push(t,e),isNaN(r)?((0,c.A)(this,gg).set([l,d,t,e],2),
1(0,c.A)(this,fg).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN((0,c.A)(this,gg)[0])&&(0,c.A)(this,fg).splice(6,6),(0,c.A)(this,gg).set([r,o,l,d,t,e],0),(0,c.A)(this,fg).push(...gu.createBezierPoints(r,o,l,d,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){const i=this.add(t,e);return i||(2===(0,c.A)(this,bg).length?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,s,n){(0,d.A)(this,Sg,i),(0,d.A)(this,xg,s),(0,d.A)(this,mg,n);var a=(0,h.A)(this,Mg,Cg).call(this,t,e),r=(0,b.A)(a,2);t=r[0],e=r[1];const o=(0,d.A)(this,fg,[NaN,NaN,NaN,NaN,t,e]);(0,d.A)(this,bg,[t,e]);const l=(0,c.A)(this,vg).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),(0,c.A)(this,vg).push({line:o,points:(0,c.A)(this,bg)}),(0,c.A)(this,gg).set(o,0),(0,d.A)(this,yg,0),this.toSVGPath(),null}getLastElement(){return(0,c.A)(this,vg).at(-1)}setLastElement(t){return(0,c.A)(this,vg)?((0,c.A)(this,vg).push(t),(0,d.A)(this,fg,t.line),(0,d.A)(this,bg,t.points),(0,d.A)(this,yg,0),{path:{d:this.toSVGPath()}}):(0,c.A)(this,kg).setLastElement(t)}removeLastElement(){if(!(0,c.A)(this,vg))return(0,c.A)(this,kg).removeLastElement();(0,c.A)(this,vg).pop(),(0,d.A)(this,_g,"");for(let t=0,e=(0,c.A)(this,vg).length;t<e;t++){const e=(0,c.A)(this,vg)[t],i=e.line,s=e.points;(0,d.A)(this,fg,i),(0,d.A)(this,bg,s),(0,d.A)(this,yg,0),this.toSVGPath()}return{path:{d:(0,c.A)(this,_g)}}}toSVGPath(){const t=gu.svgRound((0,c.A)(this,fg)[4]),e=gu.svgRound((0,c.A)(this,fg)[5]);if(2===(0,c.A)(this,bg).length)return(0,d.A)(this,_g,"".concat((0,c.A)(this,_g)," M ").concat(t," ").concat(e," Z")),(0,c.A)(this,_g);if((0,c.A)(this,bg).length<=6){const i=(0,c.A)(this,_g).lastIndexOf("M");(0,d.A)(this,_g,"".concat((0,c.A)(this,_g).slice(0,i)," M ").concat(t," ").concat(e)),(0,d.A)(this,yg,6)}if(4===(0,c.A)(this,bg).length){const t=gu.svgRound((0,c.A)(this,fg)[10]),e=gu.svgRound((0,c.A)(this,fg)[11]);return(0,d.A)(this,_g,"".concat((0,c.A)(this,_g)," L ").concat(t," ").concat(e)),(0,d.A)(this,yg,12),(0,c.A)(this,_g)}const i=[];0===(0,c.A)(this,yg)&&(i.push("M ".concat(t," ").concat(e)),(0,d.A)(this,yg,6));for(let s=(0,c.A)(this,yg),n=(0,c.A)(this,fg).length;s<n;s+=6){const t=(0,c.A)(this,fg).slice(s,s+6).map(gu.svgRound),e=(0,b.A)(t,6),n=e[0],a=e[1],r=e[2],o=e[3],l=e[4],h=e[5];i.push("C".concat(n," ").concat(a," ").concat(r," ").concat(o," ").concat(l," ").concat(h))}return(0,d.A)(this,_g,(0,c.A)(this,_g)+i.join(" ")),(0,d.A)(this,yg,(0,c.A)(this,fg).length),(0,c.A)(this,_g)}getOutlines(t,e,i,s){const n=(0,c.A)(this,vg).at(-1);return n.line=new Float32Array(n.line),n.points=new Float32Array(n.points),(0,c.A)(this,kg).build((0,c.A)(this,vg),t,e,i,(0,c.A)(this,mg),(0,c.A)(this,wg),s),(0,d.A)(this,gg,null),(0,d.A)(this,fg,null),(0,d.A)(this,vg,null),(0,d.A)(this,_g,null),(0,c.A)(this,kg)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}function Cg(t,e){return gu._normalizePoint(t,e,(0,c.A)(this,Sg),(0,c.A)(this,xg),(0,c.A)(this,mg))}var Tg=new WeakMap,Rg=new WeakMap,Pg=new WeakMap,Ig=new WeakMap,Lg=new WeakMap,Dg=new WeakMap,Fg=new WeakMap,Wg=new WeakMap,Ng=new WeakMap,Og=new WeakSet,Bg=new WeakSet,Hg=new WeakSet,zg=new WeakSet;class jg extends gu{constructor(){super(...arguments),(0,o.A)(this,zg),(0,o.A)(this,Hg),(0,o.A)(this,Bg),(0,o.A)(this,Og),(0,l.A)(this,Tg,{writable:!0,value:void 0}),(0,l.A)(this,Rg,{writable:!0,value:0}),(0,l.A)(this,Pg,{writable:!0,value:void 0}),(0,l.A)(this,Ig,{writable:!0,value:void 0}),(0,l.A)(this,Lg,{writable:!0,value:void 0}),(0,l.A)(this,Dg,{writable:!0,value:void 0}),(0,l.A)(this,Fg,{writable:!0,value:void 0}),(0,l.A)(this,Wg,{writable:!0,value:void 0}),(0,l.A)(this,Ng,{writable:!0,value:void 0})}build(t,e,i,s,n,a,r){(0,d.A)(this,Lg,e),(0,d.A)(this,Dg,i),(0,d.A)(this,Fg,s),(0,d.A)(this,Wg,n),(0,d.A)(this,Ng,a),(0,d.A)(this,Pg,null!==r&&void 0!==r?r:0),(0,d.A)(this,Ig,t),(0,h.A)(this,Hg,Ug).call(this)}setLastElement(t){return(0,c.A)(this,Ig).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return(0,c.A)(this,Ig).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const e of(0,c.A)(this,Ig)){const i=e.line;if(t.push("M".concat(gu.svgRound(i[4])," ").concat(gu.svgRound(i[5]))),6!==i.length)if(12!==i.length)for(let e=6,s=i.length;e<s;e+=6){const s=i.subarray(e,e+6).map(gu.svgRound),n=(0,b.A)(s,6),a=n[0],r=n[1],o=n[2],l=n[3],h=n[4],c=n[5];t.push("C".concat(a," ").concat(r," ").concat(o," ").concat(l," ").concat(h," ").concat(c))}else t.push("L".concat(gu.svgRound(i[10])," ").concat(gu.svgRound(i[11])));else t.push("Z")}return t.join("")}serialize(t,e){let i=(0,b.A)(t,4),s=i[0],n=i[1],a=i[2],r=i[3];const o=[],l=[],d=(0,h.A)(this,Bg,Vg).call(this),u=(0,b.A)(d,4),A=u[0],p=u[1],g=u[2],f=u[3];let v,m,w,_,y,k,S,x,M;switch((0,c.A)(this,Wg)){case 0:M=gu._rescale,v=s,m=n+r,w=a,_=-r,y=s+A*a,k=n+(1-p-f)*r,S=s+(A+g)*a,x=n+(1-
1p)*r;break;case 90:M=gu._rescaleAndSwap,v=s,m=n,w=a,_=r,y=s+p*a,k=n+A*r,S=s+(p+f)*a,x=n+(A+g)*r;break;case 180:M=gu._rescale,v=s+a,m=n,w=-a,_=r,y=s+(1-A-g)*a,k=n+p*r,S=s+(1-A)*a,x=n+(p+f)*r;break;case 270:M=gu._rescaleAndSwap,v=s+a,m=n+r,w=-a,_=-r,y=s+(1-p-f)*a,k=n+(1-A-g)*r,S=s+(1-p)*a,x=n+(1-A)*r}for(const h of(0,c.A)(this,Ig)){const t=h.line,i=h.points;o.push(M(t,v,m,w,_,e?new Array(t.length):null)),l.push(M(i,v,m,w,_,e?new Array(i.length):null))}return{lines:o,points:l,rect:[y,k,S,x]}}static deserialize(t,e,i,s,n,a){let r=a.paths,o=r.lines,l=r.points,h=a.rotation,c=a.thickness;const d=[];let u,A,p,g,f;switch(h){case 0:f=gu._rescale,u=-t/i,A=e/s+1,p=1/i,g=-1/s;break;case 90:f=gu._rescaleAndSwap,u=-e/s,A=-t/i,p=1/s,g=1/i;break;case 180:f=gu._rescale,u=t/i+1,A=-e/s,p=-1/i,g=1/s;break;case 270:f=gu._rescaleAndSwap,u=e/s+1,A=t/i+1,p=-1/s,g=-1/i}if(!o){o=[];for(const t of l){const e=t.length;if(2===e){o.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1]]));continue}if(4===e){o.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1],NaN,NaN,NaN,NaN,t[2],t[3]]));continue}const i=new Float32Array(3*(e-2));o.push(i);let s=t.subarray(0,4),n=(0,b.A)(s,4),a=n[0],r=n[1],l=n[2],h=n[3];i.set([NaN,NaN,NaN,NaN,a,r],0);for(let o=4;o<e;o+=2){const e=t[o],s=t[o+1];i.set(gu.createBezierPoints(a,r,l,h,e,s),3*(o-2));var v=[l,h,e,s];a=v[0],r=v[1],l=v[2],h=v[3]}}}for(let w=0,b=o.length;w<b;w++)d.push({line:f(o[w].map((t=>null!==t&&void 0!==t?t:NaN)),u,A,p,g),points:f(l[w].map((t=>null!==t&&void 0!==t?t:NaN)),u,A,p,g)});const m=new jg;return m.build(d,i,s,1,h,c,n),m}get box(){return(0,c.A)(this,Tg)}updateProperty(t,e){return"stroke-width"===t?(0,h.A)(this,zg,qg).call(this,e):null}updateParentDimensions(t,e){let i=(0,b.A)(t,2),s=i[0],n=i[1];const a=(0,h.A)(this,Og,Gg).call(this),r=(0,b.A)(a,2),o=r[0],l=r[1];(0,d.A)(this,Lg,s),(0,d.A)(this,Dg,n),(0,d.A)(this,Fg,e);const u=(0,h.A)(this,Og,Gg).call(this),A=(0,b.A)(u,2),p=A[0]-o,g=A[1]-l,f=(0,c.A)(this,Tg);return f[0]-=p,f[1]-=g,f[2]+=2*p,f[3]+=2*g,f}updateRotation(t){return(0,d.A)(this,Rg,t),{path:{transform:this.rotationTransform}}}get viewBox(){return(0,c.A)(this,Tg).map(gu.svgRound).join(" ")}get defaultProperties(){const t=(0,c.A)(this,Tg),e=(0,b.A)(t,2),i=e[0],s=e[1];return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(gu.svgRound(i)," ").concat(gu.svgRound(s))}}}get rotationTransform(){const t=(0,c.A)(this,Tg),e=(0,b.A)(t,4),i=e[2],s=e[3];let n=0,a=0,r=0,o=0,l=0,h=0;switch((0,c.A)(this,Rg)){case 90:a=s/i,r=-i/s,l=i;break;case 180:n=-1,o=-1,l=i,h=s;break;case 270:a=-s/i,r=i/s,h=s;break;default:return""}return"matrix(".concat(n," ").concat(a," ").concat(r," ").concat(o," ").concat(gu.svgRound(l)," ").concat(gu.svgRound(h),")")}getPathResizingSVGProperties(t){let e=(0,b.A)(t,4),i=e[0],s=e[1],n=e[2],a=e[3];const r=(0,h.A)(this,Og,Gg).call(this),o=(0,b.A)(r,2),l=o[0],d=o[1],u=(0,c.A)(this,Tg),A=(0,b.A)(u,4),p=A[0],g=A[1],f=A[2],v=A[3];if(Math.abs(f-l)<=gu.PRECISION||Math.abs(v-d)<=gu.PRECISION){const t=i+n/2-(p+f/2),e=s+a/2-(g+v/2);return{path:{"transform-origin":"".concat(gu.svgRound(i)," ").concat(gu.svgRound(s)),transform:"".concat(this.rotationTransform," translate(").concat(t," ").concat(e,")")}}}const m=(n-2*l)/(f-2*l),w=(a-2*d)/(v-2*d),_=f/n,y=v/a;return{path:{"transform-origin":"".concat(gu.svgRound(p)," ").concat(gu.svgRound(g)),transform:"".concat(this.rotationTransform," scale(").concat(_," ").concat(y,") ")+"translate(".concat(gu.svgRound(l)," ").concat(gu.svgRound(d),") scale(").concat(m," ").concat(w,") ")+"translate(".concat(gu.svgRound(-l)," ").concat(gu.svgRound(-d),")")}}}getPathResizedSVGProperties(t){let e=(0,b.A)(t,4),i=e[0],s=e[1],n=e[2],a=e[3];const r=(0,h.A)(this,Og,Gg).call(this),o=(0,b.A)(r,2),l=o[0],d=o[1],u=(0,c.A)(this,Tg),A=(0,b.A)(u,4),p=A[0],g=A[1],f=A[2],v=A[3];if(u[0]=i,u[1]=s,u[2]=n,u[3]=a,Math.abs(f-l)<=gu.PRECISION||Math.abs(v-d)<=gu.PRECISION){const t=i+n/2-(p+f/2),e=s+a/2-(g+v/2);for(const i of(0,c.A)(this,Ig)){const s=i.line,n=i.points;gu._translate(s,t,e,s),gu._translate(n,t,e,n)}return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(gu.svgRound(i)," ").concat(gu.svgRound(s)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}const m=(n-2*l)/(f-2*l),w=(a-2*d)/(v-2*d),_=-m*(p+l)+i+l,y=-w*(g+d)+s+d;if(1!==m||1!==w||0!==_||0!==y)for(const h of(0,c.A)(this,Ig)){const t=h.line,e=h.points;gu._rescale(t,_,y,m,w,t),gu._rescale(e,_,y,m,w,e)}return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(gu.svgRound(i)," ").concat(gu.svgRound(s)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties(t,e){let i=(0,b.A)(t,2),s=i[0],n=i[1];const a=(0,b.A)(e,2),r=a[0],o=a[1],l=(0,c.A)(this,Tg),h=s-l[0],u=n-l[1];if((0,c.A)(this,Lg)===r&&(0,c.A)(this,Dg)===o)for(const d of(0,c.A)(this,Ig)){const t=d.line,e=d.points;gu._translate(t,h,u,t),gu._translate(e,h,u,e)}else{const t=(0,c.A)(this,Lg)/r,e=(0,c.A)(this,Dg)/o;(0,d.A)(this,Lg,r),(0,d.A)(this,Dg,o);for(const i of(0,c.A)(this,Ig)){const s=i.line,n=i.points;gu._rescale(s,h,u,t,e,s),gu._rescale(n,h,u,t,e,n)}l[2]*=t,l[3]*=e}return l[0]=s,l[1]=n,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":"".concat(gu.svgRound(s)," ").concat(gu.svgRound(n))}}}get defaultSVGProperties(){const t=(0,c.A)(this,Tg);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":"".concat(gu.svgRound(t[0])," ").concat(gu.svgRound(t[1])),transform:this.rotationTransform||null},bbox:t}}}function Gg(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,c.A)(this,Ng);const e=(0,c.A)(this,Pg)+t/2*(0,c.A)(this,Fg);return(0,c.A)(this,Wg)%180===0?[e/(0,c.A)(this,Lg),e/(0,c.A)(this,Dg)]:[e/(0,c.A)(this,Dg),e/(0,c.A)(this,Lg)]}function Vg(){const t=(0,c.A)(this,Tg),e=(0,b.A)(t,4),i=e[0],s=e[1],n=e[2],a=e[3],r=(0,h.A)(this,Og,Gg).call(this,0),o=(0,b.A)(r,2),l=o[0],d=o[1];return[i+l,s+d,n-2*l,a-2*d]}function Ug(){const t=(0,d.A)(this,Tg,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const a of(0,c.A)(this,Ig)){const e=a.line;if(e.length<=12){for(let i=4,s=e.length;i<s;i+=6){const s=e.subarray(i,i+2),n=(0,b.A)(s,2),a=n[0],r=n[1];t[0]=Math.min(t[0],a),t[1]=Math.min(t[1],r),t[2]=Math.max(t[2],a),t[3]=Math.max(t[3],r)}continue}let i=e[4],s=e[5];for(let n=6,a=e.length;n<a;n+=6){const a=e.subarray(n,n+6),r=(0,b.A)(a,6),o=r[0],l=r[1],h=r[2],c=r[3],d=r[4],u=r[5];Ht.bezierBoundingBox(i,s,o,l,h,c,d,u,t),i=d,s=u}}const e=(0,h.A)(this,Og,Gg).call(this),i=(0,b.A)(e,2),s=i[0],n=i[1];t[0]=Math.min(1,Math.max(0,t[0]-s)),t[1]=Math.min(1,Math.max(0,t[1]-n)),t[2]=Math.min(1,Math.max(0,t[2]+s)),t[3]=Math.min(1,Math.max(0,t[3]+n)),t[2]-=t[0],t[3]-=t[1]}function qg(t){const e=(0,h.A)(this,Og,Gg).call(this),i=(0,b.A)(e,2),s=i[0],n=i[1];(0,d.A)(this,Ng,t);const a=(0,h.A)(this,Og,Gg).call(this),r=(0,b.A)(a,2),o=r[0]-s,l=r[1]-n,u=(0,c.A)(this,Tg);return u[0]-=o,u[1]-=l,u[2]+=2*o,u[3]+=2*l,u}
1var Xg=new WeakMap;class Yg extends jp{constructor(t){super(),(0,l.A)(this,Xg,{writable:!0,value:void 0}),(0,d.A)(this,Xg,t),super.updateProperties({fill:"none",stroke:ha._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){var i;"stroke-width"===t&&(null!==(i=e)&&void 0!==i||(e=this["stroke-width"]),e*=(0,c.A)(this,Xg).realScale);super.updateSVGProperty(t,e)}clone(){const t=new Yg((0,c.A)(this,Xg));return t.updateAll(this),t}}var Kg=new WeakSet;class Qg extends $p{constructor(t){super((0,s.A)((0,s.A)({},t),{},{name:"inkEditor"})),(0,o.A)(this,Kg),this._willKeepAspectRatio=!0}static initialize(t,e){ha.initialize(t,e),this._defaultDrawingOptions=new Yg(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return Mt(this,"typesMap",new Map([[N.INK_THICKNESS,"stroke-width"],[N.INK_COLOR,"stroke"],[N.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,i,s,n){return new Eg(t,e,i,s,n,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,i,s,n,a){return jg.deserialize(t,e,i,s,n,a)}static async deserialize(t,e,i){let s=null;if(t instanceof Md){const e=t,i=e.data,n=i.inkLists,a=i.rect,r=i.rotation,o=i.id,l=i.color,h=i.opacity,c=i.borderStyle.rawWidth,d=i.popupRef,u=e.parent.page.pageNumber;s=t={annotationType:W.INK,color:Array.from(l),thickness:c,opacity:h,paths:{points:n},boxes:null,pageIndex:u-1,rect:a.slice(0),rotation:r,id:o,deleted:!1,popupRef:d}}const n=await super.deserialize(t,e,i);return n.annotationElementId=t.id||null,n._initialData=s,n}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const t=this._drawId,e=this._drawingOptions,i=this.parent;e.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions(t){let e=t.color,i=t.thickness,s=t.opacity;this._drawingOptions=Qg.getDefaultDrawingOptions({stroke:Ht.makeHexColor(...e),"stroke-width":i,"stroke-opacity":s})}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=this.serializeDraw(t),i=e.lines,s=e.points,n=e.rect,a=this._drawingOptions,r=a.stroke,o=a["stroke-opacity"],l=a["stroke-width"],c={annotationType:W.INK,color:ha._colorManager.convert(r),opacity:o,thickness:l,paths:{lines:i,points:s},pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?c:this.annotationElementId&&!(0,h.A)(this,Kg,Jg).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(t){const e=this.serializeDraw(!1),i=e.points,s=e.rect;return t.updateEdited({rect:s,thickness:this._drawingOptions["stroke-width"],points:i}),null}}function Jg(t){const e=this._initialData,i=e.color,s=e.thickness,n=e.opacity,a=e.pageIndex;return this._hasBeenMoved||this._hasBeenResized||t.color.some(((t,e)=>t!==i[e]))||t.thickness!==s||t.opacity!==n||t.pageIndex!==a}(0,m.A)(Qg,"_type","ink"),(0,m.A)(Qg,"_editorType",W.INK),(0,m.A)(Qg,"_defaultDrawingOptions",null);var Zg=new WeakMap,$g=new WeakMap,tf=new WeakMap,ef=new WeakMap,sf=new WeakMap,nf=new WeakMap,af=new WeakMap,rf=new WeakMap,of=new WeakMap,lf=new WeakMap,hf=new WeakSet,cf=new WeakSet,df=new WeakSet,uf=new WeakSet,Af=new WeakSet,pf=new WeakSet,gf=new WeakSet,ff=new WeakSet;class vf extends ha{constructor(t){super((0,s.A)((0,s.A)({},t),{},{name:"stampEditor"})),(0,o.A)(this,ff),(0,o.A)(this,gf),(0,o.A)(this,pf),(0,o.A)(this,Af),(0,o.A)(this,uf),(0,o.A)(this,df),(0,o.A)(this,cf),(0,o.A)(this,hf),(0,l.A)(this,Zg,{writable:!0,value:null}),(0,l.A)(this,$g,{writable:!0,value:null}),(0,l.A)(this,tf,{writable:!0,value:null}),(0,l.A)(this,ef,{writable:!0,value:null}),(0,l.A)(this,sf,{writable:!0,value:null}),(0,l.A)(this,nf,{writable:!0,value:""}),(0,l.A)(this,af,{writable:!0,value:null}),(0,l.A)(this,rf,{writable:!0,value:null}),(0,l.A)(this,of,{writable:!0,value:!1}),(0,l.A)(this,lf,{writable:!0,value:!1}
1),(0,d.A)(this,ef,t.bitmapUrl),(0,d.A)(this,sf,t.bitmapFile)}static initialize(t,e){ha.initialize(t,e)}static get supportedTypes(){return Mt(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((t=>"image/".concat(t))))}static get supportedTypesStr(){return Mt(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(W.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!(null===(t=this.altTextData)||void 0===t||!t.altText)}}static computeTelemetryFinalData(t){var e,i;const s=t.get("hasAltText");return{hasAltText:null!==(e=s.get(!0))&&void 0!==e?e:0,hasNoAltText:null!==(i=s.get(!1))&&void 0!==i?i:0}}async mlGuessAltText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.hasAltTextData())return null;const i=this._uiManager.mlManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const s=t||this.copyCanvas(null,null,!0).imageData,n=s.data,a=s.width,r=s.height,o=await i.guess({name:"altText",request:{data:n,width:a,height:r,channels:n.length/(a*r)}});if(!o)throw new Error("No response from the AI service.");if(o.error)throw new Error("Error from the AI service.");if(o.cancel)return null;if(!o.output)throw new Error("No valid response from the AI service.");const l=o.output;return await this.setGuessedAltText(l),e&&!this.hasAltTextData()&&(this.altTextData={alt:l,decorative:!1}),l}remove(){var t;(0,c.A)(this,$g)&&((0,d.A)(this,Zg,null),this._uiManager.imageManager.deleteId((0,c.A)(this,$g)),null===(t=(0,c.A)(this,af))||void 0===t||t.remove(),(0,d.A)(this,af,null),(0,c.A)(this,rf)&&(clearTimeout((0,c.A)(this,rf)),(0,d.A)(this,rf,null)));super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&((0,c.A)(this,$g)&&null===(0,c.A)(this,af)&&(0,h.A)(this,df,bf).call(this),this.isAttachedToDOM||this.parent.add(this))):(0,c.A)(this,$g)&&(0,h.A)(this,df,bf).call(this)}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!((0,c.A)(this,tf)||(0,c.A)(this,Zg)||(0,c.A)(this,ef)||(0,c.A)(this,sf)||(0,c.A)(this,$g))}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),(0,c.A)(this,Zg)?(0,h.A)(this,uf,_f).call(this):(0,h.A)(this,df,bf).call(this),this.width&&!this.annotationElementId){const i=(0,b.A)(this.parentDimensions,2),s=i[0],n=i[1];this.setAt(t*s,e*n,this.width*s,this.height*n)}return this._uiManager.addShouldRescale(this),this.div}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;null!==(0,c.A)(this,rf)&&clearTimeout((0,c.A)(this,rf));(0,d.A)(this,rf,setTimeout((()=>{(0,d.A)(this,rf,null),(0,h.A)(this,pf,kf).call(this)}),200))}copyCanvas(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||(t=224);const s=(0,c.A)(this,Zg),n=s.width,a=s.height,r=new pe;let o=(0,c.A)(this,Zg),l=n,d=a,u=null;if(e){var A,p;if(n>e||a>e){const t=Math.min(e/n,e/a);l=Math.floor(n*t),d=Math.floor(a*t)}u=document.createElement("canvas");const t=u.width=Math.ceil(l*r.sx),i=u.height=Math.ceil(d*r.sy);(0,c.A)(this,of)||(o=(0,h.A)(this,Af,yf).call(this,t,i));const s=u.getContext("2d");s.filter=this._uiManager.hcmFilter;let g="white",f="#cfcfd8";"none"!==this._uiManager.hcmFilter?f="black":null!==(A=(p=window).matchMedia)&&void 0!==A&&A.call(p,"(prefers-color-scheme: dark)").matches&&(g="#8f8f9d",f="#42414d");const v=15,m=v*r.sx,w=v*r.sy,b=new OffscreenCanvas(2*m,2*w),_=b.getContext("2d");_.fillStyle=g,_.fillRect(0,0,2*m,2*w),_.fillStyle=f,_.fillRect(0,0,m,w),_.fillRect(m,w,m,w),s.fillStyle=s.createPattern(b,"repeat"),s.fillRect(0,0,t,i),s.drawImage(o,0,0,o.width,o.height,0,0,t,i)}let g=null;if(i){let e,i;if(r.symmetric&&o.width<t&&o.height<t)e=o.width,i=o.height;else if(o=(0,c.A)(this,Zg),n>t||a>t){const s=Math.min(t/n,t/a);e=Math.floor(n*s),i=Math.floor(a*s),(0,c.A)(this,of)||(o=(0,h.A)(this,Af,yf).call(this,e,i))}const s=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});s.drawImage(o,0,0,o.width,o.height,0,0,e,i),g={width:e,height:i,data:s.getImageData(0,0,e,i).data}}return{canvas:u,width:l,height:d,imageData:g}}getImageForAltText(){return(0,c.A)(this,af)}static async deserialize(t,e,i){let s=null;if(t instanceof Id){var n;const a=t,r=a.data,o=r.rect,l=r.rotation,h=r.id,c=r.structParent,d=r.popupRef,u=a.container,A=a.parent.page.pageNumber,p=u.querySelector("canvas"),g=i.imageManager.getFromCanvas(u.id,p);p.remove();const f=(null===(n=await e._structTree.getAriaAttributes("".concat(Xt).concat(h)))||void 0===n?void 0:n.get("aria-label"))||"";s=t={annotationType:W.STAMP,bitmapId:g.id,bitmap:g.bitmap,pageIndex:A-1,rect:o.slice(0),rotation:l,id:h,deleted:!1,accessibilityData:{decorative:!1,altText:f},isSvg:!1,structParent:c,popupRef:d}}const a=await super.deserialize(t,e,i),r=t,o=r.rect,l=r.bitmap,h=r.bitmapUrl,c=r.bitmapId,u=r.isSvg,A=r.accessibilityData;c&&i.imageManager.isValidId(c)?((0,d.A)(a,$g,c),l&&(0,d.A)(a,Zg,l)):(0,d.A)(a,ef,h),(0,d.A)(a,of,u);const p=(0,b.A)(a.pageDimensions,2),g=p[0],f=p[1];return a.width=(o[2]-o[0])/g,a.height=(o[3]-o[1])/f,a.annotationElementId=t.id||null,A&&(a.altTextData=A),a._initialData=s,(0,d.A)(a,lf,!!s),a}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i={annotationType:W.STAMP,bitmapId:(0,c.A)(this,$g),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:(0,c.A)(this,of),structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=(0,h.A)(this,gf,Sf).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i;const s=this.serializeAltText(!1),n=s.decorative,a=s.altText;if(!n&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const t=(0,h.A)(this,ff,xf).call(this,i);if(t.isSame)return null;var r;if(t.isSameAltText)delete i.accessibilityData;else i.accessibilityData.structParent=null!==(r=this._initialData.structParent)&&void 0!==r?r:-1}
1if(i.id=this.annotationElementId,null===e)return i;e.stamps||(e.stamps=new Map);const o=(0,c.A)(this,of)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has((0,c.A)(this,$g))){if((0,c.A)(this,of)){const t=e.stamps.get((0,c.A)(this,$g));o>t.area&&(t.area=o,t.serialized.bitmap.close(),t.serialized.bitmap=(0,h.A)(this,gf,Sf).call(this,!1))}}else e.stamps.set((0,c.A)(this,$g),{area:o,serialized:i}),i.bitmap=(0,h.A)(this,gf,Sf).call(this,!1);return i}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}}function mf(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?((0,d.A)(this,Zg,t.bitmap),e||((0,d.A)(this,$g,t.id),(0,d.A)(this,of,t.isSvg)),t.file&&(0,d.A)(this,nf,t.file.name),(0,h.A)(this,uf,_f).call(this)):this.remove()}function wf(){if((0,d.A)(this,tf,null),this._uiManager.enableWaiting(!1),(0,c.A)(this,af)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,c.A)(this,Zg))return this._editToolbar.hide(),void this._uiManager.editAltText(this,!0);if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,c.A)(this,Zg)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch(t){}}this.div.focus()}}function bf(){if((0,c.A)(this,$g))return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId((0,c.A)(this,$g)).then((t=>(0,h.A)(this,hf,mf).call(this,t,!0))).finally((()=>(0,h.A)(this,cf,wf).call(this)));if((0,c.A)(this,ef)){const t=(0,c.A)(this,ef);return(0,d.A)(this,ef,null),this._uiManager.enableWaiting(!0),void(0,d.A)(this,tf,this._uiManager.imageManager.getFromUrl(t).then((t=>(0,h.A)(this,hf,mf).call(this,t))).finally((()=>(0,h.A)(this,cf,wf).call(this))))}if((0,c.A)(this,sf)){const t=(0,c.A)(this,sf);return(0,d.A)(this,sf,null),this._uiManager.enableWaiting(!0),void(0,d.A)(this,tf,this._uiManager.imageManager.getFromFile(t).then((t=>(0,h.A)(this,hf,mf).call(this,t))).finally((()=>(0,h.A)(this,cf,wf).call(this))))}const t=document.createElement("input");t.type="file",t.accept=vf.supportedTypesStr;const e=this._uiManager._signal;(0,d.A)(this,tf,new Promise((i=>{t.addEventListener("change",(async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),(0,h.A)(this,hf,mf).call(this,e)}else this.remove();i()}),{signal:e}),t.addEventListener("cancel",(()=>{this.remove(),i()}),{signal:e})})).finally((()=>(0,h.A)(this,cf,wf).call(this)))),t.click()}function _f(){var t;const e=this.div;let i=(0,c.A)(this,Zg),s=i.width,n=i.height;const a=(0,b.A)(this.pageDimensions,2),r=a[0],o=a[1],l=.75;if(this.width)s=this.width*r,n=this.height*o;else if(s>l*r||n>l*o){const t=Math.min(l*r/s,l*o/n);s*=t,n*=t}const u=(0,b.A)(this.parentDimensions,2),A=u[0],p=u[1];this.setDims(s*A/r,n*p/o),this._uiManager.enableWaiting(!1);const g=(0,d.A)(this,af,document.createElement("canvas"));g.setAttribute("role","img"),this.addContainer(g),this.width=s/r,this.height=n/o,null!==(t=this._initialOptions)&&void 0!==t&&t.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),(0,h.A)(this,pf,kf).call(this),(0,c.A)(this,lf)||(this.parent.addUndoableEditor(this),(0,d.A)(this,lf,!0)),this._reportTelemetry({action:"inserted_image"}),(0,c.A)(this,nf)&&g.setAttribute("aria-label",(0,c.A)(this,nf))}function yf(t,e){const i=(0,c.A)(this,Zg);let s=i.width,n=i.height,a=(0,c.A)(this,Zg);for(;s>2*t||n>2*e;){const i=s,r=n;s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),n>2*e&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2));const o=new OffscreenCanvas(s,n);o.getContext("2d").drawImage(a,0,0,i,r,0,0,s,n),a=o.transferToImageBitmap()}return a}function kf(){const t=(0,b.A)(this.parentDimensions,2),e=t[0],i=t[1],s=this.width,n=this.height,a=new pe,r=Math.ceil(s*e*a.sx),o=Math.ceil(n*i*a.sy),l=(0,c.A)(this,af);if(!l||l.width===r&&l.height===o)return;l.width=r,l.height=o;const d=(0,c.A)(this,of)?(0,c.A)(this,Zg):(0,h.A)(this,Af,yf).call(this,r,o),u=l.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(d,0,0,d.width,d.height,0,0,r,o)}function Sf(t){if(t){if((0,c.A)(this,of)){const t=this._uiManager.imageManager.getSvgUrl((0,c.A)(this,$g));if(t)return t}const t=document.createElement("canvas");var e=(0,c.A)(this,Zg);t.width=e.width,t.height=e.height;return t.getContext("2d").drawImage((0,c.A)(this,Zg),0,0),t.toDataURL()}if((0,c.A)(this,of)){const t=(0,b.A)(this.pageDimensions,2),e=t[0],i=t[1],s=Math.round(this.width*e*Kt.PDF_TO_CSS_UNITS),n=Math.round(this.height*i*Kt.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(s,n);return a.getContext("2d").drawImage((0,c.A)(this,Zg),0,0,(0,c.A)(this,Zg).width,(0,c.A)(this,Zg).height,0,0,s,n),a.transferToImageBitmap()}return structuredClone((0,c.A)(this,Zg))}function xf(t){var e;const i=this._initialData,s=i.pageIndex,n=i.accessibilityData.altText,a=t.pageIndex===s,r=((null===(e=t.accessibilityData)||void 0===e?void 0:e.alt)||"")===n;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&a&&r,isSameAltText:r}}(0,m.A)(vf,"_type","stamp"),(0,m.A)(vf,"_editorType",W.STAMP);var Mf=new WeakMap,Ef=new WeakMap,Cf=new WeakMap,Tf=new WeakMap,Rf=new WeakMap,Pf=new WeakMap,If=new WeakMap,Lf=new WeakMap,Df=new WeakMap,Ff=new WeakMap,Wf=new WeakMap,Nf=new WeakMap,Of=new WeakMap,Bf=new WeakMap,Hf=new WeakSet,zf=new WeakMap,jf=new WeakSet,Gf
1=new WeakSet,Vf=new WeakSet;class Uf{constructor(t){let e=t.uiManager,i=t.pageIndex,s=t.div,n=t.structTreeLayer,a=t.accessibilityManager,r=t.annotationLayer,h=t.drawLayer,u=t.textLayer,A=t.viewport,p=t.l10n;(0,o.A)(this,Vf),(0,o.A)(this,Gf),(0,o.A)(this,jf),(0,l.A)(this,zf,{get:Xf,set:void 0}),(0,o.A)(this,Hf),(0,l.A)(this,Mf,{writable:!0,value:void 0}),(0,l.A)(this,Ef,{writable:!0,value:!1}),(0,l.A)(this,Cf,{writable:!0,value:null}),(0,l.A)(this,Tf,{writable:!0,value:null}),(0,l.A)(this,Rf,{writable:!0,value:null}),(0,l.A)(this,Pf,{writable:!0,value:new Map}),(0,l.A)(this,If,{writable:!0,value:!1}),(0,l.A)(this,Lf,{writable:!0,value:!1}),(0,l.A)(this,Df,{writable:!0,value:!1}),(0,l.A)(this,Ff,{writable:!0,value:null}),(0,l.A)(this,Wf,{writable:!0,value:null}),(0,l.A)(this,Nf,{writable:!0,value:null}),(0,l.A)(this,Of,{writable:!0,value:null}),(0,l.A)(this,Bf,{writable:!0,value:void 0});const g=[...v(Uf,Uf,Jf).values()];if(!Uf._initialized){Uf._initialized=!0;for(const t of g)t.initialize(p,e)}e.registerEditorTypes(g),(0,d.A)(this,Bf,e),this.pageIndex=i,this.div=s,(0,d.A)(this,Mf,a),(0,d.A)(this,Cf,r),this.viewport=A,(0,d.A)(this,Nf,u),this.drawLayer=h,this._structTree=n,(0,c.A)(this,Bf).addLayer(this)}get isEmpty(){return 0===(0,c.A)(this,Pf).size}get isInvisible(){return this.isEmpty&&(0,c.A)(this,Bf).getMode()===W.NONE}updateToolbar(t){(0,c.A)(this,Bf).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,c.A)(this,Bf).getMode();switch((0,h.A)(this,Vf,Qf).call(this),t){case W.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case W.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case W.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const e=this.div.classList;for(const i of v(Uf,Uf,Jf).values())e.toggle("".concat(i._type,"Editing"),t===i._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===(null===(e=(0,c.A)(this,Nf))||void 0===e?void 0:e.div)}setEditingState(t){(0,c.A)(this,Bf).setEditingState(t)}addCommands(t){(0,c.A)(this,Bf).addCommands(t)}cleanUndoStack(t){(0,c.A)(this,Bf).cleanUndoStack(t)}toggleDrawing(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("drawing",!t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(t=(0,c.A)(this,Cf))||void 0===t||t.div.classList.toggle("disabled",!e)}async enable(){(0,d.A)(this,Df,!0),this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const i of(0,c.A)(this,Pf).values())i.enableEditing(),i.show(!0),i.annotationElementId&&((0,c.A)(this,Bf).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));if(!(0,c.A)(this,Cf))return void(0,d.A)(this,Df,!1);const e=(0,c.A)(this,Cf).getEditableAnnotations();for(const i of e){if(i.hide(),(0,c.A)(this,Bf).isDeletedAnnotationElement(i.data.id))continue;if(t.has(i.data.id))continue;const e=await this.deserialize(i);e&&(this.addOrRebuild(e),e.enableEditing())}(0,d.A)(this,Df,!1)}disable(){(0,d.A)(this,Lf,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const n of(0,c.A)(this,Pf).values()){var i;n.disableEditing(),n.annotationElementId&&(null===n.serialize()?(e.set(n.annotationElementId,n),null===(i=this.getEditableAnnotation(n.annotationElementId))||void 0===i||i.show(),n.remove()):t.set(n.annotationElementId,n))}if((0,c.A)(this,Cf)){const i=(0,c.A)(this,Cf).getEditableAnnotations();for(const s of i){const i=s.data.id;if((0,c.A)(this,Bf).isDeletedAnnotationElement(i))continue;let n=e.get(i);n?(n.resetAnnotationElement(s),n.show(!1),s.show()):(n=t.get(i),n&&((0,c.A)(this,Bf).addChangedExistingAnnotation(n),n.renderAnnotationElement(s)&&n.show(!1)),s.show())}}(0,h.A)(this,Vf,Qf).call(this),this.isEmpty&&(this.div.hidden=!0);const s=this.div.classList;for(const n of v(Uf,Uf,Jf).values())s.remove("".concat(n._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),(0,d.A)(this,Lf,!1)}getEditableAnnotation(t){var e;return(null===(e=(0,c.A)(this,Cf))||void 0===e?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){(0,c.A)(this,Bf).getActive()!==t&&(0,c.A)(this,Bf).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,null!==(t=(0,c.A)(this,Nf))&&void 0!==t&&t.div&&!(0,c.A)(this,Of)){(0,d.A)(this,Of,new AbortController);const t=(0,c.A)(this,Bf).combinedSignal((0,c.A)(this,Of));(0,c.A)(this,Nf).div.addEventListener("pointerdown",(0,h.A)(this,Hf,qf).bind(this),{signal:t}),(0,c.A)(this,Nf).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,null!==(t=(0,c.A)(this,Nf))&&void 0!==t&&t.div&&(0,c.A)(this,Of)&&((0,c.A)(this,Of).abort(),(0,d.A)(this,Of,null),(0,c.A)(this,Nf).div.classList.remove("highlighting"))}enableClick(){if((0,c.A)(this,Tf))return;(0,d.A)(this,Tf,new AbortController);const t=(0,c.A)(this,Bf).combinedSignal((0,c.A)(this,Tf));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;null===(t=(0,c.A)(this,Tf))||void 0===t||t.abort(),(0,d.A)(this,Tf,null)}attach(t){(0,c.A)(this,Pf).set(t.id,t);const e=t.annotationElementId;e&&(0,c.A)(this,Bf).isDeletedAnnotationElement(e)&&(0,c.A)(this,Bf).removeDeletedAnnotationElement(t)}detach(t){var e;(0,c.A)(this,Pf).delete(t.id),null===(e=(0,c.A)(this,Mf))||void 0===e||e.removePointerInTextLayer(t.contentDiv),!(0,c.A)(this,Lf)&&t.annotationElementId&&(0,c.A)(this,Bf).addDeletedAnnotationElement(t)}remove(t){this.detach(t),(0,c.A)(this,Bf).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&((0,c.A)(this,Bf).addDeletedAnnotationElement(t.annotationElementId),ha.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),null===(e=t.parent)||void 0===e||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),(0,c.A)(this,Bf).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!(0,c.A)(this,Df)),(0,c.A)(this,Bf).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var e;if(!t.isAttachedToDOM)return;const i=document.activeElement;t.div.contains(i)&&!(0,c.A)(this,Rf)&&(t._focusEventsAllowed=!1,(0,d.A)(this,Rf,setTimeout((()=>{(0,d.A)(this,Rf,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0,signal:(0,c.A)(this,Bf)._signal}),i.focus())}),0))),t._structTreeParentId=null===(e=(0,c.A)(this,Mf))||void 0===e?void 0:e.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return(0,c.A)(this,Bf).getId()}combinedSignal(t){return(0,c.A)(this,Bf).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return null===(t=(0,c.A)(this,zf))||void 0===t?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){(0,c.A)(this,Bf).updateToolbar(t),(0,c.A)(this,Bf).updateMode(t);const i=(0,h.A)(this,Gf,Kf).call(this),n=i.offsetX,a=i.offsetY,r=this.getNextId(),o=(0,h.A)(this,jf,Yf).
1call(this,(0,s.A)({parent:this,id:r,x:n,y:a,uiManager:(0,c.A)(this,Bf),isCentered:!0},e));o&&this.add(o)}async deserialize(t){var e,i;return await(null===(e=v(Uf,Uf,Jf).get(null!==(i=t.annotationType)&&void 0!==i?i:t.annotationEditorType))||void 0===e?void 0:e.deserialize(t,this,(0,c.A)(this,Bf)))||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getNextId(),a=(0,h.A)(this,jf,Yf).call(this,(0,s.A)({parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:(0,c.A)(this,Bf),isCentered:e},i));return a&&this.add(a),a}addNewEditor(){this.createAndAddNewEditor((0,h.A)(this,Gf,Kf).call(this),!0)}setSelected(t){(0,c.A)(this,Bf).setSelected(t)}toggleSelected(t){(0,c.A)(this,Bf).toggleSelected(t)}unselect(t){(0,c.A)(this,Bf).unselect(t)}pointerup(t){var e;const i=Ot.platform.isMac;0!==t.button||t.ctrlKey&&i||t.target===this.div&&(0,c.A)(this,If)&&((0,d.A)(this,If,!1),null!==(e=(0,c.A)(this,zf))&&void 0!==e&&e.isDrawer&&(0,c.A)(this,zf).supportMultipleDrawings||((0,c.A)(this,Ef)?(0,c.A)(this,Bf).getMode()!==W.STAMP?this.createAndAddNewEditor(t,!1):(0,c.A)(this,Bf).unselectAll():(0,d.A)(this,Ef,!0)))}pointerdown(t){var e;if((0,c.A)(this,Bf).getMode()===W.HIGHLIGHT&&this.enableTextSelection(),(0,c.A)(this,If))return void(0,d.A)(this,If,!1);const i=Ot.platform.isMac;if(0!==t.button||t.ctrlKey&&i)return;if(t.target!==this.div)return;if((0,d.A)(this,If,!0),null!==(e=(0,c.A)(this,zf))&&void 0!==e&&e.isDrawer)return void this.startDrawingSession(t);const s=(0,c.A)(this,Bf).getActive();(0,d.A)(this,Ef,!s||s.isEmpty())}startDrawingSession(t){if(this.div.focus(),(0,c.A)(this,Ff))return void(0,c.A)(this,zf).startDrawing(this,(0,c.A)(this,Bf),!1,t);(0,c.A)(this,Bf).setCurrentDrawingSession(this),(0,d.A)(this,Ff,new AbortController);const e=(0,c.A)(this,Bf).combinedSignal((0,c.A)(this,Ff));this.div.addEventListener("blur",(t=>{let e=t.relatedTarget;e&&!this.div.contains(e)&&((0,d.A)(this,Wf,null),this.commitOrRemove())}),{signal:e}),(0,c.A)(this,zf).startDrawing(this,(0,c.A)(this,Bf),!1,t)}pause(t){if(t){const t=document.activeElement;this.div.contains(t)&&(0,d.A)(this,Wf,t)}else(0,c.A)(this,Wf)&&setTimeout((()=>{var t;null===(t=(0,c.A)(this,Wf))||void 0===t||t.focus(),(0,d.A)(this,Wf,null)}),0)}endDrawingSession(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,c.A)(this,Ff)?((0,c.A)(this,Bf).setCurrentDrawingSession(null),(0,c.A)(this,Ff).abort(),(0,d.A)(this,Ff,null),(0,d.A)(this,Wf,null),(0,c.A)(this,zf).endDrawing(t)):null}findNewParent(t,e,i){const s=(0,c.A)(this,Bf).findParent(e,i);return null!==s&&s!==this&&(s.changeParent(t),!0)}commitOrRemove(){return!!(0,c.A)(this,Ff)&&(this.endDrawingSession(),!0)}onScaleChanging(){(0,c.A)(this,Ff)&&(0,c.A)(this,zf).onScaleChangingWhenDrawing(this)}destroy(){var t;this.commitOrRemove(),(null===(t=(0,c.A)(this,Bf).getActive())||void 0===t?void 0:t.parent)===this&&((0,c.A)(this,Bf).commitOrRemove(),(0,c.A)(this,Bf).setActiveEditor(null)),(0,c.A)(this,Rf)&&(clearTimeout((0,c.A)(this,Rf)),(0,d.A)(this,Rf,null));for(const i of(0,c.A)(this,Pf).values()){var e;null===(e=(0,c.A)(this,Mf))||void 0===e||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove()}this.div=null,(0,c.A)(this,Pf).clear(),(0,c.A)(this,Bf).removeLayer(this)}render(t){let e=t.viewport;this.viewport=e,Ae(this.div,e);for(const i of(0,c.A)(this,Bf).getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update(t){let e=t.viewport;(0,c.A)(this,Bf).commitOrRemove(),(0,h.A)(this,Vf,Qf).call(this);const i=this.viewport.rotation,s=e.rotation;if(this.viewport=e,Ae(this.div,{rotation:s}),i!==s)for(const n of(0,c.A)(this,Pf).values())n.rotate(s)}get pageDimensions(){const t=this.viewport.rawDims;return[t.pageWidth,t.pageHeight]}get scale(){return(0,c.A)(this,Bf).viewParameters.realScale}}function qf(t){(0,c.A)(this,Bf).unselectAll();const e=t.target;if(e===(0,c.A)(this,Nf).div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&(0,c.A)(this,Nf).div.contains(e)){const e=Ot.platform.isMac;if(0!==t.button||t.ctrlKey&&e)return;(0,c.A)(this,Bf).showAllEditors("highlight",!0,!0),(0,c.A)(this,Nf).div.classList.add("free"),this.toggleDrawing(),Sp.startHighlighting(this,"ltr"===(0,c.A)(this,Bf).direction,{target:(0,c.A)(this,Nf).div,x:t.x,y:t.y}),(0,c.A)(this,Nf).div.addEventListener("pointerup",(()=>{(0,c.A)(this,Nf).div.classList.remove("free"),this.toggleDrawing(!0)}),{once:!0,signal:(0,c.A)(this,Bf)._signal}),t.preventDefault()}}function Xf(){return v(Uf,Uf,Jf).get((0,c.A)(this,Bf).getMode())}function Yf(t){const e=(0,c.A)(this,zf);return e?new e.prototype.constructor(t):null}function Kf(){const t=this.div.getBoundingClientRect(),e=t.x,i=t.y,s=t.width,n=t.height,a=Math.max(0,e),r=Math.max(0,i),o=(a+Math.min(window.innerWidth,e+s))/2-e,l=(r+Math.min(window.innerHeight,i+n))/2-i,h=this.viewport.rotation%180===0?[o,l]:[l,o],c=(0,b.A)(h,2);return{offsetX:c[0],offsetY:c[1]}}function Qf(){for(const t of(0,c.A)(this,Pf).values())t.isEmpty()&&t.remove()}(0,m.A)(Uf,"_initialized",!1);var Jf={writable:!0,value:new Map([au,Qg,vf,Sp].map((t=>[t._editorType,t])))},Zf=new WeakMap,$f=new WeakMap,tv=new WeakMap,ev=new WeakMap,iv=new WeakSet,sv=new WeakSet,nv=new WeakSet;class av{constructor(t){let e=t.pageIndex;(0,o.A)(this,nv),(0,o.A)(this,sv),(0,o.A)(this,iv),(0,l.A)(this,Zf,{writable:!0,value:null}),(0,l.A)(this,$f,{writable:!0,value:0}),(0,l.A)(this,tv,{writable:!0,value:new Map}),(0,l.A)(this,ev,{writable:!0,value:new Map}),this.pageIndex=e}setParent(t){if((0,c.A)(this,Zf)){if((0,c.A)(this,Zf)!==t){if((0,c.A)(this,tv).size>0)for(const e of(0,c.A)(this,tv).values())e.remove(),t.append(e);(0,d.A)(this,Zf,t)}}else(0,d.A)(this,Zf,t)}static get _svgFactory(){return Mt(this,"_svgFactory",new tc)}draw(t){var e,i;let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=((0,d.A)(this,$f,(e=(0,c.A)(this,$f),i=e++,e)),i),r=(0,h.A)(this,iv,ov).call(this),o=av._svgFactory.createElement("defs");r.append(o);const l=av._svgFactory.createElement("path");o.append(l);const u="path_p".concat(this.pageIndex,"_").concat(a);l.setAttribute("id",u),l.setAttribute("vector-effect","non-scaling-stroke"),s&&(0,c.A)(this,ev).set(a,l);const A=n?(0,h.A)(this,sv,lv).call(this,o,u):null,p=av._svgFactory.createElement("use");return r.append(p),p.setAttribute("href","#".concat(u)),this.updateProperties(r,t),(0,c.A)(this,tv).set(a,r),{id:a,clipPathId:"url(#".concat(A,")")}}drawOutline(t,e){var i,s;const n=((0,d.A)(this,$f,(i=(0,c.A)(this,$f),s=i++,i)),s),a=(0,h.A)(this,iv,ov).call(this),r=av._svgFactory.createElement("defs");a.append(r);const o=av._svgFactory.createElement("path");r.append(o);const l="path_p".concat(this.pageIndex,"_").concat(n);let u;if(o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e){const t=av._svgFactory.createElement("mask");r.append(t),u="mask_p".concat(this.pageIndex,"_").concat(n),t.setAttribute("id",u),t.setAttribute("maskUnits","objectBoundingBox");const e=av._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");const i=av._svgFactory.createElement("use");t.append(i),i.setAttribute("href","#".concat(l)),i.setAttribute("stroke","none"),i.setAttribute("fill","black"),i.setAttribute("fill-rule","nonzero"),i.classList.add("mask")}const A=av._svgFactory.createElement("use");a.append(A),A.setAttribute("href","#".concat(l)),u&&A.setAttribute("mask","url(#".concat(u,")"));const p=A.cloneNode();return a.append(p),A.classList.add("mainOutline"),p.classList.add("secondaryOutline"),this.updateProperties(a,t),(0,c.A)(this,tv).set(n,a),n}finalizeDraw(t,e){(0,c.A)(this,ev).delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;const i=e.root,s=e.bbox,n=e.rootClass,a=e.path,r="number"===typeof t?(0,c.A)(this,tv).get(t):t;if(r){if(i&&(0,h.A)(this,nv,hv).call(this,r,i),s&&w(av,av,rv).call(av,r,s),n){const t=r.classList;for(const e of Object.entries(n)){var o=(0,b.A)(e,2);const i=o[0],s=o[1];t.toggle(i,s)}}
1if(a){const t=r.firstChild.firstChild;(0,h.A)(this,nv,hv).call(this,t,a)}}}updateParent(t,e){if(e===this)return;const i=(0,c.A)(this,tv).get(t);i&&((0,c.A)(e,Zf).append(i),(0,c.A)(this,tv).delete(t),(0,c.A)(e,tv).set(t,i))}remove(t){(0,c.A)(this,ev).delete(t),null!==(0,c.A)(this,Zf)&&((0,c.A)(this,tv).get(t).remove(),(0,c.A)(this,tv).delete(t))}destroy(){(0,d.A)(this,Zf,null);for(const t of(0,c.A)(this,tv).values())t.remove();(0,c.A)(this,tv).clear(),(0,c.A)(this,ev).clear()}}function rv(t,e){let i=(0,b.A)(e,4),s=i[0],n=i[1],a=i[2],r=i[3];const o=t.style;o.top="".concat(100*n,"%"),o.left="".concat(100*s,"%"),o.width="".concat(100*a,"%"),o.height="".concat(100*r,"%")}function ov(){const t=av._svgFactory.create(1,1,!0);return(0,c.A)(this,Zf).append(t),t.setAttribute("aria-hidden",!0),t}function lv(t,e){const i=av._svgFactory.createElement("clipPath");t.append(i);const s="clip_".concat(e);i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");const n=av._svgFactory.createElement("use");return i.append(n),n.setAttribute("href","#".concat(e)),n.classList.add("clip"),s}function hv(t,e){for(const s of Object.entries(e)){var i=(0,b.A)(s,2);const e=i[0],n=i[1];null===n?t.removeAttribute(e):t.setAttribute(e,n)}}globalThis.pdfjsTestingUtils={HighlightOutliner:dA};var cv=y.GlobalWorkerOptions,dv=y.getDocument},87695(t,e,i){i.d(e,{A:()=>o});var s=i(96369),n=i(73893),a=i(27800),r=i(76562);function o(t){return(0,s.A)(t)||(0,n.A)(t)||(0,a.A)(t)||(0,r.A)()}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.