sema-code-ui 0.0.0-stage → 2.1.4

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 (372) hide show
  1. package/README.md +28 -2
  2. package/bin/sema-ui.js +2 -0
  3. package/dist/cli.js +4639 -0
  4. package/dist/public/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  5. package/dist/public/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  6. package/dist/public/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  7. package/dist/public/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  8. package/dist/public/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  9. package/dist/public/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  10. package/dist/public/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  11. package/dist/public/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  12. package/dist/public/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  13. package/dist/public/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  14. package/dist/public/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  15. package/dist/public/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  16. package/dist/public/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  17. package/dist/public/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  18. package/dist/public/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  19. package/dist/public/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  20. package/dist/public/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  21. package/dist/public/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  22. package/dist/public/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  23. package/dist/public/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  24. package/dist/public/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  25. package/dist/public/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  26. package/dist/public/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  27. package/dist/public/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  28. package/dist/public/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  29. package/dist/public/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  30. package/dist/public/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  31. package/dist/public/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  32. package/dist/public/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  33. package/dist/public/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  34. package/dist/public/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  35. package/dist/public/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  36. package/dist/public/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  37. package/dist/public/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  38. package/dist/public/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  39. package/dist/public/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  40. package/dist/public/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  41. package/dist/public/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  42. package/dist/public/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  43. package/dist/public/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  44. package/dist/public/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  45. package/dist/public/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  46. package/dist/public/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  47. package/dist/public/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  48. package/dist/public/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  49. package/dist/public/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  50. package/dist/public/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  51. package/dist/public/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  52. package/dist/public/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  53. package/dist/public/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  54. package/dist/public/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  55. package/dist/public/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  56. package/dist/public/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  57. package/dist/public/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  58. package/dist/public/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  59. package/dist/public/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  60. package/dist/public/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  61. package/dist/public/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  62. package/dist/public/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  63. package/dist/public/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
  64. package/dist/public/assets/abnfDiagram-VCTEODGH-jerp7nR7.js +1 -0
  65. package/dist/public/assets/arc-BKtVw-5X.js +1 -0
  66. package/dist/public/assets/architectureDiagram-5GKGNRK7-CAQBfzNp.js +36 -0
  67. package/dist/public/assets/blockDiagram-I7D4REHJ-eT3AUuZb.js +129 -0
  68. package/dist/public/assets/c4Diagram-7LVT6UL2-DAAd027j.js +38 -0
  69. package/dist/public/assets/channel-COTmjPbb.js +1 -0
  70. package/dist/public/assets/chunk-2Q5K7J3B-D-9Y1d0N.js +1 -0
  71. package/dist/public/assets/chunk-5VM5RSS4-DwGFL19Q.js +15 -0
  72. package/dist/public/assets/chunk-F27PBJKO-BQ3tTrPF.js +1 -0
  73. package/dist/public/assets/chunk-IMKFNOWR-C1YkYZnB.js +231 -0
  74. package/dist/public/assets/chunk-JWPE2WC7-ddWKnZRa.js +1 -0
  75. package/dist/public/assets/chunk-POPQ4Y6H-fBnUAxGB.js +1 -0
  76. package/dist/public/assets/chunk-SVP7TREG-CMXiwsDR.js +88 -0
  77. package/dist/public/assets/chunk-TICWLB2K-DST453KD.js +206 -0
  78. package/dist/public/assets/chunk-XXDRQBXY-D5kNIT5P.js +1 -0
  79. package/dist/public/assets/classDiagram-ZZMXUADV-Lr4CIilS.js +1 -0
  80. package/dist/public/assets/classDiagram-v2-VYDZK3BY-Lr4CIilS.js +1 -0
  81. package/dist/public/assets/cose-bilkent-JH36ORCC-sc1yF5Gf.js +1 -0
  82. package/dist/public/assets/cynefin-OW5HDTMX-Dwe5aQpb.js +178 -0
  83. package/dist/public/assets/cynefinDiagram-5FMLGOSQ-W_SW62Ko.js +62 -0
  84. package/dist/public/assets/cytoscape.esm-Bch-eiPH.js +331 -0
  85. package/dist/public/assets/dagre-GXQ25YYZ-D99NrftV.js +4 -0
  86. package/dist/public/assets/defaultLocale-DX6XiGOO.js +1 -0
  87. package/dist/public/assets/diagram-S7CK7UJ4-DL3IhTh8.js +30 -0
  88. package/dist/public/assets/diagram-UQ7AKVKN-DSL_Joxa.js +41 -0
  89. package/dist/public/assets/diagram-VSXAHHWV-ge66Mn5n.js +3 -0
  90. package/dist/public/assets/diagram-VX7I27RA-BGeISp3y.js +24 -0
  91. package/dist/public/assets/diagram-Z3DM3KII-ClJeMRbb.js +24 -0
  92. package/dist/public/assets/docx-preview-BcbGRtLc.js +27 -0
  93. package/dist/public/assets/ebnfDiagram-PWID7BFC-Cn4t65pg.js +1 -0
  94. package/dist/public/assets/erDiagram-RLTQ6QDP-B1CfcDsm.js +99 -0
  95. package/dist/public/assets/exceljs.min-GkdcPpXr.js +57 -0
  96. package/dist/public/assets/flowDiagram-HODETNUW-BKAsEEya.js +168 -0
  97. package/dist/public/assets/ganttDiagram-EL5Y4UJY-wj_xV86l.js +292 -0
  98. package/dist/public/assets/gitGraphDiagram-WWUBYQGX-DcWUGLDO.js +106 -0
  99. package/dist/public/assets/index-2mLslaAC.js +931 -0
  100. package/dist/public/assets/index-BANUd07X.css +32 -0
  101. package/dist/public/assets/index-BP9qYm1I.js +1 -0
  102. package/dist/public/assets/index-B_RX2-hb.js +1 -0
  103. package/dist/public/assets/index-BeSy_WW1.js +198 -0
  104. package/dist/public/assets/index-C1rb1p6e.js +74 -0
  105. package/dist/public/assets/infoDiagram-27XIBGKW-DIKucIos.js +2 -0
  106. package/dist/public/assets/init-Gi6I4Gst.js +1 -0
  107. package/dist/public/assets/ishikawaDiagram-5VMMS53U-Bz_J0vOe.js +70 -0
  108. package/dist/public/assets/journeyDiagram-3NMN7TZE-CLkeMlCH.js +139 -0
  109. package/dist/public/assets/jstat-so0kbz-l.js +1 -0
  110. package/dist/public/assets/jszip.min-Cbc05ZIR.js +12 -0
  111. package/dist/public/assets/kanban-definition-UXKFOSKX-CwzN7MzX.js +89 -0
  112. package/dist/public/assets/layout-BcaUROCV.js +1 -0
  113. package/dist/public/assets/linear-Gq1n-w3C.js +1 -0
  114. package/dist/public/assets/mermaid.core-COBFmWjx.js +312 -0
  115. package/dist/public/assets/mindmap-definition-YA3MSWOX-DqRme-JA.js +96 -0
  116. package/dist/public/assets/ordinal-Cboi1Yqb.js +1 -0
  117. package/dist/public/assets/pdf-B5ZmZFk6.js +57 -0
  118. package/dist/public/assets/pdf.worker.min-BmVo14Nb.mjs +28 -0
  119. package/dist/public/assets/pdf.worker.min-LAOCk-LR.js +1 -0
  120. package/dist/public/assets/pegDiagram-XKGWAZYB-DaxTeHLN.js +1 -0
  121. package/dist/public/assets/pieDiagram-E7YTZNPT-D11GqVqw.js +39 -0
  122. package/dist/public/assets/pptx-preview.es-CaqkDSuh.js +28 -0
  123. package/dist/public/assets/quadrantDiagram-AXDQQJYC-fFb8l4El.js +7 -0
  124. package/dist/public/assets/railroadDiagram-O6MQD6OU-CIa-0P69.js +1 -0
  125. package/dist/public/assets/requirementDiagram-BXWQKSXE-BKzH5D9W.js +84 -0
  126. package/dist/public/assets/sankeyDiagram-P5KCCOFB-CtqHjl2H.js +40 -0
  127. package/dist/public/assets/sequenceDiagram-WJ2MYXX4-BpX3U60k.js +162 -0
  128. package/dist/public/assets/sizeCapture-INFHLROL-DsR9QL71.js +1 -0
  129. package/dist/public/assets/stateDiagram-D77RDMKH-0454rKey.js +1 -0
  130. package/dist/public/assets/stateDiagram-v2-MP3YSRHH-CYc0JDHV.js +1 -0
  131. package/dist/public/assets/swimlanes-42K2YHIH-BNRZBx_P.js +1 -0
  132. package/dist/public/assets/swimlanesDiagram-VR7AAH4N-DMo6Bf1N.js +8 -0
  133. package/dist/public/assets/timeline-definition-24CTP7MA-BNDN48o2.js +120 -0
  134. package/dist/public/assets/vennDiagram-4TSXK5OY-C2f8zI0e.js +34 -0
  135. package/dist/public/assets/wardleyDiagram-VM6X3IG4-CmfNgA4_.js +78 -0
  136. package/dist/public/assets/xychartDiagram-S5SC5T6Z-B2xKzCa7.js +7 -0
  137. package/dist/public/icon.svg +8 -0
  138. package/dist/public/index.html +14 -0
  139. package/dist/public/pdfjs-6.3.289/cmaps/78-EUC-H.bcmap +0 -0
  140. package/dist/public/pdfjs-6.3.289/cmaps/78-EUC-V.bcmap +0 -0
  141. package/dist/public/pdfjs-6.3.289/cmaps/78-H.bcmap +0 -0
  142. package/dist/public/pdfjs-6.3.289/cmaps/78-RKSJ-H.bcmap +0 -0
  143. package/dist/public/pdfjs-6.3.289/cmaps/78-RKSJ-V.bcmap +0 -0
  144. package/dist/public/pdfjs-6.3.289/cmaps/78-V.bcmap +0 -0
  145. package/dist/public/pdfjs-6.3.289/cmaps/78ms-RKSJ-H.bcmap +0 -0
  146. package/dist/public/pdfjs-6.3.289/cmaps/78ms-RKSJ-V.bcmap +0 -0
  147. package/dist/public/pdfjs-6.3.289/cmaps/83pv-RKSJ-H.bcmap +0 -0
  148. package/dist/public/pdfjs-6.3.289/cmaps/90ms-RKSJ-H.bcmap +0 -0
  149. package/dist/public/pdfjs-6.3.289/cmaps/90ms-RKSJ-V.bcmap +0 -0
  150. package/dist/public/pdfjs-6.3.289/cmaps/90msp-RKSJ-H.bcmap +0 -0
  151. package/dist/public/pdfjs-6.3.289/cmaps/90msp-RKSJ-V.bcmap +0 -0
  152. package/dist/public/pdfjs-6.3.289/cmaps/90pv-RKSJ-H.bcmap +0 -0
  153. package/dist/public/pdfjs-6.3.289/cmaps/90pv-RKSJ-V.bcmap +0 -0
  154. package/dist/public/pdfjs-6.3.289/cmaps/Add-H.bcmap +0 -0
  155. package/dist/public/pdfjs-6.3.289/cmaps/Add-RKSJ-H.bcmap +0 -0
  156. package/dist/public/pdfjs-6.3.289/cmaps/Add-RKSJ-V.bcmap +0 -0
  157. package/dist/public/pdfjs-6.3.289/cmaps/Add-V.bcmap +0 -0
  158. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-CNS1-0.bcmap +0 -0
  159. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-CNS1-1.bcmap +0 -0
  160. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-CNS1-2.bcmap +0 -0
  161. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-CNS1-3.bcmap +0 -0
  162. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-CNS1-4.bcmap +0 -0
  163. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-CNS1-5.bcmap +0 -0
  164. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-CNS1-6.bcmap +0 -0
  165. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  166. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-GB1-0.bcmap +0 -0
  167. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-GB1-1.bcmap +0 -0
  168. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-GB1-2.bcmap +0 -0
  169. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-GB1-3.bcmap +0 -0
  170. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-GB1-4.bcmap +0 -0
  171. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-GB1-5.bcmap +0 -0
  172. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  173. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Japan1-0.bcmap +0 -0
  174. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Japan1-1.bcmap +0 -0
  175. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Japan1-2.bcmap +0 -0
  176. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Japan1-3.bcmap +0 -0
  177. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Japan1-4.bcmap +0 -0
  178. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Japan1-5.bcmap +0 -0
  179. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Japan1-6.bcmap +0 -0
  180. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  181. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Korea1-0.bcmap +0 -0
  182. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Korea1-1.bcmap +0 -0
  183. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Korea1-2.bcmap +0 -0
  184. package/dist/public/pdfjs-6.3.289/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  185. package/dist/public/pdfjs-6.3.289/cmaps/B5-H.bcmap +0 -0
  186. package/dist/public/pdfjs-6.3.289/cmaps/B5-V.bcmap +0 -0
  187. package/dist/public/pdfjs-6.3.289/cmaps/B5pc-H.bcmap +0 -0
  188. package/dist/public/pdfjs-6.3.289/cmaps/B5pc-V.bcmap +0 -0
  189. package/dist/public/pdfjs-6.3.289/cmaps/CNS-EUC-H.bcmap +0 -0
  190. package/dist/public/pdfjs-6.3.289/cmaps/CNS-EUC-V.bcmap +0 -0
  191. package/dist/public/pdfjs-6.3.289/cmaps/CNS1-H.bcmap +0 -0
  192. package/dist/public/pdfjs-6.3.289/cmaps/CNS1-V.bcmap +0 -0
  193. package/dist/public/pdfjs-6.3.289/cmaps/CNS2-H.bcmap +0 -0
  194. package/dist/public/pdfjs-6.3.289/cmaps/CNS2-V.bcmap +3 -0
  195. package/dist/public/pdfjs-6.3.289/cmaps/ETHK-B5-H.bcmap +0 -0
  196. package/dist/public/pdfjs-6.3.289/cmaps/ETHK-B5-V.bcmap +0 -0
  197. package/dist/public/pdfjs-6.3.289/cmaps/ETen-B5-H.bcmap +0 -0
  198. package/dist/public/pdfjs-6.3.289/cmaps/ETen-B5-V.bcmap +0 -0
  199. package/dist/public/pdfjs-6.3.289/cmaps/ETenms-B5-H.bcmap +3 -0
  200. package/dist/public/pdfjs-6.3.289/cmaps/ETenms-B5-V.bcmap +0 -0
  201. package/dist/public/pdfjs-6.3.289/cmaps/EUC-H.bcmap +0 -0
  202. package/dist/public/pdfjs-6.3.289/cmaps/EUC-V.bcmap +0 -0
  203. package/dist/public/pdfjs-6.3.289/cmaps/Ext-H.bcmap +0 -0
  204. package/dist/public/pdfjs-6.3.289/cmaps/Ext-RKSJ-H.bcmap +0 -0
  205. package/dist/public/pdfjs-6.3.289/cmaps/Ext-RKSJ-V.bcmap +0 -0
  206. package/dist/public/pdfjs-6.3.289/cmaps/Ext-V.bcmap +0 -0
  207. package/dist/public/pdfjs-6.3.289/cmaps/GB-EUC-H.bcmap +0 -0
  208. package/dist/public/pdfjs-6.3.289/cmaps/GB-EUC-V.bcmap +0 -0
  209. package/dist/public/pdfjs-6.3.289/cmaps/GB-H.bcmap +4 -0
  210. package/dist/public/pdfjs-6.3.289/cmaps/GB-V.bcmap +0 -0
  211. package/dist/public/pdfjs-6.3.289/cmaps/GBK-EUC-H.bcmap +0 -0
  212. package/dist/public/pdfjs-6.3.289/cmaps/GBK-EUC-V.bcmap +0 -0
  213. package/dist/public/pdfjs-6.3.289/cmaps/GBK2K-H.bcmap +0 -0
  214. package/dist/public/pdfjs-6.3.289/cmaps/GBK2K-V.bcmap +0 -0
  215. package/dist/public/pdfjs-6.3.289/cmaps/GBKp-EUC-H.bcmap +0 -0
  216. package/dist/public/pdfjs-6.3.289/cmaps/GBKp-EUC-V.bcmap +0 -0
  217. package/dist/public/pdfjs-6.3.289/cmaps/GBT-EUC-H.bcmap +0 -0
  218. package/dist/public/pdfjs-6.3.289/cmaps/GBT-EUC-V.bcmap +0 -0
  219. package/dist/public/pdfjs-6.3.289/cmaps/GBT-H.bcmap +0 -0
  220. package/dist/public/pdfjs-6.3.289/cmaps/GBT-V.bcmap +0 -0
  221. package/dist/public/pdfjs-6.3.289/cmaps/GBTpc-EUC-H.bcmap +0 -0
  222. package/dist/public/pdfjs-6.3.289/cmaps/GBTpc-EUC-V.bcmap +0 -0
  223. package/dist/public/pdfjs-6.3.289/cmaps/GBpc-EUC-H.bcmap +0 -0
  224. package/dist/public/pdfjs-6.3.289/cmaps/GBpc-EUC-V.bcmap +0 -0
  225. package/dist/public/pdfjs-6.3.289/cmaps/H.bcmap +0 -0
  226. package/dist/public/pdfjs-6.3.289/cmaps/HKdla-B5-H.bcmap +0 -0
  227. package/dist/public/pdfjs-6.3.289/cmaps/HKdla-B5-V.bcmap +0 -0
  228. package/dist/public/pdfjs-6.3.289/cmaps/HKdlb-B5-H.bcmap +0 -0
  229. package/dist/public/pdfjs-6.3.289/cmaps/HKdlb-B5-V.bcmap +0 -0
  230. package/dist/public/pdfjs-6.3.289/cmaps/HKgccs-B5-H.bcmap +0 -0
  231. package/dist/public/pdfjs-6.3.289/cmaps/HKgccs-B5-V.bcmap +0 -0
  232. package/dist/public/pdfjs-6.3.289/cmaps/HKm314-B5-H.bcmap +0 -0
  233. package/dist/public/pdfjs-6.3.289/cmaps/HKm314-B5-V.bcmap +0 -0
  234. package/dist/public/pdfjs-6.3.289/cmaps/HKm471-B5-H.bcmap +0 -0
  235. package/dist/public/pdfjs-6.3.289/cmaps/HKm471-B5-V.bcmap +0 -0
  236. package/dist/public/pdfjs-6.3.289/cmaps/HKscs-B5-H.bcmap +0 -0
  237. package/dist/public/pdfjs-6.3.289/cmaps/HKscs-B5-V.bcmap +0 -0
  238. package/dist/public/pdfjs-6.3.289/cmaps/Hankaku.bcmap +0 -0
  239. package/dist/public/pdfjs-6.3.289/cmaps/Hiragana.bcmap +0 -0
  240. package/dist/public/pdfjs-6.3.289/cmaps/KSC-EUC-H.bcmap +0 -0
  241. package/dist/public/pdfjs-6.3.289/cmaps/KSC-EUC-V.bcmap +0 -0
  242. package/dist/public/pdfjs-6.3.289/cmaps/KSC-H.bcmap +0 -0
  243. package/dist/public/pdfjs-6.3.289/cmaps/KSC-Johab-H.bcmap +0 -0
  244. package/dist/public/pdfjs-6.3.289/cmaps/KSC-Johab-V.bcmap +0 -0
  245. package/dist/public/pdfjs-6.3.289/cmaps/KSC-V.bcmap +0 -0
  246. package/dist/public/pdfjs-6.3.289/cmaps/KSCms-UHC-H.bcmap +0 -0
  247. package/dist/public/pdfjs-6.3.289/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  248. package/dist/public/pdfjs-6.3.289/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  249. package/dist/public/pdfjs-6.3.289/cmaps/KSCms-UHC-V.bcmap +0 -0
  250. package/dist/public/pdfjs-6.3.289/cmaps/KSCpc-EUC-H.bcmap +0 -0
  251. package/dist/public/pdfjs-6.3.289/cmaps/KSCpc-EUC-V.bcmap +0 -0
  252. package/dist/public/pdfjs-6.3.289/cmaps/Katakana.bcmap +0 -0
  253. package/dist/public/pdfjs-6.3.289/cmaps/LICENSE +36 -0
  254. package/dist/public/pdfjs-6.3.289/cmaps/NWP-H.bcmap +0 -0
  255. package/dist/public/pdfjs-6.3.289/cmaps/NWP-V.bcmap +0 -0
  256. package/dist/public/pdfjs-6.3.289/cmaps/RKSJ-H.bcmap +0 -0
  257. package/dist/public/pdfjs-6.3.289/cmaps/RKSJ-V.bcmap +0 -0
  258. package/dist/public/pdfjs-6.3.289/cmaps/Roman.bcmap +0 -0
  259. package/dist/public/pdfjs-6.3.289/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  260. package/dist/public/pdfjs-6.3.289/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  261. package/dist/public/pdfjs-6.3.289/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  262. package/dist/public/pdfjs-6.3.289/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  263. package/dist/public/pdfjs-6.3.289/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  264. package/dist/public/pdfjs-6.3.289/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  265. package/dist/public/pdfjs-6.3.289/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  266. package/dist/public/pdfjs-6.3.289/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  267. package/dist/public/pdfjs-6.3.289/cmaps/UniGB-UCS2-H.bcmap +0 -0
  268. package/dist/public/pdfjs-6.3.289/cmaps/UniGB-UCS2-V.bcmap +0 -0
  269. package/dist/public/pdfjs-6.3.289/cmaps/UniGB-UTF16-H.bcmap +0 -0
  270. package/dist/public/pdfjs-6.3.289/cmaps/UniGB-UTF16-V.bcmap +0 -0
  271. package/dist/public/pdfjs-6.3.289/cmaps/UniGB-UTF32-H.bcmap +0 -0
  272. package/dist/public/pdfjs-6.3.289/cmaps/UniGB-UTF32-V.bcmap +0 -0
  273. package/dist/public/pdfjs-6.3.289/cmaps/UniGB-UTF8-H.bcmap +0 -0
  274. package/dist/public/pdfjs-6.3.289/cmaps/UniGB-UTF8-V.bcmap +0 -0
  275. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  276. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  277. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  278. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  279. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  280. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  281. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  282. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  283. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  284. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  285. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  286. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  287. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  288. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  289. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  290. package/dist/public/pdfjs-6.3.289/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  291. package/dist/public/pdfjs-6.3.289/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  292. package/dist/public/pdfjs-6.3.289/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  293. package/dist/public/pdfjs-6.3.289/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  294. package/dist/public/pdfjs-6.3.289/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  295. package/dist/public/pdfjs-6.3.289/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  296. package/dist/public/pdfjs-6.3.289/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  297. package/dist/public/pdfjs-6.3.289/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  298. package/dist/public/pdfjs-6.3.289/cmaps/UniKS-UCS2-H.bcmap +0 -0
  299. package/dist/public/pdfjs-6.3.289/cmaps/UniKS-UCS2-V.bcmap +0 -0
  300. package/dist/public/pdfjs-6.3.289/cmaps/UniKS-UTF16-H.bcmap +0 -0
  301. package/dist/public/pdfjs-6.3.289/cmaps/UniKS-UTF16-V.bcmap +0 -0
  302. package/dist/public/pdfjs-6.3.289/cmaps/UniKS-UTF32-H.bcmap +0 -0
  303. package/dist/public/pdfjs-6.3.289/cmaps/UniKS-UTF32-V.bcmap +0 -0
  304. package/dist/public/pdfjs-6.3.289/cmaps/UniKS-UTF8-H.bcmap +0 -0
  305. package/dist/public/pdfjs-6.3.289/cmaps/UniKS-UTF8-V.bcmap +0 -0
  306. package/dist/public/pdfjs-6.3.289/cmaps/V.bcmap +0 -0
  307. package/dist/public/pdfjs-6.3.289/cmaps/WP-Symbol.bcmap +0 -0
  308. package/dist/public/pdfjs-6.3.289/standard_fonts/FoxitDingbats.pfb +0 -0
  309. package/dist/public/pdfjs-6.3.289/standard_fonts/FoxitFixed.pfb +0 -0
  310. package/dist/public/pdfjs-6.3.289/standard_fonts/FoxitFixedBold.pfb +0 -0
  311. package/dist/public/pdfjs-6.3.289/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  312. package/dist/public/pdfjs-6.3.289/standard_fonts/FoxitFixedItalic.pfb +0 -0
  313. package/dist/public/pdfjs-6.3.289/standard_fonts/FoxitSerif.pfb +0 -0
  314. package/dist/public/pdfjs-6.3.289/standard_fonts/FoxitSerifBold.pfb +0 -0
  315. package/dist/public/pdfjs-6.3.289/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  316. package/dist/public/pdfjs-6.3.289/standard_fonts/FoxitSerifItalic.pfb +0 -0
  317. package/dist/public/pdfjs-6.3.289/standard_fonts/FoxitSymbol.pfb +0 -0
  318. package/dist/public/pdfjs-6.3.289/standard_fonts/LICENSE_FOXIT +27 -0
  319. package/dist/public/pdfjs-6.3.289/standard_fonts/LICENSE_LIBERATION +363 -0
  320. package/dist/public/pdfjs-6.3.289/standard_fonts/LiberationSans-Bold.ttf +0 -0
  321. package/dist/public/pdfjs-6.3.289/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  322. package/dist/public/pdfjs-6.3.289/standard_fonts/LiberationSans-Italic.ttf +0 -0
  323. package/dist/public/pdfjs-6.3.289/standard_fonts/LiberationSans-Regular.ttf +0 -0
  324. package/dist/public/pdfjs-6.3.289/wasm/LICENSE_JBIG2 +196 -0
  325. package/dist/public/pdfjs-6.3.289/wasm/LICENSE_OPENJPEG +39 -0
  326. package/dist/public/pdfjs-6.3.289/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  327. package/dist/public/pdfjs-6.3.289/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  328. package/dist/public/pdfjs-6.3.289/wasm/LICENSE_PDFJS_QCMS +19 -0
  329. package/dist/public/pdfjs-6.3.289/wasm/LICENSE_QCMS +21 -0
  330. package/dist/public/pdfjs-6.3.289/wasm/jbig2.wasm +0 -0
  331. package/dist/public/pdfjs-6.3.289/wasm/jbig2_nowasm_fallback.js +15 -0
  332. package/dist/public/pdfjs-6.3.289/wasm/openjpeg.wasm +0 -0
  333. package/dist/public/pdfjs-6.3.289/wasm/openjpeg_nowasm_fallback.js +17 -0
  334. package/dist/public/pdfjs-6.3.289/wasm/qcms_bg.wasm +0 -0
  335. package/dist/public/pdfjs-6.3.289/wasm/quickjs-eval.js +16 -0
  336. package/dist/public/pdfjs-6.3.289/wasm/quickjs-eval.wasm +0 -0
  337. package/dist/public/viz-runtime.js +2 -0
  338. package/dist/resources/README.md +89 -0
  339. package/dist/resources/chrome/.mcp.json +9 -0
  340. package/dist/resources/chrome/skills/chrome-use/SKILL.md +78 -0
  341. package/dist/resources/mcp/fetch.json +14 -0
  342. package/dist/resources/mcp/playwright.json +14 -0
  343. package/dist/resources/skills/android-native-dev.json +13 -0
  344. package/dist/resources/skills/archify.json +13 -0
  345. package/dist/resources/skills/avoid-ai-writing.json +13 -0
  346. package/dist/resources/skills/brainstorming.json +13 -0
  347. package/dist/resources/skills/budget-variance-analysis.json +13 -0
  348. package/dist/resources/skills/code-review.json +13 -0
  349. package/dist/resources/skills/contract-review.json +13 -0
  350. package/dist/resources/skills/decision-memo.json +13 -0
  351. package/dist/resources/skills/deck-from-doc.json +13 -0
  352. package/dist/resources/skills/documentation-and-adrs.json +13 -0
  353. package/dist/resources/skills/flutter-dev.json +13 -0
  354. package/dist/resources/skills/frontend-dev.json +13 -0
  355. package/dist/resources/skills/ios-application-dev.json +13 -0
  356. package/dist/resources/skills/landing-page-generator.json +13 -0
  357. package/dist/resources/skills/minimax-docx.json +14 -0
  358. package/dist/resources/skills/minimax-pdf.json +14 -0
  359. package/dist/resources/skills/minimax-xlsx.json +14 -0
  360. package/dist/resources/skills/pptx-generator.json +14 -0
  361. package/dist/resources/skills/react-native-dev.json +13 -0
  362. package/dist/resources/skills/remotion-best-practices.json +12 -0
  363. package/dist/resources/skills/shader-dev.json +13 -0
  364. package/dist/resources/skills/systematic-debugging.json +13 -0
  365. package/dist/resources/skills/visualize/SKILL.md +413 -0
  366. package/dist/resources/skills/visualize/card.json +7 -0
  367. package/dist/resources/skills/visualize/scripts/check.mjs +539 -0
  368. package/dist/resources/skills/visualize/scripts/path.mjs +24 -0
  369. package/dist/resources/skills/wiki-page-writer.json +13 -0
  370. package/dist/resources/skills/writing-plans.json +13 -0
  371. package/dist/worker-entry.js +326 -0
  372. package/package.json +49 -4
@@ -0,0 +1,57 @@
1
+ var Zb=Object.defineProperty;var Wm=d=>{throw TypeError(d)};var qb=(d,e,t)=>e in d?Zb(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t;var O=(d,e,t)=>qb(d,typeof e!="symbol"?e+"":e,t),gp=(d,e,t)=>e.has(d)||Wm("Cannot "+t);var r=(d,e,t)=>(gp(d,e,"read from private field"),t?t.call(d):e.get(d)),y=(d,e,t)=>e.has(d)?Wm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(d):e.set(d,t),g=(d,e,t,s)=>(gp(d,e,"write to private field"),s?s.call(d,t):e.set(d,t),t),b=(d,e,t)=>(gp(d,e,"access private method"),t);var Xt=(d,e,t,s)=>({set _(i){g(d,e,i,t)},get _(){return r(d,e,s)}});var tA={9306(d,e,t){var s=t(4901),i=t(6823),n=TypeError;d.exports=function(a){if(s(a))return a;throw new n(i(a)+" is not a function")}},3506(d,e,t){var s=t(3925),i=String,n=TypeError;d.exports=function(a){if(s(a))return a;throw new n("Can't set "+i(a)+" as a prototype")}},7080(d,e,t){var s=t(4402).has;d.exports=function(i){return s(i),i}},3463(d){var e=TypeError;d.exports=function(t){if(typeof t=="string")return t;throw new e("Argument is not a string")}},4328(d,e,t){var s=t(4995),i=new s.WeakMap,n=s.set,a=s.remove;d.exports=function(o){return n(i,o,1),a(i,o),o}},6557(d,e,t){var s=t(4995).has;d.exports=function(i){return s(i),i}},6469(d,e,t){var s=t(8227),i=t(2360),n=t(4913).f,a=s("unscopables"),o=Array.prototype;o[a]===void 0&&n(o,a,{configurable:!0,value:i(null)}),d.exports=function(l){o[a][l]=!0}},679(d,e,t){var s=t(1625),i=TypeError;d.exports=function(n,a){if(s(a,n))return n;throw new i("Incorrect invocation")}},3972(d,e,t){var s=t(34),i=String,n=TypeError;d.exports=function(a){if(a===void 0||s(a))return a;throw new n(i(a)+" is not an object or undefined")}},8551(d,e,t){var s=t(34),i=String,n=TypeError;d.exports=function(a){if(s(a))return a;throw new n(i(a)+" is not an object")}},4154(d,e,t){var s=t(6955),i=TypeError;d.exports=function(n){if(s(n)==="Uint8Array")return n;throw new i("Argument is not an Uint8Array")}},7811(d){d.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"},7394(d,e,t){var s=t(4576),i=t(6706),n=t(2195),a=s.ArrayBuffer,o=s.TypeError;d.exports=a&&i(a.prototype,"byteLength","get")||function(l){if(n(l)!=="ArrayBuffer")throw new o("ArrayBuffer expected");return l.byteLength}},3238(d,e,t){var s=t(4576),i=t(7811),n=t(7394),a=s.DataView;d.exports=function(o){if(!i||n(o)!==0)return!1;try{return new a(o),!1}catch{return!0}}},5169(d,e,t){var s=t(3238),i=TypeError;d.exports=function(n){if(s(n))throw new i("ArrayBuffer is detached");return n}},4644(d,e,t){var s=t(7811),i=t(3724),n=t(4576),a=t(4901),o=t(34),l=t(9297),h=t(6955),c=t(6823),u=t(6699),f=t(6840),p=t(2106),m=t(1625),v=t(2787),A=t(2967),w=t(8227),S=t(3392),x=t(1181),C=x.enforce,E=x.get,T=n.Int8Array,P=T&&T.prototype,M=n.Uint8ClampedArray,I=M&&M.prototype,D=T&&v(T),R=P&&v(P),U=Object.prototype,B=n.TypeError,N=w("toStringTag"),W=S("TYPED_ARRAY_TAG"),k="TypedArrayConstructor",L=s&&!!A&&h(n.opera)!=="Opera",Y=!1,z,lt,vt,dt={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},rt={BigInt64Array:8,BigUint64Array:8},bt=function(ut){if(!o(ut))return!1;var kt=h(ut);return kt==="DataView"||l(dt,kt)||l(rt,kt)},Be=function(q){var ut=v(q);if(o(ut)){var kt=E(ut);return kt&&l(kt,k)?kt[k]:Be(ut)}},H=function(q){if(!o(q))return!1;var ut=h(q);return l(dt,ut)||l(rt,ut)},F=function(q){if(H(q))return q;throw new B("Target is not a typed array")},j=function(q){if(a(q)&&(!A||m(D,q)))return q;throw new B(c(q)+" is not a typed array constructor")},it=function(q,ut,kt,Te){if(i){if(kt)for(var Ce in dt){var ae=n[Ce];if(ae&&l(ae.prototype,q))try{delete ae.prototype[q]}catch{try{ae.prototype[q]=ut}catch{}}}(!R[q]||kt)&&f(R,q,kt?ut:L&&P[q]||ut,Te)}},yt=function(q,ut,kt){var Te,Ce;if(i){if(A){if(kt){for(Te in dt)if(Ce=n[Te],Ce&&l(Ce,q))try{delete Ce[q]}catch{}}if(!D[q]||kt)try{return f(D,q,kt?ut:L&&D[q]||ut)}catch{}else return}for(Te in dt)Ce=n[Te],Ce&&(!Ce[q]||kt)&&f(Ce,q,ut)}};for(z in dt)lt=n[z],vt=lt&&lt.prototype,vt?C(vt)[k]=lt:L=!1;for(z in rt)lt=n[z],vt=lt&&lt.prototype,vt&&(C(vt)[k]=lt);if((!L||!a(D)||D===Function.prototype)&&(D=function(){throw new B("Incorrect invocation")},L))for(z in dt)n[z]&&A(n[z],D);if((!L||!R||R===U)&&(R=D.prototype,L))for(z in dt)n[z]&&A(n[z].prototype,R);if(L&&v(I)!==R&&A(I,R),i&&!l(R,N)){Y=!0,p(R,N,{configurable:!0,get:function(){return o(this)?this[W]:void 0}});for(z in dt)n[z]&&u(n[z].prototype,W,z)}d.exports={NATIVE_ARRAY_BUFFER_VIEWS:L,TYPED_ARRAY_TAG:Y&&W,aTypedArray:F,aTypedArrayConstructor:j,exportTypedArrayMethod:it,exportTypedArrayStaticMethod:yt,getTypedArrayConstructor:Be,isView:bt,isTypedArray:H,TypedArray:D,TypedArrayPrototype:R}},5370(d,e,t){var s=t(6198);d.exports=function(i,n,a){for(var o=0,l=arguments.length>2?a:s(n),h=new i(l);l>o;)h[o]=n[o++];return h}},9617(d,e,t){var s=t(5397),i=t(5610),n=t(6198),a=function(o){return function(l,h,c){var u=s(l),f=n(u);if(f===0)return!o&&-1;var p=i(c,f),m;if(o&&h!==h){for(;f>p;)if(m=u[p++],m!==m)return!0}else for(;f>p;p++)if((o||p in u)&&u[p]===h)return o||p||0;return!o&&-1}};d.exports={includes:a(!0),indexOf:a(!1)}},4527(d,e,t){var s=t(3724),i=t(4376),n=TypeError,a=Object.getOwnPropertyDescriptor,o=s&&!(function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(l){return l instanceof TypeError}})();d.exports=o?function(l,h){if(i(l)&&!a(l,"length").writable)throw new n("Cannot set read only .length");return l.length=h}:function(l,h){return l.length=h}},7680(d,e,t){var s=t(9504);d.exports=s([].slice)},2804(d){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e+"+/",s=e+"-_",i=function(n){for(var a={},o=0;o<64;o++)a[n.charAt(o)]=o;return a};d.exports={i2c:t,c2i:i(t),i2cUrl:s,c2iUrl:i(s)}},6319(d,e,t){var s=t(8551),i=t(9539);d.exports=function(n,a,o,l){try{return l?a(s(o)[0],o[1]):a(o)}catch(h){i(n,"throw",h)}}},2195(d,e,t){var s=t(9504),i=s({}.toString),n=s("".slice);d.exports=function(a){return n(i(a),8,-1)}},6955(d,e,t){var s=t(2140),i=t(4901),n=t(2195),a=t(8227),o=a("toStringTag"),l=Object,h=n((function(){return arguments})())==="Arguments",c=function(u,f){try{return u[f]}catch{}};d.exports=s?n:function(u){var f,p,m;return u===void 0?"Undefined":u===null?"Null":typeof(p=c(f=l(u),o))=="string"?p:h?n(f):(m=n(f))==="Object"&&i(f.callee)?"Arguments":m}},7740(d,e,t){var s=t(9297),i=t(5031),n=t(7347),a=t(4913);d.exports=function(o,l,h){for(var c=i(l),u=a.f,f=n.f,p=0;p<c.length;p++){var m=c[p];!s(o,m)&&!(h&&s(h,m))&&u(o,m,f(l,m))}}},2211(d,e,t){var s=t(9039);d.exports=!s(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype})},2529(d){d.exports=function(e,t){return{value:e,done:t}}},6699(d,e,t){var s=t(3724),i=t(4913),n=t(6980);d.exports=s?function(a,o,l){return i.f(a,o,n(1,l))}:function(a,o,l){return a[o]=l,a}},6980(d){d.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}},4659(d,e,t){var s=t(3724),i=t(4913),n=t(6980);d.exports=function(a,o,l){s?i.f(a,o,n(0,l)):a[o]=l}},2106(d,e,t){var s=t(283),i=t(4913);d.exports=function(n,a,o){return o.get&&s(o.get,a,{getter:!0}),o.set&&s(o.set,a,{setter:!0}),i.f(n,a,o)}},6840(d,e,t){var s=t(4901),i=t(4913),n=t(283),a=t(9433);d.exports=function(o,l,h,c){c||(c={});var u=c.enumerable,f=c.name!==void 0?c.name:l;if(s(h)&&n(h,f,c),c.global)u?o[l]=h:a(l,h);else{try{c.unsafe?o[l]&&(u=!0):delete o[l]}catch{}u?o[l]=h:i.f(o,l,{value:h,enumerable:!1,configurable:!c.nonConfigurable,writable:!c.nonWritable})}return o}},6279(d,e,t){var s=t(6840);d.exports=function(i,n,a){for(var o in n)s(i,o,n[o],a);return i}},9433(d,e,t){var s=t(4576),i=Object.defineProperty;d.exports=function(n,a){try{i(s,n,{value:a,configurable:!0,writable:!0})}catch{s[n]=a}return a}},3724(d,e,t){var s=t(9039);d.exports=!s(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})},4055(d,e,t){var s=t(4576),i=t(34),n=s.document,a=i(n)&&i(n.createElement);d.exports=function(o){return a?n.createElement(o):{}}},6837(d){var e=TypeError,t=9007199254740991;d.exports=function(s){if(s>t)throw new e("Maximum allowed index exceeded");return s}},5002(d){d.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},8727(d){d.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2839(d,e,t){var s=t(4576),i=s.navigator,n=i&&i.userAgent;d.exports=n?String(n):""},9519(d,e,t){var s=t(4576),i=t(2839),n=s.process,a=s.Deno,o=n&&n.versions||a&&a.version,l=o&&o.v8,h,c;l&&(h=l.split("."),c=h[0]>0&&h[0]<4?1:+(h[0]+h[1])),!c&&i&&(h=i.match(/Edge\/(\d+)/),(!h||h[1]>=74)&&(h=i.match(/Chrome\/(\d+)/),h&&(c=+h[1]))),d.exports=c},6193(d,e,t){var s=t(9504),i=Error,n=s("".replace),a=(function(h){return String(new i(h).stack)})("zxcasd"),o=/\n\s*at [^:]*:[^\n]*/,l=o.test(a);d.exports=function(h,c){if(l&&typeof h=="string"&&!i.prepareStackTrace)for(;c--;)h=n(h,o,"");return h}},6518(d,e,t){var s=t(4576),i=t(7347).f,n=t(6699),a=t(6840),o=t(9433),l=t(7740),h=t(2796);d.exports=function(c,u){var f=c.target,p=c.global,m=c.stat,v,A,w,S,x,C;if(p?A=s:m?A=s[f]||o(f,{}):A=s[f]&&s[f].prototype,A)for(w in u){if(x=u[w],c.dontCallGetSet?(C=i(A,w),S=C&&C.value):S=A[w],v=h(p?w:f+(m?".":"#")+w,c.forced),!v&&S!==void 0){if(typeof x==typeof S)continue;l(x,S)}(c.sham||S&&S.sham)&&n(x,"sham",!0),a(A,w,x,c)}}},9039(d){d.exports=function(e){try{return!!e()}catch{return!0}}},8745(d,e,t){var s=t(616),i=Function.prototype,n=i.apply,a=i.call;d.exports=typeof Reflect=="object"&&Reflect.apply||(s?a.bind(n):function(){return a.apply(n,arguments)})},6080(d,e,t){var s=t(7476),i=t(9306),n=t(616),a=s(s.bind);d.exports=function(o,l){return i(o),l===void 0?o:n?a(o,l):function(){return o.apply(l,arguments)}}},616(d,e,t){var s=t(9039);d.exports=!s(function(){var i=(function(){}).bind();return typeof i!="function"||i.hasOwnProperty("prototype")})},9565(d,e,t){var s=t(616),i=Function.prototype.call;d.exports=s?i.bind(i):function(){return i.apply(i,arguments)}},350(d,e,t){var s=t(3724),i=t(9297),n=Function.prototype,a=s&&Object.getOwnPropertyDescriptor,o=i(n,"name"),l=o&&(function(){}).name==="something",h=o&&(!s||s&&a(n,"name").configurable);d.exports={EXISTS:o,PROPER:l,CONFIGURABLE:h}},6706(d,e,t){var s=t(9504),i=t(9306);d.exports=function(n,a,o){try{return s(i(Object.getOwnPropertyDescriptor(n,a)[o]))}catch{}}},7476(d,e,t){var s=t(2195),i=t(9504);d.exports=function(n){if(s(n)==="Function")return i(n)}},9504(d,e,t){var s=t(616),i=Function.prototype,n=i.call,a=s&&i.bind.bind(n,n);d.exports=s?a:function(o){return function(){return n.apply(o,arguments)}}},944(d){var e=TypeError;d.exports=function(t){var s=t&&t.alphabet;if(s===void 0||s==="base64"||s==="base64url")return s||"base64";throw new e("Incorrect `alphabet` option")}},7751(d,e,t){var s=t(4576),i=t(4901),n=function(a){return i(a)?a:void 0};d.exports=function(a,o){return arguments.length<2?n(s[a]):s[a]&&s[a][o]}},1767(d){d.exports=function(e){return{iterator:e,next:e.next,done:!1}}},8646(d,e,t){var s=t(9565),i=t(8551),n=t(1767),a=t(3085);d.exports=function(o,l){(!l||typeof o!="string")&&i(o);var h=a(o);return n(i(h!==void 0?s(h,o):o))}},8563(d,e,t){var s=t(9565),i=t(4901),n=t(8551),a=t(6823),o=t(3085),l=TypeError;d.exports=function(h,c){var u=arguments.length<2?o(h):c;if(i(u))return n(s(u,h));throw new l(a(h)+" is not iterable")}},3085(d,e,t){var s=t(2195),i=t(4117),n=t(5966),a=t(8227),o=a("iterator"),l=Array.prototype;d.exports=function(h){if(!i(h))return n(h,o)||n(h,"@@iterator")||(s(h)==="Arguments"?l[o]:void 0)}},5966(d,e,t){var s=t(9306),i=t(4117);d.exports=function(n,a){var o=n[a];return i(o)?void 0:s(o)}},3789(d,e,t){var s=t(9306),i=t(8551),n=t(9565),a=t(1291),o=t(1767),l="Invalid size",h=RangeError,c=TypeError,u=Math.max,f=function(p,m){this.set=p,this.size=u(m,0),this.has=s(p.has),this.keys=s(p.keys)};f.prototype={getIterator:function(){return o(i(n(this.keys,this.set)))},includes:function(p){return n(this.has,this.set,p)}},d.exports=function(p){i(p);var m=+p.size;if(m!==m)throw new c(l);var v=a(m);if(v<0)throw new h(l);return new f(p,v)}},4576(d){var e=function(t){return t&&t.Math===Math&&t};d.exports=e(typeof globalThis=="object"&&globalThis)||e(typeof window=="object"&&window)||e(typeof self=="object"&&self)||e(typeof global=="object"&&global)||e(typeof this=="object"&&this)||(function(){return this})()||Function("return this")()},9297(d,e,t){var s=t(9504),i=t(8981),n=s({}.hasOwnProperty);d.exports=Object.hasOwn||function(o,l){return n(i(o),l)}},421(d){d.exports={}},397(d,e,t){var s=t(7751);d.exports=s("document","documentElement")},5917(d,e,t){var s=t(3724),i=t(9039),n=t(4055);d.exports=!s&&!i(function(){return Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a!==7})},7055(d,e,t){var s=t(9504),i=t(9039),n=t(2195),a=Object,o=s("".split);d.exports=i(function(){return!a("z").propertyIsEnumerable(0)})?function(l){return n(l)==="String"?o(l,""):a(l)}:a},3167(d,e,t){var s=t(4901),i=t(34),n=t(2967);d.exports=function(a,o,l){var h,c;return n&&s(h=o.constructor)&&h!==l&&i(c=h.prototype)&&c!==l.prototype&&n(a,c),a}},3706(d,e,t){var s=t(9504),i=t(4901),n=t(7629),a=s(Function.toString);i(n.inspectSource)||(n.inspectSource=function(o){return a(o)}),d.exports=n.inspectSource},1181(d,e,t){var s=t(8622),i=t(4576),n=t(34),a=t(6699),o=t(9297),l=t(7629),h=t(6119),c=t(421),u="Object already initialized",f=i.TypeError,p=i.WeakMap,m,v,A,w=function(E){return A(E)?v(E):m(E,{})},S=function(E){return function(T){var P;if(!n(T)||(P=v(T)).type!==E)throw new f("Incompatible receiver, "+E+" required");return P}};if(s||l.state){var x=l.state||(l.state=new p);x.get=x.get,x.has=x.has,x.set=x.set,m=function(E,T){if(x.has(E))throw new f(u);return T.facade=E,x.set(E,T),T},v=function(E){return x.get(E)||{}},A=function(E){return x.has(E)}}else{var C=h("state");c[C]=!0,m=function(E,T){if(o(E,C))throw new f(u);return T.facade=E,a(E,C,T),T},v=function(E){return o(E,C)?E[C]:{}},A=function(E){return o(E,C)}}d.exports={set:m,get:v,has:A,enforce:w,getterFor:S}},4209(d,e,t){var s=t(8227),i=t(6269),n=s("iterator"),a=Array.prototype;d.exports=function(o){return o!==void 0&&(i.Array===o||a[n]===o)}},4376(d,e,t){var s=t(2195);d.exports=Array.isArray||function(n){return s(n)==="Array"}},1108(d,e,t){var s=t(6955);d.exports=function(i){var n=s(i);return n==="BigInt64Array"||n==="BigUint64Array"}},4901(d){var e=typeof document=="object"&&document.all;d.exports=typeof e>"u"&&e!==void 0?function(t){return typeof t=="function"||t===e}:function(t){return typeof t=="function"}},2796(d,e,t){var s=t(9039),i=t(4901),n=/#|\.prototype\./,a=function(u,f){var p=l[o(u)];return p===c?!0:p===h?!1:i(f)?s(f):!!f},o=a.normalize=function(u){return String(u).replace(n,".").toLowerCase()},l=a.data={},h=a.NATIVE="N",c=a.POLYFILL="P";d.exports=a},4117(d){d.exports=function(e){return e==null}},34(d,e,t){var s=t(4901);d.exports=function(i){return typeof i=="object"?i!==null:s(i)}},3925(d,e,t){var s=t(34);d.exports=function(i){return s(i)||i===null}},6395(d){d.exports=!1},5810(d,e,t){var s=t(34),i=t(1181).get;d.exports=function(a){if(!s(a))return!1;var o=i(a);return!!o&&o.type==="RawJSON"}},757(d,e,t){var s=t(7751),i=t(4901),n=t(1625),a=t(7040),o=Object;d.exports=a?function(l){return typeof l=="symbol"}:function(l){var h=s("Symbol");return i(h)&&n(h.prototype,o(l))}},507(d,e,t){var s=t(9565);d.exports=function(i,n,a){for(var o=a?i:i.iterator,l=i.next,h,c;!(h=s(l,o)).done;)if(c=n(h.value),c!==void 0)return c}},2652(d,e,t){var s=t(6080),i=t(9565),n=t(8551),a=t(6823),o=t(4209),l=t(6198),h=t(1625),c=t(8563),u=t(3085),f=t(9539),p=TypeError,m=function(A,w){this.stopped=A,this.result=w},v=m.prototype;d.exports=function(A,w,S){var x=S&&S.that,C=!!(S&&S.AS_ENTRIES),E=!!(S&&S.IS_RECORD),T=!!(S&&S.IS_ITERATOR),P=!!(S&&S.INTERRUPTED),M=s(w,x),I,D,R,U,B,N,W,k=function(z){var lt=I;return I=void 0,lt&&f(lt,"normal"),new m(!0,z)},L=function(z){return C?(n(z),P?M(z[0],z[1],k):M(z[0],z[1])):P?M(z,k):M(z)};if(E)I=A.iterator;else if(T)I=A;else{if(D=u(A),!D)throw new p(a(A)+" is not iterable");if(o(D)){for(R=0,U=l(A);U>R;R++)if(B=L(A[R]),B&&h(v,B))return B;return new m(!1)}I=c(A,D)}for(N=E?A.next:I.next;!(W=i(N,I)).done;){var Y=W.value;try{B=L(Y)}catch(z){if(I)f(I,"throw",z);else throw z}if(typeof B=="object"&&B&&h(v,B))return B}return new m(!1)}},6859(d){d.exports=function(e){e.iterator=e.next=e.nextHandler=e.mapper=e.predicate=e.inner=e.iterables=e.iters=e.openIters=e.padding=e.finishResults=e.buffer=null}},1385(d,e,t){var s=t(9539);d.exports=function(i,n,a){for(var o=i.length-1;o>=0;o--)if(i[o]!==void 0)try{a=s(i[o].iterator,n,a)}catch(l){n="throw",a=l}if(n==="throw")throw a;return a}},9539(d,e,t){var s=t(9565),i=t(8551),n=t(5966);d.exports=function(a,o,l){var h,c;i(a);try{if(h=n(a,"return"),!h){if(o==="throw")throw l;return l}h=s(h,a)}catch(u){c=!0,h=u}if(o==="throw")throw l;if(c)throw h;return i(h),l}},9462(d,e,t){var s=t(9565),i=t(2360),n=t(6699),a=t(6279),o=t(8227),l=t(1181),h=t(5966),c=t(7657).IteratorPrototype,u=t(2529),f=t(9539),p=t(1385),m=t(6859),v=o("toStringTag"),A="IteratorHelper",w="WrapForValidIterator",S="normal",x="throw",C=l.set,E=function(M){var I=l.getterFor(M?w:A);return a(i(c),{next:function(){var R=I(this);if(M)return R.nextHandler();if(R.done)return u(void 0,!0);try{var U=R.nextHandler();return R.done&&m(R),R.returnHandlerResult?U:u(U,R.done)}catch(B){throw R.done=!0,m(R),B}},return:function(){var D=I(this),R=D.iterator,U=D.inner,B=D.openIters,N=D.done;if(D.done=!0,M){var W=h(R,"return");return W?s(W,R):u(void 0,!0)}if(m(D),N)return u(void 0,!0);if(U)try{f(U.iterator,S)}catch(k){return f(R,x,k)}if(B)try{p(B,S)}catch(k){if(R)return f(R,x,k);throw k}return R&&f(R,S),u(void 0,!0)}})},T=E(!0),P=E(!1);n(P,v,"Iterator Helper"),d.exports=function(M,I,D){var R=function(B,N){N?(N.iterator=B.iterator,N.next=B.next):N=B,N.type=I?w:A,N.returnHandlerResult=!!D,N.nextHandler=M,N.counter=0,N.done=!1,C(this,N)};return R.prototype=I?T:P,R}},684(d){d.exports=function(e,t){var s=typeof Iterator=="function"&&Iterator.prototype[e];if(s)try{s.call({next:null},t).next()}catch{return!0}}},4549(d,e,t){var s=t(4576);d.exports=function(i,n){var a=s.Iterator,o=a&&a.prototype,l=o&&o[i],h=!1;if(l)try{l.call({next:function(){return{done:!0}},return:function(){h=!0}},-1)}catch(c){c instanceof n||(h=!1)}if(!h)return l}},7657(d,e,t){var s=t(9039),i=t(4901),n=t(34),a=t(2360),o=t(2787),l=t(6840),h=t(8227),c=t(6395),u=h("iterator"),f=!1,p,m,v;[].keys&&(v=[].keys(),"next"in v?(m=o(o(v)),m!==Object.prototype&&(p=m)):f=!0);var A=!n(p)||s(function(){var w={};return p[u].call(w)!==w});A?p={}:c&&(p=a(p)),i(p[u])||l(p,u,function(){return this}),d.exports={IteratorPrototype:p,BUGGY_SAFARI_ITERATORS:f}},6269(d){d.exports=Object.create?Object.create(null):{}},6198(d,e,t){var s=t(8014);d.exports=function(i){return s(i.length)}},283(d,e,t){var s=t(9504),i=t(9039),n=t(4901),a=t(9297),o=t(3724),l=t(350).CONFIGURABLE,h=t(3706),c=t(1181),u=c.enforce,f=c.get,p=String,m=Object.defineProperty,v=s("".slice),A=s("".replace),w=s([].join),S=o&&!i(function(){return m(function(){},"length",{value:8}).length!==8}),x=String(String).split("String"),C=d.exports=function(E,T,P){v(p(T),0,7)==="Symbol("&&(T="["+A(p(T),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),P&&P.getter&&(T="get "+T),P&&P.setter&&(T="set "+T),(!a(E,"name")||l&&E.name!==T)&&(o?m(E,"name",{value:T,configurable:!0}):E.name=T),S&&P&&a(P,"arity")&&E.length!==P.arity&&m(E,"length",{value:P.arity});try{P&&a(P,"constructor")&&P.constructor?o&&m(E,"prototype",{writable:!1}):E.prototype&&(E.prototype=void 0)}catch{}var M=u(E);return a(M,"source")||(M.source=w(x,typeof T=="string"?T:"")),E};Function.prototype.toString=C(function(){return n(this)&&f(this).source||h(this)},"toString")},2248(d,e,t){var s=t(9504),i=Map.prototype;d.exports={Map,set:s(i.set),get:s(i.get),has:s(i.has),remove:s(i.delete),proto:i}},741(d){var e=Math.ceil,t=Math.floor;d.exports=Math.trunc||function(i){var n=+i;return(n>0?t:e)(n)}},7819(d,e,t){var s=t(9039);d.exports=!s(function(){var i="9007199254740993",n=JSON.rawJSON(i);return!JSON.isRawJSON(n)||JSON.stringify(n)!==i})},6043(d,e,t){var s=t(9306),i=TypeError,n=function(a){var o,l;this.promise=new a(function(h,c){if(o!==void 0||l!==void 0)throw new i("Bad Promise constructor");o=h,l=c}),this.resolve=s(o),this.reject=s(l)};d.exports.f=function(a){return new n(a)}},2603(d,e,t){var s=t(655);d.exports=function(i,n){return i===void 0?arguments.length<2?"":n:s(i)}},4149(d){var e=RangeError;d.exports=function(t){if(t===t)return t;throw new e("NaN is not allowed")}},2360(d,e,t){var s=t(8551),i=t(6801),n=t(8727),a=t(421),o=t(397),l=t(4055),h=t(6119),c=">",u="<",f="prototype",p="script",m=h("IE_PROTO"),v=function(){},A=function(E){return u+p+c+E+u+"/"+p+c},w=function(E){E.write(A("")),E.close();var T=E.parentWindow.Object;return E=null,T},S=function(){var E=l("iframe"),T="java"+p+":",P;return E.style.display="none",o.appendChild(E),E.src=String(T),P=E.contentWindow.document,P.open(),P.write(A("document.F=Object")),P.close(),P.F},x,C=function(){try{x=new ActiveXObject("htmlfile")}catch{}C=typeof document<"u"?document.domain&&x?w(x):S():w(x);for(var E=n.length;E--;)delete C[f][n[E]];return C()};a[m]=!0,d.exports=Object.create||function(T,P){var M;return T!==null?(v[f]=s(T),M=new v,v[f]=null,M[m]=T):M=C(),P===void 0?M:i.f(M,P)}},6801(d,e,t){var s=t(3724),i=t(8686),n=t(4913),a=t(8551),o=t(5397),l=t(1072);e.f=s&&!i?Object.defineProperties:function(c,u){a(c);for(var f=o(u),p=l(u),m=p.length,v=0,A;m>v;)n.f(c,A=p[v++],f[A]);return c}},4913(d,e,t){var s=t(3724),i=t(5917),n=t(8686),a=t(8551),o=t(6969),l=TypeError,h=Object.defineProperty,c=Object.getOwnPropertyDescriptor,u="enumerable",f="configurable",p="writable";e.f=s?n?function(v,A,w){if(a(v),A=o(A),a(w),typeof v=="function"&&A==="prototype"&&"value"in w&&p in w&&!w[p]){var S=c(v,A);S&&S[p]&&(v[A]=w.value,w={configurable:f in w?w[f]:S[f],enumerable:u in w?w[u]:S[u],writable:!1})}return h(v,A,w)}:h:function(v,A,w){if(a(v),A=o(A),a(w),i)try{return h(v,A,w)}catch{}if("get"in w||"set"in w)throw new l("Accessors not supported");return"value"in w&&(v[A]=w.value),v}},7347(d,e,t){var s=t(3724),i=t(9565),n=t(8773),a=t(6980),o=t(5397),l=t(6969),h=t(9297),c=t(5917),u=Object.getOwnPropertyDescriptor;e.f=s?u:function(p,m){if(p=o(p),m=l(m),c)try{return u(p,m)}catch{}if(h(p,m))return a(!i(n.f,p,m),p[m])}},8480(d,e,t){var s=t(1828),i=t(8727),n=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(o){return s(o,n)}},3717(d,e){e.f=Object.getOwnPropertySymbols},2787(d,e,t){var s=t(9297),i=t(4901),n=t(8981),a=t(6119),o=t(2211),l=a("IE_PROTO"),h=Object,c=h.prototype;d.exports=o?h.getPrototypeOf:function(u){var f=n(u);if(s(f,l))return f[l];var p=f.constructor;return i(p)&&f instanceof p?p.prototype:f instanceof h?c:null}},1625(d,e,t){var s=t(9504);d.exports=s({}.isPrototypeOf)},1828(d,e,t){var s=t(9504),i=t(9297),n=t(5397),a=t(9617).indexOf,o=t(421),l=s([].push);d.exports=function(h,c){var u=n(h),f=0,p=[],m;for(m in u)!i(o,m)&&i(u,m)&&l(p,m);for(;c.length>f;)i(u,m=c[f++])&&(~a(p,m)||l(p,m));return p}},1072(d,e,t){var s=t(1828),i=t(8727);d.exports=Object.keys||function(a){return s(a,i)}},8773(d,e){var t={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,i=s&&!t.call({1:2},1);e.f=i?function(a){var o=s(this,a);return!!o&&o.enumerable}:t},2967(d,e,t){var s=t(6706),i=t(34),n=t(7750),a=t(3506);d.exports=Object.setPrototypeOf||("__proto__"in{}?(function(){var o=!1,l={},h;try{h=s(Object.prototype,"__proto__","set"),h(l,[]),o=l instanceof Array}catch{}return function(u,f){return n(u),a(f),i(u)&&(o?h(u,f):u.__proto__=f),u}})():void 0)},4270(d,e,t){var s=t(9565),i=t(4901),n=t(34),a=TypeError;d.exports=function(o,l){var h,c;if(l==="string"&&i(h=o.toString)&&!n(c=s(h,o))||i(h=o.valueOf)&&!n(c=s(h,o))||l!=="string"&&i(h=o.toString)&&!n(c=s(h,o)))return c;throw new a("Can't convert object to primitive value")}},5031(d,e,t){var s=t(7751),i=t(9504),n=t(8480),a=t(3717),o=t(8551),l=i([].concat);d.exports=s("Reflect","ownKeys")||function(c){var u=n.f(o(c)),f=a.f;return f?l(u,f(c)):u}},8235(d,e,t){var s=t(9504),i=t(9297),n=SyntaxError,a=parseInt,o=String.fromCharCode,l=s("".charAt),h=s("".slice),c=s(/./.exec),u={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":`
2
+ `,"\\r":"\r","\\t":" "},f=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;d.exports=function(m,v){for(var A=!0,w="";v<m.length;){var S=l(m,v);if(S==="\\"){var x=h(m,v,v+2);if(i(u,x))w+=u[x],v+=2;else if(x==="\\u"){v+=2;var C=h(m,v,v+4);if(!c(f,C))throw new n("Bad Unicode escape at: "+v);w+=o(a(C,16)),v+=4}else throw new n('Unknown escape sequence: "'+x+'"')}else if(S==='"'){A=!1,v++;break}else{if(c(p,S))throw new n("Bad control character in string literal at: "+v);w+=S,v++}}if(A)throw new n("Unterminated string at: "+v);return{value:w,end:v}}},1103(d){d.exports=function(e){try{return{error:!1,value:e()}}catch(t){return{error:!0,value:t}}}},3438(d,e,t){var s=t(8551),i=t(34),n=t(6043);d.exports=function(a,o){if(s(a),i(o)&&o.constructor===a)return o;var l=n.f(a),h=l.resolve;return h(o),l.promise}},7750(d,e,t){var s=t(4117),i=TypeError;d.exports=function(n){if(s(n))throw new i("Can't call method on "+n);return n}},9286(d,e,t){var s=t(4402),i=t(8469),n=s.Set,a=s.add;d.exports=function(o){var l=new n;return i(o,function(h){a(l,h)}),l}},3440(d,e,t){var s=t(7080),i=t(4402),n=t(9286),a=t(5170),o=t(3789),l=t(8469),h=t(507),c=i.has,u=i.remove;d.exports=function(p){var m=s(this),v=o(p),A=n(m);return a(A)<=v.size?l(A,function(w){v.includes(w)&&u(A,w)}):h(v.getIterator(),function(w){c(A,w)&&u(A,w)}),A}},4402(d,e,t){var s=t(9504),i=Set.prototype;d.exports={Set,add:s(i.add),has:s(i.has),remove:s(i.delete),proto:i}},8750(d,e,t){var s=t(7080),i=t(4402),n=t(5170),a=t(3789),o=t(8469),l=t(507),h=i.Set,c=i.add,u=i.has;d.exports=function(p){var m=s(this),v=a(p),A=new h;return n(m)>v.size?l(v.getIterator(),function(w){u(m,w)&&c(A,w)}):o(m,function(w){v.includes(w)&&c(A,w)}),A}},4449(d,e,t){var s=t(7080),i=t(4402).has,n=t(5170),a=t(3789),o=t(8469),l=t(507),h=t(9539);d.exports=function(u){var f=s(this),p=a(u);if(n(f)<=p.size)return o(f,function(v){if(p.includes(v))return!1},!0)!==!1;var m=p.getIterator();return l(m,function(v){if(i(f,v))return h(m.iterator,"normal",!1)})!==!1}},3838(d,e,t){var s=t(7080),i=t(5170),n=t(8469),a=t(3789);d.exports=function(l){var h=s(this),c=a(l);return i(h)>c.size?!1:n(h,function(u){if(!c.includes(u))return!1},!0)!==!1}},8527(d,e,t){var s=t(7080),i=t(4402).has,n=t(5170),a=t(3789),o=t(507),l=t(9539);d.exports=function(c){var u=s(this),f=a(c);if(n(u)<f.size)return!1;var p=f.getIterator();return o(p,function(m){if(!i(u,m))return l(p.iterator,"normal",!1)})!==!1}},8469(d,e,t){var s=t(9504),i=t(507),n=t(4402),a=n.Set,o=n.proto,l=s(o.forEach),h=s(o.keys),c=h(new a).next;d.exports=function(u,f,p){return p?i({iterator:h(u),next:c},f):l(u,f)}},4916(d,e,t){var s=t(7751),i=function(a){return{size:a,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},n=function(a){return{size:a,has:function(){return!0},keys:function(){throw new Error("e")}}};d.exports=function(a,o){var l=s("Set");try{new l()[a](i(0));try{return new l()[a](i(-1)),!1}catch{if(!o)return!0;try{return new l()[a](n(-1/0)),!1}catch{var h=new l([1,2]);return o(h[a](n(1/0)))}}}catch{return!1}}},9835(d){d.exports=function(e){try{var t=new Set,s={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return t.clear(),t.add(4),function(){return{done:!0}}}})}},i=t[e](s);return i.size===1&&i.values().next().value===4}catch{return!1}}},5170(d,e,t){var s=t(6706),i=t(4402);d.exports=s(i.proto,"size","get")||function(n){return n.size}},3650(d,e,t){var s=t(7080),i=t(4402),n=t(9286),a=t(3789),o=t(507),l=i.add,h=i.has,c=i.remove;d.exports=function(f){var p=s(this),m=a(f).getIterator(),v=n(p);return o(m,function(A){h(p,A)?c(v,A):l(v,A)}),v}},4204(d,e,t){var s=t(7080),i=t(4402).add,n=t(9286),a=t(3789),o=t(507);d.exports=function(h){var c=s(this),u=a(h).getIterator(),f=n(c);return o(u,function(p){i(f,p)}),f}},6119(d,e,t){var s=t(5745),i=t(3392),n=s("keys");d.exports=function(a){return n[a]||(n[a]=i(a))}},7629(d,e,t){var s=t(6395),i=t(4576),n=t(9433),a="__core-js_shared__",o=d.exports=i[a]||n(a,{});(o.versions||(o.versions=[])).push({version:"3.50.0",mode:s?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745(d,e,t){var s=t(7629),i=Object.create||Object;d.exports=function(n,a){return s[n]||(s[n]=a||i(null))}},4495(d,e,t){var s=t(9519),i=t(9039),n=t(4576),a=n.String;d.exports=!!Object.getOwnPropertySymbols&&!i(function(){var o=Symbol("symbol detection");return!a(o)||!(Object(o)instanceof Symbol)||!Symbol.sham&&s&&s<41})},1240(d,e,t){var s=t(9504);d.exports=s(1.1.valueOf)},5610(d,e,t){var s=t(1291),i=Math.max,n=Math.min;d.exports=function(a,o){var l=s(a);return l<0?i(l+o,0):n(l,o)}},5854(d,e,t){var s=t(2777),i=TypeError;d.exports=function(n){var a=s(n,"number");if(typeof a=="number")throw new i("Can't convert number to bigint");return BigInt(a)}},5397(d,e,t){var s=t(7055),i=t(7750);d.exports=function(n){return s(i(n))}},1291(d,e,t){var s=t(741);d.exports=function(i){var n=+i;return n!==n||n===0?0:s(n)}},8014(d,e,t){var s=t(1291),i=Math.min;d.exports=function(n){var a=s(n);return a>0?i(a,9007199254740991):0}},8981(d,e,t){var s=t(7750),i=Object;d.exports=function(n){return i(s(n))}},9590(d,e,t){var s=t(1291),i=RangeError;d.exports=function(n){var a=s(n);if(a<0)throw new i("The argument can't be less than 0");return a}},2777(d,e,t){var s=t(9565),i=t(34),n=t(757),a=t(5966),o=t(4270),l=t(8227),h=TypeError,c=l("toPrimitive");d.exports=function(u,f){if(!i(u)||n(u))return u;var p=a(u,c),m;if(p){if(f===void 0&&(f="default"),m=s(p,u,f),!i(m)||n(m))return m;throw new h("Can't convert object to primitive value")}return f===void 0&&(f="number"),o(u,f)}},6969(d,e,t){var s=t(2777),i=t(757);d.exports=function(n){var a=s(n,"string");return i(a)?a:a+""}},2140(d,e,t){var s=t(8227),i=s("toStringTag"),n={};n[i]="z",d.exports=String(n)==="[object z]"},655(d,e,t){var s=t(6955),i=String;d.exports=function(n){if(s(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return i(n)}},6823(d){var e=String;d.exports=function(t){try{return e(t)}catch{return"Object"}}},3392(d,e,t){var s=t(9504),i=0,n=Math.random(),a=s(1.1.toString);d.exports=function(o){return"Symbol("+(o===void 0?"":o)+")_"+a(++i+n,36)}},9143(d,e,t){var s=t(4576),i=t(9504),n=t(3972),a=t(3463),o=t(9297),l=t(2804),h=t(944),c=t(5169),u=l.c2i,f=l.c2iUrl,p=s.SyntaxError,m=s.TypeError,v=s.Array,A=i("".charAt),w=Math.floor,S=function(E,T){for(var P=E.length;T<P;T++){var M=A(E,T);if(M!==" "&&M!==" "&&M!==`
3
+ `&&M!=="\f"&&M!=="\r")break}return T},x=function(E,T,P){var M=E.length;M<4&&(E+=M===2?"AA":"A");var I=(T[A(E,0)]<<18)+(T[A(E,1)]<<12)+(T[A(E,2)]<<6)+T[A(E,3)],D=[I>>16&255,I>>8&255,I&255];if(M===2){if(P&&D[1]!==0)throw new p("Extra bits");return[D[0]]}if(M===3){if(P&&D[2]!==0)throw new p("Extra bits");return[D[0],D[1]]}return D},C=function(E,T,P){for(var M=T.length,I=0;I<M;I++)E[P+I]=T[I];return P+M};d.exports=function(E,T,P,M){a(E),n(T);var I=h(T)==="base64"?u:f,D=T?T.lastChunkHandling:void 0;if(D===void 0&&(D="loose"),D!=="loose"&&D!=="strict"&&D!=="stop-before-partial")throw new m("Incorrect `lastChunkHandling` option");P&&c(P.buffer);var R=E.length,U=P||v(w(R*3/4)),B=0,N=0,W="",k=0;if(M)for(;;){if(k=S(E,k),k===R){if(W.length>0){if(D==="stop-before-partial")break;if(D==="loose"){if(W.length===1)throw new p("Malformed padding: exactly one additional character");B=C(U,x(W,I,!1),B)}else throw new p("Missing padding")}N=R;break}var L=A(E,k);if(++k,L==="="){if(W.length<2)throw new p("Padding is too early");if(k=S(E,k),W.length===2){if(k===R){if(D==="stop-before-partial")break;throw new p("Malformed padding: only one =")}A(E,k)==="="&&(++k,k=S(E,k))}if(k<R)throw new p("Unexpected character after padding");B=C(U,x(W,I,D==="strict"),B),N=R;break}if(!o(I,L))throw new p("Unexpected character");var Y=M-B;if(Y===1&&W.length===2||Y===2&&W.length===3||(W+=L,W.length===4&&(B=C(U,x(W,I,!1),B),W="",N=k,B===M)))break}return P||(U.length=B),{bytes:U,read:N,written:B}}},2303(d,e,t){var s=t(4576),i=t(9504),n=s.Uint8Array,a=s.SyntaxError,o=Math.min,l=i("".match);d.exports=function(h,c){var u=h.length;if(u%2!==0)throw new a("String should be an even number of characters");for(var f=c?o(c.length,u/2):u/2,p=c||new n(f),m=l(h,/[\S\s]{2}/g),v=0;v<f;v++){var A=+("0x"+m[v]+"0");if(A!==A)throw new a("String should only contain hex characters");p[v]=A>>4}return{bytes:p,read:v<<1}}},7416(d,e,t){var s=t(9039),i=t(8227),n=t(3724),a=t(6395),o=i("iterator");d.exports=!s(function(){var l=new URL("b?a=1&b=2&c=3","https://a"),h=l.searchParams,c=new URLSearchParams("a=1&a=2&b=3"),u="";return l.pathname="c%20d",h.forEach(function(f,p){h.delete("b"),u+=p+f}),c.delete("a",2),c.delete("b",void 0),a&&(!l.toJSON||!c.has("a",1)||c.has("a",2)||!c.has("a",void 0)||c.has("b"))||!h.size&&(a||!n)||!h.sort||l.href!=="https://a/c%20d?a=1&c=3"||h.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!h[o]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("https://тест").host!=="xn--e1aybc"||new URL("https://a#б").hash!=="#%D0%B1"||u!=="a1c3"||new URL("https://x",void 0).host!=="x"})},7040(d,e,t){var s=t(4495);d.exports=s&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},8686(d,e,t){var s=t(3724),i=t(9039);d.exports=s&&i(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})},2812(d){var e=TypeError;d.exports=function(t,s){if(t<s)throw new e("Not enough arguments");return t}},8622(d,e,t){var s=t(4576),i=t(4901),n=s.WeakMap;d.exports=i(n)&&/native code/.test(String(n))},4995(d,e,t){var s=t(9504),i=WeakMap.prototype;d.exports={WeakMap,set:s(i.set),get:s(i.get),has:s(i.has),remove:s(i.delete)}},8227(d,e,t){var s=t(4576),i=t(5745),n=t(9297),a=t(3392),o=t(4495),l=t(7040),h=s.Symbol,c=i("wks"),u=l?h.for||h:h&&h.withoutSetter||a;d.exports=function(f){return n(c,f)||(c[f]=o&&n(h,f)?h[f]:u("Symbol."+f)),c[f]}},4423(d,e,t){var s=t(6518),i=t(9617).includes,n=t(9039),a=t(6469),o=n(function(){return!Array(1).includes()}),l=n(function(){return[,1].includes(void 0,1)});s({target:"Array",proto:!0,forced:o||l},{includes:function(c){return i(this,c,arguments.length>1?arguments[1]:void 0)}}),a("includes")},4114(d,e,t){var s=t(6518),i=t(8981),n=t(6198),a=t(4527),o=t(6837),l=t(9039),h=l(function(){return[].push.call({length:4294967296},1)!==4294967297}),c=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(f){return f instanceof TypeError}},u=h||!c();s({target:"Array",proto:!0,arity:1,forced:u},{push:function(p){var m=i(this),v=n(m),A=arguments.length;o(v+A);for(var w=0;w<A;w++)m[v]=arguments[w],v++;return a(m,v),v}})},8111(d,e,t){var s=t(6518),i=t(4576),n=t(679),a=t(8551),o=t(4901),l=t(2787),h=t(2106),c=t(4659),u=t(9039),f=t(9297),p=t(8227),m=t(7657).IteratorPrototype,v=t(3724),A=t(6395),w="constructor",S="Iterator",x=p("toStringTag"),C=TypeError,E=i[S],T=A||!o(E)||E.prototype!==m||!u(function(){E({})}),P=function(){if(n(this,m),l(this)===m)throw new C("Abstract class Iterator not directly constructable")},M=function(I,D){v?h(m,I,{configurable:!0,get:function(){return D},set:function(R){if(a(this),this===m)throw new C("You can't redefine this property");f(this,I)?this[I]=R:c(this,I,R)}}):m[I]=D};f(m,x)||M(x,S),(T||!f(m,w)||m[w]===Object)&&M(w,P),P.prototype=m,s({global:!0,constructor:!0,forced:T},{Iterator:P})},9314(d,e,t){var s=t(6518),i=t(9565),n=t(8551),a=t(1767),o=t(4149),l=t(9590),h=t(9539),c=t(9462),u=t(684),f=t(4549),p=t(6395),m=RangeError,v=1/0,A=!p&&!u("drop",0),w=!p&&!A&&f("drop",RangeError),S=p||A||w||!(function(){try{Iterator.prototype.drop.call({next:function(){return{done:!0}}},9007199254740992)}catch(C){return C instanceof m}})(),x=c(function(){for(var C=this.iterator,E=this.next,T,P;this.remaining;)if(this.remaining--,T=n(i(E,C)),P=this.done=!!T.done,P)return;if(T=n(i(E,C)),P=this.done=!!T.done,!P)return T.value});s({target:"Iterator",proto:!0,real:!0,forced:S},{drop:function(E){n(this);var T;try{if(T=l(o(+E)),T>9007199254740991&&T!==v)throw new m("The argument should be a safe integer")}catch(P){h(this,"throw",P)}return w?i(w,this,T):new x(a(this),{remaining:T})}})},1148(d,e,t){var s=t(6518),i=t(9565),n=t(2652),a=t(9306),o=t(8551),l=t(1767),h=t(9539),c=t(4549),u=c("every",TypeError);s({target:"Iterator",proto:!0,real:!0,forced:u},{every:function(p){o(this);try{a(p)}catch(A){h(this,"throw",A)}if(u)return i(u,this,p);var m=l(this),v=0;return!n(m,function(A,w){if(!p(A,v++))return w()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489(d,e,t){var s=t(6518),i=t(9565),n=t(9306),a=t(8551),o=t(1767),l=t(9462),h=t(6319),c=t(6395),u=t(9539),f=t(684),p=t(4549),m=!c&&!f("filter",function(){}),v=!c&&!m&&p("filter",TypeError),A=c||m||v,w=l(function(){for(var S=this.iterator,x=this.predicate,C=this.next,E,T,P;;){if(E=a(i(C,S)),T=this.done=!!E.done,T)return;if(P=E.value,h(S,x,[P,this.counter++],!0))return P}});s({target:"Iterator",proto:!0,real:!0,forced:A},{filter:function(x){a(this);try{n(x)}catch(C){u(this,"throw",C)}return v?i(v,this,x):new w(o(this),{predicate:x})}})},116(d,e,t){var s=t(6518),i=t(9565),n=t(2652),a=t(9306),o=t(8551),l=t(1767),h=t(9539),c=t(4549),u=c("find",TypeError);s({target:"Iterator",proto:!0,real:!0,forced:u},{find:function(p){o(this);try{a(p)}catch(A){h(this,"throw",A)}if(u)return i(u,this,p);var m=l(this),v=0;return n(m,function(A,w){if(p(A,v++))return w(A)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})},531(d,e,t){var s=t(6518),i=t(9565),n=t(9306),a=t(8551),o=t(1767),l=t(8646),h=t(9462),c=t(9539),u=t(9039),f=t(6395),p=t(684),m=t(4549),v=!f&&u(function(){return[1].values().flatMap(function(){return[1]}).find(function(){return!0})!==1}),A=!f&&!v&&!p("flatMap",function(){}),w=!f&&!v&&!A&&m("flatMap",TypeError),S=f||v||A||w,x=h(function(){for(var C=this.iterator,E=this.mapper,T,P;;){if(P=this.inner)try{if(T=a(i(P.next,P.iterator)),!T.done)return T.value;this.inner=null}catch(M){c(C,"throw",M)}if(T=a(i(this.next,C)),this.done=!!T.done)return;try{this.inner=l(E(T.value,this.counter++),!1)}catch(M){c(C,"throw",M)}}});s({target:"Iterator",proto:!0,real:!0,forced:S},{flatMap:function(E){a(this);try{n(E)}catch(T){c(this,"throw",T)}return w?i(w,this,E):new x(o(this),{mapper:E,inner:null})}})},7588(d,e,t){var s=t(6518),i=t(9565),n=t(2652),a=t(9306),o=t(8551),l=t(1767),h=t(9539),c=t(4549),u=c("forEach",TypeError);s({target:"Iterator",proto:!0,real:!0,forced:u},{forEach:function(p){o(this);try{a(p)}catch(A){h(this,"throw",A)}if(u)return i(u,this,p);var m=l(this),v=0;n(m,function(A){p(A,v++)},{IS_RECORD:!0})}})},1701(d,e,t){var s=t(6518),i=t(9565),n=t(9306),a=t(8551),o=t(1767),l=t(9462),h=t(6319),c=t(9539),u=t(684),f=t(4549),p=t(6395),m=!p&&!u("map",function(){}),v=!p&&!m&&f("map",TypeError),A=p||m||v,w=l(function(){var S=this.iterator,x=a(i(this.next,S)),C=this.done=!!x.done;if(!C)return h(S,this.mapper,[x.value,this.counter++],!0)});s({target:"Iterator",proto:!0,real:!0,forced:A},{map:function(x){a(this);try{n(x)}catch(C){c(this,"throw",C)}return v?i(v,this,x):new w(o(this),{mapper:x})}})},3579(d,e,t){var s=t(6518),i=t(9565),n=t(2652),a=t(9306),o=t(8551),l=t(1767),h=t(9539),c=t(4549),u=c("some",TypeError);s({target:"Iterator",proto:!0,real:!0,forced:u},{some:function(p){o(this);try{a(p)}catch(A){h(this,"throw",A)}if(u)return i(u,this,p);var m=l(this),v=0;return n(m,function(A,w){if(p(A,v++))return w()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},4972(d,e,t){var s=t(6518),i=t(9565),n=t(8551),a=t(1767),o=t(4149),l=t(9590),h=t(9462),c=t(9539),u=t(684),f=t(4549),p=t(6395),m=RangeError,v=1/0,A=!p&&!u("take",1),w=!p&&!A&&f("take",RangeError),S=p||A||w||!(function(){try{Iterator.prototype.take.call({next:function(){return{done:!0}}},9007199254740992)}catch(C){return C instanceof m}})(),x=h(function(){var C=this.iterator;if(!this.remaining--)return this.done=!0,c(C,"normal",void 0);var E=n(i(this.next,C)),T=this.done=!!E.done;if(!T)return E.value});s({target:"Iterator",proto:!0,real:!0,forced:S},{take:function(E){n(this);var T;try{if(T=l(o(+E)),T>9007199254740991&&T!==v)throw new m("The argument should be a safe integer")}catch(P){c(this,"throw",P)}return w?i(w,this,T):new x(a(this),{remaining:T})}})},1806(d,e,t){var s=t(6518),i=t(8551),n=t(4659),a=t(2652),o=t(1767);s({target:"Iterator",proto:!0,real:!0},{toArray:function(){var h=[],c=0;return a(o(i(this)),function(u){n(h,c++,u)},{IS_RECORD:!0}),h}})},9112(d,e,t){var s=t(6518),i=t(3724),n=t(4576),a=t(7751),o=t(9504),l=t(9565),h=t(4901),c=t(34),u=t(4376),f=t(9297),p=t(655),m=t(6198),v=t(4659),A=t(9039),w=t(8235),S=t(4495),x=n.JSON,C=n.Number,E=n.SyntaxError,T=x&&x.parse,P=a("Object","keys"),M=Object.getOwnPropertyDescriptor,I=o("".charAt),D=o("".slice),R=o(/./.exec),U=o([].push),B=/^\d$/,N=/^[1-9]$/,W=/^[\d-]$/,k=/^[\t\n\r ]$/,L=0,Y=1,z=function(H,F){H=p(H);var j=new rt(H,0),it=j.parse(),yt=it.value,q=j.skip(k,it.end);if(q<H.length)throw new E('Unexpected extra character: "'+I(H,q)+'" after the parsed data at: '+q);return h(F)?lt({"":yt},"",F,it):yt},lt=function(H,F,j,it){var yt=H[F],q=it&&yt===it.value,ut=q&&typeof it.source=="string"?{source:it.source}:{},kt,Te,Ce,ae,ni;if(c(yt)){var Vh=u(yt),el=q?it.nodes:Vh?[]:{};if(Vh)for(kt=el.length,Ce=m(yt),ae=0;ae<Ce;ae++)vt(yt,ae,lt(yt,""+ae,j,ae<kt?el[ae]:void 0));else for(Te=P(yt),Ce=m(Te),ae=0;ae<Ce;ae++)ni=Te[ae],vt(yt,ni,lt(yt,ni,j,f(el,ni)?el[ni]:void 0))}return l(j,H,F,yt,ut)},vt=function(H,F,j){if(i){var it=M(H,F);if(it&&!it.configurable)return}j===void 0?delete H[F]:v(H,F,j)},dt=function(H,F,j,it){this.value=H,this.end=F,this.source=j,this.nodes=it},rt=function(H,F){this.source=H,this.index=F};rt.prototype={fork:function(H){return new rt(this.source,H)},parse:function(){var H=this.source,F=this.skip(k,this.index),j=this.fork(F),it=I(H,F);if(R(W,it))return j.number();switch(it){case"{":return j.object();case"[":return j.array();case'"':return j.string();case"t":return j.keyword(!0);case"f":return j.keyword(!1);case"n":return j.keyword(null)}throw new E('Unexpected character: "'+it+'" at: '+F)},node:function(H,F,j,it,yt){return new dt(F,it,H?null:D(this.source,j,it),yt)},object:function(){for(var H=this.source,F=this.index+1,j=!1,it={},yt={},q=!1;F<H.length;){if(F=this.until(['"',"}"],F),I(H,F)==="}"&&!j){F++,q=!0;break}var ut=this.fork(F).string(),kt=ut.value;F=ut.end,F=this.until([":"],F)+1,F=this.skip(k,F),ut=this.fork(F).parse(),v(yt,kt,ut),v(it,kt,ut.value),F=this.until([",","}"],ut.end);var Te=I(H,F);if(Te===",")j=!0,F++;else if(Te==="}"){F++,q=!0;break}}if(!q)throw new E("Unterminated object at: "+F);return this.node(Y,it,this.index,F,yt)},array:function(){for(var H=this.source,F=this.index+1,j=!1,it=[],yt=[],q=!1;F<H.length;){if(F=this.skip(k,F),I(H,F)==="]"&&!j){F++,q=!0;break}var ut=this.fork(F).parse();if(U(yt,ut),U(it,ut.value),F=this.until([",","]"],ut.end),I(H,F)===",")j=!0,F++;else if(I(H,F)==="]"){F++,q=!0;break}}if(!q)throw new E("Unterminated array at: "+F);return this.node(Y,it,this.index,F,yt)},string:function(){var H=this.index,F=w(this.source,this.index+1);return this.node(L,F.value,H,F.end)},number:function(){var H=this.source,F=this.index,j=F;if(I(H,j)==="-"&&j++,I(H,j)==="0")j++;else if(R(N,I(H,j)))j=this.skip(B,j+1);else throw new E("Failed to parse number at: "+j);if(I(H,j)==="."){var it=j+1;if(j=this.skip(B,it),it===j)throw new E("Failed to parse number's fraction at: "+j)}if(I(H,j)==="e"||I(H,j)==="E"){j++,(I(H,j)==="+"||I(H,j)==="-")&&j++;var yt=j;if(j=this.skip(B,j),yt===j)throw new E("Failed to parse number's exponent value at: "+j)}return this.node(L,C(D(H,F,j)),F,j)},keyword:function(H){var F=""+H,j=this.index,it=j+F.length;if(D(this.source,j,it)!==F)throw new E("Failed to parse value at: "+j);return this.node(L,H,j,it)},skip:function(H,F){for(var j=this.source;F<j.length&&R(H,I(j,F));F++);return F},until:function(H,F){F=this.skip(k,F);for(var j=I(this.source,F),it=0;it<H.length;it++)if(H[it]===j)return F;throw new E('Unexpected character: "'+j+'" at: '+F)}};var bt=A(function(){var H="9007199254740993",F;return T(H,function(j,it,yt){F=yt.source}),F!==H}),Be=S&&!A(function(){return 1/T("-0 ")!==-1/0});s({target:"JSON",stat:!0,forced:bt},{parse:function(F,j){return Be&&!h(j)?T(F):z(F,j)}})},3110(d,e,t){var s=t(6518),i=t(7751),n=t(9565),a=t(9504),o=t(9039),l=t(4376),h=t(4901),c=t(34),u=t(2360),f=t(5810),p=t(757),m=t(2195),v=t(1240),A=t(9617).includes,w=t(9297),S=t(655),x=t(8235),C=t(3392),E=t(4495),T=t(7819),P=String,M=TypeError,I=i("JSON","stringify"),D=i("BigInt"),R=a("".valueOf),U=a((!0).valueOf),B=D&&a(D.prototype.valueOf),N=a(/./.exec),W=a("".charAt),k=a("".charCodeAt),L=a("".replace),Y=a("".slice),z=a([].push),lt=a([].pop),vt=a(1.1.toString),dt=/[\uD800-\uDFFF]/g,rt=/^[\uD800-\uDBFF]$/,bt=/^[\uDC00-\uDFFF]$/,Be=/^\d+$/,H=C(),F=C(),j=C(),it=H.length,yt=F.length,q=!E||o(function(){var pt=i("Symbol")("stringify detection");return I([pt])!=="[null]"||I({a:pt})!=="{}"||I(Object(pt))!=="{}"}),ut=o(function(){return I("\uDF06\uD834")!=='"\\udf06\\ud834"'||I("\uDEAD")!=='"\\udead"'}),kt=T?i("JSON","isRawJSON"):f,Te=q?function(pt,Lt,Wt){return I(pt,function(We,Xe){var ye=n(Lt,this,We,Xe);if(!p(ye))return ye},Wt)}:I,Ce=function(pt,Lt,Wt){var We=W(Wt,Lt-1),Xe=W(Wt,Lt+1);return N(rt,pt)&&!N(bt,Xe)||N(bt,pt)&&!N(rt,We)?"\\u"+vt(k(pt,0),16):pt},ae=function(pt){if(l(pt)){for(var Lt=pt.length,Wt=[],We=u(null),Xe=0;Xe<Lt;Xe++){var ye=pt[Xe],ri;if(typeof ye=="string")ri=ye;else if(typeof ye=="number"||m(ye)==="Number"||m(ye)==="String")ri=S(ye);else continue;w(We,ri)||(We[ri]=!0,z(Wt,ri))}return Wt}},ni=function(pt,Lt){try{return pt(Lt),!0}catch{return!1}},Vh=function(pt){var Lt=m(pt);return Lt==="Number"&&ni(v,pt)||Lt==="String"&&ni(R,pt)||Lt==="Boolean"&&ni(U,pt)||!!B&&Lt==="BigInt"&&ni(B,pt)},el=function(pt){if(!c(pt)||h(pt)||l(pt))return!1;try{return!Vh(pt)}catch{return!0}},Yb=function(pt,Lt){return{toJSON:function(){var Wt=pt[Lt];if(c(Wt)||typeof Wt=="bigint"){var We=Wt.toJSON;h(We)&&(Wt=n(We,Wt,Lt))}return Wt}}},Kb=function(pt){for(var Lt=0,Wt=pt.length;Lt<Wt;Lt++)if(N(Be,pt[Lt]))return F;return""},Jb=function(pt,Lt,Wt){for(var We=u(null),Xe=0,ye=Lt.length;Xe<ye;Xe++){var ri=Lt[Xe];We[Wt+ri]=Yb(pt,ri)}return We[j]=null,We};I&&s({target:"JSON",stat:!0,arity:3,forced:q||ut||!T},{stringify:function(Lt,Wt,We){var Xe=h(Wt)?Wt:void 0,ye=Xe?void 0:ae(Wt),ri=ye&&Kb(ye),_m=[],fp=[],$m=[],bu,pp=!1,jm=!0,ln=Te(Lt,function(Xh,Ti){if(Xh=P(Xh),ye){if(Xh===j){lt(fp),bu=lt($m);return}if(jm)jm=!1;else if(this!==bu&&!l(this)&&!A(ye,Xh))return}else Xe&&(Ti=n(Xe,this,Xh,Ti));if(kt(Ti))return T?Ti:(pp=!0,H+(z(_m,Ti.rawJSON)-1));if(ye&&el(Ti)){if(A(fp,Ti))throw new M("Converting circular structure to JSON");var zm=Jb(Ti,ye,ri);return z(fp,Ti),z($m,bu),bu=zm,ri&&(pp=!0),zm}return Ti},We);if(typeof ln!="string"||(ut&&(ln=L(ln,dt,Ce)),!pp))return ln;for(var zh="",Qb=ln.length,sl=0;sl<Qb;sl++){var Gm=W(ln,sl);if(Gm==='"'){var Vm=x(ln,++sl).end-1,Wh=Y(ln,sl,Vm);Y(Wh,0,it)===H?zh+=_m[Y(Wh,it)]:Y(Wh,0,yt)===F?zh+='"'+Y(Wh,yt)+'"':zh+='"'+Wh+'"',sl=Vm}else zh+=Gm}return zh}})},2731(d,e,t){var s=t(6518),i=t(9306),n=t(2248),a=t(6395),o=n.get,l=n.has,h=n.set;s({target:"Map",proto:!0,real:!0,forced:a},{getOrInsertComputed:function(u,f){var p=l(this,u);if(i(f),p)return o(this,u);u===0&&1/u===-1/0&&(u=0);var m=f(u);return h(this,u,m),m}})},5367(d,e,t){var s=t(6518),i=t(2248),n=t(6395),a=i.get,o=i.has,l=i.set;s({target:"Map",proto:!0,real:!0,forced:n},{getOrInsert:function(c,u){return o(this,c)?a(this,c):(l(this,c,u),u)}})},3068(d,e,t){var s=t(6518),i=t(9504),n=t(2652),a=RangeError,o=TypeError,l=1/0,h=NaN,c=Math.abs,u=Math.pow,f=i([].push),p=u(2,1023),m=u(2,53)-1,v=Number.MAX_VALUE,A=u(2,971),w={},S={},x={},C={},E={},T=function(P,M){var I=P+M,D=M-(I-P);return{hi:I,lo:D}};s({target:"Math",stat:!0},{sumPrecise:function(M){var I=[],D=0,R=C;switch(n(M,function(H){if(++D>m)throw new a("Maximum allowed index exceeded");if(typeof H!="number")throw new o("Value is not a number");R!==w&&(H!==H?R=w:H===l?R=R===S?w:x:H===-l?R=R===x?w:S:(H!==0||1/H===l)&&(R===C||R===E)&&(R=E,f(I,H)))}),R){case w:return h;case S:return-l;case x:return l;case C:return-0}for(var U=[],B=0,N,W,k,L,Y,z,lt=0;lt<I.length;lt++){N=I[lt];for(var vt=0,dt=0;dt<U.length;dt++){if(W=U[dt],c(N)<c(W)&&(z=N,N=W,W=z),k=T(N,W),L=k.hi,Y=k.lo,c(L)===l){var rt=L===l?1:-1;B+=rt,N=N-rt*p-rt*p,c(N)<c(W)&&(z=N,N=W,W=z),k=T(N,W),L=k.hi,Y=k.lo}Y!==0&&(U[vt++]=Y),N=L}U.length=vt,N!==0&&f(U,N)}var bt=U.length-1;if(L=0,Y=0,B!==0){var Be=bt>=0?U[bt]:0;if(bt--,c(B)>1||B>0&&Be>0||B<0&&Be<0)return B>0?l:-l;if(k=T(B*p,Be/2),L=k.hi,Y=k.lo,Y*=2,c(2*L)===l)return L>0?L===p&&Y===-(A/2)&&bt>=0&&U[bt]<0?v:l:L===-p&&Y===A/2&&bt>=0&&U[bt]>0?-v:-l;Y!==0&&(U[++bt]=Y,Y=0),L*=2}for(;bt>=0&&(k=T(L,U[bt--]),L=k.hi,Y=k.lo,Y===0););return bt>=0&&(Y<0&&U[bt]<0||Y>0&&U[bt]>0)&&(W=Y*2,N=L+W,W===N-L&&(L=N)),L}})},1689(d,e,t){var s=t(6518),i=t(4576),n=t(8745),a=t(7680),o=t(3438),l=t(6043),h=t(9306),c=t(1103),u=t(9039),f=i.Promise,p=!1,m=!f||!f.try||u(function(){var v=f.resolve();return f.try(function(A){return p=A===8,v},8)!==v})||!p;s({target:"Promise",stat:!0,forced:m},{try:function(v){var A=arguments.length>1?a(arguments,1):[],w=c(function(){return n(h(v),void 0,A)});if(!w.error)return o(this,w.value);var S=l.f(this),x=S.reject;return x(w.value),S.promise}})},7642(d,e,t){var s=t(6518),i=t(3440),n=t(9039),a=t(4916),o=!a("difference",function(h){return h.size===0}),l=o||n(function(){var h={size:1,has:function(){return!0},keys:function(){var u=0;return{next:function(){var f=u++>1;return c.has(1)&&c.clear(),{done:f,value:2}}}}},c=new Set([1,2,3,4]);return c.difference(h).size!==3});s({target:"Set",proto:!0,real:!0,forced:l},{difference:i})},8004(d,e,t){var s=t(6518),i=t(9039),n=t(8750),a=t(4916),o=!a("intersection",function(l){return l.size===2&&l.has(1)&&l.has(2)})||i(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});s({target:"Set",proto:!0,real:!0,forced:o},{intersection:n})},3853(d,e,t){var s=t(6518),i=t(4449),n=t(4916),a=!n("isDisjointFrom",function(o){return!o});s({target:"Set",proto:!0,real:!0,forced:a},{isDisjointFrom:i})},5876(d,e,t){var s=t(6518),i=t(3838),n=t(4916),a=!n("isSubsetOf",function(o){return o});s({target:"Set",proto:!0,real:!0,forced:a},{isSubsetOf:i})},2475(d,e,t){var s=t(6518),i=t(8527),n=t(4916),a=!n("isSupersetOf",function(o){return!o});s({target:"Set",proto:!0,real:!0,forced:a},{isSupersetOf:i})},5024(d,e,t){var s=t(6518),i=t(3650),n=t(9835),a=t(4916),o=!a("symmetricDifference")||!n("symmetricDifference");s({target:"Set",proto:!0,real:!0,forced:o},{symmetricDifference:i})},1698(d,e,t){var s=t(6518),i=t(4204),n=t(9835),a=t(4916),o=!a("union")||!n("union");s({target:"Set",proto:!0,real:!0,forced:o},{union:i})},9577(d,e,t){var s=t(4644),i=t(1108),n=t(6198),a=t(1291),o=t(5854),l=s.aTypedArray,h=s.getTypedArrayConstructor,c=s.exportTypedArrayMethod,u=RangeError,f=(function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(m){return m===8}})(),p=f&&(function(){try{new Int8Array(1).with(-.5,1)}catch{return!0}})();c("with",function(m,v){var A=l(this),w=n(A),S=a(m),x=S<0?w+S:S,C=i(A)?o(v):+v;if(x>=w||x<0)throw new u("Incorrect index");for(var E=new(h(A))(w),T=0;T<w;T++)E[T]=T===x?C:A[T];return E},!f||p)},5213(d,e,t){var s=t(6518),i=t(4576),n=t(5370),a=t(9143),o=i.Uint8Array,l=!o||!o.fromBase64||!(function(){try{o.fromBase64("a");return}catch{}try{o.fromBase64("",null)}catch{return!0}})();o&&s({target:"Uint8Array",stat:!0,forced:l},{fromBase64:function(c){var u=a(c,arguments.length>1?arguments[1]:void 0,null,9007199254740991);return n(o,u.bytes)}})},6632(d,e,t){var s=t(6518),i=t(4576),n=t(9143),a=t(4154),o=i.Uint8Array,l=!o||!o.prototype.setFromBase64||!(function(){var h=new o([255,255,255,255,255]);try{h.setFromBase64("",null);return}catch{}try{h.setFromBase64("a");return}catch{}try{h.setFromBase64("MjYyZg===")}catch{return h[0]===50&&h[1]===54&&h[2]===50&&h[3]===255&&h[4]===255}})();o&&s({target:"Uint8Array",proto:!0,forced:l},{setFromBase64:function(c){a(this);var u=n(c,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:u.read,written:u.written}}})},4226(d,e,t){var s=t(6518),i=t(4576),n=t(3463),a=t(4154),o=t(5169),l=t(2303);function h(){try{var c=new ArrayBuffer(16,{maxByteLength:1024});new Uint8Array(c).setFromHex("cafed00d")}catch{return!0}}i.Uint8Array&&s({target:"Uint8Array",proto:!0,forced:h()},{setFromHex:function(u){a(this),n(u),o(this.buffer);var f=l(u,this).read;return{read:f,written:f/2}}})},9486(d,e,t){var s=t(6518),i=t(4576),n=t(9504),a=t(3972),o=t(4154),l=t(5169),h=t(2804),c=t(944),u=h.i2c,f=h.i2cUrl,p=Math.floor,m=Math.ceil,v=n("".charAt),A=i.Uint8Array,w=i.Array,S=n([].join),x=!A||!A.prototype.toBase64||!(function(){try{var C=new A;C.toBase64(null)}catch{return!0}})();A&&s({target:"Uint8Array",proto:!0,forced:x},{toBase64:function(){var E=o(this),T=arguments.length?a(arguments[0]):void 0,P=c(T)==="base64"?u:f,M=!!T&&!!T.omitPadding;l(this.buffer);for(var I=0,D=E.length,R=w(M?p(D/3)*4+(D%3?D%3+1:0):m(D/3)*4),U=0,B,N=function(W){return v(P,B>>6*W&63)};I+2<D;I+=3)B=(E[I]<<16)+(E[I+1]<<8)+E[I+2],R[U++]=N(3),R[U++]=N(2),R[U++]=N(1),R[U++]=N(0);return I+2===D?(B=(E[I]<<16)+(E[I+1]<<8),R[U++]=N(3),R[U++]=N(2),R[U++]=N(1),M||(R[U++]="=")):I+1===D&&(B=E[I]<<16,R[U++]=N(3),R[U++]=N(2),M||(R[U++]="=",R[U++]="=")),S(R,"")}})},456(d,e,t){var s=t(6518),i=t(4576),n=t(9504),a=t(4154),o=t(5169),l=n(1.1.toString),h=n([].join),c=Array,u=i.Uint8Array,f=!u||!u.prototype.toHex||!(function(){try{var p=new u([255,255,255,255,255,255,255,255]);return p.toHex()==="ffffffffffffffff"}catch{return!1}})();u&&s({target:"Uint8Array",proto:!0,forced:f},{toHex:function(){a(this),o(this.buffer);for(var m=c(this.length),v=0,A=this.length;v<A;v++){var w=l(this[v],16);m[v]=w.length===1?"0"+w:w}return h(m,"")}})},9452(d,e,t){var s=t(6518),i=t(9306),n=t(6557),a=t(4328),o=t(4995),l=t(6395),h=o.get,c=o.has,u=o.set,f=l||!(function(){try{WeakMap.prototype.getOrInsertComputed&&new WeakMap().getOrInsertComputed(1,function(){throw 1})}catch(p){return p instanceof TypeError}})();s({target:"WeakMap",proto:!0,real:!0,forced:f},{getOrInsertComputed:function(m,v){if(l||n(this),a(m),i(v),c(this,m))return h(this,m);var A=v(m);return u(this,m,A),A}})},8454(d,e,t){var s=t(6518),i=t(4995),n=t(6395),a=i.get,o=i.has,l=i.set;s({target:"WeakMap",proto:!0,real:!0,forced:n},{getOrInsert:function(c,u){return o(this,c)?a(this,c):(l(this,c,u),u)}})},4979(d,e,t){var s=t(6518),i=t(4576),n=t(7751),a=t(6980),o=t(4913).f,l=t(9297),h=t(679),c=t(3167),u=t(2603),f=t(5002),p=t(6193),m=t(3724),v=t(6395),A="DOMException",w=n("Error"),S=n(A),x=function(){h(this,C);var k=arguments.length,L=u(k<1?void 0:arguments[0]),Y=u(k<2?void 0:arguments[1],"Error"),z=new S(L,Y),lt=new w(L);return lt.name=A,o(z,"stack",a(1,p(lt.stack,1))),c(z,this,x),z},C=x.prototype=S.prototype,E="stack"in new w(A),T="stack"in new S(1,2),P=S&&m&&Object.getOwnPropertyDescriptor(i,A),M=!!P&&!(P.writable&&P.configurable),I=E&&!M&&!T;s({global:!0,constructor:!0,forced:v||I},{DOMException:I?x:S});var D=n(A),R=D.prototype;if(R.constructor!==D){v||o(R,"constructor",a(1,D));for(var U in f)if(l(f,U)){var B=f[U],N=B.s;l(D,N)||o(D,N,a(6,B.c))}}},5781(d,e,t){var s=t(6518),i=t(7751),n=t(2812),a=t(655),o=t(7416),l=i("URL");s({target:"URL",stat:!0,forced:!o},{parse:function(c){var u=n(arguments.length,1),f=a(c),p=u<2||arguments[1]===void 0?void 0:a(arguments[1]);try{return new l(f,p)}catch{return null}}})}};const Xm={};function ot(d){const e=Xm[d];if(e!==void 0)return e.exports;const t=Xm[d]={exports:{}};return tA[d].call(t.exports,t,t.exports,ot),t.exports}ot.d=(d,e)=>{if(Array.isArray(e))for(var t=0;t<e.length;){var s=e[t++],i=e[t++];ot.o(d,s)?i===0&&t++:i===0?Object.defineProperty(d,s,{enumerable:!0,value:e[t++]}):Object.defineProperty(d,s,{enumerable:!0,get:i})}else for(var s in e)ot.o(e,s)&&!ot.o(d,s)&&Object.defineProperty(d,s,{enumerable:!0,get:e[s]})};ot.o=(d,e)=>Object.prototype.hasOwnProperty.call(d,e);ot(4423);ot(4114);ot(8111);ot(2489);ot(5367);ot(2731);ot(7642);ot(8004);ot(3853);ot(5876);ot(2475);ot(5024);ot(1698);ot(9577);ot(6632);ot(4226);ot(9486);ot(456);ot(5781);const ks=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Jn=[1/0,1/0,-1/0,-1/0],Aa=new Float32Array(Jn),Ep=[.001,0,0,.001,0,0],es="http://www.w3.org/2000/svg",Ds={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},ir={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},hl="pdfjs_internal_id_",_h="pdfjs_internal_editor_",nt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},ft={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},eA={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},fe={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Ou={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Yt={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26,RICHMEDIA:27},nl={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},qf={ERRORS:0,WARNINGS:1,INFOS:5},Mi={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},Yh={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},sA={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let tp=qf.WARNINGS;function iA(d){Number.isInteger(d)&&(tp=d)}function nA(){return tp}function ep(d){tp>=qf.INFOS&&console.info(`Info: ${d}`)}function st(d){tp>=qf.WARNINGS&&console.warn(`Warning: ${d}`)}function gt(d){throw new Error(d)}function qt(d,e){d||gt(e)}function rA(d){switch(d==null?void 0:d.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Pv(d,e=null,t=null){if(!d)return null;if(t&&typeof d=="string"){if(t.addDefaultProtocol&&d.startsWith("www.")){const i=d.match(/\./g);(i==null?void 0:i.length)>=2&&(d=`http://${d}`)}if(t.tryConvertEncoding)try{d=lA(d)}catch{}}const s=e?URL.parse(d,e):URL.parse(d);return rA(s)?s:null}function Iv(d,e,t=!1){const s=URL.parse(d);return s?(s.hash=e,s.href):t&&Pv(d,"http://example.com")?d.split("#",1)[0]+`${e?`#${e}`:""}`:""}function xp(d){return d.substring(d.lastIndexOf("/")+1)}function Q(d,e,t,s=!1){return Object.defineProperty(d,e,{value:t,enumerable:!s,configurable:!0,writable:!1}),t}const qo=(function(){function e(t,s){this.message=t,this.name=s}return e.prototype=new Error,e.constructor=e,e})();class Tp extends qo{constructor(e,t){super(e,"PasswordException"),this.code=t}}class mp extends qo{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}}class Cp extends qo{constructor(e){super(e,"InvalidPDFException")}}class vf extends qo{constructor(e,t,s){super(e,"ResponseException"),this.status=t,this.missing=s}}class aA extends qo{constructor(e){super(e,"FormatError")}}class la extends qo{constructor(e){super(e,"AbortException")}}function oA(d){(typeof d!="object"||(d==null?void 0:d.length)===void 0)&&gt("Invalid argument for bytesToString");const e=d.length,t=8192;if(e<t)return String.fromCharCode.apply(null,d);const s=[];for(let i=0;i<e;i+=t){const n=Math.min(i+t,e),a=d.subarray(i,n);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function sp(d){typeof d!="string"&&gt("Invalid argument for stringToBytes");const e=d.length,t=new Uint8Array(e);for(let s=0;s<e;++s)t[s]=d.charCodeAt(s)&255;return t}class Mt{static get isLittleEndian(){const e=new Uint8Array(4);e[0]=1;const t=new Uint32Array(e.buffer,0,1);return Q(this,"isLittleEndian",t[0]===1)}static get isOffscreenCanvasSupported(){return Q(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Q(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return Q(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return Q(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){const{platform:e,userAgent:t}=navigator;return Q(this,"platform",{isAndroid:t.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCanvasFilterSupported(){let e;return this.isOffscreenCanvasSupported?e=new OffscreenCanvas(1,1).getContext("2d"):typeof document<"u"&&(e=document.createElement("canvas").getContext("2d")),Q(this,"isCanvasFilterSupported",(e==null?void 0:e.filter)!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return Q(this,"isAlphaColorInputSupported",!1);const e=document.createElement("input");return e.type="color",e.setAttribute("alpha",""),e.value="#ff000080",Q(this,"isAlphaColorInputSupported",e.value!=="#ff0000")}static get isBackdropFilterSupported(){return Q(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}}var Qn,Mu,Pp;class _{static get hexNums(){return Q(this,"hexNums",Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")))}static makeHexColor(e,t,s){return`#${this.hexNums[e]}${this.hexNums[t]}${this.hexNums[s]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static multiplyByDOMMatrix(e,t){return[e[0]*t.a+e[2]*t.b,e[1]*t.a+e[3]*t.b,e[0]*t.c+e[2]*t.d,e[1]*t.c+e[3]*t.d,e[0]*t.e+e[2]*t.f+e[4],e[1]*t.e+e[3]*t.f+e[5]]}static applyTransform(e,t,s=0){const i=e[s],n=e[s+1];e[s]=i*t[0]+n*t[2]+t[4],e[s+1]=i*t[1]+n*t[3]+t[5]}static applyTransformToBezier(e,t,s=0){const i=t[0],n=t[1],a=t[2],o=t[3],l=t[4],h=t[5];for(let c=0;c<6;c+=2){const u=e[s+c],f=e[s+c+1];e[s+c]=u*i+f*a+l,e[s+c+1]=u*n+f*o+h}}static applyInverseTransform(e,t){const s=e[0],i=e[1],n=t[0]*t[3]-t[1]*t[2];e[0]=(s*t[3]-i*t[2]+t[2]*t[5]-t[4]*t[3])/n,e[1]=(-s*t[1]+i*t[0]+t[4]*t[1]-t[5]*t[0])/n}static axialAlignedBoundingBox(e,t,s){const i=t[0],n=t[1],a=t[2],o=t[3],l=t[4],h=t[5],c=e[0],u=e[1],f=e[2],p=e[3];let m=i*c+l,v=m,A=i*f+l,w=A,S=o*u+h,x=S,C=o*p+h,E=C;if(n!==0||a!==0){const T=n*c,P=n*f,M=a*u,I=a*p;m+=M,w+=M,A+=I,v+=I,S+=T,E+=T,C+=P,x+=P}s[0]=Math.min(s[0],m,A,v,w),s[1]=Math.min(s[1],S,C,x,E),s[2]=Math.max(s[2],m,A,v,w),s[3]=Math.max(s[3],S,C,x,E)}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e,t){const s=e[0],i=e[1],n=e[2],a=e[3],o=s**2+i**2,l=s*n+i*a,h=n**2+a**2,c=(o+h)/2,u=Math.sqrt(c**2-(o*h-l**2));t[0]=Math.sqrt(c+u||1),t[1]=Math.sqrt(c-u||1)}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const s=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),i=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(s>i)return null;const n=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return n>a?null:[s,n,i,a]}static pointBoundingBox(e,t,s){s[0]=Math.min(s[0],e),s[1]=Math.min(s[1],t),s[2]=Math.max(s[2],e),s[3]=Math.max(s[3],t)}static rectBoundingBox(e,t,s,i,n){n[0]=Math.min(n[0],e,s),n[1]=Math.min(n[1],t,i),n[2]=Math.max(n[2],e,s),n[3]=Math.max(n[3],t,i)}static bezierBoundingBox(e,t,s,i,n,a,o,l,h){h[0]=Math.min(h[0],e,o),h[1]=Math.min(h[1],t,l),h[2]=Math.max(h[2],e,o),h[3]=Math.max(h[3],t,l),b(this,Qn,Pp).call(this,e,s,n,o,t,i,a,l,3*(-e+3*(s-n)+o),6*(e-2*s+n),3*(s-e),h),b(this,Qn,Pp).call(this,e,s,n,o,t,i,a,l,3*(-t+3*(i-a)+l),6*(t-2*i+a),3*(i-t),h)}}Qn=new WeakSet,Mu=function(e,t,s,i,n,a,o,l,h,c){if(h<=0||h>=1)return;const u=1-h,f=h*h,p=f*h,m=u*(u*(u*e+3*h*t)+3*f*s)+p*i,v=u*(u*(u*n+3*h*a)+3*f*o)+p*l;c[0]=Math.min(c[0],m),c[1]=Math.min(c[1],v),c[2]=Math.max(c[2],m),c[3]=Math.max(c[3],v)},Pp=function(e,t,s,i,n,a,o,l,h,c,u,f){if(Math.abs(h)<1e-12){Math.abs(c)>=1e-12&&b(this,Qn,Mu).call(this,e,t,s,i,n,a,o,l,-u/c,f);return}const p=c**2-4*u*h;if(p<0)return;const m=Math.sqrt(p),v=2*h;b(this,Qn,Mu).call(this,e,t,s,i,n,a,o,l,(-c+m)/v,f),b(this,Qn,Mu).call(this,e,t,s,i,n,a,o,l,(-c-m)/v,f)},y(_,Qn);function lA(d){return decodeURIComponent(escape(d))}let vp=null,Ym=null;function hA(d){return vp||(vp=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Ym=new Map([["ſt","ſt"]])),d.replaceAll(vp,(e,t,s)=>t?t.normalize("NFKC"):Ym.get(s))}function Ov(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const d=new Uint8Array(32);return crypto.getRandomValues(d),oA(d)}function cA(d,e,t){if(!Array.isArray(t)||t.length<2)return!1;const[s,i,...n]=t;if(!d(s)&&!Number.isInteger(s)||!e(i))return!1;const a=n.length;let o=!0;switch(i.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;o=!1;break;default:return!1}for(const l of n)if(!(typeof l=="number"||o&&l===null))return!1;return!0}const Gh=()=>[],Am=()=>new Map,Ip=()=>Object.create(null),dA=()=>new Set;typeof Blob.prototype.bytes!="function"&&(Blob.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())});typeof Response.prototype.bytes!="function"&&(Response.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())});typeof Iterator.prototype.join!="function"&&(Iterator.prototype.join=function(d){return[...this].join(d)});ot(1701);function _t(d,e,t){return Math.min(Math.max(d,e),t)}class gu{constructor({viewBox:e,userUnit:t,scale:s,rotation:i,offsetX:n=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=e,this.userUnit=t,this.scale=s,this.rotation=i,this.offsetX=n,this.offsetY=a,s*=t;const l=(e[2]+e[0])/2,h=(e[3]+e[1])/2;let c,u,f,p;switch(i%=360,i<0&&(i+=360),i){case 180:c=-1,u=0,f=0,p=1;break;case 90:c=0,u=1,f=1,p=0;break;case 270:c=0,u=-1,f=-1,p=0;break;case 0:c=1,u=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(f=-f,p=-p);let m,v,A,w;c===0?(m=Math.abs(h-e[1])*s+n,v=Math.abs(l-e[0])*s+a,A=(e[3]-e[1])*s,w=(e[2]-e[0])*s):(m=Math.abs(l-e[0])*s+n,v=Math.abs(h-e[1])*s+a,A=(e[2]-e[0])*s,w=(e[3]-e[1])*s),this.transform=[c*s,u*s,f*s,p*s,m-c*s*l-f*s*h,v-u*s*l-p*s*h],this.width=A,this.height=w}get rawDims(){const e=this.viewBox;return Q(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new gu({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:t,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(e,t){const s=[e,t];return _.applyTransform(s,this.transform),s}convertToPdfPoint(e,t){const s=[e,t];return _.applyInverseTransform(s,this.transform),s}}class Sc{static textContent(e){const t=[],s={items:t,styles:Object.create(null)};function i(n){var l;if(!n)return;let a=null;const o=n.name;if(o==="#text")a=n.value;else if(Sc.shouldBuildText(o))(l=n==null?void 0:n.attributes)!=null&&l.textContent?a=n.attributes.textContent:n.value&&(a=n.value);else return;if(a!==null&&t.push({str:a}),!!n.children)for(const h of n.children)i(h)}return i(e),s}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const uA=/url\(|image-set\(/i,fA=/^on/i;var Ic,Op;class wm{static get _allowedHtmlElements(){return Q(this,"_allowedHtmlElements",new Set(["a","b","br","button","div","i","img","input","label","li","ol","option","p","select","span","sub","sup","textarea","ul"]))}static get _allowedSvgElements(){return Q(this,"_allowedSvgElements",new Set(["ellipse","line","path","rect","svg"]))}static get _allowedRichTextElements(){return Q(this,"_allowedRichTextElements",new Set(["a","b","br","div","i","li","ol","p","span","sub","sup","ul"]))}static get _allowedRichTextAttributes(){return Q(this,"_allowedRichTextAttributes",new Set(["class","dir","style"]))}static get _allowedRichTextStyles(){return Q(this,"_allowedRichTextStyles",new Set(["color","font","fontFamily","fontSize","fontStretch","fontStyle","fontWeight","kerningMode","letterSpacing","lineHeight","margin","marginBottom","marginLeft","marginRight","marginTop","orphans","paddingLeft","paddingRight","breakAfter","breakBefore","breakInside","tabInterval","tabStop","textAlign","textDecoration","textIndent","transform","verticalAlign","widows"]))}static setupStorage(e,t,s,i,n){const a=i.getValue(t,{value:null});switch(s.name){case"textarea":if(a.value!==null&&(e.textContent=a.value),n==="print")break;e.addEventListener("input",o=>{i.setValue(t,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(a.value===s.attributes.xfaOn?e.setAttribute("checked",!0):a.value===s.attributes.xfaOff&&e.removeAttribute("checked"),n==="print")break;e.addEventListener("change",o=>{i.setValue(t,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&e.setAttribute("value",a.value),n==="print")break;e.addEventListener("input",o=>{i.setValue(t,{value:o.target.value})})}break;case"select":if(a.value!==null){e.setAttribute("value",a.value);for(const o of s.children)o.attributes.value===a.value?o.attributes.selected=!0:Object.hasOwn(o.attributes,"selected")&&delete o.attributes.selected}e.addEventListener("input",o=>{const l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;i.setValue(t,{value:h})});break}}static setAttributes({html:e,element:t,storage:s=null,intent:i,linkService:n}){const{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(const[l,h]of Object.entries(a))if(h!=null&&!fA.test(l)&&!(i==="richText"&&!this._allowedRichTextAttributes.has(l)))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":if(i==="richText"){const c=this._allowedRichTextStyles;for(const[u,f]of Object.entries(h))c.has(u)&&!uA.test(f)&&(e.style[u]=f)}else Object.assign(e.style,h);break;case"textContent":e.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,h)}o&&(n==null||n.addLinkAttributes(e,a.href,a.newWindow)),s&&a.dataId&&this.setupStorage(e,a.dataId,t,s)}static render(e){var u,f,p;const t=e.annotationStorage,s=e.linkService,i=e.xfaHtml,n=e.intent||"display",a=b(this,Ic,Op).call(this,i.name,(u=i.attributes)==null?void 0:u.xmlns,n)??document.createElement("div");i.attributes&&this.setAttributes({html:a,element:i,intent:n,linkService:s});const o=n!=="richText",l=e.div;if(l.append(a),e.viewport){const m=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=m}o&&l.setAttribute("class","xfaLayer xfaFont");const h=[];if(i.children.length===0){if(i.value){const m=document.createTextNode(i.value);a.append(m),o&&Sc.shouldBuildText(i.name)&&h.push(m)}return{textDivs:h}}const c=[[i,-1,a]];for(;c.length>0;){const[m,v,A]=c.at(-1);if(v+1===m.children.length){c.pop();continue}const w=m.children[++c.at(-1)[1]];if(w===null)continue;const{name:S}=w;if(S==="#text"){const C=document.createTextNode(w.value);h.push(C),A.append(C);continue}const x=b(this,Ic,Op).call(this,S,(f=w.attributes)==null?void 0:f.xmlns,n);if(x){if(A.append(x),w.attributes&&this.setAttributes({html:x,element:w,storage:t,intent:n,linkService:s}),((p=w.children)==null?void 0:p.length)>0)c.push([w,-1,x]);else if(w.value){const C=document.createTextNode(w.value);o&&Sc.shouldBuildText(S)&&h.push(C),x.append(C)}}}for(const m of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:h}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}static getPageViewport(e,{scale:t=1,rotation:s=0}){const{width:i,height:n}=e.attributes.style;return new gu({viewBox:[0,0,parseInt(i,10),parseInt(n,10)],userUnit:1,scale:t,rotation:s})}}Ic=new WeakSet,Op=function(e,t,s){return s==="richText"?!t&&this._allowedRichTextElements.has(e)?document.createElement(e):null:t?t===es&&this._allowedSvgElements.has(e)?document.createElementNS(es,e):null:this._allowedHtmlElements.has(e)?document.createElement(e):null},y(wm,Ic);const ma=class ma{};O(ma,"CSS",96),O(ma,"PDF",72),O(ma,"PDF_TO_CSS_UNITS",ma.CSS/ma.PDF);let ha=ma;async function Sm(d,e="text"){if(yc(d,document.baseURI)){const t=await fetch(d);if(!t.ok)throw new Error(t.statusText);switch(e){case"blob":return t.blob();case"bytes":return t.bytes();case"json":return t.json()}return t.text()}return new Promise((t,s)=>{const i=new XMLHttpRequest;i.open("GET",d,!0),i.responseType=e==="bytes"?"arraybuffer":e,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(e){case"bytes":t(new Uint8Array(i.response));return;case"blob":case"json":t(i.response);return}t(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class Em extends qo{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function ip(d){const e=d.length;let t=0;for(;t<e&&d[t].trim()==="";)t++;return d.substring(t,t+5).toLowerCase()==="data:"}function xm(d){return typeof d=="string"&&/\.pdf$/i.test(d)}function pA(d){return[d]=d.split(/[#?]/,1),xp(d)}function gA(d,e="document.pdf"){if(typeof d!="string")return e;if(ip(d))return st('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const s=(o=>{try{return new URL(o)}catch{}try{return new URL(decodeURIComponent(o))}catch{}try{return new URL(o,"https://foo.bar")}catch{}try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch{}return null})(d);if(!s)return e;const i=o=>{try{let l=decodeURIComponent(o);return l.includes("/")&&(l=xp(l),l.length===4&&n.test(l))?o:l}catch{return o}},n=/\.pdf$/i,a=xp(s.pathname);if(n.test(a))return i(a);if(s.searchParams.size>0){const o=h=>[...h].findLast(c=>n.test(c)),l=o(s.searchParams.values())??o(s.searchParams.keys());if(l)return i(l)}if(s.hash){const{hash:o}=s;let l=-1;for(const{index:h}of o.matchAll(/\.pdf\b/gi))l=h;if(l>0){let h=l;for(;h>0&&!"/?#=".includes(o[h-1]);)h--;if(h<l)return i(o.slice(h,l+4))}}return e}var nr;class Km{constructor(){y(this,nr,new Map);O(this,"times",[])}time(e){r(this,nr).has(e)&&st(`Timer is already running for ${e}`),r(this,nr).set(e,Date.now())}timeEnd(e){r(this,nr).has(e)||st(`Timer has not been started for ${e}`),this.times.push({name:e,start:r(this,nr).get(e),end:Date.now()}),r(this,nr).delete(e)}toString(){const e=Math.max(...this.times.map(t=>t.name.length));return this.times.map(t=>`${t.name.padEnd(e)} ${t.end-t.start}ms
4
+ `).join("")}}nr=new WeakMap;function yc(d,e){const t=e?URL.parse(d,e):URL.parse(d);return/https?:/.test((t==null?void 0:t.protocol)??"")}function Ei(d){d.preventDefault()}function me(d){d.preventDefault(),d.stopPropagation()}var Oc;class yf{static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;r(this,Oc)||g(this,Oc,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?"));const t=r(this,Oc).exec(e);if(!t)return null;const s=parseInt(t[1],10);let i=parseInt(t[2],10);i=i>=1&&i<=12?i-1:0;let n=parseInt(t[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(t[6],10);l=l>=0&&l<=59?l:0;const h=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,h==="-"?(a+=c,o+=u):h==="+"&&(a-=c,o-=u),new Date(Date.UTC(s,i,n,a,o,l))}}Oc=new WeakMap,y(yf,Oc);function mu(d){if(d.startsWith("#")){const t=d.slice(1);return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),t.length>=8?parseInt(t.slice(6,8),16)/255:1]}if(d.startsWith("rgb(")){const[t,s,i]=d.slice(4,-1).split(",").map(n=>parseInt(n,10));return[t,s,i,1]}if(d.startsWith("rgba(")){const t=d.slice(5,-1).split(",");return[parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3])]}const e=d.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return e?[Math.round(parseFloat(e[1])*255),Math.round(parseFloat(e[2])*255),Math.round(parseFloat(e[3])*255),e[4]!==void 0&&e[4]!=="none"?parseFloat(e[4]):1]:null}function vu(d){const e=mu(d);return e?e.slice(0,3):(st(`Not a valid color format: "${d}"`),[0,0,0])}function mA(d){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const t of d.keys()){e.style.color=t;const s=window.getComputedStyle(e).color;d.set(t,vu(s))}e.remove()}function Bt(d){const{a:e,b:t,c:s,d:i,e:n,f:a}=d.getTransform();return[e,t,s,i,n,a]}function Ci(d){const{a:e,b:t,c:s,d:i,e:n,f:a}=d.getTransform().invertSelf();return[e,t,s,i,n,a]}function Yo(d,e,t=!1,s=!0){if(e instanceof gu){const{pageWidth:i,pageHeight:n}=e.rawDims,{style:a}=d,o=`round(down, var(--total-scale-factor) * ${i}px, var(--scale-round-x))`,l=`round(down, var(--total-scale-factor) * ${n}px, var(--scale-round-y))`;!t||e.rotation%180===0?(a.width=o,a.height=l):(a.width=l,a.height=o)}s&&d.setAttribute("data-main-rotation",e.rotation)}class xi{constructor(){const{pixelRatio:e}=xi;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,t,s,i,n=-1){let a=1/0,o=1/0,l=1/0;s=xi.capPixels(s,n),s>0&&(a=Math.sqrt(s/(e*t))),i!==-1&&(o=i/e,l=i/t);const h=Math.min(a,o,l);return this.sx>h||this.sy>h?(this.sx=h,this.sy=h,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,t){if(t>=0){const s=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+t/100));return e>0?Math.min(e,s):s}return e}}const Mp=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class vA{static get isDarkMode(){var e;return Q(this,"isDarkMode",!!((e=window==null?void 0:window.matchMedia)!=null&&e.call(window,"(prefers-color-scheme: dark)").matches))}}class yA{static get commentForegroundColor(){const e=document.createElement("span");e.classList.add("comment","sidebar");const{style:t}=e;t.width=t.height="0",t.display="none",t.color="var(--comment-fg-color)",document.body.append(e);const{color:s}=window.getComputedStyle(e);return e.remove(),Q(this,"commentForegroundColor",vu(s))}}function bA(d,e){e=_t(e??1,0,1);const t=255*(1-e);return d.map(s=>Math.round(s*e+t))}function Jm(d,e){const t=d[0]/255,s=d[1]/255,i=d[2]/255,n=Math.max(t,s,i),a=Math.min(t,s,i),o=(n+a)/2;if(n===a)e[0]=e[1]=0;else{const l=n-a;switch(e[1]=o<.5?l/(n+a):l/(2-n-a),n){case t:e[0]=((s-i)/l+(s<i?6:0))*60;break;case s:e[0]=((i-t)/l+2)*60;break;case i:e[0]=((t-s)/l+4)*60;break}}e[2]=o}function Rp(d,e){const t=d[0],s=d[1],i=d[2],n=(1-Math.abs(2*i-1))*s,a=n*(1-Math.abs(t/60%2-1)),o=i-n/2;switch(Math.floor(t/60)){case 0:e[0]=n+o,e[1]=a+o,e[2]=o;break;case 1:e[0]=a+o,e[1]=n+o,e[2]=o;break;case 2:e[0]=o,e[1]=n+o,e[2]=a+o;break;case 3:e[0]=o,e[1]=a+o,e[2]=n+o;break;case 4:e[0]=a+o,e[1]=o,e[2]=n+o;break;case 5:case 6:e[0]=n+o,e[1]=o,e[2]=a+o;break}}function Dp(d){return d<=.03928?d/12.92:((d+.055)/1.055)**2.4}function Qm(d,e,t){Rp(d,t),t.map(Dp);const s=.2126*t[0]+.7152*t[1]+.0722*t[2];Rp(e,t),t.map(Dp);const i=.2126*t[0]+.7152*t[1]+.0722*t[2];return s>i?(s+.05)/(i+.05):(i+.05)/(s+.05)}const Zm=new Map;function AA(d,e){const t=d[0]+d[1]*256+d[2]*65536+e[0]*16777216+e[1]*4294967296+e[2]*1099511627776;let s=Zm.get(t);if(s)return s;const i=new Float32Array(9),n=i.subarray(0,3),a=i.subarray(3,6);Jm(d,a);const o=i.subarray(6,9);Jm(e,o);const l=o[2]<.5,h=l?12:4.5;if(a[2]=l?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),Qm(a,o,n)<h){let c,u;l?(c=a[2],u=1):(c=0,u=a[2]);const f=.005;for(;u-c>f;){const p=a[2]=(c+u)/2;l===Qm(a,o,n)<h?c=p:u=p}a[2]=l?u:c}return Rp(a,n),s=_.makeHexColor(Math.round(n[0]*255),Math.round(n[1]*255),Math.round(n[2]*255)),Zm.set(t,s),s}function Mv({html:d,dir:e,className:t},s){const i=document.createDocumentFragment();if(typeof d=="string"){const n=document.createElement("p");n.dir=e||"auto";const a=d.split(/\r\n?|\n/);for(let o=0,l=a.length;o<l;++o){const h=a[o];n.append(document.createTextNode(h)),o<l-1&&n.append(document.createElement("br"))}i.append(n)}else wm.render({xfaHtml:d,div:i,intent:"richText"});i.firstElementChild.classList.add("richText",t),s.append(i)}function Rv(d){const e=new Path2D;if(!d)return e;for(let t=0,s=d.length;t<s;)switch(d[t++]){case Yh.moveTo:e.moveTo(d[t++],d[t++]);break;case Yh.lineTo:e.lineTo(d[t++],d[t++]);break;case Yh.curveTo:e.bezierCurveTo(d[t++],d[t++],d[t++],d[t++],d[t++],d[t++]);break;case Yh.quadraticCurveTo:e.quadraticCurveTo(d[t++],d[t++],d[t++],d[t++]);break;case Yh.closePath:e.closePath();break;default:st(`Unrecognized drawing path operator: ${d[t-1]}`);break}return e}ot(4972);ot(8454);ot(9452);ot(4979);ot(3579);ot(3110);ot(9314);ot(1148);ot(116);ot(9112);var rr,ar,$s,js,Mc,or,fl,pl,Rc,Cf,Dv,Le,kv,Fv,rl,Qh;const dn=class dn{constructor(e){y(this,Le);y(this,rr,null);y(this,ar,null);y(this,$s);y(this,js,null);y(this,Mc,null);y(this,or,null);y(this,fl,null);y(this,pl,null);g(this,$s,e),r(dn,Rc)||g(dn,Rc,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const e=g(this,rr,document.createElement("div"));e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const t=r(this,$s)._uiManager._signal;t instanceof AbortSignal&&!t.aborted&&(e.addEventListener("contextmenu",Ei,{signal:t}),e.addEventListener("pointerdown",b(dn,Cf,Dv),{signal:t}));const s=g(this,js,document.createElement("div"));s.className="buttons",e.append(s);const i=r(this,$s).toolbarPosition;if(i){const{style:n}=e,a=r(this,$s)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*a}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return r(this,rr)}hide(){var e;r(this,rr).classList.add("hidden"),(e=r(this,ar))==null||e.hideDropdown()}show(){var e,t;r(this,rr).classList.remove("hidden"),(e=r(this,Mc))==null||e.shown(),(t=r(this,or))==null||t.shown()}addDeleteButton(){const{editorType:e,_uiManager:t}=r(this,$s),s=document.createElement("button");s.classList.add("basic","deleteButton"),s.tabIndex=0,s.setAttribute("data-l10n-id",r(dn,Rc)[e]),b(this,Le,rl).call(this,s)&&s.addEventListener("click",i=>{t.delete()},{signal:t._signal}),r(this,js).append(s)}async addAltText(e){const t=await e.render();b(this,Le,rl).call(this,t),r(this,js).append(t,r(this,Le,Qh)),g(this,Mc,e)}addComment(e,t=null){if(r(this,or))return;const s=e.renderForToolbar();if(!s)return;b(this,Le,rl).call(this,s);const i=g(this,fl,r(this,Le,Qh));t?(r(this,js).insertBefore(s,t),r(this,js).insertBefore(i,t)):r(this,js).append(s,i),g(this,or,e),e.toolbar=this}addColorPicker(e){if(r(this,ar))return;g(this,ar,e);const t=e.renderButton();b(this,Le,rl).call(this,t),r(this,js).append(t,r(this,Le,Qh))}async addEditSignatureButton(e){const t=g(this,pl,await e.renderEditButton(r(this,$s)));b(this,Le,rl).call(this,t),r(this,js).append(t,r(this,Le,Qh))}removeButton(e){var t,s;switch(e){case"comment":(t=r(this,or))==null||t.removeToolbarCommentButton(),g(this,or,null),(s=r(this,fl))==null||s.remove(),g(this,fl,null);break}}async addButton(e,t){switch(e){case"colorPicker":t&&this.addColorPicker(t);break;case"altText":t&&await this.addAltText(t);break;case"editSignature":t&&await this.addEditSignatureButton(t);break;case"delete":this.addDeleteButton();break;case"comment":t&&this.addComment(t);break}}async addButtonBefore(e,t,s){if(!t&&e==="comment")return;const i=r(this,js).querySelector(s);i&&e==="comment"&&this.addComment(t,i)}updateEditSignatureButton(e){r(this,pl)&&(r(this,pl).title=e)}remove(){var e;r(this,rr).remove(),(e=r(this,ar))==null||e.destroy(),g(this,ar,null)}};rr=new WeakMap,ar=new WeakMap,$s=new WeakMap,js=new WeakMap,Mc=new WeakMap,or=new WeakMap,fl=new WeakMap,pl=new WeakMap,Rc=new WeakMap,Cf=new WeakSet,Dv=function(e){e.stopPropagation()},Le=new WeakSet,kv=function(e){r(this,$s)._focusEventsAllowed=!1,me(e)},Fv=function(e){r(this,$s)._focusEventsAllowed=!0,me(e)},rl=function(e){const t=r(this,$s)._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(e.addEventListener("focusin",b(this,Le,kv).bind(this),{capture:!0,signal:t}),e.addEventListener("focusout",b(this,Le,Fv).bind(this),{capture:!0,signal:t}),e.addEventListener("contextmenu",Ei,{signal:t}),!0)},Qh=function(){const e=document.createElement("div");return e.className="divider",e},y(dn,Cf),y(dn,Rc,null);let kp=dn;var Dc,wa,Ri,qn,Lv,Nv,Fp;class wA{constructor(e){y(this,qn);y(this,Dc,null);y(this,wa,null);y(this,Ri);g(this,Ri,e)}show(e,t,s){const[i,n]=b(this,qn,Nv).call(this,t,s),{style:a}=r(this,wa)||g(this,wa,b(this,qn,Lv).call(this));e.append(r(this,wa)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){r(this,wa).remove()}}Dc=new WeakMap,wa=new WeakMap,Ri=new WeakMap,qn=new WeakSet,Lv=function(){const e=g(this,wa,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar"),e.dir=r(this,Ri).direction;const t=r(this,Ri)._signal;t instanceof AbortSignal&&!t.aborted&&e.addEventListener("contextmenu",Ei,{signal:t});const s=g(this,Dc,document.createElement("div"));return s.className="buttons",e.append(s),r(this,Ri).hasCommentManager()&&b(this,qn,Fp).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{r(this,Ri).commentSelection("floating_button")}),b(this,qn,Fp).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{r(this,Ri).highlightSelection("floating_button")}),e},Nv=function(e,t){let s=0,i=0;for(const n of e){const a=n.y+n.height;if(a<s)continue;const o=n.x+(t?n.width:0);if(a>s){i=o,s=a;continue}t?o>i&&(i=o):o<i&&(i=o)}return[t?1-i:i,s]},Fp=function(e,t,s,i){const n=document.createElement("button");n.classList.add("basic",e),n.tabIndex=0,n.setAttribute("data-l10n-id",t);const a=document.createElement("span");n.append(a),a.className="visuallyHidden",a.setAttribute("data-l10n-id",s);const o=r(this,Ri)._signal;o instanceof AbortSignal&&!o.aborted&&(n.addEventListener("contextmenu",Ei,{signal:o}),n.addEventListener("click",i,{signal:o})),r(this,Dc).append(n)};const SA="59968104-cc61-4cf9-b570-014b35b3709c",yp=Object.freeze({internal:SA});function Bv(d,e,t){for(const s of t)e.addEventListener(s,d[s].bind(d))}var Sa,Ea,gl,xa;const Tt=class Tt{static initializeAndAddPointerId(e){(r(Tt,Ea)||g(Tt,Ea,new Set)).add(e)}static setPointer(e,t){r(Tt,Sa)||g(Tt,Sa,t),r(Tt,xa)??g(Tt,xa,e)}static setTimeStamp(e){g(Tt,gl,e)}static isSamePointerId(e){return r(Tt,Sa)===e}static isSamePointerIdOrRemove(e){var t;return r(Tt,Sa)===e?!0:((t=r(Tt,Ea))==null||t.delete(e),!1)}static isSamePointerType(e){return r(Tt,xa)===e}static isInitializedAndDifferentPointerType(e){return r(Tt,xa)!==null&&!Tt.isSamePointerType(e)}static isSameTimeStamp(e){return r(Tt,gl)===e}static isUsingMultiplePointers(){var e;return((e=r(Tt,Ea))==null?void 0:e.size)>=1}static clearPointerType(){g(Tt,xa,null)}static clearPointerIds(){g(Tt,Sa,NaN),g(Tt,Ea,null)}static clearTimeStamp(){g(Tt,gl,NaN)}};Sa=new WeakMap,Ea=new WeakMap,gl=new WeakMap,xa=new WeakMap,y(Tt,Sa,NaN),y(Tt,Ea,null),y(Tt,gl,NaN),y(Tt,xa,null);let _e=Tt;var Pf;class EA{constructor(){y(this,Pf,0)}get id(){return`${_h}${Xt(this,Pf)._++}`}}Pf=new WeakMap;var ml,kc,$e,vl,Ru;const Fm=class Fm{constructor(){y(this,vl);y(this,ml,Ov());y(this,kc,0);y(this,$e,null)}static get _isSVGFittingCanvas(){const e=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="${es}"><rect width="1" height="1" style="fill:red;"/></svg>`,s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=e;const n=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return Q(this,"_isSVGFittingCanvas",n)}async getFromFile(e){const{lastModified:t,name:s,size:i,type:n}=e;return b(this,vl,Ru).call(this,`${t}_${s}_${i}_${n}`,e)}async getFromUrl(e){return b(this,vl,Ru).call(this,e,e)}async getFromBlob(e,t){const s=await t;return b(this,vl,Ru).call(this,e,s)}async getFromId(e){r(this,$e)||g(this,$e,new Map);const t=r(this,$e).get(e);if(!t)return null;if(t.bitmap)return t.refCounter+=1,t;if(t.file)return this.getFromFile(t.file);if(t.blobPromise){const{blobPromise:s}=t;return delete t.blobPromise,this.getFromBlob(t.id,s)}return this.getFromUrl(t.url)}getFromCanvas(e,t){r(this,$e)||g(this,$e,new Map);let s=r(this,$e).get(e);if(s!=null&&s.bitmap)return s.refCounter+=1,s;const i=new OffscreenCanvas(t.width,t.height);return i.getContext("2d").drawImage(t,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${r(this,ml)}_${Xt(this,kc)._++}`,refCounter:1,isSvg:!1},r(this,$e).set(e,s),r(this,$e).set(s.id,s),s}getSvgUrl(e){const t=r(this,$e).get(e);return t!=null&&t.isSvg?t.svgUrl:null}deleteId(e){var i;r(this,$e)||g(this,$e,new Map);const t=r(this,$e).get(e);if(!t||(t.refCounter-=1,t.refCounter!==0))return;const{bitmap:s}=t;if(!t.url&&!t.file){const n=new OffscreenCanvas(s.width,s.height);n.getContext("bitmaprenderer").transferFromImageBitmap(s),t.blobPromise=n.convertToBlob()}(i=s.close)==null||i.call(s),t.bitmap=null}isValidId(e){return e.startsWith(`image_${r(this,ml)}_`)}};ml=new WeakMap,kc=new WeakMap,$e=new WeakMap,vl=new WeakSet,Ru=async function(e,t){r(this,$e)||g(this,$e,new Map);let s=r(this,$e).get(e);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${r(this,ml)}_${Xt(this,kc)._++}`,refCounter:0,isSvg:!1});let i;if(typeof t=="string"?(s.url=t,i=await Sm(t,"blob")):t instanceof File?i=s.file=t:t instanceof Blob&&(i=t),i.type==="image/svg+xml"){const n=Fm._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((h,c)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,h()},a.onload=async()=>{const u=s.svgUrl=a.result;o.src=await n?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=a.onerror=c});a.readAsDataURL(i),await l}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){st(i),s=null}return r(this,$e).set(e,s),s&&r(this,$e).set(s.id,s),s};let Lp=Fm;var ne,lr,Fc,Kt;class xA{constructor(e=128){y(this,ne,[]);y(this,lr,!1);y(this,Fc);y(this,Kt,-1);g(this,Fc,e)}add({cmd:e,undo:t,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&e(),r(this,lr))return;const l={cmd:e,undo:t,post:s,type:n};if(r(this,Kt)===-1){r(this,ne).length>0&&(r(this,ne).length=0),g(this,Kt,0),r(this,ne).push(l);return}if(a&&r(this,ne)[r(this,Kt)].type===n){o&&(l.undo=r(this,ne)[r(this,Kt)].undo),r(this,ne)[r(this,Kt)]=l;return}const h=r(this,Kt)+1;h===r(this,Fc)?r(this,ne).splice(0,1):(g(this,Kt,h),h<r(this,ne).length&&r(this,ne).splice(h)),r(this,ne).push(l)}undo(){if(r(this,Kt)===-1)return;g(this,lr,!0);const{undo:e,post:t}=r(this,ne)[r(this,Kt)];e(),t==null||t(),g(this,lr,!1),g(this,Kt,r(this,Kt)-1)}redo(){if(r(this,Kt)<r(this,ne).length-1){g(this,Kt,r(this,Kt)+1),g(this,lr,!0);const{cmd:e,post:t}=r(this,ne)[r(this,Kt)];e(),t==null||t(),g(this,lr,!1)}}hasSomethingToUndo(){return r(this,Kt)!==-1}hasSomethingToRedo(){return r(this,Kt)<r(this,ne).length-1}cleanType(e){if(r(this,Kt)!==-1){for(let t=r(this,Kt);t>=0;t--)if(r(this,ne)[t].type!==e){r(this,ne).splice(t+1,r(this,Kt)-t),g(this,Kt,t);return}r(this,ne).length=0,g(this,Kt,-1)}}destroy(){g(this,ne,null)}}ne=new WeakMap,lr=new WeakMap,Fc=new WeakMap,Kt=new WeakMap;var $h,Uv,Hv;const os=class os{constructor(e){var s;this.callbacks=new Map;const{isMac:t}=Mt.platform;for(const[i,n,a={}]of e){const o=i.some(l=>l.startsWith("mac+"));for(const l of i){let h=l;if(o){const f=l.startsWith("mac+");if(t!==f)continue;f&&(h=l.slice(4))}const[c,u]=b(s=os,$h,Uv).call(s,h);c!==null&&this.callbacks.getOrInsertComputed(c,Gh).push({callback:n,options:a,modifiers:u})}}}exec(e,t){var c;let s=this.callbacks.get(t.key);if(!s){if(/^[a-z]$/i.test(t.key))return;const u=b(c=os,$h,Hv).call(c,t.code);if(u===null||u===t.key||(s=this.callbacks.get(u),!s))return}const i=(t.altKey?os.ALT:0)|(t.ctrlKey?os.CTRL:0)|(t.metaKey?os.META:0)|(t.shiftKey?os.SHIFT:0),n=s.find(u=>u.modifiers===i);if(!n)return;const{callback:a,options:{bubbles:o=!1,args:l=[],checker:h=null}}=n;h&&!h(e,t)||(a.bind(e,...l,t)(),o||me(t))}};$h=new WeakSet,Uv=function(e){let t=null,s=0;for(let i of e.split("+")){if(i=i.trim(),!i)continue;const n=i.toUpperCase(),a=os[n];if(a){s|=a;continue}if(t!==null){st(`KeyboardManager: multiple keys in shortcut "${e}"`);break}t=n==="SPACE"?" ":i}return t===null&&st(`KeyboardManager: no key found in shortcut "${e}"`),[t,s]},Hv=function(e){var s;const t=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(e);return t?((s=t[1])==null?void 0:s.toLowerCase())??t[2]:null},y(os,$h),O(os,"ALT",1),O(os,"CTRL",2),O(os,"META",4),O(os,"SHIFT",8);let Ko=os;const If=class If{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return mA(e),Q(this,"_colors",e)}convert(e){const t=vu(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[s,i]of this._colors)if(i.every((n,a)=>n===t[a]))return If._colorsMapping.get(s);return t}getHexCode(e){const t=this._colors.get(e);return t?_.makeHexColor(...t):e}};O(If,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Np=If;var yl,vs,bl,$t,Jt,Al,wl,Sl,je,El,Gs,Ae,hr,cr,dr,ur,Di,Vs,Ta,Lc,Nc,xl,Bc,ki,fr,Tl,pr,Fi,Of,fn,Cl,Uc,gr,Ca,Pl,mr,Hc,le,Ct,pn,vr,yr,_c,Il,$c,br,Li,gn,jc,Gc,zs,G,Du,Bp,_v,$v,Zh,jv,Gv,Vv,Up,zv,Wv,Xv,Yv,Ye,hn,Kv,Jv,Hp,Qv,qh,_p;const cl=class cl{constructor(e,t,s,i,n,a,o,l,h,c,u,f,p,m,v,A){y(this,G);y(this,yl,new AbortController);y(this,vs,null);y(this,bl,null);y(this,$t,new Map);y(this,Jt,new Map);y(this,Al,null);y(this,wl,null);y(this,Sl,null);y(this,je,null);y(this,El,null);y(this,Gs,new xA);y(this,Ae,null);y(this,hr,null);y(this,cr,null);y(this,dr,0);y(this,ur,new Set);y(this,Di,null);y(this,Vs,null);y(this,Ta,new Set);O(this,"_editorUndoBar",null);y(this,Lc,!1);y(this,Nc,!1);y(this,xl,!1);y(this,Bc,null);y(this,ki,null);y(this,fr,null);y(this,Tl,null);y(this,pr,!1);y(this,Fi,null);y(this,Of,new EA);y(this,fn,!1);y(this,Cl,!1);y(this,Uc,!1);y(this,gr,null);y(this,Ca,null);y(this,Pl,null);y(this,mr,null);y(this,Hc,null);y(this,le,nt.NONE);y(this,Ct,new Set);y(this,pn,null);y(this,vr,null);y(this,yr,null);y(this,_c,null);y(this,Il,null);y(this,$c,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});y(this,br,[0,0]);y(this,Li,null);y(this,gn,null);y(this,jc,null);y(this,Gc,null);y(this,zs,null);const w=this._signal=r(this,yl).signal;g(this,gn,e),g(this,jc,t),g(this,Gc,s),g(this,Sl,i),g(this,Ae,n),g(this,vr,a),g(this,Il,l),this._eventBus=o;const S={signal:w,...yp};o.on("editingaction",this.onEditingAction.bind(this),S),o.on("pagechanging",this.onPageChanging.bind(this),S),o.on("scalechanging",this.onScaleChanging.bind(this),S),o.on("rotationchanging",this.onRotationChanging.bind(this),S),o.on("setpreference",this.onSetPreference.bind(this),S),o.on("switchannotationeditorparams",x=>this.updateParams(x.type,x.value),S),window.addEventListener("pointerdown",()=>{g(this,Cl,!0)},{capture:!0,signal:w}),window.addEventListener("pointerup",()=>{g(this,Cl,!1)},{capture:!0,signal:w}),window.addEventListener("beforeunload",this.endCurrentEditing.bind(this),{capture:!0,signal:w}),b(this,G,jv).call(this),b(this,G,Yv).call(this),b(this,G,Up).call(this),g(this,je,l.annotationStorage),g(this,Bc,l.filterFactory),g(this,yr,h),g(this,Tl,c||null),g(this,Lc,u),g(this,Nc,f),g(this,xl,p),g(this,Hc,m||null),this.viewParameters={realScale:ha.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=v||null,this._supportsPinchToZoom=A!==!1,n==null||n.setSidebarUiManager(this)}static get _keyboardManager(){const e=cl.prototype,t=a=>r(a,gn).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return Q(this,"_keyboardManager",new Ko([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],e.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:s}],[["Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,gn).contains(o)&&!a.isEnterHandled}],[["Space"],e.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,gn).contains(document.activeElement)}],[["Escape"],e.unselectAll],[["ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:t}],[["ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:t}],[["ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:t}],[["ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:t}]]))}destroy(){var e,t,s,i,n,a,o,l,h;(e=r(this,zs))==null||e.resolve(),g(this,zs,null),(t=r(this,yl))==null||t.abort(),g(this,yl,null),this._signal=null;for(const c of r(this,Jt).values())c.destroy();r(this,Jt).clear(),r(this,$t).clear(),r(this,Ta).clear(),(s=r(this,mr))==null||s.clear(),g(this,vs,null),r(this,Ct).clear(),r(this,Gs).destroy(),(i=r(this,Sl))==null||i.destroy(),(n=r(this,Ae))==null||n.destroy(),(a=r(this,vr))==null||a.destroy(),(o=r(this,Fi))==null||o.hide(),g(this,Fi,null),(l=r(this,Pl))==null||l.destroy(),g(this,Pl,null),g(this,bl,null),r(this,ki)&&(clearTimeout(r(this,ki)),g(this,ki,null)),r(this,Li)&&(clearTimeout(r(this,Li)),g(this,Li,null)),(h=this._editorUndoBar)==null||h.destroy(),g(this,Il,null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return r(this,Hc)}get useNewAltTextFlow(){return r(this,Nc)}get useNewAltTextWhenAddingImage(){return r(this,xl)}get hcmFilter(){return Q(this,"hcmFilter",r(this,yr)?r(this,Bc).addHCMFilter(r(this,yr).foreground,r(this,yr).background):"none")}get direction(){return Q(this,"direction",getComputedStyle(r(this,gn)).direction)}get _highlightColors(){return Q(this,"_highlightColors",r(this,Tl)?new Map(r(this,Tl).split(",").map(e=>(e=e.split("=").map(t=>t.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return Q(this,"highlightColors",null);const t=new Map,s=!!r(this,yr);for(const[i,n]of e){const a=i.endsWith("_HCM");if(s&&a){t.set(i.replace("_HCM",""),n);continue}!s&&!a&&t.set(i,n)}return Q(this,"highlightColors",t)}get highlightColorNames(){return Q(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const t=this.highlightColorNames.get(e);return this._highlightColors.get(t)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),g(this,cr,e)}setMainHighlightColorPicker(e){g(this,Pl,e)}editAltText(e,t=!1){var s;(s=r(this,Sl))==null||s.editAltText(this,e,t)}hasCommentManager(){return!!r(this,Ae)}editComment(e,t,s,i){var n;(n=r(this,Ae))==null||n.showDialog(this,e,t,s,i)}selectComment(e,t){const s=r(this,Jt).get(e),i=s==null?void 0:s.getEditorByUID(t);i==null||i.toggleComment(!0,!0)}updateComment(e){var t;(t=r(this,Ae))==null||t.updateComment(e.getData())}updatePopupColor(e){var t;(t=r(this,Ae))==null||t.updatePopupColor(e)}removeComment(e){var t;(t=r(this,Ae))==null||t.removeComments([e.uid])}deleteComment(e,t){const s=()=>{e.comment=t},i=()=>{var n;(n=this._editorUndoBar)==null||n.show(s,"comment"),this.toggleComment(null),e.comment=null};this.addCommands({cmd:i,undo:s,mustExec:!0})}toggleComment(e,t,s=void 0){var i;(i=r(this,Ae))==null||i.toggleCommentPopup(e,t,s)}makeCommentColor(e,t){var s;return e&&((s=r(this,Ae))==null?void 0:s.makeCommentColor(e,t))||null}getCommentDialogElement(){var e;return((e=r(this,Ae))==null?void 0:e.dialogElement)||null}async waitForEditorsRendered(e){if(r(this,Jt).has(e-1))return;const{resolve:t,promise:s}=Promise.withResolvers(),i=n=>{n.pageNumber===e&&(this._eventBus.off("editorsrendered",i),t())};this._eventBus.on("editorsrendered",i,yp),await s}getSignature(e){var t;(t=r(this,vr))==null||t.getSignature({uiManager:this,editor:e})}get signatureManager(){return r(this,vr)}switchToMode(e,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal,...yp}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,t){this._eventBus.dispatch("setpreference",{source:this,name:e,value:t})}onSetPreference({name:e,value:t}){switch(e){case"enableNewAltTextWhenAddingImage":g(this,xl,t);break}}onPageChanging({pageNumber:e}){g(this,dr,e-1)}deletePage(e){for(const t of this.getEditors(e))t.remove();r(this,Jt).delete(e),r(this,dr)===e&&g(this,dr,0)}focusMainContainer(){r(this,gn).focus()}findParent(e,t){for(const s of r(this,Jt).values()){const{x:i,y:n,width:a,height:o}=s.div.getBoundingClientRect();if(e>=i&&e<=i+a&&t>=n&&t<=n+o)return s}return null}disableUserSelect(e=!1){r(this,jc).classList.toggle("noUserSelect",e)}addShouldRescale(e){r(this,Ta).add(e)}removeShouldRescale(e){r(this,Ta).delete(e)}onScaleChanging({scale:e}){var t;this.commitOrRemove(),this.viewParameters.realScale=e*ha.PDF_TO_CSS_UNITS;for(const s of r(this,Ta))s.onScaleChanging();(t=r(this,cr))==null||t.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e="",t=!1){const s=document.getSelection();if(!s||s.isCollapsed)return;const{anchorNode:i,anchorOffset:n,focusNode:a,focusOffset:o}=s,l=s.toString(),c=b(this,G,Du).call(this,s).closest(".textLayer"),u=this.getSelectionBoxes(c);if(!u)return;s.empty();const f=b(this,G,Bp).call(this,c),p=r(this,le)===nt.NONE,m=()=>{const v=f==null?void 0:f.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:u,anchorNode:i,anchorOffset:n,focusNode:a,focusOffset:o,text:l});p&&this.showAllEditors("highlight",!0,!0),t&&(v==null||v.editComment())};if(p){this.switchToMode(nt.HIGHLIGHT,m);return}m()}commentSelection(e=""){this.highlightSelection(e,!0)}endCurrentEditing(){var e;this.commitOrRemove(),(e=this.currentLayer)==null||e.endDrawingSession(!1)}getAndRemoveDataFromAnnotationStorage(e){if(!r(this,je))return null;const t=`${_h}${e}`,s=r(this,je).getRawValue(t);return s&&r(this,je).remove(t),s}addToAnnotationStorage(e){!e.isEmpty()&&r(this,je)&&!r(this,je).has(e.id)&&r(this,je).setValue(e.id,e)}a11yAlert(e,t=null){const s=r(this,Gc);s&&(s.setAttribute("data-l10n-id",e),t?s.setAttribute("data-l10n-args",JSON.stringify(t)):s.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,r(this,pr)&&(g(this,pr,!1),b(this,G,Zh).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const t of r(this,Ct))if(t.div.contains(e)){g(this,Ca,[t,e]),t._focusEventsAllowed=!1;break}}focus(){if(!r(this,Ca))return;const[e,t]=r(this,Ca);g(this,Ca,null),t.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){b(this,G,Up).call(this),this.setEditingState(!0)}removeEditListeners(){b(this,G,zv).call(this),this.setEditingState(!1)}dragOver(e){for(const{type:t}of e.dataTransfer.items)for(const s of r(this,Vs))if(s.isHandlingMimeForPasting(t)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const t of e.dataTransfer.items)for(const s of r(this,Vs))if(s.isHandlingMimeForPasting(t.type)){s.paste(t,this.currentLayer),e.preventDefault();return}}copy(e){var s;if(e.preventDefault(),(s=r(this,vs))==null||s.commitOrRemove(),!this.hasSelection)return;const t=[];for(const i of r(this,Ct)){const n=i.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:t}=e;for(const n of t.items)for(const a of r(this,Vs))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let s=t.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){st(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const l of s){const h=await i.deserialize(l);if(!h)return;n.push(h)}const a=()=>{for(const l of n)b(this,G,Hp).call(this,l);b(this,G,_p).call(this,n)},o=()=>{for(const l of n)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(n){st(`paste: "${n.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),r(this,le)!==nt.NONE&&!this.isEditorHandlingKeyboard&&cl._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,r(this,pr)&&(g(this,pr,!1),b(this,G,Zh).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(e,t){for(const i of r(this,wl).get(e)||[])i.pageIndex=t;const s=r(this,Al).get(e);s&&(s.pageIndex=t,r(this,Jt).set(t,s),r(this,fn)?s.enable():s.disable())}startUpdatePages(){g(this,Al,new Map(r(this,Jt))),r(this,Jt).clear();const e=g(this,wl,new Map),t=s=>{e.getOrInsertComputed(s.pageIndex,Gh).push(s)};for(const s of r(this,$t).values())t(s);for(const[s,i]of r(this,je))s.startsWith(_h)&&!r(this,$t).has(s)&&Number.isInteger(i==null?void 0:i.pageIndex)&&t(i)}endUpdatePages(){g(this,Al,null),g(this,wl,null)}clonePage(e,t){for(const s of this.getEditors(e)){const i=s.serialize(s.mode!==nt.HIGHLIGHT);i&&(i.pageIndex=t,i.id=this.getId(),i.isClone=!0,delete i.popupRef,r(this,je).setValue(i.id,i))}}findClonesForPage(e){const t=[],{pageIndex:s}=e;for(const[i,n]of r(this,je))n.pageIndex===s&&n.isClone&&(r(this,je).remove(i),t.push(e.deserialize(n).then(a=>{a&&(a.isClone=!0,e.addOrRebuild(a))})));return Promise.all(t)}setEditingState(e){e?(b(this,G,Gv).call(this),b(this,G,Wv).call(this),b(this,G,Ye).call(this,{isEditing:r(this,le)!==nt.NONE,isEmpty:b(this,G,qh).call(this),hasSomethingToUndo:r(this,Gs).hasSomethingToUndo(),hasSomethingToRedo:r(this,Gs).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,G,Vv).call(this),b(this,G,Xv).call(this),b(this,G,Ye).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!r(this,Vs)){g(this,Vs,e);for(const t of r(this,Vs))b(this,G,hn).call(this,t.defaultPropertiesToUpdate)}}getId(){return r(this,Of).id}get currentLayer(){return r(this,Jt).get(r(this,dr))}getLayer(e){return r(this,Jt).get(e)}get currentPageIndex(){return r(this,dr)}addLayer(e){r(this,Jt).set(e.pageIndex,e),r(this,fn)?e.enable():e.disable()}removeLayer(e){r(this,Jt).delete(e.pageIndex)}async updateMode(e,t=null,s=!1,i=!1,n=!1,a=!1){var o,l,h,c,u,f;if(r(this,le)!==e&&!(r(this,zs)&&(await r(this,zs).promise,!r(this,zs)))){if(g(this,zs,Promise.withResolvers()),(o=r(this,cr))==null||o.commitOrRemove(),r(this,le)===nt.POPUP&&((l=r(this,Ae))==null||l.hideSidebar()),(h=r(this,Ae))==null||h.destroyPopup(),g(this,le,e),e===nt.NONE){this.setEditingState(!1),b(this,G,Jv).call(this);for(const p of r(this,$t).values())p.hideStandaloneCommentButton();(c=this._editorUndoBar)==null||c.hide(),this.toggleComment(null),r(this,zs).resolve();return}for(const p of r(this,$t).values())p.addStandaloneCommentButton();e===nt.SIGNATURE&&await((u=r(this,vr))==null?void 0:u.loadSignatures()),s&&_e.clearPointerType(),this.setEditingState(!0),await b(this,G,Kv).call(this),this.unselectAll();for(const p of r(this,Jt).values())p.updateMode(e);if(e===nt.POPUP){r(this,bl)||g(this,bl,await r(this,Il).getAnnotationsByType(new Set(r(this,Vs).map(v=>v._editorType))));const p=new Set,m=[];for(const v of r(this,$t).values()){const{annotationElementId:A,hasComment:w,deleted:S}=v;A&&p.add(A),w&&!S&&m.push(v.getData())}for(const v of r(this,bl)){const{id:A,popupRef:w,contentsObj:S}=v;w&&(S!=null&&S.str)&&!p.has(A)&&!r(this,ur).has(A)&&m.push(v)}(f=r(this,Ae))==null||f.showSidebar(m)}if(!t){i&&this.addNewEditorFromKeyboard(),r(this,zs).resolve();return}for(const p of r(this,$t).values())p.uid===t?(this.setSelected(p),a?p.editComment():n?p.enterInEditMode():p.focus()):p.unselect();r(this,zs).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==r(this,le)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,t){if(r(this,Vs)){switch(e){case ft.CREATE:this.currentLayer.addNewEditor(t);return;case ft.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(r(this,_c)||g(this,_c,new Map)).set(e,t),this.showAllEditors("highlight",t);break}if(this.hasSelection)for(const s of r(this,Ct))s.updateParams(e,t);else for(const s of r(this,Vs))s.updateDefaultParams(e,t)}}showAllEditors(e,t,s=!1){var n;for(const a of r(this,$t).values())a.editorType===e&&a.show(t);(((n=r(this,_c))==null?void 0:n.get(ft.HIGHLIGHT_SHOW_ALL))??!0)!==t&&b(this,G,hn).call(this,[[ft.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(e=!1){if(r(this,Uc)!==e){g(this,Uc,e);for(const t of r(this,Jt).values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}*getEditors(e){for(const t of r(this,$t).values())t.pageIndex===e&&(yield t)}getEditor(e){return r(this,$t).get(e)}addEditor(e){r(this,$t).set(e.id,e)}removeEditor(e){var t,s;e.div.contains(document.activeElement)&&(r(this,ki)&&clearTimeout(r(this,ki)),g(this,ki,setTimeout(()=>{this.focusMainContainer(),g(this,ki,null)},0))),r(this,$t).delete(e.id),e.annotationElementId&&((t=r(this,mr))==null||t.delete(e.annotationElementId)),this.unselect(e),(!e.annotationElementId||!r(this,ur).has(e.annotationElementId))&&((s=r(this,je))==null||s.remove(e.id))}addDeletedAnnotationElement(e){r(this,ur).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return r(this,ur).has(e)}removeDeletedAnnotationElement(e){r(this,ur).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){r(this,vs)!==e&&(g(this,vs,e),e&&b(this,G,hn).call(this,e.propertiesToUpdate))}updateUI(e){r(this,G,Qv)===e&&b(this,G,hn).call(this,e.propertiesToUpdate)}updateUIForDefaultProperties(e){b(this,G,hn).call(this,e.defaultPropertiesToUpdate)}toggleSelected(e){if(r(this,Ct).has(e)){r(this,Ct).delete(e),e.unselect(),b(this,G,Ye).call(this,{hasSelectedEditor:this.hasSelection});return}r(this,Ct).add(e),e.select(),b(this,G,hn).call(this,e.propertiesToUpdate),b(this,G,Ye).call(this,{hasSelectedEditor:!0})}setSelected(e){var t,s;this.updateToolbar({mode:e.mode,editId:e.uid}),(t=r(this,cr))==null||t.commitOrRemove();for(const i of r(this,Ct))i!==e&&i.unselect();(s=r(this,Ae))==null||s.destroyPopup(),r(this,Ct).clear(),r(this,Ct).add(e),e.select(),b(this,G,hn).call(this,e.propertiesToUpdate),b(this,G,Ye).call(this,{hasSelectedEditor:!0})}get firstSelectedEditor(){return r(this,Ct).values().next().value}unselect(e){e.unselect(),r(this,Ct).delete(e),b(this,G,Ye).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return r(this,Ct).size!==0}get isEnterHandled(){return r(this,Ct).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var e;r(this,Gs).undo(),b(this,G,Ye).call(this,{hasSomethingToUndo:r(this,Gs).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,G,qh).call(this)}),(e=this._editorUndoBar)==null||e.hide()}redo(){r(this,Gs).redo(),b(this,G,Ye).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:r(this,Gs).hasSomethingToRedo(),isEmpty:b(this,G,qh).call(this)})}addCommands(e){r(this,Gs).add(e),b(this,G,Ye).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,G,qh).call(this)})}cleanUndoStack(e){r(this,Gs).cleanType(e)}delete(){var n;this.commitOrRemove();const e=(n=this.currentLayer)==null?void 0:n.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const t=e?[e]:[...r(this,Ct)],s=()=>{var a;(a=this._editorUndoBar)==null||a.show(i,t.length===1?t[0].editorType:t.length);for(const o of t)o.remove()},i=()=>{for(const a of t)b(this,G,Hp).call(this,a)};this.addCommands({cmd:s,undo:i,mustExec:!0})}commitOrRemove(){var e;(e=r(this,vs))==null||e.commitOrRemove()}hasSomethingToControl(){return r(this,vs)||this.hasSelection}selectAll(){for(const e of r(this,Ct))e.commit();b(this,G,_p).call(this,r(this,$t).values())}unselectAll(){var e,t;if(!(r(this,vs)&&(r(this,vs).commitOrRemove(),r(this,le)!==nt.NONE))&&!((e=r(this,cr))!=null&&e.commitOrRemove())&&((t=r(this,Ae))==null||t.destroyPopup(),!!this.hasSelection)){for(const s of r(this,Ct))s.unselect();r(this,Ct).clear(),b(this,G,Ye).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,t,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;r(this,br)[0]+=e,r(this,br)[1]+=t;const[i,n]=r(this,br),a=[...r(this,Ct)],o=1e3;r(this,Li)&&clearTimeout(r(this,Li)),g(this,Li,setTimeout(()=>{g(this,Li,null),r(this,br)[0]=r(this,br)[1]=0,this.addCommands({cmd:()=>{for(const l of a)r(this,$t).has(l.id)&&(l.translateInPage(i,n),l.translationDone())},undo:()=>{for(const l of a)r(this,$t).has(l.id)&&(l.translateInPage(-i,-n),l.translationDone())},mustExec:!1})},o));for(const l of a)l.translateInPage(e,t),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),g(this,Di,new Map);for(const e of r(this,Ct))r(this,Di).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!r(this,Di))return!1;this.disableUserSelect(!1);const e=r(this,Di);g(this,Di,null);let t=!1;for(const[{x:i,y:n,pageIndex:a},o]of e)o.newX=i,o.newY=n,o.newPageIndex=a,t||(t=i!==o.savedX||n!==o.savedY||a!==o.savedPageIndex);if(!t)return!1;const s=(i,n,a,o)=>{if(r(this,$t).has(i.id)){const l=r(this,Jt).get(o);l?i._setParentAndPosition(l,n,a):(i.pageIndex=o,i.x=n,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:a,newPageIndex:o}]of e)s(i,n,a,o)},undo:()=>{for(const[i,{savedX:n,savedY:a,savedPageIndex:o}]of e)s(i,n,a,o)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(r(this,Di))for(const s of r(this,Di).keys())s.drag(e,t)}rebuild(e){if(e.parent===null){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||r(this,Ct).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return r(this,vs)===e}getActive(){return r(this,vs)}getMode(){return r(this,le)}isEditingMode(){return r(this,le)!==nt.NONE}get imageManager(){return Q(this,"imageManager",new Lp)}getSelectionBoxes(e){if(!e)return null;const t=document.getSelection();for(let h=0,c=t.rangeCount;h<c;h++)if(!e.contains(t.getRangeAt(h).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:a}=e.getBoundingClientRect();let o;switch(e.getAttribute("data-main-rotation")){case"90":o=(h,c,u,f)=>({x:(c-i)/a,y:1-(h+u-s)/n,width:f/a,height:u/n});break;case"180":o=(h,c,u,f)=>({x:1-(h+u-s)/n,y:1-(c+f-i)/a,width:u/n,height:f/a});break;case"270":o=(h,c,u,f)=>({x:1-(c+f-i)/a,y:(h-s)/n,width:f/a,height:u/n});break;default:o=(h,c,u,f)=>({x:(h-s)/n,y:(c-i)/a,width:u/n,height:f/a});break}const l=[];for(let h=0,c=t.rangeCount;h<c;h++){const u=t.getRangeAt(h);if(!u.collapsed)for(const{x:f,y:p,width:m,height:v}of u.getClientRects())m===0||v===0||l.push(o(f,p,m,v))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:t}){(r(this,El)||g(this,El,new Map)).set(e,t)}removeChangedExistingAnnotation({annotationElementId:e}){var t;(t=r(this,El))==null||t.delete(e)}renderAnnotationElement(e){var i;const t=(i=r(this,El))==null?void 0:i.get(e.data.id);if(!t)return;const s=r(this,je).getRawValue(t);s&&(r(this,le)===nt.NONE&&!s.hasBeenModified||s.renderAnnotationElement(e))}setMissingCanvas(e,t,s){var n;const i=(n=r(this,mr))==null?void 0:n.get(e);i&&(i.setCanvas(t,s),r(this,mr).delete(e))}addMissingCanvas(e,t){(r(this,mr)||g(this,mr,new Map)).set(e,t)}};yl=new WeakMap,vs=new WeakMap,bl=new WeakMap,$t=new WeakMap,Jt=new WeakMap,Al=new WeakMap,wl=new WeakMap,Sl=new WeakMap,je=new WeakMap,El=new WeakMap,Gs=new WeakMap,Ae=new WeakMap,hr=new WeakMap,cr=new WeakMap,dr=new WeakMap,ur=new WeakMap,Di=new WeakMap,Vs=new WeakMap,Ta=new WeakMap,Lc=new WeakMap,Nc=new WeakMap,xl=new WeakMap,Bc=new WeakMap,ki=new WeakMap,fr=new WeakMap,Tl=new WeakMap,pr=new WeakMap,Fi=new WeakMap,Of=new WeakMap,fn=new WeakMap,Cl=new WeakMap,Uc=new WeakMap,gr=new WeakMap,Ca=new WeakMap,Pl=new WeakMap,mr=new WeakMap,Hc=new WeakMap,le=new WeakMap,Ct=new WeakMap,pn=new WeakMap,vr=new WeakMap,yr=new WeakMap,_c=new WeakMap,Il=new WeakMap,$c=new WeakMap,br=new WeakMap,Li=new WeakMap,gn=new WeakMap,jc=new WeakMap,Gc=new WeakMap,zs=new WeakMap,G=new WeakSet,Du=function({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e},Bp=function(e){const{currentLayer:t}=this;if(t.hasTextLayer(e))return t;for(const s of r(this,Jt).values())if(s.hasTextLayer(e))return s;return null},_v=function(){const e=document.getSelection();if(!e||e.isCollapsed)return;const s=b(this,G,Du).call(this,e).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(r(this,Fi)||g(this,Fi,new wA(this)),r(this,Fi).show(s,i,this.direction==="ltr"))},$v=function(){var n,a,o;const e=document.getSelection();if(!e||e.isCollapsed){r(this,pn)&&((n=r(this,Fi))==null||n.hide(),g(this,pn,null),b(this,G,Ye).call(this,{hasSelectedText:!1}));return}const{anchorNode:t}=e;if(t===r(this,pn))return;const i=b(this,G,Du).call(this,e).closest(".textLayer");if(!i){r(this,pn)&&((a=r(this,Fi))==null||a.hide(),g(this,pn,null),b(this,G,Ye).call(this,{hasSelectedText:!1}));return}if((o=r(this,Fi))==null||o.hide(),g(this,pn,t),b(this,G,Ye).call(this,{hasSelectedText:!0}),!(r(this,le)!==nt.HIGHLIGHT&&r(this,le)!==nt.NONE)&&(r(this,le)===nt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),g(this,pr,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=r(this,le)===nt.HIGHLIGHT?b(this,G,Bp).call(this,i):null;if(l==null||l.toggleDrawing(),r(this,Cl)){const h=new AbortController,c=this.combinedSignal(h),u=f=>{f.type==="pointerup"&&f.button!==0||(h.abort(),l==null||l.toggleDrawing(!0),f.type==="pointerup"&&b(this,G,Zh).call(this,"main_toolbar"))};window.addEventListener("pointerup",u,{signal:c}),window.addEventListener("blur",u,{signal:c})}else l==null||l.toggleDrawing(!0),b(this,G,Zh).call(this,"main_toolbar")}},Zh=function(e=""){r(this,le)===nt.HIGHLIGHT?this.highlightSelection(e):r(this,Lc)&&b(this,G,_v).call(this)},jv=function(){document.addEventListener("selectionchange",b(this,G,$v).bind(this),{signal:this._signal})},Gv=function(){if(r(this,fr))return;g(this,fr,new AbortController);const e=this.combinedSignal(r(this,fr));window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})},Vv=function(){var e;(e=r(this,fr))==null||e.abort(),g(this,fr,null)},Up=function(){if(r(this,gr))return;g(this,gr,new AbortController);const e=this.combinedSignal(r(this,gr));window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})},zv=function(){var e;(e=r(this,gr))==null||e.abort(),g(this,gr,null)},Wv=function(){if(r(this,hr))return;g(this,hr,new AbortController);const e=this.combinedSignal(r(this,hr));document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})},Xv=function(){var e;(e=r(this,hr))==null||e.abort(),g(this,hr,null)},Yv=function(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})},Ye=function(e){Object.entries(e).some(([s,i])=>r(this,$c)[s]!==i)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(r(this,$c),e)}),r(this,le)===nt.HIGHLIGHT&&e.hasSelectedEditor===!1&&b(this,G,hn).call(this,[[ft.HIGHLIGHT_FREE,!0]]))},hn=function(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})},Kv=async function(){if(!r(this,fn)){g(this,fn,!0);const e=[];for(const t of r(this,Jt).values())e.push(t.enable());await Promise.all(e);for(const t of r(this,$t).values())t.enable()}},Jv=function(){if(this.unselectAll(),r(this,fn)){g(this,fn,!1);for(const e of r(this,Jt).values())e.disable();for(const e of r(this,$t).values())e.disable()}},Hp=function(e){const t=r(this,Jt).get(e.pageIndex);t?t.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))},Qv=function(){let e=null;for(e of r(this,Ct));return e},qh=function(){if(r(this,$t).size===0)return!0;if(r(this,$t).size===1)for(const e of r(this,$t).values())return e.isEmpty();return!1},_p=function(e){for(const t of r(this,Ct))t.unselect();r(this,Ct).clear();for(const t of e)t.isEmpty()||(r(this,Ct).add(t),t.select());b(this,G,Ye).call(this,{hasSelectedEditor:this.hasSelection})},O(cl,"TRANSLATE_SMALL",1),O(cl,"TRANSLATE_BIG",10);let Jo=cl;var we,Ni,li,Ol,Bi,ys,Ml,Ui,hs,mn,Pa,Hi,Ar,Si,tc,ku;const Ke=class Ke{constructor(e){y(this,Si);y(this,we,null);y(this,Ni,!1);y(this,li,null);y(this,Ol,null);y(this,Bi,null);y(this,ys,null);y(this,Ml,!1);y(this,Ui,null);y(this,hs,null);y(this,mn,null);y(this,Pa,null);y(this,Hi,!1);g(this,hs,e),g(this,Hi,e._uiManager.useNewAltTextFlow),r(Ke,Ar)||g(Ke,Ar,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(e){Ke._l10n??(Ke._l10n=e)}async render(){const e=g(this,li,document.createElement("button"));e.className="altText",e.tabIndex="0";const t=g(this,Ol,document.createElement("span"));e.append(t),r(this,Hi)?(e.classList.add("new"),e.setAttribute("data-l10n-id",r(Ke,Ar).missing),t.setAttribute("data-l10n-id",r(Ke,Ar)["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=r(this,hs)._uiManager._signal;e.addEventListener("contextmenu",Ei,{signal:s}),e.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),r(this,hs)._uiManager.editAltText(r(this,hs)),r(this,Hi)&&r(this,hs)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:r(this,Si,tc)}})};return e.addEventListener("click",i,{capture:!0,signal:s}),e.addEventListener("keydown",n=>{n.target===e&&n.key==="Enter"&&(g(this,Ml,!0),i(n))},{signal:s}),await b(this,Si,ku).call(this),e}finish(){r(this,li)&&(r(this,li).focus({focusVisible:r(this,Ml)}),g(this,Ml,!1))}isEmpty(){return r(this,Hi)?r(this,we)===null:!r(this,we)&&!r(this,Ni)}hasData(){return r(this,Hi)?r(this,we)!==null||!!r(this,mn):this.isEmpty()}get guessedText(){return r(this,mn)}async setGuessedText(e){r(this,we)===null&&(g(this,mn,e),g(this,Pa,await Ke._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e})),b(this,Si,ku).call(this))}toggleAltTextBadge(e=!1){var t;if(!r(this,Hi)||r(this,we)){(t=r(this,Ui))==null||t.remove(),g(this,Ui,null);return}if(!r(this,Ui)){const s=g(this,Ui,document.createElement("div"));s.className="noAltTextBadge",r(this,hs).div.append(s)}r(this,Ui).classList.toggle("hidden",!e)}serialize(e){let t=r(this,we);return!e&&r(this,mn)===t&&(t=r(this,Pa)),{altText:t,decorative:r(this,Ni),guessedText:r(this,mn),textWithDisclaimer:r(this,Pa)}}get data(){return{altText:r(this,we),decorative:r(this,Ni)}}set data({altText:e,decorative:t,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(g(this,mn,s),g(this,Pa,i)),!(r(this,we)===e&&r(this,Ni)===t)&&(n||(g(this,we,e),g(this,Ni,t)),b(this,Si,ku).call(this))}toggle(e=!1){r(this,li)&&(!e&&r(this,ys)&&(clearTimeout(r(this,ys)),g(this,ys,null)),r(this,li).disabled=!e)}shown(){r(this,hs)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:r(this,Si,tc)}})}destroy(){var e,t;(e=r(this,li))==null||e.remove(),g(this,li,null),g(this,Ol,null),g(this,Bi,null),(t=r(this,Ui))==null||t.remove(),g(this,Ui,null)}};we=new WeakMap,Ni=new WeakMap,li=new WeakMap,Ol=new WeakMap,Bi=new WeakMap,ys=new WeakMap,Ml=new WeakMap,Ui=new WeakMap,hs=new WeakMap,mn=new WeakMap,Pa=new WeakMap,Hi=new WeakMap,Ar=new WeakMap,Si=new WeakSet,tc=function(){return r(this,we)&&"added"||r(this,we)===null&&this.guessedText&&"review"||"missing"},ku=async function(){var i,n,a;const e=r(this,li);if(!e)return;if(r(this,Hi)){if(e.classList.toggle("done",!!r(this,we)),e.setAttribute("data-l10n-id",r(Ke,Ar)[r(this,Si,tc)]),(i=r(this,Ol))==null||i.setAttribute("data-l10n-id",r(Ke,Ar)[`${r(this,Si,tc)}-label`]),!r(this,we)){(n=r(this,Bi))==null||n.remove();return}}else{if(!r(this,we)&&!r(this,Ni)){e.classList.remove("done"),(a=r(this,Bi))==null||a.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let t=r(this,Bi);if(!t){g(this,Bi,t=document.createElement("span")),t.className="tooltip",t.setAttribute("role","tooltip"),t.id=`alt-text-tooltip-${r(this,hs).id}`;const o=100,l=r(this,hs)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(r(this,ys)),g(this,ys,null)},{once:!0}),e.addEventListener("mouseenter",()=>{g(this,ys,setTimeout(()=>{g(this,ys,null),r(this,Bi).classList.add("show"),r(this,hs)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),e.addEventListener("mouseleave",()=>{var h;r(this,ys)&&(clearTimeout(r(this,ys)),g(this,ys,null)),(h=r(this,Bi))==null||h.classList.remove("show")},{signal:l})}r(this,Ni)?t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(t.removeAttribute("data-l10n-id"),t.textContent=r(this,we)),t.parentNode||e.append(t);const s=r(this,hs).getElementForAltText();s==null||s.setAttribute("aria-describedby",t.id)},y(Ke,Ar,null),O(Ke,"_l10n",null);let bf=Ke;var Ie,Ws,Ia,Nt,Vc,wr,Xs,Sr,Er,Oa,zc,$p;class Au{constructor(e){y(this,zc);y(this,Ie,null);y(this,Ws,null);y(this,Ia,!1);y(this,Nt,null);y(this,Vc,null);y(this,wr,null);y(this,Xs,null);y(this,Sr,null);y(this,Er,!1);y(this,Oa,null);g(this,Nt,e)}renderForToolbar(){const e=g(this,Ws,document.createElement("button"));return e.className="comment",b(this,zc,$p).call(this,e,!1)}renderForStandalone(){const e=g(this,Ie,document.createElement("button"));e.className="annotationCommentButton";const t=r(this,Nt).commentButtonPosition;if(t){const{style:s}=e;s.insetInlineEnd=`calc(${100*(r(this,Nt)._uiManager.direction==="ltr"?1-t[0]:t[0])}% - var(--comment-button-dim))`,s.top=`calc(${100*t[1]}% - var(--comment-button-dim))`;const i=r(this,Nt).commentButtonColor;i&&(s.backgroundColor=i)}return b(this,zc,$p).call(this,e,!0)}focusButton(){setTimeout(()=>{var e;(e=r(this,Ie)??r(this,Ws))==null||e.focus()},0)}onUpdatedColor(){if(!r(this,Ie))return;const e=r(this,Nt).commentButtonColor;e&&(r(this,Ie).style.backgroundColor=e),r(this,Nt)._uiManager.updatePopupColor(r(this,Nt))}get commentButtonWidth(){var e;return(((e=r(this,Ie))==null?void 0:e.getBoundingClientRect().width)??0)/r(this,Nt).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(r(this,Oa))return r(this,Oa);if(!r(this,Ie))return null;const{x:e,y:t,height:s}=r(this,Ie).getBoundingClientRect(),{x:i,y:n,width:a,height:o}=r(this,Nt).parent.boundingClientRect;return[(e-i)/a,(t+s-n)/o]}set commentPopupPositionInLayer(e){g(this,Oa,e)}hasDefaultPopupPosition(){return r(this,Oa)===null}removeStandaloneCommentButton(){var e;(e=r(this,Ie))==null||e.remove(),g(this,Ie,null)}removeToolbarCommentButton(){var e;(e=r(this,Ws))==null||e.remove(),g(this,Ws,null)}setCommentButtonStates({selected:e,hasPopup:t}){r(this,Ie)&&(r(this,Ie).classList.toggle("selected",e),r(this,Ie).ariaExpanded=t)}edit(e){const t=this.commentPopupPositionInLayer;let s,i;if(t)[s,i]=t;else{[s,i]=r(this,Nt).commentButtonPosition;const{width:c,height:u,x:f,y:p}=r(this,Nt);s=f+s*c,i=p+i*u}const n=r(this,Nt).parent.boundingClientRect,{x:a,y:o,width:l,height:h}=n;r(this,Nt)._uiManager.editComment(r(this,Nt),a+s*l,o+i*h,{...e,parentDimensions:n})}finish(){r(this,Ws)&&(r(this,Ws).focus({focusVisible:r(this,Ia)}),g(this,Ia,!1))}isDeleted(){return r(this,Er)||r(this,Xs)===""}isEmpty(){return r(this,Xs)===null}hasBeenEdited(){return this.isDeleted()||r(this,Xs)!==r(this,Vc)}serialize(){return this.data}get data(){return{text:r(this,Xs),richText:r(this,wr),date:r(this,Sr),deleted:this.isDeleted()}}set data(e){if(e!==r(this,Xs)&&g(this,wr,null),e===null){g(this,Xs,""),g(this,Er,!0);return}g(this,Xs,e),g(this,Sr,new Date),g(this,Er,!1)}restoreData({text:e,richText:t,date:s}){g(this,Xs,e),g(this,wr,t),g(this,Sr,s),g(this,Er,!1)}setInitialText(e,t=null){g(this,Vc,e),this.data=e,g(this,Sr,null),g(this,wr,t)}shown(){}destroy(){var e,t;(e=r(this,Ws))==null||e.remove(),g(this,Ws,null),(t=r(this,Ie))==null||t.remove(),g(this,Ie,null),g(this,Xs,""),g(this,wr,null),g(this,Sr,null),g(this,Nt,null),g(this,Ia,!1),g(this,Er,!1)}}Ie=new WeakMap,Ws=new WeakMap,Ia=new WeakMap,Nt=new WeakMap,Vc=new WeakMap,wr=new WeakMap,Xs=new WeakMap,Sr=new WeakMap,Er=new WeakMap,Oa=new WeakMap,zc=new WeakSet,$p=function(e,t){if(!r(this,Nt)._uiManager.hasCommentManager())return null;e.tabIndex="0",e.ariaHasPopup="dialog",t?(e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(e.ariaControlsElements=[r(this,Nt)._uiManager.getCommentDialogElement()],e.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));const s=r(this,Nt)._uiManager._signal;if(!(s instanceof AbortSignal)||s.aborted)return e;e.addEventListener("contextmenu",Ei,{signal:s}),t&&(e.addEventListener("focusin",n=>{r(this,Nt)._focusEventsAllowed=!1,me(n)},{capture:!0,signal:s}),e.addEventListener("focusout",n=>{r(this,Nt)._focusEventsAllowed=!0,me(n)},{capture:!0,signal:s})),e.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),e===r(this,Ws)?this.edit():r(this,Nt).toggleComment(!0)};return e.addEventListener("click",i,{capture:!0,signal:s}),e.addEventListener("keydown",n=>{n.target===e&&n.key==="Enter"&&(g(this,Ia,!0),i(n))},{signal:s}),e.addEventListener("pointerenter",()=>{r(this,Nt).toggleComment(!1,!0)},{signal:s}),e.addEventListener("pointerleave",()=>{r(this,Nt).toggleComment(!1,!1)},{signal:s}),e};function qm(d){d.preventDefault()}const tv=1e-4;function bp(d){return d.cancelable?(me(d),!0):(d.stopPropagation(),!1)}var Rl,xr,Wc,Xc,Yc,Kc,Jc,Ma,Tr,vn,Ra,_i,yn,Da,bn,Cr,zt,qv,jp,Gp,Vp,Fu,ty,ey,zp;class Zv{constructor({container:e,isPinchingDisabled:t=null,isPinchingStopped:s=null,onPinchStart:i=null,onPinching:n=null,onPinchEnd:a=null,onPanning:o=null,signal:l}){y(this,zt);y(this,Rl);y(this,xr,!1);y(this,Wc,null);y(this,Xc);y(this,Yc);y(this,Kc);y(this,Jc);y(this,Ma);y(this,Tr,!1);y(this,vn,null);y(this,Ra);y(this,_i,new Set);y(this,yn,null);y(this,Da);y(this,bn,null);y(this,Cr,0);g(this,Rl,e),g(this,Wc,s),g(this,Xc,t),g(this,Yc,i),g(this,Kc,n),g(this,Jc,a),g(this,Ma,o),g(this,Da,new AbortController),g(this,Ra,AbortSignal.any([l,r(this,Da).signal])),e.addEventListener("touchstart",b(this,zt,qv).bind(this),{passive:!1,signal:r(this,Ra)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/xi.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/xi.pixelRatio}destroy(){var e,t;b(this,zt,zp).call(this),r(this,_i).clear(),(e=r(this,Da))==null||e.abort(),g(this,Da,null),(t=r(this,vn))==null||t.abort(),g(this,vn,null)}}Rl=new WeakMap,xr=new WeakMap,Wc=new WeakMap,Xc=new WeakMap,Yc=new WeakMap,Kc=new WeakMap,Jc=new WeakMap,Ma=new WeakMap,Tr=new WeakMap,vn=new WeakMap,Ra=new WeakMap,_i=new WeakMap,yn=new WeakMap,Da=new WeakMap,bn=new WeakMap,Cr=new WeakMap,zt=new WeakSet,qv=function(e){var s,i;if((s=r(this,Xc))!=null&&s.call(this))return;b(this,zt,Gp).call(this,e);const t=r(this,_i);for(const{identifier:n}of e.changedTouches)t.add(n);if(t.size===1){b(this,zt,jp).call(this);return}if(!r(this,bn)){g(this,bn,new AbortController);const n=AbortSignal.any([r(this,Ra),r(this,bn).signal]),a=r(this,Rl),o={signal:n,capture:!1,passive:!1};a.addEventListener("touchmove",b(this,zt,ty).bind(this),o);const l=b(this,zt,ey).bind(this);a.addEventListener("touchend",l,o),a.addEventListener("touchcancel",l,o),o.capture=!0,a.addEventListener("pointerdown",me,o),a.addEventListener("pointermove",me,o),a.addEventListener("pointercancel",qm,o),a.addEventListener("pointerup",qm,o),(i=r(this,Yc))==null||i.call(this)}g(this,Tr,bp(e)),b(this,zt,Fu).call(this,e)},jp=function(){if(r(this,vn))return;const e=g(this,vn,new AbortController),t=AbortSignal.any([r(this,Ra),e.signal]),s=r(this,Rl),i={capture:!0,signal:t,passive:!1},n=a=>{var o;a.pointerType==="touch"&&((o=r(this,vn))==null||o.abort(),g(this,vn,null))};s.addEventListener("pointerdown",a=>{a.pointerType==="touch"&&(me(a),n(a))},i),s.addEventListener("pointerup",n,i),s.addEventListener("pointercancel",n,i)},Gp=function(e){const t=r(this,_i);if(t.size===0)return;const s=g(this,_i,new Set);for(const{identifier:i}of e.touches)t.has(i)&&s.add(i)},Vp=function(e){const t=r(this,_i),s=[];for(const i of e.touches)t.has(i.identifier)&&s.push(i);return s},Fu=function(e){var n;const t=b(this,zt,Vp).call(this,e);if(t.length!==2||(n=r(this,Wc))!=null&&n.call(this)){g(this,yn,null);return}const[s,i]=t;g(this,yn,{touch0X:s.screenX,touch0Y:s.screenY,touch1X:i.screenX,touch1Y:i.screenY,panX:(s.clientX+i.clientX)/2,panY:(s.clientY+i.clientY)/2,screenPanX:(s.screenX+i.screenX)/2,screenPanY:(s.screenY+i.screenY)/2})},ty=function(e){var k,L,Y,z;if(!r(this,yn))return;const t=b(this,zt,Vp).call(this,e);if(t.length!==2)return;const s=r(this,Tr);if(g(this,Tr,bp(e)),!r(this,Tr))return;if(!s){b(this,zt,Fu).call(this,e);return}const[i,n]=t,{screenX:a,screenY:o}=i,{screenX:l,screenY:h}=n,c=r(this,yn),{touch0X:u,touch0Y:f,touch1X:p,touch1Y:m,panX:v,panY:A}=c,w=p-u,S=m-f,x=l-a,C=h-o,E=(i.clientX+n.clientX)/2,T=(i.clientY+n.clientY)/2;c.panX=E,c.panY=T;const P=E-v,M=T-A,I=(a+l)/2,D=(o+h)/2,R=Math.hypot(I-c.screenPanX,D-c.screenPanY);c.screenPanX=I,c.screenPanY=D;const U=Math.hypot(x,C),B=Math.hypot(w,S),N=r(this,xr)?this.MIN_TOUCH_DISTANCE_TO_SCALE:this.MIN_TOUCH_DISTANCE_TO_PINCH+2*R;if(U<tv||B<tv||Math.abs(B-U)<=N){(P||M)&&((k=r(this,Ma))==null||k.call(this,P,M));return}c.touch0X=a,c.touch0Y=o,c.touch1X=l,c.touch1Y=h;const W=Math.sign(U-B);if(!r(this,xr)){g(this,xr,!0),g(this,Cr,W),(P||M)&&((L=r(this,Ma))==null||L.call(this,P,M));return}if(r(this,Cr)){const lt=r(this,Cr);if(g(this,Cr,0),W!==lt&&Math.abs(U-B)<=2*R){g(this,xr,!1),(P||M)&&((Y=r(this,Ma))==null||Y.call(this,P,M));return}}(z=r(this,Kc))==null||z.call(this,[v,A],B,U,P,M)},ey=function(e){if(b(this,zt,Gp).call(this,e),r(this,_i).size>=2){b(this,zt,Fu).call(this,e);return}const t=!!r(this,yn);b(this,zt,zp).call(this),r(this,_i).size===1&&b(this,zt,jp).call(this),t&&bp(e)},zp=function(){var e;g(this,yn,null),g(this,xr,!1),g(this,Cr,0),g(this,Tr,!1),r(this,bn)&&(r(this,bn).abort(),g(this,bn,null),(e=r(this,Jc))==null||e.call(this))};var ka,hi,jt,Et,An,Dl,Pr,Qc,Oe,Fa,wn,Ys,Ir,Zc,La,bs,qc,Na,Sn,$i,kl,Fl,Ks,Or,td,Mf,Z,Wp,ed,Xp,Lu,sy,iy,Yp,Nu,Kp,ny,ry,ay,Jp,oy,Qp,Zp,ly,hy,cy,qp,ec;const et=class et{constructor(e){y(this,Z);y(this,ka,null);y(this,hi,null);y(this,jt,null);y(this,Et,null);y(this,An,null);y(this,Dl,!1);y(this,Pr,null);y(this,Qc,"");y(this,Oe,null);y(this,Fa,null);y(this,wn,null);y(this,Ys,null);y(this,Ir,null);y(this,Zc,"");y(this,La,!1);y(this,bs,null);y(this,qc,!1);y(this,Na,!1);y(this,Sn,!1);y(this,$i,null);y(this,kl,0);y(this,Fl,0);y(this,Ks,null);y(this,Or,null);O(this,"isSelected",!1);O(this,"_isCopy",!1);O(this,"_editToolbar",null);O(this,"_initialOptions",Object.create(null));O(this,"_initialData",null);O(this,"_isVisible",!0);O(this,"_uiManager",null);O(this,"_focusEventsAllowed",!0);y(this,td,!1);y(this,Mf,et._zIndex++);this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null,this.annotationElementId=e.annotationElementId||null,this.creationDate=e.creationDate||new Date,this.modificationDate=e.modificationDate||null,this.canAddComment=!0;const{rotation:t,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:a}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,a];const[o,l]=this.parentDimensions;this.x=e.x/o,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=et.prototype._resizeWithKeyboard,t=Jo.TRANSLATE_SMALL,s=Jo.TRANSLATE_BIG;return Q(this,"_resizerKeyboardManager",new Ko([[["ArrowLeft"],e,{args:[-t,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-s,0]}],[["ArrowRight"],e,{args:[t,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[s,0]}],[["ArrowUp"],e,{args:[0,-t]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-s]}],[["ArrowDown"],e,{args:[0,t]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,s]}],[["Escape"],et.prototype._stopResizingWithKeyboard]]))}updatePageIndex(e){this.pageIndex=e}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Q(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new TA({id:e._uiManager.getId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t){if(et._l10n??(et._l10n=e),et._l10nAlert??(et._l10nAlert=Object.freeze({highlight:"pdfjs-editor-highlight-added-alert",freetext:"pdfjs-editor-freetext-added-alert",ink:"pdfjs-editor-ink-added-alert",stamp:"pdfjs-editor-stamp-added-alert",signature:"pdfjs-editor-signature-added-alert"})),et._l10nResizer??(et._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),et._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);et._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){gt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return r(this,td)}set _isDraggable(e){var t;g(this,td,e),(t=this.div)==null||t.classList.toggle("draggable",e)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=r(this,Mf)}setParent(e){var t;e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):(b(this,Z,ec).call(this),(t=r(this,Ys))==null||t.remove(),g(this,Ys,null)),this.parent=e}focusin(e){this._focusEventsAllowed&&(r(this,La)?g(this,La,!1):this.parent.setSelected(this))}focusout(e){var s;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const t=e.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(e.preventDefault(),(s=this.parent)!=null&&s.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,s,i){const[n,a]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(e+s)/n,this.y=(t+i)/a,this.fixAndSetPosition()}_moveAfterPaste(e,t){if(this.isClone){delete this.isClone;return}const[s,i]=this.parentDimensions;this.setAt(e*s,t*i,this.width*s,this.height*i),this._onTranslated()}translate(e,t){b(this,Z,Wp).call(this,this.parentDimensions,e,t)}translateInPage(e,t){r(this,bs)||g(this,bs,[this.x,this.y,this.width,this.height]),b(this,Z,Wp).call(this,this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,t){r(this,bs)||g(this,bs,[this.x,this.y,this.width,this.height]);const{div:s,parentDimensions:[i,n]}=this;if(this.x+=e/i,this.y+=t/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,h]=this.getBaseTranslation();a+=l,o+=h;const{style:c}=s;c.left=`${(100*a).toFixed(2)}%`,c.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o)}_onTranslating(e,t){}_onTranslated(e,t){}get _hasBeenMoved(){return!!r(this,bs)&&(r(this,bs)[0]!==this.x||r(this,bs)[1]!==this.y)}get _hasBeenResized(){return!!r(this,bs)&&(r(this,bs)[2]!==this.width||r(this,bs)[3]!==this.height)}getBaseTranslation(){const[e,t]=this.parentDimensions,{_borderLineWidth:s}=et,i=s/e,n=s/t;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:t},pageDimensions:[s,i]}=this;let{x:n,y:a,width:o,height:l}=this;if(o*=s,l*=i,n*=s,a*=i,this._mustFixPosition)switch(e){case 0:n=_t(n,0,s-o),a=_t(a,0,i-l);break;case 90:n=_t(n,0,s-l),a=_t(a,o,i);break;case 180:n=_t(n,o,s),a=_t(a,l,i);break;case 270:n=_t(n,l,s),a=_t(a,0,i-o);break}this.x=n/=s,this.y=a/=i;const[h,c]=this.getBaseTranslation();n+=h,a+=c,t.left=`${(100*n).toFixed(2)}%`,t.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,t){var s;return b(s=et,ed,Xp).call(s,e,t,this.parentRotation)}pageTranslationToScreen(e,t){var s;return b(s=et,ed,Xp).call(s,e,t,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,s]}=this;return[t*e,s*e]}setDims(){const{div:{style:e},width:t,height:s}=this;e.width=`${(100*t).toFixed(2)}%`,e.height=`${(100*s).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(e){return Math.round(e*1e4)/1e4}_onResizing(){}altTextFinish(){var e;(e=r(this,jt))==null||e.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||r(this,Na))return this._editToolbar;this._editToolbar=new kp(this),this.div.append(this._editToolbar.render());const{toolbarButtons:e}=this;if(e)for(const[t,s]of e)await this._editToolbar.addButton(t,s);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var e;(e=this._editToolbar)==null||e.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){var e;(e=this._editToolbar)==null||e.removeButton("comment")}removeEditToolbar(){var e,t;(e=this._editToolbar)==null||e.remove(),this._editToolbar=null,(t=r(this,jt))==null||t.destroy()}addContainer(e){var s;const t=(s=this._editToolbar)==null?void 0:s.div;t?t.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return r(this,jt)||(bf.initialize(et._l10n),g(this,jt,new bf(this)),r(this,ka)&&(r(this,jt).data=r(this,ka),g(this,ka,null))),r(this,jt)}get altTextData(){var e;return(e=r(this,jt))==null?void 0:e.data}set altTextData(e){r(this,jt)&&(r(this,jt).data=e)}get guessedAltText(){var e;return(e=r(this,jt))==null?void 0:e.guessedText}async setGuessedAltText(e){var t;await((t=r(this,jt))==null?void 0:t.setGuessedText(e))}serializeAltText(e){var t;return(t=r(this,jt))==null?void 0:t.serialize(e)}hasAltText(){return!!r(this,jt)&&!r(this,jt).isEmpty()}hasAltTextData(){var e;return((e=r(this,jt))==null?void 0:e.hasData())??!1}focusCommentButton(){var e;(e=r(this,Et))==null||e.focusButton()}addCommentButton(){return this.canAddComment?r(this,Et)||g(this,Et,new Au(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(r(this,An)){this._uiManager.isEditingMode()&&r(this,An).classList.remove("hidden");return}this.hasComment&&(g(this,An,r(this,Et).renderForStandalone()),this.div.append(r(this,An)))}}removeStandaloneCommentButton(){r(this,Et).removeStandaloneCommentButton(),g(this,An,null)}hideStandaloneCommentButton(){var e;(e=r(this,An))==null||e.classList.add("hidden")}get comment(){if(!r(this,Et))return null;const{data:{richText:e,text:t,date:s,deleted:i}}=r(this,Et);return{text:t,richText:e,date:s,deleted:i,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(e){r(this,Et)||g(this,Et,new Au(this)),typeof e=="object"&&e!==null?r(this,Et).restoreData(e):r(this,Et).data=e,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:e,popupRef:t,richText:s}){if(!t||(r(this,Et)||g(this,Et,new Au(this)),r(this,Et).setInitialText(e,s),!this.annotationElementId))return;const i=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);i&&this.updateFromAnnotationLayer(i)}get hasEditedComment(){var e;return(e=r(this,Et))==null?void 0:e.hasBeenEdited()}get hasDeletedComment(){var e;return(e=r(this,Et))==null?void 0:e.isDeleted()}get hasComment(){return!!r(this,Et)&&!r(this,Et).isEmpty()&&!r(this,Et).isDeleted()}async editComment(e){r(this,Et)||g(this,Et,new Au(this)),r(this,Et).edit(e)}toggleComment(e,t=void 0){this.hasComment&&this._uiManager.toggleComment(this,e,t)}setSelectedCommentButton(e){r(this,Et).setSelectedButton(e)}addComment(e){if(this.hasEditedComment){const[,,,i]=e.rect,[n]=this.pageDimensions,[a]=this.pageTranslation,o=a+n+1,l=i-100,h=o+180;e.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,l,h,i]}}}updateFromAnnotationLayer({popup:{contents:e,deleted:t}}){r(this,Et).data=t?null:e}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var a;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=r(this,Dl)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),b(this,Z,Qp).call(this);const[t,s]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*s/t).toFixed(2)}%`,e.style.maxHeight=`${(100*t/s).toFixed(2)}%`);const[i,n]=this.getInitialTranslation();return this.translate(i,n),Bv(this,e,["keydown","pointerdown","dblclick"]),b(this,Z,Zp).call(this),this.addStandaloneCommentButton(),(a=this._uiManager._editorUndoBar)==null||a.hide(),e}pointerdown(e){const{isMac:t}=Mt.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}if(g(this,La,!0),this._isDraggable){b(this,Z,oy).call(this,e);return}b(this,Z,Jp).call(this,e)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){r(this,$i)&&clearTimeout(r(this,$i)),g(this,$i,setTimeout(()=>{var e;g(this,$i,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,t,s){e.changeParent(this),this.x=t,this.y=s,this.fixAndSetPosition(),this._onTranslated()}getRect(e,t,s=this.rotation){const i=this.parentScale,[n,a]=this.pageDimensions,[o,l]=this.pageTranslation,h=e/i,c=t/i,u=this.x*n,f=this.y*a,p=this.width*n,m=this.height*a;switch(s){case 0:return[u+h+o,a-f-c-m+l,u+h+p+o,a-f-c+l];case 90:return[u+c+o,a-f+h+l,u+c+m+o,a-f+h+p+l];case 180:return[u-h-p+o,a-f+c+l,u-h+o,a-f+c+m+l];case 270:return[u-c-m+o,a-f-h-p+l,u-c+o,a-f-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[s,i,n,a]=e,o=n-s,l=a-i;switch(this.rotation){case 0:return[s,t-a,o,l];case 90:return[s,t-i,l,o];case 180:return[n,t-i,o,l];case 270:return[n,t-a,l,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&et._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var e;(e=r(this,Et))==null||e.onUpdatedColor()}getData(){const{comment:{text:e,color:t,date:s,opacity:i,deleted:n,richText:a},uid:o,pageIndex:l,creationDate:h,modificationDate:c}=this;return{id:o,pageIndex:l,rect:this.getPDFRect(),richText:a,contentsObj:{str:e},creationDate:h,modificationDate:s||c,popupRef:!n,color:t,opacity:i}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),g(this,Na,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),g(this,Na,!1),!0):!1}isInEditMode(){return r(this,Na)}shouldGetKeyboardEvents(){return r(this,Sn)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:t,bottom:s,right:i}=this.getClientDimensions(),{innerHeight:n,innerWidth:a}=window;return t<a&&i>0&&e<n&&s>0}rebuild(){b(this,Z,Qp).call(this),b(this,Z,Zp).call(this)}rotate(e){}resize(){}serializeDeleted(){var e;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((e=this._initialData)==null?void 0:e.popupRef)||""}}serialize(e=!1,t=null){var s;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((s=this._initialData)==null?void 0:s.popupRef)||""}}static async deserialize(e,t,s){const i=new this.prototype.constructor({parent:t,id:s.getId(),uiManager:s,annotationElementId:e.annotationElementId,creationDate:e.creationDate,modificationDate:e.modificationDate});i.rotation=e.rotation,g(i,ka,e.accessibilityData),i._isCopy=e.isCopy||!1;const[n,a]=i.pageDimensions,[o,l,h,c]=i.getRectInCurrentCoords(e.rect,a);return i.x=o/n,i.y=l/a,i.width=h/n,i.height=c/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e,t,s;if((e=r(this,Ir))==null||e.abort(),g(this,Ir,null),this.isEmpty()||this.commit(),(t=r(this,Or))==null||t.destroy(),g(this,Or,null),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),r(this,$i)&&(clearTimeout(r(this,$i)),g(this,$i,null)),b(this,Z,ec).call(this),this.removeEditToolbar(),r(this,Ks)){for(const i of r(this,Ks).values())clearTimeout(i);g(this,Ks,null)}this.parent=null,(s=r(this,Ys))==null||s.remove(),g(this,Ys,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,Z,sy).call(this),r(this,Oe).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[e,t]}=this,[s,i,n,a]=this.getPDFRect();return[et._round(s+(n-s)*e),et._round(i+(a-i)*(1-t))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return r(this,Et).commentPopupPositionInLayer}set commentPopupPosition(e){r(this,Et).commentPopupPositionInLayer=e}hasDefaultPopupPosition(){return r(this,Et).hasDefaultPopupPosition()}get commentButtonWidth(){return r(this,Et).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(e){var t;(t=r(this,Et))==null||t.setCommentButtonStates(e)}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),g(this,wn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const t=r(this,Oe).children;if(!r(this,hi)){g(this,hi,Array.from(t));const a=b(this,Z,ly).bind(this),o=b(this,Z,hy).bind(this),l=this._uiManager._signal;for(const h of r(this,hi)){const c=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",a,{signal:l}),h.addEventListener("blur",o,{signal:l}),h.addEventListener("focus",b(this,Z,cy).bind(this,c),{signal:l}),h.setAttribute("data-l10n-id",et._l10nResizer[c])}}const s=r(this,hi)[0];let i=0;for(const a of t){if(a===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(r(this,hi).length/4);if(n!==i){if(n<i)for(let o=0;o<i-n;o++)r(this,Oe).append(r(this,Oe).firstElementChild);else if(n>i)for(let o=0;o<n-i;o++)r(this,Oe).firstElementChild.before(r(this,Oe).lastElementChild);let a=0;for(const o of t){const h=r(this,hi)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",et._l10nResizer[h])}}b(this,Z,qp).call(this,0),g(this,Sn,!0),r(this,Oe).firstElementChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,t){r(this,Sn)&&b(this,Z,Kp).call(this,r(this,Zc),{deltaX:e,deltaY:t,fromKeyboard:!0})}_stopResizingWithKeyboard(){b(this,Z,ec).call(this),this.div.focus()}select(){var e,t,s;if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var i,n;(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((n=this._editToolbar)==null||n.show())});return}(t=this._editToolbar)==null||t.show(),(s=r(this,jt))==null||s.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var e;return(e=this.div)==null?void 0:e.focus({preventScroll:!0})},0)}unselect(){var e,t,s,i,n;this.isSelected&&(this.isSelected=!1,(e=r(this,Oe))==null||e.classList.add("hidden"),(t=this.div)==null||t.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=this._editToolbar)==null||i.hide(),(n=r(this,jt))==null||n.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(e,t){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){e.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return r(this,qc)}set isEditing(e){g(this,qc,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,t=!1){if(t){r(this,Ks)||g(this,Ks,new Map);const{action:s}=e;let i=r(this,Ks).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(e),r(this,Ks).delete(s),r(this,Ks).size===0&&g(this,Ks,null)},et._telemetryTimeout),r(this,Ks).set(s,i);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),g(this,Dl,!1)}disable(){this.div&&(this.div.tabIndex=-1),g(this,Dl,!0)}updateFakeAnnotationElement(e){if(!r(this,Ys)&&!this.deleted){g(this,Ys,e.addFakeAnnotation(this));return}if(this.deleted){r(this,Ys).remove(),g(this,Ys,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&r(this,Ys).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let t=e.container.querySelector(".annotationContent");if(!t)t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),e.container.prepend(t);else if(t.nodeName==="CANVAS"){const s=t;t=document.createElement("div"),t.classList.add("annotationContent",this.editorType),s.before(t)}return t}resetAnnotationElement(e){const{firstElementChild:t}=e.container;(t==null?void 0:t.nodeName)==="DIV"&&t.classList.contains("annotationContent")&&t.remove()}};ka=new WeakMap,hi=new WeakMap,jt=new WeakMap,Et=new WeakMap,An=new WeakMap,Dl=new WeakMap,Pr=new WeakMap,Qc=new WeakMap,Oe=new WeakMap,Fa=new WeakMap,wn=new WeakMap,Ys=new WeakMap,Ir=new WeakMap,Zc=new WeakMap,La=new WeakMap,bs=new WeakMap,qc=new WeakMap,Na=new WeakMap,Sn=new WeakMap,$i=new WeakMap,kl=new WeakMap,Fl=new WeakMap,Ks=new WeakMap,Or=new WeakMap,td=new WeakMap,Mf=new WeakMap,Z=new WeakSet,Wp=function([e,t],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/e,this.y+=i/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},ed=new WeakSet,Xp=function(e,t,s){switch(s){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}},Lu=function(e){switch(e){case 90:{const[t,s]=this.pageDimensions;return[0,-t/s,s/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,s]=this.pageDimensions;return[0,t/s,-s/t,0]}default:return[1,0,0,1]}},sy=function(){if(r(this,Oe))return;g(this,Oe,document.createElement("div")),r(this,Oe).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const s of e){const i=document.createElement("div");r(this,Oe).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",b(this,Z,iy).bind(this,s),{signal:t}),i.addEventListener("contextmenu",Ei,{signal:t}),i.tabIndex=-1}this.div.prepend(r(this,Oe))},iy=function(e,t){var c;t.preventDefault();const{isMac:s}=Mt.platform;if(t.button!==0||t.ctrlKey&&s)return;(c=r(this,jt))==null||c.toggle(!1);const i=this._isDraggable;this._isDraggable=!1,g(this,Fa,[t.screenX,t.screenY]);const n=new AbortController,a=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,Z,Kp).bind(this,e),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",me,{passive:!1,signal:a}),window.addEventListener("contextmenu",Ei,{signal:a}),g(this,wn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const h=()=>{var u;n.abort(),this.parent.togglePointerEvents(!0),(u=r(this,jt))==null||u.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=o,this.div.style.cursor=l,b(this,Z,Nu).call(this)};window.addEventListener("pointerup",h,{signal:a}),window.addEventListener("blur",h,{signal:a})},Yp=function(e,t,s,i){this.width=s,this.height=i,this.x=e,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()},Nu=function(){if(!r(this,wn))return;const{savedX:e,savedY:t,savedWidth:s,savedHeight:i}=r(this,wn);g(this,wn,null);const n=this.x,a=this.y,o=this.width,l=this.height;n===e&&a===t&&o===s&&l===i||this.addCommands({cmd:b(this,Z,Yp).bind(this,n,a,o,l),undo:b(this,Z,Yp).bind(this,e,t,s,i),mustExec:!0})},Kp=function(e,t){const[s,i]=this.parentDimensions,n=this.x,a=this.y,o=this.width,l=this.height,h=et.MIN_SIZE/s,c=et.MIN_SIZE/i,u=b(this,Z,Lu).call(this,this.rotation),f=(k,L)=>[u[0]*k+u[2]*L,u[1]*k+u[3]*L],p=b(this,Z,Lu).call(this,360-this.rotation),m=(k,L)=>[p[0]*k+p[2]*L,p[1]*k+p[3]*L];let v,A,w=!1,S=!1;switch(e){case"topLeft":w=!0,v=(k,L)=>[0,0],A=(k,L)=>[k,L];break;case"topMiddle":v=(k,L)=>[k/2,0],A=(k,L)=>[k/2,L];break;case"topRight":w=!0,v=(k,L)=>[k,0],A=(k,L)=>[0,L];break;case"middleRight":S=!0,v=(k,L)=>[k,L/2],A=(k,L)=>[0,L/2];break;case"bottomRight":w=!0,v=(k,L)=>[k,L],A=(k,L)=>[0,0];break;case"bottomMiddle":v=(k,L)=>[k/2,L],A=(k,L)=>[k/2,0];break;case"bottomLeft":w=!0,v=(k,L)=>[0,L],A=(k,L)=>[k,0];break;case"middleLeft":S=!0,v=(k,L)=>[0,L/2],A=(k,L)=>[k,L/2];break}const x=v(o,l),C=A(o,l);let E=f(...C);const T=et._round(n+E[0]),P=et._round(a+E[1]);let M=1,I=1,D,R;if(t.fromKeyboard)({deltaX:D,deltaY:R}=t);else{const{screenX:k,screenY:L}=t,[Y,z]=r(this,Fa);[D,R]=this.screenToPageTranslation(k-Y,L-z),r(this,Fa)[0]=k,r(this,Fa)[1]=L}if([D,R]=m(D/s,R/i),w){const k=Math.hypot(o,l);M=I=Math.max(Math.min(Math.hypot(C[0]-x[0]-D,C[1]-x[1]-R)/k,1/o,1/l),h/o,c/l)}else S?M=_t(Math.abs(C[0]-x[0]-D),h,1)/o:I=_t(Math.abs(C[1]-x[1]-R),c,1)/l;const U=et._round(o*M),B=et._round(l*I);E=f(...A(U,B));const N=T-E[0],W=P-E[1];r(this,bs)||g(this,bs,[this.x,this.y,this.width,this.height]),this.width=U,this.height=B,this.x=N,this.y=W,this.setDims(),this.fixAndSetPosition(),this._onResizing()},ny=function(){var e;g(this,wn,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(e=r(this,jt))==null||e.toggle(!1),this.parent.togglePointerEvents(!1)},ry=function(e,t,s){let n=.7*(s/t)+1-.7;if(n===1)return;const a=b(this,Z,Lu).call(this,this.rotation),o=(T,P)=>[a[0]*T+a[2]*P,a[1]*T+a[3]*P],[l,h]=this.parentDimensions,c=this.x,u=this.y,f=this.width,p=this.height,m=et.MIN_SIZE/l,v=et.MIN_SIZE/h;n=Math.max(Math.min(n,1/f,1/p),m/f,v/p);const A=et._round(f*n),w=et._round(p*n);if(A===f&&w===p)return;r(this,bs)||g(this,bs,[c,u,f,p]);const S=o(f/2,p/2),x=et._round(c+S[0]),C=et._round(u+S[1]),E=o(A/2,w/2);this.x=x-E[0],this.y=C-E[1],this.width=A,this.height=w,this.setDims(),this.fixAndSetPosition(),this._onResizing()},ay=function(){var e;(e=r(this,jt))==null||e.toggle(!0),this.parent.togglePointerEvents(!0),b(this,Z,Nu).call(this)},Jp=function(e){const{isMac:t}=Mt.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)},oy=function(e){const{isSelected:t}=this;this._uiManager.setUpDragSession();let s=!1;const i=new AbortController,n=this._uiManager.combinedSignal(i),a={capture:!0,passive:!1,signal:n},o=h=>{i.abort(),g(this,Pr,null),g(this,La,!1),this._uiManager.endDragSession()||b(this,Z,Jp).call(this,h),s&&this._onStopDragging()};t&&(g(this,kl,e.clientX),g(this,Fl,e.clientY),g(this,Pr,e.pointerId),g(this,Qc,e.pointerType),window.addEventListener("pointermove",h=>{s||(s=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:c,clientY:u,pointerId:f}=h;if(f!==r(this,Pr)){me(h);return}const[p,m]=this.screenToPageTranslation(c-r(this,kl),u-r(this,Fl));g(this,kl,c),g(this,Fl,u),this._uiManager.dragSelectedEditors(p,m),this.div.scrollIntoView({block:"nearest"})},a),window.addEventListener("touchmove",me,a),window.addEventListener("pointerdown",h=>{h.pointerType===r(this,Qc)&&(r(this,Or)||h.isPrimary)&&o(h),me(h)},a));const l=h=>{if(!r(this,Pr)||r(this,Pr)===h.pointerId){o(h);return}me(h)};window.addEventListener("pointerup",l,{signal:n}),window.addEventListener("blur",l,{signal:n})},Qp=function(){if(r(this,Ir)||!this.div)return;g(this,Ir,new AbortController);const e=this._uiManager.combinedSignal(r(this,Ir));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})},Zp=function(){r(this,Or)||!this.div||!this.isResizable||!this._uiManager._supportsPinchToZoom||g(this,Or,new Zv({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,Z,ny).bind(this),onPinching:b(this,Z,ry).bind(this),onPinchEnd:b(this,Z,ay).bind(this),signal:this._uiManager._signal}))},ly=function(e){et._resizerKeyboardManager.exec(this,e)},hy=function(e){var t;r(this,Sn)&&((t=e.relatedTarget)==null?void 0:t.parentNode)!==r(this,Oe)&&b(this,Z,ec).call(this)},cy=function(e){g(this,Zc,r(this,Sn)?e:"")},qp=function(e){if(r(this,hi))for(const t of r(this,hi))t.tabIndex=e},ec=function(){g(this,Sn,!1),b(this,Z,qp).call(this,-1),b(this,Z,Nu).call(this)},y(et,ed),O(et,"_l10n",null),O(et,"_l10nAlert",null),O(et,"_l10nResizer",null),O(et,"_borderLineWidth",-1),O(et,"_colorManager",new Np),O(et,"_zIndex",1),O(et,"_telemetryTimeout",1e3);let Dt=et;class TA extends Dt{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const ev=3285377520,Hs=4294901760,Pi=65535;class tg{constructor(e){this.h1=e?e&4294967295:ev,this.h2=e?e&4294967295:ev}update(e){let t,s;if(typeof e=="string"){t=new Uint8Array(e.length*2),s=0;for(let v=0,A=e.length;v<A;v++){const w=e.charCodeAt(v);w<=255?t[s++]=w:(t[s++]=w>>>8,t[s++]=w&255)}}else if(ArrayBuffer.isView(e))t=e.slice(),s=t.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=s>>2,n=s-i*4,a=new Uint32Array(t.buffer,0,i);let o=0,l=0,h=this.h1,c=this.h2;const u=3432918353,f=461845907,p=u&Pi,m=f&Pi;for(let v=0;v<i;v++)v&1?(o=a[v],o=o*u&Hs|o*p&Pi,o=o<<15|o>>>17,o=o*f&Hs|o*m&Pi,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(l=a[v],l=l*u&Hs|l*p&Pi,l=l<<15|l>>>17,l=l*f&Hs|l*m&Pi,c^=l,c=c<<13|c>>>19,c=c*5+3864292196);switch(o=0,n){case 3:o^=t[i*4+2]<<16;case 2:o^=t[i*4+1]<<8;case 1:o^=t[i*4],o=o*u&Hs|o*p&Pi,o=o<<15|o>>>17,o=o*f&Hs|o*m&Pi,i&1?h^=o:c^=o}this.h1=h,this.h2=c}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&Hs|e*36045&Pi,t=t*4283543511&Hs|((t<<16|e>>>16)*2950163797&Hs)>>>16,e^=t>>>1,e=e*444984403&Hs|e*60499&Pi,t=t*3301882366&Hs|((t<<16|e>>>16)*3120437893&Hs)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}const Ec=Object.freeze({map:null,hash:"",transfer:void 0});var Ba,Ua,En,Me,Rf,dy;class Tm{constructor(){y(this,Rf);y(this,Ba,!1);y(this,Ua,null);y(this,En,null);y(this,Me,new Map);O(this,"onSetModified",null);O(this,"onResetModified",null);O(this,"onAnnotationEditor",null)}getValue(e,t){const s=r(this,Me).get(e);return s===void 0?t:Object.assign(t,s)}getRawValue(e){return r(this,Me).get(e)}remove(e){var s;const t=r(this,Me).get(e);t!==void 0&&(t instanceof Dt&&r(this,En).delete(t.annotationElementId),r(this,Me).delete(e),r(this,Me).size===0&&this.resetModified(),!r(this,Me).values().some(i=>i instanceof Dt)&&((s=this.onAnnotationEditor)==null||s.call(this,null)))}setValue(e,t){var n;const s=r(this,Me).get(e);let i=!1;if(s!==void 0)for(const[a,o]of Object.entries(t))s[a]!==o&&(i=!0,s[a]=o);else i=!0,r(this,Me).set(e,t);i&&b(this,Rf,dy).call(this),t instanceof Dt&&((r(this,En)||g(this,En,new Map)).set(t.annotationElementId,t),(n=this.onAnnotationEditor)==null||n.call(this,t.constructor._type))}has(e){return r(this,Me).has(e)}get size(){return r(this,Me).size}resetModified(){var e;r(this,Ba)&&(g(this,Ba,!1),(e=this.onResetModified)==null||e.call(this))}get print(){return new uy(this)}get serializable(){if(r(this,Me).size===0)return Ec;const e=new Map,t=new tg,s=[],i=Object.create(null);let n=!1;for(const[a,o]of r(this,Me)){const l=o instanceof Dt?o.serialize(!1,i):o;o.page&&(o.pageIndex=o.page._pageIndex,delete o.page),l&&(e.set(a,l),t.update(`${a}:${JSON.stringify(l)}`),n||(n=!!l.bitmap))}if(n)for(const a of e.values())a.bitmap&&s.push(a.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfer:s}:Ec}get editorStats(){let e=null;const t=new Map;let s=0,i=0;for(const n of r(this,Me).values()){if(!(n instanceof Dt)){n.popup&&(n.popup.deleted?i+=1:s+=1);continue}n.isCommentDeleted?i+=1:n.hasEditedComment&&(s+=1);const a=n.telemetryFinalData;if(!a)continue;const{type:o}=a;t.getOrInsertComputed(o,()=>Object.getPrototypeOf(n).constructor),e||(e=Object.create(null));const l=e[o]||(e[o]=new Map);for(const[h,c]of Object.entries(a)){if(h==="type")continue;const u=l.getOrInsertComputed(h,Am);u.set(c,(u.get(c)??0)+1)}}if((i>0||s>0)&&(e||(e=Object.create(null)),e.comments={deleted:i,edited:s}),!e)return null;for(const[n,a]of t)e[n]=a.computeTelemetryFinalData(e[n]);return e}resetModifiedIds(){g(this,Ua,null)}updateEditor(e,t){var i;const s=(i=r(this,En))==null?void 0:i.get(e);return s?(s.updateFromAnnotationLayer(t),!0):!1}getEditor(e){var t;return((t=r(this,En))==null?void 0:t.get(e))||null}get modifiedIds(){if(r(this,Ua))return r(this,Ua);const e=[];if(r(this,En))for(const s of r(this,En).values())s.serialize()&&e.push(s.annotationElementId);let t="";if(e.length){const s=new tg;s.update(e.join(",")),t=s.hexdigest()}return g(this,Ua,{ids:new Set(e),hash:t})}[Symbol.iterator](){return r(this,Me).entries()}}Ba=new WeakMap,Ua=new WeakMap,En=new WeakMap,Me=new WeakMap,Rf=new WeakSet,dy=function(){var e;r(this,Ba)||(g(this,Ba,!0),(e=this.onSetModified)==null||e.call(this))};var sd;class uy extends Tm{constructor(t){super();y(this,sd,Ec);const{serializable:s}=t;if(s===Ec)return;const{map:i,hash:n,transfer:a}=s,o=structuredClone(i,a?{transfer:a}:null);g(this,sd,{map:o,hash:n,transfer:[]})}get print(){gt("Should not call PrintAnnotationStorage.print")}get serializable(){return r(this,sd)}get modifiedIds(){return Q(this,"modifiedIds",{ids:new Set,hash:""})}}sd=new WeakMap;ot(7588);const il="__forcedDependency",{floor:sv,ceil:iv}=Math;function nv(d,e,t,s,i,n){d[e*4+0]=Math.min(d[e*4+0],t),d[e*4+1]=Math.min(d[e*4+1],s),d[e*4+2]=Math.max(d[e*4+2],i),d[e*4+3]=Math.max(d[e*4+3],n)}function CA(d,e,t,s,i){let n;d?(d<0&&(n=i[0],i[0]=i[2],i[2]=n),i[0]*=d,i[2]*=d,e<0&&(n=i[1],i[1]=i[3],i[3]=n),i[1]*=e,i[3]*=e):i.fill(0),i[0]+=t,i[1]+=s,i[2]+=t,i[3]+=s}const eg=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var Ll,Mr;class PA{constructor(e,t){y(this,Ll);y(this,Mr);g(this,Ll,e),g(this,Mr,t)}get length(){return r(this,Ll).length}isEmpty(e){return r(this,Ll)[e]===eg}minX(e){return r(this,Mr)[e*4+0]/256}minY(e){return r(this,Mr)[e*4+1]/256}maxX(e){return(r(this,Mr)[e*4+2]+1)/256}maxY(e){return(r(this,Mr)[e*4+3]+1)/256}}Ll=new WeakMap,Mr=new WeakMap;const rv=(d,e)=>d==null?void 0:d.getOrInsertComputed(e,()=>({dependencies:new Set,isRenderingOperation:!1}));var xn,wt,Ht,Ha,_a,$a,Ge,id,sg;class IA{constructor(e,t){y(this,id);y(this,xn,[[1,0,0,1,0,0]]);y(this,wt,[-1/0,-1/0,1/0,1/0]);y(this,Ht,new Float64Array(Jn));O(this,"_pendingBBoxIdx",-1);y(this,Ha);y(this,_a);y(this,$a);y(this,Ge);O(this,"_savesStack",[]);O(this,"_markedContentStack",[]);g(this,Ha,e.width),g(this,_a,e.height),b(this,id,sg).call(this,t)}growOperationsCount(e){e>=r(this,Ge).length&&b(this,id,sg).call(this,e,r(this,Ge))}get clipBox(){return r(this,wt)}save(e){return g(this,wt,{__proto__:r(this,wt)}),this._savesStack.push(e),this}restore(e,t){const s=Object.getPrototypeOf(r(this,wt));if(s===null)return this;g(this,wt,s);const i=this._savesStack.pop();return i!==void 0&&(t==null||t(i,e),r(this,Ge)[e]=r(this,Ge)[i]),this}recordOpenMarker(e){return this._savesStack.push(e),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(e,t){const s=this._savesStack.pop();return s!==void 0&&(t==null||t(s,e),r(this,Ge)[e]=r(this,Ge)[s]),this}beginMarkedContent(e){return this._markedContentStack.push(e),this}endMarkedContent(e,t){const s=this._markedContentStack.pop();return s!==void 0&&(t==null||t(s,e),r(this,Ge)[e]=r(this,Ge)[s]),this}pushBaseTransform(e){return r(this,xn).push(_.multiplyByDOMMatrix(r(this,xn).at(-1),e.getTransform())),this}popBaseTransform(){return r(this,xn).length>1&&r(this,xn).pop(),this}resetBBox(e){return this._pendingBBoxIdx!==e&&(this._pendingBBoxIdx=e,r(this,Ht).set(Jn,0)),this}recordClipBox(e,t,s,i,n,a){const o=_.multiplyByDOMMatrix(r(this,xn).at(-1),t.getTransform()),l=Jn.slice();_.axialAlignedBoundingBox([s,n,i,a],o,l);const h=_.intersect(r(this,wt),l);return h?(r(this,wt)[0]=h[0],r(this,wt)[1]=h[1],r(this,wt)[2]=h[2],r(this,wt)[3]=h[3]):(r(this,wt)[0]=r(this,wt)[1]=1/0,r(this,wt)[2]=r(this,wt)[3]=-1/0),this}recordBBox(e,t,s,i,n,a){const o=r(this,wt);if(o[0]===1/0)return this;const l=_.multiplyByDOMMatrix(r(this,xn).at(-1),t.getTransform());if(o[0]===-1/0)return _.axialAlignedBoundingBox([s,n,i,a],l,r(this,Ht)),this;const h=Jn.slice();return _.axialAlignedBoundingBox([s,n,i,a],l,h),r(this,Ht)[0]=_t(h[0],o[0],r(this,Ht)[0]),r(this,Ht)[1]=_t(h[1],o[1],r(this,Ht)[1]),r(this,Ht)[2]=_t(h[2],r(this,Ht)[2],o[2]),r(this,Ht)[3]=_t(h[3],r(this,Ht)[3],o[3]),this}recordFullPageBBox(e){return r(this,Ht)[0]=Math.max(0,r(this,wt)[0]),r(this,Ht)[1]=Math.max(0,r(this,wt)[1]),r(this,Ht)[2]=Math.min(r(this,Ha),r(this,wt)[2]),r(this,Ht)[3]=Math.min(r(this,_a),r(this,wt)[3]),this}recordOperation(e,t=!1,s){if(this._pendingBBoxIdx!==e)return this;const i=sv(r(this,Ht)[0]*256/r(this,Ha)),n=sv(r(this,Ht)[1]*256/r(this,_a)),a=iv(r(this,Ht)[2]*256/r(this,Ha)),o=iv(r(this,Ht)[3]*256/r(this,_a));if(nv(r(this,$a),e,i,n,a,o),s)for(const l of s)for(const h of l)h!==e&&nv(r(this,$a),h,i,n,a,o);return t||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(e){return this._pendingBBoxIdx===e&&(this._pendingBBoxIdx=-1,r(this,wt)[0]=Math.max(r(this,wt)[0],r(this,Ht)[0]),r(this,wt)[1]=Math.max(r(this,wt)[1],r(this,Ht)[1]),r(this,wt)[2]=Math.min(r(this,wt)[2],r(this,Ht)[2]),r(this,wt)[3]=Math.min(r(this,wt)[3],r(this,Ht)[3])),this}take(){return new PA(r(this,Ge),r(this,$a))}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(e,t){return this}recordIncrementalData(e,t){return this}resetIncrementalData(e,t){return this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,s){return this}recordFutureForcedDependency(e,t){return this}inheritSimpleDataAsFutureForcedDependencies(e){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(e,t,s,i=1,n=0,a=0,o){return this}getSimpleIndex(e){}recordDependencies(e,t){return this}recordNamedDependency(e,t){return this}recordShowTextOperation(e,t=!1){return this}}xn=new WeakMap,wt=new WeakMap,Ht=new WeakMap,Ha=new WeakMap,_a=new WeakMap,$a=new WeakMap,Ge=new WeakMap,id=new WeakSet,sg=function(e,t){const s=new ArrayBuffer(e*4);g(this,$a,new Uint8ClampedArray(s)),g(this,Ge,new Uint32Array(s)),t&&t.length>0?(r(this,Ge).set(t),r(this,Ge).fill(eg,t.length)):r(this,Ge).fill(eg)};var cs,ds,ja,ci,Nl,Rr,Dr,Pt;class OA{constructor(e,t=!1){y(this,cs,{__proto__:null});y(this,ds,{__proto__:null,transform:[],moveText:[],sameLineText:[],[il]:[]});y(this,ja,new Map);y(this,ci,new Set);y(this,Nl,new Map);y(this,Rr);y(this,Dr);y(this,Pt);g(this,Pt,e),t&&(g(this,Rr,new Map),g(this,Dr,(s,i)=>{rv(r(this,Rr),i).dependencies.add(s)}))}get clipBox(){return r(this,Pt).clipBox}growOperationsCount(e){r(this,Pt).growOperationsCount(e)}save(e){return g(this,cs,{__proto__:r(this,cs)}),g(this,ds,{__proto__:r(this,ds),transform:{__proto__:r(this,ds).transform},moveText:{__proto__:r(this,ds).moveText},sameLineText:{__proto__:r(this,ds).sameLineText},[il]:{__proto__:r(this,ds)[il]}}),r(this,Pt).save(e),this}restore(e){r(this,Pt).restore(e,r(this,Dr));const t=Object.getPrototypeOf(r(this,cs));return t===null?this:(g(this,cs,t),g(this,ds,Object.getPrototypeOf(r(this,ds))),this)}recordOpenMarker(e){return r(this,Pt).recordOpenMarker(e,r(this,Dr)),this}getOpenMarker(){return r(this,Pt).getOpenMarker()}recordCloseMarker(e){return r(this,Pt).recordCloseMarker(e,r(this,Dr)),this}beginMarkedContent(e){return r(this,Pt).beginMarkedContent(e),this}endMarkedContent(e){return r(this,Pt).endMarkedContent(e,r(this,Dr)),this}pushBaseTransform(e){return r(this,Pt).pushBaseTransform(e),this}popBaseTransform(){return r(this,Pt).popBaseTransform(),this}recordSimpleData(e,t){return r(this,cs)[e]=t,this}recordIncrementalData(e,t){return r(this,ds)[e].push(t),this}resetIncrementalData(e,t){return r(this,ds)[e].length=0,this}recordNamedData(e,t){return r(this,ja).set(e,t),this}recordSimpleDataFromNamed(e,t,s){r(this,cs)[e]=r(this,ja).get(t)??s}recordFutureForcedDependency(e,t){return this.recordIncrementalData(il,t),this}inheritSimpleDataAsFutureForcedDependencies(e){for(const t of e)t in r(this,cs)&&this.recordFutureForcedDependency(t,r(this,cs)[t]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const e of r(this,ci))this.recordFutureForcedDependency(il,e);return this}resetBBox(e){return r(this,Pt).resetBBox(e),this}recordClipBox(e,t,s,i,n,a){return r(this,Pt).recordClipBox(e,t,s,i,n,a),this}recordBBox(e,t,s,i,n,a){return r(this,Pt).recordBBox(e,t,s,i,n,a),this}recordCharacterBBox(e,t,s,i=1,n=0,a=0,o){const l=s.bbox;let h,c;if(l&&(h=l[2]!==l[0]&&l[3]!==l[1]&&r(this,Nl).get(s),h!==!1&&(c=[0,0,0,0],_.axialAlignedBoundingBox(l,s.fontMatrix,c),(i!==1||n!==0||a!==0)&&CA(i,-i,n,a,c),h)))return this.recordBBox(e,t,c[0],c[2],c[1],c[3]);if(!o)return this.recordFullPageBBox(e);const u=o();return l&&c&&h===void 0&&(h=c[0]<=n-u.actualBoundingBoxLeft&&c[2]>=n+u.actualBoundingBoxRight&&c[1]<=a-u.actualBoundingBoxAscent&&c[3]>=a+u.actualBoundingBoxDescent,r(this,Nl).set(s,h),h)?this.recordBBox(e,t,c[0],c[2],c[1],c[3]):this.recordBBox(e,t,n-u.actualBoundingBoxLeft,n+u.actualBoundingBoxRight,a-u.actualBoundingBoxAscent,a+u.actualBoundingBoxDescent)}recordFullPageBBox(e){return r(this,Pt).recordFullPageBBox(e),this}getSimpleIndex(e){return r(this,cs)[e]}recordDependencies(e,t){const s=r(this,ci),i=r(this,cs),n=r(this,ds);for(const a of t)a in r(this,cs)?s.add(i[a]):a in n&&n[a].forEach(s.add,s);return this}recordNamedDependency(e,t){return r(this,ja).has(t)&&r(this,ci).add(r(this,ja).get(t)),this}recordOperation(e,t=!1){if(this.recordDependencies(e,[il]),r(this,Rr)){const i=rv(r(this,Rr),e),{dependencies:n}=i;r(this,ci).forEach(n.add,n),r(this,Pt)._savesStack.forEach(n.add,n),r(this,Pt)._markedContentStack.forEach(n.add,n),n.delete(e),i.isRenderingOperation=!0}const s=!t&&e===r(this,Pt)._pendingBBoxIdx;return r(this,Pt).recordOperation(e,t,[r(this,ci),r(this,Pt)._savesStack,r(this,Pt)._markedContentStack]),s&&r(this,ci).clear(),this}recordShowTextOperation(e,t=!1){const s=Array.from(r(this,ci));this.recordOperation(e,t),this.recordIncrementalData("sameLineText",e);for(const i of s)this.recordIncrementalData("sameLineText",i);return this}bboxToClipBoxDropOperation(e,t=!1){const s=!t&&e===r(this,Pt)._pendingBBoxIdx;return r(this,Pt).bboxToClipBoxDropOperation(e),s&&r(this,ci).clear(),this}take(){return r(this,Nl).clear(),r(this,Pt).take()}takeDebugMetadata(){return r(this,Rr)}}cs=new WeakMap,ds=new WeakMap,ja=new WeakMap,ci=new WeakMap,Nl=new WeakMap,Rr=new WeakMap,Dr=new WeakMap,Pt=new WeakMap;var It,ee,di,Bl,Ul;const Lm=class Lm{constructor(e,t,s){y(this,It);y(this,ee);y(this,di);y(this,Bl,0);y(this,Ul,0);if(e instanceof Lm&&r(e,di)===!!s)return e;g(this,It,e),g(this,ee,t),g(this,di,!!s)}get clipBox(){return r(this,It).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(e){return Xt(this,Ul)._++,r(this,It).save(r(this,ee)),this}restore(e){return r(this,Ul)>0&&(r(this,It).restore(r(this,ee)),Xt(this,Ul)._--),this}recordOpenMarker(e){return Xt(this,Bl)._++,this}getOpenMarker(){return r(this,Bl)>0?r(this,ee):r(this,It).getOpenMarker()}recordCloseMarker(e){return Xt(this,Bl)._--,this}beginMarkedContent(e){return this}endMarkedContent(e){return this}pushBaseTransform(e){return r(this,It).pushBaseTransform(e),this}popBaseTransform(){return r(this,It).popBaseTransform(),this}recordSimpleData(e,t){return r(this,It).recordSimpleData(e,r(this,ee)),this}recordIncrementalData(e,t){return r(this,It).recordIncrementalData(e,r(this,ee)),this}resetIncrementalData(e,t){return r(this,It).resetIncrementalData(e,r(this,ee)),this}recordNamedData(e,t){return this}recordSimpleDataFromNamed(e,t,s){return r(this,It).recordSimpleDataFromNamed(e,t,r(this,ee)),this}recordFutureForcedDependency(e,t){return r(this,It).recordFutureForcedDependency(e,r(this,ee)),this}inheritSimpleDataAsFutureForcedDependencies(e){return r(this,It).inheritSimpleDataAsFutureForcedDependencies(e),this}inheritPendingDependenciesAsFutureForcedDependencies(){return r(this,It).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(e){return r(this,di)||r(this,It).resetBBox(r(this,ee)),this}recordClipBox(e,t,s,i,n,a){return r(this,di)||r(this,It).recordClipBox(r(this,ee),t,s,i,n,a),this}recordBBox(e,t,s,i,n,a){return r(this,di)||r(this,It).recordBBox(r(this,ee),t,s,i,n,a),this}recordCharacterBBox(e,t,s,i,n,a,o){return r(this,di)||r(this,It).recordCharacterBBox(r(this,ee),t,s,i,n,a,o),this}recordFullPageBBox(e){return r(this,di)||r(this,It).recordFullPageBBox(r(this,ee)),this}getSimpleIndex(e){return r(this,It).getSimpleIndex(e)}recordDependencies(e,t){return r(this,It).recordDependencies(r(this,ee),t),this}recordNamedDependency(e,t){return r(this,It).recordNamedDependency(r(this,ee),t),this}recordOperation(e){return r(this,It).recordOperation(r(this,ee),!0),this}recordShowTextOperation(e){return r(this,It).recordShowTextOperation(r(this,ee),!0),this}bboxToClipBoxDropOperation(e){return r(this,di)||r(this,It).bboxToClipBoxDropOperation(r(this,ee),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};It=new WeakMap,ee=new WeakMap,di=new WeakMap,Bl=new WeakMap,Ul=new WeakMap;let xc=Lm;const _s={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]};var Ga,Va,za,Wa,Xa,nd;const Ac=class Ac{constructor(e){y(this,Ga);y(this,Va);y(this,za,4);y(this,Wa,0);y(this,Xa,new(r(Ac,nd))(r(this,za)*6));g(this,Ga,e.width),g(this,Va,e.height)}record(e,t,s,i){if(r(this,Wa)===r(this,za)){g(this,za,r(this,za)*2);const o=new(r(Ac,nd))(r(this,za)*6);o.set(r(this,Xa)),g(this,Xa,o)}const n=Bt(e);let a;if(i[0]!==1/0){const o=Jn.slice();_.axialAlignedBoundingBox([0,-s,t,0],n,o);const l=_.intersect(i,o);if(!l)return;const[h,c,u,f]=l;if(h!==o[0]||c!==o[1]||u!==o[2]||f!==o[3]){const p=Math.atan2(n[1],n[0]),m=Math.abs(Math.sin(p)),v=Math.abs(Math.cos(p));if(m<1e-6||v<1e-6||Math.abs(m-v)<1e-6)a=[h,c,h,f,u,c];else{const A=u-h,w=f-c,S=m*m,x=v*v,C=v*m,E=x-S,T=(w*x-A*C)/E,P=(w*C-A*S)/E;a=[h+P,c,h,c+T,u,f-T]}}}a||(a=[0,-s,0,0,t,-s],_.applyTransform(a,n,0),_.applyTransform(a,n,2),_.applyTransform(a,n,4)),a[0]/=r(this,Ga),a[1]/=r(this,Va),a[2]/=r(this,Ga),a[3]/=r(this,Va),a[4]/=r(this,Ga),a[5]/=r(this,Va),r(this,Xa).set(a,r(this,Wa)*6),Xt(this,Wa)._++}take(){return r(this,Xa).subarray(0,r(this,Wa)*6)}};Ga=new WeakMap,Va=new WeakMap,za=new WeakMap,Wa=new WeakMap,Xa=new WeakMap,nd=new WeakMap,y(Ac,nd,Mt.isFloat16ArraySupported?Float16Array:Float32Array);let ig=Ac;const av=new RegExp("\\p{Cc}","u");function MA(d){const e=d[0];if(d.length<2||e!=='"'&&e!=="'"||d.at(-1)!==e)return!1;const t=d.length-1;for(let s=1;s<t;s++){const i=d[s];if(i===e||av.test(i)||i==="\\"&&(++s>=t||av.test(d[s])))return!1}return!0}function ov(d){return MA(d)?d:`"${d.replaceAll(/["\\\p{Cc}]/gu,t=>t==='"'||t==="\\"?`\\${t}`:`\\${t.codePointAt(0).toString(16)} `)}"`}var Hl,ui,Df,fy;class RA{constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){y(this,Df);y(this,Hl,new Set);y(this,ui,null);this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){const t=b(this,Df,fy).call(this);t.insertRule(e,t.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);if(this.nativeFontFaces.clear(),r(this,Hl).clear(),r(this,ui)){const{adoptedStyleSheets:e}=this._document;e!=null&&e.includes(r(this,ui))&&(this._document.adoptedStyleSheets=e.filter(t=>t!==r(this,ui))),g(this,ui,null)}this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:t,_inspectFont:s}){if(!(!e||r(this,Hl).has(e.loadedName))){if(qt(!t,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:n,style:a}=e,o=new FontFace(i,n,a);this.addNativeFontFace(o);try{await o.load(),r(this,Hl).add(i),s==null||s(e)}catch{st(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}gt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const s=e.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw st(`Failed to load font '${s.family}': '${i}'.`),e.disableFontFace=!0,i}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const i=this._queueLoadingCallback(s);this._prepareFontLoadEvent(e,i)})}}get isFontLoadingAPISupported(){var t;const e=!!((t=this._document)!=null&&t.fonts);return Q(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return Q(this,"isSyncFontLoadingSupported",ks||Mt.platform.isFirefox)}_queueLoadingCallback(e){function t(){for(qt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const n=s.shift();setTimeout(n.callback,0)}}const{loadingRequests:s}=this,i={done:!1,complete:t,callback:e};return s.push(i),i}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Q(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){function s(E,T){return E.charCodeAt(T)<<24|E.charCodeAt(T+1)<<16|E.charCodeAt(T+2)<<8|E.charCodeAt(T+3)&255}function i(E){return String.fromCharCode(E>>24&255,E>>16&255,E>>8&255,E&255)}function n(E,T,P,M){const I=E.substring(0,T),D=E.substring(T+P);return I+M+D}let a,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const h=l.getContext("2d");let c=0;function u(E,T){if(++c>30){st("Load test font never loaded."),T();return}if(h.font="30px "+E,h.fillText(".",0,20),h.getImageData(0,0,1,1).data[3]>0){T();return}setTimeout(u.bind(null,E,T))}const f=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=n(p,976,f.length,f);const v=16,A=1482184792;let w=s(p,v);for(a=0,o=f.length-3;a<o;a+=4)w=w-A+s(f,a)|0;a<f.length&&(w=w-A+s(f+"XXX",a)|0),p=n(p,v,4,i(w));const S=`url(data:font/opentype;base64,${btoa(p)});`,x=`@font-face {font-family:"${f}";src:${S}}`;this.insertRule(x);const C=this._document.createElement("div");C.style.visibility="hidden",C.style.width=C.style.height="10px",C.style.position="absolute",C.style.top=C.style.left="0px";for(const E of[e.loadedName,f]){const T=this._document.createElement("span");T.textContent="Hi",T.style.fontFamily=E,C.append(T)}this._document.body.append(C),u(f,()=>{C.remove(),t.complete()})}}Hl=new WeakMap,ui=new WeakMap,Df=new WeakSet,fy=function(){var t;if(r(this,ui))return r(this,ui);const e=((t=this._document.defaultView)==null?void 0:t.CSSStyleSheet)||globalThis.CSSStyleSheet;if(!this.styleElement&&e){const{adoptedStyleSheets:s}=this._document;if(s){const i=new e;return s.push(i),g(this,ui,i)}}return this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)),g(this,ui,this.styleElement.sheet)};var Ot;class DA{constructor(e,t=null,s,i){O(this,"compiledGlyphs",Object.create(null));y(this,Ot);g(this,Ot,e),this._inspectFont=t,s&&(this.charProcOperatorList=s),i&&Object.assign(this,i)}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const s={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(s.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(ov(this.cssFontInfo.fontFamily),this.data,s)}return(t=this._inspectFont)==null||t.call(this,this),e}createFontFaceRule(){var s;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`;let t;if(!this.cssFontInfo)t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:${ov(this.cssFontInfo.fontFamily)};${i}src:${e}}`}return(s=this._inspectFont)==null||s.call(this,this,e),t}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];const s=this.loadedName+"_path_"+t;let i;try{i=e.get(s)}catch(a){st(`getPathGenerator - ignoring character: "${a}".`)}const n=Rv(i==null?void 0:i.path);return this.fontExtraProperties||e.delete(s),this.compiledGlyphs[t]=n}get black(){return r(this,Ot).black}get bold(){return r(this,Ot).bold}get disableFontFace(){return r(this,Ot).disableFontFace}set disableFontFace(e){Q(this,"disableFontFace",!!e)}get fontExtraProperties(){return r(this,Ot).fontExtraProperties}get isInvalidPDFjsFont(){return r(this,Ot).isInvalidPDFjsFont}get isType3Font(){return r(this,Ot).isType3Font}get italic(){return r(this,Ot).italic}get missingFile(){return r(this,Ot).missingFile}get remeasure(){return r(this,Ot).remeasure}get vertical(){return r(this,Ot).vertical}get ascent(){return r(this,Ot).ascent}get defaultWidth(){return r(this,Ot).defaultWidth}get descent(){return r(this,Ot).descent}get bbox(){return r(this,Ot).bbox}get fontMatrix(){return r(this,Ot).fontMatrix}get fallbackName(){return r(this,Ot).fallbackName}get loadedName(){return r(this,Ot).loadedName}get mimetype(){return r(this,Ot).mimetype}get name(){return r(this,Ot).name}get data(){return r(this,Ot).data}clearData(){r(this,Ot).clearData()}get cssFontInfo(){return r(this,Ot).cssFontInfo}get systemFontInfo(){return r(this,Ot).systemFontInfo}get defaultVMetrics(){return r(this,Ot).defaultVMetrics}}Ot=new WeakMap;class py{}O(py,"strings",["fontFamily","fontWeight","italicAngle"]);class gy{}O(gy,"strings",["css","loadedName","baseFontName","src"]);const He=class He{};O(He,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),O(He,"numbers",["ascent","defaultWidth","descent"]),O(He,"strings",["fallbackName","loadedName","mimetype","name"]),O(He,"OFFSET_NUMBERS",Math.ceil(He.bools.length*2/8)),O(He,"OFFSET_BBOX",He.OFFSET_NUMBERS+He.numbers.length*8),O(He,"OFFSET_FONT_MATRIX",He.OFFSET_BBOX+1+8),O(He,"OFFSET_DEFAULT_VMETRICS",He.OFFSET_FONT_MATRIX+1+48),O(He,"OFFSET_STRINGS",He.OFFSET_DEFAULT_VMETRICS+1+6);let gs=He;class ss{}O(ss,"KIND",0),O(ss,"HAS_BBOX",1),O(ss,"HAS_BACKGROUND",2),O(ss,"SHADING_TYPE",3),O(ss,"N_COORD",4),O(ss,"N_COLOR",8),O(ss,"N_STOP",12),O(ss,"N_FIGURES",16);class Af{static get decoder(){return Q(this,"decoder",new TextDecoder)}static get encoder(){return Q(this,"encoder",new TextEncoder)}}var rd,_l,$l,Bu;class kA{constructor(e){y(this,$l);y(this,rd);y(this,_l);g(this,rd,e),g(this,_l,new DataView(e))}get fontFamily(){return b(this,$l,Bu).call(this,0)}get fontWeight(){return b(this,$l,Bu).call(this,1)}get italicAngle(){return b(this,$l,Bu).call(this,2)}}rd=new WeakMap,_l=new WeakMap,$l=new WeakSet,Bu=function(e){qt(e<py.strings.length,"Invalid string index");const{decoder:t}=Af;let s=0;for(let n=0;n<e;n++)s+=r(this,_l).getUint32(s)+4;const i=r(this,_l).getUint32(s);return t.decode(new Uint8Array(r(this,rd),s+4,i))};var Ya,ji,Ka,sc;class FA{constructor(e){y(this,Ka);y(this,Ya);y(this,ji);g(this,Ya,e),g(this,ji,new DataView(e))}get guessFallback(){return r(this,ji).getUint8(0)!==0}get css(){return b(this,Ka,sc).call(this,0)}get loadedName(){return b(this,Ka,sc).call(this,1)}get baseFontName(){return b(this,Ka,sc).call(this,2)}get src(){return b(this,Ka,sc).call(this,3)}get style(){const{decoder:e}=Af;let t=1;t+=4+r(this,ji).getUint32(t);const s=r(this,ji).getUint32(t),i=e.decode(new Uint8Array(r(this,Ya),t+4,s));t+=4+s;const n=r(this,ji).getUint32(t),a=e.decode(new Uint8Array(r(this,Ya),t+4,n));return{style:i,weight:a}}}Ya=new WeakMap,ji=new WeakMap,Ka=new WeakSet,sc=function(e){qt(e<gy.strings.length,"Invalid string index");const{decoder:t}=Af;let s=5;for(let n=0;n<e;n++)s+=r(this,ji).getUint32(s)+4;const i=r(this,ji).getUint32(s);return t.decode(new Uint8Array(r(this,Ya),s+4,i))};var fi,re,xt,ai,Uu,Hu,ic,ng;class LA{constructor({buffer:e,extra:t}){y(this,xt);y(this,fi);y(this,re);g(this,fi,e),g(this,re,new DataView(e)),t&&Object.assign(this,t)}get black(){return b(this,xt,ai).call(this,0)}get bold(){return b(this,xt,ai).call(this,1)}get disableFontFace(){return b(this,xt,ai).call(this,2)}get fontExtraProperties(){return b(this,xt,ai).call(this,3)}get isInvalidPDFjsFont(){return b(this,xt,ai).call(this,4)}get isType3Font(){return b(this,xt,ai).call(this,5)}get italic(){return b(this,xt,ai).call(this,6)}get missingFile(){return b(this,xt,ai).call(this,7)}get remeasure(){return b(this,xt,ai).call(this,8)}get vertical(){return b(this,xt,ai).call(this,9)}get ascent(){return b(this,xt,Uu).call(this,0)}get defaultWidth(){return b(this,xt,Uu).call(this,1)}get descent(){return b(this,xt,Uu).call(this,2)}get bbox(){return b(this,xt,Hu).call(this,gs.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return b(this,xt,Hu).call(this,gs.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return b(this,xt,Hu).call(this,gs.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}get fallbackName(){return b(this,xt,ic).call(this,0)}get loadedName(){return b(this,xt,ic).call(this,1)}get mimetype(){return b(this,xt,ic).call(this,2)}get name(){return b(this,xt,ic).call(this,3)}get data(){const{offset:e,length:t}=b(this,xt,ng).call(this);return t===0?void 0:new Uint8Array(r(this,fi),e+4,t)}clearData(){const{offset:e,length:t}=b(this,xt,ng).call(this);t!==0&&(r(this,re).setUint32(e,0),g(this,fi,new Uint8Array(r(this,fi),0,e+4).slice().buffer),g(this,re,new DataView(r(this,fi))))}get cssFontInfo(){let e=gs.OFFSET_STRINGS;const t=r(this,re).getUint32(e);e+=4+t;const s=r(this,re).getUint32(e);e+=4+s;const i=r(this,re).getUint32(e);if(i===0)return null;const n=new Uint8Array(i);return n.set(new Uint8Array(r(this,fi),e+4,i)),new kA(n.buffer)}get systemFontInfo(){let e=gs.OFFSET_STRINGS;const t=r(this,re).getUint32(e);e+=4+t;const s=r(this,re).getUint32(e);if(s===0)return null;const i=new Uint8Array(s);return i.set(new Uint8Array(r(this,fi),e+4,s)),new FA(i.buffer)}}fi=new WeakMap,re=new WeakMap,xt=new WeakSet,ai=function(e){qt(e<gs.bools.length,"Invalid boolean index");const t=Math.floor(e/4),s=e*2%8,i=r(this,re).getUint8(t)>>s&3;return i===0?void 0:i===2},Uu=function(e){return qt(e<gs.numbers.length,"Invalid number index"),r(this,re).getFloat64(gs.OFFSET_NUMBERS+e*8)},Hu=function(e,t,s,i){const n=r(this,re).getUint8(e);if(n===0)return;qt(n===t,"Invalid array length."),e+=1;const a=new Array(n);for(let o=0;o<n;o++)a[o]=r(this,re)[s](e,!0),e+=i;return a},ic=function(e){qt(e<gs.strings.length,"Invalid string index");const{decoder:t}=Af;let s=gs.OFFSET_STRINGS+4;for(let n=0;n<e;n++)s+=r(this,re).getUint32(s)+4;const i=r(this,re).getUint32(s);return t.decode(new Uint8Array(r(this,fi),s+4,i))},ng=function(){let e=gs.OFFSET_STRINGS;const t=r(this,re).getUint32(e);e+=4+t;const s=r(this,re).getUint32(e);e+=4+s;const i=r(this,re).getUint32(e);e+=4+i;const n=r(this,re).getUint32(e);return{offset:e,length:n}};class NA{constructor(e){this.buffer=e,this.view=new DataView(e),this.data=new Uint8Array(e)}getIR(){const e=this.view,t=this.data[ss.KIND],s=!!this.data[ss.HAS_BBOX],i=!!this.data[ss.HAS_BACKGROUND],n=e.getUint32(ss.N_COORD,!0),a=e.getUint32(ss.N_COLOR,!0),o=e.getUint32(ss.N_STOP,!0);let l=20;const h=new Float32Array(this.buffer,l,n*2);l+=n*8;const c=new Uint8Array(this.buffer,l,a*4);l+=a*4;const u=[];for(let m=0;m<o;++m){const v=e.getFloat32(l,!0);l+=4;const A=e.getUint32(l,!0);l+=4,u.push([v,`#${A.toString(16).padStart(6,"0")}`])}let f=null;if(s){f=[];for(let m=0;m<4;++m)f.push(e.getFloat32(l,!0)),l+=4}let p=null;if(i&&(p=new Uint8Array(this.buffer,l,3),l+=3),t===1)return["RadialAxial","axial",f,u,Array.from(h.slice(0,2)),Array.from(h.slice(2,4)),null,null];if(t===2)return["RadialAxial","radial",f,u,[h[0],h[1]],[h[3],h[4]],h[2],h[5]];if(t===3){const m=this.data[ss.SHADING_TYPE];let v=null;if(h.length>0){v=Jn.slice();for(let A=0,w=h.length;A<w;A+=2)_.pointBoundingBox(h[A],h[A+1],v)}return["Mesh",m,h,c,n,v,f,p]}throw new Error(`Unsupported pattern kind: ${t}`)}}var jl;class BA{constructor(e){y(this,jl);g(this,jl,e)}get path(){return Mt.isFloat16ArraySupported?new Float16Array(r(this,jl)):new Float32Array(r(this,jl))}}jl=new WeakMap;function UA(d){if(d instanceof URL)return d;if(typeof d=="string"){if(ks){if(/^[a-z][a-z0-9\-+.]+:/i.test(d))return new URL(d);const t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(d))}const e=URL.parse(d,window.location);if(e)return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function HA(d){if(ks&&typeof Buffer<"u"&&d instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(d instanceof Uint8Array&&d.byteLength===d.buffer.byteLength)return d;if(typeof d=="string")return sp(d);if(d instanceof ArrayBuffer||ArrayBuffer.isView(d)||typeof d=="object"&&!isNaN(d==null?void 0:d.length))return new Uint8Array(d);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function wu(d){if(typeof d!="string")return null;if(d.endsWith("/"))return d;throw new Error(`Invalid factory url: "${d}" must include trailing slash.`)}const rg=d=>typeof d=="object"&&Number.isInteger(d==null?void 0:d.num)&&d.num>=0&&Number.isInteger(d==null?void 0:d.gen)&&d.gen>=0,_A=d=>typeof d=="object"&&typeof(d==null?void 0:d.name)=="string",$A=cA.bind(null,rg,_A);var Tn,kf;class jA{constructor(){y(this,Tn,new Map);y(this,kf,Promise.resolve())}postMessage(e,t){const s={data:structuredClone(e,t?{transfer:t}:null)};r(this,kf).then(()=>{for(const[i]of r(this,Tn))i.call(this,s)})}addEventListener(e,t,s=null){let i=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:n}=s;if(n.aborted){st("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(e,t);i=()=>n.removeEventListener("abort",a),n.addEventListener("abort",a)}r(this,Tn).set(t,i)}removeEventListener(e,t){const s=r(this,Tn).get(t);s==null||s(),r(this,Tn).delete(t)}terminate(){for(const[,e]of r(this,Tn))e==null||e();r(this,Tn).clear()}}Tn=new WeakMap,kf=new WeakMap;ot(1689);const Su={DATA:1,ERROR:2},oe={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function lv(){}function as(d){if(d instanceof la||d instanceof Cp||d instanceof Tp||d instanceof vf||d instanceof mp)return d;switch(d instanceof Error||typeof d=="object"&&d!==null||gt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),d.name){case"AbortException":return new la(d.message);case"InvalidPDFException":return new Cp(d.message);case"PasswordException":return new Tp(d.message,d.code);case"ResponseException":return new vf(d.message,d.status,d.missing);case"UnknownErrorException":return new mp(d.message,d.details)}return new mp(d.message,d.toString())}var Gl,ii,my,vy,yy,_u;class nc{constructor(e,t,s){y(this,ii);y(this,Gl,new AbortController);this.sourceName=e,this.targetName=t,this.comObj=s,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),s.addEventListener("message",b(this,ii,my).bind(this),{signal:r(this,Gl).signal})}on(e,t){const s=this.actionHandler;if(s[e])throw new Error(`There is already an actionName called "${e}"`);s[e]=t}send(e,t,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},s)}sendWithPromise(e,t,s){const i=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},s)}catch(a){n.reject(a)}return n.promise}sendWithStream(e,t,s,i){const n=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{const c=Promise.withResolvers();return this.streamControllers[n]={controller:h,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:e,streamId:n,data:t,desiredSize:h.desiredSize},i),c.promise},pull:h=>{const c=Promise.withResolvers();return this.streamControllers[n].pullCall=c,l.postMessage({sourceName:a,targetName:o,stream:oe.PULL,streamId:n,desiredSize:h.desiredSize}),c.promise},cancel:h=>{qt(h instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[n].cancelCall=c,this.streamControllers[n].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:oe.CANCEL,streamId:n,reason:as(h)}),c.promise}},s)}destroy(){var e;(e=r(this,Gl))==null||e.abort(),g(this,Gl,null)}}Gl=new WeakMap,ii=new WeakSet,my=function({data:e}){if(e.targetName!==this.sourceName)return;if(e.stream){b(this,ii,yy).call(this,e);return}if(e.callback){const s=e.callbackId,i=this.callbackCapabilities[s];if(!i)throw new Error(`Cannot resolve callback ${s}`);if(delete this.callbackCapabilities[s],e.callback===Su.DATA)i.resolve(e.data);else if(e.callback===Su.ERROR)i.reject(as(e.reason));else throw new Error("Unexpected callback case");return}const t=this.actionHandler[e.action];if(!t)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const s=this.sourceName,i=e.sourceName,n=this.comObj;Promise.try(t,e.data).then(function(a){n.postMessage({sourceName:s,targetName:i,callback:Su.DATA,callbackId:e.callbackId,data:a})},function(a){n.postMessage({sourceName:s,targetName:i,callback:Su.ERROR,callbackId:e.callbackId,reason:as(a)})});return}if(e.streamId){b(this,ii,vy).call(this,e);return}t(e.data)},vy=function(e){const t=e.streamId,s=this.sourceName,i=e.sourceName,n=this.comObj,a=this,o=this.actionHandler[e.action],l={enqueue(h,c=1,u){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=c,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:oe.ENQUEUE,streamId:t,chunk:h},u)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:oe.CLOSE,streamId:t}),delete a.streamSinks[t])},error(h){qt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:oe.ERROR,streamId:t,reason:as(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[t]=l,Promise.try(o,e.data,l).then(function(){n.postMessage({sourceName:s,targetName:i,stream:oe.START_COMPLETE,streamId:t,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:oe.START_COMPLETE,streamId:t,reason:as(h)})})},yy=function(e){const t=e.streamId,s=this.sourceName,i=e.sourceName,n=this.comObj,a=this.streamControllers[t],o=this.streamSinks[t];switch(e.stream){case oe.START_COMPLETE:e.success?a.startCall.resolve():a.startCall.reject(as(e.reason));break;case oe.PULL_COMPLETE:e.success?a.pullCall.resolve():a.pullCall.reject(as(e.reason));break;case oe.PULL:if(!o){n.postMessage({sourceName:s,targetName:i,stream:oe.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&e.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=e.desiredSize,Promise.try(o.onPull||lv).then(function(){n.postMessage({sourceName:s,targetName:i,stream:oe.PULL_COMPLETE,streamId:t,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:oe.PULL_COMPLETE,streamId:t,reason:as(h)})});break;case oe.ENQUEUE:if(qt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(e.chunk);break;case oe.CLOSE:if(qt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),b(this,ii,_u).call(this,a,t);break;case oe.ERROR:qt(a,"error should have stream controller"),a.controller.error(as(e.reason)),b(this,ii,_u).call(this,a,t);break;case oe.CANCEL_COMPLETE:e.success?a.cancelCall.resolve():a.cancelCall.reject(as(e.reason)),b(this,ii,_u).call(this,a,t);break;case oe.CANCEL:if(!o)break;const l=as(e.reason);Promise.try(o.onCancel||lv,l).then(function(){n.postMessage({sourceName:s,targetName:i,stream:oe.CANCEL_COMPLETE,streamId:t,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:oe.CANCEL_COMPLETE,streamId:t,reason:as(h)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},_u=async function(e,t){var s,i,n;await Promise.allSettled([(s=e.startCall)==null?void 0:s.promise,(i=e.pullCall)==null?void 0:i.promise,(n=e.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[t]};var Ff;class by{constructor({cMapUrl:e=null,standardFontDataUrl:t=null,wasmUrl:s=null}){y(this,Ff,Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"}));this.cMapUrl=e,this.standardFontDataUrl=t,this.wasmUrl=s}async fetch({kind:e,filename:t}){switch(e){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:gt(`Not implemented: ${e}`)}const s=this[e];if(!s)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const i=`${s}${t}`;return this._fetch(i,e).catch(n=>{throw new Error(`Unable to load ${r(this,Ff)[e]} data at: ${i}`)})}async _fetch(e,t){gt("Abstract method `_fetch` called.")}}Ff=new WeakMap;class hv extends by{async _fetch(e,t){const s=t==="cMapUrl"&&!e.endsWith(".bcmap")?"text":"bytes",i=await Sm(e,s);return i instanceof Uint8Array?i:sp(i)}}var ad;class Ay{constructor({enableHWA:e=!1}){y(this,ad,!1);g(this,ad,e)}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(e,t);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!r(this,ad)})}}reset({canvas:e},t,s){if(!e)throw new Error("Canvas is not specified");if(t<=0||s<=0)throw new Error("Invalid canvas size");e.width=t,e.height=s}destroy(e){const{canvas:t}=e;if(!t)throw new Error("Canvas is not specified");t.width=t.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){gt("Abstract method `_createCanvas` called.")}}ad=new WeakMap;class GA extends Ay{constructor({ownerDocument:e=globalThis.document,enableHWA:t=!1}){super({enableHWA:t}),this._document=e}_createCanvas(e,t){const s=this._document.createElement("canvas");return s.width=e,s.height=t,s}}class wy{addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addKnockoutFilter(e=0){return"none"}addHighlightHCMFilter(e,t,s,i,n){return"none"}addSelectionHCMFilter(e,t){return"none"}addSelectionFilter(){return"none"}createSelectionStyle(e=null){return null}destroy(e=!1){}}var Ja,Vl,Cn,Gi,Se,Qa,kr,$,be,rc,Ii,$u,da,Sy,ag,ua,ac,oc,og,lc,Ey,lg,xy;class VA extends wy{constructor({docId:t,ownerDocument:s=globalThis.document}){super();y(this,$);y(this,Ja);y(this,Vl);y(this,Cn);y(this,Gi);y(this,Se);y(this,Qa);y(this,kr,0);g(this,Gi,t),g(this,Se,s)}addFilter(t){if(!t)return"none";let s=r(this,$,be).get(t);if(s)return s;const[i,n,a]=b(this,$,$u).call(this,t),o=t.length===1?i:`${i}${n}${a}`;if(s=r(this,$,be).get(o),s)return r(this,$,be).set(t,s),s;const l=`g_${r(this,Gi)}_transfer_map_${Xt(this,kr)._++}`,h=b(this,$,da).call(this,l);r(this,$,be).set(t,h),r(this,$,be).set(o,h);const c=b(this,$,ua).call(this,l);return b(this,$,oc).call(this,i,n,a,c),h}addHCMFilter(t,s){var m;const i=`${t}-${s}`,n="base";let a=r(this,$,rc).get(n);if((a==null?void 0:a.key)===i||(a?((m=a.filter)==null||m.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},r(this,$,rc).set(n,a)),!t||!s))return a.url;const o=b(this,$,lc).call(this,t);t=_.makeHexColor(...o);const l=b(this,$,lc).call(this,s);if(s=_.makeHexColor(...l),b(this,$,lg).call(this),t==="#000000"&&s==="#ffffff"||t===s)return a.url;const c=Array.from({length:256},(v,A)=>Dp(A/255)).join(","),u=`g_${r(this,Gi)}_hcm_filter`,f=a.filter=b(this,$,ua).call(this,u);b(this,$,oc).call(this,c,c,c,f),b(this,$,ag).call(this,f);const p=(v,A)=>{const w=o[v]/255,S=l[v]/255,x=new Array(A+1);for(let C=0;C<=A;C++)x[C]=w+C/A*(S-w);return x.join(",")};return b(this,$,oc).call(this,p(0,5),p(1,5),p(2,5),f),a.url=b(this,$,da).call(this,u),a.url}addSelectionHCMFilter(t,s){return this.addHighlightHCMFilter("selection",t,s,"HighlightText","Highlight")}addSelectionFilter(){return this.addHighlightHCMFilter("selection_default","black","white","HighlightText","Highlight")}createSelectionStyle(t=null){const s=t?this.addSelectionHCMFilter(t.foreground,t.background):this.addSelectionFilter();return s==="none"||!Mt.platform.isFirefox?null:{"backdrop-filter":s,"background-color":"transparent"}}addAlphaFilter(t){let s=r(this,$,be).get(t);if(s)return s;const[i]=b(this,$,$u).call(this,[t]),n=`alpha_${i}`;if(s=r(this,$,be).get(n),s)return r(this,$,be).set(t,s),s;const a=`g_${r(this,Gi)}_alpha_map_${Xt(this,kr)._++}`,o=b(this,$,da).call(this,a);r(this,$,be).set(t,o),r(this,$,be).set(n,o);const l=b(this,$,ua).call(this,a);return b(this,$,og).call(this,i,l),o}addLuminosityFilter(t){let s=r(this,$,be).get(t||"luminosity");if(s)return s;let i,n;if(t?([i]=b(this,$,$u).call(this,[t]),n=`luminosity_${i}`):n="luminosity",s=r(this,$,be).get(n),s)return r(this,$,be).set(t,s),s;const a=`g_${r(this,Gi)}_luminosity_map_${Xt(this,kr)._++}`,o=b(this,$,da).call(this,a);r(this,$,be).set(t,o),r(this,$,be).set(n,o);const l=b(this,$,ua).call(this,a);return b(this,$,Sy).call(this,l),t&&b(this,$,og).call(this,i,l),o}addKnockoutFilter(t=0){const s=t>0?Math.min(1/t,1e6):1e6,i=`knockout_${s}`,n=r(this,$,be).get(i);if(n)return n;const a=`g_${r(this,Gi)}_knockout_filter_${Xt(this,kr)._++}`,o=b(this,$,da).call(this,a);r(this,$,be).set(i,o);const l=b(this,$,ua).call(this,a),h=r(this,Se).createElementNS(es,"feComponentTransfer");l.append(h);const c=r(this,Se).createElementNS(es,"feFuncA");return c.setAttribute("type","linear"),c.setAttribute("slope",`${s}`),c.setAttribute("intercept","0"),h.append(c),o}addHighlightHCMFilter(t,s,i,n,a){var S;const o=`${s}-${i}-${n}-${a}`;let l=r(this,$,rc).get(t);if((l==null?void 0:l.key)===o||(l?((S=l.filter)==null||S.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},r(this,$,rc).set(t,l)),!s||!i))return l.url;const[h,c]=[s,i].map(b(this,$,lc).bind(this));let u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),f=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[p,m]=[n,a].map(b(this,$,xy).bind(this));f<u&&([u,f,p,m]=[f,u,m,p]),b(this,$,lg).call(this);const v=(x,C,E)=>{const T=new Array(256),P=(f-u)/E,M=x/255,I=(C-x)/(255*E);let D=0;for(let R=0;R<=E;R++){const U=Math.round(u+R*P),B=M+R*I;for(let N=D;N<=U;N++)T[N]=B;D=U+1}for(let R=D;R<256;R++)T[R]=T[D-1];return T.join(",")},A=`g_${r(this,Gi)}_hcm_${t}_filter`,w=l.filter=b(this,$,ua).call(this,A);return b(this,$,ag).call(this,w),b(this,$,oc).call(this,v(p[0],m[0],5),v(p[1],m[1],5),v(p[2],m[2],5),w),l.url=b(this,$,da).call(this,A),l.url}destroy(t=!1){var s,i,n,a;t&&((s=r(this,Qa))!=null&&s.size)||((i=r(this,Cn))==null||i.parentNode.parentNode.remove(),g(this,Cn,null),(n=r(this,Vl))==null||n.clear(),g(this,Vl,null),(a=r(this,Qa))==null||a.clear(),g(this,Qa,null),g(this,kr,0))}}Ja=new WeakMap,Vl=new WeakMap,Cn=new WeakMap,Gi=new WeakMap,Se=new WeakMap,Qa=new WeakMap,kr=new WeakMap,$=new WeakSet,be=function(){return r(this,Vl)||g(this,Vl,new Map)},rc=function(){return r(this,Qa)||g(this,Qa,new Map)},Ii=function(){if(!r(this,Cn)){const t=r(this,Se).createElement("div"),{style:s}=t;s.colorScheme="only light",s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=r(this,Se).createElementNS(es,"svg");i.setAttribute("width",0),i.setAttribute("height",0),g(this,Cn,r(this,Se).createElementNS(es,"defs")),t.append(i),i.append(r(this,Cn)),r(this,Se).body.append(t)}return r(this,Cn)},$u=function(t){if(t.length===1){const h=t[0],c=new Array(256);for(let f=0;f<256;f++)c[f]=h[f]/255;const u=c.join(",");return[u,u,u]}const[s,i,n]=t,a=new Array(256),o=new Array(256),l=new Array(256);for(let h=0;h<256;h++)a[h]=s[h]/255,o[h]=i[h]/255,l[h]=n[h]/255;return[a.join(","),o.join(","),l.join(",")]},da=function(t){if(r(this,Ja)===void 0){g(this,Ja,"");const s=r(this,Se).URL;s!==r(this,Se).baseURI&&(ip(s)?st('#createUrl: ignore "data:"-URL for performance reasons.'):g(this,Ja,Iv(s,"")))}return`url(${r(this,Ja)}#${t})`},Sy=function(t){const s=r(this,Se).createElementNS(es,"feColorMatrix");s.setAttribute("type","matrix"),s.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(s)},ag=function(t){const s=r(this,Se).createElementNS(es,"feColorMatrix");s.setAttribute("type","matrix"),s.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(s)},ua=function(t){const s=r(this,Se).createElementNS(es,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",t),r(this,$,Ii).append(s),s},ac=function(t,s,i){const n=r(this,Se).createElementNS(es,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),t.append(n)},oc=function(t,s,i,n){const a=r(this,Se).createElementNS(es,"feComponentTransfer");n.append(a),b(this,$,ac).call(this,a,"feFuncR",t),b(this,$,ac).call(this,a,"feFuncG",s),b(this,$,ac).call(this,a,"feFuncB",i)},og=function(t,s){const i=r(this,Se).createElementNS(es,"feComponentTransfer");s.append(i),b(this,$,ac).call(this,i,"feFuncA",t)},lc=function(t){return r(this,$,Ii).style.color="CanvasText",r(this,$,Ii).style.backgroundColor=t,vu(getComputedStyle(r(this,$,Ii)).getPropertyValue("background-color"))},Ey=function(t){return r(this,$,Ii).style.color="CanvasText",r(this,$,Ii).style.backgroundColor=t,mu(getComputedStyle(r(this,$,Ii)).getPropertyValue("background-color"))},lg=function(){r(this,$,Ii).style.color="",r(this,$,Ii).style.backgroundColor=""},xy=function(t){const[s,i,n,a]=b(this,$,Ey).call(this,t);if(a===1)return[s,i,n];const[o,l,h]=b(this,$,lc).call(this,"Canvas");return[Ap(s,o,a),Ap(i,l,a),Ap(n,h,a)]};function Ap(d,e,t){return Math.round(t*d+(1-t)*e)}var Tv;if(ks){let d;try{const e=process.getBuiltinModule("module").createRequire(import.meta.url);try{d=e("@napi-rs/canvas")}catch(t){st(`Cannot load "@napi-rs/canvas" package: "${t}".`)}}catch(e){st(`Cannot access the \`require\` function: "${e}".`)}globalThis.DOMMatrix||(d!=null&&d.DOMMatrix?globalThis.DOMMatrix=d.DOMMatrix:st("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.Path2D||(d!=null&&d.Path2D?globalThis.Path2D=d.Path2D:st("Cannot polyfill `Path2D`, rendering may be broken.")),(Tv=globalThis.navigator)!=null&&Tv.language||(globalThis.navigator={language:"en-US",platform:"",userAgent:""})}async function zA(d){const t=await process.getBuiltinModule("fs/promises").readFile(d);return new Uint8Array(t)}class WA extends wy{}class XA extends Ay{_createCanvas(e,t){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,t)}}class YA extends by{async _fetch(e,t){return zA(e)}}function Ty({src:d,srcPos:e=0,dest:t,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:a=!1}){const o=Mt.isLittleEndian?4278190080:255,[l,h]=a?[n,o]:[o,n],c=s>>3,u=s&7,f=l^h,p=d.length;t=new Uint32Array(t.buffer);let m=0;for(let v=0;v<i;++v){for(const w=e+c;e<w;++e,m+=8){const S=d[e];t[m]=l^-(S>>7&1)&f,t[m+1]=l^-(S>>6&1)&f,t[m+2]=l^-(S>>5&1)&f,t[m+3]=l^-(S>>4&1)&f,t[m+4]=l^-(S>>3&1)&f,t[m+5]=l^-(S>>2&1)&f,t[m+6]=l^-(S>>1&1)&f,t[m+7]=l^-(S&1)&f}if(u===0)continue;const A=e<p?d[e++]:255;for(let w=0;w<u;++w,++m)t[m]=l^-(A>>7-w&1)&f}return{srcPos:e,destPos:m}}function KA({src:d,srcPos:e=0,dest:t,destPos:s=0,width:i,height:n}){let a=0;const o=i*n*3,l=o>>2,h=new Uint32Array(d.buffer,e,l),c=Mt.isLittleEndian?4278190080:255;if(Mt.isLittleEndian){for(;a<l-2;a+=3,s+=4){const u=h[a],f=h[a+1],p=h[a+2];t[s]=u|c,t[s+1]=u>>>24|f<<8|c,t[s+2]=f>>>16|p<<16|c,t[s+3]=p>>>8|c}for(let u=a*4,f=e+o;u<f;u+=3)t[s++]=d[u]|d[u+1]<<8|d[u+2]<<16|c}else{for(;a<l-2;a+=3,s+=4){const u=h[a],f=h[a+1],p=h[a+2];t[s]=u|c,t[s+1]=u<<24|f>>>8|c,t[s+2]=f<<16|p>>>16|c,t[s+3]=p<<8|c}for(let u=a*4,f=e+o;u<f;u+=3)t[s++]=d[u]<<24|d[u+1]<<16|d[u+2]<<8|c}return{srcPos:e+o,destPos:s}}const JA=`
5
+ struct Uniforms {
6
+ offsetX : f32,
7
+ offsetY : f32,
8
+ scaleX : f32,
9
+ scaleY : f32,
10
+ paddedWidth : f32,
11
+ paddedHeight : f32,
12
+ borderSize : f32,
13
+ _pad : f32,
14
+ };
15
+
16
+ @group(0) @binding(0) var<uniform> u : Uniforms;
17
+
18
+ struct VertexInput {
19
+ @location(0) position : vec2<f32>,
20
+ @location(1) color : vec4<f32>,
21
+ };
22
+
23
+ struct VertexOutput {
24
+ @builtin(position) position : vec4<f32>,
25
+ @location(0) color : vec3<f32>,
26
+ };
27
+
28
+ @vertex
29
+ fn vs_main(in : VertexInput) -> VertexOutput {
30
+ var out : VertexOutput;
31
+ let cx = (in.position.x + u.offsetX) * u.scaleX;
32
+ let cy = (in.position.y + u.offsetY) * u.scaleY;
33
+ out.position = vec4<f32>(
34
+ ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
35
+ 1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
36
+ 0.0,
37
+ 1.0
38
+ );
39
+ out.color = in.color.rgb;
40
+ return out;
41
+ }
42
+
43
+ @fragment
44
+ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
45
+ return vec4<f32>(in.color, 1.0);
46
+ }
47
+ `;var Lf,Pn,Za,zl,Nf,Cy;class QA{constructor(){y(this,Nf);y(this,Lf,null);y(this,Pn,null);y(this,Za,null);y(this,zl,null)}init(){return r(this,Lf)||g(this,Lf,b(this,Nf,Cy).call(this))}get isReady(){return r(this,Pn)!==null}loadMeshShader(){if(!r(this,Pn)||r(this,Za))return;const e=r(this,Pn).createShaderModule({code:JA});g(this,Za,r(this,Pn).createRenderPipeline({layout:"auto",vertex:{module:e,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:e,entryPoint:"fs_main",targets:[{format:r(this,zl)}]},primitive:{topology:"triangle-list"}}))}draw(e,t,s,i,n,a,o,l){this.loadMeshShader();const h=r(this,Pn),{offsetX:c,offsetY:u,scaleX:f,scaleY:p}=i,m=h.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&h.queue.writeBuffer(m,0,e);const v=h.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&h.queue.writeBuffer(v,0,t);const A=h.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});h.queue.writeBuffer(A,0,new Float32Array([c,u,f,p,a,o,l,0]));const w=h.createBindGroup({layout:r(this,Za).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:A}}]}),S=new OffscreenCanvas(a,o),x=S.getContext("webgpu");x.configure({device:h,format:r(this,zl),alphaMode:n?"opaque":"premultiplied"});const C=n?{r:n[0]/255,g:n[1]/255,b:n[2]/255,a:1}:{r:0,g:0,b:0,a:0},E=h.createCommandEncoder(),T=E.beginRenderPass({colorAttachments:[{view:x.getCurrentTexture().createView(),clearValue:C,loadOp:"clear",storeOp:"store"}]});return s>0&&(T.setPipeline(r(this,Za)),T.setBindGroup(0,w),T.setVertexBuffer(0,m),T.setVertexBuffer(1,v),T.draw(s)),T.end(),h.queue.submit([E.finish()]),m.destroy(),v.destroy(),A.destroy(),S.transferToImageBitmap()}}Lf=new WeakMap,Pn=new WeakMap,Za=new WeakMap,zl=new WeakMap,Nf=new WeakSet,Cy=async function(){var e;if(!((e=globalThis.navigator)!=null&&e.gpu))return!1;try{const t=await navigator.gpu.requestAdapter();return t?(g(this,zl,navigator.gpu.getPreferredCanvasFormat()),g(this,Pn,await t.requestDevice()),!0):!1}catch{return!1}};const np=new QA;function ZA(){return np.init()}function qA(){return np.isReady}function t0(){np.loadMeshShader()}function e0(d,e,t,s,i,n,a,o){return np.draw(d,e,t,s,i,n,a,o)}const ke={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function ju(d,e){if(!e)return;const t=e[2]-e[0],s=e[3]-e[1],i=new Path2D;i.rect(e[0],e[1],t,s),d.clip(i)}class Cm{constructor(){O(this,"matrix",null)}isModifyingCurrentTransform(){return!1}getPattern(){gt("Abstract method `getPattern` called.")}}class s0 extends Cm{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7]}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}areConic(){if(!this.isRadial())return!1;const e=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return e+this._r1>this._r0&&e+this._r0>this._r1}_createGradient(e,t=null){let s,i=this._p0,n=this._p1;if(t&&(i=i.slice(),n=n.slice(),_.applyTransform(i,t),_.applyTransform(n,t)),this._type==="axial")s=e.createLinearGradient(i[0],i[1],n[0],n[1]);else if(this._type==="radial"){let a=this._r0,o=this._r1;if(t){const l=new Float32Array(2);_.singularValueDecompose2dScale(t,l),a*=l[0],o*=l[0]}s=e.createRadialGradient(i[0],i[1],a,n[0],n[1],o)}for(const a of this._colorStops)s.addColorStop(a[0],a[1]);return s}_createReversedGradient(e,t=null){let s=this._p1,i=this._p0;t&&(s=s.slice(),i=i.slice(),_.applyTransform(s,t),_.applyTransform(i,t));let n=this._r1,a=this._r0;if(t){const h=new Float32Array(2);_.singularValueDecompose2dScale(t,h),n*=h[0],a*=h[0]}const o=e.createRadialGradient(s[0],s[1],n,i[0],i[1],a),l=this._colorStops.map(([h,c])=>[1-h,c]).reverse();for(const[h,c]of l)o.addColorStop(h,c);return o}getPattern(e,t,s,i){let n;if(i===ke.STROKE||i===ke.FILL){if(this.isOriginBased()){let f=_.transform(s,t.baseTransform);this.matrix&&(f=_.transform(f,this.matrix));const p=.001,m=Math.hypot(f[0],f[1]),v=Math.hypot(f[2],f[3]),A=(f[0]*f[2]+f[1]*f[3])/(m*v);if(Math.abs(A)<p)if(this.isRadial()){if(Math.abs(m-v)<p)return this._createGradient(e,f)}else return this._createGradient(e,f)}const a=t.current.getClippedPathBoundingBox(i,Bt(e))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,h=t.canvasFactory.create(o,l),c=h.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-a[0],-a[1]),s=_.transform(s,[1,0,0,1,a[0],a[1]]),c.transform(...t.baseTransform),this.matrix&&c.transform(...this.matrix),ju(c,this._bbox),this.areConic()&&(c.fillStyle=this._createReversedGradient(c),c.fill()),c.fillStyle=this._createGradient(c),c.fill(),n=e.createPattern(h.canvas,"no-repeat"),t.canvasFactory.destroy(h);const u=new DOMMatrix(s);n.setTransform(u)}else this.areConic()&&(e.save(),ju(e,this._bbox),e.fillStyle=this._createReversedGradient(e),e.fillRect(-1e10,-1e10,2e10,2e10),e.restore()),ju(e,this._bbox),n=this._createGradient(e);return n}}function i0(d,e,t,s,i,n,a,o){const l=e.coords,h=e.colors,c=d.data,u=d.width*4;let f;l[t*2+1]>l[s*2+1]&&(f=t,t=s,s=f,f=n,n=a,a=f),l[s*2+1]>l[i*2+1]&&(f=s,s=i,i=f,f=a,a=o,o=f),l[t*2+1]>l[s*2+1]&&(f=t,t=s,s=f,f=n,n=a,a=f);const p=(l[t*2]+e.offsetX)*e.scaleX,m=(l[t*2+1]+e.offsetY)*e.scaleY,v=(l[s*2]+e.offsetX)*e.scaleX,A=(l[s*2+1]+e.offsetY)*e.scaleY,w=(l[i*2]+e.offsetX)*e.scaleX,S=(l[i*2+1]+e.offsetY)*e.scaleY;if(m>=S)return;const x=h[n*4],C=h[n*4+1],E=h[n*4+2],T=h[a*4],P=h[a*4+1],M=h[a*4+2],I=h[o*4],D=h[o*4+1],R=h[o*4+2],U=Math.round(m),B=Math.round(S);let N,W,k,L,Y,z,lt,vt;for(let dt=U;dt<=B;dt++){if(dt<A){const F=dt<m?0:(m-dt)/(m-A);N=p-(p-v)*F,W=x-(x-T)*F,k=C-(C-P)*F,L=E-(E-M)*F}else{let F;dt>S?F=1:A===S?F=0:F=(A-dt)/(A-S),N=v-(v-w)*F,W=T-(T-I)*F,k=P-(P-D)*F,L=M-(M-R)*F}let rt;dt<m?rt=0:dt>S?rt=1:rt=(m-dt)/(m-S),Y=p-(p-w)*rt,z=x-(x-I)*rt,lt=C-(C-D)*rt,vt=E-(E-R)*rt;const bt=Math.round(Math.min(N,Y)),Be=Math.round(Math.max(N,Y));let H=u*dt+bt*4;for(let F=bt;F<=Be;F++)rt=(N-F)/(N-Y),rt<0?rt=0:rt>1&&(rt=1),c[H++]=W-(W-z)*rt|0,c[H++]=k-(k-lt)*rt|0,c[H++]=L-(L-vt)*rt|0,c[H++]=255}}class n0 extends Cm{constructor(e){super(),this._posData=e[2],this._colData=e[3],this._vertexCount=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],t0()}_createMeshCanvas(e,t,s){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-o,c=Math.ceil(this._bounds[3])-l,u=Math.min(Math.ceil(Math.abs(h*e[0]*1.1)),3e3)||1,f=Math.min(Math.ceil(Math.abs(c*e[1]*1.1)),3e3)||1,p=h?h/u:1,m=c?c/f:1,v={coords:this._posData,colors:this._colData,offsetX:-o,offsetY:-l,scaleX:1/p,scaleY:1/m},A=u+4,w=f+4,S=s.create(A,w);if(qA()&&this._vertexCount>48)S.context.drawImage(e0(this._posData,this._colData,this._vertexCount,v,t,A,w,2),0,0);else{const x=S.context.createImageData(u,f);if(t){const C=x.data;for(let E=0,T=C.length;E<T;E+=4)C[E]=t[0],C[E+1]=t[1],C[E+2]=t[2],C[E+3]=255}for(let C=0,E=this._vertexCount;C<E;C+=3)i0(x,v,C,C+1,C+2,C,C+1,C+2);S.context.putImageData(x,2,2)}return{canvas:S.canvas,offsetX:o-2*p,offsetY:l-2*m,scaleX:p,scaleY:m}}isModifyingCurrentTransform(){return!0}getPattern(e,t,s,i){ju(e,this._bbox);const n=new Float32Array(2);if(i===ke.SHADING)_.singularValueDecompose2dScale(Bt(e),n);else if(this.matrix){_.singularValueDecompose2dScale(this.matrix,n);const[l,h]=n;_.singularValueDecompose2dScale(t.baseTransform,n),n[0]*=l,n[1]*=h}else _.singularValueDecompose2dScale(t.baseTransform,n);const a=this._createMeshCanvas(n,i===ke.SHADING?null:this._background,t.canvasFactory);i!==ke.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(a.offsetX,a.offsetY),e.scale(a.scaleX,a.scaleY);const o=e.createPattern(a.canvas,"no-repeat");return t.canvasFactory.destroy(a),o}}class r0 extends Cm{getPattern(){return"hotpink"}}function a0(d){switch(d[0]){case"RadialAxial":return new s0(d);case"Mesh":return new n0(d);case"Dummy":return new r0}throw new Error(`Unknown IR type: ${d[0]}`)}const cv={COLORED:1,UNCOLORED:2},Bf=class Bf{constructor(e,t,s,i){this.color=e[1],this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.needsIsolation=e[9]??!0,this.ctx=t,this.canvasGraphicsFactory=s,this.baseTransform=i,this.patternBaseMatrix=this.matrix?_.transform(i,this.matrix):i}canSkipPatternCanvas([e,t,s,i]){const[n,a,o,l]=this.bbox,h=Math.abs(this.xstep),c=Math.abs(this.ystep);if(e>h+1e-6||t>c+1e-6)return null;const u=Math.floor((s-o)/h)+1,f=Math.ceil((s+e-n)/h)-1,p=Math.floor((i-l)/c)+1,m=Math.ceil((i+t-a)/c)-1;return f<=u&&m<=p?[u,p]:null}updatePatternDims(e,t){const s=_.inverseTransform(this.patternBaseMatrix),i=[e[0],e[1]],n=[e[2],e[3]];_.applyTransform(i,s),_.applyTransform(n,s),t[0]=Math.abs(n[0]-i[0]),t[1]=Math.abs(n[1]-i[1]),t[2]=Math.min(i[0],n[0]),t[3]=Math.min(i[1],n[1])}_renderTileCanvas(e,t,s,i){var f,p;const[n,a,o,l]=this.bbox,h=e.canvasFactory.create(s.size,i.size),c=h.context,u=this.canvasGraphicsFactory.createCanvasGraphics(c,t);return u.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(u,this.paintType,this.color),c.translate(-s.scale*n,-i.scale*a),u.transform(0,s.scale,0,0,i.scale,0,0),c.save(),(f=u.dependencyTracker)==null||f.save(),this.clipBbox(u,n,a,o,l),u.baseTransform=Bt(u.ctx),u.executeOperatorList(this.operatorList),u.endDrawing(),(p=u.dependencyTracker)==null||p.restore(),c.restore(),h}_getCombinedScales(){const e=new Float32Array(2);_.singularValueDecompose2dScale(this.matrix,e);const[t,s]=e;return _.singularValueDecompose2dScale(this.baseTransform,e),[t*e[0],s*e[1]]}drawPattern(e,t,s=!1,[i,n],a){const[o,l,h,c]=this.bbox,u=e.dependencyTracker;if(u&&(e.dependencyTracker=new xc(u,a)),e.save(),s?e.ctx.clip(t,"evenodd"):e.ctx.clip(t),e.ctx.setTransform(...this.patternBaseMatrix),e.ctx.translate(i*this.xstep,n*this.ystep),this.needsIsolation||e.ctx.globalAlpha!==1||e.ctx.globalCompositeOperation!=="source-over"||e.inSMaskMode){const f=h-o,p=c-l,[m,v]=this._getCombinedScales(),A=this.getSizeAndScale(f,this.ctx.canvas.width,m),w=this.getSizeAndScale(p,this.ctx.canvas.height,v),S=this._renderTileCanvas(e,a,A,w);e.ctx.drawImage(S.canvas,o,l,f,p),e.canvasFactory.destroy(S)}else this.setFillAndStrokeStyleToContext(e,this.paintType,this.color),this.clipBbox(e,o,l,h,c),e.baseTransformStack.push(e.baseTransform),e.baseTransform=Bt(e.ctx),e.executeOperatorList(this.operatorList),e.baseTransform=e.baseTransformStack.pop();e.restore(),u&&(e.dependencyTracker=u)}createPatternCanvas(e,t){const[s,i,n,a]=this.bbox,o=n-s,l=a-i;let{xstep:h,ystep:c}=this;h=Math.abs(h),c=Math.abs(c),ep("TilingType: "+this.tilingType);const[u,f]=this._getCombinedScales();let p=o,m=l,v=!1,A=!1;Math.ceil(h*u)>=Math.ceil(o*u)?p=h:v=!0,Math.ceil(c*f)>=Math.ceil(l*f)?m=c:A=!0;const w=this.getSizeAndScale(p,this.ctx.canvas.width,u),S=this.getSizeAndScale(m,this.ctx.canvas.height,f),x=this._renderTileCanvas(e,t,w,S);if(v||A){const C=x.canvas;v&&(p=h),A&&(m=c);const E=this.getSizeAndScale(p,this.ctx.canvas.width,u),T=this.getSizeAndScale(m,this.ctx.canvas.height,f),P=E.size,M=T.size,I=e.canvasFactory.create(P,M),D=I.context,R=v?Math.floor(o/h):0,U=A?Math.floor(l/c):0;for(let B=0;B<=R;B++)for(let N=0;N<=U;N++)D.drawImage(C,P*B,M*N,P,M,0,0,P,M);return e.canvasFactory.destroy(x),{canvas:I.canvas,canvasEntry:I,scaleX:E.scale,scaleY:T.scale,offsetX:s,offsetY:i}}return{canvas:x.canvas,canvasEntry:x,scaleX:w.scale,scaleY:S.scale,offsetX:s,offsetY:i}}getSizeAndScale(e,t,s){const i=Math.max(Bf.MAX_PATTERN_SIZE,t);let n=Math.ceil(e*s);return n>=i?n=i:s=n/e,{scale:s,size:n}}clipBbox(e,t,s,i,n){const a=i-t,o=n-s,l=new Path2D;l.rect(t,s,a,o),_.axialAlignedBoundingBox([t,s,i,n],Bt(e.ctx),e.current.minMax),e.ctx.clip(l),e.current.updateClipFromPath()}setFillAndStrokeStyleToContext(e,t,s){const i=e.ctx,n=e.current;switch(n.patternFill=n.patternStroke=!1,t){case cv.COLORED:const{fillStyle:a,strokeStyle:o}=this.ctx;i.fillStyle=n.fillColor=a,i.strokeStyle=n.strokeColor=o;break;case cv.UNCOLORED:i.fillStyle=i.strokeStyle=s,n.fillColor=n.strokeColor=s;break;default:throw new aA(`Unsupported paint type: ${t}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,t,s,i,n){const a=i!==ke.SHADING?_.transform(s,this.patternBaseMatrix):s,o=this.createPatternCanvas(t,n);let l=new DOMMatrix(a);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const h=e.createPattern(o.canvas,"repeat");return t.canvasFactory.destroy(o.canvasEntry),h.setTransform(l),h}};O(Bf,"MAX_PATTERN_SIZE",3e3);let bc=Bf;const o0=16,l0=100,h0=15,dv=10,ps=16,Fs=new Float32Array(2);function uv(d,e){if(d._removeMirroring)throw new Error("Context is already forwarding operations.");const t=new Map;for(const s of["save","restore","rotate","scale","translate","transform","setTransform","resetTransform","clip","moveTo","lineTo","bezierCurveTo","quadraticCurveTo","arc","arcTo","ellipse","rect","roundRect","closePath","beginPath"]){const i=d[s];typeof i!="function"||typeof e[s]!="function"||(t.set(s,i),d[s]=function(...n){return e[s](...n),i.apply(this,n)})}d._removeMirroring=()=>{for(const[s,i]of t)d[s]=i;delete d._removeMirroring}}function Eu(d,e,t,s,i,n,a,o,l,h){const[c,u,f,p,m,v]=Bt(d);if(u===0&&f===0){const S=a*c+m,x=Math.round(S),C=o*p+v,E=Math.round(C),T=(a+l)*c+m,P=Math.abs(Math.round(T)-x)||1,M=(o+h)*p+v,I=Math.abs(Math.round(M)-E)||1;return d.setTransform(Math.sign(c),0,0,Math.sign(p),x,E),d.drawImage(e,t,s,i,n,0,0,P,I),d.setTransform(c,u,f,p,m,v),[P,I]}if(c===0&&p===0){const S=o*f+m,x=Math.round(S),C=a*u+v,E=Math.round(C),T=(o+h)*f+m,P=Math.abs(Math.round(T)-x)||1,M=(a+l)*u+v,I=Math.abs(Math.round(M)-E)||1;return d.setTransform(0,Math.sign(u),Math.sign(f),0,x,E),d.drawImage(e,t,s,i,n,0,0,I,P),d.setTransform(c,u,f,p,m,v),[I,P]}d.drawImage(e,t,s,i,n,a,o,l,h);const A=Math.hypot(c,u),w=Math.hypot(f,p);return[A*l,w*h]}class fv{constructor(e,t){O(this,"alphaIsShape",!1);O(this,"fontSize",0);O(this,"fontSizeScale",1);O(this,"textMatrix",null);O(this,"textMatrixScale",1);O(this,"fontMatrix",Ep);O(this,"leading",0);O(this,"x",0);O(this,"y",0);O(this,"lineX",0);O(this,"lineY",0);O(this,"charSpacing",0);O(this,"wordSpacing",0);O(this,"textHScale",1);O(this,"textRenderingMode",fe.FILL);O(this,"textRise",0);O(this,"fillColor","#000000");O(this,"strokeColor","#000000");O(this,"tilingPatternDims",null);O(this,"patternFill",!1);O(this,"patternStroke",!1);O(this,"fillAlpha",1);O(this,"strokeAlpha",1);O(this,"lineWidth",1);O(this,"activeSMask",null);O(this,"transferMaps","none");O(this,"minMax",Aa.slice());this.clipBox=new Float32Array([0,0,e,t])}clone(){var t;const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e.tilingPatternDims=(t=this.tilingPatternDims)==null?void 0:t.slice(),e}getPathBoundingBox(e=ke.FILL,t=null){const s=this.minMax.slice();if(e===ke.STROKE){t||gt("Stroke bounding box must include transform."),_.singularValueDecompose2dScale(t,Fs);const i=Fs[0]*this.lineWidth/2,n=Fs[1]*this.lineWidth/2;s[0]-=i,s[1]-=n,s[2]+=i,s[3]+=n}return s}updateClipFromPath(){const e=_.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(Aa,0)}getClippedPathBoundingBox(e=ke.FILL,t=null){return _.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function pv(d,e){const{width:t,height:s,kind:i}=e,n=s%ps,a=(s-n)/ps,o=n===0?a:a+1,l=d.createImageData(t,ps);let h=0;const c=e.data,u=l.data;let f;if(i===Ou.GRAYSCALE_1BPP)for(f=0;f<o;f++)({srcPos:h}=Ty({src:c,srcPos:h,dest:u,width:t,height:f<a?ps:n})),d.putImageData(l,0,f*ps);else if(i===Ou.RGBA_32BPP){let p=0,m=t*ps*4;for(f=0;f<a;f++)u.set(c.subarray(h,h+m)),h+=m,d.putImageData(l,0,p),p+=ps;f<o&&(m=t*n*4,u.set(c.subarray(h,h+m)),d.putImageData(l,0,p))}else if(i===Ou.RGB_24BPP)for(f=0;f<o;f++)({srcPos:h}=KA({src:c,srcPos:h,dest:new Uint32Array(u.buffer),width:t,height:f<a?ps:n})),d.putImageData(l,0,f*ps);else throw new Error(`bad image kind: ${i}`)}function gv(d,e){if(e.bitmap){d.drawImage(e.bitmap,0,0);return}const{width:t,height:s}=e,i=s%ps,n=(s-i)/ps,a=i===0?n:n+1,o=d.createImageData(t,ps);let l=0;const h=e.data,c=o.data;for(let u=0;u<a;u++)({srcPos:l}=Ty({src:h,srcPos:l,dest:c,width:t,height:u<n?ps:i,nonBlackColor:0})),d.putImageData(o,0,u*ps)}function ca(d,e){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of t)d[s]!==void 0&&(e[s]=d[s]);d.setLineDash!==void 0&&(e.setLineDash(d.getLineDash()),e.lineDashOffset=d.lineDashOffset)}function xu(d){d.strokeStyle=d.fillStyle="#000000",d.fillRule="nonzero",d.globalAlpha=1,d.lineWidth=1,d.lineCap="butt",d.lineJoin="miter",d.miterLimit=10,d.globalCompositeOperation="source-over",d.font="10px sans-serif",d.setLineDash!==void 0&&(d.setLineDash([]),d.lineDashOffset=0);const{filter:e}=d;e!=="none"&&e!==""&&(d.filter="none")}function mv(d,e){if(e)return!0;_.singularValueDecompose2dScale(d,Fs);const t=Math.fround(xi.pixelRatio*ha.PDF_TO_CSS_UNITS);return Fs[0]<=t&&Fs[1]<=t}const c0=["butt","round","square"],d0=["miter","round","bevel"],u0={},vv={};var Uf,As,Fr,qa,to,eo,so,io,no,ro,Vi,K,hg,cg,dg,ug,fg,rs,Ue,pg,Py,Gu;const va=class va{constructor(e,t,s,i,n,{optionalContentConfig:a,markedContentStack:o=null},l,h,c,u){y(this,K);y(this,As,0);y(this,Fr,0);y(this,qa,null);y(this,to,null);y(this,eo,null);y(this,so,null);y(this,io,1);y(this,no);y(this,ro,null);y(this,Vi,[]);this.ctx=e,this.current=new fv(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=t,this.objs=s,this.canvasFactory=i,this.filterFactory=n,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=c??null,this.imagesTracker=u??null}getObject(e,t,s=null){var i;return typeof t=="string"?((i=this.dependencyTracker)==null||i.recordNamedDependency(e,t),t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t)):s}beginDrawing({transform:e,viewport:t,transparency:s=!1,background:i=null}){const n=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,a),this.ctx.fillStyle=o,s){const l=this.transparentCanvasEntry=this.canvasFactory.create(n,a);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=l,this.ctx.save(),this.ctx.transform(...Bt(this.compositeCtx))}this.ctx.save(),xu(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[3]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=Bt(this.ctx)}executeOperatorList(e,t,s,i,n){var w;const a=e.argsArray,o=e.fnArray;let l=t||0;const h=a.length;if(h===l)return l;const c=h-l>dv&&typeof s=="function",u=c?Date.now()+h0:0;let f=0;const p=this.commonObjs,m=this.objs;let v,A;for(;;){if(i!==void 0){if(l===i.nextBreakPoint)return i.breakIt(l,s),l;if(i.shouldSkip(l)){if(++l===h)return l;continue}}if(!n||n(l))if(v=o[l],A=a[l]??null,v!==Mi.dependency)A===null?this[v](l):this[v](l,...A);else for(const S of A){(w=this.dependencyTracker)==null||w.recordNamedData(S,l);const x=S.startsWith("g_")?p:m;if(!x.has(S))return x.get(S,s),l}if(l++,l===h)return l;if(c&&++f>dv){if(Date.now()>u)return s(),l;f=0}}}endDrawing(){b(this,K,hg).call(this);for(const e of this.smaskGroupCanvases)this.canvasFactory.destroy(e);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(const e of r(this,Vi))b(this,K,Gu).call(this,e);r(this,Vi).length=0,g(this,qa,null),g(this,to,null),g(this,eo,null),g(this,so,null),g(this,io,1),g(this,ro,null),g(this,Fr,0),g(this,As,0),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),b(this,K,cg).call(this)}_scaleImage(e,t){const s=e.width??e.displayWidth,i=e.height??e.displayHeight,n=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=[];let l=n,h=a,c=s,u=i;for(;l>2&&c>1||h>2&&u>1;){let w=c,S=u;l>2&&c>1&&(w=Math.ceil(c/2),l/=c/w),h>2&&u>1&&(S=Math.ceil(u/2),h/=u/S),o.push({newWidth:w,newHeight:S}),c=w,u=S}if(o.length===0)return{img:e,paintWidth:s,paintHeight:i,tmpCanvas:null};if(o.length===1){const{newWidth:w,newHeight:S}=o[0],x=this.canvasFactory.create(w,S);return x.context.drawImage(e,0,0,s,i,0,0,w,S),{img:x.canvas,paintWidth:w,paintHeight:S,tmpCanvas:x}}let f=this.canvasFactory.create(1,1),p=this.canvasFactory.create(1,1),m=s,v=i,A=e;for(const{newWidth:w,newHeight:S}of o)this.canvasFactory.reset(p,w,S),p.context.drawImage(A,0,0,m,v,0,0,w,S),[f,p]=[p,f],A=f.canvas,m=w,v=S;return this.canvasFactory.destroy(p),{img:f.canvas,paintWidth:m,paintHeight:v,tmpCanvas:f}}_createMaskCanvas(e,t){var R,U;const s=this.ctx,{width:i,height:n}=t,a=this.current.fillColor,o=this.current.patternFill,l=Bt(s);let h,c,u,f;if((t.bitmap||t.data)&&t.count>1){const B=t.bitmap||t.data.buffer;c=JSON.stringify(o?l:[l.slice(0,4),a]),h=this._cachedBitmapsMap.getOrInsertComputed(B,Am);const N=h.get(c);if(N&&!o){const W=Math.round(Math.min(l[0],l[2])+l[4]),k=Math.round(Math.min(l[1],l[3])+l[5]);return(R=this.dependencyTracker)==null||R.recordDependencies(e,_s.transformAndFill),{canvas:N,offsetX:W,offsetY:k}}u=N}u||(f=this.canvasFactory.create(i,n),gv(f.context,t));let p=_.transform(l,[1/i,0,0,-1/n,0,0]);p=_.transform(p,[1,0,0,1,0,-n]);const m=Aa.slice();_.axialAlignedBoundingBox([0,0,i,n],p,m);const[v,A,w,S]=m,x=Math.round(w-v)||1,C=Math.round(S-A)||1,E=this.canvasFactory.create(x,C),T=E.context,P=v,M=A;T.translate(-P,-M),T.transform(...p);let I=null;if(!u){const B=this._scaleImage(f.canvas,Ci(T));u=B.img,I=B.tmpCanvas,u!==f.canvas&&(this.canvasFactory.destroy(f),f=null),h&&o&&(h.set(c,u),I=null,f=null)}T.imageSmoothingEnabled=mv(Bt(T),t.interpolate),Eu(T,u,0,0,u.width,u.height,0,0,i,n),I&&this.canvasFactory.destroy(I),f&&this.canvasFactory.destroy(f),T.globalCompositeOperation="source-in";const D=_.transform(Ci(T),[1,0,0,1,-P,-M]);return T.fillStyle=o?a.getPattern(s,this,D,ke.FILL,e):a,T.fillRect(0,0,i,n),h&&!o&&h.set(c,E.canvas),(U=this.dependencyTracker)==null||U.recordDependencies(e,_s.transformAndFill),{canvas:E.canvas,canvasEntry:h&&!o?null:E,offsetX:Math.round(P),offsetY:Math.round(M)}}setLineWidth(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineWidth",e),t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineCap",e),this.ctx.lineCap=c0[t]}setLineJoin(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineJoin",e),this.ctx.lineJoin=d0[t]}setMiterLimit(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("miterLimit",e),this.ctx.miterLimit=t}setDash(e,t,s){var n;(n=this.dependencyTracker)==null||n.recordSimpleData("dash",e);const i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=s)}setRenderingIntent(e,t){}setFlatness(e,t){}setGState(e,t){var s,i,n,a,o;for(const[l,h]of t)switch(l){case"LW":this.setLineWidth(e,h);break;case"LC":this.setLineCap(e,h);break;case"LJ":this.setLineJoin(e,h);break;case"ML":this.setMiterLimit(e,h);break;case"D":this.setDash(e,h[0],h[1]);break;case"RI":this.setRenderingIntent(e,h);break;case"FL":this.setFlatness(e,h);break;case"Font":this.setFont(e,h[0],h[1]);break;case"CA":(s=this.dependencyTracker)==null||s.recordSimpleData("strokeAlpha",e),this.current.strokeAlpha=h;break;case"ca":(i=this.dependencyTracker)==null||i.recordSimpleData("fillAlpha",e),this.ctx.globalAlpha=this.current.fillAlpha=h;break;case"BM":(n=this.dependencyTracker)==null||n.recordSimpleData("globalCompositeOperation",e),this.ctx.globalCompositeOperation=h;break;case"SMask":(a=this.dependencyTracker)==null||a.recordSimpleData("SMask",e),this.current.activeSMask=h?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(e);break;case"TR":(o=this.dependencyTracker)==null||o.recordSimpleData("filter",e),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(h);break}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&(this.canvasFactory.destroy(this.smaskPreparedEntry),this.smaskPreparedEntry=null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(e){e!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(e))}checkSMaskState(e){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode(e):!this.current.activeSMask&&t?this.endSMaskMode():this.current.activeSMask&&t&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(e){const{canvas:t,subtype:s,backdrop:i,transferMap:n}=e,a=s==="Luminosity"||s==="Alpha"&&n;if(!a&&!(s==="Luminosity"&&i)){this.smaskPreparedFor=e;return}let o;if(s==="Luminosity"&&i){const[S,x,C]=mu(i),E=Math.round(.3*S+.59*x+.11*C);o=(n==null?void 0:n[E])??E}else o=(n==null?void 0:n[0])??0;const l=4,{width:h,height:c}=this.ctx.canvas,u=t.width*t.height,f=h*c<l*u,p=a?{url:s==="Alpha"?this.filterFactory.addAlphaFilter(n):this.filterFactory.addLuminosityFilter(n),subtype:s,transferMap:n}:null,m=s==="Luminosity"?i:null;let v,A,w;f?(v=this._bakeSMaskCanvas(t,e.offsetX,e.offsetY,h,c,m,p),A=0,w=0):(v=this._bakeSMaskCanvas(t,0,0,t.width,t.height,m,p),A=e.offsetX,w=e.offsetY),this.smaskPreparedEntry=v,this.smaskPreparedFor=e,this.smaskPreparedOffsetX=A,this.smaskPreparedOffsetY=w,this.smaskPreparedOOBAlpha=!f&&o!==0?o:null}_bakeSMaskCanvas(e,t,s,i,n,a,o){!a&&!o&&gt("_bakeSMaskCanvas with neither backdrop nor filter");const l=this.canvasFactory.create(i,n),h=l.context;if(h.drawImage(e,t,s),a&&(h.globalCompositeOperation="destination-atop",h.fillStyle=a,h.fillRect(0,0,i,n)),!o)return l;const c=this.canvasFactory.create(i,n),u=c.context;u.filter=o.url;const f=Mt.isCanvasFilterSupported&&u.filter!=="none"&&u.filter!=="";if(u.drawImage(l.canvas,0,0),Mt.isCanvasFilterSupported&&(u.filter="none"),!f){const p=u.getImageData(0,0,i,n),{data:m}=p,{transferMap:v}=o;if(o.subtype==="Luminosity")for(let A=0,w=m.length;A<w;A+=4){const S=.3*m[A]+.59*m[A+1]+.11*m[A+2]+.5|0;m[A]=m[A+1]=m[A+2]=0,m[A+3]=(v==null?void 0:v[S])??S}else for(let A=3,w=m.length;A<w;A+=4)m[A]=v[m[A]];u.putImageData(p,0,0)}return this.canvasFactory.destroy(l),c}beginSMaskMode(e){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const{width:t,height:s}=this.ctx.canvas,i=this.canvasFactory.create(t,s);this.smaskScratchCanvas=i,this.suspendedCtx=this.ctx;const n=this.ctx=i.context;n.setTransform(this.suspendedCtx.getTransform()),ca(this.suspendedCtx,n),uv(n,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(e,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),ca(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}compose(e){if(!this.current.activeSMask)return;e=e?[Math.floor(e[0]),Math.floor(e[1]),Math.ceil(e[2]),Math.ceil(e[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,s=this.suspendedCtx,i=r(this,Fr)>0&&s===this.ctx;this.composeSMask(i?null:s,t,this.ctx,e),!i&&(this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore())}composeSMask(e,t,s,i){const n=i[0],a=i[1],o=i[2]-n,l=i[3]-a;if(o===0||l===0)return;const h=this.smaskPreparedEntry;if(h){let c=n,u=a,f=o,p=l;const m=this.smaskPreparedOOBAlpha,v=m!==null;if(v){c=Math.max(n,t.offsetX),u=Math.max(a,t.offsetY);const A=Math.min(n+o,t.offsetX+t.canvas.width),w=Math.min(a+l,t.offsetY+t.canvas.height);f=A-c,p=w-u}if(f>0&&p>0){const A=c-this.smaskPreparedOffsetX,w=u-this.smaskPreparedOffsetY;s.save(),s.globalAlpha=1,s.setTransform(1,0,0,1,0,0);const S=new Path2D;S.rect(c,u,f,p),s.clip(S),s.globalCompositeOperation="destination-in",s.drawImage(h.canvas,A,w,f,p,c,u,f,p),s.restore()}v&&m<255&&this._applySMaskOOBAlpha(s,n,a,o,l,c,u,c+f,u+p,m)}else this.genericComposeSMask(t,s,o,l,n,a);e&&(e.save(),e.globalAlpha=1,e.globalCompositeOperation=t.blendMode||"source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(s.canvas,n,a,o,l,n,a,o,l),e.restore())}_applySMaskOOBAlpha(e,t,s,i,n,a,o,l,h,c){const u=a<l&&o<h;if(u&&a===t&&o===s&&l===t+i&&h===s+n)return;const f=new Path2D;f.rect(t,s,i,n),u&&f.rect(a,o,l-a,h-o),e.save(),e.globalAlpha=c/255,e.setTransform(1,0,0,1,0,0),e.clip(f,"evenodd"),e.globalCompositeOperation="destination-in",e.fillStyle="#000000",e.fillRect(t,s,i,n),e.restore()}genericComposeSMask(e,t,s,i,n,a){const{context:o,offsetX:l,offsetY:h}=e;t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const c=new Path2D;c.rect(n,a,s,i),t.clip(c),t.globalCompositeOperation="destination-in",t.drawImage(o.canvas,n-l,a-h,s,i,n,a,s,i),t.restore()}save(e){var s;this.inSMaskMode&&ca(this.ctx,this.suspendedCtx),this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone(),(s=this.dependencyTracker)==null||s.save(e)}restore(e){var t;if((t=this.dependencyTracker)==null||t.restore(e),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(ca(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(e),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,t,s,i,n,a,o){var l;(l=this.dependencyTracker)==null||l.recordIncrementalData("transform",e),this.ctx.transform(t,s,i,n,a,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,s,i){let[n]=s;if(!i){n||(n=s[0]=new Path2D),t!==Mi.stroke&&t!==Mi.closeStroke&&(this.current.tilingPatternDims=null),this[t](e,n);return}if(this.dependencyTracker!==null){const o=t===Mi.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(e).recordBBox(e,this.ctx,i[0]-o,i[2]+o,i[1]-o,i[3]+o).recordDependencies(e,["transform"])}n instanceof Path2D||(n=s[0]=Rv(n)),_.axialAlignedBoundingBox(i,Bt(this.ctx),this.current.minMax);const a=this.current.tilingPatternDims;if(a&&t!==Mi.stroke&&t!==Mi.closeStroke&&this.current.fillColor instanceof bc){const o=_.intersect(this.current.clipBox,this.current.minMax);o?this.current.fillColor.updatePatternDims(o,a):this.current.tilingPatternDims=null}this[t](e,n),this._pathStartIdx=e}closePath(e){this.ctx.closePath()}stroke(e,t,s=!0){var o;const i=s&&b(this,K,rs).call(this,this.current.strokeAlpha),n=this.ctx,a=this.current.strokeColor;if(n.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof a=="object"&&(a!=null&&a.getPattern)){const l=a.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.strokeStyle=a.getPattern(n,this,Ci(n),ke.STROKE,e),l){const h=new Path2D;h.addPath(t,n.getTransform().invertSelf().multiplySelf(l)),t=h}this.rescaleAndStroke(t,!1),n.restore()}else this.rescaleAndStroke(t,!0);(o=this.dependencyTracker)==null||o.recordDependencies(e,_s.stroke),s&&this.consumePath(e,t,this.current.getClippedPathBoundingBox(ke.STROKE,Bt(this.ctx))),n.globalAlpha=this.current.fillAlpha,b(this,K,Ue).call(this,i)}closeStroke(e,t){this.stroke(e,t)}fill(e,t,s=!0){var c,u,f;const i=s&&b(this,K,rs).call(this,this.current.fillAlpha),n=this.ctx,a=this.current.fillColor,o=this.current.patternFill;let l=!1;const h=this.current.getClippedPathBoundingBox();if((c=this.dependencyTracker)==null||c.recordDependencies(e,_s.fill),o){const p=this.current.tilingPatternDims,m=p&&a.canSkipPatternCanvas(p);if(m){a.drawPattern(this,t,this.pendingEOFill,m,e),this.pendingEOFill=!1,s&&this.consumePath(e,t,h),this.current.tilingPatternDims=null,b(this,K,Ue).call(this,i);return}const v=a.isModifyingCurrentTransform()?n.getTransform():null;if((u=this.dependencyTracker)==null||u.save(e),n.save(),n.fillStyle=a.getPattern(n,this,Ci(n),ke.FILL,e),v){const A=new Path2D;A.addPath(t,n.getTransform().invertSelf().multiplySelf(v)),t=A}l=!0}this.contentVisible&&h!==null&&(this.pendingEOFill?(n.fill(t,"evenodd"),this.pendingEOFill=!1):n.fill(t)),l&&(n.restore(),(f=this.dependencyTracker)==null||f.restore(e)),s&&this.consumePath(e,t,h),b(this,K,Ue).call(this,i)}eoFill(e,t){this.pendingEOFill=!0,this.fill(e,t)}fillStroke(e,t){const s=b(this,K,rs).call(this,Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(e,t,!1),this.stroke(e,t,!1),this.consumePath(e,t),b(this,K,Ue).call(this,s)}eoFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}closeFillStroke(e,t){this.fillStroke(e,t)}closeEOFillStroke(e,t){this.pendingEOFill=!0,this.fillStroke(e,t)}endPath(e,t){this.consumePath(e,t)}rawFillPath(e,t){var i;const s=b(this,K,rs).call(this,this.current.fillAlpha);this.ctx.fill(t),(i=this.dependencyTracker)==null||i.recordDependencies(e,_s.rawFillPath).recordOperation(e),b(this,K,Ue).call(this,s)}clip(e){var t;(t=this.dependencyTracker)==null||t.recordFutureForcedDependency("clipMode",e),this.pendingClip=u0}eoClip(e){var t;(t=this.dependencyTracker)==null||t.recordFutureForcedDependency("clipMode",e),this.pendingClip=vv}beginText(e){var t;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,(t=this.dependencyTracker)==null||t.recordOpenMarker(e).resetIncrementalData("sameLineText").resetIncrementalData("moveText",e)}endText(e){const t=this.pendingTextPaths,s=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;t!==void 0&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",e),i.recordCloseMarker(e)}if(t!==void 0){const i=new Path2D,n=s.getTransform().invertSelf();for(const{transform:a,x:o,y:l,fontSize:h,path:c}of t)c&&i.addPath(c,new DOMMatrix(a).preMultiplySelf(n).translate(o,l).scale(h,-h));s.clip(i)}delete this.pendingTextPaths}setCharSpacing(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("charSpacing",e),this.current.charSpacing=t}setWordSpacing(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("wordSpacing",e),this.current.wordSpacing=t}setHScale(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("hScale",e),this.current.textHScale=t/100}setLeading(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("leading",e),this.current.leading=-t}setFont(e,t,s){var u,f;(u=this.dependencyTracker)==null||u.recordSimpleData("font",e).recordSimpleDataFromNamed("fontObj",t,e);const i=this.commonObjs.get(t),n=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(n.fontMatrix=i.fontMatrix||Ep,(n.fontMatrix[0]===0||n.fontMatrix[3]===0)&&st("Invalid font matrix for font "+t),s<0?(s=-s,n.fontDirection=-1):n.fontDirection=1,this.current.font=i,this.current.fontSize=s,i.isType3Font)return;const a=i.loadedName||"sans-serif",o=((f=i.systemFontInfo)==null?void 0:f.css)||`"${a}", ${i.fallbackName}`;let l="normal";i.black?l="900":i.bold&&(l="bold");const h=i.italic?"italic":"normal",c=_t(s,o0,l0);this.current.fontSizeScale=s/c,this.ctx.font=`${h} ${l} ${c}px ${o}`}setTextRenderingMode(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textRenderingMode",e),this.current.textRenderingMode=t}setTextRise(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textRise",e),this.current.textRise=t}moveText(e,t,s){var i;(i=this.dependencyTracker)==null||i.resetIncrementalData("sameLineText").recordIncrementalData("moveText",e),this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=s}setLeadingMoveText(e,t,s){this.setLeading(e,-s),this.moveText(e,t,s)}setTextMatrix(e,t){var i;(i=this.dependencyTracker)==null||i.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",e);const{current:s}=this;s.textMatrix=t,s.textMatrixScale=Math.hypot(t[0],t[1]),s.x=s.lineX=0,s.y=s.lineY=0}nextLine(e){var t;this.moveText(e,0,this.current.leading),(t=this.dependencyTracker)==null||t.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??e)}paintChar(e,t,s,i,n,a){var w,S,x,C;const o=this.ctx,l=this.current,h=l.font,c=l.textRenderingMode,u=l.fontSize/l.fontSizeScale,f=c&fe.FILL_STROKE_MASK,p=!!(c&fe.ADD_TO_PATH_FLAG),m=l.patternFill&&!h.missingFile,v=l.patternStroke&&!h.missingFile;let A;if((h.disableFontFace||p||m||v)&&!h.missingFile&&(A=h.getPathGenerator(this.commonObjs,t)),A&&(h.disableFontFace||m||v)){o.save(),o.translate(s,i),o.scale(u,-u),(w=this.dependencyTracker)==null||w.recordCharacterBBox(e,o,h);let E;if(f===fe.FILL||f===fe.FILL_STROKE)if(n){E=o.getTransform(),o.setTransform(...n);const T=b(this,K,pg).call(this,A,E,n);o.fill(T)}else o.fill(A);if(f===fe.STROKE||f===fe.FILL_STROKE)if(a){E||(E=o.getTransform()),o.setTransform(...a);const{a:T,b:P,c:M,d:I}=E,D=_.inverseTransform(a),R=_.transform([T,P,M,I,0,0],D);_.singularValueDecompose2dScale(R,Fs),o.lineWidth*=Math.max(Fs[0],Fs[1])/u,o.stroke(b(this,K,pg).call(this,A,E,a))}else o.lineWidth/=u,o.stroke(A);o.restore()}else(f===fe.FILL||f===fe.FILL_STROKE)&&(o.fillText(t,s,i),(S=this.dependencyTracker)==null||S.recordCharacterBBox(e,o,h,u,s,i,()=>o.measureText(t))),(f===fe.STROKE||f===fe.FILL_STROKE)&&(this.dependencyTracker&&((x=this.dependencyTracker)==null||x.recordCharacterBBox(e,o,h,u,s,i,()=>o.measureText(t)).recordDependencies(e,_s.stroke)),o.strokeText(t,s,i));p&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Bt(o),x:s,y:i,fontSize:u,path:A}),(C=this.dependencyTracker)==null||C.recordCharacterBBox(e,o,h,u,s,i))}get isFontSubpixelAAEnabled(){const e=this.canvasFactory.create(10,10),t=e.context;t.scale(1.5,1),t.fillText("I",0,10);const s=t.getImageData(0,0,10,10).data;this.canvasFactory.destroy(e);let i=!1;for(let n=3;n<s.length;n+=4)if(s[n]>0&&s[n]<255){i=!0;break}return Q(this,"isFontSubpixelAAEnabled",i)}showText(e,t){var U,B,N,W;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(e,_s.showText).resetBBox(e),this.current.textRenderingMode&fe.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",e).inheritPendingDependenciesAsFutureForcedDependencies());const s=this.current,i=s.font;if(i.isType3Font){const k=b(this,K,rs).call(this,s.fillAlpha);this.showType3Text(e,t),(U=this.dependencyTracker)==null||U.recordShowTextOperation(e),b(this,K,Ue).call(this,k);return}const n=s.fontSize;if(n===0){(B=this.dependencyTracker)==null||B.recordOperation(e);return}const a=b(this,K,rs).call(this,s.fillAlpha),o=this.ctx,l=s.fontSizeScale,h=s.charSpacing,c=s.wordSpacing,u=s.fontDirection,f=s.textHScale*u,p=t.length,m=i.vertical,v=m?1:-1,A=i.defaultVMetrics,w=n*s.fontMatrix[0],S=s.textRenderingMode===fe.FILL&&!i.disableFontFace&&!s.patternFill;o.save(),s.textMatrix&&o.transform(...s.textMatrix),o.translate(s.x,s.y+s.textRise),u>0?o.scale(f,-1):o.scale(f,1);let x,C;const E=s.textRenderingMode&fe.FILL_STROKE_MASK,T=E===fe.FILL||E===fe.FILL_STROKE,P=E===fe.STROKE||E===fe.FILL_STROKE;let M=s.lineWidth;const I=s.textMatrixScale;if(I===0||M===0?P&&(M=this.getSinglePixelWidth()):M/=I,l!==1&&(o.scale(l,l),M/=l),o.lineWidth=M,T&&s.patternFill){o.save();const k=s.fillColor.getPattern(o,this,Ci(o),ke.FILL,e);x=Bt(o),o.restore(),o.fillStyle=k}if(P&&s.patternStroke){o.save();const k=s.strokeColor.getPattern(o,this,Ci(o),ke.STROKE,e);C=Bt(o),o.restore(),o.strokeStyle=k}if(i.isInvalidPDFjsFont){const k=[];let L=0;for(const z of t)k.push(z.unicode),L+=z.width;const Y=k.join("");if(o.fillText(Y,0,0),this.dependencyTracker!==null){const z=o.measureText(Y);this.dependencyTracker.recordBBox(e,this.ctx,-z.actualBoundingBoxLeft,z.actualBoundingBoxRight,-z.actualBoundingBoxAscent,z.actualBoundingBoxDescent).recordShowTextOperation(e)}s.x+=L*w*f,o.restore(),this.compose(),b(this,K,Ue).call(this,a);return}let D=0,R;for(R=0;R<p;++R){const k=t[R];if(typeof k=="number"){D+=v*k*n/1e3;continue}let L=!1;const Y=(k.isSpace?c:0)+h,z=k.fontChar,lt=k.accent;let vt,dt,rt=k.width;if(m){const H=k.vmetric||A,F=-(k.vmetric?H[1]:rt*.5)*w,j=H[2]*w;rt=H?-H[0]:rt,vt=F/l,dt=(D+j)/l}else vt=D/l,dt=0;let bt;if(i.remeasure&&rt>0){bt=o.measureText(z);const H=bt.width*1e3/n*l;if(rt<H&&this.isFontSubpixelAAEnabled){const F=rt/H;L=!0,o.save(),o.scale(F,1),vt/=F}else rt!==H&&(vt+=(rt-H)/2e3*n/l)}if(this.contentVisible&&(k.isInFont||i.missingFile)){if(S&&!lt)o.fillText(z,vt,dt),(N=this.dependencyTracker)==null||N.recordCharacterBBox(e,o,bt?{bbox:null}:i,n/l,vt,dt,()=>bt??o.measureText(z));else if(this.paintChar(e,z,vt,dt,x,C),lt){const H=vt+n*lt.offset.x/l,F=dt-n*lt.offset.y/l;this.paintChar(e,lt.fontChar,H,F,x,C)}}const Be=m?rt*w-Y*u:rt*w+Y*u;D+=Be,L&&o.restore()}m?s.y-=D:s.x+=D*f,o.restore(),this.compose(),(W=this.dependencyTracker)==null||W.recordShowTextOperation(e),b(this,K,Ue).call(this,a)}showType3Text(e,t){const s=this.ctx,i=this.current,n=i.font,a=i.fontSize,o=i.fontDirection,l=n.vertical?1:-1,h=i.charSpacing,c=i.wordSpacing,u=i.textHScale*o,f=i.fontMatrix||Ep,p=t.length,m=i.textRenderingMode===fe.INVISIBLE;let v,A,w,S;if(m||a===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,s.save(),i.textMatrix&&s.transform(...i.textMatrix),s.translate(i.x,i.y+i.textRise),s.scale(u,o);const x=this.dependencyTracker;for(this.dependencyTracker=x?new xc(x,e):null,v=0;v<p;++v){if(A=t[v],typeof A=="number"){S=l*A*a/1e3,this.ctx.translate(S,0),i.x+=S*u;continue}const C=(A.isSpace?c:0)+h,E=n.charProcOperatorList.get(A.operatorListId);E?this.contentVisible&&(this.save(),E.fnArray[0]===Mi.setCharWidth&&(i.fillAlpha=i.strokeAlpha=1,s.globalAlpha=1),s.scale(a,a),s.transform(...f),this.executeOperatorList(E),this.restore()):st(`Type3 character "${A.operatorListId}" is not available.`);const T=[A.width,0];_.applyTransform(T,f),w=T[0]*a+C,s.translate(w,0),i.x+=w*u}s.restore(),x&&(this.dependencyTracker=x)}setCharWidth(e,t,s){}setCharWidthAndBounds(e,t,s,i,n,a,o){var h;const l=new Path2D;l.rect(i,n,a-i,o-n),this.ctx.clip(l),(h=this.dependencyTracker)==null||h.recordBBox(e,this.ctx,i,a,n,o).recordClipBox(e,this.ctx,i,a,n,o),this.endPath(e)}getColorN_Pattern(e,t){let s;if(t[0]==="TilingPattern"){const i=this.baseTransform||Bt(this.ctx),n={createCanvasGraphics:(a,o)=>new va(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new xc(this.dependencyTracker,o,!0):null)};s=new bc(t,this.ctx,n,i)}else s=this._getPattern(e,t[1],t[2]);return s}setStrokeColorN(e,...t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("strokeColor",e),this.current.strokeColor=this.getColorN_Pattern(e,t),this.current.patternStroke=!0}setFillColorN(e,...t){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("fillColor",e);const s=this.current.fillColor=this.getColorN_Pattern(e,t);this.current.patternFill=!0,this.current.tilingPatternDims=s instanceof bc?[0,0,0,0]:null}setStrokeRGBColor(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor=t,this.current.patternStroke=!1}setStrokeTransparent(e){var t;(t=this.dependencyTracker)==null||t.recordSimpleData("strokeColor",e),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e,t){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor=t,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(e){var t;(t=this.dependencyTracker)==null||t.recordSimpleData("fillColor",e),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(e,t,s=null){const i=this.cachedPatterns.getOrInsertComputed(t,()=>a0(this.getObject(e,t)));return s&&(i.matrix=s),i}shadingFill(e,t){var o;if(!this.contentVisible)return;const s=b(this,K,rs).call(this,this.current.fillAlpha),i=this.ctx;this.save(e);const n=this._getPattern(e,t);i.fillStyle=n.getPattern(i,this,Ci(i),ke.SHADING,e);const a=Ci(i);if(a){const{width:l,height:h}=i.canvas,c=Aa.slice();_.axialAlignedBoundingBox([0,0,l,h],a,c);const[u,f,p,m]=c;this.ctx.fillRect(u,f,p-u,m-f)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);(o=this.dependencyTracker)==null||o.resetBBox(e).recordFullPageBBox(e).recordDependencies(e,_s.transform).recordDependencies(e,_s.fill).recordOperation(e),this.compose(this.current.getClippedPathBoundingBox()),this.restore(e),b(this,K,Ue).call(this,s)}beginInlineImage(){gt("Should not call beginInlineImage")}beginImageData(){gt("Should not call beginImageData")}paintFormXObjectBegin(e,t,s){var i;if(this.contentVisible&&(this.save(e),this.baseTransformStack.push(this.baseTransform),t&&this.transform(e,...t),this.baseTransform=Bt(this.ctx),s)){_.axialAlignedBoundingBox(s,this.baseTransform,this.current.minMax);const[n,a,o,l]=s,h=new Path2D;h.rect(n,a,o-n,l-a),this.ctx.clip(h),(i=this.dependencyTracker)==null||i.recordClipBox(e,this.ctx,n,o,a,l),this.endPath(e)}}paintFormXObjectEnd(e){this.contentVisible&&(this.restore(e),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e,t){var C;if(!this.contentVisible)return;this.save(e);const{inSMaskMode:s}=this;s&&(this.endSMaskMode(),this.current.activeSMask=null);const i=this.ctx;if((!t.needsIsolation||!t.isolated&&!t.hasSoftMask)&&!t.knockout&&!t.isGray&&r(this,As)===0&&i.globalAlpha===1&&i.globalCompositeOperation==="source-over"&&!s){if(t.bbox){let E=new Path2D;const[T,P,M,I]=t.bbox;if(E.rect(T,P,M-T,I-P),t.matrix){const D=new Path2D;D.addPath(E,new DOMMatrix(t.matrix)),E=D}i.clip(E)}this.groupStack.push(null),r(this,Vi).push(null),this.groupLevel++;return}!t.isolated&&!t.knockout&&r(this,As)===0&&ep("TODO: Fully support non-isolated non-knockout groups.");const n=Bt(i);t.matrix&&i.transform(...t.matrix);const a=[0,0,i.canvas.width,i.canvas.height];let o;t.bbox?(o=Aa.slice(),_.axialAlignedBoundingBox(t.bbox,Bt(i),o),o=_.intersect(o,a)||[0,0,0,0]):o=a;const l=Math.floor(o[0]),h=Math.floor(o[1]),c=Math.max(Math.ceil(o[2])-l,1),u=Math.max(Math.ceil(o[3])-h,1);this.current.startNewPathAndClipBox([0,0,c,u]);const f=this.canvasFactory.create(c,u);t.smask&&this.smaskGroupCanvases.push(f);const p=f.context,m=t.knockout&&!t.isolated?i:null,v=!t.isolated&&!t.knockout&&!t.smask&&t.needsIsolation&&r(this,As)>0,A=t.knockout?this.canvasFactory.create(c,u):null,w=r(this,As);t.knockout?Xt(this,As)._++:g(this,As,0),p.translate(-l,-h),p.transform(...n);const S=!t.isolated&&!t.smask&&t.needsIsolation,x=S&&!s&&w===0&&!t.knockout&&!t.isGray&&t.hasSoftMask&&i.globalAlpha===1&&i.globalCompositeOperation==="source-over"&&this.current.transferMaps==="none";if(S&&(s||x)&&(p.save(),p.setTransform(1,0,0,1,0,0),p.drawImage(i.canvas,-l,-h),p.restore()),t.bbox){let E=new Path2D;const[T,P,M,I]=t.bbox;if(E.rect(T,P,M-T,I-P),t.matrix){const D=new Path2D;D.addPath(E,new DOMMatrix(t.matrix)),E=D}p.clip(E)}t.smask&&this.smaskStack.push({canvas:f.canvas,context:p,offsetX:l,offsetY:h,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null}),(!t.smask||this.dependencyTracker)&&(i.setTransform(1,0,0,1,0,0),i.translate(l,h),i.save()),ca(i,p),this.ctx=p,(C=this.dependencyTracker)==null||C.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(i),this.setGState(e,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(i),r(this,Vi).push({backdropCtx:m,savedKnockoutLevel:w,offsetX:l,offsetY:h,hasInnerBackdrop:v,replaceBackdrop:x,knockoutMaskEntry:A,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(e,t){var a;if(!this.contentVisible)return;this.groupLevel--;const s=this.ctx,i=this.groupStack.pop(),n=r(this,Vi).pop();if(n&&g(this,As,n.savedKnockoutLevel),i===null){this.restore(e);return}if(t.isGray&&b(this,K,Py).call(this,s),this.ctx=i,this.ctx.imageSmoothingEnabled=!1,(a=this.dependencyTracker)==null||a.popBaseTransform(),t.smask)this.tempSMask=this.smaskStack.pop(),this.restore(e),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform())),b(this,K,Gu).call(this,n);else{this.ctx.restore();const o=Bt(this.ctx);this.restore(e),this.ctx.save(),this.ctx.setTransform(...o);const l=Aa.slice();_.axialAlignedBoundingBox([0,0,s.canvas.width,s.canvas.height],o,l);const h=r(this,Vi).at(-1);if(r(this,As)>0)if(n.hasInnerBackdrop){const{width:c,height:u}=s.canvas,f=this.canvasFactory.create(c,u),p=f.context;p.drawImage(i.canvas,n.offsetX,n.offsetY,c,u,0,0,c,u),p.globalCompositeOperation="source-over",p.drawImage(s.canvas,0,0);const m=b(this,K,dg).call(this,s.canvas);p.globalCompositeOperation="destination-in",p.drawImage(m.canvas,0,0);const v=this.ctx.globalCompositeOperation,A=this.ctx.globalAlpha,w=this.ctx.filter;this.ctx.save(),this.ctx.setTransform(...o),this.ctx.globalAlpha=1,Mt.isCanvasFilterSupported&&(this.ctx.filter="none"),this.ctx.globalCompositeOperation="destination-out",this.ctx.drawImage(m.canvas,0,0),this.ctx.globalCompositeOperation=v,this.ctx.globalAlpha=A,Mt.isCanvasFilterSupported&&(this.ctx.filter=w??"none"),this.ctx.drawImage(f.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(m),this.canvasFactory.destroy(f)}else{const c=(h==null?void 0:h.backdropCtx)??null;b(this,K,fg).call(this,this.ctx,s.canvas,{backdropCanvas:(c==null?void 0:c.canvas)??null,destTransform:o,backdropOffset:c?[h.offsetX+n.offsetX,h.offsetY+n.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else{if(n.replaceBackdrop){const c=new Path2D;c.rect(0,0,s.canvas.width,s.canvas.height),this.ctx.clip(c),this.ctx.globalCompositeOperation="copy"}this.ctx.drawImage(s.canvas,0,0)}this.ctx.restore(),this.canvasFactory.destroy({canvas:s.canvas,context:s}),b(this,K,Gu).call(this,n),this.compose(l)}}beginAnnotation(e,t,s,i,n,a,o){if(b(this,K,hg).call(this),xu(this.ctx),this.ctx.save(),this.save(e),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),s){const l=s[2]-s[0],h=s[3]-s[1];if(a&&this.annotationCanvasMap){i=i.slice(),i[4]-=s[0],i[5]-=s[1],_.singularValueDecompose2dScale(Bt(this.ctx),Fs);const{viewportScale:c}=this,u=Math.ceil(l*this.outputScaleX*c),f=Math.ceil(h*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,f);const{canvas:p,context:m}=this.annotationCanvas;if(o){const v=this.annotationCanvasMap.getOrInsertComputed(t,Gh);p.setAttribute("data-canvas-name",o);const A=v.findIndex(w=>w.getAttribute("data-canvas-name")===o);A===-1?v.push(p):v[A]=p}else this.annotationCanvasMap.set(t,p);this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(Fs[0],0,0,-Fs[1],0,h*Fs[1]),xu(this.ctx)}else{xu(this.ctx),this.endPath(e);const c=new Path2D;c.rect(s[0],s[1],l,h),this.ctx.clip(c)}}this.current=new fv(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(e,...i),this.transform(e,...n),this.baseTransform=Bt(this.ctx)}endAnnotation(e){this.annotationCanvas&&(this.ctx.restore(),b(this,K,cg).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(e,t){var l;if(!this.contentVisible)return;const s=t.count;t=this.getObject(e,t.data,t),t.count=s;const i=b(this,K,rs).call(this,this.current.fillAlpha),n=this.ctx,a=this._createMaskCanvas(e,t),o=a.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(o,a.offsetX,a.offsetY),(l=this.dependencyTracker)==null||l.resetBBox(e).recordBBox(e,this.ctx,a.offsetX,a.offsetX+o.width,a.offsetY,a.offsetY+o.height).recordOperation(e),n.restore(),a.canvasEntry&&this.canvasFactory.destroy(a.canvasEntry),this.compose(),b(this,K,Ue).call(this,i)}paintImageMaskXObjectRepeat(e,t,s,i=0,n=0,a,o){var f,p,m;if(!this.contentVisible)return;t=this.getObject(e,t.data,t);const l=b(this,K,rs).call(this,this.current.fillAlpha),h=this.ctx;h.save();const c=Bt(h);h.transform(s,i,n,a,0,0);const u=this._createMaskCanvas(e,t);h.setTransform(1,0,0,1,u.offsetX-c[4],u.offsetY-c[5]),(f=this.dependencyTracker)==null||f.resetBBox(e);for(let v=0,A=o.length;v<A;v+=2){const w=_.transform(c,[s,i,n,a,o[v],o[v+1]]);h.drawImage(u.canvas,w[4],w[5]),(p=this.dependencyTracker)==null||p.recordBBox(e,this.ctx,w[4],w[4]+u.canvas.width,w[5],w[5]+u.canvas.height)}h.restore(),u.canvasEntry&&this.canvasFactory.destroy(u.canvasEntry),this.compose(),(m=this.dependencyTracker)==null||m.recordOperation(e),b(this,K,Ue).call(this,l)}paintImageMaskXObjectGroup(e,t){var o,l,h;if(!this.contentVisible)return;const s=b(this,K,rs).call(this,this.current.fillAlpha),i=this.ctx,n=this.current.fillColor,a=this.current.patternFill;(o=this.dependencyTracker)==null||o.resetBBox(e).recordDependencies(e,_s.transformAndFill);for(const c of t){const{data:u,width:f,height:p,transform:m}=c,v=this.canvasFactory.create(f,p),A=v.context;A.save();const w=this.getObject(e,u,c);gv(A,w),A.globalCompositeOperation="source-in",A.fillStyle=a?n.getPattern(A,this,Ci(i),ke.FILL,e):n,A.fillRect(0,0,f,p),A.restore(),i.save(),i.transform(...m),i.scale(1,-1),Eu(i,v.canvas,0,0,f,p,0,-1,1,1),this.canvasFactory.destroy(v),(l=this.dependencyTracker)==null||l.recordBBox(e,i,0,f,0,p),i.restore()}this.compose(),(h=this.dependencyTracker)==null||h.recordOperation(e),b(this,K,Ue).call(this,s)}paintImageXObject(e,t){if(!this.contentVisible)return;const s=this.getObject(e,t);if(!s){st("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e,s)}paintImageXObjectRepeat(e,t,s,i,n){if(!this.contentVisible)return;const a=this.getObject(e,t);if(!a){st("Dependent image isn't ready yet");return}const o=a.width,l=a.height,h=[];for(let c=0,u=n.length;c<u;c+=2)h.push({transform:[s,0,0,i,n[c],n[c+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(e,a,h)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return{img:e.bitmap,canvasEntry:null};const{bitmap:t,width:s,height:i}=e,n=this.canvasFactory.create(s,i),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter="none",{img:n.canvas,canvasEntry:n}}paintInlineImageXObject(e,t){var u;if(!this.contentVisible)return;const s=t.width,i=t.height,n=b(this,K,rs).call(this,this.current.fillAlpha),a=this.ctx;this.save(e);const{filter:o}=a;o!=="none"&&o!==""&&(a.filter="none"),a.scale(1/s,-1/i);let l,h=null;if(t.bitmap){const f=this.applyTransferMapsToBitmap(t);l=f.img,h=f.canvasEntry}else{const f=this.canvasFactory.create(s,i);pv(f.context,t),l=this.applyTransferMapsToCanvas(f.context),h=f}const c=this._scaleImage(l,Ci(a));a.imageSmoothingEnabled=mv(Bt(a),t.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(e).recordBBox(e,a,0,s,-i,0).recordDependencies(e,_s.imageXObject).recordOperation(e),(u=this.imagesTracker)==null||u.record(a,s,i,this.dependencyTracker.clipBox)),Eu(a,c.img,0,0,c.paintWidth,c.paintHeight,0,-i,s,i),c.tmpCanvas&&this.canvasFactory.destroy(c.tmpCanvas),h&&this.canvasFactory.destroy(h),this.compose(),this.restore(e),b(this,K,Ue).call(this,n)}paintInlineImageXObjectGroup(e,t,s){var l,h,c;if(!this.contentVisible)return;const i=b(this,K,rs).call(this,this.current.fillAlpha),n=this.ctx;let a,o=null;if(t.bitmap)a=t.bitmap;else{const u=t.width,f=t.height,p=this.canvasFactory.create(u,f);pv(p.context,t),a=this.applyTransferMapsToCanvas(p.context),o=p}(l=this.dependencyTracker)==null||l.resetBBox(e);for(const u of s)n.save(),n.transform(...u.transform),n.scale(1,-1),Eu(n,a,u.x,u.y,u.w,u.h,0,-1,1,1),(h=this.dependencyTracker)==null||h.recordBBox(e,n,0,1,-1,0),n.restore();o&&this.canvasFactory.destroy(o),(c=this.dependencyTracker)==null||c.recordOperation(e),this.compose(),b(this,K,Ue).call(this,i)}paintSolidColorImageMask(e){var s;if(!this.contentVisible)return;const t=b(this,K,rs).call(this,this.current.fillAlpha);(s=this.dependencyTracker)==null||s.resetBBox(e).recordBBox(e,this.ctx,0,1,0,1).recordDependencies(e,_s.fill).recordOperation(e),this.ctx.fillRect(0,0,1,1),this.compose(),b(this,K,Ue).call(this,t)}markPoint(e,t){}markPointProps(e,t,s){}beginMarkedContent(e,t){var s;(s=this.dependencyTracker)==null||s.beginMarkedContent(e),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t,s){var i;(i=this.dependencyTracker)==null||i.beginMarkedContent(e),t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(s)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(e){var t;(t=this.dependencyTracker)==null||t.endMarkedContent(e),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(e){}endCompat(e){}consumePath(e,t,s){var a,o;const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(s);const n=this.ctx;this.pendingClip?(i||(this.pendingClip===vv?n.clip(t,"evenodd"):n.clip(t)),this.pendingClip=null,(a=this.dependencyTracker)==null||a.bboxToClipBoxDropOperation(e).recordFutureForcedDependency("clipPath",e)):(o=this.dependencyTracker)==null||o.recordOperation(e),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Bt(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),s=Math.hypot(e[0],e[2]),i=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:t,b:s,c:i,d:n}=this.ctx.getTransform();let a,o;if(s===0&&i===0){const l=Math.abs(t),h=Math.abs(n);if(l===h)if(e===0)a=o=1/l;else{const c=l*e;a=o=c<1?1/c:1}else if(e===0)a=1/l,o=1/h;else{const c=l*e,u=h*e;a=c<1?1/c:1,o=u<1?1/u:1}}else{const l=Math.abs(t*n-s*i),h=Math.hypot(t,s),c=Math.hypot(i,n);if(e===0)a=c/l,o=h/l;else{const u=e*l;a=c>u?c/u:1,o=h>u?h/u:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e,t){const{ctx:s,current:{lineWidth:i}}=this,[n,a]=this.getScaleForStroking();if(n===a){s.lineWidth=(i||1)*n,s.stroke(e);return}const o=r(va,Uf)??g(va,Uf,new DOMMatrix),l=s.getLineDash();t&&s.save(),s.scale(n,a),o.a=1/n,o.d=1/a;const h=new Path2D;if(h.addPath(e,o),l.length>0){const c=Math.max(n,a);s.setLineDash(l.map(u=>u/c)),s.lineDashOffset/=c}s.lineWidth=i||1,s.stroke(h),t&&s.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};Uf=new WeakMap,As=new WeakMap,Fr=new WeakMap,qa=new WeakMap,to=new WeakMap,eo=new WeakMap,so=new WeakMap,io=new WeakMap,no=new WeakMap,ro=new WeakMap,Vi=new WeakMap,K=new WeakSet,hg=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)},cg=function(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}},dg=function(e,t=null,s=1){const{width:i,height:n}=e,a=t??this.canvasFactory.create(i,n),o=a.context;s=Math.round(s*255)/255;const l=s<1;l&&r(this,no)===void 0&&g(this,no,Mt.isCanvasFilterSupported?new Map:"none");let h="none";if(l&&r(this,no)instanceof Map&&(h=r(this,no).getOrInsertComputed(s,()=>this.filterFactory.addKnockoutFilter(s))),!l||h!=="none")return t&&(o.save(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,i,n),o.restore()),o.filter=h,o.drawImage(e,0,0),o.filter="none",a;const c=e.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,i,n),u=o.createImageData(i,n),f=c.data,p=u.data,m=s>0?1/s:1e6;for(let v=3,A=f.length;v<A;v+=4)p[v]=Math.min(Math.round(f[v]*m),255);return o.putImageData(u,0,0),a},ug=function(e,t,s,i){let n=(e==null?void 0:e[t])??null;if(n&&(n.canvas.width!==s||n.canvas.height!==i)&&(this.canvasFactory.destroy(n),n=null),!n)return n=this.canvasFactory.create(s,i),e&&(e[t]=n),n;const a=n.context;return a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,s,i),a.restore(),n},fg=function(e,t,s={}){const{backdropCanvas:i=null,destTransform:n=[1,0,0,1,0,0],backdropOffset:a=[0,0],reuseMaskEntry:o=null,poolMeta:l=null,sourceAlpha:h=1,sourceFilter:c="none",knockoutAlpha:u=1}=s,{width:f,height:p}=t,m=b(this,K,dg).call(this,t,o,u),v=e.globalCompositeOperation;if(e.save(),e.setTransform(...n),e.globalAlpha=1,Mt.isCanvasFilterSupported&&(e.filter="none"),e.globalCompositeOperation="destination-out",e.drawImage(m.canvas,0,0),i){const[A,w]=a,S=b(this,K,ug).call(this,l,"knockoutBackdropEntry",f,p),x=S.context;x.drawImage(i,A,w,f,p,0,0,f,p),x.globalCompositeOperation="destination-in",x.drawImage(m.canvas,0,0),x.globalCompositeOperation="source-over",e.globalCompositeOperation="destination-over",e.drawImage(S.canvas,0,0),l||this.canvasFactory.destroy(S)}e.globalCompositeOperation=v,e.globalAlpha=h,Mt.isCanvasFilterSupported&&(e.filter=c??"none"),e.drawImage(t,0,0),e.restore(),o||this.canvasFactory.destroy(m)},rs=function(e=1){if(r(this,As)===0||r(this,Fr)>0||!this.contentVisible)return!1;Xt(this,Fr)._++,g(this,io,e);const t=r(this,Vi).at(-1),{canvas:s}=this.ctx,i=b(this,K,ug).call(this,t,"knockoutTempEntry",s.width,s.height);g(this,qa,i);const n=i.context;return n.save(),n.setTransform(this.ctx.getTransform()),ca(this.ctx,n),g(this,so,n.globalCompositeOperation),n.globalCompositeOperation="source-over",uv(n,this.ctx),g(this,ro,t),g(this,to,this.ctx),g(this,eo,this.suspendedCtx),this.ctx=n,this.inSMaskMode&&(this.suspendedCtx=n),!0},Ue=function(e){var l;if(!e)return;const t=r(this,qa),s=r(this,to),i=r(this,eo),n=t.context;g(this,qa,null),g(this,to,null),g(this,eo,null),this.inSMaskMode&&this.suspendedCtx===n&&this.ctx!==n&&this.endSMaskMode(),this.inSMaskMode&&(this.suspendedCtx=i),this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=r(this,so),g(this,so,null),ca(this.ctx,s),this.ctx=s;const a=r(this,ro);g(this,ro,null);const o=r(this,io);g(this,io,1);try{b(this,K,fg).call(this,i??s,t.canvas,{backdropCanvas:((l=a==null?void 0:a.backdropCtx)==null?void 0:l.canvas)??null,backdropOffset:a!=null&&a.backdropCtx?[a.offsetX,a.offsetY]:[0,0],reuseMaskEntry:(a==null?void 0:a.knockoutMaskEntry)??null,poolMeta:a,knockoutAlpha:o})}finally{n.restore(),Xt(this,Fr)._--,a||this.canvasFactory.destroy(t)}},pg=function(e,t,s){const i=new Path2D;return i.addPath(e,new DOMMatrix(s).invertSelf().multiplySelf(t)),i},Py=function(e){const{canvas:t}=e,{width:s,height:i}=t;if(Mt.isCanvasFilterSupported){e.save(),e.setTransform(1,0,0,1,0,0),e.filter="grayscale(1)",e.globalAlpha=1,e.globalCompositeOperation="copy",e.drawImage(t,0,0),e.restore();return}const n=e.getImageData(0,0,s,i),{data:a}=n;for(let o=0,l=a.length;o<l;o+=4){const h=a[o]*.2126+a[o+1]*.7152+a[o+2]*.0722+.5|0;a[o]=a[o+1]=a[o+2]=h}e.putImageData(n,0,0)},Gu=function(e){e&&(e.knockoutMaskEntry&&(this.canvasFactory.destroy(e.knockoutMaskEntry),e.knockoutMaskEntry=null),e.knockoutTempEntry&&(this.canvasFactory.destroy(e.knockoutTempEntry),e.knockoutTempEntry=null),e.knockoutBackdropEntry&&(this.canvasFactory.destroy(e.knockoutBackdropEntry),e.knockoutBackdropEntry=null))},y(va,Uf,null);let ul=va;for(const d in Mi)ul.prototype[d]!==void 0&&(ul.prototype[Mi[d]]=ul.prototype[d]);var od,ld;class rp{constructor(e,t,s){y(this,od,null);y(this,ld,null);O(this,"_fullReader",null);O(this,"_rangeReaders",new Set);O(this,"_source",null);this._source=e,g(this,od,t),g(this,ld,s)}get _progressiveDataLength(){var e;return((e=this._fullReader)==null?void 0:e._loaded)??0}getFullReader(){return qt(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(r(this,od))(this)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const s=new(r(this,ld))(this,e,t);return this._rangeReaders.add(s),s}cancelAllRequests(e){var t;(t=this._fullReader)==null||t.cancel(e);for(const s of new Set(this._rangeReaders))s.cancel(e)}}od=new WeakMap,ld=new WeakMap;class ap{constructor(e){O(this,"onProgress",null);O(this,"_contentLength",0);O(this,"_filename",null);O(this,"_headersCapability",Promise.withResolvers());O(this,"_isRangeSupported",!1);O(this,"_isStreamingSupported",!1);O(this,"_loaded",0);O(this,"_stream",null);this._stream=e}_callOnProgress(){var e;(e=this.onProgress)==null||e.call(this,{loaded:this._loaded,total:this._contentLength})}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(){gt("Abstract method `read` called")}cancel(e){gt("Abstract method `cancel` called")}}class op{constructor(e,t,s){O(this,"_stream",null);this._stream=e}async read(){gt("Abstract method `read` called")}cancel(e){gt("Abstract method `cancel` called")}}function f0(d){let e=!0,t=s("filename\\*","i").exec(d);if(t){t=t[1];let c=o(t);return c=unescape(c),c=l(c),c=h(c),n(c)}if(t=a(d),t){const c=h(t);return n(c)}if(t=s("filename","i").exec(d),t){t=t[1];let c=o(t);return c=h(c),n(c)}function s(c,u){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function i(c,u){if(c){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const f=new TextDecoder(c,{fatal:!0}),p=sp(u);u=f.decode(p),e=!1}catch{}}return u}function n(c){return e&&/[\x80-\xff]/.test(c)&&(c=i("utf-8",c),e&&(c=i("iso-8859-1",c))),c}function a(c){const u=[];let f;const p=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=p.exec(c))!==null;){let[,v,A,w]=f;if(v=parseInt(v,10),v in u){if(v===0)break;continue}u[v]=[A,w]}const m=[];for(let v=0;v<u.length&&v in u;++v){let[A,w]=u[v];w=o(w),A&&(w=unescape(w),v===0&&(w=l(w))),m.push(w)}return m.join("")}function o(c){if(c.startsWith('"')){const u=c.slice(1).split('\\"');for(let f=0;f<u.length;++f){const p=u[f].indexOf('"');p!==-1&&(u[f]=u[f].slice(0,p),u.length=f+1),u[f]=u[f].replaceAll(/\\(.)/g,"$1")}c=u.join('"')}return c}function l(c){const u=c.indexOf("'");if(u===-1)return c;const f=c.slice(0,u),m=c.slice(u+1).replace(/^[^']*'/,"");return i(f,m)}function h(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(u,f,p,m){if(p==="q"||p==="Q")return m=m.replaceAll("_"," "),m=m.replaceAll(/=([0-9a-f]{2})/gi,function(v,A){return String.fromCharCode(parseInt(A,16))}),i(f,m);try{m=atob(m)}catch{}return i(f,m)})}return""}function Iy(d,e){const t=new Headers;if(!d||!e||typeof e!="object")return t;for(const s in e){const i=e[s];i!==void 0&&t.append(s,i)}return t}function p0(d){let e=d.length;for(;e>0&&d[e-1]!==" "&&/\s/.test(d[e-1]);)e--;return d.slice(0,e)}function lp(d){var e;return((e=URL.parse(d))==null?void 0:e.origin)??null}function Oy({responseHeaders:d,isHttp:e,rangeChunkSize:t,disableRange:s}){const i={contentLength:0,isRangeSupported:!1},n=parseInt(d.get("Content-Length"),10);return!Number.isInteger(n)||(i.contentLength=n,n<=2*t)||s||!e||d.get("Accept-Ranges")!=="bytes"||(d.get("Content-Encoding")||"identity")==="identity"&&(i.isRangeSupported=!0),i}function My(d){const e=d.get("Content-Disposition");if(e){let t=f0(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(xm(t))return t}return null}function hp(d,e){return new vf(`Unexpected server response (${d}) while retrieving PDF "${e.href}".`,d,d===404||d===0&&e.protocol==="file:")}function Ry(d,e){if(d!==e)throw new Error(`Expected range response-origin "${d}" to match "${e}".`)}function Dy(d,e,t,s){return fetch(d,{method:"GET",headers:e,signal:s.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"})}function ky(d,e){if(d!==200&&d!==206)throw hp(d,e)}function cp(d){if(d instanceof Uint8Array)return d.buffer;if(d instanceof ArrayBuffer)return d;throw new Error(`getArrayBuffer - unexpected data: ${d}`)}class g0 extends rp{constructor(t){super(t,m0,v0);O(this,"_responseOrigin",null);const{httpHeaders:s,url:i}=t;qt(/https?:/.test(i.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=Iy(!0,s)}}class m0 extends ap{constructor(t){super(t);O(this,"_abortController",new AbortController);O(this,"_reader",null);const{disableRange:s,disableStream:i,rangeChunkSize:n,url:a,withCredentials:o}=t._source;this._isStreamingSupported=!i;const l=new Headers(t.headers);Dy(a,l,o,this._abortController).then(h=>{t._responseOrigin=lp(h.url),ky(h.status,a),this._reader=h.body.getReader();const c=h.headers,{contentLength:u,isRangeSupported:f}=Oy({responseHeaders:c,isHttp:!0,rangeChunkSize:n,disableRange:s});this._contentLength=u,this._isRangeSupported=f,this._filename=My(c),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new la("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;const{value:t,done:s}=await this._reader.read();return s?{value:t,done:s}:(this._loaded+=t.byteLength,this._callOnProgress(),{value:cp(t),done:!1})}cancel(t){var s;(s=this._reader)==null||s.cancel(t),this._abortController.abort()}}class v0 extends op{constructor(t,s,i){super(t,s,i);O(this,"_abortController",new AbortController);O(this,"_readCapability",Promise.withResolvers());O(this,"_reader",null);const{url:n,withCredentials:a}=t._source,o=new Headers(t.headers);o.append("Range",`bytes=${s}-${i-1}`),Dy(n,o,a,this._abortController).then(l=>{const h=lp(l.url);Ry(h,t._responseOrigin),ky(l.status,n),this._reader=l.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;const{value:t,done:s}=await this._reader.read();return s?{value:t,done:s}:{value:cp(t),done:!1}}cancel(t){var s;(s=this._reader)==null||s.cancel(t),this._abortController.abort()}}function yv(d){return d instanceof Uint8Array&&d.byteLength===d.buffer.byteLength?d.buffer:new Uint8Array(d).buffer}function dp(){for(const d of this._requests)d.resolve({value:void 0,done:!0});this._requests.length=0}var Hf,Fy;class y0 extends rp{constructor(t){super(t,b0,A0);y(this,Hf);O(this,"_progressiveDone",!1);O(this,"_queuedChunks",[]);const{pdfDataRangeTransport:s}=t,{initialData:i,progressiveDone:n}=s;if((i==null?void 0:i.length)>0){const o=yv(i);this._queuedChunks.push(o)}this._progressiveDone=n;const a=o=>{var l;switch(o.type){case"range":case"progressiveRead":b(this,Hf,Fy).call(this,o.begin,o.chunk);break;case"progressiveDone":(l=this._fullReader)==null||l.progressiveDone(),this._progressiveDone=!0;break}};s.transportReady(a)}getFullReader(){const t=super.getFullReader();return this._queuedChunks=null,t}getRangeReader(t,s){const i=super.getRangeReader(t,s);return i&&(i.onDone=()=>this._rangeReaders.delete(i),this._source.pdfDataRangeTransport.requestDataRange(t,s)),i}cancelAllRequests(t){super.cancelAllRequests(t),this._source.pdfDataRangeTransport.abort()}}Hf=new WeakSet,Fy=function(t,s){const i=yv(s);if(t===void 0)this._fullReader?this._fullReader._enqueue(i):this._queuedChunks.push(i);else{const n=this._rangeReaders.keys().find(a=>a._begin===t);qt(n,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),n._enqueue(i)}};var hd;class b0 extends ap{constructor(t){super(t);y(this,hd,dp.bind(this));O(this,"_done",!1);O(this,"_queuedChunks",null);O(this,"_requests",[]);const{pdfDataRangeTransport:s,disableRange:i,disableStream:n}=t._source,{length:a,contentDispositionFilename:o}=s;this._queuedChunks=t._queuedChunks||[];for(const h of this._queuedChunks)this._loaded+=h.byteLength;this._done=t._progressiveDone,this._contentLength=a,this._isStreamingSupported=!n,this._isRangeSupported=!i,xm(o)&&(this._filename=o),this._headersCapability.resolve();const l=this._loaded;Promise.resolve().then(()=>{l>0&&this._loaded===l&&this._callOnProgress()})}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength,this._callOnProgress())}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,r(this,hd).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&r(this,hd).call(this)}}hd=new WeakMap;var cd;class A0 extends op{constructor(t,s,i){super(t,s,i);y(this,cd,dp.bind(this));O(this,"onDone",null);O(this,"_begin",-1);O(this,"_done",!1);O(this,"_queuedChunk",null);O(this,"_requests",[]);this._begin=s}_enqueue(t){var s;this._done||(this._requests.length===0?this._queuedChunk=t:(this._requests.shift().resolve({value:t,done:!1}),r(this,cd).call(this)),this._done=!0,(s=this.onDone)==null||s.call(this))}async read(){if(this._queuedChunk){const s=this._queuedChunk;return this._queuedChunk=null,{value:s,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){var s;this._done=!0,r(this,cd).call(this),(s=this.onDone)==null||s.call(this)}}cd=new WeakMap;const wp=200,bv=206;function w0(d){return typeof d!="string"?d:sp(d).buffer}var zi,jh,Ly,Ny;class S0 extends rp{constructor(t){super(t,E0,x0);y(this,jh);y(this,zi,new WeakMap);O(this,"_responseOrigin",null);const{httpHeaders:s,url:i}=t;this.url=i,this.isHttp=/https?:/.test(i.protocol),this.headers=Iy(this.isHttp,s)}_request(t){const s=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:t.onHeadersReceived,onDone:t.onDone,onError:t.onError,onProgress:t.onProgress};r(this,zi).set(s,i),s.open("GET",this.url),s.withCredentials=this._source.withCredentials;for(const[n,a]of this.headers)s.setRequestHeader(n,a);return this.isHttp&&"begin"in t&&"end"in t?(s.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.validateStatus=n=>n===bv||n===wp):i.validateStatus=n=>n===wp,s.responseType="arraybuffer",qt(t.onError,"Expected `onError` callback to be provided."),s.onerror=()=>t.onError(s.status),s.onreadystatechange=b(this,jh,Ny).bind(this,s),s.onprogress=b(this,jh,Ly).bind(this,s),s.send(null),s}_abortRequest(t){r(this,zi).has(t)&&(r(this,zi).delete(t),t.abort())}getRangeReader(t,s){const i=super.getRangeReader(t,s);return i&&(i.onClosed=()=>this._rangeReaders.delete(i)),i}}zi=new WeakMap,jh=new WeakSet,Ly=function(t,s){var n;const i=r(this,zi).get(t);(n=i==null?void 0:i.onProgress)==null||n.call(i,s)},Ny=function(t,s){const i=r(this,zi).get(t);if(!i||(t.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),t.readyState!==4)||!r(this,zi).has(t))return;if(r(this,zi).delete(t),t.status===0&&this.isHttp){i.onError(t.status);return}const n=t.status||wp;if(!i.validateStatus(n)){i.onError(t.status);return}const a=w0(t.response);if(n===bv){const o=t.getResponseHeader("Content-Range");/bytes \d+-\d+\/\d+/.test(o)?i.onDone(a):(st('Missing or invalid "Content-Range" header.'),i.onError(0))}else a?i.onDone(a):i.onError(t.status)};var dd,an,By,Uy,Hy,_y;class E0 extends ap{constructor(t){super(t);y(this,an);y(this,dd,dp.bind(this));O(this,"_cachedChunks",[]);O(this,"_done",!1);O(this,"_requests",[]);O(this,"_storedError",null);this._fullRequestXhr=t._request({onHeadersReceived:b(this,an,By).bind(this),onDone:b(this,an,Uy).bind(this),onError:b(this,an,Hy).bind(this),onProgress:b(this,an,_y).bind(this)})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t),r(this,dd).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}dd=new WeakMap,an=new WeakSet,By=function(){const t=this._stream,{disableRange:s,rangeChunkSize:i}=t._source,n=this._fullRequestXhr;t._responseOrigin=lp(n.responseURL);const a=n.getAllResponseHeaders(),o=new Headers(a?p0(a.trimStart()).split(/[\r\n]+/).map(c=>{const[u,...f]=c.split(": ");return[u,f.join(": ")]}):[]),{contentLength:l,isRangeSupported:h}=Oy({responseHeaders:o,isHttp:t.isHttp,rangeChunkSize:i,disableRange:s});this._contentLength=l,this._isRangeSupported=h,this._filename=My(o),this._isRangeSupported&&t._abortRequest(n),this._headersCapability.resolve()},Uy=function(t){this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._cachedChunks.push(t),this._done=!0,this._cachedChunks.length===0&&r(this,dd).call(this)},Hy=function(t){this._storedError=hp(t,this._stream.url),this._headersCapability.reject(this._storedError);for(const s of this._requests)s.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0},_y=function(t){var s;(s=this.onProgress)==null||s.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})};var ud,tr,$y,jy,gg;class x0 extends op{constructor(t,s,i){super(t,s,i);y(this,tr);y(this,ud,dp.bind(this));O(this,"onClosed",null);O(this,"_done",!1);O(this,"_queuedChunk",null);O(this,"_requests",[]);O(this,"_storedError",null);this._requestXhr=t._request({begin:s,end:i,onHeadersReceived:b(this,tr,$y).bind(this),onDone:b(this,tr,jy).bind(this),onError:b(this,tr,gg).bind(this),onProgress:null})}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const s=this._queuedChunk;return this._queuedChunk=null,{value:s,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){var s;this._done=!0,r(this,ud).call(this),this._stream._abortRequest(this._requestXhr),(s=this.onClosed)==null||s.call(this)}}ud=new WeakMap,tr=new WeakSet,$y=function(){var s;const t=lp((s=this._requestXhr)==null?void 0:s.responseURL);try{Ry(t,this._stream._responseOrigin)}catch(i){this._storedError=i,b(this,tr,gg).call(this,0)}},jy=function(t){var s;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0,r(this,ud).call(this),(s=this.onClosed)==null||s.call(this)},gg=function(t){this._storedError??(this._storedError=hp(t,this._stream.url));for(const s of this._requests)s.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};function Gy(d,e=null){const t=process.getBuiltinModule("fs"),{Readable:s}=process.getBuiltinModule("stream"),i=t.createReadStream(d,e);return s.toWeb(i)}class T0 extends rp{constructor(e){super(e,C0,P0);const{url:t}=e;qt(t.protocol==="file:","PDFNodeStream only supports file:// URLs.")}}class C0 extends ap{constructor(t){super(t);O(this,"_reader",null);const{disableRange:s,disableStream:i,rangeChunkSize:n,url:a}=t._source;this._isStreamingSupported=!i,process.getBuiltinModule("fs/promises").lstat(a).then(l=>{const h=Gy(a);this._reader=h.getReader();const{size:c}=l;this._contentLength=c,this._isRangeSupported=!s&&c>2*n,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new la("Streaming is disabled.")),this._headersCapability.resolve()}).catch(l=>{l.code==="ENOENT"&&(l=hp(0,a)),this._headersCapability.reject(l)})}async read(){await this._headersCapability.promise;const{value:t,done:s}=await this._reader.read();return s?{value:t,done:s}:(this._loaded+=t.byteLength,this._callOnProgress(),{value:cp(t),done:!1})}cancel(t){var s;(s=this._reader)==null||s.cancel(t)}}class P0 extends op{constructor(t,s,i){super(t,s,i);O(this,"_readCapability",Promise.withResolvers());O(this,"_reader",null);const{url:n}=t._source;try{const a=Gy(n,{start:s,end:i-1});this._reader=a.getReader(),this._readCapability.resolve()}catch(a){this._readCapability.reject(a)}}async read(){await this._readCapability.promise;const{value:t,done:s}=await this._reader.read();return s?{value:t,done:s}:{value:cp(t),done:!1}}cancel(t){var s;(s=this._reader)==null||s.cancel(t)}}function I0(d){return yc(d)?g0:ks?T0:S0}var fd,pd;class Yn{static get workerPort(){return r(this,fd)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");g(this,fd,e)}static get workerSrc(){return r(this,pd)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");g(this,pd,e)}}fd=new WeakMap,pd=new WeakMap,y(Yn,fd,null),y(Yn,pd,"");var Wl,gd;class O0{constructor({parsedData:e,rawData:t}){y(this,Wl);y(this,gd);g(this,Wl,e),g(this,gd,t)}getRaw(){return r(this,gd)}get(e){return r(this,Wl).get(e)??null}[Symbol.iterator](){return r(this,Wl).entries()}}Wl=new WeakMap,gd=new WeakMap;const fa=Symbol("INTERNAL");var md,vd,Xl,ao;class M0{constructor(e,{name:t,intent:s,usage:i,rbGroups:n}){y(this,md,!1);y(this,vd,!1);y(this,Xl,!1);y(this,ao,!0);g(this,md,!!(e&Ds.DISPLAY)),g(this,vd,!!(e&Ds.PRINT)),this.name=t,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(r(this,Xl))return r(this,ao);if(!r(this,ao))return!1;const{print:e,view:t}=this.usage;return r(this,md)?(t==null?void 0:t.viewState)!=="OFF":r(this,vd)?(e==null?void 0:e.printState)!=="OFF":!0}_setVisible(e,t,s=!1){e!==fa&&gt("Internal method `_setVisible` called."),g(this,Xl,s),g(this,ao,t)}get serializable(){return{userSet:r(this,Xl),visible:r(this,ao)}}}md=new WeakMap,vd=new WeakMap,Xl=new WeakMap,ao=new WeakMap;var Lr,At,Yl,Kl,yd,bd,vg;const Nm=class Nm{constructor(e,t=Ds.DISPLAY,s=null){y(this,bd);y(this,Lr,null);y(this,At,new Map);y(this,Yl,null);y(this,Kl,null);y(this,yd);O(this,"creator",null);O(this,"name",null);if(g(this,yd,e),this.renderingIntent=t,e!==null){this.name=e.name,this.creator=e.creator,g(this,Kl,e.order);for(const i of e.groups)r(this,At).set(i.id,new M0(t,i));if(s){s.size!==r(this,At).size&&gt("Incorrect serialized groupState.");for(const[i,n]of s)r(this,At).get(i)._setVisible(fa,n.visible,n.userSet)}else{if(e.baseState==="OFF")for(const i of r(this,At).values())i._setVisible(fa,!1);for(const i of e.on)r(this,At).get(i)._setVisible(fa,!0);for(const i of e.off)r(this,At).get(i)._setVisible(fa,!1)}g(this,Yl,this.getHash())}}isVisible(e){if(r(this,At).size===0)return!0;if(!e)return ep("Optional content group not defined."),!0;if(e.type==="OCG")return r(this,At).has(e.id)?r(this,At).get(e.id).visible:(st(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return b(this,bd,vg).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const t of e.ids){if(!r(this,At).has(t))return st(`Optional content group not found: ${t}`),!0;if(r(this,At).get(t).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const t of e.ids){if(!r(this,At).has(t))return st(`Optional content group not found: ${t}`),!0;if(!r(this,At).get(t).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const t of e.ids){if(!r(this,At).has(t))return st(`Optional content group not found: ${t}`),!0;if(!r(this,At).get(t).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const t of e.ids){if(!r(this,At).has(t))return st(`Optional content group not found: ${t}`),!0;if(r(this,At).get(t).visible)return!1}return!0}return st(`Unknown optional content policy ${e.policy}.`),!0}return st(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0,s=!0){var n;const i=r(this,At).get(e);if(!i){st(`Optional content group not found: ${e}`);return}if(s&&t&&i.rbGroups.length)for(const a of i.rbGroups)for(const o of a)o!==e&&((n=r(this,At).get(o))==null||n._setVisible(fa,!1,!0));i._setVisible(fa,!!t,!0),g(this,Lr,null)}setOCGState({state:e,preserveRB:t}){let s;for(const i of e){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const n=r(this,At).get(i);if(n)switch(s){case"ON":this.setVisibility(i,!0,t);break;case"OFF":this.setVisibility(i,!1,t);break;case"Toggle":this.setVisibility(i,!n.visible,t);break}}g(this,Lr,null)}get hasInitialVisibility(){return r(this,Yl)===null||this.getHash()===r(this,Yl)}getOrder(){return r(this,At).size?r(this,Kl)?r(this,Kl).slice():[...r(this,At).keys()]:null}getGroup(e){return r(this,At).get(e)||null}getHash(){if(r(this,Lr)!==null)return r(this,Lr);const e=new tg;for(const[t,s]of r(this,At))e.update(`${t}:${s.visible}`);return g(this,Lr,e.hexdigest())}[Symbol.iterator](){return r(this,At).entries()}get serializable(){const e=new Map;for(const[t,s]of r(this,At))e.set(t,s.serializable);return{data:r(this,yd),renderingIntent:this.renderingIntent,groupState:e}}static fromSerializable({data:e,renderingIntent:t,groupState:s}){return new Nm(e,t,s)}};Lr=new WeakMap,At=new WeakMap,Yl=new WeakMap,Kl=new WeakMap,yd=new WeakMap,bd=new WeakSet,vg=function(e){const t=e.length;if(t<2)return!0;const s=e[0];for(let i=1;i<t;i++){const n=e[i];let a;if(Array.isArray(n))a=b(this,bd,vg).call(this,n);else if(r(this,At).has(n))a=r(this,At).get(n).visible;else return st(`Optional content group not found: ${n}`),!0;switch(s){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return s==="And"};let mg=Nm;var Qt,Js,pe,oo,Wi,Ne,hc,Vu,yg,bg;class R0{constructor(){y(this,Ne);y(this,Qt,null);y(this,Js,null);y(this,pe,0);y(this,oo,null);y(this,Wi,null)}get pagesNumber(){return r(this,pe)}set pagesNumber(e){r(this,pe)!==e&&(g(this,pe,e),g(this,Qt,null),g(this,Js,null))}movePages(e,t,s){b(this,Ne,hc).call(this);const i=r(this,Qt),n=t.length,a=new Uint32Array(n);let o=0;for(let f=0;f<n;f++){const p=t[f]-1;a[f]=i[p],p<s&&o++}const l=r(this,pe),h=l-n,c=new Int32Array(l),u=_t(s-o,0,h);for(let f=0,p=0;f<l;f++)e.has(f+1)||(i[p]=i[f],c[p++]=f+1);i.copyWithin(u+n,u,h),i.set(a,u),c.copyWithin(u+n,u,h),c.set(t,u),g(this,Js,c),i.every((f,p)=>f===p+1)&&g(this,Qt,null)}deletePages(e){b(this,Ne,hc).call(this);const t=r(this,Qt),s=b(this,Ne,Vu).call(this);g(this,Wi,{pageNumberToId:t.slice(),pagesNumber:r(this,pe),prevPageNumbers:r(this,Js).slice()});const i=r(this,pe)-e.length;g(this,pe,i);const n=g(this,Qt,new Uint32Array(i));g(this,Js,new Int32Array(i));let a=0,o=0;for(const l of e){const h=l-1;h!==a&&(n.set(t.subarray(a,h),o),o+=h-a),a=h+1}a<t.length&&n.set(t.subarray(a),o),b(this,Ne,yg).call(this,s,new Set(e))}cancelDelete(){r(this,Wi)&&(g(this,Qt,r(this,Wi).pageNumberToId),g(this,pe,r(this,Wi).pagesNumber),g(this,Js,r(this,Wi).prevPageNumbers),g(this,Wi,null))}cleanSavedData(){g(this,Wi,null)}copyPages(e){b(this,Ne,hc).call(this),g(this,oo,{pageNumbers:e,pageIds:e.map(t=>r(this,Qt)[t-1])})}cancelCopy(){g(this,oo,null)}pastePages(e){b(this,Ne,hc).call(this);const t=r(this,Qt),s=b(this,Ne,Vu).call(this),{pageNumbers:i,pageIds:n}=r(this,oo),a=r(this,pe)+i.length;g(this,pe,a);const o=g(this,Qt,new Uint32Array(a));g(this,Js,new Int32Array(a)),o.set(t.subarray(0,e),0),o.set(n,e),o.set(t.subarray(e),e+i.length),b(this,Ne,yg).call(this,s,null,e,i),g(this,oo,null)}hasBeenAltered(){return r(this,Qt)!==null}getPageMappingForSaving(e=null,t=b(this,Ne,bg).call(this)){e??(e=b(this,Ne,Vu).call(this));let s=0;for(const n of e.values())s=Math.max(s,n.length);const i=new Array(s);for(let n=0;n<s;n++)i[n]={document:null,pageIndices:[],includePages:[]};for(const[n,a]of e)for(let o=0,l=a.length;o<l;o++)i[o].includePages.push([n-1,a[o]-1]);for(const{includePages:n,pageIndices:a}of i){n.sort((o,l)=>o[0]-l[0]);for(let o=0,l=n.length;o<l;o++)a.push(n[o][1]),n[o]=n[o][0]}return{pageInfos:i,copyLevels:t}}extractPages(e){e=Array.from(e).sort((s,i)=>s-i);const t=new Map;for(let s=0,i=e.length;s<i;s++){const n=this.getPageId(e[s]);t.getOrInsertComputed(n,Gh).push(s+1)}return this.getPageMappingForSaving(t,b(this,Ne,bg).call(this,e))}getPrevPageNumber(e){var t;return((t=r(this,Js))==null?void 0:t[e-1])??0}getPageNumber(e){if(!r(this,Qt))return e;const t=r(this,Qt);for(let s=0,i=r(this,pe);s<i;s++)if(t[s]===e)return s+1;return 0}getPageId(e){var t;return((t=r(this,Qt))==null?void 0:t[e-1])??e}getMapping(){var e;return(e=r(this,Qt))==null?void 0:e.subarray(0,this.pagesNumber)}}Qt=new WeakMap,Js=new WeakMap,pe=new WeakMap,oo=new WeakMap,Wi=new WeakMap,Ne=new WeakSet,hc=function(){if(r(this,Qt))return;const e=r(this,pe),t=g(this,Qt,new Uint32Array(e));for(let s=0;s<e;s++)t[s]=s+1;g(this,Js,new Int32Array(t))},Vu=function(){const e=new Map,t=r(this,Qt);for(let s=0,i=r(this,pe);s<i;s++){const n=t[s],a=e.get(n);a?a.push(s+1):e.set(n,[s+1])}return e},yg=function(e,t=null,s=-1,i=null){const n=r(this,Js),a=r(this,Qt),o=s+((i==null?void 0:i.length)??0),l=new Map;for(let h=0,c=r(this,pe);h<c;h++){if(h>=s&&h<o){n[h]=-i[h-s];continue}const u=a[h],f=e.get(u);let p=l.get(u)||0;if(t&&f)for(;p<f.length&&t.has(f[p]);)p++;n[h]=f==null?void 0:f[p],l.set(u,p+1)}},bg=function(e=null){if(!r(this,Qt))return null;const t=new Int32Array(r(this,pe)).fill(-1),s=new Map;if(e)for(const i of e){const n=this.getPageId(i),a=s.get(n)??0;s.set(n,a+1),t[i-1]=a}else for(let i=0,n=r(this,pe);i<n;i++){const a=r(this,Qt)[i],o=s.get(a)??0;s.set(a,o+1),t[i]=o}return t};const al=Symbol("INITIAL_DATA"),Av=()=>({...Promise.withResolvers(),data:al});var Qs;class Vy{constructor(){y(this,Qs,new Map)}get(e,t=null){if(t){const i=r(this,Qs).getOrInsertComputed(e,Av);return i.promise.then(()=>t(i.data)),null}const s=r(this,Qs).get(e);if(!s||s.data===al)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return s.data}has(e){const t=r(this,Qs).get(e);return!!t&&t.data!==al}delete(e){const t=r(this,Qs).get(e);return!t||t.data===al?!1:(r(this,Qs).delete(e),!0)}resolve(e,t=null){const s=r(this,Qs).getOrInsertComputed(e,Av);if(s.data!==al)throw new Error(`Object already resolved ${e}.`);s.data=t,s.resolve()}clear(){var e;for(const{data:t}of r(this,Qs).values())(e=t==null?void 0:t.bitmap)==null||e.close();r(this,Qs).clear()}*[Symbol.iterator](){for(const[e,{data:t}]of r(this,Qs))t!==al&&(yield[e,t])}}Qs=new WeakMap;const D0=1e5,wv=30;var Cv,Nr,Qe,Ad,wd,Jl,lo,In,Sd,Ed,ho,xd,Ql,Br,Zl,Td,ql,co,Cd,Pd,th,uo,Id,eh,sh,er,zy,Wy,Ag,Ns,zu,wg,Xy,Yy;const Pe=class Pe{constructor({textContentSource:e,images:t,container:s,viewport:i}){y(this,er);y(this,Nr,Promise.withResolvers());y(this,Qe,null);y(this,Ad,!1);y(this,wd,!!((Cv=globalThis.FontInspector)!=null&&Cv.enabled));y(this,Jl,null);y(this,lo,null);y(this,In,null);y(this,Sd,0);y(this,Ed,0);y(this,ho,null);y(this,xd,null);y(this,Ql,0);y(this,Br,0);y(this,Zl,Object.create(null));y(this,Td,[]);y(this,ql,null);y(this,co,[]);y(this,Cd,new WeakMap);y(this,Pd,null);var h;if(e instanceof ReadableStream)g(this,ql,e);else if(typeof e=="object")g(this,ql,new ReadableStream({start(c){c.enqueue(e),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');g(this,Qe,g(this,xd,s)),g(this,Jl,t),g(this,Br,i.scale*xi.pixelRatio),g(this,Ql,i.rotation),g(this,In,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:a,pageX:o,pageY:l}=i.rawDims;g(this,Pd,[1,0,0,-1,-o,l+a]),g(this,Ed,n),g(this,Sd,a),b(h=Pe,Ns,Xy).call(h),s.style.setProperty("--min-font-size",r(Pe,eh)),Yo(s,i),r(this,Nr).promise.finally(()=>{r(Pe,sh).delete(this),g(this,In,null),g(this,Zl,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:t}=Mt.platform;return Q(this,"fontFamilyMap",new Map([["sans-serif",`${e&&t?"Calibri, ":""}sans-serif`],["monospace",`${e&&t?"Lucida Console, ":""}monospace`]]))}render(){r(this,Jl)&&r(this,Qe).append(r(this,Jl).render());const e=()=>{r(this,ho).read().then(({value:t,done:s})=>{if(s){r(this,Nr).resolve();return}r(this,lo)??g(this,lo,t.lang),Object.assign(r(this,Zl),t.styles),b(this,er,zy).call(this,t.items),e()},r(this,Nr).reject)};return g(this,ho,r(this,ql).getReader()),r(Pe,sh).add(this),e(),r(this,Nr).promise}update({viewport:e,onBefore:t=null}){var n;const s=e.scale*xi.pixelRatio,i=e.rotation;if(i!==r(this,Ql)&&(t==null||t(),g(this,Ql,i),Yo(r(this,xd),{rotation:i})),s!==r(this,Br)){t==null||t(),g(this,Br,s);const a={div:null,properties:null,ctx:b(n=Pe,Ns,zu).call(n,r(this,lo))};for(const o of r(this,co))a.properties=r(this,Cd).get(o),a.div=o,b(this,er,Ag).call(this,a)}}cancel(){var t;const e=new la("TextLayer task cancelled.");(t=r(this,ho))==null||t.cancel(e).catch(()=>{}),g(this,ho,null),r(this,Nr).reject(e)}get textDivs(){return r(this,co)}get textContentItemsStr(){return r(this,Td)}static cleanup(){if(!(r(this,sh).size>0)){r(this,th).clear();for(const{canvas:e}of r(this,uo).values())e.remove();r(this,uo).clear()}}};Nr=new WeakMap,Qe=new WeakMap,Ad=new WeakMap,wd=new WeakMap,Jl=new WeakMap,lo=new WeakMap,In=new WeakMap,Sd=new WeakMap,Ed=new WeakMap,ho=new WeakMap,xd=new WeakMap,Ql=new WeakMap,Br=new WeakMap,Zl=new WeakMap,Td=new WeakMap,ql=new WeakMap,co=new WeakMap,Cd=new WeakMap,Pd=new WeakMap,th=new WeakMap,uo=new WeakMap,Id=new WeakMap,eh=new WeakMap,sh=new WeakMap,er=new WeakSet,zy=function(e){var i,n;if(r(this,Ad))return;(n=r(this,In)).ctx??(n.ctx=b(i=Pe,Ns,zu).call(i,r(this,lo)));const t=r(this,co),s=r(this,Td);for(const a of e){if(t.length>D0){st("Ignoring additional textDivs for performance reasons."),g(this,Ad,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=r(this,Qe);g(this,Qe,document.createElement("span")),r(this,Qe).classList.add("markedContent"),a.id&&r(this,Qe).setAttribute("id",a.id),a.tag==="Artifact"&&(r(this,Qe).ariaHidden=!0),o.append(r(this,Qe))}else a.type==="endMarkedContent"&&g(this,Qe,r(this,Qe).parentNode);continue}s.push(a.str),b(this,er,Wy).call(this,a)}},Wy=function(e){var m;const t=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};r(this,co).push(t);const i=_.transform(r(this,Pd),e.transform);let n=Math.atan2(i[1],i[0]);const a=r(this,Zl)[e.fontName];a.vertical&&(n+=Math.PI/2);let o=r(this,wd)&&a.fontSubstitution||a.fontFamily;o=Pe.fontFamilyMap.get(o)||o;const l=Math.hypot(i[2],i[3]),h=l*b(m=Pe,Ns,Yy).call(m,o,a,r(this,lo));let c,u;n===0?(c=i[4],u=i[5]-h):(c=i[4]+h*Math.sin(n),u=i[5]-h*Math.cos(n));const f=t.style;f.left=`${(100*c/r(this,Ed)).toFixed(2)}%`,f.top=`${(100*u/r(this,Sd)).toFixed(2)}%`,f.setProperty("--font-height",`${l.toFixed(2)}px`),f.fontFamily=o,s.fontSize=l,t.setAttribute("role","presentation"),t.textContent=e.str,t.dir=e.dir,r(this,wd)&&(t.dataset.fontName=a.fontSubstitutionLoadedName||e.fontName),n!==0&&(s.angle=n*(180/Math.PI));let p=!1;if(e.str.length>1)p=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const v=Math.abs(e.transform[0]),A=Math.abs(e.transform[3]);v!==A&&Math.max(v,A)/Math.min(v,A)>1.5&&(p=!0)}if(p&&(s.canvasWidth=a.vertical?e.height:e.width),r(this,Cd).set(t,s),r(this,In).div=t,r(this,In).properties=s,b(this,er,Ag).call(this,r(this,In)),s.hasText&&r(this,Qe).append(t),s.hasEOL){const v=document.createElement("br");v.setAttribute("role","presentation"),r(this,Qe).append(v)}},Ag=function(e){var a;const{div:t,properties:s,ctx:i}=e,{style:n}=t;if(s.canvasWidth!==0&&s.hasText){const{fontFamily:o}=n,{canvasWidth:l,fontSize:h}=s;b(a=Pe,Ns,wg).call(a,i,h*r(this,Br),o);const{width:c}=i.measureText(t.textContent);c>0&&n.setProperty("--scale-x",l*r(this,Br)/c)}s.angle!==0&&n.setProperty("--rotate",`${s.angle}deg`)},Ns=new WeakSet,zu=function(e=null){let t=r(this,uo).get(e||(e=""));if(!t){const s=document.createElement("canvas");s.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal",s.lang=e,document.body.append(s),t=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),r(this,uo).set(e,t),r(this,Id).set(t,{size:0,family:""})}return t},wg=function(e,t,s){const i=r(this,Id).get(e);t===i.size&&s===i.family||(e.font=`${t}px ${s}`,i.size=t,i.family=s)},Xy=function(){if(r(this,eh)!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),g(this,eh,e.getBoundingClientRect().height),e.remove()},Yy=function(e,t,s){const i=r(this,th).get(e);if(i)return i;const n=b(this,Ns,zu).call(this,s);n.canvas.width=n.canvas.height=wv,b(this,Ns,wg).call(this,n,wv,e);const a=n.measureText(""),o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);n.canvas.width=n.canvas.height=0;let h=.8;return o?h=o/(o+l):(Mt.platform.isFirefox&&st("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?h=t.ascent:t.descent&&(h=1+t.descent)),r(this,th).set(e,h),h},y(Pe,Ns),y(Pe,th,new Map),y(Pe,uo,new Map),y(Pe,Id,new WeakMap),y(Pe,eh,null),y(Pe,sh,new Set);let Tc=Pe;const k0=100;function F0(d={}){const e=new Sg,{docId:t}=e,s=d.url?UA(d.url):null,i=d.data?HA(d.data):null,n=d.httpHeaders||null,a=d.withCredentials===!0,o=d.password??null,l=d.range instanceof Ky?d.range:null,h=Number.isInteger(d.rangeChunkSize)&&d.rangeChunkSize>0?d.rangeChunkSize:2**16;let c=d.worker instanceof Cc?d.worker:null;const u=d.verbosity,f=typeof d.docBaseUrl=="string"&&!ip(d.docBaseUrl)?d.docBaseUrl:null,p=wu(d.cMapUrl),m=d.cMapPacked!==!1,v=wu(d.iccUrl),A=wu(d.standardFontDataUrl),w=wu(d.wasmUrl),S=d.stopAtErrors!==!0,x=Number.isInteger(d.maxImageSize)&&d.maxImageSize>-1?d.maxImageSize:-1,C=typeof d.isOffscreenCanvasSupported=="boolean"?d.isOffscreenCanvasSupported:!ks,E=typeof d.isImageDecoderSupported=="boolean"?d.isImageDecoderSupported:!ks,T=Number.isInteger(d.canvasMaxAreaInBytes)?d.canvasMaxAreaInBytes:-1,P=typeof d.disableFontFace=="boolean"?d.disableFontFace:ks,M=d.fontExtraProperties===!0,I=d.enableXfa===!0,D=d.ownerDocument||globalThis.document,R=d.disableRange===!0,U=d.disableStream===!0,B=d.disableAutoFetch===!0,N=d.pdfBug===!0,W=d.CanvasFactory||(ks?XA:GA),k=d.FilterFactory||(ks?WA:VA),L=d.BinaryDataFactory||(ks?YA:hv),Y=d.enableHWA===!0,lt=d.enableWebGPU===!0?ZA():Promise.resolve(!1),vt=d.useWasm!==!1,dt=d.pagesMapper||new R0,rt=typeof d.useSystemFonts=="boolean"?d.useSystemFonts:!ks&&!P,bt=typeof d.useWorkerFetch=="boolean"?d.useWorkerFetch:!!(L===hv&&p&&m&&A&&w&&yc(p,document.baseURI)&&yc(A,document.baseURI)&&yc(w,document.baseURI)),Be=null;iA(u);const H={canvasFactory:new W({ownerDocument:D,enableHWA:Y}),filterFactory:new k({docId:t,ownerDocument:D}),binaryDataFactory:bt?null:new L({cMapUrl:p,standardFontDataUrl:A,wasmUrl:w})};c||(c=Cc.create({verbosity:u,port:Yn.workerPort}),e._worker=c);const F={docId:t,apiVersion:"6.3.289",data:i,password:o,disableAutoFetch:B,rangeChunkSize:h,docBaseUrl:f,enableXfa:I,evaluatorOptions:{maxImageSize:x,disableFontFace:P,ignoreErrors:S,isOffscreenCanvasSupported:C,isImageDecoderSupported:E,canvasMaxAreaInBytes:T,fontExtraProperties:M,useSystemFonts:rt,useWasm:vt,useWorkerFetch:bt,cMapUrl:p,cMapPacked:m,iccUrl:v,standardFontDataUrl:A,wasmUrl:w,hasGPU:!1}},j={ownerDocument:D,pdfBug:N,styleElement:Be,enableHWA:Y,loadingParams:{disableAutoFetch:B,enableXfa:I}};return Promise.all([c.promise,lt]).then(function([,it]){if(c.destroyed)throw new Error("Worker was destroyed");F.evaluatorOptions.hasGPU=it;const yt=c.messageHandler.sendWithPromise("GetDocRequest",F,i?[i.buffer]:null);let q;if(!i)if(l)q=new y0({pdfDataRangeTransport:l,disableRange:R,disableStream:U});else if(s){const ut=I0(s);q=new ut({url:s,httpHeaders:n,withCredentials:a,rangeChunkSize:h,disableRange:R,disableStream:U})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return yt.then(ut=>{if(c.destroyed)throw new Error("Worker was destroyed");const kt=new nc(t,ut,c.port),Te=new N0(kt,e,q,j,H,dt);if(e._transport=Te,e.destroyed)throw new Error("Loading aborted");kt.send("Ready",null)})}).catch(e._capability.reject).finally(e._setupCapability.resolve),e}var _f;const $f=class $f{constructor(){O(this,"_capability",Promise.withResolvers());O(this,"_setupCapability",Promise.withResolvers());O(this,"_transport",null);O(this,"_worker",null);O(this,"docId",`d${Xt($f,_f)._++}`);O(this,"destroyed",!1);O(this,"onPassword",null);O(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var e,t,s,i;this.destroyed=!0,this._capability.promise.catch(()=>{});try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await this._setupCapability.promise,await((t=this._transport)==null?void 0:t.destroy())}catch(n){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,n}this._transport=null,(i=this._worker)==null||i.destroy(),this._worker=null}async getData(){return this._transport.getData()}};_f=new WeakMap,y($f,_f,0);let Sg=$f;var ih,fo;class Ky{constructor(e,t,s=!1,i=null){y(this,ih,Promise.withResolvers());y(this,fo,null);this.length=e,this.initialData=t,this.progressiveDone=s,this.contentDispositionFilename=i}onDataRange(e,t){r(this,fo).call(this,{type:"range",begin:e,chunk:t})}onDataProgressiveRead(e){r(this,ih).promise.then(()=>{r(this,fo).call(this,{type:"progressiveRead",chunk:e})})}onDataProgressiveDone(){r(this,ih).promise.then(()=>{r(this,fo).call(this,{type:"progressiveDone"})})}transportReady(e){g(this,fo,e),r(this,ih).resolve()}requestDataRange(e,t){gt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}ih=new WeakMap,fo=new WeakMap;class L0{constructor(e,t){this._pdfInfo=e,this._transport=t}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Q(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAttachmentContent(e){return this._transport.getAttachmentContent(e)}getAnnotationsByType(e,t){return this._transport.getAnnotationsByType(e,t)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(t)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(e,t=null){return this._transport.extractPages(e,t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}getSignatures(){return this._transport.getSignatures()}getSignatureData(e){return this._transport.getSignatureData(e)}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var On,po,go,cc;const Bm=class Bm{constructor(e,t,s,i,n=!1){y(this,go);y(this,On,!1);y(this,po,null);this._pageIndex=e,this._pageInfo=t,this._transport=s,this._stats=n?new Km:null,this._pdfBug=n,this.commonObjs=s.commonObjs,this.objs=new Vy,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,g(this,po,i),this.imageCoordinates=null}clone(e){const t=new Bm(e,this._pageInfo,this._transport,r(this,po),this._pdfBug);return t.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(t),t}get pageNumber(){return this._pageIndex+1}set pageNumber(e){this._pageIndex=e-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new gu({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:t,offsetX:s,offsetY:i,dontFlip:n})}getAnnotations({intent:e="display"}={}){const{renderingIntent:t}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Q(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,canvas:t=e.canvas,viewport:s,intent:i="display",annotationMode:n=ir.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:h=null,pageColors:c=null,printAnnotationStorage:u=null,isEditing:f=!1,recordImages:p=!1,recordOperations:m=!1,operationsFilter:v=null}){var B,N,W;(B=this._stats)==null||B.time("Overall");const A=this._transport.getRenderingIntent(i,n,u,f),{renderingIntent:w,cacheKey:S}=A;g(this,On,!1),l||(l=this._transport.getOptionalContentConfig(w));const x=this._intentStates.getOrInsertComputed(S,Ip);x.streamReaderCancelTimeout&&(clearTimeout(x.streamReaderCancelTimeout),x.streamReaderCancelTimeout=null);const C=!!(w&Ds.PRINT);x.displayReadyCapability||(x.displayReadyCapability=Promise.withResolvers(),x.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(N=this._stats)==null||N.time("Page Request"),this._pumpOperatorList(A));const E=!!(this._pdfBug&&((W=globalThis.StepperManager)!=null&&W.enabled)),T=!!t&&!this.recordedBBoxes&&(m||E),P=!!t&&!this.imageCoordinates&&p,M=k=>{var L,Y,z,lt;if(x.renderTasks.delete(R),T){const vt=(L=R.gfx)==null?void 0:L.dependencyTracker.take();vt&&((Y=R.stepper)==null||Y.setOperatorBBoxes(vt,R.gfx.dependencyTracker.takeDebugMetadata()),m&&(this.recordedBBoxes=vt))}P&&!k&&(this.imageCoordinates=(z=R.gfx)==null?void 0:z.imagesTracker.take()),C&&g(this,On,!0),b(this,go,cc).call(this),k?(R.capability.reject(k),this._abortOperatorList({intentState:x,reason:k instanceof Error?k:new Error(k)})):R.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(lt=globalThis.Stats)!=null&&lt.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))};let I=null,D=null;(T||P)&&(D=new IA(t,x.operatorList.length)),T&&(I=new OA(D,E));const R=new xg({callback:M,params:{canvas:t,canvasContext:e,dependencyTracker:I??D,imagesTracker:P?new ig(t):null,viewport:s,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:x.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!C,pdfBug:this._pdfBug,pageColors:c,enableHWA:this._transport.enableHWA,operationsFilter:v});(x.renderTasks||(x.renderTasks=new Set)).add(R);const U=R.task;return Promise.all([x.displayReadyCapability.promise,l]).then(([k,L])=>{var Y;if(this.destroyed){M();return}if((Y=this._stats)==null||Y.time("Rendering"),!(L.renderingIntent&w))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");R.initializeGraphics({transparency:k,optionalContentConfig:L}),R.operatorListChanged()}).catch(M),U}getOperatorList({intent:e="display",annotationMode:t=ir.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var h;function n(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(e,t,s,i,!0),o=this._intentStates.getOrInsertComputed(a.cacheKey,Ip);let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=n,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:r(this,po).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(i){return i.items.length}})}async getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(i=>Sc.textContent(i));const t=this.streamTextContent(e),s={items:[],styles:Object.create(null),lang:null};for await(const i of t)s.lang??(s.lang=i.lang),Object.assign(s.styles,i.styles),s.items.push(...i.items);return s}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const s of t.renderTasks)e.push(s.completed),s.cancel();return this.objs.clear(),g(this,On,!1),Promise.all(e)}cleanup(e=!1){g(this,On,!0);const t=b(this,go,cc).call(this);return e&&t&&this._stats&&(this._stats=new Km),t}_startRenderPage(e,t){var i,n;const s=this._intentStates.get(t);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(n=s.displayReadyCapability)==null||n.resolve(e))}_renderPageChunk(e,t){for(let s=0,i=e.length;s<i;s++)t.operatorList.fnArray.push(e.fnArray[s]),t.operatorList.argsArray.push(e.argsArray[s]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const s of t.renderTasks)s.operatorListChanged();e.lastChunk&&b(this,go,cc).call(this)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:s,modifiedIds:i}){const{map:n,transfer:a}=s,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:r(this,po).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:n,modifiedIds:i},void 0,a).getReader(),h=this._intentStates.get(t);h.streamReader=l;const c=()=>{l.read().then(({value:u,done:f})=>{if(f){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,h),c())},u=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const f of h.renderTasks)f.operatorListChanged();b(this,go,cc).call(this)}if(h.displayReadyCapability)h.displayReadyCapability.reject(u);else if(h.opListReadCapability)h.opListReadCapability.reject(u);else throw u}})};c()}_abortOperatorList({intentState:e,reason:t,force:s=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!s){if(e.renderTasks.size>0)return;if(t instanceof Em){let i=k0;t.extraDelay>0&&t.extraDelay<1e3&&(i+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},i);return}}if(e.streamReader.cancel(new la(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[i,n]of this._intentStates)if(n===e){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}};On=new WeakMap,po=new WeakMap,go=new WeakSet,cc=function(){if(!r(this,On)||this.destroyed)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),g(this,On,!1),!0};let Eg=Bm;var Ur,pi,Mn,mo,jf,vo,yo,is,Wu,Jy,Qy,dc,nh,Xu;const te=class te{constructor({name:e=null,port:t=null,verbosity:s=nA()}={}){y(this,is);y(this,Ur,Promise.withResolvers());y(this,pi,null);y(this,Mn,null);y(this,mo,null);if(this.name=e,this.destroyed=!1,this.verbosity=s,t){if(r(te,yo).has(t))throw new Error("Cannot use more than one PDFWorker per port.");r(te,yo).set(t,this),b(this,is,Jy).call(this,t)}else b(this,is,Qy).call(this)}get promise(){return r(this,Ur).promise}get port(){return r(this,Mn)}get messageHandler(){return r(this,pi)}destroy(){var e,t;this.destroyed=!0,(e=r(this,mo))==null||e.terminate(),g(this,mo,null),r(te,yo).delete(r(this,Mn)),g(this,Mn,null),(t=r(this,pi))==null||t.destroy(),g(this,pi,null)}static create(e){const t=r(this,yo).get(e==null?void 0:e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new te(e)}static get workerSrc(){if(Yn.workerSrc)return Yn.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Q(this,"_setupFakeWorkerGlobal",(async()=>r(this,nh,Xu)?r(this,nh,Xu):(await import(this.workerSrc)).WorkerMessageHandler)())}};Ur=new WeakMap,pi=new WeakMap,Mn=new WeakMap,mo=new WeakMap,jf=new WeakMap,vo=new WeakMap,yo=new WeakMap,is=new WeakSet,Wu=function(){r(this,Ur).resolve(),r(this,pi).send("configure",{verbosity:this.verbosity})},Jy=function(e){g(this,Mn,e),g(this,pi,new nc("main","worker",e)),r(this,pi).on("ready",()=>{}),b(this,is,Wu).call(this)},Qy=function(){if(r(te,vo)||r(te,nh,Xu)){b(this,is,dc).call(this);return}let{workerSrc:e}=te;try{te._isSameOrigin(window.location,e)||(e=te._createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e,{type:"module"}),s=new nc("main","worker",t),i=()=>{n.abort(),s.destroy(),t.terminate(),this.destroyed?r(this,Ur).reject(new Error("Worker was destroyed")):b(this,is,dc).call(this)},n=new AbortController;t.addEventListener("error",()=>{r(this,mo)||i()},{signal:n.signal}),s.on("test",o=>{if(n.abort(),this.destroyed||!o){i();return}g(this,pi,s),g(this,Mn,t),g(this,mo,t),b(this,is,Wu).call(this)}),s.on("ready",o=>{if(n.abort(),this.destroyed){i();return}try{a()}catch{b(this,is,dc).call(this)}});const a=()=>{const o=new Uint8Array;s.send("test",o,[o.buffer])};a();return}catch{ep("The worker has been disabled.")}b(this,is,dc).call(this)},dc=function(){r(te,vo)||(st("Setting up fake worker."),g(te,vo,!0)),te._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){r(this,Ur).reject(new Error("Worker was destroyed"));return}const t=new jA;g(this,Mn,t);const s=`fake${Xt(te,jf)._++}`,i=new nc(s+"_worker",s,t);e.setup(i,t),g(this,pi,new nc(s,s+"_worker",t)),b(this,is,Wu).call(this)}).catch(e=>{r(this,Ur).reject(new Error(`Setting up fake worker failed: "${e.message}".`))})},nh=new WeakSet,Xu=function(){var e;try{return((e=globalThis.pdfjsWorker)==null?void 0:e.WorkerMessageHandler)||null}catch{return null}},y(te,nh),y(te,jf,0),y(te,vo,!1),y(te,yo,new WeakMap),ks&&(g(te,vo,!0),Yn.workerSrc||(Yn.workerSrc="./pdf.worker.mjs")),te._isSameOrigin=(e,t)=>{const s=URL.parse(e);if(!(s!=null&&s.origin)||s.origin==="null")return!1;const i=new URL(t,s);return s.origin===i.origin},te._createCDNWrapper=e=>{const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};let Cc=te;var ws,bo,Rn,gi,Ao,rh,Dn,si,ol,Yu;class N0{constructor(e,t,s,i,n,a){y(this,si);O(this,"downloadInfoCapability",Promise.withResolvers());y(this,ws,null);y(this,bo,new Map);y(this,Rn,null);y(this,gi,new Map);y(this,Ao,new Map);y(this,rh,new Map);y(this,Dn,null);this.messageHandler=e,this.loadingTask=t,g(this,Rn,s),this.commonObjs=new Vy,this.fontLoader=new RA({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.enableHWA=i.enableHWA,this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.binaryDataFactory=n.binaryDataFactory,this.pagesMapper=a,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(e){const{_pageIndex:t}=e;r(this,gi).set(t,e),r(this,Ao).set(t,Promise.resolve(e))}get annotationStorage(){return Q(this,"annotationStorage",new Tm)}getRenderingIntent(e,t=ir.ENABLE,s=null,i=!1,n=!1){let a=Ds.DISPLAY,o=Ec;switch(e){case"any":a=Ds.ANY;break;case"display":break;case"print":a=Ds.PRINT;break;default:st(`getRenderingIntent - invalid intent: ${e}`)}const l=a&Ds.PRINT&&s instanceof uy?s:this.annotationStorage;switch(t){case ir.DISABLE:a+=Ds.ANNOTATIONS_DISABLE;break;case ir.ENABLE:break;case ir.ENABLE_FORMS:a+=Ds.ANNOTATIONS_FORMS;break;case ir.ENABLE_STORAGE:a+=Ds.ANNOTATIONS_STORAGE,o=l.serializable;break;default:st(`getRenderingIntent - invalid annotationMode: ${t}`)}i&&(a+=Ds.IS_EDITING),n&&(a+=Ds.OPLIST);const{ids:h,hash:c}=l.modifiedIds,u=[a,o.hash,c];return{renderingIntent:a,cacheKey:u.join("_"),annotationStorageSerializable:o,modifiedIds:h}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=r(this,Dn))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const i of r(this,gi).values())e.push(i._destroy());r(this,gi).clear(),r(this,Ao).clear(),r(this,rh).clear(),Object.hasOwn(this,"annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then(()=>{var i,n;this.commonObjs.clear(),this.fontLoader.clear(),r(this,bo).clear(),this.filterFactory.destroy(),Tc.cleanup(),(i=r(this,Rn))==null||i.cancelAllRequests(new la("Worker was terminated.")),(n=this.messageHandler)==null||n.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",(s,i)=>{qt(r(this,Rn),"GetReader - no `BasePDFStream` instance available."),g(this,ws,r(this,Rn).getFullReader()),r(this,ws).onProgress=n=>b(this,si,Yu).call(this,n),i.onPull=()=>{r(this,ws).read().then(function({value:n,done:a}){if(a){i.close();return}qt(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{r(this,ws).cancel(n),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),e.on("ReaderHeadersReady",async s=>{await r(this,ws).headersReady;const{isStreamingSupported:i,isRangeSupported:n,contentLength:a}=r(this,ws);return i&&n&&(r(this,ws).onProgress=null),{isStreamingSupported:i,isRangeSupported:n,contentLength:a}}),e.on("GetRangeReader",(s,i)=>{qt(r(this,Rn),"GetRangeReader - no `BasePDFStream` instance available.");const n=r(this,Rn).getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:a,done:o}){if(o){i.close();return}qt(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{n.cancel(a),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),e.on("GetDoc",({pdfInfo:s})=>{this.pagesMapper.pagesNumber=s.numPages,this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,t._capability.resolve(new L0(s,this))}),e.on("DocException",s=>{t._capability.reject(as(s))}),e.on("PasswordRequest",s=>{g(this,Dn,Promise.withResolvers());try{if(!t.onPassword)throw as(s);const i=n=>{n instanceof Error?r(this,Dn).reject(n):r(this,Dn).resolve({password:n})};t.onPassword(i,s.code)}catch(i){r(this,Dn).reject(i)}return r(this,Dn).promise}),e.on("DataLoaded",s=>{b(this,si,Yu).call(this,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),e.on("StartRenderPage",s=>{if(this.destroyed)return;r(this,gi).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),e.on("commonobj",([s,i,n])=>{var a;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":if("error"in n){const f=n.error;st(`Error during font loading: ${f}`),this.commonObjs.resolve(s,f);break}const o=new LA(n),l=this._params.pdfBug&&((a=globalThis.FontInspector)!=null&&a.enabled)?(f,p)=>globalThis.FontInspector.fontAdded(f,p):null,h=new DA(o,l,n.charProcOperatorList,n.extra);this.fontLoader.bind(h).catch(()=>e.sendWithPromise("FontFallback",{id:s})).finally(()=>{h.fontExtraProperties||h.clearData(),this.commonObjs.resolve(s,h)});break;case"CopyLocalImage":const{imageRef:c}=n;qt(c,"The imageRef must be defined.");for(const f of r(this,gi).values())for(const[,p]of f.objs){if((p==null?void 0:p.ref)!==c)continue;if(!p.dataLen)return null;const m=structuredClone(p);return this.commonObjs.resolve(s,m),p.dataLen}break;case"FontPath":this.commonObjs.resolve(s,new BA(n));break;case"Image":this.commonObjs.resolve(s,n);break;case"Pattern":const u=new NA(n);this.commonObjs.resolve(s,u.getIR());break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),e.on("obj",([s,i,n,a])=>{var l;if(this.destroyed)return;const o=r(this,gi).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(n){case"Image":case"Pattern":o.objs.resolve(s,a);break;default:throw new Error(`Got unknown object type ${n}`)}}}),e.on("DocProgress",s=>{this.destroyed||b(this,si,Yu).call(this,s)}),e.on("FetchBinaryData",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.binaryDataFactory)throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(s)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&&st("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((s=r(this,ws))==null?void 0:s.filename)??null},t).finally(()=>{this.annotationStorage.resetModified()})}extractPages(e,t=null){var a;const s={pageInfos:e};let i;const n=globalThis.ImageBitmap;if(typeof n=="function"){const o=Array.isArray(e)?e:[e];for(const l of o)(l==null?void 0:l.image)instanceof n&&(i||(i=[])).push(l.image)}if(this.annotationStorage.size>0){const o=this.annotationStorage.serializable;let{map:l}=o;(a=o.transfer)!=null&&a.length&&(i?i.push(...o.transfer):i=o.transfer);const h=this.pagesMapper.getMapping();if(h){const c=new Map;for(const[u,f]of l){if((f==null?void 0:f.pageIndex)!==void 0&&f.pageIndex>=0&&f.pageIndex<h.length){const p=(t==null?void 0:t[f.pageIndex])??0,m=h[f.pageIndex]-1;if(m!==f.pageIndex||p!==0){c.set(u,{...f,pageIndex:m,copyLevel:p});continue}}c.set(u,f)}l=c}s.annotationStorage=l}return this.messageHandler.sendWithPromise("ExtractPages",s,i).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this.pagesMapper.pagesNumber)return Promise.reject(new Error("Invalid page request."));const t=e-1,s=this.pagesMapper.getPageId(e)-1,i=r(this,Ao).get(t);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:s}).then(a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&r(this,rh).set(a.refStr,s);const o=new Eg(t,a,this,this.pagesMapper,this._params.pdfBug);return r(this,gi).set(t,o),o});return r(this,Ao).set(t,n),n}async getPageIndex(e){if(!rg(e))throw new Error("Invalid pageIndex request.");const t=await this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}),s=this.pagesMapper.getPageNumber(t+1);if(s===0)throw new Error("GetPageIndex: page has been removed.");return s-1}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(e+1)-1,intent:t})}getFieldObjects(){return b(this,si,ol).call(this,"GetFieldObjects")}getSignatures(){return b(this,si,ol).call(this,"GetSignatures")}getSignatureData(e){return this.messageHandler.sendWithPromise("GetSignatureData",e)}hasJSActions(){return b(this,si,ol).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAttachmentContent(e){return this.messageHandler.sendWithPromise("GetAttachmentContent",e)}getAnnotationsByType(e,t){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:e,pageIndexesToSkip:t})}getDocJSActions(){return b(this,si,ol).call(this,"GetDocJSActions")}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(e+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(e){return b(this,si,ol).call(this,"GetOptionalContentConfig").then(t=>new mg(t,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata";return r(this,bo).getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,null).then(t=>{var s,i;return{info:t[0],metadata:t[1]?new O0(t[1]):null,contentDispositionFilename:((s=r(this,ws))==null?void 0:s.filename)??null,contentLength:((i=r(this,ws))==null?void 0:i.contentLength)??null,hasStructTree:t[2]}}))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of r(this,gi).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),r(this,bo).clear(),this.filterFactory.destroy(!0),Tc.cleanup()}}cachedPageNumber(e){if(!rg(e))return null;const t=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`,s=r(this,rh).get(t);if(s>=0){const i=this.pagesMapper.getPageNumber(s+1);if(i!==0)return i}return null}}ws=new WeakMap,bo=new WeakMap,Rn=new WeakMap,gi=new WeakMap,Ao=new WeakMap,rh=new WeakMap,Dn=new WeakMap,si=new WeakSet,ol=function(e,t=null){return r(this,bo).getOrInsertComputed(e,()=>this.messageHandler.sendWithPromise(e,t))},Yu=function({loaded:e,total:t}){var s,i;(i=(s=this.loadingTask).onProgress)==null||i.call(s,{loaded:e,total:t,percent:t?_t(Math.round(e/t*100),0,100):NaN})};class B0{constructor(e){O(this,"_internalRenderTask",null);O(this,"onContinue",null);O(this,"onError",null);this._internalRenderTask=e}get promise(){return this._internalRenderTask.capability.promise}cancel(e=0){this._internalRenderTask.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this._internalRenderTask.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this._internalRenderTask;return e.form||e.canvas&&(t==null?void 0:t.size)>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}}var Hr,wo;const ya=class ya{constructor({callback:e,params:t,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:f=null,enableHWA:p=!1,operationsFilter:m=null}){y(this,Hr,null);this.callback=e,this.params=t,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=u,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=c===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new B0(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvas,this._canvasContext=t.canvas?null:t.canvasContext,this._enableHWA=p,this._dependencyTracker=t.dependencyTracker,this._imagesTracker=t.imagesTracker,this._operationsFilter=m}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){var h,c;if(this.cancelled)return;if(this._canvas){if(r(ya,wo).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.");r(ya,wo).add(this._canvas)}this._pdfBug&&((h=globalThis.StepperManager)!=null&&h.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:s,transform:i,background:n,dependencyTracker:a,imagesTracker:o}=this.params,l=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new ul(l,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors,a,o),this.gfx.beginDrawing({transform:i,viewport:s,transparency:e,background:n}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(e=null,t=0){var s,i,n;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),r(this,Hr)&&(window.cancelAnimationFrame(r(this,Hr)),g(this,Hr,null)),r(ya,wo).delete(this._canvas),e||(e=new Em(`Rendering cancelled, page ${this._pageIndex+1}`,t)),this.callback(e),(n=(i=this.task).onError)==null||n.call(i,e)}operatorListChanged(){var e,t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.gfx.dependencyTracker)==null||e.growOperationsCount(this.operatorList.fnArray.length),(t=this.stepper)==null||t.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?g(this,Hr,window.requestAnimationFrame(()=>{g(this,Hr,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._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),r(ya,wo).delete(this._canvas),this.callback())))}};Hr=new WeakMap,wo=new WeakMap,y(ya,wo,new WeakSet);let xg=ya;const U0="6.3.289",H0="1c8020a7d";ot(3068);var Ss,So,ah,ge,Od,oh,kn,Md,_r,mi,Rd,Rt,Tg,Cg,Pg,pa,Zy,sr;const ls=class ls{constructor({editor:e=null,uiManager:t=null}){y(this,Rt);y(this,Ss,null);y(this,So,null);y(this,ah);y(this,ge,null);y(this,Od,!1);y(this,oh,!1);y(this,kn,null);y(this,Md);y(this,_r,null);y(this,mi,null);var s,i;e?(g(this,oh,!1),g(this,kn,e)):g(this,oh,!0),g(this,mi,(e==null?void 0:e._uiManager)||t),g(this,Md,r(this,mi)._eventBus),g(this,ah,((s=e==null?void 0:e.color)==null?void 0:s.toUpperCase())||((i=r(this,mi))==null?void 0:i.highlightColors.values().next().value)||"#FFFF98"),r(ls,Rd)||g(ls,Rd,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Q(this,"_keyboardManager",new Ko([[["Escape"],ls.prototype._hideDropdownFromKeyboard],[["Space"],ls.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight"],ls.prototype._moveToNext],[["ArrowUp","ArrowLeft"],ls.prototype._moveToPrevious],[["Home"],ls.prototype._moveToBeginning],[["End"],ls.prototype._moveToEnd]]))}renderButton(){const e=g(this,Ss,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",r(this,kn)&&(e.ariaControls=`${r(this,kn).id}_colorpicker_dropdown`);const t=r(this,mi)._signal;e.addEventListener("click",b(this,Rt,pa).bind(this),{signal:t}),e.addEventListener("keydown",b(this,Rt,Pg).bind(this),{signal:t});const s=g(this,So,document.createElement("span"));return s.className="swatch",s.ariaHidden="true",s.style.backgroundColor=r(this,ah),e.append(s),e}renderMainDropdown(){const e=g(this,ge,b(this,Rt,Tg).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===r(this,Ss)){b(this,Rt,pa).call(this,e);return}const t=e.target.getAttribute("data-color");t&&b(this,Rt,Cg).call(this,t,e)}_moveToNext(e){var t,s;if(!r(this,Rt,sr)){b(this,Rt,pa).call(this,e);return}if(e.target===r(this,Ss)){(t=r(this,ge).firstElementChild)==null||t.focus();return}(s=e.target.nextSibling)==null||s.focus()}_moveToPrevious(e){var t,s;if(e.target===((t=r(this,ge))==null?void 0:t.firstElementChild)||e.target===r(this,Ss)){r(this,Rt,sr)&&this._hideDropdownFromKeyboard();return}r(this,Rt,sr)||b(this,Rt,pa).call(this,e),(s=e.target.previousSibling)==null||s.focus()}_moveToBeginning(e){var t;if(!r(this,Rt,sr)){b(this,Rt,pa).call(this,e);return}(t=r(this,ge).firstElementChild)==null||t.focus()}_moveToEnd(e){var t;if(!r(this,Rt,sr)){b(this,Rt,pa).call(this,e);return}(t=r(this,ge).lastElementChild)==null||t.focus()}hideDropdown(){var e,t;(e=r(this,ge))==null||e.classList.add("hidden"),r(this,Ss).ariaExpanded="false",(t=r(this,_r))==null||t.abort(),g(this,_r,null)}_hideDropdownFromKeyboard(){var e;if(!r(this,oh)){if(!r(this,Rt,sr)){(e=r(this,kn))==null||e.unselect();return}this.hideDropdown(),r(this,Ss).focus({preventScroll:!0,focusVisible:r(this,Od)})}}update(e){if(r(this,So)&&(r(this,So).style.backgroundColor=e),!r(this,ge))return;const t=r(this,mi).highlightColors.values();for(const s of r(this,ge).children)s.ariaSelected=t.next().value===e.toUpperCase()}destroy(){var e,t;(e=r(this,Ss))==null||e.remove(),g(this,Ss,null),g(this,So,null),(t=r(this,ge))==null||t.remove(),g(this,ge,null)}};Ss=new WeakMap,So=new WeakMap,ah=new WeakMap,ge=new WeakMap,Od=new WeakMap,oh=new WeakMap,kn=new WeakMap,Md=new WeakMap,_r=new WeakMap,mi=new WeakMap,Rd=new WeakMap,Rt=new WeakSet,Tg=function(){const e=document.createElement("div"),t=r(this,mi)._signal;e.addEventListener("contextmenu",Ei,{signal:t}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),r(this,kn)&&(e.id=`${r(this,kn).id}_colorpicker_dropdown`);for(const[s,i]of r(this,mi).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",r(ls,Rd)[s]);const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=i,n.ariaSelected=i===r(this,ah),n.addEventListener("click",b(this,Rt,Cg).bind(this,i),{signal:t}),e.append(n)}return e.addEventListener("keydown",b(this,Rt,Pg).bind(this),{signal:t}),e},Cg=function(e,t){t.stopPropagation(),r(this,Md).dispatch("switchannotationeditorparams",{source:this,type:ft.HIGHLIGHT_COLOR,value:e}),this.update(e)},Pg=function(e){ls._keyboardManager.exec(this,e)},pa=function(e){if(r(this,Rt,sr)){this.hideDropdown();return}if(g(this,Od,e.detail===0),r(this,_r)||(g(this,_r,new AbortController),window.addEventListener("pointerdown",b(this,Rt,Zy).bind(this),{signal:r(this,mi).combinedSignal(r(this,_r))})),r(this,Ss).ariaExpanded="true",r(this,ge)){r(this,ge).classList.remove("hidden");return}const t=g(this,ge,b(this,Rt,Tg).call(this));r(this,Ss).append(t)},Zy=function(e){var t;(t=r(this,ge))!=null&&t.contains(e.target)||this.hideDropdown()},sr=function(){return r(this,ge)&&!r(this,ge).classList.contains("hidden")},y(ls,Rd,null);let wf=ls;var Es,lh,Eo,Fn,Dd;const ba=class ba{constructor(e){y(this,Es,null);y(this,lh,!1);y(this,Eo,null);y(this,Fn,null);g(this,Eo,e),g(this,Fn,e._uiManager),r(ba,Dd)||g(ba,Dd,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(r(this,Es))return r(this,Es);const{editorType:e,colorType:t,colorAndOpacityType:s,opacityType:i,color:n,opacity:a}=r(this,Eo),o=g(this,lh,Mt.isAlphaColorInputSupported&&i!==void 0),l=g(this,Es,document.createElement("input"));if(l.type="color",o){l.setAttribute("alpha","");const h=_.hexNums[Math.round((a??1)*255)];l.value=(n||"#000000")+h}else l.value=n||"#000000";return l.className="basicColorPicker",l.tabIndex=0,l.setAttribute("data-l10n-id",r(ba,Dd)[e]),l.addEventListener("input",()=>{if(o){const h=mu(l.value);if(!h)return;const[c,u,f,p]=h,m=_.makeHexColor(c,u,f);s!==void 0?r(this,Fn).updateParams(s,{color:m,opacity:p}):(r(this,Fn).updateParams(t,m),r(this,Fn).updateParams(i,p))}else r(this,Fn).updateParams(t,l.value)},{signal:r(this,Fn)._signal}),l}update(e){if(r(this,Es))if(r(this,lh)){const t=_.hexNums[Math.round(r(this,Eo).opacity*255)];r(this,Es).value=e+t}else r(this,Es).value=e}updateOpacity(e){if(!r(this,Es)||!r(this,lh))return;const t=_.hexNums[Math.round(e*255)];r(this,Es).value=r(this,Eo).color+t}destroy(){var e;(e=r(this,Es))==null||e.remove(),g(this,Es,null)}hideDropdown(){}};Es=new WeakMap,lh=new WeakMap,Eo=new WeakMap,Fn=new WeakMap,Dd=new WeakMap,y(ba,Dd,null);let Sf=ba;ot(531);function Sv(d){return Math.floor(_t(d,0,1)*255).toString(16).padStart(2,"0")}function Kh(d){return _t(d,0,1)*255}class Ev{static CMYK_G([e,t,s,i]){return["G",1-Math.min(1,.3*e+.59*s+.11*t+i)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=Kh(e),[e,e,e]}static G_HTML([e]){const t=Sv(e);return`#${t}${t}${t}`}static RGB_G([e,t,s]){return["G",.3*e+.59*t+.11*s]}static RGB_rgb(e){return e.map(Kh)}static RGB_HTML(e){return`#${e.map(Sv).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,s,i]){return["RGB",1-Math.min(1,e+i),1-Math.min(1,s+i),1-Math.min(1,t+i)]}static CMYK_rgb([e,t,s,i]){return[Kh(1-Math.min(1,e+i)),Kh(1-Math.min(1,s+i)),Kh(1-Math.min(1,t+i))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,s]){const i=1-e,n=1-t,a=1-s,o=Math.min(i,n,a);return["CMYK",i,n,a,o]}}class _0{create(e,t,s=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${e}px`),i.setAttribute("height",`${t}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${e} ${t}`),i}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){gt("Abstract method `_createSVG` called.")}}class Ef extends _0{_createSVG(e){return document.createElementNS(es,e)}}const $0=9,Qo=new WeakSet,j0=new Date().getTimezoneOffset()*60*1e3;class Sp{static create(e){switch(e.data.annotationType){case Yt.LINK:return new Pm(e);case Yt.TEXT:return new V0(e);case Yt.WIDGET:switch(e.data.fieldType){case"Tx":return new z0(e);case"Btn":return e.data.radioButton?new Y0(e):e.data.checkBox?new X0(e):new K0(e);case"Ch":return new J0(e);case"Sig":return new W0(e)}return new tl(e);case Yt.POPUP:return new Og(e);case Yt.FREETEXT:return new rb(e);case Yt.LINE:return new Z0(e);case Yt.SQUARE:return new q0(e);case Yt.CIRCLE:return new tw(e);case Yt.POLYLINE:return new ab(e);case Yt.CARET:return new sw(e);case Yt.INK:return new Im(e);case Yt.POLYGON:return new ew(e);case Yt.HIGHLIGHT:return new ob(e);case Yt.UNDERLINE:return new iw(e);case Yt.SQUIGGLY:return new nw(e);case Yt.STRIKEOUT:return new rw(e);case Yt.STAMP:return new lb(e);case Yt.FILEATTACHMENT:return new aw(e);case Yt.RICHMEDIA:case Yt.SCREEN:case Yt.SOUND:return new hb(e);default:return new Vt(e)}}}var xo,hh,Zs,kd,Ig;const Um=class Um{constructor(e,{isRenderable:t=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){y(this,kd);y(this,xo,null);y(this,hh,!1);y(this,Zs,null);this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableComment=e.enableComment,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,this.hasOwnCommentButton=!1,t&&(this.contentElement=this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:e,richText:t}){return!!(e!=null&&e.str||t!=null&&t.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Um._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var s;const{data:e}=this,t=(s=this.annotationStorage)==null?void 0:s.getEditor(e.id);return t?t.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){var o;const e=(o=this.annotationStorage)==null?void 0:o.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:t,inkLists:s,rect:i}=this.data;let n=-1/0,a=-1/0;if((t==null?void 0:t.length)>=8){for(let l=0;l<t.length;l+=8)t[l+1]>a?(a=t[l+1],n=t[l+2]):t[l+1]===a&&(n=Math.max(n,t[l+2]));return[n,a]}if((s==null?void 0:s.length)>=1){for(const l of s)for(let h=0,c=l.length;h<c;h+=2)l[h+1]>a?(a=l[h+1],n=l[h]):l[h+1]===a&&(n=Math.max(n,l[h]));if(n!==1/0)return[n,a]}return i?[i[2],i[3]]:null}_normalizePoint(e){const{page:{view:t},viewport:{rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:a}}}=this.parent;return e[1]=t[3]-e[1]+t[1],e[0]=100*(e[0]-n)/s,e[1]=100*(e[1]-a)/i,e}get commentText(){var t,s,i;const{data:e}=this;return((s=(t=this.annotationStorage.getRawValue(`${_h}${e.id}`))==null?void 0:t.popup)==null?void 0:s.contents)||((i=e.contentsObj)==null?void 0:i.str)||""}set commentText(e){const{data:t}=this,s={deleted:!e,contents:e||""};this.annotationStorage.updateEditor(t.id,{popup:s})||this.annotationStorage.setValue(`${_h}${t.id}`,{id:t.id,annotationType:t.annotationType,page:this.parent.page,popup:s,popupRef:t.popupRef,modificationDate:new Date}),e||this.removePopup()}removePopup(){var e,t;(t=((e=r(this,Zs))==null?void 0:e.popup)||this.popup)==null||t.remove(),g(this,Zs,this.popup=null)}updateEdited(e){var n;if(!this.container)return;e.rect&&(r(this,xo)||g(this,xo,{rect:this.data.rect.slice(0)}));const{rect:t,popup:s}=e;t&&b(this,kd,Ig).call(this,t);let i=((n=r(this,Zs))==null?void 0:n.popup)||this.popup;!i&&(s!=null&&s.text)&&(this._createPopup(s),i=r(this,Zs).popup),i&&(i.updateEdited(e),s!=null&&s.deleted&&(i.remove(),g(this,Zs,null),this.popup=null))}resetEdited(){var e;r(this,xo)&&(b(this,kd,Ig).call(this,r(this,xo).rect),(e=r(this,Zs))==null||e.popup.resetEdited(),g(this,xo,null))}_createContainer(e){const{data:t,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",t.id),!(this instanceof tl)&&!(this instanceof Pm)&&!(this instanceof hb)&&(n.tabIndex=0);const{style:a}=n;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,t.alternativeText&&(n.title=t.alternativeText),t.noRotate&&n.classList.add("norotate"),!t.rect||this instanceof Og){const{rotation:v}=t;return!t.hasOwnCanvas&&v!==0&&this.setRotation(v,n),n}const{width:o,height:l}=this;if(!e&&t.borderStyle.width>0){a.borderWidth=`${t.borderStyle.width}px`;const v=t.borderStyle.horizontalCornerRadius,A=t.borderStyle.verticalCornerRadius;if(v>0||A>0){const S=`calc(${v}px * var(--total-scale-factor)) / calc(${A}px * var(--total-scale-factor))`;a.borderRadius=S}switch(t.borderStyle.style){case nl.SOLID:a.borderStyle="solid";break;case nl.DASHED:a.borderStyle="dashed";break;case nl.BEVELED:st("Unimplemented border style: beveled");break;case nl.INSET:st("Unimplemented border style: inset");break;case nl.UNDERLINE:a.borderBottomStyle="solid";break}const w=t.borderColor||null;w?(g(this,hh,!0),a.borderColor=_.makeHexColor(...w)):a.borderWidth=0}const h=_.normalizeRect([t.rect[0],s.view[3]-t.rect[1]+s.view[1],t.rect[2],s.view[3]-t.rect[3]+s.view[1]]),{pageWidth:c,pageHeight:u,pageX:f,pageY:p}=i.rawDims;a.left=`${100*(h[0]-f)/c}%`,a.top=`${100*(h[1]-p)/u}%`;const{rotation:m}=t;return t.hasOwnCanvas||m===0?(a.width=`${100*o/c}%`,a.height=`${100*l/u}%`):this.setRotation(m,n),n}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims;let{width:n,height:a}=this;e%180!==0&&([n,a]=[a,n]),t.style.width=`${100*n/s}%`,t.style.height=`${100*a/i}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(t,s,i)=>{const n=i.detail[t],a=n[0],o=n.slice(1);i.target.style[s]=Ev[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:Ev[`${a}_rgb`](o)})};return Q(this,"_commonActions",{display:t=>{const{display:s}=t.detail,i=s%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:s===1||s===2})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{const{hidden:s}=t.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},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:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:t=>{const s=t.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(e,t){const s=this._commonActions;for(const i of Object.keys(t.detail)){const n=e[i]||s[i];n==null||n(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const s=this._commonActions;for(const[i,n]of Object.entries(t)){const a=s[i];if(a){const o={detail:{[i]:n},target:e};a(o),delete t[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,s,i,n]=this.data.rect.map(Math.fround);if(e.length===8){const[v,A,w,S]=e.subarray(2,6);if(i===v&&n===A&&t===w&&s===S)return}const{style:a}=this.container;let o;if(r(this,hh)){const{borderColor:v,borderWidth:A}=a;a.borderWidth=0,o=["url('data:image/svg+xml;utf8,",`<svg xmlns="${es}" preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${v}" stroke-width="${A}">`],this.container.classList.add("hasBorder")}const l=i-t,h=n-s,{svgFactory:c}=this,u=c.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0),u.role="none";const f=c.createElement("defs");u.append(f);const p=c.createElement("clipPath"),m=`clippath_${this.data.id}`;p.setAttribute("id",m),p.setAttribute("clipPathUnits","objectBoundingBox"),f.append(p);for(let v=2,A=e.length;v<A;v+=8){const w=e[v],S=e[v+1],x=e[v+2],C=e[v+3],E=c.createElement("rect"),T=(x-t)/l,P=(n-S)/h,M=(w-x)/l,I=(S-C)/h;E.setAttribute("x",T),E.setAttribute("y",P),E.setAttribute("width",M),E.setAttribute("height",I),p.append(E),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${T}" y="${P}" width="${M}" height="${I}"/>`)}r(this,hh)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${m})`}_createPopup(e=null){const{data:t}=this;let s,i;e?(s={str:e.text},i=e.date):(s=t.contentsObj,i=t.modificationDate),g(this,Zs,new Og({data:{color:t.color,titleObj:t.titleObj,modificationDate:i,contentsObj:s,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}))}get hasPopupElement(){return!!(r(this,Zs)||this.popup||this.data.popupRef)}get extraPopupElement(){return r(this,Zs)}render(){gt("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects.get(e)||[];for(const{page:n,id:a,exportValues:o}of i){if(n===-1||a===t)continue;const l=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${a}"]`);if(h&&!Qo.has(h)){st(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:l,domElement:h})}return s}for(const i of document.getElementsByName(e)){const{exportValue:n}=i,a=i.getAttribute("data-element-id");a!==t&&Qo.has(i)&&s.push({id:a,exportValue:n,domElement:i})}return s}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",()=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t,mustEnterInEditMode:!0})})}updateOC(e){if(!this.data.oc||!e)return;e.isVisible(this.data.oc)?this.show():this.hide()}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?"transparent":_.makeHexColor(...t)}};xo=new WeakMap,hh=new WeakMap,Zs=new WeakMap,kd=new WeakSet,Ig=function(e){const{container:{style:t},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}}}=this;s==null||s.splice(0,4,...e),t.left=`${100*(e[0]-o)/n}%`,t.top=`${100*(a-e[3]+l)/a}%`,i===0?(t.width=`${100*(e[2]-e[0])/n}%`,t.height=`${100*(e[3]-e[1])/a}%`):this.setRotation(i)};let Vt=Um;class G0 extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.editor=e.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:e}=this;e.hasComment&&this._createPopup(e.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(e){this.editor.comment=e,e||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}}var Ls,ga,qy,tb;class Pm extends Vt{constructor(t,s=null){super(t,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});y(this,Ls);this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(s.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action,t.overlaidText),n=!0):t.attachment?(b(this,Ls,qy).call(this,i,t.attachmentId,t.attachment,t.overlaidText,t.attachmentDest),n=!0):t.setOCGState?(b(this,Ls,tb).call(this,i,t.setOCGState,t.overlaidText),n=!0):t.dest?(this._bindLink(i,t.dest,t.overlaidText),n=!0):(t.actions&&(t.actions.has("Action")||t.actions.has("Mouse Up")||t.actions.has("Mouse Down"))&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&(this.contentElement=i,this.container.append(i)),this.container}_bindLink(t,s,i=""){t.href=this.linkService.getDestinationHash(s),t.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&b(this,Ls,ga).call(this),i&&(t.title=i)}_bindNamedAction(t,s,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(s),!1),i&&(t.title=i),b(this,Ls,ga).call(this)}_bindJSAction(t,{actions:s,id:i,overlaidText:n}){t.href=this.linkService.getAnchorUrl("");const a=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const o of s.keys()){const l=a.get(o);l&&(t[l]=()=>{var h;return(h=this.linkService.eventBus)==null||h.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:o}}),!1})}n&&(t.title=n),t.onclick||(t.onclick=()=>!1),b(this,Ls,ga).call(this)}_bindResetFormAction(t,s){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),b(this,Ls,ga).call(this),!this._fieldObjects){st('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{var u;i==null||i();const{fields:n,refs:a,include:o}=s,l=[];if(n.length!==0||a.length!==0){const f=new Set(a);for(const p of n){const m=this._fieldObjects.get(p)||[];for(const{id:v}of m)f.add(v)}for(const p of this._fieldObjects.values())for(const m of p)f.has(m.id)===o&&l.push(m)}else for(const f of this._fieldObjects.values())l.push(...f);const h=this.annotationStorage,c=[];for(const f of l){const{id:p}=f;switch(c.push(p),f.type){case"text":{const v=f.defaultValue||"";h.setValue(p,{value:v});break}case"checkbox":case"radiobutton":{const v=f.defaultValue===f.exportValues;h.setValue(p,{value:v});break}case"combobox":case"listbox":{const v=f.defaultValue||"";h.setValue(p,{value:v});break}default:continue}const m=document.querySelector(`[data-element-id="${p}"]`);if(m){if(!Qo.has(m)){st(`_bindResetFormAction - element not allowed: ${p}`);continue}}else continue;m.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}})),!1}}}Ls=new WeakSet,ga=function(){this.container.setAttribute("data-internal-link","")},qy=function(t,s,i,n="",a=null){t.href=this.linkService.getAnchorUrl(""),i.description?t.title=i.description:n&&(t.title=n);const o=async()=>{var h;const l=await this.linkService.getAttachmentContent(s);l&&((h=this.downloadManager)==null||h.openOrDownloadData(l,i.filename,a))};t.onclick=()=>(o(),!1),b(this,Ls,ga).call(this)},tb=function(t,s,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(s),!1),i&&(t.title=i),b(this,Ls,ga).call(this)};class V0 extends Vt{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(e),this.container}}class tl extends Vt{render(){return this.container}_getKeyModifier(e){return Mt.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,t,s,i,n){s.includes("mouse")?e.addEventListener(s,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):e.addEventListener(s,a=>{var o;if(s==="blur"){if(!t.focused||!a.relatedTarget)return;t.focused=!1}else if(s==="focus"){if(t.focused)return;t.focused=!0}n&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a)}}))})}_setEventListeners(e,t,s,i){const{actions:n}=this.data;for(const[a,o]of s)(o==="Action"||n!=null&&n.has(o))&&((o==="Focus"||o==="Blur")&&(t||(t={focused:!1})),this._setEventListener(e,t,a,o,i),o==="Focus"&&!(n!=null&&n.has("Blur"))?this._setEventListener(e,t,"blur","Blur",null):o==="Blur"&&!(n!=null&&n.has("Focus"))&&this._setEventListener(e,t,"focus","Focus",null))}_setTextStyle(e){const t=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||$0,n=e.style;let a;const o=2,l=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),c=Math.round(h/(1.35*i))||1,u=h/c;a=Math.min(i,l(u/1.35))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,l(h/1.35))}n.fontSize=`calc(${a}px * var(--total-scale-factor))`,n.color=_.makeHexColor(...s),this.data.textAlignment!==null&&!this.data.comb&&(n.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class z0 extends tl{constructor(e){const t=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,s,i){const n=this.annotationStorage;for(const a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=s),n.setValue(a.id,{[i]:s})}render(){var i,n;const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const a=e.getValue(t,{value:this.data.fieldValue});let o=a.value||"";const l=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let h=a.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
48
+ `))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const c={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=h??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type=this.data.password?"password":"text",s.setAttribute("value",h??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(this.container.classList.add("hasOwnCanvas"),e.has(t)&&this.container.classList.add("sandboxModified")),Qo.add(s),this.contentElement=s,s.setAttribute("data-element-id",t),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=0;const{datetimeFormat:u,datetimeType:f,timeStep:p}=this.data,m=!!f&&this.enableScripting;u&&(s.title=u),this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",A=>{e.setValue(t,{value:A.target.value}),this.setPropertyOnSiblings(s,"value",A.target.value,"value"),c.formattedValue=null}),s.addEventListener("resetform",A=>{const w=this.data.defaultFieldValue??"";s.value=c.userValue=w,c.formattedValue=null});let v=A=>{const{formattedValue:w}=c;w!=null&&(A.target.value=w),A.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",w=>{var x;if(c.focused)return;const{target:S}=w;if(m&&(S.type=f,p&&(S.step=p)),c.userValue){const C=c.userValue;if(m)if(f==="time"){const E=new Date(C),T=[E.getHours(),E.getMinutes(),E.getSeconds()];S.value=T.map(P=>P.toString().padStart(2,"0")).join(":")}else S.value=new Date(C-j0).toISOString().split(f==="date"?"T":".",1)[0];else S.value=C}c.lastCommittedValue=S.value,c.commitKey=1,(x=this.data.actions)!=null&&x.has("Focus")||(c.focused=!0)}),s.addEventListener("updatefromsandbox",w=>{this.container.classList.add("sandboxModified");const S={value(x){c.userValue=x.detail.value??"",m||e.setValue(t,{value:c.userValue.toString()}),x.target.value=c.userValue},formattedValue(x){const{formattedValue:C}=x.detail;c.formattedValue=C,C!=null&&x.target!==document.activeElement&&(x.target.value=C);const E={formattedValue:C};m&&(E.value=C),e.setValue(t,E)},selRange(x){x.target.setSelectionRange(...x.detail.selRange)},charLimit:x=>{var P;const{charLimit:C}=x.detail,{target:E}=x;if(C===0){E.removeAttribute("maxLength");return}E.setAttribute("maxLength",C);let T=c.userValue;!T||T.length<=C||(T=T.slice(0,C),E.value=c.userValue=T,e.setValue(t,{value:T}),(P=this.linkService.eventBus)==null||P.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:T,willCommit:!0,commitKey:1,selStart:E.selectionStart,selEnd:E.selectionEnd}}))}};this._dispatchEventFromSandbox(S,w)}),s.addEventListener("keydown",w=>{var C;c.commitKey=1;let S=-1;if(w.key==="Escape"?S=0:w.key==="Enter"&&!this.data.multiLine?S=2:w.key==="Tab"&&(c.commitKey=3),S===-1)return;const{value:x}=w.target;c.lastCommittedValue!==x&&(c.lastCommittedValue=x,c.userValue=x,(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:x,willCommit:!0,commitKey:S,selStart:w.target.selectionStart,selEnd:w.target.selectionEnd}}))});const A=v;v=null,s.addEventListener("blur",w=>{var C,E;if(!c.focused||!w.relatedTarget)return;(C=this.data.actions)!=null&&C.has("Blur")||(c.focused=!1);const{target:S}=w;let{value:x}=S;if(m){if(x&&f==="time"){const T=x.split(":").map(P=>parseInt(P,10));x=new Date(2e3,0,1,T[0],T[1],T[2]||0).valueOf(),S.step=""}else x.includes("T")||(x=`${x}T00:00`),x=new Date(x).valueOf();S.type="text"}c.userValue=x,c.lastCommittedValue!==x&&((E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:x,willCommit:!0,commitKey:c.commitKey,selStart:w.target.selectionStart,selEnd:w.target.selectionEnd}})),A(w)}),(n=this.data.actions)!=null&&n.has("Keystroke")&&s.addEventListener("beforeinput",w=>{var I;c.lastCommittedValue=null;const{data:S,target:x}=w,{value:C,selectionStart:E,selectionEnd:T}=x;let P=E,M=T;switch(w.inputType){case"deleteWordBackward":{const D=/\w/;for(;P>0&&!D.test(C[P-1]);)P--;for(;P>0&&D.test(C[P-1]);)P--;break}case"deleteWordForward":{const D=C.substring(E).match(/^\W*\w*/);D&&(M+=D[0].length);break}case"deleteContentBackward":E===T&&(P-=1);break;case"deleteContentForward":E===T&&(M+=1);break}w.preventDefault(),(I=this.linkService.eventBus)==null||I.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:C,change:S||"",willCommit:!1,selStart:P,selEnd:M}})}),this._setEventListeners(s,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],w=>w.target.value)}if(v&&s.addEventListener("blur",v),this.data.comb){const w=(this.data.rect[2]-this.data.rect[0])/l;s.classList.add("comb"),s.style.setProperty("--comb-width",`calc(${w}px * var(--total-scale-factor))`);const S=this.data.textAlignment;if(S===1||S===2){const x=()=>{const C=l-s.value.length;s.style.setProperty("--comb-offset",`${S===1?C>>1:C}`)};x();for(const C of["input","blur","resetform","updatefromsandbox"])s.addEventListener(C,x)}}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class W0 extends tl{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class X0 extends tl{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,s=t.id;let i=e.getValue(s,{value:t.exportValue===t.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",e.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return Qo.add(n),n.setAttribute("data-element-id",s),n.disabled=t.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=t.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",t.exportValue),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s)){const c=l&&h.exportValue===t.exportValue;h.domElement&&(h.domElement.checked=c),e.setValue(h.id,{value:c})}e.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=t.defaultFieldValue||"Off";a.target.checked=o===t.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(s,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Y0 extends tl{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,s=t.id;let i=e.getValue(s,{value:t.buttonValue!==null&&t.fieldValue===t.buttonValue}).value;if(typeof i=="string"&&(i=i!==t.buttonValue,e.setValue(s,{value:i})),i)for(const a of this._getElementsByName(t.fieldName,s))e.setValue(a.id,{value:!1});const n=document.createElement("input");if(Qo.add(n),n.setAttribute("data-element-id",s),n.disabled=t.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=t.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=0,n.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s))e.setValue(h.id,{value:!1});e.setValue(s,{value:l})}),n.addEventListener("resetform",a=>{const o=t.defaultFieldValue;a.target.checked=o!=null&&o===t.buttonValue}),this.enableScripting&&this.hasJSActions){const a=t.buttonValue;n.addEventListener("updatefromsandbox",o=>{const l={value:h=>{const c=a===h.detail.value;for(const u of this._getElementsByName(h.target.name)){const f=c&&u.id===s;u.domElement&&(u.domElement.checked=f),e.setValue(u.id,{value:f})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class K0 extends Pm{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),e}}class J0 extends tl{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,s=e.getValue(t,{value:this.data.fieldValue}),i=document.createElement("select");Qo.add(i),i.setAttribute("data-element-id",t),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=0;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",u=>{const f=this.data.defaultFieldValue;for(const p of i.options)p.selected=p.value===f});const a=(u,f)=>{const p=f.replaceAll(" "," ");u.textContent=p,p!==f&&u.setAttribute("display-value",f)};for(const u of this.data.options){const f=document.createElement("option");a(f,u.displayValue),f.value=u.exportValue,s.value.includes(u.exportValue)&&(f.setAttribute("selected",!0),n=!1),i.append(f)}let o=null;if(n){const u=document.createElement("option");u.value=" ",u.setAttribute("hidden",!0),u.setAttribute("selected",!0),i.prepend(u),o=()=>{u.remove(),i.removeEventListener("input",o),o=null},i.addEventListener("input",o)}const l=u=>{const f=u?"value":"textContent",{options:p,multiple:m}=i;return m?Array.prototype.filter.call(p,v=>v.selected).map(v=>v[f]):p.selectedIndex===-1?null:p[p.selectedIndex][f]};let h=l(!1);const c=u=>{const f=u.target.options;return Array.prototype.map.call(f,p=>({displayValue:p.getAttribute("display-value")||p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",u=>{const f={value(p){o==null||o();const m=p.detail.value,v=new Set(Array.isArray(m)?m:[m]);for(const A of i.options)A.selected=v.has(A.value);e.setValue(t,{value:l(!0)}),h=l(!1)},multipleSelection(p){i.multiple=!0},remove(p){const m=i.options,v=p.detail.remove;m[v].selected=!1,i.remove(v),m.length>0&&Array.prototype.findIndex.call(m,w=>w.selected)===-1&&(m[0].selected=!0),e.setValue(t,{value:l(!0),items:c(p)}),h=l(!1)},clear(p){for(;i.length!==0;)i.remove(0);e.setValue(t,{value:null,items:[]}),h=l(!1)},insert(p){const{index:m,displayValue:v,exportValue:A}=p.detail.insert,w=i.children[m],S=document.createElement("option");a(S,v),S.value=A,w?w.before(S):i.append(S),e.setValue(t,{value:l(!0),items:c(p)}),h=l(!1)},items(p){const{items:m}=p.detail;for(;i.length!==0;)i.remove(0);for(const v of m){const{displayValue:A,exportValue:w}=v,S=document.createElement("option");a(S,A),S.value=w,i.append(S)}i.options.length>0&&(i.options[0].selected=!0),e.setValue(t,{value:l(!0),items:c(p)}),h=l(!1)},indices(p){const m=new Set(p.detail.indices);for(const v of p.target.options)v.selected=m.has(v.index);e.setValue(t,{value:l(!0)}),h=l(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(f,u)}),i.addEventListener("input",u=>{var m;const f=l(!0),p=l(!1);e.setValue(t,{value:f}),u.preventDefault(),(m=this.linkService.eventBus)==null||m.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:h,change:p,changeEx:f,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],u=>u.target.value)):i.addEventListener("input",function(u){e.setValue(t,{value:l(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}var Fd,Mg;class Og extends Vt{constructor(t){const{data:s,elements:i,parent:n}=t,a=!!n._commentManager;super(t,{isRenderable:!a&&Vt._hasPopupData(s)});y(this,Fd);if(this.elements=i,a&&Vt._hasPopupData(s)){const o=this.popup=b(this,Fd,Mg).call(this);for(const l of i)l.popup=o}else this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";const s=this.popup=b(this,Fd,Mg).call(this),i=[];for(const n of this.elements)n.popup=s,n.container.ariaHasPopup="dialog",i.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(n=>`${hl}${n}`).join(",")),this.container}}Fd=new WeakSet,Mg=function(){return new Q0({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,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,commentManager:this.parent._commentManager})};var xs,$r,Gf,Vf,ch,dh,se,Xi,jr,To,uh,fh,Yi,Ts,Ln,Nn,ie,Bn,Gr,Ld,Un,ph,Co,Vr,Ee,zr,ht,Ku,Rg,Dg,kg,Ju,Fg,eb,sb,ib,nb,Qu,Zu,Lg;class Q0{constructor({container:e,color:t,elements:s,titleObj:i,modificationDate:n,contentsObj:a,richText:o,parent:l,rect:h,parentRect:c,open:u,commentManager:f=null}){y(this,ht);y(this,xs,null);y(this,$r,b(this,ht,ib).bind(this));y(this,Gf,b(this,ht,Lg).bind(this));y(this,Vf,b(this,ht,Zu).bind(this));y(this,ch,b(this,ht,Qu).bind(this));y(this,dh,null);y(this,se,null);y(this,Xi,null);y(this,jr,null);y(this,To,null);y(this,uh,null);y(this,fh,null);y(this,Yi,!1);y(this,Ts,null);y(this,Ln,null);y(this,Nn,null);y(this,ie,null);y(this,Bn,null);y(this,Gr,null);y(this,Ld,null);y(this,Un,null);y(this,ph,null);y(this,Co,null);y(this,Vr,!1);y(this,Ee,null);y(this,zr,null);g(this,se,e),g(this,ph,i),g(this,Xi,a),g(this,Un,o),g(this,uh,l),g(this,dh,t),g(this,Ld,h),g(this,fh,c),g(this,To,s),g(this,xs,f),g(this,Ee,s[0]),g(this,jr,yf.toDateObject(n)),this.trigger=s.flatMap(p=>p.getElementsToTriggerPopup()),f||(b(this,ht,Ku).call(this),r(this,se).hidden=!0,u&&b(this,ht,Qu).call(this))}renderCommentButton(){if(r(this,ie)){r(this,ie).parentNode||r(this,Ee).container.after(r(this,ie));return}if(r(this,Bn)||b(this,ht,Rg).call(this),!r(this,Bn))return;const{signal:e}=g(this,Ln,new AbortController),t=r(this,Ee).hasOwnCommentButton,s=()=>{r(this,xs).toggleCommentPopup(this,!0,void 0,!t)},i=()=>{r(this,xs).toggleCommentPopup(this,!1,!0,!t)},n=()=>{r(this,xs).toggleCommentPopup(this,!1,!1)};if(t){g(this,ie,r(this,Ee).container);for(const a of this.trigger)a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.addEventListener("keydown",r(this,$r),{signal:e}),a.addEventListener("click",s,{signal:e}),a.addEventListener("pointerenter",i,{signal:e}),a.addEventListener("pointerleave",n,{signal:e}),a.classList.add("popupTriggerArea")}else{const a=g(this,ie,document.createElement("button"));a.className="annotationCommentButton";const o=r(this,Ee).container;a.style.zIndex=parseInt(o.style.zIndex,10)+1,a.tabIndex=0,a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.setAttribute("data-l10n-id","pdfjs-show-comment-button"),b(this,ht,kg).call(this),b(this,ht,Dg).call(this),a.addEventListener("keydown",r(this,$r),{signal:e}),a.addEventListener("click",s,{signal:e}),a.addEventListener("pointerenter",i,{signal:e}),a.addEventListener("pointerleave",n,{signal:e}),o.after(a)}}get commentButtonColor(){const{color:e,opacity:t}=r(this,Ee).commentData;return e?r(this,uh)._commentManager.makeCommentColor(e,t):null}focusCommentButton(){setTimeout(()=>{var e;(e=r(this,ie))==null||e.focus()},0)}getData(){const{richText:e,color:t,opacity:s,creationDate:i,modificationDate:n}=r(this,Ee).commentData;return{contentsObj:{str:this.comment},richText:e,color:t,opacity:s,creationDate:i,modificationDate:n}}get elementBeforePopup(){return r(this,ie)}get comment(){return r(this,zr)||g(this,zr,r(this,Ee).commentText),r(this,zr)}set comment(e){e!==this.comment&&(r(this,Ee).commentText=g(this,zr,e))}focus(){var e;(e=r(this,Ee).container)==null||e.focus()}get parentBoundingClientRect(){return r(this,Ee).layer.getBoundingClientRect()}setCommentButtonStates({selected:e,hasPopup:t}){r(this,ie)&&(r(this,ie).classList.toggle("selected",e),r(this,ie).ariaExpanded=t)}setSelectedCommentButton(e){r(this,ie).classList.toggle("selected",e)}get commentPopupPosition(){if(r(this,Gr))return r(this,Gr);const{x:e,y:t,height:s}=r(this,ie).getBoundingClientRect(),{x:i,y:n,width:a,height:o}=r(this,Ee).layer.getBoundingClientRect();return[(e-i)/a,(t+s-n)/o]}set commentPopupPosition(e){g(this,Gr,e)}hasDefaultPopupPosition(){return r(this,Gr)===null}get commentButtonPosition(){return r(this,Bn)}get commentButtonWidth(){return r(this,ie).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(e){const[t,s]=r(this,Gr)||this.commentButtonPosition.map(h=>h/100),i=this.parentBoundingClientRect,{x:n,y:a,width:o,height:l}=i;r(this,xs).showDialog(null,this,n+t*o,a+s*l,{...e,parentDimensions:i})}render(){var s,i;if(r(this,Ts))return;const e=g(this,Ts,document.createElement("div"));if(e.className="popup",r(this,dh)){const n=e.style.outlineColor=_.makeHexColor(...r(this,dh));e.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`}const t=document.createElement("span");if(t.className="header",(s=r(this,ph))!=null&&s.str){const n=document.createElement("span");n.className="title",t.append(n),{dir:n.dir,str:n.textContent}=r(this,ph)}if(e.append(t),r(this,jr)){const n=document.createElement("time");n.className="popupDate",n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:r(this,jr).valueOf()})),n.dateTime=r(this,jr).toISOString(),t.append(n)}Mv({html:r(this,ht,Ju)||r(this,Xi).str,dir:(i=r(this,Xi))==null?void 0:i.dir,className:"popupContent"},e),r(this,se).append(e)}updateEdited({rect:e,popup:t,deleted:s}){var i;if(r(this,xs)){s?(this.remove(),g(this,zr,null)):t&&(t.deleted?this.remove():(b(this,ht,kg).call(this),g(this,zr,t.text))),e&&(g(this,Bn,null),b(this,ht,Rg).call(this),b(this,ht,Dg).call(this));return}if(s||t!=null&&t.deleted){this.remove();return}b(this,ht,Ku).call(this),r(this,Co)||g(this,Co,{contentsObj:r(this,Xi),richText:r(this,Un)}),e&&g(this,Nn,null),t&&t.text&&(g(this,Un,b(this,ht,sb).call(this,t.text)),g(this,jr,yf.toDateObject(t.date)),g(this,Xi,null)),(i=r(this,Ts))==null||i.remove(),g(this,Ts,null)}resetEdited(){var e;r(this,Co)&&({contentsObj:Xt(this,Xi)._,richText:Xt(this,Un)._}=r(this,Co),g(this,Co,null),(e=r(this,Ts))==null||e.remove(),g(this,Ts,null),g(this,Nn,null))}remove(){var e,t,s;if((e=r(this,Ln))==null||e.abort(),g(this,Ln,null),(t=r(this,Ts))==null||t.remove(),g(this,Ts,null),g(this,Vr,!1),g(this,Yi,!1),(s=r(this,ie))==null||s.remove(),g(this,ie,null),this.trigger)for(const i of this.trigger)i.classList.remove("popupTriggerArea")}forceHide(){g(this,Vr,this.isVisible),r(this,Vr)&&(r(this,se).hidden=!0)}maybeShow(){r(this,xs)||(b(this,ht,Ku).call(this),r(this,Vr)&&(r(this,Ts)||b(this,ht,Zu).call(this),g(this,Vr,!1),r(this,se).hidden=!1))}get isVisible(){return!r(this,xs)&&r(this,se).hidden===!1}}xs=new WeakMap,$r=new WeakMap,Gf=new WeakMap,Vf=new WeakMap,ch=new WeakMap,dh=new WeakMap,se=new WeakMap,Xi=new WeakMap,jr=new WeakMap,To=new WeakMap,uh=new WeakMap,fh=new WeakMap,Yi=new WeakMap,Ts=new WeakMap,Ln=new WeakMap,Nn=new WeakMap,ie=new WeakMap,Bn=new WeakMap,Gr=new WeakMap,Ld=new WeakMap,Un=new WeakMap,ph=new WeakMap,Co=new WeakMap,Vr=new WeakMap,Ee=new WeakMap,zr=new WeakMap,ht=new WeakSet,Ku=function(){var t;if(r(this,Ln))return;g(this,Ln,new AbortController);const{signal:e}=r(this,Ln);for(const s of this.trigger)s.addEventListener("click",r(this,ch),{signal:e}),s.addEventListener("pointerenter",r(this,Vf),{signal:e}),s.addEventListener("pointerleave",r(this,Gf),{signal:e}),s.classList.add("popupTriggerArea");for(const s of r(this,To))(t=s.container)==null||t.addEventListener("keydown",r(this,$r),{signal:e})},Rg=function(){const e=r(this,To).find(t=>t.hasCommentButton);e&&g(this,Bn,e._normalizePoint(e.commentButtonPosition))},Dg=function(){if(r(this,Ee).extraPopupElement&&!r(this,Ee).editor)return;r(this,ie)||this.renderCommentButton();const[e,t]=r(this,Bn),{style:s}=r(this,ie);s.left=`calc(${e}%)`,s.top=`calc(${t}% - var(--comment-button-dim))`},kg=function(){r(this,Ee).extraPopupElement||(r(this,ie)||this.renderCommentButton(),r(this,ie).style.backgroundColor=this.commentButtonColor||"")},Ju=function(){const e=r(this,Un),t=r(this,Xi);return e!=null&&e.str&&(!(t!=null&&t.str)||t.str===e.str)&&r(this,Un).html||null},Fg=function(){var e,t,s;return((s=(t=(e=r(this,ht,Ju))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:s.fontSize)||0},eb=function(){var e,t,s;return((s=(t=(e=r(this,ht,Ju))==null?void 0:e.attributes)==null?void 0:t.style)==null?void 0:s.color)||null},sb=function(e){const t=[],s={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},i={style:{color:r(this,ht,eb),fontSize:r(this,ht,Fg)?`calc(${r(this,ht,Fg)}px * var(--total-scale-factor))`:""}};for(const n of e.split(`
49
+ `))t.push({name:"span",value:n,attributes:i});return s},ib=function(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key==="Enter"||e.key==="Escape"&&r(this,Yi))&&b(this,ht,Qu).call(this)},nb=function(){if(r(this,Nn)!==null)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:s,pageX:i,pageY:n}}}=r(this,uh);let a=!!r(this,fh),o=a?r(this,fh):r(this,Ld);for(const m of r(this,To))if(!o||_.intersect(m.data.rect,o)!==null){o=m.data.rect,a=!0;break}const l=_.normalizeRect([o[0],e[3]-o[1]+e[1],o[2],e[3]-o[3]+e[1]]),c=a?o[2]-o[0]+5:0,u=l[0]+c,f=l[1];g(this,Nn,[100*(u-i)/t,100*(f-n)/s]);const{style:p}=r(this,se);p.left=`${r(this,Nn)[0]}%`,p.top=`${r(this,Nn)[1]}%`},Qu=function(){if(r(this,xs)){r(this,xs).toggleCommentPopup(this,!1);return}g(this,Yi,!r(this,Yi)),r(this,Yi)?(b(this,ht,Zu).call(this),r(this,se).addEventListener("click",r(this,ch)),r(this,se).addEventListener("keydown",r(this,$r))):(b(this,ht,Lg).call(this),r(this,se).removeEventListener("click",r(this,ch)),r(this,se).removeEventListener("keydown",r(this,$r)))},Zu=function(){r(this,Ts)||this.render(),this.isVisible?r(this,Yi)&&r(this,se).classList.add("focused"):(b(this,ht,nb).call(this),r(this,se).hidden=!1,r(this,se).style.zIndex=parseInt(r(this,se).style.zIndex,10)+1e3)},Lg=function(){r(this,se).classList.remove("focused"),!(r(this,Yi)||!this.isVisible)&&(r(this,se).hidden=!0,r(this,se).style.zIndex=parseInt(r(this,se).style.zIndex,10)-1e3)};class rb extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=nt.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const e=this.contentElement=document.createElement("div");e.classList.add("annotationTextContent"),e.setAttribute("role","comment");for(const t of this.textContent){const s=document.createElement("span");s.textContent=t,e.append(s)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}var Nd;class Z0 extends Vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});y(this,Nd,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=g(this,Nd,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),n.append(a),this.container.append(n),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,Nd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Nd=new WeakMap;var Bd;class q0 extends Vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});y(this,Bd,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=t.borderStyle.width,o=g(this,Bd,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",s-a),o.setAttribute("height",i-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,Bd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Bd=new WeakMap;var Ud;class tw extends Vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});y(this,Ud,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:s,height:i}=this,n=this.svgFactory.create(s,i,!0),a=t.borderStyle.width,o=g(this,Ud,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",s/2),o.setAttribute("cy",i/2),o.setAttribute("rx",s/2-a/2),o.setAttribute("ry",i/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),n.append(o),this.container.append(n),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,Ud)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ud=new WeakMap;var Hd;class ab extends Vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});y(this,Hd,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:s,borderStyle:i,popupRef:n},width:a,height:o}=this;if(!s)return this.container;const l=this.svgFactory.create(a,o,!0);let h=[];for(let u=0,f=s.length;u<f;u+=2){const p=s[u]-t[0],m=t[3]-s[u+1];h.push(`${p},${m}`)}h=h.join(" ");const c=g(this,Hd,this.svgFactory.createElement(this.svgElementName));return c.setAttribute("points",h),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),l.append(c),this.container.append(l),!n&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return r(this,Hd)}addHighlightArea(){this.container.classList.add("highlightArea")}}Hd=new WeakMap;class ew extends ab{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class sw extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}}var _d,Po,$d,Ng;class Im extends Vt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0});y(this,$d);y(this,_d,null);y(this,Po,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?nt.HIGHLIGHT:nt.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,rotation:s,inkLists:i,borderStyle:n,popupRef:a}}=this,{transform:o,width:l,height:h}=b(this,$d,Ng).call(this,s,t),c=this.svgFactory.create(l,h,!0),u=g(this,_d,this.svgFactory.createElement("svg:g"));c.append(u),u.setAttribute("stroke-width",n.width||1),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit",10),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),u.setAttribute("transform",o);for(const f of i){const p=this.svgFactory.createElement(this.svgElementName);r(this,Po).push(p),p.setAttribute("points",f.join(",")),u.append(p)}return!a&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const{thickness:s,points:i,rect:n}=t,a=r(this,_d);if(s>=0&&a.setAttribute("stroke-width",s||1),i)for(let o=0,l=r(this,Po).length;o<l;o++)r(this,Po)[o].setAttribute("points",i[o].join(","));if(n){const{transform:o,width:l,height:h}=b(this,$d,Ng).call(this,this.data.rotation,n);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${h}`),a.setAttribute("transform",o)}}getElementsToTriggerPopup(){return r(this,Po)}addHighlightArea(){this.container.classList.add("highlightArea")}}_d=new WeakMap,Po=new WeakMap,$d=new WeakSet,Ng=function(t,s){switch(t){case 90:return{transform:`rotate(90) translate(${-s[0]},${s[1]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};case 180:return{transform:`rotate(180) translate(${-s[2]},${s[1]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]};case 270:return{transform:`rotate(270) translate(${-s[2]},${s[3]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};default:return{transform:`translate(${-s[0]},${s[3]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]}}};class ob extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=nt.HIGHLIGHT}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),e){const s=document.createElement("mark");s.classList.add("overlaidText"),s.textContent=e,this.container.append(s)}return this.container}}class iw extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),e){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=e,this.container.append(s)}return this.container}}class nw extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),e){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=e,this.container.append(s)}return this.container}}class rw extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:e,popupRef:t}}=this;if(!t&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),e){const s=document.createElement("s");s.classList.add("overlaidText"),s.textContent=e,this.container.append(s)}return this.container}}class lb extends Vt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=nt.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}var jd,Gd,Bg;class aw extends Vt{constructor(t){var n;super(t,{isRenderable:!0});y(this,Gd);y(this,jd,null);const{fileId:s,file:i}=this.data;this.filename=i.filename,this.content=i.content,this.fileId=s,(n=this.linkService.eventBus)==null||n.dispatch("fileattachmentannotation",{source:this,attachmentId:this.fileId,...i})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:s}=this;let i;s.hasAppearance||s.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(s.name)?"paperclip":"pushpin"}.svg`,s.fillAlpha&&s.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(s.fillAlpha*100)}%);`)),i.addEventListener("dblclick",b(this,Gd,Bg).bind(this)),g(this,jd,i);const{isMac:n}=Mt.platform;return t.addEventListener("keydown",a=>{a.key==="Enter"&&(n?a.metaKey:a.ctrlKey)&&b(this,Gd,Bg).call(this)}),!s.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return r(this,jd)}addHighlightArea(){this.container.classList.add("highlightArea")}}jd=new WeakMap,Gd=new WeakSet,Bg=async function(){var a;const{fileId:t,filename:s,content:i}=this,n=await this.linkService.getAttachmentContent(t)||i;n&&((a=this.downloadManager)==null||a.openOrDownloadData(n,s))};var gh,Io,Hn,Zo,cb,Ug;class hb extends Vt{constructor(t){super(t,{isRenderable:!!t.data.richMedia});y(this,Zo);y(this,gh,new AbortController);y(this,Io,null);y(this,Hn,null)}render(){this.container.classList.add("mediaAnnotation");const{filename:t}=this.data.richMedia,s=document.createElement("button");return s.className="mediaPlayButton",s.type="button",s.title=s.ariaLabel=t,s.addEventListener("click",()=>b(this,Zo,cb).call(this,s),{signal:r(this,gh).signal}),this.container.append(s),this.container}destroy(){r(this,gh).abort(),r(this,Hn)&&(r(this,Hn).pause(),r(this,Hn).removeAttribute("src"),r(this,Hn).load(),g(this,Hn,null)),b(this,Zo,Ug).call(this)}}gh=new WeakMap,Io=new WeakMap,Hn=new WeakMap,Zo=new WeakSet,cb=async function(t){const{fileId:s,filename:i,contentType:n}=this.data.richMedia;t.disabled=!0;let a;try{a=await this.linkService.getAttachmentContent(s)}catch{return}finally{t.disabled=!1}if(!a||!t.isConnected)return;const{signal:o}=r(this,gh),l=URL.createObjectURL(new Blob([a],{type:n}));g(this,Io,l);const h=n.startsWith("audio/"),c=document.createElement(h?"audio":"video");if(g(this,Hn,c),c.className="mediaContent",this._setBackgroundColor(c),c.src=l,c.title=i,c.controls=!0,c.autoplay=!0,c.tabIndex=0,h){let u=!1,f=!1;const p=()=>{c.controls=u||f};this.container.addEventListener("pointerenter",()=>{u=!0,p()},{signal:o}),this.container.addEventListener("pointerleave",()=>{u=!1,p()},{signal:o}),this.container.addEventListener("focusin",()=>{f=!0,p()},{signal:o}),this.container.addEventListener("focusout",()=>{f=!1,p()},{signal:o})}c.addEventListener("emptied",()=>b(this,Zo,Ug).call(this,l),{once:!0,signal:o}),t.replaceWith(c),c.play().catch(()=>{})},Ug=function(t=r(this,Io)){t&&t===r(this,Io)&&(URL.revokeObjectURL(t),g(this,Io,null))};var Wr,Oo,mh,_n,vh,Mo,Ve,Vd,rn,qu,tf;const Hm=class Hm{constructor({div:e,accessibilityManager:t,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:a,structTreeLayer:o,commentManager:l,linkService:h,annotationStorage:c}){y(this,rn);y(this,Wr,null);y(this,Oo,null);y(this,mh,null);y(this,_n,new Map);y(this,vh,null);y(this,Mo,null);y(this,Ve,[]);y(this,Vd,!1);O(this,"zIndex",0);this.div=e,g(this,Wr,t),g(this,Oo,s),g(this,vh,o||null),g(this,Mo,h||null),g(this,mh,c||new Tm),this.page=n,this.viewport=a,this._annotationEditorUIManager=i,this._commentManager=l||null}hasEditableAnnotations(){return r(this,_n).size>0}async render(e){var l;const{annotations:t,optionalContentConfig:s}=e,i=this.div;Yo(i,this.viewport);const n=new Map,a=[],o={data:null,layer:i,linkService:r(this,Mo),downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:e.renderForms!==!1,svgFactory:new Ef,annotationStorage:r(this,mh),enableComment:e.enableComment===!0,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const h of t){if(h.noHTML)continue;const c=h.annotationType===Yt.POPUP;if(c){const p=n.get(h.id);if(!p)continue;if(!this._commentManager){a.push(h);continue}o.elements=p}else if(h.rect[2]===h.rect[0]||h.rect[3]===h.rect[1])continue;o.data=h;const u=Sp.create(o);if(!u.isRenderable)continue;c||(r(this,Ve).push(u),h.popupRef&&n.getOrInsertComputed(h.popupRef,Gh).push(u));const f=u.render();h.hidden&&(f.style.visibility="hidden"),u.updateOC(s),u._isEditable&&(r(this,_n).set(u.data.id,u),(l=this._annotationEditorUIManager)==null||l.renderAnnotationElement(u))}await b(this,rn,qu).call(this);for(const h of a){const c=o.elements=n.get(h.id);o.data=h;const u=Sp.create(o);if(!u.isRenderable)continue;const f=u.render();u.contentElement.id=`${hl}${h.id}`,h.hidden&&(f.style.visibility="hidden"),c.at(-1).container.after(f)}b(this,rn,tf).call(this)}async addLinkAnnotations(e){const t={data:null,layer:this.div,linkService:r(this,Mo),svgFactory:new Ef,parent:this};for(const s of e){s.borderStyle||(s.borderStyle=Hm._defaultBorderStyle),t.data=s;const i=Sp.create(t);i.isRenderable&&(i.render(),i.contentElement.id=`${hl}${s.id}`,r(this,Ve).push(i))}await b(this,rn,qu).call(this)}update({viewport:e,optionalContentConfig:t}){const s=this.div;this.viewport=e,Yo(s,{rotation:e.rotation});for(const i of r(this,Ve))i.updateOC(t);b(this,rn,tf).call(this),s.hidden=!1}destroy(){var e,t;for(const s of r(this,Ve))(e=s.destroy)==null||e.call(s),(t=r(this,Wr))==null||t.removePointerInTextLayer(s.contentElement);r(this,Ve).length=0,r(this,_n).clear(),this.div.replaceChildren()}refreshCanvases(){b(this,rn,tf).call(this)}getEditableAnnotations(){return r(this,_n).values()}getEditableAnnotation(e){return r(this,_n).get(e)}addFakeAnnotation(e){const{div:t}=this,{id:s,rotation:i}=e,n=new G0({data:{id:s,rect:e.getPDFRect(),rotation:i},editor:e,layer:t,parent:this,enableComment:!!this._commentManager,linkService:r(this,Mo),annotationStorage:r(this,mh)});return n.render(),n.contentElement.id=`${hl}${s}`,n.createOrUpdatePopup(),r(this,Ve).push(n),n}removeAnnotation(e){var i;const t=r(this,Ve).findIndex(n=>n.data.id===e);if(t<0)return;const[s]=r(this,Ve).splice(t,1);(i=r(this,Wr))==null||i.removePointerInTextLayer(s.contentElement)}updateFakeAnnotations(e){if(e.length!==0){for(const t of e)t.updateFakeAnnotationElement(this);b(this,rn,qu).call(this)}}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}static get _defaultBorderStyle(){return Q(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:nl.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};Wr=new WeakMap,Oo=new WeakMap,mh=new WeakMap,_n=new WeakMap,vh=new WeakMap,Mo=new WeakMap,Ve=new WeakMap,Vd=new WeakMap,rn=new WeakSet,qu=async function(){var s,i,n,a;if(r(this,Ve).length===0)return;this.div.replaceChildren();const e=[];if(!r(this,Vd)){g(this,Vd,!0);for(const{contentElement:o,data:{hidden:l,id:h,oc:c}}of r(this,Ve)){const u=o.id=`${hl}${h}`,f=o.localName==="a"&&!l&&!c;e.push((s=r(this,vh))==null?void 0:s.getAriaAttributes(u,{enableLinkOwnership:f}).then(p=>{if(p)for(const[m,v]of p)o.setAttribute(m,v)}))}}r(this,Ve).sort(({data:{rect:[o,l,h,c]}},{data:{rect:[u,f,p,m]}})=>{if(o===h&&l===c)return 1;if(u===p&&f===m)return-1;const v=c,A=l,w=(l+c)/2,S=m,x=f,C=(f+m)/2;if(w>=S&&C<=A)return-1;if(C>=v&&w<=x)return 1;const E=(o+h)/2,T=(u+p)/2;return E-T});const t=document.createDocumentFragment();for(const o of r(this,Ve))t.append(o.container),this._commentManager?(n=((i=o.extraPopupElement)==null?void 0:i.popup)||o.popup)==null||n.renderCommentButton():o.extraPopupElement&&t.append(o.extraPopupElement.render());if(this.div.append(t),await Promise.all(e),r(this,Wr)){const o=await((a=r(this,vh))==null?void 0:a.getAnnotationIds());for(const{contentElement:l}of r(this,Ve))o!=null&&o.has(l.id)||r(this,Wr).addPointerInTextLayer(l,!1)}},tf=function(){var t;if(!r(this,Oo))return;const e=this.div;for(const[s,i]of r(this,Oo)){const n=e.querySelector(`[data-annotation-id="${s}"]`);if(!n)continue;if(Array.isArray(i))for(const c of i)c.className="annotationContent",c.ariaHidden=!0;else i.className="annotationContent",i.ariaHidden=!0;const a=[];for(const c of n.children)c.nodeName==="CANVAS"&&a.push(c);for(const c of a)c.remove();const o=Array.isArray(i)?i[0]:i,{firstChild:l}=n;if(l?l.classList.contains("annotationContent")?l.after(o):l.before(o):n.append(o),Array.isArray(i)){let c=o;for(let u=1,f=i.length;u<f;u++)c.after(i[u]),c=i[u]}r(this,Oo).delete(s);const h=r(this,_n).get(s);h&&(h._hasNoCanvas?((t=this._annotationEditorUIManager)==null||t.setMissingCanvas(s,n.id,i),h._hasNoCanvas=!1):h.canvas=i)}};let Hg=Hm;const Tu=/\r\n?|\n/g;var Cs,zd,Ro,Ps,ue,db,ub,fb,ef,Zn,sf,nf,pb,$g,gb;const Ut=class Ut extends Dt{constructor(t){super({...t,name:"freeTextEditor"});y(this,ue);y(this,Cs,"");y(this,zd,`${this.id}-editor`);y(this,Ro,null);y(this,Ps);O(this,"_colorPicker",null);this.color=t.color||Ut._defaultColor||Dt._defaultLineColor,g(this,Ps,t.fontSize||Ut._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert(Dt._l10nAlert.freetext),this.canAddComment=!1}static get _keyboardManager(){const t=Ut.prototype,s=a=>a.isEmpty(),i=Jo.TRANSLATE_SMALL,n=Jo.TRANSLATE_BIG;return Q(this,"_keyboardManager",new Ko([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter"],t.commitOrRemove],[["Escape"],t.commitOrRemove],[["ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:s}],[["ArrowRight"],t._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[n,0],checker:s}],[["ArrowUp"],t._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:s}],[["ArrowDown"],t._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,n],checker:s}]]))}static initialize(t,s){Dt.initialize(t,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,s){switch(t){case ft.FREETEXT_SIZE:Ut._defaultFontSize=s;break;case ft.FREETEXT_COLOR:Ut._defaultColor=s;break}}updateParams(t,s){switch(t){case ft.FREETEXT_SIZE:b(this,ue,db).call(this,s);break;case ft.FREETEXT_COLOR:b(this,ue,ub).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[ft.FREETEXT_SIZE,Ut._defaultFontSize],[ft.FREETEXT_COLOR,Ut._defaultColor||Dt._defaultLineColor]]}get propertiesToUpdate(){return[[ft.FREETEXT_SIZE,r(this,Ps)],[ft.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Sf(this)),[["colorPicker",this._colorPicker]]}get colorType(){return ft.FREETEXT_COLOR}onUpdatedColor(){var t;this.editorDiv.style.color=this.color,(t=this._colorPicker)==null||t.update(this.color),super.onUpdatedColor()}_translateEmpty(t,s){this._uiManager.translateSelectedEditors(t,s,!0)}getInitialTranslation(){const t=this.parentScale;return[-Ut._internalPadding*t,-(Ut._internalPadding+r(this,Ps))*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),g(this,Ro,new AbortController);const t=this._uiManager.combinedSignal(r(this,Ro));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",r(this,zd)),this._isDraggable=!0,(t=r(this,Ro))==null||t.abort(),g(this,Ro,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var s;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),(s=this._initialOptions)!=null&&s.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=r(this,Cs),s=g(this,Cs,b(this,ue,fb).call(this).trimEnd());if(t===s)return;const i=n=>{if(g(this,Cs,n),!n){this.remove();return}b(this,ue,nf).call(this),this._uiManager.rebuild(this),b(this,ue,ef).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(t)},mustExec:!1}),b(this,ue,ef).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){Ut._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)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let t,s;(this._isCopy||this.annotationElementId)&&(t=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",r(this,zd)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${r(this,Ps)}px * var(--total-scale-factor))`,i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[n,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,h]=this.getInitialTranslation();[l,h]=this.pageTranslationToScreen(l,h);const[c,u]=this.pageDimensions,[f,p]=this.pageTranslation;let m,v;switch(this.rotation){case 0:m=t+(o[0]-f)/c,v=s+this.height-(o[1]-p)/u;break;case 90:m=t+(o[0]-f)/c,v=s-(o[1]-p)/u,[l,h]=[h,-l];break;case 180:m=t-this.width+(o[0]-f)/c,v=s-(o[1]-p)/u,[l,h]=[-l,-h];break;case 270:m=t+(o[0]-f-this.height*u)/c,v=s+(o[1]-p-this.width*c)/u,[l,h]=[-h,l];break}this.setAt(m*n,v*a,l,h)}else this._moveAfterPaste(t,s);b(this,ue,nf).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){var m,v,A;const s=t.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;t.preventDefault();const n=b(m=Ut,Zn,$g).call(m,s.getData("text")||"").replaceAll(Tu,`
50
+ `);if(!n)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!n.includes(`
51
+ `)){o.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:h}=o,c=[],u=[];if(l.nodeType===Node.TEXT_NODE){const w=l.parentElement;if(u.push(l.nodeValue.slice(h).replaceAll(Tu,"")),w!==this.editorDiv){let S=c;for(const x of this.editorDiv.childNodes){if(x===w){S=u;continue}S.push(b(v=Ut,Zn,sf).call(v,x))}}c.push(l.nodeValue.slice(0,h).replaceAll(Tu,""))}else if(l===this.editorDiv){let w=c,S=0;for(const x of this.editorDiv.childNodes)S++===h&&(w=u),w.push(b(A=Ut,Zn,sf).call(A,x))}g(this,Cs,`${c.join(`
52
+ `)}${n}${u.join(`
53
+ `)}`),b(this,ue,nf).call(this);const f=new Range;let p=Math.sumPrecise(c.map(w=>w.length));for(const{firstChild:w}of this.editorDiv.childNodes)if(w.nodeType===Node.TEXT_NODE){const S=w.nodeValue.length;if(p<=S){f.setStart(w,p),f.setEnd(w,p);break}p-=S}a.removeAllRanges(),a.addRange(f)}get contentDiv(){return this.editorDiv}getPDFRect(){const t=Ut._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,s,i){var o;let n=null;if(t instanceof rb){const{data:{defaultAppearanceData:{fontSize:l,fontColor:h},rect:c,rotation:u,id:f,popupRef:p,richText:m,contentsObj:v,creationDate:A,modificationDate:w},textContent:S,textPosition:x,parent:{page:{pageNumber:C}}}=t;if(!(S!=null&&S.length))return null;n=t={annotationType:nt.FREETEXT,color:Array.from(h),fontSize:l,value:S.join(`
54
+ `),position:x,pageIndex:C-1,rect:c.slice(0),rotation:u,annotationElementId:f,id:f,deleted:!1,popupRef:p,comment:(v==null?void 0:v.str)||null,richText:m,creationDate:A,modificationDate:w}}const a=await super.deserialize(t,s,i);return g(a,Ps,t.fontSize),a.color=_.makeHexColor(...t.color),g(a,Cs,b(o=Ut,Zn,$g).call(o,t.value)),a._initialData=n,t.comment&&a.setCommentData(t),a}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=Dt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(t),{color:s,fontSize:r(this,Ps),value:b(this,ue,pb).call(this)});return this.addComment(i),t?(i.isCopy=!0,i):this.annotationElementId&&!b(this,ue,gb).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(t){const s=super.renderAnnotationElement(t);if(!s)return null;const{style:i}=s;i.fontSize=`calc(${r(this,Ps)}px * var(--total-scale-factor))`,i.color=this.color,s.replaceChildren();for(const n of r(this,Cs).split(`
55
+ `)){const a=document.createElement("div");a.append(n?document.createTextNode(n):document.createElement("br")),s.append(a)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:r(this,Cs)}}),s}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};Cs=new WeakMap,zd=new WeakMap,Ro=new WeakMap,Ps=new WeakMap,ue=new WeakSet,db=function(t){const s=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--total-scale-factor))`,this.translate(0,-(n-r(this,Ps))*this.parentScale),g(this,Ps,n),b(this,ue,ef).call(this)},i=r(this,Ps);this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ft.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},ub=function(t){const s=n=>{this.color=n,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ft.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},fb=function(){var i;const t=[];this.editorDiv.normalize();let s=null;for(const n of this.editorDiv.childNodes)(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&n.nodeName==="BR"||(t.push(b(i=Ut,Zn,sf).call(i,n)),s=n);return t.join(`
56
+ `)},ef=function(){const[t,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",n.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/s):(this.width=i.height/t,this.height=i.width/s),this.fixAndSetPosition()},Zn=new WeakSet,sf=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(Tu,"")},nf=function(){if(this.editorDiv.replaceChildren(),!!r(this,Cs))for(const t of r(this,Cs).split(`
57
+ `)){const s=document.createElement("div");s.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(s)}},pb=function(){return r(this,Cs).replaceAll(" "," ")},$g=function(t){return t.replaceAll(" "," ")},gb=function(t){const{value:s,fontSize:i,color:n,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==s||t.fontSize!==i||t.color.some((o,l)=>o!==n[l])||t.pageIndex!==a},y(Ut,Zn),O(Ut,"_freeTextDefaultContent",""),O(Ut,"_internalPadding",0),O(Ut,"_defaultColor",null),O(Ut,"_defaultFontSize",10),O(Ut,"_type","freetext"),O(Ut,"_editorType",nt.FREETEXT);let _g=Ut;var Do;class Om{constructor(){y(this,Do,Object.create(null))}updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,s]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,s)}updateSVGProperty(e,t){r(this,Do)[e]=t}toSVGProperties(){const e=r(this,Do);return g(this,Do,Object.create(null)),{root:e}}reset(){g(this,Do,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){gt("Not implemented")}}Do=new WeakMap;var yh,bh,he,ko,Fo,Ah,tt,jg,Gg,Vg,zg,uc,Wg,Xg,Yg,fc,mb,rf,pc,ll;const at=class at extends Dt{constructor(t){super(t);y(this,tt);y(this,yh,null);y(this,bh);O(this,"_clipPathId",null);O(this,"_colorPicker",null);O(this,"_drawId",null);O(this,"_drawOutlines",null);O(this,"_focusDrawId",null);g(this,bh,t.mustBeCommitted||!1),this._addOutlines(t)}onUpdatedColor(){var t;(t=this._colorPicker)==null||t.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){var t,s;(s=(t=this._colorPicker)==null?void 0:t.updateOpacity)==null||s.call(t,this.opacity)}_addOutlines(t){t.drawOutlines&&(b(this,tt,jg).call(this,t),b(this,tt,fc).call(this))}static _mergeSVGProperties(t,s){const i=new Set(Object.keys(t));for(const[n,a]of Object.entries(s))i.has(n)?Object.assign(t[n],a):t[n]=a;return t}static getDefaultDrawingOptions(t){gt("Not implemented")}static get typesMap(){gt("Not implemented")}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}static updateDefaultParams(t,s){const i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,s),this._currentParent&&(r(at,he).updateProperty(i,s),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,s){const i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,s)}static get defaultPropertiesToUpdate(){const t=[],s=this._defaultDrawingOptions;for(const[i,n]of this.typesMap)t.push([i,s[n]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:s}=this;for(const[i,n]of this.constructor.typesMap)t.push([i,s[n]]);return t}_updateProperty(t,s,i){const n=this._drawingOptions,a=n[s],o=l=>{var c;n.updateProperty(s,l);const h=this._drawOutlines.updateProperty(s,l);h&&b(this,tt,pc).call(this,h),(c=this.parent)==null||c.drawLayer.updateProperties(this._drawId,n.toSVGProperties()),t===this.colorType?this.onUpdatedColor():t===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:o.bind(this,i),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(t,s,i=this.colorAndOpacityType){const n=this.constructor.typesMap.get(this.colorType),a=this._opacityName,o=this._drawingOptions,l=o[n],h=o[a],c=(u,f)=>{var p;o.updateProperty(n,u),o.updateProperty(a,f),this._drawOutlines.updateProperty(n,u),this._drawOutlines.updateProperty(a,f),(p=this.parent)==null||p.drawLayer.updateProperties(this._drawId,o.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:c.bind(this,t,s),undo:c.bind(this,l,h),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:i,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,at._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(b(this,tt,rf).call(this)),{bbox:b(this,tt,ll).call(this)}))}_onResized(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,at._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(b(this,tt,rf).call(this)),{bbox:b(this,tt,ll).call(this)})),b(this,tt,zg).call(this)}_onTranslating(t,s){var i;(i=this.parent)==null||i.drawLayer.updateProperties(this._drawId,{bbox:b(this,tt,ll).call(this)})}_onTranslated(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,at._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(b(this,tt,rf).call(this),this.parentDimensions),{bbox:b(this,tt,ll).call(this)}))}_onStartDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){super.commit(),this._mustBeDisabledOnCommit&&(this.disableEditMode(),this.disableEditing())}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,r(this,bh)&&(g(this,bh,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){this._uiManager.removeShouldRescale(this),b(this,tt,Yg).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,tt,fc).call(this),b(this,tt,pc).call(this,this._drawOutlines.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var i;let s=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),b(this,tt,Yg).call(this)):t&&(this._uiManager.addShouldRescale(this),b(this,tt,fc).call(this,t),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(t),b(this,tt,Wg).call(this),s&&this.select()}rotate(t=this.parentRotation){if(!this.parent||this._drawId===null)return;const s=(t-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,at._mergeSVGProperties({bbox:b(this,tt,ll).call(this,t)},this._drawOutlines.updateRotation(s))),b(this,tt,zg).call(this,s)}show(t=this._isVisible){super.show(t),b(this,tt,Wg).call(this)}select(){super.select(),b(this,tt,uc).call(this,{hovered:!1,selected:!0})}unselect(){super.unselect(),b(this,tt,uc).call(this,{selected:!1})}pointerover(){this.isSelected||b(this,tt,uc).call(this,{hovered:!0})}pointerleave(){this.isSelected||b(this,tt,uc).call(this,{hovered:!1})}onScaleChanging(){if(!this.parent)return;const t=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);t&&b(this,tt,pc).call(this,t)}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,s;this._isCopy&&(t=this.x,s=this.y);const i=super.render();this.constructor._hasDrawClass&&i.classList.add("draw");const n=g(this,yh,document.createElement("div"));return i.append(n),n.setAttribute("aria-hidden","true"),n.className="internal",this._clipPathId&&(n.style.clipPath=this._clipPathId),Bv(this,n,["pointerover","pointerleave"]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,s),i}static createDrawerInstance(t){gt("Not implemented")}static _getDrawingTarget(t,{target:s}){return s}static _getPointerCoords({offsetX:t,offsetY:s,clientX:i,clientY:n},a=null){if(!a)return[t,s];let o=i-a.clientX,l=n-a.clientY;switch(this._currentParent.viewport.rotation){case 90:[o,l]=[l,-o];break;case 180:[o,l]=[-o,-l];break;case 270:[o,l]=[-l,o];break}return[a.offsetX+o,a.offsetY+l]}static _addDrawingListeners(t,s){}static _endDrawingSession(t=!1){return this._currentParent.endDrawingSession(t)}static startDrawing(t,s,i,n){var C;const{pointerId:a,pointerType:o}=n;if(_e.isInitializedAndDifferentPointerType(o))return;const l=this._getDrawingTarget(t,n),[h,c]=this._getPointerCoords(n),{viewport:{rotation:u}}=t,{x:f,y:p,width:m,height:v}=l.getBoundingClientRect(),A=g(at,ko,new AbortController),w=t.combinedSignal(A);if(_e.setPointer(o,a),window.addEventListener("pointerup",E=>{_e.isSamePointerIdOrRemove(E.pointerId)&&this._endDraw(E)},{signal:w}),window.addEventListener("pointercancel",E=>{_e.isSamePointerIdOrRemove(E.pointerId)&&this._endDrawingSession()},{signal:w}),window.addEventListener("pointerdown",E=>{_e.isSamePointerType(E.pointerType)&&(_e.initializeAndAddPointerId(E.pointerId),r(at,he).isCancellable()&&(r(at,he).removeLastElement(),r(at,he).isEmpty()?this._endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:w}),window.addEventListener("contextmenu",Ei,{signal:w}),l.addEventListener("pointermove",this._drawMove.bind(this),{signal:w}),l.addEventListener("touchmove",E=>{_e.isSameTimeStamp(E.timeStamp)&&me(E)},{signal:w}),this._addDrawingListeners(l,w),t.toggleDrawing(),(C=s._editorUndoBar)==null||C.hide(),r(at,he)){t.drawLayer.updateProperties(this._currentDrawId,r(at,he).startNew(h,c,m,v,u));return}s.updateUIForDefaultProperties(this),g(at,he,this.createDrawerInstance({x:h,y:c,box:[f,p,m,v],rotation:u,parent:t,isLTR:i})),g(at,Fo,this.getDefaultDrawingOptions()),this._currentParent=t;const{id:S,clipPathId:x}=t.drawLayer.draw(this._mergeSVGProperties(r(at,Fo).toSVGProperties(),r(at,he).defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=S,g(at,Ah,this._hasClipPath?x:null)}static _drawMove(t){var n;if(_e.isSameTimeStamp(t.timeStamp),!r(at,he)||!_e.isSamePointerId(t.pointerId))return;if(_e.isUsingMultiplePointers()){this._endDraw(t);return}let s;const i=(n=t.getCoalescedEvents)==null?void 0:n.call(t);if(i!=null&&i.length){const a=[];for(const o of i)a.push(...this._getPointerCoords(o,t));s=r(at,he).addPoints(a)}else s=r(at,he).add(...this._getPointerCoords(t));this._currentParent.drawLayer.updateProperties(this._currentDrawId,s),_e.setTimeStamp(t.timeStamp),me(t)}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,g(at,he,null),g(at,Fo,null),g(at,Ah,null),_e.clearTimeStamp()),r(at,ko)&&(r(at,ko).abort(),g(at,ko,null),_e.clearPointerIds())}static _endDraw(t){const s=this._currentParent;if(s){if(s.toggleDrawing(!0),this._cleanup(!1),s.drawLayer.updateProperties(this._currentDrawId,(t==null?void 0:t.target)===s.div?r(at,he).end(...this._getPointerCoords(t)):r(at,he).end()),this.supportMultipleDrawings){const i=r(at,he),n=this._currentDrawId,a=i.getLastElement();s.addCommands({cmd:()=>{s.drawLayer.updateProperties(n,i.setLastElement(a))},undo:()=>{s.drawLayer.updateProperties(n,i.removeLastElement())},mustExec:!1,type:ft.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){const s=this._currentParent;if(!s)return null;if(s.toggleDrawing(!0),s.cleanUndoStack(ft.DRAW_STEP),!r(at,he).isEmpty()){const{pageDimensions:[i,n],scale:a}=s,o=s.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:r(at,Ah),drawOutlines:r(at,he).getOutlines(i*a,n*a,a,this._INNER_MARGIN),drawingOptions:r(at,Fo),mustBeCommitted:!t});return this._cleanup(!0),o}return s.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,s,i,n,a,o,l){gt("Not implemented")}static async deserialize(t,s,i){var u,f;const{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:l}}=s.viewport,h=this.deserializeDraw(o,l,n,a,this._INNER_MARGIN,t,i),c=await super.deserialize(t,s,i);return c.createDrawingOptions(t),b(u=c,tt,jg).call(u,{drawOutlines:h}),b(f=c,tt,fc).call(f),c.onScaleChanging(),c.rotate(),c}serializeDraw(t){const[s,i]=this.pageTranslation,[n,a]=this.pageDimensions;return this._drawOutlines.serialize([s,i,n,a],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};yh=new WeakMap,bh=new WeakMap,he=new WeakMap,ko=new WeakMap,Fo=new WeakMap,Ah=new WeakMap,tt=new WeakSet,jg=function({drawOutlines:t,drawId:s,drawingOptions:i,clipPathId:n}){this._drawOutlines=t,this._drawingOptions||(this._drawingOptions=i),this.annotationElementId||this._uiManager.a11yAlert(Dt._l10nAlert[this.editorType]),s>=0?(this._drawId=s,this._clipPathId=n??null,this.parent.drawLayer.finalizeDraw(s,t.defaultProperties),b(this,tt,Vg).call(this,this.parent)):this._drawId=b(this,tt,Gg).call(this,t,this.parent),b(this,tt,pc).call(this,t.box)},Gg=function(t,s){const{id:i,clipPathId:n}=s.drawLayer.draw(at._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,this.constructor._hasClipPath);return this.constructor._hasClipPath&&(this._clipPathId=n),b(this,tt,Vg).call(this,s),i},Vg=function(t){const s=this._drawOutlines.getFocusSVGProperties(r(this,tt,Xg));s&&(this._focusDrawId=t.drawLayer.drawOutline(s,this._drawOutlines.focusMustRemoveSelfIntersections))},zg=function(t=r(this,tt,Xg)){var s;this._focusDrawId!==null&&((s=this.parent)==null||s.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(t)))},uc=function(t){var s;this._focusDrawId!==null&&((s=this.parent)==null||s.drawLayer.updateProperties(this._focusDrawId,{rootClass:t}))},Wg=function(){const{parent:t,_drawId:s,_focusDrawId:i,_isVisible:n}=this;if(!t||s===null)return;const a={hidden:!n};t.drawLayer.updateProperties(s,{rootClass:a}),i!==null&&t.drawLayer.updateProperties(i,{rootClass:a})},Xg=function(){return(this.parentRotation-this._drawRotation+360)%360},Yg=function(){if(this._drawId===null||!this.parent)return;const{drawLayer:t}=this.parent;t.remove(this._drawId),this._drawId=null,this._focusDrawId!==null&&(t.remove(this._focusDrawId),this._focusDrawId=null),this._drawingOptions.reset()},fc=function(t=this.parent){if(!(this._drawId!==null&&this.parent===t)){if(this._drawId!==null){const{drawLayer:s}=this.parent;s.updateParent(this._drawId,t.drawLayer),this._focusDrawId!==null&&s.updateParent(this._focusDrawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=b(this,tt,Gg).call(this,this._drawOutlines,t),this._clipPathId&&r(this,yh)&&(r(this,yh).style.clipPath=this._clipPathId)}},mb=function([t,s,i,n]){const{parentDimensions:[a,o],_drawRotation:l}=this;switch(l){case 90:return[s,1-t,i*(o/a),n*(a/o)];case 180:return[1-t,1-s,i,n];case 270:return[1-s,t,i*(o/a),n*(a/o)];default:return[t,s,i,n]}},rf=function(){const{x:t,y:s,width:i,height:n,parentDimensions:[a,o],_drawRotation:l}=this;switch(l){case 90:return[1-s,t,i*(a/o),n*(o/a)];case 180:return[1-t,1-s,i,n];case 270:return[s,1-t,i*(a/o),n*(o/a)];default:return[t,s,i,n]}},pc=function(t){[this.x,this.y,this.width,this.height]=b(this,tt,mb).call(this,t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},ll=function(t=this.parentRotation){const{x:s,y:i,width:n,height:a,_drawRotation:o,parentDimensions:[l,h]}=this;switch((o*4+t)/90){case 1:return[1-i-a,s,a,n];case 2:return[1-s-n,1-i-a,n,a];case 3:return[i,1-s-n,a,n];case 4:return[s,i-n*(l/h),a*(h/l),n*(l/h)];case 5:return[1-i,s,n*(l/h),a*(h/l)];case 6:return[1-s-a*(h/l),1-i,a*(h/l),n*(l/h)];case 7:return[i-n*(l/h),1-s-a*(h/l),n*(l/h),a*(h/l)];case 8:return[s-n,i-a,n,a];case 9:return[1-i,s-n,a,n];case 10:return[1-s,1-i,n,a];case 11:return[i-a,1-s,a,n];case 12:return[s-a*(h/l),i,a*(h/l),n*(l/h)];case 13:return[1-i-n*(l/h),s-a*(h/l),n*(l/h),a*(h/l)];case 14:return[1-s,1-i-n*(l/h),a*(h/l),n*(l/h)];case 15:return[i,1-s,n*(l/h),a*(h/l)];default:return[s,i,n,a]}},O(at,"_currentDrawId",-1),O(at,"_currentParent",null),y(at,he,null),y(at,ko,null),y(at,Fo,null),y(at,Ah,null),O(at,"_INNER_MARGIN",3);let Pc=at;class V{constructor(){O(this,"focusOutline",null)}toSVGPath(){gt("Abstract method `toSVGPath` must be implemented.")}get box(){gt("Abstract getter `box` must be implemented.")}serialize(e,t){gt("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){gt("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(e){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(e,t){return null}updateParentDimensions(e,t){return null}serializeQuadPoints(e,t){return null}updateRotation(e){return{}}getPathResizingSVGProperties(e){return{}}getPathResizedSVGProperties(e){return{}}getPathTranslatedSVGProperties(e,t){return{}}static _rotateBox([e,t,s,i],n){switch(n){case 90:return[1-t-i,e,i,s];case 180:return[1-e-s,1-t-i,s,i];case 270:return[t,1-e-s,i,s]}return[e,t,s,i]}static _rescale(e,t,s,i,n,a){a||(a=new Float32Array(e.length));for(let o=0,l=e.length;o<l;o+=2)a[o]=t+e[o]*i,a[o+1]=s+e[o+1]*n;return a}static _rescaleAndSwap(e,t,s,i,n,a){a||(a=new Float32Array(e.length));for(let o=0,l=e.length;o<l;o+=2)a[o]=t+e[o+1]*i,a[o+1]=s+e[o]*n;return a}static _translate(e,t,s,i){i||(i=new Float32Array(e.length));for(let n=0,a=e.length;n<a;n+=2)i[n]=t+e[n],i[n+1]=s+e[n+1];return i}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,s,i,n){switch(n){case 90:return[1-t/s,e/i];case 180:return[1-e/s,1-t/i];case 270:return[t/s,1-e/i];default:return[e/s,t/i]}}static createBezierPoints(e,t,s,i,n,a){return[(e+5*s)/6,(t+5*i)/6,(5*s+n)/6,(5*i+a)/6,(s+n)/2,(i+a)/2]}}O(V,"PRECISION",1e-4);var Is,qs,wh,Sh,vi,ct,Lo,No,Wd,Xd,Eh,xh,Ki,Yd,zf,Wf,ve,gc,vb,yb,bb,Ab,wb,Sb;const un=class un{constructor(e,t,s,i,n,a,o=0){y(this,ve);y(this,Is);y(this,qs,[]);y(this,wh);y(this,Sh);y(this,vi,[]);y(this,ct,new Float32Array(18));y(this,Lo);y(this,No);y(this,Wd);y(this,Xd);y(this,Eh);y(this,xh);y(this,Ki,[]);g(this,Is,s),g(this,xh,n*i),g(this,Sh,a),r(this,ct).set([NaN,NaN,NaN,NaN,e,t],6),g(this,wh,o),g(this,Xd,r(un,Yd)*i),g(this,Wd,r(un,Wf)*i),g(this,Eh,i),r(this,Ki).push(e,t)}isEmpty(){return isNaN(r(this,ct)[8])}isCancellable(){return r(this,Ki).length<=10}removeLastElement(){return r(this,ct).fill(NaN),r(this,vi).length=r(this,qs).length=r(this,Ki).length=0,{path:{d:""}}}add(e,t){var I;g(this,Lo,e),g(this,No,t);const[s,i,n,a]=r(this,Is);let[o,l,h,c]=r(this,ct).subarray(8,12);const u=e-h,f=t-c,p=Math.hypot(u,f);if(p<r(this,Wd))return!1;const m=p-r(this,Xd),v=m/p,A=v*u,w=v*f;let S=o,x=l;o=h,l=c,h+=A,c+=w,(I=r(this,Ki))==null||I.push(e,t);const C=-w/m,E=A/m,T=C*r(this,xh),P=E*r(this,xh);return r(this,ct).set(r(this,ct).subarray(2,8),0),r(this,ct).set([h+T,c+P],4),r(this,ct).set(r(this,ct).subarray(14,18),12),r(this,ct).set([h-T,c-P],16),isNaN(r(this,ct)[6])?(r(this,vi).length===0&&(r(this,ct).set([o+T,l+P],2),r(this,vi).push(NaN,NaN,NaN,NaN,(o+T-s)/n,(l+P-i)/a),r(this,ct).set([o-T,l-P],14),r(this,qs).push(NaN,NaN,NaN,NaN,(o-T-s)/n,(l-P-i)/a)),r(this,ct).set([S,x,o,l,h,c],6),!this.isEmpty()):(r(this,ct).set([S,x,o,l,h,c],6),Math.abs(Math.atan2(x-l,S-o)-Math.atan2(w,A))<Math.PI/2?([o,l,h,c]=r(this,ct).subarray(2,6),r(this,vi).push(NaN,NaN,NaN,NaN,((o+h)/2-s)/n,((l+c)/2-i)/a),[o,l,S,x]=r(this,ct).subarray(14,18),r(this,qs).push(NaN,NaN,NaN,NaN,((S+o)/2-s)/n,((x+l)/2-i)/a),!0):([S,x,o,l,h,c]=r(this,ct).subarray(0,6),r(this,vi).push(((S+5*o)/6-s)/n,((x+5*l)/6-i)/a,((5*o+h)/6-s)/n,((5*l+c)/6-i)/a,((o+h)/2-s)/n,((l+c)/2-i)/a),[h,c,o,l,S,x]=r(this,ct).subarray(12,18),r(this,qs).push(((S+5*o)/6-s)/n,((x+5*l)/6-i)/a,((5*o+h)/6-s)/n,((5*l+c)/6-i)/a,((o+h)/2-s)/n,((l+c)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const e=r(this,vi),t=r(this,qs);if(isNaN(r(this,ct)[6])&&!this.isEmpty())return b(this,ve,vb).call(this);const s=[];s.push(`M${e[4]} ${e[5]}`);for(let i=6;i<e.length;i+=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);b(this,ve,bb).call(this,s);for(let i=t.length-6;i>=6;i-=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);return b(this,ve,yb).call(this,s),s.join(" ")}newFreeDrawOutline(e,t,s,i,n,a){return new Eb(e,t,s,i,n,a)}getOutlines(){var u;const e=r(this,vi),t=r(this,qs),s=r(this,ct),[i,n,a,o]=r(this,Is),l=new Float32Array((((u=r(this,Ki))==null?void 0:u.length)??0)+2);for(let f=0,p=l.length-2;f<p;f+=2)l[f]=(r(this,Ki)[f]-i)/a,l[f+1]=(r(this,Ki)[f+1]-n)/o;if(l[l.length-2]=(r(this,Lo)-i)/a,l[l.length-1]=(r(this,No)-n)/o,isNaN(s[6])&&!this.isEmpty())return b(this,ve,Ab).call(this,l);const h=new Float32Array(r(this,vi).length+24+r(this,qs).length);let c=e.length;for(let f=0;f<c;f+=2){if(isNaN(e[f])){h[f]=h[f+1]=NaN;continue}h[f]=e[f],h[f+1]=e[f+1]}c=b(this,ve,Sb).call(this,h,c);for(let f=t.length-6;f>=6;f-=6)for(let p=0;p<6;p+=2){if(isNaN(t[f+p])){h[c]=h[c+1]=NaN,c+=2;continue}h[c]=t[f+p],h[c+1]=t[f+p+1],c+=2}return b(this,ve,wb).call(this,h,c),this.newFreeDrawOutline(h,l,r(this,Is),r(this,Eh),r(this,wh),r(this,Sh))}};Is=new WeakMap,qs=new WeakMap,wh=new WeakMap,Sh=new WeakMap,vi=new WeakMap,ct=new WeakMap,Lo=new WeakMap,No=new WeakMap,Wd=new WeakMap,Xd=new WeakMap,Eh=new WeakMap,xh=new WeakMap,Ki=new WeakMap,Yd=new WeakMap,zf=new WeakMap,Wf=new WeakMap,ve=new WeakSet,gc=function(){const e=r(this,ct).subarray(4,6),t=r(this,ct).subarray(16,18),[s,i,n,a]=r(this,Is);return[(r(this,Lo)+(e[0]-t[0])/2-s)/n,(r(this,No)+(e[1]-t[1])/2-i)/a,(r(this,Lo)+(t[0]-e[0])/2-s)/n,(r(this,No)+(t[1]-e[1])/2-i)/a]},vb=function(){const[e,t,s,i]=r(this,Is),[n,a,o,l]=b(this,ve,gc).call(this);return`M${(r(this,ct)[2]-e)/s} ${(r(this,ct)[3]-t)/i} L${(r(this,ct)[4]-e)/s} ${(r(this,ct)[5]-t)/i} L${n} ${a} L${o} ${l} L${(r(this,ct)[16]-e)/s} ${(r(this,ct)[17]-t)/i} L${(r(this,ct)[14]-e)/s} ${(r(this,ct)[15]-t)/i} Z`},yb=function(e){const t=r(this,qs);e.push(`L${t[4]} ${t[5]} Z`)},bb=function(e){const[t,s,i,n]=r(this,Is),a=r(this,ct).subarray(4,6),o=r(this,ct).subarray(16,18),[l,h,c,u]=b(this,ve,gc).call(this);e.push(`L${(a[0]-t)/i} ${(a[1]-s)/n} L${l} ${h} L${c} ${u} L${(o[0]-t)/i} ${(o[1]-s)/n}`)},Ab=function(e){const t=r(this,ct),[s,i,n,a]=r(this,Is),[o,l,h,c]=b(this,ve,gc).call(this),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(t[2]-s)/n,(t[3]-i)/a,NaN,NaN,NaN,NaN,(t[4]-s)/n,(t[5]-i)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,(t[16]-s)/n,(t[17]-i)/a,NaN,NaN,NaN,NaN,(t[14]-s)/n,(t[15]-i)/a],0),this.newFreeDrawOutline(u,e,r(this,Is),r(this,Eh),r(this,wh),r(this,Sh))},wb=function(e,t){const s=r(this,qs);return e.set([NaN,NaN,NaN,NaN,s[4],s[5]],t),t+=6},Sb=function(e,t){const s=r(this,ct).subarray(4,6),i=r(this,ct).subarray(16,18),[n,a,o,l]=r(this,Is),[h,c,u,f]=b(this,ve,gc).call(this);return e.set([NaN,NaN,NaN,NaN,(s[0]-n)/o,(s[1]-a)/l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,u,f,NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-a)/l],t),t+=24},y(un,Yd,8),y(un,zf,2),y(un,Wf,r(un,Yd)+r(un,zf));let xf=un;var Th,Ji,$n,Kd,yi,Jd,Zt,Xf,xb;class Eb extends V{constructor(t,s,i,n,a,o){super();y(this,Xf);y(this,Th);y(this,Ji,new Float32Array(4));y(this,$n);y(this,Kd);y(this,yi);y(this,Jd);y(this,Zt);g(this,Zt,t),g(this,yi,s),g(this,Th,i),g(this,Jd,n),g(this,$n,a),g(this,Kd,o),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],b(this,Xf,xb).call(this,o);const[l,h,c,u]=r(this,Ji);for(let f=0,p=t.length;f<p;f+=2)t[f]=(t[f]-l)/c,t[f+1]=(t[f+1]-h)/u;for(let f=0,p=s.length;f<p;f+=2)s[f]=(s[f]-l)/c,s[f+1]=(s[f+1]-h)/u}toSVGPath(){const t=[`M${r(this,Zt)[4]} ${r(this,Zt)[5]}`];for(let s=6,i=r(this,Zt).length;s<i;s+=6){if(isNaN(r(this,Zt)[s])){t.push(`L${r(this,Zt)[s+4]} ${r(this,Zt)[s+5]}`);continue}t.push(`C${r(this,Zt)[s]} ${r(this,Zt)[s+1]} ${r(this,Zt)[s+2]} ${r(this,Zt)[s+3]} ${r(this,Zt)[s+4]} ${r(this,Zt)[s+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,s,i,n],a){const o=i-t,l=n-s;let h,c;switch(a){case 0:h=V._rescale(r(this,Zt),t,n,o,-l),c=V._rescale(r(this,yi),t,n,o,-l);break;case 90:h=V._rescaleAndSwap(r(this,Zt),t,s,o,l),c=V._rescaleAndSwap(r(this,yi),t,s,o,l);break;case 180:h=V._rescale(r(this,Zt),i,s,-o,l),c=V._rescale(r(this,yi),i,s,-o,l);break;case 270:h=V._rescaleAndSwap(r(this,Zt),i,n,-o,-l),c=V._rescaleAndSwap(r(this,yi),i,n,-o,-l);break}return{outline:Array.from(h),points:[Array.from(c)]}}get box(){return r(this,Ji)}newOutliner(t,s,i,n,a,o,l=0){return new xf(t,s,i,n,a,o,l)}updateThickness(t){const s=this.getNewOutline(t);return g(this,Zt,r(s,Zt)),g(this,yi,r(s,yi)),r(this,Ji).set(r(s,Ji)),this.firstPoint=s.firstPoint,this.lastPoint=s.lastPoint,r(this,Ji)}getNewOutline(t,s){const[i,n,a,o]=r(this,Ji),[l,h,c,u]=r(this,Th),f=a*c,p=o*u,m=i*c+l,v=n*u+h,A=r(this,yi),w=this.newOutliner(A[0]*f+m,A[1]*p+v,r(this,Th),r(this,Jd),t,r(this,Kd),s??r(this,$n));for(let S=2,x=A.length;S<x;S+=2)w.add(A[S]*f+m,A[S+1]*p+v);return w.getOutlines()}}Th=new WeakMap,Ji=new WeakMap,$n=new WeakMap,Kd=new WeakMap,yi=new WeakMap,Jd=new WeakMap,Zt=new WeakMap,Xf=new WeakSet,xb=function(t){const s=r(this,Zt);let i=s[4],n=s[5];const a=[i,n,i,n];let o=i,l=n,h=i,c=n;const u=t?Math.max:Math.min,f=new Float32Array(4);for(let m=6,v=s.length;m<v;m+=6){const A=s[m+4],w=s[m+5];isNaN(s[m])?(_.pointBoundingBox(A,w,a),l>w?(o=A,l=w):l===w&&(o=u(o,A)),c<w?(h=A,c=w):c===w&&(h=u(h,A))):(f.set(Jn,0),_.bezierBoundingBox(i,n,...s.slice(m,m+6),f),_.rectBoundingBox(...f,a),l>f[1]?(o=f[0],l=f[1]):l===f[1]&&(o=u(o,f[0])),c<f[3]?(h=f[2],c=f[3]):c===f[3]&&(h=u(h,f[2]))),i=A,n=w}const p=r(this,Ji);p[0]=a[0]-r(this,$n),p[1]=a[1]-r(this,$n),p[2]=a[2]-a[0]+2*r(this,$n),p[3]=a[3]-a[1]+2*r(this,$n),this.firstPoint=[o,l],this.lastPoint=[h,c]};function Tb(d){return{bbox:d.box,root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:d.isFree},path:{d:d.toSVGPath()}}}function Cb(d,e){const{focusOutline:t}=d;return{bbox:V._rotateBox(t.box,e),root:{"data-main-rotation":e},rootClass:{highlightOutline:!0,free:d.isFree},path:{d:t.toSVGPath()}}}var Qd,Zd,qd,Xr,bi,ns,Pb,af,Ib,Ob,Jg;class Kg{constructor(e,t=0,s=0,i=!0){y(this,ns);y(this,Qd);y(this,Zd);y(this,qd);y(this,Xr,[]);y(this,bi,[]);const n=Jn.slice(),a=10**-4;for(const{x:v,y:A,width:w,height:S}of e){const x=Math.floor((v-t)/a)*a,C=Math.ceil((v+w+t)/a)*a,E=Math.floor((A-t)/a)*a,T=Math.ceil((A+S+t)/a)*a,P=[x,E,T,!0],M=[C,E,T,!1];r(this,Xr).push(P,M),_.rectBoundingBox(x,E,C,T,n)}const o=n[2]-n[0]+2*s,l=n[3]-n[1]+2*s,h=n[0]-s,c=n[1]-s;let u=i?-1/0:1/0,f=1/0;const p=r(this,Xr).at(i?-1:-2),m=[p[0],p[2]];for(const v of r(this,Xr)){const[A,w,S,x]=v;!x&&i?w<f?(f=w,u=A):w===f&&(u=Math.max(u,A)):x&&!i&&(w<f?(f=w,u=A):w===f&&(u=Math.min(u,A))),v[0]=(A-h)/o,v[1]=(w-c)/l,v[2]=(S-c)/l}g(this,Qd,new Float32Array([h,c,o,l])),g(this,Zd,[u,f]),g(this,qd,m)}getOutlines(){r(this,Xr).sort((t,s)=>t[0]-s[0]||t[1]-s[1]||t[2]-s[2]);const e=[];for(const t of r(this,Xr))t[3]?(e.push(...b(this,ns,Jg).call(this,t)),b(this,ns,Ib).call(this,t)):(b(this,ns,Ob).call(this,t),e.push(...b(this,ns,Jg).call(this,t)));return b(this,ns,Pb).call(this,e)}}Qd=new WeakMap,Zd=new WeakMap,qd=new WeakMap,Xr=new WeakMap,bi=new WeakMap,ns=new WeakSet,Pb=function(e){const t=[],s=new Set;for(const a of e){const[o,l,h]=a;t.push([o,l,a],[o,h,a])}t.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=t.length;a<o;a+=2){const l=t[a][2],h=t[a+1][2];l.push(h),h.push(l),s.add(l),s.add(h)}const i=[];let n;for(;s.size>0;){const a=s.values().next().value;let[o,l,h,c,u]=a;s.delete(a);let f=o,p=l;for(n=[o,h],i.push(n);;){let m;if(s.has(c))m=c;else if(s.has(u))m=u;else break;s.delete(m),[o,l,h,c,u]=m,f!==o&&(n.push(f,p,o,p===l?l:h),f=o),p=p===l?h:l}n.push(f,p)}return new Qg(i,r(this,Qd),r(this,Zd),r(this,qd))},af=function(e){const t=r(this,bi);let s=0,i=t.length-1;for(;s<=i;){const n=s+i>>1,a=t[n][0];if(a===e)return n;a<e?s=n+1:i=n-1}return i+1},Ib=function([,e,t]){const s=b(this,ns,af).call(this,e);r(this,bi).splice(s,0,[e,t])},Ob=function([,e,t]){const s=b(this,ns,af).call(this,e);for(let i=s;i<r(this,bi).length;i++){const[n,a]=r(this,bi)[i];if(n!==e)break;if(n===e&&a===t){r(this,bi).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[n,a]=r(this,bi)[i];if(n!==e)break;if(n===e&&a===t){r(this,bi).splice(i,1);return}}},Jg=function(e){const[t,s,i]=e,n=[[t,s,i]],a=b(this,ns,af).call(this,i);for(let o=0;o<a;o++){const[l,h]=r(this,bi)[o];for(let c=0,u=n.length;c<u;c++){const[,f,p]=n[c];if(!(h<=f||p<=l)){if(f>=l){if(p>h)n[c][1]=h;else{if(u===1)return[];n.splice(c,1),c--,u--}continue}n[c][2]=l,p>h&&n.push([t,h,p])}}}return n};var tu,eu,Ch;class Qg extends V{constructor(t,s,i,n){super();y(this,tu);y(this,eu,null);y(this,Ch);g(this,Ch,t),g(this,tu,s),this.firstPoint=i,this.lastPoint=n}static build(t,s){const i=new Kg(t,.001).getOutlines();return g(i,eu,t),i.focusOutline=new Kg(t,.0025,.001,s).getOutlines(),i}get isFree(){return!1}get defaultSVGProperties(){return Tb(this)}getFocusSVGProperties(t){return Cb(this,t)}updateRotation(t){return{root:{"data-main-rotation":t}}}serializeQuadPoints([t,s],[i,n]){const a=r(this,eu),o=new Float32Array(a.length*8);let l=0;for(const{x:h,y:c,width:u,height:f}of a){const p=h*i+t,m=(1-c)*n+s;o[l]=o[l+4]=p,o[l+1]=o[l+3]=m,o[l+2]=o[l+6]=p+u*i,o[l+5]=o[l+7]=m-f*n,l+=8}return o}toSVGPath(){const t=[];for(const s of r(this,Ch)){let[i,n]=s;t.push(`M${i} ${n}`);for(let a=2;a<s.length;a+=2){const o=s[a],l=s[a+1];o===i?(t.push(`V${l}`),n=l):l===n&&(t.push(`H${o}`),i=o)}t.push("Z")}return t.join(" ")}serialize([t,s,i,n],a){const o=[],l=i-t,h=n-s;for(const c of r(this,Ch)){const u=new Array(c.length);for(let f=0;f<c.length;f+=2)u[f]=t+c[f]*l,u[f+1]=n-c[f+1]*h;o.push(u)}return o}get box(){return r(this,tu)}}tu=new WeakMap,eu=new WeakMap,Ch=new WeakMap;class Mm extends xf{newFreeDrawOutline(e,t,s,i,n,a){return new Zg(e,t,s,i,n,a)}}var Os,su;class ow{constructor(e,t,s,i,n,a,o){y(this,Os);y(this,su);g(this,Os,new Mm(e,t,s,i,n,a,o)),g(this,su,n)}add(e,t){return r(this,Os).add(e,t)?{path:{d:r(this,Os).toSVGPath()}}:null}addPoints(e){let t=!1;for(let s=0,i=e.length;s<i;s+=2)t=r(this,Os).add(e[s],e[s+1])||t;return t?{path:{d:r(this,Os).toSVGPath()}}:null}end(e,t){return e===void 0?null:this.add(e,t)}isEmpty(){return r(this,Os).isEmpty()}isCancellable(){return r(this,Os).isCancellable()}removeLastElement(){return r(this,Os).removeLastElement()}updateProperty(e,t){return null}getOutlines(){const e=r(this,Os).getOutlines();return e.buildFocusOutline(2*r(this,su)),e}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:!0},path:{d:r(this,Os).toSVGPath()}}}}Os=new WeakMap,su=new WeakMap;var Yf;const Kf=class Kf extends Eb{newOutliner(e,t,s,i,n,a,o=0){return new Mm(e,t,s,i,n,a,o)}get isFree(){return!0}buildFocusOutline(e){this.focusOutline=this.getNewOutline(e/2+r(Kf,Yf),.0025)}get defaultSVGProperties(){return Tb(this)}getFocusSVGProperties(e){return Cb(this,e)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(e){return{root:{"data-main-rotation":e}}}updateProperty(e,t){if(e!=="thickness")return null;const s=this.updateThickness(t/2);return this.buildFocusOutline(t),s}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}};Yf=new WeakMap,y(Kf,Yf,1.5);let Zg=Kf;class Rm extends Om{constructor(e=null){super(),super.updateProperties(e)}updateSVGProperty(e,t){e!=="thickness"&&super.updateSVGProperty(e,t)}clone(){const e=new Rm;return e.updateAll(this),e}}var Ph,iu,nu,ru,au,Ih,Bs,qg,Mb,of,Rb;const Je=class Je extends Pc{constructor(t){var s;super({...t,name:"highlightEditor"});y(this,Bs);y(this,Ph,null);y(this,iu,0);y(this,nu,null);y(this,ru,0);y(this,au,"");y(this,Ih,"");g(this,Ph,t.anchorNode||null),g(this,iu,t.anchorOffset||0),g(this,nu,t.focusNode||null),g(this,ru,t.focusOffset||0),g(this,au,t.methodOfCreation||((s=this._drawOutlines)!=null&&s.isFree?"main_toolbar":"")),g(this,Ih,t.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",this.rotate()}static get _keyboardManager(){const t=Je.prototype;return Q(this,"_keyboardManager",new Ko([[["ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown"],t._moveCaret,{args:[3]}]]))}static initialize(t,s){var i;Dt.initialize(t,s),this._defaultDrawingOptions||(this._defaultDrawingOptions=new Rm({fill:((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066","fill-opacity":Je._DEFAULT_OPACITY,thickness:Je._DEFAULT_THICKNESS}))}static getDefaultDrawingOptions(t){const s=this._defaultDrawingOptions.clone();return s.updateProperties(t),s}static get typesMap(){return Q(this,"typesMap",new Map([[ft.HIGHLIGHT_COLOR,"fill"],[ft.HIGHLIGHT_THICKNESS,"thickness"]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(t){const{boxes:s,drawOutlines:i}=t;!s&&!i||(this._drawingOptions||(this._drawingOptions=t.drawingOptions||Je.getDefaultDrawingOptions()),s&&(t={...t,drawOutlines:Qg.build(s,this._uiManager.direction==="ltr")}),super._addOutlines(t))}get colorType(){return ft.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions["fill-opacity"]}get _opacityName(){return"fill-opacity"}get _drawRotation(){var t;return(t=this._drawOutlines)!=null&&t.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){var t;return!((t=this._drawOutlines)!=null&&t.isFree)}get telemetryInitialData(){return{action:"added",type:this._drawOutlines.isFree?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:r(this,au)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}translateInPage(t,s){}get toolbarPosition(){return b(this,Bs,qg).call(this,this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return b(this,Bs,qg).call(this,this._drawOutlines.firstPoint)}updateParams(t,s){switch(t){case ft.HIGHLIGHT_COLOR:this._updateColorAndOpacity(s,Je._DEFAULT_OPACITY,t),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(s)},!0);break;case ft.HIGHLIGHT_THICKNESS:super.updateParams(t,s),this._reportTelemetry({action:"thickness_changed",thickness:s},!0);break}}get propertiesToUpdate(){const t=super.propertiesToUpdate;return t.push([ft.HIGHLIGHT_FREE,this._drawOutlines.isFree]),t}get toolbarButtons(){return this._uiManager.highlightColors?(this._colorPicker=new wf({editor:this}),[["colorPicker",this._colorPicker]]):super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(t,s){return super.getRect(t,s,this._drawRotation)}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){this._reportTelemetry({action:"deleted"}),super.remove()}render(){if(this.div)return this.div;const t=super.render();return r(this,Ih)&&(t.setAttribute("aria-label",r(this,Ih)),t.setAttribute("role","mark")),this._drawOutlines.isFree?t.classList.add("free"):t.addEventListener("keydown",b(this,Bs,Mb).bind(this),{signal:this._uiManager._signal}),this.enableEditing(),t}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:b(this,Bs,of).call(this,!0);break;case 1:case 3:b(this,Bs,of).call(this,!1);break}}unselect(){super.unselect(),this._drawOutlines.isFree||b(this,Bs,of).call(this,!1)}static createDrawerInstance({x:t,y:s,box:i,parent:n,isLTR:a}){return new ow(t,s,i,n.scale,this._defaultDrawingOptions.thickness/2,a,.001)}static _getDrawingTarget(t,{target:s}){return s.closest(".textLayer")}static _getPointerCoords({x:t,y:s}){return[t,s]}static _addDrawingListeners(t,s){t.classList.add("free"),s.addEventListener("abort",()=>t.classList.remove("free"),{once:!0}),window.addEventListener("blur",()=>this._endDraw(null),{signal:s}),window.addEventListener("pointerdown",me,{capture:!0,passive:!1,signal:s})}static _endDrawingSession(t=!1){return this.endDrawing(t)}createDrawingOptions({color:t,opacity:s,thickness:i}){const{_defaultDrawingOptions:n,_DEFAULT_OPACITY:a}=Je;this._drawingOptions=Je.getDefaultDrawingOptions({fill:_.makeHexColor(...t),"fill-opacity":s||a,thickness:i||n.thickness})}static deserializeDraw(t,s,i,n,a,o,l){const{quadPoints:h}=o;if(h){const m=[];for(let v=0,A=h.length;v<A;v+=8)m.push({x:(h[v]-t)/i,y:1-(h[v+1]-s)/n,width:(h[v+2]-h[v])/i,height:(h[v+1]-h[v+5])/n});return Qg.build(m,l.direction==="ltr")}const c=o.thickness||this._defaultDrawingOptions.thickness,u=(o.inkLists||o.outlines.points)[0],f=new Mm(u[0]-t,n-(u[1]-s),[0,0,i,n],1,c/2,!0,.001);for(let m=0,v=u.length;m<v;m+=2)f.add(u[m]-t,n-(u[m+1]-s));const p=f.getOutlines();return p.buildFocusOutline(c),p}static async deserialize(t,s,i){let n=null;if(t instanceof ob){const{data:{quadPoints:o,rect:l,rotation:h,id:c,color:u,opacity:f,popupRef:p,richText:m,contentsObj:v,creationDate:A,modificationDate:w},parent:{page:{pageNumber:S}}}=t;n=t={annotationType:nt.HIGHLIGHT,color:Array.from(u),opacity:f,quadPoints:o,pageIndex:S-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:p,richText:m,comment:(v==null?void 0:v.str)||null,creationDate:A,modificationDate:w}}else if(t instanceof Im){const{data:{inkLists:o,rect:l,rotation:h,id:c,color:u,borderStyle:{rawWidth:f},popupRef:p,richText:m,contentsObj:v,creationDate:A,modificationDate:w},parent:{page:{pageNumber:S}}}=t;n=t={annotationType:nt.HIGHLIGHT,color:Array.from(u),thickness:f,inkLists:o,pageIndex:S-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:p,richText:m,comment:(v==null?void 0:v.str)||null,creationDate:A,modificationDate:w}}const a=await super.deserialize(t,s,i);return a._initialData=n,t.comment&&a.setCommentData(t),a}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const s=super.serialize(t);return Object.assign(s,{color:Dt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(s.rect,this._drawRotation)}),this.addComment(s),this.annotationElementId&&!b(this,Bs,Rb).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};Ph=new WeakMap,iu=new WeakMap,nu=new WeakMap,ru=new WeakMap,au=new WeakMap,Ih=new WeakMap,Bs=new WeakSet,qg=function([t,s]){const[i,n,a,o]=this._drawOutlines.box;return[(t-i)/a,(s-n)/o]},Mb=function(t){Je._keyboardManager.exec(this,t)},of=function(t){if(!r(this,Ph))return;const s=window.getSelection();t?s.setPosition(r(this,Ph),r(this,iu)):s.setPosition(r(this,nu),r(this,ru))},Rb=function(t){const{color:s}=this._initialData;return this.hasEditedComment||t.color.some((i,n)=>i!==s[n])},O(Je,"_DEFAULT_OPACITY",1),O(Je,"_DEFAULT_THICKNESS",12),O(Je,"_defaultDrawingOptions",null),O(Je,"_type","highlight"),O(Je,"_editorType",nt.HIGHLIGHT);let Tf=Je;var Qi,Yr,ce,Re,Bo,Oh,De,de,ti,Uo,Ho,_o,Us,lf,hf,tm;class lw{constructor(e,t,s,i,n,a){y(this,Us);y(this,Qi,new Float64Array(6));y(this,Yr,new Float64Array(2));y(this,ce);y(this,Re);y(this,Bo);y(this,Oh);y(this,De);y(this,de,"");y(this,ti,0);y(this,Uo,new yu);y(this,Ho);y(this,_o);g(this,Ho,s),g(this,_o,i),g(this,Bo,n),g(this,Oh,a),[e,t]=b(this,Us,lf).call(this,e,t);const o=g(this,ce,[NaN,NaN,NaN,NaN,e,t]);g(this,De,[e,t]),g(this,Re,[{line:o,points:r(this,De)}]),r(this,Qi).set(o,0),r(this,Yr).set([e,t],0)}updateProperty(e,t){e==="stroke-width"&&g(this,Oh,t)}isEmpty(){var e;return!((e=r(this,Re))!=null&&e.length)}isCancellable(){return r(this,De).length<=10}add(e,t){return b(this,Us,hf).call(this,e,t)&&this.toSVGPath(),{path:{d:b(this,Us,tm).call(this)}}}addPoints(e){let t=!1;for(let s=0,i=e.length;s<i;s+=2)b(this,Us,hf).call(this,e[s],e[s+1])&&(t=!0,r(this,De).length<=6&&(this.toSVGPath(),t=!1));return t&&this.toSVGPath(),{path:{d:b(this,Us,tm).call(this)}}}end(e,t){return e!==void 0&&b(this,Us,hf).call(this,e,t)?{path:{d:this.toSVGPath()}}:r(this,De).length===2?{path:{d:this.toSVGPath()}}:{path:{d:r(this,de)}}}startNew(e,t,s,i,n){g(this,Ho,s),g(this,_o,i),g(this,Bo,n),[e,t]=b(this,Us,lf).call(this,e,t);const a=g(this,ce,[NaN,NaN,NaN,NaN,e,t]);g(this,De,[e,t]),r(this,Yr).set([e,t],0);const o=r(this,Re).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),r(this,Re).push({line:a,points:r(this,De)}),r(this,Qi).set(a,0),g(this,ti,0),this.toSVGPath(),null}getLastElement(){return r(this,Re).at(-1)}setLastElement(e){return r(this,Re)?(r(this,Re).push(e),g(this,ce,e.line),g(this,De,e.points),g(this,ti,0),{path:{d:this.toSVGPath()}}):r(this,Uo).setLastElement(e)}removeLastElement(){if(!r(this,Re))return r(this,Uo).removeLastElement();r(this,Re).pop(),g(this,de,"");for(let e=0,t=r(this,Re).length;e<t;e++){const{line:s,points:i}=r(this,Re)[e];g(this,ce,s),g(this,De,i),g(this,ti,0),this.toSVGPath()}return{path:{d:r(this,de)}}}toSVGPath(){const e=V.svgRound(r(this,ce)[4]),t=V.svgRound(r(this,ce)[5]);if(r(this,De).length===2)return g(this,de,`${r(this,de)} M ${e} ${t} Z`),r(this,de);if(r(this,De).length<=6){const i=r(this,de).lastIndexOf("M");g(this,de,`${r(this,de).slice(0,i)} M ${e} ${t}`),g(this,ti,6)}if(r(this,De).length===4){const i=V.svgRound(r(this,ce)[10]),n=V.svgRound(r(this,ce)[11]);return g(this,de,`${r(this,de)} L ${i} ${n}`),g(this,ti,12),r(this,de)}const s=[];r(this,ti)===0&&(s.push(`M ${e} ${t}`),g(this,ti,6));for(let i=r(this,ti),n=r(this,ce).length;i<n;i+=6){const[a,o,l,h,c,u]=r(this,ce).slice(i,i+6).map(V.svgRound);s.push(`C${a} ${o} ${l} ${h} ${c} ${u}`)}return g(this,de,r(this,de)+s.join(" ")),g(this,ti,r(this,ce).length),r(this,de)}getOutlines(e,t,s,i){const n=r(this,Re).at(-1);return n.line=new Float32Array(n.line),n.points=new Float32Array(n.points),r(this,Uo).build(r(this,Re),e,t,s,r(this,Bo),r(this,Oh),i),g(this,Qi,null),g(this,ce,null),g(this,Re,null),g(this,de,null),r(this,Uo)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}Qi=new WeakMap,Yr=new WeakMap,ce=new WeakMap,Re=new WeakMap,Bo=new WeakMap,Oh=new WeakMap,De=new WeakMap,de=new WeakMap,ti=new WeakMap,Uo=new WeakMap,Ho=new WeakMap,_o=new WeakMap,Us=new WeakSet,lf=function(e,t){return V._normalizePoint(e,t,r(this,Ho),r(this,_o),r(this,Bo))},hf=function(e,t){[e,t]=b(this,Us,lf).call(this,e,t),r(this,Yr).set([e,t],0);const[s,i,n,a]=r(this,Qi).subarray(2,6),o=e-n,l=t-a;return Math.hypot(r(this,Ho)*o,r(this,_o)*l)<=2?!1:(r(this,De).push(e,t),isNaN(s)?(r(this,Qi).set([n,a,e,t],2),r(this,ce).push(NaN,NaN,NaN,NaN,e,t),!0):(isNaN(r(this,Qi)[0])&&r(this,ce).splice(6,6),r(this,Qi).set([s,i,n,a,e,t],0),r(this,ce).push(...V.createBezierPoints(s,i,n,a,e,t)),!0))},tm=function(){const e=V.svgRound(r(this,Yr)[0]),t=V.svgRound(r(this,Yr)[1]);if(r(this,De).length===2){const s=V.svgRound(r(this,ce)[4]),i=V.svgRound(r(this,ce)[5]);return`${r(this,de)} M ${s} ${i} L ${e} ${t}`}return`${r(this,de)} L ${e} ${t}`};var Ze,ou,lu,Ms,Zi,qi,Mh,Rh,$o,Fe,cn,Db,kb,Fb;class yu extends V{constructor(){super(...arguments);y(this,Fe);y(this,Ze);y(this,ou,0);y(this,lu);y(this,Ms);y(this,Zi);y(this,qi);y(this,Mh);y(this,Rh);y(this,$o)}build(t,s,i,n,a,o,l){g(this,Zi,s),g(this,qi,i),g(this,Mh,n),g(this,Rh,a),g(this,$o,o),g(this,lu,l??0),g(this,Ms,t),b(this,Fe,kb).call(this)}get thickness(){return r(this,$o)}setLastElement(t){return r(this,Ms).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return r(this,Ms).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:s}of r(this,Ms)){if(t.push(`M${V.svgRound(s[4])} ${V.svgRound(s[5])}`),s.length===6){t.push("Z");continue}if(s.length===12&&isNaN(s[6])){t.push(`L${V.svgRound(s[10])} ${V.svgRound(s[11])}`);continue}for(let i=6,n=s.length;i<n;i+=6){const[a,o,l,h,c,u]=s.subarray(i,i+6).map(V.svgRound);t.push(`C${a} ${o} ${l} ${h} ${c} ${u}`)}}return t.join("")}serialize([t,s,i,n],a){const o=[],l=[],[h,c,u,f]=b(this,Fe,Db).call(this);let p,m,v,A,w,S,x,C,E;switch(r(this,Rh)){case 0:E=V._rescale,p=t,m=s+n,v=i,A=-n,w=t+h*i,S=s+(1-c-f)*n,x=t+(h+u)*i,C=s+(1-c)*n;break;case 90:E=V._rescaleAndSwap,p=t,m=s,v=i,A=n,w=t+c*i,S=s+h*n,x=t+(c+f)*i,C=s+(h+u)*n;break;case 180:E=V._rescale,p=t+i,m=s,v=-i,A=n,w=t+(1-h-u)*i,S=s+c*n,x=t+(1-h)*i,C=s+(c+f)*n;break;case 270:E=V._rescaleAndSwap,p=t+i,m=s+n,v=-i,A=-n,w=t+(1-c-f)*i,S=s+(1-h-u)*n,x=t+(1-c)*i,C=s+(1-h)*n;break}for(const{line:T,points:P}of r(this,Ms))o.push(E(T,p,m,v,A,a?new Array(T.length):null)),l.push(E(P,p,m,v,A,a?new Array(P.length):null));return{lines:o,points:l,rect:[w,S,x,C]}}static deserialize(t,s,i,n,a,{paths:{lines:o,points:l},rotation:h,thickness:c}){const u=[];let f,p,m,v,A;switch(h){case 0:A=V._rescale,f=-t/i,p=s/n+1,m=1/i,v=-1/n;break;case 90:A=V._rescaleAndSwap,f=-s/n,p=-t/i,m=1/n,v=1/i;break;case 180:A=V._rescale,f=t/i+1,p=-s/n,m=-1/i,v=1/n;break;case 270:A=V._rescaleAndSwap,f=s/n+1,p=t/i+1,m=-1/n,v=-1/i;break}if(!o){o=[];for(const S of l){const x=S.length;if(x===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,S[0],S[1]]));continue}if(x===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,S[0],S[1],NaN,NaN,NaN,NaN,S[2],S[3]]));continue}const C=new Float32Array(3*(x-2));o.push(C);let[E,T,P,M]=S.subarray(0,4);C.set([NaN,NaN,NaN,NaN,E,T],0);for(let I=4;I<x;I+=2){const D=S[I],R=S[I+1];C.set(V.createBezierPoints(E,T,P,M,D,R),(I-2)*3),[E,T,P,M]=[P,M,D,R]}}}for(let S=0,x=o.length;S<x;S++)u.push({line:A(o[S].map(C=>C??NaN),f,p,m,v),points:A(l[S].map(C=>C??NaN),f,p,m,v)});const w=new this.prototype.constructor;return w.build(u,i,n,1,h,c,a),w}get box(){return r(this,Ze)}updateProperty(t,s){return t==="stroke-width"?b(this,Fe,Fb).call(this,s):null}updateParentDimensions([t,s],i){const[n,a]=b(this,Fe,cn).call(this);g(this,Zi,t),g(this,qi,s),g(this,Mh,i);const[o,l]=b(this,Fe,cn).call(this),h=o-n,c=l-a,u=r(this,Ze);return u[0]-=h,u[1]-=c,u[2]+=2*h,u[3]+=2*c,u}updateRotation(t){return g(this,ou,t),{path:{transform:this.rotationTransform}}}get viewBox(){return r(this,Ze).map(V.svgRound).join(" ")}get defaultProperties(){const[t,s]=r(this,Ze);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${V.svgRound(t)} ${V.svgRound(s)}`}}}get rotationTransform(){const[,,t,s]=r(this,Ze);let i=0,n=0,a=0,o=0,l=0,h=0;switch(r(this,ou)){case 90:n=s/t,a=-t/s,l=t;break;case 180:i=-1,o=-1,l=t,h=s;break;case 270:n=-s/t,a=t/s,h=s;break;default:return""}return`matrix(${i} ${n} ${a} ${o} ${V.svgRound(l)} ${V.svgRound(h)})`}getPathResizingSVGProperties([t,s,i,n]){const[a,o]=b(this,Fe,cn).call(this),[l,h,c,u]=r(this,Ze);if(Math.abs(c-a)<=V.PRECISION||Math.abs(u-o)<=V.PRECISION){const A=t+i/2-(l+c/2),w=s+n/2-(h+u/2);return{path:{"transform-origin":`${V.svgRound(t)} ${V.svgRound(s)}`,transform:`${this.rotationTransform} translate(${A} ${w})`}}}const f=(i-2*a)/(c-2*a),p=(n-2*o)/(u-2*o),m=c/i,v=u/n;return{path:{"transform-origin":`${V.svgRound(l)} ${V.svgRound(h)}`,transform:`${this.rotationTransform} scale(${m} ${v}) translate(${V.svgRound(a)} ${V.svgRound(o)}) scale(${f} ${p}) translate(${V.svgRound(-a)} ${V.svgRound(-o)})`}}}getPathResizedSVGProperties([t,s,i,n]){const[a,o]=b(this,Fe,cn).call(this),l=r(this,Ze),[h,c,u,f]=l;if(l[0]=t,l[1]=s,l[2]=i,l[3]=n,Math.abs(u-a)<=V.PRECISION||Math.abs(f-o)<=V.PRECISION){const w=t+i/2-(h+u/2),S=s+n/2-(c+f/2);for(const{line:x,points:C}of r(this,Ms))V._translate(x,w,S,x),V._translate(C,w,S,C);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${V.svgRound(t)} ${V.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const p=(i-2*a)/(u-2*a),m=(n-2*o)/(f-2*o),v=-p*(h+a)+t+a,A=-m*(c+o)+s+o;if(p!==1||m!==1||v!==0||A!==0)for(const{line:w,points:S}of r(this,Ms))V._rescale(w,v,A,p,m,w),V._rescale(S,v,A,p,m,S);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${V.svgRound(t)} ${V.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,s],i){const[n,a]=i,o=r(this,Ze),l=t-o[0],h=s-o[1];if(r(this,Zi)===n&&r(this,qi)===a)for(const{line:c,points:u}of r(this,Ms))V._translate(c,l,h,c),V._translate(u,l,h,u);else{const c=r(this,Zi)/n,u=r(this,qi)/a;g(this,Zi,n),g(this,qi,a);for(const{line:f,points:p}of r(this,Ms))V._rescale(f,l,h,c,u,f),V._rescale(p,l,h,c,u,p);o[2]*=c,o[3]*=u}return o[0]=t,o[1]=s,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${V.svgRound(t)} ${V.svgRound(s)}`}}}get defaultSVGProperties(){const t=r(this,Ze);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${V.svgRound(t[0])} ${V.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}Ze=new WeakMap,ou=new WeakMap,lu=new WeakMap,Ms=new WeakMap,Zi=new WeakMap,qi=new WeakMap,Mh=new WeakMap,Rh=new WeakMap,$o=new WeakMap,Fe=new WeakSet,cn=function(t=r(this,$o)){const s=r(this,lu)+t/2*r(this,Mh);return r(this,Rh)%180===0?[s/r(this,Zi),s/r(this,qi)]:[s/r(this,qi),s/r(this,Zi)]},Db=function(){const[t,s,i,n]=r(this,Ze),[a,o]=b(this,Fe,cn).call(this,0);return[t+a,s+o,i-2*a,n-2*o]},kb=function(){const t=g(this,Ze,Aa.slice());for(const{line:n}of r(this,Ms)){if(n.length<=12){for(let l=4,h=n.length;l<h;l+=6)_.pointBoundingBox(n[l],n[l+1],t);continue}let a=n[4],o=n[5];for(let l=6,h=n.length;l<h;l+=6){const[c,u,f,p,m,v]=n.subarray(l,l+6);_.bezierBoundingBox(a,o,c,u,f,p,m,v,t),a=m,o=v}}const[s,i]=b(this,Fe,cn).call(this);t[0]=_t(t[0]-s,0,1),t[1]=_t(t[1]-i,0,1),t[2]=_t(t[2]+s,0,1),t[3]=_t(t[3]+i,0,1),t[2]-=t[0],t[3]-=t[1]},Fb=function(t){const[s,i]=b(this,Fe,cn).call(this);g(this,$o,t);const[n,a]=b(this,Fe,cn).call(this),[o,l]=[n-s,a-i],h=r(this,Ze);return h[0]-=o,h[1]-=l,h[2]+=2*o,h[3]+=2*l,h};class up extends Om{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:Dt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){e==="stroke-width"&&(t??(t=this["stroke-width"]),t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){const e=new up(this._viewParameters);return e.updateAll(this),e}}var Jf,Lb;const dl=class dl extends Pc{constructor(t){super({...t,name:"inkEditor"});y(this,Jf);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,s){Dt.initialize(t,s),this._defaultDrawingOptions=new up(s.viewParameters)}static getDefaultDrawingOptions(t){const s=this._defaultDrawingOptions.clone();return s.updateProperties(t),s}static get supportMultipleDrawings(){return!0}static get typesMap(){return Q(this,"typesMap",new Map([[ft.INK_THICKNESS,"stroke-width"],[ft.INK_COLOR,"stroke"],[ft.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance({x:t,y:s,box:[,,i,n],rotation:a}){return new lw(t,s,i,n,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,s,i,n,a,o){return yu.deserialize(t,s,i,n,a,o)}static async deserialize(t,s,i){let n=null;if(t instanceof Im){const{data:{inkLists:o,rect:l,rotation:h,id:c,color:u,opacity:f,borderStyle:{rawWidth:p},popupRef:m,richText:v,contentsObj:A,creationDate:w,modificationDate:S},parent:{page:{pageNumber:x}}}=t;n=t={annotationType:nt.INK,color:Array.from(u),thickness:p,opacity:f,paths:{points:o},boxes:null,pageIndex:x-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:m,richText:v,comment:(A==null?void 0:A.str)||null,creationDate:w,modificationDate:S}}const a=await super.deserialize(t,s,i);return a._initialData=n,t.comment&&a.setCommentData(t),a}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Sf(this)),[["colorPicker",this._colorPicker]]}get colorType(){return ft.INK_COLOR}get colorAndOpacityType(){return ft.INK_COLOR_AND_OPACITY}get opacityType(){return ft.INK_OPACITY}updateParams(t,s){if(t===ft.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(s.color,s.opacity);return}super.updateParams(t,s)}static updateDefaultParams(t,s){if(t===ft.INK_COLOR_AND_OPACITY){super.updateDefaultParams(ft.INK_COLOR,s.color),super.updateDefaultParams(ft.INK_OPACITY,s.opacity);return}super.updateDefaultParams(t,s)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:s,parent:i}=this;s.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,s.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:s,opacity:i}){this._drawingOptions=dl.getDefaultDrawingOptions({stroke:_.makeHexColor(...t),"stroke-width":s,"stroke-opacity":i})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:s,points:i}=this.serializeDraw(t),{_drawingOptions:{stroke:n,"stroke-opacity":a,"stroke-width":o}}=this,l=Object.assign(super.serialize(t),{color:Dt._colorManager.convert(n),opacity:a,thickness:o,paths:{lines:s,points:i}});return this.addComment(l),t?(l.isCopy=!0,l):this.annotationElementId&&!b(this,Jf,Lb).call(this,l)?null:(l.id=this.annotationElementId,l)}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;const{points:s,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:s,popup:this.comment}),null}};Jf=new WeakSet,Lb=function(t){const{color:s,thickness:i,opacity:n,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((o,l)=>o!==s[l])||t.thickness!==i||t.opacity!==n||t.pageIndex!==a},O(dl,"_type","ink"),O(dl,"_editorType",nt.INK),O(dl,"_defaultDrawingOptions",null);let em=dl;class sm extends yu{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}ot(5213);const Cu=8,Jh=3;var jo,St,im,Ai,Nb,Bb,nm,cf,Ub,Hb,_b,rm,am,$b;class Kn{static extractContoursFromText(e,{fontFamily:t,fontStyle:s,fontWeight:i},n,a,o,l){let h=new OffscreenCanvas(1,1),c=h.getContext("2d",{alpha:!1});const u=200,f=c.font=`${s} ${i} ${u}px ${t}`,{actualBoundingBoxLeft:p,actualBoundingBoxRight:m,actualBoundingBoxAscent:v,actualBoundingBoxDescent:A,fontBoundingBoxAscent:w,fontBoundingBoxDescent:S,width:x}=c.measureText(e),C=1.5,E=Math.ceil(Math.max(Math.abs(p)+Math.abs(m)||0,x)*C),T=Math.ceil(Math.max(Math.abs(v)+Math.abs(A)||u,Math.abs(w)+Math.abs(S)||u)*C);h=new OffscreenCanvas(E,T),c=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),c.font=f,c.filter="grayscale(1)",c.fillStyle="white",c.fillRect(0,0,E,T),c.fillStyle="black",c.fillText(e,E*(C-1)/2,T*(3-C)/2);const P=b(this,St,rm).call(this,c.getImageData(0,0,E,T).data),M=b(this,St,_b).call(this,P),I=b(this,St,am).call(this,M),D=b(this,St,nm).call(this,P,E,T,I);return this.processDrawnLines({lines:{curves:D,width:E,height:T},pageWidth:n,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(e,t,s,i,n){const[a,o,l]=b(this,St,$b).call(this,e),[h,c]=b(this,St,Hb).call(this,a,o,l,Math.hypot(o,l)*r(this,jo).sigmaSFactor,r(this,jo).sigmaR,r(this,jo).kernelSize),u=b(this,St,am).call(this,c),f=b(this,St,nm).call(this,h,o,l,u);return this.processDrawnLines({lines:{curves:f,width:o,height:l},pageWidth:t,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:a,areContours:o}){i%180!==0&&([t,s]=[s,t]);const{curves:l,width:h,height:c}=e,u=e.thickness??0,f=[],p=Math.min(t/h,s/c),m=p/t,v=p/s,A=[];for(const{points:S}of l){const x=a?b(this,St,Ub).call(this,S):S;if(!x)continue;A.push(x);const C=x.length,E=new Float32Array(C),T=new Float32Array(3*(C===2?2:C-2));if(f.push({line:T,points:E}),C===2){E[0]=x[0]*m,E[1]=x[1]*v,T.set([NaN,NaN,NaN,NaN,E[0],E[1]],0);continue}let[P,M,I,D]=x;P*=m,M*=v,I*=m,D*=v,E.set([P,M,I,D],0),T.set([NaN,NaN,NaN,NaN,P,M],0);for(let R=4;R<C;R+=2){const U=E[R]=x[R]*m,B=E[R+1]=x[R+1]*v;T.set(V.createBezierPoints(P,M,I,D,U,B),(R-2)*3),[P,M,I,D]=[I,D,U,B]}}if(f.length===0)return null;const w=o?new sm:new yu;return w.build(f,t,s,1,i,o?0:u,n),{outline:w,newCurves:A,areContours:o,thickness:u,width:h,height:c}}static async compressSignature({outlines:e,areContours:t,thickness:s,width:i,height:n}){let a=1/0,o=-1/0,l=0;for(const S of e){l+=S.length;for(let x=2,C=S.length;x<C;x++){const E=S[x]-S[x-2];a=Math.min(a,E),o=Math.max(o,E)}}let h;a>=-128&&o<=127?h=Int8Array:a>=-32768&&o<=32767?h=Int16Array:h=Int32Array;const c=e.length,u=Cu+Jh*c,f=new Uint32Array(u);let p=0;f[p++]=u*Uint32Array.BYTES_PER_ELEMENT+(l-2*c)*h.BYTES_PER_ELEMENT,f[p++]=0,f[p++]=i,f[p++]=n,f[p++]=t?0:1,f[p++]=Math.max(0,Math.floor(s??0)),f[p++]=c,f[p++]=h.BYTES_PER_ELEMENT;for(const S of e)f[p++]=S.length-2,f[p++]=S[0],f[p++]=S[1];const m=new CompressionStream("deflate-raw"),v=m.writable.getWriter();await v.ready,v.write(f);const A=h.prototype.constructor;for(const S of e){const x=new A(S.length-2);for(let C=2,E=S.length;C<E;C++)x[C-2]=S[C]-S[C-2];v.write(x)}return v.close(),(await new Response(m.readable).bytes()).toBase64()}static async decompressSignature(e){try{const t=Uint8Array.fromBase64(e),{readable:s,writable:i}=new DecompressionStream("deflate-raw"),n=i.getWriter();await n.ready,n.write(t).then(async()=>{await n.ready,await n.close()}).catch(()=>{});let a=null,o=0;for await(const x of s)a||(a=new Uint8Array(new Uint32Array(x.buffer,0,4)[0])),a.set(x,o),o+=x.length;const l=new Uint32Array(a.buffer,0,a.length>>2),h=l[1];if(h!==0)throw new Error(`Invalid version: ${h}`);const c=l[2],u=l[3],f=l[4]===0,p=l[5],m=l[6],v=l[7],A=[],w=(Cu+Jh*m)*Uint32Array.BYTES_PER_ELEMENT;let S;switch(v){case Int8Array.BYTES_PER_ELEMENT:S=new Int8Array(a.buffer,w);break;case Int16Array.BYTES_PER_ELEMENT:S=new Int16Array(a.buffer,w);break;case Int32Array.BYTES_PER_ELEMENT:S=new Int32Array(a.buffer,w);break}o=0;for(let x=0;x<m;x++){const C=l[Jh*x+Cu],E=new Float32Array(C+2);A.push(E);for(let T=0;T<Jh-1;T++)E[T]=l[Jh*x+Cu+T+1];for(let T=0;T<C;T++)E[T+2]=E[T]+S[o++]}return{areContours:f,thickness:p,outlines:A,width:c,height:u}}catch(t){return st(`decompressSignature: ${t}`),null}}}jo=new WeakMap,St=new WeakSet,im=function(e,t,s,i){return s-=e,i-=t,s===0?i>0?0:4:s===1?i+6:2-i},Ai=new WeakMap,Nb=function(e,t,s,i,n,a,o){const l=b(this,St,im).call(this,s,i,n,a);for(let h=0;h<8;h++){const c=(-h+l-o+16)%8,u=r(this,Ai)[2*c],f=r(this,Ai)[2*c+1];if(e[(s+u)*t+(i+f)]!==0)return c}return-1},Bb=function(e,t,s,i,n,a,o){const l=b(this,St,im).call(this,s,i,n,a);for(let h=0;h<8;h++){const c=(h+l+o+16)%8,u=r(this,Ai)[2*c],f=r(this,Ai)[2*c+1];if(e[(s+u)*t+(i+f)]!==0)return c}return-1},nm=function(e,t,s,i){const n=e.length,a=new Int32Array(n);for(let c=0;c<n;c++)a[c]=e[c]<=i?1:0;for(let c=1;c<s-1;c++)a[c*t]=a[c*t+t-1]=0;for(let c=0;c<t;c++)a[c]=a[t*s-1-c]=0;let o=1,l;const h=[];for(let c=1;c<s-1;c++){l=1;for(let u=1;u<t-1;u++){const f=c*t+u,p=a[f];if(p===0)continue;let m=c,v=u;if(p===1&&a[f-1]===0)o+=1,v-=1;else if(p>=1&&a[f+1]===0)o+=1,v+=1,p>1&&(l=p);else{p!==1&&(l=Math.abs(p));continue}const A=[u,c],w=v===u+1,S={isHole:w,points:A,id:o,parent:0};h.push(S);let x;for(const R of h)if(R.id===l){x=R;break}x?x.isHole?S.parent=w?x.parent:l:S.parent=w?l:x.parent:S.parent=w?l:0;const C=b(this,St,Nb).call(this,a,t,c,u,m,v,0);if(C===-1){a[f]=-o,a[f]!==1&&(l=Math.abs(a[f]));continue}let E=r(this,Ai)[2*C],T=r(this,Ai)[2*C+1];const P=c+E,M=u+T;m=P,v=M;let I=c,D=u;for(;;){const R=b(this,St,Bb).call(this,a,t,I,D,m,v,1);E=r(this,Ai)[2*R],T=r(this,Ai)[2*R+1];const U=I+E,B=D+T;A.push(B,U);const N=I*t+D;if(a[N+1]===0?a[N]=-o:a[N]===1&&(a[N]=o),U===c&&B===u&&I===P&&D===M){a[f]!==1&&(l=Math.abs(a[f]));break}else m=I,v=D,I=U,D=B}}}return h},cf=function(e,t,s,i){if(s-t<=4){for(let P=t;P<s-2;P+=2)i.push(e[P],e[P+1]);return}const n=e[t],a=e[t+1],o=e[s-4]-n,l=e[s-3]-a,h=Math.hypot(o,l),c=o/h,u=l/h,f=c*a-u*n,p=l/o,m=1/h,v=Math.atan(p),A=Math.cos(v),w=Math.sin(v),S=m*(Math.abs(A)+Math.abs(w)),x=m*(1-S+S**2),C=Math.max(Math.atan(Math.abs(w+A)*x),Math.atan(Math.abs(w-A)*x));let E=0,T=t;for(let P=t+2;P<s-2;P+=2){const M=Math.abs(f-c*e[P+1]+u*e[P]);M>E&&(T=P,E=M)}E>(h*C)**2?(b(this,St,cf).call(this,e,t,T+2,i),b(this,St,cf).call(this,e,T,s,i)):i.push(n,a)},Ub=function(e){const t=[],s=e.length;return b(this,St,cf).call(this,e,0,s,t),t.push(e[s-2],e[s-1]),t.length<=4?null:t},Hb=function(e,t,s,i,n,a){const o=new Float32Array(a**2),l=-2*i**2,h=a>>1;for(let v=0;v<a;v++){const A=(v-h)**2;for(let w=0;w<a;w++)o[v*a+w]=Math.exp((A+(w-h)**2)/l)}const c=new Float32Array(256),u=-2*n**2;for(let v=0;v<256;v++)c[v]=Math.exp(v**2/u);const f=e.length,p=new Uint8Array(f),m=new Uint32Array(256);for(let v=0;v<s;v++)for(let A=0;A<t;A++){const w=v*t+A,S=e[w];let x=0,C=0;for(let T=0;T<a;T++){const P=v+T-h;if(!(P<0||P>=s))for(let M=0;M<a;M++){const I=A+M-h;if(I<0||I>=t)continue;const D=e[P*t+I],R=o[T*a+M]*c[Math.abs(D-S)];x+=D*R,C+=R}}const E=p[w]=Math.round(x/C);m[E]++}return[p,m]},_b=function(e){const t=new Uint32Array(256);for(const s of e)t[s]++;return t},rm=function(e){const t=e.length,s=new Uint8ClampedArray(t>>2);let i=-1/0,n=1/0;for(let o=0,l=s.length;o<l;o++){const h=s[o]=e[o<<2];i=Math.max(i,h),n=Math.min(n,h)}const a=255/(i-n);for(let o=0,l=s.length;o<l;o++)s[o]=(s[o]-n)*a;return s},am=function(e){let t,s=-1/0,i=-1/0;const n=e.findIndex(l=>l!==0);let a=n,o=n;for(t=n;t<256;t++){const l=e[t];l>s&&(t-a>i&&(i=t-a,o=t-1),s=l,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t},$b=function(e){const t=e,{width:s,height:i}=e,{maxDim:n}=r(this,jo);let a=s,o=i;if(s>n||i>n){let f=s,p=i,m=Math.log2(Math.max(s,i)/n);const v=Math.floor(m);m=m===v?v-1:v;for(let w=0;w<m;w++){a=Math.ceil(f/2),o=Math.ceil(p/2);const S=new OffscreenCanvas(a,o);S.getContext("2d").drawImage(e,0,0,f,p,0,0,a,o),f=a,p=o,e!==t&&e.close(),e=S.transferToImageBitmap()}const A=Math.min(n/a,n/o);a=Math.round(a*A),o=Math.round(o*A)}const h=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});h.fillStyle="white",h.fillRect(0,0,a,o),h.filter="grayscale(1)",h.drawImage(e,0,0,e.width,e.height,0,0,a,o);const c=h.getImageData(0,0,a,o).data;return[b(this,St,rm).call(this,c),a,o]},y(Kn,St),y(Kn,jo,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),y(Kn,Ai,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class Dm extends Om{constructor(){super(),super.updateProperties({fill:Dt._defaultLineColor,"stroke-width":0})}clone(){const e=new Dm;return e.updateAll(this),e}}class km extends up{constructor(e){super(e),super.updateProperties({stroke:Dt._defaultLineColor,"stroke-width":1})}clone(){const e=new km(this._viewParameters);return e.updateAll(this),e}}var Kr,tn,Jr,Go;const ms=class ms extends Pc{constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"});y(this,Kr,!1);y(this,tn,null);y(this,Jr,null);y(this,Go,null);this._willKeepAspectRatio=!0,g(this,Jr,t.signatureData||null),g(this,tn,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,s){Dt.initialize(t,s),this._defaultDrawingOptions=new Dm,this._defaultDrawnSignatureOptions=new km(s.viewParameters)}static getDefaultDrawingOptions(t){const s=this._defaultDrawingOptions.clone();return s.updateProperties(t),s}static get supportMultipleDrawings(){return!1}static get typesMap(){return Q(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!r(this,tn)}}static computeTelemetryFinalData(t){const s=t.get("hasDescription");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,s;const{_isCopy:i}=this;if(i&&(this._isCopy=!1,t=this.x,s=this.y),super.render(),this._drawId===null)if(r(this,Jr)){const{lines:n,mustSmooth:a,areContours:o,description:l,uuid:h,heightInPage:c}=r(this,Jr),{rawDims:{pageWidth:u,pageHeight:f},rotation:p}=this.parent.viewport,m=Kn.processDrawnLines({lines:n,pageWidth:u,pageHeight:f,rotation:p,innerMargin:ms._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(m,c,l,h)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:r(this,tn)||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(t,s)),this.div}setUuid(t){g(this,Go,t),this.addEditToolbar()}getUuid(){return r(this,Go)}get description(){return r(this,tn)}set description(t){g(this,tn,t),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(s=>{s==null||s.updateEditSignatureButton(t)}))}getSignaturePreview(){const{newCurves:t,areContours:s,thickness:i,width:n,height:a}=r(this,Jr),o=Math.max(n,a),l=Kn.processDrawnLines({lines:{curves:t.map(h=>({points:h})),thickness:i,width:n,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:s});return{areContours:s,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,s,i,n){const{x:a,y:o}=this,{outline:l}=g(this,Jr,t);g(this,Kr,l instanceof sm),this.description=i;let h;r(this,Kr)?h=ms.getDefaultDrawingOptions():(h=ms._defaultDrawnSignatureOptions.clone(),h.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:h});const[,c]=this.pageDimensions;let u=s/c;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(n),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!n,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return Kn.process(t,s,i,n,ms._INNER_MARGIN)}getFromText(t,s){const{rawDims:{pageWidth:i,pageHeight:n},rotation:a}=this.parent.viewport;return Kn.extractContoursFromText(t,s,i,n,a,ms._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return Kn.processDrawnLines({lines:t,pageWidth:s,pageHeight:i,rotation:n,innerMargin:ms._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:s}){t?this._drawingOptions=ms.getDefaultDrawingOptions():(this._drawingOptions=ms._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":s}))}serialize(t=!1){if(this.isEmpty())return null;const{lines:s,points:i}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":n}}=this,a=Object.assign(super.serialize(t),{isSignature:!0,areContours:r(this,Kr),color:[0,0,0],thickness:r(this,Kr)?0:n});return this.addComment(a),t?(a.paths={lines:s,points:i},a.uuid=r(this,Go),a.isCopy=!0):a.lines=s,r(this,tn)&&(a.accessibilityData={type:"Figure",alt:r(this,tn)}),a}static deserializeDraw(t,s,i,n,a,o){return o.areContours?sm.deserialize(t,s,i,n,a,o):yu.deserialize(t,s,i,n,a,o)}static async deserialize(t,s,i){var a;const n=await super.deserialize(t,s,i);return g(n,Kr,t.areContours),n.description=((a=t.accessibilityData)==null?void 0:a.alt)||"",g(n,Go,t.uuid),n}};Kr=new WeakMap,tn=new WeakMap,Jr=new WeakMap,Go=new WeakMap,O(ms,"_type","signature"),O(ms,"_editorType",nt.SIGNATURE),O(ms,"_defaultDrawingOptions",null);let om=ms;var Gt,xe,Qr,jn,Zr,Dh,Gn,Vo,en,Rs,kh,mt,mc,vc,df,uf,ff,hm,pf,jb;class lm extends Dt{constructor(t){super({...t,name:"stampEditor"});y(this,mt);y(this,Gt,null);y(this,xe,null);y(this,Qr,null);y(this,jn,null);y(this,Zr,null);y(this,Dh,"");y(this,Gn,null);y(this,Vo,!1);y(this,en,null);y(this,Rs,!1);y(this,kh,!1);g(this,jn,t.bitmapUrl),g(this,Zr,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,s){Dt.initialize(t,s)}static isHandlingMimeForPasting(t){return Mp.includes(t)}static paste(t,s){s.pasteEditor({mode:nt.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const s=t.get("hasAltText");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}async mlGuessAltText(t=null,s=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:n,width:a,height:o}=t||this.copyCanvas(null,null,!0).imageData,l=await i.guess({name:"altText",request:{data:n,width:a,height:o,channels:n.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const h=l.output;return await this.setGuessedAltText(h),s&&!this.hasAltTextData()&&(this.altTextData={alt:h,decorative:!1}),h}remove(){var t;r(this,xe)&&(g(this,Gt,null),this._uiManager.imageManager.deleteId(r(this,xe)),(t=r(this,Gn))==null||t.remove(),g(this,Gn,null),r(this,en)&&(clearTimeout(r(this,en)),g(this,en,null))),super.remove()}rebuild(){if(!this.parent){r(this,xe)&&b(this,mt,df).call(this);return}super.rebuild(),this.div!==null&&(r(this,xe)&&r(this,Gn)===null&&b(this,mt,df).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(r(this,Qr)||r(this,Gt)||r(this,jn)||r(this,Zr)||r(this,xe)||r(this,Vo))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,s;return this._isCopy&&(t=this.x,s=this.y),super.render(),this.div.hidden=!0,this.createAltText(),r(this,Vo)||(r(this,Gt)?b(this,mt,uf).call(this):b(this,mt,df).call(this)),this._isCopy&&this._moveAfterPaste(t,s),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,s){const{id:i,bitmap:n}=this._uiManager.imageManager.getFromCanvas(t,s);s.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(g(this,xe,i),n&&g(this,Gt,n),g(this,Vo,!1),b(this,mt,uf).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;r(this,en)!==null&&clearTimeout(r(this,en)),g(this,en,setTimeout(()=>{g(this,en,null),b(this,mt,hm).call(this)},200))}copyCanvas(t,s,i=!1){t||(t=224);const{width:n,height:a}=r(this,Gt),o=new xi;let l=r(this,Gt),h=n,c=a,u=null;if(s){if(n>s||a>s){const P=Math.min(s/n,s/a);h=Math.floor(n*P),c=Math.floor(a*P)}u=document.createElement("canvas");const p=u.width=Math.ceil(h*o.sx),m=u.height=Math.ceil(c*o.sy);r(this,Rs)||(l=b(this,mt,ff).call(this,p,m));const v=u.getContext("2d");v.filter=this._uiManager.hcmFilter;let A="white",w="#cfcfd8";this._uiManager.hcmFilter!=="none"?w="black":vA.isDarkMode&&(A="#8f8f9d",w="#42414d");const S=15,x=S*o.sx,C=S*o.sy,E=new OffscreenCanvas(x*2,C*2),T=E.getContext("2d");T.fillStyle=A,T.fillRect(0,0,x*2,C*2),T.fillStyle=w,T.fillRect(0,0,x,C),T.fillRect(x,C,x,C),v.fillStyle=v.createPattern(E,"repeat"),v.fillRect(0,0,p,m),v.drawImage(l,0,0,l.width,l.height,0,0,p,m)}let f=null;if(i){let p,m;if(o.symmetric&&l.width<t&&l.height<t)p=l.width,m=l.height;else if(l=r(this,Gt),n>t||a>t){const w=Math.min(t/n,t/a);p=Math.floor(n*w),m=Math.floor(a*w),r(this,Rs)||(l=b(this,mt,ff).call(this,p,m))}const A=new OffscreenCanvas(p,m).getContext("2d",{willReadFrequently:!0});A.drawImage(l,0,0,l.width,l.height,0,0,p,m),f={width:p,height:m,data:A.getImageData(0,0,p,m).data}}return{canvas:u,width:h,height:c,imageData:f}}static async deserialize(t,s,i){var A;let n=null,a=!1;if(t instanceof lb){const{data:{rect:w,rotation:S,id:x,structParent:C,popupRef:E,richText:T,contentsObj:P,creationDate:M,modificationDate:I},container:D,parent:{page:{pageNumber:R}},canvas:U}=t;let B,N;U?(delete t.canvas,{id:B,bitmap:N}=i.imageManager.getFromCanvas(D.id,U),U.remove()):(a=!0,t._hasNoCanvas=!0);const W=((A=await s._structTree.getAriaAttributes(`${hl}${x}`))==null?void 0:A.get("aria-label"))||"";n=t={annotationType:nt.STAMP,bitmapId:B,bitmap:N,pageIndex:R-1,rect:w.slice(0),rotation:S,annotationElementId:x,id:x,deleted:!1,accessibilityData:{decorative:!1,altText:W},isSvg:!1,structParent:C,popupRef:E,richText:T,comment:(P==null?void 0:P.str)||null,creationDate:M,modificationDate:I}}const o=await super.deserialize(t,s,i),{rect:l,bitmap:h,bitmapUrl:c,bitmapId:u,isSvg:f,accessibilityData:p}=t;a?(i.addMissingCanvas(t.id,o),g(o,Vo,!0)):u&&i.imageManager.isValidId(u)?(g(o,xe,u),h&&g(o,Gt,h)):g(o,jn,c),g(o,Rs,f);const[m,v]=o.pageDimensions;return o.width=(l[2]-l[0])/m,o.height=(l[3]-l[1])/v,p&&(o.altTextData=p),o._initialData=n,t.comment&&o.setCommentData(t),g(o,kh,!!n),o}serialize(t=!1,s=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=Object.assign(super.serialize(t),{bitmapId:r(this,xe),isSvg:r(this,Rs)});if(this.addComment(i),t)return i.bitmapUrl=b(this,mt,pf).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:n,altText:a}=this.serializeAltText(!1);if(!n&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=b(this,mt,jb).call(this,i);return l.isSame?null:(l.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1,i.id=this.annotationElementId,delete i.bitmapId,i)}if(s===null)return i;s.stamps||(s.stamps=new Map);const o=r(this,Rs)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(r(this,xe)))s.stamps.set(r(this,xe),{area:o,serialized:i}),i.bitmap=b(this,mt,pf).call(this,!1);else if(r(this,Rs)){const l=s.stamps.get(r(this,xe));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=b(this,mt,pf).call(this,!1))}return i}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}Gt=new WeakMap,xe=new WeakMap,Qr=new WeakMap,jn=new WeakMap,Zr=new WeakMap,Dh=new WeakMap,Gn=new WeakMap,Vo=new WeakMap,en=new WeakMap,Rs=new WeakMap,kh=new WeakMap,mt=new WeakSet,mc=function(t,s=!1){if(!t){this.remove();return}g(this,Gt,t.bitmap),s||(g(this,xe,t.id),g(this,Rs,t.isSvg)),t.file&&g(this,Dh,t.file.name),b(this,mt,uf).call(this)},vc=function(){if(g(this,Qr,null),this._uiManager.enableWaiting(!1),!!r(this,Gn)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Gt)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&r(this,Gt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},df=function(){if(r(this,xe)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(r(this,xe)).then(i=>b(this,mt,mc).call(this,i,!0)).finally(()=>b(this,mt,vc).call(this));return}if(r(this,jn)){const i=r(this,jn);g(this,jn,null),this._uiManager.enableWaiting(!0),g(this,Qr,this._uiManager.imageManager.getFromUrl(i).then(n=>b(this,mt,mc).call(this,n)).finally(()=>b(this,mt,vc).call(this)));return}if(r(this,Zr)){const i=r(this,Zr);g(this,Zr,null),this._uiManager.enableWaiting(!0),g(this,Qr,this._uiManager.imageManager.getFromFile(i).then(n=>b(this,mt,mc).call(this,n)).finally(()=>b(this,mt,vc).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=Mp.join(",");const s=this._uiManager._signal;g(this,Qr,new Promise(i=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const n=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),b(this,mt,mc).call(this,n)}i()},{signal:s}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>b(this,mt,vc).call(this))),t.click()},uf=function(){var h;const{div:t}=this;let{width:s,height:i}=r(this,Gt);const[n,a]=this.pageDimensions,o=.75;if(this.width)s=this.width*n,i=this.height*a;else if(s>o*n||i>o*a){const c=Math.min(o*n/s,o*a/i);s*=c,i*=c}this._uiManager.enableWaiting(!1);const l=g(this,Gn,document.createElement("canvas"));l.setAttribute("role","img"),this.addContainer(l),this.width=s/n,this.height=i/a,this.setDims(),(h=this._initialOptions)!=null&&h.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),b(this,mt,hm).call(this),r(this,kh)||(this.parent.addUndoableEditor(this),g(this,kh,!0)),this._reportTelemetry({action:"inserted_image"}),r(this,Dh)&&this.div.setAttribute("aria-description",r(this,Dh)),this.annotationElementId||this._uiManager.a11yAlert(Dt._l10nAlert.stamp)},ff=function(t,s){const{width:i,height:n}=r(this,Gt);let a=i,o=n,l=r(this,Gt);for(;a>2*t||o>2*s;){const h=a,c=o;a>2*t&&(a=Math.ceil(a/2)),o>2*s&&(o=Math.ceil(o/2));const u=new OffscreenCanvas(a,o);u.getContext("2d").drawImage(l,0,0,h,c,0,0,a,o),l=u.transferToImageBitmap()}return l},hm=function(){const[t,s]=this.parentDimensions,{width:i,height:n}=this,a=new xi,o=Math.ceil(i*t*a.sx),l=Math.ceil(n*s*a.sy),h=r(this,Gn);if(!h||h.width===o&&h.height===l)return;h.width=o,h.height=l;const c=r(this,Rs)?r(this,Gt):b(this,mt,ff).call(this,o,l),u=h.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(c,0,0,c.width,c.height,0,0,o,l)},pf=function(t){if(t){if(r(this,Rs)){const n=this._uiManager.imageManager.getSvgUrl(r(this,xe));if(n)return n}const s=document.createElement("canvas");return{width:s.width,height:s.height}=r(this,Gt),s.getContext("2d").drawImage(r(this,Gt),0,0),s.toDataURL()}if(r(this,Rs)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*ha.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*ha.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(n,a);return o.getContext("2d").drawImage(r(this,Gt),0,0,r(this,Gt).width,r(this,Gt).height,0,0,n,a),o.transferToImageBitmap()}return structuredClone(r(this,Gt))},jb=function(t){var o;const{pageIndex:s,accessibilityData:{altText:i}}=this._initialData,n=t.pageIndex===s,a=(((o=t.accessibilityData)==null?void 0:o.alt)||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&n&&a,isSameAltText:a}},O(lm,"_type","stamp"),O(lm,"_editorType",nt.STAMP);var zo,Fh,qr,ta,Vn,us,ea,Lh,Nh,wi,zn,fs,Wn,sa,Bh,X,ia,Ft,dm,Gb,Oi,um,fm,gf;const oi=class oi{constructor({uiManager:e,pageIndex:t,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:a,drawLayer:o,textLayer:l,viewport:h,l10n:c}){y(this,Ft);y(this,zo);y(this,Fh,!1);y(this,qr,null);y(this,ta,null);y(this,Vn,null);y(this,us,new Map);y(this,ea,!1);y(this,Lh,!1);y(this,Nh,!1);y(this,wi,null);y(this,zn,null);y(this,fs,null);y(this,Wn,null);y(this,sa,null);y(this,Bh,-1);y(this,X);const u=[...r(oi,ia).values()];if(!oi._initialized){oi._initialized=!0;for(const f of u)f.initialize(c,e)}e.registerEditorTypes(u),g(this,X,e),this.pageIndex=t,this.div=s,g(this,zo,n),g(this,qr,a),this.viewport=h,g(this,fs,l),this.drawLayer=o,this._structTree=i,r(this,X).addLayer(this)}get isEmpty(){return r(this,us).size===0}get isInvisible(){return this.isEmpty&&r(this,X).getMode()===nt.NONE}updateToolbar(e){r(this,X).updateToolbar(e)}updateMode(e=r(this,X).getMode()){switch(b(this,Ft,gf).call(this),e){case nt.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case nt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case nt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;if(t.toggle("nonEditing",!1),e===nt.POPUP)t.toggle("commentEditing",!0);else{t.toggle("commentEditing",!1);for(const s of r(oi,ia).values())t.toggle(`${s._type}Editing`,e===s._editorType)}this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=r(this,fs))==null?void 0:t.div)}setEditingState(e){r(this,X).setEditingState(e)}addCommands(e){r(this,X).addCommands(e)}cleanUndoStack(e){r(this,X).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=r(this,qr))==null||t.togglePointerEvents(e)}async enable(){var s;g(this,Nh,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(s=r(this,sa))==null||s.abort(),g(this,sa,null);const e=new Set;for(const i of r(this,Ft,dm))i.enableEditing(),i.show(!0),i.annotationElementId&&(r(this,X).removeChangedExistingAnnotation(i),e.add(i.annotationElementId));const t=r(this,qr);if(t)for(const i of t.getEditableAnnotations()){if(i.hide(),r(this,X).isDeletedAnnotationElement(i.data.id)||e.has(i.data.id))continue;const n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}g(this,Nh,!1),r(this,X)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var i;if(g(this,Lh,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),r(this,fs)&&!r(this,sa)){g(this,sa,new AbortController);const n=r(this,X).combinedSignal(r(this,sa));r(this,fs).div.addEventListener("pointerdown",a=>{const{clientX:l,clientY:h,timeStamp:c}=a,u=r(this,Bh);if(c-u>500){g(this,Bh,c);return}g(this,Bh,-1);const{classList:f}=this.div;f.toggle("getElements",!0);const p=document.elementsFromPoint(l,h);if(f.toggle("getElements",!1),!this.div.contains(p[0]))return;let m;const v=new RegExp(`^${_h}[0-9]+$`);for(const w of p)if(v.test(w.id)){m=w.id;break}if(!m)return;const A=r(this,us).get(m);(A==null?void 0:A.annotationElementId)===null&&(me(a),A.dblclick(a))},{signal:n,capture:!0})}const e=r(this,qr),t=[];if(e){const n=new Map,a=new Map;for(const o of r(this,Ft,dm)){if(o.disableEditing(),!o.annotationElementId){t.push(o);continue}if(o.serialize()!==null){n.set(o.annotationElementId,o);continue}else a.set(o.annotationElementId,o);(i=this.getEditableAnnotation(o.annotationElementId))==null||i.show(),o.remove()}for(const o of e.getEditableAnnotations()){const{id:l}=o.data;if(r(this,X).isDeletedAnnotationElement(l)){o.updateEdited({deleted:!0});continue}let h=a.get(l);if(h){h.resetAnnotationElement(o),h.show(!1),o.show();continue}h=n.get(l),h&&(r(this,X).addChangedExistingAnnotation(h),h.renderAnnotationElement(o)&&h.show(!1)),o.show()}}b(this,Ft,gf).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of r(oi,ia).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),e==null||e.updateFakeAnnotations(t),g(this,Lh,!1)}getEditableAnnotation(e){var t;return((t=r(this,qr))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){r(this,X).getActive()!==e&&r(this,X).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=r(this,fs))!=null&&e.div&&!r(this,Wn)){g(this,Wn,new AbortController);const t=r(this,X).combinedSignal(r(this,Wn));r(this,fs).div.addEventListener("pointerdown",b(this,Ft,Gb).bind(this),{signal:t}),r(this,fs).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=r(this,fs))!=null&&e.div&&r(this,Wn)&&(r(this,Wn).abort(),g(this,Wn,null),r(this,fs).div.classList.remove("highlighting"))}enableClick(){if(r(this,ta))return;g(this,ta,new AbortController);const e=r(this,X).combinedSignal(r(this,ta));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){var e;(e=r(this,ta))==null||e.abort(),g(this,ta,null)}attach(e){r(this,us).set(e.id,e);const{annotationElementId:t}=e;t&&r(this,X).isDeletedAnnotationElement(t)&&r(this,X).removeDeletedAnnotationElement(e)}detach(e){var t;r(this,us).delete(e.id),(t=r(this,zo))==null||t.removePointerInTextLayer(e.contentDiv),!r(this,Lh)&&e.annotationElementId&&r(this,X).addDeletedAnnotationElement(e)}remove(e){this.detach(e),r(this,X).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(r(this,X).addDeletedAnnotationElement(e),Dt.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),r(this,X).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!r(this,Nh)),r(this,X).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var s;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!r(this,Vn)&&(e._focusEventsAllowed=!1,g(this,Vn,setTimeout(()=>{g(this,Vn,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:r(this,X)._signal}),t.focus())},0))),e._structTreeParentId=(s=r(this,zo))==null?void 0:s.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),s=()=>{e.remove()};this.addCommands({cmd:t,undo:s,mustExec:!1})}getEditorByUID(e){for(const t of r(this,us).values())if(t.uid===e)return t;return null}combinedSignal(e){return r(this,X).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=r(this,Ft,Oi))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await r(this,X).updateMode(e.mode);const{offsetX:s,offsetY:i}=b(this,Ft,fm).call(this),n=r(this,X).getId(),a=b(this,Ft,um).call(this,{parent:this,id:n,x:s,y:i,uiManager:r(this,X),isCentered:!0,...t});a&&this.add(a)}async deserialize(e){var t;return await((t=r(oi,ia).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,r(this,X)))||null}createAndAddNewEditor(e,t,s={}){const i=r(this,X).getId(),n=b(this,Ft,um).call(this,{parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:r(this,X),isCentered:t,...s});return n&&this.add(n),n}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(e={}){this.createAndAddNewEditor(b(this,Ft,fm).call(this),!0,e)}setSelected(e){r(this,X).setSelected(e)}toggleSelected(e){r(this,X).toggleSelected(e)}unselect(e){r(this,X).unselect(e)}pointerup(e){var i;const{isMac:t}=Mt.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!r(this,ea)||(g(this,ea,!1),(i=r(this,Ft,Oi))!=null&&i.isDrawer&&r(this,Ft,Oi).supportMultipleDrawings))return;if(!r(this,Fh)){g(this,Fh,!0);return}const s=r(this,X).getMode();if(s===nt.STAMP||s===nt.POPUP||s===nt.SIGNATURE){r(this,X).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var i;if(r(this,X).getMode()===nt.HIGHLIGHT&&this.enableTextSelection(),r(this,ea)){g(this,ea,!1);return}const{isMac:t}=Mt.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(g(this,ea,!0),(i=r(this,Ft,Oi))!=null&&i.isDrawer){this.startDrawingSession(e);return}const s=r(this,X).getActive();g(this,Fh,!s||s.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),r(this,wi)){r(this,Ft,Oi).startDrawing(this,r(this,X),!1,e);return}r(this,X).setCurrentDrawingSession(this),g(this,wi,new AbortController);const t=r(this,X).combinedSignal(r(this,wi));this.div.addEventListener("blur",({relatedTarget:s})=>{s&&!this.div.contains(s)&&(g(this,zn,null),this.commitOrRemove())},{signal:t}),r(this,Ft,Oi).startDrawing(this,r(this,X),!1,e)}pause(e){if(e){const{activeElement:t}=document;this.div.contains(t)&&g(this,zn,t);return}r(this,zn)&&setTimeout(()=>{var t;(t=r(this,zn))==null||t.focus(),g(this,zn,null)},0)}endDrawingSession(e=!1){return r(this,wi)?(r(this,X).setCurrentDrawingSession(null),r(this,wi).abort(),g(this,wi,null),g(this,zn,null),r(this,Ft,Oi).endDrawing(e)):null}findNewParent(e,t,s){const i=r(this,X).findParent(t,s);return i===null||i===this?!1:(i.changeParent(e),!0)}commitOrRemove(){return r(this,wi)?(this.endDrawingSession(),!0):!1}onScaleChanging(){r(this,wi)&&r(this,Ft,Oi).onScaleChangingWhenDrawing(this)}destroy(){var e,t;this.commitOrRemove(),((e=r(this,X).getActive())==null?void 0:e.parent)===this&&(r(this,X).commitOrRemove(),r(this,X).setActiveEditor(null)),r(this,Vn)&&(clearTimeout(r(this,Vn)),g(this,Vn,null));for(const s of r(this,us).values())(t=r(this,zo))==null||t.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,r(this,us).clear(),r(this,X).removeLayer(this)}async render({viewport:e}){this.viewport=e,Yo(this.div,e);for(const t of r(this,X).getEditors(this.pageIndex))this.add(t),t.rebuild();await r(this,X).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:e}){r(this,X).commitOrRemove(),b(this,Ft,gf).call(this);const t=this.viewport.rotation,s=e.rotation;if(this.viewport=e,Yo(this.div,{rotation:s}),t!==s)for(const i of r(this,us).values())i.rotate(s)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return r(this,X).viewParameters.realScale}};zo=new WeakMap,Fh=new WeakMap,qr=new WeakMap,ta=new WeakMap,Vn=new WeakMap,us=new WeakMap,ea=new WeakMap,Lh=new WeakMap,Nh=new WeakMap,wi=new WeakMap,zn=new WeakMap,fs=new WeakMap,Wn=new WeakMap,sa=new WeakMap,Bh=new WeakMap,X=new WeakMap,ia=new WeakMap,Ft=new WeakSet,dm=function(){return r(this,us).size!==0?r(this,us).values():r(this,X).getEditors(this.pageIndex)},Gb=function(e){r(this,X).unselectAll();const{target:t}=e;if(t===r(this,fs).div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent")||t.classList.contains("textLayerImages")||t.classList.contains("textLayerImagePlaceholder"))&&r(this,fs).div.contains(t)){const{isMac:s}=Mt.platform;if(e.button!==0||e.ctrlKey&&s)return;r(this,X).showAllEditors("highlight",!0,!0),Tf.startDrawing(this,r(this,X),r(this,X).direction==="ltr",e),e.preventDefault()}},Oi=function(){return r(oi,ia).get(r(this,X).getMode())},um=function(e){const t=r(this,Ft,Oi);return t?new t.prototype.constructor(e):null},fm=function(){const{x:e,y:t,width:s,height:i}=this.boundingClientRect,n=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+s),l=Math.min(window.innerHeight,t+i),h=(n+o)/2-e,c=(a+l)/2-t,[u,f]=this.viewport.rotation%180===0?[h,c]:[c,h];return{offsetX:u,offsetY:f}},gf=function(){for(const e of r(this,us).values())e.isEmpty()&&e.remove()},O(oi,"_initialized",!1),y(oi,ia,new Map([_g,em,lm,Tf,om].map(e=>[e._editorType,e])));let cm=oi;ot(1806);function hw(d,e){return d===e?0:d.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Pu(d){var e;return d?d.nodeType===Node.ELEMENT_NODE?d.closest(".textLayer"):((e=d.parentElement)==null?void 0:e.closest(".textLayer"))||null:null}function cw(d,e,t,s){if(d===t)return e<=s;const i=d.compareDocumentPosition(t);return i&Node.DOCUMENT_POSITION_FOLLOWING?!0:i&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function xv(d,e,t){if(d.nodeType!==Node.ELEMENT_NODE||!d.classList.contains("textLayer")||e!==d.childNodes.length)return{container:d,offset:e};let s=d.lastChild;return(s==null?void 0:s.nodeType)===Node.ELEMENT_NODE&&s.classList.contains("endOfContent")&&(s=s.previousSibling),!s||!t.contains(s)?null:s.nodeType===Node.TEXT_NODE?{container:s,offset:s.textContent.length}:{container:s,offset:s.childNodes.length}}var qe,ts,ei,hu,cu,Wo,Xo,du,Qf,na,ra,aa,oa,Xn,ze,gm,mm,Vb,mf,zb,on,vm,Wb,ym;const J=class J{constructor({filterFactory:e=null,pageColors:t=null,pageIndex:s,textLayer:i=null}){y(this,on);y(this,qe,null);y(this,ts,new Map);y(this,ei,null);y(this,hu,null);y(this,cu,null);y(this,Wo,null);y(this,Xo,new Map);if(this.pageIndex=s,g(this,hu,e),g(this,cu,t),i){const n=r(J,Xn).get(i);if(n!=null&&n.selectionDiv&&(n.selectionDiv.remove(),r(J,ra).delete(n.selectionDiv)),r(J,Xn).set(i,{drawLayer:this}),r(J,oa).add(i),g(this,ei,i),g(this,Wo,new MutationObserver(a=>{var o,l,h;if(!(!r(this,qe)||!((o=r(this,ei))!=null&&o.isConnected)||!b(l=J,ze,mm).call(l))){for(const{addedNodes:c}of a)for(const u of c)if(u.nodeType===Node.ELEMENT_NODE&&u.classList.contains("endOfContent")){b(h=J,ze,mf).call(h);return}}})),r(this,Wo).observe(i,{childList:!0}),r(J,na)===null){g(J,na,new AbortController);const{signal:a}=r(J,na);document.addEventListener("selectionchange",b(J,ze,mf).bind(J),{signal:a}),document.addEventListener("pointerdown",()=>{g(J,aa,!0)},{signal:a}),document.addEventListener("pointerup",()=>{g(J,aa,!1)},{signal:a}),window.addEventListener("blur",()=>{g(J,aa,!1)},{signal:a})}}}setParent(e){var t,s,i;if(!r(this,qe)){g(this,qe,e),(t=r(this,ei))!=null&&t.isConnected&&b(s=J,ze,mm).call(s)&&b(i=J,ze,mf).call(i);return}if(r(this,qe)!==e){if(r(this,ts).size>0)for(const n of r(this,ts).values())n.remove(),e.append(n);g(this,qe,e)}}static get _svgFactory(){return Q(this,"_svgFactory",new Ef)}draw(e,t=!1,s=!1){const i=Xt(J,du)._++,n=b(this,on,vm).call(this),a=J._svgFactory.createElement("defs");n.append(a);const o=J._svgFactory.createElement("path");a.append(o);const l=`path_${i}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),t&&r(this,Xo).set(i,o);const h=s?b(this,on,Wb).call(this,a,l):null,c=J._svgFactory.createElement("use");return n.append(c),c.setAttribute("href",`#${l}`),this.updateProperties(n,e),r(this,ts).set(i,n),{id:i,clipPathId:`url(#${h})`}}drawOutline(e,t){const s=Xt(J,du)._++,i=b(this,on,vm).call(this),n=J._svgFactory.createElement("defs");i.append(n);const a=J._svgFactory.createElement("path");n.append(a);const o=`path_${s}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(t){const u=J._svgFactory.createElement("mask");n.append(u),l=`mask_${s}`,u.setAttribute("id",l),u.setAttribute("maskUnits","objectBoundingBox");const f=J._svgFactory.createElement("rect");u.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const p=J._svgFactory.createElement("use");u.append(p),p.setAttribute("href",`#${o}`),p.setAttribute("stroke","none"),p.setAttribute("fill","black"),p.setAttribute("fill-rule","nonzero"),p.classList.add("mask")}const h=J._svgFactory.createElement("use");i.append(h),h.setAttribute("href",`#${o}`),l&&h.setAttribute("mask",`url(#${l})`);const c=h.cloneNode();return i.append(c),h.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(i,e),r(this,ts).set(s,i),s}finalizeDraw(e,t){r(this,Xo).delete(e),this.updateProperties(e,t)}updateProperties(e,t){var l;if(!t)return;const{root:s,bbox:i,rootClass:n,path:a}=t,o=typeof e=="number"?r(this,ts).get(e):e;if(o){if(s&&b(this,on,ym).call(this,o,s),i&&b(l=J,ze,zb).call(l,o,i),n){const{classList:h}=o;for(const[c,u]of Object.entries(n))h.toggle(c,u)}if(a){const c=o.firstElementChild.firstElementChild;b(this,on,ym).call(this,c,a)}}}updateParent(e,t){if(t===this)return;const s=r(this,ts).get(e);s&&(r(t,qe).append(s),r(this,ts).delete(e),r(t,ts).set(e,s))}remove(e){r(this,Xo).delete(e),r(this,qe)!==null&&(r(this,ts).get(e).remove(),r(this,ts).delete(e))}destroy(){var e,t,s;g(this,qe,null);for(const i of r(this,ts).values())i.remove();if(r(this,ts).clear(),r(this,Xo).clear(),(e=r(this,Wo))==null||e.disconnect(),g(this,Wo,null),r(this,ei)){const i=r(J,Xn).get(r(this,ei));(i==null?void 0:i.drawLayer)===this&&(b(t=J,ze,gm).call(t,r(this,ei)),r(J,Xn).delete(r(this,ei)),r(J,oa).delete(r(this,ei)),r(J,oa).size===0&&((s=r(J,na))==null||s.abort(),g(J,na,null),g(J,aa,!1))),g(this,ei,null)}}};qe=new WeakMap,ts=new WeakMap,ei=new WeakMap,hu=new WeakMap,cu=new WeakMap,Wo=new WeakMap,Xo=new WeakMap,du=new WeakMap,Qf=new WeakMap,na=new WeakMap,ra=new WeakMap,aa=new WeakMap,oa=new WeakMap,Xn=new WeakMap,ze=new WeakSet,gm=function(e){const t=r(this,Xn).get(e);t!=null&&t.selectionDiv&&(t.selectionDiv.remove(),r(this,ra).delete(t.selectionDiv),t.selectionDiv=null,t.path=null)},mm=function(){const e=document.getSelection();return!!e&&!e.isCollapsed},Vb=function(){return r(this,oa).keys().filter(e=>e.isConnected).toArray().sort(hw)},mf=function(){var a;const e=document.getSelection();if(!e||e.isCollapsed){for(const o of r(this,ra))o.remove();r(this,ra).clear();return}const t=new WeakMap,s=b(this,ze,Vb).call(this),i=[];for(let o=0,l=e.rangeCount;o<l;o++){const h=e.getRangeAt(o);if(h.collapsed)continue;let{startContainer:c,startOffset:u,endContainer:f,endOffset:p}=h,m=Pu(c),v=Pu(f);const A=m===null,w=v===null;if(r(this,aa)&&A!==w)return;if(e.rangeCount===1){const{anchorNode:C,anchorOffset:E,focusNode:T,focusOffset:P}=e,M=Pu(C),I=Pu(T),D=cw(C,E,T,P);M&&I&&D!==null&&(D?(c=C,u=E,m=M,f=T,p=P,v=I):(c=T,u=P,m=I,f=C,p=E,v=M))}const S=s.filter(C=>h.intersectsNode(C));if(S.length===0)continue;let x=!1;if(m||(m=S[0],c=m,u=0,x=!0),v||(v=S.at(-1),f=v,p=v.childNodes.length,x=!0),f.nodeType===Node.ELEMENT_NODE){if(f.classList.contains("endOfContent")){const C=f.previousSibling;if(!C)continue;f=C,p=C.nodeType===Node.TEXT_NODE?C.textContent.length:C.childNodes.length}else if(f.classList.contains("textLayer")&&f.childNodes.length===p){const C=xv(f,p,v);if(!C)continue;f=C.container,p=C.offset}}if(c.nodeType===Node.ELEMENT_NODE){const C=xv(c,u,m);if(!C)continue;c=C.container,u=C.offset}if(m===v&&!x&&S.includes(m)){i.push([h,m]);continue}for(const C of S){const E=C.firstChild;if(!E)continue;const T=document.createRange();if(C===m?T.setStart(c,u):T.setStartBefore(E),C===v)T.setEnd(f,p);else{const P=C.lastChild;if(!P)continue;if(P.nodeType===Node.ELEMENT_NODE&&P.classList.contains("endOfContent")){const M=P.previousSibling;if(!M)continue;T.setEndAfter(M)}else T.setEndAfter(P)}T.collapsed||i.push([T,C])}}const n=new Set(i.map(o=>o[1]));for(const o of r(this,oa))n.has(o)||b(this,ze,gm).call(this,o);for(const[o,l]of i){const h=r(J,Xn).get(l);if(!h)continue;let c=t.get(l);if(!c){const v=l.getBoundingClientRect();c=(A,w,S,x)=>({x:(A-v.x)/v.width,y:(w-v.y)/v.height,width:S/v.width,height:x/v.height}),t.set(l,c)}const u=[];for(let{x:v,y:A,width:w,height:S}of o.getClientRects())w===0||S===0||({x:v,y:A,width:w,height:S}=c(v,A,w,S),!(w===1&&S===1)&&u.push(`M${v} ${A} h${w} v${S} h-${w} Z`));if(u.length===0)continue;const f=h.drawLayer;let p=h.selectionDiv,m=h.path;if(!p){const v=`clip_selection_${Xt(J,Qf)._++}`;p=document.createElement("div"),p.className="selection",p.style.clipPath=`url(#${v})`;const A=(a=r(f,hu))==null?void 0:a.createSelectionStyle(r(f,cu));if(A)for(const[x,C]of Object.entries(A))p.style.setProperty(x,C);const w=J._svgFactory.create(1,1,!0);w.setAttribute("aria-hidden","true"),w.setAttribute("width","100%"),w.setAttribute("height","100%");const S=J._svgFactory.createElement("clipPath");S.setAttribute("id",v),S.setAttribute("clipPathUnits","objectBoundingBox"),m=J._svgFactory.createElement("path"),S.append(m),w.append(S),p.append(w),h.path=m,h.selectionDiv=p}r(f,qe)&&p.parentNode!==r(f,qe)&&(r(f,qe).append(p),r(this,ra).add(p)),m.setAttribute("d",u.join(" "))}},zb=function(e,[t,s,i,n]){const{style:a}=e;a.top=`${100*s}%`,a.left=`${100*t}%`,a.width=`${100*i}%`,a.height=`${100*n}%`},on=new WeakSet,vm=function(){const e=J._svgFactory.create(1,1,!0);return r(this,qe).append(e),e.setAttribute("aria-hidden","true"),e},Wb=function(e,t){const s=J._svgFactory.createElement("clipPath");e.append(s);const i=`clip_${t}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=J._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${t}`),n.classList.add("clip"),i},ym=function(e,t){for(const[s,i]of Object.entries(t))i===null?e.removeAttribute(s):e.setAttribute(s,i)},y(J,ze),y(J,du,0),y(J,Qf,0),y(J,na,null),y(J,ra,new Set),y(J,aa,!1),y(J,oa,new Set),y(J,Xn,new WeakMap);let pm=J;function Iu(d){return`${(d*100).toFixed(2)}%`}var Uh,uu,fu,Hh,sn,nn,pu,Zf,Xb;const wc=class wc{constructor(e,t,s,i){y(this,Zf);y(this,Uh,[]);y(this,uu,new Map);y(this,fu,null);y(this,Hh,0);y(this,sn,0);y(this,nn,0);g(this,Hh,e),g(this,Uh,t),g(this,sn,s.rawDims.pageWidth),g(this,nn,s.rawDims.pageHeight),g(this,fu,i)}render(){const e=document.createElement("div");e.className="textLayerImages";for(let t=0;t<r(this,Uh).length;t+=6){const s=b(this,Zf,Xb).call(this,r(this,Uh).subarray(t,t+6));s&&e.append(s)}return e.addEventListener("contextmenu",t=>{var w;if(!(t.target instanceof HTMLCanvasElement))return;const s=t.target,i=r(this,uu).get(s);if(!i)return;const n=(w=r(wc,pu))==null?void 0:w.deref();if(n===s)return;n&&(n.width=0,n.height=0),g(wc,pu,new WeakRef(s));const{inverseTransform:a,x1:o,y1:l,width:h,height:c}=i,u=r(this,fu).call(this),f=Math.ceil(o*u.width),p=Math.ceil(l*u.height),m=Math.floor((o+h/r(this,sn))*u.width),v=Math.floor((l+c/r(this,nn))*u.height);s.width=m-f,s.height=v-p;const A=s.getContext("2d");A.setTransform(...a),A.translate(-f,-p),A.drawImage(u,0,0)}),e}};Uh=new WeakMap,uu=new WeakMap,fu=new WeakMap,Hh=new WeakMap,sn=new WeakMap,nn=new WeakMap,pu=new WeakMap,Zf=new WeakSet,Xb=function([e,t,s,i,n,a]){const o=Math.hypot((n-e)*r(this,sn),(a-t)*r(this,nn)),l=Math.hypot((s-e)*r(this,sn),(i-t)*r(this,nn));if(o<r(this,Hh)||l<r(this,Hh))return null;const h=[(n-e)*r(this,sn)/o,(a-t)*r(this,nn)/o,(s-e)*r(this,sn)/l,(i-t)*r(this,nn)/l,0,0],c=_.inverseTransform(h),u=document.createElement("canvas");return u.className="textLayerImagePlaceholder",u.width=0,u.height=0,Object.assign(u.style,{opacity:0,position:"absolute",left:Iu(e),top:Iu(t),width:Iu(o/r(this,sn)),height:Iu(l/r(this,nn)),transformOrigin:"0% 0%",transform:`matrix(${h.join(",")})`}),r(this,uu).set(u,{inverseTransform:c,width:o,height:l,x1:e,y1:t}),u},y(wc,pu,null);let bm=wc;globalThis._pdfjsTestingUtils={HighlightOutliner:Kg};globalThis.pdfjsLib={AbortException:la,AnnotationEditorLayer:cm,AnnotationEditorParamsType:ft,AnnotationEditorType:nt,AnnotationEditorUIManager:Jo,AnnotationLayer:Hg,AnnotationMode:ir,AnnotationType:Yt,applyOpacity:bA,build:H0,ColorPicker:wf,createValidAbsoluteUrl:Pv,CSSConstants:yA,DOMSVGFactory:Ef,DrawLayer:pm,FeatureTest:Mt,fetchData:Sm,findContrastColor:AA,getDocument:F0,getFilenameFromUrl:pA,getPdfFilenameFromUrl:gA,getRGB:vu,getRGBA:mu,getUuid:Ov,GlobalWorkerOptions:Yn,ImageKind:Ou,InvalidPDFException:Cp,isDataScheme:ip,isPdfFile:xm,isValidExplicitDest:$A,makeArr:Gh,makeMap:Am,makeObj:Ip,makeSet:dA,MathClamp:_t,noContextMenu:Ei,normalizeUnicode:hA,OPS:Mi,OutputScale:xi,PasswordException:Tp,PasswordResponses:sA,PDFDataRangeTransport:Ky,PDFDateString:yf,PDFWorker:Cc,PermissionFlag:eA,PixelsPerInch:ha,RenderingCancelledException:Em,renderRichText:Mv,ResponseException:vf,setLayerDimensions:Yo,shadow:Q,SignatureExtractor:Kn,stopEvent:me,SupportedImageMimeTypes:Mp,TextLayer:Tc,TextLayerImages:bm,TouchManager:Zv,updateUrlHash:Iv,Util:_,VerbosityLevel:qf,version:U0,XfaLayer:wm};export{la as AbortException,cm as AnnotationEditorLayer,ft as AnnotationEditorParamsType,nt as AnnotationEditorType,Jo as AnnotationEditorUIManager,Hg as AnnotationLayer,ir as AnnotationMode,Yt as AnnotationType,yA as CSSConstants,wf as ColorPicker,Ef as DOMSVGFactory,pm as DrawLayer,Mt as FeatureTest,Yn as GlobalWorkerOptions,Ou as ImageKind,Cp as InvalidPDFException,_t as MathClamp,Mi as OPS,xi as OutputScale,Ky as PDFDataRangeTransport,yf as PDFDateString,Cc as PDFWorker,Tp as PasswordException,sA as PasswordResponses,eA as PermissionFlag,ha as PixelsPerInch,Em as RenderingCancelledException,vf as ResponseException,Kn as SignatureExtractor,Mp as SupportedImageMimeTypes,Tc as TextLayer,bm as TextLayerImages,Zv as TouchManager,_ as Util,qf as VerbosityLevel,wm as XfaLayer,bA as applyOpacity,H0 as build,Pv as createValidAbsoluteUrl,Sm as fetchData,AA as findContrastColor,F0 as getDocument,pA as getFilenameFromUrl,gA as getPdfFilenameFromUrl,vu as getRGB,mu as getRGBA,Ov as getUuid,ip as isDataScheme,xm as isPdfFile,$A as isValidExplicitDest,Gh as makeArr,Am as makeMap,Ip as makeObj,dA as makeSet,Ei as noContextMenu,hA as normalizeUnicode,Mv as renderRichText,Yo as setLayerDimensions,Q as shadow,me as stopEvent,Iv as updateUrlHash,U0 as version};