@kne-components/components-core 0.3.26 → 0.3.27

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 (146) hide show
  1. package/build/asset-manifest.json +101 -101
  2. package/build/index.html +1 -1
  3. package/build/remoteEntry.js +1 -1
  4. package/build/remoteEntry.js.map +1 -1
  5. package/build/static/css/1248.54e603d8.chunk.css +2 -0
  6. package/build/static/css/{1248.9cbcf853.chunk.css.map → 1248.54e603d8.chunk.css.map} +1 -1
  7. package/build/static/css/1381.e1624a06.chunk.css +2 -0
  8. package/build/static/css/1381.e1624a06.chunk.css.map +1 -0
  9. package/build/static/css/1742.08d2747f.chunk.css +2 -0
  10. package/build/static/css/{1742.cd416dd0.chunk.css.map → 1742.08d2747f.chunk.css.map} +1 -1
  11. package/build/static/css/{1996.ddb8db0b.chunk.css → 1996.727b9448.chunk.css} +2 -2
  12. package/build/static/css/{1996.ddb8db0b.chunk.css.map → 1996.727b9448.chunk.css.map} +1 -1
  13. package/build/static/css/206.5a515f33.chunk.css +2 -0
  14. package/build/static/css/{206.8338cc31.chunk.css.map → 206.5a515f33.chunk.css.map} +1 -1
  15. package/build/static/css/2307.6195f32b.chunk.css +2 -0
  16. package/build/static/css/{2307.59328d7e.chunk.css.map → 2307.6195f32b.chunk.css.map} +1 -1
  17. package/build/static/css/254.21a841a4.chunk.css +2 -0
  18. package/build/static/css/{254.f85e422b.chunk.css.map → 254.21a841a4.chunk.css.map} +1 -1
  19. package/build/static/css/2716.0a88f083.chunk.css +2 -0
  20. package/build/static/css/{2716.ce9984fa.chunk.css.map → 2716.0a88f083.chunk.css.map} +1 -1
  21. package/build/static/css/{2765.ce93154a.chunk.css → 2765.3212941b.chunk.css} +2 -2
  22. package/build/static/css/2765.3212941b.chunk.css.map +1 -0
  23. package/build/static/css/3205.eed023cb.chunk.css +2 -0
  24. package/build/static/css/{3205.f5df444d.chunk.css.map → 3205.eed023cb.chunk.css.map} +1 -1
  25. package/build/static/css/{3771.0b48e91b.chunk.css → 3771.f7da4aa2.chunk.css} +2 -2
  26. package/build/static/css/{3771.0b48e91b.chunk.css.map → 3771.f7da4aa2.chunk.css.map} +1 -1
  27. package/build/static/css/{3790.1340423a.chunk.css → 3790.ed803fb8.chunk.css} +2 -2
  28. package/build/static/css/{3790.1340423a.chunk.css.map → 3790.ed803fb8.chunk.css.map} +1 -1
  29. package/build/static/css/{4277.9e78e664.chunk.css → 4277.9f8f2fd0.chunk.css} +2 -2
  30. package/build/static/css/{4277.9e78e664.chunk.css.map → 4277.9f8f2fd0.chunk.css.map} +1 -1
  31. package/build/static/css/5195.5d165b87.chunk.css +2 -0
  32. package/build/static/css/{5195.1a7764c9.chunk.css.map → 5195.5d165b87.chunk.css.map} +1 -1
  33. package/build/static/css/5633.e1624a06.chunk.css +2 -0
  34. package/build/static/css/5633.e1624a06.chunk.css.map +1 -0
  35. package/build/static/css/{6763.0a1f1b86.chunk.css → 6763.08be94cd.chunk.css} +2 -2
  36. package/build/static/css/{6763.0a1f1b86.chunk.css.map → 6763.08be94cd.chunk.css.map} +1 -1
  37. package/build/static/css/6980.58616f2c.chunk.css +12 -0
  38. package/build/static/css/{6980.c90479d9.chunk.css.map → 6980.58616f2c.chunk.css.map} +1 -1
  39. package/build/static/css/7227.63382196.chunk.css +2 -0
  40. package/build/static/css/{7227.1d04c161.chunk.css.map → 7227.63382196.chunk.css.map} +1 -1
  41. package/build/static/css/{760.a8e3fc68.chunk.css → 760.863e11de.chunk.css} +2 -2
  42. package/build/static/css/{760.a8e3fc68.chunk.css.map → 760.863e11de.chunk.css.map} +1 -1
  43. package/build/static/css/{8593.658ad3d5.chunk.css → 8593.bed078bd.chunk.css} +2 -2
  44. package/build/static/css/{8593.658ad3d5.chunk.css.map → 8593.bed078bd.chunk.css.map} +1 -1
  45. package/build/static/css/9058.a1f9b3ed.chunk.css +2 -0
  46. package/build/static/css/{9058.486f686e.chunk.css.map → 9058.a1f9b3ed.chunk.css.map} +1 -1
  47. package/build/static/css/9556.61cab207.chunk.css +2 -0
  48. package/build/static/css/{9556.496aa3a6.chunk.css.map → 9556.61cab207.chunk.css.map} +1 -1
  49. package/build/static/css/9772.04013925.chunk.css +2 -0
  50. package/build/static/css/{9772.d4adf7cb.chunk.css.map → 9772.04013925.chunk.css.map} +1 -1
  51. package/build/static/js/{1248.6739ae1d.chunk.js → 1248.33275f61.chunk.js} +3 -3
  52. package/build/static/js/{1248.6739ae1d.chunk.js.map → 1248.33275f61.chunk.js.map} +1 -1
  53. package/build/static/js/{1381.8dd5be3b.chunk.js → 1381.91905292.chunk.js} +1 -1
  54. package/build/static/js/1742.a43e317e.chunk.js +2 -0
  55. package/build/static/js/{1742.3d09029f.chunk.js.map → 1742.a43e317e.chunk.js.map} +1 -1
  56. package/build/static/js/1996.12d812c5.chunk.js +2 -0
  57. package/build/static/js/{1996.04836f23.chunk.js.map → 1996.12d812c5.chunk.js.map} +1 -1
  58. package/build/static/js/{206.8f291917.chunk.js → 206.4adb580f.chunk.js} +2 -2
  59. package/build/static/js/{206.8f291917.chunk.js.map → 206.4adb580f.chunk.js.map} +1 -1
  60. package/build/static/js/{2084.01218e1e.chunk.js → 2084.a1088518.chunk.js} +2 -2
  61. package/build/static/js/2084.a1088518.chunk.js.map +1 -0
  62. package/build/static/js/254.93e212aa.chunk.js +2 -0
  63. package/build/static/js/{254.00158b98.chunk.js.map → 254.93e212aa.chunk.js.map} +1 -1
  64. package/build/static/js/{2716.04376fc5.chunk.js → 2716.a624ed7e.chunk.js} +3 -3
  65. package/build/static/js/{2716.04376fc5.chunk.js.map → 2716.a624ed7e.chunk.js.map} +1 -1
  66. package/build/static/js/{2723.81d995a8.chunk.js → 2723.3eb139a9.chunk.js} +1 -1
  67. package/build/static/js/3205.073e15ab.chunk.js +2 -0
  68. package/build/static/js/{3205.988269a2.chunk.js.map → 3205.073e15ab.chunk.js.map} +1 -1
  69. package/build/static/js/3322.768b02fa.chunk.js +3 -0
  70. package/build/static/js/3322.768b02fa.chunk.js.map +1 -0
  71. package/build/static/js/3771.21eb5199.chunk.js +2 -0
  72. package/build/static/js/{3771.18b43e3f.chunk.js.map → 3771.21eb5199.chunk.js.map} +1 -1
  73. package/build/static/js/{3790.8672b55c.chunk.js → 3790.f0201618.chunk.js} +2 -2
  74. package/build/static/js/{3790.8672b55c.chunk.js.map → 3790.f0201618.chunk.js.map} +1 -1
  75. package/build/static/js/{3856.36cb344b.chunk.js → 3856.9a64be47.chunk.js} +2 -2
  76. package/build/static/js/{3856.36cb344b.chunk.js.map → 3856.9a64be47.chunk.js.map} +1 -1
  77. package/build/static/js/4277.be2cab2a.chunk.js +2 -0
  78. package/build/static/js/{4277.64017b60.chunk.js.map → 4277.be2cab2a.chunk.js.map} +1 -1
  79. package/build/static/js/4474.4b053482.chunk.js +2 -0
  80. package/build/static/js/{4474.4b324d97.chunk.js.map → 4474.4b053482.chunk.js.map} +1 -1
  81. package/build/static/js/4654.ec3f1dc8.chunk.js +2 -0
  82. package/build/static/js/4654.ec3f1dc8.chunk.js.map +1 -0
  83. package/build/static/js/5195.6a57d492.chunk.js +2 -0
  84. package/build/static/js/{5195.0f7ead6c.chunk.js.map → 5195.6a57d492.chunk.js.map} +1 -1
  85. package/build/static/js/{5633.2a25cdd3.chunk.js → 5633.e6064a2d.chunk.js} +1 -1
  86. package/build/static/js/{6763.f1069eb6.chunk.js → 6763.9bdd9329.chunk.js} +2 -2
  87. package/build/static/js/{6763.f1069eb6.chunk.js.map → 6763.9bdd9329.chunk.js.map} +1 -1
  88. package/build/static/js/{6980.57c32df9.chunk.js → 6980.498aea29.chunk.js} +2 -2
  89. package/build/static/js/6980.498aea29.chunk.js.map +1 -0
  90. package/build/static/js/{7227.2d618808.chunk.js → 7227.52a8458c.chunk.js} +3 -3
  91. package/build/static/js/{7227.2d618808.chunk.js.map → 7227.52a8458c.chunk.js.map} +1 -1
  92. package/build/static/js/{760.abaab914.chunk.js → 760.cb6371b5.chunk.js} +2 -2
  93. package/build/static/js/{760.abaab914.chunk.js.map → 760.cb6371b5.chunk.js.map} +1 -1
  94. package/build/static/js/8593.6fc1e2d5.chunk.js +2 -0
  95. package/build/static/js/{8593.241f7200.chunk.js.map → 8593.6fc1e2d5.chunk.js.map} +1 -1
  96. package/build/static/js/9058.2cd4c149.chunk.js +2 -0
  97. package/build/static/js/{9058.4edde9f4.chunk.js.map → 9058.2cd4c149.chunk.js.map} +1 -1
  98. package/build/static/js/9556.81fe2bc0.chunk.js +3 -0
  99. package/build/static/js/{9556.bed0e867.chunk.js.map → 9556.81fe2bc0.chunk.js.map} +1 -1
  100. package/build/static/js/{9772.a7b16199.chunk.js → 9772.fcae000f.chunk.js} +2 -2
  101. package/build/static/js/9772.fcae000f.chunk.js.map +1 -0
  102. package/build/static/js/main.8f43556b.js +2 -0
  103. package/build/static/js/{main.a14af7bb.js.map → main.8f43556b.js.map} +1 -1
  104. package/package.json +2 -2
  105. package/build/static/css/1248.9cbcf853.chunk.css +0 -2
  106. package/build/static/css/1381.c09f0d50.chunk.css +0 -2
  107. package/build/static/css/1381.c09f0d50.chunk.css.map +0 -1
  108. package/build/static/css/1742.cd416dd0.chunk.css +0 -2
  109. package/build/static/css/206.8338cc31.chunk.css +0 -2
  110. package/build/static/css/2307.59328d7e.chunk.css +0 -2
  111. package/build/static/css/254.f85e422b.chunk.css +0 -2
  112. package/build/static/css/2716.ce9984fa.chunk.css +0 -2
  113. package/build/static/css/2765.ce93154a.chunk.css.map +0 -1
  114. package/build/static/css/3205.f5df444d.chunk.css +0 -2
  115. package/build/static/css/5195.1a7764c9.chunk.css +0 -2
  116. package/build/static/css/5633.c09f0d50.chunk.css +0 -2
  117. package/build/static/css/5633.c09f0d50.chunk.css.map +0 -1
  118. package/build/static/css/6980.c90479d9.chunk.css +0 -12
  119. package/build/static/css/7227.1d04c161.chunk.css +0 -2
  120. package/build/static/css/9058.486f686e.chunk.css +0 -2
  121. package/build/static/css/9556.496aa3a6.chunk.css +0 -2
  122. package/build/static/css/9772.d4adf7cb.chunk.css +0 -2
  123. package/build/static/js/1742.3d09029f.chunk.js +0 -2
  124. package/build/static/js/1996.04836f23.chunk.js +0 -2
  125. package/build/static/js/2084.01218e1e.chunk.js.map +0 -1
  126. package/build/static/js/254.00158b98.chunk.js +0 -2
  127. package/build/static/js/3205.988269a2.chunk.js +0 -2
  128. package/build/static/js/3322.ebf065a0.chunk.js +0 -3
  129. package/build/static/js/3322.ebf065a0.chunk.js.map +0 -1
  130. package/build/static/js/3771.18b43e3f.chunk.js +0 -2
  131. package/build/static/js/4277.64017b60.chunk.js +0 -2
  132. package/build/static/js/4474.4b324d97.chunk.js +0 -2
  133. package/build/static/js/4654.139c6325.chunk.js +0 -2
  134. package/build/static/js/4654.139c6325.chunk.js.map +0 -1
  135. package/build/static/js/5195.0f7ead6c.chunk.js +0 -2
  136. package/build/static/js/6980.57c32df9.chunk.js.map +0 -1
  137. package/build/static/js/8593.241f7200.chunk.js +0 -2
  138. package/build/static/js/9058.4edde9f4.chunk.js +0 -2
  139. package/build/static/js/9556.bed0e867.chunk.js +0 -3
  140. package/build/static/js/9772.a7b16199.chunk.js.map +0 -1
  141. package/build/static/js/main.a14af7bb.js +0 -2
  142. /package/build/static/js/{1248.6739ae1d.chunk.js.LICENSE.txt → 1248.33275f61.chunk.js.LICENSE.txt} +0 -0
  143. /package/build/static/js/{2716.04376fc5.chunk.js.LICENSE.txt → 2716.a624ed7e.chunk.js.LICENSE.txt} +0 -0
  144. /package/build/static/js/{3322.ebf065a0.chunk.js.LICENSE.txt → 3322.768b02fa.chunk.js.LICENSE.txt} +0 -0
  145. /package/build/static/js/{7227.2d618808.chunk.js.LICENSE.txt → 7227.52a8458c.chunk.js.LICENSE.txt} +0 -0
  146. /package/build/static/js/{9556.bed0e867.chunk.js.LICENSE.txt → 9556.81fe2bc0.chunk.js.LICENSE.txt} +0 -0
@@ -1,3 +0,0 @@
1
- /*! For license information please see 3322.ebf065a0.chunk.js.LICENSE.txt */
2
- "use strict";(self.webpackChunk_kne_components_components_core=self.webpackChunk_kne_components_components_core||[]).push([[3322],{8195:(t,e,i)=>{function s(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}i.d(e,{A:()=>s})},23322:(t,e,i)=>{i.r(e),i.d(e,{Document:()=>Dg,Outline:()=>Ug,Page:()=>cf,PasswordResponses:()=>gg,Thumbnail:()=>uf,pdfjs:()=>s,useDocumentContext:()=>Wg,useOutlineContext:()=>Bg,usePageContext:()=>ef});var s={};i.r(s),i.d(s,{AbortException:()=>aA,AnnotationEditorLayer:()=>rA,AnnotationEditorParamsType:()=>oA,AnnotationEditorType:()=>lA,AnnotationEditorUIManager:()=>hA,AnnotationLayer:()=>cA,AnnotationMode:()=>dA,CMapCompressionType:()=>uA,ColorPicker:()=>pA,DOMSVGFactory:()=>AA,DrawLayer:()=>gA,FeatureTest:()=>fA,GlobalWorkerOptions:()=>mA,ImageKind:()=>vA,InvalidPDFException:()=>bA,MissingPDFException:()=>wA,OPS:()=>yA,Outliner:()=>_A,PDFDataRangeTransport:()=>xA,PDFDateString:()=>EA,PDFWorker:()=>kA,PasswordResponses:()=>SA,PermissionFlag:()=>MA,PixelsPerInch:()=>CA,RenderingCancelledException:()=>RA,TextLayer:()=>TA,UnexpectedResponseException:()=>PA,Util:()=>LA,VerbosityLevel:()=>IA,XfaLayer:()=>DA,build:()=>FA,createValidAbsoluteUrl:()=>OA,fetchData:()=>NA,getDocument:()=>WA,getFilenameFromUrl:()=>BA,getPdfFilenameFromUrl:()=>jA,getXfaPageViewport:()=>HA,isDataScheme:()=>zA,isPdfFile:()=>VA,noContextMenu:()=>UA,normalizeUnicode:()=>GA,renderTextLayer:()=>qA,setLayerDimensions:()=>XA,shadow:()=>KA,updateTextLayer:()=>YA,version:()=>QA});var n=i(89379);function a(t,e,i){e||(e=[]);var s=e.length++;return Object.defineProperty({},"_",{set:function(n){e[s]=n,t.apply(i,e)}})}var r=i(53986),o=i(39790),l=i(26562);function h(t,e,i){return i((0,l.A)(t,e))}var c=i(64467),d=i(55149),u=i(38458),p=i(24558);const A=["textContentSource","container","viewport"];var g,f,m,v,b,w,y,_,x,E,k,S,M={d:(t,e)=>{for(var i in e)M.o(e,i)&&!M.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},C=globalThis.pdfjsLib={};M.d(C,{AbortException:()=>jt,AnnotationEditorLayer:()=>Vp,AnnotationEditorParamsType:()=>z,AnnotationEditorType:()=>H,AnnotationEditorUIManager:()=>Ls,AnnotationLayer:()=>ec,AnnotationMode:()=>j,CMapCompressionType:()=>yt,ColorPicker:()=>Rd,DOMSVGFactory:()=>Ne,DrawLayer:()=>eA,FeatureTest:()=>Ut,GlobalWorkerOptions:()=>Ga,ImageKind:()=>Q,InvalidPDFException:()=>Ot,MissingPDFException:()=>Nt,OPS:()=>_t,Outliner:()=>Tc,PDFDataRangeTransport:()=>zo,PDFDateString:()=>Ye,PDFWorker:()=>el,PasswordResponses:()=>xt,PermissionFlag:()=>V,PixelsPerInch:()=>ge,RenderingCancelledException:()=>Be,TextLayer:()=>bo,UnexpectedResponseException:()=>Wt,Util:()=>qt,VerbosityLevel:()=>wt,XfaLayer:()=>Cl,build:()=>El,createValidAbsoluteUrl:()=>Pt,fetchData:()=>De,getDocument:()=>Wo,getFilenameFromUrl:()=>ze,getPdfFilenameFromUrl:()=>Ve,getXfaPageViewport:()=>Qe,isDataScheme:()=>je,isPdfFile:()=>He,noContextMenu:()=>qe,normalizeUnicode:()=>Jt,renderTextLayer:()=>To,setLayerDimensions:()=>ti,shadow:()=>Lt,updateTextLayer:()=>Po,version:()=>xl});const R="object"===typeof process&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),T=[1,0,0,1,0,0],P=[.001,0,0,.001,0,0],L=1.35,I=1,D=2,F=4,O=16,N=32,W=64,B=256,j={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},H={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},z={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},V={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},U=0,G=1,q=2,X=3,K=3,Y=4,Q={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},J=1,Z=2,$=3,tt=4,et=5,it=6,st=7,nt=8,at=9,rt=10,ot=11,lt=12,ht=13,ct=14,dt=15,ut=16,pt=17,At=20,gt=1,ft=2,mt=3,vt=4,bt=5,wt={ERRORS:0,WARNINGS:1,INFOS:5},yt={NONE:0,BINARY:1},_t={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},xt={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Et=wt.WARNINGS;function kt(t){Number.isInteger(t)&&(Et=t)}function St(){return Et}function Mt(t){Et>=wt.INFOS&&console.log("Info: ".concat(t))}function Ct(t){Et>=wt.WARNINGS&&console.log("Warning: ".concat(t))}function Rt(t){throw new Error(t)}function Tt(t,e){t||Rt(e)}function Pt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(i&&"string"===typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);(null===e||void 0===e?void 0:e.length)>=2&&(t="http://".concat(t))}if(i.tryConvertEncoding)try{t=decodeURIComponent(escape(t))}catch(s){}}const n=e?new URL(t,e):new URL(t);if(function(t){switch(null===t||void 0===t?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch(n){}return null}function Lt(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(t,e,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}const It=function(){function t(e,i){this.constructor===t&&Rt("Cannot initialize BaseException."),this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();class Dt extends It{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Ft extends It{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class Ot extends It{constructor(t){super(t,"InvalidPDFException")}}class Nt extends It{constructor(t){super(t,"MissingPDFException")}}class Wt extends It{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class Bt extends It{constructor(t){super(t,"FormatError")}}class jt extends It{constructor(t){super(t,"AbortException")}}function Ht(t){"object"===typeof t&&void 0!==(null===t||void 0===t?void 0:t.length)||Rt("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const s=[];for(let n=0;n<e;n+=i){const a=Math.min(n+i,e),r=t.subarray(n,a);s.push(String.fromCharCode.apply(null,r))}return s.join("")}function zt(t){"string"!==typeof t&&Rt("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let s=0;s<e;++s)i[s]=255&t.charCodeAt(s);return i}function Vt(t){const e=Object.create(null);for(const[i,s]of t)e[i]=s;return e}class Ut{static get isLittleEndian(){return Lt(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return Lt(this,"isEvalSupported",function(){try{return new Function(""),!0}catch(t){return!1}}())}static get isOffscreenCanvasSupported(){return Lt(this,"isOffscreenCanvasSupported","undefined"!==typeof OffscreenCanvas)}static get platform(){var t;return"undefined"!==typeof navigator&&"string"===typeof(null===(t=navigator)||void 0===t?void 0:t.platform)?Lt(this,"platform",{isMac:navigator.platform.includes("Mac")}):Lt(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){var t,e;return Lt(this,"isCSSRoundSupported",null===(t=globalThis.CSS)||void 0===t||null===(e=t.supports)||void 0===e?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const Gt=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class qt{static makeHexColor(t,e,i){return"#".concat(Gt[t]).concat(Gt[e]).concat(Gt[i])}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){const i=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(t,e){const i=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],s[0],n[0],a[0]),Math.min(i[1],s[1],n[1],a[1]),Math.max(i[0],s[0],n[0],a[0]),Math.max(i[1],s[1],n[1],a[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],s=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],r=(i+a)/2,o=Math.sqrt((i+a)**2-4*(i*a-n*s))/2,l=r+o||1,h=r-o||1;return[Math.sqrt(l),Math.sqrt(h)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)return null;const n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>a?null:[i,n,s,a]}static bezierBoundingBox(t,e,i,s,n,a,r,o,h){return h?(h[0]=Math.min(h[0],t,r),h[1]=Math.min(h[1],e,o),h[2]=Math.max(h[2],t,r),h[3]=Math.max(h[3],e,o)):h=[Math.min(t,r),Math.min(e,o),Math.max(t,r),Math.max(e,o)],(0,l.A)(qt,this,Kt).call(this,t,i,n,r,e,s,a,o,3*(3*(i-n)-t+r),6*(t-2*i+n),3*(i-t),h),(0,l.A)(qt,this,Kt).call(this,t,i,n,r,e,s,a,o,3*(3*(s-a)-e+o),6*(e-2*s+a),3*(s-e),h),h}}function Xt(t,e,i,s,n,a,r,o,l,h){if(l<=0||l>=1)return;const c=1-l,d=l*l,u=d*l,p=c*(c*(c*t+3*l*e)+3*d*i)+u*s,A=c*(c*(c*n+3*l*a)+3*d*r)+u*o;h[0]=Math.min(h[0],p),h[1]=Math.min(h[1],A),h[2]=Math.max(h[2],p),h[3]=Math.max(h[3],A)}function Kt(t,e,i,s,n,a,r,o,h,c,d,u){if(Math.abs(h)<1e-12)return void(Math.abs(c)>=1e-12&&(0,l.A)(g,this,Xt).call(this,t,e,i,s,n,a,r,o,-d/c,u));const p=c**2-4*d*h;if(p<0)return;const A=Math.sqrt(p),f=2*h;(0,l.A)(g,this,Xt).call(this,t,e,i,s,n,a,r,o,(-c+A)/f,u),(0,l.A)(g,this,Xt).call(this,t,e,i,s,n,a,r,o,(-c-A)/f,u)}g=qt;let Yt=null,Qt=null;function Jt(t){return Yt||(Yt=/([\xA0\xB5\u037E\u0EB3\u2000-\u200A\u202F\u2126\uFB00-\uFB04\uFB06\uFB20-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBA1\uFBA4-\uFBA9\uFBAE-\uFBB1\uFBD3-\uFBDC\uFBDE-\uFBE7\uFBEA-\uFBF8\uFBFC\uFBFD\uFC00-\uFC5D\uFC64-\uFCF1\uFCF5-\uFD3D\uFD88\uFDF4\uFDFA\uFDFB\uFE71\uFE77\uFE79\uFE7B\uFE7D]+)|(\uFB05+)/g,Qt=new Map([["\ufb05","\u017ft"]])),t.replaceAll(Yt,(t,e,i)=>e?e.normalize("NFKC"):Qt.get(i))}const Zt="pdfjs_internal_id_",$t=0,te=1,ee=2,ie=3,se=4,ne=5,ae=6,re=7,oe=8;class le{constructor(){this.constructor===le&&Rt("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,s,n){return"none"}destroy(){}}var he=new WeakMap;class ce{constructor(){let{enableHWA:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,d.A)(this,he,!1),this.constructor===ce&&Rt("Cannot initialize BaseCanvasFactory."),(0,p.A)(he,this,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!(0,u.A)(he,this)})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){Rt("Abstract method `_createCanvas` called.")}}class de{constructor(t){let{baseUrl:e=null,isCompressed:i=!0}=t;this.constructor===de&&Rt("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=i}async fetch(t){let{name:e}=t;if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":""),s=this.isCompressed?yt.BINARY:yt.NONE;return this._fetchData(i,s).catch(t=>{throw new Error("Unable to load ".concat(this.isCompressed?"binary ":"","CMap at: ").concat(i))})}_fetchData(t,e){Rt("Abstract method `_fetchData` called.")}}class ue{constructor(t){let{baseUrl:e=null}=t;this.constructor===ue&&Rt("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const i="".concat(this.baseUrl).concat(e);return this._fetchData(i).catch(t=>{throw new Error("Unable to load font data at: ".concat(i))})}_fetchData(t){Rt("Abstract method `_fetchData` called.")}}class pe{constructor(){this.constructor===pe&&Rt("Cannot initialize BaseSVGFactory.")}create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width","".concat(t,"px")),s.setAttribute("height","".concat(e,"px"))),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),s}createElement(t){if("string"!==typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){Rt("Abstract method `_createSVG` called.")}}const Ae="http://www.w3.org/2000/svg";class ge{}f=ge,(0,c.A)(ge,"CSS",96),(0,c.A)(ge,"PDF",72),(0,c.A)(ge,"PDF_TO_CSS_UNITS",f.CSS/f.PDF);var fe=new WeakMap,me=new WeakMap,ve=new WeakMap,be=new WeakMap,we=new WeakMap,ye=new WeakMap,_e=new WeakSet;function xe(t){return(0,u.A)(fe,t)||(0,p.A)(fe,t,new Map)}function Ee(t){return(0,u.A)(we,t)||(0,p.A)(we,t,new Map)}function ke(t){if(!(0,u.A)(me,t)){const e=(0,u.A)(be,t).createElement("div"),{style:i}=e;i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;const s=(0,u.A)(be,t).createElementNS(Ae,"svg");s.setAttribute("width",0),s.setAttribute("height",0),(0,p.A)(me,t,(0,u.A)(be,t).createElementNS(Ae,"defs")),e.append(s),s.append((0,u.A)(me,t)),(0,u.A)(be,t).body.append(e)}return(0,u.A)(me,t)}function Se(t){if(1===t.length){const e=t[0],i=new Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;const s=i.join(",");return[s,s,s]}const[e,i,s]=t,n=new Array(256),a=new Array(256),r=new Array(256);for(let o=0;o<256;o++)n[o]=e[o]/255,a[o]=i[o]/255,r[o]=s[o]/255;return[n.join(","),a.join(","),r.join(",")]}function Me(t){const e=(0,u.A)(be,this).createElementNS(Ae,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}function Ce(t){const e=(0,u.A)(be,this).createElementNS(Ae,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}function Re(t){const e=(0,u.A)(be,this).createElementNS(Ae,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),h(_e,this,ke).append(e),e}function Te(t,e,i){const s=(0,u.A)(be,this).createElementNS(Ae,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),t.append(s)}function Pe(t,e,i,s){const n=(0,u.A)(be,this).createElementNS(Ae,"feComponentTransfer");s.append(n),(0,l.A)(_e,this,Te).call(this,n,"feFuncR",t),(0,l.A)(_e,this,Te).call(this,n,"feFuncG",e),(0,l.A)(_e,this,Te).call(this,n,"feFuncB",i)}function Le(t,e){const i=(0,u.A)(be,this).createElementNS(Ae,"feComponentTransfer");e.append(i),(0,l.A)(_e,this,Te).call(this,i,"feFuncA",t)}function Ie(t){return h(_e,this,ke).style.color=t,Je(getComputedStyle(h(_e,this,ke)).getPropertyValue("color"))}async function De(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(Ge(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,s)=>{const n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType=e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE)if(200!==n.status&&0!==n.status)s(new Error(n.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void i(n.response)}i(n.responseText)}},n.send(null)})}class Fe extends de{_fetchData(t,e){return De(t,this.isCompressed?"arraybuffer":"text").then(t=>({cMapData:t instanceof ArrayBuffer?new Uint8Array(t):zt(t),compressionType:e}))}}class Oe extends ue{_fetchData(t){return De(t,"arraybuffer").then(t=>new Uint8Array(t))}}class Ne extends pe{_createSVG(t){return document.createElementNS(Ae,t)}}class We{constructor(t){let{viewBox:e,scale:i,rotation:s,offsetX:n=0,offsetY:a=0,dontFlip:r=!1}=t;this.viewBox=e,this.scale=i,this.rotation=s,this.offsetX=n,this.offsetY=a;const o=(e[2]+e[0])/2,l=(e[3]+e[1])/2;let h,c,d,u,p,A,g,f;switch(s%=360,s<0&&(s+=360),s){case 180:h=-1,c=0,d=0,u=1;break;case 90:h=0,c=1,d=1,u=0;break;case 270:h=0,c=-1,d=-1,u=0;break;case 0:h=1,c=0,d=0,u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(d=-d,u=-u),0===h?(p=Math.abs(l-e[1])*i+n,A=Math.abs(o-e[0])*i+a,g=(e[3]-e[1])*i,f=(e[2]-e[0])*i):(p=Math.abs(o-e[0])*i+n,A=Math.abs(l-e[1])*i+a,g=(e[2]-e[0])*i,f=(e[3]-e[1])*i),this.transform=[h*i,c*i,d*i,u*i,p-h*i*o-d*i*l,A-c*i*o-u*i*l],this.width=g,this.height=f}get rawDims(){const{viewBox:t}=this;return Lt(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new We({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}convertToViewportPoint(t,e){return qt.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=qt.applyTransform([t[0],t[1]],this.transform),i=qt.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return qt.applyInverseTransform([t,e],this.transform)}}class Be extends It{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t,"RenderingCancelledException"),this.extraDelay=e}}function je(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function He(t){return"string"===typeof t&&/\.pdf$/i.test(t)}function ze(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function Ve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!==typeof t)return e;if(je(t))return Ct('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t);let n=i.exec(s[1])||i.exec(s[2])||i.exec(s[3]);if(n&&(n=n[0],n.includes("%")))try{n=i.exec(decodeURIComponent(n))[0]}catch(a){}return n||e}class Ue{constructor(){(0,c.A)(this,"started",Object.create(null)),(0,c.A)(this,"times",[])}time(t){t in this.started&&Ct("Timer is already running for ".concat(t)),this.started[t]=Date.now()}timeEnd(t){t in this.started||Ct("Timer has not been started for ".concat(t)),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:i}of this.times)e=Math.max(i.length,e);for(const{name:i,start:s,end:n}of this.times)t.push("".concat(i.padEnd(e)," ").concat(n-s,"ms\n"));return t.join("")}}function Ge(t,e){try{const{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch(i){return!1}}function qe(t){t.preventDefault()}function Xe(t){console.log("Deprecated API usage: "+t)}let Ke;class Ye{static toDateObject(t){if(!t||"string"!==typeof t)return null;Ke||(Ke=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=Ke.exec(t);if(!e)return null;const i=parseInt(e[1],10);let s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let r=parseInt(e[5],10);r=r>=0&&r<=59?r:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;const l=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let c=parseInt(e[9],10)||0;return c=c>=0&&c<=59?c:0,"-"===l?(a+=h,r+=c):"+"===l&&(a-=h,r-=c),new Date(Date.UTC(i,s,n,a,r,o))}}function Qe(t,e){let{scale:i=1,rotation:s=0}=e;const{width:n,height:a}=t.attributes.style,r=[0,0,parseInt(n),parseInt(a)];return new We({viewBox:r,scale:i,rotation:s})}function Je(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(Ct('Not a valid color format: "'.concat(t,'"')),[0,0,0])}function Ze(t){const{a:e,b:i,c:s,d:n,e:a,f:r}=t.getTransform();return[e,i,s,n,a,r]}function $e(t){const{a:e,b:i,c:s,d:n,e:a,f:r}=t.getTransform().invertSelf();return[e,i,s,n,a,r]}function ti(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e instanceof We){const{pageWidth:s,pageHeight:n}=e.rawDims,{style:a}=t,r=Ut.isCSSRoundSupported,o="var(--scale-factor) * ".concat(s,"px"),l="var(--scale-factor) * ".concat(n,"px"),h=r?"round(".concat(o,", 1px)"):"calc(".concat(o,")"),c=r?"round(".concat(l,", 1px)"):"calc(".concat(l,")");i&&e.rotation%180!==0?(a.width=c,a.height=h):(a.width=h,a.height=c)}s&&t.setAttribute("data-main-rotation",e.rotation)}var ei=new WeakMap,ii=new WeakMap,si=new WeakMap,ni=new WeakMap,ai=new WeakSet;class ri{constructor(t){(0,o.A)(this,ai),(0,d.A)(this,ei,null),(0,d.A)(this,ii,null),(0,d.A)(this,si,void 0),(0,d.A)(this,ni,null),(0,p.A)(si,this,t)}render(){const t=(0,p.A)(ei,this,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");const e=(0,u.A)(si,this)._uiManager._signal;t.addEventListener("contextmenu",qe,{signal:e}),t.addEventListener("pointerdown",oi,{signal:e});const i=(0,p.A)(ni,this,document.createElement("div"));i.className="buttons",t.append(i);const s=(0,u.A)(si,this).toolbarPosition;if(s){const{style:e}=t,i="ltr"===(0,u.A)(si,this)._uiManager.direction?1-s[0]:s[0];e.insetInlineEnd="".concat(100*i,"%"),e.top="calc(".concat(100*s[1],"% + var(--editor-toolbar-vert-offset))")}return(0,l.A)(ai,this,di).call(this),t}hide(){var t;(0,u.A)(ei,this).classList.add("hidden"),null===(t=(0,u.A)(ii,this))||void 0===t||t.hideDropdown()}show(){(0,u.A)(ei,this).classList.remove("hidden")}addAltTextButton(t){(0,l.A)(ai,this,ci).call(this,t),(0,u.A)(ni,this).prepend(t,h(ai,this,ui))}addColorPicker(t){(0,p.A)(ii,this,t);const e=t.renderButton();(0,l.A)(ai,this,ci).call(this,e),(0,u.A)(ni,this).prepend(e,h(ai,this,ui))}remove(){var t;(0,u.A)(ei,this).remove(),null===(t=(0,u.A)(ii,this))||void 0===t||t.destroy(),(0,p.A)(ii,this,null)}}function oi(t){t.stopPropagation()}function li(t){(0,u.A)(si,this)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}function hi(t){(0,u.A)(si,this)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}function ci(t){const e=(0,u.A)(si,this)._uiManager._signal;t.addEventListener("focusin",(0,l.A)(ai,this,li).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",(0,l.A)(ai,this,hi).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",qe,{signal:e})}function di(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-editor-remove-".concat((0,u.A)(si,this).editorType,"-button")),(0,l.A)(ai,this,ci).call(this,t),t.addEventListener("click",t=>{(0,u.A)(si,this)._uiManager.delete()},{signal:(0,u.A)(si,this)._uiManager._signal}),(0,u.A)(ni,this).append(t)}function ui(t){const e=document.createElement("div");return e.className="divider",e}var pi=new WeakMap,Ai=new WeakMap,gi=new WeakMap,fi=new WeakSet;class mi{constructor(t){(0,o.A)(this,fi),(0,d.A)(this,pi,null),(0,d.A)(this,Ai,null),(0,d.A)(this,gi,void 0),(0,p.A)(gi,this,t)}show(t,e,i){const[s,n]=(0,l.A)(fi,this,bi).call(this,e,i),{style:a}=(0,u.A)(Ai,this)||(0,p.A)(Ai,this,(0,l.A)(fi,this,vi).call(this));t.append((0,u.A)(Ai,this)),a.insetInlineEnd="".concat(100*s,"%"),a.top="calc(".concat(100*n,"% + var(--editor-toolbar-vert-offset))")}hide(){(0,u.A)(Ai,this).remove()}}function vi(){const t=(0,p.A)(Ai,this,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",qe,{signal:(0,u.A)(gi,this)._signal});const e=(0,p.A)(pi,this,document.createElement("div"));return e.className="buttons",t.append(e),(0,l.A)(fi,this,wi).call(this),t}function bi(t,e){let i=0,s=0;for(const n of t){const t=n.y+n.height;if(t<i)continue;const a=n.x+(e?n.width:0);t>i?(s=a,i=t):e?a>s&&(s=a):a<s&&(s=a)}return[e?1-s:s,i]}function wi(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=(0,u.A)(gi,this)._signal;t.addEventListener("contextmenu",qe,{signal:i}),t.addEventListener("click",()=>{(0,u.A)(gi,this).highlightSelection("floating_button")},{signal:i}),(0,u.A)(pi,this).append(t)}function yi(t,e,i){for(const s of i)e.addEventListener(s,t[s].bind(t))}var _i=new WeakMap;class xi{constructor(){(0,d.A)(this,_i,0)}get id(){var t,e;return"".concat("pdfjs_internal_editor_").concat(((0,p.A)(_i,this,(t=(0,u.A)(_i,this),e=t++,t)),e))}}var Ei=new WeakMap,ki=new WeakMap,Si=new WeakMap,Mi=new WeakSet;class Ci{constructor(){(0,o.A)(this,Mi),(0,d.A)(this,Ei,function(){var t,e;if("undefined"!==typeof crypto&&"function"===typeof(null===(t=crypto)||void 0===t?void 0:t.randomUUID))return crypto.randomUUID();const i=new Uint8Array(32);if("undefined"!==typeof crypto&&"function"===typeof(null===(e=crypto)||void 0===e?void 0:e.getRandomValues))crypto.getRandomValues(i);else for(let s=0;s<32;s++)i[s]=Math.floor(255*Math.random());return Ht(i)}()),(0,d.A)(this,ki,0),(0,d.A)(this,Si,null)}static get _isSVGFittingCanvas(){const t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';return Lt(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async getFromFile(t){const{lastModified:e,name:i,size:s,type:n}=t;return(0,l.A)(Mi,this,Ri).call(this,"".concat(e,"_").concat(i,"_").concat(s,"_").concat(n),t)}async getFromUrl(t){return(0,l.A)(Mi,this,Ri).call(this,t,t)}async getFromId(t){(0,u.A)(Si,this)||(0,p.A)(Si,this,new Map);const e=(0,u.A)(Si,this).get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){const e=(0,u.A)(Si,this).get(t);return null!==e&&void 0!==e&&e.isSvg?e.svgUrl:null}deleteId(t){(0,u.A)(Si,this)||(0,p.A)(Si,this,new Map);const e=(0,u.A)(Si,this).get(t);e&&(e.refCounter-=1,0===e.refCounter&&(e.bitmap=null))}isValidId(t){return t.startsWith("image_".concat((0,u.A)(Ei,this),"_"))}}async function Ri(t,e){var i;(0,u.A)(Si,this)||(0,p.A)(Si,this,new Map);let s=(0,u.A)(Si,this).get(t);if(null===s)return null;if(null!==(i=s)&&void 0!==i&&i.bitmap)return s.refCounter+=1,s;try{var n,a;let t;if(s||(s={bitmap:null,id:"image_".concat((0,u.A)(Ei,this),"_").concat(((0,p.A)(ki,this,(n=(0,u.A)(ki,this),a=n++,n)),a)),refCounter:0,isSvg:!1}),"string"===typeof e?(s.url=e,t=await De(e,"blob")):t=s.file=e,"image/svg+xml"===t.type){const e=m._isSVGFittingCanvas,i=new FileReader,n=new Image,a=new Promise((t,a)=>{n.onload=()=>{s.bitmap=n,s.isSvg=!0,t()},i.onload=async()=>{const t=s.svgUrl=i.result;n.src=await e?"".concat(t,"#svgView(preserveAspectRatio(none))"):t},n.onerror=i.onerror=a});i.readAsDataURL(t),await a}else s.bitmap=await createImageBitmap(t);s.refCounter=1}catch(r){console.error(r),s=null}return(0,u.A)(Si,this).set(t,s),s&&(0,u.A)(Si,this).set(s.id,s),s}m=Ci;var Ti=new WeakMap,Pi=new WeakMap,Li=new WeakMap,Ii=new WeakMap;class Di{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;(0,d.A)(this,Ti,[]),(0,d.A)(this,Pi,!1),(0,d.A)(this,Li,void 0),(0,d.A)(this,Ii,-1),(0,p.A)(Li,this,t)}add(t){let{cmd:e,undo:i,post:s,mustExec:n,type:a=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}=t;if(n&&e(),(0,u.A)(Pi,this))return;const l={cmd:e,undo:i,post:s,type:a};if(-1===(0,u.A)(Ii,this))return(0,u.A)(Ti,this).length>0&&((0,u.A)(Ti,this).length=0),(0,p.A)(Ii,this,0),void(0,u.A)(Ti,this).push(l);if(r&&(0,u.A)(Ti,this)[(0,u.A)(Ii,this)].type===a)return o&&(l.undo=(0,u.A)(Ti,this)[(0,u.A)(Ii,this)].undo),void((0,u.A)(Ti,this)[(0,u.A)(Ii,this)]=l);const h=(0,u.A)(Ii,this)+1;h===(0,u.A)(Li,this)?(0,u.A)(Ti,this).splice(0,1):((0,p.A)(Ii,this,h),h<(0,u.A)(Ti,this).length&&(0,u.A)(Ti,this).splice(h)),(0,u.A)(Ti,this).push(l)}undo(){if(-1===(0,u.A)(Ii,this))return;(0,p.A)(Pi,this,!0);const{undo:t,post:e}=(0,u.A)(Ti,this)[(0,u.A)(Ii,this)];t(),null===e||void 0===e||e(),(0,p.A)(Pi,this,!1),(0,p.A)(Ii,this,(0,u.A)(Ii,this)-1)}redo(){if((0,u.A)(Ii,this)<(0,u.A)(Ti,this).length-1){(0,p.A)(Ii,this,(0,u.A)(Ii,this)+1),(0,p.A)(Pi,this,!0);const{cmd:t,post:e}=(0,u.A)(Ti,this)[(0,u.A)(Ii,this)];t(),null===e||void 0===e||e(),(0,p.A)(Pi,this,!1)}}hasSomethingToUndo(){return-1!==(0,u.A)(Ii,this)}hasSomethingToRedo(){return(0,u.A)(Ii,this)<(0,u.A)(Ti,this).length-1}destroy(){(0,p.A)(Ti,this,null)}}var Fi=new WeakSet;class Oi{constructor(t){(0,o.A)(this,Fi),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=Ut.platform;for(const[i,s,n={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:s,options:n}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:s,options:n}),this.allKeys.add(t.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get((0,l.A)(Fi,this,Ni).call(this,e));if(!i)return;const{callback:s,options:{bubbles:n=!1,args:a=[],checker:r=null}}=i;r&&!r(t,e)||(s.bind(t,...a,e)(),n||(e.stopPropagation(),e.preventDefault()))}}function Ni(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e}class Wi{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function(t){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const i of t.keys()){e.style.color=i;const s=window.getComputedStyle(e).color;t.set(i,Je(s))}e.remove()}(t),Lt(this,"_colors",t)}convert(t){const e=Je(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,s]of this._colors)if(s.every((t,i)=>t===e[i]))return Wi._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?qt.makeHexColor(...e):t}}(0,c.A)(Wi,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var Bi=new WeakMap,ji=new WeakMap,Hi=new WeakMap,zi=new WeakMap,Vi=new WeakMap,Ui=new WeakMap,Gi=new WeakMap,qi=new WeakMap,Xi=new WeakMap,Ki=new WeakMap,Yi=new WeakMap,Qi=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,$i=new WeakMap,ts=new WeakMap,es=new WeakMap,is=new WeakMap,ss=new WeakMap,ns=new WeakMap,as=new WeakMap,rs=new WeakMap,os=new WeakMap,ls=new WeakMap,hs=new WeakMap,cs=new WeakMap,ds=new WeakMap,us=new WeakMap,ps=new WeakMap,As=new WeakMap,gs=new WeakMap,fs=new WeakMap,ms=new WeakMap,vs=new WeakMap,bs=new WeakMap,ws=new WeakMap,ys=new WeakMap,_s=new WeakMap,xs=new WeakMap,Es=new WeakMap,ks=new WeakMap,Ss=new WeakMap,Ms=new WeakMap,Cs=new WeakMap,Rs=new WeakMap,Ts=new WeakMap,Ps=new WeakSet;class Ls{static get _keyboardManager(){const t=Ls.prototype,e=t=>(0,u.A)(Rs,t).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,e)=>{let{target:i}=e;if(i instanceof HTMLInputElement){const{type:t}=i;return"text"!==t&&"number"!==t}return!0},s=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return Lt(this,"_keyboardManager",new Oi([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&(0,u.A)(Rs,t).contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&(0,u.A)(Rs,t).contains(document.activeElement)}}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}constructor(t,e,i,s,n,a,r,h,c){(0,o.A)(this,Ps),(0,d.A)(this,Bi,new AbortController),(0,d.A)(this,ji,null),(0,d.A)(this,Hi,new Map),(0,d.A)(this,zi,new Map),(0,d.A)(this,Vi,null),(0,d.A)(this,Ui,null),(0,d.A)(this,Gi,null),(0,d.A)(this,qi,new Di),(0,d.A)(this,Xi,0),(0,d.A)(this,Ki,new Set),(0,d.A)(this,Yi,null),(0,d.A)(this,Qi,null),(0,d.A)(this,Ji,new Set),(0,d.A)(this,Zi,!1),(0,d.A)(this,$i,null),(0,d.A)(this,ts,null),(0,d.A)(this,es,null),(0,d.A)(this,is,!1),(0,d.A)(this,ss,null),(0,d.A)(this,ns,new xi),(0,d.A)(this,as,!1),(0,d.A)(this,rs,!1),(0,d.A)(this,os,null),(0,d.A)(this,ls,null),(0,d.A)(this,hs,null),(0,d.A)(this,cs,H.NONE),(0,d.A)(this,ds,new Set),(0,d.A)(this,us,null),(0,d.A)(this,ps,null),(0,d.A)(this,As,null),(0,d.A)(this,gs,this.blur.bind(this)),(0,d.A)(this,fs,this.focus.bind(this)),(0,d.A)(this,ms,this.copy.bind(this)),(0,d.A)(this,vs,this.cut.bind(this)),(0,d.A)(this,bs,this.paste.bind(this)),(0,d.A)(this,ws,this.keydown.bind(this)),(0,d.A)(this,ys,this.keyup.bind(this)),(0,d.A)(this,_s,this.onEditingAction.bind(this)),(0,d.A)(this,xs,this.onPageChanging.bind(this)),(0,d.A)(this,Es,this.onScaleChanging.bind(this)),(0,d.A)(this,ks,this.onRotationChanging.bind(this)),(0,d.A)(this,Ss,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),(0,d.A)(this,Ms,[0,0]),(0,d.A)(this,Cs,null),(0,d.A)(this,Rs,null),(0,d.A)(this,Ts,null),this._signal=(0,u.A)(Bi,this).signal,(0,p.A)(Rs,this,t),(0,p.A)(Ts,this,e),(0,p.A)(Vi,this,i),this._eventBus=s,this._eventBus._on("editingaction",(0,u.A)(_s,this)),this._eventBus._on("pagechanging",(0,u.A)(xs,this)),this._eventBus._on("scalechanging",(0,u.A)(Es,this)),this._eventBus._on("rotationchanging",(0,u.A)(ks,this)),(0,l.A)(Ps,this,Ns).call(this),(0,l.A)(Ps,this,Us).call(this),(0,l.A)(Ps,this,js).call(this),(0,p.A)(Ui,this,n.annotationStorage),(0,p.A)($i,this,n.filterFactory),(0,p.A)(ps,this,a),(0,p.A)(es,this,r||null),(0,p.A)(Zi,this,h),(0,p.A)(hs,this,c||null),this.viewParameters={realScale:ge.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){var t,e,i;null===(t=(0,u.A)(Bi,this))||void 0===t||t.abort(),(0,p.A)(Bi,this,null),this._signal=null,this._eventBus._off("editingaction",(0,u.A)(_s,this)),this._eventBus._off("pagechanging",(0,u.A)(xs,this)),this._eventBus._off("scalechanging",(0,u.A)(Es,this)),this._eventBus._off("rotationchanging",(0,u.A)(ks,this));for(const s of(0,u.A)(zi,this).values())s.destroy();(0,u.A)(zi,this).clear(),(0,u.A)(Hi,this).clear(),(0,u.A)(Ji,this).clear(),(0,p.A)(ji,this,null),(0,u.A)(ds,this).clear(),(0,u.A)(qi,this).destroy(),null===(e=(0,u.A)(Vi,this))||void 0===e||e.destroy(),null===(i=(0,u.A)(ss,this))||void 0===i||i.hide(),(0,p.A)(ss,this,null),(0,u.A)(ts,this)&&(clearTimeout((0,u.A)(ts,this)),(0,p.A)(ts,this,null)),(0,u.A)(Cs,this)&&(clearTimeout((0,u.A)(Cs,this)),(0,p.A)(Cs,this,null))}async mlGuess(t){var e;return(null===(e=(0,u.A)(hs,this))||void 0===e?void 0:e.guess(t))||null}get hasMLManager(){return!!(0,u.A)(hs,this)}get hcmFilter(){return Lt(this,"hcmFilter",(0,u.A)(ps,this)?(0,u.A)($i,this).addHCMFilter((0,u.A)(ps,this).foreground,(0,u.A)(ps,this).background):"none")}get direction(){return Lt(this,"direction",getComputedStyle((0,u.A)(Rs,this)).direction)}get highlightColors(){return Lt(this,"highlightColors",(0,u.A)(es,this)?new Map((0,u.A)(es,this).split(",").map(t=>t.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return Lt(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){(0,p.A)(ls,this,t)}editAltText(t){var e;null===(e=(0,u.A)(Vi,this))||void 0===e||e.editAltText(this,t)}onPageChanging(t){let{pageNumber:e}=t;(0,p.A)(Xi,this,e-1)}focusMainContainer(){(0,u.A)(Rs,this).focus()}findParent(t,e){for(const i of(0,u.A)(zi,this).values()){const{x:s,y:n,width:a,height:r}=i.div.getBoundingClientRect();if(t>=s&&t<=s+a&&e>=n&&e<=n+r)return i}return null}disableUserSelect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,u.A)(Ts,this).classList.toggle("noUserSelect",t)}addShouldRescale(t){(0,u.A)(Ji,this).add(t)}removeShouldRescale(t){(0,u.A)(Ji,this).delete(t)}onScaleChanging(t){let{scale:e}=t;this.commitOrRemove(),this.viewParameters.realScale=e*ge.PDF_TO_CSS_UNITS;for(const i of(0,u.A)(Ji,this))i.onScaleChanging()}onRotationChanging(t){let{pagesRotation:e}=t;this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:i,anchorOffset:s,focusNode:n,focusOffset:a}=e,r=e.toString(),o=(0,l.A)(Ps,this,Is).call(this,e).closest(".textLayer"),h=this.getSelectionBoxes(o);if(h){e.empty(),(0,u.A)(cs,this)===H.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:H.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const e of(0,u.A)(zi,this).values())if(e.hasTextLayer(o)){e.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:i,anchorOffset:s,focusNode:n,focusOffset:a,text:r});break}}}addToAnnotationStorage(t){t.isEmpty()||!(0,u.A)(Ui,this)||(0,u.A)(Ui,this).has(t.id)||(0,u.A)(Ui,this).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,(0,u.A)(is,this)&&((0,p.A)(is,this,!1),(0,l.A)(Ps,this,Os).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of(0,u.A)(ds,this))if(e.div.contains(t)){(0,p.A)(os,this,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!(0,u.A)(os,this))return;const[t,e]=(0,u.A)(os,this);(0,p.A)(os,this,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){(0,l.A)(Ps,this,js).call(this),(0,l.A)(Ps,this,zs).call(this)}removeEditListeners(){(0,l.A)(Ps,this,Hs).call(this),(0,l.A)(Ps,this,Vs).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of(0,u.A)(Qi,this))if(i.isHandlingMimeForPasting(e))return t.dataTransfer.dropEffect="copy",void t.preventDefault()}drop(t){for(const e of t.dataTransfer.items)for(const i of(0,u.A)(Qi,this))if(i.isHandlingMimeForPasting(e.type))return i.paste(e,this.currentLayer),void t.preventDefault()}copy(t){var e;if(t.preventDefault(),null===(e=(0,u.A)(ji,this))||void 0===e||e.commitOrRemove(),!this.hasSelection)return;const i=[];for(const s of(0,u.A)(ds,this)){const t=s.serialize(!0);t&&i.push(t)}0!==i.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:e}=t;for(const a of e.items)for(const t of(0,u.A)(Qi,this))if(t.isHandlingMimeForPasting(a.type))return void t.paste(a,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(n){return void Ct('paste: "'.concat(n.message,'".'))}if(!Array.isArray(i))return;this.unselectAll();const s=this.currentLayer;try{const t=[];for(const a of i){const e=s.deserialize(a);if(!e)return;t.push(e)}const e=()=>{for(const e of t)(0,l.A)(Ps,this,Ys).call(this,e);(0,l.A)(Ps,this,Zs).call(this,t)},n=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:n,mustExec:!0})}catch(n){Ct('paste: "'.concat(n.message,'".'))}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),(0,u.A)(cs,this)===H.NONE||this.isEditorHandlingKeyboard||Ls._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,(0,u.A)(is,this)&&((0,p.A)(is,this,!1),(0,l.A)(Ps,this,Os).call(this,"main_toolbar")))}onEditingAction(t){let{name:e}=t;switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}setEditingState(t){t?((0,l.A)(Ps,this,Ws).call(this),(0,l.A)(Ps,this,zs).call(this),(0,l.A)(Ps,this,Gs).call(this,{isEditing:(0,u.A)(cs,this)!==H.NONE,isEmpty:(0,l.A)(Ps,this,Js).call(this),hasSomethingToUndo:(0,u.A)(qi,this).hasSomethingToUndo(),hasSomethingToRedo:(0,u.A)(qi,this).hasSomethingToRedo(),hasSelectedEditor:!1})):((0,l.A)(Ps,this,Bs).call(this),(0,l.A)(Ps,this,Vs).call(this),(0,l.A)(Ps,this,Gs).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!(0,u.A)(Qi,this)){(0,p.A)(Qi,this,t);for(const t of(0,u.A)(Qi,this))(0,l.A)(Ps,this,qs).call(this,t.defaultPropertiesToUpdate)}}getId(){return(0,u.A)(ns,this).id}get currentLayer(){return(0,u.A)(zi,this).get((0,u.A)(Xi,this))}getLayer(t){return(0,u.A)(zi,this).get(t)}get currentPageIndex(){return(0,u.A)(Xi,this)}addLayer(t){(0,u.A)(zi,this).set(t.pageIndex,t),(0,u.A)(as,this)?t.enable():t.disable()}removeLayer(t){(0,u.A)(zi,this).delete(t.pageIndex)}updateMode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if((0,u.A)(cs,this)!==t){if((0,p.A)(cs,this,t),t===H.NONE)return this.setEditingState(!1),void(0,l.A)(Ps,this,Ks).call(this);this.setEditingState(!0),(0,l.A)(Ps,this,Xs).call(this),this.unselectAll();for(const e of(0,u.A)(zi,this).values())e.updateMode(t);if(e||!i){if(e)for(const t of(0,u.A)(Hi,this).values())if(t.annotationElementId===e){this.setSelected(t),t.enterInEditMode();break}}else this.addNewEditorFromKeyboard()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==(0,u.A)(cs,this)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var i;if((0,u.A)(Qi,this)){switch(t){case z.CREATE:return void this.currentLayer.addNewEditor();case z.HIGHLIGHT_DEFAULT_COLOR:null===(i=(0,u.A)(ls,this))||void 0===i||i.updateColor(e);break;case z.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),((0,u.A)(As,this)||(0,p.A)(As,this,new Map)).set(t,e),this.showAllEditors("highlight",e)}for(const i of(0,u.A)(ds,this))i.updateParams(t,e);for(const i of(0,u.A)(Qi,this))i.updateDefaultParams(t,e)}}showAllEditors(t,e){var i,s;for(const n of(0,u.A)(Hi,this).values())n.editorType===t&&n.show(e);(null===(i=null===(s=(0,u.A)(As,this))||void 0===s?void 0:s.get(z.HIGHLIGHT_SHOW_ALL))||void 0===i||i)!==e&&(0,l.A)(Ps,this,qs).call(this,[[z.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,u.A)(rs,this)!==t){(0,p.A)(rs,this,t);for(const e of(0,u.A)(zi,this).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const i of(0,u.A)(Hi,this).values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return(0,u.A)(Hi,this).get(t)}addEditor(t){(0,u.A)(Hi,this).set(t.id,t)}removeEditor(t){var e;(t.div.contains(document.activeElement)&&((0,u.A)(ts,this)&&clearTimeout((0,u.A)(ts,this)),(0,p.A)(ts,this,setTimeout(()=>{this.focusMainContainer(),(0,p.A)(ts,this,null)},0))),(0,u.A)(Hi,this).delete(t.id),this.unselect(t),t.annotationElementId&&(0,u.A)(Ki,this).has(t.annotationElementId))||(null===(e=(0,u.A)(Ui,this))||void 0===e||e.remove(t.id))}addDeletedAnnotationElement(t){(0,u.A)(Ki,this).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return(0,u.A)(Ki,this).has(t)}removeDeletedAnnotationElement(t){(0,u.A)(Ki,this).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){(0,u.A)(ji,this)!==t&&((0,p.A)(ji,this,t),t&&(0,l.A)(Ps,this,qs).call(this,t.propertiesToUpdate))}updateUI(t){h(Ps,this,Qs)===t&&(0,l.A)(Ps,this,qs).call(this,t.propertiesToUpdate)}toggleSelected(t){if((0,u.A)(ds,this).has(t))return(0,u.A)(ds,this).delete(t),t.unselect(),void(0,l.A)(Ps,this,Gs).call(this,{hasSelectedEditor:this.hasSelection});(0,u.A)(ds,this).add(t),t.select(),(0,l.A)(Ps,this,qs).call(this,t.propertiesToUpdate),(0,l.A)(Ps,this,Gs).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of(0,u.A)(ds,this))e!==t&&e.unselect();(0,u.A)(ds,this).clear(),(0,u.A)(ds,this).add(t),t.select(),(0,l.A)(Ps,this,qs).call(this,t.propertiesToUpdate),(0,l.A)(Ps,this,Gs).call(this,{hasSelectedEditor:!0})}isSelected(t){return(0,u.A)(ds,this).has(t)}get firstSelectedEditor(){return(0,u.A)(ds,this).values().next().value}unselect(t){t.unselect(),(0,u.A)(ds,this).delete(t),(0,l.A)(Ps,this,Gs).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==(0,u.A)(ds,this).size}get isEnterHandled(){return 1===(0,u.A)(ds,this).size&&this.firstSelectedEditor.isEnterHandled}undo(){(0,u.A)(qi,this).undo(),(0,l.A)(Ps,this,Gs).call(this,{hasSomethingToUndo:(0,u.A)(qi,this).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:(0,l.A)(Ps,this,Js).call(this)})}redo(){(0,u.A)(qi,this).redo(),(0,l.A)(Ps,this,Gs).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:(0,u.A)(qi,this).hasSomethingToRedo(),isEmpty:(0,l.A)(Ps,this,Js).call(this)})}addCommands(t){(0,u.A)(qi,this).add(t),(0,l.A)(Ps,this,Gs).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:(0,l.A)(Ps,this,Js).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...(0,u.A)(ds,this)];this.addCommands({cmd:()=>{for(const e of t)e.remove()},undo:()=>{for(const e of t)(0,l.A)(Ps,this,Ys).call(this,e)},mustExec:!0})}commitOrRemove(){var t;null===(t=(0,u.A)(ji,this))||void 0===t||t.commitOrRemove()}hasSomethingToControl(){return(0,u.A)(ji,this)||this.hasSelection}selectAll(){for(const t of(0,u.A)(ds,this))t.commit();(0,l.A)(Ps,this,Zs).call(this,(0,u.A)(Hi,this).values())}unselectAll(){if((!(0,u.A)(ji,this)||((0,u.A)(ji,this).commitOrRemove(),(0,u.A)(cs,this)===H.NONE))&&this.hasSelection){for(const t of(0,u.A)(ds,this))t.unselect();(0,u.A)(ds,this).clear(),(0,l.A)(Ps,this,Gs).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]||this.commitOrRemove(),!this.hasSelection)return;(0,u.A)(Ms,this)[0]+=t,(0,u.A)(Ms,this)[1]+=e;const[i,s]=(0,u.A)(Ms,this),n=[...(0,u.A)(ds,this)];(0,u.A)(Cs,this)&&clearTimeout((0,u.A)(Cs,this)),(0,p.A)(Cs,this,setTimeout(()=>{(0,p.A)(Cs,this,null),(0,u.A)(Ms,this)[0]=(0,u.A)(Ms,this)[1]=0,this.addCommands({cmd:()=>{for(const t of n)(0,u.A)(Hi,this).has(t.id)&&t.translateInPage(i,s)},undo:()=>{for(const t of n)(0,u.A)(Hi,this).has(t.id)&&t.translateInPage(-i,-s)},mustExec:!1})},1e3));for(const a of n)a.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),(0,p.A)(Yi,this,new Map);for(const t of(0,u.A)(ds,this))(0,u.A)(Yi,this).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!(0,u.A)(Yi,this))return!1;this.disableUserSelect(!1);const t=(0,u.A)(Yi,this);(0,p.A)(Yi,this,null);let e=!1;for(const[{x:s,y:n,pageIndex:a},r]of t)r.newX=s,r.newY=n,r.newPageIndex=a,e||(e=s!==r.savedX||n!==r.savedY||a!==r.savedPageIndex);if(!e)return!1;const i=(t,e,i,s)=>{if((0,u.A)(Hi,this).has(t.id)){const n=(0,u.A)(zi,this).get(s);n?t._setParentAndPosition(n,e,i):(t.pageIndex=s,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(const[e,{newX:s,newY:n,newPageIndex:a}]of t)i(e,s,n,a)},undo:()=>{for(const[e,{savedX:s,savedY:n,savedPageIndex:a}]of t)i(e,s,n,a)},mustExec:!0}),!0}dragSelectedEditors(t,e){if((0,u.A)(Yi,this))for(const i of(0,u.A)(Yi,this).keys())i.drag(t,e)}rebuild(t){if(null===t.parent){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return(null===(t=this.getActive())||void 0===t?void 0:t.shouldGetKeyboardEvents())||1===(0,u.A)(ds,this).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return(0,u.A)(ji,this)===t}getActive(){return(0,u.A)(ji,this)}getMode(){return(0,u.A)(cs,this)}get imageManager(){return Lt(this,"imageManager",new Ci)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let l=0,h=e.rangeCount;l<h;l++)if(!t.contains(e.getRangeAt(l).commonAncestorContainer))return null;const{x:i,y:s,width:n,height:a}=t.getBoundingClientRect();let r;switch(t.getAttribute("data-main-rotation")){case"90":r=(t,e,r,o)=>({x:(e-s)/a,y:1-(t+r-i)/n,width:o/a,height:r/n});break;case"180":r=(t,e,r,o)=>({x:1-(t+r-i)/n,y:1-(e+o-s)/a,width:r/n,height:o/a});break;case"270":r=(t,e,r,o)=>({x:1-(e+o-s)/a,y:(t-i)/n,width:o/a,height:r/n});break;default:r=(t,e,r,o)=>({x:(t-i)/n,y:(e-s)/a,width:r/n,height:o/a})}const o=[];for(let l=0,h=e.rangeCount;l<h;l++){const t=e.getRangeAt(l);if(!t.collapsed)for(const{x:e,y:i,width:s,height:n}of t.getClientRects())0!==s&&0!==n&&o.push(r(e,i,s,n))}return 0===o.length?null:o}addChangedExistingAnnotation(t){let{annotationElementId:e,id:i}=t;((0,u.A)(Gi,this)||(0,p.A)(Gi,this,new Map)).set(e,i)}removeChangedExistingAnnotation(t){var e;let{annotationElementId:i}=t;null===(e=(0,u.A)(Gi,this))||void 0===e||e.delete(i)}renderAnnotationElement(t){var e;const i=null===(e=(0,u.A)(Gi,this))||void 0===e?void 0:e.get(t.data.id);if(!i)return;const s=(0,u.A)(Ui,this).getRawValue(i);s&&((0,u.A)(cs,this)!==H.NONE||s.hasBeenModified)&&s.renderAnnotationElement(t)}}function Is(t){let{anchorNode:e}=t;return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function Ds(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=(0,l.A)(Ps,this,Is).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&((0,u.A)(ss,this)||(0,p.A)(ss,this,new mi(this)),(0,u.A)(ss,this).show(e,i,"ltr"===this.direction))}function Fs(){var t;const e=document.getSelection();if(!e||e.isCollapsed){var i;if((0,u.A)(us,this))null===(i=(0,u.A)(ss,this))||void 0===i||i.hide(),(0,p.A)(us,this,null),(0,l.A)(Ps,this,Gs).call(this,{hasSelectedText:!1});return}const{anchorNode:s}=e;if(s===(0,u.A)(us,this))return;var n;if((0,l.A)(Ps,this,Is).call(this,e).closest(".textLayer")){if(null===(t=(0,u.A)(ss,this))||void 0===t||t.hide(),(0,p.A)(us,this,s),(0,l.A)(Ps,this,Gs).call(this,{hasSelectedText:!0}),((0,u.A)(cs,this)===H.HIGHLIGHT||(0,u.A)(cs,this)===H.NONE)&&((0,u.A)(cs,this)===H.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),(0,p.A)(is,this,this.isShiftKeyDown),!this.isShiftKeyDown)){const t=this._signal,e=t=>{"pointerup"===t.type&&0!==t.button||(window.removeEventListener("pointerup",e),window.removeEventListener("blur",e),"pointerup"===t.type&&(0,l.A)(Ps,this,Os).call(this,"main_toolbar"))};window.addEventListener("pointerup",e,{signal:t}),window.addEventListener("blur",e,{signal:t})}}else(0,u.A)(us,this)&&(null===(n=(0,u.A)(ss,this))||void 0===n||n.hide(),(0,p.A)(us,this,null),(0,l.A)(Ps,this,Gs).call(this,{hasSelectedText:!1}))}function Os(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";(0,u.A)(cs,this)===H.HIGHLIGHT?this.highlightSelection(t):(0,u.A)(Zi,this)&&(0,l.A)(Ps,this,Ds).call(this)}function Ns(){document.addEventListener("selectionchange",(0,l.A)(Ps,this,Fs).bind(this),{signal:this._signal})}function Ws(){const t=this._signal;window.addEventListener("focus",(0,u.A)(fs,this),{signal:t}),window.addEventListener("blur",(0,u.A)(gs,this),{signal:t})}function Bs(){window.removeEventListener("focus",(0,u.A)(fs,this)),window.removeEventListener("blur",(0,u.A)(gs,this))}function js(){const t=this._signal;window.addEventListener("keydown",(0,u.A)(ws,this),{signal:t}),window.addEventListener("keyup",(0,u.A)(ys,this),{signal:t})}function Hs(){window.removeEventListener("keydown",(0,u.A)(ws,this)),window.removeEventListener("keyup",(0,u.A)(ys,this))}function zs(){const t=this._signal;document.addEventListener("copy",(0,u.A)(ms,this),{signal:t}),document.addEventListener("cut",(0,u.A)(vs,this),{signal:t}),document.addEventListener("paste",(0,u.A)(bs,this),{signal:t})}function Vs(){document.removeEventListener("copy",(0,u.A)(ms,this)),document.removeEventListener("cut",(0,u.A)(vs,this)),document.removeEventListener("paste",(0,u.A)(bs,this))}function Us(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}function Gs(t){Object.entries(t).some(t=>{let[e,i]=t;return(0,u.A)(Ss,this)[e]!==i})&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign((0,u.A)(Ss,this),t)}),(0,u.A)(cs,this)===H.HIGHLIGHT&&!1===t.hasSelectedEditor&&(0,l.A)(Ps,this,qs).call(this,[[z.HIGHLIGHT_FREE,!0]]))}function qs(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}function Xs(){if(!(0,u.A)(as,this)){(0,p.A)(as,this,!0);for(const t of(0,u.A)(zi,this).values())t.enable();for(const t of(0,u.A)(Hi,this).values())t.enable()}}function Ks(){if(this.unselectAll(),(0,u.A)(as,this)){(0,p.A)(as,this,!1);for(const t of(0,u.A)(zi,this).values())t.disable();for(const t of(0,u.A)(Hi,this).values())t.disable()}}function Ys(t){const e=(0,u.A)(zi,this).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}function Qs(t){let e=null;for(e of(0,u.A)(ds,t));return e}function Js(){if(0===(0,u.A)(Hi,this).size)return!0;if(1===(0,u.A)(Hi,this).size)for(const t of(0,u.A)(Hi,this).values())return t.isEmpty();return!1}function Zs(t){for(const e of(0,u.A)(ds,this))e.unselect();(0,u.A)(ds,this).clear();for(const e of t)e.isEmpty()||((0,u.A)(ds,this).add(e),e.select());(0,l.A)(Ps,this,Gs).call(this,{hasSelectedEditor:this.hasSelection})}(0,c.A)(Ls,"TRANSLATE_SMALL",1),(0,c.A)(Ls,"TRANSLATE_BIG",10);var $s=new WeakMap,tn=new WeakMap,en=new WeakMap,sn=new WeakMap,nn=new WeakMap,an=new WeakMap,rn=new WeakMap,on=new WeakSet;class ln{constructor(t){(0,o.A)(this,on),(0,d.A)(this,$s,""),(0,d.A)(this,tn,!1),(0,d.A)(this,en,null),(0,d.A)(this,sn,null),(0,d.A)(this,nn,null),(0,d.A)(this,an,!1),(0,d.A)(this,rn,null),(0,p.A)(rn,this,t)}static initialize(t){ln._l10nPromise||(ln._l10nPromise=t)}async render(){const t=(0,p.A)(en,this,document.createElement("button"));t.className="altText";const e=await ln._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=e,t.setAttribute("aria-label",e),t.tabIndex="0";const i=(0,u.A)(rn,this)._uiManager._signal;t.addEventListener("contextmenu",qe,{signal:i}),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});const s=t=>{t.preventDefault(),(0,u.A)(rn,this)._uiManager.editAltText((0,u.A)(rn,this))};return t.addEventListener("click",s,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&((0,p.A)(an,this,!0),s(e))},{signal:i}),await(0,l.A)(on,this,hn).call(this),t}finish(){(0,u.A)(en,this)&&((0,u.A)(en,this).focus({focusVisible:(0,u.A)(an,this)}),(0,p.A)(an,this,!1))}isEmpty(){return!(0,u.A)($s,this)&&!(0,u.A)(tn,this)}get data(){return{altText:(0,u.A)($s,this),decorative:(0,u.A)(tn,this)}}set data(t){let{altText:e,decorative:i}=t;(0,u.A)($s,this)===e&&(0,u.A)(tn,this)===i||((0,p.A)($s,this,e),(0,p.A)(tn,this,i),(0,l.A)(on,this,hn).call(this))}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,u.A)(en,this)&&(!t&&(0,u.A)(nn,this)&&(clearTimeout((0,u.A)(nn,this)),(0,p.A)(nn,this,null)),(0,u.A)(en,this).disabled=!t)}destroy(){var t;null===(t=(0,u.A)(en,this))||void 0===t||t.remove(),(0,p.A)(en,this,null),(0,p.A)(sn,this,null)}}async function hn(){const t=(0,u.A)(en,this);if(!t)return;var e;if(!(0,u.A)($s,this)&&!(0,u.A)(tn,this))return t.classList.remove("done"),void(null===(e=(0,u.A)(sn,this))||void 0===e||e.remove());t.classList.add("done"),v._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(e=>{t.setAttribute("aria-label",e)});let i=(0,u.A)(sn,this);if(!i){(0,p.A)(sn,this,i=document.createElement("span")),i.className="tooltip",i.setAttribute("role","tooltip");const e=i.id="alt-text-tooltip-".concat((0,u.A)(rn,this).id);t.setAttribute("aria-describedby",e);const s=100,n=(0,u.A)(rn,this)._uiManager._signal;n.addEventListener("abort",()=>{clearTimeout((0,u.A)(nn,this)),(0,p.A)(nn,this,null)},{once:!0}),t.addEventListener("mouseenter",()=>{(0,p.A)(nn,this,setTimeout(()=>{(0,p.A)(nn,this,null),(0,u.A)(sn,this).classList.add("show"),(0,u.A)(rn,this)._reportTelemetry({action:"alt_text_tooltip"})},s))},{signal:n}),t.addEventListener("mouseleave",()=>{var t;(0,u.A)(nn,this)&&(clearTimeout((0,u.A)(nn,this)),(0,p.A)(nn,this,null)),null===(t=(0,u.A)(sn,this))||void 0===t||t.classList.remove("show")},{signal:n})}i.innerText=(0,u.A)(tn,this)?await v._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):(0,u.A)($s,this),i.parentNode||t.append(i);const s=(0,u.A)(rn,this).getImageForAltText();null===s||void 0===s||s.setAttribute("aria-describedby",i.id)}v=ln,(0,c.A)(ln,"_l10nPromise",null);var cn=new WeakMap,dn=new WeakMap,un=new WeakMap,pn=new WeakMap,An=new WeakMap,gn=new WeakMap,fn=new WeakMap,mn=new WeakMap,vn=new WeakMap,bn=new WeakMap,wn=new WeakMap,yn=new WeakMap,_n=new WeakMap,xn=new WeakMap,En=new WeakMap,kn=new WeakMap,Sn=new WeakMap,Mn=new WeakMap,Cn=new WeakMap,Rn=new WeakMap,Tn=new WeakMap,Pn=new WeakMap,Ln=new WeakSet;class In{static get _resizerKeyboardManager(){const t=In.prototype._resizeWithKeyboard,e=Ls.TRANSLATE_SMALL,i=Ls.TRANSLATE_BIG;return Lt(this,"_resizerKeyboardManager",new Oi([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],In.prototype._stopResizingWithKeyboard]]))}constructor(t){(0,o.A)(this,Ln),(0,d.A)(this,cn,null),(0,d.A)(this,dn,null),(0,d.A)(this,un,null),(0,d.A)(this,pn,!1),(0,d.A)(this,An,!1),(0,d.A)(this,gn,null),(0,d.A)(this,fn,null),(0,d.A)(this,mn,this.focusin.bind(this)),(0,d.A)(this,vn,this.focusout.bind(this)),(0,d.A)(this,bn,null),(0,d.A)(this,wn,""),(0,d.A)(this,yn,!1),(0,d.A)(this,_n,null),(0,d.A)(this,xn,!1),(0,d.A)(this,En,!1),(0,d.A)(this,kn,!1),(0,d.A)(this,Sn,null),(0,d.A)(this,Mn,0),(0,d.A)(this,Cn,0),(0,d.A)(this,Rn,null),(0,c.A)(this,"_initialOptions",Object.create(null)),(0,c.A)(this,"_isVisible",!0),(0,c.A)(this,"_uiManager",null),(0,c.A)(this,"_focusEventsAllowed",!0),(0,c.A)(this,"_l10nPromise",null),(0,d.A)(this,Tn,!1),(0,d.A)(this,Pn,In._zIndex++),this.constructor===In&&Rt("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:s,pageX:n,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[n,a];const[r,l]=this.parentDimensions;this.x=t.x/r,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return Lt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new Kn({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e,i){if(In._l10nPromise||(In._l10nPromise=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(e=>[e,t.get(e.replaceAll(/([A-Z])/g,t=>"-".concat(t.toLowerCase())))]))),null!==i&&void 0!==i&&i.strings)for(const n of i.strings)In._l10nPromise.set(n,t.get(n));if(-1!==In._borderLineWidth)return;const s=getComputedStyle(document.documentElement);In._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){Rt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return(0,u.A)(Tn,this)}set _isDraggable(t){var e;(0,p.A)(Tn,this,t),null===(e=this.div)||void 0===e||e.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=(0,u.A)(Pn,this)}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(0,l.A)(Ln,this,Xn).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&((0,u.A)(yn,this)?(0,p.A)(yn,this,!1):this.parent.setSelected(this))}focusout(t){var e;if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const i=t.relatedTarget;null!==i&&void 0!==i&&i.closest("#".concat(this.id))||(t.preventDefault(),null!==(e=this.parent)&&void 0!==e&&e.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){const[n,a]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/n,this.y=(e+s)/a,this.fixAndSetPosition()}translate(t,e){(0,l.A)(Ln,this,Dn).call(this,this.parentDimensions,t,e)}translateInPage(t,e){(0,u.A)(_n,this)||(0,p.A)(_n,this,[this.x,this.y]),(0,l.A)(Ln,this,Dn).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){(0,u.A)(_n,this)||(0,p.A)(_n,this,[this.x,this.y]);const[i,s]=this.parentDimensions;if(this.x+=t/i,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:a}=this;const[r,o]=this.getBaseTranslation();n+=r,a+=o,this.div.style.left="".concat((100*n).toFixed(2),"%"),this.div.style.top="".concat((100*a).toFixed(2),"%"),this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!(0,u.A)(_n,this)&&((0,u.A)(_n,this)[0]!==this.x||(0,u.A)(_n,this)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=In,s=i/t,n=i/e;switch(this.rotation){case 90:return[-s,n];case 180:return[s,n];case 270:return[s,-n];default:return[-s,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation;const[e,i]=this.pageDimensions;let{x:s,y:n,width:a,height:r}=this;if(a*=e,r*=i,s*=e,n*=i,this._mustFixPosition)switch(t){case 0:s=Math.max(0,Math.min(e-a,s)),n=Math.max(0,Math.min(i-r,n));break;case 90:s=Math.max(0,Math.min(e-r,s)),n=Math.min(i,Math.max(a,n));break;case 180:s=Math.min(e,Math.max(a,s)),n=Math.min(i,Math.max(r,n));break;case 270:s=Math.min(e,Math.max(r,s)),n=Math.max(0,Math.min(i-a,n))}this.x=s/=e,this.y=n/=i;const[o,l]=this.getBaseTranslation();s+=o,n+=l;const{style:h}=this.div;h.left="".concat((100*s).toFixed(2),"%"),h.top="".concat((100*n).toFixed(2),"%"),this.moveInDOM()}screenToPageTranslation(t,e){return Fn.call(In,t,e,this.parentRotation)}pageTranslationToScreen(t,e){return Fn.call(In,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,i]}=this,s=e*t,n=i*t;return Ut.isCSSRoundSupported?[Math.round(s),Math.round(n)]:[s,n]}setDims(t,e){const[i,s]=this.parentDimensions;this.div.style.width="".concat((100*t/i).toFixed(2),"%"),(0,u.A)(An,this)||(this.div.style.height="".concat((100*e/s).toFixed(2),"%"))}fixDims(){const{style:t}=this.div,{height:e,width:i}=t,s=i.endsWith("%"),n=!(0,u.A)(An,this)&&e.endsWith("%");if(s&&n)return;const[a,r]=this.parentDimensions;s||(t.width="".concat((100*parseFloat(i)/a).toFixed(2),"%")),(0,u.A)(An,this)||n||(t.height="".concat((100*parseFloat(e)/r).toFixed(2),"%"))}getInitialTranslation(){return[0,0]}altTextFinish(){var t;null===(t=(0,u.A)(un,this))||void 0===t||t.finish()}async addEditToolbar(){return(0,u.A)(bn,this)||(0,u.A)(En,this)||((0,p.A)(bn,this,new ri(this)),this.div.append((0,u.A)(bn,this).render()),(0,u.A)(un,this)&&(0,u.A)(bn,this).addAltTextButton(await(0,u.A)(un,this).render())),(0,u.A)(bn,this)}removeEditToolbar(){var t;(0,u.A)(bn,this)&&((0,u.A)(bn,this).remove(),(0,p.A)(bn,this,null),null===(t=(0,u.A)(un,this))||void 0===t||t.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){(0,u.A)(un,this)||(ln.initialize(In._l10nPromise),(0,p.A)(un,this,new ln(this)),(0,u.A)(cn,this)&&((0,u.A)(un,this).data=(0,u.A)(cn,this),(0,p.A)(cn,this,null)),await this.addEditToolbar())}get altTextData(){var t;return null===(t=(0,u.A)(un,this))||void 0===t?void 0:t.data}set altTextData(t){(0,u.A)(un,this)&&((0,u.A)(un,this).data=t)}hasAltText(){var t;return!(null!==(t=(0,u.A)(un,this))&&void 0!==t&&t.isEmpty())}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=(0,u.A)(pn,this)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground();const t=this._uiManager._signal;this.div.addEventListener("focusin",(0,u.A)(mn,this),{signal:t}),this.div.addEventListener("focusout",(0,u.A)(vn,this),{signal:t});const[e,i]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth="".concat((100*i/e).toFixed(2),"%"),this.div.style.maxHeight="".concat((100*e/i).toFixed(2),"%"));const[s,n]=this.getInitialTranslation();return this.translate(s,n),yi(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=Ut.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():((0,p.A)(yn,this,!0),this._isDraggable?(0,l.A)(Ln,this,zn).call(this,t):(0,l.A)(Ln,this,Hn).call(this,t))}moveInDOM(){(0,u.A)(Sn,this)&&clearTimeout((0,u.A)(Sn,this)),(0,p.A)(Sn,this,setTimeout(()=>{var t;(0,p.A)(Sn,this,null),null===(t=this.parent)||void 0===t||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition()}getRect(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation;const s=this.parentScale,[n,a]=this.pageDimensions,[r,o]=this.pageTranslation,l=t/s,h=e/s,c=this.x*n,d=this.y*a,u=this.width*n,p=this.height*a;switch(i){case 0:return[c+l+r,a-d-h-p+o,c+l+u+r,a-d-h+o];case 90:return[c+h+r,a-d+l+o,c+h+p+r,a-d+l+u+o];case 180:return[c-l-u+r,a-d+h+o,c-l+r,a-d+h+p+o];case 270:return[c-h-p+r,a-d-l-u+o,c-h+r,a-d-l+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,s,n,a]=t,r=n-i,o=a-s;switch(this.rotation){case 0:return[i,e-a,r,o];case 90:return[i,e-s,o,r];case 180:return[n,e-s,r,o];case 270:return[n,e-a,o,r];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){(0,p.A)(En,this,!0)}disableEditMode(){(0,p.A)(En,this,!1)}isInEditMode(){return(0,u.A)(En,this)}shouldGetKeyboardEvents(){return(0,u.A)(kn,this)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var t,e;const i=this._uiManager._signal;null===(t=this.div)||void 0===t||t.addEventListener("focusin",(0,u.A)(mn,this),{signal:i}),null===(e=this.div)||void 0===e||e.addEventListener("focusout",(0,u.A)(vn,this),{signal:i})}rotate(t){}serialize(){Rt("An editor must be serializable")}static deserialize(t,e,i){const s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation,(0,p.A)(cn,s,t.accessibilityData);const[n,a]=s.pageDimensions,[r,o,l,h]=s.getRectInCurrentCoords(t.rect,a);return s.x=r/n,s.y=o/a,s.width=l/n,s.height=h/a,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.div.removeEventListener("focusin",(0,u.A)(mn,this)),this.div.removeEventListener("focusout",(0,u.A)(vn,this)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),(0,u.A)(Sn,this)&&(clearTimeout((0,u.A)(Sn,this)),(0,p.A)(Sn,this,null)),(0,l.A)(Ln,this,Xn).call(this),this.removeEditToolbar(),(0,u.A)(Rn,this)){for(const t of(0,u.A)(Rn,this).values())clearTimeout(t);(0,p.A)(Rn,this,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&((0,l.A)(Ln,this,Nn).call(this),(0,u.A)(gn,this).classList.remove("hidden"),yi(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),(0,p.A)(fn,this,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=(0,u.A)(gn,this).children;if(!(0,u.A)(dn,this)){(0,p.A)(dn,this,Array.from(e));const t=(0,l.A)(Ln,this,Vn).bind(this),i=(0,l.A)(Ln,this,Un).bind(this),s=this._uiManager._signal;for(const e of(0,u.A)(dn,this)){const n=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:s}),e.addEventListener("blur",i,{signal:s}),e.addEventListener("focus",(0,l.A)(Ln,this,Gn).bind(this,n),{signal:s}),In._l10nPromise.get("pdfjs-editor-resizer-label-".concat(n)).then(t=>e.setAttribute("aria-label",t))}}const i=(0,u.A)(dn,this)[0];let s=0;for(const a of e){if(a===i)break;s++}const n=(360-this.rotation+this.parentRotation)%360/90*((0,u.A)(dn,this).length/4);if(n!==s){if(n<s)for(let e=0;e<s-n;e++)(0,u.A)(gn,this).append((0,u.A)(gn,this).firstChild);else if(n>s)for(let e=0;e<n-s;e++)(0,u.A)(gn,this).firstChild.before((0,u.A)(gn,this).lastChild);let t=0;for(const i of e){const e=(0,u.A)(dn,this)[t++].getAttribute("data-resizer-name");In._l10nPromise.get("pdfjs-editor-resizer-label-".concat(e)).then(t=>i.setAttribute("aria-label",t))}}(0,l.A)(Ln,this,qn).call(this,0),(0,p.A)(kn,this,!0),(0,u.A)(gn,this).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){(0,u.A)(kn,this)&&(0,l.A)(Ln,this,jn).call(this,(0,u.A)(wn,this),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){(0,l.A)(Ln,this,Xn).call(this),this.div.focus()}select(){var t,e;this.makeResizable(),null===(t=this.div)||void 0===t||t.classList.add("selectedEditor"),(0,u.A)(bn,this)?null===(e=(0,u.A)(bn,this))||void 0===e||e.show():this.addEditToolbar().then(()=>{var t,e;null!==(t=this.div)&&void 0!==t&&t.classList.contains("selectedEditor")&&(null===(e=(0,u.A)(bn,this))||void 0===e||e.show())})}unselect(){var t,e,i,s;null===(t=(0,u.A)(gn,this))||void 0===t||t.classList.add("hidden"),null===(e=this.div)||void 0===e||e.classList.remove("selectedEditor"),null!==(i=this.div)&&void 0!==i&&i.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),null===(s=(0,u.A)(bn,this))||void 0===s||s.hide()}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return(0,u.A)(xn,this)}set isEditing(t){(0,p.A)(xn,this,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){(0,p.A)(An,this,!0);const i=t/e,{style:s}=this.div;s.aspectRatio=i,s.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){(0,u.A)(Rn,this)||(0,p.A)(Rn,this,new Map);const{action:e}=t;let i=(0,u.A)(Rn,this).get(e);return i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),(0,u.A)(Rn,this).delete(e),0===(0,u.A)(Rn,this).size&&(0,p.A)(Rn,this,null)},In._telemetryTimeout),void(0,u.A)(Rn,this).set(e,i)}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),(0,p.A)(pn,this,!1)}disable(){this.div&&(this.div.tabIndex=-1),(0,p.A)(pn,this,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){const t=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const{firstChild:e}=t.container;"DIV"===e.nodeName&&e.classList.contains("annotationContent")&&e.remove()}}function Dn(t,e,i){let[s,n]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/s,this.y+=i/n,this.fixAndSetPosition()}function Fn(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}function On(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}function Nn(){if((0,u.A)(gn,this))return;(0,p.A)(gn,this,document.createElement("div")),(0,u.A)(gn,this).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const t=document.createElement("div");(0,u.A)(gn,this).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",(0,l.A)(Ln,this,Wn).bind(this,i),{signal:e}),t.addEventListener("contextmenu",qe,{signal:e}),t.tabIndex=-1}this.div.prepend((0,u.A)(gn,this))}function Wn(t,e){var i;e.preventDefault();const{isMac:s}=Ut.platform;if(0!==e.button||e.ctrlKey&&s)return;null===(i=(0,u.A)(un,this))||void 0===i||i.toggle(!1);const n=(0,l.A)(Ln,this,jn).bind(this,t),a=this._isDraggable;this._isDraggable=!1;const r=this._uiManager._signal,o={passive:!0,capture:!0,signal:r};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",n,o),window.addEventListener("contextmenu",qe,{signal:r});const h=this.x,c=this.y,d=this.width,p=this.height,A=this.parent.div.style.cursor,g=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const f=()=>{var t;this.parent.togglePointerEvents(!0),null===(t=(0,u.A)(un,this))||void 0===t||t.toggle(!0),this._isDraggable=a,window.removeEventListener("pointerup",f),window.removeEventListener("blur",f),window.removeEventListener("pointermove",n,o),window.removeEventListener("contextmenu",qe),this.parent.div.style.cursor=A,this.div.style.cursor=g,(0,l.A)(Ln,this,Bn).call(this,h,c,d,p)};window.addEventListener("pointerup",f,{signal:r}),window.addEventListener("blur",f,{signal:r})}function Bn(t,e,i,s){const n=this.x,a=this.y,r=this.width,o=this.height;n===t&&a===e&&r===i&&o===s||this.addCommands({cmd:()=>{this.width=r,this.height=o,this.x=n,this.y=a;const[t,e]=this.parentDimensions;this.setDims(t*r,e*o),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=s,this.x=t,this.y=e;const[n,a]=this.parentDimensions;this.setDims(n*i,a*s),this.fixAndSetPosition()},mustExec:!0})}function jn(t,e){const[i,s]=this.parentDimensions,n=this.x,a=this.y,r=this.width,o=this.height,h=b.MIN_SIZE/i,c=b.MIN_SIZE/s,d=t=>Math.round(1e4*t)/1e4,u=(0,l.A)(Ln,this,On).call(this,this.rotation),p=(t,e)=>[u[0]*t+u[2]*e,u[1]*t+u[3]*e],A=(0,l.A)(Ln,this,On).call(this,360-this.rotation);let g,f,m=!1,v=!1;switch(t){case"topLeft":m=!0,g=(t,e)=>[0,0],f=(t,e)=>[t,e];break;case"topMiddle":g=(t,e)=>[t/2,0],f=(t,e)=>[t/2,e];break;case"topRight":m=!0,g=(t,e)=>[t,0],f=(t,e)=>[0,e];break;case"middleRight":v=!0,g=(t,e)=>[t,e/2],f=(t,e)=>[0,e/2];break;case"bottomRight":m=!0,g=(t,e)=>[t,e],f=(t,e)=>[0,0];break;case"bottomMiddle":g=(t,e)=>[t/2,e],f=(t,e)=>[t/2,0];break;case"bottomLeft":m=!0,g=(t,e)=>[0,e],f=(t,e)=>[t,0];break;case"middleLeft":v=!0,g=(t,e)=>[0,e/2],f=(t,e)=>[t,e/2]}const w=g(r,o),y=f(r,o);let _=p(...y);const x=d(n+_[0]),E=d(a+_[1]);let k=1,S=1,[M,C]=this.screenToPageTranslation(e.movementX,e.movementY);var R,T;if([M,C]=(R=M/i,T=C/s,[A[0]*R+A[2]*T,A[1]*R+A[3]*T]),m){const t=Math.hypot(r,o);k=S=Math.max(Math.min(Math.hypot(y[0]-w[0]-M,y[1]-w[1]-C)/t,1/r,1/o),h/r,c/o)}else v?k=Math.max(h,Math.min(1,Math.abs(y[0]-w[0]-M)))/r:S=Math.max(c,Math.min(1,Math.abs(y[1]-w[1]-C)))/o;const P=d(r*k),L=d(o*S);_=p(...f(P,L));const I=x-_[0],D=E-_[1];this.width=P,this.height=L,this.x=I,this.y=D,this.setDims(i*P,s*L),this.fixAndSetPosition()}function Hn(t){const{isMac:e}=Ut.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}function zn(t){const e=this._uiManager.isSelected(this);let i,s;this._uiManager.setUpDragSession();const n=this._uiManager._signal;e&&(this.div.classList.add("moving"),i={passive:!0,capture:!0,signal:n},(0,p.A)(Mn,this,t.clientX),(0,p.A)(Cn,this,t.clientY),s=t=>{const{clientX:e,clientY:i}=t,[s,n]=this.screenToPageTranslation(e-(0,u.A)(Mn,this),i-(0,u.A)(Cn,this));(0,p.A)(Mn,this,e),(0,p.A)(Cn,this,i),this._uiManager.dragSelectedEditors(s,n)},window.addEventListener("pointermove",s,i));const a=()=>{window.removeEventListener("pointerup",a),window.removeEventListener("blur",a),e&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",s,i)),(0,p.A)(yn,this,!1),this._uiManager.endDragSession()||(0,l.A)(Ln,this,Hn).call(this,t)};window.addEventListener("pointerup",a,{signal:n}),window.addEventListener("blur",a,{signal:n})}function Vn(t){b._resizerKeyboardManager.exec(this,t)}function Un(t){var e;(0,u.A)(kn,this)&&(null===(e=t.relatedTarget)||void 0===e?void 0:e.parentNode)!==(0,u.A)(gn,this)&&(0,l.A)(Ln,this,Xn).call(this)}function Gn(t){(0,p.A)(wn,this,(0,u.A)(kn,this)?t:"")}function qn(t){if((0,u.A)(dn,this))for(const e of(0,u.A)(dn,this))e.tabIndex=t}function Xn(){if((0,p.A)(kn,this,!1),(0,l.A)(Ln,this,qn).call(this,-1),(0,u.A)(fn,this)){const{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=(0,u.A)(fn,this);(0,l.A)(Ln,this,Bn).call(this,t,e,i,s),(0,p.A)(fn,this,null)}}b=In,(0,c.A)(In,"_borderLineWidth",-1),(0,c.A)(In,"_colorManager",new Wi),(0,c.A)(In,"_zIndex",1),(0,c.A)(In,"_telemetryTimeout",1e3);class Kn extends In{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const Yn=3285377520,Qn=4294901760,Jn=65535;class Zn{constructor(t){this.h1=t?4294967295&t:Yn,this.h2=t?4294967295&t:Yn}update(t){let e,i;if("string"===typeof t){e=new Uint8Array(2*t.length),i=0;for(let s=0,n=t.length;s<n;s++){const n=t.charCodeAt(s);n<=255?e[i++]=n:(e[i++]=n>>>8,e[i++]=255&n)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const s=i>>2,n=i-4*s,a=new Uint32Array(e.buffer,0,s);let r=0,o=0,l=this.h1,h=this.h2;const c=3432918353,d=461845907,u=11601,p=13715;for(let A=0;A<s;A++)1&A?(r=a[A],r=r*c&Qn|r*u&Jn,r=r<<15|r>>>17,r=r*d&Qn|r*p&Jn,l^=r,l=l<<13|l>>>19,l=5*l+3864292196):(o=a[A],o=o*c&Qn|o*u&Jn,o=o<<15|o>>>17,o=o*d&Qn|o*p&Jn,h^=o,h=h<<13|h>>>19,h=5*h+3864292196);switch(r=0,n){case 3:r^=e[4*s+2]<<16;case 2:r^=e[4*s+1]<<8;case 1:r^=e[4*s],r=r*c&Qn|r*u&Jn,r=r<<15|r>>>17,r=r*d&Qn|r*p&Jn,1&s?l^=r:h^=r}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&Qn|36045*t&Jn,e=4283543511*e&Qn|(2950163797*(e<<16|t>>>16)&Qn)>>>16,t^=e>>>1,t=444984403*t&Qn|60499*t&Jn,e=3301882366*e&Qn|(3120437893*(e<<16|t>>>16)&Qn)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const $n=Object.freeze({map:null,hash:"",transfer:void 0});var ta=new WeakMap,ea=new WeakMap,ia=new WeakSet;class sa{constructor(){(0,o.A)(this,ia),(0,d.A)(this,ta,!1),(0,d.A)(this,ea,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=(0,u.A)(ea,this).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return(0,u.A)(ea,this).get(t)}remove(t){if((0,u.A)(ea,this).delete(t),0===(0,u.A)(ea,this).size&&this.resetModified(),"function"===typeof this.onAnnotationEditor){for(const t of(0,u.A)(ea,this).values())if(t instanceof In)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=(0,u.A)(ea,this).get(t);let s=!1;if(void 0!==i)for(const[n,a]of Object.entries(e))i[n]!==a&&(s=!0,i[n]=a);else s=!0,(0,u.A)(ea,this).set(t,e);s&&(0,l.A)(ia,this,na).call(this),e instanceof In&&"function"===typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return(0,u.A)(ea,this).has(t)}getAll(){return(0,u.A)(ea,this).size>0?Vt((0,u.A)(ea,this)):null}setAll(t){for(const[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return(0,u.A)(ea,this).size}resetModified(){(0,u.A)(ta,this)&&((0,p.A)(ta,this,!1),"function"===typeof this.onResetModified&&this.onResetModified())}get print(){return new ra(this)}get serializable(){if(0===(0,u.A)(ea,this).size)return $n;const t=new Map,e=new Zn,i=[],s=Object.create(null);let n=!1;for(const[a,r]of(0,u.A)(ea,this)){const i=r instanceof In?r.serialize(!1,s):r;i&&(t.set(a,i),e.update("".concat(a,":").concat(JSON.stringify(i))),n||(n=!!i.bitmap))}if(n)for(const a of t.values())a.bitmap&&i.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:$n}get editorStats(){let t=null;const e=new Map;for(const n of(0,u.A)(ea,this).values()){var i;if(!(n instanceof In))continue;const a=n.telemetryFinalData;if(!a)continue;const{type:r}=a;e.has(r)||e.set(r,Object.getPrototypeOf(n).constructor),t||(t=Object.create(null));const o=(i=t)[r]||(i[r]=new Map);for(const[t,e]of Object.entries(a)){var s;if("type"===t)continue;let i=o.get(t);i||(i=new Map,o.set(t,i));const n=null!==(s=i.get(e))&&void 0!==s?s:0;i.set(e,n+1)}}for(const[n,a]of e)t[n]=a.computeTelemetryFinalData(t[n]);return t}}function na(){(0,u.A)(ta,this)||((0,p.A)(ta,this,!0),"function"===typeof this.onSetModified&&this.onSetModified())}var aa=new WeakMap;class ra extends sa{constructor(t){super(),(0,d.A)(this,aa,void 0);const{map:e,hash:i,transfer:s}=t.serializable,n=structuredClone(e,s?{transfer:s}:null);(0,p.A)(aa,this,{map:n,hash:i,transfer:s})}get print(){Rt("Should not call PrintAnnotationStorage.print")}get serializable(){return(0,u.A)(aa,this)}}var oa=new WeakMap;class la{constructor(t){let{ownerDocument:e=globalThis.document,styleElement:i=null}=t;(0,d.A)(this,oa,new Set),this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),(0,u.A)(oa,this).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,_inspectFont:i}=t;if(e&&!(0,u.A)(oa,this).has(e.loadedName))if(Tt(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:t,src:n,style:a}=e,r=new FontFace(t,n,a);this.addNativeFontFace(r);try{await r.load(),(0,u.A)(oa,this).add(t),null===i||void 0===i||i(e)}catch(s){Ct("Cannot load system font: ".concat(e.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(r)}}else Rt("Not implemented: loadSystemFont without the Font Loading API.")}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw Ct("Failed to load font '".concat(e.family,"': '").concat(i,"'.")),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{const i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var t;return Lt(this,"isFontLoadingAPISupported",!(null===(t=this._document)||void 0===t||!t.fonts))}get isSyncFontLoadingSupported(){var t;let e=!1;return(R||"undefined"!==typeof navigator&&"string"===typeof(null===(t=navigator)||void 0===t?void 0:t.userAgent)&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),Lt(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(t){const{loadingRequests:e}=this,i={done:!1,complete:function(){for(Tt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){const t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(i),i}get _loadTestFont(){return Lt(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function i(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function s(t,e,i,s){return t.substring(0,e)+s+t.substring(e+i)}let n,a;const r=this._document.createElement("canvas");r.width=1,r.height=1;const o=r.getContext("2d");let l=0;const h="lt".concat(Date.now()).concat(this.loadTestFontId++);let c=this._loadTestFont;c=s(c,976,h.length,h);const d=1482184792;let u=i(c,16);for(n=0,a=h.length-3;n<a;n+=4)u=u-d+i(h,n)|0;var p;n<h.length&&(u=u-d+i(h+"XXX",n)|0),c=s(c,16,4,(p=u,String.fromCharCode(p>>24&255,p>>16&255,p>>8&255,255&p)));const A="url(data:font/opentype;base64,".concat(btoa(c),");"),g='@font-face {font-family:"'.concat(h,'";src:').concat(A,"}");this.insertRule(g);const f=this._document.createElement("div");f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px";for(const m of[t.loadedName,h]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=m,f.append(t)}this._document.body.append(f),function t(e,i){if(++l>30)return Ct("Load test font never loaded."),void i();o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i))}(h,()=>{f.remove(),e.complete()})}}class ha{constructor(t,e){let{disableFontFace:i=!1,inspectFont:s=null}=e;this.compiledGlyphs=Object.create(null);for(const n in t)this[n]=t[n];this.disableFontFace=!0===i,this._inspectFont=s}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return null===(t=this._inspectFont)||void 0===t||t.call(this,this),e}createFontFaceRule(){var t;if(!this.data||this.disableFontFace)return null;const e=Ht(this.data),i="url(data:".concat(this.mimetype,";base64,").concat(btoa(e),");");let s;if(this.cssFontInfo){let t="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(t+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),s='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(t,"src:").concat(i,"}")}else s='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(i,"}");return null===(t=this._inspectFont)||void 0===t||t.call(this,this,i),s}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let i;try{i=t.get(this.loadedName+"_path_"+e)}catch(n){Ct('getPathGenerator - ignoring character: "'.concat(n,'".'))}if(!Array.isArray(i)||0===i.length)return this.compiledGlyphs[e]=function(t,e){};const s=[];for(let a=0,r=i.length;a<r;)switch(i[a++]){case $t:{const[t,e,n,r,o,l]=i.slice(a,a+6);s.push(i=>i.bezierCurveTo(t,e,n,r,o,l)),a+=6}break;case te:{const[t,e]=i.slice(a,a+2);s.push(i=>i.moveTo(t,e)),a+=2}break;case ee:{const[t,e]=i.slice(a,a+2);s.push(i=>i.lineTo(t,e)),a+=2}break;case ie:{const[t,e,n,r]=i.slice(a,a+4);s.push(i=>i.quadraticCurveTo(t,e,n,r)),a+=4}break;case se:s.push(t=>t.restore());break;case ne:s.push(t=>t.save());break;case ae:Tt(2===s.length,"Scale command is only valid at the third position.");break;case re:{const[t,e,n,r,o,l]=i.slice(a,a+6);s.push(i=>i.transform(t,e,n,r,o,l)),a+=6}break;case oe:{const[t,e]=i.slice(a,a+2);s.push(i=>i.translate(t,e)),a+=2}}return this.compiledGlyphs[e]=function(t,e){s[0](t),s[1](t),t.scale(e,-e);for(let i=2,n=s.length;i<n;i++)s[i](t)}}}if(R){var ca=Promise.withResolvers(),da=null;(async()=>{const t=await i.e(5902).then(i.t.bind(i,65902,19)),e=await i.e(283).then(i.t.bind(i,283,19)),s=await i.e(4602).then(i.t.bind(i,24602,19)),n=await i.e(1102).then(i.t.bind(i,91102,19));return new Map(Object.entries({fs:t,http:e,https:s,url:n,canvas:undefined,path2d:undefined}))})().then(t=>{da=t,ca.resolve()},t=>{Ct("loadPackages: ".concat(t)),da=new Map,ca.resolve()})}class ua{static get promise(){return ca.promise}static get(t){var e;return null===(e=da)||void 0===e?void 0:e.get(t)}}const pa=function(t){return ua.get("fs").promises.readFile(t).then(t=>new Uint8Array(t))};const Aa="Fill",ga="Stroke",fa="Shading";function ma(t,e){if(!e)return;const i=e[2]-e[0],s=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],i,s),t.clip(n)}class va{constructor(){this.constructor===va&&Rt("Cannot initialize BaseShadingPattern.")}getPattern(){Rt("Abstract method `getPattern` called.")}}class ba extends va{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,s){let n;if(s===ga||s===Aa){const a=e.current.getClippedPathBoundingBox(s,Ze(t))||[0,0,0,0],r=Math.ceil(a[2]-a[0])||1,o=Math.ceil(a[3]-a[1])||1,l=e.cachedCanvases.getCanvas("pattern",r,o,!0),h=l.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-a[0],-a[1]),i=qt.transform(i,[1,0,0,1,a[0],a[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),ma(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),n=t.createPattern(l.canvas,"no-repeat");const c=new DOMMatrix(i);n.setTransform(c)}else ma(t,this._bbox),n=this._createGradient(t);return n}}function wa(t,e,i,s,n,a,r,o){const l=e.coords,h=e.colors,c=t.data,d=4*t.width;let u;l[i+1]>l[s+1]&&(u=i,i=s,s=u,u=a,a=r,r=u),l[s+1]>l[n+1]&&(u=s,s=n,n=u,u=r,r=o,o=u),l[i+1]>l[s+1]&&(u=i,i=s,s=u,u=a,a=r,r=u);const p=(l[i]+e.offsetX)*e.scaleX,A=(l[i+1]+e.offsetY)*e.scaleY,g=(l[s]+e.offsetX)*e.scaleX,f=(l[s+1]+e.offsetY)*e.scaleY,m=(l[n]+e.offsetX)*e.scaleX,v=(l[n+1]+e.offsetY)*e.scaleY;if(A>=v)return;const b=h[a],w=h[a+1],y=h[a+2],_=h[r],x=h[r+1],E=h[r+2],k=h[o],S=h[o+1],M=h[o+2],C=Math.round(A),R=Math.round(v);let T,P,L,I,D,F,O,N;for(let W=C;W<=R;W++){if(W<f){const t=W<A?0:(A-W)/(A-f);T=p-(p-g)*t,P=b-(b-_)*t,L=w-(w-x)*t,I=y-(y-E)*t}else{let t;t=W>v?1:f===v?0:(f-W)/(f-v),T=g-(g-m)*t,P=_-(_-k)*t,L=x-(x-S)*t,I=E-(E-M)*t}let t;t=W<A?0:W>v?1:(A-W)/(A-v),D=p-(p-m)*t,F=b-(b-k)*t,O=w-(w-S)*t,N=y-(y-M)*t;const e=Math.round(Math.min(T,D)),i=Math.round(Math.max(T,D));let s=d*W+4*e;for(let n=e;n<=i;n++)t=(T-n)/(T-D),t<0?t=0:t>1&&(t=1),c[s++]=P-(P-F)*t|0,c[s++]=L-(L-O)*t|0,c[s++]=I-(I-N)*t|0,c[s++]=255}}function ya(t,e,i){const s=e.coords,n=e.colors;let a,r;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(s.length/o)-1,h=o-1;for(a=0;a<l;a++){let e=a*o;for(let a=0;a<h;a++,e++)wa(t,i,s[e],s[e+1],s[e+o],n[e],n[e+1],n[e+o]),wa(t,i,s[e+o+1],s[e+1],s[e+o],n[e+o+1],n[e+1],n[e+o])}break;case"triangles":for(a=0,r=s.length;a<r;a+=3)wa(t,i,s[a],s[a+1],s[a+2],n[a],n[a+1],n[a+2]);break;default:throw new Error("illegal figure")}}class _a extends va{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,i){const s=Math.floor(this._bounds[0]),n=Math.floor(this._bounds[1]),a=Math.ceil(this._bounds[2])-s,r=Math.ceil(this._bounds[3])-n,o=Math.min(Math.ceil(Math.abs(a*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(r*t[1]*1.1)),3e3),h=a/o,c=r/l,d={coords:this._coords,colors:this._colors,offsetX:-s,offsetY:-n,scaleX:1/h,scaleY:1/c},u=o+4,p=l+4,A=i.getCanvas("mesh",u,p,!1),g=A.context,f=g.createImageData(o,l);if(e){const t=f.data;for(let i=0,s=t.length;i<s;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(const m of this._figures)ya(f,m,d);g.putImageData(f,2,2);return{canvas:A.canvas,offsetX:s-2*h,offsetY:n-2*c,scaleX:h,scaleY:c}}getPattern(t,e,i,s){let n;if(ma(t,this._bbox),s===fa)n=qt.singularValueDecompose2dScale(Ze(t));else if(n=qt.singularValueDecompose2dScale(e.baseTransform),this.matrix){const t=qt.singularValueDecompose2dScale(this.matrix);n=[n[0]*t[0],n[1]*t[1]]}const a=this._createMeshCanvas(n,s===fa?null:this._background,e.cachedCanvases);return s!==fa&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY),t.createPattern(a.canvas,"no-repeat")}}class xa extends va{getPattern(){return"hotpink"}}const Ea=1,ka=2;class Sa{constructor(t,e,i,s,n){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=i,this.canvasGraphicsFactory=s,this.baseTransform=n}createPatternCanvas(t){const e=this.operatorList,i=this.bbox,s=this.xstep,n=this.ystep,a=this.paintType,r=this.tilingType,o=this.color,l=this.canvasGraphicsFactory;Mt("TilingType: "+r);const h=i[0],c=i[1],d=i[2],u=i[3],p=qt.singularValueDecompose2dScale(this.matrix),A=qt.singularValueDecompose2dScale(this.baseTransform),g=[p[0]*A[0],p[1]*A[1]],f=this.getSizeAndScale(s,this.ctx.canvas.width,g[0]),m=this.getSizeAndScale(n,this.ctx.canvas.height,g[1]),v=t.cachedCanvases.getCanvas("pattern",f.size,m.size,!0),b=v.context,w=l.createCanvasGraphics(b);w.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(w,a,o);let y=h,_=c,x=d,E=u;return h<0&&(y=0,x+=Math.abs(h)),c<0&&(_=0,E+=Math.abs(c)),b.translate(-f.scale*y,-m.scale*_),w.transform(f.scale,0,0,m.scale,0,0),b.save(),this.clipBbox(w,y,_,x,E),w.baseTransform=Ze(w.ctx),w.executeOperatorList(e),w.endDrawing(),{canvas:v.canvas,scaleX:f.scale,scaleY:m.scale,offsetX:y,offsetY:_}}getSizeAndScale(t,e,i){t=Math.abs(t);const s=Math.max(Sa.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*i);return n>=s?n=s:i=n/t,{scale:i,size:n}}clipBbox(t,e,i,s,n){const a=s-e,r=n-i;t.ctx.rect(e,i,a,r),t.current.updateRectMinMax(Ze(t.ctx),[e,i,s,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const s=t.ctx,n=t.current;switch(e){case Ea:const t=this.ctx;s.fillStyle=t.fillStyle,s.strokeStyle=t.strokeStyle,n.fillColor=t.fillStyle,n.strokeColor=t.strokeStyle;break;case ka:const a=qt.makeHexColor(i[0],i[1],i[2]);s.fillStyle=a,s.strokeStyle=a,n.fillColor=a,n.strokeColor=a;break;default:throw new Bt("Unsupported paint type: ".concat(e))}}getPattern(t,e,i,s){let n=i;s!==fa&&(n=qt.transform(n,e.baseTransform),this.matrix&&(n=qt.transform(n,this.matrix)));const a=this.createPatternCanvas(e);let r=new DOMMatrix(n);r=r.translate(a.offsetX,a.offsetY),r=r.scale(1/a.scaleX,1/a.scaleY);const o=t.createPattern(a.canvas,"repeat");return o.setTransform(r),o}}function Ma(t){let{src:e,srcPos:i=0,dest:s,width:n,height:a,nonBlackColor:r=4294967295,inverseDecode:o=!1}=t;const l=Ut.isLittleEndian?4278190080:255,[h,c]=o?[r,l]:[l,r],d=n>>3,u=7&n,p=e.length;s=new Uint32Array(s.buffer);let A=0;for(let g=0;g<a;g++){for(const n=i+d;i<n;i++){const t=i<p?e[i]:255;s[A++]=128&t?c:h,s[A++]=64&t?c:h,s[A++]=32&t?c:h,s[A++]=16&t?c:h,s[A++]=8&t?c:h,s[A++]=4&t?c:h,s[A++]=2&t?c:h,s[A++]=1&t?c:h}if(0===u)continue;const t=i<p?e[i++]:255;for(let e=0;e<u;e++)s[A++]=t&1<<7-e?c:h}return{srcPos:i,destPos:A}}(0,c.A)(Sa,"MAX_PATTERN_SIZE",3e3);const Ca=16;class Ra{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let s;return void 0!==this.cache[t]?(s=this.cache[t],this.canvasFactory.reset(s,e,i)):(s=this.canvasFactory.create(e,i),this.cache[t]=s),s}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function Ta(t,e,i,s,n,a,r,o,l,h){const[c,d,u,p,A,g]=Ze(t);if(0===d&&0===u){const f=r*c+A,m=Math.round(f),v=o*p+g,b=Math.round(v),w=(r+l)*c+A,y=Math.abs(Math.round(w)-m)||1,_=(o+h)*p+g,x=Math.abs(Math.round(_)-b)||1;return t.setTransform(Math.sign(c),0,0,Math.sign(p),m,b),t.drawImage(e,i,s,n,a,0,0,y,x),t.setTransform(c,d,u,p,A,g),[y,x]}if(0===c&&0===p){const f=o*u+A,m=Math.round(f),v=r*d+g,b=Math.round(v),w=(o+h)*u+A,y=Math.abs(Math.round(w)-m)||1,_=(r+l)*d+g,x=Math.abs(Math.round(_)-b)||1;return t.setTransform(0,Math.sign(d),Math.sign(u),0,m,b),t.drawImage(e,i,s,n,a,0,0,x,y),t.setTransform(c,d,u,p,A,g),[x,y]}t.drawImage(e,i,s,n,a,r,o,l,h);return[Math.hypot(c,d)*l,Math.hypot(u,p)*h]}class Pa{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=T,this.textMatrixScale=1,this.fontMatrix=P,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=U,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,i){[e,i]=qt.applyTransform([e,i],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,e){const i=qt.applyTransform(e,t),s=qt.applyTransform(e.slice(2),t),n=qt.applyTransform([e[0],e[3]],t),a=qt.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],s[0],n[0],a[0]),this.minY=Math.min(this.minY,i[1],s[1],n[1],a[1]),this.maxX=Math.max(this.maxX,i[0],s[0],n[0],a[0]),this.maxY=Math.max(this.maxY,i[1],s[1],n[1],a[1])}updateScalingPathMinMax(t,e){qt.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,i,s,n,a,r,o,l,h){const c=qt.bezierBoundingBox(e,i,s,n,a,r,o,l,h);h||this.updateRectMinMax(t,c)}getPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Aa,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[this.minX,this.minY,this.maxX,this.maxY];if(t===ga){e||Rt("Stroke bounding box must include transform.");const t=qt.singularValueDecompose2dScale(e),s=t[0]*this.lineWidth/2,n=t[1]*this.lineWidth/2;i[0]-=s,i[1]-=n,i[2]+=s,i[3]+=n}return i}updateClipFromPath(){const t=qt.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Aa,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return qt.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function La(t,e){if("undefined"!==typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,s=e.width,n=i%Ca,a=(i-n)/Ca,r=0===n?a:a+1,o=t.createImageData(s,Ca);let l,h=0;const c=e.data,d=o.data;let u,p,A,g;if(e.kind===Q.GRAYSCALE_1BPP){const e=c.byteLength,i=new Uint32Array(d.buffer,0,d.byteLength>>2),g=i.length,f=s+7>>3,m=4294967295,v=Ut.isLittleEndian?4278190080:255;for(u=0;u<r;u++){for(A=u<a?Ca:n,l=0,p=0;p<A;p++){const t=e-h;let n=0;const a=t>f?s:8*t-7,r=-8&a;let o=0,d=0;for(;n<r;n+=8)d=c[h++],i[l++]=128&d?m:v,i[l++]=64&d?m:v,i[l++]=32&d?m:v,i[l++]=16&d?m:v,i[l++]=8&d?m:v,i[l++]=4&d?m:v,i[l++]=2&d?m:v,i[l++]=1&d?m:v;for(;n<a;n++)0===o&&(d=c[h++],o=128),i[l++]=d&o?m:v,o>>=1}for(;l<g;)i[l++]=0;t.putImageData(o,0,u*Ca)}}else if(e.kind===Q.RGBA_32BPP){for(p=0,g=s*Ca*4,u=0;u<a;u++)d.set(c.subarray(h,h+g)),h+=g,t.putImageData(o,0,p),p+=Ca;u<r&&(g=s*n*4,d.set(c.subarray(h,h+g)),t.putImageData(o,0,p))}else{if(e.kind!==Q.RGB_24BPP)throw new Error("bad image kind: ".concat(e.kind));for(A=Ca,g=s*A,u=0;u<r;u++){for(u>=a&&(A=n,g=s*A),l=0,p=g;p--;)d[l++]=c[h++],d[l++]=c[h++],d[l++]=c[h++],d[l++]=255;t.putImageData(o,0,u*Ca)}}}function Ia(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,s=e.width,n=i%Ca,a=(i-n)/Ca,r=0===n?a:a+1,o=t.createImageData(s,Ca);let l=0;const h=e.data,c=o.data;for(let d=0;d<r;d++){const e=d<a?Ca:n;({srcPos:l}=Ma({src:h,srcPos:l,dest:c,width:s,height:e,nonBlackColor:0})),t.putImageData(o,0,d*Ca)}}function Da(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of i)void 0!==t[s]&&(e[s]=t[s]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function Fa(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0),!R){const{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}}function Oa(t,e){if(e)return!0;const i=qt.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*ge.PDF_TO_CSS_UNITS);return i[0]<=s&&i[1]<=s}const Na=["butt","round","square"],Wa=["miter","round","bevel"],Ba={},ja={};var Ha=new WeakSet;class za{constructor(t,e,i,s,n,a,r,l){let{optionalContentConfig:h,markedContentStack:c=null}=a;(0,o.A)(this,Ha),this.ctx=t,this.current=new Pa(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=s,this.filterFactory=n,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=c||[],this.optionalContentConfig=h,this.cachedCanvases=new Ra(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=r,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"===typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let{transform:e,viewport:i,transparency:s=!1,background:n=null}=t;const a=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,a,r),this.ctx.fillStyle=o,s){const t=this.cachedCanvases.getCanvas("transparent",a,r);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...Ze(this.compositeCtx))}this.ctx.save(),Fa(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=Ze(this.ctx)}executeOperatorList(t,e,i,s){const n=t.argsArray,a=t.fnArray;let r=e||0;const o=n.length;if(o===r)return r;const l=o-r>10&&"function"===typeof i,h=l?Date.now()+15:0;let c=0;const d=this.commonObjs,u=this.objs;let p;for(;;){if(void 0!==s&&r===s.nextBreakPoint)return s.breakIt(r,i),r;if(p=a[r],p!==_t.dependency)this[p].apply(this,n[r]);else for(const t of n[r]){const e=t.startsWith("g_")?d:u;if(!e.has(t))return e.get(t,i),r}if(r++,r===o)return r;if(l&&++c>10){if(Date.now()>h)return i(),r;c=0}}}endDrawing(){(0,l.A)(Ha,this,Va).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),(0,l.A)(Ha,this,Ua).call(this)}_scaleImage(t,e){const i=t.width,s=t.height;let n,a,r=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=i,h=s,c="prescale1";for(;r>2&&l>1||o>2&&h>1;){let e=l,i=h;r>2&&l>1&&(e=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),r/=l/e),o>2&&h>1&&(i=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/i),n=this.cachedCanvases.getCanvas(c,e,i),a=n.context,a.clearRect(0,0,e,i),a.drawImage(t,0,0,l,h,0,0,e,i),t=n.canvas,l=e,h=i,c="prescale1"===c?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:h}}_createMaskCanvas(t){const e=this.ctx,{width:i,height:s}=t,n=this.current.fillColor,a=this.current.patternFill,r=Ze(e);let o,l,h,c;if((t.bitmap||t.data)&&t.count>1){const e=t.bitmap||t.data.buffer;l=JSON.stringify(a?r:[r.slice(0,4),n]),o=this._cachedBitmapsMap.get(e),o||(o=new Map,this._cachedBitmapsMap.set(e,o));const i=o.get(l);if(i&&!a){return{canvas:i,offsetX:Math.round(Math.min(r[0],r[2])+r[4]),offsetY:Math.round(Math.min(r[1],r[3])+r[5])}}h=i}h||(c=this.cachedCanvases.getCanvas("maskCanvas",i,s),Ia(c.context,t));let d=qt.transform(r,[1/i,0,0,-1/s,0,0]);d=qt.transform(d,[1,0,0,1,0,-s]);const[u,p,A,g]=qt.getAxialAlignedBoundingBox([0,0,i,s],d),f=Math.round(A-u)||1,m=Math.round(g-p)||1,v=this.cachedCanvases.getCanvas("fillCanvas",f,m),b=v.context,w=u,y=p;b.translate(-w,-y),b.transform(...d),h||(h=this._scaleImage(c.canvas,$e(b)),h=h.img,o&&a&&o.set(l,h)),b.imageSmoothingEnabled=Oa(Ze(b),t.interpolate),Ta(b,h,0,0,h.width,h.height,0,0,i,s),b.globalCompositeOperation="source-in";const _=qt.transform($e(b),[1,0,0,1,-w,-y]);return b.fillStyle=a?n.getPattern(e,this,_,Aa):n,b.fillRect(0,0,i,s),o&&!a&&(this.cachedCanvases.delete("fillCanvas"),o.set(l,v.canvas)),{canvas:v.canvas,offsetX:Math.round(w),offsetY:Math.round(y)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=Na[t]}setLineJoin(t){this.ctx.lineJoin=Wa[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,i]of t)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(i,t,e);this.suspendedCtx=this.ctx,this.ctx=s.context;const n=this.ctx;n.setTransform(...Ze(this.suspendedCtx)),Da(this.suspendedCtx,n),function(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,s,n,a,r){e.transform(t,i,s,n,a,r),this.__originalTransform(t,i,s,n,a,r)},t.setTransform=function(t,i,s,n,a,r){e.setTransform(t,i,s,n,a,r),this.__originalSetTransform(t,i,s,n,a,r)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,s,n,a,r){e.bezierCurveTo(t,i,s,n,a,r),this.__originalBezierCurveTo(t,i,s,n,a,r)},t.rect=function(t,i,s,n){e.rect(t,i,s,n),this.__originalRect(t,i,s,n)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(n,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Da(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,i,s){const n=s[0],a=s[1],r=s[2]-n,o=s[3]-a;0!==r&&0!==o&&(this.genericComposeSMask(e.context,i,r,o,e.subtype,e.backdrop,e.transferMap,n,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,s,n,a,r,o,l,h,c){let d=t.canvas,u=o-h,p=l-c;if(a)if(u<0||p<0||u+i>d.width||p+s>d.height){const t=this.cachedCanvases.getCanvas("maskExtension",i,s),e=t.context;e.drawImage(d,-u,-p),a.some(t=>0!==t)&&(e.globalCompositeOperation="destination-atop",e.fillStyle=qt.makeHexColor(...a),e.fillRect(0,0,i,s),e.globalCompositeOperation="source-over"),d=t.canvas,u=p=0}else if(a.some(t=>0!==t)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const e=new Path2D;e.rect(u,p,i,s),t.clip(e),t.globalCompositeOperation="destination-atop",t.fillStyle=qt.makeHexColor(...a),t.fillRect(u,p,i,s),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===n&&r?e.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===n&&(e.filter=this.filterFactory.addLuminosityFilter(r));const A=new Path2D;A.rect(o,l,i,s),e.clip(A),e.globalCompositeOperation="destination-in",e.drawImage(d,u,p,i,s,o,l,i,s),e.restore()}save(){this.inSMaskMode?(Da(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Da(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,s,n,a){this.ctx.transform(t,e,i,s,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){const s=this.ctx,n=this.current;let a,r,o=n.x,l=n.y;const h=Ze(s),c=0===h[0]&&0===h[3]||0===h[1]&&0===h[2],d=c?i.slice(0):null;for(let u=0,p=0,A=t.length;u<A;u++)switch(0|t[u]){case _t.rectangle:o=e[p++],l=e[p++];const t=e[p++],i=e[p++],u=o+t,A=l+i;s.moveTo(o,l),0===t||0===i?s.lineTo(u,A):(s.lineTo(u,l),s.lineTo(u,A),s.lineTo(o,A)),c||n.updateRectMinMax(h,[o,l,u,A]),s.closePath();break;case _t.moveTo:o=e[p++],l=e[p++],s.moveTo(o,l),c||n.updatePathMinMax(h,o,l);break;case _t.lineTo:o=e[p++],l=e[p++],s.lineTo(o,l),c||n.updatePathMinMax(h,o,l);break;case _t.curveTo:a=o,r=l,o=e[p+4],l=e[p+5],s.bezierCurveTo(e[p],e[p+1],e[p+2],e[p+3],o,l),n.updateCurvePathMinMax(h,a,r,e[p],e[p+1],e[p+2],e[p+3],o,l,d),p+=6;break;case _t.curveTo2:a=o,r=l,s.bezierCurveTo(o,l,e[p],e[p+1],e[p+2],e[p+3]),n.updateCurvePathMinMax(h,a,r,o,l,e[p],e[p+1],e[p+2],e[p+3],d),o=e[p+2],l=e[p+3],p+=4;break;case _t.curveTo3:a=o,r=l,o=e[p+2],l=e[p+3],s.bezierCurveTo(e[p],e[p+1],o,l,o,l),n.updateCurvePathMinMax(h,a,r,e[p],e[p+1],o,l,o,l,d),p+=4;break;case _t.closePath:s.closePath()}c&&n.updateScalingPathMinMax(h,d),n.setCurrentPoint(o,l)}closePath(){this.ctx.closePath()}stroke(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"===typeof i&&null!==i&&void 0!==i&&i.getPattern?(e.save(),e.strokeStyle=i.getPattern(e,this,$e(e),ga),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.ctx,i=this.current.fillColor;let s=!1;this.current.patternFill&&(e.save(),e.fillStyle=i.getPattern(e,this,$e(e),Aa),s=!0);const n=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==n&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),s&&e.restore(),t&&this.consumePath(n)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=Ba}eoClip(){this.pendingClip=ja}beginText(){this.current.textMatrix=T,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(void 0!==t){e.save(),e.beginPath();for(const i of t)e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}else e.beginPath()}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var i;const s=this.commonObjs.get(t),n=this.current;if(!s)throw new Error("Can't find font for ".concat(t));if(n.fontMatrix=s.fontMatrix||P,0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||Ct("Invalid font matrix for font "+t),e<0?(e=-e,n.fontDirection=-1):n.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;const a=s.loadedName||"sans-serif",r=(null===(i=s.systemFontInfo)||void 0===i?void 0:i.css)||'"'.concat(a,'", ').concat(s.fallbackName);let o="normal";s.black?o="900":s.bold&&(o="bold");const l=s.italic?"italic":"normal";let h=e;e<16?h=16:e>100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font="".concat(l," ").concat(o," ").concat(h,"px ").concat(r)}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,i,s,n,a){this.current.textMatrix=[t,e,i,s,n,a],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,s){const n=this.ctx,a=this.current,r=a.font,o=a.textRenderingMode,l=a.fontSize/a.fontSizeScale,h=o&K,c=!!(o&Y),d=a.patternFill&&!r.missingFile;let u;if((r.disableFontFace||c||d)&&(u=r.getPathGenerator(this.commonObjs,t)),r.disableFontFace||d?(n.save(),n.translate(e,i),n.beginPath(),u(n,l),s&&n.setTransform(...s),h!==U&&h!==q||n.fill(),h!==G&&h!==q||n.stroke(),n.restore()):(h!==U&&h!==q||n.fillText(t,e,i),h!==G&&h!==q||n.strokeText(t,e,i)),c){(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ze(n),x:e,y:i,fontSize:l,addToPath:u})}}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let i=!1;for(let s=3;s<e.length;s+=4)if(e[s]>0&&e[s]<255){i=!0;break}return Lt(this,"isFontSubpixelAAEnabled",i)}showText(t){const e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(t);const s=e.fontSize;if(0===s)return;const n=this.ctx,a=e.fontSizeScale,r=e.charSpacing,o=e.wordSpacing,l=e.fontDirection,h=e.textHScale*l,c=t.length,d=i.vertical,u=d?1:-1,p=i.defaultVMetrics,A=s*e.fontMatrix[0],g=e.textRenderingMode===U&&!i.disableFontFace&&!e.patternFill;let f;if(n.save(),n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),l>0?n.scale(h,-1):n.scale(h,1),e.patternFill){n.save();const t=e.fillColor.getPattern(n,this,$e(n),Aa);f=Ze(n),n.restore(),n.fillStyle=t}let m=e.lineWidth;const v=e.textMatrixScale;if(0===v||0===m){const t=e.textRenderingMode&K;t!==G&&t!==q||(m=this.getSinglePixelWidth())}else m/=v;if(1!==a&&(n.scale(a,a),m/=a),n.lineWidth=m,i.isInvalidPDFjsFont){const i=[];let s=0;for(const e of t)i.push(e.unicode),s+=e.width;return n.fillText(i.join(""),0,0),e.x+=s*A*h,n.restore(),void this.compose()}let b,w=0;for(b=0;b<c;++b){const e=t[b];if("number"===typeof e){w+=u*e*s/1e3;continue}let h=!1;const c=(e.isSpace?o:0)+r,m=e.fontChar,v=e.accent;let y,_,x=e.width;if(d){const t=e.vmetric||p,i=-(e.vmetric?t[1]:.5*x)*A,s=t[2]*A;x=t?-t[0]:x,y=i/a,_=(w+s)/a}else y=w/a,_=0;if(i.remeasure&&x>0){const t=1e3*n.measureText(m).width/s*a;if(x<t&&this.isFontSubpixelAAEnabled){const e=x/t;h=!0,n.save(),n.scale(e,1),y/=e}else x!==t&&(y+=(x-t)/2e3*s/a)}if(this.contentVisible&&(e.isInFont||i.missingFile))if(g&&!v)n.fillText(m,y,_);else if(this.paintChar(m,y,_,f),v){const t=y+s*v.offset.x/a,e=_-s*v.offset.y/a;this.paintChar(v.fontChar,t,e,f)}w+=d?x*A-c*l:x*A+c*l,h&&n.restore()}d?e.y-=w:e.x+=w*h,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,i=this.current,s=i.font,n=i.fontSize,a=i.fontDirection,r=s.vertical?1:-1,o=i.charSpacing,l=i.wordSpacing,h=i.textHScale*a,c=i.fontMatrix||P,d=t.length;let u,p,A,g;if(!(i.textRenderingMode===X)&&0!==n){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...i.textMatrix),e.translate(i.x,i.y),e.scale(h,a),u=0;u<d;++u){if(p=t[u],"number"===typeof p){g=r*p*n/1e3,this.ctx.translate(g,0),i.x+=g*h;continue}const a=(p.isSpace?l:0)+o,d=s.charProcOperatorList[p.operatorListId];if(!d){Ct('Type3 character "'.concat(p.operatorListId,'" is not available.'));continue}this.contentVisible&&(this.processingType3=p,this.save(),e.scale(n,n),e.transform(...c),this.executeOperatorList(d),this.restore());A=qt.applyTransform([p.width,0],c)[0]*n+a,e.translate(A,0),i.x+=A*h}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,i,s,n,a){this.ctx.rect(i,s,n-i,a-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){const i=t[1],s=this.baseTransform||Ze(this.ctx),n={createCanvasGraphics:t=>new za(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Sa(t,i,this.ctx,n,s)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){const s=qt.makeHexColor(t,e,i);this.ctx.strokeStyle=s,this.current.strokeColor=s}setFillRGBColor(t,e,i){const s=qt.makeHexColor(t,e,i);this.ctx.fillStyle=s,this.current.fillColor=s,this.current.patternFill=!1}_getPattern(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(t)?e=this.cachedPatterns.get(t):(e=function(t){switch(t[0]){case"RadialAxial":return new ba(t);case"Mesh":return new _a(t);case"Dummy":return new xa}throw new Error("Unknown IR type: ".concat(t[0]))}(this.getObject(t)),this.cachedPatterns.set(t,e)),i&&(e.matrix=i),e}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,$e(e),fa);const s=$e(e);if(s){const{width:t,height:i}=e.canvas,[n,a,r,o]=qt.getAxialAlignedBoundingBox([0,0,t,i],s);this.ctx.fillRect(n,a,r-n,o-a)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Rt("Should not call beginInlineImage")}beginImageData(){Rt("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Ze(this.ctx),e)){const t=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],t,i),this.current.updateRectMinMax(Ze(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||Mt("TODO: Support non-isolated groups."),t.knockout&&Ct("Knockout groups not supported.");const i=Ze(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let s=qt.getAxialAlignedBoundingBox(t.bbox,Ze(e));const n=[0,0,e.canvas.width,e.canvas.height];s=qt.intersect(s,n)||[0,0,0,0];const a=Math.floor(s[0]),r=Math.floor(s[1]),o=Math.max(Math.ceil(s[2])-a,1),l=Math.max(Math.ceil(s[3])-r,1);this.current.startNewPathAndClipBox([0,0,o,l]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const c=this.cachedCanvases.getCanvas(h,o,l),d=c.context;d.translate(-a,-r),d.transform(...i),t.smask?this.smaskStack.push({canvas:c.canvas,context:d,offsetX:a,offsetY:r,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,r),e.save()),Da(e,d),this.ctx=d,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const t=Ze(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);const i=qt.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,s,n){if((0,l.A)(Ha,this,Va).call(this),Fa(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const s=e[2]-e[0],a=e[3]-e[1];if(n&&this.annotationCanvasMap){(i=i.slice())[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=s,e[3]=a;const[n,r]=qt.singularValueDecompose2dScale(Ze(this.ctx)),{viewportScale:o}=this,l=Math.ceil(s*this.outputScaleX*o),h=Math.ceil(a*this.outputScaleY*o);this.annotationCanvas=this.canvasFactory.create(l,h);const{canvas:c,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(t,c),this.annotationCanvas.savedCtx=this.ctx,this.ctx=d,this.ctx.save(),this.ctx.setTransform(n,0,0,-r,0,a*r),Fa(this.ctx)}else Fa(this.ctx),this.ctx.rect(e[0],e[1],s,a),this.ctx.clip(),this.endPath()}this.current=new Pa(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),(0,l.A)(Ha,this,Ua).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;(t=this.getObject(t.data,t)).count=e;const i=this.ctx,s=this.processingType3;if(s&&(void 0===s.compiled&&(s.compiled=function(t){const{width:e,height:i}=t;if(e>1e3||i>1e3)return null;const s=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=e+1;let a,r,o,l=new Uint8Array(n*(i+1));const h=e+7&-8;let c=new Uint8Array(h*i),d=0;for(const g of t.data){let t=128;for(;t>0;)c[d++]=g&t?0:255,t>>=1}let u=0;for(d=0,0!==c[d]&&(l[0]=1,++u),r=1;r<e;r++)c[d]!==c[d+1]&&(l[r]=c[d]?2:1,++u),d++;for(0!==c[d]&&(l[r]=2,++u),a=1;a<i;a++){d=a*h,o=a*n,c[d-h]!==c[d]&&(l[o]=c[d]?1:8,++u);let t=(c[d]?4:0)+(c[d-h]?8:0);for(r=1;r<e;r++)t=(t>>2)+(c[d+1]?4:0)+(c[d-h+1]?8:0),s[t]&&(l[o+r]=s[t],++u),d++;if(c[d-h]!==c[d]&&(l[o+r]=c[d]?2:4,++u),u>1e3)return null}for(d=h*(i-1),o=a*n,0!==c[d]&&(l[o]=8,++u),r=1;r<e;r++)c[d]!==c[d+1]&&(l[o+r]=c[d]?4:8,++u),d++;if(0!==c[d]&&(l[o+r]=4,++u),u>1e3)return null;const p=new Int32Array([0,n,-1,0,-n,0,0,0,1]),A=new Path2D;for(a=0;u&&a<=i;a++){let t=a*n;const i=t+e;for(;t<i&&!l[t];)t++;if(t===i)continue;A.moveTo(t%n,a);const s=t;let r=l[t];do{const e=p[r];do{t+=e}while(!l[t]);const i=l[t];5!==i&&10!==i?(r=i,l[t]=0):(r=i&51*r>>4,l[t]&=r>>2|r<<2),A.lineTo(t%n,t/n|0),l[t]||--u}while(s!==t);--a}return c=null,l=null,function(t){t.save(),t.scale(1/e,-1/i),t.translate(0,-i),t.fill(A),t.beginPath(),t.restore()}}(t)),s.compiled))return void s.compiled(i);const n=this._createMaskCanvas(t),a=n.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,n.offsetX,n.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;t=this.getObject(t.data,t);const r=this.ctx;r.save();const o=Ze(r);r.transform(e,i,s,n,0,0);const l=this._createMaskCanvas(t);r.setTransform(1,0,0,1,l.offsetX-o[4],l.offsetY-o[5]);for(let h=0,c=a.length;h<c;h+=2){const t=qt.transform(o,[e,i,s,n,a[h],a[h+1]]),[c,d]=qt.applyTransform([0,0],t);r.drawImage(l.canvas,c,d)}r.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;for(const n of t){const{data:t,width:a,height:r,transform:o}=n,l=this.cachedCanvases.getCanvas("maskCanvas",a,r),h=l.context;h.save();Ia(h,this.getObject(t,n)),h.globalCompositeOperation="source-in",h.fillStyle=s?i.getPattern(h,this,$e(e),Aa):i,h.fillRect(0,0,a,r),h.restore(),e.save(),e.transform(...o),e.scale(1,-1),Ta(e,l.canvas,0,0,a,r,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):Ct("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,s){if(!this.contentVisible)return;const n=this.getObject(t);if(!n)return void Ct("Dependent image isn't ready yet");const a=n.width,r=n.height,o=[];for(let l=0,h=s.length;l<h;l+=2)o.push({transform:[e,0,0,i,s[l],s[l+1]],x:0,y:0,w:a,h:r});this.paintInlineImageXObjectGroup(n,o)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;const{bitmap:e,width:i,height:s}=t,n=this.cachedCanvases.getCanvas("inlineImage",i,s),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,i=t.height,s=this.ctx;if(this.save(),!R){const{filter:t}=s;"none"!==t&&""!==t&&(s.filter="none")}let n;if(s.scale(1/e,-1/i),t.bitmap)n=this.applyTransferMapsToBitmap(t);else if("function"===typeof HTMLElement&&t instanceof HTMLElement||!t.data)n=t;else{const s=this.cachedCanvases.getCanvas("inlineImage",e,i).context;La(s,t),n=this.applyTransferMapsToCanvas(s)}const a=this._scaleImage(n,$e(s));s.imageSmoothingEnabled=Oa(Ze(s),t.interpolate),Ta(s,a.img,0,0,a.paintWidth,a.paintHeight,0,-i,e,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const i=this.ctx;let s;if(t.bitmap)s=t.bitmap;else{const e=t.width,i=t.height,n=this.cachedCanvases.getCanvas("inlineImage",e,i).context;La(n,t),s=this.applyTransferMapsToCanvas(n)}for(const n of e)i.save(),i.transform(...n.transform),i.scale(1,-1),Ta(i,s,n.x,n.y,n.w,n.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const i=this.ctx;this.pendingClip&&(e||(this.pendingClip===ja?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Ze(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:i,c:s,d:n}=this.ctx.getTransform();let a,r;if(0===i&&0===s){const i=Math.abs(e),s=Math.abs(n);if(i===s)if(0===t)a=r=1/i;else{const e=i*t;a=r=e<1?1/e:1}else if(0===t)a=1/i,r=1/s;else{const e=i*t,n=s*t;a=e<1?1/e:1,r=n<1?1/n:1}}else{const o=Math.abs(e*n-i*s),l=Math.hypot(e,i),h=Math.hypot(s,n);if(0===t)a=h/o,r=l/o;else{const e=t*o;a=h>e?h/e:1,r=l>e?l/e:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=r}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:i}=this.current,[s,n]=this.getScaleForStroking();if(e.lineWidth=i||1,1===s&&1===n)return void e.stroke();const a=e.getLineDash();if(t&&e.save(),e.scale(s,n),a.length>0){const t=Math.max(s,n);e.setLineDash(a.map(e=>e/t)),e.lineDashOffset/=t}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}function Va(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}function Ua(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}for(const pf in _t)void 0!==za.prototype[pf]&&(za.prototype[_t[pf]]=za.prototype[pf]);class Ga{static get workerPort(){return(0,l.A)(Ga,this,qa)._}static set workerPort(t){if(!("undefined"!==typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");qa._=(0,l.A)(Ga,this,t)}static get workerSrc(){return(0,l.A)(Ga,this,Xa)._}static set workerSrc(t){if("string"!==typeof t)throw new Error("Invalid `workerSrc` type.");Xa._=(0,l.A)(Ga,this,t)}}var qa={_:null},Xa={_:""};const Ka=1,Ya=2,Qa=1,Ja=2,Za=3,$a=4,tr=5,er=6,ir=7,sr=8;function nr(t){switch(t instanceof Error||"object"===typeof t&&null!==t||Rt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new jt(t.message);case"MissingPDFException":return new Nt(t.message);case"PasswordException":return new Dt(t.message,t.code);case"UnexpectedResponseException":return new Wt(t.message,t.status);case"UnknownErrorException":return new Ft(t.message,t.details);default:return new Ft(t.message,t.toString())}}var ar=new WeakSet;class rr{constructor(t,e,i){(0,o.A)(this,ar),this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=t=>{const e=t.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void(0,l.A)(ar,this,lr).call(this,e);if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error("Cannot resolve callback ".concat(t));if(delete this.callbackCapabilities[t],e.callback===Ka)i.resolve(e.data);else{if(e.callback!==Ya)throw new Error("Unexpected callback case");i.reject(nr(e.reason))}return}const s=this.actionHandler[e.action];if(!s)throw new Error("Unknown action from worker: ".concat(e.action));if(e.callbackId){const t=this.sourceName,n=e.sourceName;new Promise(function(t){t(s(e.data))}).then(function(s){i.postMessage({sourceName:t,targetName:n,callback:Ka,callbackId:e.callbackId,data:s})},function(s){i.postMessage({sourceName:t,targetName:n,callback:Ya,callbackId:e.callbackId,reason:nr(s)})})}else e.streamId?(0,l.A)(ar,this,or).call(this,e):s(e.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,e){const i=this.actionHandler;if(i[t])throw new Error('There is already an actionName called "'.concat(t,'"'));i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const s=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[s]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,i,s){const n=this.streamId++,a=this.sourceName,r=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{const l=Promise.withResolvers();return this.streamControllers[n]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:a,targetName:r,action:t,streamId:n,data:e,desiredSize:i.desiredSize},s),l.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[n].pullCall=e,o.postMessage({sourceName:a,targetName:r,stream:er,streamId:n,desiredSize:t.desiredSize}),e.promise},cancel:t=>{Tt(t instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[n].cancelCall=e,this.streamControllers[n].isClosed=!0,o.postMessage({sourceName:a,targetName:r,stream:Qa,streamId:n,reason:nr(t)}),e.promise}},i)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}function or(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this,r=this.actionHandler[t.action],o={enqueue(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const o=this.desiredSize;this.desiredSize-=a,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:i,targetName:s,stream:$a,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:Za,streamId:e}),delete a.streamSinks[e])},error(t){Tt(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:tr,streamId:e,reason:nr(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,new Promise(function(e){e(r(t.data,o))}).then(function(){n.postMessage({sourceName:i,targetName:s,stream:sr,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:s,stream:sr,streamId:e,reason:nr(t)})})}function lr(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,a=this.streamControllers[e],r=this.streamSinks[e];switch(t.stream){case sr:t.success?a.startCall.resolve():a.startCall.reject(nr(t.reason));break;case ir:t.success?a.pullCall.resolve():a.pullCall.reject(nr(t.reason));break;case er:if(!r){n.postMessage({sourceName:i,targetName:s,stream:ir,streamId:e,success:!0});break}r.desiredSize<=0&&t.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=t.desiredSize,new Promise(function(t){var e;t(null===(e=r.onPull)||void 0===e?void 0:e.call(r))}).then(function(){n.postMessage({sourceName:i,targetName:s,stream:ir,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:s,stream:ir,streamId:e,reason:nr(t)})});break;case $a:if(Tt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case Za:if(Tt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),(0,l.A)(ar,this,hr).call(this,a,e);break;case tr:Tt(a,"error should have stream controller"),a.controller.error(nr(t.reason)),(0,l.A)(ar,this,hr).call(this,a,e);break;case Ja:t.success?a.cancelCall.resolve():a.cancelCall.reject(nr(t.reason)),(0,l.A)(ar,this,hr).call(this,a,e);break;case Qa:if(!r)break;new Promise(function(e){var i;e(null===(i=r.onCancel)||void 0===i?void 0:i.call(r,nr(t.reason)))}).then(function(){n.postMessage({sourceName:i,targetName:s,stream:Ja,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:s,stream:Ja,streamId:e,reason:nr(t)})}),r.sinkCapability.reject(nr(t.reason)),r.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async function hr(t,e){var i,s,n;await Promise.allSettled([null===(i=t.startCall)||void 0===i?void 0:i.promise,null===(s=t.pullCall)||void 0===s?void 0:s.promise,null===(n=t.cancelCall)||void 0===n?void 0:n.promise]),delete this.streamControllers[e]}var cr=new WeakMap,dr=new WeakMap;class ur{constructor(t){let{parsedData:e,rawData:i}=t;(0,d.A)(this,cr,void 0),(0,d.A)(this,dr,void 0),(0,p.A)(cr,this,e),(0,p.A)(dr,this,i)}getRaw(){return(0,u.A)(dr,this)}get(t){var e;return null!==(e=(0,u.A)(cr,this).get(t))&&void 0!==e?e:null}getAll(){return Vt((0,u.A)(cr,this))}has(t){return(0,u.A)(cr,this).has(t)}}const pr=Symbol("INTERNAL");var Ar=new WeakMap,gr=new WeakMap,fr=new WeakMap,mr=new WeakMap;class vr{constructor(t,e){let{name:i,intent:s,usage:n}=e;(0,d.A)(this,Ar,!1),(0,d.A)(this,gr,!1),(0,d.A)(this,fr,!1),(0,d.A)(this,mr,!0),(0,p.A)(Ar,this,!!(t&D)),(0,p.A)(gr,this,!!(t&F)),this.name=i,this.intent=s,this.usage=n}get visible(){if((0,u.A)(fr,this))return(0,u.A)(mr,this);if(!(0,u.A)(mr,this))return!1;const{print:t,view:e}=this.usage;return(0,u.A)(Ar,this)?"OFF"!==(null===e||void 0===e?void 0:e.viewState):!(0,u.A)(gr,this)||"OFF"!==(null===t||void 0===t?void 0:t.printState)}_setVisible(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t!==pr&&Rt("Internal method `_setVisible` called."),(0,p.A)(fr,this,i),(0,p.A)(mr,this,e)}}var br=new WeakMap,wr=new WeakMap,yr=new WeakMap,_r=new WeakMap,xr=new WeakSet;class Er{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D;if((0,o.A)(this,xr),(0,d.A)(this,br,null),(0,d.A)(this,wr,new Map),(0,d.A)(this,yr,null),(0,d.A)(this,_r,null),this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,(0,p.A)(_r,this,t.order);for(const i of t.groups)(0,u.A)(wr,this).set(i.id,new vr(e,i));if("OFF"===t.baseState)for(const t of(0,u.A)(wr,this).values())t._setVisible(pr,!1);for(const e of t.on)(0,u.A)(wr,this).get(e)._setVisible(pr,!0);for(const e of t.off)(0,u.A)(wr,this).get(e)._setVisible(pr,!1);(0,p.A)(yr,this,this.getHash())}}isVisible(t){if(0===(0,u.A)(wr,this).size)return!0;if(!t)return Mt("Optional content group not defined."),!0;if("OCG"===t.type)return(0,u.A)(wr,this).has(t.id)?(0,u.A)(wr,this).get(t.id).visible:(Ct("Optional content group not found: ".concat(t.id)),!0);if("OCMD"===t.type){if(t.expression)return(0,l.A)(xr,this,kr).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!(0,u.A)(wr,this).has(e))return Ct("Optional content group not found: ".concat(e)),!0;if((0,u.A)(wr,this).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!(0,u.A)(wr,this).has(e))return Ct("Optional content group not found: ".concat(e)),!0;if(!(0,u.A)(wr,this).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!(0,u.A)(wr,this).has(e))return Ct("Optional content group not found: ".concat(e)),!0;if(!(0,u.A)(wr,this).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!(0,u.A)(wr,this).has(e))return Ct("Optional content group not found: ".concat(e)),!0;if((0,u.A)(wr,this).get(e).visible)return!1}return!0}return Ct("Unknown optional content policy ".concat(t.policy,".")),!0}return Ct("Unknown group type ".concat(t.type,".")),!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=(0,u.A)(wr,this).get(t);i?(i._setVisible(pr,!!e,!0),(0,p.A)(br,this,null)):Ct("Optional content group not found: ".concat(t))}setOCGState(t){let e,{state:i,preserveRB:s}=t;for(const n of i){switch(n){case"ON":case"OFF":case"Toggle":e=n;continue}const t=(0,u.A)(wr,this).get(n);if(t)switch(e){case"ON":t._setVisible(pr,!0);break;case"OFF":t._setVisible(pr,!1);break;case"Toggle":t._setVisible(pr,!t.visible)}}(0,p.A)(br,this,null)}get hasInitialVisibility(){return null===(0,u.A)(yr,this)||this.getHash()===(0,u.A)(yr,this)}getOrder(){return(0,u.A)(wr,this).size?(0,u.A)(_r,this)?(0,u.A)(_r,this).slice():[...(0,u.A)(wr,this).keys()]:null}getGroups(){return(0,u.A)(wr,this).size>0?Vt((0,u.A)(wr,this)):null}getGroup(t){return(0,u.A)(wr,this).get(t)||null}getHash(){if(null!==(0,u.A)(br,this))return(0,u.A)(br,this);const t=new Zn;for(const[e,i]of(0,u.A)(wr,this))t.update("".concat(e,":").concat(i.visible));return(0,p.A)(br,this,t.hexdigest())}}function kr(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let s=1;s<e;s++){const e=t[s];let n;if(Array.isArray(e))n=(0,l.A)(xr,this,kr).call(this,e);else{if(!(0,u.A)(wr,this).has(e))return Ct("Optional content group not found: ".concat(e)),!0;n=(0,u.A)(wr,this).get(e).visible}switch(i){case"And":if(!n)return!1;break;case"Or":if(n)return!0;break;case"Not":return!n;default:return!0}}return"And"===i}class Sr{constructor(t,e){let{disableRange:i=!1,disableStream:s=!1}=e;Tt(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:a,progressiveDone:r,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=o,(null===a||void 0===a?void 0:a.length)>0){const t=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!i,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),t.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),t.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData(t){let{begin:e,chunk:i}=t;const s=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{Tt(this._rangeReaders.some(function(t){return t._begin===e&&(t._enqueue(s),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}_onProgress(t){var e,i,s,n;void 0===t.total?null===(e=this._rangeReaders[0])||void 0===e||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded}):null===(s=this._fullRequestReader)||void 0===s||null===(n=s.onProgress)||void 0===n||n.call(s,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;null===(t=this._fullRequestReader)||void 0===t||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){Tt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new Mr(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Cr(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeReaders.slice(0))i.cancel(t);this._pdfDataRangeTransport.abort()}}class Mr{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=t,this._done=i||!1,this._filename=He(s)?s:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunks.push(t);this._loaded+=t.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Cr{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Rr(t){let{getResponseHeader:e,isHttp:i,rangeChunkSize:s,disableRange:n}=t;const a={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e("Content-Length"),10);if(!Number.isInteger(r))return a;if(a.suggestedLength=r,r<=2*s)return a;if(n||!i)return a;if("bytes"!==e("Accept-Ranges"))return a;return"identity"!==(e("Content-Encoding")||"identity")||(a.allowRangeRequests=!0),a}function Tr(t){const e=t("Content-Disposition");if(e){let t=function(t){let e=!0,i=s("filename\\*","i").exec(t);if(i){i=i[1];let t=r(i);return t=unescape(t),t=o(t),t=l(t),a(t)}if(i=function(t){const e=[];let i;const n=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=n.exec(t));){let[,t,s,n]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[s,n]}const a=[];for(let s=0;s<e.length&&s in e;++s){let[t,i]=e[s];i=r(i),t&&(i=unescape(i),0===s&&(i=o(i))),a.push(i)}return a.join("")}(t),i)return a(l(i));if(i=s("filename","i").exec(t),i){i=i[1];let t=r(i);return t=l(t),a(t)}function s(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function n(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const s=new TextDecoder(t,{fatal:!0}),n=zt(i);i=s.decode(n),e=!1}catch(s){}}return i}function a(t){return e&&/[\x80-\xff]/.test(t)&&(t=n("utf-8",t),e&&(t=n("iso-8859-1",t))),t}function r(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){const e=t.indexOf("'");return-1===e?t:n(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,i,s){if("q"===i||"Q"===i)return n(e,s=(s=s.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{s=atob(s)}catch(a){}return n(e,s)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(i){}if(He(t))return t}return null}function Pr(t,e){return 404===t||0===t&&e.startsWith("file:")?new Nt('Missing PDF "'+e+'".'):new Wt("Unexpected server response (".concat(t,') while retrieving PDF "').concat(e,'".'),t)}function Lr(t){return 200===t||206===t}function Ir(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function Dr(t){const e=new Headers;for(const i in t){const s=t[i];void 0!==s&&e.append(i,s)}return e}function Fr(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Ct("getArrayBuffer - unexpected data format: ".concat(t)),new Uint8Array(t).buffer)}class Or{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return Tt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Nr(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Wr(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class Nr{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._headers=Dr(this._stream.httpHeaders);const i=e.url;fetch(i,Ir(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!Lr(t.status))throw Pr(t.status,i);this._reader=t.body.getReader(),this._headersCapability.resolve();const e=e=>t.headers.get(e),{allowRangeRequests:s,suggestedLength:n}=Rr({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=n||this._contentLength,this._filename=Tr(e),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new jt("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:Fr(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class Wr{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController,this._headers=Dr(this._stream.httpHeaders),this._headers.append("Range","bytes=".concat(e,"-").concat(i-1));const n=s.url;fetch(n,Ir(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!Lr(t.status))throw Pr(t.status,n);this._readCapability.resolve(),this._reader=t.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),{value:Fr(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}}class Br{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&e.httpHeaders||Object.create(null),this.withCredentials=e.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,i){const s={begin:t,end:e};for(const n in i)s[n]=i[n];return this.request(s)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,s=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const n in this.httpHeaders){const t=this.httpHeaders[n];void 0!==t&&e.setRequestHeader(n,t)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range","bytes=".concat(t.begin,"-").concat(t.end-1)),s.expectedStatus=206):s.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(i){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),s.onHeadersReceived=t.onHeadersReceived,s.onDone=t.onDone,s.onError=t.onError,s.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;const s=this.pendingRequests[t];s&&(null===(i=s.onProgress)||void 0===i||i.call(s,e))}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const s=i.xhr;if(s.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==s.readyState)return;if(!(t in this.pendingRequests))return;var n;if(delete this.pendingRequests[t],0===s.status&&this.isHttp)return void(null===(n=i.onError)||void 0===n||n.call(i,s.status));const a=s.status||200;var r;if(!(200===a&&206===i.expectedStatus)&&a!==i.expectedStatus)return void(null===(r=i.onError)||void 0===r||r.call(i,s.status));const o=function(t){const e=t.response;return"string"!==typeof e?e:zt(e).buffer}(s);if(206===a){const t=s.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);i.onDone({begin:parseInt(e[1],10),chunk:o})}else if(o)i.onDone({begin:0,chunk:o});else{var l;null===(l=i.onError)||void 0===l||l.call(i,s.status)}}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class jr{constructor(t){this._source=t,this._manager=new Br(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return Tt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Hr(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new zr(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class Hr{constructor(t,e){this._manager=t;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(i),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t),i=t=>e.getResponseHeader(t),{allowRangeRequests:s,suggestedLength:n}=Rr({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=Tr(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t)if(this._requests.length>0){this._requests.shift().resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);if(this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=Pr(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class zr{constructor(t,e,i){this._manager=t;const s={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var t;null===(t=this.onClosed)||void 0===t||t.call(this,this)}_onDone(t){const e=t.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunk=e;this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=Pr(t,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded}))}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Vr=/^file:\/\/\/[a-zA-Z]:\//;class Ur{constructor(t){this.source=t,this.url=function(t){const e=ua.get("url"),i=e.parse(t);return"file:"===i.protocol||i.host?i:/^[a-z]:[/\\]/i.test(t)?e.parse("file:///".concat(t)):(i.host||(i.protocol="file:"),i)}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return Tt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new Qr(this):new Kr(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=this.isFsUrl?new Jr(this,t,e):new Yr(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const i of this._rangeRequestReaders.slice(0))i.cancel(t)}}class Gr{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new jt("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class qr{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function Xr(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class Kr extends Gr{constructor(t){super(t);const e=e=>{if(404===e.statusCode){const t=new Nt('Missing PDF "'.concat(this._url,'".'));return this._storedError=t,void this._headersCapability.reject(t)}this._headersCapability.resolve(),this._setReadableStream(e);const i=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:s,suggestedLength:n}=Rr({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=n||this._contentLength,this._filename=Tr(i)};if(this._request=null,"http:"===this._url.protocol){const i=ua.get("http");this._request=i.request(Xr(this._url,t.httpHeaders),e)}else{const i=ua.get("https");this._request=i.request(Xr(this._url,t.httpHeaders),e)}this._request.on("error",t=>{this._storedError=t,this._headersCapability.reject(t)}),this._request.end()}}class Yr extends qr{constructor(t,e,i){super(t),this._httpHeaders={};for(const n in t.httpHeaders){const e=t.httpHeaders[n];void 0!==e&&(this._httpHeaders[n]=e)}this._httpHeaders.Range="bytes=".concat(e,"-").concat(i-1);const s=t=>{if(404!==t.statusCode)this._setReadableStream(t);else{const t=new Nt('Missing PDF "'.concat(this._url,'".'));this._storedError=t}};if(this._request=null,"http:"===this._url.protocol){const t=ua.get("http");this._request=t.request(Xr(this._url,this._httpHeaders),s)}else{const t=ua.get("https");this._request=t.request(Xr(this._url,this._httpHeaders),s)}this._request.on("error",t=>{this._storedError=t}),this._request.end()}}class Qr extends Gr{constructor(t){super(t);let e=decodeURIComponent(this._url.path);Vr.test(this._url.href)&&(e=e.replace(/^\//,""));const i=ua.get("fs");i.promises.lstat(e).then(t=>{this._contentLength=t.size,this._setReadableStream(i.createReadStream(e)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=new Nt('Missing PDF "'.concat(e,'".'))),this._storedError=t,this._headersCapability.reject(t)})}}class Jr extends qr{constructor(t,e,i){super(t);let s=decodeURIComponent(this._url.path);Vr.test(this._url.href)&&(s=s.replace(/^\//,""));const n=ua.get("fs");this._setReadableStream(n.createReadStream(s,{start:e,end:i-1}))}}const Zr=30;var $r=new WeakMap,to=new WeakMap,eo=new WeakMap,io=new WeakMap,so=new WeakMap,no=new WeakMap,ao=new WeakMap,ro=new WeakMap,oo=new WeakMap,lo=new WeakMap,ho=new WeakMap,co=new WeakMap,uo=new WeakMap,po=new WeakMap,Ao=new WeakMap,go=new WeakMap,fo=new WeakMap,mo=new WeakMap,vo=new WeakSet;class bo{constructor(t){var e;let{textContentSource:i,container:s,viewport:n}=t;if((0,o.A)(this,vo),(0,d.A)(this,$r,Promise.withResolvers()),(0,d.A)(this,to,null),(0,d.A)(this,eo,!1),(0,d.A)(this,io,!(null===(e=globalThis.FontInspector)||void 0===e||!e.enabled)),(0,d.A)(this,so,null),(0,d.A)(this,no,null),(0,d.A)(this,ao,0),(0,d.A)(this,ro,0),(0,d.A)(this,oo,null),(0,d.A)(this,lo,null),(0,d.A)(this,ho,0),(0,d.A)(this,co,0),(0,d.A)(this,uo,Object.create(null)),(0,d.A)(this,po,[]),(0,d.A)(this,Ao,null),(0,d.A)(this,go,[]),(0,d.A)(this,fo,new WeakMap),(0,d.A)(this,mo,null),i instanceof ReadableStream)(0,p.A)(Ao,this,i);else{if("object"!==typeof i)throw new Error('No "textContentSource" parameter specified.');(0,p.A)(Ao,this,new ReadableStream({start(t){t.enqueue(i),t.close()}}))}(0,p.A)(to,this,(0,p.A)(lo,this,s)),(0,p.A)(co,this,n.scale*(globalThis.devicePixelRatio||1)),(0,p.A)(ho,this,n.rotation),(0,p.A)(no,this,{prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null});const{pageWidth:a,pageHeight:r,pageX:l,pageY:h}=n.rawDims;(0,p.A)(mo,this,[1,0,0,-1,-l,h+r]),(0,p.A)(ro,this,a),(0,p.A)(ao,this,r),Eo.call(bo),ti(s,n),(0,u.A)($r,this).promise.catch(()=>{}).then(()=>{Ro._.delete(this),(0,p.A)(no,this,null),(0,p.A)(uo,this,null)})}render(){const t=()=>{(0,u.A)(oo,this).read().then(e=>{var i;let{value:s,done:n}=e;n?(0,u.A)($r,this).resolve():(null!==(i=(0,u.A)(so,this))&&void 0!==i||(0,p.A)(so,this,s.lang),Object.assign((0,u.A)(uo,this),s.styles),(0,l.A)(vo,this,wo).call(this,s.items),t())},(0,u.A)($r,this).reject)};return(0,p.A)(oo,this,(0,u.A)(Ao,this).getReader()),Ro._.add(this),t(),(0,u.A)($r,this).promise}update(t){let{viewport:e,onBefore:i=null}=t;const s=e.scale*(globalThis.devicePixelRatio||1),n=e.rotation;if(n!==(0,u.A)(ho,this)&&(null===i||void 0===i||i(),(0,p.A)(ho,this,n),ti((0,u.A)(lo,this),{rotation:n})),s!==(0,u.A)(co,this)){null===i||void 0===i||i(),(0,p.A)(co,this,s);const t={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:xo.call(bo,(0,u.A)(so,this))};for(const e of(0,u.A)(go,this))t.properties=(0,u.A)(fo,this).get(e),t.div=e,(0,l.A)(vo,this,_o).call(this,t)}}cancel(){var t;const e=new jt("TextLayer task cancelled.");null===(t=(0,u.A)(oo,this))||void 0===t||t.cancel(e).catch(()=>{}),(0,p.A)(oo,this,null),(0,u.A)($r,this).reject(e)}get textDivs(){return(0,u.A)(go,this)}get textContentItemsStr(){return(0,u.A)(po,this)}static cleanup(){if(!((0,l.A)(bo,this,Ro)._.size>0)){(0,l.A)(bo,this,So)._.clear();for(const{canvas:t}of(0,l.A)(bo,this,Mo)._.values())t.remove();(0,l.A)(bo,this,Mo)._.clear()}}}function wo(t){var e,i;if((0,u.A)(eo,this))return;null!==(i=(e=(0,u.A)(no,this)).ctx)&&void 0!==i||(e.ctx=xo.call(w,(0,u.A)(so,this)));const s=(0,u.A)(go,this),n=(0,u.A)(po,this);for(const a of t){if(s.length>1e5)return Ct("Ignoring additional textDivs for performance reasons."),void(0,p.A)(eo,this,!0);if(void 0!==a.str)n.push(a.str),(0,l.A)(vo,this,yo).call(this,a);else if("beginMarkedContentProps"===a.type||"beginMarkedContent"===a.type){const t=(0,u.A)(to,this);(0,p.A)(to,this,document.createElement("span")),(0,u.A)(to,this).classList.add("markedContent"),null!==a.id&&(0,u.A)(to,this).setAttribute("id","".concat(a.id)),t.append((0,u.A)(to,this))}else"endMarkedContent"===a.type&&(0,p.A)(to,this,(0,u.A)(to,this).parentNode)}}function yo(t){const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};(0,u.A)(go,this).push(e);const s=qt.transform((0,u.A)(mo,this),t.transform);let n=Math.atan2(s[1],s[0]);const a=(0,u.A)(uo,this)[t.fontName];a.vertical&&(n+=Math.PI/2);const r=(0,u.A)(io,this)&&a.fontSubstitution||a.fontFamily,o=Math.hypot(s[2],s[3]),h=o*ko.call(w,r,(0,u.A)(so,this));let c,d;0===n?(c=s[4],d=s[5]-h):(c=s[4]+h*Math.sin(n),d=s[5]-h*Math.cos(n));const p="calc(var(--scale-factor)*",A=e.style;(0,u.A)(to,this)===(0,u.A)(lo,this)?(A.left="".concat((100*c/(0,u.A)(ro,this)).toFixed(2),"%"),A.top="".concat((100*d/(0,u.A)(ao,this)).toFixed(2),"%")):(A.left="".concat(p).concat(c.toFixed(2),"px)"),A.top="".concat(p).concat(d.toFixed(2),"px)")),A.fontSize="".concat(p).concat((Co._*o).toFixed(2),"px)"),A.fontFamily=r,i.fontSize=o,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,(0,u.A)(io,this)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),0!==n&&(i.angle=n*(180/Math.PI));let g=!1;if(t.str.length>1)g=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(g=!0)}if(g&&(i.canvasWidth=a.vertical?t.height:t.width),(0,u.A)(fo,this).set(e,i),(0,u.A)(no,this).div=e,(0,u.A)(no,this).properties=i,(0,l.A)(vo,this,_o).call(this,(0,u.A)(no,this)),i.hasText&&(0,u.A)(to,this).append(e),i.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),(0,u.A)(to,this).append(t)}}function _o(t){const{div:e,properties:i,ctx:s,prevFontSize:n,prevFontFamily:a}=t,{style:r}=e;let o="";if(Co._>1&&(o="scale(".concat(1/Co._,")")),0!==i.canvasWidth&&i.hasText){const{fontFamily:l}=r,{canvasWidth:h,fontSize:c}=i;n===c&&a===l||(s.font="".concat(c*(0,u.A)(co,this),"px ").concat(l),t.prevFontSize=c,t.prevFontFamily=l);const{width:d}=s.measureText(e.textContent);d>0&&(o="scaleX(".concat(h*(0,u.A)(co,this)/d,") ").concat(o))}0!==i.angle&&(o="rotate(".concat(i.angle,"deg) ").concat(o)),o.length>0&&(r.transform=o)}function xo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=(0,l.A)(w,this,Mo)._.get(t||(t=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),(0,l.A)(w,this,Mo)._.set(t,e)}return e}function Eo(){if(null!==(0,l.A)(w,this,Co)._)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.textContent="X",document.body.append(t),Co._=(0,l.A)(w,this,t.getBoundingClientRect().height),t.remove()}function ko(t,e){const i=(0,l.A)(w,this,So)._.get(t);if(i)return i;const s=(0,l.A)(w,this,xo).call(this,e),n=s.font;s.canvas.width=s.canvas.height=Zr,s.font="".concat(Zr,"px ").concat(t);const a=s.measureText("");let r=a.fontBoundingBoxAscent,o=Math.abs(a.fontBoundingBoxDescent);if(r){const e=r/(r+o);return(0,l.A)(w,this,So)._.set(t,e),s.canvas.width=s.canvas.height=0,s.font=n,e}s.strokeStyle="red",s.clearRect(0,0,Zr,Zr),s.strokeText("g",0,0);let h=s.getImageData(0,0,Zr,Zr).data;o=0;for(let l=h.length-1-3;l>=0;l-=4)if(h[l]>0){o=Math.ceil(l/4/Zr);break}s.clearRect(0,0,Zr,Zr),s.strokeText("A",0,Zr),h=s.getImageData(0,0,Zr,Zr).data,r=0;for(let l=0,d=h.length;l<d;l+=4)if(h[l]>0){r=Zr-Math.floor(l/4/Zr);break}s.canvas.width=s.canvas.height=0,s.font=n;const c=r?r/(r+o):.8;return(0,l.A)(w,this,So)._.set(t,c),c}w=bo;var So={_:new Map},Mo={_:new Map},Co={_:null},Ro={_:new Set};function To(){Xe("`renderTextLayer`, please use `TextLayer` instead.");const t=arguments[0],{textContentSource:e,container:i,viewport:s}=t,n=(0,r.A)(t,A),a=Object.keys(n);a.length>0&&Ct("Ignoring `renderTextLayer` parameters: "+a.join(", "));const o=new bo({textContentSource:e,container:i,viewport:s}),{textDivs:l,textContentItemsStr:h}=o;return{promise:o.render(),textDivs:l,textContentItemsStr:h}}function Po(){Xe("`updateTextLayer`, please use `TextLayer` instead.")}class Lo{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function t(i){var s;if(!i)return;let n=null;const a=i.name;if("#text"===a)n=i.value;else{if(!Lo.shouldBuildText(a))return;null!==i&&void 0!==i&&null!==(s=i.attributes)&&void 0!==s&&s.textContent?n=i.attributes.textContent:i.value&&(n=i.value)}if(null!==n&&e.push({str:n}),i.children)for(const e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}const Io=65536,Do=R?class extends ce{_createCanvas(t,e){return ua.get("canvas").createCanvas(t,e)}}:class extends ce{constructor(){let{ownerDocument:t=globalThis.document,enableHWA:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super({enableHWA:e}),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},Fo=R?class extends de{_fetchData(t,e){return pa(t).then(t=>({cMapData:t,compressionType:e}))}}:Fe,Oo=R?class extends le{}:class extends le{constructor(){let{docId:t,ownerDocument:e=globalThis.document}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),(0,o.A)(this,_e),(0,d.A)(this,fe,void 0),(0,d.A)(this,me,void 0),(0,d.A)(this,ve,void 0),(0,d.A)(this,be,void 0),(0,d.A)(this,we,void 0),(0,d.A)(this,ye,0),(0,p.A)(ve,this,t),(0,p.A)(be,this,e)}addFilter(t){var e,i;if(!t)return"none";let s=h(_e,this,xe).get(t);if(s)return s;const[n,a,r]=(0,l.A)(_e,this,Se).call(this,t),o=1===t.length?n:"".concat(n).concat(a).concat(r);if(s=h(_e,this,xe).get(o),s)return h(_e,this,xe).set(t,s),s;const c="g_".concat((0,u.A)(ve,this),"_transfer_map_").concat(((0,p.A)(ye,this,(e=(0,u.A)(ye,this),i=e++,e)),i)),d="url(#".concat(c,")");h(_e,this,xe).set(t,d),h(_e,this,xe).set(o,d);const A=(0,l.A)(_e,this,Re).call(this,c);return(0,l.A)(_e,this,Pe).call(this,n,a,r,A),d}addHCMFilter(t,e){var i;const s="".concat(t,"-").concat(e),n="base";let a=h(_e,this,Ee).get(n);if((null===(i=a)||void 0===i?void 0:i.key)===s)return a.url;var r;a?(null===(r=a.filter)||void 0===r||r.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},h(_e,this,Ee).set(n,a));if(!t||!e)return a.url;const o=(0,l.A)(_e,this,Ie).call(this,t);t=qt.makeHexColor(...o);const c=(0,l.A)(_e,this,Ie).call(this,e);if(e=qt.makeHexColor(...c),h(_e,this,ke).style.color="","#000000"===t&&"#ffffff"===e||t===e)return a.url;const d=new Array(256);for(let l=0;l<=255;l++){const t=l/255;d[l]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const p=d.join(","),A="g_".concat((0,u.A)(ve,this),"_hcm_filter"),g=a.filter=(0,l.A)(_e,this,Re).call(this,A);(0,l.A)(_e,this,Pe).call(this,p,p,p,g),(0,l.A)(_e,this,Ce).call(this,g);const f=(t,e)=>{const i=o[t]/255,s=c[t]/255,n=new Array(e+1);for(let a=0;a<=e;a++)n[a]=i+a/e*(s-i);return n.join(",")};return(0,l.A)(_e,this,Pe).call(this,f(0,5),f(1,5),f(2,5),g),a.url="url(#".concat(A,")"),a.url}addAlphaFilter(t){var e,i;let s=h(_e,this,xe).get(t);if(s)return s;const[n]=(0,l.A)(_e,this,Se).call(this,[t]),a="alpha_".concat(n);if(s=h(_e,this,xe).get(a),s)return h(_e,this,xe).set(t,s),s;const r="g_".concat((0,u.A)(ve,this),"_alpha_map_").concat(((0,p.A)(ye,this,(e=(0,u.A)(ye,this),i=e++,e)),i)),o="url(#".concat(r,")");h(_e,this,xe).set(t,o),h(_e,this,xe).set(a,o);const c=(0,l.A)(_e,this,Re).call(this,r);return(0,l.A)(_e,this,Le).call(this,n,c),o}addLuminosityFilter(t){var e,i;let s,n,a=h(_e,this,xe).get(t||"luminosity");if(a)return a;if(t?([s]=(0,l.A)(_e,this,Se).call(this,[t]),n="luminosity_".concat(s)):n="luminosity",a=h(_e,this,xe).get(n),a)return h(_e,this,xe).set(t,a),a;const r="g_".concat((0,u.A)(ve,this),"_luminosity_map_").concat(((0,p.A)(ye,this,(e=(0,u.A)(ye,this),i=e++,e)),i)),o="url(#".concat(r,")");h(_e,this,xe).set(t,o),h(_e,this,xe).set(n,o);const c=(0,l.A)(_e,this,Re).call(this,r);return(0,l.A)(_e,this,Me).call(this,c),t&&(0,l.A)(_e,this,Le).call(this,s,c),o}addHighlightHCMFilter(t,e,i,s,n){var a;const r="".concat(e,"-").concat(i,"-").concat(s,"-").concat(n);let o=h(_e,this,Ee).get(t);if((null===(a=o)||void 0===a?void 0:a.key)===r)return o.url;var c;o?(null===(c=o.filter)||void 0===c||c.remove(),o.key=r,o.url="none",o.filter=null):(o={key:r,url:"none",filter:null},h(_e,this,Ee).set(t,o));if(!e||!i)return o.url;const[d,p]=[e,i].map((0,l.A)(_e,this,Ie).bind(this));let A=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),g=Math.round(.2126*p[0]+.7152*p[1]+.0722*p[2]),[f,m]=[s,n].map((0,l.A)(_e,this,Ie).bind(this));g<A&&([A,g,f,m]=[g,A,m,f]),h(_e,this,ke).style.color="";const v=(t,e,i)=>{const s=new Array(256),n=(g-A)/i,a=t/255,r=(e-t)/(255*i);let o=0;for(let l=0;l<=i;l++){const t=Math.round(A+l*n),e=a+l*r;for(let i=o;i<=t;i++)s[i]=e;o=t+1}for(let l=o;l<256;l++)s[l]=s[o-1];return s.join(",")},b="g_".concat((0,u.A)(ve,this),"_hcm_").concat(t,"_filter"),w=o.filter=(0,l.A)(_e,this,Re).call(this,b);return(0,l.A)(_e,this,Ce).call(this,w),(0,l.A)(_e,this,Pe).call(this,v(f[0],m[0],5),v(f[1],m[1],5),v(f[2],m[2],5),w),o.url="url(#".concat(b,")"),o.url}destroy(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&0!==h(_e,this,Ee).size||((0,u.A)(me,this)&&((0,u.A)(me,this).parentNode.parentNode.remove(),(0,p.A)(me,this,null)),(0,u.A)(fe,this)&&((0,u.A)(fe,this).clear(),(0,p.A)(fe,this,null)),(0,p.A)(ye,this,0))}},No=R?class extends ue{_fetchData(t){return pa(t)}}:Oe;function Wo(){var t,e;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"===typeof i||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i});const s=new jo,{docId:n}=s,a=i.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch(e){if(R&&"string"===typeof t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(i.url):null,r=i.data?function(t){if(R&&"undefined"!==typeof Buffer&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"===typeof t)return zt(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"===typeof t&&!isNaN(null===t||void 0===t?void 0:t.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(i.data):null,o=i.httpHeaders||null,l=!0===i.withCredentials,h=null!==(t=i.password)&&void 0!==t?t:null,c=i.range instanceof zo?i.range:null,d=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:Io;let u=i.worker instanceof el?i.worker:null;const p=i.verbosity,A="string"!==typeof i.docBaseUrl||je(i.docBaseUrl)?null:i.docBaseUrl,g="string"===typeof i.cMapUrl?i.cMapUrl:null,f=!1!==i.cMapPacked,m=i.CMapReaderFactory||Fo,v="string"===typeof i.standardFontDataUrl?i.standardFontDataUrl:null,b=i.StandardFontDataFactory||No,w=!0!==i.stopAtErrors,y=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,_=!1!==i.isEvalSupported,x="boolean"===typeof i.isOffscreenCanvasSupported?i.isOffscreenCanvasSupported:!R,E=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,k="boolean"===typeof i.disableFontFace?i.disableFontFace:R,S=!0===i.fontExtraProperties,M=!0===i.enableXfa,C=i.ownerDocument||globalThis.document,T=!0===i.disableRange,P=!0===i.disableStream,L=!0===i.disableAutoFetch,I=!0===i.pdfBug,D=!0===i.enableHWA,F=c?c.length:null!==(e=i.length)&&void 0!==e?e:NaN,O="boolean"===typeof i.useSystemFonts?i.useSystemFonts:!R&&!k,N="boolean"===typeof i.useWorkerFetch?i.useWorkerFetch:m===Fe&&b===Oe&&g&&v&&Ge(g,document.baseURI)&&Ge(v,document.baseURI),W=i.canvasFactory||new Do({ownerDocument:C,enableHWA:D}),B=i.filterFactory||new Oo({docId:n,ownerDocument:C});kt(p);const j={canvasFactory:W,filterFactory:B};if(N||(j.cMapReaderFactory=new m({baseUrl:g,isCompressed:f}),j.standardFontDataFactory=new b({baseUrl:v})),!u){const t={verbosity:p,port:Ga.workerPort};u=t.port?el.fromPort(t):new el(t),s._worker=u}const H={docId:n,apiVersion:"4.4.168",data:r,password:h,disableAutoFetch:L,rangeChunkSize:d,length:F,docBaseUrl:A,enableXfa:M,evaluatorOptions:{maxImageSize:y,disableFontFace:k,ignoreErrors:w,isEvalSupported:_,isOffscreenCanvasSupported:x,canvasMaxAreaInBytes:E,fontExtraProperties:S,useSystemFonts:O,cMapUrl:N?g:null,standardFontDataUrl:N?v:null}},z={disableFontFace:k,fontExtraProperties:S,ownerDocument:C,pdfBug:I,styleElement:null,loadingParams:{disableAutoFetch:L,enableXfa:M}};return u.promise.then(function(){if(s.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const t=u.messageHandler.sendWithPromise("GetDocRequest",H,r?[r.buffer]:null);let e;if(c)e=new Sr(c,{disableRange:T,disableStream:P});else if(!r){if(!a)throw new Error("getDocument - no `url` parameter provided.");e=(t=>{if(R){return function(){return"undefined"!==typeof fetch&&"undefined"!==typeof Response&&"body"in Response.prototype}()&&Ge(t.url)?new Or(t):new Ur(t)}return Ge(t.url)?new Or(t):new jr(t)})({url:a,length:F,httpHeaders:o,withCredentials:l,rangeChunkSize:d,disableRange:T,disableStream:P})}return t.then(t=>{if(s.destroyed)throw new Error("Loading aborted");if(u.destroyed)throw new Error("Worker was destroyed");const i=new rr(n,t,u.port),a=new dl(i,s,e,z,j);s._transport=a,i.send("Ready",null)})}).catch(s._capability.reject),s}function Bo(t){return"object"===typeof t&&Number.isInteger(null===t||void 0===t?void 0:t.num)&&t.num>=0&&Number.isInteger(null===t||void 0===t?void 0:t.gen)&&t.gen>=0}class jo{constructor(){var t,e;this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d".concat((Ho._=(t=Ho._,e=t++,t),e)),this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{var t,e;null!==(t=this._worker)&&void 0!==t&&t.port&&(this._worker._pendingDestroy=!0),await(null===(e=this._transport)||void 0===e?void 0:e.destroy())}catch(s){var i;throw null!==(i=this._worker)&&void 0!==i&&i.port&&delete this._worker._pendingDestroy,s}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}var Ho={_:0};class zo{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=s,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(const i of this._progressListeners)i(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){Rt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Vo{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Lt(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Uo=new WeakMap,Go=new WeakMap,qo=new WeakSet;class Xo{constructor(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(0,o.A)(this,qo),(0,d.A)(this,Uo,null),(0,d.A)(this,Go,!1),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new Ue:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new fl,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:s=0,dontFlip:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new We({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Lt(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null}render(t){var e,i;let{canvasContext:s,viewport:n,intent:a="display",annotationMode:r=j.ENABLE,transform:o=null,background:h=null,optionalContentConfigPromise:c=null,annotationCanvasMap:d=null,pageColors:u=null,printAnnotationStorage:A=null}=t;null===(e=this._stats)||void 0===e||e.time("Overall");const g=this._transport.getRenderingIntent(a,r,A),{renderingIntent:f,cacheKey:m}=g;(0,p.A)(Go,this,!1),(0,l.A)(qo,this,Yo).call(this),c||(c=this._transport.getOptionalContentConfig(f));let v=this._intentStates.get(m);v||(v=Object.create(null),this._intentStates.set(m,v)),v.streamReaderCancelTimeout&&(clearTimeout(v.streamReaderCancelTimeout),v.streamReaderCancelTimeout=null);const b=!!(f&F);var w;v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(w=this._stats)||void 0===w||w.time("Page Request"),this._pumpOperatorList(g));const y=t=>{var e;(v.renderTasks.delete(_),(this._maybeCleanupAfterRender||b)&&(0,p.A)(Go,this,!0),(0,l.A)(qo,this,Ko).call(this,!b),t?(_.capability.reject(t),this._abortOperatorList({intentState:v,reason:t instanceof Error?t:new Error(t)})):_.capability.resolve(),this._stats)&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),null!==(e=globalThis.Stats)&&void 0!==e&&e.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},_=new yl({callback:y,params:{canvasContext:s,viewport:n,transform:o,background:h},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:d,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:u});((i=v).renderTasks||(i.renderTasks=new Set)).add(_);const x=_.task;return Promise.all([v.displayReadyCapability.promise,c]).then(t=>{var e;let[i,s]=t;if(this.destroyed)y();else{if(null===(e=this._stats)||void 0===e||e.time("Rendering"),!(s.renderingIntent&f))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");_.initializeGraphics({transparency:i,optionalContentConfig:s}),_.operatorListChanged()}}).catch(y),x}getOperatorList(){let{intent:t="display",annotationMode:e=j.ENABLE,printAnnotationStorage:i=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=this._transport.getRenderingIntent(t,e,i,!0);let n,a=this._intentStates.get(s.cacheKey);var r,o;(a||(a=Object.create(null),this._intentStates.set(s.cacheKey,a)),a.opListReadCapability)||(n=Object.create(null),n.operatorListChanged=function(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(n))},a.opListReadCapability=Promise.withResolvers(),((r=a).renderTasks||(r.renderTasks=new Set)).add(n),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(o=this._stats)||void 0===o||o.time("Page Request"),this._pumpOperatorList(s));return a.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:t=!1,disableNormalization:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then(t=>Lo.textContent(t));const e=this.streamTextContent(t);return new Promise(function(t,i){const s=e.getReader(),n={items:[],styles:Object.create(null),lang:null};!function e(){s.read().then(function(i){var s;let{value:a,done:r}=i;r?t(n):(null!==(s=n.lang)&&void 0!==s||(n.lang=a.lang),Object.assign(n.styles,a.styles),n.items.push(...a.items),e())},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),(0,p.A)(Go,this,!1),(0,l.A)(qo,this,Yo).call(this),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,p.A)(Go,this,!0);const e=(0,l.A)(qo,this,Ko).call(this,!1);return t&&e&&this._stats&&(this._stats=new Ue),e}_startRenderPage(t,e){var i,s;const n=this._intentStates.get(e);n&&(null===(i=this._stats)||void 0===i||i.timeEnd("Page Request"),null===(s=n.displayReadyCapability)||void 0===s||s.resolve(t))}_renderPageChunk(t,e){for(let i=0,s=t.length;i<s;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&(0,l.A)(qo,this,Ko).call(this,!0)}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageSerializable:s}=t;const{map:n,transfer:a}=s,r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:n},a).getReader(),o=this._intentStates.get(i);o.streamReader=r;const h=()=>{r.read().then(t=>{let{value:e,done:i}=t;i?o.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,o),h())},t=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){o.operatorList.lastChunk=!0;for(const t of o.renderTasks)t.operatorListChanged();(0,l.A)(qo,this,Ko).call(this,!0)}if(o.displayReadyCapability)o.displayReadyCapability.reject(t);else{if(!o.opListReadCapability)throw t;o.opListReadCapability.reject(t)}}})};h()}_abortOperatorList(t){let{intentState:e,reason:i,force:s=!1}=t;if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!s){if(e.renderTasks.size>0)return;if(i instanceof Be){let t=100;return i.extraDelay>0&&i.extraDelay<1e3&&(t+=i.extraDelay),void(e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},t))}}if(e.streamReader.cancel(new jt(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}function Ko(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,l.A)(qo,this,Yo).call(this),!(0,u.A)(Go,this)||this.destroyed)return!1;if(t)return(0,p.A)(Uo,this,setTimeout(()=>{(0,p.A)(Uo,this,null),(0,l.A)(qo,this,Ko).call(this,!1)},5e3)),!1;for(const{renderTasks:e,operatorList:i}of this._intentStates.values())if(e.size>0||!i.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),(0,p.A)(Go,this,!1),!0}function Yo(){(0,u.A)(Uo,this)&&(clearTimeout((0,u.A)(Uo,this)),(0,p.A)(Uo,this,null))}var Qo=new WeakMap,Jo=new WeakMap;class Zo{constructor(){(0,d.A)(this,Qo,new Set),(0,d.A)(this,Jo,Promise.resolve())}postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};(0,u.A)(Jo,this).then(()=>{for(const t of(0,u.A)(Qo,this))t.call(this,i)})}addEventListener(t,e){(0,u.A)(Qo,this).add(e)}removeEventListener(t,e){(0,u.A)(Qo,this).delete(e)}terminate(){(0,u.A)(Qo,this).clear()}}const $o={isWorkerDisabled:!1,fakeWorkerId:0};R&&($o.isWorkerDisabled=!0,Ga.workerSrc||(Ga.workerSrc="./pdf.worker.mjs")),$o.isSameOrigin=function(t,e){let i;try{if(i=new URL(t),!i.origin||"null"===i.origin)return!1}catch(n){return!1}const s=new URL(e,i);return i.origin===s.origin},$o.createCDNWrapper=function(t){const e='await import("'.concat(t,'");');return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};var tl=new WeakSet;class el{constructor(){let{name:t=null,port:e=null,verbosity:i=St()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if((0,o.A)(this,tl),this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){var s;if(null!==(s=nl._)&&void 0!==s&&s.has(e))throw new Error("Cannot use more than one PDFWorker per port.");return(nl._||(nl._=new WeakMap)).set(e,this),void this._initializeFromPort(e)}this._initialize()}get promise(){return R?Promise.all([ua.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new rr("main","worker",t),this._messageHandler.on("ready",function(){}),(0,l.A)(tl,this,il).call(this)}_initialize(){if($o.isWorkerDisabled||sl(el))return void this._setupFakeWorker();let{workerSrc:t}=el;try{$o.isSameOrigin(window.location.href,t)||(t=$o.createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new rr("main","worker",e),s=()=>{n.abort(),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;e.addEventListener("error",()=>{this._webWorker||s()},{signal:n.signal}),i.on("test",t=>{n.abort(),!this.destroyed&&t?(this._messageHandler=i,this._port=e,this._webWorker=e,(0,l.A)(tl,this,il).call(this)):s()}),i.on("ready",t=>{if(n.abort(),this.destroyed)s();else try{a()}catch(e){this._setupFakeWorker()}});const a=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void a()}catch(e){Mt("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){$o.isWorkerDisabled||(Ct("Setting up fake worker."),$o.isWorkerDisabled=!0),el._setupFakeWorkerGlobal.then(t=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const e=new Zo;this._port=e;const i="fake".concat($o.fakeWorkerId++),s=new rr(i+"_worker",i,e);t.setup(s,e),this._messageHandler=new rr(i,i+"_worker",e),(0,l.A)(tl,this,il).call(this)}).catch(t=>{this._readyCapability.reject(new Error('Setting up fake worker failed: "'.concat(t.message,'".')))})}destroy(){var t;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),null===(t=nl._)||void 0===t||t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){var e;if(null===t||void 0===t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const i=null===(e=(0,l.A)(el,this,nl)._)||void 0===e?void 0:e.get(t.port);if(i){if(i._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return i}return new el(t)}static get workerSrc(){if(Ga.workerSrc)return Ga.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Lt(this,"_setupFakeWorkerGlobal",(async()=>{if(h(el,this,sl))return h(el,this,sl);return(await i(4153)(this.workerSrc)).WorkerMessageHandler})())}}function il(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}function sl(t){try{var e;return(null===(e=globalThis.pdfjsWorker)||void 0===e?void 0:e.WorkerMessageHandler)||null}catch(i){return null}}var nl={_:void 0},al=new WeakMap,rl=new WeakMap,ol=new WeakMap,ll=new WeakMap,hl=new WeakMap,cl=new WeakSet;class dl{constructor(t,e,i,s,n){(0,o.A)(this,cl),(0,d.A)(this,al,new Map),(0,d.A)(this,rl,new Map),(0,d.A)(this,ol,new Map),(0,d.A)(this,ll,new Map),(0,d.A)(this,hl,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new fl,this.fontLoader=new la({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return Lt(this,"annotationStorage",new sa)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:j.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=D,a=$n;switch(t){case"any":n=I;break;case"display":break;case"print":n=F;break;default:Ct("getRenderingIntent - invalid intent: ".concat(t))}switch(e){case j.DISABLE:n+=W;break;case j.ENABLE:break;case j.ENABLE_FORMS:n+=O;break;case j.ENABLE_STORAGE:n+=N;a=(n&F&&i instanceof ra?i:this.annotationStorage).serializable;break;default:Ct("getRenderingIntent - invalid annotationMode: ".concat(e))}return s&&(n+=B),{renderingIntent:n,cacheKey:"".concat(n,"_").concat(a.hash),annotationStorageSerializable:a}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null===(t=(0,u.A)(hl,this))||void 0===t||t.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const s of(0,u.A)(rl,this).values())e.push(s._destroy());(0,u.A)(rl,this).clear(),(0,u.A)(ol,this).clear(),(0,u.A)(ll,this).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{var t;this.commonObjs.clear(),this.fontLoader.clear(),(0,u.A)(al,this).clear(),this.filterFactory.destroy(),bo.cleanup(),null===(t=this._networkStream)||void 0===t||t.cancelAllRequests(new jt("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{Tt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function(t){let{value:i,done:s}=t;s?e.close():(Tt(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",t=>{const i=Promise.withResolvers(),s=this._fullReader;return s.headersReady.then(()=>{if(!s.isStreamingSupported||!s.isRangeSupported){var t;if(this._lastProgress)null===(t=e.onProgress)||void 0===t||t.call(e,this._lastProgress);s.onProgress=t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}}i.resolve({isStreamingSupported:s.isStreamingSupported,isRangeSupported:s.isRangeSupported,contentLength:s.contentLength})},i.reject),i.promise}),t.on("GetRangeReader",(t,e)=>{Tt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then(function(t){let{value:i,done:s}=t;s?e.close():(Tt(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}):e.close()}),t.on("GetDoc",t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new Vo(i,this))}),t.on("DocException",function(t){let i;switch(t.name){case"PasswordException":i=new Dt(t.message,t.code);break;case"InvalidPDFException":i=new Ot(t.message);break;case"MissingPDFException":i=new Nt(t.message);break;case"UnexpectedResponseException":i=new Wt(t.message,t.status);break;case"UnknownErrorException":i=new Ft(t.message,t.details);break;default:Rt("DocException - expected a valid Error.")}e._capability.reject(i)}),t.on("PasswordRequest",t=>{if((0,p.A)(hl,this,Promise.withResolvers()),e.onPassword){const s=t=>{t instanceof Error?(0,u.A)(hl,this).reject(t):(0,u.A)(hl,this).resolve({password:t})};try{e.onPassword(s,t.code)}catch(i){(0,u.A)(hl,this).reject(i)}}else(0,u.A)(hl,this).reject(new Dt(t.message,t.code));return(0,u.A)(hl,this).promise}),t.on("DataLoaded",t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{if(this.destroyed)return;(0,u.A)(rl,this).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",e=>{var i;let[s,n,a]=e;if(this.destroyed)return null;if(this.commonObjs.has(s))return null;switch(n){case"Font":const{disableFontFace:e,fontExtraProperties:r,pdfBug:o}=this._params;if("error"in a){const t=a.error;Ct("Error during font loading: ".concat(t)),this.commonObjs.resolve(s,t);break}const l=o&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,h=new ha(a,{disableFontFace:e,inspectFont:l});this.fontLoader.bind(h).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!r&&h.data&&(h.data=null),this.commonObjs.resolve(s,h)});break;case"CopyLocalImage":const{imageRef:c}=a;Tt(c,"The imageRef must be defined.");for(const t of(0,u.A)(rl,this).values())for(const[,e]of t.objs)if((null===e||void 0===e?void 0:e.ref)===c)return e.dataLen?(this.commonObjs.resolve(s,structuredClone(e)),e.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,a);break;default:throw new Error("Got unknown common object type ".concat(n))}return null}),t.on("obj",t=>{let[e,i,s,n]=t;if(this.destroyed)return;const a=(0,u.A)(rl,this).get(i);var r;if(!a.objs.has(e))if(0!==a._intentStates.size)switch(s){case"Image":a.objs.resolve(e,n),(null===n||void 0===n?void 0:n.dataLen)>1e7&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.objs.resolve(e,n);break;default:throw new Error("Got unknown object type ".concat(s))}else null===n||void 0===n||null===(r=n.bitmap)||void 0===r||r.close()}),t.on("DocProgress",t=>{var i;this.destroyed||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}),t.on("FetchBuiltInCMap",t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(t):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(t):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t,e;this.annotationStorage.size<=0&&Ct("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:i,transfer:s}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:i,filename:null!==(t=null===(e=this._fullReader)||void 0===e?void 0:e.filename)&&void 0!==t?t:null},s).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,i=(0,u.A)(ol,this).get(e);if(i)return i;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(i=>{if(this.destroyed)throw new Error("Transport destroyed");i.refStr&&(0,u.A)(ll,this).set(i.refStr,t);const s=new Xo(e,i,this,this._params.pdfBug);return(0,u.A)(rl,this).set(e,s),s});return(0,u.A)(ol,this).set(e,s),s}getPageIndex(t){return Bo(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return(0,l.A)(cl,this,ul).call(this,"GetFieldObjects")}hasJSActions(){return(0,l.A)(cl,this,ul).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!==typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return(0,l.A)(cl,this,ul).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return(0,l.A)(cl,this,ul).call(this,"GetOptionalContentConfig").then(e=>new Er(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=(0,u.A)(al,this).get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then(t=>{var e,i,s,n;return{info:t[0],metadata:t[1]?new ur(t[1]):null,contentDispositionFilename:null!==(e=null===(i=this._fullReader)||void 0===i?void 0:i.filename)&&void 0!==e?e:null,contentLength:null!==(s=null===(n=this._fullReader)||void 0===n?void 0:n.contentLength)&&void 0!==s?s:null}});return(0,u.A)(al,this).set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of(0,u.A)(rl,this).values()){if(!t.cleanup())throw new Error("startCleanup: Page ".concat(t.pageNumber," is currently rendering."))}this.commonObjs.clear(),t||this.fontLoader.clear(),(0,u.A)(al,this).clear(),this.filterFactory.destroy(!0),bo.cleanup()}}cachedPageNumber(t){var e;if(!Bo(t))return null;const i=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return null!==(e=(0,u.A)(ll,this).get(i))&&void 0!==e?e:null}}function ul(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=(0,u.A)(al,this).get(t);if(i)return i;const s=this.messageHandler.sendWithPromise(t,e);return(0,u.A)(al,this).set(t,s),s}const pl=Symbol("INITIAL_DATA");var Al=new WeakMap,gl=new WeakSet;class fl{constructor(){(0,o.A)(this,gl),(0,d.A)(this,Al,Object.create(null))}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const i=(0,l.A)(gl,this,ml).call(this,t);return i.promise.then(()=>e(i.data)),null}const i=(0,u.A)(Al,this)[t];if(!i||i.data===pl)throw new Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){const e=(0,u.A)(Al,this)[t];return!!e&&e.data!==pl}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=(0,l.A)(gl,this,ml).call(this,t);i.data=e,i.resolve()}clear(){for(const e in(0,u.A)(Al,this)){var t;const{data:i}=(0,u.A)(Al,this)[e];null===i||void 0===i||null===(t=i.bitmap)||void 0===t||t.close()}(0,p.A)(Al,this,Object.create(null))}*[Symbol.iterator](){for(const t in(0,u.A)(Al,this)){const{data:e}=(0,u.A)(Al,this)[t];e!==pl&&(yield[t,e])}}}function ml(t){var e;return(e=(0,u.A)(Al,this))[t]||(e[t]=(0,n.A)((0,n.A)({},Promise.withResolvers()),{},{data:pl}))}var vl=new WeakMap;class bl{constructor(t){(0,d.A)(this,vl,null),(0,p.A)(vl,this,t),this.onContinue=null}get promise(){return(0,u.A)(vl,this).capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(0,u.A)(vl,this).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=(0,u.A)(vl,this).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=(0,u.A)(vl,this);return t.form||t.canvas&&(null===e||void 0===e?void 0:e.size)>0}}var wl=new WeakMap;class yl{constructor(t){let{callback:e,params:i,objs:s,commonObjs:n,annotationCanvasMap:a,operatorList:r,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:p=null}=t;(0,d.A)(this,wl,null),this.callback=e,this.params=i,this.objs=s,this.commonObjs=n,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=u,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===c&&"undefined"!==typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new bl(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=i.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics(t){var e,i;let{transparency:s=!1,optionalContentConfig:n}=t;if(this.cancelled)return;if(this._canvas){if(_l._.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");_l._.add(this._canvas)}this._pdfBug&&null!==(e=globalThis.StepperManager)&&void 0!==e&&e.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:a,viewport:r,transform:o,background:l}=this.params;this.gfx=new za(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:n},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:o,viewport:r,transparency:s,background:l}),this.operatorListIdx=0,this.graphicsReady=!0,null===(i=this.graphicsReadyCallback)||void 0===i||i.call(this)}cancel(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,null===(t=this.gfx)||void 0===t||t.endDrawing(),(0,u.A)(wl,this)&&(window.cancelAnimationFrame((0,u.A)(wl,this)),(0,p.A)(wl,this,null)),_l._.delete(this._canvas),this.callback(e||new Be("Rendering cancelled, page ".concat(this._pageIndex+1),i))}operatorListChanged(){var t;this.graphicsReady?(null===(t=this.stepper)||void 0===t||t.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?(0,p.A)(wl,this,window.requestAnimationFrame(()=>{(0,p.A)(wl,this,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),_l._.delete(this._canvas),this.callback())))}}var _l={_:new WeakSet};const xl="4.4.168",El="19fbc8998";function kl(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function Sl(t){return Math.max(0,Math.min(255,255*t))}class Ml{static CMYK_G(t){let[e,i,s,n]=t;return["G",1-Math.min(1,.3*e+.59*s+.11*i+n)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_rgb(t){let[e]=t;return e=Sl(e),[e,e,e]}static G_HTML(t){let[e]=t;const i=kl(e);return"#".concat(i).concat(i).concat(i)}static RGB_G(t){let[e,i,s]=t;return["G",.3*e+.59*i+.11*s]}static RGB_rgb(t){return t.map(Sl)}static RGB_HTML(t){return"#".concat(t.map(kl).join(""))}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(t){let[e,i,s,n]=t;return["RGB",1-Math.min(1,e+n),1-Math.min(1,s+n),1-Math.min(1,i+n)]}static CMYK_rgb(t){let[e,i,s,n]=t;return[Sl(1-Math.min(1,e+n)),Sl(1-Math.min(1,s+n)),Sl(1-Math.min(1,i+n))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,s]=t;const n=1-e,a=1-i,r=1-s;return["CMYK",n,a,r,Math.min(n,a,r)]}}class Cl{static setupStorage(t,e,i,s,n){const a=s.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==a.value&&(t.textContent=a.value),"print"===n)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(a.value===i.attributes.xfaOn?t.setAttribute("checked",!0):a.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===n)break;t.addEventListener("change",t=>{s.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==a.value&&t.setAttribute("value",a.value),"print"===n)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})})}break;case"select":if(null!==a.value){t.setAttribute("value",a.value);for(const t of i.children)t.attributes.value===a.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",t=>{const i=t.target.options,n=-1===i.selectedIndex?"":i[i.selectedIndex].value;s.setValue(e,{value:n})})}}static setAttributes(t){let{html:e,element:i,storage:s=null,intent:n,linkService:a}=t;const{attributes:r}=i,o=e instanceof HTMLAnchorElement;"radio"===r.type&&(r.name="".concat(r.name,"-").concat(n));for(const[l,h]of Object.entries(r))if(null!==h&&void 0!==h)switch(l){case"class":h.length&&e.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",h);break;case"style":Object.assign(e.style,h);break;case"textContent":e.textContent=h;break;default:(!o||"href"!==l&&"newWindow"!==l)&&e.setAttribute(l,h)}o&&a.addLinkAttributes(e,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(e,r.dataId,i,s)}static render(t){const e=t.annotationStorage,i=t.linkService,s=t.xfaHtml,n=t.intent||"display",a=document.createElement(s.name);s.attributes&&this.setAttributes({html:a,element:s,intent:n,linkService:i});const r="richText"!==n,o=t.div;if(o.append(a),t.viewport){const e="matrix(".concat(t.viewport.transform.join(","),")");o.style.transform=e}r&&o.setAttribute("class","xfaLayer xfaFont");const l=[];if(0===s.children.length){if(s.value){const t=document.createTextNode(s.value);a.append(t),r&&Lo.shouldBuildText(s.name)&&l.push(t)}return{textDivs:l}}const h=[[s,-1,a]];for(;h.length>0;){var c,d;const[t,s,a]=h.at(-1);if(s+1===t.children.length){h.pop();continue}const o=t.children[++h.at(-1)[1]];if(null===o)continue;const{name:u}=o;if("#text"===u){const t=document.createTextNode(o.value);l.push(t),a.append(t);continue}const p=null!==o&&void 0!==o&&null!==(c=o.attributes)&&void 0!==c&&c.xmlns?document.createElementNS(o.attributes.xmlns,u):document.createElement(u);if(a.append(p),o.attributes&&this.setAttributes({html:p,element:o,storage:e,intent:n,linkService:i}),(null===(d=o.children)||void 0===d?void 0:d.length)>0)h.push([o,-1,p]);else if(o.value){const t=document.createTextNode(o.value);r&&Lo.shouldBuildText(u)&&l.push(t),p.append(t)}}for(const u of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))u.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const e="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=e,t.div.hidden=!1}}const Rl=1e3,Tl=new WeakSet;function Pl(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class Ll{static create(t){switch(t.data.annotationType){case Z:return new jl(t);case J:return new Ul(t);case At:switch(t.data.fieldType){case"Tx":return new ql(t);case"Btn":return t.data.radioButton?new Yl(t):t.data.checkBox?new Kl(t):new Ql(t);case"Ch":return new Jl(t);case"Sig":return new Xl(t)}return new Gl(t);case ut:return new Zl(t);case $:return new Rh(t);case tt:return new Ph(t);case et:return new Ih(t);case it:return new Fh(t);case nt:return new Nh(t);case ct:return new Bh(t);case dt:return new Hh(t);case st:return new Wh(t);case at:return new zh(t);case rt:return new Vh(t);case ot:return new Uh(t);case lt:return new Gh(t);case ht:return new qh(t);case pt:return new Yh(t);default:return new Nl(t)}}}var Il=new WeakMap,Dl=new WeakMap,Fl=new WeakMap,Ol=new WeakSet;class Nl{constructor(t){let{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,o.A)(this,Ol),(0,d.A)(this,Il,null),(0,d.A)(this,Dl,!1),(0,d.A)(this,Fl,null),this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),s&&this._createQuadrilaterals()}static _hasPopupData(t){let{titleObj:e,contentsObj:i,richText:s}=t;return!!(null!==e&&void 0!==e&&e.str||null!==i&&void 0!==i&&i.str||null!==s&&void 0!==s&&s.str)}get hasPopupData(){return Nl._hasPopupData(this.data)}updateEdited(t){var e;if(!this.container)return;(0,u.A)(Il,this)||(0,p.A)(Il,this,{rect:this.data.rect.slice(0)});const{rect:i}=t;i&&(0,l.A)(Ol,this,Wl).call(this,i),null===(e=(0,u.A)(Fl,this))||void 0===e||e.popup.updateEdited(t)}resetEdited(){var t;(0,u.A)(Il,this)&&((0,l.A)(Ol,this,Wl).call(this,(0,u.A)(Il,this).rect),null===(t=(0,u.A)(Fl,this))||void 0===t||t.popup.resetEdited(),(0,p.A)(Il,this,null))}_createContainer(t){const{data:e,parent:{page:i,viewport:s}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof Gl||(n.tabIndex=Rl);const{style:a}=n;if(a.zIndex=this.parent.zIndex++,e.popupRef&&n.setAttribute("aria-haspopup","dialog"),e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Zl){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,n),n}const{width:r,height:o}=Pl(e.rect);if(!t&&e.borderStyle.width>0){a.borderWidth="".concat(e.borderStyle.width,"px");const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){const e="calc(".concat(t,"px * var(--scale-factor)) / calc(").concat(i,"px * var(--scale-factor))");a.borderRadius=e}else if(this instanceof Yl){const t="calc(".concat(r,"px * var(--scale-factor)) / calc(").concat(o,"px * var(--scale-factor))");a.borderRadius=t}switch(e.borderStyle.style){case gt:a.borderStyle="solid";break;case ft:a.borderStyle="dashed";break;case mt:Ct("Unimplemented border style: beveled");break;case vt:Ct("Unimplemented border style: inset");break;case bt:a.borderBottomStyle="solid"}const s=e.borderColor||null;s?((0,p.A)(Dl,this,!0),a.borderColor=qt.makeHexColor(0|s[0],0|s[1],0|s[2])):a.borderWidth=0}const l=qt.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:h,pageHeight:c,pageX:d,pageY:u}=s.rawDims;a.left="".concat(100*(l[0]-d)/h,"%"),a.top="".concat(100*(l[1]-u)/c,"%");const{rotation:A}=e;return e.hasOwnCanvas||0===A?(a.width="".concat(100*r/h,"%"),a.height="".concat(100*o/c,"%")):this.setRotation(A,n),n}setRotation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;const{pageWidth:i,pageHeight:s}=this.parent.viewport.rawDims,{width:n,height:a}=Pl(this.data.rect);let r,o;t%180===0?(r=100*n/i,o=100*a/s):(r=100*a/i,o=100*n/s),e.style.width="".concat(r,"%"),e.style.height="".concat(o,"%"),e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const s=i.detail[t],n=s[0],a=s.slice(1);i.target.style[e]=Ml["".concat(n,"_HTML")](a),this.annotationStorage.setValue(this.data.id,{[e]:Ml["".concat(n,"_rgb")](a)})};return Lt(this,"_commonActions",{display:t=>{const{display:e}=t.detail,i=e%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const s of Object.keys(e.detail)){const n=t[s]||i[s];null===n||void 0===n||n(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[s,n]of Object.entries(e)){const a=i[s];if(a){a({detail:{[s]:n},target:t}),delete e[s]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,s,n]=this.data.rect.map(t=>Math.fround(t));if(8===t.length){const[a,r,o,l]=t.subarray(2,6);if(s===a&&n===r&&e===o&&i===l)return}const{style:a}=this.container;let r;if((0,u.A)(Dl,this)){const{borderColor:t,borderWidth:e}=a;a.borderWidth=0,r=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">','<g fill="transparent" stroke="'.concat(t,'" stroke-width="').concat(e,'">')],this.container.classList.add("hasBorder")}const o=s-e,l=n-i,{svgFactory:h}=this,c=h.createElement("svg");c.classList.add("quadrilateralsContainer"),c.setAttribute("width",0),c.setAttribute("height",0);const d=h.createElement("defs");c.append(d);const p=h.createElement("clipPath"),A="clippath_".concat(this.data.id);p.setAttribute("id",A),p.setAttribute("clipPathUnits","objectBoundingBox"),d.append(p);for(let u=2,f=t.length;u<f;u+=8){var g;const i=t[u],s=t[u+1],a=t[u+2],c=t[u+3],d=h.createElement("rect"),A=(a-e)/o,f=(n-s)/l,m=(i-a)/o,v=(s-c)/l;d.setAttribute("x",A),d.setAttribute("y",f),d.setAttribute("width",m),d.setAttribute("height",v),p.append(d),null===(g=r)||void 0===g||g.push('<rect vector-effect="non-scaling-stroke" x="'.concat(A,'" y="').concat(f,'" width="').concat(m,'" height="').concat(v,'"/>'))}(0,u.A)(Dl,this)&&(r.push("</g></svg>')"),a.backgroundImage=r.join("")),this.container.append(c),this.container.style.clipPath="url(#".concat(A,")")}_createPopup(){const{container:t,data:e}=this;t.setAttribute("aria-haspopup","dialog");const i=(0,p.A)(Fl,this,new Zl({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:"popup_".concat(e.id),rotation:e.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(i.render())}render(){Rt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const s=this._fieldObjects[t];if(s)for(const{page:t,id:n,exportValues:a}of s){if(-1===t)continue;if(n===e)continue;const s="string"===typeof a?a:null,r=document.querySelector('[data-element-id="'.concat(n,'"]'));!r||Tl.has(r)?i.push({id:n,exportValue:s,domElement:r}):Ct("_getElementsByName - element not allowed: ".concat(n))}return i}for(const s of document.getElementsByName(t)){const{exportValue:t}=s,n=s.getAttribute("data-element-id");n!==e&&(Tl.has(s)&&i.push({id:n,exportValue:t,domElement:s}))}return i}show(){var t;this.container&&(this.container.hidden=!1),null===(t=this.popup)||void 0===t||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),null===(t=this.popup)||void 0===t||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var i;null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}}function Wl(t){const{container:{style:e},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:r,pageY:o}}}}=this;null===i||void 0===i||i.splice(0,4,...t);const{width:l,height:h}=Pl(t);e.left="".concat(100*(t[0]-r)/n,"%"),e.top="".concat(100*(a-t[3]+o)/a,"%"),0===s?(e.width="".concat(100*l/n,"%"),e.height="".concat(100*h/a,"%")):this.setRotation(s)}var Bl=new WeakSet;class jl extends Nl{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(t,{isRenderable:!0,ignoreBorder:!(null===e||void 0===e||!e.ignoreBorder),createQuadrilaterals:!0}),(0,o.A)(this,Bl),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let s=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(i,t.action),s=!0):t.attachment?((0,l.A)(Bl,this,zl).call(this,i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?((0,l.A)(Bl,this,Vl).call(this,i,t.setOCGState),s=!0):t.dest?(this._bindLink(i,t.dest),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),s=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(i,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&this.container.append(i),this.container}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&(0,l.A)(Bl,this,Hl).call(this)}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),(0,l.A)(Bl,this,Hl).call(this)}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const s of Object.keys(e.actions)){const n=i.get(s);n&&(t[n]=()=>{var t;return null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1})}t.onclick||(t.onclick=()=>!1),(0,l.A)(Bl,this,Hl).call(this)}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),(0,l.A)(Bl,this,Hl).call(this),!this._fieldObjects)return Ct('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{null===i||void 0===i||i();const{fields:t,refs:s,include:n}=e,a=[];if(0!==t.length||0!==s.length){const e=new Set(s);for(const i of t){const t=this._fieldObjects[i]||[];for(const{id:i}of t)e.add(i)}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===n&&a.push(i)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const r=this.annotationStorage,o=[];for(const e of a){const{id:t}=e;switch(o.push(t),e.type){case"text":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;r.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";r.setValue(t,{value:i});break}default:continue}const i=document.querySelector('[data-element-id="'.concat(t,'"]'));i&&(Tl.has(i)?i.dispatchEvent(new Event("resetform")):Ct("_bindResetFormAction - element not allowed: ".concat(t)))}var l;this.enableScripting&&(null===(l=this.linkService.eventBus)||void 0===l||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}));return!1}}}function Hl(){this.container.setAttribute("data-internal-link","")}function zl(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>{var t;return null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(e.content,e.filename,i),!1},(0,l.A)(Bl,this,Hl).call(this)}function Vl(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),(0,l.A)(Bl,this,Hl).call(this)}class Ul extends Nl{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class Gl extends Nl{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&("CANVAS"===(null===(e=t.previousSibling)||void 0===e?void 0:e.nodeName)&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Ut.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,n){i.includes("mouse")?t.addEventListener(i,t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{var a;if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}n&&(null===(a=this.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(t)}}))})}_setEventListeners(t,e,i,s){for(const[o,l]of i){var n,a,r;if("Action"===l||null!==(n=this.data.actions)&&void 0!==n&&n[l])"Focus"!==l&&"Blur"!==l||e||(e={focused:!1}),this._setEventListener(t,e,o,l,s),"Focus"!==l||null!==(a=this.data.actions)&&void 0!==a&&a.Blur?"Blur"!==l||null!==(r=this.data.actions)&&void 0!==r&&r.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null)}}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":qt.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||9,n=t.style;let a;const r=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),e=t/(Math.round(t/(L*s))||1);a=Math.min(s,r(e/L))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(s,r(t/L))}n.fontSize="calc(".concat(a,"px * var(--scale-factor))"),n.color=qt.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class ql extends Gl{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,s){const n=this.annotationStorage;for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=i),n.setValue(a.id,{[s]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){var s;const a=t.getValue(e,{value:this.data.fieldValue});let r=a.value||"";const o=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;o&&r.length>o&&(r=r.slice(0,o));let l=a.formattedValue||(null===(s=this.data.textContent)||void 0===s?void 0:s.join("\n"))||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const h={userValue:r,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=null!==l&&void 0!==l?l:r,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",null!==l&&void 0!==l?l:r),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),Tl.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=Rl,this._setRequired(i,this.data.required),o&&(i.maxLength=o),i.addEventListener("input",s=>{t.setValue(e,{value:s.target.value}),this.setPropertyOnSiblings(i,"value",s.target.value,"value"),h.formattedValue=null}),i.addEventListener("resetform",t=>{var e;const s=null!==(e=this.data.defaultFieldValue)&&void 0!==e?e:"";i.value=h.userValue=s,h.formattedValue=null});let c=t=>{const{formattedValue:e}=h;null!==e&&void 0!==e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var n;i.addEventListener("focus",t=>{var e;if(h.focused)return;const{target:i}=t;h.userValue&&(i.value=h.userValue),h.lastCommittedValue=i.value,h.commitKey=1,null!==(e=this.data.actions)&&void 0!==e&&e.Focus||(h.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target);const s={value(i){var s;h.userValue=null!==(s=i.detail.value)&&void 0!==s?s:"",t.setValue(e,{value:h.userValue.toString()}),i.target.value=h.userValue},formattedValue(i){const{formattedValue:s}=i.detail;h.formattedValue=s,null!==s&&void 0!==s&&i.target!==document.activeElement&&(i.target.value=s),t.setValue(e,{formattedValue:s})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{var s;const{charLimit:n}=i.detail,{target:a}=i;if(0===n)return void a.removeAttribute("maxLength");a.setAttribute("maxLength",n);let r=h.userValue;!r||r.length<=n||(r=r.slice(0,n),a.value=h.userValue=r,t.setValue(e,{value:r}),null===(s=this.linkService.eventBus)||void 0===s||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:a.selectionStart,selEnd:a.selectionEnd}}))}};this._dispatchEventFromSandbox(s,i)}),i.addEventListener("keydown",t=>{var i;h.commitKey=1;let s=-1;if("Escape"===t.key?s=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(h.commitKey=3):s=2,-1===s)return;const{value:n}=t.target;h.lastCommittedValue!==n&&(h.lastCommittedValue=n,h.userValue=n,null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:s,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});const s=c;c=null,i.addEventListener("blur",t=>{var i;if(!h.focused||!t.relatedTarget)return;null!==(i=this.data.actions)&&void 0!==i&&i.Blur||(h.focused=!1);const{value:n}=t.target;var a;(h.userValue=n,h.lastCommittedValue!==n)&&(null===(a=this.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:h.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}));s(t)}),null!==(n=this.data.actions)&&void 0!==n&&n.Keystroke&&i.addEventListener("beforeinput",t=>{var i;h.lastCommittedValue=null;const{data:s,target:n}=t,{value:a,selectionStart:r,selectionEnd:o}=n;let l=r,c=o;switch(t.inputType){case"deleteWordBackward":{const t=a.substring(0,r).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{const t=a.substring(r).match(/^[^\w]*\w*/);t&&(c+=t[0].length);break}case"deleteContentBackward":r===o&&(l-=1);break;case"deleteContentForward":r===o&&(c+=1)}t.preventDefault(),null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,change:s||"",willCommit:!1,selStart:l,selEnd:c}})}),this._setEventListeners(i,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(c&&i.addEventListener("blur",c),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/o;i.classList.add("comb"),i.style.letterSpacing="calc(".concat(t,"px * var(--scale-factor) - 1ch)")}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Xl extends Gl{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Kl extends Gl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"===typeof s&&(s="Off"!==s,t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return Tl.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=Rl,n.addEventListener("change",s=>{const{name:n,checked:a}=s.target;for(const r of this._getElementsByName(n,i)){const i=a&&r.exportValue===e.exportValue;r.domElement&&(r.domElement.checked=i),t.setValue(r.id,{value:i})}t.setValue(i,{value:a})}),n.addEventListener("resetform",t=>{const i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",e=>{const s={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}};this._dispatchEventFromSandbox(s,e)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Yl extends Gl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"===typeof s&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(const a of this._getElementsByName(e.fieldName,i))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(Tl.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.tabIndex=Rl,n.addEventListener("change",e=>{const{name:s,checked:n}=e.target;for(const a of this._getElementsByName(s,i))t.setValue(a.id,{value:!1});t.setValue(i,{value:n})}),n.addEventListener("resetform",t=>{const i=e.defaultFieldValue;t.target.checked=null!==i&&void 0!==i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){const s=e.buttonValue;n.addEventListener("updatefromsandbox",e=>{const n={value:e=>{const n=s===e.detail.value;for(const s of this._getElementsByName(e.target.name)){const e=n&&s.id===i;s.domElement&&(s.domElement.checked=e),t.setValue(s.id,{value:e})}}};this._dispatchEventFromSandbox(n,e)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Ql extends jl{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class Jl extends Gl{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");Tl.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=Rl;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",t=>{const e=this.data.defaultFieldValue;for(const i of s.options)i.selected=i.value===e});for(const h of this.data.options){const t=document.createElement("option");t.textContent=h.displayValue,t.value=h.exportValue,i.value.includes(h.exportValue)&&(t.setAttribute("selected",!0),n=!1),s.append(t)}let a=null;if(n){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),s.prepend(t),a=()=>{t.remove(),s.removeEventListener("input",a),a=null},s.addEventListener("input",a)}const r=t=>{const e=t?"value":"textContent",{options:i,multiple:n}=s;return n?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]};let o=r(!1);const l=t=>{const e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",i=>{const n={value(i){var n;null===(n=a)||void 0===n||n();const l=i.detail.value,h=new Set(Array.isArray(l)?l:[l]);for(const t of s.options)t.selected=h.has(t.value);t.setValue(e,{value:r(!0)}),o=r(!1)},multipleSelection(t){s.multiple=!0},remove(i){const n=s.options,a=i.detail.remove;if(n[a].selected=!1,s.remove(a),n.length>0){-1===Array.prototype.findIndex.call(n,t=>t.selected)&&(n[0].selected=!0)}t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},clear(i){for(;0!==s.length;)s.remove(0);t.setValue(e,{value:null,items:[]}),o=r(!1)},insert(i){const{index:n,displayValue:a,exportValue:h}=i.detail.insert,c=s.children[n],d=document.createElement("option");d.textContent=a,d.value=h,c?c.before(d):s.append(d),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},items(i){const{items:n}=i.detail;for(;0!==s.length;)s.remove(0);for(const t of n){const{displayValue:e,exportValue:i}=t,n=document.createElement("option");n.textContent=e,n.value=i,s.append(n)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:r(!0),items:l(i)}),o=r(!1)},indices(i){const s=new Set(i.detail.indices);for(const t of i.target.options)t.selected=s.has(t.index);t.setValue(e,{value:r(!0)}),o=r(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(n,i)}),s.addEventListener("input",i=>{var s;const n=r(!0),a=r(!1);t.setValue(e,{value:n}),i.preventDefault(),null===(s=this.linkService.eventBus)||void 0===s||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:a,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):s.addEventListener("input",function(i){t.setValue(e,{value:r(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Zl extends Nl{constructor(t){const{data:e,elements:i}=t;super(t,{isRenderable:Nl._hasPopupData(e)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new bh({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),e=[];for(const i of this.elements)i.popup=t,e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(t=>"".concat(Zt).concat(t)).join(",")),this.container}}var $l=new WeakMap,th=new WeakMap,eh=new WeakMap,ih=new WeakMap,sh=new WeakMap,nh=new WeakMap,ah=new WeakMap,rh=new WeakMap,oh=new WeakMap,lh=new WeakMap,hh=new WeakMap,ch=new WeakMap,dh=new WeakMap,uh=new WeakMap,ph=new WeakMap,Ah=new WeakMap,gh=new WeakMap,fh=new WeakMap,mh=new WeakMap,vh=new WeakSet;class bh{constructor(t){let{container:e,color:i,elements:s,titleObj:n,modificationDate:a,contentsObj:r,richText:h,parent:c,rect:A,parentRect:g,open:f}=t;(0,o.A)(this,vh),(0,d.A)(this,$l,(0,l.A)(vh,this,Eh).bind(this)),(0,d.A)(this,th,(0,l.A)(vh,this,Ch).bind(this)),(0,d.A)(this,eh,(0,l.A)(vh,this,Mh).bind(this)),(0,d.A)(this,ih,(0,l.A)(vh,this,Sh).bind(this)),(0,d.A)(this,sh,null),(0,d.A)(this,nh,null),(0,d.A)(this,ah,null),(0,d.A)(this,rh,null),(0,d.A)(this,oh,null),(0,d.A)(this,lh,null),(0,d.A)(this,hh,null),(0,d.A)(this,ch,!1),(0,d.A)(this,dh,null),(0,d.A)(this,uh,null),(0,d.A)(this,ph,null),(0,d.A)(this,Ah,null),(0,d.A)(this,gh,null),(0,d.A)(this,fh,null),(0,d.A)(this,mh,!1),(0,p.A)(nh,this,e),(0,p.A)(gh,this,n),(0,p.A)(ah,this,r),(0,p.A)(Ah,this,h),(0,p.A)(lh,this,c),(0,p.A)(sh,this,i),(0,p.A)(ph,this,A),(0,p.A)(hh,this,g),(0,p.A)(oh,this,s),(0,p.A)(rh,this,Ye.toDateObject(a)),this.trigger=s.flatMap(t=>t.getElementsToTriggerPopup());for(const o of this.trigger)o.addEventListener("click",(0,u.A)(ih,this)),o.addEventListener("mouseenter",(0,u.A)(eh,this)),o.addEventListener("mouseleave",(0,u.A)(th,this)),o.classList.add("popupTriggerArea");for(const o of s){var m;null===(m=o.container)||void 0===m||m.addEventListener("keydown",(0,u.A)($l,this))}(0,u.A)(nh,this).hidden=!0,f&&(0,l.A)(vh,this,Sh).call(this)}render(){if((0,u.A)(dh,this))return;const t=(0,p.A)(dh,this,document.createElement("div"));if(t.className="popup",(0,u.A)(sh,this)){const e=t.style.outlineColor=qt.makeHexColor(...(0,u.A)(sh,this));if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))t.style.backgroundColor="color-mix(in srgb, ".concat(e," 30%, white)");else{const e=.7;t.style.backgroundColor=qt.makeHexColor(...(0,u.A)(sh,this).map(t=>Math.floor(e*(255-t)+t)))}}const e=document.createElement("span");e.className="header";const i=document.createElement("h1");if(e.append(i),({dir:i.dir,str:i.textContent}=(0,u.A)(gh,this)),t.append(e),(0,u.A)(rh,this)){const t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),t.setAttribute("data-l10n-args",JSON.stringify({date:(0,u.A)(rh,this).toLocaleDateString(),time:(0,u.A)(rh,this).toLocaleTimeString()})),e.append(t)}const s=h(vh,this,wh);if(s)Cl.render({xfaHtml:s,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const e=this._formatContents((0,u.A)(ah,this));t.append(e)}(0,u.A)(nh,this).append(t)}_formatContents(t){let{str:e,dir:i}=t;const s=document.createElement("p");s.classList.add("popupContent"),s.dir=i;const n=e.split(/(?:\r\n?|\n)/);for(let a=0,r=n.length;a<r;++a){const t=n[a];s.append(document.createTextNode(t)),a<r-1&&s.append(document.createElement("br"))}return s}updateEdited(t){var e;let{rect:i,popupContent:s}=t;(0,u.A)(fh,this)||(0,p.A)(fh,this,{contentsObj:(0,u.A)(ah,this),richText:(0,u.A)(Ah,this)}),i&&(0,p.A)(uh,this,null),s&&((0,p.A)(Ah,this,(0,l.A)(vh,this,xh).call(this,s)),(0,p.A)(ah,this,null)),null===(e=(0,u.A)(dh,this))||void 0===e||e.remove(),(0,p.A)(dh,this,null)}resetEdited(){var t;(0,u.A)(fh,this)&&(({contentsObj:a(p.A,[ah,this])._,richText:a(p.A,[Ah,this])._}=(0,u.A)(fh,this)),(0,p.A)(fh,this,null),null===(t=(0,u.A)(dh,this))||void 0===t||t.remove(),(0,p.A)(dh,this,null),(0,p.A)(uh,this,null))}forceHide(){(0,p.A)(mh,this,this.isVisible),(0,u.A)(mh,this)&&((0,u.A)(nh,this).hidden=!0)}maybeShow(){(0,u.A)(mh,this)&&((0,u.A)(dh,this)||(0,l.A)(vh,this,Mh).call(this),(0,p.A)(mh,this,!1),(0,u.A)(nh,this).hidden=!1)}get isVisible(){return!1===(0,u.A)(nh,this).hidden}}function wh(t){const e=(0,u.A)(Ah,t),i=(0,u.A)(ah,t);return null===e||void 0===e||!e.str||null!==i&&void 0!==i&&i.str&&i.str!==e.str?null:(0,u.A)(Ah,t).html||null}function yh(t){var e;return(null===(e=h(vh,t,wh))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.fontSize)||0}function _h(t){var e;return(null===(e=h(vh,t,wh))||void 0===e||null===(e=e.attributes)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.color)||null}function xh(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:h(vh,this,_h),fontSize:h(vh,this,yh)?"calc(".concat(h(vh,this,yh),"px * var(--scale-factor))"):""}};for(const n of t.split("\n"))e.push({name:"span",value:n,attributes:s});return i}function Eh(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&(0,u.A)(ch,this))&&(0,l.A)(vh,this,Sh).call(this)}function kh(){if(null!==(0,u.A)(uh,this))return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:s,pageY:n}}}=(0,u.A)(lh,this);let a=!!(0,u.A)(hh,this),r=a?(0,u.A)(hh,this):(0,u.A)(ph,this);for(const p of(0,u.A)(oh,this))if(!r||null!==qt.intersect(p.data.rect,r)){r=p.data.rect,a=!0;break}const o=qt.normalizeRect([r[0],t[3]-r[1]+t[1],r[2],t[3]-r[3]+t[1]]),l=a?r[2]-r[0]+5:0,h=o[0]+l,c=o[1];(0,p.A)(uh,this,[100*(h-s)/e,100*(c-n)/i]);const{style:d}=(0,u.A)(nh,this);d.left="".concat((0,u.A)(uh,this)[0],"%"),d.top="".concat((0,u.A)(uh,this)[1],"%")}function Sh(){(0,p.A)(ch,this,!(0,u.A)(ch,this)),(0,u.A)(ch,this)?((0,l.A)(vh,this,Mh).call(this),(0,u.A)(nh,this).addEventListener("click",(0,u.A)(ih,this)),(0,u.A)(nh,this).addEventListener("keydown",(0,u.A)($l,this))):((0,l.A)(vh,this,Ch).call(this),(0,u.A)(nh,this).removeEventListener("click",(0,u.A)(ih,this)),(0,u.A)(nh,this).removeEventListener("keydown",(0,u.A)($l,this)))}function Mh(){(0,u.A)(dh,this)||this.render(),this.isVisible?(0,u.A)(ch,this)&&(0,u.A)(nh,this).classList.add("focused"):((0,l.A)(vh,this,kh).call(this),(0,u.A)(nh,this).hidden=!1,(0,u.A)(nh,this).style.zIndex=parseInt((0,u.A)(nh,this).style.zIndex)+1e3)}function Ch(){(0,u.A)(nh,this).classList.remove("focused"),!(0,u.A)(ch,this)&&this.isVisible&&((0,u.A)(nh,this).hidden=!0,(0,u.A)(nh,this).style.zIndex=parseInt((0,u.A)(nh,this).style.zIndex)-1e3)}class Rh extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=H.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}var Th=new WeakMap;class Ph extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,d.A)(this,Th,null)}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:e,height:i}=Pl(t.rect),s=this.svgFactory.create(e,i,!0),n=(0,p.A)(Th,this,this.svgFactory.createElement("svg:line"));return n.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),n.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),n.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),n.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),n.setAttribute("stroke-width",t.borderStyle.width||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),s.append(n),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,u.A)(Th,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Lh=new WeakMap;class Ih extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,d.A)(this,Lh,null)}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:e,height:i}=Pl(t.rect),s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,a=(0,p.A)(Lh,this,this.svgFactory.createElement("svg:rect"));return a.setAttribute("x",n/2),a.setAttribute("y",n/2),a.setAttribute("width",e-n),a.setAttribute("height",i-n),a.setAttribute("stroke-width",n||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,u.A)(Lh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Dh=new WeakMap;class Fh extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,d.A)(this,Dh,null)}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:e,height:i}=Pl(t.rect),s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,a=(0,p.A)(Dh,this,this.svgFactory.createElement("svg:ellipse"));return a.setAttribute("cx",e/2),a.setAttribute("cy",i/2),a.setAttribute("rx",e/2-n/2),a.setAttribute("ry",i/2-n/2),a.setAttribute("stroke-width",n||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,u.A)(Dh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}var Oh=new WeakMap;class Nh extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,d.A)(this,Oh,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:i,popupRef:s}}=this;if(!e)return this.container;const{width:n,height:a}=Pl(t),r=this.svgFactory.create(n,a,!0);let o=[];for(let h=0,c=e.length;h<c;h+=2){const i=e[h]-t[0],s=t[3]-e[h+1];o.push("".concat(i,",").concat(s))}o=o.join(" ");const l=(0,p.A)(Oh,this,this.svgFactory.createElement(this.svgElementName));return l.setAttribute("points",o),l.setAttribute("stroke-width",i.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!s&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,u.A)(Oh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}class Wh extends Nh{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Bh extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var jh=new WeakMap;class Hh extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,d.A)(this,jh,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=H.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:e,borderStyle:i,popupRef:s}}=this,{width:n,height:a}=Pl(t),r=this.svgFactory.create(n,a,!0);for(const o of e){let e=[];for(let i=0,s=o.length;i<s;i+=2){const s=o[i]-t[0],n=t[3]-o[i+1];e.push("".concat(s,",").concat(n))}e=e.join(" ");const n=this.svgFactory.createElement(this.svgElementName);(0,u.A)(jh,this).push(n),n.setAttribute("points",e),n.setAttribute("stroke-width",i.width||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),!s&&this.hasPopupData&&this._createPopup(),r.append(n)}return this.container.append(r),this.container}getElementsToTriggerPopup(){return(0,u.A)(jh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}class zh extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class Vh extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class Uh extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class Gh extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class qh extends Nl{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Xh=new WeakMap,Kh=new WeakSet;class Yh extends Nl{constructor(t){var e;super(t,{isRenderable:!0}),(0,o.A)(this,Kh),(0,d.A)(this,Xh,null);const{file:i}=this.data;this.filename=i.filename,this.content=i.content,null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("fileattachmentannotation",(0,n.A)({source:this},i))}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let i;e.hasAppearance||0===e.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(e.name)?"paperclip":"pushpin",".svg"),e.fillAlpha&&e.fillAlpha<1&&(i.style="filter: opacity(".concat(Math.round(100*e.fillAlpha),"%);"))),i.addEventListener("dblclick",(0,l.A)(Kh,this,Qh).bind(this)),(0,p.A)(Xh,this,i);const{isMac:s}=Ut.platform;return t.addEventListener("keydown",t=>{"Enter"===t.key&&(s?t.metaKey:t.ctrlKey)&&(0,l.A)(Kh,this,Qh).call(this)}),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return(0,u.A)(Xh,this)}addHighlightArea(){this.container.classList.add("highlightArea")}}function Qh(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.content,this.filename)}var Jh=new WeakMap,Zh=new WeakMap,$h=new WeakMap,tc=new WeakSet;class ec{constructor(t){let{div:e,accessibilityManager:i,annotationCanvasMap:s,annotationEditorUIManager:n,page:a,viewport:r}=t;(0,o.A)(this,tc),(0,d.A)(this,Jh,null),(0,d.A)(this,Zh,null),(0,d.A)(this,$h,new Map),this.div=e,(0,p.A)(Jh,this,i),(0,p.A)(Zh,this,s),this.page=a,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=n}async render(t){const{annotations:e}=t,i=this.div;ti(i,this.viewport);const s=new Map,n={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new Ne,annotationStorage:t.annotationStorage||new sa,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const r of e){if(r.noHTML)continue;const t=r.annotationType===ut;if(t){const t=s.get(r.id);if(!t)continue;n.elements=t}else{const{width:t,height:e}=Pl(r.rect);if(t<=0||e<=0)continue}n.data=r;const e=Ll.create(n);if(!e.isRenderable)continue;if(!t&&r.popupRef){const t=s.get(r.popupRef);t?t.push(e):s.set(r.popupRef,[e])}const i=e.render();var a;if(r.hidden&&(i.style.visibility="hidden"),(0,l.A)(tc,this,ic).call(this,i,r.id),e.annotationEditorType>0)(0,u.A)($h,this).set(e.data.id,e),null===(a=this._annotationEditorUIManager)||void 0===a||a.renderAnnotationElement(e)}(0,l.A)(tc,this,sc).call(this)}update(t){let{viewport:e}=t;const i=this.div;this.viewport=e,ti(i,{rotation:e.rotation}),(0,l.A)(tc,this,sc).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from((0,u.A)($h,this).values())}getEditableAnnotation(t){return(0,u.A)($h,this).get(t)}}function ic(t,e){var i;const s=t.firstChild||t;s.id="".concat(Zt).concat(e),this.div.append(t),null===(i=(0,u.A)(Jh,this))||void 0===i||i.moveElementInDOM(this.div,t,s,!1)}function sc(){if(!(0,u.A)(Zh,this))return;const t=this.div;for(const[e,i]of(0,u.A)(Zh,this)){const s=t.querySelector('[data-annotation-id="'.concat(e,'"]'));if(!s)continue;i.className="annotationContent";const{firstChild:n}=s;n?"CANVAS"===n.nodeName?n.replaceWith(i):n.classList.contains("annotationContent")?n.after(i):n.before(i):s.append(i)}(0,u.A)(Zh,this).clear()}const nc=/\r\n?|\n/g;var ac=new WeakMap,rc=new WeakMap,oc=new WeakMap,lc=new WeakMap,hc=new WeakMap,cc=new WeakMap,dc=new WeakMap,uc=new WeakMap,pc=new WeakMap,Ac=new WeakMap,gc=new WeakSet;class fc extends In{static get _keyboardManager(){const t=fc.prototype,e=t=>t.isEmpty(),i=Ls.TRANSLATE_SMALL,s=Ls.TRANSLATE_BIG;return Lt(this,"_keyboardManager",new Oi([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}]]))}constructor(t){super((0,n.A)((0,n.A)({},t),{},{name:"freeTextEditor"})),(0,o.A)(this,gc),(0,d.A)(this,ac,this.editorDivBlur.bind(this)),(0,d.A)(this,rc,this.editorDivFocus.bind(this)),(0,d.A)(this,oc,this.editorDivInput.bind(this)),(0,d.A)(this,lc,this.editorDivKeydown.bind(this)),(0,d.A)(this,hc,this.editorDivPaste.bind(this)),(0,d.A)(this,cc,void 0),(0,d.A)(this,dc,""),(0,d.A)(this,uc,"".concat(this.id,"-editor")),(0,d.A)(this,pc,void 0),(0,d.A)(this,Ac,null),(0,p.A)(cc,this,t.color||fc._defaultColor||In._defaultLineColor),(0,p.A)(pc,this,t.fontSize||fc._defaultFontSize)}static initialize(t,e){In.initialize(t,e,{strings:["pdfjs-free-text-default-content"]});const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case z.FREETEXT_SIZE:fc._defaultFontSize=e;break;case z.FREETEXT_COLOR:fc._defaultColor=e}}updateParams(t,e){switch(t){case z.FREETEXT_SIZE:(0,l.A)(gc,this,mc).call(this,e);break;case z.FREETEXT_COLOR:(0,l.A)(gc,this,vc).call(this,e)}}static get defaultPropertiesToUpdate(){return[[z.FREETEXT_SIZE,fc._defaultFontSize],[z.FREETEXT_COLOR,fc._defaultColor||In._defaultLineColor]]}get propertiesToUpdate(){return[[z.FREETEXT_SIZE,(0,u.A)(pc,this)],[z.FREETEXT_COLOR,(0,u.A)(cc,this)]]}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-fc._internalPadding*t,-(fc._internalPadding+(0,u.A)(pc,this))*t]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(H.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant");const t=this._uiManager._signal;this.editorDiv.addEventListener("keydown",(0,u.A)(lc,this),{signal:t}),this.editorDiv.addEventListener("focus",(0,u.A)(rc,this),{signal:t}),this.editorDiv.addEventListener("blur",(0,u.A)(ac,this),{signal:t}),this.editorDiv.addEventListener("input",(0,u.A)(oc,this),{signal:t}),this.editorDiv.addEventListener("paste",(0,u.A)(hc,this),{signal:t})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",(0,u.A)(uc,this)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",(0,u.A)(lc,this)),this.editorDiv.removeEventListener("focus",(0,u.A)(rc,this)),this.editorDiv.removeEventListener("blur",(0,u.A)(ac,this)),this.editorDiv.removeEventListener("input",(0,u.A)(oc,this)),this.editorDiv.removeEventListener("paste",(0,u.A)(hc,this)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var t;this.width||(this.enableEditMode(),this.editorDiv.focus(),null!==(t=this._initialOptions)&&void 0!==t&&t.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=(0,u.A)(dc,this),e=(0,p.A)(dc,this,(0,l.A)(gc,this,bc).call(this).trimEnd());if(t===e)return;const i=t=>{(0,p.A)(dc,this,t),t?((0,l.A)(gc,this,_c).call(this),this._uiManager.rebuild(this),(0,l.A)(gc,this,wc).call(this)):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),(0,l.A)(gc,this,wc).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){fc._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",(0,u.A)(uc,this)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),In._l10nPromise.get("pdfjs-free-text-default-content").then(t=>{var e;return null===(e=this.editorDiv)||void 0===e?void 0:e.setAttribute("default-content",t)}),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize="calc(".concat((0,u.A)(pc,this),"px * var(--scale-factor))"),i.color=(0,u.A)(cc,this),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),yi(this,this.div,["dblclick","keydown"]),this.width){const[i,s]=this.parentDimensions;if(this.annotationElementId){const{position:n}=(0,u.A)(Ac,this);let[a,r]=this.getInitialTranslation();[a,r]=this.pageTranslationToScreen(a,r);const[o,l]=this.pageDimensions,[h,c]=this.pageTranslation;let d,p;switch(this.rotation){case 0:d=t+(n[0]-h)/o,p=e+this.height-(n[1]-c)/l;break;case 90:d=t+(n[0]-h)/o,p=e-(n[1]-c)/l,[a,r]=[r,-a];break;case 180:d=t-this.width+(n[0]-h)/o,p=e-(n[1]-c)/l,[a,r]=[-a,-r];break;case 270:d=t+(n[0]-h-this.height*l)/o,p=e+(n[1]-c-this.width*o)/l,[a,r]=[-r,a]}this.setAt(d*i,p*s,a,r)}else this.setAt(t*i,e*s,this.width*i,this.height*s);(0,l.A)(gc,this,_c).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();const s=Ec.call(fc,e.getData("text")||"").replaceAll(nc,"\n");if(!s)return;const n=window.getSelection();if(!n.rangeCount)return;this.editorDiv.normalize(),n.deleteFromDocument();const a=n.getRangeAt(0);if(!s.includes("\n"))return a.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),void n.collapseToStart();const{startContainer:r,startOffset:o}=a,h=[],c=[];if(r.nodeType===Node.TEXT_NODE){const t=r.parentElement;if(c.push(r.nodeValue.slice(o).replaceAll(nc,"")),t!==this.editorDiv){let e=h;for(const i of this.editorDiv.childNodes)i!==t?e.push(yc.call(fc,i)):e=c}h.push(r.nodeValue.slice(0,o).replaceAll(nc,""))}else if(r===this.editorDiv){let t=h,e=0;for(const i of this.editorDiv.childNodes)e++===o&&(t=c),t.push(yc.call(fc,i))}(0,p.A)(dc,this,"".concat(h.join("\n")).concat(s).concat(c.join("\n"))),(0,l.A)(gc,this,_c).call(this);const d=new Range;let u=h.reduce((t,e)=>t+e.length,0);for(const{firstChild:l}of this.editorDiv.childNodes)if(l.nodeType===Node.TEXT_NODE){const t=l.nodeValue.length;if(u<=t){d.setStart(l,u),d.setEnd(l,u);break}u-=t}n.removeAllRanges(),n.addRange(d)}get contentDiv(){return this.editorDiv}static deserialize(t,e,i){let s=null;if(t instanceof Rh){const{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:n,rotation:a,id:r},textContent:o,textPosition:l,parent:{page:{pageNumber:h}}}=t;if(!o||0===o.length)return null;s=t={annotationType:H.FREETEXT,color:Array.from(i),fontSize:e,value:o.join("\n"),position:l,pageIndex:h-1,rect:n.slice(0),rotation:a,id:r,deleted:!1}}const n=super.deserialize(t,e,i);return(0,p.A)(pc,n,t.fontSize),(0,p.A)(cc,n,qt.makeHexColor(...t.color)),(0,p.A)(dc,n,Ec.call(fc,t.value)),n.annotationElementId=t.id||null,(0,p.A)(Ac,n,s),n}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const e=fc._internalPadding*this.parentScale,i=this.getRect(e,e),s=In._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:(0,u.A)(cc,this)),n={annotationType:H.FREETEXT,color:s,fontSize:(0,u.A)(pc,this),value:(0,l.A)(gc,this,xc).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!(0,l.A)(gc,this,kc).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(this.deleted)return e;const{style:i}=e;i.fontSize="calc(".concat((0,u.A)(pc,this),"px * var(--scale-factor))"),i.color=(0,u.A)(cc,this),e.replaceChildren();for(const n of(0,u.A)(dc,this).split("\n")){const t=document.createElement("div");t.append(n?document.createTextNode(n):document.createElement("br")),e.append(t)}const s=fc._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(s,s),popupContent:(0,u.A)(dc,this)}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}function mc(t){const e=t=>{this.editorDiv.style.fontSize="calc(".concat(t,"px * var(--scale-factor))"),this.translate(0,-(t-(0,u.A)(pc,this))*this.parentScale),(0,p.A)(pc,this,t),(0,l.A)(gc,this,wc).call(this)},i=(0,u.A)(pc,this);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:z.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function vc(t){const e=t=>{(0,p.A)(cc,this,this.editorDiv.style.color=t)},i=(0,u.A)(cc,this);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:z.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function bc(){const t=[];this.editorDiv.normalize();for(const e of this.editorDiv.childNodes)t.push(yc.call(y,e));return t.join("\n")}function wc(){const[t,e]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,s=e.style.display,n=e.classList.contains("hidden");e.classList.remove("hidden"),e.style.display="hidden",t.div.append(this.div),i=e.getBoundingClientRect(),e.remove(),e.style.display=s,e.classList.toggle("hidden",n)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()}function yc(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(nc,"")}function _c(){if(this.editorDiv.replaceChildren(),(0,u.A)(dc,this))for(const t of(0,u.A)(dc,this).split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}function xc(){return(0,u.A)(dc,this).replaceAll("\xa0"," ")}function Ec(t){return t.replaceAll(" ","\xa0")}function kc(t){const{value:e,fontSize:i,color:s,pageIndex:n}=(0,u.A)(Ac,this);return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==s[e])||t.pageIndex!==n}y=fc,(0,c.A)(fc,"_freeTextDefaultContent",""),(0,c.A)(fc,"_internalPadding",0),(0,c.A)(fc,"_defaultColor",null),(0,c.A)(fc,"_defaultFontSize",10),(0,c.A)(fc,"_type","freetext"),(0,c.A)(fc,"_editorType",H.FREETEXT);var Sc=new WeakMap,Mc=new WeakMap,Cc=new WeakMap,Rc=new WeakSet;class Tc{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];(0,o.A)(this,Rc),(0,d.A)(this,Sc,void 0),(0,d.A)(this,Mc,[]),(0,d.A)(this,Cc,[]);let n=1/0,a=-1/0,r=1/0,l=-1/0;const h=10**-4;for(const{x:o,y:d,width:p,height:b}of t){const t=Math.floor((o-e)/h)*h,i=Math.ceil((o+p+e)/h)*h,s=Math.floor((d-e)/h)*h,c=Math.ceil((d+b+e)/h)*h,A=[t,s,c,!0],g=[i,s,c,!1];(0,u.A)(Mc,this).push(A,g),n=Math.min(n,t),a=Math.max(a,i),r=Math.min(r,s),l=Math.max(l,c)}const c=a-n+2*i,A=l-r+2*i,g=n-i,f=r-i,m=(0,u.A)(Mc,this).at(s?-1:-2),v=[m[0],m[2]];for(const o of(0,u.A)(Mc,this)){const[t,e,i]=o;o[0]=(t-g)/c,o[1]=(e-f)/A,o[2]=(i-f)/A}(0,p.A)(Sc,this,{x:g,y:f,width:c,height:A,lastPoint:v})}getOutlines(){(0,u.A)(Mc,this).sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);const t=[];for(const e of(0,u.A)(Mc,this))e[3]?(t.push(...(0,l.A)(Rc,this,Fc).call(this,e)),(0,l.A)(Rc,this,Ic).call(this,e)):((0,l.A)(Rc,this,Dc).call(this,e),t.push(...(0,l.A)(Rc,this,Fc).call(this,e)));return(0,l.A)(Rc,this,Pc).call(this,t)}}function Pc(t){const e=[],i=new Set;for(const a of t){const[t,i,s]=a;e.push([t,i,a],[t,s,a])}e.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let a=0,r=e.length;a<r;a+=2){const t=e[a][2],s=e[a+1][2];t.push(s),s.push(t),i.add(t),i.add(s)}const s=[];let n;for(;i.size>0;){const t=i.values().next().value;let[e,a,r,o,l]=t;i.delete(t);let h=e,c=a;for(n=[e,r],s.push(n);;){let t;if(i.has(o))t=o;else{if(!i.has(l))break;t=l}i.delete(t),[e,a,r,o,l]=t,h!==e&&(n.push(h,c,e,c===a?a:r),h=e),c=c===a?r:a}n.push(h,c)}return new Bc(s,(0,u.A)(Sc,this))}function Lc(t){const e=(0,u.A)(Cc,this);let i=0,s=e.length-1;for(;i<=s;){const n=i+s>>1,a=e[n][0];if(a===t)return n;a<t?i=n+1:s=n-1}return s+1}function Ic(t){let[,e,i]=t;const s=(0,l.A)(Rc,this,Lc).call(this,e);(0,u.A)(Cc,this).splice(s,0,[e,i])}function Dc(t){let[,e,i]=t;const s=(0,l.A)(Rc,this,Lc).call(this,e);for(let n=s;n<(0,u.A)(Cc,this).length;n++){const[t,s]=(0,u.A)(Cc,this)[n];if(t!==e)break;if(t===e&&s===i)return void(0,u.A)(Cc,this).splice(n,1)}for(let n=s-1;n>=0;n--){const[t,s]=(0,u.A)(Cc,this)[n];if(t!==e)break;if(t===e&&s===i)return void(0,u.A)(Cc,this).splice(n,1)}}function Fc(t){const[e,i,s]=t,n=[[e,i,s]],a=(0,l.A)(Rc,this,Lc).call(this,s);for(let r=0;r<a;r++){const[t,i]=(0,u.A)(Cc,this)[r];for(let s=0,a=n.length;s<a;s++){const[,r,o]=n[s];if(!(i<=r||o<=t))if(r>=t)if(o>i)n[s][1]=i;else{if(1===a)return[];n.splice(s,1),s--,a--}else n[s][2]=t,o>i&&n.push([e,i,o])}}return n}class Oc{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(t,e){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof ud}}var Nc=new WeakMap,Wc=new WeakMap;class Bc extends Oc{constructor(t,e){super(),(0,d.A)(this,Nc,void 0),(0,d.A)(this,Wc,void 0),(0,p.A)(Wc,this,t),(0,p.A)(Nc,this,e)}toSVGPath(){const t=[];for(const e of(0,u.A)(Wc,this)){let[i,s]=e;t.push("M".concat(i," ").concat(s));for(let n=2;n<e.length;n+=2){const a=e[n],r=e[n+1];a===i?(t.push("V".concat(r)),s=r):r===s&&(t.push("H".concat(a)),i=a)}t.push("Z")}return t.join(" ")}serialize(t,e){let[i,s,n,a]=t;const r=[],o=n-i,l=a-s;for(const h of(0,u.A)(Wc,this)){const t=new Array(h.length);for(let e=0;e<h.length;e+=2)t[e]=i+h[e]*o,t[e+1]=a-h[e+1]*l;r.push(t)}return r}get box(){return(0,u.A)(Nc,this)}}var jc=new WeakMap,Hc=new WeakMap,zc=new WeakMap,Vc=new WeakMap,Uc=new WeakMap,Gc=new WeakMap,qc=new WeakMap,Xc=new WeakMap,Kc=new WeakMap,Yc=new WeakMap,Qc=new WeakMap,Jc=new WeakMap,Zc=new WeakMap,$c=new WeakSet;class td{constructor(t,e,i,s,n){let{x:a,y:r}=t,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;(0,o.A)(this,$c),(0,d.A)(this,jc,void 0),(0,d.A)(this,Hc,[]),(0,d.A)(this,zc,void 0),(0,d.A)(this,Vc,void 0),(0,d.A)(this,Uc,[]),(0,d.A)(this,Gc,new Float64Array(18)),(0,d.A)(this,qc,void 0),(0,d.A)(this,Xc,void 0),(0,d.A)(this,Kc,void 0),(0,d.A)(this,Yc,void 0),(0,d.A)(this,Qc,void 0),(0,d.A)(this,Jc,void 0),(0,d.A)(this,Zc,[]),(0,p.A)(jc,this,e),(0,p.A)(Jc,this,s*i),(0,p.A)(Vc,this,n),(0,u.A)(Gc,this).set([NaN,NaN,NaN,NaN,a,r],6),(0,p.A)(zc,this,l),(0,p.A)(Yc,this,id._*i),(0,p.A)(Kc,this,sd._*i),(0,p.A)(Qc,this,i),(0,u.A)(Zc,this).push(a,r)}get free(){return!0}isEmpty(){return isNaN((0,u.A)(Gc,this)[8])}add(t){var e;let{x:i,y:s}=t;(0,p.A)(qc,this,i),(0,p.A)(Xc,this,s);const[n,a,r,o]=(0,u.A)(jc,this);let[l,h,c,d]=(0,u.A)(Gc,this).subarray(8,12);const A=i-c,g=s-d,f=Math.hypot(A,g);if(f<(0,u.A)(Kc,this))return!1;const m=f-(0,u.A)(Yc,this),v=m/f,b=v*A,w=v*g;let y=l,_=h;l=c,h=d,c+=b,d+=w,null===(e=(0,u.A)(Zc,this))||void 0===e||e.push(i,s);const x=b/m,E=-w/m*(0,u.A)(Jc,this),k=x*(0,u.A)(Jc,this);if((0,u.A)(Gc,this).set((0,u.A)(Gc,this).subarray(2,8),0),(0,u.A)(Gc,this).set([c+E,d+k],4),(0,u.A)(Gc,this).set((0,u.A)(Gc,this).subarray(14,18),12),(0,u.A)(Gc,this).set([c-E,d-k],16),isNaN((0,u.A)(Gc,this)[6]))return 0===(0,u.A)(Uc,this).length&&((0,u.A)(Gc,this).set([l+E,h+k],2),(0,u.A)(Uc,this).push(NaN,NaN,NaN,NaN,(l+E-n)/r,(h+k-a)/o),(0,u.A)(Gc,this).set([l-E,h-k],14),(0,u.A)(Hc,this).push(NaN,NaN,NaN,NaN,(l-E-n)/r,(h-k-a)/o)),(0,u.A)(Gc,this).set([y,_,l,h,c,d],6),!this.isEmpty();(0,u.A)(Gc,this).set([y,_,l,h,c,d],6);return Math.abs(Math.atan2(_-h,y-l)-Math.atan2(w,b))<Math.PI/2?([l,h,c,d]=(0,u.A)(Gc,this).subarray(2,6),(0,u.A)(Uc,this).push(NaN,NaN,NaN,NaN,((l+c)/2-n)/r,((h+d)/2-a)/o),[l,h,y,_]=(0,u.A)(Gc,this).subarray(14,18),(0,u.A)(Hc,this).push(NaN,NaN,NaN,NaN,((y+l)/2-n)/r,((_+h)/2-a)/o),!0):([y,_,l,h,c,d]=(0,u.A)(Gc,this).subarray(0,6),(0,u.A)(Uc,this).push(((y+5*l)/6-n)/r,((_+5*h)/6-a)/o,((5*l+c)/6-n)/r,((5*h+d)/6-a)/o,((l+c)/2-n)/r,((h+d)/2-a)/o),[c,d,l,h,y,_]=(0,u.A)(Gc,this).subarray(12,18),(0,u.A)(Hc,this).push(((y+5*l)/6-n)/r,((_+5*h)/6-a)/o,((5*l+c)/6-n)/r,((5*h+d)/6-a)/o,((l+c)/2-n)/r,((h+d)/2-a)/o),!0)}toSVGPath(){if(this.isEmpty())return"";const t=(0,u.A)(Uc,this),e=(0,u.A)(Hc,this),i=(0,u.A)(Gc,this).subarray(4,6),s=(0,u.A)(Gc,this).subarray(16,18),[n,a,r,o]=(0,u.A)(jc,this),[h,c,d,p]=(0,l.A)($c,this,ed).call(this);if(isNaN((0,u.A)(Gc,this)[6])&&!this.isEmpty())return"M".concat(((0,u.A)(Gc,this)[2]-n)/r," ").concat(((0,u.A)(Gc,this)[3]-a)/o," L").concat(((0,u.A)(Gc,this)[4]-n)/r," ").concat(((0,u.A)(Gc,this)[5]-a)/o," L").concat(h," ").concat(c," L").concat(d," ").concat(p," L").concat(((0,u.A)(Gc,this)[16]-n)/r," ").concat(((0,u.A)(Gc,this)[17]-a)/o," L").concat(((0,u.A)(Gc,this)[14]-n)/r," ").concat(((0,u.A)(Gc,this)[15]-a)/o," Z");const A=[];A.push("M".concat(t[4]," ").concat(t[5]));for(let l=6;l<t.length;l+=6)isNaN(t[l])?A.push("L".concat(t[l+4]," ").concat(t[l+5])):A.push("C".concat(t[l]," ").concat(t[l+1]," ").concat(t[l+2]," ").concat(t[l+3]," ").concat(t[l+4]," ").concat(t[l+5]));A.push("L".concat((i[0]-n)/r," ").concat((i[1]-a)/o," L").concat(h," ").concat(c," L").concat(d," ").concat(p," L").concat((s[0]-n)/r," ").concat((s[1]-a)/o));for(let l=e.length-6;l>=6;l-=6)isNaN(e[l])?A.push("L".concat(e[l+4]," ").concat(e[l+5])):A.push("C".concat(e[l]," ").concat(e[l+1]," ").concat(e[l+2]," ").concat(e[l+3]," ").concat(e[l+4]," ").concat(e[l+5]));return A.push("L".concat(e[4]," ").concat(e[5]," Z")),A.join(" ")}getOutlines(){var t,e;const i=(0,u.A)(Uc,this),s=(0,u.A)(Hc,this),n=(0,u.A)(Gc,this),a=n.subarray(4,6),r=n.subarray(16,18),[o,h,c,d]=(0,u.A)(jc,this),p=new Float64Array((null!==(t=null===(e=(0,u.A)(Zc,this))||void 0===e?void 0:e.length)&&void 0!==t?t:0)+2);for(let l=0,w=p.length-2;l<w;l+=2)p[l]=((0,u.A)(Zc,this)[l]-o)/c,p[l+1]=((0,u.A)(Zc,this)[l+1]-h)/d;p[p.length-2]=((0,u.A)(qc,this)-o)/c,p[p.length-1]=((0,u.A)(Xc,this)-h)/d;const[A,g,f,m]=(0,l.A)($c,this,ed).call(this);if(isNaN(n[6])&&!this.isEmpty()){const t=new Float64Array(36);return t.set([NaN,NaN,NaN,NaN,(n[2]-o)/c,(n[3]-h)/d,NaN,NaN,NaN,NaN,(n[4]-o)/c,(n[5]-h)/d,NaN,NaN,NaN,NaN,A,g,NaN,NaN,NaN,NaN,f,m,NaN,NaN,NaN,NaN,(n[16]-o)/c,(n[17]-h)/d,NaN,NaN,NaN,NaN,(n[14]-o)/c,(n[15]-h)/d],0),new ud(t,p,(0,u.A)(jc,this),(0,u.A)(Qc,this),(0,u.A)(zc,this),(0,u.A)(Vc,this))}const v=new Float64Array((0,u.A)(Uc,this).length+24+(0,u.A)(Hc,this).length);let b=i.length;for(let l=0;l<b;l+=2)isNaN(i[l])?v[l]=v[l+1]=NaN:(v[l]=i[l],v[l+1]=i[l+1]);v.set([NaN,NaN,NaN,NaN,(a[0]-o)/c,(a[1]-h)/d,NaN,NaN,NaN,NaN,A,g,NaN,NaN,NaN,NaN,f,m,NaN,NaN,NaN,NaN,(r[0]-o)/c,(r[1]-h)/d],b),b+=24;for(let l=s.length-6;l>=6;l-=6)for(let t=0;t<6;t+=2)isNaN(s[l+t])?(v[b]=v[b+1]=NaN,b+=2):(v[b]=s[l+t],v[b+1]=s[l+t+1],b+=2);return v.set([NaN,NaN,NaN,NaN,s[4],s[5]],b),new ud(v,p,(0,u.A)(jc,this),(0,u.A)(Qc,this),(0,u.A)(zc,this),(0,u.A)(Vc,this))}}function ed(){const t=(0,u.A)(Gc,this).subarray(4,6),e=(0,u.A)(Gc,this).subarray(16,18),[i,s,n,a]=(0,u.A)(jc,this);return[((0,u.A)(qc,this)+(t[0]-e[0])/2-i)/n,((0,u.A)(Xc,this)+(t[1]-e[1])/2-s)/a,((0,u.A)(qc,this)+(e[0]-t[0])/2-i)/n,((0,u.A)(Xc,this)+(e[1]-t[1])/2-s)/a]}var id={_:8},sd={_:id._+2},nd=new WeakMap,ad=new WeakMap,rd=new WeakMap,od=new WeakMap,ld=new WeakMap,hd=new WeakMap,cd=new WeakMap,dd=new WeakSet;class ud extends Oc{constructor(t,e,i,s,n,a){super(),(0,o.A)(this,dd),(0,d.A)(this,nd,void 0),(0,d.A)(this,ad,null),(0,d.A)(this,rd,void 0),(0,d.A)(this,od,void 0),(0,d.A)(this,ld,void 0),(0,d.A)(this,hd,void 0),(0,d.A)(this,cd,void 0),(0,p.A)(cd,this,t),(0,p.A)(ld,this,e),(0,p.A)(nd,this,i),(0,p.A)(hd,this,s),(0,p.A)(rd,this,n),(0,p.A)(od,this,a),(0,l.A)(dd,this,gd).call(this,a);const{x:r,y:h,width:c,height:A}=(0,u.A)(ad,this);for(let o=0,l=t.length;o<l;o+=2)t[o]=(t[o]-r)/c,t[o+1]=(t[o+1]-h)/A;for(let o=0,l=e.length;o<l;o+=2)e[o]=(e[o]-r)/c,e[o+1]=(e[o+1]-h)/A}toSVGPath(){const t=["M".concat((0,u.A)(cd,this)[4]," ").concat((0,u.A)(cd,this)[5])];for(let e=6,i=(0,u.A)(cd,this).length;e<i;e+=6)isNaN((0,u.A)(cd,this)[e])?t.push("L".concat((0,u.A)(cd,this)[e+4]," ").concat((0,u.A)(cd,this)[e+5])):t.push("C".concat((0,u.A)(cd,this)[e]," ").concat((0,u.A)(cd,this)[e+1]," ").concat((0,u.A)(cd,this)[e+2]," ").concat((0,u.A)(cd,this)[e+3]," ").concat((0,u.A)(cd,this)[e+4]," ").concat((0,u.A)(cd,this)[e+5]));return t.push("Z"),t.join(" ")}serialize(t,e){let[i,s,n,a]=t;const r=n-i,o=a-s;let h,c;switch(e){case 0:h=(0,l.A)(dd,this,pd).call(this,(0,u.A)(cd,this),i,a,r,-o),c=(0,l.A)(dd,this,pd).call(this,(0,u.A)(ld,this),i,a,r,-o);break;case 90:h=(0,l.A)(dd,this,Ad).call(this,(0,u.A)(cd,this),i,s,r,o),c=(0,l.A)(dd,this,Ad).call(this,(0,u.A)(ld,this),i,s,r,o);break;case 180:h=(0,l.A)(dd,this,pd).call(this,(0,u.A)(cd,this),n,s,-r,o),c=(0,l.A)(dd,this,pd).call(this,(0,u.A)(ld,this),n,s,-r,o);break;case 270:h=(0,l.A)(dd,this,Ad).call(this,(0,u.A)(cd,this),n,a,-r,-o),c=(0,l.A)(dd,this,Ad).call(this,(0,u.A)(ld,this),n,a,-r,-o)}return{outline:Array.from(h),points:[Array.from(c)]}}get box(){return(0,u.A)(ad,this)}getNewOutline(t,e){const{x:i,y:s,width:n,height:a}=(0,u.A)(ad,this),[r,o,l,h]=(0,u.A)(nd,this),c=n*l,d=a*h,p=i*l+r,A=s*h+o,g=new td({x:(0,u.A)(ld,this)[0]*c+p,y:(0,u.A)(ld,this)[1]*d+A},(0,u.A)(nd,this),(0,u.A)(hd,this),t,(0,u.A)(od,this),null!==e&&void 0!==e?e:(0,u.A)(rd,this));for(let f=2;f<(0,u.A)(ld,this).length;f+=2)g.add({x:(0,u.A)(ld,this)[f]*c+p,y:(0,u.A)(ld,this)[f+1]*d+A});return g.getOutlines()}}function pd(t,e,i,s,n){const a=new Float64Array(t.length);for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r]*s,a[r+1]=i+t[r+1]*n;return a}function Ad(t,e,i,s,n){const a=new Float64Array(t.length);for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r+1]*s,a[r+1]=i+t[r]*n;return a}function gd(t){const e=(0,u.A)(cd,this);let i=e[4],s=e[5],n=i,a=s,r=i,o=s,l=i,h=s;const c=t?Math.max:Math.min;for(let u=6,p=e.length;u<p;u+=6){if(isNaN(e[u]))n=Math.min(n,e[u+4]),a=Math.min(a,e[u+5]),r=Math.max(r,e[u+4]),o=Math.max(o,e[u+5]),h<e[u+5]?(l=e[u+4],h=e[u+5]):h===e[u+5]&&(l=c(l,e[u+4]));else{const t=qt.bezierBoundingBox(i,s,...e.slice(u,u+6));n=Math.min(n,t[0]),a=Math.min(a,t[1]),r=Math.max(r,t[2]),o=Math.max(o,t[3]),h<t[3]?(l=t[2],h=t[3]):h===t[3]&&(l=c(l,t[2]))}i=e[u+4],s=e[u+5]}const d=n-(0,u.A)(rd,this),A=a-(0,u.A)(rd,this),g=r-n+2*(0,u.A)(rd,this),f=o-a+2*(0,u.A)(rd,this);(0,p.A)(ad,this,{x:d,y:A,width:g,height:f,lastPoint:[l,h]})}var fd=new WeakMap,md=new WeakMap,vd=new WeakMap,bd=new WeakMap,wd=new WeakMap,yd=new WeakMap,_d=new WeakMap,xd=new WeakMap,Ed=new WeakMap,kd=new WeakMap,Sd=new WeakMap,Md=new WeakMap,Cd=new WeakSet;class Rd{static get _keyboardManager(){return Lt(this,"_keyboardManager",new Oi([[["Escape","mac+Escape"],Rd.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Rd.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Rd.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Rd.prototype._moveToPrevious],[["Home","mac+Home"],Rd.prototype._moveToBeginning],[["End","mac+End"],Rd.prototype._moveToEnd]]))}constructor(t){var e;let{editor:i=null,uiManager:s=null}=t;(0,o.A)(this,Cd),(0,d.A)(this,fd,(0,l.A)(Cd,this,Ld).bind(this)),(0,d.A)(this,md,(0,l.A)(Cd,this,Dd).bind(this)),(0,d.A)(this,vd,null),(0,d.A)(this,bd,null),(0,d.A)(this,wd,void 0),(0,d.A)(this,yd,null),(0,d.A)(this,_d,!1),(0,d.A)(this,xd,!1),(0,d.A)(this,Ed,null),(0,d.A)(this,kd,void 0),(0,d.A)(this,Sd,null),(0,d.A)(this,Md,void 0),i?((0,p.A)(xd,this,!1),(0,p.A)(Md,this,z.HIGHLIGHT_COLOR),(0,p.A)(Ed,this,i)):((0,p.A)(xd,this,!0),(0,p.A)(Md,this,z.HIGHLIGHT_DEFAULT_COLOR)),(0,p.A)(Sd,this,(null===i||void 0===i?void 0:i._uiManager)||s),(0,p.A)(kd,this,(0,u.A)(Sd,this)._eventBus),(0,p.A)(wd,this,(null===i||void 0===i?void 0:i.color)||(null===(e=(0,u.A)(Sd,this))||void 0===e?void 0:e.highlightColors.values().next().value)||"#FFFF98")}renderButton(){const t=(0,p.A)(vd,this,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=(0,u.A)(Sd,this)._signal;t.addEventListener("click",(0,l.A)(Cd,this,Id).bind(this),{signal:e}),t.addEventListener("keydown",(0,u.A)(fd,this),{signal:e});const i=(0,p.A)(bd,this,document.createElement("span"));return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=(0,u.A)(wd,this),t.append(i),t}renderMainDropdown(){const t=(0,p.A)(yd,this,(0,l.A)(Cd,this,Td).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===(0,u.A)(vd,this))return void(0,l.A)(Cd,this,Id).call(this,t);const e=t.target.getAttribute("data-color");e&&(0,l.A)(Cd,this,Pd).call(this,e,t)}_moveToNext(t){var e,i;h(Cd,this,Fd)?t.target!==(0,u.A)(vd,this)?null===(e=t.target.nextSibling)||void 0===e||e.focus():null===(i=(0,u.A)(yd,this).firstChild)||void 0===i||i.focus():(0,l.A)(Cd,this,Id).call(this,t)}_moveToPrevious(t){var e,i;t.target!==(null===(e=(0,u.A)(yd,this))||void 0===e?void 0:e.firstChild)&&t.target!==(0,u.A)(vd,this)?(h(Cd,this,Fd)||(0,l.A)(Cd,this,Id).call(this,t),null===(i=t.target.previousSibling)||void 0===i||i.focus()):h(Cd,this,Fd)&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){var e;h(Cd,this,Fd)?null===(e=(0,u.A)(yd,this).firstChild)||void 0===e||e.focus():(0,l.A)(Cd,this,Id).call(this,t)}_moveToEnd(t){var e;h(Cd,this,Fd)?null===(e=(0,u.A)(yd,this).lastChild)||void 0===e||e.focus():(0,l.A)(Cd,this,Id).call(this,t)}hideDropdown(){var t;null===(t=(0,u.A)(yd,this))||void 0===t||t.classList.add("hidden"),window.removeEventListener("pointerdown",(0,u.A)(md,this))}_hideDropdownFromKeyboard(){var t;(0,u.A)(xd,this)||(h(Cd,this,Fd)?(this.hideDropdown(),(0,u.A)(vd,this).focus({preventScroll:!0,focusVisible:(0,u.A)(_d,this)})):null===(t=(0,u.A)(Ed,this))||void 0===t||t.unselect())}updateColor(t){if((0,u.A)(bd,this)&&((0,u.A)(bd,this).style.backgroundColor=t),!(0,u.A)(yd,this))return;const e=(0,u.A)(Sd,this).highlightColors.values();for(const i of(0,u.A)(yd,this).children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;null===(t=(0,u.A)(vd,this))||void 0===t||t.remove(),(0,p.A)(vd,this,null),(0,p.A)(bd,this,null),null===(e=(0,u.A)(yd,this))||void 0===e||e.remove(),(0,p.A)(yd,this,null)}}function Td(){const t=document.createElement("div"),e=(0,u.A)(Sd,this)._signal;t.addEventListener("contextmenu",qe,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[i,s]of(0,u.A)(Sd,this).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",s),n.title=i,n.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-".concat(i));const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=s,n.setAttribute("aria-selected",s===(0,u.A)(wd,this)),n.addEventListener("click",(0,l.A)(Cd,this,Pd).bind(this,s),{signal:e}),t.append(n)}return t.addEventListener("keydown",(0,u.A)(fd,this),{signal:e}),t}function Pd(t,e){e.stopPropagation(),(0,u.A)(kd,this).dispatch("switchannotationeditorparams",{source:this,type:(0,u.A)(Md,this),value:t})}function Ld(t){_._keyboardManager.exec(this,t)}function Id(t){if(h(Cd,this,Fd))return void this.hideDropdown();if((0,p.A)(_d,this,0===t.detail),window.addEventListener("pointerdown",(0,u.A)(md,this),{signal:(0,u.A)(Sd,this)._signal}),(0,u.A)(yd,this))return void(0,u.A)(yd,this).classList.remove("hidden");const e=(0,p.A)(yd,this,(0,l.A)(Cd,this,Td).call(this));(0,u.A)(vd,this).append(e)}function Dd(t){var e;null!==(e=(0,u.A)(yd,this))&&void 0!==e&&e.contains(t.target)||this.hideDropdown()}function Fd(t){return(0,u.A)(yd,t)&&!(0,u.A)(yd,t).classList.contains("hidden")}_=Rd;var Od=new WeakMap,Nd=new WeakMap,Wd=new WeakMap,Bd=new WeakMap,jd=new WeakMap,Hd=new WeakMap,zd=new WeakMap,Vd=new WeakMap,Ud=new WeakMap,Gd=new WeakMap,qd=new WeakMap,Xd=new WeakMap,Kd=new WeakMap,Yd=new WeakMap,Qd=new WeakMap,Jd=new WeakMap,Zd=new WeakMap,$d=new WeakMap,tu=new WeakMap,eu=new WeakSet;class iu extends In{static get _keyboardManager(){const t=iu.prototype;return Lt(this,"_keyboardManager",new Oi([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super((0,n.A)((0,n.A)({},t),{},{name:"highlightEditor"})),(0,o.A)(this,eu),(0,d.A)(this,Od,null),(0,d.A)(this,Nd,0),(0,d.A)(this,Wd,void 0),(0,d.A)(this,Bd,null),(0,d.A)(this,jd,null),(0,d.A)(this,Hd,null),(0,d.A)(this,zd,null),(0,d.A)(this,Vd,0),(0,d.A)(this,Ud,null),(0,d.A)(this,Gd,null),(0,d.A)(this,qd,null),(0,d.A)(this,Xd,!1),(0,d.A)(this,Kd,(0,l.A)(eu,this,du).bind(this)),(0,d.A)(this,Yd,null),(0,d.A)(this,Qd,void 0),(0,d.A)(this,Jd,null),(0,d.A)(this,Zd,""),(0,d.A)(this,$d,void 0),(0,d.A)(this,tu,""),this.color=t.color||iu._defaultColor,(0,p.A)($d,this,t.thickness||iu._defaultThickness),(0,p.A)(Qd,this,t.opacity||iu._defaultOpacity),(0,p.A)(Wd,this,t.boxes||null),(0,p.A)(tu,this,t.methodOfCreation||""),(0,p.A)(Zd,this,t.text||""),this._isDraggable=!1,t.highlightId>-1?((0,p.A)(Xd,this,!0),(0,l.A)(eu,this,nu).call(this,t),(0,l.A)(eu,this,hu).call(this)):((0,p.A)(Od,this,t.anchorNode),(0,p.A)(Nd,this,t.anchorOffset),(0,p.A)(zd,this,t.focusNode),(0,p.A)(Vd,this,t.focusOffset),(0,l.A)(eu,this,su).call(this),(0,l.A)(eu,this,hu).call(this),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:(0,u.A)(Xd,this)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:(0,u.A)($d,this),methodOfCreation:(0,u.A)(tu,this)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,e){var i;In.initialize(t,e),iu._defaultColor||(iu._defaultColor=(null===(i=e.highlightColors)||void 0===i?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case z.HIGHLIGHT_DEFAULT_COLOR:iu._defaultColor=e;break;case z.HIGHLIGHT_THICKNESS:iu._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return(0,u.A)(Yd,this)}updateParams(t,e){switch(t){case z.HIGHLIGHT_COLOR:(0,l.A)(eu,this,au).call(this,e);break;case z.HIGHLIGHT_THICKNESS:(0,l.A)(eu,this,ru).call(this,e)}}static get defaultPropertiesToUpdate(){return[[z.HIGHLIGHT_DEFAULT_COLOR,iu._defaultColor],[z.HIGHLIGHT_THICKNESS,iu._defaultThickness]]}get propertiesToUpdate(){return[[z.HIGHLIGHT_COLOR,this.color||iu._defaultColor],[z.HIGHLIGHT_THICKNESS,(0,u.A)($d,this)||iu._defaultThickness],[z.HIGHLIGHT_FREE,(0,u.A)(Xd,this)]]}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&((0,p.A)(jd,this,new Rd({editor:this})),t.addColorPicker((0,u.A)(jd,this))),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition((0,l.A)(eu,this,pu).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,(0,l.A)(eu,this,pu).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){(0,l.A)(eu,this,lu).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&((0,l.A)(eu,this,hu).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)(0,l.A)(eu,this,lu).call(this);else if(t){var i;(0,l.A)(eu,this,hu).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),this.show(this._isVisible),e&&this.select()}rotate(t){const{drawLayer:e}=this.parent;let i;(0,u.A)(Xd,this)?(t=(t-this.rotation+360)%360,i=cu.call(iu,(0,u.A)(Gd,this).box,t)):i=cu.call(iu,this,t),e.rotate((0,u.A)(qd,this),t),e.rotate((0,u.A)(Jd,this),t),e.updateBox((0,u.A)(qd,this),i),e.updateBox((0,u.A)(Jd,this),cu.call(iu,(0,u.A)(Hd,this).box,t))}render(){if(this.div)return this.div;const t=super.render();(0,u.A)(Zd,this)&&(t.setAttribute("aria-label",(0,u.A)(Zd,this)),t.setAttribute("role","mark")),(0,u.A)(Xd,this)?t.classList.add("free"):this.div.addEventListener("keydown",(0,u.A)(Kd,this),{signal:this._uiManager._signal});const e=(0,p.A)(Ud,this,document.createElement("div"));t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=(0,u.A)(Bd,this);const[i,s]=this.parentDimensions;return this.setDims(this.width*i,this.height*s),yi(this,(0,u.A)(Ud,this),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass((0,u.A)(Jd,this),"hovered")}pointerleave(){this.parent.drawLayer.removeClass((0,u.A)(Jd,this),"hovered")}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:(0,l.A)(eu,this,uu).call(this,!0);break;case 1:case 3:(0,l.A)(eu,this,uu).call(this,!1)}}select(){var t,e;super.select(),(0,u.A)(Jd,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.removeClass((0,u.A)(Jd,this),"hovered"),null===(e=this.parent)||void 0===e||e.drawLayer.addClass((0,u.A)(Jd,this),"selected"))}unselect(){var t;super.unselect(),(0,u.A)(Jd,this)&&(null===(t=this.parent)||void 0===t||t.drawLayer.removeClass((0,u.A)(Jd,this),"selected"),(0,u.A)(Xd,this)||(0,l.A)(eu,this,uu).call(this,!1))}get _mustFixPosition(){return!(0,u.A)(Xd,this)}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.show((0,u.A)(qd,this),t),this.parent.drawLayer.show((0,u.A)(Jd,this),t))}static startHighlighting(t,e,i){let{target:s,x:n,y:a}=i;const{x:r,y:o,width:h,height:c}=s.getBoundingClientRect(),d=e=>{(0,l.A)(iu,this,fu).call(this,t,e)},u=t._signal,p={capture:!0,passive:!1,signal:u},A=t=>{t.preventDefault(),t.stopPropagation()},g=e=>{s.removeEventListener("pointermove",d),window.removeEventListener("blur",g),window.removeEventListener("pointerup",g),window.removeEventListener("pointerdown",A,p),window.removeEventListener("contextmenu",qe),(0,l.A)(iu,this,mu).call(this,t,e)};window.addEventListener("blur",g,{signal:u}),window.addEventListener("pointerup",g,{signal:u}),window.addEventListener("pointerdown",A,p),window.addEventListener("contextmenu",qe,{signal:u}),s.addEventListener("pointermove",d,{signal:u}),this._freeHighlight=new td({x:n,y:a},[r,o,h,c],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0))}static deserialize(t,e,i){const s=super.deserialize(t,e,i),{rect:[n,a,r,o],color:h,quadPoints:c}=t;s.color=qt.makeHexColor(...h),(0,p.A)(Qd,s,t.opacity);const[d,u]=s.pageDimensions;s.width=(r-n)/d,s.height=(o-a)/u;const A=(0,p.A)(Wd,s,[]);for(let l=0;l<c.length;l+=8)A.push({x:(c[4]-r)/d,y:(o-(1-c[l+5]))/u,width:(c[l+2]-c[l])/d,height:(c[l+5]-c[l+1])/u});return(0,l.A)(eu,s,su).call(s),s}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;const e=this.getRect(0,0),i=In._colorManager.convert(this.color);return{annotationType:H.HIGHLIGHT,color:i,opacity:(0,u.A)(Qd,this),thickness:(0,u.A)($d,this),quadPoints:(0,l.A)(eu,this,Au).call(this),outlines:(0,l.A)(eu,this,gu).call(this,e),pageIndex:this.pageIndex,rect:e,rotation:(0,l.A)(eu,this,pu).call(this),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}}function su(){const t=new Tc((0,u.A)(Wd,this),.001);(0,p.A)(Gd,this,t.getOutlines()),({x:this.x,y:this.y,width:this.width,height:this.height}=(0,u.A)(Gd,this).box);const e=new Tc((0,u.A)(Wd,this),.0025,.001,"ltr"===this._uiManager.direction);(0,p.A)(Hd,this,e.getOutlines());const{lastPoint:i}=(0,u.A)(Hd,this).box;(0,p.A)(Yd,this,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])}function nu(t){let{highlightOutlines:e,highlightId:i,clipPathId:s}=t;(0,p.A)(Gd,this,e);if((0,p.A)(Hd,this,e.getNewOutline((0,u.A)($d,this)/2+1.5,.0025)),i>=0)(0,p.A)(qd,this,i),(0,p.A)(Bd,this,s),this.parent.drawLayer.finalizeLine(i,e),(0,p.A)(Jd,this,this.parent.drawLayer.highlightOutline((0,u.A)(Hd,this)));else if(this.parent){const t=this.parent.viewport.rotation;this.parent.drawLayer.updateLine((0,u.A)(qd,this),e),this.parent.drawLayer.updateBox((0,u.A)(qd,this),cu.call(x,(0,u.A)(Gd,this).box,(t-this.rotation+360)%360)),this.parent.drawLayer.updateLine((0,u.A)(Jd,this),(0,u.A)(Hd,this)),this.parent.drawLayer.updateBox((0,u.A)(Jd,this),cu.call(x,(0,u.A)(Hd,this).box,t))}const{x:n,y:a,width:r,height:o}=e.box;switch(this.rotation){case 0:this.x=n,this.y=a,this.width=r,this.height=o;break;case 90:{const[t,e]=this.parentDimensions;this.x=a,this.y=1-n,this.width=r*e/t,this.height=o*t/e;break}case 180:this.x=1-n,this.y=1-a,this.width=r,this.height=o;break;case 270:{const[t,e]=this.parentDimensions;this.x=1-a,this.y=n,this.width=r*e/t,this.height=o*t/e;break}}const{lastPoint:l}=(0,u.A)(Hd,this).box;(0,p.A)(Yd,this,[(l[0]-n)/r,(l[1]-a)/o])}function au(t){const e=t=>{var e,i;this.color=t,null===(e=this.parent)||void 0===e||e.drawLayer.changeColor((0,u.A)(qd,this),t),null===(i=(0,u.A)(jd,this))||void 0===i||i.updateColor(t)},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:z.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}function ru(t){const e=(0,u.A)($d,this),i=t=>{(0,p.A)($d,this,t),(0,l.A)(eu,this,ou).call(this,t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:z.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}function ou(t){if(!(0,u.A)(Xd,this))return;(0,l.A)(eu,this,nu).call(this,{highlightOutlines:(0,u.A)(Gd,this).getNewOutline(t/2)}),this.fixAndSetPosition();const[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}function lu(){null!==(0,u.A)(qd,this)&&this.parent&&(this.parent.drawLayer.remove((0,u.A)(qd,this)),(0,p.A)(qd,this,null),this.parent.drawLayer.remove((0,u.A)(Jd,this)),(0,p.A)(Jd,this,null))}function hu(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null===(0,u.A)(qd,this)&&(({id:a(p.A,[qd,this])._,clipPathId:a(p.A,[Bd,this])._}=t.drawLayer.highlight((0,u.A)(Gd,this),this.color,(0,u.A)(Qd,this))),(0,p.A)(Jd,this,t.drawLayer.highlightOutline((0,u.A)(Hd,this))),(0,u.A)(Ud,this)&&((0,u.A)(Ud,this).style.clipPath=(0,u.A)(Bd,this)))}function cu(t,e){let{x:i,y:s,width:n,height:a}=t;switch(e){case 90:return{x:1-s-a,y:i,width:a,height:n};case 180:return{x:1-i-n,y:1-s-a,width:n,height:a};case 270:return{x:s,y:1-i-n,width:a,height:n}}return{x:i,y:s,width:n,height:a}}function du(t){x._keyboardManager.exec(this,t)}function uu(t){if(!(0,u.A)(Od,this))return;const e=window.getSelection();t?e.setPosition((0,u.A)(Od,this),(0,u.A)(Nd,this)):e.setPosition((0,u.A)(zd,this),(0,u.A)(Vd,this))}function pu(){return(0,u.A)(Xd,this)?this.rotation:0}function Au(){if((0,u.A)(Xd,this))return null;const[t,e]=this.pageDimensions,i=(0,u.A)(Wd,this),s=new Float32Array(8*i.length);let n=0;for(const{x:a,y:r,width:o,height:l}of i){const i=a*t,h=(1-r-l)*e;s[n]=s[n+4]=i,s[n+1]=s[n+3]=h,s[n+2]=s[n+6]=i+o*t,s[n+5]=s[n+7]=h+l*e,n+=8}return s}function gu(t){return(0,u.A)(Gd,this).serialize(t,(0,l.A)(eu,this,pu).call(this))}function fu(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}function mu(t,e){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}x=iu,(0,c.A)(iu,"_defaultColor",null),(0,c.A)(iu,"_defaultOpacity",1),(0,c.A)(iu,"_defaultThickness",12),(0,c.A)(iu,"_l10nPromise",void 0),(0,c.A)(iu,"_type","highlight"),(0,c.A)(iu,"_editorType",H.HIGHLIGHT),(0,c.A)(iu,"_freeHighlightId",-1),(0,c.A)(iu,"_freeHighlight",null),(0,c.A)(iu,"_freeHighlightClipId","");var vu=new WeakMap,bu=new WeakMap,wu=new WeakMap,yu=new WeakMap,_u=new WeakMap,xu=new WeakMap,Eu=new WeakMap,ku=new WeakMap,Su=new WeakMap,Mu=new WeakMap,Cu=new WeakMap,Ru=new WeakMap,Tu=new WeakMap,Pu=new WeakMap,Lu=new WeakMap,Iu=new WeakSet;class Du extends In{constructor(t){super((0,n.A)((0,n.A)({},t),{},{name:"inkEditor"})),(0,o.A)(this,Iu),(0,d.A)(this,vu,0),(0,d.A)(this,bu,0),(0,d.A)(this,wu,this.canvasPointermove.bind(this)),(0,d.A)(this,yu,this.canvasPointerleave.bind(this)),(0,d.A)(this,_u,this.canvasPointerup.bind(this)),(0,d.A)(this,xu,this.canvasPointerdown.bind(this)),(0,d.A)(this,Eu,null),(0,d.A)(this,ku,new Path2D),(0,d.A)(this,Su,!1),(0,d.A)(this,Mu,!1),(0,d.A)(this,Cu,!1),(0,d.A)(this,Ru,null),(0,d.A)(this,Tu,0),(0,d.A)(this,Pu,0),(0,d.A)(this,Lu,null),this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t,e){In.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case z.INK_THICKNESS:Du._defaultThickness=e;break;case z.INK_COLOR:Du._defaultColor=e;break;case z.INK_OPACITY:Du._defaultOpacity=e/100}}updateParams(t,e){switch(t){case z.INK_THICKNESS:(0,l.A)(Iu,this,Fu).call(this,e);break;case z.INK_COLOR:(0,l.A)(Iu,this,Ou).call(this,e);break;case z.INK_OPACITY:(0,l.A)(Iu,this,Nu).call(this,e)}}static get defaultPropertiesToUpdate(){return[[z.INK_THICKNESS,Du._defaultThickness],[z.INK_COLOR,Du._defaultColor||In._defaultLineColor],[z.INK_OPACITY,Math.round(100*Du._defaultOpacity)]]}get propertiesToUpdate(){var t;return[[z.INK_THICKNESS,this.thickness||Du._defaultThickness],[z.INK_COLOR,this.color||Du._defaultColor||In._defaultLineColor],[z.INK_OPACITY,Math.round(100*(null!==(t=this.opacity)&&void 0!==t?t:Du._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||((0,l.A)(Iu,this,Yu).call(this),(0,l.A)(Iu,this,Qu).call(this)),this.isAttachedToDOM||(this.parent.add(this),(0,l.A)(Iu,this,Ju).call(this)),(0,l.A)(Iu,this,rp).call(this)))}remove(){var t;null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,(0,u.A)(Eu,this)&&(clearTimeout((0,u.A)(Eu,this)),(0,p.A)(Eu,this,null)),null===(t=(0,u.A)(Ru,this))||void 0===t||t.disconnect(),(0,p.A)(Ru,this,null),super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,e]=this.parentDimensions,i=this.width*t,s=this.height*e;this.setDimensions(i,s)}enableEditMode(){(0,u.A)(Su,this)||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",(0,u.A)(xu,this),{signal:this._uiManager._signal}))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",(0,u.A)(xu,this)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}commit(){(0,u.A)(Su,this)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),(0,p.A)(Su,this,!0),this.div.classList.add("disabled"),(0,l.A)(Iu,this,rp).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){0===t.button&&this.isInEditMode()&&!(0,u.A)(Su,this)&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),(0,l.A)(Iu,this,ju).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),(0,l.A)(Iu,this,Hu).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),(0,l.A)(Iu,this,Ku).call(this,t)}canvasPointerleave(t){(0,l.A)(Iu,this,Ku).call(this,t)}get isResizable(){return!this.isEmpty()&&(0,u.A)(Su,this)}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,s,n,a]=(0,l.A)(Iu,this,Wu).call(this);if(this.setAt(i,s,0,0),this.setDims(n,a),(0,l.A)(Iu,this,Yu).call(this),this.width){const[i,s]=this.parentDimensions;this.setAspectRatio(this.width*i,this.height*s),this.setAt(t*i,e*s,this.width*i,this.height*s),(0,p.A)(Cu,this,!0),(0,l.A)(Iu,this,Ju).call(this),this.setDims(this.width*i,this.height*s),(0,l.A)(Iu,this,Xu).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return(0,l.A)(Iu,this,Qu).call(this),this.div}setDimensions(t,e){const i=Math.round(t),s=Math.round(e);if((0,u.A)(Tu,this)===i&&(0,u.A)(Pu,this)===s)return;(0,p.A)(Tu,this,i),(0,p.A)(Pu,this,s),this.canvas.style.visibility="hidden";const[n,a]=this.parentDimensions;this.width=t/n,this.height=e/a,this.fixAndSetPosition(),(0,u.A)(Su,this)&&(0,l.A)(Iu,this,Zu).call(this,t,e),(0,l.A)(Iu,this,Ju).call(this),(0,l.A)(Iu,this,Xu).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(t,e,i){if(t instanceof Hh)return null;const s=super.deserialize(t,e,i);s.thickness=t.thickness,s.color=qt.makeHexColor(...t.color),s.opacity=t.opacity;const[n,a]=s.pageDimensions,r=s.width*n,o=s.height*a,h=s.parentScale,c=t.thickness/2;(0,p.A)(Su,s,!0),(0,p.A)(Tu,s,Math.round(r)),(0,p.A)(Pu,s,Math.round(o));const{paths:d,rect:u,rotation:A}=t;for(let{bezier:p}of d){p=ip.call(Du,p,u,A);const t=[];s.paths.push(t);let e=h*(p[0]-c),i=h*(p[1]-c);for(let s=2,a=p.length;s<a;s+=6){const n=h*(p[s]-c),a=h*(p[s+1]-c),r=h*(p[s+2]-c),o=h*(p[s+3]-c),l=h*(p[s+4]-c),d=h*(p[s+5]-c);t.push([[e,i],[n,a],[r,o],[l,d]]),e=l,i=d}const n=(0,l.A)(Du,this,tp).call(this,t);s.bezierPath2D.push(n)}const g=(0,l.A)(Iu,s,np).call(s);return(0,p.A)(bu,s,Math.max(In.MIN_SIZE,g[2]-g[0])),(0,p.A)(vu,s,Math.max(In.MIN_SIZE,g[3]-g[1])),(0,l.A)(Iu,s,Zu).call(s,r,o),s}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),e=In._colorManager.convert(this.ctx.strokeStyle);return{annotationType:H.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:(0,l.A)(Iu,this,sp).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}function Fu(t){const e=t=>{this.thickness=t,(0,l.A)(Iu,this,rp).call(this)},i=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:z.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}function Ou(t){const e=t=>{this.color=t,(0,l.A)(Iu,this,Xu).call(this)},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:z.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function Nu(t){const e=t=>{this.opacity=t,(0,l.A)(Iu,this,Xu).call(this)};t/=100;const i=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:z.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}function Wu(){const{parentRotation:t,parentDimensions:[e,i]}=this;switch(t){case 90:return[0,i,i,e];case 180:return[e,i,e,i];case 270:return[e,0,i,e];default:return[0,0,e,i]}}function Bu(){const{ctx:t,color:e,opacity:i,thickness:s,parentScale:n,scaleFactor:a}=this;t.lineWidth=s*n/a,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle="".concat(e).concat(function(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")}(i))}function ju(t,e){const i=this._uiManager._signal;var s;(this.canvas.addEventListener("contextmenu",qe,{signal:i}),this.canvas.addEventListener("pointerleave",(0,u.A)(yu,this),{signal:i}),this.canvas.addEventListener("pointermove",(0,u.A)(wu,this),{signal:i}),this.canvas.addEventListener("pointerup",(0,u.A)(_u,this),{signal:i}),this.canvas.removeEventListener("pointerdown",(0,u.A)(xu,this)),this.isEditing=!0,(0,u.A)(Cu,this))||((0,p.A)(Cu,this,!0),(0,l.A)(Iu,this,Ju).call(this),this.thickness||(this.thickness=E._defaultThickness),this.color||(this.color=E._defaultColor||In._defaultLineColor),null!==(s=this.opacity)&&void 0!==s||(this.opacity=E._defaultOpacity));this.currentPath.push([t,e]),(0,p.A)(Mu,this,!1),(0,l.A)(Iu,this,Bu).call(this),(0,p.A)(Lu,this,()=>{(0,l.A)(Iu,this,Uu).call(this),(0,u.A)(Lu,this)&&window.requestAnimationFrame((0,u.A)(Lu,this))}),window.requestAnimationFrame((0,u.A)(Lu,this))}function Hu(t,e){const[i,s]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===s)return;const n=this.currentPath;let a=(0,u.A)(ku,this);if(n.push([t,e]),(0,p.A)(Mu,this,!0),n.length<=2)return a.moveTo(...n[0]),void a.lineTo(t,e);3===n.length&&((0,p.A)(ku,this,a=new Path2D),a.moveTo(...n[0])),(0,l.A)(Iu,this,Gu).call(this,a,...n.at(-3),...n.at(-2),t,e)}function zu(){if(0===this.currentPath.length)return;const t=this.currentPath.at(-1);(0,u.A)(ku,this).lineTo(...t)}function Vu(t,e){let i;if((0,p.A)(Lu,this,null),t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),(0,l.A)(Iu,this,Hu).call(this,t,e),(0,l.A)(Iu,this,zu).call(this),1!==this.currentPath.length)i=(0,l.A)(Iu,this,qu).call(this);else{const s=[t,e];i=[[s,s.slice(),s.slice(),s]]}const s=(0,u.A)(ku,this),n=this.currentPath;this.currentPath=[],(0,p.A)(ku,this,new Path2D);this.addCommands({cmd:()=>{this.allRawPaths.push(n),this.paths.push(i),this.bezierPath2D.push(s),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||((0,l.A)(Iu,this,Yu).call(this),(0,l.A)(Iu,this,Qu).call(this)),(0,l.A)(Iu,this,rp).call(this))},mustExec:!0})}function Uu(){if(!(0,u.A)(Mu,this))return;(0,p.A)(Mu,this,!1);const t=Math.ceil(this.thickness*this.parentScale),e=this.currentPath.slice(-3),i=e.map(t=>t[0]),s=e.map(t=>t[1]),{ctx:n}=(Math.min(...i),Math.max(...i),Math.min(...s),Math.max(...s),this);n.save(),n.clearRect(0,0,this.canvas.width,this.canvas.height);for(const a of this.bezierPath2D)n.stroke(a);n.stroke((0,u.A)(ku,this)),n.restore()}function Gu(t,e,i,s,n,a,r){const o=(e+s)/2,l=(i+n)/2,h=(s+a)/2,c=(n+r)/2;t.bezierCurveTo(o+2*(s-o)/3,l+2*(n-l)/3,h+2*(s-h)/3,c+2*(n-c)/3,h,c)}function qu(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const e=[];let i,[s,n]=t[0];for(i=1;i<t.length-2;i++){const[a,r]=t[i],[o,l]=t[i+1],h=(a+o)/2,c=(r+l)/2,d=[s+2*(a-s)/3,n+2*(r-n)/3],u=[h+2*(a-h)/3,c+2*(r-c)/3];e.push([[s,n],d,u,[h,c]]),[s,n]=[h,c]}const[a,r]=t[i],[o,l]=t[i+1],h=[s+2*(a-s)/3,n+2*(r-n)/3],c=[o+2*(a-o)/3,l+2*(r-l)/3];return e.push([[s,n],h,c,[o,l]]),e}function Xu(){if(this.isEmpty())return void(0,l.A)(Iu,this,$u).call(this);(0,l.A)(Iu,this,Bu).call(this);const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),(0,l.A)(Iu,this,$u).call(this);for(const i of this.bezierPath2D)e.stroke(i)}function Ku(t){this.canvas.removeEventListener("pointerleave",(0,u.A)(yu,this)),this.canvas.removeEventListener("pointermove",(0,u.A)(wu,this)),this.canvas.removeEventListener("pointerup",(0,u.A)(_u,this)),this.canvas.addEventListener("pointerdown",(0,u.A)(xu,this),{signal:this._uiManager._signal}),(0,u.A)(Eu,this)&&clearTimeout((0,u.A)(Eu,this)),(0,p.A)(Eu,this,setTimeout(()=>{(0,p.A)(Eu,this,null),this.canvas.removeEventListener("contextmenu",qe)},10)),(0,l.A)(Iu,this,Vu).call(this,t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}function Yu(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}function Qu(){(0,p.A)(Ru,this,new ResizeObserver(t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)})),(0,u.A)(Ru,this).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;null===(t=(0,u.A)(Ru,this))||void 0===t||t.disconnect(),(0,p.A)(Ru,this,null)},{once:!0})}function Ju(){if(!(0,u.A)(Cu,this))return;const[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),(0,l.A)(Iu,this,$u).call(this)}function Zu(t,e){const i=(0,l.A)(Iu,this,ap).call(this),s=(t-i)/(0,u.A)(bu,this),n=(e-i)/(0,u.A)(vu,this);this.scaleFactor=Math.min(s,n)}function $u(){const t=(0,l.A)(Iu,this,ap).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}function tp(t){const e=new Path2D;for(let i=0,s=t.length;i<s;i++){const[s,n,a,r]=t[i];0===i&&e.moveTo(...s),e.bezierCurveTo(n[0],n[1],a[0],a[1],r[0],r[1])}return e}function ep(t,e,i){const[s,n,a,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]+=s,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=t[e+1]+s,t[e+1]=i+n}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=a-t[e],t[e+1]+=n;break;case 270:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=a-t[e+1],t[e+1]=r-i}break;default:throw new Error("Invalid rotation")}return t}function ip(t,e,i){const[s,n,a,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]-=s,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=t[e+1]-n,t[e+1]=i-s}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=a-t[e],t[e+1]-=n;break;case 270:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=r-t[e+1],t[e+1]=a-i}break;default:throw new Error("Invalid rotation")}return t}function sp(t,e,i,s){const n=[],a=this.thickness/2,r=t*e+a,o=t*i+a;for(const l of this.paths){const e=[],i=[];for(let s=0,n=l.length;s<n;s++){const[a,h,c,d]=l[s];if(a[0]===d[0]&&a[1]===d[1]&&1===n){const s=t*a[0]+r,n=t*a[1]+o;e.push(s,n),i.push(s,n);break}const u=t*a[0]+r,p=t*a[1]+o,A=t*h[0]+r,g=t*h[1]+o,f=t*c[0]+r,m=t*c[1]+o,v=t*d[0]+r,b=t*d[1]+o;0===s&&(e.push(u,p),i.push(u,p)),e.push(A,g,f,m,v,b),i.push(A,g),s===n-1&&i.push(v,b)}n.push({bezier:ep.call(E,e,s,this.rotation),points:ep.call(E,i,s,this.rotation)})}return n}function np(){let t=1/0,e=-1/0,i=1/0,s=-1/0;for(const n of this.paths)for(const[a,r,o,l]of n){const n=qt.bezierBoundingBox(...a,...r,...o,...l);t=Math.min(t,n[0]),i=Math.min(i,n[1]),e=Math.max(e,n[2]),s=Math.max(s,n[3])}return[t,i,e,s]}function ap(){return(0,u.A)(Su,this)?Math.ceil(this.thickness*this.parentScale):0}function rp(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!(0,u.A)(Su,this))return void(0,l.A)(Iu,this,Xu).call(this);const e=(0,l.A)(Iu,this,np).call(this),i=(0,l.A)(Iu,this,ap).call(this);(0,p.A)(bu,this,Math.max(In.MIN_SIZE,e[2]-e[0])),(0,p.A)(vu,this,Math.max(In.MIN_SIZE,e[3]-e[1]));const s=Math.ceil(i+(0,u.A)(bu,this)*this.scaleFactor),n=Math.ceil(i+(0,u.A)(vu,this)*this.scaleFactor),[a,r]=this.parentDimensions;this.width=s/a,this.height=n/r,this.setAspectRatio(s,n);const o=this.translationX,h=this.translationY;this.translationX=-e[0],this.translationY=-e[1],(0,l.A)(Iu,this,Ju).call(this),(0,l.A)(Iu,this,Xu).call(this),(0,p.A)(Tu,this,s),(0,p.A)(Pu,this,n),this.setDims(s,n);const c=t?i/this.scaleFactor/2:0;this.translate(o-this.translationX-c,h-this.translationY-c)}E=Du,(0,c.A)(Du,"_defaultColor",null),(0,c.A)(Du,"_defaultOpacity",1),(0,c.A)(Du,"_defaultThickness",1),(0,c.A)(Du,"_type","ink"),(0,c.A)(Du,"_editorType",H.INK);var op=new WeakMap,lp=new WeakMap,hp=new WeakMap,cp=new WeakMap,dp=new WeakMap,up=new WeakMap,pp=new WeakMap,Ap=new WeakMap,gp=new WeakMap,fp=new WeakMap,mp=new WeakMap,vp=new WeakSet;class bp extends In{constructor(t){super((0,n.A)((0,n.A)({},t),{},{name:"stampEditor"})),(0,o.A)(this,vp),(0,d.A)(this,op,null),(0,d.A)(this,lp,null),(0,d.A)(this,hp,null),(0,d.A)(this,cp,null),(0,d.A)(this,dp,null),(0,d.A)(this,up,""),(0,d.A)(this,pp,null),(0,d.A)(this,Ap,null),(0,d.A)(this,gp,null),(0,d.A)(this,fp,!1),(0,d.A)(this,mp,!1),(0,p.A)(cp,this,t.bitmapUrl),(0,p.A)(dp,this,t.bitmapFile)}static initialize(t,e){In.initialize(t,e)}static get supportedTypes(){return Lt(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(t=>"image/".concat(t)))}static get supportedTypesStr(){return Lt(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(H.STAMP,{bitmapFile:t.getAsFile()})}remove(){var t,e;(0,u.A)(lp,this)&&((0,p.A)(op,this,null),this._uiManager.imageManager.deleteId((0,u.A)(lp,this)),null===(t=(0,u.A)(pp,this))||void 0===t||t.remove(),(0,p.A)(pp,this,null),null===(e=(0,u.A)(Ap,this))||void 0===e||e.disconnect(),(0,p.A)(Ap,this,null),(0,u.A)(gp,this)&&(clearTimeout((0,u.A)(gp,this)),(0,p.A)(gp,this,null)));super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&((0,u.A)(lp,this)&&null===(0,u.A)(pp,this)&&(0,l.A)(vp,this,_p).call(this),this.isAttachedToDOM||this.parent.add(this))):(0,u.A)(lp,this)&&(0,l.A)(vp,this,_p).call(this)}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!((0,u.A)(hp,this)||(0,u.A)(op,this)||(0,u.A)(cp,this)||(0,u.A)(dp,this)||(0,u.A)(lp,this))}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),(0,u.A)(op,this)?(0,l.A)(vp,this,xp).call(this):(0,l.A)(vp,this,_p).call(this),this.width){const[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s)}return this.div}getImageForAltText(){return(0,u.A)(pp,this)}static deserialize(t,e,i){if(t instanceof qh)return null;const s=super.deserialize(t,e,i),{rect:n,bitmapUrl:a,bitmapId:r,isSvg:o,accessibilityData:l}=t;r&&i.imageManager.isValidId(r)?(0,p.A)(lp,s,r):(0,p.A)(cp,s,a),(0,p.A)(fp,s,o);const[h,c]=s.pageDimensions;return s.width=(n[2]-n[0])/h,s.height=(n[3]-n[1])/c,l&&(s.altTextData=l),s}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;const i={annotationType:H.STAMP,bitmapId:(0,u.A)(lp,this),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:(0,u.A)(fp,this),structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=(0,l.A)(vp,this,Mp).call(this,!0),i.accessibilityData=this.altTextData,i;const{decorative:s,altText:n}=this.altTextData;if(!s&&n&&(i.accessibilityData={type:"Figure",alt:n}),null===e)return i;e.stamps||(e.stamps=new Map);const a=(0,u.A)(fp,this)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has((0,u.A)(lp,this))){if((0,u.A)(fp,this)){const t=e.stamps.get((0,u.A)(lp,this));a>t.area&&(t.area=a,t.serialized.bitmap.close(),t.serialized.bitmap=(0,l.A)(vp,this,Mp).call(this,!1))}}else e.stamps.set((0,u.A)(lp,this),{area:a,serialized:i}),i.bitmap=(0,l.A)(vp,this,Mp).call(this,!1);return i}}function wp(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t?((0,p.A)(op,this,t.bitmap),e||((0,p.A)(lp,this,t.id),(0,p.A)(fp,this,t.isSvg)),t.file&&(0,p.A)(up,this,t.file.name),(0,l.A)(vp,this,xp).call(this)):this.remove()}function yp(){(0,p.A)(hp,this,null),this._uiManager.enableWaiting(!1),(0,u.A)(pp,this)&&this.div.focus()}function _p(){if((0,u.A)(lp,this))return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId((0,u.A)(lp,this)).then(t=>(0,l.A)(vp,this,wp).call(this,t,!0)).finally(()=>(0,l.A)(vp,this,yp).call(this));if((0,u.A)(cp,this)){const t=(0,u.A)(cp,this);return(0,p.A)(cp,this,null),this._uiManager.enableWaiting(!0),void(0,p.A)(hp,this,this._uiManager.imageManager.getFromUrl(t).then(t=>(0,l.A)(vp,this,wp).call(this,t)).finally(()=>(0,l.A)(vp,this,yp).call(this)))}if((0,u.A)(dp,this)){const t=(0,u.A)(dp,this);return(0,p.A)(dp,this,null),this._uiManager.enableWaiting(!0),void(0,p.A)(hp,this,this._uiManager.imageManager.getFromFile(t).then(t=>(0,l.A)(vp,this,wp).call(this,t)).finally(()=>(0,l.A)(vp,this,yp).call(this)))}const t=document.createElement("input");t.type="file",t.accept=k.supportedTypesStr;const e=this._uiManager._signal;(0,p.A)(hp,this,new Promise(i=>{t.addEventListener("change",async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);(0,l.A)(vp,this,wp).call(this,e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>(0,l.A)(vp,this,yp).call(this))),t.click()}function xp(){const{div:t}=this;let{width:e,height:i}=(0,u.A)(op,this);const[s,n]=this.pageDimensions,a=.75;if(this.width)e=this.width*s,i=this.height*n;else if(e>a*s||i>a*n){const t=Math.min(a*s/e,a*n/i);e*=t,i*=t}const[r,o]=this.parentDimensions;this.setDims(e*r/s,i*o/n),this._uiManager.enableWaiting(!1);const h=(0,p.A)(pp,this,document.createElement("canvas"));t.append(h),t.hidden=!1,(0,l.A)(vp,this,Sp).call(this,e,i),(0,l.A)(vp,this,Cp).call(this),(0,u.A)(mp,this)||(this.parent.addUndoableEditor(this),(0,p.A)(mp,this,!0)),this._reportTelemetry({action:"inserted_image"}),(0,u.A)(up,this)&&h.setAttribute("aria-label",(0,u.A)(up,this))}function Ep(t,e){var i;const[s,n]=this.parentDimensions;this.width=t/s,this.height=e/n,this.setDims(t,e),null!==(i=this._initialOptions)&&void 0!==i&&i.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==(0,u.A)(gp,this)&&clearTimeout((0,u.A)(gp,this));(0,p.A)(gp,this,setTimeout(()=>{(0,p.A)(gp,this,null),(0,l.A)(vp,this,Sp).call(this,t,e)},200))}function kp(t,e){const{width:i,height:s}=(0,u.A)(op,this);let n=i,a=s,r=(0,u.A)(op,this);for(;n>2*t||a>2*e;){const i=n,s=a;n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2)),a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));const o=new OffscreenCanvas(n,a);o.getContext("2d").drawImage(r,0,0,i,s,0,0,n,a),r=o.transferToImageBitmap()}return r}function Sp(t,e){t=Math.ceil(t),e=Math.ceil(e);const i=(0,u.A)(pp,this);if(!i||i.width===t&&i.height===e)return;i.width=t,i.height=e;const s=(0,u.A)(fp,this)?(0,u.A)(op,this):(0,l.A)(vp,this,kp).call(this,t,e);if(this._uiManager.hasMLManager&&!this.hasAltText()){const i=new OffscreenCanvas(t,e).getContext("2d");i.drawImage(s,0,0,s.width,s.height,0,0,t,e),this._uiManager.mlGuess({service:"image-to-text",request:{data:i.getImageData(0,0,t,e).data,width:t,height:e,channels:4}}).then(t=>{const e=(null===t||void 0===t?void 0:t.output)||"";this.parent&&e&&!this.hasAltText()&&(this.altTextData={altText:e,decorative:!1})})}const n=i.getContext("2d");n.filter=this._uiManager.hcmFilter,n.drawImage(s,0,0,s.width,s.height,0,0,t,e)}function Mp(t){if(t){if((0,u.A)(fp,this)){const t=this._uiManager.imageManager.getSvgUrl((0,u.A)(lp,this));if(t)return t}const t=document.createElement("canvas");({width:t.width,height:t.height}=(0,u.A)(op,this));return t.getContext("2d").drawImage((0,u.A)(op,this),0,0),t.toDataURL()}if((0,u.A)(fp,this)){const[t,e]=this.pageDimensions,i=Math.round(this.width*t*ge.PDF_TO_CSS_UNITS),s=Math.round(this.height*e*ge.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,s);return n.getContext("2d").drawImage((0,u.A)(op,this),0,0,(0,u.A)(op,this).width,(0,u.A)(op,this).height,0,0,i,s),n.transferToImageBitmap()}return structuredClone((0,u.A)(op,this))}function Cp(){this._uiManager._signal&&((0,p.A)(Ap,this,new ResizeObserver(t=>{const e=t[0].contentRect;e.width&&e.height&&(0,l.A)(vp,this,Ep).call(this,e.width,e.height)})),(0,u.A)(Ap,this).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;null===(t=(0,u.A)(Ap,this))||void 0===t||t.disconnect(),(0,p.A)(Ap,this,null)},{once:!0}))}k=bp,(0,c.A)(bp,"_type","stamp"),(0,c.A)(bp,"_editorType",H.STAMP);var Rp=new WeakMap,Tp=new WeakMap,Pp=new WeakMap,Lp=new WeakMap,Ip=new WeakMap,Dp=new WeakMap,Fp=new WeakMap,Op=new WeakMap,Np=new WeakMap,Wp=new WeakMap,Bp=new WeakMap,jp=new WeakMap,Hp=new WeakMap,zp=new WeakSet;class Vp{constructor(t){let{uiManager:e,pageIndex:i,div:s,accessibilityManager:n,annotationLayer:a,drawLayer:r,textLayer:l,viewport:h,l10n:c}=t;(0,o.A)(this,zp),(0,d.A)(this,Rp,void 0),(0,d.A)(this,Tp,!1),(0,d.A)(this,Pp,null),(0,d.A)(this,Lp,null),(0,d.A)(this,Ip,null),(0,d.A)(this,Dp,null),(0,d.A)(this,Fp,null),(0,d.A)(this,Op,new Map),(0,d.A)(this,Np,!1),(0,d.A)(this,Wp,!1),(0,d.A)(this,Bp,!1),(0,d.A)(this,jp,null),(0,d.A)(this,Hp,void 0);const A=[...Yp._.values()];if(!Vp._initialized){Vp._initialized=!0;for(const t of A)t.initialize(c,e)}e.registerEditorTypes(A),(0,p.A)(Hp,this,e),this.pageIndex=i,this.div=s,(0,p.A)(Rp,this,n),(0,p.A)(Pp,this,a),this.viewport=h,(0,p.A)(jp,this,l),this.drawLayer=r,(0,u.A)(Hp,this).addLayer(this)}get isEmpty(){return 0===(0,u.A)(Op,this).size}get isInvisible(){return this.isEmpty&&(0,u.A)(Hp,this).getMode()===H.NONE}updateToolbar(t){(0,u.A)(Hp,this).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,u.A)(Hp,this).getMode();switch((0,l.A)(zp,this,Kp).call(this),t){case H.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case H.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case H.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;for(const i of Yp._.values())e.toggle("".concat(i._type,"Editing"),t===i._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===(null===(e=(0,u.A)(jp,this))||void 0===e?void 0:e.div)}addInkEditorIfNeeded(t){if((0,u.A)(Hp,this).getMode()!==H.INK)return;if(!t)for(const e of(0,u.A)(Op,this).values())if(e.isEmpty())return void e.setInBackground();this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){(0,u.A)(Hp,this).setEditingState(t)}addCommands(t){(0,u.A)(Hp,this).addCommands(t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(t=(0,u.A)(Pp,this))||void 0===t||t.div.classList.toggle("disabled",!e)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const i of(0,u.A)(Op,this).values())i.enableEditing(),i.show(!0),i.annotationElementId&&((0,u.A)(Hp,this).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));if(!(0,u.A)(Pp,this))return;const e=(0,u.A)(Pp,this).getEditableAnnotations();for(const i of e){if(i.hide(),(0,u.A)(Hp,this).isDeletedAnnotationElement(i.data.id))continue;if(t.has(i.data.id))continue;const e=this.deserialize(i);e&&(this.addOrRebuild(e),e.enableEditing())}}disable(){(0,p.A)(Bp,this,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const n of(0,u.A)(Op,this).values()){var i;n.disableEditing(),n.annotationElementId&&(null===n.serialize()?(e.set(n.annotationElementId,n),null===(i=this.getEditableAnnotation(n.annotationElementId))||void 0===i||i.show(),n.remove()):t.set(n.annotationElementId,n))}if((0,u.A)(Pp,this)){const i=(0,u.A)(Pp,this).getEditableAnnotations();for(const s of i){const{id:i}=s.data;if((0,u.A)(Hp,this).isDeletedAnnotationElement(i))continue;let n=e.get(i);n?(n.resetAnnotationElement(s),n.show(!1),s.show()):(n=t.get(i),n&&((0,u.A)(Hp,this).addChangedExistingAnnotation(n),n.renderAnnotationElement(s),n.show(!1)),s.show())}}(0,l.A)(zp,this,Kp).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of Yp._.values())s.remove("".concat(n._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),(0,p.A)(Bp,this,!1)}getEditableAnnotation(t){var e;return(null===(e=(0,u.A)(Pp,this))||void 0===e?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){(0,u.A)(Hp,this).getActive()!==t&&(0,u.A)(Hp,this).setActiveEditor(t)}enableTextSelection(){var t;this.div.tabIndex=-1,null!==(t=(0,u.A)(jp,this))&&void 0!==t&&t.div&&!(0,u.A)(Dp,this)&&((0,p.A)(Dp,this,(0,l.A)(zp,this,Up).bind(this)),(0,u.A)(jp,this).div.addEventListener("pointerdown",(0,u.A)(Dp,this),{signal:(0,u.A)(Hp,this)._signal}),(0,u.A)(jp,this).div.classList.add("highlighting"))}disableTextSelection(){var t;this.div.tabIndex=0,null!==(t=(0,u.A)(jp,this))&&void 0!==t&&t.div&&(0,u.A)(Dp,this)&&((0,u.A)(jp,this).div.removeEventListener("pointerdown",(0,u.A)(Dp,this)),(0,p.A)(Dp,this,null),(0,u.A)(jp,this).div.classList.remove("highlighting"))}enableClick(){if((0,u.A)(Ip,this))return;const t=(0,u.A)(Hp,this)._signal;(0,p.A)(Ip,this,this.pointerdown.bind(this)),(0,p.A)(Lp,this,this.pointerup.bind(this)),this.div.addEventListener("pointerdown",(0,u.A)(Ip,this),{signal:t}),this.div.addEventListener("pointerup",(0,u.A)(Lp,this),{signal:t})}disableClick(){(0,u.A)(Ip,this)&&(this.div.removeEventListener("pointerdown",(0,u.A)(Ip,this)),this.div.removeEventListener("pointerup",(0,u.A)(Lp,this)),(0,p.A)(Ip,this,null),(0,p.A)(Lp,this,null))}attach(t){(0,u.A)(Op,this).set(t.id,t);const{annotationElementId:e}=t;e&&(0,u.A)(Hp,this).isDeletedAnnotationElement(e)&&(0,u.A)(Hp,this).removeDeletedAnnotationElement(t)}detach(t){var e;(0,u.A)(Op,this).delete(t.id),null===(e=(0,u.A)(Rp,this))||void 0===e||e.removePointerInTextLayer(t.contentDiv),!(0,u.A)(Bp,this)&&t.annotationElementId&&(0,u.A)(Hp,this).addDeletedAnnotationElement(t)}remove(t){this.detach(t),(0,u.A)(Hp,this).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,(0,u.A)(Wp,this)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&((0,u.A)(Hp,this).addDeletedAnnotationElement(t.annotationElementId),In.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),null===(e=t.parent)||void 0===e||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),(0,u.A)(Hp,this).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),(0,u.A)(Hp,this).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var e;if(!t.isAttachedToDOM)return;const{activeElement:i}=document;t.div.contains(i)&&!(0,u.A)(Fp,this)&&(t._focusEventsAllowed=!1,(0,p.A)(Fp,this,setTimeout(()=>{(0,p.A)(Fp,this,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:(0,u.A)(Hp,this)._signal}),i.focus())},0))),t._structTreeParentId=null===(e=(0,u.A)(Rp,this))||void 0===e?void 0:e.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return(0,u.A)(Hp,this).getId()}get _signal(){return(0,u.A)(Hp,this)._signal}canCreateNewEmptyEditor(){var t;return null===(t=h(zp,this,Gp))||void 0===t?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){(0,u.A)(Hp,this).updateToolbar(t),(0,u.A)(Hp,this).updateMode(t);const{offsetX:i,offsetY:s}=(0,l.A)(zp,this,Xp).call(this),a=this.getNextId(),r=(0,l.A)(zp,this,qp).call(this,(0,n.A)({parent:this,id:a,x:i,y:s,uiManager:(0,u.A)(Hp,this),isCentered:!0},e));r&&this.add(r)}deserialize(t){var e,i;return(null===(e=Yp._.get(null!==(i=t.annotationType)&&void 0!==i?i:t.annotationEditorType))||void 0===e?void 0:e.deserialize(t,this,(0,u.A)(Hp,this)))||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=this.getNextId(),a=(0,l.A)(zp,this,qp).call(this,(0,n.A)({parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:(0,u.A)(Hp,this),isCentered:e},i));return a&&this.add(a),a}addNewEditor(){this.createAndAddNewEditor((0,l.A)(zp,this,Xp).call(this),!0)}setSelected(t){(0,u.A)(Hp,this).setSelected(t)}toggleSelected(t){(0,u.A)(Hp,this).toggleSelected(t)}isSelected(t){return(0,u.A)(Hp,this).isSelected(t)}unselect(t){(0,u.A)(Hp,this).unselect(t)}pointerup(t){const{isMac:e}=Ut.platform;0!==t.button||t.ctrlKey&&e||t.target===this.div&&(0,u.A)(Np,this)&&((0,p.A)(Np,this,!1),(0,u.A)(Tp,this)?(0,u.A)(Hp,this).getMode()!==H.STAMP?this.createAndAddNewEditor(t,!1):(0,u.A)(Hp,this).unselectAll():(0,p.A)(Tp,this,!0))}pointerdown(t){if((0,u.A)(Hp,this).getMode()===H.HIGHLIGHT&&this.enableTextSelection(),(0,u.A)(Np,this))return void(0,p.A)(Np,this,!1);const{isMac:e}=Ut.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;(0,p.A)(Np,this,!0);const i=(0,u.A)(Hp,this).getActive();(0,p.A)(Tp,this,!i||i.isEmpty())}findNewParent(t,e,i){const s=(0,u.A)(Hp,this).findParent(e,i);return null!==s&&s!==this&&(s.changeParent(t),!0)}destroy(){var t;(null===(t=(0,u.A)(Hp,this).getActive())||void 0===t?void 0:t.parent)===this&&((0,u.A)(Hp,this).commitOrRemove(),(0,u.A)(Hp,this).setActiveEditor(null)),(0,u.A)(Fp,this)&&(clearTimeout((0,u.A)(Fp,this)),(0,p.A)(Fp,this,null));for(const i of(0,u.A)(Op,this).values()){var e;null===(e=(0,u.A)(Rp,this))||void 0===e||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove()}this.div=null,(0,u.A)(Op,this).clear(),(0,u.A)(Hp,this).removeLayer(this)}render(t){let{viewport:e}=t;this.viewport=e,ti(this.div,e);for(const i of(0,u.A)(Hp,this).getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update(t){let{viewport:e}=t;(0,u.A)(Hp,this).commitOrRemove(),(0,l.A)(zp,this,Kp).call(this);const i=this.viewport.rotation,s=e.rotation;if(this.viewport=e,ti(this.div,{rotation:s}),i!==s)for(const n of(0,u.A)(Op,this).values())n.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return(0,u.A)(Hp,this).viewParameters.realScale}}function Up(t){if((0,u.A)(Hp,this).unselectAll(),t.target===(0,u.A)(jp,this).div){const{isMac:e}=Ut.platform;if(0!==t.button||t.ctrlKey&&e)return;(0,u.A)(Hp,this).showAllEditors("highlight",!0,!0),(0,u.A)(jp,this).div.classList.add("free"),iu.startHighlighting(this,"ltr"===(0,u.A)(Hp,this).direction,t),(0,u.A)(jp,this).div.addEventListener("pointerup",()=>{(0,u.A)(jp,this).div.classList.remove("free")},{once:!0,signal:(0,u.A)(Hp,this)._signal}),t.preventDefault()}}function Gp(t){return Yp._.get((0,u.A)(Hp,t).getMode())}function qp(t){const e=h(zp,this,Gp);return e?new e.prototype.constructor(t):null}function Xp(){const{x:t,y:e,width:i,height:s}=this.div.getBoundingClientRect(),n=Math.max(0,t),a=Math.max(0,e),r=(n+Math.min(window.innerWidth,t+i))/2-t,o=(a+Math.min(window.innerHeight,e+s))/2-e,[l,h]=this.viewport.rotation%180===0?[r,o]:[o,r];return{offsetX:l,offsetY:h}}function Kp(){(0,p.A)(Wp,this,!0);for(const t of(0,u.A)(Op,this).values())t.isEmpty()&&t.remove();(0,p.A)(Wp,this,!1)}(0,c.A)(Vp,"_initialized",!1);var Yp={_:new Map([fc,Du,bp,iu].map(t=>[t._editorType,t]))},Qp=new WeakMap,Jp=new WeakMap,Zp=new WeakMap,$p=new WeakMap,tA=new WeakSet;class eA{constructor(t){let{pageIndex:e}=t;(0,o.A)(this,tA),(0,d.A)(this,Qp,null),(0,d.A)(this,Jp,0),(0,d.A)(this,Zp,new Map),(0,d.A)(this,$p,new Map),this.pageIndex=e}setParent(t){if((0,u.A)(Qp,this)){if((0,u.A)(Qp,this)!==t){if((0,u.A)(Zp,this).size>0)for(const e of(0,u.A)(Zp,this).values())e.remove(),t.append(e);(0,p.A)(Qp,this,t)}}else(0,p.A)(Qp,this,t)}static get _svgFactory(){return Lt(this,"_svgFactory",new Ne)}highlight(t,e,i){var s,n;let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=((0,p.A)(Jp,this,(s=(0,u.A)(Jp,this),n=s++,s)),n),o=(0,l.A)(tA,this,sA).call(this,t.box);o.classList.add("highlight"),t.free&&o.classList.add("free");const h=eA._svgFactory.createElement("defs");o.append(h);const c=eA._svgFactory.createElement("path");h.append(c);const d="path_p".concat(this.pageIndex,"_").concat(r);c.setAttribute("id",d),c.setAttribute("d",t.toSVGPath()),a&&(0,u.A)($p,this).set(r,c);const A=(0,l.A)(tA,this,nA).call(this,h,d),g=eA._svgFactory.createElement("use");return o.append(g),o.setAttribute("fill",e),o.setAttribute("fill-opacity",i),g.setAttribute("href","#".concat(d)),(0,u.A)(Zp,this).set(r,o),{id:r,clipPathId:"url(#".concat(A,")")}}highlightOutline(t){var e,i;const s=((0,p.A)(Jp,this,(e=(0,u.A)(Jp,this),i=e++,e)),i),n=(0,l.A)(tA,this,sA).call(this,t.box);n.classList.add("highlightOutline");const a=eA._svgFactory.createElement("defs");n.append(a);const r=eA._svgFactory.createElement("path");a.append(r);const o="path_p".concat(this.pageIndex,"_").concat(s);let h;if(r.setAttribute("id",o),r.setAttribute("d",t.toSVGPath()),r.setAttribute("vector-effect","non-scaling-stroke"),t.free){n.classList.add("free");const t=eA._svgFactory.createElement("mask");a.append(t),h="mask_p".concat(this.pageIndex,"_").concat(s),t.setAttribute("id",h),t.setAttribute("maskUnits","objectBoundingBox");const e=eA._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");const i=eA._svgFactory.createElement("use");t.append(i),i.setAttribute("href","#".concat(o)),i.setAttribute("stroke","none"),i.setAttribute("fill","black"),i.setAttribute("fill-rule","nonzero"),i.classList.add("mask")}const c=eA._svgFactory.createElement("use");n.append(c),c.setAttribute("href","#".concat(o)),h&&c.setAttribute("mask","url(#".concat(h,")"));const d=c.cloneNode();return n.append(d),c.classList.add("mainOutline"),d.classList.add("secondaryOutline"),(0,u.A)(Zp,this).set(s,n),s}finalizeLine(t,e){const i=(0,u.A)($p,this).get(t);(0,u.A)($p,this).delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){(0,u.A)(Zp,this).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),(0,u.A)($p,this).delete(t)}updatePath(t,e){(0,u.A)($p,this).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){iA.call(eA,(0,u.A)(Zp,this).get(t),e)}show(t,e){(0,u.A)(Zp,this).get(t).classList.toggle("hidden",!e)}rotate(t,e){(0,u.A)(Zp,this).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){(0,u.A)(Zp,this).get(t).setAttribute("fill",e)}changeOpacity(t,e){(0,u.A)(Zp,this).get(t).setAttribute("fill-opacity",e)}addClass(t,e){(0,u.A)(Zp,this).get(t).classList.add(e)}removeClass(t,e){(0,u.A)(Zp,this).get(t).classList.remove(e)}remove(t){null!==(0,u.A)(Qp,this)&&((0,u.A)(Zp,this).get(t).remove(),(0,u.A)(Zp,this).delete(t))}destroy(){(0,p.A)(Qp,this,null);for(const t of(0,u.A)(Zp,this).values())t.remove();(0,u.A)(Zp,this).clear()}}function iA(t){let{x:e=0,y:i=0,width:s=1,height:n=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{style:a}=t;a.top="".concat(100*i,"%"),a.left="".concat(100*e,"%"),a.width="".concat(100*s,"%"),a.height="".concat(100*n,"%")}function sA(t){const e=S._svgFactory.create(1,1,!0);return(0,u.A)(Qp,this).append(e),e.setAttribute("aria-hidden",!0),iA.call(S,e,t),e}function nA(t,e){const i=S._svgFactory.createElement("clipPath");t.append(i);const s="clip_".concat(e);i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");const n=S._svgFactory.createElement("use");return i.append(n),n.setAttribute("href","#".concat(e)),n.classList.add("clip"),s}S=eA;var aA=C.AbortException,rA=C.AnnotationEditorLayer,oA=C.AnnotationEditorParamsType,lA=C.AnnotationEditorType,hA=C.AnnotationEditorUIManager,cA=C.AnnotationLayer,dA=C.AnnotationMode,uA=C.CMapCompressionType,pA=C.ColorPicker,AA=C.DOMSVGFactory,gA=C.DrawLayer,fA=C.FeatureTest,mA=C.GlobalWorkerOptions,vA=C.ImageKind,bA=C.InvalidPDFException,wA=C.MissingPDFException,yA=C.OPS,_A=C.Outliner,xA=C.PDFDataRangeTransport,EA=C.PDFDateString,kA=C.PDFWorker,SA=C.PasswordResponses,MA=C.PermissionFlag,CA=C.PixelsPerInch,RA=C.RenderingCancelledException,TA=C.TextLayer,PA=C.UnexpectedResponseException,LA=C.Util,IA=C.VerbosityLevel,DA=C.XfaLayer,FA=C.build,OA=C.createValidAbsoluteUrl,NA=C.fetchData,WA=C.getDocument,BA=C.getFilenameFromUrl,jA=C.getPdfFilenameFromUrl,HA=C.getXfaPageViewport,zA=C.isDataScheme,VA=C.isPdfFile,UA=C.noContextMenu,GA=C.normalizeUnicode,qA=C.renderTextLayer,XA=C.setLayerDimensions,KA=C.shadow,YA=C.updateTextLayer,QA=C.version,JA=i(70579),ZA=i(73884),$A=function(t,e,i){if(i||2===arguments.length)for(var s,n=0,a=e.length;n<a;n++)!s&&n in e||(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))},tg=$A($A($A($A($A($A($A($A($A($A($A($A($A($A($A($A($A($A([],["onCopy","onCut","onPaste"],!0),["onCompositionEnd","onCompositionStart","onCompositionUpdate"],!0),["onFocus","onBlur"],!0),["onInput","onInvalid","onReset","onSubmit"],!0),["onLoad","onError"],!0),["onKeyDown","onKeyPress","onKeyUp"],!0),["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],!0),["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],!0),["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],!0),["onSelect"],!0),["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],!0),["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],!0),["onScroll"],!0),["onWheel"],!0),["onAnimationStart","onAnimationEnd","onAnimationIteration"],!0),["onTransitionEnd"],!0),["onChange"],!0),["onToggle"],!0);function eg(t,e){var i={};return tg.forEach(function(s){var n=t[s];n&&(i[s]=e?function(t){return n(t,e(s))}:n)}),i}function ig(t){var e=!1;return{promise:new Promise(function(i,s){t.then(function(t){return!e&&i(t)}).catch(function(t){return!e&&s(t)})}),cancel:function(){e=!0}}}function sg(t){var e,i,s="";if("string"==typeof t||"number"==typeof t)s+=t;else if("object"==typeof t)if(Array.isArray(t)){var n=t.length;for(e=0;e<n;e++)t[e]&&(i=sg(t[e]))&&(s&&(s+=" "),s+=i)}else for(i in t)t[i]&&(s&&(s+=" "),s+=i);return s}const ng=function(){for(var t,e,i=0,s="",n=arguments.length;i<n;i++)(t=arguments[i])&&(e=sg(t))&&(s&&(s+=" "),s+=e);return s};var ag=!0,rg="Invariant failed";function og(t,e){if(!t){if(ag)throw new Error(rg);var i="function"===typeof e?e():e,s=i?"".concat(rg,": ").concat(i):rg;throw new Error(s)}}var lg=i(96440),hg=Object.prototype.hasOwnProperty;function cg(t,e,i){for(i of t.keys())if(dg(i,e))return i}function dg(t,e){var i,s,n;if(t===e)return!0;if(t&&e&&(i=t.constructor)===e.constructor){if(i===Date)return t.getTime()===e.getTime();if(i===RegExp)return t.toString()===e.toString();if(i===Array){if((s=t.length)===e.length)for(;s--&&dg(t[s],e[s]););return-1===s}if(i===Set){if(t.size!==e.size)return!1;for(s of t){if((n=s)&&"object"===typeof n&&!(n=cg(e,n)))return!1;if(!e.has(n))return!1}return!0}if(i===Map){if(t.size!==e.size)return!1;for(s of t){if((n=s[0])&&"object"===typeof n&&!(n=cg(e,n)))return!1;if(!dg(s[1],e.get(n)))return!1}return!0}if(i===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(i===DataView){if((s=t.byteLength)===e.byteLength)for(;s--&&t.getInt8(s)===e.getInt8(s););return-1===s}if(ArrayBuffer.isView(t)){if((s=t.byteLength)===e.byteLength)for(;s--&&t[s]===e[s];);return-1===s}if(!i||"object"===typeof t){for(i in s=0,t){if(hg.call(t,i)&&++s&&!hg.call(e,i))return!1;if(!(i in e)||!dg(t[i],e[i]))return!1}return Object.keys(e).length===s}}return t!==t&&e!==e}const ug=(0,ZA.createContext)(null);function pg(t){let{children:e,type:i}=t;return(0,JA.jsx)("div",{className:"react-pdf__message react-pdf__message--".concat(i),children:e})}class Ag{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return og(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){og(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}goToDestination(t){return new Promise(e=>{og(this.pdfDocument,"PDF document not loaded."),og(t,"Destination is not specified."),"string"===typeof t?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(t=>{og(Array.isArray(t),'"'.concat(t,'" is not a valid destination array.'));const e=t[0];new Promise(t=>{og(this.pdfDocument,"PDF document not loaded."),e instanceof Object?this.pdfDocument.getPageIndex(e).then(e=>{t(e)}).catch(()=>{og(!1,'"'.concat(e,'" is not a valid page reference.'))}):"number"===typeof e?t(e):og(!1,'"'.concat(e,'" is not a valid destination reference.'))}).then(e=>{const i=e+1;og(this.pdfViewer,"PDF viewer is not initialized."),og(i>=1&&i<=this.pagesCount,'"'.concat(i,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:e,pageNumber:i})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;og(this.pdfViewer,"PDF viewer is not initialized."),og(t>=1&&t<=this.pagesCount,'"'.concat(t,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,i){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=i?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const gg={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},fg="undefined"!==typeof window,mg=fg&&"file:"===window.location.protocol;function vg(t){return"undefined"!==typeof t}function bg(t){return vg(t)&&null!==t}function wg(t){return function(t){return"string"===typeof t}(t)&&/^data:/.test(t)}function yg(t){og(wg(t),"Invalid data URI.");const[e="",i=""]=t.split(",");return-1!==e.split(";").indexOf("base64")?atob(i):unescape(i)}function _g(){return fg&&window.devicePixelRatio||1}const xg="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Eg(){lg(!mg,"Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ".concat(xg))}function kg(t){(null===t||void 0===t?void 0:t.cancel)&&t.cancel()}function Sg(t,e){return Object.defineProperty(t,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.view[3]},configurable:!0}),t}function Mg(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function Cg(){return(0,ZA.useReducer)(Mg,{value:void 0,error:void 0})}var Rg=function(t,e,i,s){return new(i||(i=Promise))(function(n,a){function r(t){try{l(s.next(t))}catch(e){a(e)}}function o(t){try{l(s.throw(t))}catch(e){a(e)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((s=s.apply(t,e||[])).next())})},Tg=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};const{PDFDataRangeTransport:Pg}=s,Lg=(t,e)=>{switch(e){case gg.NEED_PASSWORD:t(prompt("Enter the password to open this PDF file."));break;case gg.INCORRECT_PASSWORD:t(prompt("Invalid password. Please try again."));break}};function Ig(t){return"object"===typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}const Dg=(0,ZA.forwardRef)(function(t,e){var{children:i,className:s,error:n="Failed to load PDF file.",externalLinkRel:a,externalLinkTarget:r,file:o,inputRef:l,imageResourcesPath:h,loading:c="Loading PDF\u2026",noData:d="No PDF file specified.",onItemClick:u,onLoadError:p,onLoadProgress:A,onLoadSuccess:g,onPassword:f=Lg,onSourceError:m,onSourceSuccess:v,options:b,renderMode:w,rotate:y}=t,_=Tg(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[x,E]=Cg(),{value:k,error:S}=x,[M,C]=Cg(),{value:R,error:T}=M,P=(0,ZA.useRef)(new Ag),L=(0,ZA.useRef)([]),I=(0,ZA.useRef)(void 0),D=(0,ZA.useRef)(void 0);o&&o!==I.current&&Ig(o)&&(lg(!dg(o,I.current),'File prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.'),I.current=o),b&&b!==D.current&&(lg(!dg(b,D.current),'Options prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.'),D.current=b);const F=(0,ZA.useRef)({scrollPageIntoView:t=>{const{dest:e,pageNumber:i,pageIndex:s=i-1}=t;if(u)return void u({dest:e,pageIndex:s,pageNumber:i});const n=L.current[s];n?n.scrollIntoView():lg(!1,"An internal link leading to page ".concat(i," was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>."))}});(0,ZA.useImperativeHandle)(e,()=>({linkService:P,pages:L,viewer:F}),[]),(0,ZA.useEffect)(function(){E({type:"RESET"})},[o,E]);const O=(0,ZA.useCallback)(()=>Rg(this,void 0,void 0,function*(){if(!o)return null;if("string"===typeof o){if(wg(o)){return{data:yg(o)}}return Eg(),{url:o}}if(o instanceof Pg)return{range:o};if(o instanceof ArrayBuffer)return{data:o};if(fg&&function(t){return og(fg,"isBlob can only be used in a browser environment"),t instanceof Blob}(o)){const t=yield function(t){return new Promise((e,i)=>{const s=new FileReader;s.onload=()=>{if(!s.result)return i(new Error("Error while reading a file."));e(s.result)},s.onerror=t=>{if(!t.target)return i(new Error("Error while reading a file."));const{error:e}=t.target;if(!e)return i(new Error("Error while reading a file."));switch(e.code){case e.NOT_FOUND_ERR:return i(new Error("Error while reading a file: File not found."));case e.SECURITY_ERR:return i(new Error("Error while reading a file: Security error."));case e.ABORT_ERR:return i(new Error("Error while reading a file: Aborted."));default:return i(new Error("Error while reading a file."))}},s.readAsArrayBuffer(t)})}(o);return{data:t}}if(og("object"===typeof o,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),og(Ig(o),"Invalid parameter object: need either .data, .range or .url"),"url"in o&&"string"===typeof o.url){if(wg(o.url)){const{url:t}=o,e=Tg(o,["url"]),i=yg(t);return Object.assign({data:i},e)}Eg()}return o}),[o]);(0,ZA.useEffect)(()=>{const t=ig(O());return t.promise.then(t=>{E({type:"RESOLVE",value:t})}).catch(t=>{E({type:"REJECT",error:t})}),()=>{kg(t)}},[O,E]),(0,ZA.useEffect)(()=>{"undefined"!==typeof k&&(!1!==k?v&&v():S&&(lg(!1,S.toString()),m&&m(S)))},[k]),(0,ZA.useEffect)(function(){C({type:"RESET"})},[C,k]),(0,ZA.useEffect)(function(){if(!k)return;const t=b?Object.assign(Object.assign({},k),b):k,e=WA(t);A&&(e.onProgress=A),f&&(e.onPassword=f);const i=e,s=i.promise.then(t=>{C({type:"RESOLVE",value:t})}).catch(t=>{i.destroyed||C({type:"REJECT",error:t})});return()=>{s.finally(()=>i.destroy())}},[b,C,k]),(0,ZA.useEffect)(()=>{"undefined"!==typeof R&&(!1!==R?R&&(g&&g(R),L.current=new Array(R.numPages),P.current.setDocument(R)):T&&(lg(!1,T.toString()),p&&p(T)))},[R]),(0,ZA.useEffect)(function(){P.current.setViewer(F.current),P.current.setExternalLinkRel(a),P.current.setExternalLinkTarget(r)},[a,r]);const N=(0,ZA.useCallback)((t,e)=>{L.current[t]=e},[]),W=(0,ZA.useCallback)(t=>{delete L.current[t]},[]),B=(0,ZA.useMemo)(()=>({imageResourcesPath:h,linkService:P.current,onItemClick:u,pdf:R,registerPage:N,renderMode:w,rotate:y,unregisterPage:W}),[h,u,R,N,w,y,W]),j=(0,ZA.useMemo)(()=>eg(_,()=>R),[_,R]);return(0,JA.jsx)("div",Object.assign({className:ng("react-pdf__Document",s),ref:l,style:{"--scale-factor":"1"}},j,{children:o?void 0===R||null===R?(0,JA.jsx)(pg,{type:"loading",children:"function"===typeof c?c():c}):!1===R?(0,JA.jsx)(pg,{type:"error",children:"function"===typeof n?n():n}):(0,JA.jsx)(ug.Provider,{value:B,children:i}):(0,JA.jsx)(pg,{type:"no-data",children:"function"===typeof d?d():d})}))}),Fg=(0,ZA.createContext)(null);class Og{constructor(t){let{num:e,gen:i}=t;this.num=e,this.gen=i}toString(){let t="".concat(this.num,"R");return 0!==this.gen&&(t+=this.gen),t}}function Ng(t){const e=(0,ZA.useRef)(void 0),i=e.current;return vg(i)?()=>i:()=>{const i=t();return e.current=i,i}}function Wg(){return(0,ZA.useContext)(ug)}function Bg(){return(0,ZA.useContext)(Fg)}var jg=function(t,e,i,s){return new(i||(i=Promise))(function(n,a){function r(t){try{l(s.next(t))}catch(e){a(e)}}function o(t){try{l(s.throw(t))}catch(e){a(e)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,o)}l((s=s.apply(t,e||[])).next())})},Hg=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};function zg(t){const e=Wg(),i=Bg();og(i,"Unable to find Outline context.");const s=Object.assign(Object.assign(Object.assign({},e),i),t),{item:n,linkService:a,onItemClick:r,pdf:o}=s,l=Hg(s,["item","linkService","onItemClick","pdf"]);og(o,"Attempted to load an outline, but no document was specified. Wrap <Outline /> in a <Document /> or pass explicit `pdf` prop.");const h=Ng(()=>"string"===typeof n.dest?o.getDestination(n.dest):n.dest),c=Ng(()=>jg(this,void 0,void 0,function*(){const t=yield h();if(!t)throw new Error("Destination not found.");const[e]=t;return o.getPageIndex(new Og(e))})),d=Ng(()=>jg(this,void 0,void 0,function*(){return(yield c())+1}));return(0,JA.jsxs)("li",{children:[(0,JA.jsx)("a",{href:"#",onClick:function(t){t.preventDefault(),og(r||a,"Either onItemClick callback or linkService must be defined in order to navigate to an outline item."),r?Promise.all([h(),c(),d()]).then(t=>{let[e,i,s]=t;r({dest:e,pageIndex:i,pageNumber:s})}):a&&a.goToDestination(n.dest)},children:n.title}),function(){if(!n.items||!n.items.length)return null;const{items:t}=n;return(0,JA.jsx)("ul",{children:t.map((t,e)=>(0,JA.jsx)(zg,Object.assign({item:t,pdf:o},l),"string"===typeof t.dest?t.dest:e))})}()]})}var Vg=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};function Ug(t){const e=Wg(),i=Object.assign(Object.assign({},e),t),{className:s,inputRef:n,onItemClick:a,onLoadError:r,onLoadSuccess:o,pdf:l}=i,h=Vg(i,["className","inputRef","onItemClick","onLoadError","onLoadSuccess","pdf"]);og(l,"Attempted to load an outline, but no document was specified. Wrap <Outline /> in a <Document /> or pass explicit `pdf` prop.");const[c,d]=Cg(),{value:u,error:p}=c;(0,ZA.useEffect)(function(){d({type:"RESET"})},[d,l]),(0,ZA.useEffect)(function(){if(!l)return;const t=ig(l.getOutline()),e=t;return t.promise.then(t=>{d({type:"RESOLVE",value:t})}).catch(t=>{d({type:"REJECT",error:t})}),()=>kg(e)},[d,l]),(0,ZA.useEffect)(()=>{void 0!==u&&(!1!==u?"undefined"!==typeof u&&!1!==u&&o&&o(u):p&&(lg(!1,p.toString()),r&&r(p)))},[u]);const A=(0,ZA.useMemo)(()=>({onItemClick:a}),[a]),g=(0,ZA.useMemo)(()=>eg(h,()=>u),[h,u]);if(!u)return null;return(0,JA.jsx)("div",Object.assign({className:ng("react-pdf__Outline",s),ref:n},g,{children:(0,JA.jsx)(Fg.Provider,{value:A,children:u?(0,JA.jsx)("ul",{children:u.map((t,e)=>(0,JA.jsx)(zg,{item:t,pdf:l},"string"===typeof t.dest?t.dest:e))}):null})}))}function Gg(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=t.filter(Boolean);return i.length<=1?i[0]||null:function(t){i.forEach(function(e){"function"===typeof e?e(t):e&&(e.current=t)})}}const qg=(0,ZA.createContext)(null),Xg={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Kg=/^H(\d+)$/;function Yg(t){return"children"in t}function Qg(t){return!!Yg(t)&&(1===t.children.length&&0 in t.children&&"id"in t.children[0])}function Jg(t){const e={};if(Yg(t)){const{role:i}=t,s=i.match(Kg);if(s)e.role="heading",e["aria-level"]=Number(s[1]);else if(function(t){return t in Xg}(i)){const t=Xg[i];t&&(e.role=t)}}return e}function Zg(t){const e={};if(Yg(t)){if(void 0!==t.alt&&(e["aria-label"]=t.alt),void 0!==t.lang&&(e.lang=t.lang),Qg(t)){const[i]=t.children;if(i){const t=Zg(i);return Object.assign(Object.assign({},e),t)}}}else"id"in t&&(e["aria-owns"]=t.id);return e}function $g(t){return t?Object.assign(Object.assign({},Jg(t)),Zg(t)):null}function tf(t){let{className:e,node:i}=t;const s=(0,ZA.useMemo)(()=>$g(i),[i]),n=(0,ZA.useMemo)(()=>Yg(i)?Qg(i)?null:i.children.map((t,e)=>(0,JA.jsx)(tf,{node:t},e)):null,[i]);return(0,JA.jsx)("span",Object.assign({className:e},s,{children:n}))}function ef(){return(0,ZA.useContext)(qg)}function sf(){const t=ef();og(t,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:i}=t,[s,n]=Cg(),{value:a,error:r}=s,{customTextRenderer:o,page:l}=t;return(0,ZA.useEffect)(function(){n({type:"RESET"})},[n,l]),(0,ZA.useEffect)(function(){if(o)return;if(!l)return;const t=ig(l.getStructTree()),e=t;return t.promise.then(t=>{n({type:"RESOLVE",value:t})}).catch(t=>{n({type:"REJECT",error:t})}),()=>kg(e)},[o,l,n]),(0,ZA.useEffect)(()=>{void 0!==a&&(!1!==a?a&&i&&i(a):r&&(lg(!1,r.toString()),e&&e(r)))},[a]),a?(0,JA.jsx)(tf,{className:"react-pdf__Page__structTree structTree",node:a}):null}const nf=dA;function af(t){const e=ef();og(e,"Unable to find Page context.");const i=Object.assign(Object.assign({},e),t),{_className:s,canvasBackground:n,devicePixelRatio:a=_g(),onRenderError:r,onRenderSuccess:o,page:l,renderForms:h,renderTextLayer:c,rotate:d,scale:u}=i,{canvasRef:p}=t;og(l,"Attempted to render page canvas, but no page was specified.");const A=(0,ZA.useRef)(null);function g(t){(function(t){return"RenderingCancelledException"===t.name})(t)||(lg(!1,t.toString()),r&&r(t))}const f=(0,ZA.useMemo)(()=>l.getViewport({scale:u*a,rotation:d}),[a,l,d,u]),m=(0,ZA.useMemo)(()=>l.getViewport({scale:u,rotation:d}),[l,d,u]);(0,ZA.useEffect)(function(){if(!l)return;l.cleanup();const{current:t}=A;if(!t)return;t.width=f.width,t.height=f.height,t.style.width="".concat(Math.floor(m.width),"px"),t.style.height="".concat(Math.floor(m.height),"px"),t.style.visibility="hidden";const e={annotationMode:h?nf.ENABLE_FORMS:nf.ENABLE,canvasContext:t.getContext("2d",{alpha:!1}),viewport:f};n&&(e.background=n);const i=l.render(e),s=i;return i.promise.then(()=>{t.style.visibility="",l&&o&&o(Sg(l,u))}).catch(g),()=>kg(s)},[n,l,h,f,m]);const v=(0,ZA.useCallback)(()=>{const{current:t}=A;t&&(t.width=0,t.height=0)},[]);return(0,ZA.useEffect)(()=>v,[v]),(0,JA.jsx)("canvas",{className:"".concat(s,"__canvas"),dir:"ltr",ref:Gg(p,A),style:{display:"block",userSelect:"none"},children:c?(0,JA.jsx)(sf,{}):null})}function rf(){const t=ef();og(t,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:i,onGetTextSuccess:s,onRenderTextLayerError:n,onRenderTextLayerSuccess:a,page:r,pageIndex:o,pageNumber:l,rotate:h,scale:c}=t;og(r,"Attempted to load page text content, but no page was specified.");const[d,u]=Cg(),{value:p,error:A}=d,g=(0,ZA.useRef)(null),f=(0,ZA.useRef)(void 0);lg(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),(0,ZA.useEffect)(function(){u({type:"RESET"})},[r,u]),(0,ZA.useEffect)(function(){if(!r)return;const t=ig(r.getTextContent()),e=t;return t.promise.then(t=>{u({type:"RESOLVE",value:t})}).catch(t=>{u({type:"REJECT",error:t})}),()=>kg(e)},[r,u]),(0,ZA.useEffect)(()=>{void 0!==p&&(!1!==p?p&&s&&s(p):A&&(lg(!1,A.toString()),i&&i(A)))},[p]);const m=(0,ZA.useCallback)(()=>{a&&a()},[a]),v=(0,ZA.useCallback)(t=>{lg(!1,t.toString()),n&&n(t)},[n]);const b=(0,ZA.useMemo)(()=>r.getViewport({scale:c,rotation:h}),[r,h,c]);return(0,ZA.useLayoutEffect)(function(){if(!r||!p)return;const{current:t}=g;if(!t)return;t.innerHTML="";const i=r.streamTextContent({includeMarkedContent:!0}),s=new TA({container:t,textContentSource:i,viewport:b}),n=s;return s.render().then(()=>{const i=document.createElement("div");i.className="endOfContent",t.append(i),f.current=i;const s=t.querySelectorAll('[role="presentation"]');if(e){let t=0;p.items.forEach((i,n)=>{if(!function(t){return"str"in t}(i))return;const a=s[t];if(!a)return;const r=e(Object.assign({pageIndex:o,pageNumber:l,itemIndex:n},i));a.innerHTML=r,t+=i.str&&i.hasEOL?2:1})}m()}).catch(v),()=>kg(n)},[e,v,m,r,o,l,p,b]),(0,JA.jsx)("div",{className:ng("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){const t=f.current;t&&t.classList.remove("active")},onMouseDown:function(){const t=f.current;t&&t.classList.add("active")},ref:g})}function of(){const t=Wg(),e=ef();og(e,"Unable to find Page context.");const i=Object.assign(Object.assign({},t),e),{imageResourcesPath:s,linkService:n,onGetAnnotationsError:a,onGetAnnotationsSuccess:r,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:l,page:h,pdf:c,renderForms:d,rotate:u,scale:p=1}=i;og(c,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),og(h,"Attempted to load page annotations, but no page was specified."),og(n,"Attempted to load page annotations, but no linkService was specified.");const[A,g]=Cg(),{value:f,error:m}=A,v=(0,ZA.useRef)(null);lg(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),(0,ZA.useEffect)(function(){g({type:"RESET"})},[g,h]),(0,ZA.useEffect)(function(){if(!h)return;const t=ig(h.getAnnotations()),e=t;return t.promise.then(t=>{g({type:"RESOLVE",value:t})}).catch(t=>{g({type:"REJECT",error:t})}),()=>{kg(e)}},[g,h]),(0,ZA.useEffect)(()=>{void 0!==f&&(!1!==f?f&&r&&r(f):m&&(lg(!1,m.toString()),a&&a(m)))},[f]);const b=(0,ZA.useMemo)(()=>h.getViewport({scale:p,rotation:u}),[h,u,p]);return(0,ZA.useEffect)(function(){if(!c||!h||!n||!f)return;const{current:t}=v;if(!t)return;const e=b.clone({dontFlip:!0}),i={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:t,l10n:null,page:h,viewport:e},a={annotations:f,annotationStorage:c.annotationStorage,div:t,imageResourcesPath:s,linkService:n,page:h,renderForms:d,viewport:e};t.innerHTML="";try{new cA(i).render(a),l&&l()}catch(r){!function(t){lg(!1,"".concat(t)),o&&o(t)}(r)}return()=>{}},[f,s,n,h,c,d,b]),(0,JA.jsx)("div",{className:ng("react-pdf__Page__annotations","annotationLayer"),ref:v})}var lf=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};const hf=1;function cf(t){const e=Wg(),i=Object.assign(Object.assign({},e),t),{_className:s="react-pdf__Page",_enableRegisterUnregisterPage:n=!0,canvasBackground:a,canvasRef:r,children:o,className:l,customRenderer:h,customTextRenderer:c,devicePixelRatio:d,error:u="Failed to load the page.",height:p,inputRef:A,loading:g="Loading page\u2026",noData:f="No page specified.",onGetAnnotationsError:m,onGetAnnotationsSuccess:v,onGetStructTreeError:b,onGetStructTreeSuccess:w,onGetTextError:y,onGetTextSuccess:_,onLoadError:x,onLoadSuccess:E,onRenderAnnotationLayerError:k,onRenderAnnotationLayerSuccess:S,onRenderError:M,onRenderSuccess:C,onRenderTextLayerError:R,onRenderTextLayerSuccess:T,pageIndex:P,pageNumber:L,pdf:I,registerPage:D,renderAnnotationLayer:F=!0,renderForms:O=!1,renderMode:N="canvas",renderTextLayer:W=!0,rotate:B,scale:j=hf,unregisterPage:H,width:z}=i,V=lf(i,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[U,G]=Cg(),{value:q,error:X}=U,K=(0,ZA.useRef)(null);og(I,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const Y=bg(L)?L-1:null!==P&&void 0!==P?P:null,Q=null!==L&&void 0!==L?L:bg(P)?P+1:null,J=null!==B&&void 0!==B?B:q?q.rotate:null,Z=(0,ZA.useMemo)(()=>{if(!q)return null;let t=1;const e=null!==j&&void 0!==j?j:hf;if(z||p){const e=q.getViewport({scale:1,rotation:J});z?t=z/e.width:p&&(t=p/e.height)}return e*t},[p,q,J,j,z]);(0,ZA.useEffect)(function(){return()=>{bg(Y)&&n&&H&&H(Y)}},[n,I,Y,H]),(0,ZA.useEffect)(function(){G({type:"RESET"})},[G,I,Y]),(0,ZA.useEffect)(function(){if(!I||!Q)return;const t=ig(I.getPage(Q)),e=t;return t.promise.then(t=>{G({type:"RESOLVE",value:t})}).catch(t=>{G({type:"REJECT",error:t})}),()=>kg(e)},[G,I,Q]),(0,ZA.useEffect)(()=>{void 0!==q&&(!1!==q?function(){if(E){if(!q||!Z)return;E(Sg(q,Z))}if(n&&D){if(!bg(Y)||!K.current)return;D(Y,K.current)}}():X&&(lg(!1,X.toString()),x&&x(X)))},[q,Z]);const $=(0,ZA.useMemo)(()=>q&&bg(Y)&&Q&&bg(J)&&bg(Z)?{_className:s,canvasBackground:a,customTextRenderer:c,devicePixelRatio:d,onGetAnnotationsError:m,onGetAnnotationsSuccess:v,onGetStructTreeError:b,onGetStructTreeSuccess:w,onGetTextError:y,onGetTextSuccess:_,onRenderAnnotationLayerError:k,onRenderAnnotationLayerSuccess:S,onRenderError:M,onRenderSuccess:C,onRenderTextLayerError:R,onRenderTextLayerSuccess:T,page:q,pageIndex:Y,pageNumber:Q,renderForms:O,renderTextLayer:W,rotate:J,scale:Z}:null,[s,a,c,d,m,v,b,w,y,_,k,S,M,C,R,T,q,Y,Q,O,W,J,Z]),tt=(0,ZA.useMemo)(()=>eg(V,()=>q?Z?Sg(q,Z):void 0:q),[V,q,Z]),et="".concat(Y,"@").concat(Z,"/").concat(J);function it(){switch(N){case"custom":return og(h,'renderMode was set to "custom", but no customRenderer was passed.'),(0,JA.jsx)(h,{},"".concat(et,"_custom"));case"none":return null;default:return(0,JA.jsx)(af,{canvasRef:r},"".concat(et,"_canvas"))}}return(0,JA.jsx)("div",Object.assign({className:ng(s,l),"data-page-number":Q,ref:Gg(A,K),style:{"--scale-factor":"".concat(Z),backgroundColor:a||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},tt,{children:Q?null===I||void 0===q||null===q?(0,JA.jsx)(pg,{type:"loading",children:"function"===typeof g?g():g}):!1===I||!1===q?(0,JA.jsx)(pg,{type:"error",children:"function"===typeof u?u():u}):(0,JA.jsxs)(qg.Provider,{value:$,children:[it(),W?(0,JA.jsx)(rf,{},"".concat(et,"_text")):null,F?(0,JA.jsx)(of,{},"".concat(et,"_annotations")):null,o]}):(0,JA.jsx)(pg,{type:"no-data",children:"function"===typeof f?f():f})}))}var df=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};function uf(t){const e=Wg(),i=Object.assign(Object.assign({},e),t),{className:s,linkService:n,onItemClick:a,pageIndex:r,pageNumber:o,pdf:l}=i;og(l,"Attempted to load a thumbnail, but no document was specified. Wrap <Thumbnail /> in a <Document /> or pass explicit `pdf` prop.");const h=bg(o)?o-1:null!==r&&void 0!==r?r:null,c=null!==o&&void 0!==o?o:bg(r)?r+1:null;const{className:d,onItemClick:u}=t,p=df(t,["className","onItemClick"]);return(0,JA.jsx)("a",{className:ng("react-pdf__Thumbnail",s),href:c?"#":void 0,onClick:function(t){t.preventDefault(),bg(h)&&c&&(og(a||n,"Either onItemClick callback or linkService must be defined in order to navigate to an outline item."),a?a({pageIndex:h,pageNumber:c}):n&&n.goToPage(c))},children:(0,JA.jsx)(cf,Object.assign({},p,{_className:"react-pdf__Thumbnail__page",_enableRegisterUnregisterPage:!1,renderAnnotationLayer:!1,renderTextLayer:!1}))})}lg(!mg,"Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ".concat(xg)),mA.workerSrc="pdf.worker.mjs"},24558:(t,e,i)=>{i.d(e,{A:()=>n});var s=i(26562);function n(t,e,i){return t.set((0,s.A)(t,e),i),i}},26562:(t,e,i)=>{function s(t,e,i){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:i;throw new TypeError("Private element is not present on this object")}i.d(e,{A:()=>s})},38458:(t,e,i)=>{i.d(e,{A:()=>n});var s=i(26562);function n(t,e){return t.get((0,s.A)(t,e))}},39790:(t,e,i)=>{i.d(e,{A:()=>n});var s=i(8195);function n(t,e){(0,s.A)(t,e),e.add(t)}},51153:(t,e,i)=>{var s=i(73884),n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function h(t,e,i){var s,a={},h=null,c=null;for(s in void 0!==i&&(h=""+i),void 0!==e.key&&(h=""+e.key),void 0!==e.ref&&(c=e.ref),e)r.call(e,s)&&!l.hasOwnProperty(s)&&(a[s]=e[s]);if(t&&t.defaultProps)for(s in e=t.defaultProps)void 0===a[s]&&(a[s]=e[s]);return{$$typeof:n,type:t,key:h,ref:c,props:a,_owner:o.current}}e.Fragment=a,e.jsx=h,e.jsxs=h},55149:(t,e,i)=>{i.d(e,{A:()=>n});var s=i(8195);function n(t,e,i){(0,s.A)(t,e),e.set(t,i)}},70579:(t,e,i)=>{t.exports=i(51153)},96440:t=>{var e=function(){};t.exports=e}}]);
3
- //# sourceMappingURL=3322.ebf065a0.chunk.js.map