sealclaw 2026.9.21 → 2026.9.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/build-info.json +2 -2
  2. package/dist/cli-startup-metadata.json +1 -1
  3. package/dist/control-ui/assets/{agents-BY4aXME8.js → agents-B3eGrySi.js} +2 -2
  4. package/dist/control-ui/assets/{channels-D-QByuhk.js → channels-CuNr3x8S.js} +2 -2
  5. package/dist/control-ui/assets/{cron-BgVlNDdc.js → cron-CS9cgBJT.js} +2 -2
  6. package/dist/control-ui/assets/{cron-task-list-D2nXZpo2.js → cron-task-list-CU6ybcB9.js} +2 -2
  7. package/dist/control-ui/assets/{debug-CuGSEgIy.js → debug-DR6YkUV-.js} +2 -2
  8. package/dist/control-ui/assets/{filespace-DicgLi9K.js → filespace-jYEFvxIi.js} +2 -2
  9. package/dist/control-ui/assets/{index-CwOuBWjW.js → index-BTFXLjRb.js} +9 -9
  10. package/dist/control-ui/assets/{instances-uGReSAlG.js → instances-BXXkA07m.js} +2 -2
  11. package/dist/control-ui/assets/{nodes-DmSj9fyO.js → nodes-CJ48zMNM.js} +2 -2
  12. package/dist/control-ui/assets/{pdf-9NuP_4_b.js → pdf-DyX3XLCf.js} +2 -2
  13. package/dist/control-ui/assets/{pdf.worker-C3u58bx7.js → pdf.worker-BbbExAx6.js} +2 -2
  14. package/dist/control-ui/assets/{plugins-DlhMPMhL.js → plugins-B5NdnLkj.js} +2 -2
  15. package/dist/control-ui/assets/request-Cif3b33V.js +2 -0
  16. package/dist/control-ui/assets/{sessions-ltqOEThv.js → sessions-C0-Brdmh.js} +2 -2
  17. package/dist/control-ui/assets/{skill-center-T5345ywM.js → skill-center-B0-YuHLe.js} +2 -2
  18. package/dist/control-ui/assets/{skill-publish-DAkF1LGc.js → skill-publish-C7InyITi.js} +2 -2
  19. package/dist/control-ui/assets/{skills-CPiV0PPn.js → skills-DBun6Ded.js} +2 -2
  20. package/dist/control-ui/assets/{workspace-browser-B3o_ElYg.js → workspace-browser-oC_m4pwR.js} +2 -2
  21. package/dist/control-ui/index.html +2 -2
  22. package/dist/extensions/xicheng-bi/index.js +1 -1
  23. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  24. package/dist/postinstall-inventory.json +18 -18
  25. package/package.json +1 -1
  26. package/dist/control-ui/assets/request-C_ZSS118.js +0 -2
@@ -1,4 +1,4 @@
1
- import{$ as e,h as t}from"./index-CwOuBWjW.js";import{a as n,i as r,n as i,r as a,t as o}from"./classPrivateFieldSet2-DSsIYuru.js";function s(e,t,n){t||(t=[]);var r=t.length++;return Object.defineProperty({},`_`,{set:function(i){t[r]=i,e.apply(n,t)}})}var c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,ee={};ee.d=(e,t)=>{for(var n in t)ee.o(t,n)&&!ee.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},ee.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var E=typeof process==`object`&&process+``==`[object process]`&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!==`browser`),te=[1/0,1/0,-1/0,-1/0],ne=new Float32Array(te),re=[.001,0,0,.001,0,0],ie=1.35;.35/ie;var ae={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},oe={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},se=`pdfjs_internal_editor_`,D={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},O={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},ce={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},le={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},ue={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},de={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},fe={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},pe={ERRORS:0,WARNINGS:1,INFOS:5},me={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,rawFillPath:94},he={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},ge={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},_e=pe.WARNINGS;function ve(e){Number.isInteger(e)&&(_e=e)}function ye(){return _e}function be(e){_e>=pe.INFOS&&console.info(`Info: ${e}`)}function k(e){_e>=pe.WARNINGS&&console.warn(`Warning: ${e}`)}function A(e){throw Error(e)}function xe(e,t){e||A(t)}function Se(e){switch(e==null?void 0:e.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function Ce(e,t=null,n=null){if(!e)return null;if(n&&typeof e==`string`){if(n.addDefaultProtocol&&e.startsWith(`www.`)){let t=e.match(/\./g);(t==null?void 0:t.length)>=2&&(e=`http://${e}`)}if(n.tryConvertEncoding)try{e=ze(e)}catch{}}let r=t?URL.parse(e,t):URL.parse(e);return Se(r)?r:null}function we(e,t,n=!1){let r=URL.parse(e);return r?(r.hash=t,r.href):n&&Ce(e,`http://example.com`)?e.split(`#`,1)[0]+`${t?`#${t}`:``}`:``}function Te(e){return e.substring(e.lastIndexOf(`/`)+1)}function j(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}var Ee=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=Error(),e.constructor=e,e}(),De=class extends Ee{constructor(e,t){super(e,`PasswordException`),this.code=t}},Oe=class extends Ee{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}},ke=class extends Ee{constructor(e){super(e,`InvalidPDFException`)}},Ae=class extends Ee{constructor(e,t,n){super(e,`ResponseException`),this.status=t,this.missing=n}},je=class extends Ee{constructor(e){super(e,`FormatError`)}},Me=class extends Ee{constructor(e){super(e,`AbortException`)}};function Ne(e){(typeof e!=`object`||(e==null?void 0:e.length)===void 0)&&A(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);let r=[];for(let i=0;i<t;i+=n){let a=Math.min(i+n,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join(``)}function Pe(e){typeof e!=`string`&&A(`Invalid argument for stringToBytes`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}function Fe(){let e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}var Ie=class{static get isLittleEndian(){return j(this,`isLittleEndian`,Fe())}static get isOffscreenCanvasSupported(){return j(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get isImageDecoderSupported(){return j(this,`isImageDecoderSupported`,typeof ImageDecoder<`u`)}static get isFloat16ArraySupported(){return j(this,`isFloat16ArraySupported`,typeof Float16Array<`u`)}static get isSanitizerSupported(){return j(this,`isSanitizerSupported`,typeof Sanitizer<`u`)}static get platform(){let{platform:e,userAgent:t}=navigator;return j(this,`platform`,{isAndroid:t.includes(`Android`),isLinux:e.includes(`Linux`),isMac:e.includes(`Mac`),isWindows:e.includes(`Win`),isFirefox:t.includes(`Firefox`)})}static get isCSSRoundSupported(){var e,t;return j(this,`isCSSRoundSupported`,(e=globalThis.CSS)==null||(t=e.supports)==null?void 0:t.call(e,`width: round(1.5px, 1px)`))}static get isAlphaColorInputSupported(){return j(this,`isAlphaColorInputSupported`,(()=>{if(typeof document>`u`)return!1;let e=document.createElement(`input`);return e.type=`color`,e.setAttribute(`alpha`,``),e.value=`#ff000080`,e.value!==`#ff0000`})())}},M=class e{static get hexNums(){return j(this,`hexNums`,Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,`0`)))}static makeHexColor(e,t,n){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[n]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[1],t[1]=n,n=t[2],t[2]=t[3],t[3]=n,e[1]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){let r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4],e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];for(let t=0;t<6;t+=2){let l=e[n+t],u=e[n+t+1];e[n+t]=l*r+u*a+s,e[n+t+1]=l*i+u*o+c}}static applyInverseTransform(e,t){let n=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i,e[1]=(-n*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=e[0],u=e[1],d=e[2],f=e[3],p=r*l+s,m=p,h=r*d+s,g=h,_=o*u+c,v=_,y=o*f+c,b=y;if(i!==0||a!==0){let e=i*l,t=i*d,n=a*u,r=a*f;p+=n,g+=n,h+=r,m+=r,_+=e,b+=e,y+=t,v+=t}n[0]=Math.min(n[0],p,h,m,g),n[1]=Math.min(n[1],_,y,v,b),n[2]=Math.max(n[2],p,h,m,g),n[3]=Math.max(n[3],_,y,v,b)}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=n**2+r**2,s=n*i+r*a,c=i**2+a**2,l=(o+c)/2,u=Math.sqrt(l**2-(o*c-s**2));t[0]=Math.sqrt(l+u||1),t[1]=Math.sqrt(l-u||1)}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,r,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],t,r),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],t,r)}static bezierBoundingBox(t,r,i,a,o,s,c,l,u){u[0]=Math.min(u[0],t,c),u[1]=Math.min(u[1],r,l),u[2]=Math.max(u[2],t,c),u[3]=Math.max(u[3],r,l),n(e,this,Re).call(this,t,i,o,c,r,a,s,l,3*(-t+3*(i-o)+c),6*(t-2*i+o),3*(i-t),u),n(e,this,Re).call(this,t,i,o,c,r,a,s,l,3*(-r+3*(a-s)+l),6*(r-2*a+s),3*(a-r),u)}};c=M;function Le(e,t,n,r,i,a,o,s,c,l){if(c<=0||c>=1)return;let u=1-c,d=c*c,f=d*c,p=u*(u*(u*e+3*c*t)+3*d*n)+f*r,m=u*(u*(u*i+3*c*a)+3*d*o)+f*s;l[0]=Math.min(l[0],p),l[1]=Math.min(l[1],m),l[2]=Math.max(l[2],p),l[3]=Math.max(l[3],m)}function Re(e,t,r,i,a,o,s,l,u,d,f,p){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&n(c,this,Le).call(this,e,t,r,i,a,o,s,l,-f/d,p);return}let m=d**2-4*f*u;if(m<0)return;let h=Math.sqrt(m),g=2*u;n(c,this,Le).call(this,e,t,r,i,a,o,s,l,(-d+h)/g,p),n(c,this,Le).call(this,e,t,r,i,a,o,s,l,(-d-h)/g,p)}function ze(e){return decodeURIComponent(escape(e))}var Be=null,Ve=null;function He(e){return Be||(Be=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Ve=new Map([[`ſt`,`ſt`]])),e.replaceAll(Be,(e,t,n)=>t?t.normalize(`NFKC`):Ve.get(n))}function Ue(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),Ne(e)}var We=`pdfjs_internal_id_`;function Ge(e,t,n){if(!Array.isArray(n)||n.length<2)return!1;let[r,i,...a]=n;if(!e(r)&&!Number.isInteger(r)||!t(i))return!1;let o=a.length,s=!0;switch(i.name){case`XYZ`:if(o<2||o>3)return!1;break;case`Fit`:case`FitB`:return o===0;case`FitH`:case`FitBH`:case`FitV`:case`FitBV`:if(o>1)return!1;break;case`FitR`:if(o!==4)return!1;s=!1;break;default:return!1}for(let e of a)if(!(typeof e==`number`||s&&e===null))return!1;return!0}var Ke=()=>[],qe=()=>new Map,Je=()=>Object.create(null);function N(e,t,n){return Math.min(Math.max(e,t),n)}var Ye=class e{static textContent(t){let n=[],r={items:n,styles:Object.create(null)};function i(t){var r;if(!t)return;let a=null,o=t.name;if(o===`#text`)a=t.value;else if(e.shouldBuildText(o))!(t==null||(r=t.attributes)==null)&&r.textContent?a=t.attributes.textContent:t.value&&(a=t.value);else return;if(a!==null&&n.push({str:a}),t.children)for(let e of t.children)i(e)}return i(t),r}static shouldBuildText(e){return!(e===`textarea`||e===`input`||e===`option`||e===`select`)}},Xe=class{static setupStorage(e,t,n,r,i){let a=r.getValue(t,{value:null});switch(n.name){case`textarea`:if(a.value!==null&&(e.textContent=a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})});break;case`input`:if(n.attributes.type===`radio`||n.attributes.type===`checkbox`){if(a.value===n.attributes.xfaOn?e.setAttribute(`checked`,!0):a.value===n.attributes.xfaOff&&e.removeAttribute(`checked`),i===`print`)break;e.addEventListener(`change`,e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute(`xfaOn`):e.target.getAttribute(`xfaOff`)})})}else{if(a.value!==null&&e.setAttribute(`value`,a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})})}break;case`select`:if(a.value!==null){e.setAttribute(`value`,a.value);for(let e of n.children)e.attributes.value===a.value?e.attributes.selected=!0:Object.hasOwn(e.attributes,`selected`)&&delete e.attributes.selected}e.addEventListener(`input`,e=>{let n=e.target.options,i=n.selectedIndex===-1?``:n[n.selectedIndex].value;r.setValue(t,{value:i})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){let{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type===`radio`&&(a.name=`${a.name}-${r}`);for(let[t,n]of Object.entries(a))if(n!=null)switch(t){case`class`:n.length&&e.setAttribute(t,n.join(` `));break;case`dataId`:break;case`id`:e.setAttribute(`data-element-id`,n);break;case`style`:Object.assign(e.style,n);break;case`textContent`:e.textContent=n;break;default:(!o||t!==`href`&&t!==`newWindow`)&&e.setAttribute(t,n)}o&&i.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,t,n)}static render(e){let t=e.annotationStorage,n=e.linkService,r=e.xfaHtml,i=e.intent||`display`,a=document.createElement(r.name);r.attributes&&this.setAttributes({html:a,element:r,intent:i,linkService:n});let o=i!==`richText`,s=e.div;if(s.append(a),e.viewport){let t=`matrix(${e.viewport.transform.join(`,`)})`;s.style.transform=t}o&&s.setAttribute(`class`,`xfaLayer xfaFont`);let c=[];if(r.children.length===0){if(r.value){let e=document.createTextNode(r.value);a.append(e),o&&Ye.shouldBuildText(r.name)&&c.push(e)}return{textDivs:c}}let l=[[r,-1,a]];for(;l.length>0;){var u,d;let[e,r,a]=l.at(-1);if(r+1===e.children.length){l.pop();continue}let s=e.children[++l.at(-1)[1]];if(s===null)continue;let{name:f}=s;if(f===`#text`){let e=document.createTextNode(s.value);c.push(e),a.append(e);continue}let p=!(s==null||(u=s.attributes)==null)&&u.xmlns?document.createElementNS(s.attributes.xmlns,f):document.createElement(f);if(a.append(p),s.attributes&&this.setAttributes({html:p,element:s,storage:t,intent:i,linkService:n}),((d=s.children)==null?void 0:d.length)>0)l.push([s,-1,p]);else if(s.value){let e=document.createTextNode(s.value);o&&Ye.shouldBuildText(f)&&c.push(e),p.append(e)}}for(let e of s.querySelectorAll(`.xfaNonInteractive input, .xfaNonInteractive textarea`))e.setAttribute(`readOnly`,!0);return{textDivs:c}}static update(e){let t=`matrix(${e.viewport.transform.join(`,`)})`;e.div.style.transform=t,e.div.hidden=!1}},Ze=`http://www.w3.org/2000/svg`,Qe=class{};l=Qe,e(Qe,`CSS`,96),e(Qe,`PDF`,72),e(Qe,`PDF_TO_CSS_UNITS`,l.CSS/l.PDF);async function $e(e,t=`text`){if(ct(e,document.baseURI)){let n=await fetch(e);if(!n.ok)throw Error(n.statusText);switch(t){case`blob`:return n.blob();case`bytes`:return n.bytes();case`json`:return n.json()}return n.text()}return new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`GET`,e,!0),i.responseType=t===`bytes`?`arraybuffer`:t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case`bytes`:n(new Uint8Array(i.response));return;case`blob`:case`json`:n(i.response);return}n(i.responseText);return}r(Error(i.statusText))}},i.send(null)})}var et=class e{constructor({viewBox:e,userUnit:t,scale:n,rotation:r,offsetX:i=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=r,this.offsetX=i,this.offsetY=a,n*=t;let s=(e[2]+e[0])/2,c=(e[3]+e[1])/2,l,u,d,f;switch(r%=360,r<0&&(r+=360),r){case 180:l=-1,u=0,d=0,f=1;break;case 90:l=0,u=1,d=1,f=0;break;case 270:l=0,u=-1,d=-1,f=0;break;case 0:l=1,u=0,d=0,f=-1;break;default:throw Error(`PageViewport: Invalid rotation, must be a multiple of 90 degrees.`)}o&&(d=-d,f=-f);let p,m,h,g;l===0?(p=Math.abs(c-e[1])*n+i,m=Math.abs(s-e[0])*n+a,h=(e[3]-e[1])*n,g=(e[2]-e[0])*n):(p=Math.abs(s-e[0])*n+i,m=Math.abs(c-e[1])*n+a,h=(e[2]-e[0])*n,g=(e[3]-e[1])*n),this.transform=[l*n,u*n,d*n,f*n,p-l*n*s-d*n*c,m-u*n*s-f*n*c],this.width=h,this.height=g}get rawDims(){let e=this.viewBox;return j(this,`rawDims`,{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:t=this.scale,rotation:n=this.rotation,offsetX:r=this.offsetX,offsetY:i=this.offsetY,dontFlip:a=!1}={}){return new e({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:n,offsetX:r,offsetY:i,dontFlip:a})}convertToViewportPoint(e,t){let n=[e,t];return M.applyTransform(n,this.transform),n}convertToViewportRectangle(e){let t=[e[0],e[1]];M.applyTransform(t,this.transform);let n=[e[2],e[3]];return M.applyTransform(n,this.transform),[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){let n=[e,t];return M.applyInverseTransform(n,this.transform),n}},tt=class extends Ee{constructor(e,t=0){super(e,`RenderingCancelledException`),this.extraDelay=t}};function nt(e){let t=e.length,n=0;for(;n<t&&e[n].trim()===``;)n++;return e.substring(n,n+5).toLowerCase()===`data:`}function rt(e){return typeof e==`string`&&/\.pdf$/i.test(e)}function it(e){return[e]=e.split(/[#?]/,1),Te(e)}function at(e,t=`document.pdf`){if(typeof e!=`string`)return t;if(nt(e))return k(`getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.`),t;let n=(e=>{try{return new URL(e)}catch{try{return new URL(decodeURIComponent(e))}catch{try{return new URL(e,`https://foo.bar`)}catch{try{return new URL(decodeURIComponent(e),`https://foo.bar`)}catch{return null}}}}})(e);if(!n)return t;let r=e=>{try{let t=decodeURIComponent(e);return t.includes(`/`)&&(t=Te(t),/^\.pdf$/i.test(t))?e:t}catch{return e}},i=/\.pdf$/i,a=Te(n.pathname);if(i.test(a))return r(a);if(n.searchParams.size>0){let e=e=>[...e].findLast(e=>i.test(e)),t=e(n.searchParams.values())??e(n.searchParams.keys());if(t)return r(t)}if(n.hash){let e=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(e)return r(e[0])}return t}var ot=new WeakMap,st=class{constructor(){r(this,ot,new Map),e(this,`times`,[])}time(e){a(ot,this).has(e)&&k(`Timer is already running for ${e}`),a(ot,this).set(e,Date.now())}timeEnd(e){a(ot,this).has(e)||k(`Timer has not been started for ${e}`),this.times.push({name:e,start:a(ot,this).get(e),end:Date.now()}),a(ot,this).delete(e)}toString(){let e=Math.max(...this.times.map(e=>e.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}ms\n`).join(``)}};function ct(e,t){let n=t?URL.parse(e,t):URL.parse(e);return/https?:/.test((n==null?void 0:n.protocol)??``)}function lt(e){e.preventDefault()}function P(e){e.preventDefault(),e.stopPropagation()}function ut(e){console.log(`Deprecated API usage: `+e)}var dt=class e{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!=`string`)return null;n(e,this,ft)._||(ft._=n(e,this,null));let r=n(e,this,ft)._.exec(t);if(!r)return null;let i=parseInt(r[1],10),a=parseInt(r[2],10);a=a>=1&&a<=12?a-1:0;let o=parseInt(r[3],10);o=o>=1&&o<=31?o:1;let s=parseInt(r[4],10);s=s>=0&&s<=23?s:0;let c=parseInt(r[5],10);c=c>=0&&c<=59?c:0;let l=parseInt(r[6],10);l=l>=0&&l<=59?l:0;let u=r[7]||`Z`,d=parseInt(r[8],10);d=d>=0&&d<=23?d:0;let f=parseInt(r[9],10)||0;return f=f>=0&&f<=59?f:0,u===`-`?(s+=d,c+=f):u===`+`&&(s-=d,c-=f),new Date(Date.UTC(i,a,o,s,c,l))}},ft={_:void 0};function pt(e,{scale:t=1,rotation:n=0}){let{width:r,height:i}=e.attributes.style;return new et({viewBox:[0,0,parseInt(r,10),parseInt(i,10)],userUnit:1,scale:t,rotation:n})}function mt(e){if(e.startsWith(`#`)){let t=e.slice(1);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),t.length>=8?parseInt(t.slice(6,8),16)/255:1]}if(e.startsWith(`rgb(`)){let[t,n,r]=e.slice(4,-1).split(`,`).map(e=>parseInt(e,10));return[t,n,r,1]}if(e.startsWith(`rgba(`)){let t=e.slice(5,-1).split(`,`);return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3])]}let t=e.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!==`none`?parseFloat(t[4]):1]:null}function ht(e){let t=mt(e);return t?t.slice(0,3):(k(`Not a valid color format: "${e}"`),[0,0,0])}function gt(e){let t=document.createElement(`span`);t.style.visibility=`hidden`,t.style.colorScheme=`only light`,document.body.append(t);for(let n of e.keys()){t.style.color=n;let r=window.getComputedStyle(t).color;e.set(n,ht(r))}t.remove()}function F(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform();return[t,n,r,i,a,o]}function _t(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform().invertSelf();return[t,n,r,i,a,o]}function vt(e,t,n=!1,r=!0){if(t instanceof et){let{pageWidth:r,pageHeight:i}=t.rawDims,{style:a}=e,o=Ie.isCSSRoundSupported,s=`var(--total-scale-factor) * ${r}px`,c=`var(--total-scale-factor) * ${i}px`,l=o?`round(down, ${s}, var(--scale-round-x))`:`calc(${s})`,u=o?`round(down, ${c}, var(--scale-round-y))`:`calc(${c})`;!n||t.rotation%180==0?(a.width=l,a.height=u):(a.width=u,a.height=l)}r&&e.setAttribute(`data-main-rotation`,t.rotation)}var yt=class e{constructor(){let{pixelRatio:t}=e;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,n,r,i,a=-1){let o=1/0,s=1/0,c=1/0;r=e.capPixels(r,a),r>0&&(o=Math.sqrt(r/(t*n))),i!==-1&&(s=i/t,c=i/n);let l=Math.min(o,s,c);return this.sx>l||this.sy>l?(this.sx=l,this.sy=l,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,n):n}return e}},bt=[`image/apng`,`image/avif`,`image/bmp`,`image/gif`,`image/jpeg`,`image/png`,`image/svg+xml`,`image/webp`,`image/x-icon`],xt=class{static get isDarkMode(){var e,t;return j(this,`isDarkMode`,!!(!((e=window)==null||(t=e.matchMedia)==null)&&t.call(e,`(prefers-color-scheme: dark)`).matches))}},St=class{static get commentForegroundColor(){let e=document.createElement(`span`);e.classList.add(`comment`,`sidebar`);let{style:t}=e;t.width=t.height=`0`,t.display=`none`,t.color=`var(--comment-fg-color)`,document.body.append(e);let{color:n}=window.getComputedStyle(e);return e.remove(),j(this,`commentForegroundColor`,ht(n))}};function Ct(e,t){t=N(t??1,0,1);let n=255*(1-t);return e.map(e=>Math.round(e*t+n))}function wt(e,t){let n=e[0]/255,r=e[1]/255,i=e[2]/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(a+o)/2;if(a===o)t[0]=t[1]=0;else{let e=a-o;switch(t[1]=s<.5?e/(a+o):e/(2-a-o),a){case n:t[0]=((r-i)/e+(r<i?6:0))*60;break;case r:t[0]=((i-n)/e+2)*60;break;case i:t[0]=((n-r)/e+4)*60;break}}t[2]=s}function Tt(e,t){let n=e[0],r=e[1],i=e[2],a=(1-Math.abs(2*i-1))*r,o=a*(1-Math.abs(n/60%2-1)),s=i-a/2;switch(Math.floor(n/60)){case 0:t[0]=a+s,t[1]=o+s,t[2]=s;break;case 1:t[0]=o+s,t[1]=a+s,t[2]=s;break;case 2:t[0]=s,t[1]=a+s,t[2]=o+s;break;case 3:t[0]=s,t[1]=o+s,t[2]=a+s;break;case 4:t[0]=o+s,t[1]=s,t[2]=a+s;break;case 5:case 6:t[0]=a+s,t[1]=s,t[2]=o+s;break}}function Et(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function Dt(e,t,n){Tt(e,n),n.map(Et);let r=.2126*n[0]+.7152*n[1]+.0722*n[2];Tt(t,n),n.map(Et);let i=.2126*n[0]+.7152*n[1]+.0722*n[2];return r>i?(r+.05)/(i+.05):(i+.05)/(r+.05)}var Ot=new Map;function kt(e,t){let n=e[0]+e[1]*256+e[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,r=Ot.get(n);if(r)return r;let i=new Float32Array(9),a=i.subarray(0,3),o=i.subarray(3,6);wt(e,o);let s=i.subarray(6,9);wt(t,s);let c=s[2]<.5,l=c?12:4.5;if(o[2]=c?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),Dt(o,s,a)<l){let e,t;for(c?(e=o[2],t=1):(e=0,t=o[2]);t-e>.005;){let n=o[2]=(e+t)/2;c===Dt(o,s,a)<l?e=n:t=n}o[2]=c?t:e}return Tt(o,a),r=M.makeHexColor(Math.round(a[0]*255),Math.round(a[1]*255),Math.round(a[2]*255)),Ot.set(n,r),r}function At({html:e,dir:t,className:n},r){let i=document.createDocumentFragment();if(typeof e==`string`){let n=document.createElement(`p`);n.dir=t||`auto`;let r=e.split(/(?:\r\n?|\n)/);for(let e=0,t=r.length;e<t;++e){let i=r[e];n.append(document.createTextNode(i)),e<t-1&&n.append(document.createElement(`br`))}i.append(n)}else Xe.render({xfaHtml:e,div:i,intent:`richText`});i.firstElementChild.classList.add(`richText`,n),r.append(i)}function jt(e){let t=new Path2D;if(!e)return t;for(let n=0,r=e.length;n<r;)switch(e[n++]){case he.moveTo:t.moveTo(e[n++],e[n++]);break;case he.lineTo:t.lineTo(e[n++],e[n++]);break;case he.curveTo:t.bezierCurveTo(e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]);break;case he.quadraticCurveTo:t.quadraticCurveTo(e[n++],e[n++],e[n++],e[n++]);break;case he.closePath:t.closePath();break;default:k(`Unrecognized drawing path operator: ${e[n-1]}`);break}return t}var Mt=new WeakMap,Nt=new WeakMap,Pt=new WeakMap,Ft=new WeakMap,It=new WeakMap,Lt=new WeakMap,Rt=new WeakMap,zt=new WeakMap,Bt=new WeakSet,Vt=class{constructor(e){i(this,Bt),r(this,Mt,null),r(this,Nt,null),r(this,Pt,void 0),r(this,Ft,null),r(this,It,null),r(this,Lt,null),r(this,Rt,null),r(this,zt,null),o(Pt,this,e),qt._||(qt._=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`,signature:`pdfjs-editor-remove-signature-button`}))}render(){let e=o(Mt,this,document.createElement(`div`));e.classList.add(`editToolbar`,`hidden`),e.setAttribute(`role`,`toolbar`);let t=a(Pt,this)._uiManager._signal;t instanceof AbortSignal&&!t.aborted&&(e.addEventListener(`contextmenu`,lt,{signal:t}),e.addEventListener(`pointerdown`,Ht,{signal:t}));let n=o(Ft,this,document.createElement(`div`));n.className=`buttons`,e.append(n);let r=a(Pt,this).toolbarPosition;if(r){let{style:t}=e;t.insetInlineEnd=`${100*(a(Pt,this)._uiManager.direction===`ltr`?1-r[0]:r[0])}%`,t.top=`calc(${100*r[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return a(Mt,this)}hide(){var e;a(Mt,this).classList.add(`hidden`),(e=a(Nt,this))==null||e.hideDropdown()}show(){var e,t;a(Mt,this).classList.remove(`hidden`),(e=a(It,this))==null||e.shown(),(t=a(Lt,this))==null||t.shown()}addDeleteButton(){let{editorType:e,_uiManager:t}=a(Pt,this),r=document.createElement(`button`);r.classList.add(`basic`,`deleteButton`),r.tabIndex=0,r.setAttribute(`data-l10n-id`,qt._[e]),n(Bt,this,Gt).call(this,r)&&r.addEventListener(`click`,e=>{t.delete()},{signal:t._signal}),a(Ft,this).append(r)}async addAltText(e){let t=await e.render();n(Bt,this,Gt).call(this,t),a(Ft,this).append(t,Kt.call(n(Bt,this))),o(It,this,e)}addComment(e,t=null){if(a(Lt,this))return;let r=e.renderForToolbar();if(!r)return;n(Bt,this,Gt).call(this,r);let i=o(Rt,this,Kt.call(n(Bt,this)));t?(a(Ft,this).insertBefore(r,t),a(Ft,this).insertBefore(i,t)):a(Ft,this).append(r,i),o(Lt,this,e),e.toolbar=this}addColorPicker(e){if(a(Nt,this))return;o(Nt,this,e);let t=e.renderButton();n(Bt,this,Gt).call(this,t),a(Ft,this).append(t,Kt.call(n(Bt,this)))}async addEditSignatureButton(e){let t=o(zt,this,await e.renderEditButton(a(Pt,this)));n(Bt,this,Gt).call(this,t),a(Ft,this).append(t,Kt.call(n(Bt,this)))}removeButton(e){switch(e){case`comment`:var t,n;(t=a(Lt,this))==null||t.removeToolbarCommentButton(),o(Lt,this,null),(n=a(Rt,this))==null||n.remove(),o(Rt,this,null);break}}async addButton(e,t){switch(e){case`colorPicker`:t&&this.addColorPicker(t);break;case`altText`:t&&await this.addAltText(t);break;case`editSignature`:t&&await this.addEditSignatureButton(t);break;case`delete`:this.addDeleteButton();break;case`comment`:t&&this.addComment(t);break}}async addButtonBefore(e,t,n){if(!t&&e===`comment`)return;let r=a(Ft,this).querySelector(n);r&&e===`comment`&&this.addComment(t,r)}updateEditSignatureButton(e){a(zt,this)&&(a(zt,this).title=e)}remove(){var e;a(Mt,this).remove(),(e=a(Nt,this))==null||e.destroy(),o(Nt,this,null)}};function Ht(e){e.stopPropagation()}function Ut(e){a(Pt,this)._focusEventsAllowed=!1,P(e)}function Wt(e){a(Pt,this)._focusEventsAllowed=!0,P(e)}function Gt(e){let t=a(Pt,this)._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener(`focusin`,n(Bt,this,Ut).bind(this),{capture:!0,signal:t}),e.addEventListener(`focusout`,n(Bt,this,Wt).bind(this),{capture:!0,signal:t}),e.addEventListener(`contextmenu`,lt,{signal:t}),!0)}function Kt(){let e=document.createElement(`div`);return e.className=`divider`,e}var qt={_:null},Jt=new WeakMap,Yt=new WeakMap,Xt=new WeakMap,Zt=new WeakSet,Qt=class{constructor(e){i(this,Zt),r(this,Jt,null),r(this,Yt,null),r(this,Xt,void 0),o(Xt,this,e)}show(e,t,r){let[i,s]=n(Zt,this,en).call(this,t,r),{style:c}=a(Yt,this)||o(Yt,this,n(Zt,this,$t).call(this));e.append(a(Yt,this)),c.insetInlineEnd=`${100*i}%`,c.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){a(Yt,this).remove()}};function $t(){let e=o(Yt,this,document.createElement(`div`));e.className=`editToolbar`,e.setAttribute(`role`,`toolbar`);let t=a(Xt,this)._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener(`contextmenu`,lt,{signal:t});let r=o(Jt,this,document.createElement(`div`));return r.className=`buttons`,e.append(r),a(Xt,this).hasCommentManager()&&n(Zt,this,tn).call(this,`commentButton`,`pdfjs-comment-floating-button`,`pdfjs-comment-floating-button-label`,()=>{a(Xt,this).commentSelection(`floating_button`)}),n(Zt,this,tn).call(this,`highlightButton`,`pdfjs-highlight-floating-button1`,`pdfjs-highlight-floating-button-label`,()=>{a(Xt,this).highlightSelection(`floating_button`)}),e}function en(e,t){let n=0,r=0;for(let i of e){let e=i.y+i.height;if(e<n)continue;let a=i.x+(t?i.width:0);if(e>n){r=a,n=e;continue}t?a>r&&(r=a):a<r&&(r=a)}return[t?1-r:r,n]}function tn(e,t,n,r){let i=document.createElement(`button`);i.classList.add(`basic`,e),i.tabIndex=0,i.setAttribute(`data-l10n-id`,t);let o=document.createElement(`span`);i.append(o),o.className=`visuallyHidden`,o.setAttribute(`data-l10n-id`,n);let s=a(Xt,this)._signal;s instanceof AbortSignal&&!s.aborted&&(i.addEventListener(`contextmenu`,lt,{signal:s}),i.addEventListener(`click`,r,{signal:s})),a(Jt,this).append(i)}function nn(e,t,n){for(let r of n)t.addEventListener(r,e[r].bind(e))}var rn=class e{static initializeAndAddPointerId(e){(on._||(on._=new Set)).add(e)}static setPointer(e,t){an._||(an._=t),cn._??(cn._=e)}static setTimeStamp(e){sn._=e}static isSamePointerId(e){return an._===e}static isSamePointerIdOrRemove(e){var t;return an._===e?!0:((t=on._)==null||t.delete(e),!1)}static isSamePointerType(e){return cn._===e}static isInitializedAndDifferentPointerType(t){return cn._!==null&&!e.isSamePointerType(t)}static isSameTimeStamp(e){return sn._===e}static isUsingMultiplePointers(){var e;return((e=on._)==null?void 0:e.size)>=1}static clearPointerType(){cn._=null}static clearPointerIds(){an._=NaN,on._=null}static clearTimeStamp(){sn._=NaN}},an={_:NaN},on={_:null},sn={_:NaN},cn={_:null},ln=new WeakMap,un=class{constructor(){r(this,ln,0)}get id(){var e,t;return`${se}${o(ln,this,(e=a(ln,this),t=e++,e)),t}`}},dn=new WeakMap,fn=new WeakMap,pn=new WeakMap,mn=new WeakSet,hn=class{constructor(){i(this,mn),r(this,dn,Ue()),r(this,fn,0),r(this,pn,null)}static get _isSVGFittingCanvas(){let e=new OffscreenCanvas(1,3).getContext(`2d`,{willReadFrequently:!0}),t=new Image;t.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>`;let n=t.decode().then(()=>(e.drawImage(t,0,0,1,1,0,0,1,3),new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0]===0));return j(this,`_isSVGFittingCanvas`,n)}async getFromFile(e){let{lastModified:t,name:r,size:i,type:a}=e;return n(mn,this,gn).call(this,`${t}_${r}_${i}_${a}`,e)}async getFromUrl(e){return n(mn,this,gn).call(this,e,e)}async getFromBlob(e,t){let r=await t;return n(mn,this,gn).call(this,e,r)}async getFromId(e){a(pn,this)||o(pn,this,new Map);let t=a(pn,this).get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){let{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){var n,r;a(pn,this)||o(pn,this,new Map);let i=a(pn,this).get(e);if(i!=null&&i.bitmap)return i.refCounter+=1,i;let s=new OffscreenCanvas(t.width,t.height);return s.getContext(`2d`).drawImage(t,0,0),i={bitmap:s.transferToImageBitmap(),id:`image_${a(dn,this)}_${o(fn,this,(n=a(fn,this),r=n++,n)),r}`,refCounter:1,isSvg:!1},a(pn,this).set(e,i),a(pn,this).set(i.id,i),i}getSvgUrl(e){let t=a(pn,this).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var t;a(pn,this)||o(pn,this,new Map);let n=a(pn,this).get(e);if(!n||(--n.refCounter,n.refCounter!==0))return;let{bitmap:r}=n;if(!n.url&&!n.file){let e=new OffscreenCanvas(r.width,r.height);e.getContext(`bitmaprenderer`).transferFromImageBitmap(r),n.blobPromise=e.convertToBlob()}(t=r.close)==null||t.call(r),n.bitmap=null}isValidId(e){return e.startsWith(`image_${a(dn,this)}_`)}};u=hn;async function gn(e,t){a(pn,this)||o(pn,this,new Map);let n=a(pn,this).get(e);if(n===null)return null;if(n!=null&&n.bitmap)return n.refCounter+=1,n;try{var r,i;n||(n={bitmap:null,id:`image_${a(dn,this)}_${o(fn,this,(r=a(fn,this),i=r++,r)),i}`,refCounter:0,isSvg:!1});let e;if(typeof t==`string`?(n.url=t,e=await $e(t,`blob`)):t instanceof File?e=n.file=t:t instanceof Blob&&(e=t),e.type===`image/svg+xml`){let t=u._isSVGFittingCanvas,r=new FileReader,i=new Image,a=new Promise((e,a)=>{i.onload=()=>{n.bitmap=i,n.isSvg=!0,e()},r.onload=async()=>{let e=n.svgUrl=r.result;i.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e},i.onerror=r.onerror=a});r.readAsDataURL(e),await a}else n.bitmap=await createImageBitmap(e);n.refCounter=1}catch(e){k(e),n=null}return a(pn,this).set(e,n),n&&a(pn,this).set(n.id,n),n}var _n=new WeakMap,vn=new WeakMap,yn=new WeakMap,bn=new WeakMap,xn=class{constructor(e=128){r(this,_n,[]),r(this,vn,!1),r(this,yn,void 0),r(this,bn,-1),o(yn,this,e)}add({cmd:e,undo:t,post:n,mustExec:r,type:i=NaN,overwriteIfSameType:s=!1,keepUndo:c=!1}){if(r&&e(),a(vn,this))return;let l={cmd:e,undo:t,post:n,type:i};if(a(bn,this)===-1){a(_n,this).length>0&&(a(_n,this).length=0),o(bn,this,0),a(_n,this).push(l);return}if(s&&a(_n,this)[a(bn,this)].type===i){c&&(l.undo=a(_n,this)[a(bn,this)].undo),a(_n,this)[a(bn,this)]=l;return}let u=a(bn,this)+1;u===a(yn,this)?a(_n,this).splice(0,1):(o(bn,this,u),u<a(_n,this).length&&a(_n,this).splice(u)),a(_n,this).push(l)}undo(){if(a(bn,this)===-1)return;o(vn,this,!0);let{undo:e,post:t}=a(_n,this)[a(bn,this)];e(),t==null||t(),o(vn,this,!1),o(bn,this,a(bn,this)-1)}redo(){if(a(bn,this)<a(_n,this).length-1){o(bn,this,a(bn,this)+1),o(vn,this,!0);let{cmd:e,post:t}=a(_n,this)[a(bn,this)];e(),t==null||t(),o(vn,this,!1)}}hasSomethingToUndo(){return a(bn,this)!==-1}hasSomethingToRedo(){return a(bn,this)<a(_n,this).length-1}cleanType(e){if(a(bn,this)!==-1){for(let t=a(bn,this);t>=0;t--)if(a(_n,this)[t].type!==e){a(_n,this).splice(t+1,a(bn,this)-t),o(bn,this,t);return}a(_n,this).length=0,o(bn,this,-1)}}destroy(){o(_n,this,null)}},Sn=new WeakSet,Cn=class{constructor(e){i(this,Sn),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:t}=Ie.platform;for(let[n,r,i={}]of e)for(let e of n){let n=e.startsWith(`mac+`);t&&n?(this.callbacks.set(e.slice(4),{callback:r,options:i}),this.allKeys.add(e.split(`+`).at(-1))):!t&&!n&&(this.callbacks.set(e,{callback:r,options:i}),this.allKeys.add(e.split(`+`).at(-1)))}}exec(e,t){if(!this.allKeys.has(t.key))return;let r=this.callbacks.get(n(Sn,this,wn).call(this,t));if(!r)return;let{callback:i,options:{bubbles:a=!1,args:o=[],checker:s=null}}=r;s&&!s(e,t)||(i.bind(e,...o,t)(),a||P(t))}};function wn(e){e.altKey&&this.buffer.push(`alt`),e.ctrlKey&&this.buffer.push(`ctrl`),e.metaKey&&this.buffer.push(`meta`),e.shiftKey&&this.buffer.push(`shift`),this.buffer.push(e.key);let t=this.buffer.join(`+`);return this.buffer.length=0,t}var Tn=class e{get _colors(){let e=new Map([[`CanvasText`,null],[`Canvas`,null]]);return gt(e),j(this,`_colors`,e)}convert(t){let n=ht(t);if(!window.matchMedia(`(forced-colors: active)`).matches)return n;for(let[t,r]of this._colors)if(r.every((e,t)=>e===n[t]))return e._colorsMapping.get(t);return n}getHexCode(e){let t=this._colors.get(e);return t?M.makeHexColor(...t):e}};e(Tn,`_colorsMapping`,new Map([[`CanvasText`,[0,0,0]],[`Canvas`,[255,255,255]]]));var En=new WeakMap,Dn=new WeakMap,On=new WeakMap,kn=new WeakMap,An=new WeakMap,jn=new WeakMap,Mn=new WeakMap,Nn=new WeakMap,Pn=new WeakMap,Fn=new WeakMap,In=new WeakMap,Ln=new WeakMap,Rn=new WeakMap,zn=new WeakMap,Bn=new WeakMap,Vn=new WeakMap,Hn=new WeakMap,Un=new WeakMap,Wn=new WeakMap,Gn=new WeakMap,Kn=new WeakMap,qn=new WeakMap,Jn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,Zn=new WeakMap,Qn=new WeakMap,$n=new WeakMap,er=new WeakMap,tr=new WeakMap,nr=new WeakMap,rr=new WeakMap,ir=new WeakMap,ar=new WeakMap,or=new WeakMap,sr=new WeakMap,cr=new WeakMap,I=new WeakMap,lr=new WeakMap,ur=new WeakMap,dr=new WeakMap,fr=new WeakMap,pr=new WeakMap,mr=new WeakMap,hr=new WeakMap,gr=new WeakMap,_r=new WeakMap,vr=new WeakMap,yr=new WeakMap,br=new WeakMap,L=new WeakSet,xr=class t{static get _keyboardManager(){let e=t.prototype,n=e=>a(_r,e).contains(document.activeElement)&&document.activeElement.tagName!==`BUTTON`&&e.hasSomethingToControl(),r=(e,{target:t})=>{if(t instanceof HTMLInputElement){let{type:e}=t;return e!==`text`&&e!==`number`}return!0},i=this.TRANSLATE_SMALL,o=this.TRANSLATE_BIG;return j(this,`_keyboardManager`,new Cn([[[`ctrl+a`,`mac+meta+a`],e.selectAll,{checker:r}],[[`ctrl+z`,`mac+meta+z`],e.undo,{checker:r}],[[`ctrl+y`,`ctrl+shift+z`,`mac+meta+shift+z`,`ctrl+shift+Z`,`mac+meta+shift+Z`],e.redo,{checker:r}],[[`Backspace`,`alt+Backspace`,`ctrl+Backspace`,`shift+Backspace`,`mac+Backspace`,`mac+alt+Backspace`,`mac+ctrl+Backspace`,`Delete`,`ctrl+Delete`,`shift+Delete`,`mac+Delete`],e.delete,{checker:r}],[[`Enter`,`mac+Enter`],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&a(_r,e).contains(t)&&!e.isEnterHandled}],[[` `,`mac+ `],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&a(_r,e).contains(document.activeElement)}],[[`Escape`,`mac+Escape`],e.unselectAll],[[`ArrowLeft`,`mac+ArrowLeft`],e.translateSelectedEditors,{args:[-i,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],e.translateSelectedEditors,{args:[-o,0],checker:n}],[[`ArrowRight`,`mac+ArrowRight`],e.translateSelectedEditors,{args:[i,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],e.translateSelectedEditors,{args:[o,0],checker:n}],[[`ArrowUp`,`mac+ArrowUp`],e.translateSelectedEditors,{args:[0,-i],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],e.translateSelectedEditors,{args:[0,-o],checker:n}],[[`ArrowDown`,`mac+ArrowDown`],e.translateSelectedEditors,{args:[0,i],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],e.translateSelectedEditors,{args:[0,o],checker:n}]]))}constructor(t,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){i(this,L),r(this,En,new AbortController),r(this,Dn,null),r(this,On,null),r(this,kn,new Map),r(this,An,new Map),r(this,jn,null),r(this,Mn,null),r(this,Nn,null),r(this,Pn,null),r(this,Fn,new xn),r(this,In,null),r(this,Ln,null),r(this,Rn,null),r(this,zn,0),r(this,Bn,new Set),r(this,Vn,null),r(this,Hn,null),r(this,Un,new Set),e(this,`_editorUndoBar`,null),r(this,Wn,!1),r(this,Gn,!1),r(this,Kn,!1),r(this,qn,null),r(this,Jn,null),r(this,Yn,null),r(this,Xn,null),r(this,Zn,!1),r(this,Qn,null),r(this,$n,new un),r(this,er,!1),r(this,tr,!1),r(this,nr,!1),r(this,rr,null),r(this,ir,null),r(this,ar,null),r(this,or,null),r(this,sr,null),r(this,cr,D.NONE),r(this,I,new Set),r(this,lr,null),r(this,ur,null),r(this,dr,null),r(this,fr,null),r(this,pr,null),r(this,mr,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),r(this,hr,[0,0]),r(this,gr,null),r(this,_r,null),r(this,vr,null),r(this,yr,null),r(this,br,null);let S=this._signal=a(En,this).signal;o(_r,this,t),o(vr,this,s),o(yr,this,c),o(Mn,this,l),o(In,this,u),o(ur,this,d),o(pr,this,p),this._eventBus=f,f._on(`editingaction`,this.onEditingAction.bind(this),{signal:S}),f._on(`pagechanging`,this.onPageChanging.bind(this),{signal:S}),f._on(`scalechanging`,this.onScaleChanging.bind(this),{signal:S}),f._on(`rotationchanging`,this.onRotationChanging.bind(this),{signal:S}),f._on(`setpreference`,this.onSetPreference.bind(this),{signal:S}),f._on(`switchannotationeditorparams`,e=>this.updateParams(e.type,e.value),{signal:S}),window.addEventListener(`pointerdown`,()=>{o(tr,this,!0)},{capture:!0,signal:S}),window.addEventListener(`pointerup`,()=>{o(tr,this,!1)},{capture:!0,signal:S}),window.addEventListener(`beforeunload`,n(L,this,wr).bind(this),{capture:!0,signal:S}),n(L,this,Or).call(this),n(L,this,Fr).call(this),n(L,this,jr).call(this),o(Nn,this,p.annotationStorage),o(qn,this,p.filterFactory),o(dr,this,m),o(Xn,this,h||null),o(Wn,this,g),o(Gn,this,_),o(Kn,this,v),o(sr,this,y||null),this.viewParameters={realScale:Qe.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=b||null,this._supportsPinchToZoom=x!==!1,u==null||u.setSidebarUiManager(this)}destroy(){var e,t,n,r,i,s,c,l,u;(e=a(br,this))==null||e.resolve(),o(br,this,null),(t=a(En,this))==null||t.abort(),o(En,this,null),this._signal=null;for(let e of a(An,this).values())e.destroy();a(An,this).clear(),a(kn,this).clear(),a(Un,this).clear(),(n=a(or,this))==null||n.clear(),o(Dn,this,null),a(I,this).clear(),a(Fn,this).destroy(),(r=a(Mn,this))==null||r.destroy(),(i=a(In,this))==null||i.destroy(),(s=a(ur,this))==null||s.destroy(),(c=a(Qn,this))==null||c.hide(),o(Qn,this,null),(l=a(ar,this))==null||l.destroy(),o(ar,this,null),o(On,this,null),a(Jn,this)&&(clearTimeout(a(Jn,this)),o(Jn,this,null)),a(gr,this)&&(clearTimeout(a(gr,this)),o(gr,this,null)),(u=this._editorUndoBar)==null||u.destroy(),o(pr,this,null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return a(sr,this)}get useNewAltTextFlow(){return a(Gn,this)}get useNewAltTextWhenAddingImage(){return a(Kn,this)}get hcmFilter(){return j(this,`hcmFilter`,a(dr,this)?a(qn,this).addHCMFilter(a(dr,this).foreground,a(dr,this).background):`none`)}get direction(){return j(this,`direction`,getComputedStyle(a(_r,this)).direction)}get _highlightColors(){return j(this,`_highlightColors`,a(Xn,this)?new Map(a(Xn,this).split(`,`).map(e=>(e=e.split(`=`).map(e=>e.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){let{_highlightColors:e}=this;if(!e)return j(this,`highlightColors`,null);let t=new Map,n=!!a(dr,this);for(let[r,i]of e){let e=r.endsWith(`_HCM`);if(n&&e){t.set(r.replace(`_HCM`,``),i);continue}!n&&!e&&t.set(r,i)}return j(this,`highlightColors`,t)}get highlightColorNames(){return j(this,`highlightColorNames`,this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;let t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),o(Rn,this,e)}setMainHighlightColorPicker(e){o(ar,this,e)}editAltText(e,t=!1){var n;(n=a(Mn,this))==null||n.editAltText(this,e,t)}hasCommentManager(){return!!a(In,this)}editComment(e,t,n,r){var i;(i=a(In,this))==null||i.showDialog(this,e,t,n,r)}selectComment(e,t){let n=a(An,this).get(e),r=n==null?void 0:n.getEditorByUID(t);r==null||r.toggleComment(!0,!0)}updateComment(e){var t;(t=a(In,this))==null||t.updateComment(e.getData())}updatePopupColor(e){var t;(t=a(In,this))==null||t.updatePopupColor(e)}removeComment(e){var t;(t=a(In,this))==null||t.removeComments([e.uid])}deleteComment(e,t){let n=()=>{e.comment=t};this.addCommands({cmd:()=>{var t;(t=this._editorUndoBar)==null||t.show(n,`comment`),this.toggleComment(null),e.comment=null},undo:n,mustExec:!0})}toggleComment(e,t,n=void 0){var r;(r=a(In,this))==null||r.toggleCommentPopup(e,t,n)}makeCommentColor(e,t){var n;return e&&((n=a(In,this))==null?void 0:n.makeCommentColor(e,t))||null}getCommentDialogElement(){var e;return((e=a(In,this))==null?void 0:e.dialogElement)||null}async waitForEditorsRendered(e){if(a(An,this).has(e-1))return;let{resolve:t,promise:n}=Promise.withResolvers(),r=n=>{n.pageNumber===e&&(this._eventBus._off(`editorsrendered`,r),t())};this._eventBus.on(`editorsrendered`,r),await n}getSignature(e){var t;(t=a(ur,this))==null||t.getSignature({uiManager:this,editor:e})}get signatureManager(){return a(ur,this)}switchToMode(e,t){this._eventBus.on(`annotationeditormodechanged`,t,{once:!0,signal:this._signal}),this._eventBus.dispatch(`showannotationeditorui`,{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch(`setpreference`,{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case`enableNewAltTextWhenAddingImage`:o(Kn,this,t);break}}onPageChanging({pageNumber:e}){o(zn,this,e-1)}deletePage(e){for(let t of this.getEditors(e))t.remove();a(An,this).delete(e),a(zn,this)===e&&o(zn,this,0)}focusMainContainer(){a(_r,this).focus()}findParent(e,t){for(let n of a(An,this).values()){let{x:r,y:i,width:a,height:o}=n.div.getBoundingClientRect();if(e>=r&&e<=r+a&&t>=i&&t<=i+o)return n}return null}disableUserSelect(e=!1){a(vr,this).classList.toggle(`noUserSelect`,e)}addShouldRescale(e){a(Un,this).add(e)}removeShouldRescale(e){a(Un,this).delete(e)}onScaleChanging({scale:e}){var t;this.commitOrRemove(),this.viewParameters.realScale=e*Qe.PDF_TO_CSS_UNITS;for(let e of a(Un,this))e.onScaleChanging();(t=a(Rn,this))==null||t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=``,t=!1){let r=document.getSelection();if(!r||r.isCollapsed)return;let{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:c}=r,l=r.toString(),u=n(L,this,Sr).call(this,r).closest(`.textLayer`),d=this.getSelectionBoxes(u);if(!d)return;r.empty();let f=n(L,this,Cr).call(this,u),p=a(cr,this)===D.NONE,m=()=>{let n=f==null?void 0:f.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:c,text:l});p&&this.showAllEditors(`highlight`,!0,!0),t&&(n==null||n.editComment())};if(p){this.switchToMode(D.HIGHLIGHT,m);return}m()}commentSelection(e=``){this.highlightSelection(e,!0)}getAndRemoveDataFromAnnotationStorage(e){if(!a(Nn,this))return null;let t=`${se}${e}`,n=a(Nn,this).getRawValue(t);return n&&a(Nn,this).remove(t),n}addToAnnotationStorage(e){!e.isEmpty()&&a(Nn,this)&&!a(Nn,this).has(e.id)&&a(Nn,this).setValue(e.id,e)}a11yAlert(e,t=null){let n=a(yr,this);n&&(n.setAttribute(`data-l10n-id`,e),t?n.setAttribute(`data-l10n-args`,JSON.stringify(t)):n.removeAttribute(`data-l10n-args`))}blur(){if(this.isShiftKeyDown=!1,a(Zn,this)&&(o(Zn,this,!1),n(L,this,Dr).call(this,`main_toolbar`)),!this.hasSelection)return;let{activeElement:e}=document;for(let t of a(I,this))if(t.div.contains(e)){o(ir,this,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!a(ir,this))return;let[e,t]=a(ir,this);o(ir,this,null),t.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){n(L,this,jr).call(this),this.setEditingState(!0)}removeEditListeners(){n(L,this,Mr).call(this),this.setEditingState(!1)}dragOver(e){for(let{type:t}of e.dataTransfer.items)for(let n of a(Hn,this))if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect=`copy`,e.preventDefault();return}}drop(e){for(let t of e.dataTransfer.items)for(let n of a(Hn,this))if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var t;if(e.preventDefault(),(t=a(Dn,this))==null||t.commitOrRemove(),!this.hasSelection)return;let n=[];for(let e of a(I,this)){let t=e.serialize(!0);t&&n.push(t)}n.length!==0&&e.clipboardData.setData(`application/pdfjs`,JSON.stringify(n))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();let{clipboardData:t}=e;for(let e of t.items)for(let t of a(Hn,this))if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}let r=t.getData(`application/pdfjs`);if(!r)return;try{r=JSON.parse(r)}catch(e){k(`paste: "${e.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();let i=this.currentLayer;try{let e=[];for(let t of r){let n=await i.deserialize(t);if(!n)return;e.push(n)}this.addCommands({cmd:()=>{for(let t of e)n(L,this,Br).call(this,t);n(L,this,Ur).call(this,e)},undo:()=>{for(let t of e)t.remove()},mustExec:!0})}catch(e){k(`paste: "${e.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key===`Shift`&&(this.isShiftKeyDown=!0),a(cr,this)!==D.NONE&&!this.isEditorHandlingKeyboard&&t._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key===`Shift`&&(this.isShiftKeyDown=!1,a(Zn,this)&&(o(Zn,this,!1),n(L,this,Dr).call(this,`main_toolbar`)))}onEditingAction({name:e}){switch(e){case`undo`:case`redo`:case`delete`:case`selectAll`:this[e]();break;case`highlightSelection`:this.highlightSelection(`context_menu`);break;case`commentSelection`:this.commentSelection(`context_menu`);break}}updatePageIndex(e,t){for(let n of this.getEditors(e))n.pageIndex=t;let n=a(jn,this).get(e);n&&(n.pageIndex=t,a(An,this).set(t,n),a(er,this)?n.enable():n.disable())}startUpdatePages(){o(jn,this,new Map(a(An,this))),a(An,this).clear()}endUpdatePages(){o(jn,this,null)}clonePage(e,t){for(let n of this.getEditors(e)){let e=n.serialize(n.mode!==D.HIGHLIGHT);e&&(e.pageIndex=t,e.id=this.getId(),e.isClone=!0,delete e.popupRef,a(Nn,this).setValue(e.id,e))}}findClonesForPage(e){let t=[],{pageIndex:n}=e;for(let[r,i]of a(Nn,this))i.pageIndex===n&&i.isClone&&(a(Nn,this).remove(r),t.push(e.deserialize(i).then(t=>{t&&(t.isClone=!0,e.addOrRebuild(t))})));return Promise.all(t)}setEditingState(e){e?(n(L,this,kr).call(this),n(L,this,Nr).call(this),n(L,this,Ir).call(this,{isEditing:a(cr,this)!==D.NONE,isEmpty:n(L,this,Hr).call(this),hasSomethingToUndo:a(Fn,this).hasSomethingToUndo(),hasSomethingToRedo:a(Fn,this).hasSomethingToRedo(),hasSelectedEditor:!1})):(n(L,this,Ar).call(this),n(L,this,Pr).call(this),n(L,this,Ir).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!a(Hn,this)){o(Hn,this,e);for(let e of a(Hn,this))n(L,this,Lr).call(this,e.defaultPropertiesToUpdate)}}getId(){return a($n,this).id}get currentLayer(){return a(An,this).get(a(zn,this))}getLayer(e){return a(An,this).get(e)}get currentPageIndex(){return a(zn,this)}addLayer(e){a(An,this).set(e.pageIndex,e),a(er,this)?e.enable():e.disable()}removeLayer(e){a(An,this).delete(e.pageIndex)}async updateMode(e,t=null,r=!1,i=!1,s=!1,c=!1){var l,u;if(a(cr,this)!==e&&!(a(br,this)&&(await a(br,this).promise,!a(br,this)))){if(o(br,this,Promise.withResolvers()),(l=a(Rn,this))==null||l.commitOrRemove(),a(cr,this)===D.POPUP){var d;(d=a(In,this))==null||d.hideSidebar()}if((u=a(In,this))==null||u.destroyPopup(),o(cr,this,e),e===D.NONE){var f;this.setEditingState(!1),n(L,this,zr).call(this);for(let e of a(kn,this).values())e.hideStandaloneCommentButton();(f=this._editorUndoBar)==null||f.hide(),this.toggleComment(null),a(br,this).resolve();return}for(let e of a(kn,this).values())e.addStandaloneCommentButton();if(e===D.SIGNATURE){var p;await((p=a(ur,this))==null?void 0:p.loadSignatures())}r&&rn.clearPointerType(),this.setEditingState(!0),await n(L,this,Rr).call(this),this.unselectAll();for(let t of a(An,this).values())t.updateMode(e);if(e===D.POPUP){var m;a(On,this)||o(On,this,await a(pr,this).getAnnotationsByType(new Set(a(Hn,this).map(e=>e._editorType))));let e=new Set,t=[];for(let n of a(kn,this).values()){let{annotationElementId:r,hasComment:i,deleted:a}=n;r&&e.add(r),i&&!a&&t.push(n.getData())}for(let n of a(On,this)){let{id:r,popupRef:i,contentsObj:o}=n;i&&o!=null&&o.str&&!e.has(r)&&!a(Bn,this).has(r)&&t.push(n)}(m=a(In,this))==null||m.showSidebar(t)}if(!t){i&&this.addNewEditorFromKeyboard(),a(br,this).resolve();return}for(let e of a(kn,this).values())e.uid===t?(this.setSelected(e),c?e.editComment():s?e.enterInEditMode():e.focus()):e.unselect();a(br,this).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==a(cr,this)&&this._eventBus.dispatch(`switchannotationeditormode`,{source:this,...e})}updateParams(e,t){if(a(Hn,this)){switch(e){case O.CREATE:this.currentLayer.addNewEditor(t);return;case O.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:{type:`highlight`,action:`toggle_visibility`}}}),(a(fr,this)||o(fr,this,new Map)).set(e,t),this.showAllEditors(`highlight`,t);break}if(this.hasSelection)for(let n of a(I,this))n.updateParams(e,t);else for(let n of a(Hn,this))n.updateDefaultParams(e,t)}}showAllEditors(e,t,r=!1){var i;for(let n of a(kn,this).values())n.editorType===e&&n.show(t);(((i=a(fr,this))==null?void 0:i.get(O.HIGHLIGHT_SHOW_ALL))??!0)!==t&&n(L,this,Lr).call(this,[[O.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(a(nr,this)!==e){o(nr,this,e);for(let t of a(An,this).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle(`waiting`,e)}}*getEditors(e){for(let t of a(kn,this).values())t.pageIndex===e&&(yield t)}getEditor(e){return a(kn,this).get(e)}addEditor(e){a(kn,this).set(e.id,e)}removeEditor(e){if(e.div.contains(document.activeElement)&&(a(Jn,this)&&clearTimeout(a(Jn,this)),o(Jn,this,setTimeout(()=>{this.focusMainContainer(),o(Jn,this,null)},0))),a(kn,this).delete(e.id),e.annotationElementId){var t;(t=a(or,this))==null||t.delete(e.annotationElementId)}if(this.unselect(e),!e.annotationElementId||!a(Bn,this).has(e.annotationElementId)){var n;(n=a(Nn,this))==null||n.remove(e.id)}}addDeletedAnnotationElement(e){a(Bn,this).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return a(Bn,this).has(e)}removeDeletedAnnotationElement(e){a(Bn,this).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){a(Dn,this)!==e&&(o(Dn,this,e),e&&n(L,this,Lr).call(this,e.propertiesToUpdate))}updateUI(e){Vr.call(n(L,this))===e&&n(L,this,Lr).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){n(L,this,Lr).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(a(I,this).has(e)){a(I,this).delete(e),e.unselect(),n(L,this,Ir).call(this,{hasSelectedEditor:this.hasSelection});return}a(I,this).add(e),e.select(),n(L,this,Lr).call(this,e.propertiesToUpdate),n(L,this,Ir).call(this,{hasSelectedEditor:!0})}setSelected(e){var t,r;this.updateToolbar({mode:e.mode,editId:e.uid}),(t=a(Rn,this))==null||t.commitOrRemove();for(let t of a(I,this))t!==e&&t.unselect();(r=a(In,this))==null||r.destroyPopup(),a(I,this).clear(),a(I,this).add(e),e.select(),n(L,this,Lr).call(this,e.propertiesToUpdate),n(L,this,Ir).call(this,{hasSelectedEditor:!0})}isSelected(e){return a(I,this).has(e)}get firstSelectedEditor(){return a(I,this).values().next().value}unselect(e){e.unselect(),a(I,this).delete(e),n(L,this,Ir).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(I,this).size!==0}get isEnterHandled(){return a(I,this).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;a(Fn,this).undo(),n(L,this,Ir).call(this,{hasSomethingToUndo:a(Fn,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:n(L,this,Hr).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){a(Fn,this).redo(),n(L,this,Ir).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(Fn,this).hasSomethingToRedo(),isEmpty:n(L,this,Hr).call(this)})}addCommands(e){a(Fn,this).add(e),n(L,this,Ir).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:n(L,this,Hr).call(this)})}cleanUndoStack(e){a(Fn,this).cleanType(e)}delete(){var e;this.commitOrRemove();let t=(e=this.currentLayer)==null?void 0:e.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let r=t?[t]:[...a(I,this)],i=()=>{var e;(e=this._editorUndoBar)==null||e.show(o,r.length===1?r[0].editorType:r.length);for(let e of r)e.remove()},o=()=>{for(let e of r)n(L,this,Br).call(this,e)};this.addCommands({cmd:i,undo:o,mustExec:!0})}commitOrRemove(){var e;(e=a(Dn,this))==null||e.commitOrRemove()}hasSomethingToControl(){return a(Dn,this)||this.hasSelection}selectAll(){for(let e of a(I,this))e.commit();n(L,this,Ur).call(this,a(kn,this).values())}unselectAll(){var e,t;if(!(a(Dn,this)&&(a(Dn,this).commitOrRemove(),a(cr,this)!==D.NONE))&&!((e=a(Rn,this))!=null&&e.commitOrRemove())&&((t=a(In,this))==null||t.destroyPopup(),this.hasSelection)){for(let e of a(I,this))e.unselect();a(I,this).clear(),n(L,this,Ir).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;a(hr,this)[0]+=e,a(hr,this)[1]+=t;let[r,i]=a(hr,this),s=[...a(I,this)];a(gr,this)&&clearTimeout(a(gr,this)),o(gr,this,setTimeout(()=>{o(gr,this,null),a(hr,this)[0]=a(hr,this)[1]=0,this.addCommands({cmd:()=>{for(let e of s)a(kn,this).has(e.id)&&(e.translateInPage(r,i),e.translationDone())},undo:()=>{for(let e of s)a(kn,this).has(e.id)&&(e.translateInPage(-r,-i),e.translationDone())},mustExec:!1})},1e3));for(let n of s)n.translateInPage(e,t),n.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),o(Vn,this,new Map);for(let e of a(I,this))a(Vn,this).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(Vn,this))return!1;this.disableUserSelect(!1);let e=a(Vn,this);o(Vn,this,null);let t=!1;for(let[{x:n,y:r,pageIndex:i},a]of e)a.newX=n,a.newY=r,a.newPageIndex=i,t||(t=n!==a.savedX||r!==a.savedY||i!==a.savedPageIndex);if(!t)return!1;let n=(e,t,n,r)=>{if(a(kn,this).has(e.id)){let i=a(An,this).get(r);i?e._setParentAndPosition(i,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(let[t,{newX:r,newY:i,newPageIndex:a}]of e)n(t,r,i,a)},undo:()=>{for(let[t,{savedX:r,savedY:i,savedPageIndex:a}]of e)n(t,r,i,a)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(a(Vn,this))for(let n of a(Vn,this).keys())n.drag(e,t)}rebuild(e){if(e.parent===null){let t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||a(I,this).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return a(Dn,this)===e}getActive(){return a(Dn,this)}getMode(){return a(cr,this)}isEditingMode(){return a(cr,this)!==D.NONE}get imageManager(){return j(this,`imageManager`,new hn)}getSelectionBoxes(e){if(!e)return null;let t=document.getSelection();for(let n=0,r=t.rangeCount;n<r;n++)if(!e.contains(t.getRangeAt(n).commonAncestorContainer))return null;let{x:n,y:r,width:i,height:a}=e.getBoundingClientRect(),o;switch(e.getAttribute(`data-main-rotation`)){case`90`:o=(e,t,o,s)=>({x:(t-r)/a,y:1-(e+o-n)/i,width:s/a,height:o/i});break;case`180`:o=(e,t,o,s)=>({x:1-(e+o-n)/i,y:1-(t+s-r)/a,width:o/i,height:s/a});break;case`270`:o=(e,t,o,s)=>({x:1-(t+s-r)/a,y:(e-n)/i,width:s/a,height:o/i});break;default:o=(e,t,o,s)=>({x:(e-n)/i,y:(t-r)/a,width:o/i,height:s/a});break}let s=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(!n.collapsed)for(let{x:e,y:t,width:r,height:i}of n.getClientRects())r===0||i===0||s.push(o(e,t,r,i))}return s.length===0?null:s}addChangedExistingAnnotation({annotationElementId:e,id:t}){(a(Pn,this)||o(Pn,this,new Map)).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){var t;(t=a(Pn,this))==null||t.delete(e)}renderAnnotationElement(e){var t;let n=(t=a(Pn,this))==null?void 0:t.get(e.data.id);if(!n)return;let r=a(Nn,this).getRawValue(n);r&&(a(cr,this)===D.NONE&&!r.hasBeenModified||r.renderAnnotationElement(e))}setMissingCanvas(e,t,n){var r;let i=(r=a(or,this))==null?void 0:r.get(e);i&&(i.setCanvas(t,n),a(or,this).delete(e))}addMissingCanvas(e,t){(a(or,this)||o(or,this,new Map)).set(e,t)}};function Sr({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function Cr(e){let{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(let t of a(An,this).values())if(t.hasTextLayer(e))return t;return null}function wr(e){var t;this.commitOrRemove(),(t=this.currentLayer)==null||t.endDrawingSession(!1)}function Tr(){let e=document.getSelection();if(!e||e.isCollapsed)return;let t=n(L,this,Sr).call(this,e).closest(`.textLayer`),r=this.getSelectionBoxes(t);r&&(a(Qn,this)||o(Qn,this,new Qt(this)),a(Qn,this).show(t,r,this.direction===`ltr`))}function Er(){var e;let t=document.getSelection();if(!t||t.isCollapsed){if(a(lr,this)){var r;(r=a(Qn,this))==null||r.hide(),o(lr,this,null),n(L,this,Ir).call(this,{hasSelectedText:!1})}return}let{anchorNode:i}=t;if(i===a(lr,this))return;let s=n(L,this,Sr).call(this,t).closest(`.textLayer`);if(!s){if(a(lr,this)){var c;(c=a(Qn,this))==null||c.hide(),o(lr,this,null),n(L,this,Ir).call(this,{hasSelectedText:!1})}return}if((e=a(Qn,this))==null||e.hide(),o(lr,this,i),n(L,this,Ir).call(this,{hasSelectedText:!0}),!(a(cr,this)!==D.HIGHLIGHT&&a(cr,this)!==D.NONE)&&(a(cr,this)===D.HIGHLIGHT&&this.showAllEditors(`highlight`,!0,!0),o(Zn,this,this.isShiftKeyDown),!this.isShiftKeyDown)){let e=a(cr,this)===D.HIGHLIGHT?n(L,this,Cr).call(this,s):null;if(e==null||e.toggleDrawing(),a(tr,this)){let t=new AbortController,r=this.combinedSignal(t),i=r=>{r.type===`pointerup`&&r.button!==0||(t.abort(),e==null||e.toggleDrawing(!0),r.type===`pointerup`&&n(L,this,Dr).call(this,`main_toolbar`))};window.addEventListener(`pointerup`,i,{signal:r}),window.addEventListener(`blur`,i,{signal:r})}else e==null||e.toggleDrawing(!0),n(L,this,Dr).call(this,`main_toolbar`)}}function Dr(e=``){a(cr,this)===D.HIGHLIGHT?this.highlightSelection(e):a(Wn,this)&&n(L,this,Tr).call(this)}function Or(){document.addEventListener(`selectionchange`,n(L,this,Er).bind(this),{signal:this._signal})}function kr(){if(a(Yn,this))return;o(Yn,this,new AbortController);let e=this.combinedSignal(a(Yn,this));window.addEventListener(`focus`,this.focus.bind(this),{signal:e}),window.addEventListener(`blur`,this.blur.bind(this),{signal:e})}function Ar(){var e;(e=a(Yn,this))==null||e.abort(),o(Yn,this,null)}function jr(){if(a(rr,this))return;o(rr,this,new AbortController);let e=this.combinedSignal(a(rr,this));window.addEventListener(`keydown`,this.keydown.bind(this),{signal:e}),window.addEventListener(`keyup`,this.keyup.bind(this),{signal:e})}function Mr(){var e;(e=a(rr,this))==null||e.abort(),o(rr,this,null)}function Nr(){if(a(Ln,this))return;o(Ln,this,new AbortController);let e=this.combinedSignal(a(Ln,this));document.addEventListener(`copy`,this.copy.bind(this),{signal:e}),document.addEventListener(`cut`,this.cut.bind(this),{signal:e}),document.addEventListener(`paste`,this.paste.bind(this),{signal:e})}function Pr(){var e;(e=a(Ln,this))==null||e.abort(),o(Ln,this,null)}function Fr(){let e=this._signal;document.addEventListener(`dragover`,this.dragOver.bind(this),{signal:e}),document.addEventListener(`drop`,this.drop.bind(this),{signal:e})}function Ir(e){Object.entries(e).some(([e,t])=>a(mr,this)[e]!==t)&&(this._eventBus.dispatch(`editingstateschanged`,{source:this,details:Object.assign(a(mr,this),e)}),a(cr,this)===D.HIGHLIGHT&&e.hasSelectedEditor===!1&&n(L,this,Lr).call(this,[[O.HIGHLIGHT_FREE,!0]]))}function Lr(e){this._eventBus.dispatch(`annotationeditorparamschanged`,{source:this,details:e})}async function Rr(){if(!a(er,this)){o(er,this,!0);let e=[];for(let t of a(An,this).values())e.push(t.enable());await Promise.all(e);for(let e of a(kn,this).values())e.enable()}}function zr(){if(this.unselectAll(),a(er,this)){o(er,this,!1);for(let e of a(An,this).values())e.disable();for(let e of a(kn,this).values())e.disable()}}function Br(e){let t=a(An,this).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}function Vr(){let e=null;for(e of a(I,this));return e}function Hr(){if(a(kn,this).size===0)return!0;if(a(kn,this).size===1)for(let e of a(kn,this).values())return e.isEmpty();return!1}function Ur(e){for(let e of a(I,this))e.unselect();a(I,this).clear();for(let t of e)t.isEmpty()||(a(I,this).add(t),t.select());n(L,this,Ir).call(this,{hasSelectedEditor:this.hasSelection})}e(xr,`TRANSLATE_SMALL`,1),e(xr,`TRANSLATE_BIG`,10);var Wr=new WeakMap,Gr=new WeakMap,Kr=new WeakMap,qr=new WeakMap,Jr=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,Zr=new WeakMap,Qr=new WeakMap,$r=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakSet,ri=class e{constructor(e){i(this,ni),r(this,Wr,null),r(this,Gr,!1),r(this,Kr,null),r(this,qr,null),r(this,Jr,null),r(this,Yr,null),r(this,Xr,!1),r(this,Zr,null),r(this,Qr,null),r(this,$r,null),r(this,ei,null),r(this,ti,!1),o(Qr,this,e),o(ti,this,e._uiManager.useNewAltTextFlow),oi._||(oi._=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){e._l10n??(e._l10n=t)}async render(){let e=o(Kr,this,document.createElement(`button`));e.className=`altText`,e.tabIndex=`0`;let t=o(qr,this,document.createElement(`span`));e.append(t),a(ti,this)?(e.classList.add(`new`),e.setAttribute(`data-l10n-id`,oi._.missing),t.setAttribute(`data-l10n-id`,oi._[`missing-label`])):(e.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button`),t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button-label`));let r=a(Qr,this)._uiManager._signal;e.addEventListener(`contextmenu`,lt,{signal:r}),e.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:r});let i=e=>{e.preventDefault(),a(Qr,this)._uiManager.editAltText(a(Qr,this)),a(ti,this)&&a(Qr,this)._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_clicked`,data:{label:ii.call(n(ni,this))}})};return e.addEventListener(`click`,i,{capture:!0,signal:r}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(o(Xr,this,!0),i(t))},{signal:r}),await n(ni,this,ai).call(this),e}finish(){a(Kr,this)&&(a(Kr,this).focus({focusVisible:a(Xr,this)}),o(Xr,this,!1))}isEmpty(){return a(ti,this)?a(Wr,this)===null:!a(Wr,this)&&!a(Gr,this)}hasData(){return a(ti,this)?a(Wr,this)!==null||!!a($r,this):this.isEmpty()}get guessedText(){return a($r,this)}async setGuessedText(t){a(Wr,this)===null&&(o($r,this,t),o(ei,this,await e._l10n.get(`pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer`,{generatedAltText:t})),n(ni,this,ai).call(this))}toggleAltTextBadge(e=!1){if(!a(ti,this)||a(Wr,this)){var t;(t=a(Zr,this))==null||t.remove(),o(Zr,this,null);return}if(!a(Zr,this)){let e=o(Zr,this,document.createElement(`div`));e.className=`noAltTextBadge`,a(Qr,this).div.append(e)}a(Zr,this).classList.toggle(`hidden`,!e)}serialize(e){let t=a(Wr,this);return!e&&a($r,this)===t&&(t=a(ei,this)),{altText:t,decorative:a(Gr,this),guessedText:a($r,this),textWithDisclaimer:a(ei,this)}}get data(){return{altText:a(Wr,this),decorative:a(Gr,this)}}set data({altText:e,decorative:t,guessedText:r,textWithDisclaimer:i,cancel:s=!1}){r&&(o($r,this,r),o(ei,this,i)),!(a(Wr,this)===e&&a(Gr,this)===t)&&(s||(o(Wr,this,e),o(Gr,this,t)),n(ni,this,ai).call(this))}toggle(e=!1){a(Kr,this)&&(!e&&a(Yr,this)&&(clearTimeout(a(Yr,this)),o(Yr,this,null)),a(Kr,this).disabled=!e)}shown(){a(Qr,this)._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_displayed`,data:{label:ii.call(n(ni,this))}})}destroy(){var e,t;(e=a(Kr,this))==null||e.remove(),o(Kr,this,null),o(qr,this,null),o(Jr,this,null),(t=a(Zr,this))==null||t.remove(),o(Zr,this,null)}};function ii(){return a(Wr,this)&&`added`||a(Wr,this)===null&&this.guessedText&&`review`||`missing`}async function ai(){let e=a(Kr,this);if(!e)return;if(a(ti,this)){var t;if(e.classList.toggle(`done`,!!a(Wr,this)),e.setAttribute(`data-l10n-id`,oi._[ii.call(n(ni,this))]),(t=a(qr,this))==null||t.setAttribute(`data-l10n-id`,oi._[`${ii.call(n(ni,this))}-label`]),!a(Wr,this)){var r;(r=a(Jr,this))==null||r.remove();return}}else{if(!a(Wr,this)&&!a(Gr,this)){var i;e.classList.remove(`done`),(i=a(Jr,this))==null||i.remove();return}e.classList.add(`done`),e.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-edit-button`)}let s=a(Jr,this);if(!s){o(Jr,this,s=document.createElement(`span`)),s.className=`tooltip`,s.setAttribute(`role`,`tooltip`),s.id=`alt-text-tooltip-${a(Qr,this).id}`;let t=a(Qr,this)._uiManager._signal;t.addEventListener(`abort`,()=>{clearTimeout(a(Yr,this)),o(Yr,this,null)},{once:!0}),e.addEventListener(`mouseenter`,()=>{o(Yr,this,setTimeout(()=>{o(Yr,this,null),a(Jr,this).classList.add(`show`),a(Qr,this)._reportTelemetry({action:`alt_text_tooltip`})},100))},{signal:t}),e.addEventListener(`mouseleave`,()=>{var e;a(Yr,this)&&(clearTimeout(a(Yr,this)),o(Yr,this,null)),(e=a(Jr,this))==null||e.classList.remove(`show`)},{signal:t})}a(Gr,this)?s.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-decorative-tooltip`):(s.removeAttribute(`data-l10n-id`),s.textContent=a(Wr,this)),s.parentNode||e.append(s);let c=a(Qr,this).getElementForAltText();c==null||c.setAttribute(`aria-describedby`,s.id)}var oi={_:null};e(ri,`_l10n`,null);var si=new WeakMap,ci=new WeakMap,li=new WeakMap,R=new WeakMap,ui=new WeakMap,di=new WeakMap,fi=new WeakMap,pi=new WeakMap,mi=new WeakMap,hi=new WeakMap,gi=new WeakSet,_i=class{constructor(e){i(this,gi),r(this,si,null),r(this,ci,null),r(this,li,!1),r(this,R,null),r(this,ui,null),r(this,di,null),r(this,fi,null),r(this,pi,null),r(this,mi,!1),r(this,hi,null),o(R,this,e)}renderForToolbar(){let e=o(ci,this,document.createElement(`button`));return e.className=`comment`,n(gi,this,vi).call(this,e,!1)}renderForStandalone(){let e=o(si,this,document.createElement(`button`));e.className=`annotationCommentButton`;let t=a(R,this).commentButtonPosition;if(t){let{style:n}=e;n.insetInlineEnd=`calc(${100*(a(R,this)._uiManager.direction===`ltr`?1-t[0]:t[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;let r=a(R,this).commentButtonColor;r&&(n.backgroundColor=r)}return n(gi,this,vi).call(this,e,!0)}focusButton(){setTimeout(()=>{var e;(e=a(si,this)??a(ci,this))==null||e.focus()},0)}onUpdatedColor(){if(!a(si,this))return;let e=a(R,this).commentButtonColor;e&&(a(si,this).style.backgroundColor=e),a(R,this)._uiManager.updatePopupColor(a(R,this))}get commentButtonWidth(){var e;return(((e=a(si,this))==null?void 0:e.getBoundingClientRect().width)??0)/a(R,this).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(a(hi,this))return a(hi,this);if(!a(si,this))return null;let{x:e,y:t,height:n}=a(si,this).getBoundingClientRect(),{x:r,y:i,width:o,height:s}=a(R,this).parent.boundingClientRect;return[(e-r)/o,(t+n-i)/s]}set commentPopupPositionInLayer(e){o(hi,this,e)}hasDefaultPopupPosition(){return a(hi,this)===null}removeStandaloneCommentButton(){var e;(e=a(si,this))==null||e.remove(),o(si,this,null)}removeToolbarCommentButton(){var e;(e=a(ci,this))==null||e.remove(),o(ci,this,null)}setCommentButtonStates({selected:e,hasPopup:t}){a(si,this)&&(a(si,this).classList.toggle(`selected`,e),a(si,this).ariaExpanded=t)}edit(e){let t=this.commentPopupPositionInLayer,n,r;if(t)[n,r]=t;else{[n,r]=a(R,this).commentButtonPosition;let{width:e,height:t,x:i,y:o}=a(R,this);n=i+n*e,r=o+r*t}let i=a(R,this).parent.boundingClientRect,{x:o,y:s,width:c,height:l}=i;a(R,this)._uiManager.editComment(a(R,this),o+n*c,s+r*l,{...e,parentDimensions:i})}finish(){a(ci,this)&&(a(ci,this).focus({focusVisible:a(li,this)}),o(li,this,!1))}isDeleted(){return a(mi,this)||a(fi,this)===``}isEmpty(){return a(fi,this)===null}hasBeenEdited(){return this.isDeleted()||a(fi,this)!==a(ui,this)}serialize(){return this.data}get data(){return{text:a(fi,this),richText:a(di,this),date:a(pi,this),deleted:this.isDeleted()}}set data(e){if(e!==a(fi,this)&&o(di,this,null),e===null){o(fi,this,``),o(mi,this,!0);return}o(fi,this,e),o(pi,this,new Date),o(mi,this,!1)}restoreData({text:e,richText:t,date:n}){o(fi,this,e),o(di,this,t),o(pi,this,n),o(mi,this,!1)}setInitialText(e,t=null){o(ui,this,e),this.data=e,o(pi,this,null),o(di,this,t)}shown(){}destroy(){var e,t;(e=a(ci,this))==null||e.remove(),o(ci,this,null),(t=a(si,this))==null||t.remove(),o(si,this,null),o(fi,this,``),o(di,this,null),o(pi,this,null),o(R,this,null),o(li,this,!1),o(mi,this,!1)}};function vi(e,t){if(!a(R,this)._uiManager.hasCommentManager())return null;e.tabIndex=`0`,e.ariaHasPopup=`dialog`,t?(e.ariaControls=`commentPopup`,e.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`)):(e.ariaControlsElements=[a(R,this)._uiManager.getCommentDialogElement()],e.setAttribute(`data-l10n-id`,`pdfjs-editor-add-comment-button`));let n=a(R,this)._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener(`contextmenu`,lt,{signal:n}),t&&(e.addEventListener(`focusin`,e=>{a(R,this)._focusEventsAllowed=!1,P(e)},{capture:!0,signal:n}),e.addEventListener(`focusout`,e=>{a(R,this)._focusEventsAllowed=!0,P(e)},{capture:!0,signal:n})),e.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:n});let r=t=>{t.preventDefault(),e===a(ci,this)?this.edit():a(R,this).toggleComment(!0)};return e.addEventListener(`click`,r,{capture:!0,signal:n}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(o(li,this,!0),r(t))},{signal:n}),e.addEventListener(`pointerenter`,()=>{a(R,this).toggleComment(!1,!0)},{signal:n}),e.addEventListener(`pointerleave`,()=>{a(R,this).toggleComment(!1,!1)},{signal:n}),e}var yi=new WeakMap,bi=new WeakMap,xi=new WeakMap,Si=new WeakMap,Ci=new WeakMap,wi=new WeakMap,Ti=new WeakMap,Ei=new WeakMap,Di=new WeakMap,Oi=new WeakMap,ki=new WeakMap,Ai=new WeakMap,ji=new WeakSet,Mi=class{constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:s=null,onPinchStart:c=null,onPinching:l=null,onPinchEnd:u=null,signal:d}){i(this,ji),r(this,yi,void 0),r(this,bi,!1),r(this,xi,null),r(this,Si,void 0),r(this,Ci,void 0),r(this,wi,void 0),r(this,Ti,void 0),r(this,Ei,null),r(this,Di,void 0),r(this,Oi,null),r(this,ki,void 0),r(this,Ai,null),o(yi,this,e),o(xi,this,s),o(Si,this,t),o(Ci,this,c),o(wi,this,l),o(Ti,this,u),o(ki,this,new AbortController),o(Di,this,AbortSignal.any([d,a(ki,this).signal])),e.addEventListener(`touchstart`,n(ji,this,Ni).bind(this),{passive:!1,signal:a(Di,this)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/yt.pixelRatio}destroy(){var e,t;(e=a(ki,this))==null||e.abort(),o(ki,this,null),(t=a(Ei,this))==null||t.abort(),o(Ei,this,null)}};d=Mi;function Ni(e){var t,r;if((t=a(Si,this))!=null&&t.call(this))return;if(e.touches.length===1){if(a(Ei,this))return;let e=o(Ei,this,new AbortController),t=AbortSignal.any([a(Di,this),e.signal]),n=a(yi,this),r={capture:!0,signal:t,passive:!1},i=e=>{if(e.pointerType===`touch`){var t;(t=a(Ei,this))==null||t.abort(),o(Ei,this,null)}};n.addEventListener(`pointerdown`,e=>{e.pointerType===`touch`&&(P(e),i(e))},r),n.addEventListener(`pointerup`,i,r),n.addEventListener(`pointercancel`,i,r);return}if(!a(Ai,this)){var i;o(Ai,this,new AbortController);let e=AbortSignal.any([a(Di,this),a(Ai,this).signal]),t=a(yi,this),r={signal:e,capture:!1,passive:!1};t.addEventListener(`touchmove`,n(ji,this,Pi).bind(this),r);let s=n(ji,this,Fi).bind(this);t.addEventListener(`touchend`,s,r),t.addEventListener(`touchcancel`,s,r),r.capture=!0,t.addEventListener(`pointerdown`,P,r),t.addEventListener(`pointermove`,P,r),t.addEventListener(`pointercancel`,P,r),t.addEventListener(`pointerup`,P,r),(i=a(Ci,this))==null||i.call(this)}if(P(e),e.touches.length!==2||(r=a(xi,this))!=null&&r.call(this)){o(Oi,this,null);return}let[s,c]=e.touches;s.identifier>c.identifier&&([s,c]=[c,s]),o(Oi,this,{touch0X:s.screenX,touch0Y:s.screenY,touch1X:c.screenX,touch1Y:c.screenY})}function Pi(e){var t;if(!a(Oi,this)||e.touches.length!==2)return;P(e);let[n,r]=e.touches;n.identifier>r.identifier&&([n,r]=[r,n]);let{screenX:i,screenY:s}=n,{screenX:c,screenY:l}=r,u=a(Oi,this),{touch0X:f,touch0Y:p,touch1X:m,touch1Y:h}=u,g=m-f,_=h-p,v=c-i,y=l-s,b=Math.hypot(v,y)||1,x=Math.hypot(g,_)||1;if(!a(bi,this)&&Math.abs(x-b)<=d.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(u.touch0X=i,u.touch0Y=s,u.touch1X=c,u.touch1Y=l,!a(bi,this)){o(bi,this,!0);return}let S=[(i+c)/2,(s+l)/2];(t=a(wi,this))==null||t.call(this,S,x,b)}function Fi(e){if(!(e.touches.length>=2)){if(a(Ai,this)){var t;a(Ai,this).abort(),o(Ai,this,null),(t=a(Ti,this))==null||t.call(this)}a(Oi,this)&&(P(e),o(Oi,this,null),o(bi,this,!1))}}var Ii=new WeakMap,Li=new WeakMap,Ri=new WeakMap,z=new WeakMap,zi=new WeakMap,Bi=new WeakMap,Vi=new WeakMap,Hi=new WeakMap,Ui=new WeakMap,Wi=new WeakMap,Gi=new WeakMap,Ki=new WeakMap,qi=new WeakMap,Ji=new WeakMap,Yi=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Qi=new WeakMap,$i=new WeakMap,ea=new WeakMap,ta=new WeakMap,na=new WeakMap,ra=new WeakMap,ia=new WeakMap,aa=new WeakMap,oa=new WeakMap,B=new WeakSet,V=class t{static get _resizerKeyboardManager(){let e=t.prototype._resizeWithKeyboard,n=xr.TRANSLATE_SMALL,r=xr.TRANSLATE_BIG;return j(this,`_resizerKeyboardManager`,new Cn([[[`ArrowLeft`,`mac+ArrowLeft`],e,{args:[-n,0]}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],e,{args:[-r,0]}],[[`ArrowRight`,`mac+ArrowRight`],e,{args:[n,0]}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],e,{args:[r,0]}],[[`ArrowUp`,`mac+ArrowUp`],e,{args:[0,-n]}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],e,{args:[0,-r]}],[[`ArrowDown`,`mac+ArrowDown`],e,{args:[0,n]}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],e,{args:[0,r]}],[[`Escape`,`mac+Escape`],t.prototype._stopResizingWithKeyboard]]))}constructor(n){i(this,B),r(this,Ii,null),r(this,Li,null),r(this,Ri,null),r(this,z,null),r(this,zi,null),r(this,Bi,!1),r(this,Vi,null),r(this,Hi,``),r(this,Ui,null),r(this,Wi,null),r(this,Gi,null),r(this,Ki,null),r(this,qi,null),r(this,Ji,``),r(this,Yi,!1),r(this,Xi,null),r(this,Zi,!1),r(this,Qi,!1),r(this,$i,!1),r(this,ea,null),r(this,ta,0),r(this,na,0),r(this,ra,null),r(this,ia,null),e(this,`isSelected`,!1),e(this,`_isCopy`,!1),e(this,`_editToolbar`,null),e(this,`_initialOptions`,Object.create(null)),e(this,`_initialData`,null),e(this,`_isVisible`,!0),e(this,`_uiManager`,null),e(this,`_focusEventsAllowed`,!0),r(this,aa,!1),r(this,oa,t._zIndex++),this.parent=n.parent,this.id=n.id,this.width=this.height=null,this.pageIndex=n.parent.pageIndex,this.name=n.name,this.div=null,this._uiManager=n.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=n.isCentered,this._structTreeParentId=null,this.annotationElementId=n.annotationElementId||null,this.creationDate=n.creationDate||new Date,this.modificationDate=n.modificationDate||null,this.canAddComment=!0;let{rotation:a,rawDims:{pageWidth:o,pageHeight:s,pageX:c,pageY:l}}=this.parent.viewport;this.rotation=a,this.pageRotation=(360+a-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[o,s],this.pageTranslation=[c,l];let[u,d]=this.parentDimensions;this.x=n.x/u,this.y=n.y/d,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(e){this.pageIndex=e}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return j(this,`_defaultLineColor`,this._colorManager.getHexCode(`CanvasText`))}static deleteAnnotationElement(e){let t=new Ea({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,n){if(t._l10n??(t._l10n=e),t._l10nResizer||(t._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`})),t._borderLineWidth!==-1)return;let r=getComputedStyle(document.documentElement);t._borderLineWidth=parseFloat(r.getPropertyValue(`--outline-width`))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){A(`Not implemented`)}get propertiesToUpdate(){return[]}get _isDraggable(){return a(aa,this)}set _isDraggable(e){var t;o(aa,this,e),(t=this.div)==null||t.classList.toggle(`draggable`,e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=a(oa,this)}setParent(e){if(e!==null)this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions;else{var t;n(B,this,Ta).call(this),(t=a(Ki,this))==null||t.remove(),o(Ki,this,null)}this.parent=e}focusin(e){this._focusEventsAllowed&&(a(Yi,this)?o(Yi,this,!1):this.parent.setSelected(this))}focusout(e){var t;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;let n=e.relatedTarget;n!=null&&n.closest(`#${this.id}`)||(e.preventDefault(),(t=this.parent)!=null&&t.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){let[i,a]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}let[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r),this._onTranslated()}translate(e,t){n(B,this,sa).call(this,this.parentDimensions,e,t)}translateInPage(e,t){a(Xi,this)||o(Xi,this,[this.x,this.y,this.width,this.height]),n(B,this,sa).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:`nearest`})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){a(Xi,this)||o(Xi,this,[this.x,this.y,this.width,this.height]);let{div:n,parentDimensions:[r,i]}=this;if(this.x+=e/r,this.y+=t/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:c}=this,[l,u]=this.getBaseTranslation();s+=l,c+=u;let{style:d}=n;d.left=`${(100*s).toFixed(2)}%`,d.top=`${(100*c).toFixed(2)}%`,this._onTranslating(s,c),n.scrollIntoView({block:`nearest`})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!a(Xi,this)&&(a(Xi,this)[0]!==this.x||a(Xi,this)[1]!==this.y)}get _hasBeenResized(){return!!a(Xi,this)&&(a(Xi,this)[2]!==this.width||a(Xi,this)[3]!==this.height)}getBaseTranslation(){let[e,n]=this.parentDimensions,{_borderLineWidth:r}=t,i=r/e,a=r/n;switch(this.rotation){case 90:return[-i,a];case 180:return[i,a];case 270:return[i,-a];default:return[-i,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){let{div:{style:t},pageDimensions:[n,r]}=this,{x:i,y:a,width:o,height:s}=this;if(o*=n,s*=r,i*=n,a*=r,this._mustFixPosition)switch(e){case 0:i=N(i,0,n-o),a=N(a,0,r-s);break;case 90:i=N(i,0,n-s),a=N(a,o,r);break;case 180:i=N(i,o,n),a=N(a,s,r);break;case 270:i=N(i,s,n),a=N(a,0,r-o);break}this.x=i/=n,this.y=a/=r;let[c,l]=this.getBaseTranslation();i+=c,a+=l,t.left=`${(100*i).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,n){return ca.call(t,e,n,this.parentRotation)}pageTranslationToScreen(e,n){return ca.call(t,e,n,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(){let{div:{style:e},width:t,height:n}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=a(Ri,this))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||a(Qi,this))return this._editToolbar;this._editToolbar=new Vt(this),this.div.append(this._editToolbar.render());let{toolbarButtons:e}=this;if(e)for(let[t,n]of e)await this._editToolbar.addButton(t,n);return this.hasComment||this._editToolbar.addButton(`comment`,this.addCommentButton()),this._editToolbar.addButton(`delete`),this._editToolbar}addCommentButtonInToolbar(){var e;(e=this._editToolbar)==null||e.addButtonBefore(`comment`,this.addCommentButton(),`.deleteButton`)}removeCommentButtonFromToolbar(){var e;(e=this._editToolbar)==null||e.removeButton(`comment`)}removeEditToolbar(){var e,t;(e=this._editToolbar)==null||e.remove(),this._editToolbar=null,(t=a(Ri,this))==null||t.destroy()}addContainer(e){var t;let n=(t=this._editToolbar)==null?void 0:t.div;n?n.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return a(Ri,this)||(ri.initialize(t._l10n),o(Ri,this,new ri(this)),a(Ii,this)&&(a(Ri,this).data=a(Ii,this),o(Ii,this,null))),a(Ri,this)}get altTextData(){var e;return(e=a(Ri,this))==null?void 0:e.data}set altTextData(e){a(Ri,this)&&(a(Ri,this).data=e)}get guessedAltText(){var e;return(e=a(Ri,this))==null?void 0:e.guessedText}async setGuessedAltText(e){var t;await((t=a(Ri,this))==null?void 0:t.setGuessedText(e))}serializeAltText(e){var t;return(t=a(Ri,this))==null?void 0:t.serialize(e)}hasAltText(){return!!a(Ri,this)&&!a(Ri,this).isEmpty()}hasAltTextData(){var e;return((e=a(Ri,this))==null?void 0:e.hasData())??!1}focusCommentButton(){var e;(e=a(z,this))==null||e.focusButton()}addCommentButton(){return this.canAddComment?a(z,this)||o(z,this,new _i(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(a(zi,this)){this._uiManager.isEditingMode()&&a(zi,this).classList.remove(`hidden`);return}this.hasComment&&(o(zi,this,a(z,this).renderForStandalone()),this.div.append(a(zi,this)))}}removeStandaloneCommentButton(){a(z,this).removeStandaloneCommentButton(),o(zi,this,null)}hideStandaloneCommentButton(){var e;(e=a(zi,this))==null||e.classList.add(`hidden`)}get comment(){if(!a(z,this))return null;let{data:{richText:e,text:t,date:n,deleted:r}}=a(z,this);return{text:t,richText:e,date:n,deleted:r,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){a(z,this)||o(z,this,new _i(this)),typeof e==`object`&&e?a(z,this).restoreData(e):a(z,this).data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:n}){if(!t||(a(z,this)||o(z,this,new _i(this)),a(z,this).setInitialText(e,n),!this.annotationElementId))return;let r=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);r&&this.updateFromAnnotationLayer(r)}get hasEditedComment(){var e;return(e=a(z,this))==null?void 0:e.hasBeenEdited()}get hasDeletedComment(){var e;return(e=a(z,this))==null?void 0:e.isDeleted()}get hasComment(){return!!a(z,this)&&!a(z,this).isEmpty()&&!a(z,this).isDeleted()}async editComment(e){a(z,this)||o(z,this,new _i(this)),a(z,this).edit(e)}toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){a(z,this).setSelectedButton(e)}addComment(e){if(this.hasEditedComment){let[,,,t]=e.rect,[n]=this.pageDimensions,[r]=this.pageTranslation,i=r+n+1,a=t-100,o=i+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[i,a,o,t]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){a(z,this).data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var e;let t=this.div=document.createElement(`div`);t.setAttribute(`data-editor-rotation`,(360-this.rotation)%360),t.className=this.name,t.setAttribute(`id`,this.id),t.tabIndex=a(Bi,this)?-1:0,t.setAttribute(`role`,`application`),this.defaultL10nId&&t.setAttribute(`data-l10n-id`,this.defaultL10nId),this._isVisible||t.classList.add(`hidden`),this.setInForeground(),n(B,this,ba).call(this);let[r,i]=this.parentDimensions;this.parentRotation%180!=0&&(t.style.maxWidth=`${(100*i/r).toFixed(2)}%`,t.style.maxHeight=`${(100*r/i).toFixed(2)}%`);let[s,c]=this.getInitialTranslation();return this.translate(s,c),nn(this,t,[`keydown`,`pointerdown`,`dblclick`]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(a(ia,this)||o(ia,this,new Mi({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:n(B,this,ha).bind(this),onPinching:n(B,this,ga).bind(this),onPinchEnd:n(B,this,_a).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),(e=this._uiManager._editorUndoBar)==null||e.hide(),t}pointerdown(e){let{isMac:t}=Ie.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(o(Yi,this,!0),this._isDraggable){n(B,this,ya).call(this,e);return}n(B,this,va).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){a(ea,this)&&clearTimeout(a(ea,this)),o(ea,this,setTimeout(()=>{var e;o(ea,this,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){let r=this.parentScale,[i,a]=this.pageDimensions,[o,s]=this.pageTranslation,c=e/r,l=t/r,u=this.x*i,d=this.y*a,f=this.width*i,p=this.height*a;switch(n){case 0:return[u+c+o,a-d-l-p+s,u+c+f+o,a-d-l+s];case 90:return[u+l+o,a-d+c+s,u+l+p+o,a-d+c+f+s];case 180:return[u-c-f+o,a-d+l+s,u-c+o,a-d+l+p+s];case 270:return[u-l-p+o,a-d-c-f+s,u-l+o,a-d-c+s];default:throw Error(`Invalid rotation`)}}getRectInCurrentCoords(e,t){let[n,r,i,a]=e,o=i-n,s=a-r;switch(this.rotation){case 0:return[n,t-a,o,s];case 90:return[n,t-r,s,o];case 180:return[i,t-r,o,s];case 270:return[i,t-a,s,o];default:throw Error(`Invalid rotation`)}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&t._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var e;(e=a(z,this))==null||e.onUpdatedColor()}getData(){let{comment:{text:e,color:t,date:n,opacity:r,deleted:i,richText:a},uid:o,pageIndex:s,creationDate:c,modificationDate:l}=this;return{id:o,pageIndex:s,rect:this.getPDFRect(),richText:a,contentsObj:{str:e},creationDate:c,modificationDate:n||l,popupRef:!i,color:t,opacity:r}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),o(Qi,this,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),o(Qi,this,!1),!0):!1}isInEditMode(){return a(Qi,this)}shouldGetKeyboardEvents(){return a($i,this)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:e,left:t,bottom:n,right:r}=this.getClientDimensions(),{innerHeight:i,innerWidth:a}=window;return t<a&&r>0&&e<i&&n>0}rebuild(){n(B,this,ba).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||``}}serialize(e=!1,t=null){var n;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((n=this._initialData)==null?void 0:n.popupRef)||``}}static async deserialize(e,t,n){let r=new this.prototype.constructor({parent:t,id:n.getId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});r.rotation=e.rotation,o(Ii,r,e.accessibilityData),r._isCopy=e.isCopy||!1;let[i,a]=r.pageDimensions,[s,c,l,u]=r.getRectInCurrentCoords(e.rect,a);return r.x=s/i,r.y=c/a,r.width=l/i,r.height=u/a,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,t,r;if((e=a(qi,this))==null||e.abort(),o(qi,this,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),a(ea,this)&&(clearTimeout(a(ea,this)),o(ea,this,null)),n(B,this,Ta).call(this),this.removeEditToolbar(),a(ra,this)){for(let e of a(ra,this).values())clearTimeout(e);o(ra,this,null)}this.parent=null,(t=a(ia,this))==null||t.destroy(),o(ia,this,null),(r=a(Ki,this))==null||r.remove(),o(Ki,this,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(n(B,this,ua).call(this),a(Ui,this).classList.remove(`hidden`))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction===`ltr`?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[e,n]}=this,[r,i,a,o]=this.getPDFRect();return[t._round(r+(a-r)*e),t._round(i+(o-i)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return a(z,this).commentPopupPositionInLayer}set commentPopupPosition(e){a(z,this).commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return a(z,this).hasDefaultPopupPosition()}get commentButtonWidth(){return a(z,this).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){var t;(t=a(z,this))==null||t.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!==`Enter`)return;this._uiManager.setSelected(this),o(Gi,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let r=a(Ui,this).children;if(!a(Li,this)){o(Li,this,Array.from(r));let e=n(B,this,xa).bind(this),i=n(B,this,Sa).bind(this),s=this._uiManager._signal;for(let r of a(Li,this)){let a=r.getAttribute(`data-resizer-name`);r.setAttribute(`role`,`spinbutton`),r.addEventListener(`keydown`,e,{signal:s}),r.addEventListener(`blur`,i,{signal:s}),r.addEventListener(`focus`,n(B,this,Ca).bind(this,a),{signal:s}),r.setAttribute(`data-l10n-id`,t._l10nResizer[a])}}let i=a(Li,this)[0],s=0;for(let e of r){if(e===i)break;s++}let c=(360-this.rotation+this.parentRotation)%360/90*(a(Li,this).length/4);if(c!==s){if(c<s)for(let e=0;e<s-c;e++)a(Ui,this).append(a(Ui,this).firstElementChild);else if(c>s)for(let e=0;e<c-s;e++)a(Ui,this).firstElementChild.before(a(Ui,this).lastElementChild);let e=0;for(let n of r){let r=a(Li,this)[e++].getAttribute(`data-resizer-name`);n.setAttribute(`data-l10n-id`,t._l10nResizer[r])}}n(B,this,wa).call(this,0),o($i,this,!0),a(Ui,this).firstElementChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){a($i,this)&&n(B,this,ma).call(this,a(Ji,this),{deltaX:e,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){n(B,this,Ta).call(this),this.div.focus()}select(){var e,t,n;if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add(`selectedEditor`),!this._editToolbar){this.addEditToolbar().then(()=>{var e;if((e=this.div)!=null&&e.classList.contains(`selectedEditor`)){var t;(t=this._editToolbar)==null||t.show()}});return}(t=this._editToolbar)==null||t.show(),(n=a(Ri,this))==null||n.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var e;return(e=this.div)==null?void 0:e.focus({preventScroll:!0})},0)}unselect(){var e,t,n,r,i;this.isSelected&&(this.isSelected=!1,(e=a(Ui,this))==null||e.classList.add(`hidden`),(t=this.div)==null||t.classList.remove(`selectedEditor`),(n=this.div)!=null&&n.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(r=this._editToolbar)==null||r.hide(),(i=a(Ri,this))==null||i.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!==`BUTTON`&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return a(Zi,this)}set isEditing(e){o(Zi,this,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:`added`}}get telemetryFinalData(){return null}_reportTelemetry(e,n=!1){if(n){a(ra,this)||o(ra,this,new Map);let{action:n}=e,r=a(ra,this).get(n);r&&clearTimeout(r),r=setTimeout(()=>{this._reportTelemetry(e),a(ra,this).delete(n),a(ra,this).size===0&&o(ra,this,null)},t._telemetryTimeout),a(ra,this).set(n,r);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:e}})}show(e=this._isVisible){this.div.classList.toggle(`hidden`,!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),o(Bi,this,!1)}disable(){this.div&&(this.div.tabIndex=-1),o(Bi,this,!0)}updateFakeAnnotationElement(e){if(!a(Ki,this)&&!this.deleted){o(Ki,this,e.addFakeAnnotation(this));return}if(this.deleted){a(Ki,this).remove(),o(Ki,this,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&a(Ki,this).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let t=e.container.querySelector(`.annotationContent`);if(!t)t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.container.prepend(t);else if(t.nodeName===`CANVAS`){let e=t;t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.before(t)}return t}resetAnnotationElement(e){let{firstElementChild:t}=e.container;(t==null?void 0:t.nodeName)===`DIV`&&t.classList.contains(`annotationContent`)&&t.remove()}};f=V;function sa([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}function ca(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}function la(e){switch(e){case 90:{let[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}function ua(){if(a(Ui,this))return;o(Ui,this,document.createElement(`div`)),a(Ui,this).classList.add(`resizers`);let e=this._willKeepAspectRatio?[`topLeft`,`topRight`,`bottomRight`,`bottomLeft`]:[`topLeft`,`topMiddle`,`topRight`,`middleRight`,`bottomRight`,`bottomMiddle`,`bottomLeft`,`middleLeft`],t=this._uiManager._signal;for(let r of e){let e=document.createElement(`div`);a(Ui,this).append(e),e.classList.add(`resizer`,r),e.setAttribute(`data-resizer-name`,r),e.addEventListener(`pointerdown`,n(B,this,da).bind(this,r),{signal:t}),e.addEventListener(`contextmenu`,lt,{signal:t}),e.tabIndex=-1}this.div.prepend(a(Ui,this))}function da(e,t){var r;t.preventDefault();let{isMac:i}=Ie.platform;if(t.button!==0||t.ctrlKey&&i)return;(r=a(Ri,this))==null||r.toggle(!1);let s=this._isDraggable;this._isDraggable=!1,o(Wi,this,[t.screenX,t.screenY]);let c=new AbortController,l=this._uiManager.combinedSignal(c);this.parent.togglePointerEvents(!1),window.addEventListener(`pointermove`,n(B,this,ma).bind(this,e),{passive:!0,capture:!0,signal:l}),window.addEventListener(`touchmove`,P,{passive:!1,signal:l}),window.addEventListener(`contextmenu`,lt,{signal:l}),o(Gi,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let u=this.parent.div.style.cursor,d=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;let f=()=>{var e;c.abort(),this.parent.togglePointerEvents(!0),(e=a(Ri,this))==null||e.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=u,this.div.style.cursor=d,n(B,this,pa).call(this)};window.addEventListener(`pointerup`,f,{signal:l}),window.addEventListener(`blur`,f,{signal:l})}function fa(e,t,n,r){this.width=n,this.height=r,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()}function pa(){if(!a(Gi,this))return;let{savedX:e,savedY:t,savedWidth:r,savedHeight:i}=a(Gi,this);o(Gi,this,null);let s=this.x,c=this.y,l=this.width,u=this.height;s===e&&c===t&&l===r&&u===i||this.addCommands({cmd:n(B,this,fa).bind(this,s,c,l,u),undo:n(B,this,fa).bind(this,e,t,r,i),mustExec:!0})}function ma(e,t){let[r,i]=this.parentDimensions,s=this.x,c=this.y,l=this.width,u=this.height,d=f.MIN_SIZE/r,p=f.MIN_SIZE/i,m=n(B,this,la).call(this,this.rotation),h=(e,t)=>[m[0]*e+m[2]*t,m[1]*e+m[3]*t],g=n(B,this,la).call(this,360-this.rotation),_=(e,t)=>[g[0]*e+g[2]*t,g[1]*e+g[3]*t],v,y,b=!1,x=!1;switch(e){case`topLeft`:b=!0,v=(e,t)=>[0,0],y=(e,t)=>[e,t];break;case`topMiddle`:v=(e,t)=>[e/2,0],y=(e,t)=>[e/2,t];break;case`topRight`:b=!0,v=(e,t)=>[e,0],y=(e,t)=>[0,t];break;case`middleRight`:x=!0,v=(e,t)=>[e,t/2],y=(e,t)=>[0,t/2];break;case`bottomRight`:b=!0,v=(e,t)=>[e,t],y=(e,t)=>[0,0];break;case`bottomMiddle`:v=(e,t)=>[e/2,t],y=(e,t)=>[e/2,0];break;case`bottomLeft`:b=!0,v=(e,t)=>[0,t],y=(e,t)=>[e,0];break;case`middleLeft`:x=!0,v=(e,t)=>[0,t/2],y=(e,t)=>[e,t/2];break}let S=v(l,u),C=y(l,u),w=h(...C),T=f._round(s+w[0]),ee=f._round(c+w[1]),E=1,te=1,ne,re;if(t.fromKeyboard)({deltaX:ne,deltaY:re}=t);else{let{screenX:e,screenY:n}=t,[r,i]=a(Wi,this);[ne,re]=this.screenToPageTranslation(e-r,n-i),a(Wi,this)[0]=e,a(Wi,this)[1]=n}if([ne,re]=_(ne/r,re/i),b){let e=Math.hypot(l,u);E=te=Math.max(Math.min(Math.hypot(C[0]-S[0]-ne,C[1]-S[1]-re)/e,1/l,1/u),d/l,p/u)}else x?E=N(Math.abs(C[0]-S[0]-ne),d,1)/l:te=N(Math.abs(C[1]-S[1]-re),p,1)/u;let ie=f._round(l*E),ae=f._round(u*te);w=h(...y(ie,ae));let oe=T-w[0],se=ee-w[1];a(Xi,this)||o(Xi,this,[this.x,this.y,this.width,this.height]),this.width=ie,this.height=ae,this.x=oe,this.y=se,this.setDims(),this.fixAndSetPosition(),this._onResizing()}function ha(){var e;o(Gi,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=a(Ri,this))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)}function ga(e,t,r){let i=.7,s=r/t*i+1-i;if(s===1)return;let c=n(B,this,la).call(this,this.rotation),l=(e,t)=>[c[0]*e+c[2]*t,c[1]*e+c[3]*t],[u,d]=this.parentDimensions,p=this.x,m=this.y,h=this.width,g=this.height,_=f.MIN_SIZE/u,v=f.MIN_SIZE/d;s=Math.max(Math.min(s,1/h,1/g),_/h,v/g);let y=f._round(h*s),b=f._round(g*s);if(y===h&&b===g)return;a(Xi,this)||o(Xi,this,[p,m,h,g]);let x=l(h/2,g/2),S=f._round(p+x[0]),C=f._round(m+x[1]),w=l(y/2,b/2);this.x=S-w[0],this.y=C-w[1],this.width=y,this.height=b,this.setDims(),this.fixAndSetPosition(),this._onResizing()}function _a(){var e;(e=a(Ri,this))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),n(B,this,pa).call(this)}function va(e){let{isMac:t}=Ie.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}function ya(e){let{isSelected:t}=this;this._uiManager.setUpDragSession();let r=!1,i=new AbortController,s=this._uiManager.combinedSignal(i),c={capture:!0,passive:!1,signal:s},l=e=>{i.abort(),o(Vi,this,null),o(Yi,this,!1),this._uiManager.endDragSession()||n(B,this,va).call(this,e),r&&this._onStopDragging()};t&&(o(ta,this,e.clientX),o(na,this,e.clientY),o(Vi,this,e.pointerId),o(Hi,this,e.pointerType),window.addEventListener(`pointermove`,e=>{r||(r=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:t,clientY:n,pointerId:i}=e;if(i!==a(Vi,this)){P(e);return}let[s,c]=this.screenToPageTranslation(t-a(ta,this),n-a(na,this));o(ta,this,t),o(na,this,n),this._uiManager.dragSelectedEditors(s,c)},c),window.addEventListener(`touchmove`,P,c),window.addEventListener(`pointerdown`,e=>{e.pointerType===a(Hi,this)&&(a(ia,this)||e.isPrimary)&&l(e),P(e)},c));let u=e=>{if(!a(Vi,this)||a(Vi,this)===e.pointerId){l(e);return}P(e)};window.addEventListener(`pointerup`,u,{signal:s}),window.addEventListener(`blur`,u,{signal:s})}function ba(){if(a(qi,this)||!this.div)return;o(qi,this,new AbortController);let e=this._uiManager.combinedSignal(a(qi,this));this.div.addEventListener(`focusin`,this.focusin.bind(this),{signal:e}),this.div.addEventListener(`focusout`,this.focusout.bind(this),{signal:e})}function xa(e){f._resizerKeyboardManager.exec(this,e)}function Sa(e){var t;a($i,this)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==a(Ui,this)&&n(B,this,Ta).call(this)}function Ca(e){o(Ji,this,a($i,this)?e:``)}function wa(e){if(a(Li,this))for(let t of a(Li,this))t.tabIndex=e}function Ta(){o($i,this,!1),n(B,this,wa).call(this,-1),n(B,this,pa).call(this)}e(V,`_l10n`,null),e(V,`_l10nResizer`,null),e(V,`_borderLineWidth`,-1),e(V,`_colorManager`,new Tn),e(V,`_zIndex`,1),e(V,`_telemetryTimeout`,1e3);var Ea=class extends V{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},Da=3285377520,Oa=4294901760,ka=65535,Aa=class{constructor(e){this.h1=e?e&4294967295:Da,this.h2=e?e&4294967295:Da}update(e){let t,n;if(typeof e==`string`){t=new Uint8Array(e.length*2),n=0;for(let r=0,i=e.length;r<i;r++){let i=e.charCodeAt(r);i<=255?t[n++]=i:(t[n++]=i>>>8,t[n++]=i&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),n=t.byteLength;else throw Error(`Invalid data format, must be a string or TypedArray.`);let r=n>>2,i=n-r*4,a=new Uint32Array(t.buffer,0,r),o=0,s=0,c=this.h1,l=this.h2,u=3432918353,d=461845907,f=u&ka,p=d&ka;for(let e=0;e<r;e++)e&1?(o=a[e],o=o*u&Oa|o*f&ka,o=o<<15|o>>>17,o=o*d&Oa|o*p&ka,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(s=a[e],s=s*u&Oa|s*f&ka,s=s<<15|s>>>17,s=s*d&Oa|s*p&ka,l^=s,l=l<<13|l>>>19,l=l*5+3864292196);switch(o=0,i){case 3:o^=t[r*4+2]<<16;case 2:o^=t[r*4+1]<<8;case 1:o^=t[r*4],o=o*u&Oa|o*f&ka,o=o<<15|o>>>17,o=o*d&Oa|o*p&ka,r&1?c^=o:l^=o}this.h1=c,this.h2=l}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&Oa|e*36045&ka,t=t*4283543511&Oa|((t<<16|e>>>16)*2950163797&Oa)>>>16,e^=t>>>1,e=e*444984403&Oa|e*60499&ka,t=t*3301882366&Oa|((t<<16|e>>>16)*3120437893&Oa)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,`0`)+(t>>>0).toString(16).padStart(8,`0`)}},ja=Object.freeze({map:null,hash:``,transfer:void 0}),Ma=new WeakMap,Na=new WeakMap,Pa=new WeakMap,Fa=new WeakMap,Ia=new WeakSet;S=Symbol.iterator;var La=class{constructor(){i(this,Ia),r(this,Ma,!1),r(this,Na,null),r(this,Pa,null),r(this,Fa,new Map),e(this,`onSetModified`,null),e(this,`onResetModified`,null),e(this,`onAnnotationEditor`,null)}getValue(e,t){let n=a(Fa,this).get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return a(Fa,this).get(e)}remove(e){var t;let n=a(Fa,this).get(e);n!==void 0&&(n instanceof V&&a(Pa,this).delete(n.annotationElementId),a(Fa,this).delete(e),a(Fa,this).size===0&&this.resetModified(),!a(Fa,this).values().some(e=>e instanceof V)&&((t=this.onAnnotationEditor)==null||t.call(this,null)))}setValue(e,t){let r=a(Fa,this).get(e),i=!1;if(r!==void 0)for(let[e,n]of Object.entries(t))r[e]!==n&&(i=!0,r[e]=n);else i=!0,a(Fa,this).set(e,t);if(i&&n(Ia,this,Ra).call(this),t instanceof V){var s;(a(Pa,this)||o(Pa,this,new Map)).set(t.annotationElementId,t),(s=this.onAnnotationEditor)==null||s.call(this,t.constructor._type)}}has(e){return a(Fa,this).has(e)}get size(){return a(Fa,this).size}resetModified(){if(a(Ma,this)){var e;o(Ma,this,!1),(e=this.onResetModified)==null||e.call(this)}}get print(){return new Ba(this)}get serializable(){if(a(Fa,this).size===0)return ja;let e=new Map,t=new Aa,n=[],r=Object.create(null),i=!1;for(let[n,o]of a(Fa,this)){let a=o instanceof V?o.serialize(!1,r):o;o.page&&(o.pageIndex=o.page._pageIndex,delete o.page),a&&(e.set(n,a),t.update(`${n}:${JSON.stringify(a)}`),i||(i=!!a.bitmap))}if(i)for(let t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:ja}get editorStats(){let e=null,t=new Map,n=0,r=0;for(let o of a(Fa,this).values()){var i;if(!(o instanceof V)){o.popup&&(o.popup.deleted?r+=1:n+=1);continue}o.isCommentDeleted?r+=1:o.hasEditedComment&&(n+=1);let a=o.telemetryFinalData;if(!a)continue;let{type:s}=a;t.has(s)||t.set(s,Object.getPrototypeOf(o).constructor),e||(e=Object.create(null));let c=(i=e)[s]||(i[s]=new Map);for(let[e,t]of Object.entries(a)){if(e===`type`)continue;let n=c.getOrInsertComputed(e,qe);n.set(t,(n.get(t)??0)+1)}}if((r>0||n>0)&&(e||(e=Object.create(null)),e.comments={deleted:r,edited:n}),!e)return null;for(let[n,r]of t)e[n]=r.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){o(Na,this,null)}updateEditor(e,t){var n;let r=(n=a(Pa,this))==null?void 0:n.get(e);return r?(r.updateFromAnnotationLayer(t),!0):!1}getEditor(e){var t;return((t=a(Pa,this))==null?void 0:t.get(e))||null}get modifiedIds(){if(a(Na,this))return a(Na,this);let e=[];if(a(Pa,this))for(let t of a(Pa,this).values())t.serialize()&&e.push(t.annotationElementId);let t=``;if(e.length){let n=new Aa;n.update(e.join(`,`)),t=n.hexdigest()}return o(Na,this,{ids:new Set(e),hash:t})}[S](){return a(Fa,this).entries()}};function Ra(){if(!a(Ma,this)){var e;o(Ma,this,!0),(e=this.onSetModified)==null||e.call(this)}}var za=new WeakMap,Ba=class extends La{constructor(e){super(),r(this,za,ja);let{serializable:t}=e;if(t===ja)return;let{map:n,hash:i,transfer:a}=t,s=structuredClone(n,a?{transfer:a}:null);o(za,this,{map:s,hash:i,transfer:[]})}get print(){A(`Should not call PrintAnnotationStorage.print`)}get serializable(){return a(za,this)}get modifiedIds(){return j(this,`modifiedIds`,{ids:new Set,hash:``})}},Va=`__forcedDependency`,{floor:Ha,ceil:Ua}=Math;function Wa(e,t,n,r,i,a){e[t*4+0]=Math.min(e[t*4+0],n),e[t*4+1]=Math.min(e[t*4+1],r),e[t*4+2]=Math.max(e[t*4+2],i),e[t*4+3]=Math.max(e[t*4+3],a)}var Ga=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],Ka=new WeakMap,qa=new WeakMap,Ja=class{constructor(e,t){r(this,Ka,void 0),r(this,qa,void 0),o(Ka,this,e),o(qa,this,t)}get length(){return a(Ka,this).length}isEmpty(e){return a(Ka,this)[e]===Ga}minX(e){return a(qa,this)[e*4+0]/256}minY(e){return a(qa,this)[e*4+1]/256}maxX(e){return(a(qa,this)[e*4+2]+1)/256}maxY(e){return(a(qa,this)[e*4+3]+1)/256}},Ya=(e,t)=>e==null?void 0:e.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),Xa=new WeakMap,H=new WeakMap,Za=new WeakMap,Qa=new WeakMap,$a=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakSet,ro=class{constructor(t,a){i(this,no),r(this,Xa,[[1,0,0,1,0,0]]),r(this,H,[-1/0,-1/0,1/0,1/0]),r(this,Za,new Float64Array(te)),e(this,`_pendingBBoxIdx`,-1),r(this,Qa,void 0),r(this,$a,void 0),r(this,eo,void 0),r(this,to,void 0),e(this,`_savesStack`,[]),e(this,`_markedContentStack`,[]),o(Qa,this,t.width),o($a,this,t.height),n(no,this,io).call(this,a)}growOperationsCount(e){e>=a(to,this).length&&n(no,this,io).call(this,e,a(to,this))}get clipBox(){return a(H,this)}save(e){return o(H,this,{__proto__:a(H,this)}),this._savesStack.push(e),this}restore(e,t){let n=Object.getPrototypeOf(a(H,this));if(n===null)return this;o(H,this,n);let r=this._savesStack.pop();return r!==void 0&&(t==null||t(r,e),a(to,this)[e]=a(to,this)[r]),this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,t){let n=this._savesStack.pop();return n!==void 0&&(t==null||t(n,e),a(to,this)[e]=a(to,this)[n]),this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,t){let n=this._markedContentStack.pop();return n!==void 0&&(t==null||t(n,e),a(to,this)[e]=a(to,this)[n]),this}pushBaseTransform(e){return a(Xa,this).push(M.multiplyByDOMMatrix(a(Xa,this).at(-1),e.getTransform())),this}popBaseTransform(){return a(Xa,this).length>1&&a(Xa,this).pop(),this}resetBBox(e){return this._pendingBBoxIdx!==e&&(this._pendingBBoxIdx=e,a(Za,this).set(te,0)),this}recordClipBox(e,t,n,r,i,o){let s=M.multiplyByDOMMatrix(a(Xa,this).at(-1),t.getTransform()),c=te.slice();M.axialAlignedBoundingBox([n,i,r,o],s,c);let l=M.intersect(a(H,this),c);return l?(a(H,this)[0]=l[0],a(H,this)[1]=l[1],a(H,this)[2]=l[2],a(H,this)[3]=l[3]):(a(H,this)[0]=a(H,this)[1]=1/0,a(H,this)[2]=a(H,this)[3]=-1/0),this}recordBBox(e,t,n,r,i,o){let s=a(H,this);if(s[0]===1/0)return this;let c=M.multiplyByDOMMatrix(a(Xa,this).at(-1),t.getTransform());if(s[0]===-1/0)return M.axialAlignedBoundingBox([n,i,r,o],c,a(Za,this)),this;let l=te.slice();return M.axialAlignedBoundingBox([n,i,r,o],c,l),a(Za,this)[0]=N(l[0],s[0],a(Za,this)[0]),a(Za,this)[1]=N(l[1],s[1],a(Za,this)[1]),a(Za,this)[2]=N(l[2],a(Za,this)[2],s[2]),a(Za,this)[3]=N(l[3],a(Za,this)[3],s[3]),this}recordFullPageBBox(e){return a(Za,this)[0]=Math.max(0,a(H,this)[0]),a(Za,this)[1]=Math.max(0,a(H,this)[1]),a(Za,this)[2]=Math.min(a(Qa,this),a(H,this)[2]),a(Za,this)[3]=Math.min(a($a,this),a(H,this)[3]),this}recordOperation(e,t=!1,n){if(this._pendingBBoxIdx!==e)return this;let r=Ha(a(Za,this)[0]*256/a(Qa,this)),i=Ha(a(Za,this)[1]*256/a($a,this)),o=Ua(a(Za,this)[2]*256/a(Qa,this)),s=Ua(a(Za,this)[3]*256/a($a,this));if(Wa(a(eo,this),e,r,i,o,s),n)for(let t of n)for(let n of t)n!==e&&Wa(a(eo,this),n,r,i,o,s);return t||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(e){return this._pendingBBoxIdx===e&&(this._pendingBBoxIdx=-1,a(H,this)[0]=Math.max(a(H,this)[0],a(Za,this)[0]),a(H,this)[1]=Math.max(a(H,this)[1],a(Za,this)[1]),a(H,this)[2]=Math.min(a(H,this)[2],a(Za,this)[2]),a(H,this)[3]=Math.min(a(H,this)[3],a(Za,this)[3])),this}take(){return new Ja(a(to,this),a(eo,this))}takeDebugMetadata(){throw Error(`Unreachable`)}recordSimpleData(e,t){return this}recordIncrementalData(e,t){return this}resetIncrementalData(e,t){return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e,t=!1){return this}};function io(e,t){let n=new ArrayBuffer(e*4);o(eo,this,new Uint8ClampedArray(n)),o(to,this,new Uint32Array(n)),t&&t.length>0?(a(to,this).set(t),a(to,this).fill(Ga,t.length)):a(to,this).fill(Ga)}var ao=new WeakMap,oo=new WeakMap,so=new WeakMap,co=new WeakMap,lo=new WeakMap,uo=new WeakMap,fo=new WeakMap,U=new WeakMap,po=class{constructor(e,t=!1){r(this,ao,{__proto__:null}),r(this,oo,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Va]:[]}),r(this,so,new Map),r(this,co,new Set),r(this,lo,new Map),r(this,uo,void 0),r(this,fo,void 0),r(this,U,void 0),o(U,this,e),t&&(o(uo,this,new Map),o(fo,this,(e,t)=>{Ya(a(uo,this),t).dependencies.add(e)}))}get clipBox(){return a(U,this).clipBox}growOperationsCount(e){a(U,this).growOperationsCount(e)}save(e){return o(ao,this,{__proto__:a(ao,this)}),o(oo,this,{__proto__:a(oo,this),transform:{__proto__:a(oo,this).transform},moveText:{__proto__:a(oo,this).moveText},sameLineText:{__proto__:a(oo,this).sameLineText},[Va]:{__proto__:a(oo,this)[Va]}}),a(U,this).save(e),this}restore(e){a(U,this).restore(e,a(fo,this));let t=Object.getPrototypeOf(a(ao,this));return t===null?this:(o(ao,this,t),o(oo,this,Object.getPrototypeOf(a(oo,this))),this)}recordOpenMarker(e){return a(U,this).recordOpenMarker(e,a(fo,this)),this}getOpenMarker(){return a(U,this).getOpenMarker()}recordCloseMarker(e){return a(U,this).recordCloseMarker(e,a(fo,this)),this}beginMarkedContent(e){return a(U,this).beginMarkedContent(e),this}endMarkedContent(e){return a(U,this).endMarkedContent(e,a(fo,this)),this}pushBaseTransform(e){return a(U,this).pushBaseTransform(e),this}popBaseTransform(){return a(U,this).popBaseTransform(),this}recordSimpleData(e,t){return a(ao,this)[e]=t,this}recordIncrementalData(e,t){return a(oo,this)[e].push(t),this}resetIncrementalData(e,t){return a(oo,this)[e].length=0,this}recordNamedData(e,t){return a(so,this).set(e,t),this}recordSimpleDataFromNamed(e,t,n){a(ao,this)[e]=a(so,this).get(t)??n}recordFutureForcedDependency(e,t){return this.recordIncrementalData(Va,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(let t of e)t in a(ao,this)&&this.recordFutureForcedDependency(t,a(ao,this)[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let e of a(co,this))this.recordFutureForcedDependency(Va,e);return this}resetBBox(e){return a(U,this).resetBBox(e),this}recordClipBox(e,t,n,r,i,o){return a(U,this).recordClipBox(e,t,n,r,i,o),this}recordBBox(e,t,n,r,i,o){return a(U,this).recordBBox(e,t,n,r,i,o),this}recordCharacterBBox(e,t,n,r=1,i=0,o=0,s){let c=n.bbox,l,u;if(c&&(l=c[2]!==c[0]&&c[3]!==c[1]&&a(lo,this).get(n),l!==!1&&(u=[0,0,0,0],M.axialAlignedBoundingBox(c,n.fontMatrix,u),(r!==1||i!==0||o!==0)&&M.scaleMinMax([r,0,0,-r,i,o],u),l)))return this.recordBBox(e,t,u[0],u[2],u[1],u[3]);if(!s)return this.recordFullPageBBox(e);let d=s();return c&&u&&l===void 0&&(l=u[0]<=i-d.actualBoundingBoxLeft&&u[2]>=i+d.actualBoundingBoxRight&&u[1]<=o-d.actualBoundingBoxAscent&&u[3]>=o+d.actualBoundingBoxDescent,a(lo,this).set(n,l),l)?this.recordBBox(e,t,u[0],u[2],u[1],u[3]):this.recordBBox(e,t,i-d.actualBoundingBoxLeft,i+d.actualBoundingBoxRight,o-d.actualBoundingBoxAscent,o+d.actualBoundingBoxDescent)}recordFullPageBBox(e){return a(U,this).recordFullPageBBox(e),this}getSimpleIndex(e){return a(ao,this)[e]}recordDependencies(e,t){let n=a(co,this),r=a(ao,this),i=a(oo,this);for(let e of t)e in a(ao,this)?n.add(r[e]):e in i&&i[e].forEach(n.add,n);return this}recordNamedDependency(e,t){return a(so,this).has(t)&&a(co,this).add(a(so,this).get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[Va]),a(uo,this)){let t=Ya(a(uo,this),e),{dependencies:n}=t;a(co,this).forEach(n.add,n),a(U,this)._savesStack.forEach(n.add,n),a(U,this)._markedContentStack.forEach(n.add,n),n.delete(e),t.isRenderingOperation=!0}let n=!t&&e===a(U,this)._pendingBBoxIdx;return a(U,this).recordOperation(e,t,[a(co,this),a(U,this)._savesStack,a(U,this)._markedContentStack]),n&&a(co,this).clear(),this}recordShowTextOperation(e,t=!1){let n=Array.from(a(co,this));this.recordOperation(e,t),this.recordIncrementalData(`sameLineText`,e);for(let e of n)this.recordIncrementalData(`sameLineText`,e);return this}bboxToClipBoxDropOperation(e,t=!1){let n=!t&&e===a(U,this)._pendingBBoxIdx;return a(U,this).bboxToClipBoxDropOperation(e),n&&a(co,this).clear(),this}take(){return a(lo,this).clear(),a(U,this).take()}takeDebugMetadata(){return a(uo,this)}},W=new WeakMap,mo=new WeakMap,ho=new WeakMap,go=new WeakMap,_o=new WeakMap,vo=class e{constructor(t,n,i){if(r(this,W,void 0),r(this,mo,void 0),r(this,ho,void 0),r(this,go,0),r(this,_o,0),t instanceof e&&a(ho,t)===!!i)return t;o(W,this,t),o(mo,this,n),o(ho,this,!!i)}get clipBox(){return a(W,this).clipBox}growOperationsCount(){throw Error(`Unreachable`)}save(e){var t;return o(_o,this,(t=a(_o,this),t++,t)),a(W,this).save(a(mo,this)),this}restore(e){if(a(_o,this)>0){var t;a(W,this).restore(a(mo,this)),o(_o,this,(t=a(_o,this),t--,t))}return this}recordOpenMarker(e){var t;return o(go,this,(t=a(go,this),t++,t)),this}getOpenMarker(){return a(go,this)>0?a(mo,this):a(W,this).getOpenMarker()}recordCloseMarker(e){var t;return o(go,this,(t=a(go,this),t--,t)),this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return a(W,this).pushBaseTransform(e),this}popBaseTransform(){return a(W,this).popBaseTransform(),this}recordSimpleData(e,t){return a(W,this).recordSimpleData(e,a(mo,this)),this}recordIncrementalData(e,t){return a(W,this).recordIncrementalData(e,a(mo,this)),this}resetIncrementalData(e,t){return a(W,this).resetIncrementalData(e,a(mo,this)),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return a(W,this).recordSimpleDataFromNamed(e,t,a(mo,this)),this}recordFutureForcedDependency(e,t){return a(W,this).recordFutureForcedDependency(e,a(mo,this)),this}inheritSimpleDataAsFutureForcedDependencies(e){return a(W,this).inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return a(W,this).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return a(ho,this)||a(W,this).resetBBox(a(mo,this)),this}recordClipBox(e,t,n,r,i,o){return a(ho,this)||a(W,this).recordClipBox(a(mo,this),t,n,r,i,o),this}recordBBox(e,t,n,r,i,o){return a(ho,this)||a(W,this).recordBBox(a(mo,this),t,n,r,i,o),this}recordCharacterBBox(e,t,n,r,i,o,s){return a(ho,this)||a(W,this).recordCharacterBBox(a(mo,this),t,n,r,i,o,s),this}recordFullPageBBox(e){return a(ho,this)||a(W,this).recordFullPageBBox(a(mo,this)),this}getSimpleIndex(e){return a(W,this).getSimpleIndex(e)}recordDependencies(e,t){return a(W,this).recordDependencies(a(mo,this),t),this}recordNamedDependency(e,t){return a(W,this).recordNamedDependency(a(mo,this),t),this}recordOperation(e){return a(W,this).recordOperation(a(mo,this),!0),this}recordShowTextOperation(e){return a(W,this).recordShowTextOperation(a(mo,this),!0),this}bboxToClipBoxDropOperation(e){return a(ho,this)||a(W,this).bboxToClipBoxDropOperation(a(mo,this),!0),this}take(){throw Error(`Unreachable`)}takeDebugMetadata(){throw Error(`Unreachable`)}},yo={stroke:[`path`,`transform`,`filter`,`strokeColor`,`strokeAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`dash`],fill:[`path`,`transform`,`filter`,`fillColor`,`fillAlpha`,`globalCompositeOperation`,`SMask`],imageXObject:[`transform`,`SMask`,`filter`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`],rawFillPath:[`filter`,`fillColor`,`fillAlpha`],showText:[`transform`,`leading`,`charSpacing`,`wordSpacing`,`hScale`,`textRise`,`moveText`,`textMatrix`,`font`,`fontObj`,`filter`,`fillColor`,`textRenderingMode`,`SMask`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`,`sameLineText`],transform:[`transform`],transformAndFill:[`transform`,`fillColor`]},bo=new WeakMap,xo=new WeakMap,So=new WeakMap,Co=new WeakMap,wo=new WeakMap,To=class{constructor(e){r(this,bo,void 0),r(this,xo,void 0),r(this,So,4),r(this,Co,0),r(this,wo,new Eo._(a(So,this)*6)),o(bo,this,e.width),o(xo,this,e.height)}record(e,t,n,r){var i;if(a(Co,this)===a(So,this)){o(So,this,a(So,this)*2);let e=new Eo._(a(So,this)*6);e.set(a(wo,this)),o(wo,this,e)}let s=M.domMatrixToTransform(e.getTransform()),c;if(r[0]!==1/0){let e=te.slice();M.axialAlignedBoundingBox([0,-n,t,0],s,e);let i=M.intersect(r,e);if(!i)return;let[a,o,l,u]=i;if(a!==e[0]||o!==e[1]||l!==e[2]||u!==e[3]){let e=Math.atan2(s[1],s[0]),t=Math.abs(Math.sin(e)),n=Math.abs(Math.cos(e));if(t<1e-6||n<1e-6||Math.abs(t-n)<1e-6)c=[a,o,a,u,l,o];else{let e=l-a,r=u-o,i=t*t,s=n*n,d=n*t,f=s-i,p=(r*s-e*d)/f;c=[a+(r*d-e*i)/f,o,a,o+p,l,u-p]}}}c||(c=[0,-n,0,0,t,-n],M.applyTransform(c,s,0),M.applyTransform(c,s,2),M.applyTransform(c,s,4)),c[0]/=a(bo,this),c[1]/=a(xo,this),c[2]/=a(bo,this),c[3]/=a(xo,this),c[4]/=a(bo,this),c[5]/=a(xo,this),a(wo,this).set(c,a(Co,this)*6),o(Co,this,(i=a(Co,this),i++,i))}take(){return a(wo,this).subarray(0,a(Co,this)*6)}},Eo={_:Ie.isFloat16ArraySupported?Float16Array:Float32Array},Do=new WeakMap,Oo=class{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){r(this,Do,new Set),this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement(`style`),this._document.documentElement.getElementsByTagName(`head`)[0].append(this.styleElement));let t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),a(Do,this).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(!(!e||a(Do,this).has(e.loadedName))){if(xe(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:r,style:i}=e,o=new FontFace(t,r,i);this.addNativeFontFace(o);try{await o.load(),a(Do,this).add(t),n==null||n(e)}catch{k(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}A(`Not implemented: loadSystemFont without the Font Loading API.`)}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw k(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(t=>{let n=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){var e;let t=!!((e=this._document)!=null&&e.fonts);return j(this,`isFontLoadingAPISupported`,t)}get isSyncFontLoadingSupported(){return j(this,`isSyncFontLoadingSupported`,E||Ie.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(xe(!r.done,`completeRequest() cannot be called twice.`),r.done=!0;n.length>0&&n[0].done;){let e=n.shift();setTimeout(e.callback,0)}}let{loadingRequests:n}=this,r={done:!1,complete:t,callback:e};return n.push(r),r}get _loadTestFont(){let e=atob(`T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==`);return j(this,`_loadTestFont`,e)}_prepareFontLoadEvent(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3)&255}function r(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function i(e,t,n,r){let i=e.substring(0,t),a=e.substring(t+n);return i+r+a}let a,o,s=this._document.createElement(`canvas`);s.width=1,s.height=1;let c=s.getContext(`2d`),l=0;function u(e,t){if(++l>30){k(`Load test font never loaded.`),t();return}if(c.font=`30px `+e,c.fillText(`.`,0,20),c.getImageData(0,0,1,1).data[3]>0){t();return}setTimeout(u.bind(null,e,t))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=i(f,976,d.length,d);let p=1482184792,m=n(f,16);for(a=0,o=d.length-3;a<o;a+=4)m=m-p+n(d,a)|0;a<d.length&&(m=m-p+n(d+`XXX`,a)|0),f=i(f,16,4,r(m));let h=`@font-face {font-family:"${d}";src:${`url(data:font/opentype;base64,${btoa(f)});`}}`;this.insertRule(h);let g=this._document.createElement(`div`);g.style.visibility=`hidden`,g.style.width=g.style.height=`10px`,g.style.position=`absolute`,g.style.top=g.style.left=`0px`;for(let t of[e.loadedName,d]){let e=this._document.createElement(`span`);e.textContent=`Hi`,e.style.fontFamily=t,g.append(e)}this._document.body.append(g),u(d,()=>{g.remove(),t.complete()})}},G=new WeakMap,ko=class{constructor(t,n=null,i,a){e(this,`compiledGlyphs`,Object.create(null)),r(this,G,void 0),o(G,this,t),this._inspectFont=n,i&&(this.charProcOperatorList=i),a&&Object.assign(this,a)}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var e;if(!this.data||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${t}}`}return(e=this._inspectFont)==null||e.call(this,this,t),n}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let n=this.loadedName+`_path_`+t,r;try{r=e.get(n)}catch(e){k(`getPathGenerator - ignoring character: "${e}".`)}let i=jt(r==null?void 0:r.path);return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=i}get black(){return a(G,this).black}get bold(){return a(G,this).bold}get disableFontFace(){return a(G,this).disableFontFace}set disableFontFace(e){j(this,`disableFontFace`,!!e)}get fontExtraProperties(){return a(G,this).fontExtraProperties}get isInvalidPDFjsFont(){return a(G,this).isInvalidPDFjsFont}get isType3Font(){return a(G,this).isType3Font}get italic(){return a(G,this).italic}get missingFile(){return a(G,this).missingFile}get remeasure(){return a(G,this).remeasure}get vertical(){return a(G,this).vertical}get ascent(){return a(G,this).ascent}get defaultWidth(){return a(G,this).defaultWidth}get descent(){return a(G,this).descent}get bbox(){return a(G,this).bbox}get fontMatrix(){return a(G,this).fontMatrix}get fallbackName(){return a(G,this).fallbackName}get loadedName(){return a(G,this).loadedName}get mimetype(){return a(G,this).mimetype}get name(){return a(G,this).name}get data(){return a(G,this).data}clearData(){a(G,this).clearData()}get cssFontInfo(){return a(G,this).cssFontInfo}get systemFontInfo(){return a(G,this).systemFontInfo}get defaultVMetrics(){return a(G,this).defaultVMetrics}},Ao=class{};e(Ao,`strings`,[`fontFamily`,`fontWeight`,`italicAngle`]);var jo=class{};e(jo,`strings`,[`css`,`loadedName`,`baseFontName`,`src`]);var Mo=class{};p=Mo,e(Mo,`bools`,[`black`,`bold`,`disableFontFace`,`fontExtraProperties`,`isInvalidPDFjsFont`,`isType3Font`,`italic`,`missingFile`,`remeasure`,`vertical`]),e(Mo,`numbers`,[`ascent`,`defaultWidth`,`descent`]),e(Mo,`strings`,[`fallbackName`,`loadedName`,`mimetype`,`name`]),e(Mo,`OFFSET_NUMBERS`,Math.ceil(p.bools.length*2/8)),e(Mo,`OFFSET_BBOX`,p.OFFSET_NUMBERS+p.numbers.length*8),e(Mo,`OFFSET_FONT_MATRIX`,p.OFFSET_BBOX+1+8),e(Mo,`OFFSET_DEFAULT_VMETRICS`,p.OFFSET_FONT_MATRIX+1+48),e(Mo,`OFFSET_STRINGS`,p.OFFSET_DEFAULT_VMETRICS+1+6);var No=class{};e(No,`KIND`,0),e(No,`HAS_BBOX`,1),e(No,`HAS_BACKGROUND`,2),e(No,`SHADING_TYPE`,3),e(No,`N_COORD`,4),e(No,`N_COLOR`,8),e(No,`N_STOP`,12),e(No,`N_FIGURES`,16);var Po=new WeakMap,Fo=new WeakMap,Io=new WeakMap,Lo=new WeakSet,Ro=class{constructor(e){i(this,Lo),r(this,Po,void 0),r(this,Fo,new TextDecoder),r(this,Io,void 0),o(Po,this,e),o(Io,this,new DataView(e))}get fontFamily(){return n(Lo,this,zo).call(this,0)}get fontWeight(){return n(Lo,this,zo).call(this,1)}get italicAngle(){return n(Lo,this,zo).call(this,2)}};function zo(e){xe(e<Ao.strings.length,`Invalid string index`);let t=0;for(let n=0;n<e;n++)t+=a(Io,this).getUint32(t)+4;let n=a(Io,this).getUint32(t);return a(Fo,this).decode(new Uint8Array(a(Po,this),t+4,n))}var Bo=new WeakMap,Vo=new WeakMap,Ho=new WeakMap,Uo=new WeakSet,Wo=class{constructor(e){i(this,Uo),r(this,Bo,void 0),r(this,Vo,new TextDecoder),r(this,Ho,void 0),o(Bo,this,e),o(Ho,this,new DataView(e))}get guessFallback(){return a(Ho,this).getUint8(0)!==0}get css(){return n(Uo,this,Go).call(this,0)}get loadedName(){return n(Uo,this,Go).call(this,1)}get baseFontName(){return n(Uo,this,Go).call(this,2)}get src(){return n(Uo,this,Go).call(this,3)}get style(){let e=1;e+=4+a(Ho,this).getUint32(e);let t=a(Ho,this).getUint32(e),n=a(Vo,this).decode(new Uint8Array(a(Bo,this),e+4,t));e+=4+t;let r=a(Ho,this).getUint32(e);return{style:n,weight:a(Vo,this).decode(new Uint8Array(a(Bo,this),e+4,r))}}};function Go(e){xe(e<jo.strings.length,`Invalid string index`);let t=5;for(let n=0;n<e;n++)t+=a(Ho,this).getUint32(t)+4;let n=a(Ho,this).getUint32(t);return a(Vo,this).decode(new Uint8Array(a(Bo,this),t+4,n))}var Ko=new WeakMap,qo=new WeakMap,Jo=new WeakMap,Yo=new WeakSet,Xo=class{constructor({buffer:e,extra:t}){i(this,Yo),r(this,Ko,void 0),r(this,qo,new TextDecoder),r(this,Jo,void 0),o(Ko,this,e),o(Jo,this,new DataView(e)),t&&Object.assign(this,t)}get black(){return n(Yo,this,Zo).call(this,0)}get bold(){return n(Yo,this,Zo).call(this,1)}get disableFontFace(){return n(Yo,this,Zo).call(this,2)}get fontExtraProperties(){return n(Yo,this,Zo).call(this,3)}get isInvalidPDFjsFont(){return n(Yo,this,Zo).call(this,4)}get isType3Font(){return n(Yo,this,Zo).call(this,5)}get italic(){return n(Yo,this,Zo).call(this,6)}get missingFile(){return n(Yo,this,Zo).call(this,7)}get remeasure(){return n(Yo,this,Zo).call(this,8)}get vertical(){return n(Yo,this,Zo).call(this,9)}get ascent(){return n(Yo,this,Qo).call(this,0)}get defaultWidth(){return n(Yo,this,Qo).call(this,1)}get descent(){return n(Yo,this,Qo).call(this,2)}get bbox(){return n(Yo,this,$o).call(this,Mo.OFFSET_BBOX,4,`getInt16`,2)}get fontMatrix(){return n(Yo,this,$o).call(this,Mo.OFFSET_FONT_MATRIX,6,`getFloat64`,8)}get defaultVMetrics(){return n(Yo,this,$o).call(this,Mo.OFFSET_DEFAULT_VMETRICS,3,`getInt16`,2)}get fallbackName(){return n(Yo,this,es).call(this,0)}get loadedName(){return n(Yo,this,es).call(this,1)}get mimetype(){return n(Yo,this,es).call(this,2)}get name(){return n(Yo,this,es).call(this,3)}get data(){let{offset:e,length:t}=n(Yo,this,ts).call(this);return t===0?void 0:new Uint8Array(a(Ko,this),e+4,t)}clearData(){let{offset:e,length:t}=n(Yo,this,ts).call(this);t!==0&&(a(Jo,this).setUint32(e,0),o(Ko,this,new Uint8Array(a(Ko,this),0,e+4).slice().buffer),o(Jo,this,new DataView(a(Ko,this))))}get cssFontInfo(){let e=Mo.OFFSET_STRINGS,t=a(Jo,this).getUint32(e);e+=4+t;let n=a(Jo,this).getUint32(e);e+=4+n;let r=a(Jo,this).getUint32(e);if(r===0)return null;let i=new Uint8Array(r);return i.set(new Uint8Array(a(Ko,this),e+4,r)),new Ro(i.buffer)}get systemFontInfo(){let e=Mo.OFFSET_STRINGS,t=a(Jo,this).getUint32(e);e+=4+t;let n=a(Jo,this).getUint32(e);if(n===0)return null;let r=new Uint8Array(n);return r.set(new Uint8Array(a(Ko,this),e+4,n)),new Wo(r.buffer)}};function Zo(e){xe(e<Mo.bools.length,`Invalid boolean index`);let t=Math.floor(e/4),n=e*2%8,r=a(Jo,this).getUint8(t)>>n&3;return r===0?void 0:r===2}function Qo(e){return xe(e<Mo.numbers.length,`Invalid number index`),a(Jo,this).getFloat64(Mo.OFFSET_NUMBERS+e*8)}function $o(e,t,n,r){let i=a(Jo,this).getUint8(e);if(i===0)return;xe(i===t,`Invalid array length.`),e+=1;let o=Array(i);for(let t=0;t<i;t++)o[t]=a(Jo,this)[n](e,!0),e+=r;return o}function es(e){xe(e<Mo.strings.length,`Invalid string index`);let t=Mo.OFFSET_STRINGS+4;for(let n=0;n<e;n++)t+=a(Jo,this).getUint32(t)+4;let n=a(Jo,this).getUint32(t);return a(qo,this).decode(new Uint8Array(a(Ko,this),t+4,n))}function ts(){let e=Mo.OFFSET_STRINGS,t=a(Jo,this).getUint32(e);e+=4+t;let n=a(Jo,this).getUint32(e);e+=4+n;let r=a(Jo,this).getUint32(e);e+=4+r;let i=a(Jo,this).getUint32(e);return{offset:e,length:i}}var ns=class{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){let e=this.view,t=this.data[No.KIND],n=!!this.data[No.HAS_BBOX],r=!!this.data[No.HAS_BACKGROUND],i=e.getUint32(No.N_COORD,!0),a=e.getUint32(No.N_COLOR,!0),o=e.getUint32(No.N_STOP,!0),s=20,c=new Float32Array(this.buffer,s,i*2);s+=i*8;let l=new Uint8Array(this.buffer,s,a*4);s+=a*4;let u=[];for(let t=0;t<o;++t){let t=e.getFloat32(s,!0);s+=4;let n=e.getUint32(s,!0);s+=4,u.push([t,`#${n.toString(16).padStart(6,`0`)}`])}let d=null;if(n){d=[];for(let t=0;t<4;++t)d.push(e.getFloat32(s,!0)),s+=4}let f=null;if(r&&(f=new Uint8Array(this.buffer,s,3),s+=3),t===1)return[`RadialAxial`,`axial`,d,u,Array.from(c.slice(0,2)),Array.from(c.slice(2,4)),null,null];if(t===2)return[`RadialAxial`,`radial`,d,u,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(t===3){let e=this.data[No.SHADING_TYPE],t=null;if(c.length>0){t=te.slice();for(let e=0,n=c.length;e<n;e+=2)M.pointBoundingBox(c[e],c[e+1],t)}return[`Mesh`,e,c,l,i,t,d,f]}throw Error(`Unsupported pattern kind: ${t}`)}},rs=new WeakMap,is=class{constructor(e){r(this,rs,void 0),o(rs,this,e)}get path(){return Ie.isFloat16ArraySupported?new Float16Array(a(rs,this)):new Float32Array(a(rs,this))}};function as(e){if(e instanceof URL)return e;if(typeof e==`string`){if(E){if(/^[a-z][a-z0-9\-+.]+:/i.test(e))return new URL(e);let t=process.getBuiltinModule(`url`);return new URL(t.pathToFileURL(e))}let t=URL.parse(e,window.location);if(t)return t}throw Error(`Invalid PDF url data: either string or URL-object is expected in the url property.`)}function os(e){if(E&&typeof Buffer<`u`&&e instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e==`string`)return Pe(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e==`object`&&!isNaN(e==null?void 0:e.length))return new Uint8Array(e);throw Error(`Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.`)}function ss(e){if(typeof e!=`string`)return null;if(e.endsWith(`/`))return e;throw Error(`Invalid factory url: "${e}" must include trailing slash.`)}var cs=e=>typeof e==`object`&&Number.isInteger(e==null?void 0:e.num)&&e.num>=0&&Number.isInteger(e==null?void 0:e.gen)&&e.gen>=0,ls=Ge.bind(null,cs,e=>typeof e==`object`&&typeof(e==null?void 0:e.name)==`string`),us=new WeakMap,ds=new WeakMap,fs=class{constructor(){r(this,us,new Map),r(this,ds,Promise.resolve())}postMessage(e,t){let n={data:structuredClone(e,t?{transfer:t}:null)};a(ds,this).then(()=>{for(let[e]of a(us,this))e.call(this,n)})}addEventListener(e,t,n=null){let r=null;if((n==null?void 0:n.signal)instanceof AbortSignal){let{signal:i}=n;if(i.aborted){k("LoopbackPort - cannot use an `aborted` signal.");return}let a=()=>this.removeEventListener(e,t);r=()=>i.removeEventListener(`abort`,a),i.addEventListener(`abort`,a)}a(us,this).set(t,r)}removeEventListener(e,t){let n=a(us,this).get(t);n==null||n(),a(us,this).delete(t)}terminate(){for(let[,e]of a(us,this))e==null||e();a(us,this).clear()}},ps={DATA:1,ERROR:2},ms={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function hs(){}function gs(e){if(e instanceof Me||e instanceof ke||e instanceof De||e instanceof Ae||e instanceof Oe)return e;switch(e instanceof Error||typeof e==`object`&&e||A(`wrapReason: Expected "reason" to be a (possibly cloned) Error.`),e.name){case`AbortException`:return new Me(e.message);case`InvalidPDFException`:return new ke(e.message);case`PasswordException`:return new De(e.message,e.code);case`ResponseException`:return new Ae(e.message,e.status,e.missing);case`UnknownErrorException`:return new Oe(e.message,e.details)}return new Oe(e.message,e.toString())}var _s=new WeakMap,vs=new WeakSet,ys=class{constructor(e,t,o){i(this,vs),r(this,_s,new AbortController),this.sourceName=e,this.targetName=t,this.comObj=o,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),o.addEventListener(`message`,n(vs,this,bs).bind(this),{signal:a(_s,this).signal})}on(e,t){let n=this.actionHandler;if(n[e])throw Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){let r=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[r]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},n)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,n,r){let i=this.streamId++,a=this.sourceName,o=this.targetName,s=this.comObj;return new ReadableStream({start:n=>{let c=Promise.withResolvers();return this.streamControllers[i]={controller:n,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},s.postMessage({sourceName:a,targetName:o,action:e,streamId:i,data:t,desiredSize:n.desiredSize},r),c.promise},pull:e=>{let t=Promise.withResolvers();return this.streamControllers[i].pullCall=t,s.postMessage({sourceName:a,targetName:o,stream:ms.PULL,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{xe(e instanceof Error,`cancel must have a valid reason`);let t=Promise.withResolvers();return this.streamControllers[i].cancelCall=t,this.streamControllers[i].isClosed=!0,s.postMessage({sourceName:a,targetName:o,stream:ms.CANCEL,streamId:i,reason:gs(e)}),t.promise}},n)}destroy(){var e;(e=a(_s,this))==null||e.abort(),o(_s,this,null)}};function bs({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){n(vs,this,Ss).call(this,e);return}if(e.callback){let t=e.callbackId,n=this.callbackCapabilities[t];if(!n)throw Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===ps.DATA)n.resolve(e.data);else if(e.callback===ps.ERROR)n.reject(gs(e.reason));else throw Error(`Unexpected callback case`);return}let t=this.actionHandler[e.action];if(!t)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let n=this.sourceName,r=e.sourceName,i=this.comObj;Promise.try(t,e.data).then(function(t){i.postMessage({sourceName:n,targetName:r,callback:ps.DATA,callbackId:e.callbackId,data:t})},function(t){i.postMessage({sourceName:n,targetName:r,callback:ps.ERROR,callbackId:e.callbackId,reason:gs(t)})});return}if(e.streamId){n(vs,this,xs).call(this,e);return}t(e.data)}function xs(e){let t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,a=this,o=this.actionHandler[e.action],s={enqueue(e,a=1,o){if(this.isCancelled)return;let s=this.desiredSize;this.desiredSize-=a,s>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:r,stream:ms.ENQUEUE,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:ms.CLOSE,streamId:t}),delete a.streamSinks[t])},error(e){xe(e instanceof Error,`error must have a valid reason`),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:ms.ERROR,streamId:t,reason:gs(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[t]=s,Promise.try(o,e.data,s).then(function(){i.postMessage({sourceName:n,targetName:r,stream:ms.START_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:ms.START_COMPLETE,streamId:t,reason:gs(e)})})}function Ss(e){let t=e.streamId,r=this.sourceName,i=e.sourceName,a=this.comObj,o=this.streamControllers[t],s=this.streamSinks[t];switch(e.stream){case ms.START_COMPLETE:e.success?o.startCall.resolve():o.startCall.reject(gs(e.reason));break;case ms.PULL_COMPLETE:e.success?o.pullCall.resolve():o.pullCall.reject(gs(e.reason));break;case ms.PULL:if(!s){a.postMessage({sourceName:r,targetName:i,stream:ms.PULL_COMPLETE,streamId:t,success:!0});break}s.desiredSize<=0&&e.desiredSize>0&&s.sinkCapability.resolve(),s.desiredSize=e.desiredSize,Promise.try(s.onPull||hs).then(function(){a.postMessage({sourceName:r,targetName:i,stream:ms.PULL_COMPLETE,streamId:t,success:!0})},function(e){a.postMessage({sourceName:r,targetName:i,stream:ms.PULL_COMPLETE,streamId:t,reason:gs(e)})});break;case ms.ENQUEUE:if(xe(o,`enqueue should have stream controller`),o.isClosed)break;o.controller.enqueue(e.chunk);break;case ms.CLOSE:if(xe(o,`close should have stream controller`),o.isClosed)break;o.isClosed=!0,o.controller.close(),n(vs,this,Cs).call(this,o,t);break;case ms.ERROR:xe(o,`error should have stream controller`),o.controller.error(gs(e.reason)),n(vs,this,Cs).call(this,o,t);break;case ms.CANCEL_COMPLETE:e.success?o.cancelCall.resolve():o.cancelCall.reject(gs(e.reason)),n(vs,this,Cs).call(this,o,t);break;case ms.CANCEL:if(!s)break;let c=gs(e.reason);Promise.try(s.onCancel||hs,c).then(function(){a.postMessage({sourceName:r,targetName:i,stream:ms.CANCEL_COMPLETE,streamId:t,success:!0})},function(e){a.postMessage({sourceName:r,targetName:i,stream:ms.CANCEL_COMPLETE,streamId:t,reason:gs(e)})}),s.sinkCapability.reject(c),s.isCancelled=!0,delete this.streamSinks[t];break;default:throw Error(`Unexpected stream case`)}}async function Cs(e,t){var n,r,i;await Promise.allSettled([(n=e.startCall)==null?void 0:n.promise,(r=e.pullCall)==null?void 0:r.promise,(i=e.cancelCall)==null?void 0:i.promise]),delete this.streamControllers[t]}var ws=new WeakMap,Ts=class{constructor({cMapUrl:e=null,standardFontDataUrl:t=null,wasmUrl:n=null}){r(this,ws,Object.freeze({cMapUrl:`CMap`,standardFontDataUrl:`font`,wasmUrl:`wasm`})),this.cMapUrl=e,this.standardFontDataUrl=t,this.wasmUrl=n}async fetch({kind:e,filename:t}){switch(e){case`cMapUrl`:case`standardFontDataUrl`:case`wasmUrl`:break;default:A(`Not implemented: ${e}`)}let n=this[e];if(!n)throw Error(`Ensure that the \`${e}\` API parameter is provided.`);let r=`${n}${t}`;return this._fetch(r,e).catch(t=>{throw Error(`Unable to load ${a(ws,this)[e]} data at: ${r}`)})}async _fetch(e,t){A("Abstract method `_fetch` called.")}},Es=class extends Ts{async _fetch(e,t){let n=await $e(e,t===`cMapUrl`&&!e.endsWith(`.bcmap`)?`text`:`bytes`);return n instanceof Uint8Array?n:Pe(n)}},Ds=new WeakMap,Os=class{constructor({enableHWA:e=!1}){r(this,Ds,!1),o(Ds,this,e)}create(e,t){if(e<=0||t<=0)throw Error(`Invalid canvas size`);let n=this._createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`,{willReadFrequently:!a(Ds,this)})}}reset({canvas:e},t,n){if(!e)throw Error(`Canvas is not specified`);if(t<=0||n<=0)throw Error(`Invalid canvas size`);e.width=t,e.height=n}destroy(e){let{canvas:t}=e;if(!t)throw Error(`Canvas is not specified`);t.width=t.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){A("Abstract method `_createCanvas` called.")}},ks=class extends Os{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}},As=class{addFilter(e){return`none`}addHCMFilter(e,t){return`none`}addAlphaFilter(e){return`none`}addLuminosityFilter(e){return`none`}addHighlightHCMFilter(e,t,n,r,i){return`none`}destroy(e=!1){}},js=new WeakMap,Ms=new WeakMap,Ns=new WeakMap,Ps=new WeakMap,Fs=new WeakMap,Is=new WeakMap,Ls=new WeakMap,K=new WeakSet,Rs=class extends As{constructor({docId:e,ownerDocument:t=globalThis.document}){super(),i(this,K),r(this,js,void 0),r(this,Ms,void 0),r(this,Ns,void 0),r(this,Ps,void 0),r(this,Fs,void 0),r(this,Is,void 0),r(this,Ls,0),o(Ps,this,e),o(Fs,this,t)}addFilter(e){var t,r;if(!e)return`none`;let i=zs.call(n(K,this)).get(e);if(i)return i;let[s,c,l]=n(K,this,Hs).call(this,e),u=e.length===1?s:`${s}${c}${l}`;if(i=zs.call(n(K,this)).get(u),i)return zs.call(n(K,this)).set(e,i),i;let d=`g_${a(Ps,this)}_transfer_map_${o(Ls,this,(t=a(Ls,this),r=t++,t)),r}`,f=n(K,this,Us).call(this,d);zs.call(n(K,this)).set(e,f),zs.call(n(K,this)).set(u,f);let p=n(K,this,Ks).call(this,d);return n(K,this,Js).call(this,s,c,l,p),f}addHCMFilter(e,t){let r=`${e}-${t}`,i=`base`,o=Bs.call(n(K,this)).get(i);if((o==null?void 0:o.key)===r)return o.url;if(o){var s;(s=o.filter)==null||s.remove(),o.key=r,o.url=`none`,o.filter=null}else o={key:r,url:`none`,filter:null},Bs.call(n(K,this)).set(i,o);if(!e||!t)return o.url;let c=n(K,this,Xs).call(this,e);e=M.makeHexColor(...c);let l=n(K,this,Xs).call(this,t);if(t=M.makeHexColor(...l),Vs.call(n(K,this)).style.color=``,e===`#000000`&&t===`#ffffff`||e===t)return o.url;let u=Array(256);for(let e=0;e<=255;e++){let t=e/255;u[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}let d=u.join(`,`),f=`g_${a(Ps,this)}_hcm_filter`,p=o.filter=n(K,this,Ks).call(this,f);n(K,this,Js).call(this,d,d,d,p),n(K,this,Gs).call(this,p);let m=(e,t)=>{let n=c[e]/255,r=l[e]/255,i=Array(t+1);for(let e=0;e<=t;e++)i[e]=n+e/t*(r-n);return i.join(`,`)};return n(K,this,Js).call(this,m(0,5),m(1,5),m(2,5),p),o.url=n(K,this,Us).call(this,f),o.url}addAlphaFilter(e){var t,r;let i=zs.call(n(K,this)).get(e);if(i)return i;let[s]=n(K,this,Hs).call(this,[e]),c=`alpha_${s}`;if(i=zs.call(n(K,this)).get(c),i)return zs.call(n(K,this)).set(e,i),i;let l=`g_${a(Ps,this)}_alpha_map_${o(Ls,this,(t=a(Ls,this),r=t++,t)),r}`,u=n(K,this,Us).call(this,l);zs.call(n(K,this)).set(e,u),zs.call(n(K,this)).set(c,u);let d=n(K,this,Ks).call(this,l);return n(K,this,Ys).call(this,s,d),u}addLuminosityFilter(e){var t,r;let i=zs.call(n(K,this)).get(e||`luminosity`);if(i)return i;let s,c;if(e?([s]=n(K,this,Hs).call(this,[e]),c=`luminosity_${s}`):c=`luminosity`,i=zs.call(n(K,this)).get(c),i)return zs.call(n(K,this)).set(e,i),i;let l=`g_${a(Ps,this)}_luminosity_map_${o(Ls,this,(t=a(Ls,this),r=t++,t)),r}`,u=n(K,this,Us).call(this,l);zs.call(n(K,this)).set(e,u),zs.call(n(K,this)).set(c,u);let d=n(K,this,Ks).call(this,l);return n(K,this,Ws).call(this,d),e&&n(K,this,Ys).call(this,s,d),u}addHighlightHCMFilter(e,t,r,i,o){let s=`${t}-${r}-${i}-${o}`,c=Bs.call(n(K,this)).get(e);if((c==null?void 0:c.key)===s)return c.url;if(c){var l;(l=c.filter)==null||l.remove(),c.key=s,c.url=`none`,c.filter=null}else c={key:s,url:`none`,filter:null},Bs.call(n(K,this)).set(e,c);if(!t||!r)return c.url;let[u,d]=[t,r].map(n(K,this,Xs).bind(this)),f=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),p=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[m,h]=[i,o].map(n(K,this,Xs).bind(this));p<f&&([f,p,m,h]=[p,f,h,m]),Vs.call(n(K,this)).style.color=``;let g=(e,t,n)=>{let r=Array(256),i=(p-f)/n,a=e/255,o=(t-e)/(255*n),s=0;for(let e=0;e<=n;e++){let t=Math.round(f+e*i),n=a+e*o;for(let e=s;e<=t;e++)r[e]=n;s=t+1}for(let e=s;e<256;e++)r[e]=r[s-1];return r.join(`,`)},_=`g_${a(Ps,this)}_hcm_${e}_filter`,v=c.filter=n(K,this,Ks).call(this,_);return n(K,this,Gs).call(this,v),n(K,this,Js).call(this,g(m[0],h[0],5),g(m[1],h[1],5),g(m[2],h[2],5),v),c.url=n(K,this,Us).call(this,_),c.url}destroy(e=!1){var t,n,r,i;e&&(t=a(Is,this))!=null&&t.size||((n=a(Ns,this))==null||n.parentNode.parentNode.remove(),o(Ns,this,null),(r=a(Ms,this))==null||r.clear(),o(Ms,this,null),(i=a(Is,this))==null||i.clear(),o(Is,this,null),o(Ls,this,0))}};function zs(){return a(Ms,this)||o(Ms,this,new Map)}function Bs(){return a(Is,this)||o(Is,this,new Map)}function Vs(){if(!a(Ns,this)){let e=a(Fs,this).createElement(`div`),{style:t}=e;t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=a(Fs,this).createElementNS(Ze,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),o(Ns,this,a(Fs,this).createElementNS(Ze,`defs`)),e.append(n),n.append(a(Ns,this)),a(Fs,this).body.append(e)}return a(Ns,this)}function Hs(e){if(e.length===1){let t=e[0],n=Array(256);for(let e=0;e<256;e++)n[e]=t[e]/255;let r=n.join(`,`);return[r,r,r]}let[t,n,r]=e,i=Array(256),a=Array(256),o=Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255,a[e]=n[e]/255,o[e]=r[e]/255;return[i.join(`,`),a.join(`,`),o.join(`,`)]}function Us(e){if(a(js,this)===void 0){o(js,this,``);let e=a(Fs,this).URL;e!==a(Fs,this).baseURI&&(nt(e)?k(`#createUrl: ignore "data:"-URL for performance reasons.`):o(js,this,we(e,``)))}return`url(${a(js,this)}#${e})`}function Ws(e){let t=a(Fs,this).createElementNS(Ze,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0`),e.append(t)}function Gs(e){let t=a(Fs,this).createElementNS(Ze,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0`),e.append(t)}function Ks(e){let t=a(Fs,this).createElementNS(Ze,`filter`);return t.setAttribute(`color-interpolation-filters`,`sRGB`),t.setAttribute(`id`,e),Vs.call(n(K,this)).append(t),t}function qs(e,t,n){let r=a(Fs,this).createElementNS(Ze,t);r.setAttribute(`type`,`discrete`),r.setAttribute(`tableValues`,n),e.append(r)}function Js(e,t,r,i){let o=a(Fs,this).createElementNS(Ze,`feComponentTransfer`);i.append(o),n(K,this,qs).call(this,o,`feFuncR`,e),n(K,this,qs).call(this,o,`feFuncG`,t),n(K,this,qs).call(this,o,`feFuncB`,r)}function Ys(e,t){let r=a(Fs,this).createElementNS(Ze,`feComponentTransfer`);t.append(r),n(K,this,qs).call(this,r,`feFuncA`,e)}function Xs(e){return Vs.call(n(K,this)).style.color=e,ht(getComputedStyle(Vs.call(n(K,this))).getPropertyValue(`color`))}E&&k("Please use the `legacy` build in Node.js environments.");async function Zs(e){let t=await process.getBuiltinModule(`fs/promises`).readFile(e);return new Uint8Array(t)}var Qs=class extends As{},$s=class extends Os{_createCanvas(e,t){return process.getBuiltinModule(`module`).createRequire(import.meta.url)(`@napi-rs/canvas`).createCanvas(e,t)}},ec=class extends Ts{async _fetch(e,t){return Zs(e)}},tc=`
1
+ import{$ as e,h as t}from"./index-BTFXLjRb.js";import{a as n,i as r,n as i,r as a,t as o}from"./classPrivateFieldSet2-DSsIYuru.js";function s(e,t,n){t||(t=[]);var r=t.length++;return Object.defineProperty({},`_`,{set:function(i){t[r]=i,e.apply(n,t)}})}var c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,ee={};ee.d=(e,t)=>{for(var n in t)ee.o(t,n)&&!ee.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},ee.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var E=typeof process==`object`&&process+``==`[object process]`&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!==`browser`),te=[1/0,1/0,-1/0,-1/0],ne=new Float32Array(te),re=[.001,0,0,.001,0,0],ie=1.35;.35/ie;var ae={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},oe={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},se=`pdfjs_internal_editor_`,D={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},O={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},ce={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},le={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},ue={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},de={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},fe={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},pe={ERRORS:0,WARNINGS:1,INFOS:5},me={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,rawFillPath:94},he={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},ge={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},_e=pe.WARNINGS;function ve(e){Number.isInteger(e)&&(_e=e)}function ye(){return _e}function be(e){_e>=pe.INFOS&&console.info(`Info: ${e}`)}function k(e){_e>=pe.WARNINGS&&console.warn(`Warning: ${e}`)}function A(e){throw Error(e)}function xe(e,t){e||A(t)}function Se(e){switch(e==null?void 0:e.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function Ce(e,t=null,n=null){if(!e)return null;if(n&&typeof e==`string`){if(n.addDefaultProtocol&&e.startsWith(`www.`)){let t=e.match(/\./g);(t==null?void 0:t.length)>=2&&(e=`http://${e}`)}if(n.tryConvertEncoding)try{e=ze(e)}catch{}}let r=t?URL.parse(e,t):URL.parse(e);return Se(r)?r:null}function we(e,t,n=!1){let r=URL.parse(e);return r?(r.hash=t,r.href):n&&Ce(e,`http://example.com`)?e.split(`#`,1)[0]+`${t?`#${t}`:``}`:``}function Te(e){return e.substring(e.lastIndexOf(`/`)+1)}function j(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}var Ee=function(){function e(e,t){this.message=e,this.name=t}return e.prototype=Error(),e.constructor=e,e}(),De=class extends Ee{constructor(e,t){super(e,`PasswordException`),this.code=t}},Oe=class extends Ee{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}},ke=class extends Ee{constructor(e){super(e,`InvalidPDFException`)}},Ae=class extends Ee{constructor(e,t,n){super(e,`ResponseException`),this.status=t,this.missing=n}},je=class extends Ee{constructor(e){super(e,`FormatError`)}},Me=class extends Ee{constructor(e){super(e,`AbortException`)}};function Ne(e){(typeof e!=`object`||(e==null?void 0:e.length)===void 0)&&A(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);let r=[];for(let i=0;i<t;i+=n){let a=Math.min(i+n,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join(``)}function Pe(e){typeof e!=`string`&&A(`Invalid argument for stringToBytes`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}function Fe(){let e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}var Ie=class{static get isLittleEndian(){return j(this,`isLittleEndian`,Fe())}static get isOffscreenCanvasSupported(){return j(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get isImageDecoderSupported(){return j(this,`isImageDecoderSupported`,typeof ImageDecoder<`u`)}static get isFloat16ArraySupported(){return j(this,`isFloat16ArraySupported`,typeof Float16Array<`u`)}static get isSanitizerSupported(){return j(this,`isSanitizerSupported`,typeof Sanitizer<`u`)}static get platform(){let{platform:e,userAgent:t}=navigator;return j(this,`platform`,{isAndroid:t.includes(`Android`),isLinux:e.includes(`Linux`),isMac:e.includes(`Mac`),isWindows:e.includes(`Win`),isFirefox:t.includes(`Firefox`)})}static get isCSSRoundSupported(){var e,t;return j(this,`isCSSRoundSupported`,(e=globalThis.CSS)==null||(t=e.supports)==null?void 0:t.call(e,`width: round(1.5px, 1px)`))}static get isAlphaColorInputSupported(){return j(this,`isAlphaColorInputSupported`,(()=>{if(typeof document>`u`)return!1;let e=document.createElement(`input`);return e.type=`color`,e.setAttribute(`alpha`,``),e.value=`#ff000080`,e.value!==`#ff0000`})())}},M=class e{static get hexNums(){return j(this,`hexNums`,Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,`0`)))}static makeHexColor(e,t,n){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[n]}`}static domMatrixToTransform(e){return[e.a,e.b,e.c,e.d,e.e,e.f]}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[0],t[2]*=e[0],e[3]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[1],t[1]=n,n=t[2],t[2]=t[3],t[3]=n,e[1]<0&&(n=t[1],t[1]=t[3],t[3]=n),t[1]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[2],t[2]=n),t[0]*=e[2],t[2]*=e[2]),t[0]+=e[4],t[1]+=e[5],t[2]+=e[4],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,n=0){let r=e[n],i=e[n+1];e[n]=r*t[0]+i*t[2]+t[4],e[n+1]=r*t[1]+i*t[3]+t[5]}static applyTransformToBezier(e,t,n=0){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];for(let t=0;t<6;t+=2){let l=e[n+t],u=e[n+t+1];e[n+t]=l*r+u*a+s,e[n+t+1]=l*i+u*o+c}}static applyInverseTransform(e,t){let n=e[0],r=e[1],i=t[0]*t[3]-t[1]*t[2];e[0]=(n*t[3]-r*t[2]+t[2]*t[5]-t[4]*t[3])/i,e[1]=(-n*t[1]+r*t[0]+t[4]*t[1]-t[5]*t[0])/i}static axialAlignedBoundingBox(e,t,n){let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=e[0],u=e[1],d=e[2],f=e[3],p=r*l+s,m=p,h=r*d+s,g=h,_=o*u+c,v=_,y=o*f+c,b=y;if(i!==0||a!==0){let e=i*l,t=i*d,n=a*u,r=a*f;p+=n,g+=n,h+=r,m+=r,_+=e,b+=e,y+=t,v+=t}n[0]=Math.min(n[0],p,h,m,g),n[1]=Math.min(n[1],_,y,v,b),n[2]=Math.max(n[2],p,h,m,g),n[3]=Math.max(n[3],_,y,v,b)}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=n**2+r**2,s=n*i+r*a,c=i**2+a**2,l=(o+c)/2,u=Math.sqrt(l**2-(o*c-s**2));t[0]=Math.sqrt(l+u||1),t[1]=Math.sqrt(l-u||1)}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]}static pointBoundingBox(e,t,n){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}static rectBoundingBox(e,t,n,r,i){i[0]=Math.min(i[0],e,n),i[1]=Math.min(i[1],t,r),i[2]=Math.max(i[2],e,n),i[3]=Math.max(i[3],t,r)}static bezierBoundingBox(t,r,i,a,o,s,c,l,u){u[0]=Math.min(u[0],t,c),u[1]=Math.min(u[1],r,l),u[2]=Math.max(u[2],t,c),u[3]=Math.max(u[3],r,l),n(e,this,Re).call(this,t,i,o,c,r,a,s,l,3*(-t+3*(i-o)+c),6*(t-2*i+o),3*(i-t),u),n(e,this,Re).call(this,t,i,o,c,r,a,s,l,3*(-r+3*(a-s)+l),6*(r-2*a+s),3*(a-r),u)}};c=M;function Le(e,t,n,r,i,a,o,s,c,l){if(c<=0||c>=1)return;let u=1-c,d=c*c,f=d*c,p=u*(u*(u*e+3*c*t)+3*d*n)+f*r,m=u*(u*(u*i+3*c*a)+3*d*o)+f*s;l[0]=Math.min(l[0],p),l[1]=Math.min(l[1],m),l[2]=Math.max(l[2],p),l[3]=Math.max(l[3],m)}function Re(e,t,r,i,a,o,s,l,u,d,f,p){if(Math.abs(u)<1e-12){Math.abs(d)>=1e-12&&n(c,this,Le).call(this,e,t,r,i,a,o,s,l,-f/d,p);return}let m=d**2-4*f*u;if(m<0)return;let h=Math.sqrt(m),g=2*u;n(c,this,Le).call(this,e,t,r,i,a,o,s,l,(-d+h)/g,p),n(c,this,Le).call(this,e,t,r,i,a,o,s,l,(-d-h)/g,p)}function ze(e){return decodeURIComponent(escape(e))}var Be=null,Ve=null;function He(e){return Be||(Be=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Ve=new Map([[`ſt`,`ſt`]])),e.replaceAll(Be,(e,t,n)=>t?t.normalize(`NFKC`):Ve.get(n))}function Ue(){if(typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(32);return crypto.getRandomValues(e),Ne(e)}var We=`pdfjs_internal_id_`;function Ge(e,t,n){if(!Array.isArray(n)||n.length<2)return!1;let[r,i,...a]=n;if(!e(r)&&!Number.isInteger(r)||!t(i))return!1;let o=a.length,s=!0;switch(i.name){case`XYZ`:if(o<2||o>3)return!1;break;case`Fit`:case`FitB`:return o===0;case`FitH`:case`FitBH`:case`FitV`:case`FitBV`:if(o>1)return!1;break;case`FitR`:if(o!==4)return!1;s=!1;break;default:return!1}for(let e of a)if(!(typeof e==`number`||s&&e===null))return!1;return!0}var Ke=()=>[],qe=()=>new Map,Je=()=>Object.create(null);function N(e,t,n){return Math.min(Math.max(e,t),n)}var Ye=class e{static textContent(t){let n=[],r={items:n,styles:Object.create(null)};function i(t){var r;if(!t)return;let a=null,o=t.name;if(o===`#text`)a=t.value;else if(e.shouldBuildText(o))!(t==null||(r=t.attributes)==null)&&r.textContent?a=t.attributes.textContent:t.value&&(a=t.value);else return;if(a!==null&&n.push({str:a}),t.children)for(let e of t.children)i(e)}return i(t),r}static shouldBuildText(e){return!(e===`textarea`||e===`input`||e===`option`||e===`select`)}},Xe=class{static setupStorage(e,t,n,r,i){let a=r.getValue(t,{value:null});switch(n.name){case`textarea`:if(a.value!==null&&(e.textContent=a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})});break;case`input`:if(n.attributes.type===`radio`||n.attributes.type===`checkbox`){if(a.value===n.attributes.xfaOn?e.setAttribute(`checked`,!0):a.value===n.attributes.xfaOff&&e.removeAttribute(`checked`),i===`print`)break;e.addEventListener(`change`,e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute(`xfaOn`):e.target.getAttribute(`xfaOff`)})})}else{if(a.value!==null&&e.setAttribute(`value`,a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})})}break;case`select`:if(a.value!==null){e.setAttribute(`value`,a.value);for(let e of n.children)e.attributes.value===a.value?e.attributes.selected=!0:Object.hasOwn(e.attributes,`selected`)&&delete e.attributes.selected}e.addEventListener(`input`,e=>{let n=e.target.options,i=n.selectedIndex===-1?``:n[n.selectedIndex].value;r.setValue(t,{value:i})});break}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){let{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type===`radio`&&(a.name=`${a.name}-${r}`);for(let[t,n]of Object.entries(a))if(n!=null)switch(t){case`class`:n.length&&e.setAttribute(t,n.join(` `));break;case`dataId`:break;case`id`:e.setAttribute(`data-element-id`,n);break;case`style`:Object.assign(e.style,n);break;case`textContent`:e.textContent=n;break;default:(!o||t!==`href`&&t!==`newWindow`)&&e.setAttribute(t,n)}o&&i.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,t,n)}static render(e){let t=e.annotationStorage,n=e.linkService,r=e.xfaHtml,i=e.intent||`display`,a=document.createElement(r.name);r.attributes&&this.setAttributes({html:a,element:r,intent:i,linkService:n});let o=i!==`richText`,s=e.div;if(s.append(a),e.viewport){let t=`matrix(${e.viewport.transform.join(`,`)})`;s.style.transform=t}o&&s.setAttribute(`class`,`xfaLayer xfaFont`);let c=[];if(r.children.length===0){if(r.value){let e=document.createTextNode(r.value);a.append(e),o&&Ye.shouldBuildText(r.name)&&c.push(e)}return{textDivs:c}}let l=[[r,-1,a]];for(;l.length>0;){var u,d;let[e,r,a]=l.at(-1);if(r+1===e.children.length){l.pop();continue}let s=e.children[++l.at(-1)[1]];if(s===null)continue;let{name:f}=s;if(f===`#text`){let e=document.createTextNode(s.value);c.push(e),a.append(e);continue}let p=!(s==null||(u=s.attributes)==null)&&u.xmlns?document.createElementNS(s.attributes.xmlns,f):document.createElement(f);if(a.append(p),s.attributes&&this.setAttributes({html:p,element:s,storage:t,intent:i,linkService:n}),((d=s.children)==null?void 0:d.length)>0)l.push([s,-1,p]);else if(s.value){let e=document.createTextNode(s.value);o&&Ye.shouldBuildText(f)&&c.push(e),p.append(e)}}for(let e of s.querySelectorAll(`.xfaNonInteractive input, .xfaNonInteractive textarea`))e.setAttribute(`readOnly`,!0);return{textDivs:c}}static update(e){let t=`matrix(${e.viewport.transform.join(`,`)})`;e.div.style.transform=t,e.div.hidden=!1}},Ze=`http://www.w3.org/2000/svg`,Qe=class{};l=Qe,e(Qe,`CSS`,96),e(Qe,`PDF`,72),e(Qe,`PDF_TO_CSS_UNITS`,l.CSS/l.PDF);async function $e(e,t=`text`){if(ct(e,document.baseURI)){let n=await fetch(e);if(!n.ok)throw Error(n.statusText);switch(t){case`blob`:return n.blob();case`bytes`:return n.bytes();case`json`:return n.json()}return n.text()}return new Promise((n,r)=>{let i=new XMLHttpRequest;i.open(`GET`,e,!0),i.responseType=t===`bytes`?`arraybuffer`:t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case`bytes`:n(new Uint8Array(i.response));return;case`blob`:case`json`:n(i.response);return}n(i.responseText);return}r(Error(i.statusText))}},i.send(null)})}var et=class e{constructor({viewBox:e,userUnit:t,scale:n,rotation:r,offsetX:i=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=n,this.rotation=r,this.offsetX=i,this.offsetY=a,n*=t;let s=(e[2]+e[0])/2,c=(e[3]+e[1])/2,l,u,d,f;switch(r%=360,r<0&&(r+=360),r){case 180:l=-1,u=0,d=0,f=1;break;case 90:l=0,u=1,d=1,f=0;break;case 270:l=0,u=-1,d=-1,f=0;break;case 0:l=1,u=0,d=0,f=-1;break;default:throw Error(`PageViewport: Invalid rotation, must be a multiple of 90 degrees.`)}o&&(d=-d,f=-f);let p,m,h,g;l===0?(p=Math.abs(c-e[1])*n+i,m=Math.abs(s-e[0])*n+a,h=(e[3]-e[1])*n,g=(e[2]-e[0])*n):(p=Math.abs(s-e[0])*n+i,m=Math.abs(c-e[1])*n+a,h=(e[2]-e[0])*n,g=(e[3]-e[1])*n),this.transform=[l*n,u*n,d*n,f*n,p-l*n*s-d*n*c,m-u*n*s-f*n*c],this.width=h,this.height=g}get rawDims(){let e=this.viewBox;return j(this,`rawDims`,{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:t=this.scale,rotation:n=this.rotation,offsetX:r=this.offsetX,offsetY:i=this.offsetY,dontFlip:a=!1}={}){return new e({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:n,offsetX:r,offsetY:i,dontFlip:a})}convertToViewportPoint(e,t){let n=[e,t];return M.applyTransform(n,this.transform),n}convertToViewportRectangle(e){let t=[e[0],e[1]];M.applyTransform(t,this.transform);let n=[e[2],e[3]];return M.applyTransform(n,this.transform),[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){let n=[e,t];return M.applyInverseTransform(n,this.transform),n}},tt=class extends Ee{constructor(e,t=0){super(e,`RenderingCancelledException`),this.extraDelay=t}};function nt(e){let t=e.length,n=0;for(;n<t&&e[n].trim()===``;)n++;return e.substring(n,n+5).toLowerCase()===`data:`}function rt(e){return typeof e==`string`&&/\.pdf$/i.test(e)}function it(e){return[e]=e.split(/[#?]/,1),Te(e)}function at(e,t=`document.pdf`){if(typeof e!=`string`)return t;if(nt(e))return k(`getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.`),t;let n=(e=>{try{return new URL(e)}catch{try{return new URL(decodeURIComponent(e))}catch{try{return new URL(e,`https://foo.bar`)}catch{try{return new URL(decodeURIComponent(e),`https://foo.bar`)}catch{return null}}}}})(e);if(!n)return t;let r=e=>{try{let t=decodeURIComponent(e);return t.includes(`/`)&&(t=Te(t),/^\.pdf$/i.test(t))?e:t}catch{return e}},i=/\.pdf$/i,a=Te(n.pathname);if(i.test(a))return r(a);if(n.searchParams.size>0){let e=e=>[...e].findLast(e=>i.test(e)),t=e(n.searchParams.values())??e(n.searchParams.keys());if(t)return r(t)}if(n.hash){let e=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(n.hash);if(e)return r(e[0])}return t}var ot=new WeakMap,st=class{constructor(){r(this,ot,new Map),e(this,`times`,[])}time(e){a(ot,this).has(e)&&k(`Timer is already running for ${e}`),a(ot,this).set(e,Date.now())}timeEnd(e){a(ot,this).has(e)||k(`Timer has not been started for ${e}`),this.times.push({name:e,start:a(ot,this).get(e),end:Date.now()}),a(ot,this).delete(e)}toString(){let e=Math.max(...this.times.map(e=>e.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}ms\n`).join(``)}};function ct(e,t){let n=t?URL.parse(e,t):URL.parse(e);return/https?:/.test((n==null?void 0:n.protocol)??``)}function lt(e){e.preventDefault()}function P(e){e.preventDefault(),e.stopPropagation()}function ut(e){console.log(`Deprecated API usage: `+e)}var dt=class e{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!=`string`)return null;n(e,this,ft)._||(ft._=n(e,this,null));let r=n(e,this,ft)._.exec(t);if(!r)return null;let i=parseInt(r[1],10),a=parseInt(r[2],10);a=a>=1&&a<=12?a-1:0;let o=parseInt(r[3],10);o=o>=1&&o<=31?o:1;let s=parseInt(r[4],10);s=s>=0&&s<=23?s:0;let c=parseInt(r[5],10);c=c>=0&&c<=59?c:0;let l=parseInt(r[6],10);l=l>=0&&l<=59?l:0;let u=r[7]||`Z`,d=parseInt(r[8],10);d=d>=0&&d<=23?d:0;let f=parseInt(r[9],10)||0;return f=f>=0&&f<=59?f:0,u===`-`?(s+=d,c+=f):u===`+`&&(s-=d,c-=f),new Date(Date.UTC(i,a,o,s,c,l))}},ft={_:void 0};function pt(e,{scale:t=1,rotation:n=0}){let{width:r,height:i}=e.attributes.style;return new et({viewBox:[0,0,parseInt(r,10),parseInt(i,10)],userUnit:1,scale:t,rotation:n})}function mt(e){if(e.startsWith(`#`)){let t=e.slice(1);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),t.length>=8?parseInt(t.slice(6,8),16)/255:1]}if(e.startsWith(`rgb(`)){let[t,n,r]=e.slice(4,-1).split(`,`).map(e=>parseInt(e,10));return[t,n,r,1]}if(e.startsWith(`rgba(`)){let t=e.slice(5,-1).split(`,`);return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3])]}let t=e.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!==`none`?parseFloat(t[4]):1]:null}function ht(e){let t=mt(e);return t?t.slice(0,3):(k(`Not a valid color format: "${e}"`),[0,0,0])}function gt(e){let t=document.createElement(`span`);t.style.visibility=`hidden`,t.style.colorScheme=`only light`,document.body.append(t);for(let n of e.keys()){t.style.color=n;let r=window.getComputedStyle(t).color;e.set(n,ht(r))}t.remove()}function F(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform();return[t,n,r,i,a,o]}function _t(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform().invertSelf();return[t,n,r,i,a,o]}function vt(e,t,n=!1,r=!0){if(t instanceof et){let{pageWidth:r,pageHeight:i}=t.rawDims,{style:a}=e,o=Ie.isCSSRoundSupported,s=`var(--total-scale-factor) * ${r}px`,c=`var(--total-scale-factor) * ${i}px`,l=o?`round(down, ${s}, var(--scale-round-x))`:`calc(${s})`,u=o?`round(down, ${c}, var(--scale-round-y))`:`calc(${c})`;!n||t.rotation%180==0?(a.width=l,a.height=u):(a.width=u,a.height=l)}r&&e.setAttribute(`data-main-rotation`,t.rotation)}var yt=class e{constructor(){let{pixelRatio:t}=e;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,n,r,i,a=-1){let o=1/0,s=1/0,c=1/0;r=e.capPixels(r,a),r>0&&(o=Math.sqrt(r/(t*n))),i!==-1&&(s=i/t,c=i/n);let l=Math.min(o,s,c);return this.sx>l||this.sy>l?(this.sx=l,this.sy=l,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){let n=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,n):n}return e}},bt=[`image/apng`,`image/avif`,`image/bmp`,`image/gif`,`image/jpeg`,`image/png`,`image/svg+xml`,`image/webp`,`image/x-icon`],xt=class{static get isDarkMode(){var e,t;return j(this,`isDarkMode`,!!(!((e=window)==null||(t=e.matchMedia)==null)&&t.call(e,`(prefers-color-scheme: dark)`).matches))}},St=class{static get commentForegroundColor(){let e=document.createElement(`span`);e.classList.add(`comment`,`sidebar`);let{style:t}=e;t.width=t.height=`0`,t.display=`none`,t.color=`var(--comment-fg-color)`,document.body.append(e);let{color:n}=window.getComputedStyle(e);return e.remove(),j(this,`commentForegroundColor`,ht(n))}};function Ct(e,t){t=N(t??1,0,1);let n=255*(1-t);return e.map(e=>Math.round(e*t+n))}function wt(e,t){let n=e[0]/255,r=e[1]/255,i=e[2]/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(a+o)/2;if(a===o)t[0]=t[1]=0;else{let e=a-o;switch(t[1]=s<.5?e/(a+o):e/(2-a-o),a){case n:t[0]=((r-i)/e+(r<i?6:0))*60;break;case r:t[0]=((i-n)/e+2)*60;break;case i:t[0]=((n-r)/e+4)*60;break}}t[2]=s}function Tt(e,t){let n=e[0],r=e[1],i=e[2],a=(1-Math.abs(2*i-1))*r,o=a*(1-Math.abs(n/60%2-1)),s=i-a/2;switch(Math.floor(n/60)){case 0:t[0]=a+s,t[1]=o+s,t[2]=s;break;case 1:t[0]=o+s,t[1]=a+s,t[2]=s;break;case 2:t[0]=s,t[1]=a+s,t[2]=o+s;break;case 3:t[0]=s,t[1]=o+s,t[2]=a+s;break;case 4:t[0]=o+s,t[1]=s,t[2]=a+s;break;case 5:case 6:t[0]=a+s,t[1]=s,t[2]=o+s;break}}function Et(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function Dt(e,t,n){Tt(e,n),n.map(Et);let r=.2126*n[0]+.7152*n[1]+.0722*n[2];Tt(t,n),n.map(Et);let i=.2126*n[0]+.7152*n[1]+.0722*n[2];return r>i?(r+.05)/(i+.05):(i+.05)/(r+.05)}var Ot=new Map;function kt(e,t){let n=e[0]+e[1]*256+e[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,r=Ot.get(n);if(r)return r;let i=new Float32Array(9),a=i.subarray(0,3),o=i.subarray(3,6);wt(e,o);let s=i.subarray(6,9);wt(t,s);let c=s[2]<.5,l=c?12:4.5;if(o[2]=c?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),Dt(o,s,a)<l){let e,t;for(c?(e=o[2],t=1):(e=0,t=o[2]);t-e>.005;){let n=o[2]=(e+t)/2;c===Dt(o,s,a)<l?e=n:t=n}o[2]=c?t:e}return Tt(o,a),r=M.makeHexColor(Math.round(a[0]*255),Math.round(a[1]*255),Math.round(a[2]*255)),Ot.set(n,r),r}function At({html:e,dir:t,className:n},r){let i=document.createDocumentFragment();if(typeof e==`string`){let n=document.createElement(`p`);n.dir=t||`auto`;let r=e.split(/(?:\r\n?|\n)/);for(let e=0,t=r.length;e<t;++e){let i=r[e];n.append(document.createTextNode(i)),e<t-1&&n.append(document.createElement(`br`))}i.append(n)}else Xe.render({xfaHtml:e,div:i,intent:`richText`});i.firstElementChild.classList.add(`richText`,n),r.append(i)}function jt(e){let t=new Path2D;if(!e)return t;for(let n=0,r=e.length;n<r;)switch(e[n++]){case he.moveTo:t.moveTo(e[n++],e[n++]);break;case he.lineTo:t.lineTo(e[n++],e[n++]);break;case he.curveTo:t.bezierCurveTo(e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]);break;case he.quadraticCurveTo:t.quadraticCurveTo(e[n++],e[n++],e[n++],e[n++]);break;case he.closePath:t.closePath();break;default:k(`Unrecognized drawing path operator: ${e[n-1]}`);break}return t}var Mt=new WeakMap,Nt=new WeakMap,Pt=new WeakMap,Ft=new WeakMap,It=new WeakMap,Lt=new WeakMap,Rt=new WeakMap,zt=new WeakMap,Bt=new WeakSet,Vt=class{constructor(e){i(this,Bt),r(this,Mt,null),r(this,Nt,null),r(this,Pt,void 0),r(this,Ft,null),r(this,It,null),r(this,Lt,null),r(this,Rt,null),r(this,zt,null),o(Pt,this,e),qt._||(qt._=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`,signature:`pdfjs-editor-remove-signature-button`}))}render(){let e=o(Mt,this,document.createElement(`div`));e.classList.add(`editToolbar`,`hidden`),e.setAttribute(`role`,`toolbar`);let t=a(Pt,this)._uiManager._signal;t instanceof AbortSignal&&!t.aborted&&(e.addEventListener(`contextmenu`,lt,{signal:t}),e.addEventListener(`pointerdown`,Ht,{signal:t}));let n=o(Ft,this,document.createElement(`div`));n.className=`buttons`,e.append(n);let r=a(Pt,this).toolbarPosition;if(r){let{style:t}=e;t.insetInlineEnd=`${100*(a(Pt,this)._uiManager.direction===`ltr`?1-r[0]:r[0])}%`,t.top=`calc(${100*r[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return a(Mt,this)}hide(){var e;a(Mt,this).classList.add(`hidden`),(e=a(Nt,this))==null||e.hideDropdown()}show(){var e,t;a(Mt,this).classList.remove(`hidden`),(e=a(It,this))==null||e.shown(),(t=a(Lt,this))==null||t.shown()}addDeleteButton(){let{editorType:e,_uiManager:t}=a(Pt,this),r=document.createElement(`button`);r.classList.add(`basic`,`deleteButton`),r.tabIndex=0,r.setAttribute(`data-l10n-id`,qt._[e]),n(Bt,this,Gt).call(this,r)&&r.addEventListener(`click`,e=>{t.delete()},{signal:t._signal}),a(Ft,this).append(r)}async addAltText(e){let t=await e.render();n(Bt,this,Gt).call(this,t),a(Ft,this).append(t,Kt.call(n(Bt,this))),o(It,this,e)}addComment(e,t=null){if(a(Lt,this))return;let r=e.renderForToolbar();if(!r)return;n(Bt,this,Gt).call(this,r);let i=o(Rt,this,Kt.call(n(Bt,this)));t?(a(Ft,this).insertBefore(r,t),a(Ft,this).insertBefore(i,t)):a(Ft,this).append(r,i),o(Lt,this,e),e.toolbar=this}addColorPicker(e){if(a(Nt,this))return;o(Nt,this,e);let t=e.renderButton();n(Bt,this,Gt).call(this,t),a(Ft,this).append(t,Kt.call(n(Bt,this)))}async addEditSignatureButton(e){let t=o(zt,this,await e.renderEditButton(a(Pt,this)));n(Bt,this,Gt).call(this,t),a(Ft,this).append(t,Kt.call(n(Bt,this)))}removeButton(e){switch(e){case`comment`:var t,n;(t=a(Lt,this))==null||t.removeToolbarCommentButton(),o(Lt,this,null),(n=a(Rt,this))==null||n.remove(),o(Rt,this,null);break}}async addButton(e,t){switch(e){case`colorPicker`:t&&this.addColorPicker(t);break;case`altText`:t&&await this.addAltText(t);break;case`editSignature`:t&&await this.addEditSignatureButton(t);break;case`delete`:this.addDeleteButton();break;case`comment`:t&&this.addComment(t);break}}async addButtonBefore(e,t,n){if(!t&&e===`comment`)return;let r=a(Ft,this).querySelector(n);r&&e===`comment`&&this.addComment(t,r)}updateEditSignatureButton(e){a(zt,this)&&(a(zt,this).title=e)}remove(){var e;a(Mt,this).remove(),(e=a(Nt,this))==null||e.destroy(),o(Nt,this,null)}};function Ht(e){e.stopPropagation()}function Ut(e){a(Pt,this)._focusEventsAllowed=!1,P(e)}function Wt(e){a(Pt,this)._focusEventsAllowed=!0,P(e)}function Gt(e){let t=a(Pt,this)._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener(`focusin`,n(Bt,this,Ut).bind(this),{capture:!0,signal:t}),e.addEventListener(`focusout`,n(Bt,this,Wt).bind(this),{capture:!0,signal:t}),e.addEventListener(`contextmenu`,lt,{signal:t}),!0)}function Kt(){let e=document.createElement(`div`);return e.className=`divider`,e}var qt={_:null},Jt=new WeakMap,Yt=new WeakMap,Xt=new WeakMap,Zt=new WeakSet,Qt=class{constructor(e){i(this,Zt),r(this,Jt,null),r(this,Yt,null),r(this,Xt,void 0),o(Xt,this,e)}show(e,t,r){let[i,s]=n(Zt,this,en).call(this,t,r),{style:c}=a(Yt,this)||o(Yt,this,n(Zt,this,$t).call(this));e.append(a(Yt,this)),c.insetInlineEnd=`${100*i}%`,c.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){a(Yt,this).remove()}};function $t(){let e=o(Yt,this,document.createElement(`div`));e.className=`editToolbar`,e.setAttribute(`role`,`toolbar`);let t=a(Xt,this)._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener(`contextmenu`,lt,{signal:t});let r=o(Jt,this,document.createElement(`div`));return r.className=`buttons`,e.append(r),a(Xt,this).hasCommentManager()&&n(Zt,this,tn).call(this,`commentButton`,`pdfjs-comment-floating-button`,`pdfjs-comment-floating-button-label`,()=>{a(Xt,this).commentSelection(`floating_button`)}),n(Zt,this,tn).call(this,`highlightButton`,`pdfjs-highlight-floating-button1`,`pdfjs-highlight-floating-button-label`,()=>{a(Xt,this).highlightSelection(`floating_button`)}),e}function en(e,t){let n=0,r=0;for(let i of e){let e=i.y+i.height;if(e<n)continue;let a=i.x+(t?i.width:0);if(e>n){r=a,n=e;continue}t?a>r&&(r=a):a<r&&(r=a)}return[t?1-r:r,n]}function tn(e,t,n,r){let i=document.createElement(`button`);i.classList.add(`basic`,e),i.tabIndex=0,i.setAttribute(`data-l10n-id`,t);let o=document.createElement(`span`);i.append(o),o.className=`visuallyHidden`,o.setAttribute(`data-l10n-id`,n);let s=a(Xt,this)._signal;s instanceof AbortSignal&&!s.aborted&&(i.addEventListener(`contextmenu`,lt,{signal:s}),i.addEventListener(`click`,r,{signal:s})),a(Jt,this).append(i)}function nn(e,t,n){for(let r of n)t.addEventListener(r,e[r].bind(e))}var rn=class e{static initializeAndAddPointerId(e){(on._||(on._=new Set)).add(e)}static setPointer(e,t){an._||(an._=t),cn._??(cn._=e)}static setTimeStamp(e){sn._=e}static isSamePointerId(e){return an._===e}static isSamePointerIdOrRemove(e){var t;return an._===e?!0:((t=on._)==null||t.delete(e),!1)}static isSamePointerType(e){return cn._===e}static isInitializedAndDifferentPointerType(t){return cn._!==null&&!e.isSamePointerType(t)}static isSameTimeStamp(e){return sn._===e}static isUsingMultiplePointers(){var e;return((e=on._)==null?void 0:e.size)>=1}static clearPointerType(){cn._=null}static clearPointerIds(){an._=NaN,on._=null}static clearTimeStamp(){sn._=NaN}},an={_:NaN},on={_:null},sn={_:NaN},cn={_:null},ln=new WeakMap,un=class{constructor(){r(this,ln,0)}get id(){var e,t;return`${se}${o(ln,this,(e=a(ln,this),t=e++,e)),t}`}},dn=new WeakMap,fn=new WeakMap,pn=new WeakMap,mn=new WeakSet,hn=class{constructor(){i(this,mn),r(this,dn,Ue()),r(this,fn,0),r(this,pn,null)}static get _isSVGFittingCanvas(){let e=new OffscreenCanvas(1,3).getContext(`2d`,{willReadFrequently:!0}),t=new Image;t.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>`;let n=t.decode().then(()=>(e.drawImage(t,0,0,1,1,0,0,1,3),new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0]===0));return j(this,`_isSVGFittingCanvas`,n)}async getFromFile(e){let{lastModified:t,name:r,size:i,type:a}=e;return n(mn,this,gn).call(this,`${t}_${r}_${i}_${a}`,e)}async getFromUrl(e){return n(mn,this,gn).call(this,e,e)}async getFromBlob(e,t){let r=await t;return n(mn,this,gn).call(this,e,r)}async getFromId(e){a(pn,this)||o(pn,this,new Map);let t=a(pn,this).get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){let{blobPromise:e}=t;return delete t.blobPromise,this.getFromBlob(t.id,e)}return this.getFromUrl(t.url)}getFromCanvas(e,t){var n,r;a(pn,this)||o(pn,this,new Map);let i=a(pn,this).get(e);if(i!=null&&i.bitmap)return i.refCounter+=1,i;let s=new OffscreenCanvas(t.width,t.height);return s.getContext(`2d`).drawImage(t,0,0),i={bitmap:s.transferToImageBitmap(),id:`image_${a(dn,this)}_${o(fn,this,(n=a(fn,this),r=n++,n)),r}`,refCounter:1,isSvg:!1},a(pn,this).set(e,i),a(pn,this).set(i.id,i),i}getSvgUrl(e){let t=a(pn,this).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var t;a(pn,this)||o(pn,this,new Map);let n=a(pn,this).get(e);if(!n||(--n.refCounter,n.refCounter!==0))return;let{bitmap:r}=n;if(!n.url&&!n.file){let e=new OffscreenCanvas(r.width,r.height);e.getContext(`bitmaprenderer`).transferFromImageBitmap(r),n.blobPromise=e.convertToBlob()}(t=r.close)==null||t.call(r),n.bitmap=null}isValidId(e){return e.startsWith(`image_${a(dn,this)}_`)}};u=hn;async function gn(e,t){a(pn,this)||o(pn,this,new Map);let n=a(pn,this).get(e);if(n===null)return null;if(n!=null&&n.bitmap)return n.refCounter+=1,n;try{var r,i;n||(n={bitmap:null,id:`image_${a(dn,this)}_${o(fn,this,(r=a(fn,this),i=r++,r)),i}`,refCounter:0,isSvg:!1});let e;if(typeof t==`string`?(n.url=t,e=await $e(t,`blob`)):t instanceof File?e=n.file=t:t instanceof Blob&&(e=t),e.type===`image/svg+xml`){let t=u._isSVGFittingCanvas,r=new FileReader,i=new Image,a=new Promise((e,a)=>{i.onload=()=>{n.bitmap=i,n.isSvg=!0,e()},r.onload=async()=>{let e=n.svgUrl=r.result;i.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e},i.onerror=r.onerror=a});r.readAsDataURL(e),await a}else n.bitmap=await createImageBitmap(e);n.refCounter=1}catch(e){k(e),n=null}return a(pn,this).set(e,n),n&&a(pn,this).set(n.id,n),n}var _n=new WeakMap,vn=new WeakMap,yn=new WeakMap,bn=new WeakMap,xn=class{constructor(e=128){r(this,_n,[]),r(this,vn,!1),r(this,yn,void 0),r(this,bn,-1),o(yn,this,e)}add({cmd:e,undo:t,post:n,mustExec:r,type:i=NaN,overwriteIfSameType:s=!1,keepUndo:c=!1}){if(r&&e(),a(vn,this))return;let l={cmd:e,undo:t,post:n,type:i};if(a(bn,this)===-1){a(_n,this).length>0&&(a(_n,this).length=0),o(bn,this,0),a(_n,this).push(l);return}if(s&&a(_n,this)[a(bn,this)].type===i){c&&(l.undo=a(_n,this)[a(bn,this)].undo),a(_n,this)[a(bn,this)]=l;return}let u=a(bn,this)+1;u===a(yn,this)?a(_n,this).splice(0,1):(o(bn,this,u),u<a(_n,this).length&&a(_n,this).splice(u)),a(_n,this).push(l)}undo(){if(a(bn,this)===-1)return;o(vn,this,!0);let{undo:e,post:t}=a(_n,this)[a(bn,this)];e(),t==null||t(),o(vn,this,!1),o(bn,this,a(bn,this)-1)}redo(){if(a(bn,this)<a(_n,this).length-1){o(bn,this,a(bn,this)+1),o(vn,this,!0);let{cmd:e,post:t}=a(_n,this)[a(bn,this)];e(),t==null||t(),o(vn,this,!1)}}hasSomethingToUndo(){return a(bn,this)!==-1}hasSomethingToRedo(){return a(bn,this)<a(_n,this).length-1}cleanType(e){if(a(bn,this)!==-1){for(let t=a(bn,this);t>=0;t--)if(a(_n,this)[t].type!==e){a(_n,this).splice(t+1,a(bn,this)-t),o(bn,this,t);return}a(_n,this).length=0,o(bn,this,-1)}}destroy(){o(_n,this,null)}},Sn=new WeakSet,Cn=class{constructor(e){i(this,Sn),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:t}=Ie.platform;for(let[n,r,i={}]of e)for(let e of n){let n=e.startsWith(`mac+`);t&&n?(this.callbacks.set(e.slice(4),{callback:r,options:i}),this.allKeys.add(e.split(`+`).at(-1))):!t&&!n&&(this.callbacks.set(e,{callback:r,options:i}),this.allKeys.add(e.split(`+`).at(-1)))}}exec(e,t){if(!this.allKeys.has(t.key))return;let r=this.callbacks.get(n(Sn,this,wn).call(this,t));if(!r)return;let{callback:i,options:{bubbles:a=!1,args:o=[],checker:s=null}}=r;s&&!s(e,t)||(i.bind(e,...o,t)(),a||P(t))}};function wn(e){e.altKey&&this.buffer.push(`alt`),e.ctrlKey&&this.buffer.push(`ctrl`),e.metaKey&&this.buffer.push(`meta`),e.shiftKey&&this.buffer.push(`shift`),this.buffer.push(e.key);let t=this.buffer.join(`+`);return this.buffer.length=0,t}var Tn=class e{get _colors(){let e=new Map([[`CanvasText`,null],[`Canvas`,null]]);return gt(e),j(this,`_colors`,e)}convert(t){let n=ht(t);if(!window.matchMedia(`(forced-colors: active)`).matches)return n;for(let[t,r]of this._colors)if(r.every((e,t)=>e===n[t]))return e._colorsMapping.get(t);return n}getHexCode(e){let t=this._colors.get(e);return t?M.makeHexColor(...t):e}};e(Tn,`_colorsMapping`,new Map([[`CanvasText`,[0,0,0]],[`Canvas`,[255,255,255]]]));var En=new WeakMap,Dn=new WeakMap,On=new WeakMap,kn=new WeakMap,An=new WeakMap,jn=new WeakMap,Mn=new WeakMap,Nn=new WeakMap,Pn=new WeakMap,Fn=new WeakMap,In=new WeakMap,Ln=new WeakMap,Rn=new WeakMap,zn=new WeakMap,Bn=new WeakMap,Vn=new WeakMap,Hn=new WeakMap,Un=new WeakMap,Wn=new WeakMap,Gn=new WeakMap,Kn=new WeakMap,qn=new WeakMap,Jn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,Zn=new WeakMap,Qn=new WeakMap,$n=new WeakMap,er=new WeakMap,tr=new WeakMap,nr=new WeakMap,rr=new WeakMap,ir=new WeakMap,ar=new WeakMap,or=new WeakMap,sr=new WeakMap,cr=new WeakMap,I=new WeakMap,lr=new WeakMap,ur=new WeakMap,dr=new WeakMap,fr=new WeakMap,pr=new WeakMap,mr=new WeakMap,hr=new WeakMap,gr=new WeakMap,_r=new WeakMap,vr=new WeakMap,yr=new WeakMap,br=new WeakMap,L=new WeakSet,xr=class t{static get _keyboardManager(){let e=t.prototype,n=e=>a(_r,e).contains(document.activeElement)&&document.activeElement.tagName!==`BUTTON`&&e.hasSomethingToControl(),r=(e,{target:t})=>{if(t instanceof HTMLInputElement){let{type:e}=t;return e!==`text`&&e!==`number`}return!0},i=this.TRANSLATE_SMALL,o=this.TRANSLATE_BIG;return j(this,`_keyboardManager`,new Cn([[[`ctrl+a`,`mac+meta+a`],e.selectAll,{checker:r}],[[`ctrl+z`,`mac+meta+z`],e.undo,{checker:r}],[[`ctrl+y`,`ctrl+shift+z`,`mac+meta+shift+z`,`ctrl+shift+Z`,`mac+meta+shift+Z`],e.redo,{checker:r}],[[`Backspace`,`alt+Backspace`,`ctrl+Backspace`,`shift+Backspace`,`mac+Backspace`,`mac+alt+Backspace`,`mac+ctrl+Backspace`,`Delete`,`ctrl+Delete`,`shift+Delete`,`mac+Delete`],e.delete,{checker:r}],[[`Enter`,`mac+Enter`],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&a(_r,e).contains(t)&&!e.isEnterHandled}],[[` `,`mac+ `],e.addNewEditorFromKeyboard,{checker:(e,{target:t})=>!(t instanceof HTMLButtonElement)&&a(_r,e).contains(document.activeElement)}],[[`Escape`,`mac+Escape`],e.unselectAll],[[`ArrowLeft`,`mac+ArrowLeft`],e.translateSelectedEditors,{args:[-i,0],checker:n}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],e.translateSelectedEditors,{args:[-o,0],checker:n}],[[`ArrowRight`,`mac+ArrowRight`],e.translateSelectedEditors,{args:[i,0],checker:n}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],e.translateSelectedEditors,{args:[o,0],checker:n}],[[`ArrowUp`,`mac+ArrowUp`],e.translateSelectedEditors,{args:[0,-i],checker:n}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],e.translateSelectedEditors,{args:[0,-o],checker:n}],[[`ArrowDown`,`mac+ArrowDown`],e.translateSelectedEditors,{args:[0,i],checker:n}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],e.translateSelectedEditors,{args:[0,o],checker:n}]]))}constructor(t,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){i(this,L),r(this,En,new AbortController),r(this,Dn,null),r(this,On,null),r(this,kn,new Map),r(this,An,new Map),r(this,jn,null),r(this,Mn,null),r(this,Nn,null),r(this,Pn,null),r(this,Fn,new xn),r(this,In,null),r(this,Ln,null),r(this,Rn,null),r(this,zn,0),r(this,Bn,new Set),r(this,Vn,null),r(this,Hn,null),r(this,Un,new Set),e(this,`_editorUndoBar`,null),r(this,Wn,!1),r(this,Gn,!1),r(this,Kn,!1),r(this,qn,null),r(this,Jn,null),r(this,Yn,null),r(this,Xn,null),r(this,Zn,!1),r(this,Qn,null),r(this,$n,new un),r(this,er,!1),r(this,tr,!1),r(this,nr,!1),r(this,rr,null),r(this,ir,null),r(this,ar,null),r(this,or,null),r(this,sr,null),r(this,cr,D.NONE),r(this,I,new Set),r(this,lr,null),r(this,ur,null),r(this,dr,null),r(this,fr,null),r(this,pr,null),r(this,mr,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),r(this,hr,[0,0]),r(this,gr,null),r(this,_r,null),r(this,vr,null),r(this,yr,null),r(this,br,null);let S=this._signal=a(En,this).signal;o(_r,this,t),o(vr,this,s),o(yr,this,c),o(Mn,this,l),o(In,this,u),o(ur,this,d),o(pr,this,p),this._eventBus=f,f._on(`editingaction`,this.onEditingAction.bind(this),{signal:S}),f._on(`pagechanging`,this.onPageChanging.bind(this),{signal:S}),f._on(`scalechanging`,this.onScaleChanging.bind(this),{signal:S}),f._on(`rotationchanging`,this.onRotationChanging.bind(this),{signal:S}),f._on(`setpreference`,this.onSetPreference.bind(this),{signal:S}),f._on(`switchannotationeditorparams`,e=>this.updateParams(e.type,e.value),{signal:S}),window.addEventListener(`pointerdown`,()=>{o(tr,this,!0)},{capture:!0,signal:S}),window.addEventListener(`pointerup`,()=>{o(tr,this,!1)},{capture:!0,signal:S}),window.addEventListener(`beforeunload`,n(L,this,wr).bind(this),{capture:!0,signal:S}),n(L,this,Or).call(this),n(L,this,Fr).call(this),n(L,this,jr).call(this),o(Nn,this,p.annotationStorage),o(qn,this,p.filterFactory),o(dr,this,m),o(Xn,this,h||null),o(Wn,this,g),o(Gn,this,_),o(Kn,this,v),o(sr,this,y||null),this.viewParameters={realScale:Qe.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=b||null,this._supportsPinchToZoom=x!==!1,u==null||u.setSidebarUiManager(this)}destroy(){var e,t,n,r,i,s,c,l,u;(e=a(br,this))==null||e.resolve(),o(br,this,null),(t=a(En,this))==null||t.abort(),o(En,this,null),this._signal=null;for(let e of a(An,this).values())e.destroy();a(An,this).clear(),a(kn,this).clear(),a(Un,this).clear(),(n=a(or,this))==null||n.clear(),o(Dn,this,null),a(I,this).clear(),a(Fn,this).destroy(),(r=a(Mn,this))==null||r.destroy(),(i=a(In,this))==null||i.destroy(),(s=a(ur,this))==null||s.destroy(),(c=a(Qn,this))==null||c.hide(),o(Qn,this,null),(l=a(ar,this))==null||l.destroy(),o(ar,this,null),o(On,this,null),a(Jn,this)&&(clearTimeout(a(Jn,this)),o(Jn,this,null)),a(gr,this)&&(clearTimeout(a(gr,this)),o(gr,this,null)),(u=this._editorUndoBar)==null||u.destroy(),o(pr,this,null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return a(sr,this)}get useNewAltTextFlow(){return a(Gn,this)}get useNewAltTextWhenAddingImage(){return a(Kn,this)}get hcmFilter(){return j(this,`hcmFilter`,a(dr,this)?a(qn,this).addHCMFilter(a(dr,this).foreground,a(dr,this).background):`none`)}get direction(){return j(this,`direction`,getComputedStyle(a(_r,this)).direction)}get _highlightColors(){return j(this,`_highlightColors`,a(Xn,this)?new Map(a(Xn,this).split(`,`).map(e=>(e=e.split(`=`).map(e=>e.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){let{_highlightColors:e}=this;if(!e)return j(this,`highlightColors`,null);let t=new Map,n=!!a(dr,this);for(let[r,i]of e){let e=r.endsWith(`_HCM`);if(n&&e){t.set(r.replace(`_HCM`,``),i);continue}!n&&!e&&t.set(r,i)}return j(this,`highlightColors`,t)}get highlightColorNames(){return j(this,`highlightColorNames`,this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;let t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),o(Rn,this,e)}setMainHighlightColorPicker(e){o(ar,this,e)}editAltText(e,t=!1){var n;(n=a(Mn,this))==null||n.editAltText(this,e,t)}hasCommentManager(){return!!a(In,this)}editComment(e,t,n,r){var i;(i=a(In,this))==null||i.showDialog(this,e,t,n,r)}selectComment(e,t){let n=a(An,this).get(e),r=n==null?void 0:n.getEditorByUID(t);r==null||r.toggleComment(!0,!0)}updateComment(e){var t;(t=a(In,this))==null||t.updateComment(e.getData())}updatePopupColor(e){var t;(t=a(In,this))==null||t.updatePopupColor(e)}removeComment(e){var t;(t=a(In,this))==null||t.removeComments([e.uid])}deleteComment(e,t){let n=()=>{e.comment=t};this.addCommands({cmd:()=>{var t;(t=this._editorUndoBar)==null||t.show(n,`comment`),this.toggleComment(null),e.comment=null},undo:n,mustExec:!0})}toggleComment(e,t,n=void 0){var r;(r=a(In,this))==null||r.toggleCommentPopup(e,t,n)}makeCommentColor(e,t){var n;return e&&((n=a(In,this))==null?void 0:n.makeCommentColor(e,t))||null}getCommentDialogElement(){var e;return((e=a(In,this))==null?void 0:e.dialogElement)||null}async waitForEditorsRendered(e){if(a(An,this).has(e-1))return;let{resolve:t,promise:n}=Promise.withResolvers(),r=n=>{n.pageNumber===e&&(this._eventBus._off(`editorsrendered`,r),t())};this._eventBus.on(`editorsrendered`,r),await n}getSignature(e){var t;(t=a(ur,this))==null||t.getSignature({uiManager:this,editor:e})}get signatureManager(){return a(ur,this)}switchToMode(e,t){this._eventBus.on(`annotationeditormodechanged`,t,{once:!0,signal:this._signal}),this._eventBus.dispatch(`showannotationeditorui`,{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch(`setpreference`,{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case`enableNewAltTextWhenAddingImage`:o(Kn,this,t);break}}onPageChanging({pageNumber:e}){o(zn,this,e-1)}deletePage(e){for(let t of this.getEditors(e))t.remove();a(An,this).delete(e),a(zn,this)===e&&o(zn,this,0)}focusMainContainer(){a(_r,this).focus()}findParent(e,t){for(let n of a(An,this).values()){let{x:r,y:i,width:a,height:o}=n.div.getBoundingClientRect();if(e>=r&&e<=r+a&&t>=i&&t<=i+o)return n}return null}disableUserSelect(e=!1){a(vr,this).classList.toggle(`noUserSelect`,e)}addShouldRescale(e){a(Un,this).add(e)}removeShouldRescale(e){a(Un,this).delete(e)}onScaleChanging({scale:e}){var t;this.commitOrRemove(),this.viewParameters.realScale=e*Qe.PDF_TO_CSS_UNITS;for(let e of a(Un,this))e.onScaleChanging();(t=a(Rn,this))==null||t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=``,t=!1){let r=document.getSelection();if(!r||r.isCollapsed)return;let{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:c}=r,l=r.toString(),u=n(L,this,Sr).call(this,r).closest(`.textLayer`),d=this.getSelectionBoxes(u);if(!d)return;r.empty();let f=n(L,this,Cr).call(this,u),p=a(cr,this)===D.NONE,m=()=>{let n=f==null?void 0:f.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:c,text:l});p&&this.showAllEditors(`highlight`,!0,!0),t&&(n==null||n.editComment())};if(p){this.switchToMode(D.HIGHLIGHT,m);return}m()}commentSelection(e=``){this.highlightSelection(e,!0)}getAndRemoveDataFromAnnotationStorage(e){if(!a(Nn,this))return null;let t=`${se}${e}`,n=a(Nn,this).getRawValue(t);return n&&a(Nn,this).remove(t),n}addToAnnotationStorage(e){!e.isEmpty()&&a(Nn,this)&&!a(Nn,this).has(e.id)&&a(Nn,this).setValue(e.id,e)}a11yAlert(e,t=null){let n=a(yr,this);n&&(n.setAttribute(`data-l10n-id`,e),t?n.setAttribute(`data-l10n-args`,JSON.stringify(t)):n.removeAttribute(`data-l10n-args`))}blur(){if(this.isShiftKeyDown=!1,a(Zn,this)&&(o(Zn,this,!1),n(L,this,Dr).call(this,`main_toolbar`)),!this.hasSelection)return;let{activeElement:e}=document;for(let t of a(I,this))if(t.div.contains(e)){o(ir,this,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!a(ir,this))return;let[e,t]=a(ir,this);o(ir,this,null),t.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){n(L,this,jr).call(this),this.setEditingState(!0)}removeEditListeners(){n(L,this,Mr).call(this),this.setEditingState(!1)}dragOver(e){for(let{type:t}of e.dataTransfer.items)for(let n of a(Hn,this))if(n.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect=`copy`,e.preventDefault();return}}drop(e){for(let t of e.dataTransfer.items)for(let n of a(Hn,this))if(n.isHandlingMimeForPasting(t.type)){n.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var t;if(e.preventDefault(),(t=a(Dn,this))==null||t.commitOrRemove(),!this.hasSelection)return;let n=[];for(let e of a(I,this)){let t=e.serialize(!0);t&&n.push(t)}n.length!==0&&e.clipboardData.setData(`application/pdfjs`,JSON.stringify(n))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();let{clipboardData:t}=e;for(let e of t.items)for(let t of a(Hn,this))if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}let r=t.getData(`application/pdfjs`);if(!r)return;try{r=JSON.parse(r)}catch(e){k(`paste: "${e.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();let i=this.currentLayer;try{let e=[];for(let t of r){let n=await i.deserialize(t);if(!n)return;e.push(n)}this.addCommands({cmd:()=>{for(let t of e)n(L,this,Br).call(this,t);n(L,this,Ur).call(this,e)},undo:()=>{for(let t of e)t.remove()},mustExec:!0})}catch(e){k(`paste: "${e.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key===`Shift`&&(this.isShiftKeyDown=!0),a(cr,this)!==D.NONE&&!this.isEditorHandlingKeyboard&&t._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key===`Shift`&&(this.isShiftKeyDown=!1,a(Zn,this)&&(o(Zn,this,!1),n(L,this,Dr).call(this,`main_toolbar`)))}onEditingAction({name:e}){switch(e){case`undo`:case`redo`:case`delete`:case`selectAll`:this[e]();break;case`highlightSelection`:this.highlightSelection(`context_menu`);break;case`commentSelection`:this.commentSelection(`context_menu`);break}}updatePageIndex(e,t){for(let n of this.getEditors(e))n.pageIndex=t;let n=a(jn,this).get(e);n&&(n.pageIndex=t,a(An,this).set(t,n),a(er,this)?n.enable():n.disable())}startUpdatePages(){o(jn,this,new Map(a(An,this))),a(An,this).clear()}endUpdatePages(){o(jn,this,null)}clonePage(e,t){for(let n of this.getEditors(e)){let e=n.serialize(n.mode!==D.HIGHLIGHT);e&&(e.pageIndex=t,e.id=this.getId(),e.isClone=!0,delete e.popupRef,a(Nn,this).setValue(e.id,e))}}findClonesForPage(e){let t=[],{pageIndex:n}=e;for(let[r,i]of a(Nn,this))i.pageIndex===n&&i.isClone&&(a(Nn,this).remove(r),t.push(e.deserialize(i).then(t=>{t&&(t.isClone=!0,e.addOrRebuild(t))})));return Promise.all(t)}setEditingState(e){e?(n(L,this,kr).call(this),n(L,this,Nr).call(this),n(L,this,Ir).call(this,{isEditing:a(cr,this)!==D.NONE,isEmpty:n(L,this,Hr).call(this),hasSomethingToUndo:a(Fn,this).hasSomethingToUndo(),hasSomethingToRedo:a(Fn,this).hasSomethingToRedo(),hasSelectedEditor:!1})):(n(L,this,Ar).call(this),n(L,this,Pr).call(this),n(L,this,Ir).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!a(Hn,this)){o(Hn,this,e);for(let e of a(Hn,this))n(L,this,Lr).call(this,e.defaultPropertiesToUpdate)}}getId(){return a($n,this).id}get currentLayer(){return a(An,this).get(a(zn,this))}getLayer(e){return a(An,this).get(e)}get currentPageIndex(){return a(zn,this)}addLayer(e){a(An,this).set(e.pageIndex,e),a(er,this)?e.enable():e.disable()}removeLayer(e){a(An,this).delete(e.pageIndex)}async updateMode(e,t=null,r=!1,i=!1,s=!1,c=!1){var l,u;if(a(cr,this)!==e&&!(a(br,this)&&(await a(br,this).promise,!a(br,this)))){if(o(br,this,Promise.withResolvers()),(l=a(Rn,this))==null||l.commitOrRemove(),a(cr,this)===D.POPUP){var d;(d=a(In,this))==null||d.hideSidebar()}if((u=a(In,this))==null||u.destroyPopup(),o(cr,this,e),e===D.NONE){var f;this.setEditingState(!1),n(L,this,zr).call(this);for(let e of a(kn,this).values())e.hideStandaloneCommentButton();(f=this._editorUndoBar)==null||f.hide(),this.toggleComment(null),a(br,this).resolve();return}for(let e of a(kn,this).values())e.addStandaloneCommentButton();if(e===D.SIGNATURE){var p;await((p=a(ur,this))==null?void 0:p.loadSignatures())}r&&rn.clearPointerType(),this.setEditingState(!0),await n(L,this,Rr).call(this),this.unselectAll();for(let t of a(An,this).values())t.updateMode(e);if(e===D.POPUP){var m;a(On,this)||o(On,this,await a(pr,this).getAnnotationsByType(new Set(a(Hn,this).map(e=>e._editorType))));let e=new Set,t=[];for(let n of a(kn,this).values()){let{annotationElementId:r,hasComment:i,deleted:a}=n;r&&e.add(r),i&&!a&&t.push(n.getData())}for(let n of a(On,this)){let{id:r,popupRef:i,contentsObj:o}=n;i&&o!=null&&o.str&&!e.has(r)&&!a(Bn,this).has(r)&&t.push(n)}(m=a(In,this))==null||m.showSidebar(t)}if(!t){i&&this.addNewEditorFromKeyboard(),a(br,this).resolve();return}for(let e of a(kn,this).values())e.uid===t?(this.setSelected(e),c?e.editComment():s?e.enterInEditMode():e.focus()):e.unselect();a(br,this).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==a(cr,this)&&this._eventBus.dispatch(`switchannotationeditormode`,{source:this,...e})}updateParams(e,t){if(a(Hn,this)){switch(e){case O.CREATE:this.currentLayer.addNewEditor(t);return;case O.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:{type:`highlight`,action:`toggle_visibility`}}}),(a(fr,this)||o(fr,this,new Map)).set(e,t),this.showAllEditors(`highlight`,t);break}if(this.hasSelection)for(let n of a(I,this))n.updateParams(e,t);else for(let n of a(Hn,this))n.updateDefaultParams(e,t)}}showAllEditors(e,t,r=!1){var i;for(let n of a(kn,this).values())n.editorType===e&&n.show(t);(((i=a(fr,this))==null?void 0:i.get(O.HIGHLIGHT_SHOW_ALL))??!0)!==t&&n(L,this,Lr).call(this,[[O.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(a(nr,this)!==e){o(nr,this,e);for(let t of a(An,this).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle(`waiting`,e)}}*getEditors(e){for(let t of a(kn,this).values())t.pageIndex===e&&(yield t)}getEditor(e){return a(kn,this).get(e)}addEditor(e){a(kn,this).set(e.id,e)}removeEditor(e){if(e.div.contains(document.activeElement)&&(a(Jn,this)&&clearTimeout(a(Jn,this)),o(Jn,this,setTimeout(()=>{this.focusMainContainer(),o(Jn,this,null)},0))),a(kn,this).delete(e.id),e.annotationElementId){var t;(t=a(or,this))==null||t.delete(e.annotationElementId)}if(this.unselect(e),!e.annotationElementId||!a(Bn,this).has(e.annotationElementId)){var n;(n=a(Nn,this))==null||n.remove(e.id)}}addDeletedAnnotationElement(e){a(Bn,this).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return a(Bn,this).has(e)}removeDeletedAnnotationElement(e){a(Bn,this).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){a(Dn,this)!==e&&(o(Dn,this,e),e&&n(L,this,Lr).call(this,e.propertiesToUpdate))}updateUI(e){Vr.call(n(L,this))===e&&n(L,this,Lr).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){n(L,this,Lr).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(a(I,this).has(e)){a(I,this).delete(e),e.unselect(),n(L,this,Ir).call(this,{hasSelectedEditor:this.hasSelection});return}a(I,this).add(e),e.select(),n(L,this,Lr).call(this,e.propertiesToUpdate),n(L,this,Ir).call(this,{hasSelectedEditor:!0})}setSelected(e){var t,r;this.updateToolbar({mode:e.mode,editId:e.uid}),(t=a(Rn,this))==null||t.commitOrRemove();for(let t of a(I,this))t!==e&&t.unselect();(r=a(In,this))==null||r.destroyPopup(),a(I,this).clear(),a(I,this).add(e),e.select(),n(L,this,Lr).call(this,e.propertiesToUpdate),n(L,this,Ir).call(this,{hasSelectedEditor:!0})}isSelected(e){return a(I,this).has(e)}get firstSelectedEditor(){return a(I,this).values().next().value}unselect(e){e.unselect(),a(I,this).delete(e),n(L,this,Ir).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(I,this).size!==0}get isEnterHandled(){return a(I,this).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;a(Fn,this).undo(),n(L,this,Ir).call(this,{hasSomethingToUndo:a(Fn,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:n(L,this,Hr).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){a(Fn,this).redo(),n(L,this,Ir).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(Fn,this).hasSomethingToRedo(),isEmpty:n(L,this,Hr).call(this)})}addCommands(e){a(Fn,this).add(e),n(L,this,Ir).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:n(L,this,Hr).call(this)})}cleanUndoStack(e){a(Fn,this).cleanType(e)}delete(){var e;this.commitOrRemove();let t=(e=this.currentLayer)==null?void 0:e.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let r=t?[t]:[...a(I,this)],i=()=>{var e;(e=this._editorUndoBar)==null||e.show(o,r.length===1?r[0].editorType:r.length);for(let e of r)e.remove()},o=()=>{for(let e of r)n(L,this,Br).call(this,e)};this.addCommands({cmd:i,undo:o,mustExec:!0})}commitOrRemove(){var e;(e=a(Dn,this))==null||e.commitOrRemove()}hasSomethingToControl(){return a(Dn,this)||this.hasSelection}selectAll(){for(let e of a(I,this))e.commit();n(L,this,Ur).call(this,a(kn,this).values())}unselectAll(){var e,t;if(!(a(Dn,this)&&(a(Dn,this).commitOrRemove(),a(cr,this)!==D.NONE))&&!((e=a(Rn,this))!=null&&e.commitOrRemove())&&((t=a(In,this))==null||t.destroyPopup(),this.hasSelection)){for(let e of a(I,this))e.unselect();a(I,this).clear(),n(L,this,Ir).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;a(hr,this)[0]+=e,a(hr,this)[1]+=t;let[r,i]=a(hr,this),s=[...a(I,this)];a(gr,this)&&clearTimeout(a(gr,this)),o(gr,this,setTimeout(()=>{o(gr,this,null),a(hr,this)[0]=a(hr,this)[1]=0,this.addCommands({cmd:()=>{for(let e of s)a(kn,this).has(e.id)&&(e.translateInPage(r,i),e.translationDone())},undo:()=>{for(let e of s)a(kn,this).has(e.id)&&(e.translateInPage(-r,-i),e.translationDone())},mustExec:!1})},1e3));for(let n of s)n.translateInPage(e,t),n.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),o(Vn,this,new Map);for(let e of a(I,this))a(Vn,this).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(Vn,this))return!1;this.disableUserSelect(!1);let e=a(Vn,this);o(Vn,this,null);let t=!1;for(let[{x:n,y:r,pageIndex:i},a]of e)a.newX=n,a.newY=r,a.newPageIndex=i,t||(t=n!==a.savedX||r!==a.savedY||i!==a.savedPageIndex);if(!t)return!1;let n=(e,t,n,r)=>{if(a(kn,this).has(e.id)){let i=a(An,this).get(r);i?e._setParentAndPosition(i,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(let[t,{newX:r,newY:i,newPageIndex:a}]of e)n(t,r,i,a)},undo:()=>{for(let[t,{savedX:r,savedY:i,savedPageIndex:a}]of e)n(t,r,i,a)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(a(Vn,this))for(let n of a(Vn,this).keys())n.drag(e,t)}rebuild(e){if(e.parent===null){let t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||a(I,this).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return a(Dn,this)===e}getActive(){return a(Dn,this)}getMode(){return a(cr,this)}isEditingMode(){return a(cr,this)!==D.NONE}get imageManager(){return j(this,`imageManager`,new hn)}getSelectionBoxes(e){if(!e)return null;let t=document.getSelection();for(let n=0,r=t.rangeCount;n<r;n++)if(!e.contains(t.getRangeAt(n).commonAncestorContainer))return null;let{x:n,y:r,width:i,height:a}=e.getBoundingClientRect(),o;switch(e.getAttribute(`data-main-rotation`)){case`90`:o=(e,t,o,s)=>({x:(t-r)/a,y:1-(e+o-n)/i,width:s/a,height:o/i});break;case`180`:o=(e,t,o,s)=>({x:1-(e+o-n)/i,y:1-(t+s-r)/a,width:o/i,height:s/a});break;case`270`:o=(e,t,o,s)=>({x:1-(t+s-r)/a,y:(e-n)/i,width:s/a,height:o/i});break;default:o=(e,t,o,s)=>({x:(e-n)/i,y:(t-r)/a,width:o/i,height:s/a});break}let s=[];for(let e=0,n=t.rangeCount;e<n;e++){let n=t.getRangeAt(e);if(!n.collapsed)for(let{x:e,y:t,width:r,height:i}of n.getClientRects())r===0||i===0||s.push(o(e,t,r,i))}return s.length===0?null:s}addChangedExistingAnnotation({annotationElementId:e,id:t}){(a(Pn,this)||o(Pn,this,new Map)).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){var t;(t=a(Pn,this))==null||t.delete(e)}renderAnnotationElement(e){var t;let n=(t=a(Pn,this))==null?void 0:t.get(e.data.id);if(!n)return;let r=a(Nn,this).getRawValue(n);r&&(a(cr,this)===D.NONE&&!r.hasBeenModified||r.renderAnnotationElement(e))}setMissingCanvas(e,t,n){var r;let i=(r=a(or,this))==null?void 0:r.get(e);i&&(i.setCanvas(t,n),a(or,this).delete(e))}addMissingCanvas(e,t){(a(or,this)||o(or,this,new Map)).set(e,t)}};function Sr({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function Cr(e){let{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(let t of a(An,this).values())if(t.hasTextLayer(e))return t;return null}function wr(e){var t;this.commitOrRemove(),(t=this.currentLayer)==null||t.endDrawingSession(!1)}function Tr(){let e=document.getSelection();if(!e||e.isCollapsed)return;let t=n(L,this,Sr).call(this,e).closest(`.textLayer`),r=this.getSelectionBoxes(t);r&&(a(Qn,this)||o(Qn,this,new Qt(this)),a(Qn,this).show(t,r,this.direction===`ltr`))}function Er(){var e;let t=document.getSelection();if(!t||t.isCollapsed){if(a(lr,this)){var r;(r=a(Qn,this))==null||r.hide(),o(lr,this,null),n(L,this,Ir).call(this,{hasSelectedText:!1})}return}let{anchorNode:i}=t;if(i===a(lr,this))return;let s=n(L,this,Sr).call(this,t).closest(`.textLayer`);if(!s){if(a(lr,this)){var c;(c=a(Qn,this))==null||c.hide(),o(lr,this,null),n(L,this,Ir).call(this,{hasSelectedText:!1})}return}if((e=a(Qn,this))==null||e.hide(),o(lr,this,i),n(L,this,Ir).call(this,{hasSelectedText:!0}),!(a(cr,this)!==D.HIGHLIGHT&&a(cr,this)!==D.NONE)&&(a(cr,this)===D.HIGHLIGHT&&this.showAllEditors(`highlight`,!0,!0),o(Zn,this,this.isShiftKeyDown),!this.isShiftKeyDown)){let e=a(cr,this)===D.HIGHLIGHT?n(L,this,Cr).call(this,s):null;if(e==null||e.toggleDrawing(),a(tr,this)){let t=new AbortController,r=this.combinedSignal(t),i=r=>{r.type===`pointerup`&&r.button!==0||(t.abort(),e==null||e.toggleDrawing(!0),r.type===`pointerup`&&n(L,this,Dr).call(this,`main_toolbar`))};window.addEventListener(`pointerup`,i,{signal:r}),window.addEventListener(`blur`,i,{signal:r})}else e==null||e.toggleDrawing(!0),n(L,this,Dr).call(this,`main_toolbar`)}}function Dr(e=``){a(cr,this)===D.HIGHLIGHT?this.highlightSelection(e):a(Wn,this)&&n(L,this,Tr).call(this)}function Or(){document.addEventListener(`selectionchange`,n(L,this,Er).bind(this),{signal:this._signal})}function kr(){if(a(Yn,this))return;o(Yn,this,new AbortController);let e=this.combinedSignal(a(Yn,this));window.addEventListener(`focus`,this.focus.bind(this),{signal:e}),window.addEventListener(`blur`,this.blur.bind(this),{signal:e})}function Ar(){var e;(e=a(Yn,this))==null||e.abort(),o(Yn,this,null)}function jr(){if(a(rr,this))return;o(rr,this,new AbortController);let e=this.combinedSignal(a(rr,this));window.addEventListener(`keydown`,this.keydown.bind(this),{signal:e}),window.addEventListener(`keyup`,this.keyup.bind(this),{signal:e})}function Mr(){var e;(e=a(rr,this))==null||e.abort(),o(rr,this,null)}function Nr(){if(a(Ln,this))return;o(Ln,this,new AbortController);let e=this.combinedSignal(a(Ln,this));document.addEventListener(`copy`,this.copy.bind(this),{signal:e}),document.addEventListener(`cut`,this.cut.bind(this),{signal:e}),document.addEventListener(`paste`,this.paste.bind(this),{signal:e})}function Pr(){var e;(e=a(Ln,this))==null||e.abort(),o(Ln,this,null)}function Fr(){let e=this._signal;document.addEventListener(`dragover`,this.dragOver.bind(this),{signal:e}),document.addEventListener(`drop`,this.drop.bind(this),{signal:e})}function Ir(e){Object.entries(e).some(([e,t])=>a(mr,this)[e]!==t)&&(this._eventBus.dispatch(`editingstateschanged`,{source:this,details:Object.assign(a(mr,this),e)}),a(cr,this)===D.HIGHLIGHT&&e.hasSelectedEditor===!1&&n(L,this,Lr).call(this,[[O.HIGHLIGHT_FREE,!0]]))}function Lr(e){this._eventBus.dispatch(`annotationeditorparamschanged`,{source:this,details:e})}async function Rr(){if(!a(er,this)){o(er,this,!0);let e=[];for(let t of a(An,this).values())e.push(t.enable());await Promise.all(e);for(let e of a(kn,this).values())e.enable()}}function zr(){if(this.unselectAll(),a(er,this)){o(er,this,!1);for(let e of a(An,this).values())e.disable();for(let e of a(kn,this).values())e.disable()}}function Br(e){let t=a(An,this).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}function Vr(){let e=null;for(e of a(I,this));return e}function Hr(){if(a(kn,this).size===0)return!0;if(a(kn,this).size===1)for(let e of a(kn,this).values())return e.isEmpty();return!1}function Ur(e){for(let e of a(I,this))e.unselect();a(I,this).clear();for(let t of e)t.isEmpty()||(a(I,this).add(t),t.select());n(L,this,Ir).call(this,{hasSelectedEditor:this.hasSelection})}e(xr,`TRANSLATE_SMALL`,1),e(xr,`TRANSLATE_BIG`,10);var Wr=new WeakMap,Gr=new WeakMap,Kr=new WeakMap,qr=new WeakMap,Jr=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,Zr=new WeakMap,Qr=new WeakMap,$r=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakSet,ri=class e{constructor(e){i(this,ni),r(this,Wr,null),r(this,Gr,!1),r(this,Kr,null),r(this,qr,null),r(this,Jr,null),r(this,Yr,null),r(this,Xr,!1),r(this,Zr,null),r(this,Qr,null),r(this,$r,null),r(this,ei,null),r(this,ti,!1),o(Qr,this,e),o(ti,this,e._uiManager.useNewAltTextFlow),oi._||(oi._=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){e._l10n??(e._l10n=t)}async render(){let e=o(Kr,this,document.createElement(`button`));e.className=`altText`,e.tabIndex=`0`;let t=o(qr,this,document.createElement(`span`));e.append(t),a(ti,this)?(e.classList.add(`new`),e.setAttribute(`data-l10n-id`,oi._.missing),t.setAttribute(`data-l10n-id`,oi._[`missing-label`])):(e.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button`),t.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-button-label`));let r=a(Qr,this)._uiManager._signal;e.addEventListener(`contextmenu`,lt,{signal:r}),e.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:r});let i=e=>{e.preventDefault(),a(Qr,this)._uiManager.editAltText(a(Qr,this)),a(ti,this)&&a(Qr,this)._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_clicked`,data:{label:ii.call(n(ni,this))}})};return e.addEventListener(`click`,i,{capture:!0,signal:r}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(o(Xr,this,!0),i(t))},{signal:r}),await n(ni,this,ai).call(this),e}finish(){a(Kr,this)&&(a(Kr,this).focus({focusVisible:a(Xr,this)}),o(Xr,this,!1))}isEmpty(){return a(ti,this)?a(Wr,this)===null:!a(Wr,this)&&!a(Gr,this)}hasData(){return a(ti,this)?a(Wr,this)!==null||!!a($r,this):this.isEmpty()}get guessedText(){return a($r,this)}async setGuessedText(t){a(Wr,this)===null&&(o($r,this,t),o(ei,this,await e._l10n.get(`pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer`,{generatedAltText:t})),n(ni,this,ai).call(this))}toggleAltTextBadge(e=!1){if(!a(ti,this)||a(Wr,this)){var t;(t=a(Zr,this))==null||t.remove(),o(Zr,this,null);return}if(!a(Zr,this)){let e=o(Zr,this,document.createElement(`div`));e.className=`noAltTextBadge`,a(Qr,this).div.append(e)}a(Zr,this).classList.toggle(`hidden`,!e)}serialize(e){let t=a(Wr,this);return!e&&a($r,this)===t&&(t=a(ei,this)),{altText:t,decorative:a(Gr,this),guessedText:a($r,this),textWithDisclaimer:a(ei,this)}}get data(){return{altText:a(Wr,this),decorative:a(Gr,this)}}set data({altText:e,decorative:t,guessedText:r,textWithDisclaimer:i,cancel:s=!1}){r&&(o($r,this,r),o(ei,this,i)),!(a(Wr,this)===e&&a(Gr,this)===t)&&(s||(o(Wr,this,e),o(Gr,this,t)),n(ni,this,ai).call(this))}toggle(e=!1){a(Kr,this)&&(!e&&a(Yr,this)&&(clearTimeout(a(Yr,this)),o(Yr,this,null)),a(Kr,this).disabled=!e)}shown(){a(Qr,this)._reportTelemetry({action:`pdfjs.image.alt_text.image_status_label_displayed`,data:{label:ii.call(n(ni,this))}})}destroy(){var e,t;(e=a(Kr,this))==null||e.remove(),o(Kr,this,null),o(qr,this,null),o(Jr,this,null),(t=a(Zr,this))==null||t.remove(),o(Zr,this,null)}};function ii(){return a(Wr,this)&&`added`||a(Wr,this)===null&&this.guessedText&&`review`||`missing`}async function ai(){let e=a(Kr,this);if(!e)return;if(a(ti,this)){var t;if(e.classList.toggle(`done`,!!a(Wr,this)),e.setAttribute(`data-l10n-id`,oi._[ii.call(n(ni,this))]),(t=a(qr,this))==null||t.setAttribute(`data-l10n-id`,oi._[`${ii.call(n(ni,this))}-label`]),!a(Wr,this)){var r;(r=a(Jr,this))==null||r.remove();return}}else{if(!a(Wr,this)&&!a(Gr,this)){var i;e.classList.remove(`done`),(i=a(Jr,this))==null||i.remove();return}e.classList.add(`done`),e.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-edit-button`)}let s=a(Jr,this);if(!s){o(Jr,this,s=document.createElement(`span`)),s.className=`tooltip`,s.setAttribute(`role`,`tooltip`),s.id=`alt-text-tooltip-${a(Qr,this).id}`;let t=a(Qr,this)._uiManager._signal;t.addEventListener(`abort`,()=>{clearTimeout(a(Yr,this)),o(Yr,this,null)},{once:!0}),e.addEventListener(`mouseenter`,()=>{o(Yr,this,setTimeout(()=>{o(Yr,this,null),a(Jr,this).classList.add(`show`),a(Qr,this)._reportTelemetry({action:`alt_text_tooltip`})},100))},{signal:t}),e.addEventListener(`mouseleave`,()=>{var e;a(Yr,this)&&(clearTimeout(a(Yr,this)),o(Yr,this,null)),(e=a(Jr,this))==null||e.classList.remove(`show`)},{signal:t})}a(Gr,this)?s.setAttribute(`data-l10n-id`,`pdfjs-editor-alt-text-decorative-tooltip`):(s.removeAttribute(`data-l10n-id`),s.textContent=a(Wr,this)),s.parentNode||e.append(s);let c=a(Qr,this).getElementForAltText();c==null||c.setAttribute(`aria-describedby`,s.id)}var oi={_:null};e(ri,`_l10n`,null);var si=new WeakMap,ci=new WeakMap,li=new WeakMap,R=new WeakMap,ui=new WeakMap,di=new WeakMap,fi=new WeakMap,pi=new WeakMap,mi=new WeakMap,hi=new WeakMap,gi=new WeakSet,_i=class{constructor(e){i(this,gi),r(this,si,null),r(this,ci,null),r(this,li,!1),r(this,R,null),r(this,ui,null),r(this,di,null),r(this,fi,null),r(this,pi,null),r(this,mi,!1),r(this,hi,null),o(R,this,e)}renderForToolbar(){let e=o(ci,this,document.createElement(`button`));return e.className=`comment`,n(gi,this,vi).call(this,e,!1)}renderForStandalone(){let e=o(si,this,document.createElement(`button`));e.className=`annotationCommentButton`;let t=a(R,this).commentButtonPosition;if(t){let{style:n}=e;n.insetInlineEnd=`calc(${100*(a(R,this)._uiManager.direction===`ltr`?1-t[0]:t[0])}% - var(--comment-button-dim))`,n.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;let r=a(R,this).commentButtonColor;r&&(n.backgroundColor=r)}return n(gi,this,vi).call(this,e,!0)}focusButton(){setTimeout(()=>{var e;(e=a(si,this)??a(ci,this))==null||e.focus()},0)}onUpdatedColor(){if(!a(si,this))return;let e=a(R,this).commentButtonColor;e&&(a(si,this).style.backgroundColor=e),a(R,this)._uiManager.updatePopupColor(a(R,this))}get commentButtonWidth(){var e;return(((e=a(si,this))==null?void 0:e.getBoundingClientRect().width)??0)/a(R,this).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(a(hi,this))return a(hi,this);if(!a(si,this))return null;let{x:e,y:t,height:n}=a(si,this).getBoundingClientRect(),{x:r,y:i,width:o,height:s}=a(R,this).parent.boundingClientRect;return[(e-r)/o,(t+n-i)/s]}set commentPopupPositionInLayer(e){o(hi,this,e)}hasDefaultPopupPosition(){return a(hi,this)===null}removeStandaloneCommentButton(){var e;(e=a(si,this))==null||e.remove(),o(si,this,null)}removeToolbarCommentButton(){var e;(e=a(ci,this))==null||e.remove(),o(ci,this,null)}setCommentButtonStates({selected:e,hasPopup:t}){a(si,this)&&(a(si,this).classList.toggle(`selected`,e),a(si,this).ariaExpanded=t)}edit(e){let t=this.commentPopupPositionInLayer,n,r;if(t)[n,r]=t;else{[n,r]=a(R,this).commentButtonPosition;let{width:e,height:t,x:i,y:o}=a(R,this);n=i+n*e,r=o+r*t}let i=a(R,this).parent.boundingClientRect,{x:o,y:s,width:c,height:l}=i;a(R,this)._uiManager.editComment(a(R,this),o+n*c,s+r*l,{...e,parentDimensions:i})}finish(){a(ci,this)&&(a(ci,this).focus({focusVisible:a(li,this)}),o(li,this,!1))}isDeleted(){return a(mi,this)||a(fi,this)===``}isEmpty(){return a(fi,this)===null}hasBeenEdited(){return this.isDeleted()||a(fi,this)!==a(ui,this)}serialize(){return this.data}get data(){return{text:a(fi,this),richText:a(di,this),date:a(pi,this),deleted:this.isDeleted()}}set data(e){if(e!==a(fi,this)&&o(di,this,null),e===null){o(fi,this,``),o(mi,this,!0);return}o(fi,this,e),o(pi,this,new Date),o(mi,this,!1)}restoreData({text:e,richText:t,date:n}){o(fi,this,e),o(di,this,t),o(pi,this,n),o(mi,this,!1)}setInitialText(e,t=null){o(ui,this,e),this.data=e,o(pi,this,null),o(di,this,t)}shown(){}destroy(){var e,t;(e=a(ci,this))==null||e.remove(),o(ci,this,null),(t=a(si,this))==null||t.remove(),o(si,this,null),o(fi,this,``),o(di,this,null),o(pi,this,null),o(R,this,null),o(li,this,!1),o(mi,this,!1)}};function vi(e,t){if(!a(R,this)._uiManager.hasCommentManager())return null;e.tabIndex=`0`,e.ariaHasPopup=`dialog`,t?(e.ariaControls=`commentPopup`,e.setAttribute(`data-l10n-id`,`pdfjs-show-comment-button`)):(e.ariaControlsElements=[a(R,this)._uiManager.getCommentDialogElement()],e.setAttribute(`data-l10n-id`,`pdfjs-editor-add-comment-button`));let n=a(R,this)._uiManager._signal;if(!(n instanceof AbortSignal)||n.aborted)return e;e.addEventListener(`contextmenu`,lt,{signal:n}),t&&(e.addEventListener(`focusin`,e=>{a(R,this)._focusEventsAllowed=!1,P(e)},{capture:!0,signal:n}),e.addEventListener(`focusout`,e=>{a(R,this)._focusEventsAllowed=!0,P(e)},{capture:!0,signal:n})),e.addEventListener(`pointerdown`,e=>e.stopPropagation(),{signal:n});let r=t=>{t.preventDefault(),e===a(ci,this)?this.edit():a(R,this).toggleComment(!0)};return e.addEventListener(`click`,r,{capture:!0,signal:n}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(o(li,this,!0),r(t))},{signal:n}),e.addEventListener(`pointerenter`,()=>{a(R,this).toggleComment(!1,!0)},{signal:n}),e.addEventListener(`pointerleave`,()=>{a(R,this).toggleComment(!1,!1)},{signal:n}),e}var yi=new WeakMap,bi=new WeakMap,xi=new WeakMap,Si=new WeakMap,Ci=new WeakMap,wi=new WeakMap,Ti=new WeakMap,Ei=new WeakMap,Di=new WeakMap,Oi=new WeakMap,ki=new WeakMap,Ai=new WeakMap,ji=new WeakSet,Mi=class{constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:s=null,onPinchStart:c=null,onPinching:l=null,onPinchEnd:u=null,signal:d}){i(this,ji),r(this,yi,void 0),r(this,bi,!1),r(this,xi,null),r(this,Si,void 0),r(this,Ci,void 0),r(this,wi,void 0),r(this,Ti,void 0),r(this,Ei,null),r(this,Di,void 0),r(this,Oi,null),r(this,ki,void 0),r(this,Ai,null),o(yi,this,e),o(xi,this,s),o(Si,this,t),o(Ci,this,c),o(wi,this,l),o(Ti,this,u),o(ki,this,new AbortController),o(Di,this,AbortSignal.any([d,a(ki,this).signal])),e.addEventListener(`touchstart`,n(ji,this,Ni).bind(this),{passive:!1,signal:a(Di,this)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/yt.pixelRatio}destroy(){var e,t;(e=a(ki,this))==null||e.abort(),o(ki,this,null),(t=a(Ei,this))==null||t.abort(),o(Ei,this,null)}};d=Mi;function Ni(e){var t,r;if((t=a(Si,this))!=null&&t.call(this))return;if(e.touches.length===1){if(a(Ei,this))return;let e=o(Ei,this,new AbortController),t=AbortSignal.any([a(Di,this),e.signal]),n=a(yi,this),r={capture:!0,signal:t,passive:!1},i=e=>{if(e.pointerType===`touch`){var t;(t=a(Ei,this))==null||t.abort(),o(Ei,this,null)}};n.addEventListener(`pointerdown`,e=>{e.pointerType===`touch`&&(P(e),i(e))},r),n.addEventListener(`pointerup`,i,r),n.addEventListener(`pointercancel`,i,r);return}if(!a(Ai,this)){var i;o(Ai,this,new AbortController);let e=AbortSignal.any([a(Di,this),a(Ai,this).signal]),t=a(yi,this),r={signal:e,capture:!1,passive:!1};t.addEventListener(`touchmove`,n(ji,this,Pi).bind(this),r);let s=n(ji,this,Fi).bind(this);t.addEventListener(`touchend`,s,r),t.addEventListener(`touchcancel`,s,r),r.capture=!0,t.addEventListener(`pointerdown`,P,r),t.addEventListener(`pointermove`,P,r),t.addEventListener(`pointercancel`,P,r),t.addEventListener(`pointerup`,P,r),(i=a(Ci,this))==null||i.call(this)}if(P(e),e.touches.length!==2||(r=a(xi,this))!=null&&r.call(this)){o(Oi,this,null);return}let[s,c]=e.touches;s.identifier>c.identifier&&([s,c]=[c,s]),o(Oi,this,{touch0X:s.screenX,touch0Y:s.screenY,touch1X:c.screenX,touch1Y:c.screenY})}function Pi(e){var t;if(!a(Oi,this)||e.touches.length!==2)return;P(e);let[n,r]=e.touches;n.identifier>r.identifier&&([n,r]=[r,n]);let{screenX:i,screenY:s}=n,{screenX:c,screenY:l}=r,u=a(Oi,this),{touch0X:f,touch0Y:p,touch1X:m,touch1Y:h}=u,g=m-f,_=h-p,v=c-i,y=l-s,b=Math.hypot(v,y)||1,x=Math.hypot(g,_)||1;if(!a(bi,this)&&Math.abs(x-b)<=d.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(u.touch0X=i,u.touch0Y=s,u.touch1X=c,u.touch1Y=l,!a(bi,this)){o(bi,this,!0);return}let S=[(i+c)/2,(s+l)/2];(t=a(wi,this))==null||t.call(this,S,x,b)}function Fi(e){if(!(e.touches.length>=2)){if(a(Ai,this)){var t;a(Ai,this).abort(),o(Ai,this,null),(t=a(Ti,this))==null||t.call(this)}a(Oi,this)&&(P(e),o(Oi,this,null),o(bi,this,!1))}}var Ii=new WeakMap,Li=new WeakMap,Ri=new WeakMap,z=new WeakMap,zi=new WeakMap,Bi=new WeakMap,Vi=new WeakMap,Hi=new WeakMap,Ui=new WeakMap,Wi=new WeakMap,Gi=new WeakMap,Ki=new WeakMap,qi=new WeakMap,Ji=new WeakMap,Yi=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Qi=new WeakMap,$i=new WeakMap,ea=new WeakMap,ta=new WeakMap,na=new WeakMap,ra=new WeakMap,ia=new WeakMap,aa=new WeakMap,oa=new WeakMap,B=new WeakSet,V=class t{static get _resizerKeyboardManager(){let e=t.prototype._resizeWithKeyboard,n=xr.TRANSLATE_SMALL,r=xr.TRANSLATE_BIG;return j(this,`_resizerKeyboardManager`,new Cn([[[`ArrowLeft`,`mac+ArrowLeft`],e,{args:[-n,0]}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],e,{args:[-r,0]}],[[`ArrowRight`,`mac+ArrowRight`],e,{args:[n,0]}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],e,{args:[r,0]}],[[`ArrowUp`,`mac+ArrowUp`],e,{args:[0,-n]}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],e,{args:[0,-r]}],[[`ArrowDown`,`mac+ArrowDown`],e,{args:[0,n]}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],e,{args:[0,r]}],[[`Escape`,`mac+Escape`],t.prototype._stopResizingWithKeyboard]]))}constructor(n){i(this,B),r(this,Ii,null),r(this,Li,null),r(this,Ri,null),r(this,z,null),r(this,zi,null),r(this,Bi,!1),r(this,Vi,null),r(this,Hi,``),r(this,Ui,null),r(this,Wi,null),r(this,Gi,null),r(this,Ki,null),r(this,qi,null),r(this,Ji,``),r(this,Yi,!1),r(this,Xi,null),r(this,Zi,!1),r(this,Qi,!1),r(this,$i,!1),r(this,ea,null),r(this,ta,0),r(this,na,0),r(this,ra,null),r(this,ia,null),e(this,`isSelected`,!1),e(this,`_isCopy`,!1),e(this,`_editToolbar`,null),e(this,`_initialOptions`,Object.create(null)),e(this,`_initialData`,null),e(this,`_isVisible`,!0),e(this,`_uiManager`,null),e(this,`_focusEventsAllowed`,!0),r(this,aa,!1),r(this,oa,t._zIndex++),this.parent=n.parent,this.id=n.id,this.width=this.height=null,this.pageIndex=n.parent.pageIndex,this.name=n.name,this.div=null,this._uiManager=n.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=n.isCentered,this._structTreeParentId=null,this.annotationElementId=n.annotationElementId||null,this.creationDate=n.creationDate||new Date,this.modificationDate=n.modificationDate||null,this.canAddComment=!0;let{rotation:a,rawDims:{pageWidth:o,pageHeight:s,pageX:c,pageY:l}}=this.parent.viewport;this.rotation=a,this.pageRotation=(360+a-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[o,s],this.pageTranslation=[c,l];let[u,d]=this.parentDimensions;this.x=n.x/u,this.y=n.y/d,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(e){this.pageIndex=e}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return j(this,`_defaultLineColor`,this._colorManager.getHexCode(`CanvasText`))}static deleteAnnotationElement(e){let t=new Ea({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,n){if(t._l10n??(t._l10n=e),t._l10nResizer||(t._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`})),t._borderLineWidth!==-1)return;let r=getComputedStyle(document.documentElement);t._borderLineWidth=parseFloat(r.getPropertyValue(`--outline-width`))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){A(`Not implemented`)}get propertiesToUpdate(){return[]}get _isDraggable(){return a(aa,this)}set _isDraggable(e){var t;o(aa,this,e),(t=this.div)==null||t.classList.toggle(`draggable`,e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=a(oa,this)}setParent(e){if(e!==null)this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions;else{var t;n(B,this,Ta).call(this),(t=a(Ki,this))==null||t.remove(),o(Ki,this,null)}this.parent=e}focusin(e){this._focusEventsAllowed&&(a(Yi,this)?o(Yi,this,!1):this.parent.setSelected(this))}focusout(e){var t;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;let n=e.relatedTarget;n!=null&&n.closest(`#${this.id}`)||(e.preventDefault(),(t=this.parent)!=null&&t.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){let[i,a]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}let[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r),this._onTranslated()}translate(e,t){n(B,this,sa).call(this,this.parentDimensions,e,t)}translateInPage(e,t){a(Xi,this)||o(Xi,this,[this.x,this.y,this.width,this.height]),n(B,this,sa).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:`nearest`})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){a(Xi,this)||o(Xi,this,[this.x,this.y,this.width,this.height]);let{div:n,parentDimensions:[r,i]}=this;if(this.x+=e/r,this.y+=t/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:c}=this,[l,u]=this.getBaseTranslation();s+=l,c+=u;let{style:d}=n;d.left=`${(100*s).toFixed(2)}%`,d.top=`${(100*c).toFixed(2)}%`,this._onTranslating(s,c),n.scrollIntoView({block:`nearest`})}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!a(Xi,this)&&(a(Xi,this)[0]!==this.x||a(Xi,this)[1]!==this.y)}get _hasBeenResized(){return!!a(Xi,this)&&(a(Xi,this)[2]!==this.width||a(Xi,this)[3]!==this.height)}getBaseTranslation(){let[e,n]=this.parentDimensions,{_borderLineWidth:r}=t,i=r/e,a=r/n;switch(this.rotation){case 90:return[-i,a];case 180:return[i,a];case 270:return[i,-a];default:return[-i,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){let{div:{style:t},pageDimensions:[n,r]}=this,{x:i,y:a,width:o,height:s}=this;if(o*=n,s*=r,i*=n,a*=r,this._mustFixPosition)switch(e){case 0:i=N(i,0,n-o),a=N(a,0,r-s);break;case 90:i=N(i,0,n-s),a=N(a,o,r);break;case 180:i=N(i,o,n),a=N(a,s,r);break;case 270:i=N(i,s,n),a=N(a,0,r-o);break}this.x=i/=n,this.y=a/=r;let[c,l]=this.getBaseTranslation();i+=c,a+=l,t.left=`${(100*i).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,n){return ca.call(t,e,n,this.parentRotation)}pageTranslationToScreen(e,n){return ca.call(t,e,n,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[t,n]}=this;return[t*e,n*e]}setDims(){let{div:{style:e},width:t,height:n}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*n).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=a(Ri,this))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||a(Qi,this))return this._editToolbar;this._editToolbar=new Vt(this),this.div.append(this._editToolbar.render());let{toolbarButtons:e}=this;if(e)for(let[t,n]of e)await this._editToolbar.addButton(t,n);return this.hasComment||this._editToolbar.addButton(`comment`,this.addCommentButton()),this._editToolbar.addButton(`delete`),this._editToolbar}addCommentButtonInToolbar(){var e;(e=this._editToolbar)==null||e.addButtonBefore(`comment`,this.addCommentButton(),`.deleteButton`)}removeCommentButtonFromToolbar(){var e;(e=this._editToolbar)==null||e.removeButton(`comment`)}removeEditToolbar(){var e,t;(e=this._editToolbar)==null||e.remove(),this._editToolbar=null,(t=a(Ri,this))==null||t.destroy()}addContainer(e){var t;let n=(t=this._editToolbar)==null?void 0:t.div;n?n.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return a(Ri,this)||(ri.initialize(t._l10n),o(Ri,this,new ri(this)),a(Ii,this)&&(a(Ri,this).data=a(Ii,this),o(Ii,this,null))),a(Ri,this)}get altTextData(){var e;return(e=a(Ri,this))==null?void 0:e.data}set altTextData(e){a(Ri,this)&&(a(Ri,this).data=e)}get guessedAltText(){var e;return(e=a(Ri,this))==null?void 0:e.guessedText}async setGuessedAltText(e){var t;await((t=a(Ri,this))==null?void 0:t.setGuessedText(e))}serializeAltText(e){var t;return(t=a(Ri,this))==null?void 0:t.serialize(e)}hasAltText(){return!!a(Ri,this)&&!a(Ri,this).isEmpty()}hasAltTextData(){var e;return((e=a(Ri,this))==null?void 0:e.hasData())??!1}focusCommentButton(){var e;(e=a(z,this))==null||e.focusButton()}addCommentButton(){return this.canAddComment?a(z,this)||o(z,this,new _i(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(a(zi,this)){this._uiManager.isEditingMode()&&a(zi,this).classList.remove(`hidden`);return}this.hasComment&&(o(zi,this,a(z,this).renderForStandalone()),this.div.append(a(zi,this)))}}removeStandaloneCommentButton(){a(z,this).removeStandaloneCommentButton(),o(zi,this,null)}hideStandaloneCommentButton(){var e;(e=a(zi,this))==null||e.classList.add(`hidden`)}get comment(){if(!a(z,this))return null;let{data:{richText:e,text:t,date:n,deleted:r}}=a(z,this);return{text:t,richText:e,date:n,deleted:r,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){a(z,this)||o(z,this,new _i(this)),typeof e==`object`&&e?a(z,this).restoreData(e):a(z,this).data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:n}){if(!t||(a(z,this)||o(z,this,new _i(this)),a(z,this).setInitialText(e,n),!this.annotationElementId))return;let r=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);r&&this.updateFromAnnotationLayer(r)}get hasEditedComment(){var e;return(e=a(z,this))==null?void 0:e.hasBeenEdited()}get hasDeletedComment(){var e;return(e=a(z,this))==null?void 0:e.isDeleted()}get hasComment(){return!!a(z,this)&&!a(z,this).isEmpty()&&!a(z,this).isDeleted()}async editComment(e){a(z,this)||o(z,this,new _i(this)),a(z,this).edit(e)}toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){a(z,this).setSelectedButton(e)}addComment(e){if(this.hasEditedComment){let[,,,t]=e.rect,[n]=this.pageDimensions,[r]=this.pageTranslation,i=r+n+1,a=t-100,o=i+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[i,a,o,t]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){a(z,this).data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var e;let t=this.div=document.createElement(`div`);t.setAttribute(`data-editor-rotation`,(360-this.rotation)%360),t.className=this.name,t.setAttribute(`id`,this.id),t.tabIndex=a(Bi,this)?-1:0,t.setAttribute(`role`,`application`),this.defaultL10nId&&t.setAttribute(`data-l10n-id`,this.defaultL10nId),this._isVisible||t.classList.add(`hidden`),this.setInForeground(),n(B,this,ba).call(this);let[r,i]=this.parentDimensions;this.parentRotation%180!=0&&(t.style.maxWidth=`${(100*i/r).toFixed(2)}%`,t.style.maxHeight=`${(100*r/i).toFixed(2)}%`);let[s,c]=this.getInitialTranslation();return this.translate(s,c),nn(this,t,[`keydown`,`pointerdown`,`dblclick`]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(a(ia,this)||o(ia,this,new Mi({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:n(B,this,ha).bind(this),onPinching:n(B,this,ga).bind(this),onPinchEnd:n(B,this,_a).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),(e=this._uiManager._editorUndoBar)==null||e.hide(),t}pointerdown(e){let{isMac:t}=Ie.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(o(Yi,this,!0),this._isDraggable){n(B,this,ya).call(this,e);return}n(B,this,va).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){a(ea,this)&&clearTimeout(a(ea,this)),o(ea,this,setTimeout(()=>{var e;o(ea,this,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,n=this.rotation){let r=this.parentScale,[i,a]=this.pageDimensions,[o,s]=this.pageTranslation,c=e/r,l=t/r,u=this.x*i,d=this.y*a,f=this.width*i,p=this.height*a;switch(n){case 0:return[u+c+o,a-d-l-p+s,u+c+f+o,a-d-l+s];case 90:return[u+l+o,a-d+c+s,u+l+p+o,a-d+c+f+s];case 180:return[u-c-f+o,a-d+l+s,u-c+o,a-d+l+p+s];case 270:return[u-l-p+o,a-d-c-f+s,u-l+o,a-d-c+s];default:throw Error(`Invalid rotation`)}}getRectInCurrentCoords(e,t){let[n,r,i,a]=e,o=i-n,s=a-r;switch(this.rotation){case 0:return[n,t-a,o,s];case 90:return[n,t-r,s,o];case 180:return[i,t-r,o,s];case 270:return[i,t-a,s,o];default:throw Error(`Invalid rotation`)}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&t._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var e;(e=a(z,this))==null||e.onUpdatedColor()}getData(){let{comment:{text:e,color:t,date:n,opacity:r,deleted:i,richText:a},uid:o,pageIndex:s,creationDate:c,modificationDate:l}=this;return{id:o,pageIndex:s,rect:this.getPDFRect(),richText:a,contentsObj:{str:e},creationDate:c,modificationDate:n||l,popupRef:!i,color:t,opacity:r}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),o(Qi,this,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),o(Qi,this,!1),!0):!1}isInEditMode(){return a(Qi,this)}shouldGetKeyboardEvents(){return a($i,this)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:e,left:t,bottom:n,right:r}=this.getClientDimensions(),{innerHeight:i,innerWidth:a}=window;return t<a&&r>0&&e<i&&n>0}rebuild(){n(B,this,ba).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||``}}serialize(e=!1,t=null){var n;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((n=this._initialData)==null?void 0:n.popupRef)||``}}static async deserialize(e,t,n){let r=new this.prototype.constructor({parent:t,id:n.getId(),uiManager:n,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});r.rotation=e.rotation,o(Ii,r,e.accessibilityData),r._isCopy=e.isCopy||!1;let[i,a]=r.pageDimensions,[s,c,l,u]=r.getRectInCurrentCoords(e.rect,a);return r.x=s/i,r.y=c/a,r.width=l/i,r.height=u/a,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,t,r;if((e=a(qi,this))==null||e.abort(),o(qi,this,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),a(ea,this)&&(clearTimeout(a(ea,this)),o(ea,this,null)),n(B,this,Ta).call(this),this.removeEditToolbar(),a(ra,this)){for(let e of a(ra,this).values())clearTimeout(e);o(ra,this,null)}this.parent=null,(t=a(ia,this))==null||t.destroy(),o(ia,this,null),(r=a(Ki,this))==null||r.remove(),o(Ki,this,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(n(B,this,ua).call(this),a(Ui,this).classList.remove(`hidden`))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction===`ltr`?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[e,n]}=this,[r,i,a,o]=this.getPDFRect();return[t._round(r+(a-r)*e),t._round(i+(o-i)*(1-n))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return a(z,this).commentPopupPositionInLayer}set commentPopupPosition(e){a(z,this).commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return a(z,this).hasDefaultPopupPosition()}get commentButtonWidth(){return a(z,this).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){var t;(t=a(z,this))==null||t.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!==`Enter`)return;this._uiManager.setSelected(this),o(Gi,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let r=a(Ui,this).children;if(!a(Li,this)){o(Li,this,Array.from(r));let e=n(B,this,xa).bind(this),i=n(B,this,Sa).bind(this),s=this._uiManager._signal;for(let r of a(Li,this)){let a=r.getAttribute(`data-resizer-name`);r.setAttribute(`role`,`spinbutton`),r.addEventListener(`keydown`,e,{signal:s}),r.addEventListener(`blur`,i,{signal:s}),r.addEventListener(`focus`,n(B,this,Ca).bind(this,a),{signal:s}),r.setAttribute(`data-l10n-id`,t._l10nResizer[a])}}let i=a(Li,this)[0],s=0;for(let e of r){if(e===i)break;s++}let c=(360-this.rotation+this.parentRotation)%360/90*(a(Li,this).length/4);if(c!==s){if(c<s)for(let e=0;e<s-c;e++)a(Ui,this).append(a(Ui,this).firstElementChild);else if(c>s)for(let e=0;e<c-s;e++)a(Ui,this).firstElementChild.before(a(Ui,this).lastElementChild);let e=0;for(let n of r){let r=a(Li,this)[e++].getAttribute(`data-resizer-name`);n.setAttribute(`data-l10n-id`,t._l10nResizer[r])}}n(B,this,wa).call(this,0),o($i,this,!0),a(Ui,this).firstElementChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){a($i,this)&&n(B,this,ma).call(this,a(Ji,this),{deltaX:e,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){n(B,this,Ta).call(this),this.div.focus()}select(){var e,t,n;if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add(`selectedEditor`),!this._editToolbar){this.addEditToolbar().then(()=>{var e;if((e=this.div)!=null&&e.classList.contains(`selectedEditor`)){var t;(t=this._editToolbar)==null||t.show()}});return}(t=this._editToolbar)==null||t.show(),(n=a(Ri,this))==null||n.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var e;return(e=this.div)==null?void 0:e.focus({preventScroll:!0})},0)}unselect(){var e,t,n,r,i;this.isSelected&&(this.isSelected=!1,(e=a(Ui,this))==null||e.classList.add(`hidden`),(t=this.div)==null||t.classList.remove(`selectedEditor`),(n=this.div)!=null&&n.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(r=this._editToolbar)==null||r.hide(),(i=a(Ri,this))==null||i.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!==`BUTTON`&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return a(Zi,this)}set isEditing(e){o(Zi,this,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:`added`}}get telemetryFinalData(){return null}_reportTelemetry(e,n=!1){if(n){a(ra,this)||o(ra,this,new Map);let{action:n}=e,r=a(ra,this).get(n);r&&clearTimeout(r),r=setTimeout(()=>{this._reportTelemetry(e),a(ra,this).delete(n),a(ra,this).size===0&&o(ra,this,null)},t._telemetryTimeout),a(ra,this).set(n,r);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,data:e}})}show(e=this._isVisible){this.div.classList.toggle(`hidden`,!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),o(Bi,this,!1)}disable(){this.div&&(this.div.tabIndex=-1),o(Bi,this,!0)}updateFakeAnnotationElement(e){if(!a(Ki,this)&&!this.deleted){o(Ki,this,e.addFakeAnnotation(this));return}if(this.deleted){a(Ki,this).remove(),o(Ki,this,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&a(Ki,this).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let t=e.container.querySelector(`.annotationContent`);if(!t)t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.container.prepend(t);else if(t.nodeName===`CANVAS`){let e=t;t=document.createElement(`div`),t.classList.add(`annotationContent`,this.editorType),e.before(t)}return t}resetAnnotationElement(e){let{firstElementChild:t}=e.container;(t==null?void 0:t.nodeName)===`DIV`&&t.classList.contains(`annotationContent`)&&t.remove()}};f=V;function sa([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}function ca(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}function la(e){switch(e){case 90:{let[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}function ua(){if(a(Ui,this))return;o(Ui,this,document.createElement(`div`)),a(Ui,this).classList.add(`resizers`);let e=this._willKeepAspectRatio?[`topLeft`,`topRight`,`bottomRight`,`bottomLeft`]:[`topLeft`,`topMiddle`,`topRight`,`middleRight`,`bottomRight`,`bottomMiddle`,`bottomLeft`,`middleLeft`],t=this._uiManager._signal;for(let r of e){let e=document.createElement(`div`);a(Ui,this).append(e),e.classList.add(`resizer`,r),e.setAttribute(`data-resizer-name`,r),e.addEventListener(`pointerdown`,n(B,this,da).bind(this,r),{signal:t}),e.addEventListener(`contextmenu`,lt,{signal:t}),e.tabIndex=-1}this.div.prepend(a(Ui,this))}function da(e,t){var r;t.preventDefault();let{isMac:i}=Ie.platform;if(t.button!==0||t.ctrlKey&&i)return;(r=a(Ri,this))==null||r.toggle(!1);let s=this._isDraggable;this._isDraggable=!1,o(Wi,this,[t.screenX,t.screenY]);let c=new AbortController,l=this._uiManager.combinedSignal(c);this.parent.togglePointerEvents(!1),window.addEventListener(`pointermove`,n(B,this,ma).bind(this,e),{passive:!0,capture:!0,signal:l}),window.addEventListener(`touchmove`,P,{passive:!1,signal:l}),window.addEventListener(`contextmenu`,lt,{signal:l}),o(Gi,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let u=this.parent.div.style.cursor,d=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;let f=()=>{var e;c.abort(),this.parent.togglePointerEvents(!0),(e=a(Ri,this))==null||e.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=u,this.div.style.cursor=d,n(B,this,pa).call(this)};window.addEventListener(`pointerup`,f,{signal:l}),window.addEventListener(`blur`,f,{signal:l})}function fa(e,t,n,r){this.width=n,this.height=r,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()}function pa(){if(!a(Gi,this))return;let{savedX:e,savedY:t,savedWidth:r,savedHeight:i}=a(Gi,this);o(Gi,this,null);let s=this.x,c=this.y,l=this.width,u=this.height;s===e&&c===t&&l===r&&u===i||this.addCommands({cmd:n(B,this,fa).bind(this,s,c,l,u),undo:n(B,this,fa).bind(this,e,t,r,i),mustExec:!0})}function ma(e,t){let[r,i]=this.parentDimensions,s=this.x,c=this.y,l=this.width,u=this.height,d=f.MIN_SIZE/r,p=f.MIN_SIZE/i,m=n(B,this,la).call(this,this.rotation),h=(e,t)=>[m[0]*e+m[2]*t,m[1]*e+m[3]*t],g=n(B,this,la).call(this,360-this.rotation),_=(e,t)=>[g[0]*e+g[2]*t,g[1]*e+g[3]*t],v,y,b=!1,x=!1;switch(e){case`topLeft`:b=!0,v=(e,t)=>[0,0],y=(e,t)=>[e,t];break;case`topMiddle`:v=(e,t)=>[e/2,0],y=(e,t)=>[e/2,t];break;case`topRight`:b=!0,v=(e,t)=>[e,0],y=(e,t)=>[0,t];break;case`middleRight`:x=!0,v=(e,t)=>[e,t/2],y=(e,t)=>[0,t/2];break;case`bottomRight`:b=!0,v=(e,t)=>[e,t],y=(e,t)=>[0,0];break;case`bottomMiddle`:v=(e,t)=>[e/2,t],y=(e,t)=>[e/2,0];break;case`bottomLeft`:b=!0,v=(e,t)=>[0,t],y=(e,t)=>[e,0];break;case`middleLeft`:x=!0,v=(e,t)=>[0,t/2],y=(e,t)=>[e,t/2];break}let S=v(l,u),C=y(l,u),w=h(...C),T=f._round(s+w[0]),ee=f._round(c+w[1]),E=1,te=1,ne,re;if(t.fromKeyboard)({deltaX:ne,deltaY:re}=t);else{let{screenX:e,screenY:n}=t,[r,i]=a(Wi,this);[ne,re]=this.screenToPageTranslation(e-r,n-i),a(Wi,this)[0]=e,a(Wi,this)[1]=n}if([ne,re]=_(ne/r,re/i),b){let e=Math.hypot(l,u);E=te=Math.max(Math.min(Math.hypot(C[0]-S[0]-ne,C[1]-S[1]-re)/e,1/l,1/u),d/l,p/u)}else x?E=N(Math.abs(C[0]-S[0]-ne),d,1)/l:te=N(Math.abs(C[1]-S[1]-re),p,1)/u;let ie=f._round(l*E),ae=f._round(u*te);w=h(...y(ie,ae));let oe=T-w[0],se=ee-w[1];a(Xi,this)||o(Xi,this,[this.x,this.y,this.width,this.height]),this.width=ie,this.height=ae,this.x=oe,this.y=se,this.setDims(),this.fixAndSetPosition(),this._onResizing()}function ha(){var e;o(Gi,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=a(Ri,this))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)}function ga(e,t,r){let i=.7,s=r/t*i+1-i;if(s===1)return;let c=n(B,this,la).call(this,this.rotation),l=(e,t)=>[c[0]*e+c[2]*t,c[1]*e+c[3]*t],[u,d]=this.parentDimensions,p=this.x,m=this.y,h=this.width,g=this.height,_=f.MIN_SIZE/u,v=f.MIN_SIZE/d;s=Math.max(Math.min(s,1/h,1/g),_/h,v/g);let y=f._round(h*s),b=f._round(g*s);if(y===h&&b===g)return;a(Xi,this)||o(Xi,this,[p,m,h,g]);let x=l(h/2,g/2),S=f._round(p+x[0]),C=f._round(m+x[1]),w=l(y/2,b/2);this.x=S-w[0],this.y=C-w[1],this.width=y,this.height=b,this.setDims(),this.fixAndSetPosition(),this._onResizing()}function _a(){var e;(e=a(Ri,this))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),n(B,this,pa).call(this)}function va(e){let{isMac:t}=Ie.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}function ya(e){let{isSelected:t}=this;this._uiManager.setUpDragSession();let r=!1,i=new AbortController,s=this._uiManager.combinedSignal(i),c={capture:!0,passive:!1,signal:s},l=e=>{i.abort(),o(Vi,this,null),o(Yi,this,!1),this._uiManager.endDragSession()||n(B,this,va).call(this,e),r&&this._onStopDragging()};t&&(o(ta,this,e.clientX),o(na,this,e.clientY),o(Vi,this,e.pointerId),o(Hi,this,e.pointerType),window.addEventListener(`pointermove`,e=>{r||(r=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:t,clientY:n,pointerId:i}=e;if(i!==a(Vi,this)){P(e);return}let[s,c]=this.screenToPageTranslation(t-a(ta,this),n-a(na,this));o(ta,this,t),o(na,this,n),this._uiManager.dragSelectedEditors(s,c)},c),window.addEventListener(`touchmove`,P,c),window.addEventListener(`pointerdown`,e=>{e.pointerType===a(Hi,this)&&(a(ia,this)||e.isPrimary)&&l(e),P(e)},c));let u=e=>{if(!a(Vi,this)||a(Vi,this)===e.pointerId){l(e);return}P(e)};window.addEventListener(`pointerup`,u,{signal:s}),window.addEventListener(`blur`,u,{signal:s})}function ba(){if(a(qi,this)||!this.div)return;o(qi,this,new AbortController);let e=this._uiManager.combinedSignal(a(qi,this));this.div.addEventListener(`focusin`,this.focusin.bind(this),{signal:e}),this.div.addEventListener(`focusout`,this.focusout.bind(this),{signal:e})}function xa(e){f._resizerKeyboardManager.exec(this,e)}function Sa(e){var t;a($i,this)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==a(Ui,this)&&n(B,this,Ta).call(this)}function Ca(e){o(Ji,this,a($i,this)?e:``)}function wa(e){if(a(Li,this))for(let t of a(Li,this))t.tabIndex=e}function Ta(){o($i,this,!1),n(B,this,wa).call(this,-1),n(B,this,pa).call(this)}e(V,`_l10n`,null),e(V,`_l10nResizer`,null),e(V,`_borderLineWidth`,-1),e(V,`_colorManager`,new Tn),e(V,`_zIndex`,1),e(V,`_telemetryTimeout`,1e3);var Ea=class extends V{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},Da=3285377520,Oa=4294901760,ka=65535,Aa=class{constructor(e){this.h1=e?e&4294967295:Da,this.h2=e?e&4294967295:Da}update(e){let t,n;if(typeof e==`string`){t=new Uint8Array(e.length*2),n=0;for(let r=0,i=e.length;r<i;r++){let i=e.charCodeAt(r);i<=255?t[n++]=i:(t[n++]=i>>>8,t[n++]=i&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),n=t.byteLength;else throw Error(`Invalid data format, must be a string or TypedArray.`);let r=n>>2,i=n-r*4,a=new Uint32Array(t.buffer,0,r),o=0,s=0,c=this.h1,l=this.h2,u=3432918353,d=461845907,f=u&ka,p=d&ka;for(let e=0;e<r;e++)e&1?(o=a[e],o=o*u&Oa|o*f&ka,o=o<<15|o>>>17,o=o*d&Oa|o*p&ka,c^=o,c=c<<13|c>>>19,c=c*5+3864292196):(s=a[e],s=s*u&Oa|s*f&ka,s=s<<15|s>>>17,s=s*d&Oa|s*p&ka,l^=s,l=l<<13|l>>>19,l=l*5+3864292196);switch(o=0,i){case 3:o^=t[r*4+2]<<16;case 2:o^=t[r*4+1]<<8;case 1:o^=t[r*4],o=o*u&Oa|o*f&ka,o=o<<15|o>>>17,o=o*d&Oa|o*p&ka,r&1?c^=o:l^=o}this.h1=c,this.h2=l}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&Oa|e*36045&ka,t=t*4283543511&Oa|((t<<16|e>>>16)*2950163797&Oa)>>>16,e^=t>>>1,e=e*444984403&Oa|e*60499&ka,t=t*3301882366&Oa|((t<<16|e>>>16)*3120437893&Oa)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,`0`)+(t>>>0).toString(16).padStart(8,`0`)}},ja=Object.freeze({map:null,hash:``,transfer:void 0}),Ma=new WeakMap,Na=new WeakMap,Pa=new WeakMap,Fa=new WeakMap,Ia=new WeakSet;S=Symbol.iterator;var La=class{constructor(){i(this,Ia),r(this,Ma,!1),r(this,Na,null),r(this,Pa,null),r(this,Fa,new Map),e(this,`onSetModified`,null),e(this,`onResetModified`,null),e(this,`onAnnotationEditor`,null)}getValue(e,t){let n=a(Fa,this).get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return a(Fa,this).get(e)}remove(e){var t;let n=a(Fa,this).get(e);n!==void 0&&(n instanceof V&&a(Pa,this).delete(n.annotationElementId),a(Fa,this).delete(e),a(Fa,this).size===0&&this.resetModified(),!a(Fa,this).values().some(e=>e instanceof V)&&((t=this.onAnnotationEditor)==null||t.call(this,null)))}setValue(e,t){let r=a(Fa,this).get(e),i=!1;if(r!==void 0)for(let[e,n]of Object.entries(t))r[e]!==n&&(i=!0,r[e]=n);else i=!0,a(Fa,this).set(e,t);if(i&&n(Ia,this,Ra).call(this),t instanceof V){var s;(a(Pa,this)||o(Pa,this,new Map)).set(t.annotationElementId,t),(s=this.onAnnotationEditor)==null||s.call(this,t.constructor._type)}}has(e){return a(Fa,this).has(e)}get size(){return a(Fa,this).size}resetModified(){if(a(Ma,this)){var e;o(Ma,this,!1),(e=this.onResetModified)==null||e.call(this)}}get print(){return new Ba(this)}get serializable(){if(a(Fa,this).size===0)return ja;let e=new Map,t=new Aa,n=[],r=Object.create(null),i=!1;for(let[n,o]of a(Fa,this)){let a=o instanceof V?o.serialize(!1,r):o;o.page&&(o.pageIndex=o.page._pageIndex,delete o.page),a&&(e.set(n,a),t.update(`${n}:${JSON.stringify(a)}`),i||(i=!!a.bitmap))}if(i)for(let t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:n}:ja}get editorStats(){let e=null,t=new Map,n=0,r=0;for(let o of a(Fa,this).values()){var i;if(!(o instanceof V)){o.popup&&(o.popup.deleted?r+=1:n+=1);continue}o.isCommentDeleted?r+=1:o.hasEditedComment&&(n+=1);let a=o.telemetryFinalData;if(!a)continue;let{type:s}=a;t.has(s)||t.set(s,Object.getPrototypeOf(o).constructor),e||(e=Object.create(null));let c=(i=e)[s]||(i[s]=new Map);for(let[e,t]of Object.entries(a)){if(e===`type`)continue;let n=c.getOrInsertComputed(e,qe);n.set(t,(n.get(t)??0)+1)}}if((r>0||n>0)&&(e||(e=Object.create(null)),e.comments={deleted:r,edited:n}),!e)return null;for(let[n,r]of t)e[n]=r.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){o(Na,this,null)}updateEditor(e,t){var n;let r=(n=a(Pa,this))==null?void 0:n.get(e);return r?(r.updateFromAnnotationLayer(t),!0):!1}getEditor(e){var t;return((t=a(Pa,this))==null?void 0:t.get(e))||null}get modifiedIds(){if(a(Na,this))return a(Na,this);let e=[];if(a(Pa,this))for(let t of a(Pa,this).values())t.serialize()&&e.push(t.annotationElementId);let t=``;if(e.length){let n=new Aa;n.update(e.join(`,`)),t=n.hexdigest()}return o(Na,this,{ids:new Set(e),hash:t})}[S](){return a(Fa,this).entries()}};function Ra(){if(!a(Ma,this)){var e;o(Ma,this,!0),(e=this.onSetModified)==null||e.call(this)}}var za=new WeakMap,Ba=class extends La{constructor(e){super(),r(this,za,ja);let{serializable:t}=e;if(t===ja)return;let{map:n,hash:i,transfer:a}=t,s=structuredClone(n,a?{transfer:a}:null);o(za,this,{map:s,hash:i,transfer:[]})}get print(){A(`Should not call PrintAnnotationStorage.print`)}get serializable(){return a(za,this)}get modifiedIds(){return j(this,`modifiedIds`,{ids:new Set,hash:``})}},Va=`__forcedDependency`,{floor:Ha,ceil:Ua}=Math;function Wa(e,t,n,r,i,a){e[t*4+0]=Math.min(e[t*4+0],n),e[t*4+1]=Math.min(e[t*4+1],r),e[t*4+2]=Math.max(e[t*4+2],i),e[t*4+3]=Math.max(e[t*4+3],a)}var Ga=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],Ka=new WeakMap,qa=new WeakMap,Ja=class{constructor(e,t){r(this,Ka,void 0),r(this,qa,void 0),o(Ka,this,e),o(qa,this,t)}get length(){return a(Ka,this).length}isEmpty(e){return a(Ka,this)[e]===Ga}minX(e){return a(qa,this)[e*4+0]/256}minY(e){return a(qa,this)[e*4+1]/256}maxX(e){return(a(qa,this)[e*4+2]+1)/256}maxY(e){return(a(qa,this)[e*4+3]+1)/256}},Ya=(e,t)=>e==null?void 0:e.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),Xa=new WeakMap,H=new WeakMap,Za=new WeakMap,Qa=new WeakMap,$a=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakSet,ro=class{constructor(t,a){i(this,no),r(this,Xa,[[1,0,0,1,0,0]]),r(this,H,[-1/0,-1/0,1/0,1/0]),r(this,Za,new Float64Array(te)),e(this,`_pendingBBoxIdx`,-1),r(this,Qa,void 0),r(this,$a,void 0),r(this,eo,void 0),r(this,to,void 0),e(this,`_savesStack`,[]),e(this,`_markedContentStack`,[]),o(Qa,this,t.width),o($a,this,t.height),n(no,this,io).call(this,a)}growOperationsCount(e){e>=a(to,this).length&&n(no,this,io).call(this,e,a(to,this))}get clipBox(){return a(H,this)}save(e){return o(H,this,{__proto__:a(H,this)}),this._savesStack.push(e),this}restore(e,t){let n=Object.getPrototypeOf(a(H,this));if(n===null)return this;o(H,this,n);let r=this._savesStack.pop();return r!==void 0&&(t==null||t(r,e),a(to,this)[e]=a(to,this)[r]),this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,t){let n=this._savesStack.pop();return n!==void 0&&(t==null||t(n,e),a(to,this)[e]=a(to,this)[n]),this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,t){let n=this._markedContentStack.pop();return n!==void 0&&(t==null||t(n,e),a(to,this)[e]=a(to,this)[n]),this}pushBaseTransform(e){return a(Xa,this).push(M.multiplyByDOMMatrix(a(Xa,this).at(-1),e.getTransform())),this}popBaseTransform(){return a(Xa,this).length>1&&a(Xa,this).pop(),this}resetBBox(e){return this._pendingBBoxIdx!==e&&(this._pendingBBoxIdx=e,a(Za,this).set(te,0)),this}recordClipBox(e,t,n,r,i,o){let s=M.multiplyByDOMMatrix(a(Xa,this).at(-1),t.getTransform()),c=te.slice();M.axialAlignedBoundingBox([n,i,r,o],s,c);let l=M.intersect(a(H,this),c);return l?(a(H,this)[0]=l[0],a(H,this)[1]=l[1],a(H,this)[2]=l[2],a(H,this)[3]=l[3]):(a(H,this)[0]=a(H,this)[1]=1/0,a(H,this)[2]=a(H,this)[3]=-1/0),this}recordBBox(e,t,n,r,i,o){let s=a(H,this);if(s[0]===1/0)return this;let c=M.multiplyByDOMMatrix(a(Xa,this).at(-1),t.getTransform());if(s[0]===-1/0)return M.axialAlignedBoundingBox([n,i,r,o],c,a(Za,this)),this;let l=te.slice();return M.axialAlignedBoundingBox([n,i,r,o],c,l),a(Za,this)[0]=N(l[0],s[0],a(Za,this)[0]),a(Za,this)[1]=N(l[1],s[1],a(Za,this)[1]),a(Za,this)[2]=N(l[2],a(Za,this)[2],s[2]),a(Za,this)[3]=N(l[3],a(Za,this)[3],s[3]),this}recordFullPageBBox(e){return a(Za,this)[0]=Math.max(0,a(H,this)[0]),a(Za,this)[1]=Math.max(0,a(H,this)[1]),a(Za,this)[2]=Math.min(a(Qa,this),a(H,this)[2]),a(Za,this)[3]=Math.min(a($a,this),a(H,this)[3]),this}recordOperation(e,t=!1,n){if(this._pendingBBoxIdx!==e)return this;let r=Ha(a(Za,this)[0]*256/a(Qa,this)),i=Ha(a(Za,this)[1]*256/a($a,this)),o=Ua(a(Za,this)[2]*256/a(Qa,this)),s=Ua(a(Za,this)[3]*256/a($a,this));if(Wa(a(eo,this),e,r,i,o,s),n)for(let t of n)for(let n of t)n!==e&&Wa(a(eo,this),n,r,i,o,s);return t||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(e){return this._pendingBBoxIdx===e&&(this._pendingBBoxIdx=-1,a(H,this)[0]=Math.max(a(H,this)[0],a(Za,this)[0]),a(H,this)[1]=Math.max(a(H,this)[1],a(Za,this)[1]),a(H,this)[2]=Math.min(a(H,this)[2],a(Za,this)[2]),a(H,this)[3]=Math.min(a(H,this)[3],a(Za,this)[3])),this}take(){return new Ja(a(to,this),a(eo,this))}takeDebugMetadata(){throw Error(`Unreachable`)}recordSimpleData(e,t){return this}recordIncrementalData(e,t){return this}resetIncrementalData(e,t){return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,n,r=1,i=0,a=0,o){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e,t=!1){return this}};function io(e,t){let n=new ArrayBuffer(e*4);o(eo,this,new Uint8ClampedArray(n)),o(to,this,new Uint32Array(n)),t&&t.length>0?(a(to,this).set(t),a(to,this).fill(Ga,t.length)):a(to,this).fill(Ga)}var ao=new WeakMap,oo=new WeakMap,so=new WeakMap,co=new WeakMap,lo=new WeakMap,uo=new WeakMap,fo=new WeakMap,U=new WeakMap,po=class{constructor(e,t=!1){r(this,ao,{__proto__:null}),r(this,oo,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Va]:[]}),r(this,so,new Map),r(this,co,new Set),r(this,lo,new Map),r(this,uo,void 0),r(this,fo,void 0),r(this,U,void 0),o(U,this,e),t&&(o(uo,this,new Map),o(fo,this,(e,t)=>{Ya(a(uo,this),t).dependencies.add(e)}))}get clipBox(){return a(U,this).clipBox}growOperationsCount(e){a(U,this).growOperationsCount(e)}save(e){return o(ao,this,{__proto__:a(ao,this)}),o(oo,this,{__proto__:a(oo,this),transform:{__proto__:a(oo,this).transform},moveText:{__proto__:a(oo,this).moveText},sameLineText:{__proto__:a(oo,this).sameLineText},[Va]:{__proto__:a(oo,this)[Va]}}),a(U,this).save(e),this}restore(e){a(U,this).restore(e,a(fo,this));let t=Object.getPrototypeOf(a(ao,this));return t===null?this:(o(ao,this,t),o(oo,this,Object.getPrototypeOf(a(oo,this))),this)}recordOpenMarker(e){return a(U,this).recordOpenMarker(e,a(fo,this)),this}getOpenMarker(){return a(U,this).getOpenMarker()}recordCloseMarker(e){return a(U,this).recordCloseMarker(e,a(fo,this)),this}beginMarkedContent(e){return a(U,this).beginMarkedContent(e),this}endMarkedContent(e){return a(U,this).endMarkedContent(e,a(fo,this)),this}pushBaseTransform(e){return a(U,this).pushBaseTransform(e),this}popBaseTransform(){return a(U,this).popBaseTransform(),this}recordSimpleData(e,t){return a(ao,this)[e]=t,this}recordIncrementalData(e,t){return a(oo,this)[e].push(t),this}resetIncrementalData(e,t){return a(oo,this)[e].length=0,this}recordNamedData(e,t){return a(so,this).set(e,t),this}recordSimpleDataFromNamed(e,t,n){a(ao,this)[e]=a(so,this).get(t)??n}recordFutureForcedDependency(e,t){return this.recordIncrementalData(Va,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(let t of e)t in a(ao,this)&&this.recordFutureForcedDependency(t,a(ao,this)[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let e of a(co,this))this.recordFutureForcedDependency(Va,e);return this}resetBBox(e){return a(U,this).resetBBox(e),this}recordClipBox(e,t,n,r,i,o){return a(U,this).recordClipBox(e,t,n,r,i,o),this}recordBBox(e,t,n,r,i,o){return a(U,this).recordBBox(e,t,n,r,i,o),this}recordCharacterBBox(e,t,n,r=1,i=0,o=0,s){let c=n.bbox,l,u;if(c&&(l=c[2]!==c[0]&&c[3]!==c[1]&&a(lo,this).get(n),l!==!1&&(u=[0,0,0,0],M.axialAlignedBoundingBox(c,n.fontMatrix,u),(r!==1||i!==0||o!==0)&&M.scaleMinMax([r,0,0,-r,i,o],u),l)))return this.recordBBox(e,t,u[0],u[2],u[1],u[3]);if(!s)return this.recordFullPageBBox(e);let d=s();return c&&u&&l===void 0&&(l=u[0]<=i-d.actualBoundingBoxLeft&&u[2]>=i+d.actualBoundingBoxRight&&u[1]<=o-d.actualBoundingBoxAscent&&u[3]>=o+d.actualBoundingBoxDescent,a(lo,this).set(n,l),l)?this.recordBBox(e,t,u[0],u[2],u[1],u[3]):this.recordBBox(e,t,i-d.actualBoundingBoxLeft,i+d.actualBoundingBoxRight,o-d.actualBoundingBoxAscent,o+d.actualBoundingBoxDescent)}recordFullPageBBox(e){return a(U,this).recordFullPageBBox(e),this}getSimpleIndex(e){return a(ao,this)[e]}recordDependencies(e,t){let n=a(co,this),r=a(ao,this),i=a(oo,this);for(let e of t)e in a(ao,this)?n.add(r[e]):e in i&&i[e].forEach(n.add,n);return this}recordNamedDependency(e,t){return a(so,this).has(t)&&a(co,this).add(a(so,this).get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[Va]),a(uo,this)){let t=Ya(a(uo,this),e),{dependencies:n}=t;a(co,this).forEach(n.add,n),a(U,this)._savesStack.forEach(n.add,n),a(U,this)._markedContentStack.forEach(n.add,n),n.delete(e),t.isRenderingOperation=!0}let n=!t&&e===a(U,this)._pendingBBoxIdx;return a(U,this).recordOperation(e,t,[a(co,this),a(U,this)._savesStack,a(U,this)._markedContentStack]),n&&a(co,this).clear(),this}recordShowTextOperation(e,t=!1){let n=Array.from(a(co,this));this.recordOperation(e,t),this.recordIncrementalData(`sameLineText`,e);for(let e of n)this.recordIncrementalData(`sameLineText`,e);return this}bboxToClipBoxDropOperation(e,t=!1){let n=!t&&e===a(U,this)._pendingBBoxIdx;return a(U,this).bboxToClipBoxDropOperation(e),n&&a(co,this).clear(),this}take(){return a(lo,this).clear(),a(U,this).take()}takeDebugMetadata(){return a(uo,this)}},W=new WeakMap,mo=new WeakMap,ho=new WeakMap,go=new WeakMap,_o=new WeakMap,vo=class e{constructor(t,n,i){if(r(this,W,void 0),r(this,mo,void 0),r(this,ho,void 0),r(this,go,0),r(this,_o,0),t instanceof e&&a(ho,t)===!!i)return t;o(W,this,t),o(mo,this,n),o(ho,this,!!i)}get clipBox(){return a(W,this).clipBox}growOperationsCount(){throw Error(`Unreachable`)}save(e){var t;return o(_o,this,(t=a(_o,this),t++,t)),a(W,this).save(a(mo,this)),this}restore(e){if(a(_o,this)>0){var t;a(W,this).restore(a(mo,this)),o(_o,this,(t=a(_o,this),t--,t))}return this}recordOpenMarker(e){var t;return o(go,this,(t=a(go,this),t++,t)),this}getOpenMarker(){return a(go,this)>0?a(mo,this):a(W,this).getOpenMarker()}recordCloseMarker(e){var t;return o(go,this,(t=a(go,this),t--,t)),this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return a(W,this).pushBaseTransform(e),this}popBaseTransform(){return a(W,this).popBaseTransform(),this}recordSimpleData(e,t){return a(W,this).recordSimpleData(e,a(mo,this)),this}recordIncrementalData(e,t){return a(W,this).recordIncrementalData(e,a(mo,this)),this}resetIncrementalData(e,t){return a(W,this).resetIncrementalData(e,a(mo,this)),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,n){return a(W,this).recordSimpleDataFromNamed(e,t,a(mo,this)),this}recordFutureForcedDependency(e,t){return a(W,this).recordFutureForcedDependency(e,a(mo,this)),this}inheritSimpleDataAsFutureForcedDependencies(e){return a(W,this).inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return a(W,this).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return a(ho,this)||a(W,this).resetBBox(a(mo,this)),this}recordClipBox(e,t,n,r,i,o){return a(ho,this)||a(W,this).recordClipBox(a(mo,this),t,n,r,i,o),this}recordBBox(e,t,n,r,i,o){return a(ho,this)||a(W,this).recordBBox(a(mo,this),t,n,r,i,o),this}recordCharacterBBox(e,t,n,r,i,o,s){return a(ho,this)||a(W,this).recordCharacterBBox(a(mo,this),t,n,r,i,o,s),this}recordFullPageBBox(e){return a(ho,this)||a(W,this).recordFullPageBBox(a(mo,this)),this}getSimpleIndex(e){return a(W,this).getSimpleIndex(e)}recordDependencies(e,t){return a(W,this).recordDependencies(a(mo,this),t),this}recordNamedDependency(e,t){return a(W,this).recordNamedDependency(a(mo,this),t),this}recordOperation(e){return a(W,this).recordOperation(a(mo,this),!0),this}recordShowTextOperation(e){return a(W,this).recordShowTextOperation(a(mo,this),!0),this}bboxToClipBoxDropOperation(e){return a(ho,this)||a(W,this).bboxToClipBoxDropOperation(a(mo,this),!0),this}take(){throw Error(`Unreachable`)}takeDebugMetadata(){throw Error(`Unreachable`)}},yo={stroke:[`path`,`transform`,`filter`,`strokeColor`,`strokeAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`dash`],fill:[`path`,`transform`,`filter`,`fillColor`,`fillAlpha`,`globalCompositeOperation`,`SMask`],imageXObject:[`transform`,`SMask`,`filter`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`],rawFillPath:[`filter`,`fillColor`,`fillAlpha`],showText:[`transform`,`leading`,`charSpacing`,`wordSpacing`,`hScale`,`textRise`,`moveText`,`textMatrix`,`font`,`fontObj`,`filter`,`fillColor`,`textRenderingMode`,`SMask`,`fillAlpha`,`strokeAlpha`,`globalCompositeOperation`,`sameLineText`],transform:[`transform`],transformAndFill:[`transform`,`fillColor`]},bo=new WeakMap,xo=new WeakMap,So=new WeakMap,Co=new WeakMap,wo=new WeakMap,To=class{constructor(e){r(this,bo,void 0),r(this,xo,void 0),r(this,So,4),r(this,Co,0),r(this,wo,new Eo._(a(So,this)*6)),o(bo,this,e.width),o(xo,this,e.height)}record(e,t,n,r){var i;if(a(Co,this)===a(So,this)){o(So,this,a(So,this)*2);let e=new Eo._(a(So,this)*6);e.set(a(wo,this)),o(wo,this,e)}let s=M.domMatrixToTransform(e.getTransform()),c;if(r[0]!==1/0){let e=te.slice();M.axialAlignedBoundingBox([0,-n,t,0],s,e);let i=M.intersect(r,e);if(!i)return;let[a,o,l,u]=i;if(a!==e[0]||o!==e[1]||l!==e[2]||u!==e[3]){let e=Math.atan2(s[1],s[0]),t=Math.abs(Math.sin(e)),n=Math.abs(Math.cos(e));if(t<1e-6||n<1e-6||Math.abs(t-n)<1e-6)c=[a,o,a,u,l,o];else{let e=l-a,r=u-o,i=t*t,s=n*n,d=n*t,f=s-i,p=(r*s-e*d)/f;c=[a+(r*d-e*i)/f,o,a,o+p,l,u-p]}}}c||(c=[0,-n,0,0,t,-n],M.applyTransform(c,s,0),M.applyTransform(c,s,2),M.applyTransform(c,s,4)),c[0]/=a(bo,this),c[1]/=a(xo,this),c[2]/=a(bo,this),c[3]/=a(xo,this),c[4]/=a(bo,this),c[5]/=a(xo,this),a(wo,this).set(c,a(Co,this)*6),o(Co,this,(i=a(Co,this),i++,i))}take(){return a(wo,this).subarray(0,a(Co,this)*6)}},Eo={_:Ie.isFloat16ArraySupported?Float16Array:Float32Array},Do=new WeakMap,Oo=class{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){r(this,Do,new Set),this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement(`style`),this._document.documentElement.getElementsByTagName(`head`)[0].append(this.styleElement));let t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),a(Do,this).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:n}){if(!(!e||a(Do,this).has(e.loadedName))){if(xe(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:r,style:i}=e,o=new FontFace(t,r,i);this.addNativeFontFace(o);try{await o.load(),a(Do,this).add(t),n==null||n(e)}catch{k(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}A(`Not implemented: loadSystemFont without the Font Loading API.`)}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){let t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw k(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(t=>{let n=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){var e;let t=!!((e=this._document)!=null&&e.fonts);return j(this,`isFontLoadingAPISupported`,t)}get isSyncFontLoadingSupported(){return j(this,`isSyncFontLoadingSupported`,E||Ie.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(xe(!r.done,`completeRequest() cannot be called twice.`),r.done=!0;n.length>0&&n[0].done;){let e=n.shift();setTimeout(e.callback,0)}}let{loadingRequests:n}=this,r={done:!1,complete:t,callback:e};return n.push(r),r}get _loadTestFont(){let e=atob(`T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==`);return j(this,`_loadTestFont`,e)}_prepareFontLoadEvent(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3)&255}function r(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function i(e,t,n,r){let i=e.substring(0,t),a=e.substring(t+n);return i+r+a}let a,o,s=this._document.createElement(`canvas`);s.width=1,s.height=1;let c=s.getContext(`2d`),l=0;function u(e,t){if(++l>30){k(`Load test font never loaded.`),t();return}if(c.font=`30px `+e,c.fillText(`.`,0,20),c.getImageData(0,0,1,1).data[3]>0){t();return}setTimeout(u.bind(null,e,t))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=i(f,976,d.length,d);let p=1482184792,m=n(f,16);for(a=0,o=d.length-3;a<o;a+=4)m=m-p+n(d,a)|0;a<d.length&&(m=m-p+n(d+`XXX`,a)|0),f=i(f,16,4,r(m));let h=`@font-face {font-family:"${d}";src:${`url(data:font/opentype;base64,${btoa(f)});`}}`;this.insertRule(h);let g=this._document.createElement(`div`);g.style.visibility=`hidden`,g.style.width=g.style.height=`10px`,g.style.position=`absolute`,g.style.top=g.style.left=`0px`;for(let t of[e.loadedName,d]){let e=this._document.createElement(`span`);e.textContent=`Hi`,e.style.fontFamily=t,g.append(e)}this._document.body.append(g),u(d,()=>{g.remove(),t.complete()})}},G=new WeakMap,ko=class{constructor(t,n=null,i,a){e(this,`compiledGlyphs`,Object.create(null)),r(this,G,void 0),o(G,this,t),this._inspectFont=n,i&&(this.charProcOperatorList=i),a&&Object.assign(this,a)}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var e;if(!this.data||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${t}}`}return(e=this._inspectFont)==null||e.call(this,this,t),n}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let n=this.loadedName+`_path_`+t,r;try{r=e.get(n)}catch(e){k(`getPathGenerator - ignoring character: "${e}".`)}let i=jt(r==null?void 0:r.path);return this.fontExtraProperties||e.delete(n),this.compiledGlyphs[t]=i}get black(){return a(G,this).black}get bold(){return a(G,this).bold}get disableFontFace(){return a(G,this).disableFontFace}set disableFontFace(e){j(this,`disableFontFace`,!!e)}get fontExtraProperties(){return a(G,this).fontExtraProperties}get isInvalidPDFjsFont(){return a(G,this).isInvalidPDFjsFont}get isType3Font(){return a(G,this).isType3Font}get italic(){return a(G,this).italic}get missingFile(){return a(G,this).missingFile}get remeasure(){return a(G,this).remeasure}get vertical(){return a(G,this).vertical}get ascent(){return a(G,this).ascent}get defaultWidth(){return a(G,this).defaultWidth}get descent(){return a(G,this).descent}get bbox(){return a(G,this).bbox}get fontMatrix(){return a(G,this).fontMatrix}get fallbackName(){return a(G,this).fallbackName}get loadedName(){return a(G,this).loadedName}get mimetype(){return a(G,this).mimetype}get name(){return a(G,this).name}get data(){return a(G,this).data}clearData(){a(G,this).clearData()}get cssFontInfo(){return a(G,this).cssFontInfo}get systemFontInfo(){return a(G,this).systemFontInfo}get defaultVMetrics(){return a(G,this).defaultVMetrics}},Ao=class{};e(Ao,`strings`,[`fontFamily`,`fontWeight`,`italicAngle`]);var jo=class{};e(jo,`strings`,[`css`,`loadedName`,`baseFontName`,`src`]);var Mo=class{};p=Mo,e(Mo,`bools`,[`black`,`bold`,`disableFontFace`,`fontExtraProperties`,`isInvalidPDFjsFont`,`isType3Font`,`italic`,`missingFile`,`remeasure`,`vertical`]),e(Mo,`numbers`,[`ascent`,`defaultWidth`,`descent`]),e(Mo,`strings`,[`fallbackName`,`loadedName`,`mimetype`,`name`]),e(Mo,`OFFSET_NUMBERS`,Math.ceil(p.bools.length*2/8)),e(Mo,`OFFSET_BBOX`,p.OFFSET_NUMBERS+p.numbers.length*8),e(Mo,`OFFSET_FONT_MATRIX`,p.OFFSET_BBOX+1+8),e(Mo,`OFFSET_DEFAULT_VMETRICS`,p.OFFSET_FONT_MATRIX+1+48),e(Mo,`OFFSET_STRINGS`,p.OFFSET_DEFAULT_VMETRICS+1+6);var No=class{};e(No,`KIND`,0),e(No,`HAS_BBOX`,1),e(No,`HAS_BACKGROUND`,2),e(No,`SHADING_TYPE`,3),e(No,`N_COORD`,4),e(No,`N_COLOR`,8),e(No,`N_STOP`,12),e(No,`N_FIGURES`,16);var Po=new WeakMap,Fo=new WeakMap,Io=new WeakMap,Lo=new WeakSet,Ro=class{constructor(e){i(this,Lo),r(this,Po,void 0),r(this,Fo,new TextDecoder),r(this,Io,void 0),o(Po,this,e),o(Io,this,new DataView(e))}get fontFamily(){return n(Lo,this,zo).call(this,0)}get fontWeight(){return n(Lo,this,zo).call(this,1)}get italicAngle(){return n(Lo,this,zo).call(this,2)}};function zo(e){xe(e<Ao.strings.length,`Invalid string index`);let t=0;for(let n=0;n<e;n++)t+=a(Io,this).getUint32(t)+4;let n=a(Io,this).getUint32(t);return a(Fo,this).decode(new Uint8Array(a(Po,this),t+4,n))}var Bo=new WeakMap,Vo=new WeakMap,Ho=new WeakMap,Uo=new WeakSet,Wo=class{constructor(e){i(this,Uo),r(this,Bo,void 0),r(this,Vo,new TextDecoder),r(this,Ho,void 0),o(Bo,this,e),o(Ho,this,new DataView(e))}get guessFallback(){return a(Ho,this).getUint8(0)!==0}get css(){return n(Uo,this,Go).call(this,0)}get loadedName(){return n(Uo,this,Go).call(this,1)}get baseFontName(){return n(Uo,this,Go).call(this,2)}get src(){return n(Uo,this,Go).call(this,3)}get style(){let e=1;e+=4+a(Ho,this).getUint32(e);let t=a(Ho,this).getUint32(e),n=a(Vo,this).decode(new Uint8Array(a(Bo,this),e+4,t));e+=4+t;let r=a(Ho,this).getUint32(e);return{style:n,weight:a(Vo,this).decode(new Uint8Array(a(Bo,this),e+4,r))}}};function Go(e){xe(e<jo.strings.length,`Invalid string index`);let t=5;for(let n=0;n<e;n++)t+=a(Ho,this).getUint32(t)+4;let n=a(Ho,this).getUint32(t);return a(Vo,this).decode(new Uint8Array(a(Bo,this),t+4,n))}var Ko=new WeakMap,qo=new WeakMap,Jo=new WeakMap,Yo=new WeakSet,Xo=class{constructor({buffer:e,extra:t}){i(this,Yo),r(this,Ko,void 0),r(this,qo,new TextDecoder),r(this,Jo,void 0),o(Ko,this,e),o(Jo,this,new DataView(e)),t&&Object.assign(this,t)}get black(){return n(Yo,this,Zo).call(this,0)}get bold(){return n(Yo,this,Zo).call(this,1)}get disableFontFace(){return n(Yo,this,Zo).call(this,2)}get fontExtraProperties(){return n(Yo,this,Zo).call(this,3)}get isInvalidPDFjsFont(){return n(Yo,this,Zo).call(this,4)}get isType3Font(){return n(Yo,this,Zo).call(this,5)}get italic(){return n(Yo,this,Zo).call(this,6)}get missingFile(){return n(Yo,this,Zo).call(this,7)}get remeasure(){return n(Yo,this,Zo).call(this,8)}get vertical(){return n(Yo,this,Zo).call(this,9)}get ascent(){return n(Yo,this,Qo).call(this,0)}get defaultWidth(){return n(Yo,this,Qo).call(this,1)}get descent(){return n(Yo,this,Qo).call(this,2)}get bbox(){return n(Yo,this,$o).call(this,Mo.OFFSET_BBOX,4,`getInt16`,2)}get fontMatrix(){return n(Yo,this,$o).call(this,Mo.OFFSET_FONT_MATRIX,6,`getFloat64`,8)}get defaultVMetrics(){return n(Yo,this,$o).call(this,Mo.OFFSET_DEFAULT_VMETRICS,3,`getInt16`,2)}get fallbackName(){return n(Yo,this,es).call(this,0)}get loadedName(){return n(Yo,this,es).call(this,1)}get mimetype(){return n(Yo,this,es).call(this,2)}get name(){return n(Yo,this,es).call(this,3)}get data(){let{offset:e,length:t}=n(Yo,this,ts).call(this);return t===0?void 0:new Uint8Array(a(Ko,this),e+4,t)}clearData(){let{offset:e,length:t}=n(Yo,this,ts).call(this);t!==0&&(a(Jo,this).setUint32(e,0),o(Ko,this,new Uint8Array(a(Ko,this),0,e+4).slice().buffer),o(Jo,this,new DataView(a(Ko,this))))}get cssFontInfo(){let e=Mo.OFFSET_STRINGS,t=a(Jo,this).getUint32(e);e+=4+t;let n=a(Jo,this).getUint32(e);e+=4+n;let r=a(Jo,this).getUint32(e);if(r===0)return null;let i=new Uint8Array(r);return i.set(new Uint8Array(a(Ko,this),e+4,r)),new Ro(i.buffer)}get systemFontInfo(){let e=Mo.OFFSET_STRINGS,t=a(Jo,this).getUint32(e);e+=4+t;let n=a(Jo,this).getUint32(e);if(n===0)return null;let r=new Uint8Array(n);return r.set(new Uint8Array(a(Ko,this),e+4,n)),new Wo(r.buffer)}};function Zo(e){xe(e<Mo.bools.length,`Invalid boolean index`);let t=Math.floor(e/4),n=e*2%8,r=a(Jo,this).getUint8(t)>>n&3;return r===0?void 0:r===2}function Qo(e){return xe(e<Mo.numbers.length,`Invalid number index`),a(Jo,this).getFloat64(Mo.OFFSET_NUMBERS+e*8)}function $o(e,t,n,r){let i=a(Jo,this).getUint8(e);if(i===0)return;xe(i===t,`Invalid array length.`),e+=1;let o=Array(i);for(let t=0;t<i;t++)o[t]=a(Jo,this)[n](e,!0),e+=r;return o}function es(e){xe(e<Mo.strings.length,`Invalid string index`);let t=Mo.OFFSET_STRINGS+4;for(let n=0;n<e;n++)t+=a(Jo,this).getUint32(t)+4;let n=a(Jo,this).getUint32(t);return a(qo,this).decode(new Uint8Array(a(Ko,this),t+4,n))}function ts(){let e=Mo.OFFSET_STRINGS,t=a(Jo,this).getUint32(e);e+=4+t;let n=a(Jo,this).getUint32(e);e+=4+n;let r=a(Jo,this).getUint32(e);e+=4+r;let i=a(Jo,this).getUint32(e);return{offset:e,length:i}}var ns=class{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){let e=this.view,t=this.data[No.KIND],n=!!this.data[No.HAS_BBOX],r=!!this.data[No.HAS_BACKGROUND],i=e.getUint32(No.N_COORD,!0),a=e.getUint32(No.N_COLOR,!0),o=e.getUint32(No.N_STOP,!0),s=20,c=new Float32Array(this.buffer,s,i*2);s+=i*8;let l=new Uint8Array(this.buffer,s,a*4);s+=a*4;let u=[];for(let t=0;t<o;++t){let t=e.getFloat32(s,!0);s+=4;let n=e.getUint32(s,!0);s+=4,u.push([t,`#${n.toString(16).padStart(6,`0`)}`])}let d=null;if(n){d=[];for(let t=0;t<4;++t)d.push(e.getFloat32(s,!0)),s+=4}let f=null;if(r&&(f=new Uint8Array(this.buffer,s,3),s+=3),t===1)return[`RadialAxial`,`axial`,d,u,Array.from(c.slice(0,2)),Array.from(c.slice(2,4)),null,null];if(t===2)return[`RadialAxial`,`radial`,d,u,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(t===3){let e=this.data[No.SHADING_TYPE],t=null;if(c.length>0){t=te.slice();for(let e=0,n=c.length;e<n;e+=2)M.pointBoundingBox(c[e],c[e+1],t)}return[`Mesh`,e,c,l,i,t,d,f]}throw Error(`Unsupported pattern kind: ${t}`)}},rs=new WeakMap,is=class{constructor(e){r(this,rs,void 0),o(rs,this,e)}get path(){return Ie.isFloat16ArraySupported?new Float16Array(a(rs,this)):new Float32Array(a(rs,this))}};function as(e){if(e instanceof URL)return e;if(typeof e==`string`){if(E){if(/^[a-z][a-z0-9\-+.]+:/i.test(e))return new URL(e);let t=process.getBuiltinModule(`url`);return new URL(t.pathToFileURL(e))}let t=URL.parse(e,window.location);if(t)return t}throw Error(`Invalid PDF url data: either string or URL-object is expected in the url property.`)}function os(e){if(E&&typeof Buffer<`u`&&e instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e==`string`)return Pe(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e==`object`&&!isNaN(e==null?void 0:e.length))return new Uint8Array(e);throw Error(`Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.`)}function ss(e){if(typeof e!=`string`)return null;if(e.endsWith(`/`))return e;throw Error(`Invalid factory url: "${e}" must include trailing slash.`)}var cs=e=>typeof e==`object`&&Number.isInteger(e==null?void 0:e.num)&&e.num>=0&&Number.isInteger(e==null?void 0:e.gen)&&e.gen>=0,ls=Ge.bind(null,cs,e=>typeof e==`object`&&typeof(e==null?void 0:e.name)==`string`),us=new WeakMap,ds=new WeakMap,fs=class{constructor(){r(this,us,new Map),r(this,ds,Promise.resolve())}postMessage(e,t){let n={data:structuredClone(e,t?{transfer:t}:null)};a(ds,this).then(()=>{for(let[e]of a(us,this))e.call(this,n)})}addEventListener(e,t,n=null){let r=null;if((n==null?void 0:n.signal)instanceof AbortSignal){let{signal:i}=n;if(i.aborted){k("LoopbackPort - cannot use an `aborted` signal.");return}let a=()=>this.removeEventListener(e,t);r=()=>i.removeEventListener(`abort`,a),i.addEventListener(`abort`,a)}a(us,this).set(t,r)}removeEventListener(e,t){let n=a(us,this).get(t);n==null||n(),a(us,this).delete(t)}terminate(){for(let[,e]of a(us,this))e==null||e();a(us,this).clear()}},ps={DATA:1,ERROR:2},ms={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function hs(){}function gs(e){if(e instanceof Me||e instanceof ke||e instanceof De||e instanceof Ae||e instanceof Oe)return e;switch(e instanceof Error||typeof e==`object`&&e||A(`wrapReason: Expected "reason" to be a (possibly cloned) Error.`),e.name){case`AbortException`:return new Me(e.message);case`InvalidPDFException`:return new ke(e.message);case`PasswordException`:return new De(e.message,e.code);case`ResponseException`:return new Ae(e.message,e.status,e.missing);case`UnknownErrorException`:return new Oe(e.message,e.details)}return new Oe(e.message,e.toString())}var _s=new WeakMap,vs=new WeakSet,ys=class{constructor(e,t,o){i(this,vs),r(this,_s,new AbortController),this.sourceName=e,this.targetName=t,this.comObj=o,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),o.addEventListener(`message`,n(vs,this,bs).bind(this),{signal:a(_s,this).signal})}on(e,t){let n=this.actionHandler;if(n[e])throw Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){let r=this.callbackId++,i=Promise.withResolvers();this.callbackCapabilities[r]=i;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},n)}catch(e){i.reject(e)}return i.promise}sendWithStream(e,t,n,r){let i=this.streamId++,a=this.sourceName,o=this.targetName,s=this.comObj;return new ReadableStream({start:n=>{let c=Promise.withResolvers();return this.streamControllers[i]={controller:n,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},s.postMessage({sourceName:a,targetName:o,action:e,streamId:i,data:t,desiredSize:n.desiredSize},r),c.promise},pull:e=>{let t=Promise.withResolvers();return this.streamControllers[i].pullCall=t,s.postMessage({sourceName:a,targetName:o,stream:ms.PULL,streamId:i,desiredSize:e.desiredSize}),t.promise},cancel:e=>{xe(e instanceof Error,`cancel must have a valid reason`);let t=Promise.withResolvers();return this.streamControllers[i].cancelCall=t,this.streamControllers[i].isClosed=!0,s.postMessage({sourceName:a,targetName:o,stream:ms.CANCEL,streamId:i,reason:gs(e)}),t.promise}},n)}destroy(){var e;(e=a(_s,this))==null||e.abort(),o(_s,this,null)}};function bs({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){n(vs,this,Ss).call(this,e);return}if(e.callback){let t=e.callbackId,n=this.callbackCapabilities[t];if(!n)throw Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===ps.DATA)n.resolve(e.data);else if(e.callback===ps.ERROR)n.reject(gs(e.reason));else throw Error(`Unexpected callback case`);return}let t=this.actionHandler[e.action];if(!t)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let n=this.sourceName,r=e.sourceName,i=this.comObj;Promise.try(t,e.data).then(function(t){i.postMessage({sourceName:n,targetName:r,callback:ps.DATA,callbackId:e.callbackId,data:t})},function(t){i.postMessage({sourceName:n,targetName:r,callback:ps.ERROR,callbackId:e.callbackId,reason:gs(t)})});return}if(e.streamId){n(vs,this,xs).call(this,e);return}t(e.data)}function xs(e){let t=e.streamId,n=this.sourceName,r=e.sourceName,i=this.comObj,a=this,o=this.actionHandler[e.action],s={enqueue(e,a=1,o){if(this.isCancelled)return;let s=this.desiredSize;this.desiredSize-=a,s>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:r,stream:ms.ENQUEUE,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:ms.CLOSE,streamId:t}),delete a.streamSinks[t])},error(e){xe(e instanceof Error,`error must have a valid reason`),!this.isCancelled&&(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:r,stream:ms.ERROR,streamId:t,reason:gs(e)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};s.sinkCapability.resolve(),s.ready=s.sinkCapability.promise,this.streamSinks[t]=s,Promise.try(o,e.data,s).then(function(){i.postMessage({sourceName:n,targetName:r,stream:ms.START_COMPLETE,streamId:t,success:!0})},function(e){i.postMessage({sourceName:n,targetName:r,stream:ms.START_COMPLETE,streamId:t,reason:gs(e)})})}function Ss(e){let t=e.streamId,r=this.sourceName,i=e.sourceName,a=this.comObj,o=this.streamControllers[t],s=this.streamSinks[t];switch(e.stream){case ms.START_COMPLETE:e.success?o.startCall.resolve():o.startCall.reject(gs(e.reason));break;case ms.PULL_COMPLETE:e.success?o.pullCall.resolve():o.pullCall.reject(gs(e.reason));break;case ms.PULL:if(!s){a.postMessage({sourceName:r,targetName:i,stream:ms.PULL_COMPLETE,streamId:t,success:!0});break}s.desiredSize<=0&&e.desiredSize>0&&s.sinkCapability.resolve(),s.desiredSize=e.desiredSize,Promise.try(s.onPull||hs).then(function(){a.postMessage({sourceName:r,targetName:i,stream:ms.PULL_COMPLETE,streamId:t,success:!0})},function(e){a.postMessage({sourceName:r,targetName:i,stream:ms.PULL_COMPLETE,streamId:t,reason:gs(e)})});break;case ms.ENQUEUE:if(xe(o,`enqueue should have stream controller`),o.isClosed)break;o.controller.enqueue(e.chunk);break;case ms.CLOSE:if(xe(o,`close should have stream controller`),o.isClosed)break;o.isClosed=!0,o.controller.close(),n(vs,this,Cs).call(this,o,t);break;case ms.ERROR:xe(o,`error should have stream controller`),o.controller.error(gs(e.reason)),n(vs,this,Cs).call(this,o,t);break;case ms.CANCEL_COMPLETE:e.success?o.cancelCall.resolve():o.cancelCall.reject(gs(e.reason)),n(vs,this,Cs).call(this,o,t);break;case ms.CANCEL:if(!s)break;let c=gs(e.reason);Promise.try(s.onCancel||hs,c).then(function(){a.postMessage({sourceName:r,targetName:i,stream:ms.CANCEL_COMPLETE,streamId:t,success:!0})},function(e){a.postMessage({sourceName:r,targetName:i,stream:ms.CANCEL_COMPLETE,streamId:t,reason:gs(e)})}),s.sinkCapability.reject(c),s.isCancelled=!0,delete this.streamSinks[t];break;default:throw Error(`Unexpected stream case`)}}async function Cs(e,t){var n,r,i;await Promise.allSettled([(n=e.startCall)==null?void 0:n.promise,(r=e.pullCall)==null?void 0:r.promise,(i=e.cancelCall)==null?void 0:i.promise]),delete this.streamControllers[t]}var ws=new WeakMap,Ts=class{constructor({cMapUrl:e=null,standardFontDataUrl:t=null,wasmUrl:n=null}){r(this,ws,Object.freeze({cMapUrl:`CMap`,standardFontDataUrl:`font`,wasmUrl:`wasm`})),this.cMapUrl=e,this.standardFontDataUrl=t,this.wasmUrl=n}async fetch({kind:e,filename:t}){switch(e){case`cMapUrl`:case`standardFontDataUrl`:case`wasmUrl`:break;default:A(`Not implemented: ${e}`)}let n=this[e];if(!n)throw Error(`Ensure that the \`${e}\` API parameter is provided.`);let r=`${n}${t}`;return this._fetch(r,e).catch(t=>{throw Error(`Unable to load ${a(ws,this)[e]} data at: ${r}`)})}async _fetch(e,t){A("Abstract method `_fetch` called.")}},Es=class extends Ts{async _fetch(e,t){let n=await $e(e,t===`cMapUrl`&&!e.endsWith(`.bcmap`)?`text`:`bytes`);return n instanceof Uint8Array?n:Pe(n)}},Ds=new WeakMap,Os=class{constructor({enableHWA:e=!1}){r(this,Ds,!1),o(Ds,this,e)}create(e,t){if(e<=0||t<=0)throw Error(`Invalid canvas size`);let n=this._createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`,{willReadFrequently:!a(Ds,this)})}}reset({canvas:e},t,n){if(!e)throw Error(`Canvas is not specified`);if(t<=0||n<=0)throw Error(`Invalid canvas size`);e.width=t,e.height=n}destroy(e){let{canvas:t}=e;if(!t)throw Error(`Canvas is not specified`);t.width=t.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){A("Abstract method `_createCanvas` called.")}},ks=class extends Os{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}},As=class{addFilter(e){return`none`}addHCMFilter(e,t){return`none`}addAlphaFilter(e){return`none`}addLuminosityFilter(e){return`none`}addHighlightHCMFilter(e,t,n,r,i){return`none`}destroy(e=!1){}},js=new WeakMap,Ms=new WeakMap,Ns=new WeakMap,Ps=new WeakMap,Fs=new WeakMap,Is=new WeakMap,Ls=new WeakMap,K=new WeakSet,Rs=class extends As{constructor({docId:e,ownerDocument:t=globalThis.document}){super(),i(this,K),r(this,js,void 0),r(this,Ms,void 0),r(this,Ns,void 0),r(this,Ps,void 0),r(this,Fs,void 0),r(this,Is,void 0),r(this,Ls,0),o(Ps,this,e),o(Fs,this,t)}addFilter(e){var t,r;if(!e)return`none`;let i=zs.call(n(K,this)).get(e);if(i)return i;let[s,c,l]=n(K,this,Hs).call(this,e),u=e.length===1?s:`${s}${c}${l}`;if(i=zs.call(n(K,this)).get(u),i)return zs.call(n(K,this)).set(e,i),i;let d=`g_${a(Ps,this)}_transfer_map_${o(Ls,this,(t=a(Ls,this),r=t++,t)),r}`,f=n(K,this,Us).call(this,d);zs.call(n(K,this)).set(e,f),zs.call(n(K,this)).set(u,f);let p=n(K,this,Ks).call(this,d);return n(K,this,Js).call(this,s,c,l,p),f}addHCMFilter(e,t){let r=`${e}-${t}`,i=`base`,o=Bs.call(n(K,this)).get(i);if((o==null?void 0:o.key)===r)return o.url;if(o){var s;(s=o.filter)==null||s.remove(),o.key=r,o.url=`none`,o.filter=null}else o={key:r,url:`none`,filter:null},Bs.call(n(K,this)).set(i,o);if(!e||!t)return o.url;let c=n(K,this,Xs).call(this,e);e=M.makeHexColor(...c);let l=n(K,this,Xs).call(this,t);if(t=M.makeHexColor(...l),Vs.call(n(K,this)).style.color=``,e===`#000000`&&t===`#ffffff`||e===t)return o.url;let u=Array(256);for(let e=0;e<=255;e++){let t=e/255;u[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}let d=u.join(`,`),f=`g_${a(Ps,this)}_hcm_filter`,p=o.filter=n(K,this,Ks).call(this,f);n(K,this,Js).call(this,d,d,d,p),n(K,this,Gs).call(this,p);let m=(e,t)=>{let n=c[e]/255,r=l[e]/255,i=Array(t+1);for(let e=0;e<=t;e++)i[e]=n+e/t*(r-n);return i.join(`,`)};return n(K,this,Js).call(this,m(0,5),m(1,5),m(2,5),p),o.url=n(K,this,Us).call(this,f),o.url}addAlphaFilter(e){var t,r;let i=zs.call(n(K,this)).get(e);if(i)return i;let[s]=n(K,this,Hs).call(this,[e]),c=`alpha_${s}`;if(i=zs.call(n(K,this)).get(c),i)return zs.call(n(K,this)).set(e,i),i;let l=`g_${a(Ps,this)}_alpha_map_${o(Ls,this,(t=a(Ls,this),r=t++,t)),r}`,u=n(K,this,Us).call(this,l);zs.call(n(K,this)).set(e,u),zs.call(n(K,this)).set(c,u);let d=n(K,this,Ks).call(this,l);return n(K,this,Ys).call(this,s,d),u}addLuminosityFilter(e){var t,r;let i=zs.call(n(K,this)).get(e||`luminosity`);if(i)return i;let s,c;if(e?([s]=n(K,this,Hs).call(this,[e]),c=`luminosity_${s}`):c=`luminosity`,i=zs.call(n(K,this)).get(c),i)return zs.call(n(K,this)).set(e,i),i;let l=`g_${a(Ps,this)}_luminosity_map_${o(Ls,this,(t=a(Ls,this),r=t++,t)),r}`,u=n(K,this,Us).call(this,l);zs.call(n(K,this)).set(e,u),zs.call(n(K,this)).set(c,u);let d=n(K,this,Ks).call(this,l);return n(K,this,Ws).call(this,d),e&&n(K,this,Ys).call(this,s,d),u}addHighlightHCMFilter(e,t,r,i,o){let s=`${t}-${r}-${i}-${o}`,c=Bs.call(n(K,this)).get(e);if((c==null?void 0:c.key)===s)return c.url;if(c){var l;(l=c.filter)==null||l.remove(),c.key=s,c.url=`none`,c.filter=null}else c={key:s,url:`none`,filter:null},Bs.call(n(K,this)).set(e,c);if(!t||!r)return c.url;let[u,d]=[t,r].map(n(K,this,Xs).bind(this)),f=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),p=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[m,h]=[i,o].map(n(K,this,Xs).bind(this));p<f&&([f,p,m,h]=[p,f,h,m]),Vs.call(n(K,this)).style.color=``;let g=(e,t,n)=>{let r=Array(256),i=(p-f)/n,a=e/255,o=(t-e)/(255*n),s=0;for(let e=0;e<=n;e++){let t=Math.round(f+e*i),n=a+e*o;for(let e=s;e<=t;e++)r[e]=n;s=t+1}for(let e=s;e<256;e++)r[e]=r[s-1];return r.join(`,`)},_=`g_${a(Ps,this)}_hcm_${e}_filter`,v=c.filter=n(K,this,Ks).call(this,_);return n(K,this,Gs).call(this,v),n(K,this,Js).call(this,g(m[0],h[0],5),g(m[1],h[1],5),g(m[2],h[2],5),v),c.url=n(K,this,Us).call(this,_),c.url}destroy(e=!1){var t,n,r,i;e&&(t=a(Is,this))!=null&&t.size||((n=a(Ns,this))==null||n.parentNode.parentNode.remove(),o(Ns,this,null),(r=a(Ms,this))==null||r.clear(),o(Ms,this,null),(i=a(Is,this))==null||i.clear(),o(Is,this,null),o(Ls,this,0))}};function zs(){return a(Ms,this)||o(Ms,this,new Map)}function Bs(){return a(Is,this)||o(Is,this,new Map)}function Vs(){if(!a(Ns,this)){let e=a(Fs,this).createElement(`div`),{style:t}=e;t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=a(Fs,this).createElementNS(Ze,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),o(Ns,this,a(Fs,this).createElementNS(Ze,`defs`)),e.append(n),n.append(a(Ns,this)),a(Fs,this).body.append(e)}return a(Ns,this)}function Hs(e){if(e.length===1){let t=e[0],n=Array(256);for(let e=0;e<256;e++)n[e]=t[e]/255;let r=n.join(`,`);return[r,r,r]}let[t,n,r]=e,i=Array(256),a=Array(256),o=Array(256);for(let e=0;e<256;e++)i[e]=t[e]/255,a[e]=n[e]/255,o[e]=r[e]/255;return[i.join(`,`),a.join(`,`),o.join(`,`)]}function Us(e){if(a(js,this)===void 0){o(js,this,``);let e=a(Fs,this).URL;e!==a(Fs,this).baseURI&&(nt(e)?k(`#createUrl: ignore "data:"-URL for performance reasons.`):o(js,this,we(e,``)))}return`url(${a(js,this)}#${e})`}function Ws(e){let t=a(Fs,this).createElementNS(Ze,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0`),e.append(t)}function Gs(e){let t=a(Fs,this).createElementNS(Ze,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0`),e.append(t)}function Ks(e){let t=a(Fs,this).createElementNS(Ze,`filter`);return t.setAttribute(`color-interpolation-filters`,`sRGB`),t.setAttribute(`id`,e),Vs.call(n(K,this)).append(t),t}function qs(e,t,n){let r=a(Fs,this).createElementNS(Ze,t);r.setAttribute(`type`,`discrete`),r.setAttribute(`tableValues`,n),e.append(r)}function Js(e,t,r,i){let o=a(Fs,this).createElementNS(Ze,`feComponentTransfer`);i.append(o),n(K,this,qs).call(this,o,`feFuncR`,e),n(K,this,qs).call(this,o,`feFuncG`,t),n(K,this,qs).call(this,o,`feFuncB`,r)}function Ys(e,t){let r=a(Fs,this).createElementNS(Ze,`feComponentTransfer`);t.append(r),n(K,this,qs).call(this,r,`feFuncA`,e)}function Xs(e){return Vs.call(n(K,this)).style.color=e,ht(getComputedStyle(Vs.call(n(K,this))).getPropertyValue(`color`))}E&&k("Please use the `legacy` build in Node.js environments.");async function Zs(e){let t=await process.getBuiltinModule(`fs/promises`).readFile(e);return new Uint8Array(t)}var Qs=class extends As{},$s=class extends Os{_createCanvas(e,t){return process.getBuiltinModule(`module`).createRequire(import.meta.url)(`@napi-rs/canvas`).createCanvas(e,t)}},ec=class extends Ts{async _fetch(e,t){return Zs(e)}},tc=`
2
2
  struct Uniforms {
3
3
  offsetX : f32,
4
4
  offsetY : f32,
@@ -52,4 +52,4 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
52
52
  `)){let n=document.createElement(`div`);n.append(e?document.createTextNode(e):document.createElement(`br`)),t.append(n)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:a(Tm,this)}}),t}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};_=Am;function jm(e){let t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--total-scale-factor))`,this.translate(0,-(e-a(Om,this))*this.parentScale),o(Om,this,e),n(km,this,Pm).call(this)},r=a(Om,this);this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:O.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function Mm(e){let t=e=>{this.color=e,this.onUpdatedColor()},n=this.color;this.addCommands({cmd:t.bind(this,e),undo:t.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:O.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function Nm(){let e=[];this.editorDiv.normalize();let t=null;for(let n of this.editorDiv.childNodes)(t==null?void 0:t.nodeType)===Node.TEXT_NODE&&n.nodeName===`BR`||(e.push(Fm.call(_,n)),t=n);return e.join(`
53
53
  `)}function Pm(){let[e,t]=this.parentDimensions,n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{let{currentLayer:e,div:t}=this,r=t.style.display,i=t.classList.contains(`hidden`);t.classList.remove(`hidden`),t.style.display=`hidden`,e.div.append(this.div),n=t.getBoundingClientRect(),t.remove(),t.style.display=r,t.classList.toggle(`hidden`,i)}this.rotation%180==this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}function Fm(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(wm,``)}function Im(){if(this.editorDiv.replaceChildren(),a(Tm,this))for(let e of a(Tm,this).split(`
54
54
  `)){let t=document.createElement(`div`);t.append(e?document.createTextNode(e):document.createElement(`br`)),this.editorDiv.append(t)}}function Lm(){return a(Tm,this).replaceAll(`\xA0`,` `)}function Rm(e){return e.replaceAll(` `,`\xA0`)}function zm(e){let{value:t,fontSize:n,color:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==t||e.fontSize!==n||e.color.some((e,t)=>e!==r[t])||e.pageIndex!==i}e(Am,`_freeTextDefaultContent`,``),e(Am,`_internalPadding`,0),e(Am,`_defaultColor`,null),e(Am,`_defaultFontSize`,10),e(Am,`_type`,`freetext`),e(Am,`_editorType`,D.FREETEXT);var Y=class{toSVGPath(){A("Abstract method `toSVGPath` must be implemented.")}get box(){A("Abstract getter `box` must be implemented.")}serialize(e,t){A("Abstract method `serialize` must be implemented.")}static _rescale(e,t,n,r,i,a){a||(a=new Float32Array(e.length));for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o]*r,a[o+1]=n+e[o+1]*i;return a}static _rescaleAndSwap(e,t,n,r,i,a){a||(a=new Float32Array(e.length));for(let o=0,s=e.length;o<s;o+=2)a[o]=t+e[o+1]*r,a[o+1]=n+e[o]*i;return a}static _translate(e,t,n,r){r||(r=new Float32Array(e.length));for(let i=0,a=e.length;i<a;i+=2)r[i]=t+e[i],r[i+1]=n+e[i+1];return r}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,n,r,i){switch(i){case 90:return[1-t/n,e/r];case 180:return[1-e/n,1-t/r];case 270:return[t/n,1-e/r];default:return[e/n,t/r]}}static _normalizePagePoint(e,t,n){switch(n){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,n,r,i,a){return[(e+5*n)/6,(t+5*r)/6,(5*n+i)/6,(5*r+a)/6,(n+i)/2,(r+a)/2]}};e(Y,`PRECISION`,1e-4);var Bm=new WeakMap,Vm=new WeakMap,Hm=new WeakMap,Um=new WeakMap,Wm=new WeakMap,X=new WeakMap,Gm=new WeakMap,Km=new WeakMap,qm=new WeakMap,Jm=new WeakMap,Ym=new WeakMap,Xm=new WeakMap,Zm=new WeakMap,Qm=new WeakSet,$m=class{constructor({x:e,y:t},n,s,c,l,u=0){i(this,Qm),r(this,Bm,void 0),r(this,Vm,[]),r(this,Hm,void 0),r(this,Um,void 0),r(this,Wm,[]),r(this,X,new Float32Array(18)),r(this,Gm,void 0),r(this,Km,void 0),r(this,qm,void 0),r(this,Jm,void 0),r(this,Ym,void 0),r(this,Xm,void 0),r(this,Zm,[]),o(Bm,this,n),o(Xm,this,c*s),o(Um,this,l),a(X,this).set([NaN,NaN,NaN,NaN,e,t],6),o(Hm,this,u),o(Jm,this,sh._*s),o(qm,this,ch._*s),o(Ym,this,s),a(Zm,this).push(e,t)}isEmpty(){return isNaN(a(X,this)[8])}add({x:e,y:t}){var n;o(Gm,this,e),o(Km,this,t);let[r,i,s,c]=a(Bm,this),[l,u,d,f]=a(X,this).subarray(8,12),p=e-d,m=t-f,h=Math.hypot(p,m);if(h<a(qm,this))return!1;let g=h-a(Jm,this),_=g/h,v=_*p,y=_*m,b=l,x=u;l=d,u=f,d+=v,f+=y,(n=a(Zm,this))==null||n.push(e,t);let S=-y/g,C=v/g,w=S*a(Xm,this),T=C*a(Xm,this);return a(X,this).set(a(X,this).subarray(2,8),0),a(X,this).set([d+w,f+T],4),a(X,this).set(a(X,this).subarray(14,18),12),a(X,this).set([d-w,f-T],16),isNaN(a(X,this)[6])?(a(Wm,this).length===0&&(a(X,this).set([l+w,u+T],2),a(Wm,this).push(NaN,NaN,NaN,NaN,(l+w-r)/s,(u+T-i)/c),a(X,this).set([l-w,u-T],14),a(Vm,this).push(NaN,NaN,NaN,NaN,(l-w-r)/s,(u-T-i)/c)),a(X,this).set([b,x,l,u,d,f],6),!this.isEmpty()):(a(X,this).set([b,x,l,u,d,f],6),Math.abs(Math.atan2(x-u,b-l)-Math.atan2(y,v))<Math.PI/2?([l,u,d,f]=a(X,this).subarray(2,6),a(Wm,this).push(NaN,NaN,NaN,NaN,((l+d)/2-r)/s,((u+f)/2-i)/c),[l,u,b,x]=a(X,this).subarray(14,18),a(Vm,this).push(NaN,NaN,NaN,NaN,((b+l)/2-r)/s,((x+u)/2-i)/c),!0):([b,x,l,u,d,f]=a(X,this).subarray(0,6),a(Wm,this).push(((b+5*l)/6-r)/s,((x+5*u)/6-i)/c,((5*l+d)/6-r)/s,((5*u+f)/6-i)/c,((l+d)/2-r)/s,((u+f)/2-i)/c),[d,f,l,u,b,x]=a(X,this).subarray(12,18),a(Vm,this).push(((b+5*l)/6-r)/s,((x+5*u)/6-i)/c,((5*l+d)/6-r)/s,((5*u+f)/6-i)/c,((l+d)/2-r)/s,((u+f)/2-i)/c),!0))}toSVGPath(){if(this.isEmpty())return``;let e=a(Wm,this),t=a(Vm,this);if(isNaN(a(X,this)[6])&&!this.isEmpty())return n(Qm,this,th).call(this);let r=[];r.push(`M${e[4]} ${e[5]}`);for(let t=6;t<e.length;t+=6)isNaN(e[t])?r.push(`L${e[t+4]} ${e[t+5]}`):r.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);n(Qm,this,rh).call(this,r);for(let e=t.length-6;e>=6;e-=6)isNaN(t[e])?r.push(`L${t[e+4]} ${t[e+5]}`):r.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);return n(Qm,this,nh).call(this,r),r.join(` `)}newFreeDrawOutline(e,t,n,r,i,a){return new _h(e,t,n,r,i,a)}getOutlines(){var e;let t=a(Wm,this),r=a(Vm,this),i=a(X,this),[o,s,c,l]=a(Bm,this),u=new Float32Array((((e=a(Zm,this))==null?void 0:e.length)??0)+2);for(let e=0,t=u.length-2;e<t;e+=2)u[e]=(a(Zm,this)[e]-o)/c,u[e+1]=(a(Zm,this)[e+1]-s)/l;if(u[u.length-2]=(a(Gm,this)-o)/c,u[u.length-1]=(a(Km,this)-s)/l,isNaN(i[6])&&!this.isEmpty())return n(Qm,this,ih).call(this,u);let d=new Float32Array(a(Wm,this).length+24+a(Vm,this).length),f=t.length;for(let e=0;e<f;e+=2){if(isNaN(t[e])){d[e]=d[e+1]=NaN;continue}d[e]=t[e],d[e+1]=t[e+1]}f=n(Qm,this,oh).call(this,d,f);for(let e=r.length-6;e>=6;e-=6)for(let t=0;t<6;t+=2){if(isNaN(r[e+t])){d[f]=d[f+1]=NaN,f+=2;continue}d[f]=r[e+t],d[f+1]=r[e+t+1],f+=2}return n(Qm,this,ah).call(this,d,f),this.newFreeDrawOutline(d,u,a(Bm,this),a(Ym,this),a(Hm,this),a(Um,this))}};function eh(){let e=a(X,this).subarray(4,6),t=a(X,this).subarray(16,18),[n,r,i,o]=a(Bm,this);return[(a(Gm,this)+(e[0]-t[0])/2-n)/i,(a(Km,this)+(e[1]-t[1])/2-r)/o,(a(Gm,this)+(t[0]-e[0])/2-n)/i,(a(Km,this)+(t[1]-e[1])/2-r)/o]}function th(){let[e,t,r,i]=a(Bm,this),[o,s,c,l]=n(Qm,this,eh).call(this);return`M${(a(X,this)[2]-e)/r} ${(a(X,this)[3]-t)/i} L${(a(X,this)[4]-e)/r} ${(a(X,this)[5]-t)/i} L${o} ${s} L${c} ${l} L${(a(X,this)[16]-e)/r} ${(a(X,this)[17]-t)/i} L${(a(X,this)[14]-e)/r} ${(a(X,this)[15]-t)/i} Z`}function nh(e){let t=a(Vm,this);e.push(`L${t[4]} ${t[5]} Z`)}function rh(e){let[t,r,i,o]=a(Bm,this),s=a(X,this).subarray(4,6),c=a(X,this).subarray(16,18),[l,u,d,f]=n(Qm,this,eh).call(this);e.push(`L${(s[0]-t)/i} ${(s[1]-r)/o} L${l} ${u} L${d} ${f} L${(c[0]-t)/i} ${(c[1]-r)/o}`)}function ih(e){let t=a(X,this),[r,i,o,s]=a(Bm,this),[c,l,u,d]=n(Qm,this,eh).call(this),f=new Float32Array(36);return f.set([NaN,NaN,NaN,NaN,(t[2]-r)/o,(t[3]-i)/s,NaN,NaN,NaN,NaN,(t[4]-r)/o,(t[5]-i)/s,NaN,NaN,NaN,NaN,c,l,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,(t[16]-r)/o,(t[17]-i)/s,NaN,NaN,NaN,NaN,(t[14]-r)/o,(t[15]-i)/s],0),this.newFreeDrawOutline(f,e,a(Bm,this),a(Ym,this),a(Hm,this),a(Um,this))}function ah(e,t){let n=a(Vm,this);return e.set([NaN,NaN,NaN,NaN,n[4],n[5]],t),t+=6}function oh(e,t){let r=a(X,this).subarray(4,6),i=a(X,this).subarray(16,18),[o,s,c,l]=a(Bm,this),[u,d,f,p]=n(Qm,this,eh).call(this);return e.set([NaN,NaN,NaN,NaN,(r[0]-o)/c,(r[1]-s)/l,NaN,NaN,NaN,NaN,u,d,NaN,NaN,NaN,NaN,f,p,NaN,NaN,NaN,NaN,(i[0]-o)/c,(i[1]-s)/l],t),t+=24}var sh={_:8},ch={_:sh._+{_:2}._},lh=new WeakMap,uh=new WeakMap,dh=new WeakMap,fh=new WeakMap,ph=new WeakMap,mh=new WeakMap,hh=new WeakMap,gh=new WeakSet,_h=class extends Y{constructor(e,t,s,c,l,u){super(),i(this,gh),r(this,lh,void 0),r(this,uh,new Float32Array(4)),r(this,dh,void 0),r(this,fh,void 0),r(this,ph,void 0),r(this,mh,void 0),r(this,hh,void 0),o(hh,this,e),o(ph,this,t),o(lh,this,s),o(mh,this,c),o(dh,this,l),o(fh,this,u),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],n(gh,this,vh).call(this,u);let[d,f,p,m]=a(uh,this);for(let t=0,n=e.length;t<n;t+=2)e[t]=(e[t]-d)/p,e[t+1]=(e[t+1]-f)/m;for(let e=0,n=t.length;e<n;e+=2)t[e]=(t[e]-d)/p,t[e+1]=(t[e+1]-f)/m}toSVGPath(){let e=[`M${a(hh,this)[4]} ${a(hh,this)[5]}`];for(let t=6,n=a(hh,this).length;t<n;t+=6){if(isNaN(a(hh,this)[t])){e.push(`L${a(hh,this)[t+4]} ${a(hh,this)[t+5]}`);continue}e.push(`C${a(hh,this)[t]} ${a(hh,this)[t+1]} ${a(hh,this)[t+2]} ${a(hh,this)[t+3]} ${a(hh,this)[t+4]} ${a(hh,this)[t+5]}`)}return e.push(`Z`),e.join(` `)}serialize([e,t,n,r],i){let o=n-e,s=r-t,c,l;switch(i){case 0:c=Y._rescale(a(hh,this),e,r,o,-s),l=Y._rescale(a(ph,this),e,r,o,-s);break;case 90:c=Y._rescaleAndSwap(a(hh,this),e,t,o,s),l=Y._rescaleAndSwap(a(ph,this),e,t,o,s);break;case 180:c=Y._rescale(a(hh,this),n,t,-o,s),l=Y._rescale(a(ph,this),n,t,-o,s);break;case 270:c=Y._rescaleAndSwap(a(hh,this),n,r,-o,-s),l=Y._rescaleAndSwap(a(ph,this),n,r,-o,-s);break}return{outline:Array.from(c),points:[Array.from(l)]}}get box(){return a(uh,this)}newOutliner(e,t,n,r,i,a=0){return new $m(e,t,n,r,i,a)}getNewOutline(e,t){let[n,r,i,o]=a(uh,this),[s,c,l,u]=a(lh,this),d=i*l,f=o*u,p=n*l+s,m=r*u+c,h=this.newOutliner({x:a(ph,this)[0]*d+p,y:a(ph,this)[1]*f+m},a(lh,this),a(mh,this),e,a(fh,this),t??a(dh,this));for(let e=2;e<a(ph,this).length;e+=2)h.add({x:a(ph,this)[e]*d+p,y:a(ph,this)[e+1]*f+m});return h.getOutlines()}};function vh(e){let t=a(hh,this),n=t[4],r=t[5],i=[n,r,n,r],o=n,s=r,c=n,l=r,u=e?Math.max:Math.min,d=new Float32Array(4);for(let e=6,a=t.length;e<a;e+=6){let a=t[e+4],f=t[e+5];isNaN(t[e])?(M.pointBoundingBox(a,f,i),s>f?(o=a,s=f):s===f&&(o=u(o,a)),l<f?(c=a,l=f):l===f&&(c=u(c,a))):(d.set(te,0),M.bezierBoundingBox(n,r,...t.slice(e,e+6),d),M.rectBoundingBox(...d,i),s>d[1]?(o=d[0],s=d[1]):s===d[1]&&(o=u(o,d[0])),l<d[3]?(c=d[2],l=d[3]):l===d[3]&&(c=u(c,d[2]))),n=a,r=f}let f=a(uh,this);f[0]=i[0]-a(dh,this),f[1]=i[1]-a(dh,this),f[2]=i[2]-i[0]+2*a(dh,this),f[3]=i[3]-i[1]+2*a(dh,this),this.firstPoint=[o,s],this.lastPoint=[c,l]}var yh=new WeakMap,bh=new WeakMap,xh=new WeakMap,Sh=new WeakMap,Ch=new WeakMap,wh=new WeakSet,Th=class{constructor(e,t=0,n=0,s=!0){i(this,wh),r(this,yh,void 0),r(this,bh,void 0),r(this,xh,void 0),r(this,Sh,[]),r(this,Ch,[]);let c=te.slice(),l=10**-4;for(let{x:n,y:r,width:i,height:o}of e){let e=Math.floor((n-t)/l)*l,s=Math.ceil((n+i+t)/l)*l,u=Math.floor((r-t)/l)*l,d=Math.ceil((r+o+t)/l)*l,f=[e,u,d,!0],p=[s,u,d,!1];a(Sh,this).push(f,p),M.rectBoundingBox(e,u,s,d,c)}let u=c[2]-c[0]+2*n,d=c[3]-c[1]+2*n,f=c[0]-n,p=c[1]-n,m=s?-1/0:1/0,h=1/0,g=a(Sh,this).at(s?-1:-2),_=[g[0],g[2]];for(let e of a(Sh,this)){let[t,n,r,i]=e;!i&&s?n<h?(h=n,m=t):n===h&&(m=Math.max(m,t)):i&&!s&&(n<h?(h=n,m=t):n===h&&(m=Math.min(m,t))),e[0]=(t-f)/u,e[1]=(n-p)/d,e[2]=(r-p)/d}o(yh,this,new Float32Array([f,p,u,d])),o(bh,this,[m,h]),o(xh,this,_)}getOutlines(){a(Sh,this).sort((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2]);let e=[];for(let t of a(Sh,this))t[3]?(e.push(...n(wh,this,Ah).call(this,t)),n(wh,this,Oh).call(this,t)):(n(wh,this,kh).call(this,t),e.push(...n(wh,this,Ah).call(this,t)));return n(wh,this,Eh).call(this,e)}};function Eh(e){let t=[],n=new Set;for(let n of e){let[e,r,i]=n;t.push([e,r,n],[e,i,n])}t.sort((e,t)=>e[1]-t[1]||e[0]-t[0]);for(let e=0,r=t.length;e<r;e+=2){let r=t[e][2],i=t[e+1][2];r.push(i),i.push(r),n.add(r),n.add(i)}let r=[],i;for(;n.size>0;){let e=n.values().next().value,[t,a,o,s,c]=e;n.delete(e);let l=t,u=a;for(i=[t,o],r.push(i);;){let e;if(n.has(s))e=s;else if(n.has(c))e=c;else break;n.delete(e),[t,a,o,s,c]=e,l!==t&&(i.push(l,u,t,u===a?a:o),l=t),u=u===a?o:a}i.push(l,u)}return new Nh(r,a(yh,this),a(bh,this),a(xh,this))}function Dh(e){let t=a(Ch,this),n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i][0];if(a===e)return i;a<e?n=i+1:r=i-1}return r+1}function Oh([,e,t]){let r=n(wh,this,Dh).call(this,e);a(Ch,this).splice(r,0,[e,t])}function kh([,e,t]){let r=n(wh,this,Dh).call(this,e);for(let n=r;n<a(Ch,this).length;n++){let[r,i]=a(Ch,this)[n];if(r!==e)break;if(r===e&&i===t){a(Ch,this).splice(n,1);return}}for(let n=r-1;n>=0;n--){let[r,i]=a(Ch,this)[n];if(r!==e)break;if(r===e&&i===t){a(Ch,this).splice(n,1);return}}}function Ah(e){let[t,r,i]=e,o=[[t,r,i]],s=n(wh,this,Dh).call(this,i);for(let e=0;e<s;e++){let[n,r]=a(Ch,this)[e];for(let e=0,i=o.length;e<i;e++){let[,a,s]=o[e];if(!(r<=a||s<=n)){if(a>=n){if(s>r)o[e][1]=r;else{if(i===1)return[];o.splice(e,1),e--,i--}continue}o[e][2]=n,s>r&&o.push([t,r,s])}}}return o}var jh=new WeakMap,Mh=new WeakMap,Nh=class extends Y{constructor(e,t,n,i){super(),r(this,jh,void 0),r(this,Mh,void 0),o(Mh,this,e),o(jh,this,t),this.firstPoint=n,this.lastPoint=i}toSVGPath(){let e=[];for(let t of a(Mh,this)){let[n,r]=t;e.push(`M${n} ${r}`);for(let i=2;i<t.length;i+=2){let a=t[i],o=t[i+1];a===n?(e.push(`V${o}`),r=o):o===r&&(e.push(`H${a}`),n=a)}e.push(`Z`)}return e.join(` `)}serialize([e,t,n,r],i){let o=[],s=n-e,c=r-t;for(let t of a(Mh,this)){let n=Array(t.length);for(let i=0;i<t.length;i+=2)n[i]=e+t[i]*s,n[i+1]=r-t[i+1]*c;o.push(n)}return o}get box(){return a(jh,this)}get classNamesForOutlining(){return[`highlightOutline`]}},Ph=class extends $m{newFreeDrawOutline(e,t,n,r,i,a){return new Fh(e,t,n,r,i,a)}},Fh=class extends _h{newOutliner(e,t,n,r,i,a=0){return new Ph(e,t,n,r,i,a)}},Ih=new WeakMap,Lh=new WeakMap,Rh=new WeakMap,zh=new WeakMap,Bh=new WeakMap,Vh=new WeakMap,Hh=new WeakMap,Uh=new WeakMap,Wh=new WeakMap,Gh=new WeakMap,Kh=new WeakMap,qh=new WeakMap,Jh=new WeakMap,Yh=new WeakMap,Xh=new WeakMap,Zh=new WeakMap,Qh=new WeakMap,$h=new WeakMap,Z=new WeakSet,eg=class e extends V{static get _keyboardManager(){let t=e.prototype;return j(this,`_keyboardManager`,new Cn([[[`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({...t,name:`highlightEditor`}),i(this,Z),r(this,Ih,null),r(this,Lh,0),r(this,Rh,void 0),r(this,zh,null),r(this,Bh,null),r(this,Vh,null),r(this,Hh,null),r(this,Uh,0),r(this,Wh,null),r(this,Gh,null),r(this,Kh,null),r(this,qh,!1),r(this,Jh,null),r(this,Yh,null),r(this,Xh,null),r(this,Zh,``),r(this,Qh,void 0),r(this,$h,``),this.color=t.color||e._defaultColor,o(Qh,this,t.thickness||e._defaultThickness),this.opacity=t.opacity||e._defaultOpacity,o(Rh,this,t.boxes||null),o($h,this,t.methodOfCreation||``),o(Zh,this,t.text||``),this._isDraggable=!1,this.defaultL10nId=`pdfjs-editor-highlight-editor`,t.highlightId>-1?(o(qh,this,!0),n(Z,this,ng).call(this,t),n(Z,this,sg).call(this)):a(Rh,this)&&(o(Ih,this,t.anchorNode),o(Lh,this,t.anchorOffset),o(Hh,this,t.focusNode),o(Uh,this,t.focusOffset),n(Z,this,tg).call(this),n(Z,this,sg).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-highlight-added-alert`)}get telemetryInitialData(){return{action:`added`,type:a(qh,this)?`free_highlight`:`highlight`,color:this._uiManager.getNonHCMColorName(this.color),thickness:a(Qh,this),methodOfCreation:a($h,this)}}get telemetryFinalData(){return{type:`highlight`,color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get(`color`).size}}static initialize(t,n){var r;V.initialize(t,n),e._defaultColor||(e._defaultColor=((r=n.highlightColors)==null?void 0:r.values().next().value)||`#fff066`)}static updateDefaultParams(t,n){switch(t){case O.HIGHLIGHT_COLOR:e._defaultColor=n;break;case O.HIGHLIGHT_THICKNESS:e._defaultThickness=n;break}}translateInPage(e,t){}get toolbarPosition(){return a(Yh,this)}get commentButtonPosition(){return a(Jh,this)}updateParams(e,t){switch(e){case O.HIGHLIGHT_COLOR:n(Z,this,rg).call(this,t);break;case O.HIGHLIGHT_THICKNESS:n(Z,this,ig).call(this,t);break}}static get defaultPropertiesToUpdate(){return[[O.HIGHLIGHT_COLOR,e._defaultColor],[O.HIGHLIGHT_THICKNESS,e._defaultThickness]]}get propertiesToUpdate(){return[[O.HIGHLIGHT_COLOR,this.color||e._defaultColor],[O.HIGHLIGHT_THICKNESS,a(Qh,this)||e._defaultThickness],[O.HIGHLIGHT_FREE,a(qh,this)]]}onUpdatedColor(){var e,t;(e=this.parent)==null||e.drawLayer.updateProperties(a(Kh,this),{root:{fill:this.color,"fill-opacity":this.opacity}}),(t=a(Bh,this))==null||t.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[[`colorPicker`,o(Bh,this,new lf({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle(`disabled`,!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle(`disabled`,!1)}fixAndSetPosition(){return super.fixAndSetPosition(n(Z,this,dg).call(this))}getBaseTranslation(){return[0,0]}getRect(e,t){return super.getRect(e,t,n(Z,this,dg).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){n(Z,this,og).call(this),this._reportTelemetry({action:`deleted`}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(n(Z,this,sg).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;if(this.parent&&!e)n(Z,this,og).call(this);else if(e){var r;n(Z,this,sg).call(this,e),t=!this.parent&&((r=this.div)==null?void 0:r.classList.contains(`selectedEditor`))}super.setParent(e),this.show(this._isVisible),t&&this.select()}rotate(t){let{drawLayer:n}=this.parent,r;a(qh,this)?(t=(t-this.rotation+360)%360,r=cg.call(e,a(Gh,this).box,t)):r=cg.call(e,[this.x,this.y,this.width,this.height],t),n.updateProperties(a(Kh,this),{bbox:r,root:{"data-main-rotation":t}}),n.updateProperties(a(Xh,this),{bbox:cg.call(e,a(Vh,this).box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let e=super.render();a(Zh,this)&&(e.setAttribute(`aria-label`,a(Zh,this)),e.setAttribute(`role`,`mark`)),a(qh,this)?e.classList.add(`free`):this.div.addEventListener(`keydown`,n(Z,this,lg).bind(this),{signal:this._uiManager._signal});let t=o(Wh,this,document.createElement(`div`));return e.append(t),t.setAttribute(`aria-hidden`,`true`),t.className=`internal`,t.style.clipPath=a(zh,this),this.setDims(),nn(this,a(Wh,this),[`pointerover`,`pointerleave`]),this.enableEditing(),e}pointerover(){if(!this.isSelected){var e;(e=this.parent)==null||e.drawLayer.updateProperties(a(Xh,this),{rootClass:{hovered:!0}})}}pointerleave(){if(!this.isSelected){var e;(e=this.parent)==null||e.drawLayer.updateProperties(a(Xh,this),{rootClass:{hovered:!1}})}}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:n(Z,this,ug).call(this,!0);break;case 1:case 3:n(Z,this,ug).call(this,!1);break}}select(){var e;super.select(),a(Xh,this)&&((e=this.parent)==null||e.drawLayer.updateProperties(a(Xh,this),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var e;super.unselect(),a(Xh,this)&&((e=this.parent)==null||e.drawLayer.updateProperties(a(Xh,this),{rootClass:{selected:!1}}),a(qh,this)||n(Z,this,ug).call(this,!1))}get _mustFixPosition(){return!a(qh,this)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(a(Kh,this),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(a(Xh,this),{rootClass:{hidden:!e}}))}static startHighlighting(t,r,{target:i,x:a,y:o}){let{x:s,y:c,width:l,height:u}=i.getBoundingClientRect(),d=new AbortController,f=t.combinedSignal(d),p=r=>{d.abort(),n(e,this,hg).call(this,t,r)};window.addEventListener(`blur`,p,{signal:f}),window.addEventListener(`pointerup`,p,{signal:f}),window.addEventListener(`pointerdown`,P,{capture:!0,passive:!1,signal:f}),window.addEventListener(`contextmenu`,lt,{signal:f}),i.addEventListener(`pointermove`,n(e,this,mg).bind(this,t),{signal:f}),this._freeHighlight=new Ph({x:a,y:o},[s,c,l,u],t.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=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)}static async deserialize(e,t,r){let i=null;if(e instanceof rm){let{data:{quadPoints:t,rect:n,rotation:r,id:a,color:o,opacity:s,popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;i=e={annotationType:D.HIGHLIGHT,color:Array.from(o),opacity:s,quadPoints:t,boxes:null,pageIndex:p-1,rect:n.slice(0),rotation:r,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:(u==null?void 0:u.str)||null,creationDate:d,modificationDate:f}}else if(e instanceof tm){let{data:{inkLists:t,rect:n,rotation:r,id:a,color:o,borderStyle:{rawWidth:s},popupRef:c,richText:l,contentsObj:u,creationDate:d,modificationDate:f},parent:{page:{pageNumber:p}}}=e;i=e={annotationType:D.HIGHLIGHT,color:Array.from(o),thickness:s,inkLists:t,boxes:null,pageIndex:p-1,rect:n.slice(0),rotation:r,annotationElementId:a,id:a,deleted:!1,popupRef:c,richText:l,comment:(u==null?void 0:u.str)||null,creationDate:d,modificationDate:f}}let{color:s,quadPoints:c,inkLists:l,outlines:u,opacity:d}=e,f=await super.deserialize(e,t,r);f.color=M.makeHexColor(...s),f.opacity=d||1,l&&o(Qh,f,e.thickness),f._initialData=i,e.comment&&f.setCommentData(e);let[p,m]=f.pageDimensions,[h,g]=f.pageTranslation;if(c){let e=o(Rh,f,[]);for(let t=0;t<c.length;t+=8)e.push({x:(c[t]-h)/p,y:1-(c[t+1]-g)/m,width:(c[t+2]-c[t])/p,height:(c[t+1]-c[t+5])/m});n(Z,f,tg).call(f),n(Z,f,sg).call(f),f.rotate(f.rotation)}else if(l||u){o(qh,f,!0);let e=(l||u.points)[0],r={x:e[0]-h,y:m-(e[1]-g)},i=new Ph(r,[0,0,p,m],1,a(Qh,f)/2,!0,.001);for(let t=0,n=e.length;t<n;t+=2)r.x=e[t]-h,r.y=m-(e[t+1]-g),i.add(r);let{id:s,clipPathId:c}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:`0 0 1 1`,fill:f.color,"fill-opacity":f._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:i.toSVGPath()}},!0,!0);n(Z,f,ng).call(f,{highlightOutlines:i.getOutlines(),highlightId:s,clipPathId:c}),n(Z,f,sg).call(f),f.rotate(f.parentRotation)}return f}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let t=V._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),r=super.serialize(e);return Object.assign(r,{color:t,opacity:this.opacity,thickness:a(Qh,this),quadPoints:n(Z,this,fg).call(this),outlines:n(Z,this,pg).call(this,r.rect)}),this.addComment(r),this.annotationElementId&&!n(Z,this,gg).call(this,r)?null:(r.id=this.annotationElementId,r)}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};v=eg;function tg(){let e=new Th(a(Rh,this),.001);o(Gh,this,e.getOutlines()),[this.x,this.y,this.width,this.height]=a(Gh,this).box;let t=new Th(a(Rh,this),.0025,.001,this._uiManager.direction===`ltr`);o(Vh,this,t.getOutlines());let{firstPoint:n}=a(Gh,this);o(Jh,this,[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height]);let{lastPoint:r}=a(Vh,this);o(Yh,this,[(r[0]-this.x)/this.width,(r[1]-this.y)/this.height])}function ng({highlightOutlines:e,highlightId:t,clipPathId:n}){if(o(Gh,this,e),o(Vh,this,e.getNewOutline(a(Qh,this)/2+1.5,.0025)),t>=0)o(Kh,this,t),o(zh,this,n),this.parent.drawLayer.finalizeDraw(t,{bbox:e.box,path:{d:e.toSVGPath()}}),o(Xh,this,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:a(Vh,this).box,path:{d:a(Vh,this).toSVGPath()}},!0));else if(this.parent){let t=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(a(Kh,this),{bbox:cg.call(v,a(Gh,this).box,(t-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(a(Xh,this),{bbox:cg.call(v,a(Vh,this).box,t),path:{d:a(Vh,this).toSVGPath()}})}let[r,i,s,c]=e.box;switch(this.rotation){case 0:this.x=r,this.y=i,this.width=s,this.height=c;break;case 90:{let[e,t]=this.parentDimensions;this.x=i,this.y=1-r,this.width=s*t/e,this.height=c*e/t;break}case 180:this.x=1-r,this.y=1-i,this.width=s,this.height=c;break;case 270:{let[e,t]=this.parentDimensions;this.x=1-i,this.y=r,this.width=s*t/e,this.height=c*e/t;break}}let{firstPoint:l}=e;o(Jh,this,[(l[0]-r)/s,(l[1]-i)/c]);let{lastPoint:u}=a(Vh,this);o(Yh,this,[(u[0]-r)/s,(u[1]-i)/c])}function rg(e){let t=(e,t)=>{this.color=e,this.opacity=t,this.onUpdatedColor()},n=this.color,r=this.opacity;this.addCommands({cmd:t.bind(this,e,v._defaultOpacity),undo:t.bind(this,n,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:O.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:`color_changed`,color:this._uiManager.getNonHCMColorName(e)},!0)}function ig(e){let t=a(Qh,this),r=e=>{o(Qh,this,e),n(Z,this,ag).call(this,e)};this.addCommands({cmd:r.bind(this,e),undo:r.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:O.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:`thickness_changed`,thickness:e},!0)}function ag(e){a(qh,this)&&(n(Z,this,ng).call(this,{highlightOutlines:a(Gh,this).getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims())}function og(){a(Kh,this)===null||!this.parent||(this.parent.drawLayer.remove(a(Kh,this)),o(Kh,this,null),this.parent.drawLayer.remove(a(Xh,this)),o(Xh,this,null))}function sg(e=this.parent){a(Kh,this)===null&&({id:s(o,[Kh,this])._,clipPathId:s(o,[zh,this])._}=e.drawLayer.draw({bbox:a(Gh,this).box,root:{viewBox:`0 0 1 1`,fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:a(qh,this)},path:{d:a(Gh,this).toSVGPath()}},!1,!0),o(Xh,this,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:a(qh,this)},bbox:a(Vh,this).box,path:{d:a(Vh,this).toSVGPath()}},a(qh,this))),a(Wh,this)&&(a(Wh,this).style.clipPath=a(zh,this)))}function cg([e,t,n,r],i){switch(i){case 90:return[1-t-r,e,r,n];case 180:return[1-e-n,1-t-r,n,r];case 270:return[t,1-e-n,r,n]}return[e,t,n,r]}function lg(e){v._keyboardManager.exec(this,e)}function ug(e){if(!a(Ih,this))return;let t=window.getSelection();e?t.setPosition(a(Ih,this),a(Lh,this)):t.setPosition(a(Hh,this),a(Uh,this))}function dg(){return a(qh,this)?this.rotation:0}function fg(){if(a(qh,this))return null;let[e,t]=this.pageDimensions,[n,r]=this.pageTranslation,i=a(Rh,this),o=new Float32Array(i.length*8),s=0;for(let{x:a,y:c,width:l,height:u}of i){let i=a*e+n,d=(1-c)*t+r;o[s]=o[s+4]=i,o[s+1]=o[s+3]=d,o[s+2]=o[s+6]=i+l*e,o[s+5]=o[s+7]=d-u*t,s+=8}return o}function pg(e){return a(Gh,this).serialize(e,n(Z,this,dg).call(this))}function mg(e,t){this._freeHighlight.add(t)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}function hg(e,t){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:`main_toolbar`}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=``}function gg(e){let{color:t}=this._initialData;return this.hasEditedComment||e.color.some((e,n)=>e!==t[n])}e(eg,`_defaultColor`,null),e(eg,`_defaultOpacity`,1),e(eg,`_defaultThickness`,12),e(eg,`_type`,`highlight`),e(eg,`_editorType`,D.HIGHLIGHT),e(eg,`_freeHighlightId`,-1),e(eg,`_freeHighlight`,null),e(eg,`_freeHighlightClipId`,``);var _g=new WeakMap,vg=class{constructor(){r(this,_g,Object.create(null))}updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(let[t,n]of Object.entries(e))t.startsWith(`_`)||this.updateProperty(t,n)}updateSVGProperty(e,t){a(_g,this)[e]=t}toSVGProperties(){let e=a(_g,this);return o(_g,this,Object.create(null)),{root:e}}reset(){o(_g,this,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){A(`Not implemented`)}},yg=new WeakMap,bg=new WeakMap,Q=new WeakSet,xg=class t extends V{constructor(t){super(t),i(this,Q),r(this,yg,null),r(this,bg,void 0),e(this,`_colorPicker`,null),e(this,`_drawId`,null),o(bg,this,t.mustBeCommitted||!1),this._addOutlines(t)}onUpdatedColor(){var e;(e=this._colorPicker)==null||e.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){var e,t;(e=this._colorPicker)==null||(t=e.updateOpacity)==null||t.call(e,this.opacity)}_addOutlines(e){e.drawOutlines&&(n(Q,this,Sg).call(this,e),n(Q,this,Tg).call(this))}static _mergeSVGProperties(e,t){let n=new Set(Object.keys(e));for(let[r,i]of Object.entries(t))n.has(r)?Object.assign(e[r],i):e[r]=i;return e}static getDefaultDrawingOptions(e){A(`Not implemented`)}static get typesMap(){A(`Not implemented`)}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,t){let n=this.typesMap.get(e);n&&this._defaultDrawingOptions.updateProperty(n,t),this._currentParent&&(Ag._.updateProperty(n,t),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,t){let n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,t)}static get defaultPropertiesToUpdate(){let e=[],t=this._defaultDrawingOptions;for(let[n,r]of this.typesMap)e.push([n,t[r]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:t}=this;for(let[n,r]of this.constructor.typesMap)e.push([n,t[r]]);return e}_updateProperty(e,t,r){let i=this._drawingOptions,o=i[t],s=r=>{var o;i.updateProperty(t,r);let s=a(yg,this).updateProperty(t,r);s&&n(Q,this,Og).call(this,s),(o=this.parent)==null||o.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),e===this.colorType?this.onUpdatedColor():e===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:s.bind(this,r),undo:s.bind(this,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,t){let n=this.constructor.typesMap.get(this.colorType),r=this.constructor.typesMap.get(this.opacityType),i=this._drawingOptions,o=i[n],s=i[r],c=(e,t)=>{var o;i.updateProperty(n,e),i.updateProperty(r,t),a(yg,this).updateProperty(n,e),a(yg,this).updateProperty(r,t),(o=this.parent)==null||o.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:c.bind(this,e,t),undo:c.bind(this,o,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:O.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,t._mergeSVGProperties(a(yg,this).getPathResizingSVGProperties(n(Q,this,Dg).call(this)),{bbox:n(Q,this,kg).call(this)}))}_onResized(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,t._mergeSVGProperties(a(yg,this).getPathResizedSVGProperties(n(Q,this,Dg).call(this)),{bbox:n(Q,this,kg).call(this)}))}_onTranslating(e,t){var r;(r=this.parent)==null||r.drawLayer.updateProperties(this._drawId,{bbox:n(Q,this,kg).call(this)})}_onTranslated(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,t._mergeSVGProperties(a(yg,this).getPathTranslatedSVGProperties(n(Q,this,Dg).call(this),this.parentDimensions),{bbox:n(Q,this,kg).call(this)}))}_onStartDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var e;(e=this.parent)==null||e.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(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,a(bg,this)&&(o(bg,this,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){n(Q,this,wg).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(n(Q,this,Tg).call(this),n(Q,this,Og).call(this,a(yg,this).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let t=!1;if(this.parent&&!e)this._uiManager.removeShouldRescale(this),n(Q,this,wg).call(this);else if(e){var r;this._uiManager.addShouldRescale(this),n(Q,this,Tg).call(this,e),t=!this.parent&&((r=this.div)==null?void 0:r.classList.contains(`selectedEditor`))}super.setParent(e),t&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,t._mergeSVGProperties({bbox:n(Q,this,kg).call(this)},a(yg,this).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&n(Q,this,Og).call(this,a(yg,this).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,t;this._isCopy&&(e=this.x,t=this.y);let n=super.render();n.classList.add(`draw`);let r=document.createElement(`div`);return n.append(r),r.setAttribute(`aria-hidden`,`true`),r.className=`internal`,this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,t),n}static createDrawerInstance(e,t,n,r,i){A(`Not implemented`)}static startDrawing(e,t,n,r){var i;let{target:a,offsetX:o,offsetY:s,pointerId:c,pointerType:l}=r;if(rn.isInitializedAndDifferentPointerType(l))return;let{viewport:{rotation:u}}=e,{width:d,height:f}=a.getBoundingClientRect(),p=jg._=new AbortController,m=e.combinedSignal(p);if(rn.setPointer(l,c),window.addEventListener(`pointerup`,e=>{rn.isSamePointerIdOrRemove(e.pointerId)&&this._endDraw(e)},{signal:m}),window.addEventListener(`pointercancel`,e=>{rn.isSamePointerIdOrRemove(e.pointerId)&&this._currentParent.endDrawingSession()},{signal:m}),window.addEventListener(`pointerdown`,e=>{rn.isSamePointerType(e.pointerType)&&(rn.initializeAndAddPointerId(e.pointerId),Ag._.isCancellable()&&(Ag._.removeLastElement(),Ag._.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:m}),window.addEventListener(`contextmenu`,lt,{signal:m}),a.addEventListener(`pointermove`,this._drawMove.bind(this),{signal:m}),a.addEventListener(`touchmove`,e=>{rn.isSameTimeStamp(e.timeStamp)&&P(e)},{signal:m}),e.toggleDrawing(),(i=t._editorUndoBar)==null||i.hide(),Ag._){e.drawLayer.updateProperties(this._currentDrawId,Ag._.startNew(o,s,d,f,u));return}t.updateUIForDefaultProperties(this),Ag._=this.createDrawerInstance(o,s,d,f,u),Mg._=this.getDefaultDrawingOptions(),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(Mg._.toSVGProperties(),Ag._.defaultSVGProperties),!0,!1)}static _drawMove(e){if(rn.isSameTimeStamp(e.timeStamp),!Ag._)return;let{offsetX:t,offsetY:n,pointerId:r}=e;if(rn.isSamePointerId(r)){if(rn.isUsingMultiplePointers()){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,Ag._.add(t,n)),rn.setTimeStamp(e.timeStamp),P(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,Ag._=null,Mg._=null,rn.clearTimeStamp()),jg._&&(jg._.abort(),jg._=null,rn.clearPointerIds())}static _endDraw(e){let t=this._currentParent;if(t){if(t.toggleDrawing(!0),this._cleanup(!1),(e==null?void 0:e.target)===t.div&&t.drawLayer.updateProperties(this._currentDrawId,Ag._.end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){let e=Ag._,n=this._currentDrawId,r=e.getLastElement();t.addCommands({cmd:()=>{t.drawLayer.updateProperties(n,e.setLastElement(r))},undo:()=>{t.drawLayer.updateProperties(n,e.removeLastElement())},mustExec:!1,type:O.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){let t=this._currentParent;if(!t)return null;if(t.toggleDrawing(!0),t.cleanUndoStack(O.DRAW_STEP),!Ag._.isEmpty()){let{pageDimensions:[n,r],scale:i}=t,a=t.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:Ag._.getOutlines(n*i,r*i,i,this._INNER_MARGIN),drawingOptions:Mg._,mustBeCommitted:!e});return this._cleanup(!0),a}return t.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,t,n,r,i,a){A(`Not implemented`)}static async deserialize(e,t,r){let{rawDims:{pageWidth:i,pageHeight:a,pageX:o,pageY:s}}=t.viewport,c=this.deserializeDraw(o,s,i,a,this._INNER_MARGIN,e),l=await super.deserialize(e,t,r);return l.createDrawingOptions(e),n(Q,l,Sg).call(l,{drawOutlines:c}),n(Q,l,Tg).call(l),l.onScaleChanging(),l.rotate(),l}serializeDraw(e){let[t,n]=this.pageTranslation,[r,i]=this.pageDimensions;return a(yg,this).serialize([t,n,r,i],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};y=xg;function Sg({drawOutlines:e,drawId:t,drawingOptions:r}){o(yg,this,e),this._drawingOptions||(this._drawingOptions=r),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),t>=0?(this._drawId=t,this.parent.drawLayer.finalizeDraw(t,e.defaultProperties)):this._drawId=n(Q,this,Cg).call(this,e,this.parent),n(Q,this,Og).call(this,e.box)}function Cg(e,t){let{id:n}=t.drawLayer.draw(y._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n}function wg(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}function Tg(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=n(Q,this,Cg).call(this,a(yg,this),e)}}function Eg([e,t,n,r]){let{parentDimensions:[i,a],rotation:o}=this;switch(o){case 90:return[t,1-e,a/i*n,i/a*r];case 180:return[1-e,1-t,n,r];case 270:return[1-t,e,a/i*n,i/a*r];default:return[e,t,n,r]}}function Dg(){let{x:e,y:t,width:n,height:r,parentDimensions:[i,a],rotation:o}=this;switch(o){case 90:return[1-t,e,i/a*n,a/i*r];case 180:return[1-e,1-t,n,r];case 270:return[t,1-e,i/a*n,a/i*r];default:return[e,t,n,r]}}function Og(e){[this.x,this.y,this.width,this.height]=n(Q,this,Eg).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}function kg(){let{x:e,y:t,width:n,height:r,rotation:i,parentRotation:a,parentDimensions:[o,s]}=this;switch((i*4+a)/90){case 1:return[1-t-r,e,r,n];case 2:return[1-e-n,1-t-r,n,r];case 3:return[t,1-e-n,r,n];case 4:return[e,t-o/s*n,s/o*r,o/s*n];case 5:return[1-t,e,o/s*n,s/o*r];case 6:return[1-e-s/o*r,1-t,s/o*r,o/s*n];case 7:return[t-o/s*n,1-e-s/o*r,o/s*n,s/o*r];case 8:return[e-n,t-r,n,r];case 9:return[1-t,e-n,r,n];case 10:return[1-e,1-t,n,r];case 11:return[t-r,1-e,r,n];case 12:return[e-s/o*r,t,s/o*r,o/s*n];case 13:return[1-t-o/s*n,e-s/o*r,o/s*n,s/o*r];case 14:return[1-e,1-t-o/s*n,s/o*r,o/s*n];case 15:return[t,1-e,o/s*n,s/o*r];default:return[e,t,n,r]}}e(xg,`_currentDrawId`,-1),e(xg,`_currentParent`,null);var Ag={_:null},jg={_:null},Mg={_:null};e(xg,`_INNER_MARGIN`,3);var Ng=new WeakMap,Pg=new WeakMap,Fg=new WeakMap,Ig=new WeakMap,Lg=new WeakMap,Rg=new WeakMap,zg=new WeakMap,Bg=new WeakMap,Vg=new WeakMap,Hg=new WeakMap,Ug=new WeakMap,Wg=new WeakSet,Gg=class{constructor(e,t,s,c,l,u){i(this,Wg),r(this,Ng,new Float64Array(6)),r(this,Pg,void 0),r(this,Fg,void 0),r(this,Ig,void 0),r(this,Lg,void 0),r(this,Rg,void 0),r(this,zg,``),r(this,Bg,0),r(this,Vg,new r_),r(this,Hg,void 0),r(this,Ug,void 0),o(Hg,this,s),o(Ug,this,c),o(Ig,this,l),o(Lg,this,u),[e,t]=n(Wg,this,Kg).call(this,e,t);let d=o(Pg,this,[NaN,NaN,NaN,NaN,e,t]);o(Rg,this,[e,t]),o(Fg,this,[{line:d,points:a(Rg,this)}]),a(Ng,this).set(d,0)}updateProperty(e,t){e===`stroke-width`&&o(Lg,this,t)}isEmpty(){return!a(Fg,this)||a(Fg,this).length===0}isCancellable(){return a(Rg,this).length<=10}add(e,t){[e,t]=n(Wg,this,Kg).call(this,e,t);let[r,i,o,s]=a(Ng,this).subarray(2,6),c=e-o,l=t-s;return Math.hypot(a(Hg,this)*c,a(Ug,this)*l)<=2?null:(a(Rg,this).push(e,t),isNaN(r)?(a(Ng,this).set([o,s,e,t],2),a(Pg,this).push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(a(Ng,this)[0])&&a(Pg,this).splice(6,6),a(Ng,this).set([r,i,o,s,e,t],0),a(Pg,this).push(...Y.createBezierPoints(r,i,o,s,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){return this.add(e,t)||(a(Rg,this).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,r,i,s){o(Hg,this,r),o(Ug,this,i),o(Ig,this,s),[e,t]=n(Wg,this,Kg).call(this,e,t);let c=o(Pg,this,[NaN,NaN,NaN,NaN,e,t]);o(Rg,this,[e,t]);let l=a(Fg,this).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),a(Fg,this).push({line:c,points:a(Rg,this)}),a(Ng,this).set(c,0),o(Bg,this,0),this.toSVGPath(),null}getLastElement(){return a(Fg,this).at(-1)}setLastElement(e){return a(Fg,this)?(a(Fg,this).push(e),o(Pg,this,e.line),o(Rg,this,e.points),o(Bg,this,0),{path:{d:this.toSVGPath()}}):a(Vg,this).setLastElement(e)}removeLastElement(){if(!a(Fg,this))return a(Vg,this).removeLastElement();a(Fg,this).pop(),o(zg,this,``);for(let e=0,t=a(Fg,this).length;e<t;e++){let{line:t,points:n}=a(Fg,this)[e];o(Pg,this,t),o(Rg,this,n),o(Bg,this,0),this.toSVGPath()}return{path:{d:a(zg,this)}}}toSVGPath(){let e=Y.svgRound(a(Pg,this)[4]),t=Y.svgRound(a(Pg,this)[5]);if(a(Rg,this).length===2)return o(zg,this,`${a(zg,this)} M ${e} ${t} Z`),a(zg,this);if(a(Rg,this).length<=6){let n=a(zg,this).lastIndexOf(`M`);o(zg,this,`${a(zg,this).slice(0,n)} M ${e} ${t}`),o(Bg,this,6)}if(a(Rg,this).length===4){let e=Y.svgRound(a(Pg,this)[10]),t=Y.svgRound(a(Pg,this)[11]);return o(zg,this,`${a(zg,this)} L ${e} ${t}`),o(Bg,this,12),a(zg,this)}let n=[];a(Bg,this)===0&&(n.push(`M ${e} ${t}`),o(Bg,this,6));for(let e=a(Bg,this),t=a(Pg,this).length;e<t;e+=6){let[t,r,i,o,s,c]=a(Pg,this).slice(e,e+6).map(Y.svgRound);n.push(`C${t} ${r} ${i} ${o} ${s} ${c}`)}return o(zg,this,a(zg,this)+n.join(` `)),o(Bg,this,a(Pg,this).length),a(zg,this)}getOutlines(e,t,n,r){let i=a(Fg,this).at(-1);return i.line=new Float32Array(i.line),i.points=new Float32Array(i.points),a(Vg,this).build(a(Fg,this),e,t,n,a(Ig,this),a(Lg,this),r),o(Ng,this,null),o(Pg,this,null),o(Fg,this,null),o(zg,this,null),a(Vg,this)}get defaultSVGProperties(){return{root:{viewBox:`0 0 10000 10000`},rootClass:{draw:!0},bbox:[0,0,1,1]}}};function Kg(e,t){return Y._normalizePoint(e,t,a(Hg,this),a(Ug,this),a(Ig,this))}var qg=new WeakMap,Jg=new WeakMap,Yg=new WeakMap,Xg=new WeakMap,Zg=new WeakMap,Qg=new WeakMap,$g=new WeakMap,e_=new WeakMap,t_=new WeakMap,n_=new WeakSet,r_=class extends Y{constructor(...e){super(...e),i(this,n_),r(this,qg,void 0),r(this,Jg,0),r(this,Yg,void 0),r(this,Xg,void 0),r(this,Zg,void 0),r(this,Qg,void 0),r(this,$g,void 0),r(this,e_,void 0),r(this,t_,void 0)}build(e,t,r,i,a,s,c){o(Zg,this,t),o(Qg,this,r),o($g,this,i),o(e_,this,a),o(t_,this,s),o(Yg,this,c??0),o(Xg,this,e),n(n_,this,o_).call(this)}get thickness(){return a(t_,this)}setLastElement(e){return a(Xg,this).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return a(Xg,this).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:t}of a(Xg,this)){if(e.push(`M${Y.svgRound(t[4])} ${Y.svgRound(t[5])}`),t.length===6){e.push(`Z`);continue}if(t.length===12&&isNaN(t[6])){e.push(`L${Y.svgRound(t[10])} ${Y.svgRound(t[11])}`);continue}for(let n=6,r=t.length;n<r;n+=6){let[r,i,a,o,s,c]=t.subarray(n,n+6).map(Y.svgRound);e.push(`C${r} ${i} ${a} ${o} ${s} ${c}`)}}return e.join(``)}serialize([e,t,r,i],o){let s=[],c=[],[l,u,d,f]=n(n_,this,a_).call(this),p,m,h,g,_,v,y,b,x;switch(a(e_,this)){case 0:x=Y._rescale,p=e,m=t+i,h=r,g=-i,_=e+l*r,v=t+(1-u-f)*i,y=e+(l+d)*r,b=t+(1-u)*i;break;case 90:x=Y._rescaleAndSwap,p=e,m=t,h=r,g=i,_=e+u*r,v=t+l*i,y=e+(u+f)*r,b=t+(l+d)*i;break;case 180:x=Y._rescale,p=e+r,m=t,h=-r,g=i,_=e+(1-l-d)*r,v=t+u*i,y=e+(1-l)*r,b=t+(u+f)*i;break;case 270:x=Y._rescaleAndSwap,p=e+r,m=t+i,h=-r,g=-i,_=e+(1-u-f)*r,v=t+(1-l-d)*i,y=e+(1-u)*r,b=t+(1-l)*i;break}for(let{line:e,points:t}of a(Xg,this))s.push(x(e,p,m,h,g,o?Array(e.length):null)),c.push(x(t,p,m,h,g,o?Array(t.length):null));return{lines:s,points:c,rect:[_,v,y,b]}}static deserialize(e,t,n,r,i,{paths:{lines:a,points:o},rotation:s,thickness:c}){let l=[],u,d,f,p,m;switch(s){case 0:m=Y._rescale,u=-e/n,d=t/r+1,f=1/n,p=-1/r;break;case 90:m=Y._rescaleAndSwap,u=-t/r,d=-e/n,f=1/r,p=1/n;break;case 180:m=Y._rescale,u=e/n+1,d=-t/r,f=-1/n,p=1/r;break;case 270:m=Y._rescaleAndSwap,u=t/r+1,d=e/n+1,f=-1/r,p=-1/n;break}if(!a){a=[];for(let e of o){let t=e.length;if(t===2){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1]]));continue}if(t===4){a.push(new Float32Array([NaN,NaN,NaN,NaN,e[0],e[1],NaN,NaN,NaN,NaN,e[2],e[3]]));continue}let n=new Float32Array(3*(t-2));a.push(n);let[r,i,o,s]=e.subarray(0,4);n.set([NaN,NaN,NaN,NaN,r,i],0);for(let a=4;a<t;a+=2){let t=e[a],c=e[a+1];n.set(Y.createBezierPoints(r,i,o,s,t,c),(a-2)*3),[r,i,o,s]=[o,s,t,c]}}}for(let e=0,t=a.length;e<t;e++)l.push({line:m(a[e].map(e=>e??NaN),u,d,f,p),points:m(o[e].map(e=>e??NaN),u,d,f,p)});let h=new this.prototype.constructor;return h.build(l,n,r,1,s,c,i),h}get box(){return a(qg,this)}updateProperty(e,t){return e===`stroke-width`?n(n_,this,s_).call(this,t):null}updateParentDimensions([e,t],r){let[i,s]=n(n_,this,i_).call(this);o(Zg,this,e),o(Qg,this,t),o($g,this,r);let[c,l]=n(n_,this,i_).call(this),u=c-i,d=l-s,f=a(qg,this);return f[0]-=u,f[1]-=d,f[2]+=2*u,f[3]+=2*d,f}updateRotation(e){return o(Jg,this,e),{path:{transform:this.rotationTransform}}}get viewBox(){return a(qg,this).map(Y.svgRound).join(` `)}get defaultProperties(){let[e,t]=a(qg,this);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Y.svgRound(e)} ${Y.svgRound(t)}`}}}get rotationTransform(){let[,,e,t]=a(qg,this),n=0,r=0,i=0,o=0,s=0,c=0;switch(a(Jg,this)){case 90:r=t/e,i=-e/t,s=e;break;case 180:n=-1,o=-1,s=e,c=t;break;case 270:r=-t/e,i=e/t,c=t;break;default:return``}return`matrix(${n} ${r} ${i} ${o} ${Y.svgRound(s)} ${Y.svgRound(c)})`}getPathResizingSVGProperties([e,t,r,i]){let[o,s]=n(n_,this,i_).call(this),[c,l,u,d]=a(qg,this);if(Math.abs(u-o)<=Y.PRECISION||Math.abs(d-s)<=Y.PRECISION){let n=e+r/2-(c+u/2),a=t+i/2-(l+d/2);return{path:{"transform-origin":`${Y.svgRound(e)} ${Y.svgRound(t)}`,transform:`${this.rotationTransform} translate(${n} ${a})`}}}let f=(r-2*o)/(u-2*o),p=(i-2*s)/(d-2*s),m=u/r,h=d/i;return{path:{"transform-origin":`${Y.svgRound(c)} ${Y.svgRound(l)}`,transform:`${this.rotationTransform} scale(${m} ${h}) translate(${Y.svgRound(o)} ${Y.svgRound(s)}) scale(${f} ${p}) translate(${Y.svgRound(-o)} ${Y.svgRound(-s)})`}}}getPathResizedSVGProperties([e,t,r,i]){let[o,s]=n(n_,this,i_).call(this),c=a(qg,this),[l,u,d,f]=c;if(c[0]=e,c[1]=t,c[2]=r,c[3]=i,Math.abs(d-o)<=Y.PRECISION||Math.abs(f-s)<=Y.PRECISION){let n=e+r/2-(l+d/2),o=t+i/2-(u+f/2);for(let{line:e,points:t}of a(Xg,this))Y._translate(e,n,o,e),Y._translate(t,n,o,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Y.svgRound(e)} ${Y.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let p=(r-2*o)/(d-2*o),m=(i-2*s)/(f-2*s),h=-p*(l+o)+e+o,g=-m*(u+s)+t+s;if(p!==1||m!==1||h!==0||g!==0)for(let{line:e,points:t}of a(Xg,this))Y._rescale(e,h,g,p,m,e),Y._rescale(t,h,g,p,m,t);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Y.svgRound(e)} ${Y.svgRound(t)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,t],n){let[r,i]=n,s=a(qg,this),c=e-s[0],l=t-s[1];if(a(Zg,this)===r&&a(Qg,this)===i)for(let{line:e,points:t}of a(Xg,this))Y._translate(e,c,l,e),Y._translate(t,c,l,t);else{let e=a(Zg,this)/r,t=a(Qg,this)/i;o(Zg,this,r),o(Qg,this,i);for(let{line:n,points:r}of a(Xg,this))Y._rescale(n,c,l,e,t,n),Y._rescale(r,c,l,e,t,r);s[2]*=e,s[3]*=t}return s[0]=e,s[1]=t,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Y.svgRound(e)} ${Y.svgRound(t)}`}}}get defaultSVGProperties(){let e=a(qg,this);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Y.svgRound(e[0])} ${Y.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}};function i_(e=a(t_,this)){let t=a(Yg,this)+e/2*a($g,this);return a(e_,this)%180==0?[t/a(Zg,this),t/a(Qg,this)]:[t/a(Qg,this),t/a(Zg,this)]}function a_(){let[e,t,r,i]=a(qg,this),[o,s]=n(n_,this,i_).call(this,0);return[e+o,t+s,r-2*o,i-2*s]}function o_(){let e=o(qg,this,ne.slice());for(let{line:t}of a(Xg,this)){if(t.length<=12){for(let n=4,r=t.length;n<r;n+=6)M.pointBoundingBox(t[n],t[n+1],e);continue}let n=t[4],r=t[5];for(let i=6,a=t.length;i<a;i+=6){let[a,o,s,c,l,u]=t.subarray(i,i+6);M.bezierBoundingBox(n,r,a,o,s,c,l,u,e),n=l,r=u}}let[t,r]=n(n_,this,i_).call(this);e[0]=N(e[0]-t,0,1),e[1]=N(e[1]-r,0,1),e[2]=N(e[2]+t,0,1),e[3]=N(e[3]+r,0,1),e[2]-=e[0],e[3]-=e[1]}function s_(e){let[t,r]=n(n_,this,i_).call(this);o(t_,this,e);let[i,s]=n(n_,this,i_).call(this),[c,l]=[i-t,s-r],u=a(qg,this);return u[0]-=c,u[1]-=l,u[2]+=2*c,u[3]+=2*l,u}var c_=class e extends vg{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:`none`,stroke:V._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-miterlimit":10})}updateSVGProperty(e,t){e===`stroke-width`&&(t??(t=this[`stroke-width`]),t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},l_=new WeakSet,u_=class e extends xg{constructor(e){super({...e,name:`inkEditor`}),i(this,l_),this._willKeepAspectRatio=!0,this.defaultL10nId=`pdfjs-editor-ink-editor`}static initialize(e,t){V.initialize(e,t),this._defaultDrawingOptions=new c_(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!0}static get typesMap(){return j(this,`typesMap`,new Map([[O.INK_THICKNESS,`stroke-width`],[O.INK_COLOR,`stroke`],[O.INK_OPACITY,`stroke-opacity`]]))}static createDrawerInstance(e,t,n,r,i){return new Gg(e,t,n,r,i,this._defaultDrawingOptions[`stroke-width`])}static deserializeDraw(e,t,n,r,i,a){return r_.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){let r=null;if(e instanceof tm){let{data:{inkLists:t,rect:n,rotation:i,id:a,color:o,opacity:s,borderStyle:{rawWidth:c},popupRef:l,richText:u,contentsObj:d,creationDate:f,modificationDate:p},parent:{page:{pageNumber:m}}}=e;r=e={annotationType:D.INK,color:Array.from(o),thickness:c,opacity:s,paths:{points:t},boxes:null,pageIndex:m-1,rect:n.slice(0),rotation:i,annotationElementId:a,id:a,deleted:!1,popupRef:l,richText:u,comment:(d==null?void 0:d.str)||null,creationDate:f,modificationDate:p}}let i=await super.deserialize(e,t,n);return i._initialData=r,e.comment&&i.setCommentData(e),i}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new xf(this)),[[`colorPicker`,this._colorPicker]]}get colorType(){return O.INK_COLOR}get colorAndOpacityType(){return O.INK_COLOR_AND_OPACITY}get opacityType(){return O.INK_OPACITY}updateParams(e,t){if(e===O.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(t.color,t.opacity);return}super.updateParams(e,t)}static updateDefaultParams(e,t){if(e===O.INK_COLOR_AND_OPACITY){super.updateDefaultParams(O.INK_COLOR,t.color),super.updateDefaultParams(O.INK_OPACITY,t.opacity);return}super.updateDefaultParams(e,t)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions[`stroke-opacity`]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:t,parent:n}=this;t.updateSVGProperty(`stroke-width`),n.drawLayer.updateProperties(e,t.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty(`stroke-width`),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:n,opacity:r}){this._drawingOptions=e.getDefaultDrawingOptions({stroke:M.makeHexColor(...t),"stroke-width":n,"stroke-opacity":r})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:t,points:r}=this.serializeDraw(e),{_drawingOptions:{stroke:i,"stroke-opacity":a,"stroke-width":o}}=this,s=Object.assign(super.serialize(e),{color:V._colorManager.convert(i),opacity:a,thickness:o,paths:{lines:t,points:r}});return this.addComment(s),e?(s.isCopy=!0,s):this.annotationElementId&&!n(l_,this,d_).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:t,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions[`stroke-width`],points:t,popup:this.comment}),null}};function d_(e){let{color:t,thickness:n,opacity:r,pageIndex:i}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((e,n)=>e!==t[n])||e.thickness!==n||e.opacity!==r||e.pageIndex!==i}e(u_,`_type`,`ink`),e(u_,`_editorType`,D.INK),e(u_,`_defaultDrawingOptions`,null);var f_=class extends r_{toSVGPath(){let e=super.toSVGPath();return e.endsWith(`Z`)||(e+=`Z`),e}},p_=8,m_=3,h_=class e{static extractContoursFromText(t,{fontFamily:r,fontStyle:i,fontWeight:a},o,s,c,l){let u=new OffscreenCanvas(1,1),d=u.getContext(`2d`,{alpha:!1}),f=d.font=`${i} ${a} 200px ${r}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:m,actualBoundingBoxAscent:h,actualBoundingBoxDescent:g,fontBoundingBoxAscent:_,fontBoundingBoxDescent:v,width:y}=d.measureText(t),b=1.5,x=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||0,y)*b),S=Math.ceil(Math.max(Math.abs(h)+Math.abs(g)||200,Math.abs(_)+Math.abs(v)||200)*b);u=new OffscreenCanvas(x,S),d=u.getContext(`2d`,{alpha:!0,willReadFrequently:!0}),d.font=f,d.filter=`grayscale(1)`,d.fillStyle=`white`,d.fillRect(0,0,x,S),d.fillStyle=`black`,d.fillText(t,x*(b-1)/2,S*(3-b)/2);let C=n(e,this,w_).call(this,d.getImageData(0,0,x,S).data),w=n(e,this,C_).call(this,C),T=n(e,this,T_).call(this,w),ee=n(e,this,y_).call(this,C,x,S,T);return this.processDrawnLines({lines:{curves:ee,width:x,height:S},pageWidth:o,pageHeight:s,rotation:c,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,r,i,a,o){let[s,c,l]=n(e,this,E_).call(this,t),[u,d]=n(e,this,S_).call(this,s,c,l,Math.hypot(c,l)*n(e,this,D_)._.sigmaSFactor,n(e,this,D_)._.sigmaR,n(e,this,D_)._.kernelSize),f=n(e,this,T_).call(this,d),p=n(e,this,y_).call(this,u,c,l,f);return this.processDrawnLines({lines:{curves:p,width:c,height:l},pageWidth:r,pageHeight:i,rotation:a,innerMargin:o,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:r,pageHeight:i,rotation:a,innerMargin:o,mustSmooth:s,areContours:c}){a%180!=0&&([r,i]=[i,r]);let{curves:l,width:u,height:d}=t,f=t.thickness??0,p=[],m=Math.min(r/u,i/d),h=m/r,g=m/i,_=[];for(let{points:t}of l){let r=s?n(e,this,x_).call(this,t):t;if(!r)continue;_.push(r);let i=r.length,a=new Float32Array(i),o=new Float32Array(3*(i===2?2:i-2));if(p.push({line:o,points:a}),i===2){a[0]=r[0]*h,a[1]=r[1]*g,o.set([NaN,NaN,NaN,NaN,a[0],a[1]],0);continue}let[c,l,u,d]=r;c*=h,l*=g,u*=h,d*=g,a.set([c,l,u,d],0),o.set([NaN,NaN,NaN,NaN,c,l],0);for(let e=4;e<i;e+=2){let t=a[e]=r[e]*h,n=a[e+1]=r[e+1]*g;o.set(Y.createBezierPoints(c,l,u,d,t,n),(e-2)*3),[c,l,u,d]=[u,d,t,n]}}if(p.length===0)return null;let v=c?new f_:new r_;return v.build(p,r,i,1,a,c?0:f,o),{outline:v,newCurves:_,areContours:c,thickness:f,width:u,height:d}}static async compressSignature({outlines:e,areContours:t,thickness:n,width:r,height:i}){let a=1/0,o=-1/0,s=0;for(let t of e){s+=t.length;for(let e=2,n=t.length;e<n;e++){let n=t[e]-t[e-2];a=Math.min(a,n),o=Math.max(o,n)}}let c;c=a>=-128&&o<=127?Int8Array:a>=-32768&&o<=32767?Int16Array:Int32Array;let l=e.length,u=p_+m_*l,d=new Uint32Array(u),f=0;d[f++]=u*Uint32Array.BYTES_PER_ELEMENT+(s-2*l)*c.BYTES_PER_ELEMENT,d[f++]=0,d[f++]=r,d[f++]=i,d[f++]=+!t,d[f++]=Math.max(0,Math.floor(n??0)),d[f++]=l,d[f++]=c.BYTES_PER_ELEMENT;for(let t of e)d[f++]=t.length-2,d[f++]=t[0],d[f++]=t[1];let p=new CompressionStream(`deflate-raw`),m=p.writable.getWriter();await m.ready,m.write(d);let h=c.prototype.constructor;for(let t of e){let e=new h(t.length-2);for(let n=2,r=t.length;n<r;n++)e[n-2]=t[n]-t[n-2];m.write(e)}return m.close(),(await new Response(p.readable).bytes()).toBase64()}static async decompressSignature(e){try{let t=Uint8Array.fromBase64(e),{readable:n,writable:r}=new DecompressionStream(`deflate-raw`),i=r.getWriter();await i.ready,i.write(t).then(async()=>{await i.ready,await i.close()}).catch(()=>{});let a=null,o=0;for await(let e of n)a||(a=new Uint8Array(new Uint32Array(e.buffer,0,4)[0])),a.set(e,o),o+=e.length;let s=new Uint32Array(a.buffer,0,a.length>>2),c=s[1];if(c!==0)throw Error(`Invalid version: ${c}`);let l=s[2],u=s[3],d=s[4]===0,f=s[5],p=s[6],m=s[7],h=[],g=(p_+m_*p)*Uint32Array.BYTES_PER_ELEMENT,_;switch(m){case Int8Array.BYTES_PER_ELEMENT:_=new Int8Array(a.buffer,g);break;case Int16Array.BYTES_PER_ELEMENT:_=new Int16Array(a.buffer,g);break;case Int32Array.BYTES_PER_ELEMENT:_=new Int32Array(a.buffer,g);break}o=0;for(let e=0;e<p;e++){let t=s[m_*e+p_],n=new Float32Array(t+2);h.push(n);for(let t=0;t<m_-1;t++)n[t]=s[m_*e+p_+t+1];for(let e=0;e<t;e++)n[e+2]=n[e]+_[o++]}return{areContours:d,thickness:f,outlines:h,width:l,height:u}}catch(e){return k(`decompressSignature: ${e}`),null}}};b=h_;function g_(e,t,n,r){return n-=e,r-=t,n===0?r>0?0:4:n===1?r+6:2-r}function __(e,t,r,i,a,o,s){let c=n(b,this,g_).call(this,r,i,a,o);for(let a=0;a<8;a++){let o=(-a+c-s+16)%8,l=n(b,this,O_)._[2*o],u=n(b,this,O_)._[2*o+1];if(e[(r+l)*t+(i+u)]!==0)return o}return-1}function v_(e,t,r,i,a,o,s){let c=n(b,this,g_).call(this,r,i,a,o);for(let a=0;a<8;a++){let o=(a+c+s+16)%8,l=n(b,this,O_)._[2*o],u=n(b,this,O_)._[2*o+1];if(e[(r+l)*t+(i+u)]!==0)return o}return-1}function y_(e,t,r,i){let a=e.length,o=new Int32Array(a);for(let t=0;t<a;t++)o[t]=+(e[t]<=i);for(let e=1;e<r-1;e++)o[e*t]=o[e*t+t-1]=0;for(let e=0;e<t;e++)o[e]=o[t*r-1-e]=0;let s=1,c,l=[];for(let e=1;e<r-1;e++){c=1;for(let r=1;r<t-1;r++){let i=e*t+r,a=o[i];if(a===0)continue;let u=e,d=r;if(a===1&&o[i-1]===0)s+=1,--d;else if(a>=1&&o[i+1]===0)s+=1,d+=1,a>1&&(c=a);else{a!==1&&(c=Math.abs(a));continue}let f=[r,e],p=d===r+1,m={isHole:p,points:f,id:s,parent:0};l.push(m);let h;for(let e of l)if(e.id===c){h=e;break}h?h.isHole?m.parent=p?h.parent:c:m.parent=p?c:h.parent:m.parent=p?c:0;let g=n(b,this,__).call(this,o,t,e,r,u,d,0);if(g===-1){o[i]=-s,o[i]!==1&&(c=Math.abs(o[i]));continue}let _=n(b,this,O_)._[2*g],v=n(b,this,O_)._[2*g+1],y=e+_,x=r+v;u=y,d=x;let S=e,C=r;for(;;){let a=n(b,this,v_).call(this,o,t,S,C,u,d,1);_=n(b,this,O_)._[2*a],v=n(b,this,O_)._[2*a+1];let l=S+_,p=C+v;f.push(p,l);let m=S*t+C;if(o[m+1]===0?o[m]=-s:o[m]===1&&(o[m]=s),l===e&&p===r&&S===y&&C===x){o[i]!==1&&(c=Math.abs(o[i]));break}else u=S,d=C,S=l,C=p}}}return l}function b_(e,t,r,i){if(r-t<=4){for(let n=t;n<r-2;n+=2)i.push(e[n],e[n+1]);return}let a=e[t],o=e[t+1],s=e[r-4]-a,c=e[r-3]-o,l=Math.hypot(s,c),u=s/l,d=c/l,f=u*o-d*a,p=c/s,m=1/l,h=Math.atan(p),g=Math.cos(h),_=Math.sin(h),v=m*(Math.abs(g)+Math.abs(_)),y=m*(1-v+v**2),x=Math.max(Math.atan(Math.abs(_+g)*y),Math.atan(Math.abs(_-g)*y)),S=0,C=t;for(let n=t+2;n<r-2;n+=2){let t=Math.abs(f-u*e[n+1]+d*e[n]);t>S&&(C=n,S=t)}S>(l*x)**2?(n(b,this,b_).call(this,e,t,C+2,i),n(b,this,b_).call(this,e,C,r,i)):i.push(a,o)}function x_(e){let t=[],r=e.length;return n(b,this,b_).call(this,e,0,r,t),t.push(e[r-2],e[r-1]),t.length<=4?null:t}function S_(e,t,n,r,i,a){let o=new Float32Array(a**2),s=-2*r**2,c=a>>1;for(let e=0;e<a;e++){let t=(e-c)**2;for(let n=0;n<a;n++)o[e*a+n]=Math.exp((t+(n-c)**2)/s)}let l=new Float32Array(256),u=-2*i**2;for(let e=0;e<256;e++)l[e]=Math.exp(e**2/u);let d=e.length,f=new Uint8Array(d),p=new Uint32Array(256);for(let r=0;r<n;r++)for(let i=0;i<t;i++){let s=r*t+i,u=e[s],d=0,m=0;for(let s=0;s<a;s++){let f=r+s-c;if(!(f<0||f>=n))for(let n=0;n<a;n++){let r=i+n-c;if(r<0||r>=t)continue;let p=e[f*t+r],h=o[s*a+n]*l[Math.abs(p-u)];d+=p*h,m+=h}}let h=f[s]=Math.round(d/m);p[h]++}return[f,p]}function C_(e){let t=new Uint32Array(256);for(let n of e)t[n]++;return t}function w_(e){let t=e.length,n=new Uint8ClampedArray(t>>2),r=-1/0,i=1/0;for(let t=0,a=n.length;t<a;t++){let a=n[t]=e[t<<2];r=Math.max(r,a),i=Math.min(i,a)}let a=255/(r-i);for(let e=0,t=n.length;e<t;e++)n[e]=(n[e]-i)*a;return n}function T_(e){let t,n=-1/0,r=-1/0,i=e.findIndex(e=>e!==0),a=i,o=i;for(t=i;t<256;t++){let i=e[t];i>n&&(t-a>r&&(r=t-a,o=t-1),n=i,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t}function E_(e){let t=e,{width:r,height:i}=e,{maxDim:a}=n(b,this,D_)._,o=r,s=i;if(r>a||i>a){let n=r,c=i,l=Math.log2(Math.max(r,i)/a),u=Math.floor(l);l=l===u?u-1:u;for(let r=0;r<l;r++){o=Math.ceil(n/2),s=Math.ceil(c/2);let r=new OffscreenCanvas(o,s);r.getContext(`2d`).drawImage(e,0,0,n,c,0,0,o,s),n=o,c=s,e!==t&&e.close(),e=r.transferToImageBitmap()}let d=Math.min(a/o,a/s);o=Math.round(o*d),s=Math.round(s*d)}let c=new OffscreenCanvas(o,s).getContext(`2d`,{willReadFrequently:!0});c.fillStyle=`white`,c.fillRect(0,0,o,s),c.filter=`grayscale(1)`,c.drawImage(e,0,0,e.width,e.height,0,0,o,s);let l=c.getImageData(0,0,o,s).data;return[n(b,this,w_).call(this,l),o,s]}var D_={_:{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}},O_={_:new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1])},k_=class e extends vg{constructor(){super(),super.updateProperties({fill:V._defaultLineColor,"stroke-width":0})}clone(){let t=new e;return t.updateAll(this),t}},A_=class e extends c_{constructor(e){super(e),super.updateProperties({stroke:V._defaultLineColor,"stroke-width":1})}clone(){let t=new e(this._viewParameters);return t.updateAll(this),t}},j_=new WeakMap,M_=new WeakMap,N_=new WeakMap,P_=new WeakMap,F_=class e extends xg{constructor(e){super({...e,mustBeCommitted:!0,name:`signatureEditor`}),r(this,j_,!1),r(this,M_,null),r(this,N_,null),r(this,P_,null),this._willKeepAspectRatio=!0,o(N_,this,e.signatureData||null),o(M_,this,null),this.defaultL10nId=`pdfjs-editor-signature-editor1`}static initialize(e,t){V.initialize(e,t),this._defaultDrawingOptions=new k_,this._defaultDrawnSignatureOptions=new A_(t.viewParameters)}static getDefaultDrawingOptions(e){let t=this._defaultDrawingOptions.clone();return t.updateProperties(e),t}static get supportMultipleDrawings(){return!1}static get typesMap(){return j(this,`typesMap`,new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:`signature`,hasDescription:!!a(M_,this)}}static computeTelemetryFinalData(e){let t=e.get(`hasDescription`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,n,{_isCopy:r}=this;if(r&&(this._isCopy=!1,t=this.x,n=this.y),super.render(),this._drawId===null)if(a(N_,this)){let{lines:t,mustSmooth:n,areContours:r,description:i,uuid:o,heightInPage:s}=a(N_,this),{rawDims:{pageWidth:c,pageHeight:l},rotation:u}=this.parent.viewport,d=h_.processDrawnLines({lines:t,pageWidth:c,pageHeight:l,rotation:u,innerMargin:e._INNER_MARGIN,mustSmooth:n,areContours:r});this.addSignature(d,s,i,o)}else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:``})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:a(M_,this)||``}));return r&&(this._isCopy=!0,this._moveAfterPaste(t,n)),this.div}setUuid(e){o(P_,this,e),this.addEditToolbar()}getUuid(){return a(P_,this)}get description(){return a(M_,this)}set description(e){o(M_,this,e),this.div&&(this.div.setAttribute(`data-l10n-args`,JSON.stringify({description:e})),super.addEditToolbar().then(t=>{t==null||t.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:t,thickness:n,width:r,height:i}=a(N_,this),o=Math.max(r,i);return{areContours:t,outline:h_.processDrawnLines({lines:{curves:e.map(e=>({points:e})),thickness:n,width:r,height:i},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:t}).outline}}get toolbarButtons(){return this._uiManager.signatureManager?[[`editSignature`,this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,n,r,i){let{x:s,y:c}=this,{outline:l}=o(N_,this,t);o(j_,this,l instanceof f_),this.description=r;let u;a(j_,this)?u=e.getDefaultDrawingOptions():(u=e._defaultDrawnSignatureOptions.clone(),u.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:u});let[,d]=this.pageDimensions,f=n/d;f=f>=1?.5:f,this.width*=f/this.height,this.width>=1&&(f*=.9/this.width,this.width=.9),this.height=f,this.setDims(),this.x=s,this.y=c,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:`pdfjs.signature.inserted`,data:{hasBeenSaved:!!i,hasDescription:!!r}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return h_.process(t,n,r,i,e._INNER_MARGIN)}getFromText(t,n){let{rawDims:{pageWidth:r,pageHeight:i},rotation:a}=this.parent.viewport;return h_.extractContoursFromText(t,n,r,i,a,e._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:n,pageHeight:r},rotation:i}=this.parent.viewport;return h_.processDrawnLines({lines:t,pageWidth:n,pageHeight:r,rotation:i,innerMargin:e._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:n}){t?this._drawingOptions=e.getDefaultDrawingOptions():(this._drawingOptions=e._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":n}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:t,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":r}}=this,i=Object.assign(super.serialize(e),{isSignature:!0,areContours:a(j_,this),color:[0,0,0],thickness:a(j_,this)?0:r});return this.addComment(i),e?(i.paths={lines:t,points:n},i.uuid=a(P_,this),i.isCopy=!0):i.lines=t,a(M_,this)&&(i.accessibilityData={type:`Figure`,alt:a(M_,this)}),i}static deserializeDraw(e,t,n,r,i,a){return a.areContours?f_.deserialize(e,t,n,r,i,a):r_.deserialize(e,t,n,r,i,a)}static async deserialize(e,t,n){var r;let i=await super.deserialize(e,t,n);return o(j_,i,e.areContours),i.description=((r=e.accessibilityData)==null?void 0:r.alt)||``,o(P_,i,e.uuid),i}};e(F_,`_type`,`signature`),e(F_,`_editorType`,D.SIGNATURE),e(F_,`_defaultDrawingOptions`,null);var I_=new WeakMap,L_=new WeakMap,R_=new WeakMap,z_=new WeakMap,B_=new WeakMap,V_=new WeakMap,H_=new WeakMap,U_=new WeakMap,W_=new WeakMap,G_=new WeakMap,K_=new WeakMap,q_=new WeakSet,J_=class extends V{constructor(e){super({...e,name:`stampEditor`}),i(this,q_),r(this,I_,null),r(this,L_,null),r(this,R_,null),r(this,z_,null),r(this,B_,null),r(this,V_,``),r(this,H_,null),r(this,U_,!1),r(this,W_,null),r(this,G_,!1),r(this,K_,!1),o(z_,this,e.bitmapUrl),o(B_,this,e.bitmapFile),this.defaultL10nId=`pdfjs-editor-stamp-editor`}static initialize(e,t){V.initialize(e,t)}static isHandlingMimeForPasting(e){return bt.includes(e)}static paste(e,t){t.pasteEditor({mode:D.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var e;return{type:`stamp`,hasAltText:!!((e=this.altTextData)!=null&&e.altText)}}static computeTelemetryFinalData(e){let t=e.get(`hasAltText`);return{hasAltText:t.get(!0)??0,hasNoAltText:t.get(!1)??0}}async mlGuessAltText(e=null,t=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw Error(`No ML.`);if(!await n.isEnabledFor(`altText`))throw Error(`ML isn't enabled for alt text.`);let{data:r,width:i,height:a}=e||this.copyCanvas(null,null,!0).imageData,o=await n.guess({name:`altText`,request:{data:r,width:i,height:a,channels:r.length/(i*a)}});if(!o)throw Error(`No response from the AI service.`);if(o.error)throw Error(`Error from the AI service.`);if(o.cancel)return null;if(!o.output)throw Error(`No valid response from the AI service.`);let s=o.output;return await this.setGuessedAltText(s),t&&!this.hasAltTextData()&&(this.altTextData={alt:s,decorative:!1}),s}remove(){if(a(L_,this)){var e;o(I_,this,null),this._uiManager.imageManager.deleteId(a(L_,this)),(e=a(H_,this))==null||e.remove(),o(H_,this,null),a(W_,this)&&(clearTimeout(a(W_,this)),o(W_,this,null))}super.remove()}rebuild(){if(!this.parent){a(L_,this)&&n(q_,this,Z_).call(this);return}super.rebuild(),this.div!==null&&(a(L_,this)&&a(H_,this)===null&&n(q_,this,Z_).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(a(R_,this)||a(I_,this)||a(z_,this)||a(B_,this)||a(L_,this)||a(U_,this))}get toolbarButtons(){return[[`altText`,this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;return this._isCopy&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.createAltText(),a(U_,this)||(a(I_,this)?n(q_,this,Q_).call(this):n(q_,this,Z_).call(this)),this._isCopy&&this._moveAfterPaste(e,t),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,t){let{id:r,bitmap:i}=this._uiManager.imageManager.getFromCanvas(e,t);t.remove(),r&&this._uiManager.imageManager.isValidId(r)&&(o(L_,this,r),i&&o(I_,this,i),o(U_,this,!1),n(q_,this,Q_).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(a(W_,this)!==null&&clearTimeout(a(W_,this)),o(W_,this,setTimeout(()=>{o(W_,this,null),n(q_,this,ev).call(this)},200)))}copyCanvas(e,t,r=!1){e||(e=224);let{width:i,height:o}=a(I_,this),s=new yt,c=a(I_,this),l=i,u=o,d=null;if(t){if(i>t||o>t){let e=Math.min(t/i,t/o);l=Math.floor(i*e),u=Math.floor(o*e)}d=document.createElement(`canvas`);let e=d.width=Math.ceil(l*s.sx),r=d.height=Math.ceil(u*s.sy);a(G_,this)||(c=n(q_,this,$_).call(this,e,r));let f=d.getContext(`2d`);f.filter=this._uiManager.hcmFilter;let p=`white`,m=`#cfcfd8`;this._uiManager.hcmFilter===`none`?xt.isDarkMode&&(p=`#8f8f9d`,m=`#42414d`):m=`black`;let h=15*s.sx,g=15*s.sy,_=new OffscreenCanvas(h*2,g*2),v=_.getContext(`2d`);v.fillStyle=p,v.fillRect(0,0,h*2,g*2),v.fillStyle=m,v.fillRect(0,0,h,g),v.fillRect(h,g,h,g),f.fillStyle=f.createPattern(_,`repeat`),f.fillRect(0,0,e,r),f.drawImage(c,0,0,c.width,c.height,0,0,e,r)}let f=null;if(r){let t,r;if(s.symmetric&&c.width<e&&c.height<e)t=c.width,r=c.height;else if(c=a(I_,this),i>e||o>e){let s=Math.min(e/i,e/o);t=Math.floor(i*s),r=Math.floor(o*s),a(G_,this)||(c=n(q_,this,$_).call(this,t,r))}let l=new OffscreenCanvas(t,r).getContext(`2d`,{willReadFrequently:!0});l.drawImage(c,0,0,c.width,c.height,0,0,t,r),f={width:t,height:r,data:l.getImageData(0,0,t,r).data}}return{canvas:d,width:l,height:u,imageData:f}}static async deserialize(e,t,n){let r=null,i=!1;if(e instanceof sm){var a;let{data:{rect:o,rotation:s,id:c,structParent:l,popupRef:u,richText:d,contentsObj:f,creationDate:p,modificationDate:m},container:h,parent:{page:{pageNumber:g}},canvas:_}=e,v,y;_?(delete e.canvas,{id:v,bitmap:y}=n.imageManager.getFromCanvas(h.id,_),_.remove()):(i=!0,e._hasNoCanvas=!0);let b=((a=await t._structTree.getAriaAttributes(`${We}${c}`))==null?void 0:a.get(`aria-label`))||``;r=e={annotationType:D.STAMP,bitmapId:v,bitmap:y,pageIndex:g-1,rect:o.slice(0),rotation:s,annotationElementId:c,id:c,deleted:!1,accessibilityData:{decorative:!1,altText:b},isSvg:!1,structParent:l,popupRef:u,richText:d,comment:(f==null?void 0:f.str)||null,creationDate:p,modificationDate:m}}let s=await super.deserialize(e,t,n),{rect:c,bitmap:l,bitmapUrl:u,bitmapId:d,isSvg:f,accessibilityData:p}=e;i?(n.addMissingCanvas(e.id,s),o(U_,s,!0)):d&&n.imageManager.isValidId(d)?(o(L_,s,d),l&&o(I_,s,l)):o(z_,s,u),o(G_,s,f);let[m,h]=s.pageDimensions;return s.width=(c[2]-c[0])/m,s.height=(c[3]-c[1])/h,p&&(s.altTextData=p),s._initialData=r,e.comment&&s.setCommentData(e),o(K_,s,!!r),s}serialize(e=!1,t=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let r=Object.assign(super.serialize(e),{bitmapId:a(L_,this),isSvg:a(G_,this)});if(this.addComment(r),e)return r.bitmapUrl=n(q_,this,tv).call(this,!0),r.accessibilityData=this.serializeAltText(!0),r.isCopy=!0,r;let{decorative:i,altText:o}=this.serializeAltText(!1);if(!i&&o&&(r.accessibilityData={type:`Figure`,alt:o}),this.annotationElementId){let e=n(q_,this,nv).call(this,r);return e.isSame?null:(e.isSameAltText?delete r.accessibilityData:r.accessibilityData.structParent=this._initialData.structParent??-1,r.id=this.annotationElementId,delete r.bitmapId,r)}if(t===null)return r;t.stamps||(t.stamps=new Map);let s=a(G_,this)?(r.rect[2]-r.rect[0])*(r.rect[3]-r.rect[1]):null;if(!t.stamps.has(a(L_,this)))t.stamps.set(a(L_,this),{area:s,serialized:r}),r.bitmap=n(q_,this,tv).call(this,!1);else if(a(G_,this)){let e=t.stamps.get(a(L_,this));s>e.area&&(e.area=s,e.serialized.bitmap.close(),e.serialized.bitmap=n(q_,this,tv).call(this,!1))}return r}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};function Y_(e,t=!1){if(!e){this.remove();return}o(I_,this,e.bitmap),t||(o(L_,this,e.id),o(G_,this,e.isSvg)),e.file&&o(V_,this,e.file.name),n(q_,this,Q_).call(this)}function X_(){if(o(R_,this,null),this._uiManager.enableWaiting(!1),a(H_,this)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(I_,this)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(I_,this)){this._reportTelemetry({action:`pdfjs.image.image_added`,data:{alt_text_modal:!1,alt_text_type:`empty`}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}function Z_(){if(a(L_,this)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(a(L_,this)).then(e=>n(q_,this,Y_).call(this,e,!0)).finally(()=>n(q_,this,X_).call(this));return}if(a(z_,this)){let e=a(z_,this);o(z_,this,null),this._uiManager.enableWaiting(!0),o(R_,this,this._uiManager.imageManager.getFromUrl(e).then(e=>n(q_,this,Y_).call(this,e)).finally(()=>n(q_,this,X_).call(this)));return}if(a(B_,this)){let e=a(B_,this);o(B_,this,null),this._uiManager.enableWaiting(!0),o(R_,this,this._uiManager.imageManager.getFromFile(e).then(e=>n(q_,this,Y_).call(this,e)).finally(()=>n(q_,this,X_).call(this)));return}let e=document.createElement(`input`);e.type=`file`,e.accept=bt.join(`,`);let t=this._uiManager._signal;o(R_,this,new Promise(r=>{e.addEventListener(`change`,async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let t=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:`pdfjs.image.image_selected`,data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),n(q_,this,Y_).call(this,t)}r()},{signal:t}),e.addEventListener(`cancel`,()=>{this.remove(),r()},{signal:t})}).finally(()=>n(q_,this,X_).call(this))),e.click()}function Q_(){var e;let{div:t}=this,{width:r,height:i}=a(I_,this),[s,c]=this.pageDimensions,l=.75;if(this.width)r=this.width*s,i=this.height*c;else if(r>l*s||i>l*c){let e=Math.min(l*s/r,l*c/i);r*=e,i*=e}this._uiManager.enableWaiting(!1);let u=o(H_,this,document.createElement(`canvas`));u.setAttribute(`role`,`img`),this.addContainer(u),this.width=r/s,this.height=i/c,this.setDims(),(e=this._initialOptions)!=null&&e.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),n(q_,this,ev).call(this),a(K_,this)||(this.parent.addUndoableEditor(this),o(K_,this,!0)),this._reportTelemetry({action:`inserted_image`}),a(V_,this)&&this.div.setAttribute(`aria-description`,a(V_,this)),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-stamp-added-alert`)}function $_(e,t){let{width:n,height:r}=a(I_,this),i=n,o=r,s=a(I_,this);for(;i>2*e||o>2*t;){let n=i,r=o;i>2*e&&(i=Math.ceil(i/2)),o>2*t&&(o=Math.ceil(o/2));let a=new OffscreenCanvas(i,o);a.getContext(`2d`).drawImage(s,0,0,n,r,0,0,i,o),s=a.transferToImageBitmap()}return s}function ev(){let[e,t]=this.parentDimensions,{width:r,height:i}=this,o=new yt,s=Math.ceil(r*e*o.sx),c=Math.ceil(i*t*o.sy),l=a(H_,this);if(!l||l.width===s&&l.height===c)return;l.width=s,l.height=c;let u=a(G_,this)?a(I_,this):n(q_,this,$_).call(this,s,c),d=l.getContext(`2d`);d.filter=this._uiManager.hcmFilter,d.drawImage(u,0,0,u.width,u.height,0,0,s,c)}function tv(e){if(e){if(a(G_,this)){let e=this._uiManager.imageManager.getSvgUrl(a(L_,this));if(e)return e}let e=document.createElement(`canvas`);return{width:e.width,height:e.height}=a(I_,this),e.getContext(`2d`).drawImage(a(I_,this),0,0),e.toDataURL()}if(a(G_,this)){let[e,t]=this.pageDimensions,n=Math.round(this.width*e*Qe.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*Qe.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext(`2d`).drawImage(a(I_,this),0,0,a(I_,this).width,a(I_,this).height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(a(I_,this))}function nv(e){var t;let{pageIndex:n,accessibilityData:{altText:r}}=this._initialData,i=e.pageIndex===n,a=(((t=e.accessibilityData)==null?void 0:t.alt)||``)===r;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&a,isSameAltText:a}}e(J_,`_type`,`stamp`),e(J_,`_editorType`,D.STAMP);var rv=new WeakMap,iv=new WeakMap,av=new WeakMap,ov=new WeakMap,sv=new WeakMap,cv=new WeakMap,lv=new WeakMap,uv=new WeakMap,dv=new WeakMap,fv=new WeakMap,pv=new WeakMap,mv=new WeakMap,hv=new WeakMap,gv=new WeakMap,_v=new WeakMap,$=new WeakMap,vv=new WeakSet,yv=class e{constructor({uiManager:t,pageIndex:n,div:s,structTreeLayer:c,accessibilityManager:l,annotationLayer:u,drawLayer:d,textLayer:f,viewport:p,l10n:m}){i(this,vv),r(this,rv,void 0),r(this,iv,!1),r(this,av,null),r(this,ov,null),r(this,sv,null),r(this,cv,new Map),r(this,lv,!1),r(this,uv,!1),r(this,dv,!1),r(this,fv,null),r(this,pv,null),r(this,mv,null),r(this,hv,null),r(this,gv,null),r(this,_v,-1),r(this,$,void 0);let h=[...Ev._.values()];if(!e._initialized){e._initialized=!0;for(let e of h)e.initialize(m,t)}t.registerEditorTypes(h),o($,this,t),this.pageIndex=n,this.div=s,o(rv,this,l),o(av,this,u),this.viewport=p,o(mv,this,f),this.drawLayer=d,this._structTree=c,a($,this).addLayer(this)}get isEmpty(){return a(cv,this).size===0}get isInvisible(){return this.isEmpty&&a($,this).getMode()===D.NONE}updateToolbar(e){a($,this).updateToolbar(e)}updateMode(e=a($,this).getMode()){switch(n(vv,this,Tv).call(this),e){case D.NONE:this.div.classList.toggle(`nonEditing`,!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case D.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case D.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:t}=this.div;if(t.toggle(`nonEditing`,!1),e===D.POPUP)t.toggle(`commentEditing`,!0);else{t.toggle(`commentEditing`,!1);for(let n of Ev._.values())t.toggle(`${n._type}Editing`,e===n._editorType)}this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=a(mv,this))==null?void 0:t.div)}setEditingState(e){a($,this).setEditingState(e)}addCommands(e){a($,this).addCommands(e)}cleanUndoStack(e){a($,this).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle(`drawing`,!e)}togglePointerEvents(e=!1){this.div.classList.toggle(`disabled`,!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=a(av,this))==null||t.togglePointerEvents(e)}async enable(){var e;o(dv,this,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle(`nonEditing`,!1),(e=a(gv,this))==null||e.abort(),o(gv,this,null);let t=new Set;for(let e of bv.call(n(vv,this)))e.enableEditing(),e.show(!0),e.annotationElementId&&(a($,this).removeChangedExistingAnnotation(e),t.add(e.annotationElementId));let r=a(av,this);if(r)for(let e of r.getEditableAnnotations()){if(e.hide(),a($,this).isDeletedAnnotationElement(e.data.id)||t.has(e.data.id))continue;let n=await this.deserialize(e);n&&(this.addOrRebuild(n),n.enableEditing())}o(dv,this,!1),a($,this)._eventBus.dispatch(`editorsrendered`,{source:this,pageNumber:this.pageIndex+1})}disable(){if(o(uv,this,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle(`nonEditing`,!0),a(mv,this)&&!a(gv,this)){o(gv,this,new AbortController);let e=a($,this).combinedSignal(a(gv,this));a(mv,this).div.addEventListener(`pointerdown`,e=>{let{clientX:t,clientY:n,timeStamp:r}=e;if(r-a(_v,this)>500){o(_v,this,r);return}o(_v,this,-1);let{classList:i}=this.div;i.toggle(`getElements`,!0);let s=document.elementsFromPoint(t,n);if(i.toggle(`getElements`,!1),!this.div.contains(s[0]))return;let c,l=RegExp(`^${se}[0-9]+$`);for(let e of s)if(l.test(e.id)){c=e.id;break}if(!c)return;let u=a(cv,this).get(c);(u==null?void 0:u.annotationElementId)===null&&(P(e),u.dblclick(e))},{signal:e,capture:!0})}let e=a(av,this),t=[];if(e){let i=new Map,o=new Map;for(let e of bv.call(n(vv,this))){var r;if(e.disableEditing(),!e.annotationElementId){t.push(e);continue}if(e.serialize()!==null){i.set(e.annotationElementId,e);continue}else o.set(e.annotationElementId,e);(r=this.getEditableAnnotation(e.annotationElementId))==null||r.show(),e.remove()}for(let t of e.getEditableAnnotations()){let{id:e}=t.data;if(a($,this).isDeletedAnnotationElement(e)){t.updateEdited({deleted:!0});continue}let n=o.get(e);if(n){n.resetAnnotationElement(t),n.show(!1),t.show();continue}n=i.get(e),n&&(a($,this).addChangedExistingAnnotation(n),n.renderAnnotationElement(t)&&n.show(!1)),t.show()}}n(vv,this,Tv).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let e of Ev._.values())i.remove(`${e._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),e==null||e.updateFakeAnnotations(t),o(uv,this,!1)}getEditableAnnotation(e){var t;return((t=a(av,this))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){a($,this).getActive()!==e&&a($,this).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=a(mv,this))!=null&&e.div&&!a(hv,this)){o(hv,this,new AbortController);let e=a($,this).combinedSignal(a(hv,this));a(mv,this).div.addEventListener(`pointerdown`,n(vv,this,xv).bind(this),{signal:e}),a(mv,this).div.classList.add(`highlighting`)}}disableTextSelection(){var e;this.div.tabIndex=0,(e=a(mv,this))!=null&&e.div&&a(hv,this)&&(a(hv,this).abort(),o(hv,this,null),a(mv,this).div.classList.remove(`highlighting`))}enableClick(){if(a(ov,this))return;o(ov,this,new AbortController);let e=a($,this).combinedSignal(a(ov,this));this.div.addEventListener(`pointerdown`,this.pointerdown.bind(this),{signal:e});let t=this.pointerup.bind(this);this.div.addEventListener(`pointerup`,t,{signal:e}),this.div.addEventListener(`pointercancel`,t,{signal:e})}disableClick(){var e;(e=a(ov,this))==null||e.abort(),o(ov,this,null)}attach(e){a(cv,this).set(e.id,e);let{annotationElementId:t}=e;t&&a($,this).isDeletedAnnotationElement(t)&&a($,this).removeDeletedAnnotationElement(e)}detach(e){var t;a(cv,this).delete(e.id),(t=a(rv,this))==null||t.removePointerInTextLayer(e.contentDiv),!a(uv,this)&&e.annotationElementId&&a($,this).addDeletedAnnotationElement(e)}remove(e){this.detach(e),a($,this).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(a($,this).addDeletedAnnotationElement(e),V.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),a($,this).addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!a(dv,this)),a($,this).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var t;if(!e.isAttachedToDOM)return;let{activeElement:n}=document;e.div.contains(n)&&!a(sv,this)&&(e._focusEventsAllowed=!1,o(sv,this,setTimeout(()=>{o(sv,this,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0,signal:a($,this)._signal}),n.focus())},0))),e._structTreeParentId=(t=a(rv,this))==null?void 0:t.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getEditorByUID(e){for(let t of a(cv,this).values())if(t.uid===e)return t;return null}combinedSignal(e){return a($,this).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=Sv.call(n(vv,this)))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await a($,this).updateMode(e.mode);let{offsetX:r,offsetY:i}=n(vv,this,wv).call(this),o=a($,this).getId(),s=n(vv,this,Cv).call(this,{parent:this,id:o,x:r,y:i,uiManager:a($,this),isCentered:!0,...t});s&&this.add(s)}async deserialize(e){var t;return await((t=Ev._.get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,a($,this)))||null}createAndAddNewEditor(e,t,r={}){let i=a($,this).getId(),o=n(vv,this,Cv).call(this,{parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:a($,this),isCentered:t,...r});return o&&this.add(o),o}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(e={}){this.createAndAddNewEditor(n(vv,this,wv).call(this),!0,e)}setSelected(e){a($,this).setSelected(e)}toggleSelected(e){a($,this).toggleSelected(e)}unselect(e){a($,this).unselect(e)}pointerup(e){var t;let{isMac:r}=Ie.platform;if(e.button!==0||e.ctrlKey&&r||e.target!==this.div||!a(lv,this)||(o(lv,this,!1),(t=Sv.call(n(vv,this)))!=null&&t.isDrawer&&Sv.call(n(vv,this)).supportMultipleDrawings))return;if(!a(iv,this)){o(iv,this,!0);return}let i=a($,this).getMode();if(i===D.STAMP||i===D.POPUP||i===D.SIGNATURE){a($,this).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var t;if(a($,this).getMode()===D.HIGHLIGHT&&this.enableTextSelection(),a(lv,this)){o(lv,this,!1);return}let{isMac:r}=Ie.platform;if(e.button!==0||e.ctrlKey&&r||e.target!==this.div)return;if(o(lv,this,!0),(t=Sv.call(n(vv,this)))!=null&&t.isDrawer){this.startDrawingSession(e);return}let i=a($,this).getActive();o(iv,this,!i||i.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),a(fv,this)){Sv.call(n(vv,this)).startDrawing(this,a($,this),!1,e);return}a($,this).setCurrentDrawingSession(this),o(fv,this,new AbortController);let t=a($,this).combinedSignal(a(fv,this));this.div.addEventListener(`blur`,({relatedTarget:e})=>{e&&!this.div.contains(e)&&(o(pv,this,null),this.commitOrRemove())},{signal:t}),Sv.call(n(vv,this)).startDrawing(this,a($,this),!1,e)}pause(e){if(e){let{activeElement:e}=document;this.div.contains(e)&&o(pv,this,e);return}a(pv,this)&&setTimeout(()=>{var e;(e=a(pv,this))==null||e.focus(),o(pv,this,null)},0)}endDrawingSession(e=!1){return a(fv,this)?(a($,this).setCurrentDrawingSession(null),a(fv,this).abort(),o(fv,this,null),o(pv,this,null),Sv.call(n(vv,this)).endDrawing(e)):null}findNewParent(e,t,n){let r=a($,this).findParent(t,n);return r===null||r===this?!1:(r.changeParent(e),!0)}commitOrRemove(){return a(fv,this)?(this.endDrawingSession(),!0):!1}onScaleChanging(){a(fv,this)&&Sv.call(n(vv,this)).onScaleChangingWhenDrawing(this)}destroy(){var e;this.commitOrRemove(),((e=a($,this).getActive())==null?void 0:e.parent)===this&&(a($,this).commitOrRemove(),a($,this).setActiveEditor(null)),a(sv,this)&&(clearTimeout(a(sv,this)),o(sv,this,null));for(let e of a(cv,this).values()){var t;(t=a(rv,this))==null||t.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove()}this.div=null,a(cv,this).clear(),a($,this).removeLayer(this)}async render({viewport:e}){this.viewport=e,vt(this.div,e);for(let e of a($,this).getEditors(this.pageIndex))this.add(e),e.rebuild();await a($,this).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){a($,this).commitOrRemove(),n(vv,this,Tv).call(this);let t=this.viewport.rotation,r=e.rotation;if(this.viewport=e,vt(this.div,{rotation:r}),t!==r)for(let e of a(cv,this).values())e.rotate(r)}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return a($,this).viewParameters.realScale}};function bv(){return a(cv,this).size===0?a($,this).getEditors(this.pageIndex):a(cv,this).values()}function xv(e){a($,this).unselectAll();let{target:t}=e;if(t===a(mv,this).div||(t.getAttribute(`role`)===`img`||t.classList.contains(`endOfContent`)||t.classList.contains(`textLayerImagePlaceholder`))&&a(mv,this).div.contains(t)){let{isMac:t}=Ie.platform;if(e.button!==0||e.ctrlKey&&t)return;a($,this).showAllEditors(`highlight`,!0,!0),a(mv,this).div.classList.add(`free`),this.toggleDrawing(),eg.startHighlighting(this,a($,this).direction===`ltr`,{target:a(mv,this).div,x:e.x,y:e.y}),a(mv,this).div.addEventListener(`pointerup`,()=>{a(mv,this).div.classList.remove(`free`),this.toggleDrawing(!0)},{once:!0,signal:a($,this)._signal}),e.preventDefault()}}function Sv(){return Ev._.get(a($,this).getMode())}function Cv(e){let t=Sv.call(n(vv,this));return t?new t.prototype.constructor(e):null}function wv(){let{x:e,y:t,width:n,height:r}=this.boundingClientRect,i=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+n),s=Math.min(window.innerHeight,t+r),c=(i+o)/2-e,l=(a+s)/2-t,[u,d]=this.viewport.rotation%180==0?[c,l]:[l,c];return{offsetX:u,offsetY:d}}function Tv(){for(let e of a(cv,this).values())e.isEmpty()&&e.remove()}e(yv,`_initialized`,!1);var Ev={_:new Map([Am,u_,J_,eg,F_].map(e=>[e._editorType,e]))},Dv=new WeakMap,Ov=new WeakMap,kv=new WeakMap,Av=new WeakSet,jv=class e{constructor(){i(this,Av),r(this,Dv,null),r(this,Ov,new Map),r(this,kv,new Map)}setParent(e){if(!a(Dv,this)){o(Dv,this,e);return}if(a(Dv,this)!==e){if(a(Ov,this).size>0)for(let t of a(Ov,this).values())t.remove(),e.append(t);o(Dv,this,e)}}static get _svgFactory(){return j(this,`_svgFactory`,new Df)}draw(t,r=!1,i=!1){var o,s;let c=(Iv._=(o=Iv._,s=o++,o),s),l=n(Av,this,Nv).call(this),u=e._svgFactory.createElement(`defs`);l.append(u);let d=e._svgFactory.createElement(`path`);u.append(d);let f=`path_${c}`;d.setAttribute(`id`,f),d.setAttribute(`vector-effect`,`non-scaling-stroke`),r&&a(kv,this).set(c,d);let p=i?n(Av,this,Pv).call(this,u,f):null,m=e._svgFactory.createElement(`use`);return l.append(m),m.setAttribute(`href`,`#${f}`),this.updateProperties(l,t),a(Ov,this).set(c,l),{id:c,clipPathId:`url(#${p})`}}drawOutline(t,r){var i,o;let s=(Iv._=(i=Iv._,o=i++,i),o),c=n(Av,this,Nv).call(this),l=e._svgFactory.createElement(`defs`);c.append(l);let u=e._svgFactory.createElement(`path`);l.append(u);let d=`path_${s}`;u.setAttribute(`id`,d),u.setAttribute(`vector-effect`,`non-scaling-stroke`);let f;if(r){let t=e._svgFactory.createElement(`mask`);l.append(t),f=`mask_${s}`,t.setAttribute(`id`,f),t.setAttribute(`maskUnits`,`objectBoundingBox`);let n=e._svgFactory.createElement(`rect`);t.append(n),n.setAttribute(`width`,`1`),n.setAttribute(`height`,`1`),n.setAttribute(`fill`,`white`);let r=e._svgFactory.createElement(`use`);t.append(r),r.setAttribute(`href`,`#${d}`),r.setAttribute(`stroke`,`none`),r.setAttribute(`fill`,`black`),r.setAttribute(`fill-rule`,`nonzero`),r.classList.add(`mask`)}let p=e._svgFactory.createElement(`use`);c.append(p),p.setAttribute(`href`,`#${d}`),f&&p.setAttribute(`mask`,`url(#${f})`);let m=p.cloneNode();return c.append(m),p.classList.add(`mainOutline`),m.classList.add(`secondaryOutline`),this.updateProperties(c,t),a(Ov,this).set(s,c),s}finalizeDraw(e,t){a(kv,this).delete(e),this.updateProperties(e,t)}updateProperties(t,r){if(!r)return;let{root:i,bbox:o,rootClass:s,path:c}=r,l=typeof t==`number`?a(Ov,this).get(t):t;if(l){if(i&&n(Av,this,Fv).call(this,l,i),o&&Mv.call(e,l,o),s){let{classList:e}=l;for(let[t,n]of Object.entries(s))e.toggle(t,n)}if(c){let e=l.firstElementChild.firstElementChild;n(Av,this,Fv).call(this,e,c)}}}updateParent(e,t){if(t===this)return;let n=a(Ov,this).get(e);n&&(a(Dv,t).append(n),a(Ov,this).delete(e),a(Ov,t).set(e,n))}remove(e){a(kv,this).delete(e),a(Dv,this)!==null&&(a(Ov,this).get(e).remove(),a(Ov,this).delete(e))}destroy(){o(Dv,this,null);for(let e of a(Ov,this).values())e.remove();a(Ov,this).clear(),a(kv,this).clear()}};x=jv;function Mv(e,[t,n,r,i]){let{style:a}=e;a.top=`${100*n}%`,a.left=`${100*t}%`,a.width=`${100*r}%`,a.height=`${100*i}%`}function Nv(){let e=x._svgFactory.create(1,1,!0);return a(Dv,this).append(e),e.setAttribute(`aria-hidden`,!0),e}function Pv(e,t){let n=x._svgFactory.createElement(`clipPath`);e.append(n);let r=`clip_${t}`;n.setAttribute(`id`,r),n.setAttribute(`clipPathUnits`,`objectBoundingBox`);let i=x._svgFactory.createElement(`use`);return n.append(i),i.setAttribute(`href`,`#${t}`),i.classList.add(`clip`),r}function Fv(e,t){for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r)}var Iv={_:0};function Lv(e){return`${(e*100).toFixed(2)}%`}var Rv=new WeakMap,zv=new WeakMap,Bv=new WeakMap,Vv=new WeakMap,Hv=new WeakMap,Uv=new WeakMap,Wv=new WeakSet,Gv=class{constructor(e,t,n,a){i(this,Wv),r(this,Rv,[]),r(this,zv,new Map),r(this,Bv,null),r(this,Vv,0),r(this,Hv,0),r(this,Uv,0),o(Vv,this,e),o(Rv,this,t),o(Hv,this,n.rawDims.pageWidth),o(Uv,this,n.rawDims.pageHeight),o(Bv,this,a)}render(){let e=document.createElement(`div`);e.className=`textLayerImages`;for(let t=0;t<a(Rv,this).length;t+=6){let r=n(Wv,this,Kv).call(this,a(Rv,this).subarray(t,t+6));r&&e.append(r)}return e.addEventListener(`contextmenu`,e=>{var t;if(!(e.target instanceof HTMLCanvasElement))return;let n=e.target,r=a(zv,this).get(n);if(!r)return;let i=(t=qv._)==null?void 0:t.deref();if(i===n)return;i&&(i.width=0,i.height=0),qv._=new WeakRef(n);let{inverseTransform:o,x1:s,y1:c,width:l,height:u}=r,d=a(Bv,this).call(this),f=Math.ceil(s*d.width),p=Math.ceil(c*d.height),m=Math.floor((s+l/a(Hv,this))*d.width),h=Math.floor((c+u/a(Uv,this))*d.height);n.width=m-f,n.height=h-p;let g=n.getContext(`2d`);g.setTransform(...o),g.translate(-f,-p),g.drawImage(d,0,0)}),e}};function Kv([e,t,n,r,i,o]){let s=Math.hypot((i-e)*a(Hv,this),(o-t)*a(Uv,this)),c=Math.hypot((n-e)*a(Hv,this),(r-t)*a(Uv,this));if(s<a(Vv,this)||c<a(Vv,this))return null;let l=[(i-e)*a(Hv,this)/s,(o-t)*a(Uv,this)/s,(n-e)*a(Hv,this)/c,(r-t)*a(Uv,this)/c,0,0],u=M.inverseTransform(l),d=document.createElement(`canvas`);return d.className=`textLayerImagePlaceholder`,d.width=0,d.height=0,Object.assign(d.style,{opacity:0,position:`absolute`,left:Lv(e),top:Lv(t),width:Lv(s/a(Hv,this)),height:Lv(c/a(Uv,this)),transformOrigin:`0% 0%`,transform:`matrix(${l.join(`,`)})`}),a(zv,this).set(d,{inverseTransform:u,width:s,height:c,x1:e,y1:t}),d}var qv={_:null};globalThis._pdfjsTestingUtils={HighlightOutliner:Th},globalThis.pdfjsLib={AbortException:Me,AnnotationEditorLayer:yv,AnnotationEditorParamsType:O,AnnotationEditorType:D,AnnotationEditorUIManager:xr,AnnotationLayer:xm,AnnotationMode:oe,AnnotationType:de,applyOpacity:Ct,build:Xd,ColorPicker:lf,createValidAbsoluteUrl:Ce,CSSConstants:St,DOMSVGFactory:Df,DrawLayer:jv,FeatureTest:Ie,fetchData:$e,findContrastColor:kt,getDocument:cd,getFilenameFromUrl:it,getPdfFilenameFromUrl:at,getRGB:ht,getRGBA:mt,getUuid:Ue,getXfaPageViewport:pt,GlobalWorkerOptions:Jl,ImageKind:ue,InvalidPDFException:ke,isDataScheme:nt,isPdfFile:rt,isValidExplicitDest:ls,makeArr:Ke,makeMap:qe,makeObj:Je,MathClamp:N,noContextMenu:lt,normalizeUnicode:He,OPS:me,OutputScale:yt,PasswordResponses:ge,PDFDataRangeTransport:pd,PDFDateString:dt,PDFWorker:Td,PermissionFlag:ce,PixelsPerInch:Qe,RenderingCancelledException:tt,renderRichText:At,ResponseException:Ae,setLayerDimensions:vt,shadow:j,SignatureExtractor:h_,stopEvent:P,SupportedImageMimeTypes:bt,TextLayer:Ju,TextLayerImages:Gv,TouchManager:Mi,updateUrlHash:we,Util:M,VerbosityLevel:pe,version:Yd,XfaLayer:Xe};export{Me as AbortException,yv as AnnotationEditorLayer,O as AnnotationEditorParamsType,D as AnnotationEditorType,xr as AnnotationEditorUIManager,xm as AnnotationLayer,oe as AnnotationMode,de as AnnotationType,St as CSSConstants,lf as ColorPicker,Df as DOMSVGFactory,jv as DrawLayer,Ie as FeatureTest,Jl as GlobalWorkerOptions,ue as ImageKind,ke as InvalidPDFException,N as MathClamp,me as OPS,yt as OutputScale,pd as PDFDataRangeTransport,dt as PDFDateString,Td as PDFWorker,ge as PasswordResponses,ce as PermissionFlag,Qe as PixelsPerInch,tt as RenderingCancelledException,Ae as ResponseException,h_ as SignatureExtractor,bt as SupportedImageMimeTypes,Ju as TextLayer,Gv as TextLayerImages,Mi as TouchManager,M as Util,pe as VerbosityLevel,Xe as XfaLayer,Ct as applyOpacity,Xd as build,Ce as createValidAbsoluteUrl,$e as fetchData,kt as findContrastColor,cd as getDocument,it as getFilenameFromUrl,at as getPdfFilenameFromUrl,ht as getRGB,mt as getRGBA,Ue as getUuid,pt as getXfaPageViewport,nt as isDataScheme,rt as isPdfFile,ls as isValidExplicitDest,Ke as makeArr,qe as makeMap,Je as makeObj,lt as noContextMenu,He as normalizeUnicode,At as renderRichText,vt as setLayerDimensions,j as shadow,P as stopEvent,we as updateUrlHash,Yd as version};
55
- //# sourceMappingURL=pdf-9NuP_4_b.js.map
55
+ //# sourceMappingURL=pdf-DyX3XLCf.js.map