@kanorio/elements 1.2.0 → 1.3.0

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 (337) hide show
  1. package/README.md +1 -1
  2. package/dist/CustomerAccountPanel-FXJEOS4F.js +2 -0
  3. package/dist/CustomerAccountPanel-LK4GSYYU.js +2 -0
  4. package/dist/{FormAddressField-QR7ZCH77.js → FormAddressField-NH5LD6K7.js} +2 -2
  5. package/dist/{FormAddressField-C6VN7J6I.js → FormAddressField-Z5XT2ELO.js} +2 -2
  6. package/dist/FormFileField-5YFTKIRZ.js +2 -0
  7. package/dist/FormFileField-D2XIGIML.js +2 -0
  8. package/dist/{FormTaxIdField-K34MDUPW.js → FormTaxIdField-GGBQOVZE.js} +2 -2
  9. package/dist/{FormTaxIdField-XMK5WRQO.js → FormTaxIdField-XJSMW3II.js} +2 -2
  10. package/dist/KanorioAccount-GXRAMZCI.js +2 -0
  11. package/dist/KanorioAccount-P6IIPIZ2.js +2 -0
  12. package/dist/KanorioAnalytics-KYTK3T2L.js +2 -0
  13. package/dist/KanorioAnalytics-XHKBWYTS.js +2 -0
  14. package/dist/KanorioCurriculum-3TLNLUL4.js +2 -0
  15. package/dist/KanorioCurriculum-SQ4S3U5T.js +2 -0
  16. package/dist/KanorioForm-FDS5UKUT.js +2 -0
  17. package/dist/KanorioForm-K3H3YUQH.js +2 -0
  18. package/dist/KanorioLightbox-QPJQJLNO.js +2 -0
  19. package/dist/KanorioLightbox-WBMR7MLG.js +2 -0
  20. package/dist/KanorioLogin-JMHHBRU7.js +2 -0
  21. package/dist/KanorioLogin-QMPBTK55.js +2 -0
  22. package/dist/KanorioMedia-5P63OK4U.js +2 -0
  23. package/dist/KanorioMedia-LONTU7H2.js +2 -0
  24. package/dist/KanorioReviews-AAQ27MYU.js +2 -0
  25. package/dist/KanorioReviews-LUB4KF23.js +2 -0
  26. package/dist/KanorioUnit-ADFQ7POH.js +2 -0
  27. package/dist/KanorioUnit-YBKFHGLB.js +2 -0
  28. package/dist/{MediaPlayer-F43FPK4E.js → MediaPlayer-C5KI6N5V.js} +2 -2
  29. package/dist/{MediaPlayer-JHFZFOOG.js → MediaPlayer-PMAEZSCZ.js} +2 -2
  30. package/dist/{PDFViewerFull-INVHZL4V.js → PDFViewerFull-6MZJTHN2.js} +2 -2
  31. package/dist/{PDFViewerFull-CB44M7GW.js → PDFViewerFull-P3HCVGDZ.js} +2 -2
  32. package/dist/account.d.ts +3 -2
  33. package/dist/account.js +1 -1
  34. package/dist/analytics.js +1 -1
  35. package/dist/ar-JXAEXYYY.js +2 -0
  36. package/dist/ar-UXUCJCPY.js +2 -0
  37. package/dist/bg-EUIPVVBX.js +2 -0
  38. package/dist/bg-HEU3KGAJ.js +2 -0
  39. package/dist/{bn-BHRS66N3.js → bn-L35GOE5D.js} +2 -2
  40. package/dist/{bn-DM5WNGJ5.js → bn-LMQOF3SO.js} +2 -2
  41. package/dist/bot-protection.d.ts +67 -36
  42. package/dist/bot-protection.js +1 -1
  43. package/dist/chunk-2H3LTDAA.js +2 -0
  44. package/dist/chunk-3NXF6SCJ.js +2 -0
  45. package/dist/{chunk-EE4S6NRV.js → chunk-4OC7BRQS.js} +2 -2
  46. package/dist/{chunk-DTBRUBPG.js → chunk-56UUP6CI.js} +2 -2
  47. package/dist/{chunk-IAXVJLJ3.js → chunk-65RP744E.js} +2 -2
  48. package/dist/chunk-APWDEDWM.js +2 -0
  49. package/dist/{chunk-H7VP4BYY.js → chunk-CD7JDUB6.js} +2 -2
  50. package/dist/{chunk-4KA3HSRQ.js → chunk-CIVS7LYU.js} +2 -2
  51. package/dist/chunk-CMYBXWO5.js +3 -0
  52. package/dist/{chunk-WM5S3YN5.js → chunk-CTMHQZAU.js} +2 -2
  53. package/dist/chunk-D4KDA3KL.js +2 -0
  54. package/dist/{chunk-36YEGBKK.js → chunk-EGJ6SNTR.js} +2 -2
  55. package/dist/chunk-G5673RJK.js +3 -0
  56. package/dist/{chunk-2ONAW3CA.js → chunk-GWUOOGNK.js} +2 -2
  57. package/dist/{chunk-FQCA2VGY.js → chunk-HAHAYDYM.js} +2 -2
  58. package/dist/chunk-IDY2ZCXL.js +2 -0
  59. package/dist/{chunk-NGRNPVON.js → chunk-II7PVZWZ.js} +2 -2
  60. package/dist/chunk-J5SMJRYC.js +2 -0
  61. package/dist/{chunk-N5PIQM4L.js → chunk-KW2CH7SS.js} +2 -2
  62. package/dist/chunk-KYXZNMNA.js +2 -0
  63. package/dist/{chunk-QOQQCCID.js → chunk-L3BUSP27.js} +2 -2
  64. package/dist/{chunk-B7KLKVIM.js → chunk-L66F3USG.js} +2 -2
  65. package/dist/{chunk-NBDRYQZV.js → chunk-OLGITMLA.js} +2 -2
  66. package/dist/{chunk-BGVTMWPN.js → chunk-OWXGUUSI.js} +2 -2
  67. package/dist/chunk-Q4APVE7S.js +2 -0
  68. package/dist/chunk-QF55WZDP.js +2 -0
  69. package/dist/{chunk-4MOCTNN7.js → chunk-QRKYFFDH.js} +2 -2
  70. package/dist/chunk-QYTK2CW3.js +2 -0
  71. package/dist/chunk-R5M6FXXQ.js +2 -0
  72. package/dist/chunk-RI64PHGM.js +2 -0
  73. package/dist/chunk-RNRIZCZS.js +2 -0
  74. package/dist/chunk-RTF2NUMK.js +3 -0
  75. package/dist/chunk-SB5665ZK.js +2 -0
  76. package/dist/{chunk-5HWAL7VK.js → chunk-SGFVHVLE.js} +2 -2
  77. package/dist/{chunk-K4VRRKYJ.js → chunk-UDNUWN4W.js} +2 -2
  78. package/dist/{chunk-AF46NLXK.js → chunk-UITC3NFQ.js} +2 -2
  79. package/dist/chunk-VGQ2N7JH.js +2 -0
  80. package/dist/chunk-WJPCDZSL.js +2 -0
  81. package/dist/{chunk-LWRWKZBC.js → chunk-WKKPZXK3.js} +2 -2
  82. package/dist/{chunk-Z4OV6QHI.js → chunk-Y5JA6B5O.js} +2 -2
  83. package/dist/cs-LY4LE4NI.js +2 -0
  84. package/dist/cs-MGLMNU2K.js +2 -0
  85. package/dist/curriculum.d.ts +3 -2
  86. package/dist/curriculum.js +1 -1
  87. package/dist/da-LQTLZNBW.js +2 -0
  88. package/dist/da-X5HKEDEL.js +2 -0
  89. package/dist/de-M3M4VBDR.js +2 -0
  90. package/dist/de-Y5ELIZBU.js +2 -0
  91. package/dist/{deliverables-C5RD2ASE.js → deliverables-EOIAZFWB.js} +25 -25
  92. package/dist/{deliverables-BDS7WMBC.js → deliverables-NO5NEFRM.js} +2 -2
  93. package/dist/{el-SMBF7FG4.js → el-7YYYEHW6.js} +2 -2
  94. package/dist/{el-G2AWU43W.js → el-YZGS3PLP.js} +2 -2
  95. package/dist/elements.css +1 -1
  96. package/dist/en-AU-IUEA3YQP.js +2 -0
  97. package/dist/en-AU-RQ2DVIXE.js +2 -0
  98. package/dist/en-CA-OFK46Q44.js +2 -0
  99. package/dist/en-CA-QDP57WHG.js +2 -0
  100. package/dist/en-GB-URCOTEDK.js +2 -0
  101. package/dist/en-GB-VNG2IO2E.js +2 -0
  102. package/dist/en-JSBHSC4K.js +2 -0
  103. package/dist/en-MCRNEXQP.js +2 -0
  104. package/dist/en-US-5RT4SJ3V.js +2 -0
  105. package/dist/en-US-IWMVMSUT.js +2 -0
  106. package/dist/es-419-53Z5HI6Z.js +2 -0
  107. package/dist/es-419-JFUQ3D4V.js +2 -0
  108. package/dist/es-ES-BMD6JJEO.js +2 -0
  109. package/dist/es-ES-PBIVNTAT.js +2 -0
  110. package/dist/fa-57P7R77M.js +2 -0
  111. package/dist/{fa-OYP2Q5EV.js → fa-NE4XJTHW.js} +2 -2
  112. package/dist/fi-G5MG7VJ2.js +2 -0
  113. package/dist/fi-SCTIKRMX.js +2 -0
  114. package/dist/form.d.ts +393 -23
  115. package/dist/form.js +1 -1
  116. package/dist/{forms-answers-address-7P6EVFY5.js → forms-answers-address-5MXQYIH3.js} +2 -2
  117. package/dist/{forms-answers-address-IQV2Y56H.js → forms-answers-address-BGBI445K.js} +2 -2
  118. package/dist/{forms-answers-tax-id-WJD7K3PG.js → forms-answers-tax-id-3AYXCNP5.js} +2 -2
  119. package/dist/{forms-answers-tax-id-D4GOUC6N.js → forms-answers-tax-id-LSWOEHJ4.js} +2 -2
  120. package/dist/fr-CA-4X7URW4M.js +2 -0
  121. package/dist/fr-CA-RQDI3NIQ.js +2 -0
  122. package/dist/fr-FR-EDVHTVOW.js +2 -0
  123. package/dist/fr-FR-KGXOTINP.js +2 -0
  124. package/dist/{gu-BREQK3GJ.js → gu-7AJCL43I.js} +2 -2
  125. package/dist/{gu-RNCZTEOA.js → gu-QE53XIWR.js} +2 -2
  126. package/dist/he-UWYKIUPF.js +2 -0
  127. package/dist/he-VLGZUN42.js +2 -0
  128. package/dist/{hi-DKG5TPYX.js → hi-5M4U37GW.js} +2 -2
  129. package/dist/{hi-F7Y62LAZ.js → hi-KXKJMKZF.js} +2 -2
  130. package/dist/{hu-3Y5YEIFL.js → hu-JU7V3YQX.js} +2 -2
  131. package/dist/{hu-L6W5O2G5.js → hu-YRF3KPIJ.js} +2 -2
  132. package/dist/id-IRL2KCIE.js +2 -0
  133. package/dist/id-SXO4Z54V.js +2 -0
  134. package/dist/index.d.ts +5 -3
  135. package/dist/index.js +1 -1
  136. package/dist/it-55QCLHB7.js +2 -0
  137. package/dist/it-RBRELRA3.js +2 -0
  138. package/dist/ja-2WRUVHKU.js +2 -0
  139. package/dist/ja-3HZPHYZS.js +2 -0
  140. package/dist/kanorio-elements.js +1 -1
  141. package/dist/{km-HPCMYWAG.js → km-EW4ISUB7.js} +2 -2
  142. package/dist/{km-PHVYTPLT.js → km-SL6MZB3H.js} +2 -2
  143. package/dist/{kn-QAWBGLHG.js → kn-RUSRJNGR.js} +2 -2
  144. package/dist/kn-YGEU3PSD.js +2 -0
  145. package/dist/ko-2GI6Z5YH.js +2 -0
  146. package/dist/ko-QK33QMU2.js +2 -0
  147. package/dist/{lightbox-DEvsB5dB.d.ts → lightbox-BmkHgtZg.d.ts} +1 -1
  148. package/dist/lightbox.d.ts +4 -3
  149. package/dist/lightbox.js +1 -1
  150. package/dist/{lo-JNUKFIQV.js → lo-PPDKXTQQ.js} +2 -2
  151. package/dist/{lo-YRHYLRZC.js → lo-ZRV6OAH6.js} +2 -2
  152. package/dist/login.d.ts +3 -2
  153. package/dist/login.js +1 -1
  154. package/dist/media.d.ts +3 -2
  155. package/dist/media.js +1 -1
  156. package/dist/{ml-QO64O4H6.js → ml-BIZEFHNR.js} +2 -2
  157. package/dist/{ml-3LXSDTNF.js → ml-KO2JGAL5.js} +2 -2
  158. package/dist/{mr-PLM72664.js → mr-J4AGQFC7.js} +2 -2
  159. package/dist/{mr-5WLN37JQ.js → mr-PZNRW5MW.js} +2 -2
  160. package/dist/{ms-PIAATVMD.js → ms-NYWKJQEQ.js} +2 -2
  161. package/dist/{ms-N544Y63H.js → ms-OMUKF5WC.js} +2 -2
  162. package/dist/{my-3J665CWK.js → my-FHI5JEQF.js} +2 -2
  163. package/dist/{my-6IKSM3XW.js → my-R4OXNUDW.js} +2 -2
  164. package/dist/nb-EC6AP76Y.js +2 -0
  165. package/dist/nb-U4QN5GJE.js +2 -0
  166. package/dist/{ne-ASFNHMO3.js → ne-DRPNDCZH.js} +2 -2
  167. package/dist/ne-J3XQJZAY.js +2 -0
  168. package/dist/nl-BE-QIH5K6WQ.js +2 -0
  169. package/dist/nl-BE-VHBDCIRF.js +2 -0
  170. package/dist/nl-NL-FZMZRVH4.js +2 -0
  171. package/dist/nl-NL-USXHXD5U.js +2 -0
  172. package/dist/nn-IPL74C6S.js +2 -0
  173. package/dist/nn-UCSEDGDB.js +2 -0
  174. package/dist/{pa-P2GAYL5A.js → pa-LTF7CWS2.js} +2 -2
  175. package/dist/{pa-VX5TUNDP.js → pa-NTK4KSUF.js} +2 -2
  176. package/dist/{phone-input-Q5AV6KSW.js → phone-input-DOL46AIF.js} +2 -2
  177. package/dist/{phone-input-T6QX2TDS.js → phone-input-PXLNDXAB.js} +2 -2
  178. package/dist/pl-6FXX3WNC.js +2 -0
  179. package/dist/pl-YWCG2YWW.js +2 -0
  180. package/dist/{provider-CMLzyAjJ.d.ts → provider-BYGVc6kS.d.ts} +3 -1
  181. package/dist/provider.d.ts +3 -2
  182. package/dist/provider.js +1 -1
  183. package/dist/pt-BR-5JRKIQVH.js +2 -0
  184. package/dist/pt-BR-CIJCMCLE.js +2 -0
  185. package/dist/pt-PT-A7F2KKCY.js +2 -0
  186. package/dist/pt-PT-Y2UCAKHP.js +2 -0
  187. package/dist/reviews.d.ts +3 -2
  188. package/dist/reviews.js +1 -1
  189. package/dist/ro-6MQF2KY2.js +2 -0
  190. package/dist/ro-YISUN7LU.js +2 -0
  191. package/dist/ru-KGU3SC3S.js +2 -0
  192. package/dist/ru-RMPFJQSL.js +2 -0
  193. package/dist/{si-5VUM5FGR.js → si-CTQN6I2M.js} +2 -2
  194. package/dist/{si-5F7RWQIE.js → si-N5U32GIL.js} +2 -2
  195. package/dist/sv-36EB3HIA.js +2 -0
  196. package/dist/sv-QGZRDKBJ.js +2 -0
  197. package/dist/sw-CWIRVHYD.js +2 -0
  198. package/dist/sw-OUQYTLJF.js +2 -0
  199. package/dist/{ta-MNWTH3F5.js → ta-E3ZBHC6A.js} +2 -2
  200. package/dist/{ta-R73RBA23.js → ta-N7BHKWBO.js} +2 -2
  201. package/dist/{te-5SBVH4OF.js → te-7JC2KGAU.js} +2 -2
  202. package/dist/{te-GVW56XDM.js → te-CTCZQKFU.js} +2 -2
  203. package/dist/{th-G6SY3D2Q.js → th-AN5CLQP6.js} +2 -2
  204. package/dist/{th-2GWK7DBB.js → th-JVK4E2AJ.js} +2 -2
  205. package/dist/tl-BSWGJB7O.js +2 -0
  206. package/dist/tl-X72423V3.js +2 -0
  207. package/dist/tr-22NUPSET.js +2 -0
  208. package/dist/tr-AZ2PLRZY.js +2 -0
  209. package/dist/{uk-PGHXMWJR.js → uk-POKPJJDZ.js} +2 -2
  210. package/dist/uk-UOTQJ3E7.js +2 -0
  211. package/dist/unit.d.ts +3 -1
  212. package/dist/unit.js +1 -1
  213. package/dist/{ur-4CR64XUI.js → ur-6LBRTMAE.js} +2 -2
  214. package/dist/{ur-J5HV4NTW.js → ur-NRHFTLO5.js} +2 -2
  215. package/dist/vi-3ZVAOXIJ.js +2 -0
  216. package/dist/vi-XC4CGJHX.js +2 -0
  217. package/dist/web-components.js +1 -1
  218. package/dist/zh-CN-EKEY2CLM.js +2 -0
  219. package/dist/zh-CN-XW3PLUG5.js +2 -0
  220. package/dist/zh-HK-25OZZBHO.js +2 -0
  221. package/dist/zh-HK-EPQAUBL3.js +2 -0
  222. package/dist/zh-Hant-LFJZCOMK.js +2 -0
  223. package/dist/zh-Hant-RQMTFZSE.js +2 -0
  224. package/package.json +2 -2
  225. package/dist/CustomerAccountPanel-DJKV7LT4.js +0 -2
  226. package/dist/CustomerAccountPanel-RWEHWBJY.js +0 -2
  227. package/dist/FormFileField-LZDCXI2Z.js +0 -2
  228. package/dist/FormFileField-ONL4Q55V.js +0 -2
  229. package/dist/KanorioAccount-EN3TM67X.js +0 -2
  230. package/dist/KanorioAccount-XGVSGVYN.js +0 -2
  231. package/dist/KanorioAnalytics-NEKTFQEE.js +0 -2
  232. package/dist/KanorioAnalytics-UMCUWQM7.js +0 -2
  233. package/dist/KanorioCurriculum-3QSCOHK7.js +0 -2
  234. package/dist/KanorioCurriculum-RUIGZ5X7.js +0 -2
  235. package/dist/KanorioForm-GUA5GEJY.js +0 -2
  236. package/dist/KanorioForm-KXV7D2TU.js +0 -2
  237. package/dist/KanorioLightbox-M72HNQQX.js +0 -2
  238. package/dist/KanorioLightbox-TQ3Q73TD.js +0 -2
  239. package/dist/KanorioLogin-5XFN3YEE.js +0 -2
  240. package/dist/KanorioLogin-AJHHVQGV.js +0 -2
  241. package/dist/KanorioMedia-ADKUDH5C.js +0 -2
  242. package/dist/KanorioMedia-DLBSXCKA.js +0 -2
  243. package/dist/KanorioReviews-42FZSXTI.js +0 -2
  244. package/dist/KanorioReviews-7LD5WKFG.js +0 -2
  245. package/dist/KanorioUnit-NWBX5DEI.js +0 -2
  246. package/dist/KanorioUnit-SIM3344J.js +0 -2
  247. package/dist/ar-3VA7IUCO.js +0 -2
  248. package/dist/ar-AUQCHHZG.js +0 -2
  249. package/dist/bg-IRGRVWOG.js +0 -2
  250. package/dist/bg-QWC2KG3G.js +0 -2
  251. package/dist/chunk-4BBERZ6T.js +0 -2
  252. package/dist/chunk-5AUWUK5R.js +0 -2
  253. package/dist/chunk-66XN5RR4.js +0 -2
  254. package/dist/chunk-EZMTUAQX.js +0 -2
  255. package/dist/chunk-FSY5GB5E.js +0 -3
  256. package/dist/chunk-G4U6BFZY.js +0 -2
  257. package/dist/chunk-GJY6AQIS.js +0 -2
  258. package/dist/chunk-IXDKZO42.js +0 -2
  259. package/dist/chunk-MIQK3T3Y.js +0 -2
  260. package/dist/chunk-QGR3QAQB.js +0 -3
  261. package/dist/chunk-SUXTLVTX.js +0 -2
  262. package/dist/chunk-UIHBR4NU.js +0 -3
  263. package/dist/chunk-WXIUWMFR.js +0 -2
  264. package/dist/cs-3IX2ZQKJ.js +0 -2
  265. package/dist/cs-NZW6FBFY.js +0 -2
  266. package/dist/da-AFMLFM32.js +0 -2
  267. package/dist/da-PZ32KKTE.js +0 -2
  268. package/dist/de-5JPEK4HF.js +0 -2
  269. package/dist/de-MVL4XGYR.js +0 -2
  270. package/dist/en-AIAENVLI.js +0 -2
  271. package/dist/en-AU-LB5UVGIW.js +0 -2
  272. package/dist/en-AU-Q2O2HPJ2.js +0 -2
  273. package/dist/en-CA-AZDOY7PW.js +0 -2
  274. package/dist/en-CA-PVKXM3WS.js +0 -2
  275. package/dist/en-GB-2N4WB6SL.js +0 -2
  276. package/dist/en-GB-Y5QRPC7S.js +0 -2
  277. package/dist/en-SAXQF5YW.js +0 -2
  278. package/dist/en-US-74L4OI3J.js +0 -2
  279. package/dist/en-US-EKS52JBW.js +0 -2
  280. package/dist/es-419-Q5IH6W5F.js +0 -2
  281. package/dist/es-419-VSZWGONE.js +0 -2
  282. package/dist/es-ES-7L55KPLO.js +0 -2
  283. package/dist/es-ES-ETSYFLPQ.js +0 -2
  284. package/dist/fa-WRJCKGS3.js +0 -2
  285. package/dist/fi-44ST6B6Q.js +0 -2
  286. package/dist/fi-J6NJBPNK.js +0 -2
  287. package/dist/fr-CA-KXRNFZBP.js +0 -2
  288. package/dist/fr-CA-PWWAPLBH.js +0 -2
  289. package/dist/fr-FR-FMLQPLOD.js +0 -2
  290. package/dist/fr-FR-MQAFE7IX.js +0 -2
  291. package/dist/he-GNC45OCB.js +0 -2
  292. package/dist/he-VXZCGAHY.js +0 -2
  293. package/dist/id-7DWHYYFC.js +0 -2
  294. package/dist/id-DCV57AQB.js +0 -2
  295. package/dist/it-7RASZ4SK.js +0 -2
  296. package/dist/it-JICU5WVL.js +0 -2
  297. package/dist/ja-4V7QJLTM.js +0 -2
  298. package/dist/ja-52MBIM3T.js +0 -2
  299. package/dist/kn-5DYCOYAN.js +0 -2
  300. package/dist/ko-55JV4VQK.js +0 -2
  301. package/dist/ko-FZIJZG6K.js +0 -2
  302. package/dist/nb-345ACUTX.js +0 -2
  303. package/dist/nb-F33WYJ6T.js +0 -2
  304. package/dist/ne-AAIECB2W.js +0 -2
  305. package/dist/nl-BE-SHZLAL5T.js +0 -2
  306. package/dist/nl-BE-WK4C6XRZ.js +0 -2
  307. package/dist/nl-NL-2YLHGJZL.js +0 -2
  308. package/dist/nl-NL-PHRY43UB.js +0 -2
  309. package/dist/nn-I5A2LCBH.js +0 -2
  310. package/dist/nn-S3SNETRB.js +0 -2
  311. package/dist/pl-4Y4BWTLT.js +0 -2
  312. package/dist/pl-SGPLZAER.js +0 -2
  313. package/dist/pt-BR-CW3MRSRP.js +0 -2
  314. package/dist/pt-BR-WKEKB5CG.js +0 -2
  315. package/dist/pt-PT-AJZQS2C6.js +0 -2
  316. package/dist/pt-PT-ZTPCI2K6.js +0 -2
  317. package/dist/ro-ANISGUFX.js +0 -2
  318. package/dist/ro-HRV64STT.js +0 -2
  319. package/dist/ru-7U566HR4.js +0 -2
  320. package/dist/ru-PKSZKOLH.js +0 -2
  321. package/dist/sv-HZVCM7LG.js +0 -2
  322. package/dist/sv-UOGO55PW.js +0 -2
  323. package/dist/sw-5XU65KFC.js +0 -2
  324. package/dist/sw-KVAYRFED.js +0 -2
  325. package/dist/tl-OCD2O6J3.js +0 -2
  326. package/dist/tl-PZNXANIM.js +0 -2
  327. package/dist/tr-2BDM6H5Q.js +0 -2
  328. package/dist/tr-VFMHVRQX.js +0 -2
  329. package/dist/uk-OQRACKKD.js +0 -2
  330. package/dist/vi-MQSOSIUY.js +0 -2
  331. package/dist/vi-U7OT2LM7.js +0 -2
  332. package/dist/zh-CN-CCYHPSVA.js +0 -2
  333. package/dist/zh-CN-RNW2BEY7.js +0 -2
  334. package/dist/zh-HK-HE2T63O2.js +0 -2
  335. package/dist/zh-HK-RKREDSAO.js +0 -2
  336. package/dist/zh-Hant-GBQLGJDF.js +0 -2
  337. package/dist/zh-Hant-T6KHSA5B.js +0 -2
@@ -1,4 +1,4 @@
1
- "use client";import{c as Kr,d as xs,e as Zr}from"./chunk-WM5S3YN5.js";import{a as Yr}from"./chunk-MXGMJAWS.js";import{c as Jr,d as Qr,e as to}from"./chunk-BKNL7ZCI.js";import"./chunk-IAXVJLJ3.js";import"./chunk-5AUWUK5R.js";import{b as Ss}from"./chunk-2E6RCDAA.js";import{A as $e,L as Vr,Y as Wr,Z as Xr,_ as qr,aa as oe,ba as Ee,q as zr}from"./chunk-S2NFWI7C.js";import{b as _e}from"./chunk-AFNEGNVJ.js";import{a as ft}from"./chunk-OU4IOHLN.js";import{a as ut}from"./chunk-6LGTFWQS.js";import{a as il,b as nl,c as F}from"./chunk-CDG7S4P5.js";var ce=il((Dh,Vo)=>{"use strict";var sh=!1,zo=function(){};sh&&(Go=function(t,e){var s=arguments.length;e=new Array(s>1?s-1:0);for(var i=1;i<s;i++)e[i-1]=arguments[i];var n=0,r="Warning: "+t.replace(/%s/g,function(){return e[n++]});typeof console<"u"&&console.error(r);try{throw new Error(r)}catch{}},zo=function(a,t,e){var s=arguments.length;e=new Array(s>2?s-2:0);for(var i=2;i<s;i++)e[i-2]=arguments[i];if(t===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");a||Go.apply(null,[t].concat(e))});var Go;Vo.exports=zo});var Z=F(ut());var jt={};nl(jt,{AbortException:()=>Ut,AnnotationEditorLayer:()=>bi,AnnotationEditorParamsType:()=>G,AnnotationEditorType:()=>B,AnnotationEditorUIManager:()=>le,AnnotationLayer:()=>Ne,AnnotationMode:()=>Ht,AnnotationType:()=>ht,CSSConstants:()=>Us,ColorPicker:()=>ns,DOMSVGFactory:()=>ge,DrawLayer:()=>yi,FeatureTest:()=>dt,GlobalWorkerOptions:()=>Xt,ImageKind:()=>qe,InvalidPDFException:()=>De,MathClamp:()=>_t,OPS:()=>ke,OutputScale:()=>qt,PDFDataRangeTransport:()=>is,PDFDateString:()=>Me,PDFWorker:()=>Ie,PasswordResponses:()=>Eo,PermissionFlag:()=>vo,PixelsPerInch:()=>Qt,RenderingCancelledException:()=>Le,ResponseException:()=>fe,SignatureExtractor:()=>Jt,SupportedImageMimeTypes:()=>Hs,TextLayer:()=>he,TouchManager:()=>ts,Util:()=>k,VerbosityLevel:()=>ds,XfaLayer:()=>Je,applyOpacity:()=>Ro,build:()=>Uo,createValidAbsoluteUrl:()=>wr,fetchData:()=>Oe,findContrastColor:()=>ko,getDocument:()=>_i,getFilenameFromUrl:()=>To,getPdfFilenameFromUrl:()=>Co,getRGB:()=>Fe,getUuid:()=>Er,getXfaPageViewport:()=>Po,isDataScheme:()=>fs,isPdfFile:()=>vi,isValidExplicitDest:()=>Lo,noContextMenu:()=>Lt,normalizeUnicode:()=>So,renderRichText:()=>Sr,setLayerDimensions:()=>ae,shadow:()=>U,stopEvent:()=>ot,updateUrlHash:()=>vr,version:()=>Ho});var Ns={};Ns.d=(a,t)=>{for(var e in t)Ns.o(t,e)&&!Ns.o(a,e)&&Object.defineProperty(a,e,{enumerable:!0,get:t[e]})};Ns.o=(a,t)=>Object.prototype.hasOwnProperty.call(a,t);var xt=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Vi=[.001,0,0,.001,0,0],Os=1.35,rl=.35,Th=rl/Os,kt={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ht={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Ke="pdfjs_internal_editor_",B={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},G={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},vo={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},At={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},qe={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},ht={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};var xe={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};var ds={ERRORS:0,WARNINGS:1,INFOS:5},ke={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},Ts={moveTo:0,lineTo:1,curveTo:2,closePath:3},Eo={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Ai=ds.WARNINGS;function ol(a){Number.isInteger(a)&&(Ai=a)}function al(){return Ai}function wi(a){Ai>=ds.INFOS&&console.info(`Info: ${a}`)}function H(a){Ai>=ds.WARNINGS&&console.warn(`Warning: ${a}`)}function Q(a){throw new Error(a)}function z(a,t){a||Q(t)}function ll(a){switch(a?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function wr(a,t=null,e=null){if(!a)return null;if(e&&typeof a=="string"&&(e.addDefaultProtocol&&a.startsWith("www.")&&a.match(/\./g)?.length>=2&&(a=`http://${a}`),e.tryConvertEncoding))try{a=ul(a)}catch{}let s=t?URL.parse(a,t):URL.parse(a);return ll(s)?s:null}function vr(a,t,e=!1){let s=URL.parse(a);return s?(s.hash=t,s.href):e&&wr(a,"http://example.com")?a.split("#",1)[0]+`${t?`#${t}`:""}`:""}function U(a,t,e,s=!1){return Object.defineProperty(a,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}var ye=(function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t})(),Fs=class extends ye{constructor(t,e){super(t,"PasswordException"),this.code=e}},Ye=class extends ye{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},De=class extends ye{constructor(t){super(t,"InvalidPDFException")}},fe=class extends ye{constructor(t,e,s){super(t,"ResponseException"),this.status=e,this.missing=s}},Wi=class extends ye{constructor(t){super(t,"FormatError")}},Ut=class extends ye{constructor(t){super(t,"AbortException")}};function _o(a){(typeof a!="object"||a?.length===void 0)&&Q("Invalid argument for bytesToString");let t=a.length,e=8192;if(t<e)return String.fromCharCode.apply(null,a);let s=[];for(let i=0;i<t;i+=e){let n=Math.min(i+e,t),r=a.subarray(i,n);s.push(String.fromCharCode.apply(null,r))}return s.join("")}function us(a){typeof a!="string"&&Q("Invalid argument for stringToBytes");let t=a.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=a.charCodeAt(s)&255;return e}function hl(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}function cl(){let a=new Uint8Array(4);return a[0]=1,new Uint32Array(a.buffer,0,1)[0]===1}function dl(){try{return new Function(""),!0}catch{return!1}}var dt=class{static get isLittleEndian(){return U(this,"isLittleEndian",cl())}static get isEvalSupported(){return U(this,"isEvalSupported",dl())}static get isOffscreenCanvasSupported(){return U(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return U(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return U(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){return U(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},Hi=Array.from(Array(256).keys(),a=>a.toString(16).padStart(2,"0")),k=class{static makeHexColor(t,e,s){return`#${Hi[t]}${Hi[e]}${Hi[s]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,s=0){let i=t[s],n=t[s+1];t[s]=i*e[0]+n*e[2]+e[4],t[s+1]=i*e[1]+n*e[3]+e[5]}static applyTransformToBezier(t,e,s=0){let i=e[0],n=e[1],r=e[2],o=e[3],l=e[4],h=e[5];for(let c=0;c<6;c+=2){let d=t[s+c],u=t[s+c+1];t[s+c]=d*i+u*r+l,t[s+c+1]=d*n+u*o+h}}static applyInverseTransform(t,e){let s=t[0],i=t[1],n=e[0]*e[3]-e[1]*e[2];t[0]=(s*e[3]-i*e[2]+e[2]*e[5]-e[4]*e[3])/n,t[1]=(-s*e[1]+i*e[0]+e[4]*e[1]-e[5]*e[0])/n}static axialAlignedBoundingBox(t,e,s){let i=e[0],n=e[1],r=e[2],o=e[3],l=e[4],h=e[5],c=t[0],d=t[1],u=t[2],f=t[3],g=i*c+l,p=g,b=i*u+l,m=b,y=o*d+h,A=y,w=o*f+h,v=w;if(n!==0||r!==0){let E=n*c,_=n*u,S=r*d,x=r*f;g+=S,m+=S,b+=x,p+=x,y+=E,v+=E,w+=_,A+=_}s[0]=Math.min(s[0],g,b,p,m),s[1]=Math.min(s[1],y,w,A,v),s[2]=Math.max(s[2],g,b,p,m),s[3]=Math.max(s[3],y,w,A,v)}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){let s=t[0],i=t[1],n=t[2],r=t[3],o=s**2+i**2,l=s*n+i*r,h=n**2+r**2,c=(o+h)/2,d=Math.sqrt(c**2-(o*h-l**2));e[0]=Math.sqrt(c+d||1),e[1]=Math.sqrt(c-d||1)}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;let n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>r?null:[s,n,i,r]}static pointBoundingBox(t,e,s){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}static rectBoundingBox(t,e,s,i,n){n[0]=Math.min(n[0],t,s),n[1]=Math.min(n[1],e,i),n[2]=Math.max(n[2],t,s),n[3]=Math.max(n[3],e,i)}static#t(t,e,s,i,n,r,o,l,h,c){if(h<=0||h>=1)return;let d=1-h,u=h*h,f=u*h,g=d*(d*(d*t+3*h*e)+3*u*s)+f*i,p=d*(d*(d*n+3*h*r)+3*u*o)+f*l;c[0]=Math.min(c[0],g),c[1]=Math.min(c[1],p),c[2]=Math.max(c[2],g),c[3]=Math.max(c[3],p)}static#e(t,e,s,i,n,r,o,l,h,c,d,u){if(Math.abs(h)<1e-12){Math.abs(c)>=1e-12&&this.#t(t,e,s,i,n,r,o,l,-d/c,u);return}let f=c**2-4*d*h;if(f<0)return;let g=Math.sqrt(f),p=2*h;this.#t(t,e,s,i,n,r,o,l,(-c+g)/p,u),this.#t(t,e,s,i,n,r,o,l,(-c-g)/p,u)}static bezierBoundingBox(t,e,s,i,n,r,o,l,h){h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,l),this.#e(t,s,n,o,e,i,r,l,3*(-t+3*(s-n)+o),6*(t-2*s+n),3*(s-t),h),this.#e(t,s,n,o,e,i,r,l,3*(-e+3*(i-r)+l),6*(e-2*i+r),3*(i-e),h)}};function ul(a){return decodeURIComponent(escape(a))}var Ui=null,eo=null;function So(a){return Ui||(Ui=/([\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,eo=new Map([["\uFB05","\u017Ft"]])),a.replaceAll(Ui,(t,e,s)=>e?e.normalize("NFKC"):eo.get(s))}function Er(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let a=new Uint8Array(32);return crypto.getRandomValues(a),_o(a)}var _r="pdfjs_internal_id_";function fl(a,t,e){if(!Array.isArray(e)||e.length<2)return!1;let[s,i,...n]=e;if(!a(s)&&!Number.isInteger(s)||!t(i))return!1;let r=n.length,o=!0;switch(i.name){case"XYZ":if(r<2||r>3)return!1;break;case"Fit":case"FitB":return r===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(r>1)return!1;break;case"FitR":if(r!==4)return!1;o=!1;break;default:return!1}for(let l of n)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function _t(a,t,e){return Math.min(Math.max(a,t),e)}function xo(a){return Uint8Array.prototype.toBase64?a.toBase64():btoa(_o(a))}function pl(a){return Uint8Array.fromBase64?Uint8Array.fromBase64(a):us(atob(a))}typeof Promise.try!="function"&&(Promise.try=function(a,...t){return new Promise(e=>{e(a(...t))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(a){return a.reduce((t,e)=>t+e,0)});var Ze=class a{static textContent(t){let e=[],s={items:e,styles:Object.create(null)};function i(n){if(!n)return;let r=null,o=n.name;if(o==="#text")r=n.value;else if(a.shouldBuildText(o))n?.attributes?.textContent?r=n.attributes.textContent:n.value&&(r=n.value);else return;if(r!==null&&e.push({str:r}),!!n.children)for(let l of n.children)i(l)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}},Je=class{static setupStorage(t,e,s,i,n){let r=i.getValue(e,{value:null});switch(s.name){case"textarea":if(r.value!==null&&(t.textContent=r.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(r.value===s.attributes.xfaOn?t.setAttribute("checked",!0):r.value===s.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",o=>{i.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(r.value!==null&&t.setAttribute("value",r.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})})}break;case"select":if(r.value!==null){t.setAttribute("value",r.value);for(let o of s.children)o.attributes.value===r.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{let l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;i.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){let{attributes:r}=e,o=t instanceof HTMLAnchorElement;r.type==="radio"&&(r.name=`${r.name}-${i}`);for(let[l,h]of Object.entries(r))if(h!=null)switch(l){case"class":h.length&&t.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,h)}o&&n.addLinkAttributes(t,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(t,r.dataId,e,s)}static render(t){let e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",r=document.createElement(i.name);i.attributes&&this.setAttributes({html:r,element:i,intent:n,linkService:s});let o=n!=="richText",l=t.div;if(l.append(r),t.viewport){let d=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=d}o&&l.setAttribute("class","xfaLayer xfaFont");let h=[];if(i.children.length===0){if(i.value){let d=document.createTextNode(i.value);r.append(d),o&&Ze.shouldBuildText(i.name)&&h.push(d)}return{textDivs:h}}let c=[[i,-1,r]];for(;c.length>0;){let[d,u,f]=c.at(-1);if(u+1===d.children.length){c.pop();continue}let g=d.children[++c.at(-1)[1]];if(g===null)continue;let{name:p}=g;if(p==="#text"){let m=document.createTextNode(g.value);h.push(m),f.append(m);continue}let b=g?.attributes?.xmlns?document.createElementNS(g.attributes.xmlns,p):document.createElement(p);if(f.append(b),g.attributes&&this.setAttributes({html:b,element:g,storage:e,intent:n,linkService:s}),g.children?.length>0)c.push([g,-1,b]);else if(g.value){let m=document.createTextNode(g.value);o&&Ze.shouldBuildText(p)&&h.push(m),b.append(m)}}for(let d of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))d.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}},Zt="http://www.w3.org/2000/svg",Qt=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};async function Oe(a,t="text"){if(Xe(a,document.baseURI)){let e=await fetch(a);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{let i=new XMLHttpRequest;i.open("GET",a,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}var Qe=class a{constructor({viewBox:t,userUnit:e,scale:s,rotation:i,offsetX:n=0,offsetY:r=0,dontFlip:o=!1}){this.viewBox=t,this.userUnit=e,this.scale=s,this.rotation=i,this.offsetX=n,this.offsetY=r,s*=e;let l=(t[2]+t[0])/2,h=(t[3]+t[1])/2,c,d,u,f;switch(i%=360,i<0&&(i+=360),i){case 180:c=-1,d=0,u=0,f=1;break;case 90:c=0,d=1,u=1,f=0;break;case 270:c=0,d=-1,u=-1,f=0;break;case 0:c=1,d=0,u=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(u=-u,f=-f);let g,p,b,m;c===0?(g=Math.abs(h-t[1])*s+n,p=Math.abs(l-t[0])*s+r,b=(t[3]-t[1])*s,m=(t[2]-t[0])*s):(g=Math.abs(l-t[0])*s+n,p=Math.abs(h-t[1])*s+r,b=(t[2]-t[0])*s,m=(t[3]-t[1])*s),this.transform=[c*s,d*s,u*s,f*s,g-c*s*l-u*s*h,p-d*s*l-f*s*h],this.width=b,this.height=m}get rawDims(){let t=this.viewBox;return U(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new a({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){let s=[t,e];return k.applyTransform(s,this.transform),s}convertToViewportRectangle(t){let e=[t[0],t[1]];k.applyTransform(e,this.transform);let s=[t[2],t[3]];return k.applyTransform(s,this.transform),[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){let s=[t,e];return k.applyInverseTransform(s,this.transform),s}},Le=class extends ye{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};function fs(a){let t=a.length,e=0;for(;e<t&&a[e].trim()==="";)e++;return a.substring(e,e+5).toLowerCase()==="data:"}function vi(a){return typeof a=="string"&&/\.pdf$/i.test(a)}function To(a){return[a]=a.split(/[#?]/,1),a.substring(a.lastIndexOf("/")+1)}function Co(a,t="document.pdf"){if(typeof a!="string")return t;if(fs(a))return H('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;let 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}}}}})(a);if(!s)return t;let i=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch{return o}},n=/\.pdf$/i,r=s.pathname.split("/").at(-1);if(n.test(r))return i(r);if(s.searchParams.size>0){let o=Array.from(s.searchParams.values()).reverse();for(let h of o)if(n.test(h))return i(h);let l=Array.from(s.searchParams.keys()).reverse();for(let h of l)if(n.test(h))return i(h)}if(s.hash){let l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(s.hash);if(l)return i(l[0])}return t}var Bs=class{started=Object.create(null);times=[];time(t){t in this.started&&H(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||H(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){let t=[],e=0;for(let{name:s}of this.times)e=Math.max(s.length,e);for(let{name:s,start:i,end:n}of this.times)t.push(`${s.padEnd(e)} ${n-i}ms
1
+ "use client";import{c as Kr,d as xs,e as Zr}from"./chunk-CTMHQZAU.js";import{a as Yr}from"./chunk-MXGMJAWS.js";import{c as Jr,d as Qr,e as to}from"./chunk-BKNL7ZCI.js";import"./chunk-65RP744E.js";import"./chunk-3NXF6SCJ.js";import{b as Ss}from"./chunk-2E6RCDAA.js";import{A as $e,L as Vr,Y as Wr,Z as Xr,_ as qr,aa as oe,ba as Ee,q as zr}from"./chunk-S2NFWI7C.js";import{b as _e}from"./chunk-AFNEGNVJ.js";import{a as ft}from"./chunk-OU4IOHLN.js";import{a as ut}from"./chunk-6LGTFWQS.js";import{a as il,b as nl,c as F}from"./chunk-CDG7S4P5.js";var ce=il((Dh,Vo)=>{"use strict";var sh=!1,zo=function(){};sh&&(Go=function(t,e){var s=arguments.length;e=new Array(s>1?s-1:0);for(var i=1;i<s;i++)e[i-1]=arguments[i];var n=0,r="Warning: "+t.replace(/%s/g,function(){return e[n++]});typeof console<"u"&&console.error(r);try{throw new Error(r)}catch{}},zo=function(a,t,e){var s=arguments.length;e=new Array(s>2?s-2:0);for(var i=2;i<s;i++)e[i-2]=arguments[i];if(t===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");a||Go.apply(null,[t].concat(e))});var Go;Vo.exports=zo});var Z=F(ut());var jt={};nl(jt,{AbortException:()=>Ut,AnnotationEditorLayer:()=>bi,AnnotationEditorParamsType:()=>G,AnnotationEditorType:()=>B,AnnotationEditorUIManager:()=>le,AnnotationLayer:()=>Ne,AnnotationMode:()=>Ht,AnnotationType:()=>ht,CSSConstants:()=>Us,ColorPicker:()=>ns,DOMSVGFactory:()=>ge,DrawLayer:()=>yi,FeatureTest:()=>dt,GlobalWorkerOptions:()=>Xt,ImageKind:()=>qe,InvalidPDFException:()=>De,MathClamp:()=>_t,OPS:()=>ke,OutputScale:()=>qt,PDFDataRangeTransport:()=>is,PDFDateString:()=>Me,PDFWorker:()=>Ie,PasswordResponses:()=>Eo,PermissionFlag:()=>vo,PixelsPerInch:()=>Qt,RenderingCancelledException:()=>Le,ResponseException:()=>fe,SignatureExtractor:()=>Jt,SupportedImageMimeTypes:()=>Hs,TextLayer:()=>he,TouchManager:()=>ts,Util:()=>k,VerbosityLevel:()=>ds,XfaLayer:()=>Je,applyOpacity:()=>Ro,build:()=>Uo,createValidAbsoluteUrl:()=>wr,fetchData:()=>Oe,findContrastColor:()=>ko,getDocument:()=>_i,getFilenameFromUrl:()=>To,getPdfFilenameFromUrl:()=>Co,getRGB:()=>Fe,getUuid:()=>Er,getXfaPageViewport:()=>Po,isDataScheme:()=>fs,isPdfFile:()=>vi,isValidExplicitDest:()=>Lo,noContextMenu:()=>Lt,normalizeUnicode:()=>So,renderRichText:()=>Sr,setLayerDimensions:()=>ae,shadow:()=>U,stopEvent:()=>ot,updateUrlHash:()=>vr,version:()=>Ho});var Ns={};Ns.d=(a,t)=>{for(var e in t)Ns.o(t,e)&&!Ns.o(a,e)&&Object.defineProperty(a,e,{enumerable:!0,get:t[e]})};Ns.o=(a,t)=>Object.prototype.hasOwnProperty.call(a,t);var xt=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Vi=[.001,0,0,.001,0,0],Os=1.35,rl=.35,Th=rl/Os,kt={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ht={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Ke="pdfjs_internal_editor_",B={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},G={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},vo={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},At={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},qe={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},ht={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};var xe={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};var ds={ERRORS:0,WARNINGS:1,INFOS:5},ke={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},Ts={moveTo:0,lineTo:1,curveTo:2,closePath:3},Eo={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Ai=ds.WARNINGS;function ol(a){Number.isInteger(a)&&(Ai=a)}function al(){return Ai}function wi(a){Ai>=ds.INFOS&&console.info(`Info: ${a}`)}function H(a){Ai>=ds.WARNINGS&&console.warn(`Warning: ${a}`)}function Q(a){throw new Error(a)}function z(a,t){a||Q(t)}function ll(a){switch(a?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function wr(a,t=null,e=null){if(!a)return null;if(e&&typeof a=="string"&&(e.addDefaultProtocol&&a.startsWith("www.")&&a.match(/\./g)?.length>=2&&(a=`http://${a}`),e.tryConvertEncoding))try{a=ul(a)}catch{}let s=t?URL.parse(a,t):URL.parse(a);return ll(s)?s:null}function vr(a,t,e=!1){let s=URL.parse(a);return s?(s.hash=t,s.href):e&&wr(a,"http://example.com")?a.split("#",1)[0]+`${t?`#${t}`:""}`:""}function U(a,t,e,s=!1){return Object.defineProperty(a,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}var ye=(function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t})(),Fs=class extends ye{constructor(t,e){super(t,"PasswordException"),this.code=e}},Ye=class extends ye{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},De=class extends ye{constructor(t){super(t,"InvalidPDFException")}},fe=class extends ye{constructor(t,e,s){super(t,"ResponseException"),this.status=e,this.missing=s}},Wi=class extends ye{constructor(t){super(t,"FormatError")}},Ut=class extends ye{constructor(t){super(t,"AbortException")}};function _o(a){(typeof a!="object"||a?.length===void 0)&&Q("Invalid argument for bytesToString");let t=a.length,e=8192;if(t<e)return String.fromCharCode.apply(null,a);let s=[];for(let i=0;i<t;i+=e){let n=Math.min(i+e,t),r=a.subarray(i,n);s.push(String.fromCharCode.apply(null,r))}return s.join("")}function us(a){typeof a!="string"&&Q("Invalid argument for stringToBytes");let t=a.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=a.charCodeAt(s)&255;return e}function hl(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}function cl(){let a=new Uint8Array(4);return a[0]=1,new Uint32Array(a.buffer,0,1)[0]===1}function dl(){try{return new Function(""),!0}catch{return!1}}var dt=class{static get isLittleEndian(){return U(this,"isLittleEndian",cl())}static get isEvalSupported(){return U(this,"isEvalSupported",dl())}static get isOffscreenCanvasSupported(){return U(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return U(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return U(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){return U(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},Hi=Array.from(Array(256).keys(),a=>a.toString(16).padStart(2,"0")),k=class{static makeHexColor(t,e,s){return`#${Hi[t]}${Hi[e]}${Hi[s]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,s=0){let i=t[s],n=t[s+1];t[s]=i*e[0]+n*e[2]+e[4],t[s+1]=i*e[1]+n*e[3]+e[5]}static applyTransformToBezier(t,e,s=0){let i=e[0],n=e[1],r=e[2],o=e[3],l=e[4],h=e[5];for(let c=0;c<6;c+=2){let d=t[s+c],u=t[s+c+1];t[s+c]=d*i+u*r+l,t[s+c+1]=d*n+u*o+h}}static applyInverseTransform(t,e){let s=t[0],i=t[1],n=e[0]*e[3]-e[1]*e[2];t[0]=(s*e[3]-i*e[2]+e[2]*e[5]-e[4]*e[3])/n,t[1]=(-s*e[1]+i*e[0]+e[4]*e[1]-e[5]*e[0])/n}static axialAlignedBoundingBox(t,e,s){let i=e[0],n=e[1],r=e[2],o=e[3],l=e[4],h=e[5],c=t[0],d=t[1],u=t[2],f=t[3],g=i*c+l,p=g,b=i*u+l,m=b,y=o*d+h,A=y,w=o*f+h,v=w;if(n!==0||r!==0){let E=n*c,_=n*u,S=r*d,x=r*f;g+=S,m+=S,b+=x,p+=x,y+=E,v+=E,w+=_,A+=_}s[0]=Math.min(s[0],g,b,p,m),s[1]=Math.min(s[1],y,w,A,v),s[2]=Math.max(s[2],g,b,p,m),s[3]=Math.max(s[3],y,w,A,v)}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){let s=t[0],i=t[1],n=t[2],r=t[3],o=s**2+i**2,l=s*n+i*r,h=n**2+r**2,c=(o+h)/2,d=Math.sqrt(c**2-(o*h-l**2));e[0]=Math.sqrt(c+d||1),e[1]=Math.sqrt(c-d||1)}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;let n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>r?null:[s,n,i,r]}static pointBoundingBox(t,e,s){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}static rectBoundingBox(t,e,s,i,n){n[0]=Math.min(n[0],t,s),n[1]=Math.min(n[1],e,i),n[2]=Math.max(n[2],t,s),n[3]=Math.max(n[3],e,i)}static#t(t,e,s,i,n,r,o,l,h,c){if(h<=0||h>=1)return;let d=1-h,u=h*h,f=u*h,g=d*(d*(d*t+3*h*e)+3*u*s)+f*i,p=d*(d*(d*n+3*h*r)+3*u*o)+f*l;c[0]=Math.min(c[0],g),c[1]=Math.min(c[1],p),c[2]=Math.max(c[2],g),c[3]=Math.max(c[3],p)}static#e(t,e,s,i,n,r,o,l,h,c,d,u){if(Math.abs(h)<1e-12){Math.abs(c)>=1e-12&&this.#t(t,e,s,i,n,r,o,l,-d/c,u);return}let f=c**2-4*d*h;if(f<0)return;let g=Math.sqrt(f),p=2*h;this.#t(t,e,s,i,n,r,o,l,(-c+g)/p,u),this.#t(t,e,s,i,n,r,o,l,(-c-g)/p,u)}static bezierBoundingBox(t,e,s,i,n,r,o,l,h){h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,l),this.#e(t,s,n,o,e,i,r,l,3*(-t+3*(s-n)+o),6*(t-2*s+n),3*(s-t),h),this.#e(t,s,n,o,e,i,r,l,3*(-e+3*(i-r)+l),6*(e-2*i+r),3*(i-e),h)}};function ul(a){return decodeURIComponent(escape(a))}var Ui=null,eo=null;function So(a){return Ui||(Ui=/([\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,eo=new Map([["\uFB05","\u017Ft"]])),a.replaceAll(Ui,(t,e,s)=>e?e.normalize("NFKC"):eo.get(s))}function Er(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let a=new Uint8Array(32);return crypto.getRandomValues(a),_o(a)}var _r="pdfjs_internal_id_";function fl(a,t,e){if(!Array.isArray(e)||e.length<2)return!1;let[s,i,...n]=e;if(!a(s)&&!Number.isInteger(s)||!t(i))return!1;let r=n.length,o=!0;switch(i.name){case"XYZ":if(r<2||r>3)return!1;break;case"Fit":case"FitB":return r===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(r>1)return!1;break;case"FitR":if(r!==4)return!1;o=!1;break;default:return!1}for(let l of n)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function _t(a,t,e){return Math.min(Math.max(a,t),e)}function xo(a){return Uint8Array.prototype.toBase64?a.toBase64():btoa(_o(a))}function pl(a){return Uint8Array.fromBase64?Uint8Array.fromBase64(a):us(atob(a))}typeof Promise.try!="function"&&(Promise.try=function(a,...t){return new Promise(e=>{e(a(...t))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(a){return a.reduce((t,e)=>t+e,0)});var Ze=class a{static textContent(t){let e=[],s={items:e,styles:Object.create(null)};function i(n){if(!n)return;let r=null,o=n.name;if(o==="#text")r=n.value;else if(a.shouldBuildText(o))n?.attributes?.textContent?r=n.attributes.textContent:n.value&&(r=n.value);else return;if(r!==null&&e.push({str:r}),!!n.children)for(let l of n.children)i(l)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}},Je=class{static setupStorage(t,e,s,i,n){let r=i.getValue(e,{value:null});switch(s.name){case"textarea":if(r.value!==null&&(t.textContent=r.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(r.value===s.attributes.xfaOn?t.setAttribute("checked",!0):r.value===s.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",o=>{i.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(r.value!==null&&t.setAttribute("value",r.value),n==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})})}break;case"select":if(r.value!==null){t.setAttribute("value",r.value);for(let o of s.children)o.attributes.value===r.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{let l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;i.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){let{attributes:r}=e,o=t instanceof HTMLAnchorElement;r.type==="radio"&&(r.name=`${r.name}-${i}`);for(let[l,h]of Object.entries(r))if(h!=null)switch(l){case"class":h.length&&t.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,h)}o&&n.addLinkAttributes(t,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(t,r.dataId,e,s)}static render(t){let e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",r=document.createElement(i.name);i.attributes&&this.setAttributes({html:r,element:i,intent:n,linkService:s});let o=n!=="richText",l=t.div;if(l.append(r),t.viewport){let d=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=d}o&&l.setAttribute("class","xfaLayer xfaFont");let h=[];if(i.children.length===0){if(i.value){let d=document.createTextNode(i.value);r.append(d),o&&Ze.shouldBuildText(i.name)&&h.push(d)}return{textDivs:h}}let c=[[i,-1,r]];for(;c.length>0;){let[d,u,f]=c.at(-1);if(u+1===d.children.length){c.pop();continue}let g=d.children[++c.at(-1)[1]];if(g===null)continue;let{name:p}=g;if(p==="#text"){let m=document.createTextNode(g.value);h.push(m),f.append(m);continue}let b=g?.attributes?.xmlns?document.createElementNS(g.attributes.xmlns,p):document.createElement(p);if(f.append(b),g.attributes&&this.setAttributes({html:b,element:g,storage:e,intent:n,linkService:s}),g.children?.length>0)c.push([g,-1,b]);else if(g.value){let m=document.createTextNode(g.value);o&&Ze.shouldBuildText(p)&&h.push(m),b.append(m)}}for(let d of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))d.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}},Zt="http://www.w3.org/2000/svg",Qt=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};async function Oe(a,t="text"){if(Xe(a,document.baseURI)){let e=await fetch(a);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{let i=new XMLHttpRequest;i.open("GET",a,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}var Qe=class a{constructor({viewBox:t,userUnit:e,scale:s,rotation:i,offsetX:n=0,offsetY:r=0,dontFlip:o=!1}){this.viewBox=t,this.userUnit=e,this.scale=s,this.rotation=i,this.offsetX=n,this.offsetY=r,s*=e;let l=(t[2]+t[0])/2,h=(t[3]+t[1])/2,c,d,u,f;switch(i%=360,i<0&&(i+=360),i){case 180:c=-1,d=0,u=0,f=1;break;case 90:c=0,d=1,u=1,f=0;break;case 270:c=0,d=-1,u=-1,f=0;break;case 0:c=1,d=0,u=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(u=-u,f=-f);let g,p,b,m;c===0?(g=Math.abs(h-t[1])*s+n,p=Math.abs(l-t[0])*s+r,b=(t[3]-t[1])*s,m=(t[2]-t[0])*s):(g=Math.abs(l-t[0])*s+n,p=Math.abs(h-t[1])*s+r,b=(t[2]-t[0])*s,m=(t[3]-t[1])*s),this.transform=[c*s,d*s,u*s,f*s,g-c*s*l-u*s*h,p-d*s*l-f*s*h],this.width=b,this.height=m}get rawDims(){let t=this.viewBox;return U(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:n=!1}={}){return new a({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){let s=[t,e];return k.applyTransform(s,this.transform),s}convertToViewportRectangle(t){let e=[t[0],t[1]];k.applyTransform(e,this.transform);let s=[t[2],t[3]];return k.applyTransform(s,this.transform),[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){let s=[t,e];return k.applyInverseTransform(s,this.transform),s}},Le=class extends ye{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};function fs(a){let t=a.length,e=0;for(;e<t&&a[e].trim()==="";)e++;return a.substring(e,e+5).toLowerCase()==="data:"}function vi(a){return typeof a=="string"&&/\.pdf$/i.test(a)}function To(a){return[a]=a.split(/[#?]/,1),a.substring(a.lastIndexOf("/")+1)}function Co(a,t="document.pdf"){if(typeof a!="string")return t;if(fs(a))return H('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;let 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}}}}})(a);if(!s)return t;let i=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch{return o}},n=/\.pdf$/i,r=s.pathname.split("/").at(-1);if(n.test(r))return i(r);if(s.searchParams.size>0){let o=Array.from(s.searchParams.values()).reverse();for(let h of o)if(n.test(h))return i(h);let l=Array.from(s.searchParams.keys()).reverse();for(let h of l)if(n.test(h))return i(h)}if(s.hash){let l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(s.hash);if(l)return i(l[0])}return t}var Bs=class{started=Object.create(null);times=[];time(t){t in this.started&&H(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||H(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){let t=[],e=0;for(let{name:s}of this.times)e=Math.max(s.length,e);for(let{name:s,start:i,end:n}of this.times)t.push(`${s.padEnd(e)} ${n-i}ms
2
2
  `);return t.join("")}};function Xe(a,t){let e=t?URL.parse(a,t):URL.parse(a);return e?.protocol==="http:"||e?.protocol==="https:"}function Lt(a){a.preventDefault()}function ot(a){a.preventDefault(),a.stopPropagation()}function gl(a){console.log("Deprecated API usage: "+a)}var Me=class{static#t;static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;this.#t||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");let e=this.#t.exec(t);if(!e)return null;let s=parseInt(e[1],10),i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let r=parseInt(e[4],10);r=r>=0&&r<=23?r:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;let h=e[7]||"Z",c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,h==="-"?(r+=c,o+=d):h==="+"&&(r-=c,o-=d),new Date(Date.UTC(s,i,n,r,o,l))}};function Po(a,{scale:t=1,rotation:e=0}){let{width:s,height:i}=a.attributes.style,n=[0,0,parseInt(s),parseInt(i)];return new Qe({viewBox:n,userUnit:1,scale:t,rotation:e})}function Fe(a){if(a.startsWith("#")){let t=parseInt(a.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return a.startsWith("rgb(")?a.slice(4,-1).split(",").map(t=>parseInt(t)):a.startsWith("rgba(")?a.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(H(`Not a valid color format: "${a}"`),[0,0,0])}function ml(a){let t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(let e of a.keys()){t.style.color=e;let s=window.getComputedStyle(t).color;a.set(e,Fe(s))}t.remove()}function rt(a){let{a:t,b:e,c:s,d:i,e:n,f:r}=a.getTransform();return[t,e,s,i,n,r]}function Vt(a){let{a:t,b:e,c:s,d:i,e:n,f:r}=a.getTransform().invertSelf();return[t,e,s,i,n,r]}function ae(a,t,e=!1,s=!0){if(t instanceof Qe){let{pageWidth:i,pageHeight:n}=t.rawDims,{style:r}=a,o=dt.isCSSRoundSupported,l=`var(--total-scale-factor) * ${i}px`,h=`var(--total-scale-factor) * ${n}px`,c=o?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,d=o?`round(down, ${h}, var(--scale-round-y))`:`calc(${h})`;!e||t.rotation%180===0?(r.width=c,r.height=d):(r.width=d,r.height=c)}s&&a.setAttribute("data-main-rotation",t.rotation)}var qt=class a{constructor(){let{pixelRatio:t}=a;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,s,i,n=-1){let r=1/0,o=1/0,l=1/0;s=a.capPixels(s,n),s>0&&(r=Math.sqrt(s/(t*e))),i!==-1&&(o=i/t,l=i/e);let h=Math.min(r,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(t,e){if(e>=0){let s=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,s):s}return t}},Hs=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],Xi=class{static get isDarkMode(){return U(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},Us=class{static get commentForegroundColor(){let t=document.createElement("span");t.classList.add("comment","sidebar");let{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);let{color:s}=window.getComputedStyle(t);return t.remove(),U(this,"commentForegroundColor",Fe(s))}};function Ro(a,t,e,s){s=Math.min(Math.max(s??1,0),1);let i=255*(1-s);return a=Math.round(a*s+i),t=Math.round(t*s+i),e=Math.round(e*s+i),[a,t,e]}function so(a,t){let e=a[0]/255,s=a[1]/255,i=a[2]/255,n=Math.max(e,s,i),r=Math.min(e,s,i),o=(n+r)/2;if(n===r)t[0]=t[1]=0;else{let l=n-r;switch(t[1]=o<.5?l/(n+r):l/(2-n-r),n){case e:t[0]=((s-i)/l+(s<i?6:0))*60;break;case s:t[0]=((i-e)/l+2)*60;break;case i:t[0]=((e-s)/l+4)*60;break}}t[2]=o}function qi(a,t){let e=a[0],s=a[1],i=a[2],n=(1-Math.abs(2*i-1))*s,r=n*(1-Math.abs(e/60%2-1)),o=i-n/2;switch(Math.floor(e/60)){case 0:t[0]=n+o,t[1]=r+o,t[2]=o;break;case 1:t[0]=r+o,t[1]=n+o,t[2]=o;break;case 2:t[0]=o,t[1]=n+o,t[2]=r+o;break;case 3:t[0]=o,t[1]=r+o,t[2]=n+o;break;case 4:t[0]=r+o,t[1]=o,t[2]=n+o;break;case 5:case 6:t[0]=n+o,t[1]=o,t[2]=r+o;break}}function io(a){return a<=.03928?a/12.92:((a+.055)/1.055)**2.4}function no(a,t,e){qi(a,e),e.map(io);let s=.2126*e[0]+.7152*e[1]+.0722*e[2];qi(t,e),e.map(io);let i=.2126*e[0]+.7152*e[1]+.0722*e[2];return s>i?(s+.05)/(i+.05):(i+.05)/(s+.05)}var ro=new Map;function ko(a,t){let e=a[0]+a[1]*256+a[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,s=ro.get(e);if(s)return s;let i=new Float32Array(9),n=i.subarray(0,3),r=i.subarray(3,6);so(a,r);let o=i.subarray(6,9);so(t,o);let l=o[2]<.5,h=l?12:4.5;if(r[2]=l?Math.sqrt(r[2]):1-Math.sqrt(1-r[2]),no(r,o,n)<h){let c,d;l?(c=r[2],d=1):(c=0,d=r[2]);let u=.005;for(;d-c>u;){let f=r[2]=(c+d)/2;l===no(r,o,n)<h?c=f:d=f}r[2]=l?d:c}return qi(r,n),s=k.makeHexColor(Math.round(n[0]*255),Math.round(n[1]*255),Math.round(n[2]*255)),ro.set(e,s),s}function Sr({html:a,dir:t,className:e},s){let i=document.createDocumentFragment();if(typeof a=="string"){let n=document.createElement("p");n.dir=t||"auto";let r=a.split(/(?:\r\n?|\n)/);for(let o=0,l=r.length;o<l;++o){let h=r[o];n.append(document.createTextNode(h)),o<l-1&&n.append(document.createElement("br"))}i.append(n)}else Je.render({xfaHtml:a,div:i,intent:"richText"});i.firstChild.classList.add("richText",e),s.append(i)}var Yi=class a{#t=null;#e=null;#i;#s=null;#o=null;#n=null;#r=null;#a=null;static#h=null;constructor(t){this.#i=t,a.#h||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"})}render(){let t=this.#t=document.createElement("div");t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=this.#i._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",Lt,{signal:e}),t.addEventListener("pointerdown",a.#l,{signal:e}));let s=this.#s=document.createElement("div");s.className="buttons",t.append(s);let i=this.#i.toolbarPosition;if(i){let{style:n}=t,r=this.#i._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*r}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#t}static#l(t){t.stopPropagation()}#u(t){this.#i._focusEventsAllowed=!1,ot(t)}#d(t){this.#i._focusEventsAllowed=!0,ot(t)}#f(t){let e=this.#i._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",this.#u.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#d.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Lt,{signal:e}),!0)}hide(){this.#t.classList.add("hidden"),this.#e?.hideDropdown()}show(){this.#t.classList.remove("hidden"),this.#o?.shown(),this.#n?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=this.#i,s=document.createElement("button");s.classList.add("basic","deleteButton"),s.tabIndex=0,s.setAttribute("data-l10n-id",a.#h[t]),this.#f(s)&&s.addEventListener("click",i=>{e.delete()},{signal:e._signal}),this.#s.append(s)}get#m(){let t=document.createElement("div");return t.className="divider",t}async addAltText(t){let e=await t.render();this.#f(e),this.#s.append(e,this.#m),this.#o=t}addComment(t,e=null){if(this.#n)return;let s=t.renderForToolbar();if(!s)return;this.#f(s);let i=this.#r=this.#m;e?(this.#s.insertBefore(s,e),this.#s.insertBefore(i,e)):this.#s.append(s,i),this.#n=t,t.toolbar=this}addColorPicker(t){if(this.#e)return;this.#e=t;let e=t.renderButton();this.#f(e),this.#s.append(e,this.#m)}async addEditSignatureButton(t){let e=this.#a=await t.renderEditButton(this.#i);this.#f(e),this.#s.append(e,this.#m)}removeButton(t){t==="comment"&&(this.#n?.removeToolbarCommentButton(),this.#n=null,this.#r?.remove(),this.#r=null)}async addButton(t,e){switch(t){case"colorPicker":this.addColorPicker(e);break;case"altText":await this.addAltText(e);break;case"editSignature":await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(e);break}}async addButtonBefore(t,e,s){let i=this.#s.querySelector(s);i&&t==="comment"&&this.addComment(e,i)}updateEditSignatureButton(t){this.#a&&(this.#a.title=t)}remove(){this.#t.remove(),this.#e?.destroy(),this.#e=null}},Ki=class{#t=null;#e=null;#i;constructor(t){this.#i=t}#s(){let t=this.#e=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar");let e=this.#i._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",Lt,{signal:e});let s=this.#t=document.createElement("div");return s.className="buttons",t.append(s),this.#i.hasCommentManager()&&this.#n("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#i.commentSelection("floating_button")}),this.#n("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#i.highlightSelection("floating_button")}),t}#o(t,e){let s=0,i=0;for(let n of t){let r=n.y+n.height;if(r<s)continue;let o=n.x+(e?n.width:0);if(r>s){i=o,s=r;continue}e?o>i&&(i=o):o<i&&(i=o)}return[e?1-i:i,s]}show(t,e,s){let[i,n]=this.#o(e,s),{style:r}=this.#e||=this.#s();t.append(this.#e),r.insetInlineEnd=`${100*i}%`,r.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){this.#e.remove()}#n(t,e,s,i){let n=document.createElement("button");n.classList.add("basic",t),n.tabIndex=0,n.setAttribute("data-l10n-id",e);let r=document.createElement("span");n.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id",s);let o=this.#i._signal;o instanceof AbortSignal&&!o.aborted&&(n.addEventListener("contextmenu",Lt,{signal:o}),n.addEventListener("click",i,{signal:o})),this.#t.append(n)}};function Do(a,t,e){for(let s of e)t.addEventListener(s,a[s].bind(a))}var Zi=class{#t=0;get id(){return`${Ke}${this.#t++}`}},Ji=class a{#t=Er();#e=0;#i=null;static get _isSVGFittingCanvas(){let t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=t;let 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 U(this,"_isSVGFittingCanvas",n)}async#s(t,e){this.#i||=new Map;let s=this.#i.get(t);if(s===null)return null;if(s?.bitmap)return s.refCounter+=1,s;try{s||={bitmap:null,id:`image_${this.#t}_${this.#e++}`,refCounter:0,isSvg:!1};let i;if(typeof e=="string"?(s.url=e,i=await Oe(e,"blob")):e instanceof File?i=s.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){let n=a._isSVGFittingCanvas,r=new FileReader,o=new Image,l=new Promise((h,c)=>{o.onload=()=>{s.bitmap=o,s.isSvg=!0,h()},r.onload=async()=>{let d=s.svgUrl=r.result;o.src=await n?`${d}#svgView(preserveAspectRatio(none))`:d},o.onerror=r.onerror=c});r.readAsDataURL(i),await l}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){H(i),s=null}return this.#i.set(t,s),s&&this.#i.set(s.id,s),s}async getFromFile(t){let{lastModified:e,name:s,size:i,type:n}=t;return this.#s(`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return this.#s(t,t)}async getFromBlob(t,e){let s=await e;return this.#s(t,s)}async getFromId(t){this.#i||=new Map;let e=this.#i.get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){let{blobPromise:s}=e;return delete e.blobPromise,this.getFromBlob(e.id,s)}return this.getFromUrl(e.url)}getFromCanvas(t,e){this.#i||=new Map;let s=this.#i.get(t);if(s?.bitmap)return s.refCounter+=1,s;let i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${this.#t}_${this.#e++}`,refCounter:1,isSvg:!1},this.#i.set(t,s),this.#i.set(s.id,s),s}getSvgUrl(t){let e=this.#i.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#i||=new Map;let e=this.#i.get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;let{bitmap:s}=e;if(!e.url&&!e.file){let i=new OffscreenCanvas(s.width,s.height);i.getContext("bitmaprenderer").transferFromImageBitmap(s),e.blobPromise=i.convertToBlob()}s.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#t}_`)}},Qi=class{#t=[];#e=!1;#i;#s=-1;constructor(t=128){this.#i=t}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:r=!1,keepUndo:o=!1}){if(i&&t(),this.#e)return;let l={cmd:t,undo:e,post:s,type:n};if(this.#s===-1){this.#t.length>0&&(this.#t.length=0),this.#s=0,this.#t.push(l);return}if(r&&this.#t[this.#s].type===n){o&&(l.undo=this.#t[this.#s].undo),this.#t[this.#s]=l;return}let h=this.#s+1;h===this.#i?this.#t.splice(0,1):(this.#s=h,h<this.#t.length&&this.#t.splice(h)),this.#t.push(l)}undo(){if(this.#s===-1)return;this.#e=!0;let{undo:t,post:e}=this.#t[this.#s];t(),e?.(),this.#e=!1,this.#s-=1}redo(){if(this.#s<this.#t.length-1){this.#s+=1,this.#e=!0;let{cmd:t,post:e}=this.#t[this.#s];t(),e?.(),this.#e=!1}}hasSomethingToUndo(){return this.#s!==-1}hasSomethingToRedo(){return this.#s<this.#t.length-1}cleanType(t){if(this.#s!==-1){for(let e=this.#s;e>=0;e--)if(this.#t[e].type!==t){this.#t.splice(e+1,this.#s-e),this.#s=e;return}this.#t.length=0,this.#s=-1}}destroy(){this.#t=null}},pe=class{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=dt.platform;for(let[s,i,n={}]of t)for(let r of s){let o=r.startsWith("mac+");e&&o?(this.callbacks.set(r.slice(4),{callback:i,options:n}),this.allKeys.add(r.split("+").at(-1))):!e&&!o&&(this.callbacks.set(r,{callback:i,options:n}),this.allKeys.add(r.split("+").at(-1)))}}#t(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);let e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;let s=this.callbacks.get(this.#t(e));if(!s)return;let{callback:i,options:{bubbles:n=!1,args:r=[],checker:o=null}}=s;o&&!o(t,e)||(i.bind(t,...r,e)(),n||ot(e))}},tn=class a{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return ml(t),U(this,"_colors",t)}convert(t){let e=Fe(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[s,i]of this._colors)if(i.every((n,r)=>n===e[r]))return a._colorsMapping.get(s);return e}getHexCode(t){let e=this._colors.get(t);return e?k.makeHexColor(...e):t}},le=class a{#t=new AbortController;#e=null;#i=null;#s=new Map;#o=new Map;#n=null;#r=null;#a=null;#h=new Qi;#l=null;#u=null;#d=null;#f=0;#m=new Set;#p=null;#c=null;#g=new Set;_editorUndoBar=null;#b=!1;#A=!1;#y=!1;#x=null;#_=null;#w=null;#C=null;#E=!1;#S=null;#k=new Zi;#P=!1;#R=!1;#F=!1;#L=null;#I=null;#B=null;#N=null;#z=null;#T=B.NONE;#v=new Set;#M=null;#H=null;#j=null;#X=null;#W=null;#q={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#$=[0,0];#O=null;#V=null;#J=null;#Q=null;#U=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=a.prototype,e=r=>r.#V.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&r.hasSomethingToControl(),s=(r,{target:o})=>{if(o instanceof HTMLInputElement){let{type:l}=o;return l!=="text"&&l!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return U(this,"_keyboardManager",new pe([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],t.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.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"],t.delete,{checker:s}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(r,{target:o})=>!(o instanceof HTMLButtonElement)&&r.#V.contains(o)&&!r.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(r,{target:o})=>!(o instanceof HTMLButtonElement)&&r.#V.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}constructor(t,e,s,i,n,r,o,l,h,c,d,u,f,g,p,b){let m=this._signal=this.#t.signal;this.#V=t,this.#J=e,this.#Q=s,this.#n=i,this.#l=n,this.#H=r,this.#W=l,this._eventBus=o,o._on("editingaction",this.onEditingAction.bind(this),{signal:m}),o._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),o._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),o._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),o._on("setpreference",this.onSetPreference.bind(this),{signal:m}),o._on("switchannotationeditorparams",y=>this.updateParams(y.type,y.value),{signal:m}),window.addEventListener("pointerdown",()=>{this.#R=!0},{capture:!0,signal:m}),window.addEventListener("pointerup",()=>{this.#R=!1},{capture:!0,signal:m}),this.#lt(),this.#ut(),this.#et(),this.#r=l.annotationStorage,this.#x=l.filterFactory,this.#j=h,this.#C=c||null,this.#b=d,this.#A=u,this.#y=f,this.#z=g||null,this.viewParameters={realScale:Qt.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=p||null,this._supportsPinchToZoom=b!==!1,n?.setSidebarUiManager(this)}destroy(){this.#U?.resolve(),this.#U=null,this.#t?.abort(),this.#t=null,this._signal=null;for(let t of this.#o.values())t.destroy();this.#o.clear(),this.#s.clear(),this.#g.clear(),this.#N?.clear(),this.#e=null,this.#v.clear(),this.#h.destroy(),this.#n?.destroy(),this.#l?.destroy(),this.#H?.destroy(),this.#S?.hide(),this.#S=null,this.#B?.destroy(),this.#B=null,this.#i=null,this.#_&&(clearTimeout(this.#_),this.#_=null),this.#O&&(clearTimeout(this.#O),this.#O=null),this._editorUndoBar?.destroy(),this.#W=null}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return this.#z}get useNewAltTextFlow(){return this.#A}get useNewAltTextWhenAddingImage(){return this.#y}get hcmFilter(){return U(this,"hcmFilter",this.#j?this.#x.addHCMFilter(this.#j.foreground,this.#j.background):"none")}get direction(){return U(this,"direction",getComputedStyle(this.#V).direction)}get _highlightColors(){return U(this,"_highlightColors",this.#C?new Map(this.#C.split(",").map(t=>(t=t.split("=").map(e=>e.trim()),t[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){let{_highlightColors:t}=this;if(!t)return U(this,"highlightColors",null);let e=new Map,s=!!this.#j;for(let[i,n]of t){let r=i.endsWith("_HCM");if(s&&r){e.set(i.replace("_HCM",""),n);continue}!s&&!r&&e.set(i,n)}return U(this,"highlightColors",e)}get highlightColorNames(){return U(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;let e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#d=t}setMainHighlightColorPicker(t){this.#B=t}editAltText(t,e=!1){this.#n?.editAltText(this,t,e)}hasCommentManager(){return!!this.#l}editComment(t,e,s,i){this.#l?.showDialog(this,t,e,s,i)}selectComment(t,e){this.#o.get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){this.#l?.updateComment(t.getData())}updatePopupColor(t){this.#l?.updatePopupColor(t)}removeComment(t){this.#l?.removeComments([t.uid])}toggleComment(t,e,s=void 0){this.#l?.toggleCommentPopup(t,e,s)}makeCommentColor(t,e){return t&&this.#l?.makeCommentColor(t,e)||null}getCommentDialogElement(){return this.#l?.dialogElement||null}async waitForEditorsRendered(t){if(this.#o.has(t-1))return;let{resolve:e,promise:s}=Promise.withResolvers(),i=n=>{n.pageNumber===t&&(this._eventBus._off("editorsrendered",i),e())};this._eventBus.on("editorsrendered",i),await s}getSignature(t){this.#H?.getSignature({uiManager:this,editor:t})}get signatureManager(){return this.#H}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){t==="enableNewAltTextWhenAddingImage"&&(this.#y=e)}onPageChanging({pageNumber:t}){this.#f=t-1}focusMainContainer(){this.#V.focus()}findParent(t,e){for(let s of this.#o.values()){let{x:i,y:n,width:r,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+r&&e>=n&&e<=n+o)return s}return null}disableUserSelect(t=!1){this.#J.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#g.add(t)}removeShouldRescale(t){this.#g.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Qt.PDF_TO_CSS_UNITS;for(let e of this.#g)e.onScaleChanging();this.#d?.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#Z({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}#tt(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let s of this.#o.values())if(s.hasTextLayer(t))return s;return null}highlightSelection(t="",e=!1){let s=document.getSelection();if(!s||s.isCollapsed)return;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:o}=s,l=s.toString(),c=this.#Z(s).closest(".textLayer"),d=this.getSelectionBoxes(c);if(!d)return;s.empty();let u=this.#tt(c),f=this.#T===B.NONE,g=()=>{let p=u?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:o,text:l});f&&this.showAllEditors("highlight",!0,!0),e&&p?.editComment()};if(f){this.switchToMode(B.HIGHLIGHT,g);return}g()}commentSelection(t=""){this.highlightSelection(t,!0)}#ot(){let t=document.getSelection();if(!t||t.isCollapsed)return;let s=this.#Z(t).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(this.#S||=new Ki(this),this.#S.show(s,i,this.direction==="ltr"))}getAndRemoveDataFromAnnotationStorage(t){if(!this.#r)return null;let e=`${Ke}${t}`,s=this.#r.getRawValue(e);return s&&this.#r.remove(e),s}addToAnnotationStorage(t){!t.isEmpty()&&this.#r&&!this.#r.has(t.id)&&this.#r.setValue(t.id,t)}a11yAlert(t,e=null){let s=this.#Q;s&&(s.setAttribute("data-l10n-id",t),e?s.setAttribute("data-l10n-args",JSON.stringify(e)):s.removeAttribute("data-l10n-args"))}#at(){let t=document.getSelection();if(!t||t.isCollapsed){this.#M&&(this.#S?.hide(),this.#M=null,this.#D({hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e===this.#M)return;let i=this.#Z(t).closest(".textLayer");if(!i){this.#M&&(this.#S?.hide(),this.#M=null,this.#D({hasSelectedText:!1}));return}if(this.#S?.hide(),this.#M=e,this.#D({hasSelectedText:!0}),!(this.#T!==B.HIGHLIGHT&&this.#T!==B.NONE)&&(this.#T===B.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#E=this.isShiftKeyDown,!this.isShiftKeyDown)){let n=this.#T===B.HIGHLIGHT?this.#tt(i):null;if(n?.toggleDrawing(),this.#R){let r=new AbortController,o=this.combinedSignal(r),l=h=>{h.type==="pointerup"&&h.button!==0||(r.abort(),n?.toggleDrawing(!0),h.type==="pointerup"&&this.#Y("main_toolbar"))};window.addEventListener("pointerup",l,{signal:o}),window.addEventListener("blur",l,{signal:o})}else n?.toggleDrawing(!0),this.#Y("main_toolbar")}}#Y(t=""){this.#T===B.HIGHLIGHT?this.highlightSelection(t):this.#b&&this.#ot()}#lt(){document.addEventListener("selectionchange",this.#at.bind(this),{signal:this._signal})}#ht(){if(this.#w)return;this.#w=new AbortController;let t=this.combinedSignal(this.#w);window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}#ct(){this.#w?.abort(),this.#w=null}blur(){if(this.isShiftKeyDown=!1,this.#E&&(this.#E=!1,this.#Y("main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of this.#v)if(e.div.contains(t)){this.#I=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#I)return;let[t,e]=this.#I;this.#I=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}#et(){if(this.#L)return;this.#L=new AbortController;let t=this.combinedSignal(this.#L);window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}#dt(){this.#L?.abort(),this.#L=null}#st(){if(this.#u)return;this.#u=new AbortController;let t=this.combinedSignal(this.#u);document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}#it(){this.#u?.abort(),this.#u=null}#ut(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#et(),this.#st()}removeEditListeners(){this.#dt(),this.#it()}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let s of this.#c)if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let s of this.#c)if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let s of this.#v){let i=s.serialize(!0);i&&e.push(i)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();let{clipboardData:e}=t;for(let n of e.items)for(let r of this.#c)if(r.isHandlingMimeForPasting(n.type)){r.paste(n,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){H(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();let i=this.currentLayer;try{let n=[];for(let l of s){let h=await i.deserialize(l);if(!h)return;n.push(h)}let r=()=>{for(let l of n)this.#nt(l);this.#rt(n)},o=()=>{for(let l of n)l.remove()};this.addCommands({cmd:r,undo:o,mustExec:!0})}catch(n){H(`paste: "${n.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),this.#T!==B.NONE&&!this.isEditorHandlingKeyboard&&a._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,this.#E&&(this.#E=!1,this.#Y("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}#D(t){Object.entries(t).some(([s,i])=>this.#q[s]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#q,t)}),this.#T===B.HIGHLIGHT&&t.hasSelectedEditor===!1&&this.#G([[G.HIGHLIGHT_FREE,!0]]))}#G(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#ht(),this.#st(),this.#D({isEditing:this.#T!==B.NONE,isEmpty:this.#K(),hasSomethingToUndo:this.#h.hasSomethingToUndo(),hasSomethingToRedo:this.#h.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ct(),this.#it(),this.#D({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#c){this.#c=t;for(let e of this.#c)this.#G(e.defaultPropertiesToUpdate)}}getId(){return this.#k.id}get currentLayer(){return this.#o.get(this.#f)}getLayer(t){return this.#o.get(t)}get currentPageIndex(){return this.#f}addLayer(t){this.#o.set(t.pageIndex,t),this.#P?t.enable():t.disable()}removeLayer(t){this.#o.delete(t.pageIndex)}async updateMode(t,e=null,s=!1,i=!1,n=!1){if(this.#T!==t&&!(this.#U&&(await this.#U.promise,!this.#U))){if(this.#U=Promise.withResolvers(),this.#d?.commitOrRemove(),this.#T===B.POPUP&&this.#l?.hideSidebar(),this.#l?.destroyPopup(),this.#T=t,t===B.NONE){this.setEditingState(!1),this.#pt();for(let r of this.#s.values())r.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#U.resolve();return}for(let r of this.#s.values())r.addStandaloneCommentButton();t===B.SIGNATURE&&await this.#H?.loadSignatures(),this.setEditingState(!0),await this.#ft(),this.unselectAll();for(let r of this.#o.values())r.updateMode(t);if(t===B.POPUP){this.#i||=await this.#W.getAnnotationsByType(new Set(this.#c.map(l=>l._editorType)));let r=new Set,o=[];for(let l of this.#s.values()){let{annotationElementId:h,hasComment:c,deleted:d}=l;h&&r.add(h),c&&!d&&o.push(l.getData())}for(let l of this.#i){let{id:h,popupRef:c,contentsObj:d}=l;c&&d?.str&&!r.has(h)&&!this.#m.has(h)&&o.push(l)}this.#l?.showSidebar(o)}if(!e){s&&this.addNewEditorFromKeyboard(),this.#U.resolve();return}for(let r of this.#s.values())r.uid===e?(this.setSelected(r),n?r.editComment():i?r.enterInEditMode():r.focus()):r.unselect();this.#U.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==this.#T&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(this.#c){switch(t){case G.CREATE:this.currentLayer.addNewEditor(e);return;case G.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#X||=new Map).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let s of this.#v)s.updateParams(t,e);else for(let s of this.#c)s.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){for(let n of this.#s.values())n.editorType===t&&n.show(e);(this.#X?.get(G.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#G([[G.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#F!==t){this.#F=t;for(let e of this.#o.values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}async#ft(){if(!this.#P){this.#P=!0;let t=[];for(let e of this.#o.values())t.push(e.enable());await Promise.all(t);for(let e of this.#s.values())e.enable()}}#pt(){if(this.unselectAll(),this.#P){this.#P=!1;for(let t of this.#o.values())t.disable();for(let t of this.#s.values())t.disable()}}*getEditors(t){for(let e of this.#s.values())e.pageIndex===t&&(yield e)}getEditor(t){return this.#s.get(t)}addEditor(t){this.#s.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#_&&clearTimeout(this.#_),this.#_=setTimeout(()=>{this.focusMainContainer(),this.#_=null},0)),this.#s.delete(t.id),t.annotationElementId&&this.#N?.delete(t.annotationElementId),this.unselect(t),(!t.annotationElementId||!this.#m.has(t.annotationElementId))&&this.#r?.remove(t.id)}addDeletedAnnotationElement(t){this.#m.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#m.has(t)}removeDeletedAnnotationElement(t){this.#m.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#nt(t){let e=this.#o.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#e!==t&&(this.#e=t,t&&this.#G(t.propertiesToUpdate))}get#gt(){let t=null;for(t of this.#v);return t}updateUI(t){this.#gt===t&&this.#G(t.propertiesToUpdate)}updateUIForDefaultProperties(t){this.#G(t.defaultPropertiesToUpdate)}toggleSelected(t){if(this.#v.has(t)){this.#v.delete(t),t.unselect(),this.#D({hasSelectedEditor:this.hasSelection});return}this.#v.add(t),t.select(),this.#G(t.propertiesToUpdate),this.#D({hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.id}),this.#d?.commitOrRemove();for(let e of this.#v)e!==t&&e.unselect();this.#v.clear(),this.#v.add(t),t.select(),this.#G(t.propertiesToUpdate),this.#D({hasSelectedEditor:!0})}isSelected(t){return this.#v.has(t)}get firstSelectedEditor(){return this.#v.values().next().value}unselect(t){t.unselect(),this.#v.delete(t),this.#D({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#v.size!==0}get isEnterHandled(){return this.#v.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#h.undo(),this.#D({hasSomethingToUndo:this.#h.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#K()}),this._editorUndoBar?.hide()}redo(){this.#h.redo(),this.#D({hasSomethingToUndo:!0,hasSomethingToRedo:this.#h.hasSomethingToRedo(),isEmpty:this.#K()})}addCommands(t){this.#h.add(t),this.#D({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#K()})}cleanUndoStack(t){this.#h.cleanType(t)}#K(){if(this.#s.size===0)return!0;if(this.#s.size===1)for(let t of this.#s.values())return t.isEmpty();return!1}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...this.#v],s=()=>{this._editorUndoBar?.show(i,e.length===1?e[0].editorType:e.length);for(let n of e)n.remove()},i=()=>{for(let n of e)this.#nt(n)};this.addCommands({cmd:s,undo:i,mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#rt(t){for(let e of this.#v)e.unselect();this.#v.clear();for(let e of t)e.isEmpty()||(this.#v.add(e),e.select());this.#D({hasSelectedEditor:this.hasSelection})}selectAll(){for(let t of this.#v)t.commit();this.#rt(this.#s.values())}unselectAll(){if(!(this.#e&&(this.#e.commitOrRemove(),this.#T!==B.NONE))&&!this.#d?.commitOrRemove()&&this.hasSelection){for(let t of this.#v)t.unselect();this.#v.clear(),this.#D({hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;this.#$[0]+=t,this.#$[1]+=e;let[i,n]=this.#$,r=[...this.#v],o=1e3;this.#O&&clearTimeout(this.#O),this.#O=setTimeout(()=>{this.#O=null,this.#$[0]=this.#$[1]=0,this.addCommands({cmd:()=>{for(let l of r)this.#s.has(l.id)&&(l.translateInPage(i,n),l.translationDone())},undo:()=>{for(let l of r)this.#s.has(l.id)&&(l.translateInPage(-i,-n),l.translationDone())},mustExec:!1})},o);for(let l of r)l.translateInPage(t,e),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#p=new Map;for(let t of this.#v)this.#p.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#p)return!1;this.disableUserSelect(!1);let t=this.#p;this.#p=null;let e=!1;for(let[{x:i,y:n,pageIndex:r},o]of t)o.newX=i,o.newY=n,o.newPageIndex=r,e||=i!==o.savedX||n!==o.savedY||r!==o.savedPageIndex;if(!e)return!1;let s=(i,n,r,o)=>{if(this.#s.has(i.id)){let l=this.#o.get(o);l?i._setParentAndPosition(l,n,r):(i.pageIndex=o,i.x=n,i.y=r)}};return this.addCommands({cmd:()=>{for(let[i,{newX:n,newY:r,newPageIndex:o}]of t)s(i,n,r,o)},undo:()=>{for(let[i,{savedX:n,savedY:r,savedPageIndex:o}]of t)s(i,n,r,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#p)for(let s of this.#p.keys())s.drag(t,e)}rebuild(t){if(t.parent===null){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#v.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#e===t}getActive(){return this.#e}getMode(){return this.#T}isEditingMode(){return this.#T!==B.NONE}get imageManager(){return U(this,"imageManager",new Ji)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let h=0,c=e.rangeCount;h<c;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;let{x:s,y:i,width:n,height:r}=t.getBoundingClientRect(),o;switch(t.getAttribute("data-main-rotation")){case"90":o=(h,c,d,u)=>({x:(c-i)/r,y:1-(h+d-s)/n,width:u/r,height:d/n});break;case"180":o=(h,c,d,u)=>({x:1-(h+d-s)/n,y:1-(c+u-i)/r,width:d/n,height:u/r});break;case"270":o=(h,c,d,u)=>({x:1-(c+u-i)/r,y:(h-s)/n,width:u/r,height:d/n});break;default:o=(h,c,d,u)=>({x:(h-s)/n,y:(c-i)/r,width:d/n,height:u/r});break}let l=[];for(let h=0,c=e.rangeCount;h<c;h++){let d=e.getRangeAt(h);if(!d.collapsed)for(let{x:u,y:f,width:g,height:p}of d.getClientRects())g===0||p===0||l.push(o(u,f,g,p))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:t,id:e}){(this.#a||=new Map).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){this.#a?.delete(t)}renderAnnotationElement(t){let e=this.#a?.get(t.data.id);if(!e)return;let s=this.#r.getRawValue(e);s&&(this.#T===B.NONE&&!s.hasBeenModified||s.renderAnnotationElement(t))}setMissingCanvas(t,e,s){let i=this.#N?.get(t);i&&(i.setCanvas(e,s),this.#N.delete(t))}addMissingCanvas(t,e){(this.#N||=new Map).set(t,e)}},js=class a{#t=null;#e=!1;#i=null;#s=null;#o=null;#n=null;#r=!1;#a=null;#h=null;#l=null;#u=null;#d=!1;static#f=null;static _l10n=null;constructor(t){this.#h=t,this.#d=t._uiManager.useNewAltTextFlow,a.#f||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(t){a._l10n??=t}async render(){let t=this.#i=document.createElement("button");t.className="altText",t.tabIndex="0";let e=this.#s=document.createElement("span");t.append(e),this.#d?(t.classList.add("new"),t.setAttribute("data-l10n-id",a.#f.missing),e.setAttribute("data-l10n-id",a.#f["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let s=this.#h._uiManager._signal;t.addEventListener("contextmenu",Lt,{signal:s}),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});let i=n=>{n.preventDefault(),this.#h._uiManager.editAltText(this.#h),this.#d&&this.#h._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#m}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(this.#r=!0,i(n))},{signal:s}),await this.#p(),t}get#m(){return this.#t&&"added"||this.#t===null&&this.guessedText&&"review"||"missing"}finish(){this.#i&&(this.#i.focus({focusVisible:this.#r}),this.#r=!1)}isEmpty(){return this.#d?this.#t===null:!this.#t&&!this.#e}hasData(){return this.#d?this.#t!==null||!!this.#l:this.isEmpty()}get guessedText(){return this.#l}async setGuessedText(t){this.#t===null&&(this.#l=t,this.#u=await a._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t}),this.#p())}toggleAltTextBadge(t=!1){if(!this.#d||this.#t){this.#a?.remove(),this.#a=null;return}if(!this.#a){let e=this.#a=document.createElement("div");e.className="noAltTextBadge",this.#h.div.append(e)}this.#a.classList.toggle("hidden",!t)}serialize(t){let e=this.#t;return!t&&this.#l===e&&(e=this.#u),{altText:e,decorative:this.#e,guessedText:this.#l,textWithDisclaimer:this.#u}}get data(){return{altText:this.#t,decorative:this.#e}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:n=!1}){s&&(this.#l=s,this.#u=i),!(this.#t===t&&this.#e===e)&&(n||(this.#t=t,this.#e=e),this.#p())}toggle(t=!1){this.#i&&(!t&&this.#n&&(clearTimeout(this.#n),this.#n=null),this.#i.disabled=!t)}shown(){this.#h._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#m}})}destroy(){this.#i?.remove(),this.#i=null,this.#s=null,this.#o=null,this.#a?.remove(),this.#a=null}async#p(){let t=this.#i;if(!t)return;if(this.#d){if(t.classList.toggle("done",!!this.#t),t.setAttribute("data-l10n-id",a.#f[this.#m]),this.#s?.setAttribute("data-l10n-id",a.#f[`${this.#m}-label`]),!this.#t){this.#o?.remove();return}}else{if(!this.#t&&!this.#e){t.classList.remove("done"),this.#o?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=this.#o;if(!e){this.#o=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${this.#h.id}`;let i=100,n=this.#h._uiManager._signal;n.addEventListener("abort",()=>{clearTimeout(this.#n),this.#n=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#n=setTimeout(()=>{this.#n=null,this.#o.classList.add("show"),this.#h._reportTelemetry({action:"alt_text_tooltip"})},i)},{signal:n}),t.addEventListener("mouseleave",()=>{this.#n&&(clearTimeout(this.#n),this.#n=null),this.#o?.classList.remove("show")},{signal:n})}this.#e?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=this.#t),e.parentNode||t.append(e),this.#h.getElementForAltText()?.setAttribute("aria-describedby",e.id)}},Ce=class{#t=null;#e=null;#i=!1;#s=null;#o=null;#n=null;#r=null;#a=null;#h=!1;#l=null;constructor(t){this.#s=t}renderForToolbar(){let t=this.#e=document.createElement("button");return t.className="comment",this.#u(t,!1)}renderForStandalone(){let t=this.#t=document.createElement("button");t.className="annotationCommentButton";let e=this.#s.commentButtonPosition;if(e){let{style:s}=t;s.insetInlineEnd=`calc(${100*(this.#s._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,s.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;let i=this.#s.commentButtonColor;i&&(s.backgroundColor=i)}return this.#u(t,!0)}focusButton(){setTimeout(()=>{(this.#t??this.#e)?.focus()},0)}onUpdatedColor(){if(!this.#t)return;let t=this.#s.commentButtonColor;t&&(this.#t.style.backgroundColor=t),this.#s._uiManager.updatePopupColor(this.#s)}get commentButtonWidth(){return(this.#t?.getBoundingClientRect().width??0)/this.#s.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#l)return this.#l;if(!this.#t)return null;let{x:t,y:e,height:s}=this.#t.getBoundingClientRect(),{x:i,y:n,width:r,height:o}=this.#s.parent.boundingClientRect;return[(t-i)/r,(e+s-n)/o]}set commentPopupPositionInLayer(t){this.#l=t}hasDefaultPopupPosition(){return this.#l===null}removeStandaloneCommentButton(){this.#t?.remove(),this.#t=null}removeToolbarCommentButton(){this.#e?.remove(),this.#e=null}setCommentButtonStates({selected:t,hasPopup:e}){this.#t&&(this.#t.classList.toggle("selected",t),this.#t.ariaExpanded=e)}#u(t,e){if(!this.#s._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[this.#s._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button"));let s=this.#s._uiManager._signal;if(!(s instanceof AbortSignal)||s.aborted)return t;t.addEventListener("contextmenu",Lt,{signal:s}),e&&(t.addEventListener("focusin",n=>{this.#s._focusEventsAllowed=!1,ot(n)},{capture:!0,signal:s}),t.addEventListener("focusout",n=>{this.#s._focusEventsAllowed=!0,ot(n)},{capture:!0,signal:s})),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});let i=n=>{n.preventDefault(),t===this.#e?this.edit():this.#s.toggleComment(!0)};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(this.#i=!0,i(n))},{signal:s}),t.addEventListener("pointerenter",()=>{this.#s.toggleComment(!1,!0)},{signal:s}),t.addEventListener("pointerleave",()=>{this.#s.toggleComment(!1,!1)},{signal:s}),t}edit(t){let e=this.commentPopupPositionInLayer,s,i;if(e)[s,i]=e;else{[s,i]=this.#s.commentButtonPosition;let{width:c,height:d,x:u,y:f}=this.#s;s=u+s*c,i=f+i*d}let n=this.#s.parent.boundingClientRect,{x:r,y:o,width:l,height:h}=n;this.#s._uiManager.editComment(this.#s,r+s*l,o+i*h,{...t,parentDimensions:n})}finish(){this.#e&&(this.#e.focus({focusVisible:this.#i}),this.#i=!1)}isDeleted(){return this.#h||this.#r===""}isEmpty(){return this.#r===null}hasBeenEdited(){return this.isDeleted()||this.#r!==this.#o}serialize(){return this.data}get data(){return{text:this.#r,richText:this.#n,date:this.#a,deleted:this.isDeleted()}}set data(t){if(t!==this.#r&&(this.#n=null),t===null){this.#r="",this.#h=!0;return}this.#r=t,this.#a=new Date,this.#h=!1}setInitialText(t,e=null){this.#o=t,this.data=t,this.#a=null,this.#n=e}shown(){}destroy(){this.#e?.remove(),this.#e=null,this.#t?.remove(),this.#t=null,this.#r="",this.#n=null,this.#a=null,this.#s=null,this.#i=!1,this.#h=!1}},ts=class a{#t;#e=!1;#i=null;#s;#o;#n;#r;#a=null;#h;#l=null;#u;#d=null;constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:s=null,onPinchStart:i=null,onPinching:n=null,onPinchEnd:r=null,signal:o}){this.#t=t,this.#i=s,this.#s=e,this.#o=i,this.#n=n,this.#r=r,this.#u=new AbortController,this.#h=AbortSignal.any([o,this.#u.signal]),t.addEventListener("touchstart",this.#f.bind(this),{passive:!1,signal:this.#h})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/qt.pixelRatio}#f(t){if(this.#s?.())return;if(t.touches.length===1){if(this.#a)return;let i=this.#a=new AbortController,n=AbortSignal.any([this.#h,i.signal]),r=this.#t,o={capture:!0,signal:n,passive:!1},l=h=>{h.pointerType==="touch"&&(this.#a?.abort(),this.#a=null)};r.addEventListener("pointerdown",h=>{h.pointerType==="touch"&&(ot(h),l(h))},o),r.addEventListener("pointerup",l,o),r.addEventListener("pointercancel",l,o);return}if(!this.#d){this.#d=new AbortController;let i=AbortSignal.any([this.#h,this.#d.signal]),n=this.#t,r={signal:i,capture:!1,passive:!1};n.addEventListener("touchmove",this.#m.bind(this),r);let o=this.#p.bind(this);n.addEventListener("touchend",o,r),n.addEventListener("touchcancel",o,r),r.capture=!0,n.addEventListener("pointerdown",ot,r),n.addEventListener("pointermove",ot,r),n.addEventListener("pointercancel",ot,r),n.addEventListener("pointerup",ot,r),this.#o?.()}if(ot(t),t.touches.length!==2||this.#i?.()){this.#l=null;return}let[e,s]=t.touches;e.identifier>s.identifier&&([e,s]=[s,e]),this.#l={touch0X:e.screenX,touch0Y:e.screenY,touch1X:s.screenX,touch1Y:s.screenY}}#m(t){if(!this.#l||t.touches.length!==2)return;ot(t);let[e,s]=t.touches;e.identifier>s.identifier&&([e,s]=[s,e]);let{screenX:i,screenY:n}=e,{screenX:r,screenY:o}=s,l=this.#l,{touch0X:h,touch0Y:c,touch1X:d,touch1Y:u}=l,f=d-h,g=u-c,p=r-i,b=o-n,m=Math.hypot(p,b)||1,y=Math.hypot(f,g)||1;if(!this.#e&&Math.abs(y-m)<=a.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=i,l.touch0Y=n,l.touch1X=r,l.touch1Y=o,!this.#e){this.#e=!0;return}let A=[(i+r)/2,(n+o)/2];this.#n?.(A,y,m)}#p(t){t.touches.length>=2||(this.#d&&(this.#d.abort(),this.#d=null,this.#r?.()),this.#l&&(ot(t),this.#l=null,this.#e=!1))}destroy(){this.#u?.abort(),this.#u=null,this.#a?.abort(),this.#a=null}},tt=class a{#t=null;#e=null;#i=null;#s=null;#o=null;#n=!1;#r=null;#a="";#h=null;#l=null;#u=null;#d=null;#f=null;#m="";#p=!1;#c=null;#g=!1;#b=!1;#A=!1;#y=null;#x=0;#_=0;#w=null;#C=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#E=!1;#S=a._zIndex++;static _borderLineWidth=-1;static _colorManager=new tn;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=a.prototype._resizeWithKeyboard,e=le.TRANSLATE_SMALL,s=le.TRANSLATE_BIG;return U(this,"_resizerKeyboardManager",new pe([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,s]}],[["Escape","mac+Escape"],a.prototype._stopResizingWithKeyboard]]))}constructor(t){this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null;let{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,r];let[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}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 U(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new en({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(a._l10n??=t,a._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"}),a._borderLineWidth!==-1)return;let s=getComputedStyle(document.documentElement);a._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){Q("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#E}set _isDraggable(t){this.#E=t,this.div?.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#S}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(this.#O(),this.#d?.remove(),this.#d=null),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#p?this.#p=!1:this.parent.setSelected(this))}focusout(t){!this._focusEventsAllowed||!this.isAttachedToDOM||t.relatedTarget?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){let[n,r]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/n,this.y=(e+i)/r,this.fixAndSetPosition()}_moveAfterPaste(t,e){let[s,i]=this.parentDimensions;this.setAt(t*s,e*i,this.width*s,this.height*i),this._onTranslated()}#k([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(t,e){this.#k(this.parentDimensions,t,e)}translateInPage(t,e){this.#c||=[this.x,this.y,this.width,this.height],this.#k(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){this.#c||=[this.x,this.y,this.width,this.height];let{div:s,parentDimensions:[i,n]}=this;if(this.x+=t/i,this.y+=e/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:d,y:u}=this.div.getBoundingClientRect();this.parent.findNewParent(this,d,u)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:r,y:o}=this,[l,h]=this.getBaseTranslation();r+=l,o+=h;let{style:c}=s;c.left=`${(100*r).toFixed(2)}%`,c.top=`${(100*o).toFixed(2)}%`,this._onTranslating(r,o),s.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!this.#c&&(this.#c[0]!==this.x||this.#c[1]!==this.y)}get _hasBeenResized(){return!!this.#c&&(this.#c[2]!==this.width||this.#c[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:s}=a,i=s/t,n=s/e;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(t=this.rotation){let{div:{style:e},pageDimensions:[s,i]}=this,{x:n,y:r,width:o,height:l}=this;if(o*=s,l*=i,n*=s,r*=i,this._mustFixPosition)switch(t){case 0:n=_t(n,0,s-o),r=_t(r,0,i-l);break;case 90:n=_t(n,0,s-l),r=_t(r,o,i);break;case 180:n=_t(n,o,s),r=_t(r,l,i);break;case 270:n=_t(n,l,s),r=_t(r,0,i-o);break}this.x=n/=s,this.y=r/=i;let[h,c]=this.getBaseTranslation();n+=h,r+=c,e.left=`${(100*n).toFixed(2)}%`,e.top=`${(100*r).toFixed(2)}%`,this.moveInDOM()}static#P(t,e,s){switch(s){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return a.#P(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return a.#P(t,e,360-this.parentRotation)}#R(t){switch(t){case 90:{let[e,s]=this.pageDimensions;return[0,-e/s,s/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,s]=this.pageDimensions;return[0,e/s,-s/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,s]}=this;return[e*t,s*t]}setDims(){let{div:{style:t},width:e,height:s}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*s).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#F(){if(this.#h)return;this.#h=document.createElement("div"),this.#h.classList.add("resizers");let t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(let s of t){let i=document.createElement("div");this.#h.append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",this.#L.bind(this,s),{signal:e}),i.addEventListener("contextmenu",Lt,{signal:e}),i.tabIndex=-1}this.div.prepend(this.#h)}#L(t,e){e.preventDefault();let{isMac:s}=dt.platform;if(e.button!==0||e.ctrlKey&&s)return;this.#i?.toggle(!1);let i=this._isDraggable;this._isDraggable=!1,this.#l=[e.screenX,e.screenY];let n=new AbortController,r=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#N.bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("touchmove",ot,{passive:!1,signal:r}),window.addEventListener("contextmenu",Lt,{signal:r}),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let h=()=>{n.abort(),this.parent.togglePointerEvents(!0),this.#i?.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=o,this.div.style.cursor=l,this.#B()};window.addEventListener("pointerup",h,{signal:r}),window.addEventListener("blur",h,{signal:r})}#I(t,e,s,i){this.width=s,this.height=i,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#B(){if(!this.#u)return;let{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=this.#u;this.#u=null;let n=this.x,r=this.y,o=this.width,l=this.height;n===t&&r===e&&o===s&&l===i||this.addCommands({cmd:this.#I.bind(this,n,r,o,l),undo:this.#I.bind(this,t,e,s,i),mustExec:!0})}static _round(t){return Math.round(t*1e4)/1e4}#N(t,e){let[s,i]=this.parentDimensions,n=this.x,r=this.y,o=this.width,l=this.height,h=a.MIN_SIZE/s,c=a.MIN_SIZE/i,d=this.#R(this.rotation),u=(P,D)=>[d[0]*P+d[2]*D,d[1]*P+d[3]*D],f=this.#R(360-this.rotation),g=(P,D)=>[f[0]*P+f[2]*D,f[1]*P+f[3]*D],p,b,m=!1,y=!1;switch(t){case"topLeft":m=!0,p=(P,D)=>[0,0],b=(P,D)=>[P,D];break;case"topMiddle":p=(P,D)=>[P/2,0],b=(P,D)=>[P/2,D];break;case"topRight":m=!0,p=(P,D)=>[P,0],b=(P,D)=>[0,D];break;case"middleRight":y=!0,p=(P,D)=>[P,D/2],b=(P,D)=>[0,D/2];break;case"bottomRight":m=!0,p=(P,D)=>[P,D],b=(P,D)=>[0,0];break;case"bottomMiddle":p=(P,D)=>[P/2,D],b=(P,D)=>[P/2,0];break;case"bottomLeft":m=!0,p=(P,D)=>[0,D],b=(P,D)=>[P,0];break;case"middleLeft":y=!0,p=(P,D)=>[0,D/2],b=(P,D)=>[P,D/2];break}let A=p(o,l),w=b(o,l),v=u(...w),E=a._round(n+v[0]),_=a._round(r+v[1]),S=1,x=1,T,C;if(e.fromKeyboard)({deltaX:T,deltaY:C}=e);else{let{screenX:P,screenY:D}=e,[N,X]=this.#l;[T,C]=this.screenToPageTranslation(P-N,D-X),this.#l[0]=P,this.#l[1]=D}if([T,C]=g(T/s,C/i),m){let P=Math.hypot(o,l);S=x=Math.max(Math.min(Math.hypot(w[0]-A[0]-T,w[1]-A[1]-C)/P,1/o,1/l),h/o,c/l)}else y?S=_t(Math.abs(w[0]-A[0]-T),h,1)/o:x=_t(Math.abs(w[1]-A[1]-C),c,1)/l;let I=a._round(o*S),O=a._round(l*x);v=u(...b(I,O));let L=E-v[0],j=_-v[1];this.#c||=[this.x,this.y,this.width,this.height],this.width=I,this.height=O,this.x=L,this.y=j,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#i?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#b)return this._editToolbar;this._editToolbar=new Yi(this),this.div.append(this._editToolbar.render());let{toolbarButtons:t}=this;if(t)for(let[e,s]of t)await this._editToolbar.addButton(e,s);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#i?.destroy()}addContainer(t){let e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#i||(js.initialize(a._l10n),this.#i=new js(this),this.#t&&(this.#i.data=this.#t,this.#t=null)),this.#i}get altTextData(){return this.#i?.data}set altTextData(t){this.#i&&(this.#i.data=t)}get guessedAltText(){return this.#i?.guessedText}async setGuessedAltText(t){await this.#i?.setGuessedText(t)}serializeAltText(t){return this.#i?.serialize(t)}hasAltText(){return!!this.#i&&!this.#i.isEmpty()}hasAltTextData(){return this.#i?.hasData()??!1}focusCommentButton(){this.#s?.focusButton()}addCommentButton(){return this.#s||=new Ce(this)}addStandaloneCommentButton(){if(this.#o){this._uiManager.isEditingMode()&&this.#o.classList.remove("hidden");return}this.hasComment&&(this.#o=this.#s.renderForStandalone(),this.div.append(this.#o))}removeStandaloneCommentButton(){this.#s.removeStandaloneCommentButton(),this.#o=null}hideStandaloneCommentButton(){this.#o?.classList.add("hidden")}get comment(){let{data:{richText:t,text:e,date:s,deleted:i}}=this.#s;return{text:e,richText:t,date:s,deleted:i,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){this.#s||=new Ce(this),this.#s.data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:t,popupRef:e,richText:s}){if(!e||(this.#s||=new Ce(this),this.#s.setInitialText(t,s),!this.annotationElementId))return;let i=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);i&&this.updateFromAnnotationLayer(i)}get hasEditedComment(){return this.#s?.hasBeenEdited()}get hasDeletedComment(){return this.#s?.isDeleted()}get hasComment(){return!!this.#s&&!this.#s.isEmpty()&&!this.#s.isDeleted()}async editComment(t){this.#s||=new Ce(this),this.#s.edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){this.#s.setSelectedButton(t)}addComment(t){if(this.hasEditedComment){let[,,,i]=t.rect,[n]=this.pageDimensions,[r]=this.pageTranslation,o=r+n+1,l=i-100,h=o+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,l,h,i]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){this.#s.data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=this.#n?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),this.#j();let[e,s]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*s/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/s).toFixed(2)}%`);let[i,n]=this.getInitialTranslation();return this.translate(i,n),Do(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#C||=new ts({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#z.bind(this),onPinching:this.#T.bind(this),onPinchEnd:this.#v.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}#z(){this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#i?.toggle(!1),this.parent.togglePointerEvents(!1)}#T(t,e,s){let n=.7*(s/e)+1-.7;if(n===1)return;let r=this.#R(this.rotation),o=(E,_)=>[r[0]*E+r[2]*_,r[1]*E+r[3]*_],[l,h]=this.parentDimensions,c=this.x,d=this.y,u=this.width,f=this.height,g=a.MIN_SIZE/l,p=a.MIN_SIZE/h;n=Math.max(Math.min(n,1/u,1/f),g/u,p/f);let b=a._round(u*n),m=a._round(f*n);if(b===u&&m===f)return;this.#c||=[c,d,u,f];let y=o(u/2,f/2),A=a._round(c+y[0]),w=a._round(d+y[1]),v=o(b/2,m/2);this.x=A-v[0],this.y=w-v[1],this.width=b,this.height=m,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#v(){this.#i?.toggle(!0),this.parent.togglePointerEvents(!0),this.#B()}pointerdown(t){let{isMac:e}=dt.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(this.#p=!0,this._isDraggable){this.#H(t);return}this.#M(t)}#M(t){let{isMac:e}=dt.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#H(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let s=!1,i=new AbortController,n=this._uiManager.combinedSignal(i),r={capture:!0,passive:!1,signal:n},o=h=>{i.abort(),this.#r=null,this.#p=!1,this._uiManager.endDragSession()||this.#M(h),s&&this._onStopDragging()};e&&(this.#x=t.clientX,this.#_=t.clientY,this.#r=t.pointerId,this.#a=t.pointerType,window.addEventListener("pointermove",h=>{s||(s=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:c,clientY:d,pointerId:u}=h;if(u!==this.#r){ot(h);return}let[f,g]=this.screenToPageTranslation(c-this.#x,d-this.#_);this.#x=c,this.#_=d,this._uiManager.dragSelectedEditors(f,g)},r),window.addEventListener("touchmove",ot,r),window.addEventListener("pointerdown",h=>{h.pointerType===this.#a&&(this.#C||h.isPrimary)&&o(h),ot(h)},r));let l=h=>{if(!this.#r||this.#r===h.pointerId){o(h);return}ot(h)};window.addEventListener("pointerup",l,{signal:n}),window.addEventListener("blur",l,{signal:n})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,s=this.rotation){let i=this.parentScale,[n,r]=this.pageDimensions,[o,l]=this.pageTranslation,h=t/i,c=e/i,d=this.x*n,u=this.y*r,f=this.width*n,g=this.height*r;switch(s){case 0:return[d+h+o,r-u-c-g+l,d+h+f+o,r-u-c+l];case 90:return[d+c+o,r-u+h+l,d+c+g+o,r-u+h+f+l];case 180:return[d-h-f+o,r-u+c+l,d-h+o,r-u+c+g+l];case 270:return[d-c-g+o,r-u-h-f+l,d-c+o,r-u-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[s,i,n,r]=t,o=n-s,l=r-i;switch(this.rotation){case 0:return[s,e-r,o,l];case 90:return[s,e-i,l,o];case 180:return[n,e-i,o,l];case 270:return[n,e-r,l,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&a._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#s?.onUpdatedColor()}getData(){let{comment:{text:t,color:e,date:s,opacity:i,deleted:n,richText:r},uid:o,pageIndex:l,creationDate:h,modificationDate:c}=this;return{id:o,pageIndex:l,rect:this.getPDFRect(),richText:r,contentsObj:{str:t},creationDate:h,modificationDate:s||c,popupRef:!n,color:e,opacity:i}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),this.#b=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#b=!1,!0):!1}isInEditMode(){return this.#b}shouldGetKeyboardEvents(){return this.#A}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:t,left:e,bottom:s,right:i}=this.getClientDimensions(),{innerHeight:n,innerWidth:r}=window;return e<r&&i>0&&t<n&&s>0}#j(){if(this.#f||!this.div)return;this.#f=new AbortController;let t=this._uiManager.combinedSignal(this.#f);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#j()}rotate(t){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(t=!1,e=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(t,e,s){let i=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:s,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});i.rotation=t.rotation,i.#t=t.accessibilityData,i._isCopy=t.isCopy||!1;let[n,r]=i.pageDimensions,[o,l,h,c]=i.getRectInCurrentCoords(t.rect,r);return i.x=o/n,i.y=l/r,i.width=h/n,i.height=c/r,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#f?.abort(),this.#f=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#O(),this.removeEditToolbar(),this.#w){for(let t of this.#w.values())clearTimeout(t);this.#w=null}this.parent=null,this.#C?.destroy(),this.#C=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#F(),this.#h.classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,e]}=this,[s,i,n,r]=this.getPDFRect();return[a._round(s+(n-s)*t),a._round(i+(r-i)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#s.commentPopupPositionInLayer}set commentPopupPosition(t){this.#s.commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return this.#s.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#s.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){this.#s.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),this.#u={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let e=this.#h.children;if(!this.#e){this.#e=Array.from(e);let r=this.#X.bind(this),o=this.#W.bind(this),l=this._uiManager._signal;for(let h of this.#e){let c=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",r,{signal:l}),h.addEventListener("blur",o,{signal:l}),h.addEventListener("focus",this.#q.bind(this,c),{signal:l}),h.setAttribute("data-l10n-id",a._l10nResizer[c])}}let s=this.#e[0],i=0;for(let r of e){if(r===s)break;i++}let n=(360-this.rotation+this.parentRotation)%360/90*(this.#e.length/4);if(n!==i){if(n<i)for(let o=0;o<i-n;o++)this.#h.append(this.#h.firstChild);else if(n>i)for(let o=0;o<n-i;o++)this.#h.firstChild.before(this.#h.lastChild);let r=0;for(let o of e){let h=this.#e[r++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",a._l10nResizer[h])}}this.#$(0),this.#A=!0,this.#h.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#X(t){a._resizerKeyboardManager.exec(this,t)}#W(t){this.#A&&t.relatedTarget?.parentNode!==this.#h&&this.#O()}#q(t){this.#m=this.#A?t:""}#$(t){if(this.#e)for(let e of this.#e)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#A&&this.#N(this.#m,{deltaX:t,deltaY:e,fromKeyboard:!0})}#O(){this.#A=!1,this.#$(-1),this.#B()}_stopResizingWithKeyboard(){this.#O(),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#i?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#h?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#i?.toggleAltTextBadge(!0),this.hasComment&&this._uiManager.toggleComment(this,!1,!1))}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){t.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#g}set isEditing(t){this.#g=t,this.parent&&(t?(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(t,e=!1){if(e){this.#w||=new Map;let{action:s}=t,i=this.#w.get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),this.#w.delete(s),this.#w.size===0&&(this.#w=null)},a._telemetryTimeout),this.#w.set(s,i);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#n=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#n=!0}updateFakeAnnotationElement(t){if(!this.#d&&!this.deleted){this.#d=t.addFakeAnnotation(this);return}if(this.deleted){this.#d.remove(),this.#d=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#d.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){let s=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.before(e)}return e}resetAnnotationElement(t){let{firstChild:e}=t.container;e?.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}},en=class extends tt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},oo=3285377520,Nt=4294901760,Wt=65535,$s=class{constructor(t){this.h1=t?t&4294967295:oo,this.h2=t?t&4294967295:oo}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let p=0,b=t.length;p<b;p++){let m=t.charCodeAt(p);m<=255?e[s++]=m:(e[s++]=m>>>8,e[s++]=m&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),s=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");let i=s>>2,n=s-i*4,r=new Uint32Array(e.buffer,0,i),o=0,l=0,h=this.h1,c=this.h2,d=3432918353,u=461845907,f=d&Wt,g=u&Wt;for(let p=0;p<i;p++)p&1?(o=r[p],o=o*d&Nt|o*f&Wt,o=o<<15|o>>>17,o=o*u&Nt|o*g&Wt,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(l=r[p],l=l*d&Nt|l*f&Wt,l=l<<15|l>>>17,l=l*u&Nt|l*g&Wt,c^=l,c=c<<13|c>>>19,c=c*5+3864292196);switch(o=0,n){case 3:o^=e[i*4+2]<<16;case 2:o^=e[i*4+1]<<8;case 1:o^=e[i*4],o=o*d&Nt|o*f&Wt,o=o<<15|o>>>17,o=o*u&Nt|o*g&Wt,i&1?h^=o:c^=o}this.h1=h,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Nt|t*36045&Wt,e=e*4283543511&Nt|((e<<16|t>>>16)*2950163797&Nt)>>>16,t^=e>>>1,t=t*444984403&Nt|t*60499&Wt,e=e*3301882366&Nt|((e<<16|t>>>16)*3120437893&Nt)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},sn=Object.freeze({map:null,hash:"",transfer:void 0}),es=class{#t=!1;#e=null;#i=null;#s=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){let s=this.#s.get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return this.#s.get(t)}remove(t){let e=this.#s.get(t);if(e!==void 0&&(e instanceof tt&&this.#i.delete(e.annotationElementId),this.#s.delete(t),this.#s.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function")){for(let s of this.#s.values())if(s instanceof tt)return;this.onAnnotationEditor(null)}}setValue(t,e){let s=this.#s.get(t),i=!1;if(s!==void 0)for(let[n,r]of Object.entries(e))s[n]!==r&&(i=!0,s[n]=r);else i=!0,this.#s.set(t,e);i&&this.#o(),e instanceof tt&&((this.#i||=new Map).set(e.annotationElementId,e),typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type))}has(t){return this.#s.has(t)}get size(){return this.#s.size}#o(){this.#t||(this.#t=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#t&&(this.#t=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Gs(this)}get serializable(){if(this.#s.size===0)return sn;let t=new Map,e=new $s,s=[],i=Object.create(null),n=!1;for(let[r,o]of this.#s){let l=o instanceof tt?o.serialize(!1,i):o;l&&(t.set(r,l),e.update(`${r}:${JSON.stringify(l)}`),n||=!!l.bitmap)}if(n)for(let r of t.values())r.bitmap&&s.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:sn}get editorStats(){let t=null,e=new Map,s=0,i=0;for(let n of this.#s.values()){if(!(n instanceof tt)){n.popup&&(n.popup.deleted?i+=1:s+=1);continue}n.isCommentDeleted?i+=1:n.hasEditedComment&&(s+=1);let r=n.telemetryFinalData;if(!r)continue;let{type:o}=r;e.has(o)||e.set(o,Object.getPrototypeOf(n).constructor),t||=Object.create(null);let l=t[o]||=new Map;for(let[h,c]of Object.entries(r)){if(h==="type")continue;let d=l.get(h);d||(d=new Map,l.set(h,d));let u=d.get(c)??0;d.set(c,u+1)}}if((i>0||s>0)&&(t||=Object.create(null),t.comments={deleted:i,edited:s}),!t)return null;for(let[n,r]of e)t[n]=r.computeTelemetryFinalData(t[n]);return t}resetModifiedIds(){this.#e=null}updateEditor(t,e){let s=this.#i?.get(t);return s?(s.updateFromAnnotationLayer(e),!0):!1}getEditor(t){return this.#i?.get(t)||null}get modifiedIds(){if(this.#e)return this.#e;let t=[];if(this.#i)for(let e of this.#i.values())e.serialize()&&t.push(e.annotationElementId);return this.#e={ids:new Set(t),hash:t.join(",")}}[Symbol.iterator](){return this.#s.entries()}},Gs=class extends es{#t;constructor(t){super();let{map:e,hash:s,transfer:i}=t.serializable,n=structuredClone(e,i?{transfer:i}:null);this.#t={map:n,hash:s,transfer:i}}get print(){Q("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#t}get modifiedIds(){return U(this,"modifiedIds",{ids:new Set,hash:""})}},nn=class{#t=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#t.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:s}){if(!(!t||this.#t.has(t.loadedName))){if(z(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:i,src:n,style:r}=t,o=new FontFace(i,n,r);this.addNativeFontFace(o);try{await o.load(),this.#t.add(i),s?.(t)}catch{H(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}Q("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){let s=t.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw H(`Failed to load font '${s.family}': '${i}'.`),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(s=>{let i=this._queueLoadingCallback(s);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){let t=!!this._document?.fonts;return U(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return U(this,"isSyncFontLoadingSupported",xt||dt.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(z(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){let n=s.shift();setTimeout(n.callback,0)}}let{loadingRequests:s}=this,i={done:!1,complete:e,callback:t};return s.push(i),i}get _loadTestFont(){let t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return U(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function s(w,v){return w.charCodeAt(v)<<24|w.charCodeAt(v+1)<<16|w.charCodeAt(v+2)<<8|w.charCodeAt(v+3)&255}function i(w,v,E,_){let S=w.substring(0,v),x=w.substring(v+E);return S+_+x}let n,r,o=this._document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d"),h=0;function c(w,v){if(++h>30){H("Load test font never loaded."),v();return}if(l.font="30px "+w,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){v();return}setTimeout(c.bind(null,w,v))}let d=`lt${Date.now()}${this.loadTestFontId++}`,u=this._loadTestFont;u=i(u,976,d.length,d);let g=16,p=1482184792,b=s(u,g);for(n=0,r=d.length-3;n<r;n+=4)b=b-p+s(d,n)|0;n<d.length&&(b=b-p+s(d+"XXX",n)|0),u=i(u,g,4,hl(b));let m=`url(data:font/opentype;base64,${btoa(u)});`,y=`@font-face {font-family:"${d}";src:${m}}`;this.insertRule(y);let A=this._document.createElement("div");A.style.visibility="hidden",A.style.width=A.style.height="10px",A.style.position="absolute",A.style.top=A.style.left="0px";for(let w of[t.loadedName,d]){let v=this._document.createElement("span");v.textContent="Hi",v.style.fontFamily=w,A.append(v)}this._document.body.append(A),c(d,()=>{A.remove(),e.complete()})}},rn=class{#t;constructor(t,e=null,s,i){this.compiledGlyphs=Object.create(null),this.#t=t,this._inspectFont=e,s&&Object.assign(this,s),i&&(this.charProcOperatorList=i)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${xo(this.data)});`,e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let s=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(s+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${s}src:${t}}`}return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let s=this.loadedName+"_path_"+e,i;try{i=t.get(s)}catch(r){H(`getPathGenerator - ignoring character: "${r}".`)}let n=new Path2D(i||"");return this.fontExtraProperties||t.delete(s),this.compiledGlyphs[e]=n}get black(){return this.#t.black}get bold(){return this.#t.bold}get disableFontFace(){return this.#t.disableFontFace??!1}get fontExtraProperties(){return this.#t.fontExtraProperties??!1}get isInvalidPDFjsFont(){return this.#t.isInvalidPDFjsFont}get isType3Font(){return this.#t.isType3Font}get italic(){return this.#t.italic}get missingFile(){return this.#t.missingFile}get remeasure(){return this.#t.remeasure}get vertical(){return this.#t.vertical}get ascent(){return this.#t.ascent}get defaultWidth(){return this.#t.defaultWidth}get descent(){return this.#t.descent}get bbox(){return this.#t.bbox}get fontMatrix(){return this.#t.fontMatrix}get fallbackName(){return this.#t.fallbackName}get loadedName(){return this.#t.loadedName}get mimetype(){return this.#t.mimetype}get name(){return this.#t.name}get data(){return this.#t.data}clearData(){this.#t.clearData()}get cssFontInfo(){return this.#t.cssFontInfo}get systemFontInfo(){return this.#t.systemFontInfo}get defaultVMetrics(){return this.#t.defaultVMetrics}};function bl(a){if(a instanceof URL)return a.href;if(typeof a=="string"){if(xt)return a;let t=URL.parse(a,window.location);if(t)return t.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function yl(a){if(xt&&typeof Buffer<"u"&&a instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength)return a;if(typeof a=="string")return us(a);if(a instanceof ArrayBuffer||ArrayBuffer.isView(a)||typeof a=="object"&&!isNaN(a?.length))return new Uint8Array(a);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Cs(a){if(typeof a!="string")return null;if(a.endsWith("/"))return a;throw new Error(`Invalid factory url: "${a}" must include trailing slash.`)}var on=a=>typeof a=="object"&&Number.isInteger(a?.num)&&a.num>=0&&Number.isInteger(a?.gen)&&a.gen>=0,Al=a=>typeof a=="object"&&typeof a?.name=="string",Lo=fl.bind(null,on,Al),an=class{#t=new Map;#e=Promise.resolve();postMessage(t,e){let s={data:structuredClone(t,e?{transfer:e}:null)};this.#e.then(()=>{for(let[i]of this.#t)i.call(this,s)})}addEventListener(t,e,s=null){let i=null;if(s?.signal instanceof AbortSignal){let{signal:n}=s;if(n.aborted){H("LoopbackPort - cannot use an `aborted` signal.");return}let r=()=>this.removeEventListener(t,e);i=()=>n.removeEventListener("abort",r),n.addEventListener("abort",r)}this.#t.set(e,i)}removeEventListener(t,e){this.#t.get(e)?.(),this.#t.delete(e)}terminate(){for(let[,t]of this.#t)t?.();this.#t.clear()}},Ps={DATA:1,ERROR:2},ct={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function ao(){}function Ct(a){if(a instanceof Ut||a instanceof De||a instanceof Fs||a instanceof fe||a instanceof Ye)return a;switch(a instanceof Error||typeof a=="object"&&a!==null||Q('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),a.name){case"AbortException":return new Ut(a.message);case"InvalidPDFException":return new De(a.message);case"PasswordException":return new Fs(a.message,a.code);case"ResponseException":return new fe(a.message,a.status,a.missing);case"UnknownErrorException":return new Ye(a.message,a.details)}return new Ye(a.message,a.toString())}var ue=class{#t=new AbortController;constructor(t,e,s){this.sourceName=t,this.targetName=e,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",this.#e.bind(this),{signal:this.#t.signal})}#e({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){this.#s(t);return}if(t.callback){let s=t.callbackId,i=this.callbackCapabilities[s];if(!i)throw new Error(`Cannot resolve callback ${s}`);if(delete this.callbackCapabilities[s],t.callback===Ps.DATA)i.resolve(t.data);else if(t.callback===Ps.ERROR)i.reject(Ct(t.reason));else throw new Error("Unexpected callback case");return}let e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let s=this.sourceName,i=t.sourceName,n=this.comObj;Promise.try(e,t.data).then(function(r){n.postMessage({sourceName:s,targetName:i,callback:Ps.DATA,callbackId:t.callbackId,data:r})},function(r){n.postMessage({sourceName:s,targetName:i,callback:Ps.ERROR,callbackId:t.callbackId,reason:Ct(r)})});return}if(t.streamId){this.#i(t);return}e(t.data)}on(t,e){let s=this.actionHandler;if(s[t])throw new Error(`There is already an actionName called "${t}"`);s[t]=e}send(t,e,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},s)}sendWithPromise(t,e,s){let i=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},s)}catch(r){n.reject(r)}return n.promise}sendWithStream(t,e,s,i){let n=this.streamId++,r=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{let c=Promise.withResolvers();return this.streamControllers[n]={controller:h,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:r,targetName:o,action:t,streamId:n,data:e,desiredSize:h.desiredSize},i),c.promise},pull:h=>{let c=Promise.withResolvers();return this.streamControllers[n].pullCall=c,l.postMessage({sourceName:r,targetName:o,stream:ct.PULL,streamId:n,desiredSize:h.desiredSize}),c.promise},cancel:h=>{z(h instanceof Error,"cancel must have a valid reason");let c=Promise.withResolvers();return this.streamControllers[n].cancelCall=c,this.streamControllers[n].isClosed=!0,l.postMessage({sourceName:r,targetName:o,stream:ct.CANCEL,streamId:n,reason:Ct(h)}),c.promise}},s)}#i(t){let e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,r=this,o=this.actionHandler[t.action],l={enqueue(h,c=1,d){if(this.isCancelled)return;let u=this.desiredSize;this.desiredSize-=c,u>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:ct.ENQUEUE,streamId:e,chunk:h},d)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:ct.CLOSE,streamId:e}),delete r.streamSinks[e])},error(h){z(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:ct.ERROR,streamId:e,reason:Ct(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,Promise.try(o,t.data,l).then(function(){n.postMessage({sourceName:s,targetName:i,stream:ct.START_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:ct.START_COMPLETE,streamId:e,reason:Ct(h)})})}#s(t){let e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,r=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case ct.START_COMPLETE:t.success?r.startCall.resolve():r.startCall.reject(Ct(t.reason));break;case ct.PULL_COMPLETE:t.success?r.pullCall.resolve():r.pullCall.reject(Ct(t.reason));break;case ct.PULL:if(!o){n.postMessage({sourceName:s,targetName:i,stream:ct.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,Promise.try(o.onPull||ao).then(function(){n.postMessage({sourceName:s,targetName:i,stream:ct.PULL_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:ct.PULL_COMPLETE,streamId:e,reason:Ct(h)})});break;case ct.ENQUEUE:if(z(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(t.chunk);break;case ct.CLOSE:if(z(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#o(r,e);break;case ct.ERROR:z(r,"error should have stream controller"),r.controller.error(Ct(t.reason)),this.#o(r,e);break;case ct.CANCEL_COMPLETE:t.success?r.cancelCall.resolve():r.cancelCall.reject(Ct(t.reason)),this.#o(r,e);break;case ct.CANCEL:if(!o)break;let l=Ct(t.reason);Promise.try(o.onCancel||ao,l).then(function(){n.postMessage({sourceName:s,targetName:i,stream:ct.CANCEL_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:ct.CANCEL_COMPLETE,streamId:e,reason:Ct(h)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#o(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.#t?.abort(),this.#t=null}},zs=class{#t=!1;constructor({enableHWA:t=!1}){this.#t=t}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");let s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!this.#t})}}reset(t,e,s){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=s}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){Q("Abstract method `_createCanvas` called.")}},ln=class extends zs{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){let s=this._document.createElement("canvas");return s.width=t,s.height=e,s}},Vs=class{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw new Error("CMap name must be specified.");let e=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(e).then(s=>({cMapData:s,isCompressed:this.isCompressed})).catch(s=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}async _fetch(t){Q("Abstract method `_fetch` called.")}},Ws=class extends Vs{async _fetch(t){let e=await Oe(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):us(e)}},Xs=class{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,n){return"none"}destroy(t=!1){}},hn=class extends Xs{#t;#e;#i;#s;#o;#n;#r=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super(),this.#s=t,this.#o=e}get#a(){return this.#e||=new Map}get#h(){return this.#n||=new Map}get#l(){if(!this.#i){let t=this.#o.createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;let s=this.#o.createElementNS(Zt,"svg");s.setAttribute("width",0),s.setAttribute("height",0),this.#i=this.#o.createElementNS(Zt,"defs"),t.append(s),s.append(this.#i),this.#o.body.append(t)}return this.#i}#u(t){if(t.length===1){let l=t[0],h=new Array(256);for(let d=0;d<256;d++)h[d]=l[d]/255;let c=h.join(",");return[c,c,c]}let[e,s,i]=t,n=new Array(256),r=new Array(256),o=new Array(256);for(let l=0;l<256;l++)n[l]=e[l]/255,r[l]=s[l]/255,o[l]=i[l]/255;return[n.join(","),r.join(","),o.join(",")]}#d(t){if(this.#t===void 0){this.#t="";let e=this.#o.URL;e!==this.#o.baseURI&&(fs(e)?H('#createUrl: ignore "data:"-URL for performance reasons.'):this.#t=vr(e,""))}return`url(${this.#t}#${t})`}addFilter(t){if(!t)return"none";let e=this.#a.get(t);if(e)return e;let[s,i,n]=this.#u(t),r=t.length===1?s:`${s}${i}${n}`;if(e=this.#a.get(r),e)return this.#a.set(t,e),e;let o=`g_${this.#s}_transfer_map_${this.#r++}`,l=this.#d(o);this.#a.set(t,l),this.#a.set(r,l);let h=this.#p(o);return this.#g(s,i,n,h),l}addHCMFilter(t,e){let s=`${t}-${e}`,i="base",n=this.#h.get(i);if(n?.key===s||(n?(n.filter?.remove(),n.key=s,n.url="none",n.filter=null):(n={key:s,url:"none",filter:null},this.#h.set(i,n)),!t||!e))return n.url;let r=this.#A(t);t=k.makeHexColor(...r);let o=this.#A(e);if(e=k.makeHexColor(...o),this.#l.style.color="",t==="#000000"&&e==="#ffffff"||t===e)return n.url;let l=new Array(256);for(let f=0;f<=255;f++){let g=f/255;l[f]=g<=.03928?g/12.92:((g+.055)/1.055)**2.4}let h=l.join(","),c=`g_${this.#s}_hcm_filter`,d=n.filter=this.#p(c);this.#g(h,h,h,d),this.#m(d);let u=(f,g)=>{let p=r[f]/255,b=o[f]/255,m=new Array(g+1);for(let y=0;y<=g;y++)m[y]=p+y/g*(b-p);return m.join(",")};return this.#g(u(0,5),u(1,5),u(2,5),d),n.url=this.#d(c),n.url}addAlphaFilter(t){let e=this.#a.get(t);if(e)return e;let[s]=this.#u([t]),i=`alpha_${s}`;if(e=this.#a.get(i),e)return this.#a.set(t,e),e;let n=`g_${this.#s}_alpha_map_${this.#r++}`,r=this.#d(n);this.#a.set(t,r),this.#a.set(i,r);let o=this.#p(n);return this.#b(s,o),r}addLuminosityFilter(t){let e=this.#a.get(t||"luminosity");if(e)return e;let s,i;if(t?([s]=this.#u([t]),i=`luminosity_${s}`):i="luminosity",e=this.#a.get(i),e)return this.#a.set(t,e),e;let n=`g_${this.#s}_luminosity_map_${this.#r++}`,r=this.#d(n);this.#a.set(t,r),this.#a.set(i,r);let o=this.#p(n);return this.#f(o),t&&this.#b(s,o),r}addHighlightHCMFilter(t,e,s,i,n){let r=`${e}-${s}-${i}-${n}`,o=this.#h.get(t);if(o?.key===r||(o?(o.filter?.remove(),o.key=r,o.url="none",o.filter=null):(o={key:r,url:"none",filter:null},this.#h.set(t,o)),!e||!s))return o.url;let[l,h]=[e,s].map(this.#A.bind(this)),c=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),d=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[u,f]=[i,n].map(this.#A.bind(this));d<c&&([c,d,u,f]=[d,c,f,u]),this.#l.style.color="";let g=(m,y,A)=>{let w=new Array(256),v=(d-c)/A,E=m/255,_=(y-m)/(255*A),S=0;for(let x=0;x<=A;x++){let T=Math.round(c+x*v),C=E+x*_;for(let I=S;I<=T;I++)w[I]=C;S=T+1}for(let x=S;x<256;x++)w[x]=w[S-1];return w.join(",")},p=`g_${this.#s}_hcm_${t}_filter`,b=o.filter=this.#p(p);return this.#m(b),this.#g(g(u[0],f[0],5),g(u[1],f[1],5),g(u[2],f[2],5),b),o.url=this.#d(p),o.url}destroy(t=!1){t&&this.#n?.size||(this.#i?.parentNode.parentNode.remove(),this.#i=null,this.#e?.clear(),this.#e=null,this.#n?.clear(),this.#n=null,this.#r=0)}#f(t){let e=this.#o.createElementNS(Zt,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}#m(t){let e=this.#o.createElementNS(Zt,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}#p(t){let e=this.#o.createElementNS(Zt,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#l.append(e),e}#c(t,e,s){let i=this.#o.createElementNS(Zt,e);i.setAttribute("type","discrete"),i.setAttribute("tableValues",s),t.append(i)}#g(t,e,s,i){let n=this.#o.createElementNS(Zt,"feComponentTransfer");i.append(n),this.#c(n,"feFuncR",t),this.#c(n,"feFuncG",e),this.#c(n,"feFuncB",s)}#b(t,e){let s=this.#o.createElementNS(Zt,"feComponentTransfer");e.append(s),this.#c(s,"feFuncA",t)}#A(t){return this.#l.style.color=t,Fe(getComputedStyle(this.#l).getPropertyValue("color"))}},qs=class{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");let e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load font data at: ${e}`)})}async _fetch(t){Q("Abstract method `_fetch` called.")}},Ys=class extends qs{async _fetch(t){let e=await Oe(t,"arraybuffer");return new Uint8Array(e)}},Ks=class{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!t)throw new Error("Wasm filename must be specified.");let e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load wasm data at: ${e}`)})}async _fetch(t){Q("Abstract method `_fetch` called.")}},Zs=class extends Ks{async _fetch(t){let e=await Oe(t,"arraybuffer");return new Uint8Array(e)}};xt&&H("Please use the `legacy` build in Node.js environments.");async function xr(a){let e=await process.getBuiltinModule("fs").promises.readFile(a);return new Uint8Array(e)}var cn=class extends Xs{},dn=class extends zs{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(t,e)}},un=class extends Vs{async _fetch(t){return xr(t)}},fn=class extends qs{async _fetch(t){return xr(t)}},pn=class extends Ks{async _fetch(t){return xr(t)}},Se="__forcedDependency",{floor:lo,ceil:ho}=Math;function Rs(a,t,e,s,i,n){a[t*4+0]=Math.min(a[t*4+0],e),a[t*4+1]=Math.min(a[t*4+1],s),a[t*4+2]=Math.max(a[t*4+2],i),a[t*4+3]=Math.max(a[t*4+3],n)}var gn=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],mn=class{#t;#e;constructor(t,e){this.#t=t,this.#e=e}get length(){return this.#t.length}isEmpty(t){return this.#t[t]===gn}minX(t){return this.#e[t*4+0]/256}minY(t){return this.#e[t*4+1]/256}maxX(t){return(this.#e[t*4+2]+1)/256}maxY(t){return(this.#e[t*4+3]+1)/256}},ks=(a,t)=>{if(!a)return;let e=a.get(t);return e||(e={dependencies:new Set,isRenderingOperation:!1},a.set(t,e)),e},bn=class{#t={__proto__:null};#e={__proto__:null,transform:[],moveText:[],sameLineText:[],[Se]:[]};#i=new Map;#s=[];#o=[];#n=[[1,0,0,1,0,0]];#r=[-1/0,-1/0,1/0,1/0];#a=new Float64Array([1/0,1/0,-1/0,-1/0]);#h=-1;#l=new Set;#u=new Map;#d=new Map;#f;#m;#p;#c;#g;constructor(t,e,s=!1){this.#f=t.width,this.#m=t.height,this.#b(e),s&&(this.#g=new Map)}growOperationsCount(t){t>=this.#c.length&&this.#b(t,this.#c)}#b(t,e){let s=new ArrayBuffer(t*4);this.#p=new Uint8ClampedArray(s),this.#c=new Uint32Array(s),e&&e.length>0?(this.#c.set(e),this.#c.fill(gn,e.length)):this.#c.fill(gn)}save(t){return this.#t={__proto__:this.#t},this.#e={__proto__:this.#e,transform:{__proto__:this.#e.transform},moveText:{__proto__:this.#e.moveText},sameLineText:{__proto__:this.#e.sameLineText},[Se]:{__proto__:this.#e[Se]}},this.#r={__proto__:this.#r},this.#s.push(t),this}restore(t){let e=Object.getPrototypeOf(this.#t);if(e===null)return this;this.#t=e,this.#e=Object.getPrototypeOf(this.#e),this.#r=Object.getPrototypeOf(this.#r);let s=this.#s.pop();return s!==void 0&&(ks(this.#g,t)?.dependencies.add(s),this.#c[t]=this.#c[s]),this}recordOpenMarker(t){return this.#s.push(t),this}getOpenMarker(){return this.#s.length===0?null:this.#s.at(-1)}recordCloseMarker(t){let e=this.#s.pop();return e!==void 0&&(ks(this.#g,t)?.dependencies.add(e),this.#c[t]=this.#c[e]),this}beginMarkedContent(t){return this.#o.push(t),this}endMarkedContent(t){let e=this.#o.pop();return e!==void 0&&(ks(this.#g,t)?.dependencies.add(e),this.#c[t]=this.#c[e]),this}pushBaseTransform(t){return this.#n.push(k.multiplyByDOMMatrix(this.#n.at(-1),t.getTransform())),this}popBaseTransform(){return this.#n.length>1&&this.#n.pop(),this}recordSimpleData(t,e){return this.#t[t]=e,this}recordIncrementalData(t,e){return this.#e[t].push(e),this}resetIncrementalData(t,e){return this.#e[t].length=0,this}recordNamedData(t,e){return this.#i.set(t,e),this}recordSimpleDataFromNamed(t,e,s){this.#t[t]=this.#i.get(e)??s}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Se,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)e in this.#t&&this.recordFutureForcedDependency(e,this.#t[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of this.#l)this.recordFutureForcedDependency(Se,t);return this}resetBBox(t){return this.#h!==t&&(this.#h=t,this.#a[0]=1/0,this.#a[1]=1/0,this.#a[2]=-1/0,this.#a[3]=-1/0),this}recordClipBox(t,e,s,i,n,r){let o=k.multiplyByDOMMatrix(this.#n.at(-1),e.getTransform()),l=[1/0,1/0,-1/0,-1/0];k.axialAlignedBoundingBox([s,n,i,r],o,l);let h=k.intersect(this.#r,l);return h?(this.#r[0]=h[0],this.#r[1]=h[1],this.#r[2]=h[2],this.#r[3]=h[3]):(this.#r[0]=this.#r[1]=1/0,this.#r[2]=this.#r[3]=-1/0),this}recordBBox(t,e,s,i,n,r){let o=this.#r;if(o[0]===1/0)return this;let l=k.multiplyByDOMMatrix(this.#n.at(-1),e.getTransform());if(o[0]===-1/0)return k.axialAlignedBoundingBox([s,n,i,r],l,this.#a),this;let h=[1/0,1/0,-1/0,-1/0];return k.axialAlignedBoundingBox([s,n,i,r],l,h),this.#a[0]=Math.min(this.#a[0],Math.max(h[0],o[0])),this.#a[1]=Math.min(this.#a[1],Math.max(h[1],o[1])),this.#a[2]=Math.max(this.#a[2],Math.min(h[2],o[2])),this.#a[3]=Math.max(this.#a[3],Math.min(h[3],o[3])),this}recordCharacterBBox(t,e,s,i=1,n=0,r=0,o){let l=s.bbox,h,c;if(l&&(h=l[2]!==l[0]&&l[3]!==l[1]&&this.#d.get(s),h!==!1&&(c=[0,0,0,0],k.axialAlignedBoundingBox(l,s.fontMatrix,c),(i!==1||n!==0||r!==0)&&k.scaleMinMax([i,0,0,-i,n,r],c),h)))return this.recordBBox(t,e,c[0],c[2],c[1],c[3]);if(!o)return this.recordFullPageBBox(t);let d=o();return l&&c&&h===void 0&&(h=c[0]<=n-d.actualBoundingBoxLeft&&c[2]>=n+d.actualBoundingBoxRight&&c[1]<=r-d.actualBoundingBoxAscent&&c[3]>=r+d.actualBoundingBoxDescent,this.#d.set(s,h),h)?this.recordBBox(t,e,c[0],c[2],c[1],c[3]):this.recordBBox(t,e,n-d.actualBoundingBoxLeft,n+d.actualBoundingBoxRight,r-d.actualBoundingBoxAscent,r+d.actualBoundingBoxDescent)}recordFullPageBBox(t){return this.#a[0]=Math.max(0,this.#r[0]),this.#a[1]=Math.max(0,this.#r[1]),this.#a[2]=Math.min(this.#f,this.#r[2]),this.#a[3]=Math.min(this.#m,this.#r[3]),this}getSimpleIndex(t){return this.#t[t]}recordDependencies(t,e){let s=this.#l,i=this.#t,n=this.#e;for(let r of e)r in this.#t?s.add(i[r]):r in n&&n[r].forEach(s.add,s);return this}recordNamedDependency(t,e){return this.#i.has(e)&&this.#l.add(this.#i.get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Se]),this.#g){let s=ks(this.#g,t),{dependencies:i}=s;this.#l.forEach(i.add,i),this.#s.forEach(i.add,i),this.#o.forEach(i.add,i),i.delete(t),s.isRenderingOperation=!0}if(this.#h===t){let s=lo(this.#a[0]*256/this.#f),i=lo(this.#a[1]*256/this.#m),n=ho(this.#a[2]*256/this.#f),r=ho(this.#a[3]*256/this.#m);Rs(this.#p,t,s,i,n,r);for(let o of this.#l)o!==t&&Rs(this.#p,o,s,i,n,r);for(let o of this.#s)o!==t&&Rs(this.#p,o,s,i,n,r);for(let o of this.#o)o!==t&&Rs(this.#p,o,s,i,n,r);e||(this.#l.clear(),this.#h=-1)}return this}recordShowTextOperation(t,e=!1){let s=Array.from(this.#l);this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(let i of s)this.recordIncrementalData("sameLineText",i);return this}bboxToClipBoxDropOperation(t,e=!1){return this.#h===t&&(this.#h=-1,this.#r[0]=Math.max(this.#r[0],this.#a[0]),this.#r[1]=Math.max(this.#r[1],this.#a[1]),this.#r[2]=Math.min(this.#r[2],this.#a[2]),this.#r[3]=Math.min(this.#r[3],this.#a[3]),e||this.#l.clear()),this}_takePendingDependencies(){let t=this.#l;return this.#l=new Set,t}_extractOperation(t){let e=this.#u.get(t);return this.#u.delete(t),e}_pushPendingDependencies(t){for(let e of t)this.#l.add(e)}take(){return this.#d.clear(),new mn(this.#c,this.#p)}takeDebugMetadata(){return this.#g}},Js=class a{#t;#e;#i;#s=0;#o=0;constructor(t,e,s){if(t instanceof a&&t.#i===!!s)return t;this.#t=t,this.#e=e,this.#i=!!s}growOperationsCount(){throw new Error("Unreachable")}save(t){return this.#o++,this.#t.save(this.#e),this}restore(t){return this.#o>0&&(this.#t.restore(this.#e),this.#o--),this}recordOpenMarker(t){return this.#s++,this}getOpenMarker(){return this.#s>0?this.#e:this.#t.getOpenMarker()}recordCloseMarker(t){return this.#s--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return this.#t.pushBaseTransform(t),this}popBaseTransform(){return this.#t.popBaseTransform(),this}recordSimpleData(t,e){return this.#t.recordSimpleData(t,this.#e),this}recordIncrementalData(t,e){return this.#t.recordIncrementalData(t,this.#e),this}resetIncrementalData(t,e){return this.#t.resetIncrementalData(t,this.#e),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,s){return this.#t.recordSimpleDataFromNamed(t,e,this.#e),this}recordFutureForcedDependency(t,e){return this.#t.recordFutureForcedDependency(t,this.#e),this}inheritSimpleDataAsFutureForcedDependencies(t){return this.#t.inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#t.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return this.#i||this.#t.resetBBox(this.#e),this}recordClipBox(t,e,s,i,n,r){return this.#i||this.#t.recordClipBox(this.#e,e,s,i,n,r),this}recordBBox(t,e,s,i,n,r){return this.#i||this.#t.recordBBox(this.#e,e,s,i,n,r),this}recordCharacterBBox(t,e,s,i,n,r,o){return this.#i||this.#t.recordCharacterBBox(this.#e,e,s,i,n,r,o),this}recordFullPageBBox(t){return this.#i||this.#t.recordFullPageBBox(this.#e),this}getSimpleIndex(t){return this.#t.getSimpleIndex(t)}recordDependencies(t,e){return this.#t.recordDependencies(this.#e,e),this}recordNamedDependency(t,e){return this.#t.recordNamedDependency(this.#e,e),this}recordOperation(t){return this.#t.recordOperation(this.#e,!0),this}recordShowTextOperation(t){return this.#t.recordShowTextOperation(this.#e,!0),this}bboxToClipBoxDropOperation(t){return this.#i||this.#t.bboxToClipBoxDropOperation(this.#e,!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}},Ot={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"]},wt={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function yn(a,t){if(!t)return;let e=t[2]-t[0],s=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,s),a.clip(i)}var ss=class{isModifyingCurrentTransform(){return!1}getPattern(){Q("Abstract method `getPattern` called.")}},An=class extends ss{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;this._type==="axial"?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(let s of this._colorStops)e.addColorStop(s[0],s[1]);return e}getPattern(t,e,s,i){let n;if(i===wt.STROKE||i===wt.FILL){let r=e.current.getClippedPathBoundingBox(i,rt(t))||[0,0,0,0],o=Math.ceil(r[2]-r[0])||1,l=Math.ceil(r[3]-r[1])||1,h=e.cachedCanvases.getCanvas("pattern",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(-r[0],-r[1]),s=k.transform(s,[1,0,0,1,r[0],r[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix),yn(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),n=t.createPattern(h.canvas,"no-repeat");let d=new DOMMatrix(s);n.setTransform(d)}else yn(t,this._bbox),n=this._createGradient(t);return n}};function ji(a,t,e,s,i,n,r,o){let l=t.coords,h=t.colors,c=a.data,d=a.width*4,u;l[e+1]>l[s+1]&&(u=e,e=s,s=u,u=n,n=r,r=u),l[s+1]>l[i+1]&&(u=s,s=i,i=u,u=r,r=o,o=u),l[e+1]>l[s+1]&&(u=e,e=s,s=u,u=n,n=r,r=u);let f=(l[e]+t.offsetX)*t.scaleX,g=(l[e+1]+t.offsetY)*t.scaleY,p=(l[s]+t.offsetX)*t.scaleX,b=(l[s+1]+t.offsetY)*t.scaleY,m=(l[i]+t.offsetX)*t.scaleX,y=(l[i+1]+t.offsetY)*t.scaleY;if(g>=y)return;let A=h[n],w=h[n+1],v=h[n+2],E=h[r],_=h[r+1],S=h[r+2],x=h[o],T=h[o+1],C=h[o+2],I=Math.round(g),O=Math.round(y),L,j,P,D,N,X,mt,Tt;for(let J=I;J<=O;J++){if(J<b){let Y=J<g?0:(g-J)/(g-b);L=f-(f-p)*Y,j=A-(A-E)*Y,P=w-(w-_)*Y,D=v-(v-S)*Y}else{let Y;J>y?Y=1:b===y?Y=0:Y=(b-J)/(b-y),L=p-(p-m)*Y,j=E-(E-x)*Y,P=_-(_-T)*Y,D=S-(S-C)*Y}let q;J<g?q=0:J>y?q=1:q=(g-J)/(g-y),N=f-(f-m)*q,X=A-(A-x)*q,mt=w-(w-T)*q,Tt=v-(v-C)*q;let vt=Math.round(Math.min(L,N)),bt=Math.round(Math.max(L,N)),yt=d*J+vt*4;for(let Y=vt;Y<=bt;Y++)q=(L-Y)/(L-N),q<0?q=0:q>1&&(q=1),c[yt++]=j-(j-X)*q|0,c[yt++]=P-(P-mt)*q|0,c[yt++]=D-(D-Tt)*q|0,c[yt++]=255}}function wl(a,t,e){let s=t.coords,i=t.colors,n,r;switch(t.type){case"lattice":let o=t.verticesPerRow,l=Math.floor(s.length/o)-1,h=o-1;for(n=0;n<l;n++){let c=n*o;for(let d=0;d<h;d++,c++)ji(a,e,s[c],s[c+1],s[c+o],i[c],i[c+1],i[c+o]),ji(a,e,s[c+o+1],s[c+1],s[c+o],i[c+o+1],i[c+1],i[c+o])}break;case"triangles":for(n=0,r=s.length;n<r;n+=3)ji(a,e,s[n],s[n+1],s[n+2],i[n],i[n+1],i[n+2]);break;default:throw new Error("illegal figure")}}var wn=class extends ss{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,s){let 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,d=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3),u=Math.min(Math.ceil(Math.abs(c*t[1]*1.1)),3e3),f=h/d,g=c/u,p={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-l,scaleX:1/f,scaleY:1/g},b=d+4,m=u+4,y=s.getCanvas("mesh",b,m),A=y.context,w=A.createImageData(d,u);if(e){let E=w.data;for(let _=0,S=E.length;_<S;_+=4)E[_]=e[0],E[_+1]=e[1],E[_+2]=e[2],E[_+3]=255}for(let E of this._figures)wl(w,E,p);return A.putImageData(w,2,2),{canvas:y.canvas,offsetX:o-2*f,offsetY:l-2*g,scaleX:f,scaleY:g}}isModifyingCurrentTransform(){return!0}getPattern(t,e,s,i){yn(t,this._bbox);let n=new Float32Array(2);if(i===wt.SHADING)k.singularValueDecompose2dScale(rt(t),n);else if(this.matrix){k.singularValueDecompose2dScale(this.matrix,n);let[o,l]=n;k.singularValueDecompose2dScale(e.baseTransform,n),n[0]*=o,n[1]*=l}else k.singularValueDecompose2dScale(e.baseTransform,n);let r=this._createMeshCanvas(n,i===wt.SHADING?null:this._background,e.cachedCanvases);return i!==wt.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(r.offsetX,r.offsetY),t.scale(r.scaleX,r.scaleY),t.createPattern(r.canvas,"no-repeat")}},vn=class extends ss{getPattern(){return"hotpink"}};function vl(a){switch(a[0]){case"RadialAxial":return new An(a);case"Mesh":return new wn(a);case"Dummy":return new vn}throw new Error(`Unknown IR type: ${a[0]}`)}var co={COLORED:1,UNCOLORED:2},En=class a{static MAX_PATTERN_SIZE=3e3;constructor(t,e,s,i){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.ctx=e,this.canvasGraphicsFactory=s,this.baseTransform=i}createPatternCanvas(t,e){let{bbox:s,operatorList:i,paintType:n,tilingType:r,color:o,canvasGraphicsFactory:l}=this,{xstep:h,ystep:c}=this;h=Math.abs(h),c=Math.abs(c),wi("TilingType: "+r);let d=s[0],u=s[1],f=s[2],g=s[3],p=f-d,b=g-u,m=new Float32Array(2);k.singularValueDecompose2dScale(this.matrix,m);let[y,A]=m;k.singularValueDecompose2dScale(this.baseTransform,m);let w=y*m[0],v=A*m[1],E=p,_=b,S=!1,x=!1,T=Math.ceil(h*w),C=Math.ceil(c*v),I=Math.ceil(p*w),O=Math.ceil(b*v);T>=I?E=h:S=!0,C>=O?_=c:x=!0;let L=this.getSizeAndScale(E,this.ctx.canvas.width,w),j=this.getSizeAndScale(_,this.ctx.canvas.height,v),P=t.cachedCanvases.getCanvas("pattern",L.size,j.size),D=P.context,N=l.createCanvasGraphics(D,e);if(N.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(N,n,o),D.translate(-L.scale*d,-j.scale*u),N.transform(0,L.scale,0,0,j.scale,0,0),D.save(),N.dependencyTracker?.save(),this.clipBbox(N,d,u,f,g),N.baseTransform=rt(N.ctx),N.executeOperatorList(i),N.endDrawing(),N.dependencyTracker?.restore(),D.restore(),S||x){let X=P.canvas;S&&(E=h),x&&(_=c);let mt=this.getSizeAndScale(E,this.ctx.canvas.width,w),Tt=this.getSizeAndScale(_,this.ctx.canvas.height,v),J=mt.size,q=Tt.size,vt=t.cachedCanvases.getCanvas("pattern-workaround",J,q),bt=vt.context,yt=S?Math.floor(p/h):0,Y=x?Math.floor(b/c):0;for(let M=0;M<=yt;M++)for(let $=0;$<=Y;$++)bt.drawImage(X,J*M,q*$,J,q,0,0,J,q);return{canvas:vt.canvas,scaleX:mt.scale,scaleY:Tt.scale,offsetX:d,offsetY:u}}return{canvas:P.canvas,scaleX:L.scale,scaleY:j.scale,offsetX:d,offsetY:u}}getSizeAndScale(t,e,s){let i=Math.max(a.MAX_PATTERN_SIZE,e),n=Math.ceil(t*s);return n>=i?n=i:s=n/t,{scale:s,size:n}}clipBbox(t,e,s,i,n){let r=i-e,o=n-s;t.ctx.rect(e,s,r,o),k.axialAlignedBoundingBox([e,s,i,n],rt(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){let i=t.ctx,n=t.current;switch(e){case co.COLORED:let{fillStyle:r,strokeStyle:o}=this.ctx;i.fillStyle=n.fillColor=r,i.strokeStyle=n.strokeColor=o;break;case co.UNCOLORED:i.fillStyle=i.strokeStyle=s,n.fillColor=n.strokeColor=s;break;default:throw new Wi(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,s,i,n){let r=s;i!==wt.SHADING&&(r=k.transform(r,e.baseTransform),this.matrix&&(r=k.transform(r,this.matrix)));let o=this.createPatternCanvas(e,n),l=new DOMMatrix(r);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);let h=t.createPattern(o.canvas,"repeat");return h.setTransform(l),h}};function El({src:a,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:r=!1}){let o=dt.isLittleEndian?4278190080:255,[l,h]=r?[n,o]:[o,n],c=s>>3,d=s&7,u=a.length;e=new Uint32Array(e.buffer);let f=0;for(let g=0;g<i;g++){for(let b=t+c;t<b;t++){let m=t<u?a[t]:255;e[f++]=m&128?h:l,e[f++]=m&64?h:l,e[f++]=m&32?h:l,e[f++]=m&16?h:l,e[f++]=m&8?h:l,e[f++]=m&4?h:l,e[f++]=m&2?h:l,e[f++]=m&1?h:l}if(d===0)continue;let p=t<u?a[t++]:255;for(let b=0;b<d;b++)e[f++]=p&1<<7-b?h:l}return{srcPos:t,destPos:f}}var uo=16,fo=100,_l=15,po=10,Pt=16,$i=new DOMMatrix,Dt=new Float32Array(2),Pe=new Float32Array([1/0,1/0,-1/0,-1/0]);function Sl(a,t){if(a._removeMirroring)throw new Error("Context is already forwarding operations.");a.__originalSave=a.save,a.__originalRestore=a.restore,a.__originalRotate=a.rotate,a.__originalScale=a.scale,a.__originalTranslate=a.translate,a.__originalTransform=a.transform,a.__originalSetTransform=a.setTransform,a.__originalResetTransform=a.resetTransform,a.__originalClip=a.clip,a.__originalMoveTo=a.moveTo,a.__originalLineTo=a.lineTo,a.__originalBezierCurveTo=a.bezierCurveTo,a.__originalRect=a.rect,a.__originalClosePath=a.closePath,a.__originalBeginPath=a.beginPath,a._removeMirroring=()=>{a.save=a.__originalSave,a.restore=a.__originalRestore,a.rotate=a.__originalRotate,a.scale=a.__originalScale,a.translate=a.__originalTranslate,a.transform=a.__originalTransform,a.setTransform=a.__originalSetTransform,a.resetTransform=a.__originalResetTransform,a.clip=a.__originalClip,a.moveTo=a.__originalMoveTo,a.lineTo=a.__originalLineTo,a.bezierCurveTo=a.__originalBezierCurveTo,a.rect=a.__originalRect,a.closePath=a.__originalClosePath,a.beginPath=a.__originalBeginPath,delete a._removeMirroring},a.save=function(){t.save(),this.__originalSave()},a.restore=function(){t.restore(),this.__originalRestore()},a.translate=function(e,s){t.translate(e,s),this.__originalTranslate(e,s)},a.scale=function(e,s){t.scale(e,s),this.__originalScale(e,s)},a.transform=function(e,s,i,n,r,o){t.transform(e,s,i,n,r,o),this.__originalTransform(e,s,i,n,r,o)},a.setTransform=function(e,s,i,n,r,o){t.setTransform(e,s,i,n,r,o),this.__originalSetTransform(e,s,i,n,r,o)},a.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},a.rotate=function(e){t.rotate(e),this.__originalRotate(e)},a.clip=function(e){t.clip(e),this.__originalClip(e)},a.moveTo=function(e,s){t.moveTo(e,s),this.__originalMoveTo(e,s)},a.lineTo=function(e,s){t.lineTo(e,s),this.__originalLineTo(e,s)},a.bezierCurveTo=function(e,s,i,n,r,o){t.bezierCurveTo(e,s,i,n,r,o),this.__originalBezierCurveTo(e,s,i,n,r,o)},a.rect=function(e,s,i,n){t.rect(e,s,i,n),this.__originalRect(e,s,i,n)},a.closePath=function(){t.closePath(),this.__originalClosePath()},a.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}var _n=class{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,s){let i;return this.cache[t]!==void 0?(i=this.cache[t],this.canvasFactory.reset(i,e,s)):(i=this.canvasFactory.create(e,s),this.cache[t]=i),i}delete(t){delete this.cache[t]}clear(){for(let t in this.cache){let e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}};function Ds(a,t,e,s,i,n,r,o,l,h){let[c,d,u,f,g,p]=rt(a);if(d===0&&u===0){let y=r*c+g,A=Math.round(y),w=o*f+p,v=Math.round(w),E=(r+l)*c+g,_=Math.abs(Math.round(E)-A)||1,S=(o+h)*f+p,x=Math.abs(Math.round(S)-v)||1;return a.setTransform(Math.sign(c),0,0,Math.sign(f),A,v),a.drawImage(t,e,s,i,n,0,0,_,x),a.setTransform(c,d,u,f,g,p),[_,x]}if(c===0&&f===0){let y=o*u+g,A=Math.round(y),w=r*d+p,v=Math.round(w),E=(o+h)*u+g,_=Math.abs(Math.round(E)-A)||1,S=(r+l)*d+p,x=Math.abs(Math.round(S)-v)||1;return a.setTransform(0,Math.sign(d),Math.sign(u),0,A,v),a.drawImage(t,e,s,i,n,0,0,x,_),a.setTransform(c,d,u,f,g,p),[x,_]}a.drawImage(t,e,s,i,n,r,o,l,h);let b=Math.hypot(c,d),m=Math.hypot(u,f);return[b*l,m*h]}var Qs=class{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=Vi;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=At.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";constructor(t,e,s){s?.(this),this.clipBox=new Float32Array([0,0,t,e]),this.minMax=Pe.slice()}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=wt.FILL,e=null){let s=this.minMax.slice();if(t===wt.STROKE){e||Q("Stroke bounding box must include transform."),k.singularValueDecompose2dScale(e,Dt);let i=Dt[0]*this.lineWidth/2,n=Dt[1]*this.lineWidth/2;s[0]-=i,s[1]-=n,s[2]+=i,s[3]+=n}return s}updateClipFromPath(){let t=k.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(Pe,0)}getClippedPathBoundingBox(t=wt.FILL,e=null){return k.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};function go(a,t){if(t instanceof ImageData){a.putImageData(t,0,0);return}let e=t.height,s=t.width,i=e%Pt,n=(e-i)/Pt,r=i===0?n:n+1,o=a.createImageData(s,Pt),l=0,h,c=t.data,d=o.data,u,f,g,p;if(t.kind===qe.GRAYSCALE_1BPP){let b=c.byteLength,m=new Uint32Array(d.buffer,0,d.byteLength>>2),y=m.length,A=s+7>>3,w=4294967295,v=dt.isLittleEndian?4278190080:255;for(u=0;u<r;u++){for(g=u<n?Pt:i,h=0,f=0;f<g;f++){let E=b-l,_=0,S=E>A?s:E*8-7,x=S&-8,T=0,C=0;for(;_<x;_+=8)C=c[l++],m[h++]=C&128?w:v,m[h++]=C&64?w:v,m[h++]=C&32?w:v,m[h++]=C&16?w:v,m[h++]=C&8?w:v,m[h++]=C&4?w:v,m[h++]=C&2?w:v,m[h++]=C&1?w:v;for(;_<S;_++)T===0&&(C=c[l++],T=128),m[h++]=C&T?w:v,T>>=1}for(;h<y;)m[h++]=0;a.putImageData(o,0,u*Pt)}}else if(t.kind===qe.RGBA_32BPP){for(f=0,p=s*Pt*4,u=0;u<n;u++)d.set(c.subarray(l,l+p)),l+=p,a.putImageData(o,0,f),f+=Pt;u<r&&(p=s*i*4,d.set(c.subarray(l,l+p)),a.putImageData(o,0,f))}else if(t.kind===qe.RGB_24BPP)for(g=Pt,p=s*g,u=0;u<r;u++){for(u>=n&&(g=i,p=s*g),h=0,f=p;f--;)d[h++]=c[l++],d[h++]=c[l++],d[h++]=c[l++],d[h++]=255;a.putImageData(o,0,u*Pt)}else throw new Error(`bad image kind: ${t.kind}`)}function mo(a,t){if(t.bitmap){a.drawImage(t.bitmap,0,0);return}let e=t.height,s=t.width,i=e%Pt,n=(e-i)/Pt,r=i===0?n:n+1,o=a.createImageData(s,Pt),l=0,h=t.data,c=o.data;for(let d=0;d<r;d++){let u=d<n?Pt:i;({srcPos:l}=El({src:h,srcPos:l,dest:c,width:s,height:u,nonBlackColor:0})),a.putImageData(o,0,d*Pt)}}function Ge(a,t){let e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let s of e)a[s]!==void 0&&(t[s]=a[s]);a.setLineDash!==void 0&&(t.setLineDash(a.getLineDash()),t.lineDashOffset=a.lineDashOffset)}function Ls(a){a.strokeStyle=a.fillStyle="#000000",a.fillRule="nonzero",a.globalAlpha=1,a.lineWidth=1,a.lineCap="butt",a.lineJoin="miter",a.miterLimit=10,a.globalCompositeOperation="source-over",a.font="10px sans-serif",a.setLineDash!==void 0&&(a.setLineDash([]),a.lineDashOffset=0);let{filter:t}=a;t!=="none"&&t!==""&&(a.filter="none")}function bo(a,t){if(t)return!0;k.singularValueDecompose2dScale(a,Dt);let e=Math.fround(qt.pixelRatio*Qt.PDF_TO_CSS_UNITS);return Dt[0]<=e&&Dt[1]<=e}var xl=["butt","round","square"],Tl=["miter","round","bevel"],Cl={},yo={},Re=class a{constructor(t,e,s,i,n,{optionalContentConfig:r,markedContentStack:o=null},l,h,c){this.ctx=t,this.current=new Qs(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=s,this.canvasFactory=i,this.filterFactory=n,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=r,this.cachedCanvases=new _n(this.canvasFactory),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}getObject(t,e,s=null){return typeof e=="string"?(this.dependencyTracker?.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):s}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:i=null}){let n=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,r),this.ctx.fillStyle=o,s){let l=this.cachedCanvases.getCanvas("transparent",n,r);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...rt(this.compositeCtx))}this.ctx.save(),Ls(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=rt(this.ctx)}executeOperatorList(t,e,s,i,n){let r=t.argsArray,o=t.fnArray,l=e||0,h=r.length;if(h===l)return l;let c=h-l>po&&typeof s=="function",d=c?Date.now()+_l:0,u=0,f=this.commonObjs,g=this.objs,p,b;for(;;){if(i!==void 0&&l===i.nextBreakPoint)return i.breakIt(l,s),l;if(!n||n(l))if(p=o[l],b=r[l]??null,p!==ke.dependency)b===null?this[p](l):this[p](l,...b);else for(let m of b){this.dependencyTracker?.recordNamedData(m,l);let y=m.startsWith("g_")?f:g;if(!y.has(m))return y.get(m,s),l}if(l++,l===h)return l;if(c&&++u>po){if(Date.now()>d)return s(),l;u=0}}}#t(){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.transparentCanvas=null)}endDrawing(){this.#t(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(let t of this._cachedBitmapsMap.values()){for(let e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#e()}#e(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){let s=t.width??t.displayWidth,i=t.height??t.displayHeight,n=Math.max(Math.hypot(e[0],e[1]),1),r=Math.max(Math.hypot(e[2],e[3]),1),o=s,l=i,h="prescale1",c,d;for(;n>2&&o>1||r>2&&l>1;){let u=o,f=l;n>2&&o>1&&(u=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),n/=o/u),r>2&&l>1&&(f=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,r/=l/f),c=this.cachedCanvases.getCanvas(h,u,f),d=c.context,d.clearRect(0,0,u,f),d.drawImage(t,0,0,o,l,0,0,u,f),t=c.canvas,o=u,l=f,h=h==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:o,paintHeight:l}}_createMaskCanvas(t,e){let s=this.ctx,{width:i,height:n}=e,r=this.current.fillColor,o=this.current.patternFill,l=rt(s),h,c,d,u;if((e.bitmap||e.data)&&e.count>1){let T=e.bitmap||e.data.buffer;c=JSON.stringify(o?l:[l.slice(0,4),r]),h=this._cachedBitmapsMap.get(T),h||(h=new Map,this._cachedBitmapsMap.set(T,h));let C=h.get(c);if(C&&!o){let I=Math.round(Math.min(l[0],l[2])+l[4]),O=Math.round(Math.min(l[1],l[3])+l[5]);return this.dependencyTracker?.recordDependencies(t,Ot.transformAndFill),{canvas:C,offsetX:I,offsetY:O}}d=C}d||(u=this.cachedCanvases.getCanvas("maskCanvas",i,n),mo(u.context,e));let f=k.transform(l,[1/i,0,0,-1/n,0,0]);f=k.transform(f,[1,0,0,1,0,-n]);let g=Pe.slice();k.axialAlignedBoundingBox([0,0,i,n],f,g);let[p,b,m,y]=g,A=Math.round(m-p)||1,w=Math.round(y-b)||1,v=this.cachedCanvases.getCanvas("fillCanvas",A,w),E=v.context,_=p,S=b;E.translate(-_,-S),E.transform(...f),d||(d=this._scaleImage(u.canvas,Vt(E)),d=d.img,h&&o&&h.set(c,d)),E.imageSmoothingEnabled=bo(rt(E),e.interpolate),Ds(E,d,0,0,d.width,d.height,0,0,i,n),E.globalCompositeOperation="source-in";let x=k.transform(Vt(E),[1,0,0,1,-_,-S]);return E.fillStyle=o?r.getPattern(s,this,x,wt.FILL,t):r,E.fillRect(0,0,i,n),h&&!o&&(this.cachedCanvases.delete("fillCanvas"),h.set(c,v.canvas)),this.dependencyTracker?.recordDependencies(t,Ot.transformAndFill),{canvas:v.canvas,offsetX:Math.round(_),offsetY:Math.round(S)}}setLineWidth(t,e){this.dependencyTracker?.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){this.dependencyTracker?.recordSimpleData("lineCap",t),this.ctx.lineCap=xl[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=Tl[e]}setMiterLimit(t,e){this.dependencyTracker?.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,s){this.dependencyTracker?.recordSimpleData("dash",t);let i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(e),i.lineDashOffset=s)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){for(let[s,i]of e)switch(s){case"LW":this.setLineWidth(t,i);break;case"LC":this.setLineCap(t,i);break;case"LJ":this.setLineJoin(t,i);break;case"ML":this.setMiterLimit(t,i);break;case"D":this.setDash(t,i[0],i[1]);break;case"RI":this.setRenderingIntent(t,i);break;case"FL":this.setFlatness(t,i);break;case"Font":this.setFont(t,i[0],i[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=i;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=i;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=i;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",t),this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.dependencyTracker?.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");let e=this.ctx.canvas.width,s=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(i,e,s);this.suspendedCtx=this.ctx;let r=this.ctx=n.context;r.setTransform(this.suspendedCtx.getTransform()),Ge(this.suspendedCtx,r),Sl(r,this.suspendedCtx),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Ge(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,s,i){let n=i[0],r=i[1],o=i[2]-n,l=i[3]-r;o===0||l===0||(this.genericComposeSMask(e.context,s,o,l,e.subtype,e.backdrop,e.transferMap,n,r,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,0,0),t.restore())}genericComposeSMask(t,e,s,i,n,r,o,l,h,c,d){let u=t.canvas,f=l-c,g=h-d;if(r)if(f<0||g<0||f+s>u.width||g+i>u.height){let b=this.cachedCanvases.getCanvas("maskExtension",s,i),m=b.context;m.drawImage(u,-f,-g),m.globalCompositeOperation="destination-atop",m.fillStyle=r,m.fillRect(0,0,s,i),m.globalCompositeOperation="source-over",u=b.canvas,f=g=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let b=new Path2D;b.rect(f,g,s,i),t.clip(b),t.globalCompositeOperation="destination-atop",t.fillStyle=r,t.fillRect(f,g,s,i),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),n==="Alpha"&&o?e.filter=this.filterFactory.addAlphaFilter(o):n==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(o));let p=new Path2D;p.rect(l,h,s,i),e.clip(p),e.globalCompositeOperation="destination-in",e.drawImage(u,f,g,s,i,l,h,s,i),e.restore()}save(t){this.inSMaskMode&&Ge(this.ctx,this.suspendedCtx),this.ctx.save();let e=this.current;this.stateStack.push(e),this.current=e.clone(),this.dependencyTracker?.save(t)}restore(t){if(this.dependencyTracker?.restore(t),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&Ge(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,s,i,n,r,o){this.dependencyTracker?.recordIncrementalData("transform",t),this.ctx.transform(e,s,i,n,r,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s,i){let[n]=s;if(!i){n||=s[0]=new Path2D,this[e](t,n);return}if(this.dependencyTracker!==null){let r=e===ke.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,i[0]-r,i[2]+r,i[1]-r,i[3]+r).recordDependencies(t,["transform"])}if(!(n instanceof Path2D)){let r=s[0]=new Path2D;for(let o=0,l=n.length;o<l;)switch(n[o++]){case Ts.moveTo:r.moveTo(n[o++],n[o++]);break;case Ts.lineTo:r.lineTo(n[o++],n[o++]);break;case Ts.curveTo:r.bezierCurveTo(n[o++],n[o++],n[o++],n[o++],n[o++],n[o++]);break;case Ts.closePath:r.closePath();break;default:H(`Unrecognized drawing path operator: ${n[o-1]}`);break}n=r}k.axialAlignedBoundingBox(i,rt(this.ctx),this.current.minMax),this[e](t,n),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,s=!0){let i=this.ctx,n=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof n=="object"&&n?.getPattern){let r=n.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=n.getPattern(i,this,Vt(i),wt.STROKE,t),r){let o=new Path2D;o.addPath(e,i.getTransform().invertSelf().multiplySelf(r)),e=o}this.rescaleAndStroke(e,!1),i.restore()}else this.rescaleAndStroke(e,!0);this.dependencyTracker?.recordDependencies(t,Ot.stroke),s&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(wt.STROKE,rt(this.ctx))),i.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e,s=!0){let i=this.ctx,n=this.current.fillColor,r=this.current.patternFill,o=!1;if(r){let h=n.isModifyingCurrentTransform()?i.getTransform():null;if(this.dependencyTracker?.save(t),i.save(),i.fillStyle=n.getPattern(i,this,Vt(i),wt.FILL,t),h){let c=new Path2D;c.addPath(e,i.getTransform().invertSelf().multiplySelf(h)),e=c}o=!0}let l=this.current.getClippedPathBoundingBox();this.contentVisible&&l!==null&&(this.pendingEOFill?(i.fill(e,"evenodd"),this.pendingEOFill=!1):i.fill(e)),this.dependencyTracker?.recordDependencies(t,Ot.fill),o&&(i.restore(),this.dependencyTracker?.restore(t)),s&&this.consumePath(t,e,l)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){this.ctx.fill(e),this.dependencyTracker?.recordDependencies(t,Ot.rawFillPath).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=Cl}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=yo}beginText(t){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){let e=this.pendingTextPaths,s=this.ctx;if(this.dependencyTracker){let{dependencyTracker:i}=this;e!==void 0&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(e!==void 0){let i=new Path2D,n=s.getTransform().invertSelf();for(let{transform:r,x:o,y:l,fontSize:h,path:c}of e)c&&i.addPath(c,new DOMMatrix(r).preMultiplySelf(n).translate(o,l).scale(h,-h));s.clip(i)}delete this.pendingTextPaths}setCharSpacing(t,e){this.dependencyTracker?.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){this.dependencyTracker?.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){this.dependencyTracker?.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){this.dependencyTracker?.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,s){this.dependencyTracker?.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);let i=this.commonObjs.get(e),n=this.current;if(!i)throw new Error(`Can't find font for ${e}`);if(n.fontMatrix=i.fontMatrix||Vi,(n.fontMatrix[0]===0||n.fontMatrix[3]===0)&&H("Invalid font matrix for font "+e),s<0?(s=-s,n.fontDirection=-1):n.fontDirection=1,this.current.font=i,this.current.fontSize=s,i.isType3Font)return;let r=i.loadedName||"sans-serif",o=i.systemFontInfo?.css||`"${r}", ${i.fallbackName}`,l="normal";i.black?l="900":i.bold&&(l="bold");let h=i.italic?"italic":"normal",c=s;s<uo?c=uo:s>fo&&(c=fo),this.current.fontSizeScale=s/c,this.ctx.font=`${h} ${l} ${c}px ${o}`}setTextRenderingMode(t,e){this.dependencyTracker?.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){this.dependencyTracker?.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,s){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=s}setLeadingMoveText(t,e,s){this.setLeading(t,-s),this.moveText(t,e,s)}setTextMatrix(t,e){this.dependencyTracker?.recordSimpleData("textMatrix",t);let{current:s}=this;s.textMatrix=e,s.textMatrixScale=Math.hypot(e[0],e[1]),s.x=s.lineX=0,s.y=s.lineY=0}nextLine(t){this.moveText(t,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}#i(t,e,s){let i=new Path2D;return i.addPath(t,new DOMMatrix(s).invertSelf().multiplySelf(e)),i}paintChar(t,e,s,i,n,r){let o=this.ctx,l=this.current,h=l.font,c=l.textRenderingMode,d=l.fontSize/l.fontSizeScale,u=c&At.FILL_STROKE_MASK,f=!!(c&At.ADD_TO_PATH_FLAG),g=l.patternFill&&!h.missingFile,p=l.patternStroke&&!h.missingFile,b;if((h.disableFontFace||f||g||p)&&!h.missingFile&&(b=h.getPathGenerator(this.commonObjs,e)),b&&(h.disableFontFace||g||p)){o.save(),o.translate(s,i),o.scale(d,-d),this.dependencyTracker?.recordCharacterBBox(t,o,h);let m;if(u===At.FILL||u===At.FILL_STROKE)if(n){m=o.getTransform(),o.setTransform(...n);let y=this.#i(b,m,n);o.fill(y)}else o.fill(b);if(u===At.STROKE||u===At.FILL_STROKE)if(r){m||=o.getTransform(),o.setTransform(...r);let{a:y,b:A,c:w,d:v}=m,E=k.inverseTransform(r),_=k.transform([y,A,w,v,0,0],E);k.singularValueDecompose2dScale(_,Dt),o.lineWidth*=Math.max(Dt[0],Dt[1])/d,o.stroke(this.#i(b,m,r))}else o.lineWidth/=d,o.stroke(b);o.restore()}else(u===At.FILL||u===At.FILL_STROKE)&&(o.fillText(e,s,i),this.dependencyTracker?.recordCharacterBBox(t,o,h,d,s,i,()=>o.measureText(e))),(u===At.STROKE||u===At.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,o,h,d,s,i,()=>o.measureText(e)).recordDependencies(t,Ot.stroke),o.strokeText(e,s,i));f&&((this.pendingTextPaths||=[]).push({transform:rt(o),x:s,y:i,fontSize:d,path:b}),this.dependencyTracker?.recordCharacterBBox(t,o,h,d,s,i))}get isFontSubpixelAAEnabled(){let{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);let e=t.getImageData(0,0,10,10).data,s=!1;for(let i=3;i<e.length;i+=4)if(e[i]>0&&e[i]<255){s=!0;break}return U(this,"isFontSubpixelAAEnabled",s)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Ot.showText).resetBBox(t),this.current.textRenderingMode&At.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());let s=this.current,i=s.font;if(i.isType3Font){this.showType3Text(t,e),this.dependencyTracker?.recordShowTextOperation(t);return}let n=s.fontSize;if(n===0){this.dependencyTracker?.recordOperation(t);return}let r=this.ctx,o=s.fontSizeScale,l=s.charSpacing,h=s.wordSpacing,c=s.fontDirection,d=s.textHScale*c,u=e.length,f=i.vertical,g=f?1:-1,p=i.defaultVMetrics,b=n*s.fontMatrix[0],m=s.textRenderingMode===At.FILL&&!i.disableFontFace&&!s.patternFill;r.save(),s.textMatrix&&r.transform(...s.textMatrix),r.translate(s.x,s.y+s.textRise),c>0?r.scale(d,-1):r.scale(d,1);let y,A;if(s.patternFill){r.save();let S=s.fillColor.getPattern(r,this,Vt(r),wt.FILL,t);y=rt(r),r.restore(),r.fillStyle=S}if(s.patternStroke){r.save();let S=s.strokeColor.getPattern(r,this,Vt(r),wt.STROKE,t);A=rt(r),r.restore(),r.strokeStyle=S}let w=s.lineWidth,v=s.textMatrixScale;if(v===0||w===0){let S=s.textRenderingMode&At.FILL_STROKE_MASK;(S===At.STROKE||S===At.FILL_STROKE)&&(w=this.getSinglePixelWidth())}else w/=v;if(o!==1&&(r.scale(o,o),w/=o),r.lineWidth=w,i.isInvalidPDFjsFont){let S=[],x=0;for(let C of e)S.push(C.unicode),x+=C.width;let T=S.join("");if(r.fillText(T,0,0),this.dependencyTracker!==null){let C=r.measureText(T);this.dependencyTracker.recordBBox(t,this.ctx,-C.actualBoundingBoxLeft,C.actualBoundingBoxRight,-C.actualBoundingBoxAscent,C.actualBoundingBoxDescent).recordShowTextOperation(t)}s.x+=x*b*d,r.restore(),this.compose();return}let E=0,_;for(_=0;_<u;++_){let S=e[_];if(typeof S=="number"){E+=g*S*n/1e3;continue}let x=!1,T=(S.isSpace?h:0)+l,C=S.fontChar,I=S.accent,O,L,j=S.width;if(f){let N=S.vmetric||p,X=-(S.vmetric?N[1]:j*.5)*b,mt=N[2]*b;j=N?-N[0]:j,O=X/o,L=(E+mt)/o}else O=E/o,L=0;let P;if(i.remeasure&&j>0){P=r.measureText(C);let N=P.width*1e3/n*o;if(j<N&&this.isFontSubpixelAAEnabled){let X=j/N;x=!0,r.save(),r.scale(X,1),O/=X}else j!==N&&(O+=(j-N)/2e3*n/o)}if(this.contentVisible&&(S.isInFont||i.missingFile)){if(m&&!I)r.fillText(C,O,L),this.dependencyTracker?.recordCharacterBBox(t,r,P?{bbox:null}:i,n/o,O,L,()=>P??r.measureText(C));else if(this.paintChar(t,C,O,L,y,A),I){let N=O+n*I.offset.x/o,X=L-n*I.offset.y/o;this.paintChar(t,I.fontChar,N,X,y,A)}}let D=f?j*b-T*c:j*b+T*c;E+=D,x&&r.restore()}f?s.y-=E:s.x+=E*d,r.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(t)}showType3Text(t,e){let s=this.ctx,i=this.current,n=i.font,r=i.fontSize,o=i.fontDirection,l=n.vertical?1:-1,h=i.charSpacing,c=i.wordSpacing,d=i.textHScale*o,u=i.fontMatrix||Vi,f=e.length,g=i.textRenderingMode===At.INVISIBLE,p,b,m,y;if(g||r===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(d,o);let A=this.dependencyTracker;for(this.dependencyTracker=A?new Js(A,t):null,p=0;p<f;++p){if(b=e[p],typeof b=="number"){y=l*b*r/1e3,this.ctx.translate(y,0),i.x+=y*d;continue}let w=(b.isSpace?c:0)+h,v=n.charProcOperatorList[b.operatorListId];v?this.contentVisible&&(this.save(),s.scale(r,r),s.transform(...u),this.executeOperatorList(v),this.restore()):H(`Type3 character "${b.operatorListId}" is not available.`);let E=[b.width,0];k.applyTransform(E,u),m=E[0]*r+w,s.translate(m,0),i.x+=m*d}s.restore(),A&&(this.dependencyTracker=A)}setCharWidth(t,e,s){}setCharWidthAndBounds(t,e,s,i,n,r,o){let l=new Path2D;l.rect(i,n,r-i,o-n),this.ctx.clip(l),this.dependencyTracker?.recordBBox(t,this.ctx,i,r,n,o).recordClipBox(t,this.ctx,i,r,n,o),this.endPath(t)}getColorN_Pattern(t,e){let s;if(e[0]==="TilingPattern"){let i=this.baseTransform||rt(this.ctx),n={createCanvasGraphics:(r,o)=>new a(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new Js(this.dependencyTracker,o,!0):null)};s=new En(e,this.ctx,n,i)}else s=this._getPattern(t,e[1],e[2]);return s}setStrokeColorN(t,...e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.current.fillColor=this.getColorN_Pattern(t,e),this.current.patternFill=!0}setStrokeRGBColor(t,e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(t){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(t){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e,s=null){let i;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=vl(this.getObject(t,e)),this.cachedPatterns.set(e,i)),s&&(i.matrix=s),i}shadingFill(t,e){if(!this.contentVisible)return;let s=this.ctx;this.save(t);let i=this._getPattern(t,e);s.fillStyle=i.getPattern(s,this,Vt(s),wt.SHADING,t);let n=Vt(s);if(n){let{width:r,height:o}=s.canvas,l=Pe.slice();k.axialAlignedBoundingBox([0,0,r,o],n,l);let[h,c,d,u]=l;this.ctx.fillRect(h,c,d-h,u-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,Ot.transform).recordDependencies(t,Ot.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){Q("Should not call beginInlineImage")}beginImageData(){Q("Should not call beginImageData")}paintFormXObjectBegin(t,e,s){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=rt(this.ctx),s)){k.axialAlignedBoundingBox(s,this.baseTransform,this.current.minMax);let[i,n,r,o]=s,l=new Path2D;l.rect(i,n,r-i,o-n),this.ctx.clip(l),this.dependencyTracker?.recordClipBox(t,this.ctx,i,r,n,o),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){if(!this.contentVisible)return;this.save(t),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let s=this.ctx;e.isolated||wi("TODO: Support non-isolated groups."),e.knockout&&H("Knockout groups not supported.");let i=rt(s);if(e.matrix&&s.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let n=Pe.slice();k.axialAlignedBoundingBox(e.bbox,rt(s),n);let r=[0,0,s.canvas.width,s.canvas.height];n=k.intersect(n,r)||[0,0,0,0];let o=Math.floor(n[0]),l=Math.floor(n[1]),h=Math.max(Math.ceil(n[2])-o,1),c=Math.max(Math.ceil(n[3])-l,1);this.current.startNewPathAndClipBox([0,0,h,c]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);let u=this.cachedCanvases.getCanvas(d,h,c),f=u.context;f.translate(-o,-l),f.transform(...i);let g=new Path2D,[p,b,m,y]=e.bbox;if(g.rect(p,b,m-p,y-b),e.matrix){let A=new Path2D;A.addPath(g,new DOMMatrix(e.matrix)),g=A}f.clip(g),e.smask&&this.smaskStack.push({canvas:u.canvas,context:f,offsetX:o,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}),(!e.smask||this.dependencyTracker)&&(s.setTransform(1,0,0,1,0,0),s.translate(o,l),s.save()),Ge(s,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(s),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(s),this.groupLevel++}endGroup(t,e){if(!this.contentVisible)return;this.groupLevel--;let s=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();let n=rt(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...n);let r=Pe.slice();k.axialAlignedBoundingBox([0,0,s.canvas.width,s.canvas.height],n,r),this.ctx.drawImage(s.canvas,0,0),this.ctx.restore(),this.compose(r)}}beginAnnotation(t,e,s,i,n,r){if(this.#t(),Ls(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),s){let o=s[2]-s[0],l=s[3]-s[1];if(r&&this.annotationCanvasMap){i=i.slice(),i[4]-=s[0],i[5]-=s[1],s=s.slice(),s[0]=s[1]=0,s[2]=o,s[3]=l,k.singularValueDecompose2dScale(rt(this.ctx),Dt);let{viewportScale:h}=this,c=Math.ceil(o*this.outputScaleX*h),d=Math.ceil(l*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(c,d);let{canvas:u,context:f}=this.annotationCanvas;this.annotationCanvasMap.set(e,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=f,this.ctx.save(),this.ctx.setTransform(Dt[0],0,0,-Dt[1],0,l*Dt[1]),Ls(this.ctx)}else{Ls(this.ctx),this.endPath(t);let h=new Path2D;h.rect(s[0],s[1],o,l),this.ctx.clip(h)}}this.current=new Qs(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...i),this.transform(t,...n)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),this.#e(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){if(!this.contentVisible)return;let s=e.count;e=this.getObject(t,e.data,e),e.count=s;let i=this.ctx,n=this._createMaskCanvas(t,e),r=n.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(r,n.offsetX,n.offsetY),this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,n.offsetX,n.offsetX+r.width,n.offsetY,n.offsetY+r.height).recordOperation(t),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s,i=0,n=0,r,o){if(!this.contentVisible)return;e=this.getObject(t,e.data,e);let l=this.ctx;l.save();let h=rt(l);l.transform(s,i,n,r,0,0);let c=this._createMaskCanvas(t,e);l.setTransform(1,0,0,1,c.offsetX-h[4],c.offsetY-h[5]),this.dependencyTracker?.resetBBox(t);for(let d=0,u=o.length;d<u;d+=2){let f=k.transform(h,[s,i,n,r,o[d],o[d+1]]);l.drawImage(c.canvas,f[4],f[5]),this.dependencyTracker?.recordBBox(t,this.ctx,f[4],f[4]+c.canvas.width,f[5],f[5]+c.canvas.height)}l.restore(),this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageMaskXObjectGroup(t,e){if(!this.contentVisible)return;let s=this.ctx,i=this.current.fillColor,n=this.current.patternFill;this.dependencyTracker?.resetBBox(t).recordDependencies(t,Ot.transformAndFill);for(let r of e){let{data:o,width:l,height:h,transform:c}=r,d=this.cachedCanvases.getCanvas("maskCanvas",l,h),u=d.context;u.save();let f=this.getObject(t,o,r);mo(u,f),u.globalCompositeOperation="source-in",u.fillStyle=n?i.getPattern(u,this,Vt(s),wt.FILL,t):i,u.fillRect(0,0,l,h),u.restore(),s.save(),s.transform(...c),s.scale(1,-1),Ds(s,d.canvas,0,0,l,h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,s,0,l,0,h),s.restore()}this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;let s=this.getObject(t,e);if(!s){H("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,s)}paintImageXObjectRepeat(t,e,s,i,n){if(!this.contentVisible)return;let r=this.getObject(t,e);if(!r){H("Dependent image isn't ready yet");return}let o=r.width,l=r.height,h=[];for(let c=0,d=n.length;c<d;c+=2)h.push({transform:[s,0,0,i,n[c],n[c+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(t,r,h)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;let{bitmap:e,width:s,height:i}=t,n=this.cachedCanvases.getCanvas("inlineImage",s,i),r=n.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",n.canvas}paintInlineImageXObject(t,e){if(!this.contentVisible)return;let s=e.width,i=e.height,n=this.ctx;this.save(t);let{filter:r}=n;r!=="none"&&r!==""&&(n.filter="none"),n.scale(1/s,-1/i);let o;if(e.bitmap)o=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)o=e;else{let c=this.cachedCanvases.getCanvas("inlineImage",s,i).context;go(c,e),o=this.applyTransferMapsToCanvas(c)}let l=this._scaleImage(o,Vt(n));n.imageSmoothingEnabled=bo(rt(n),e.interpolate),this.dependencyTracker?.resetBBox(t).recordBBox(t,n,0,s,-i,0).recordDependencies(t,Ot.imageXObject).recordOperation(t),Ds(n,l.img,0,0,l.paintWidth,l.paintHeight,0,-i,s,i),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,s){if(!this.contentVisible)return;let i=this.ctx,n;if(e.bitmap)n=e.bitmap;else{let r=e.width,o=e.height,h=this.cachedCanvases.getCanvas("inlineImage",r,o).context;go(h,e),n=this.applyTransferMapsToCanvas(h)}this.dependencyTracker?.resetBBox(t);for(let r of s)i.save(),i.transform(...r.transform),i.scale(1,-1),Ds(i,n,r.x,r.y,r.w,r.h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,i,0,1,-1,0),i.restore();this.dependencyTracker?.recordOperation(t),this.compose()}paintSolidColorImageMask(t){this.contentVisible&&(this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,Ot.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}markPointProps(t,e,s){}beginMarkedContent(t,e){this.dependencyTracker?.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,s){this.dependencyTracker?.beginMarkedContent(t),e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(s)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){this.dependencyTracker?.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,s){let i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(s);let n=this.ctx;this.pendingClip?(i||(this.pendingClip===yo?n.clip(e,"evenodd"):n.clip(e)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):this.dependencyTracker?.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=rt(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:t}=this.current,{a:e,b:s,c:i,d:n}=this.ctx.getTransform(),r,o;if(s===0&&i===0){let l=Math.abs(e),h=Math.abs(n);if(l===h)if(t===0)r=o=1/l;else{let c=l*t;r=o=c<1?1/c:1}else if(t===0)r=1/l,o=1/h;else{let c=l*t,d=h*t;r=c<1?1/c:1,o=d<1?1/d:1}}else{let l=Math.abs(e*n-s*i),h=Math.hypot(e,s),c=Math.hypot(i,n);if(t===0)r=c/l,o=h/l;else{let d=t*l;r=c>d?c/d:1,o=h>d?h/d:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,e){let{ctx:s,current:{lineWidth:i}}=this,[n,r]=this.getScaleForStroking();if(n===r){s.lineWidth=(i||1)*n,s.stroke(t);return}let o=s.getLineDash();e&&s.save(),s.scale(n,r),$i.a=1/n,$i.d=1/r;let l=new Path2D;if(l.addPath(t,$i),o.length>0){let h=Math.max(n,r);s.setLineDash(o.map(c=>c/h)),s.lineDashOffset/=h}s.lineWidth=i||1,s.stroke(l),e&&s.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};for(let a in ke)Re.prototype[a]!==void 0&&(Re.prototype[ke[a]]=Re.prototype[a]);var ti=class a{#t;#e;#i;static strings=["fontFamily","fontWeight","italicAngle"];static write(t){let e=new TextEncoder,s={},i=0;for(let h of a.strings){let c=e.encode(t[h]);s[h]=c,i+=4+c.length}let n=new ArrayBuffer(i),r=new Uint8Array(n),o=new DataView(n),l=0;for(let h of a.strings){let c=s[h],d=c.length;o.setUint32(l,d),r.set(c,l+4),l+=4+d}return z(l===n.byteLength,"CssFontInfo.write: Buffer overflow"),n}constructor(t){this.#t=t,this.#e=new DataView(this.#t),this.#i=new TextDecoder}#s(t){z(t<a.strings.length,"Invalid string index");let e=0;for(let i=0;i<t;i++)e+=this.#e.getUint32(e)+4;let s=this.#e.getUint32(e);return this.#i.decode(new Uint8Array(this.#t,e+4,s))}get fontFamily(){return this.#s(0)}get fontWeight(){return this.#s(1)}get italicAngle(){return this.#s(2)}},ei=class a{#t;#e;#i;static strings=["css","loadedName","baseFontName","src"];static write(t){let e=new TextEncoder,s={},i=0;for(let u of a.strings){let f=e.encode(t[u]);s[u]=f,i+=4+f.length}i+=4;let n,r,o=1+i;t.style&&(n=e.encode(t.style.style),r=e.encode(t.style.weight),o+=4+n.length+4+r.length);let l=new ArrayBuffer(o),h=new Uint8Array(l),c=new DataView(l),d=0;c.setUint8(d++,t.guessFallback?1:0),c.setUint32(d,0),d+=4,i=0;for(let u of a.strings){let f=s[u],g=f.length;i+=4+g,c.setUint32(d,g),h.set(f,d+4),d+=4+g}return c.setUint32(d-i-4,i),t.style&&(c.setUint32(d,n.length),h.set(n,d+4),d+=4+n.length,c.setUint32(d,r.length),h.set(r,d+4),d+=4+r.length),z(d<=l.byteLength,"SubstitionInfo.write: Buffer overflow"),l.transferToFixedLength(d)}constructor(t){this.#t=t,this.#e=new DataView(this.#t),this.#i=new TextDecoder}get guessFallback(){return this.#e.getUint8(0)!==0}#s(t){z(t<a.strings.length,"Invalid string index");let e=5;for(let i=0;i<t;i++)e+=this.#e.getUint32(e)+4;let s=this.#e.getUint32(e);return this.#i.decode(new Uint8Array(this.#t,e+4,s))}get css(){return this.#s(0)}get loadedName(){return this.#s(1)}get baseFontName(){return this.#s(2)}get src(){return this.#s(3)}get style(){let t=1;t+=4+this.#e.getUint32(t);let e=this.#e.getUint32(t),s=this.#i.decode(new Uint8Array(this.#t,t+4,e));t+=4+e;let i=this.#e.getUint32(t),n=this.#i.decode(new Uint8Array(this.#t,t+4,i));return{style:s,weight:n}}},Sn=class a{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static#t=Math.ceil(this.bools.length*2/8);static#e=this.#t+this.numbers.length*8;static#i=this.#e+1+8;static#s=this.#i+1+48;static#o=this.#s+1+6;#n;#r;#a;constructor({data:t,extra:e}){this.#n=t,this.#r=new TextDecoder,this.#a=new DataView(this.#n),e&&Object.assign(this,e)}#h(t){z(t<a.bools.length,"Invalid boolean index");let e=Math.floor(t/4),s=t*2%8,i=this.#a.getUint8(e)>>s&3;return i===0?void 0:i===2}get black(){return this.#h(0)}get bold(){return this.#h(1)}get disableFontFace(){return this.#h(2)}get fontExtraProperties(){return this.#h(3)}get isInvalidPDFjsFont(){return this.#h(4)}get isType3Font(){return this.#h(5)}get italic(){return this.#h(6)}get missingFile(){return this.#h(7)}get remeasure(){return this.#h(8)}get vertical(){return this.#h(9)}#l(t){return z(t<a.numbers.length,"Invalid number index"),this.#a.getFloat64(a.#t+t*8)}get ascent(){return this.#l(0)}get defaultWidth(){return this.#l(1)}get descent(){return this.#l(2)}get bbox(){let t=a.#e;if(this.#a.getUint8(t)===0)return;t+=1;let s=[];for(let i=0;i<4;i++)s.push(this.#a.getInt16(t,!0)),t+=2;return s}get fontMatrix(){let t=a.#i;if(this.#a.getUint8(t)===0)return;t+=1;let s=[];for(let i=0;i<6;i++)s.push(this.#a.getFloat64(t,!0)),t+=8;return s}get defaultVMetrics(){let t=a.#s;if(this.#a.getUint8(t)===0)return;t+=1;let s=[];for(let i=0;i<3;i++)s.push(this.#a.getInt16(t,!0)),t+=2;return s}#u(t){z(t<a.strings.length,"Invalid string index");let e=a.#o+4;for(let n=0;n<t;n++)e+=this.#a.getUint32(e)+4;let s=this.#a.getUint32(e),i=new Uint8Array(s);return i.set(new Uint8Array(this.#n,e+4,s)),this.#r.decode(i)}get fallbackName(){return this.#u(0)}get loadedName(){return this.#u(1)}get mimetype(){return this.#u(2)}get name(){return this.#u(3)}get data(){let t=a.#o,e=this.#a.getUint32(t);t+=4+e;let s=this.#a.getUint32(t);t+=4+s;let i=this.#a.getUint32(t);t+=4+i;let n=this.#a.getUint32(t);if(n!==0)return new Uint8Array(this.#n,t+4,n)}clearData(){let t=a.#o,e=this.#a.getUint32(t);t+=4+e;let s=this.#a.getUint32(t);t+=4+s;let i=this.#a.getUint32(t);t+=4+i;let n=this.#a.getUint32(t);new Uint8Array(this.#n,t+4,n).fill(0),this.#a.setUint32(t,0)}get cssFontInfo(){let t=a.#o,e=this.#a.getUint32(t);t+=4+e;let s=this.#a.getUint32(t);t+=4+s;let i=this.#a.getUint32(t);if(i===0)return null;let n=new Uint8Array(i);return n.set(new Uint8Array(this.#n,t+4,i)),new ti(n.buffer)}get systemFontInfo(){let t=a.#o,e=this.#a.getUint32(t);t+=4+e;let s=this.#a.getUint32(t);if(s===0)return null;let i=new Uint8Array(s);return i.set(new Uint8Array(this.#n,t+4,s)),new ei(i.buffer)}static write(t){let e=t.systemFontInfo?ei.write(t.systemFontInfo):null,s=t.cssFontInfo?ti.write(t.cssFontInfo):null,i=new TextEncoder,n={},r=0;for(let p of a.strings)n[p]=i.encode(t[p]),r+=4+n[p].length;let o=a.#o+4+r+4+(e?e.byteLength:0)+4+(s?s.byteLength:0)+4+(t.data?t.data.length:0),l=new ArrayBuffer(o),h=new Uint8Array(l),c=new DataView(l),d=0,u=a.bools.length,f=0,g=0;for(let p=0;p<u;p++){let b=t[a.bools[p]];f|=(b===void 0?0:b?2:1)<<g,g+=2,(g===8||p===u-1)&&(c.setUint8(d++,f),f=0,g=0)}z(d===a.#t,"FontInfo.write: Boolean properties offset mismatch");for(let p of a.numbers)c.setFloat64(d,t[p]),d+=8;if(z(d===a.#e,"FontInfo.write: Number properties offset mismatch"),t.bbox){c.setUint8(d++,4);for(let p of t.bbox)c.setInt16(d,p,!0),d+=2}else c.setUint8(d++,0),d+=8;if(z(d===a.#i,"FontInfo.write: BBox properties offset mismatch"),t.fontMatrix){c.setUint8(d++,6);for(let p of t.fontMatrix)c.setFloat64(d,p,!0),d+=8}else c.setUint8(d++,0),d+=48;if(z(d===a.#s,"FontInfo.write: FontMatrix properties offset mismatch"),t.defaultVMetrics){c.setUint8(d++,1);for(let p of t.defaultVMetrics)c.setInt16(d,p,!0),d+=2}else c.setUint8(d++,0),d+=6;z(d===a.#o,"FontInfo.write: DefaultVMetrics properties offset mismatch"),c.setUint32(a.#o,0),d+=4;for(let p of a.strings){let b=n[p],m=b.length;c.setUint32(d,m),h.set(b,d+4),d+=4+m}if(c.setUint32(a.#o,d-a.#o-4),!e)c.setUint32(d,0),d+=4;else{let p=e.byteLength;c.setUint32(d,p),z(d+4+p<=l.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),h.set(new Uint8Array(e),d+4),d+=4+p}if(!s)c.setUint32(d,0),d+=4;else{let p=s.byteLength;c.setUint32(d,p),z(d+4+p<=l.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),h.set(new Uint8Array(s),d+4),d+=4+p}return t.data===void 0?(c.setUint32(d,0),d+=4):(c.setUint32(d,t.data.length),h.set(t.data,d+4),d+=4+t.data.length),z(d<=l.byteLength,"FontInfo.write: Buffer overflow"),l.transferToFixedLength(d)}},Xt=class{static#t=null;static#e="";static get workerPort(){return this.#t}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");this.#t=t}static get workerSrc(){return this.#e}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");this.#e=t}},xn=class{#t;#e;constructor({parsedData:t,rawData:e}){this.#t=t,this.#e=e}getRaw(){return this.#e}get(t){return this.#t.get(t)??null}[Symbol.iterator](){return this.#t.entries()}},Te=Symbol("INTERNAL"),Tn=class{#t=!1;#e=!1;#i=!1;#s=!0;constructor(t,{name:e,intent:s,usage:i,rbGroups:n}){this.#t=!!(t&kt.DISPLAY),this.#e=!!(t&kt.PRINT),this.name=e,this.intent=s,this.usage=i,this.rbGroups=n}get visible(){if(this.#i)return this.#s;if(!this.#s)return!1;let{print:t,view:e}=this.usage;return this.#t?e?.viewState!=="OFF":this.#e?t?.printState!=="OFF":!0}_setVisible(t,e,s=!1){t!==Te&&Q("Internal method `_setVisible` called."),this.#i=s,this.#s=e}},Cn=class{#t=null;#e=new Map;#i=null;#s=null;constructor(t,e=kt.DISPLAY){if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,this.#s=t.order;for(let s of t.groups)this.#e.set(s.id,new Tn(e,s));if(t.baseState==="OFF")for(let s of this.#e.values())s._setVisible(Te,!1);for(let s of t.on)this.#e.get(s)._setVisible(Te,!0);for(let s of t.off)this.#e.get(s)._setVisible(Te,!1);this.#i=this.getHash()}}#o(t){let e=t.length;if(e<2)return!0;let s=t[0];for(let i=1;i<e;i++){let n=t[i],r;if(Array.isArray(n))r=this.#o(n);else if(this.#e.has(n))r=this.#e.get(n).visible;else return H(`Optional content group not found: ${n}`),!0;switch(s){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return s==="And"}isVisible(t){if(this.#e.size===0)return!0;if(!t)return wi("Optional content group not defined."),!0;if(t.type==="OCG")return this.#e.has(t.id)?this.#e.get(t.id).visible:(H(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return this.#o(t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!this.#e.has(e))return H(`Optional content group not found: ${e}`),!0;if(this.#e.get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(let e of t.ids){if(!this.#e.has(e))return H(`Optional content group not found: ${e}`),!0;if(!this.#e.get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(let e of t.ids){if(!this.#e.has(e))return H(`Optional content group not found: ${e}`),!0;if(!this.#e.get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(let e of t.ids){if(!this.#e.has(e))return H(`Optional content group not found: ${e}`),!0;if(this.#e.get(e).visible)return!1}return!0}return H(`Unknown optional content policy ${t.policy}.`),!0}return H(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){let i=this.#e.get(t);if(!i){H(`Optional content group not found: ${t}`);return}if(s&&e&&i.rbGroups.length)for(let n of i.rbGroups)for(let r of n)r!==t&&this.#e.get(r)?._setVisible(Te,!1,!0);i._setVisible(Te,!!e,!0),this.#t=null}setOCGState({state:t,preserveRB:e}){let s;for(let i of t){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}let n=this.#e.get(i);if(n)switch(s){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!n.visible,e);break}}this.#t=null}get hasInitialVisibility(){return this.#i===null||this.getHash()===this.#i}getOrder(){return this.#e.size?this.#s?this.#s.slice():[...this.#e.keys()]:null}getGroup(t){return this.#e.get(t)||null}getHash(){if(this.#t!==null)return this.#t;let t=new $s;for(let[e,s]of this.#e)t.update(`${e}:${s.visible}`);return this.#t=t.hexdigest()}[Symbol.iterator](){return this.#e.entries()}},Pn=class{constructor(t,{disableRange:e=!1,disableStream:s=!1}){z(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');let{length:i,initialData:n,progressiveDone:r,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=o,n?.length>0){let l=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((l,h)=>{this._onReceiveData({begin:l,chunk:h})}),t.addProgressListener((l,h)=>{this._onProgress({loaded:l,total:h})}),t.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){let s=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{let i=this._rangeReaders.some(function(n){return n._begin!==t?!1:(n._enqueue(s),!0)});z(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){t.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){let e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){z(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let t=this._queuedChunks;return this._queuedChunks=null,new Rn(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let s=new kn(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(let e of this._rangeReaders.slice(0))e.cancel(t);this._pdfDataRangeTransport.abort()}},Rn=class{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=vi(i)?i:null,this._queuedChunks=e||[],this._loaded=0;for(let n of this._queuedChunks)this._loaded+=n.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}},kn=class{constructor(t,e,s){this._stream=t,this._begin=e,this._end=s,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(let s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}};function Pl(a){let t=!0,e=s("filename\\*","i").exec(a);if(e){e=e[1];let c=o(e);return c=unescape(c),c=l(c),c=h(c),n(c)}if(e=r(a),e){let c=h(e);return n(c)}if(e=s("filename","i").exec(a),e){e=e[1];let c=o(e);return c=h(c),n(c)}function s(c,d){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function i(c,d){if(c){if(!/^[\x00-\xFF]+$/.test(d))return d;try{let u=new TextDecoder(c,{fatal:!0}),f=us(d);d=u.decode(f),t=!1}catch{}}return d}function n(c){return t&&/[\x80-\xff]/.test(c)&&(c=i("utf-8",c),t&&(c=i("iso-8859-1",c))),c}function r(c){let d=[],u,f=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(u=f.exec(c))!==null;){let[,p,b,m]=u;if(p=parseInt(p,10),p in d){if(p===0)break;continue}d[p]=[b,m]}let g=[];for(let p=0;p<d.length&&p in d;++p){let[b,m]=d[p];m=o(m),b&&(m=unescape(m),p===0&&(m=l(m))),g.push(m)}return g.join("")}function o(c){if(c.startsWith('"')){let d=c.slice(1).split('\\"');for(let u=0;u<d.length;++u){let f=d[u].indexOf('"');f!==-1&&(d[u]=d[u].slice(0,f),d.length=u+1),d[u]=d[u].replaceAll(/\\(.)/g,"$1")}c=d.join('"')}return c}function l(c){let d=c.indexOf("'");if(d===-1)return c;let u=c.slice(0,d),g=c.slice(d+1).replace(/^[^']*'/,"");return i(u,g)}function h(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(d,u,f,g){if(f==="q"||f==="Q")return g=g.replaceAll("_"," "),g=g.replaceAll(/=([0-9a-fA-F]{2})/g,function(p,b){return String.fromCharCode(parseInt(b,16))}),i(u,g);try{g=atob(g)}catch{}return i(u,g)})}return""}function Mo(a,t){let e=new Headers;if(!a||!t||typeof t!="object")return e;for(let s in t){let i=t[s];i!==void 0&&e.append(s,i)}return e}function Ei(a){return URL.parse(a)?.origin??null}function Io({responseHeaders:a,isHttp:t,rangeChunkSize:e,disableRange:s}){let i={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(a.get("Content-Length"),10);return!Number.isInteger(n)||(i.suggestedLength=n,n<=2*e)||s||!t||a.get("Accept-Ranges")!=="bytes"||(a.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function No(a){let t=a.get("Content-Disposition");if(t){let e=Pl(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(vi(e))return e}return null}function ps(a,t){return new fe(`Unexpected server response (${a}) while retrieving PDF "${t}".`,a,a===404||a===0&&t.startsWith("file:"))}function Oo(a){return a===200||a===206}function Fo(a,t,e){return{method:"GET",headers:a,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Bo(a){return a instanceof Uint8Array?a.buffer:a instanceof ArrayBuffer?a:(H(`getArrayBuffer - unexpected data format: ${a}`),new Uint8Array(a).buffer)}var Dn=class{_responseOrigin=null;constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Mo(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return z(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Ln(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let s=new Mn(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(let e of this._rangeRequestReaders.slice(0))e.cancel(t)}},Ln=class{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;let e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;let s=new Headers(t.headers),i=e.url;fetch(i,Fo(s,this._withCredentials,this._abortController)).then(n=>{if(t._responseOrigin=Ei(n.url),!Oo(n.status))throw ps(n.status,i);this._reader=n.body.getReader(),this._headersCapability.resolve();let r=n.headers,{allowRangeRequests:o,suggestedLength:l}=Io({responseHeaders:r,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=No(r),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Ut("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:Bo(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}},Mn=class{constructor(t,e,s){this._stream=t,this._reader=null,this._loaded=0;let i=t.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController;let n=new Headers(t.headers);n.append("Range",`bytes=${e}-${s-1}`);let r=i.url;fetch(r,Fo(n,this._withCredentials,this._abortController)).then(o=>{let l=Ei(o.url);if(l!==t._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${t._responseOrigin}".`);if(!Oo(o.status))throw ps(o.status,r);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:Bo(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}},Gi=200,zi=206;function Rl(a){let t=a.response;return typeof t!="string"?t:us(t).buffer}var In=class{_responseOrigin=null;constructor({url:t,httpHeaders:e,withCredentials:s}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Mo(this.isHttp,e),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(t){let e=new XMLHttpRequest,s=this.currXhrId++,i=this.pendingRequests[s]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(let[n,r]of this.headers)e.setRequestHeader(n,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=zi):i.expectedStatus=Gi,e.responseType="arraybuffer",z(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{t.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,s),e.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=t.onHeadersReceived,i.onDone=t.onDone,i.onError=t.onError,i.onProgress=t.onProgress,e.send(null),s}onProgress(t,e){let s=this.pendingRequests[t];s&&s.onProgress?.(e)}onStateChange(t,e){let s=this.pendingRequests[t];if(!s)return;let i=s.xhr;if(i.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),i.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],i.status===0&&this.isHttp){s.onError(i.status);return}let n=i.status||Gi;if(!(n===Gi&&s.expectedStatus===zi)&&n!==s.expectedStatus){s.onError(i.status);return}let o=Rl(i);if(n===zi){let l=i.getResponseHeader("Content-Range"),h=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);h?s.onDone({begin:parseInt(h[1],10),chunk:o}):(H('Missing or invalid "Content-Range" header.'),s.onError(0))}else o?s.onDone({begin:0,chunk:o}):s.onError(i.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){let e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}},Nn=class{constructor(t){this._source=t,this._manager=new In(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){let e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return z(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new On(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){let s=new Fn(this._manager,t,e);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(let e of this._rangeRequestReaders.slice(0))e.cancel(t)}},On=class{constructor(t,e){this._manager=t,this._url=e.url,this._fullRequestId=t.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){let t=this._fullRequestId,e=this._manager.getRequestXhr(t);this._manager._responseOrigin=Ei(e.responseURL);let s=e.getAllResponseHeaders(),i=new Headers(s?s.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(o=>{let[l,...h]=o.split(": ");return[l,h.join(": ")]}):[]),{allowRangeRequests:n,suggestedLength:r}=Io({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=r||this._contentLength,this._filename=No(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=ps(t,this._url),this._headersCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}},Fn=class{constructor(t,e,s){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:s,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){let t=Ei(this._manager.getRequestXhr(this._requestId)?.responseURL);t!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${t}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){this.onClosed?.(this)}_onDone(t){let e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(let s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError??=ps(t,this._url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}},kl=/^[a-z][a-z0-9\-+.]+:/i;function Dl(a){if(kl.test(a))return new URL(a);let t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(a))}var Bn=class{constructor(t){this.source=t,this.url=Dl(t.url),z(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return z(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new Hn(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let s=new Un(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(let e of this._rangeRequestReaders.slice(0))e.cancel(t)}},Hn=class{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;let e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();let s=process.getBuiltinModule("fs");s.promises.lstat(this._url).then(i=>{this._contentLength=i.size,this._setReadableStream(s.createReadStream(this._url)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=ps(0,this._url.href)),this._storedError=i,this._headersCapability.reject(i)})}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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Ut("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}},Un=class{constructor(t,e,s){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();let i=t.source;this._isStreamingSupported=!i.disableStream;let n=process.getBuiltinModule("fs");this._setReadableStream(n.createReadStream(this._url,{start:e,end:s-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}},ze=Symbol("INITIAL_DATA"),si=class{#t=Object.create(null);#e(t){return this.#t[t]||={...Promise.withResolvers(),data:ze}}get(t,e=null){if(e){let i=this.#e(t);return i.promise.then(()=>e(i.data)),null}let s=this.#t[t];if(!s||s.data===ze)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){let e=this.#t[t];return!!e&&e.data!==ze}delete(t){let e=this.#t[t];return!e||e.data===ze?!1:(delete this.#t[t],!0)}resolve(t,e=null){let s=this.#e(t);s.data=e,s.resolve()}clear(){for(let t in this.#t){let{data:e}=this.#t[t];e?.bitmap?.close()}this.#t=Object.create(null)}*[Symbol.iterator](){for(let t in this.#t){let{data:e}=this.#t[t];e!==ze&&(yield[t,e])}}},Ll=1e5,Ao=30,he=class a{#t=Promise.withResolvers();#e=null;#i=!1;#s=!!globalThis.FontInspector?.enabled;#o=null;#n=null;#r=0;#a=0;#h=null;#l=null;#u=0;#d=0;#f=Object.create(null);#m=[];#p=null;#c=[];#g=new WeakMap;#b=null;static#A=new Map;static#y=new Map;static#x=new WeakMap;static#_=null;static#w=new Set;constructor({textContentSource:t,container:e,viewport:s}){if(t instanceof ReadableStream)this.#p=t;else if(typeof t=="object")this.#p=new ReadableStream({start(l){l.enqueue(t),l.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#e=this.#l=e,this.#d=s.scale*qt.pixelRatio,this.#u=s.rotation,this.#n={div:null,properties:null,ctx:null};let{pageWidth:i,pageHeight:n,pageX:r,pageY:o}=s.rawDims;this.#b=[1,0,0,-1,-r,o+n],this.#a=i,this.#r=n,a.#R(),ae(e,s),this.#t.promise.finally(()=>{a.#w.delete(this),this.#n=null,this.#f=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=dt.platform;return U(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){let t=()=>{this.#h.read().then(({value:e,done:s})=>{if(s){this.#t.resolve();return}this.#o??=e.lang,Object.assign(this.#f,e.styles),this.#C(e.items),t()},this.#t.reject)};return this.#h=this.#p.getReader(),a.#w.add(this),t(),this.#t.promise}update({viewport:t,onBefore:e=null}){let s=t.scale*qt.pixelRatio,i=t.rotation;if(i!==this.#u&&(e?.(),this.#u=i,ae(this.#l,{rotation:i})),s!==this.#d){e?.(),this.#d=s;let n={div:null,properties:null,ctx:a.#k(this.#o)};for(let r of this.#c)n.properties=this.#g.get(r),n.div=r,this.#S(n)}}cancel(){let t=new Ut("TextLayer task cancelled.");this.#h?.cancel(t).catch(()=>{}),this.#h=null,this.#t.reject(t)}get textDivs(){return this.#c}get textContentItemsStr(){return this.#m}#C(t){if(this.#i)return;this.#n.ctx??=a.#k(this.#o);let e=this.#c,s=this.#m;for(let i of t){if(e.length>Ll){H("Ignoring additional textDivs for performance reasons."),this.#i=!0;return}if(i.str===void 0){if(i.type==="beginMarkedContentProps"||i.type==="beginMarkedContent"){let n=this.#e;this.#e=document.createElement("span"),this.#e.classList.add("markedContent"),i.id&&this.#e.setAttribute("id",`${i.id}`),n.append(this.#e)}else i.type==="endMarkedContent"&&(this.#e=this.#e.parentNode);continue}s.push(i.str),this.#E(i)}}#E(t){let e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#c.push(e);let i=k.transform(this.#b,t.transform),n=Math.atan2(i[1],i[0]),r=this.#f[t.fontName];r.vertical&&(n+=Math.PI/2);let o=this.#s&&r.fontSubstitution||r.fontFamily;o=a.fontFamilyMap.get(o)||o;let l=Math.hypot(i[2],i[3]),h=l*a.#F(o,r,this.#o),c,d;n===0?(c=i[4],d=i[5]-h):(c=i[4]+h*Math.sin(n),d=i[5]-h*Math.cos(n));let u="calc(var(--total-scale-factor) *",f=e.style;this.#e===this.#l?(f.left=`${(100*c/this.#a).toFixed(2)}%`,f.top=`${(100*d/this.#r).toFixed(2)}%`):(f.left=`${u}${c.toFixed(2)}px)`,f.top=`${u}${d.toFixed(2)}px)`),f.fontSize=`${u}${(a.#_*l).toFixed(2)}px)`,f.fontFamily=o,s.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,this.#s&&(e.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),n!==0&&(s.angle=n*(180/Math.PI));let g=!1;if(t.str.length>1)g=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){let p=Math.abs(t.transform[0]),b=Math.abs(t.transform[3]);p!==b&&Math.max(p,b)/Math.min(p,b)>1.5&&(g=!0)}if(g&&(s.canvasWidth=r.vertical?t.height:t.width),this.#g.set(e,s),this.#n.div=e,this.#n.properties=s,this.#S(this.#n),s.hasText&&this.#e.append(e),s.hasEOL){let p=document.createElement("br");p.setAttribute("role","presentation"),this.#e.append(p)}}#S(t){let{div:e,properties:s,ctx:i}=t,{style:n}=e,r="";if(a.#_>1&&(r=`scale(${1/a.#_})`),s.canvasWidth!==0&&s.hasText){let{fontFamily:o}=n,{canvasWidth:l,fontSize:h}=s;a.#P(i,h*this.#d,o);let{width:c}=i.measureText(e.textContent);c>0&&(r=`scaleX(${l*this.#d/c}) ${r}`)}s.angle!==0&&(r=`rotate(${s.angle}deg) ${r}`),r.length>0&&(n.transform=r)}static cleanup(){if(!(this.#w.size>0)){this.#A.clear();for(let{canvas:t}of this.#y.values())t.remove();this.#y.clear()}}static#k(t=null){let e=this.#y.get(t||="");if(!e){let s=document.createElement("canvas");s.className="hiddenCanvasElement",s.lang=t,document.body.append(s),e=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#y.set(t,e),this.#x.set(e,{size:0,family:""})}return e}static#P(t,e,s){let i=this.#x.get(t);e===i.size&&s===i.family||(t.font=`${e}px ${s}`,i.size=e,i.family=s)}static#R(){if(this.#_!==null)return;let t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),this.#_=t.getBoundingClientRect().height,t.remove()}static#F(t,e,s){let i=this.#A.get(t);if(i)return i;let n=this.#k(s);n.canvas.width=n.canvas.height=Ao,this.#P(n,Ao,t);let r=n.measureText(""),o=r.fontBoundingBoxAscent,l=Math.abs(r.fontBoundingBoxDescent);n.canvas.width=n.canvas.height=0;let h=.8;return o?h=o/(o+l):(dt.platform.isFirefox&&H("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?h=e.ascent:e.descent&&(h=1+e.descent)),this.#A.set(t,h),h}},Ml=100;function _i(a={}){typeof a=="string"||a instanceof URL?a={url:a}:(a instanceof ArrayBuffer||ArrayBuffer.isView(a))&&(a={data:a});let t=new jn,{docId:e}=t,s=a.url?bl(a.url):null,i=a.data?yl(a.data):null,n=a.httpHeaders||null,r=a.withCredentials===!0,o=a.password??null,l=a.range instanceof is?a.range:null,h=Number.isInteger(a.rangeChunkSize)&&a.rangeChunkSize>0?a.rangeChunkSize:2**16,c=a.worker instanceof Ie?a.worker:null,d=a.verbosity,u=typeof a.docBaseUrl=="string"&&!fs(a.docBaseUrl)?a.docBaseUrl:null,f=Cs(a.cMapUrl),g=a.cMapPacked!==!1,p=a.CMapReaderFactory||(xt?un:Ws),b=Cs(a.iccUrl),m=Cs(a.standardFontDataUrl),y=a.StandardFontDataFactory||(xt?fn:Ys),A=Cs(a.wasmUrl),w=a.WasmFactory||(xt?pn:Zs),v=a.stopAtErrors!==!0,E=Number.isInteger(a.maxImageSize)&&a.maxImageSize>-1?a.maxImageSize:-1,_=a.isEvalSupported!==!1,S=typeof a.isOffscreenCanvasSupported=="boolean"?a.isOffscreenCanvasSupported:!xt,x=typeof a.isImageDecoderSupported=="boolean"?a.isImageDecoderSupported:!xt&&(dt.platform.isFirefox||!globalThis.chrome),T=Number.isInteger(a.canvasMaxAreaInBytes)?a.canvasMaxAreaInBytes:-1,C=typeof a.disableFontFace=="boolean"?a.disableFontFace:xt,I=a.fontExtraProperties===!0,O=a.enableXfa===!0,L=a.ownerDocument||globalThis.document,j=a.disableRange===!0,P=a.disableStream===!0,D=a.disableAutoFetch===!0,N=a.pdfBug===!0,X=a.CanvasFactory||(xt?dn:ln),mt=a.FilterFactory||(xt?cn:hn),Tt=a.enableHWA===!0,J=a.useWasm!==!1,q=l?l.length:a.length??NaN,vt=typeof a.useSystemFonts=="boolean"?a.useSystemFonts:!xt&&!C,bt=typeof a.useWorkerFetch=="boolean"?a.useWorkerFetch:!!(p===Ws&&y===Ys&&w===Zs&&f&&m&&A&&Xe(f,document.baseURI)&&Xe(m,document.baseURI)&&Xe(A,document.baseURI)),yt=null;ol(d);let Y={canvasFactory:new X({ownerDocument:L,enableHWA:Tt}),filterFactory:new mt({docId:e,ownerDocument:L}),cMapReaderFactory:bt?null:new p({baseUrl:f,isCompressed:g}),standardFontDataFactory:bt?null:new y({baseUrl:m}),wasmFactory:bt?null:new w({baseUrl:A})};c||(c=Ie.create({verbosity:d,port:Xt.workerPort}),t._worker=c);let M={docId:e,apiVersion:"5.4.296",data:i,password:o,disableAutoFetch:D,rangeChunkSize:h,length:q,docBaseUrl:u,enableXfa:O,evaluatorOptions:{maxImageSize:E,disableFontFace:C,ignoreErrors:v,isEvalSupported:_,isOffscreenCanvasSupported:S,isImageDecoderSupported:x,canvasMaxAreaInBytes:T,fontExtraProperties:I,useSystemFonts:vt,useWasm:J,useWorkerFetch:bt,cMapUrl:f,iccUrl:b,standardFontDataUrl:m,wasmUrl:A}},$={ownerDocument:L,pdfBug:N,styleElement:yt,loadingParams:{disableAutoFetch:D,enableXfa:O}};return c.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");let lt=c.messageHandler.sendWithPromise("GetDocRequest",M,i?[i.buffer]:null),St;if(l)St=new Pn(l,{disableRange:j,disableStream:P});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");let K=Xe(s)?Dn:xt?Bn:Nn;St=new K({url:s,length:q,httpHeaders:n,withCredentials:r,rangeChunkSize:h,disableRange:j,disableStream:P})}return lt.then(K=>{if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");let W=new ue(e,K,c.port),st=new zn(W,t,St,$,Y,Tt);t._transport=st,W.send("Ready",null)})}).catch(t._capability.reject),t}var jn=class a{static#t=0;_capability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${a.#t++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}},is=class{#t=Promise.withResolvers();#e=[];#i=[];#s=[];#o=[];constructor(t,e,s=!1,i=null){this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i}addRangeListener(t){this.#o.push(t)}addProgressListener(t){this.#s.push(t)}addProgressiveReadListener(t){this.#i.push(t)}addProgressiveDoneListener(t){this.#e.push(t)}onDataRange(t,e){for(let s of this.#o)s(t,e)}onDataProgress(t,e){this.#t.promise.then(()=>{for(let s of this.#s)s(t,e)})}onDataProgressiveRead(t){this.#t.promise.then(()=>{for(let e of this.#i)e(t)})}onDataProgressiveDone(){this.#t.promise.then(()=>{for(let t of this.#e)t()})}transportReady(){this.#t.resolve()}requestDataRange(t,e){Q("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},$n=class{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return U(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},Gn=class{#t=!1;constructor(t,e,s,i=!1){this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new Bs:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new si,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new Qe({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}getAnnotations({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return U(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,canvas:e=t.canvas,viewport:s,intent:i="display",annotationMode:n=Ht.ENABLE,transform:r=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:h=null,pageColors:c=null,printAnnotationStorage:d=null,isEditing:u=!1,recordOperations:f=!1,operationsFilter:g=null}){this._stats?.time("Overall");let p=this._transport.getRenderingIntent(i,n,d,u),{renderingIntent:b,cacheKey:m}=p;this.#t=!1,l||=this._transport.getOptionalContentConfig(b);let y=this._intentStates.get(m);y||(y=Object.create(null),this._intentStates.set(m,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);let A=!!(b&kt.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(p));let w=!!(this._pdfBug&&globalThis.StepperManager?.enabled),v=!this.recordedBBoxes&&(f||w),E=x=>{if(y.renderTasks.delete(_),v){let T=_.gfx?.dependencyTracker.take();T&&(_.stepper&&_.stepper.setOperatorBBoxes(T,_.gfx.dependencyTracker.takeDebugMetadata()),f&&(this.recordedBBoxes=T))}A&&(this.#t=!0),this.#e(),x?(_.capability.reject(x),this._abortOperatorList({intentState:y,reason:x instanceof Error?x:new Error(x)})):_.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},_=new Wn({callback:E,params:{canvas:e,canvasContext:t,dependencyTracker:v?new bn(e,y.operatorList.length,w):null,viewport:s,transform:r,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!A,pdfBug:this._pdfBug,pageColors:c,enableHWA:this._transport.enableHWA,operationsFilter:g});(y.renderTasks||=new Set).add(_);let S=_.task;return Promise.all([y.displayReadyCapability.promise,l]).then(([x,T])=>{if(this.destroyed){E();return}if(this._stats?.time("Rendering"),!(T.renderingIntent&b))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");_.initializeGraphics({transparency:x,optionalContentConfig:T}),_.operatorListChanged()}).catch(E),S}getOperatorList({intent:t="display",annotationMode:e=Ht.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){function n(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}let r=this._transport.getRenderingIntent(t,e,s,i,!0),o=this._intentStates.get(r.cacheKey);o||(o=Object.create(null),this._intentStates.set(r.cacheKey,o));let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=n,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(r)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>Ze.textContent(s));let e=this.streamTextContent(t);return new Promise(function(s,i){function n(){r.read().then(function({value:l,done:h}){if(h){s(o);return}o.lang??=l.lang,Object.assign(o.styles,l.styles),o.items.push(...l.items),n()},i)}let r=e.getReader(),o={items:[],styles:Object.create(null),lang:null};n()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),this.#t=!1,Promise.all(t)}cleanup(t=!1){this.#t=!0;let e=this.#e();return t&&e&&(this._stats&&=new Bs),e}#e(){if(!this.#t||this.destroyed)return!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}_startRenderPage(t,e){let s=this._intentStates.get(e);s&&(this._stats?.timeEnd("Page Request"),s.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let s=0,i=t.length;s<i;s++)e.operatorList.fnArray.push(t.fnArray[s]),e.operatorList.argsArray.push(t.argsArray[s]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(let s of e.renderTasks)s.operatorListChanged();t.lastChunk&&this.#e()}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:i}){let{map:n,transfer:r}=s,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:i},r).getReader(),h=this._intentStates.get(e);h.streamReader=l;let c=()=>{l.read().then(({value:d,done:u})=>{if(u){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,h),c())},d=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(let u of h.renderTasks)u.operatorListChanged();this.#e()}if(h.displayReadyCapability)h.displayReadyCapability.reject(d);else if(h.opListReadCapability)h.opListReadCapability.reject(d);else throw d}})};c()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!s){if(t.renderTasks.size>0)return;if(e instanceof Le){let i=Ml;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new Ut(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[i,n]of this._intentStates)if(n===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}},Ie=class a{#t=Promise.withResolvers();#e=null;#i=null;#s=null;static#o=0;static#n=!1;static#r=new WeakMap;static{xt&&(this.#n=!0,Xt.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(t,e)=>{let s=URL.parse(t);if(!s?.origin||s.origin==="null")return!1;let i=new URL(e,s);return s.origin===i.origin},this._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},this.fromPort=t=>{if(gl("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return this.create(t)}}constructor({name:t=null,port:e=null,verbosity:s=al()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=s,e){if(a.#r.has(e))throw new Error("Cannot use more than one PDFWorker per port.");a.#r.set(e,this),this.#h(e)}else this.#l()}get promise(){return this.#t.promise}#a(){this.#t.resolve(),this.#e.send("configure",{verbosity:this.verbosity})}get port(){return this.#i}get messageHandler(){return this.#e}#h(t){this.#i=t,this.#e=new ue("main","worker",t),this.#e.on("ready",()=>{}),this.#a()}#l(){if(a.#n||a.#d){this.#u();return}let{workerSrc:t}=a;try{a._isSameOrigin(window.location,t)||(t=a._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),s=new ue("main","worker",e),i=()=>{n.abort(),s.destroy(),e.terminate(),this.destroyed?this.#t.reject(new Error("Worker was destroyed")):this.#u()},n=new AbortController;e.addEventListener("error",()=>{this.#s||i()},{signal:n.signal}),s.on("test",o=>{if(n.abort(),this.destroyed||!o){i();return}this.#e=s,this.#i=e,this.#s=e,this.#a()}),s.on("ready",o=>{if(n.abort(),this.destroyed){i();return}try{r()}catch{this.#u()}});let r=()=>{let o=new Uint8Array;s.send("test",o,[o.buffer])};r();return}catch{wi("The worker has been disabled.")}this.#u()}#u(){a.#n||(H("Setting up fake worker."),a.#n=!0),a._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this.#t.reject(new Error("Worker was destroyed"));return}let e=new an;this.#i=e;let s=`fake${a.#o++}`,i=new ue(s+"_worker",s,e);t.setup(i,e),this.#e=new ue(s,s+"_worker",e),this.#a()}).catch(t=>{this.#t.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this.#s?.terminate(),this.#s=null,a.#r.delete(this.#i),this.#i=null,this.#e?.destroy(),this.#e=null}static create(t){let e=this.#r.get(t?.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new a(t)}static get workerSrc(){if(Xt.workerSrc)return Xt.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#d(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return U(this,"_setupFakeWorkerGlobal",(async()=>this.#d?this.#d:(await import(this.workerSrc)).WorkerMessageHandler)())}},zn=class{#t=new Map;#e=new Map;#i=new Map;#s=new Map;#o=null;constructor(t,e,s,i,n,r){this.messageHandler=t,this.loadingTask=e,this.commonObjs=new si,this.fontLoader=new nn({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.wasmFactory=n.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=r,this.setupMessageHandler()}#n(t,e=null){let s=this.#t.get(t);if(s)return s;let i=this.messageHandler.sendWithPromise(t,e);return this.#t.set(t,i),i}get annotationStorage(){return U(this,"annotationStorage",new es)}getRenderingIntent(t,e=Ht.ENABLE,s=null,i=!1,n=!1){let r=kt.DISPLAY,o=sn;switch(t){case"any":r=kt.ANY;break;case"display":break;case"print":r=kt.PRINT;break;default:H(`getRenderingIntent - invalid intent: ${t}`)}let l=r&kt.PRINT&&s instanceof Gs?s:this.annotationStorage;switch(e){case Ht.DISABLE:r+=kt.ANNOTATIONS_DISABLE;break;case Ht.ENABLE:break;case Ht.ENABLE_FORMS:r+=kt.ANNOTATIONS_FORMS;break;case Ht.ENABLE_STORAGE:r+=kt.ANNOTATIONS_STORAGE,o=l.serializable;break;default:H(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(r+=kt.IS_EDITING),n&&(r+=kt.OPLIST);let{ids:h,hash:c}=l.modifiedIds,d=[r,o.hash,c];return{renderingIntent:r,cacheKey:d.join("_"),annotationStorageSerializable:o,modifiedIds:h}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#o?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let s of this.#e.values())t.push(s._destroy());this.#e.clear(),this.#i.clear(),this.#s.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),he.cleanup(),this._networkStream?.cancelAllRequests(new Ut("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(s,i)=>{z(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},i.onPull=()=>{this._fullReader.read().then(function({value:n,done:r}){if(r){i.close();return}z(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{this._fullReader.cancel(n),i.ready.catch(r=>{if(!this.destroyed)throw r})}}),t.on("ReaderHeadersReady",async s=>{await this._fullReader.headersReady;let{isStreamingSupported:i,isRangeSupported:n,contentLength:r}=this._fullReader;return(!i||!n)&&(this._lastProgress&&e.onProgress?.(this._lastProgress),this._fullReader.onProgress=o=>{e.onProgress?.({loaded:o.loaded,total:o.total})}),{isStreamingSupported:i,isRangeSupported:n,contentLength:r}}),t.on("GetRangeReader",(s,i)=>{z(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let n=this._networkStream.getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:r,done:o}){if(o){i.close();return}z(r instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{i.error(r)})},i.onCancel=r=>{n.cancel(r),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:s})=>{this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,e._capability.resolve(new $n(s,this))}),t.on("DocException",s=>{e._capability.reject(Ct(s))}),t.on("PasswordRequest",s=>{this.#o=Promise.withResolvers();try{if(!e.onPassword)throw Ct(s);let i=n=>{n instanceof Error?this.#o.reject(n):this.#o.resolve({password:n})};e.onPassword(i,s.code)}catch(i){this.#o.reject(i)}return this.#o.promise}),t.on("DataLoaded",s=>{e.onProgress?.({loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),t.on("StartRenderPage",s=>{if(this.destroyed)return;this.#e.get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,n])=>{if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":if("error"in n){let c=n.error;H(`Error during font loading: ${c}`),this.commonObjs.resolve(s,c);break}let r=new Sn(n),o=this._params.pdfBug&&globalThis.FontInspector?.enabled?(c,d)=>globalThis.FontInspector.fontAdded(c,d):null,l=new rn(r,o,n.extra,n.charProcOperatorList);this.fontLoader.bind(l).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!l.fontExtraProperties&&l.data&&l.clearData(),this.commonObjs.resolve(s,l)});break;case"CopyLocalImage":let{imageRef:h}=n;z(h,"The imageRef must be defined.");for(let c of this.#e.values())for(let[,d]of c.objs)if(d?.ref===h)return d.dataLen?(this.commonObjs.resolve(s,structuredClone(d)),d.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,n);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([s,i,n,r])=>{if(this.destroyed)return;let o=this.#e.get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){r?.bitmap?.close();return}switch(n){case"Image":case"Pattern":o.objs.resolve(s,r);break;default:throw new Error(`Got unknown object type ${n}`)}}}),t.on("DocProgress",s=>{this.destroyed||e.onProgress?.({loaded:s.loaded,total:s.total})}),t.on("FetchBinaryData",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");let i=this[s.type];if(!i)throw new Error(`${s.type} not initialized, see the \`useWorkerFetch\` parameter.`);return i.fetch(s)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&H("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));let e=t-1,s=this.#i.get(e);if(s)return s;let i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&this.#s.set(n.refStr,t);let r=new Gn(e,n,this,this._params.pdfBug);return this.#e.set(e,r),r});return this.#i.set(e,i),i}getPageIndex(t){return on(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return this.#n("GetFieldObjects")}hasJSActions(){return this.#n("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return this.#n("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#n("GetOptionalContentConfig").then(e=>new Cn(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata",e=this.#t.get(t);if(e)return e;let s=this.messageHandler.sendWithPromise(t,null).then(i=>({info:i[0],metadata:i[1]?new xn(i[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#t.set(t,s),s}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(let e of this.#e.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(!0),he.cleanup()}}cachedPageNumber(t){if(!on(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return this.#s.get(e)??null}},Vn=class{#t=null;onContinue=null;onError=null;constructor(t){this.#t=t}get promise(){return this.#t.capability.promise}cancel(t=0){this.#t.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this.#t.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this.#t;return t.form||t.canvas&&e?.size>0}},Wn=class a{#t=null;static#e=new WeakSet;constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:r,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:c=!1,pdfBug:d=!1,pageColors:u=null,enableHWA:f=!1,operationsFilter:g=null}){this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=d,this.pageColors=u,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 Vn(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=e.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=f,this._dependencyTracker=e.dependencyTracker,this._operationsFilter=g}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(a.#e.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.");a.#e.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:s,transform:i,background:n,dependencyTracker:r}=this.params,o=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new Re(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,r),this.gfx.beginDrawing({transform:i,viewport:s,transparency:t,background:n}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#t&&(window.cancelAnimationFrame(this.#t),this.#t=null),a.#e.delete(this._canvas),t||=new Le(`Rendering cancelled, page ${this._pageIndex+1}`,e),this.callback(t),this.task.onError?.(t)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.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?this.#t=window.requestAnimationFrame(()=>{this.#t=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(),a.#e.delete(this._canvas),this.callback())))}},Ho="5.4.296",Uo="f56dc8601",ns=class a{#t=null;#e=null;#i;#s=null;#o=!1;#n=!1;#r=null;#a;#h=null;#l=null;static#u=null;static get _keyboardManager(){return U(this,"_keyboardManager",new pe([[["Escape","mac+Escape"],a.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],a.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],a.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],a.prototype._moveToPrevious],[["Home","mac+Home"],a.prototype._moveToBeginning],[["End","mac+End"],a.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#n=!1,this.#r=t):this.#n=!0,this.#l=t?._uiManager||e,this.#a=this.#l._eventBus,this.#i=t?.color?.toUpperCase()||this.#l?.highlightColors.values().next().value||"#FFFF98",a.#u||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){let t=this.#t=document.createElement("button");t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",this.#r&&(t.ariaControls=`${this.#r.id}_colorpicker_dropdown`);let e=this.#l._signal;t.addEventListener("click",this.#p.bind(this),{signal:e}),t.addEventListener("keydown",this.#m.bind(this),{signal:e});let s=this.#e=document.createElement("span");return s.className="swatch",s.ariaHidden="true",s.style.backgroundColor=this.#i,t.append(s),t}renderMainDropdown(){let t=this.#s=this.#d();return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}#d(){let t=document.createElement("div"),e=this.#l._signal;t.addEventListener("contextmenu",Lt,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#r&&(t.id=`${this.#r.id}_colorpicker_dropdown`);for(let[s,i]of this.#l.highlightColors){let n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",a.#u[s]);let r=document.createElement("span");n.append(r),r.className="swatch",r.style.backgroundColor=i,n.ariaSelected=i===this.#i,n.addEventListener("click",this.#f.bind(this,i),{signal:e}),t.append(n)}return t.addEventListener("keydown",this.#m.bind(this),{signal:e}),t}#f(t,e){e.stopPropagation(),this.#a.dispatch("switchannotationeditorparams",{source:this,type:G.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)}_colorSelectFromKeyboard(t){if(t.target===this.#t){this.#p(t);return}let e=t.target.getAttribute("data-color");e&&this.#f(e,t)}_moveToNext(t){if(!this.#g){this.#p(t);return}if(t.target===this.#t){this.#s.firstChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===this.#s?.firstChild||t.target===this.#t){this.#g&&this._hideDropdownFromKeyboard();return}this.#g||this.#p(t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!this.#g){this.#p(t);return}this.#s.firstChild?.focus()}_moveToEnd(t){if(!this.#g){this.#p(t);return}this.#s.lastChild?.focus()}#m(t){a._keyboardManager.exec(this,t)}#p(t){if(this.#g){this.hideDropdown();return}if(this.#o=t.detail===0,this.#h||(this.#h=new AbortController,window.addEventListener("pointerdown",this.#c.bind(this),{signal:this.#l.combinedSignal(this.#h)})),this.#t.ariaExpanded="true",this.#s){this.#s.classList.remove("hidden");return}let e=this.#s=this.#d();this.#t.append(e)}#c(t){this.#s?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#s?.classList.add("hidden"),this.#t.ariaExpanded="false",this.#h?.abort(),this.#h=null}get#g(){return this.#s&&!this.#s.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#n){if(!this.#g){this.#r?.unselect();return}this.hideDropdown(),this.#t.focus({preventScroll:!0,focusVisible:this.#o})}}updateColor(t){if(this.#e&&(this.#e.style.backgroundColor=t),!this.#s)return;let e=this.#l.highlightColors.values();for(let s of this.#s.children)s.ariaSelected=e.next().value===t.toUpperCase()}destroy(){this.#t?.remove(),this.#t=null,this.#e=null,this.#s?.remove(),this.#s=null}},ii=class a{#t=null;#e=null;#i=null;static#s=null;constructor(t){this.#e=t,this.#i=t._uiManager,a.#s||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#t)return this.#t;let{editorType:t,colorType:e,colorValue:s}=this.#e,i=this.#t=document.createElement("input");return i.type="color",i.value=s||"#000000",i.className="basicColorPicker",i.tabIndex=0,i.setAttribute("data-l10n-id",a.#s[t]),i.addEventListener("input",()=>{this.#i.updateParams(e,i.value)},{signal:this.#i._signal}),i}update(t){this.#t&&(this.#t.value=t)}destroy(){this.#t?.remove(),this.#t=null}hideDropdown(){}};function wo(a){return Math.floor(Math.max(0,Math.min(1,a))*255).toString(16).padStart(2,"0")}function Ve(a){return Math.max(0,Math.min(255,255*a))}var ni=class{static CMYK_G([t,e,s,i]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=Ve(t),[t,t,t]}static G_HTML([t]){let e=wo(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_rgb(t){return t.map(Ve)}static RGB_HTML(t){return`#${t.map(wo).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,s,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,s+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,s,i]){return[Ve(1-Math.min(1,t+i)),Ve(1-Math.min(1,s+i)),Ve(1-Math.min(1,e+i))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){let i=1-t,n=1-e,r=1-s,o=Math.min(i,n,r);return["CMYK",i,n,r,o]}};var Xn=class{create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");let i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){Q("Abstract method `_createSVG` called.")}},ge=class extends Xn{_createSVG(t){return document.createElementNS(Zt,t)}},Il=9,me=new WeakSet,Nl=new Date().getTimezoneOffset()*60*1e3,ri=class{static create(t){switch(t.data.annotationType){case ht.LINK:return new rs(t);case ht.TEXT:return new Yn(t);case ht.WIDGET:switch(t.data.fieldType){case"Tx":return new Kn(t);case"Btn":return t.data.radioButton?new oi(t):t.data.checkBox?new Jn(t):new Qn(t);case"Ch":return new tr(t);case"Sig":return new Zn(t)}return new te(t);case ht.POPUP:return new os(t);case ht.FREETEXT:return new ai(t);case ht.LINE:return new sr(t);case ht.SQUARE:return new ir(t);case ht.CIRCLE:return new nr(t);case ht.POLYLINE:return new li(t);case ht.CARET:return new or(t);case ht.INK:return new as(t);case ht.POLYGON:return new rr(t);case ht.HIGHLIGHT:return new hi(t);case ht.UNDERLINE:return new ar(t);case ht.SQUIGGLY:return new lr(t);case ht.STRIKEOUT:return new hr(t);case ht.STAMP:return new ci(t);case ht.FILEATTACHMENT:return new cr(t);default:return new at(t)}}},at=class a{#t=null;#e=!1;#i=null;constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t?.str||e?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return a._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:t}=this,e=this.annotationStorage?.getEditor(t.id);return e?e.getData():t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let t=this.annotationStorage?.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;let{quadPoints:e,inkLists:s,rect:i}=this.data,n=-1/0,r=-1/0;if(e?.length>=8){for(let o=0;o<e.length;o+=8)e[o+1]>r?(r=e[o+1],n=e[o+2]):e[o+1]===r&&(n=Math.max(n,e[o+2]));return[n,r]}if(s?.length>=1){for(let o of s)for(let l=0,h=o.length;l<h;l+=2)o[l+1]>r?(r=o[l+1],n=o[l]):o[l+1]===r&&(n=Math.max(n,o[l]));if(n!==1/0)return[n,r]}return i?[i[2],i[3]]:null}_normalizePoint(t){let{page:{view:e},viewport:{rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:r}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-n)/s,t[1]=100*(t[1]-r)/i,t}get commentText(){let{data:t}=this;return this.annotationStorage.getRawValue(`${Ke}${t.id}`)?.popup?.contents||t.contentsObj?.str||""}set commentText(t){let{data:e}=this,s={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:s})||this.annotationStorage.setValue(`${Ke}${e.id}`,{id:e.id,annotationType:e.annotationType,pageIndex:this.parent.page._pageIndex,popup:s,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){(this.#i?.popup||this.popup)?.remove(),this.#i=this.popup=null}updateEdited(t){if(!this.container)return;t.rect&&(this.#t||={rect:this.data.rect.slice(0)});let{rect:e,popup:s}=t;e&&this.#s(e);let i=this.#i?.popup||this.popup;!i&&s?.text&&(this._createPopup(s),i=this.#i.popup),i&&(i.updateEdited(t),s?.deleted&&(i.remove(),this.#i=null,this.popup=null))}resetEdited(){this.#t&&(this.#s(this.#t.rect),this.#i?.popup.resetEdited(),this.#t=null)}#s(t){let{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:o,pageY:l}}}}=this;s?.splice(0,4,...t),e.left=`${100*(t[0]-o)/n}%`,e.top=`${100*(r-t[3]+l)/r}%`,i===0?(e.width=`${100*(t[2]-t[0])/n}%`,e.height=`${100*(t[3]-t[1])/r}%`):this.setRotation(i)}_createContainer(t){let{data:e,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),!(this instanceof te)&&!(this instanceof rs)&&(n.tabIndex=0);let{style:r}=n;if(r.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof os){let{rotation:p}=e;return!e.hasOwnCanvas&&p!==0&&this.setRotation(p,n),n}let{width:o,height:l}=this;if(!t&&e.borderStyle.width>0){r.borderWidth=`${e.borderStyle.width}px`;let p=e.borderStyle.horizontalCornerRadius,b=e.borderStyle.verticalCornerRadius;if(p>0||b>0){let y=`calc(${p}px * var(--total-scale-factor)) / calc(${b}px * var(--total-scale-factor))`;r.borderRadius=y}else if(this instanceof oi){let y=`calc(${o}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;r.borderRadius=y}switch(e.borderStyle.style){case xe.SOLID:r.borderStyle="solid";break;case xe.DASHED:r.borderStyle="dashed";break;case xe.BEVELED:H("Unimplemented border style: beveled");break;case xe.INSET:H("Unimplemented border style: inset");break;case xe.UNDERLINE:r.borderBottomStyle="solid";break;default:break}let m=e.borderColor||null;m?(this.#e=!0,r.borderColor=k.makeHexColor(m[0]|0,m[1]|0,m[2]|0)):r.borderWidth=0}let h=k.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),{pageWidth:c,pageHeight:d,pageX:u,pageY:f}=i.rawDims;r.left=`${100*(h[0]-u)/c}%`,r.top=`${100*(h[1]-f)/d}%`;let{rotation:g}=e;return e.hasOwnCanvas||g===0?(r.width=`${100*o/c}%`,r.height=`${100*l/d}%`):this.setRotation(g,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;let{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims,{width:n,height:r}=this;t%180!==0&&([n,r]=[r,n]),e.style.width=`${100*n/s}%`,e.style.height=`${100*r/i}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(e,s,i)=>{let n=i.detail[e],r=n[0],o=n.slice(1);i.target.style[s]=ni[`${r}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:ni[`${r}_rgb`](o)})};return U(this,"_commonActions",{display:e=>{let{display:s}=e.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:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:s}=e.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{let s=e.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(t,e){let s=this._commonActions;for(let i of Object.keys(e.detail))(t[i]||s[i])?.(e)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let s=this._commonActions;for(let[i,n]of Object.entries(e)){let r=s[i];if(r){let o={detail:{[i]:n},target:t};r(o),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:t}=this.data;if(!t)return;let[e,s,i,n]=this.data.rect.map(p=>Math.fround(p));if(t.length===8){let[p,b,m,y]=t.subarray(2,6);if(i===p&&n===b&&e===m&&s===y)return}let{style:r}=this.container,o;if(this.#e){let{borderColor:p,borderWidth:b}=r;r.borderWidth=0,o=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${p}" stroke-width="${b}">`],this.container.classList.add("hasBorder")}let l=i-e,h=n-s,{svgFactory:c}=this,d=c.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";let u=c.createElement("defs");d.append(u);let f=c.createElement("clipPath"),g=`clippath_${this.data.id}`;f.setAttribute("id",g),f.setAttribute("clipPathUnits","objectBoundingBox"),u.append(f);for(let p=2,b=t.length;p<b;p+=8){let m=t[p],y=t[p+1],A=t[p+2],w=t[p+3],v=c.createElement("rect"),E=(A-e)/l,_=(n-y)/h,S=(m-A)/l,x=(y-w)/h;v.setAttribute("x",E),v.setAttribute("y",_),v.setAttribute("width",S),v.setAttribute("height",x),f.append(v),o?.push(`<rect vector-effect="non-scaling-stroke" x="${E}" y="${_}" width="${S}" height="${x}"/>`)}this.#e&&(o.push("</g></svg>')"),r.backgroundImage=o.join("")),this.container.append(d),this.container.style.clipPath=`url(#${g})`}_createPopup(t=null){let{data:e}=this,s,i;t?(s={str:t.text},i=t.date):(s=e.contentsObj,i=e.modificationDate);let n=this.#i=new os({data:{color:e.color,titleObj:e.titleObj,modificationDate:i,contentsObj:s,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]});this.parent._commentManager||this.parent.div.append(n.render())}get hasPopupElement(){return!!(this.#i||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#i}render(){Q("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){let s=[];if(this._fieldObjects){let i=this._fieldObjects[t];if(i)for(let{page:n,id:r,exportValues:o}of i){if(n===-1||r===e)continue;let l=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${r}"]`);if(h&&!me.has(h)){H(`_getElementsByName - element not allowed: ${r}`);continue}s.push({id:r,exportValue:l,domElement:h})}return s}for(let i of document.getElementsByName(t)){let{exportValue:n}=i,r=i.getAttribute("data-element-id");r!==e&&me.has(i)&&s.push({id:r,exportValue:n,domElement:i})}return s}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}},qn=class extends at{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){let{editor:t}=this;t.hasComment&&(this._createPopup(t.comment),this.extraPopupElement.popup.renderCommentButton())}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.container.remove(),this.container=null,this.removePopup()}},rs=class extends at{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){let{data:t,linkService:e}=this,s=document.createElement("a");s.setAttribute("data-element-id",t.id);let i=!1;return t.url?(e.addLinkAttributes(s,t.url,t.newWindow),i=!0):t.action?(this._bindNamedAction(s,t.action,t.overlaidText),i=!0):t.attachment?(this.#e(s,t.attachment,t.overlaidText,t.attachmentDest),i=!0):t.setOCGState?(this.#i(s,t.setOCGState,t.overlaidText),i=!0):t.dest?(this._bindLink(s,t.dest,t.overlaidText),i=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,t),i=!0),t.resetForm?(this._bindResetFormAction(s,t.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(s,""),i=!0)),this.container.classList.add("linkAnnotation"),i&&this.container.append(s),this.container}#t(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e,s=""){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||e==="")&&this.#t(),s&&(t.title=s)}_bindNamedAction(t,e,s=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),s&&(t.title=s),this.#t()}#e(t,e,s="",i=null){t.href=this.linkService.getAnchorUrl(""),e.description?t.title=e.description:s&&(t.title=s),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,i),!1),this.#t()}#i(t,e,s=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),s&&(t.title=s),this.#t()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let i of Object.keys(e.actions)){let n=s.get(i);n&&(t[n]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:i}}),!1))}e.overlaidText&&(t.title=e.overlaidText),t.onclick||(t.onclick=()=>!1),this.#t()}_bindResetFormAction(t,e){let s=t.onclick;if(s||(t.href=this.linkService.getAnchorUrl("")),this.#t(),!this._fieldObjects){H('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(t.onclick=()=>!1);return}t.onclick=()=>{s?.();let{fields:i,refs:n,include:r}=e,o=[];if(i.length!==0||n.length!==0){let c=new Set(n);for(let d of i){let u=this._fieldObjects[d]||[];for(let{id:f}of u)c.add(f)}for(let d of Object.values(this._fieldObjects))for(let u of d)c.has(u.id)===r&&o.push(u)}else for(let c of Object.values(this._fieldObjects))o.push(...c);let l=this.annotationStorage,h=[];for(let c of o){let{id:d}=c;switch(h.push(d),c.type){case"text":{let f=c.defaultValue||"";l.setValue(d,{value:f});break}case"checkbox":case"radiobutton":{let f=c.defaultValue===c.exportValues;l.setValue(d,{value:f});break}case"combobox":case"listbox":{let f=c.defaultValue||"";l.setValue(d,{value:f});break}default:continue}let u=document.querySelector(`[data-element-id="${d}"]`);if(u){if(!me.has(u)){H(`_bindResetFormAction - element not allowed: ${d}`);continue}}else continue;u.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}}),!1}}},Yn=class extends at{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}},te=class extends at{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return dt.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,n){s.includes("mouse")?t.addEventListener(s,r=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(r),shift:r.shiftKey,modifier:this._getKeyModifier(r)}})}):t.addEventListener(s,r=>{if(s==="blur"){if(!e.focused||!r.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(r)}})})}_setEventListeners(t,e,s,i){for(let[n,r]of s)(r==="Action"||this.data.actions?.[r])&&((r==="Focus"||r==="Blur")&&(e||={focused:!1}),this._setEventListener(t,e,n,r,i),r==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,e,"blur","Blur",null):r==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":k.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||Il,n=t.style,r,o=2,l=h=>Math.round(10*h)/10;if(this.data.multiLine){let h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),c=Math.round(h/(Os*i))||1,d=h/c;r=Math.min(i,l(d/Os))}else{let h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);r=Math.min(i,l(h/Os))}n.fontSize=`calc(${r}px * var(--total-scale-factor))`,n.color=k.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}},Kn=class extends te{constructor(t){let e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,s,i){let n=this.annotationStorage;for(let r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=s),n.setValue(r.id,{[i]:s})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){let i=t.getValue(e,{value:this.data.fieldValue}),n=i.value||"",r=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;r&&n.length>r&&(n=n.slice(0,r));let o=i.formattedValue||this.data.textContent?.join(`
3
3
  `)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,""));let l={userValue:n,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=o??n,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type=this.data.password?"password":"text",s.setAttribute("value",o??n),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),me.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=0;let{datetimeFormat:h,datetimeType:c,timeStep:d}=this.data,u=!!c&&this.enableScripting;h&&(s.title=h),this._setRequired(s,this.data.required),r&&(s.maxLength=r),s.addEventListener("input",g=>{t.setValue(e,{value:g.target.value}),this.setPropertyOnSiblings(s,"value",g.target.value,"value"),l.formattedValue=null}),s.addEventListener("resetform",g=>{let p=this.data.defaultFieldValue??"";s.value=l.userValue=p,l.formattedValue=null});let f=g=>{let{formattedValue:p}=l;p!=null&&(g.target.value=p),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",p=>{if(l.focused)return;let{target:b}=p;if(u&&(b.type=c,d&&(b.step=d)),l.userValue){let m=l.userValue;if(u)if(c==="time"){let y=new Date(m),A=[y.getHours(),y.getMinutes(),y.getSeconds()];b.value=A.map(w=>w.toString().padStart(2,"0")).join(":")}else b.value=new Date(m-Nl).toISOString().split(c==="date"?"T":".",1)[0];else b.value=m}l.lastCommittedValue=b.value,l.commitKey=1,this.data.actions?.Focus||(l.focused=!0)}),s.addEventListener("updatefromsandbox",p=>{this.showElementAndHideCanvas(p.target);let b={value(m){l.userValue=m.detail.value??"",u||t.setValue(e,{value:l.userValue.toString()}),m.target.value=l.userValue},formattedValue(m){let{formattedValue:y}=m.detail;l.formattedValue=y,y!=null&&m.target!==document.activeElement&&(m.target.value=y);let A={formattedValue:y};u&&(A.value=y),t.setValue(e,A)},selRange(m){m.target.setSelectionRange(...m.detail.selRange)},charLimit:m=>{let{charLimit:y}=m.detail,{target:A}=m;if(y===0){A.removeAttribute("maxLength");return}A.setAttribute("maxLength",y);let w=l.userValue;!w||w.length<=y||(w=w.slice(0,y),A.value=l.userValue=w,t.setValue(e,{value:w}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,willCommit:!0,commitKey:1,selStart:A.selectionStart,selEnd:A.selectionEnd}}))}};this._dispatchEventFromSandbox(b,p)}),s.addEventListener("keydown",p=>{l.commitKey=1;let b=-1;if(p.key==="Escape"?b=0:p.key==="Enter"&&!this.data.multiLine?b=2:p.key==="Tab"&&(l.commitKey=3),b===-1)return;let{value:m}=p.target;l.lastCommittedValue!==m&&(l.lastCommittedValue=m,l.userValue=m,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:m,willCommit:!0,commitKey:b,selStart:p.target.selectionStart,selEnd:p.target.selectionEnd}}))});let g=f;f=null,s.addEventListener("blur",p=>{if(!l.focused||!p.relatedTarget)return;this.data.actions?.Blur||(l.focused=!1);let{target:b}=p,{value:m}=b;if(u){if(m&&c==="time"){let y=m.split(":").map(A=>parseInt(A,10));m=new Date(2e3,0,1,y[0],y[1],y[2]||0).valueOf(),b.step=""}else m.includes("T")||(m=`${m}T00:00`),m=new Date(m).valueOf();b.type="text"}l.userValue=m,l.lastCommittedValue!==m&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:m,willCommit:!0,commitKey:l.commitKey,selStart:p.target.selectionStart,selEnd:p.target.selectionEnd}}),g(p)}),this.data.actions?.Keystroke&&s.addEventListener("beforeinput",p=>{l.lastCommittedValue=null;let{data:b,target:m}=p,{value:y,selectionStart:A,selectionEnd:w}=m,v=A,E=w;switch(p.inputType){case"deleteWordBackward":{let _=y.substring(0,A).match(/\w*[^\w]*$/);_&&(v-=_[0].length);break}case"deleteWordForward":{let _=y.substring(A).match(/^[^\w]*\w*/);_&&(E+=_[0].length);break}case"deleteContentBackward":A===w&&(v-=1);break;case"deleteContentForward":A===w&&(E+=1);break}p.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:y,change:b||"",willCommit:!1,selStart:v,selEnd:E}})}),this._setEventListeners(s,l,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],p=>p.target.value)}if(f&&s.addEventListener("blur",f),this.data.comb){let p=(this.data.rect[2]-this.data.rect[0])/r;s.classList.add("comb"),s.style.letterSpacing=`calc(${p}px * var(--total-scale-factor) - 1ch)`}}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}},Zn=class extends te{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},Jn=class extends te{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,s=e.id,i=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let n=document.createElement("input");return me.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=0,n.addEventListener("change",r=>{let{name:o,checked:l}=r.target;for(let h of this._getElementsByName(o,s)){let c=l&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=c),t.setValue(h.id,{value:c})}t.setValue(s,{value:l})}),n.addEventListener("resetform",r=>{let o=e.defaultFieldValue||"Off";r.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",r=>{let o={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(s,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,r)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],r=>r.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},oi=class extends te{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,s=e.id,i=t.getValue(s,{value:e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(s,{value:i})),i)for(let r of this._getElementsByName(e.fieldName,s))t.setValue(r.id,{value:!1});let n=document.createElement("input");if(me.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=0,n.addEventListener("change",r=>{let{name:o,checked:l}=r.target;for(let h of this._getElementsByName(o,s))t.setValue(h.id,{value:!1});t.setValue(s,{value:l})}),n.addEventListener("resetform",r=>{let o=e.defaultFieldValue;r.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){let r=e.buttonValue;n.addEventListener("updatefromsandbox",o=>{let l={value:h=>{let c=r===h.detail.value;for(let d of this._getElementsByName(h.target.name)){let u=c&&d.id===s;d.domElement&&(d.domElement.checked=u),t.setValue(d.id,{value:u})}}};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._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},Qn=class extends rs{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),t}},tr=class extends te{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");me.add(i),i.setAttribute("data-element-id",e),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",c=>{let d=this.data.defaultFieldValue;for(let u of i.options)u.selected=u.value===d});for(let c of this.data.options){let d=document.createElement("option");d.textContent=c.displayValue,d.value=c.exportValue,s.value.includes(c.exportValue)&&(d.setAttribute("selected",!0),n=!1),i.append(d)}let r=null;if(n){let c=document.createElement("option");c.value=" ",c.setAttribute("hidden",!0),c.setAttribute("selected",!0),i.prepend(c),r=()=>{c.remove(),i.removeEventListener("input",r),r=null},i.addEventListener("input",r)}let o=c=>{let d=c?"value":"textContent",{options:u,multiple:f}=i;return f?Array.prototype.filter.call(u,g=>g.selected).map(g=>g[d]):u.selectedIndex===-1?null:u[u.selectedIndex][d]},l=o(!1),h=c=>{let d=c.target.options;return Array.prototype.map.call(d,u=>({displayValue:u.textContent,exportValue:u.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",c=>{let d={value(u){r?.();let f=u.detail.value,g=new Set(Array.isArray(f)?f:[f]);for(let p of i.options)p.selected=g.has(p.value);t.setValue(e,{value:o(!0)}),l=o(!1)},multipleSelection(u){i.multiple=!0},remove(u){let f=i.options,g=u.detail.remove;f[g].selected=!1,i.remove(g),f.length>0&&Array.prototype.findIndex.call(f,b=>b.selected)===-1&&(f[0].selected=!0),t.setValue(e,{value:o(!0),items:h(u)}),l=o(!1)},clear(u){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),l=o(!1)},insert(u){let{index:f,displayValue:g,exportValue:p}=u.detail.insert,b=i.children[f],m=document.createElement("option");m.textContent=g,m.value=p,b?b.before(m):i.append(m),t.setValue(e,{value:o(!0),items:h(u)}),l=o(!1)},items(u){let{items:f}=u.detail;for(;i.length!==0;)i.remove(0);for(let g of f){let{displayValue:p,exportValue:b}=g,m=document.createElement("option");m.textContent=p,m.value=b,i.append(m)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:o(!0),items:h(u)}),l=o(!1)},indices(u){let f=new Set(u.detail.indices);for(let g of u.target.options)g.selected=f.has(g.index);t.setValue(e,{value:o(!0)}),l=o(!1)},editable(u){u.target.disabled=!u.detail.editable}};this._dispatchEventFromSandbox(d,c)}),i.addEventListener("input",c=>{let d=o(!0),u=o(!1);t.setValue(e,{value:d}),c.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:u,changeEx:d,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"]],c=>c.target.value)):i.addEventListener("input",function(c){t.setValue(e,{value:o(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},os=class extends at{constructor(t){let{data:e,elements:s,parent:i}=t,n=!!i._commentManager;if(super(t,{isRenderable:!n&&at._hasPopupData(e)}),this.elements=s,n&&at._hasPopupData(e)){let r=this.popup=this.#t();for(let o of s)o.popup=r}else this.popup=null}#t(){return new er({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})}render(){let{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";let e=this.popup=this.#t(),s=[];for(let i of this.elements)i.popup=e,i.container.ariaHasPopup="dialog",s.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",s.map(i=>`${_r}${i}`).join(",")),this.container}},er=class{#t=null;#e=this.#z.bind(this);#i=this.#H.bind(this);#s=this.#M.bind(this);#o=this.#v.bind(this);#n=null;#r=null;#a=null;#h=null;#l=null;#u=null;#d=null;#f=!1;#m=null;#p=null;#c=null;#g=null;#b=null;#A=null;#y=null;#x=null;#_=null;#w=null;#C=!1;#E=null;#S=null;constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:n,contentsObj:r,richText:o,parent:l,rect:h,parentRect:c,open:d,commentManager:u=null}){this.#r=t,this.#_=i,this.#a=r,this.#x=o,this.#u=l,this.#n=e,this.#y=h,this.#d=c,this.#l=s,this.#t=u,this.#E=s[0],this.#h=Me.toDateObject(n),this.trigger=s.flatMap(f=>f.getElementsToTriggerPopup()),u?this.renderCommentButton():(this.#k(),this.#r.hidden=!0,d&&this.#v())}#k(){if(this.#p)return;this.#p=new AbortController;let{signal:t}=this.#p;for(let e of this.trigger)e.addEventListener("click",this.#o,{signal:t}),e.addEventListener("pointerenter",this.#s,{signal:t}),e.addEventListener("pointerleave",this.#i,{signal:t}),e.classList.add("popupTriggerArea");for(let e of this.#l)e.container?.addEventListener("keydown",this.#e,{signal:t})}#P(){let t=this.#l.find(e=>e.hasCommentButton);t&&(this.#b=t._normalizePoint(t.commentButtonPosition))}renderCommentButton(){if(this.#g||(this.#b||this.#P(),!this.#b))return;let{signal:t}=this.#p=new AbortController,e=!!this.#E.extraPopupElement,s=()=>{this.#t.toggleCommentPopup(this,!0,void 0,!e)},i=()=>{this.#t.toggleCommentPopup(this,!1,!0,!e)},n=()=>{this.#t.toggleCommentPopup(this,!1,!1)};if(e){this.#g=this.#E.container;for(let r of this.trigger)r.ariaHasPopup="dialog",r.ariaControls="commentPopup",r.addEventListener("keydown",this.#e,{signal:t}),r.addEventListener("click",s,{signal:t}),r.addEventListener("pointerenter",i,{signal:t}),r.addEventListener("pointerleave",n,{signal:t}),r.classList.add("popupTriggerArea")}else{let r=this.#g=document.createElement("button");r.className="annotationCommentButton";let o=this.#E.container;r.style.zIndex=o.style.zIndex+1,r.tabIndex=0,r.ariaHasPopup="dialog",r.ariaControls="commentPopup",r.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#F(),this.#R(),r.addEventListener("keydown",this.#e,{signal:t}),r.addEventListener("click",s,{signal:t}),r.addEventListener("pointerenter",i,{signal:t}),r.addEventListener("pointerleave",n,{signal:t}),o.after(r)}}#R(){if(this.#E.extraPopupElement&&!this.#E.editor)return;this.renderCommentButton();let[t,e]=this.#b,{style:s}=this.#g;s.left=`calc(${t}%)`,s.top=`calc(${e}% - var(--comment-button-dim))`}#F(){this.#E.extraPopupElement||(this.renderCommentButton(),this.#g.style.backgroundColor=this.commentButtonColor||"")}get commentButtonColor(){let{color:t,opacity:e}=this.#E.commentData;return t?this.#u._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{this.#g?.focus()},0)}getData(){let{richText:t,color:e,opacity:s,creationDate:i,modificationDate:n}=this.#E.commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:s,creationDate:i,modificationDate:n}}get elementBeforePopup(){return this.#g}get comment(){return this.#S||=this.#E.commentText,this.#S}set comment(t){t!==this.comment&&(this.#E.commentText=this.#S=t)}get parentBoundingClientRect(){return this.#E.layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){this.#g&&(this.#g.classList.toggle("selected",t),this.#g.ariaExpanded=e)}setSelectedCommentButton(t){this.#g.classList.toggle("selected",t)}get commentPopupPosition(){if(this.#A)return this.#A;let{x:t,y:e,height:s}=this.#g.getBoundingClientRect(),{x:i,y:n,width:r,height:o}=this.#E.layer.getBoundingClientRect();return[(t-i)/r,(e+s-n)/o]}set commentPopupPosition(t){this.#A=t}hasDefaultPopupPosition(){return this.#A===null}get commentButtonPosition(){return this.#b}get commentButtonWidth(){return this.#g.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,s]=this.#A||this.commentButtonPosition.map(h=>h/100),i=this.parentBoundingClientRect,{x:n,y:r,width:o,height:l}=i;this.#t.showDialog(null,this,n+e*o,r+s*l,{...t,parentDimensions:i})}render(){if(this.#m)return;let t=this.#m=document.createElement("div");if(t.className="popup",this.#n){let s=t.style.outlineColor=k.makeHexColor(...this.#n);t.style.backgroundColor=`color-mix(in srgb, ${s} 30%, white)`}let e=document.createElement("span");if(e.className="header",this.#_?.str){let s=document.createElement("span");s.className="title",e.append(s),{dir:s.dir,str:s.textContent}=this.#_}if(t.append(e),this.#h){let s=document.createElement("time");s.className="popupDate",s.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),s.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#h.valueOf()})),s.dateTime=this.#h.toISOString(),e.append(s)}Sr({html:this.#L||this.#a.str,dir:this.#a?.dir,className:"popupContent"},t),this.#r.append(t)}get#L(){let t=this.#x,e=this.#a;return t?.str&&(!e?.str||e.str===t.str)&&this.#x.html||null}get#I(){return this.#L?.attributes?.style?.fontSize||0}get#B(){return this.#L?.attributes?.style?.color||null}#N(t){let e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:this.#B,fontSize:this.#I?`calc(${this.#I}px * var(--total-scale-factor))`:""}};for(let n of t.split(`
4
4
  `))e.push({name:"span",value:n,attributes:i});return s}#z(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&this.#f)&&this.#v()}updateEdited({rect:t,popup:e,deleted:s}){if(this.#t){s?(this.remove(),this.#S=null):e&&(e.deleted?this.remove():(this.#F(),this.#S=e.text)),t&&(this.#b=null,this.#P(),this.#R());return}if(s||e?.deleted){this.remove();return}this.#k(),this.#w||={contentsObj:this.#a,richText:this.#x},t&&(this.#c=null),e&&e.text&&(this.#x=this.#N(e.text),this.#h=Me.toDateObject(e.date),this.#a=null),this.#m?.remove(),this.#m=null}resetEdited(){this.#w&&({contentsObj:this.#a,richText:this.#x}=this.#w,this.#w=null,this.#m?.remove(),this.#m=null,this.#c=null)}remove(){if(this.#p?.abort(),this.#p=null,this.#m?.remove(),this.#m=null,this.#C=!1,this.#f=!1,this.#g?.remove(),this.#g=null,this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}#T(){if(this.#c!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:n}}}=this.#u,r=!!this.#d,o=r?this.#d:this.#y;for(let g of this.#l)if(!o||k.intersect(g.data.rect,o)!==null){o=g.data.rect,r=!0;break}let l=k.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),c=r?o[2]-o[0]+5:0,d=l[0]+c,u=l[1];this.#c=[100*(d-i)/e,100*(u-n)/s];let{style:f}=this.#r;f.left=`${this.#c[0]}%`,f.top=`${this.#c[1]}%`}#v(){if(this.#t){this.#t.toggleCommentPopup(this,!1);return}this.#f=!this.#f,this.#f?(this.#M(),this.#r.addEventListener("click",this.#o),this.#r.addEventListener("keydown",this.#e)):(this.#H(),this.#r.removeEventListener("click",this.#o),this.#r.removeEventListener("keydown",this.#e))}#M(){this.#m||this.render(),this.isVisible?this.#f&&this.#r.classList.add("focused"):(this.#T(),this.#r.hidden=!1,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)+1e3)}#H(){this.#r.classList.remove("focused"),!(this.#f||!this.isVisible)&&(this.#r.hidden=!0,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)-1e3)}forceHide(){this.#C=this.isVisible,this.#C&&(this.#r.hidden=!0)}maybeShow(){this.#t||(this.#k(),this.#C&&(this.#m||this.#M(),this.#C=!1,this.#r.hidden=!1))}get isVisible(){return this.#t?!1:this.#r.hidden===!1}},ai=class extends at{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=B.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(let e of this.textContent){let s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}},sr=class extends at{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let{data:t,width:e,height:s}=this,i=this.svgFactory.create(e,s,!0),n=this.#t=this.svgFactory.createElement("svg:line");return n.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),n.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),n.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),n.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),n.setAttribute("stroke-width",t.borderStyle.width||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),i.append(n),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},ir=class extends at{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let{data:t,width:e,height:s}=this,i=this.svgFactory.create(e,s,!0),n=t.borderStyle.width,r=this.#t=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",n/2),r.setAttribute("y",n/2),r.setAttribute("width",e-n),r.setAttribute("height",s-n),r.setAttribute("stroke-width",n||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),i.append(r),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},nr=class extends at{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let{data:t,width:e,height:s}=this,i=this.svgFactory.create(e,s,!0),n=t.borderStyle.width,r=this.#t=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",e/2),r.setAttribute("cy",s/2),r.setAttribute("rx",e/2-n/2),r.setAttribute("ry",s/2-n/2),r.setAttribute("stroke-width",n||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),i.append(r),this.container.append(i),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},li=class extends at{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,vertices:e,borderStyle:s,popupRef:i},width:n,height:r}=this;if(!e)return this.container;let o=this.svgFactory.create(n,r,!0),l=[];for(let c=0,d=e.length;c<d;c+=2){let u=e[c]-t[0],f=t[3]-e[c+1];l.push(`${u},${f}`)}l=l.join(" ");let h=this.#t=this.svgFactory.createElement(this.svgElementName);return h.setAttribute("points",l),h.setAttribute("stroke-width",s.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),o.append(h),this.container.append(o),!i&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},rr=class extends li{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}},or=class extends at{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}},as=class extends at{#t=null;#e=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?B.HIGHLIGHT:B.INK}#i(t,e){switch(t){case 90:return{transform:`rotate(90) translate(${-e[0]},${e[1]}) scale(1,-1)`,width:e[3]-e[1],height:e[2]-e[0]};case 180:return{transform:`rotate(180) translate(${-e[2]},${e[1]}) scale(1,-1)`,width:e[2]-e[0],height:e[3]-e[1]};case 270:return{transform:`rotate(270) translate(${-e[2]},${e[3]}) scale(1,-1)`,width:e[3]-e[1],height:e[2]-e[0]};default:return{transform:`translate(${-e[0]},${e[3]}) scale(1,-1)`,width:e[2]-e[0],height:e[3]-e[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,rotation:e,inkLists:s,borderStyle:i,popupRef:n}}=this,{transform:r,width:o,height:l}=this.#i(e,t),h=this.svgFactory.create(o,l,!0),c=this.#t=this.svgFactory.createElement("svg:g");h.append(c),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke-linecap","round"),c.setAttribute("stroke-linejoin","round"),c.setAttribute("stroke-miterlimit",10),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),c.setAttribute("transform",r);for(let d=0,u=s.length;d<u;d++){let f=this.svgFactory.createElement(this.svgElementName);this.#e.push(f),f.setAttribute("points",s[d].join(",")),c.append(f)}return!n&&this.hasPopupData&&this._createPopup(),this.container.append(h),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);let{thickness:e,points:s,rect:i}=t,n=this.#t;if(e>=0&&n.setAttribute("stroke-width",e||1),s)for(let r=0,o=this.#e.length;r<o;r++)this.#e[r].setAttribute("points",s[r].join(","));if(i){let{transform:r,width:o,height:l}=this.#i(this.data.rotation,i);n.parentElement.setAttribute("viewBox",`0 0 ${o} ${l}`),n.setAttribute("transform",r)}}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}},hi=class extends at{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=B.HIGHLIGHT}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){let s=document.createElement("mark");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}},ar=class extends at{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),t){let s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}},lr=class extends at{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),t){let s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}},hr=class extends at{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),t){let s=document.createElement("s");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}},ci=class extends at{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=B.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}},cr=class extends at{#t=null;constructor(t){super(t,{isRenderable:!0});let{file:e}=this.data;this.filename=e.filename,this.content=e.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...e})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:t,data:e}=this,s;e.hasAppearance||e.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(e.fillAlpha*100)}%);`)),s.addEventListener("dblclick",this.#e.bind(this)),this.#t=s;let{isMac:i}=dt.platform;return t.addEventListener("keydown",n=>{n.key==="Enter"&&(i?n.metaKey:n.ctrlKey)&&this.#e()}),!e.popupRef&&this.hasPopupData?this._createPopup():s.classList.add("popupTriggerArea"),t.append(s),t}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}#e(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}},Ne=class a{#t=null;#e=null;#i=null;#s=new Map;#o=null;#n=null;constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:r,structTreeLayer:o,commentManager:l,linkService:h,annotationStorage:c}){this.div=t,this.#t=e,this.#e=s,this.#o=o||null,this.#n=h||null,this.#i=c||new es,this.page=n,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=i,this._commentManager=l||null}hasEditableAnnotations(){return this.#s.size>0}async#r(t,e,s){let i=t.firstChild||t,n=i.id=`${_r}${e}`,r=await this.#o?.getAriaAttributes(n);if(r)for(let[o,l]of r)i.setAttribute(o,l);s?s.at(-1).container.after(t):(this.div.append(t),this.#t?.moveElementInDOM(this.div,t,i,!1))}async render(t){let{annotations:e}=t,s=this.div;ae(s,this.viewport);let i=new Map,n={data:null,layer:s,linkService:this.#n,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new ge,annotationStorage:this.#i,enableComment:t.enableComment===!0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let r of e){if(r.noHTML)continue;let o=r.annotationType===ht.POPUP;if(o){let c=i.get(r.id);if(!c)continue;n.elements=c}else if(r.rect[2]===r.rect[0]||r.rect[3]===r.rect[1])continue;n.data=r;let l=ri.create(n);if(!l.isRenderable)continue;if(!o&&r.popupRef){let c=i.get(r.popupRef);c?c.push(l):i.set(r.popupRef,[l])}let h=l.render();r.hidden&&(h.style.visibility="hidden"),await this.#r(h,r.id,n.elements),l.extraPopupElement?.popup?.renderCommentButton(),l._isEditable&&(this.#s.set(l.data.id,l),this._annotationEditorUIManager?.renderAnnotationElement(l))}this.#a()}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:this.#n,svgFactory:new ge,parent:this};for(let s of t){s.borderStyle||=a._defaultBorderStyle,e.data=s;let i=ri.create(e);if(!i.isRenderable)continue;let n=i.render();await this.#r(n,s.id,null)}}update({viewport:t}){let e=this.div;this.viewport=t,ae(e,{rotation:t.rotation}),this.#a(),e.hidden=!1}#a(){if(!this.#e)return;let t=this.div;for(let[e,s]of this.#e){let i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;s.className="annotationContent";let{firstChild:n}=i;n?n.nodeName==="CANVAS"?n.replaceWith(s):n.classList.contains("annotationContent")?n.after(s):n.before(s):i.append(s);let r=this.#s.get(e);r&&(r._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,i.id,s),r._hasNoCanvas=!1):r.canvas=s)}this.#e.clear()}getEditableAnnotations(){return Array.from(this.#s.values())}getEditableAnnotation(t){return this.#s.get(t)}addFakeAnnotation(t){let{div:e}=this,{id:s,rotation:i}=t,n=new qn({data:{id:s,rect:t.getPDFRect(),rotation:i},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:this.#n,annotationStorage:this.#i}),r=n.render();return e.append(r),this.#t?.moveElementInDOM(e,r,r,!1),n.createOrUpdatePopup(),n}static get _defaultBorderStyle(){return U(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:xe.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Ms=/\r\n?|\n/g,dr=class a extends tt{#t="";#e=`${this.id}-editor`;#i=null;#s;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=a.prototype,e=n=>n.isEmpty(),s=le.TRANSLATE_SMALL,i=le.TRANSLATE_BIG;return U(this,"_keyboardManager",new pe([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}]]))}static _type="freetext";static _editorType=B.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.color=t.color||a._defaultColor||tt._defaultLineColor,this.#s=t.fontSize||a._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static initialize(t,e){tt.initialize(t,e);let s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case G.FREETEXT_SIZE:a._defaultFontSize=e;break;case G.FREETEXT_COLOR:a._defaultColor=e;break}}updateParams(t,e){switch(t){case G.FREETEXT_SIZE:this.#o(e);break;case G.FREETEXT_COLOR:this.#n(e);break}}static get defaultPropertiesToUpdate(){return[[G.FREETEXT_SIZE,a._defaultFontSize],[G.FREETEXT_COLOR,a._defaultColor||tt._defaultLineColor]]}get propertiesToUpdate(){return[[G.FREETEXT_SIZE,this.#s],[G.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new ii(this),[["colorPicker",this._colorPicker]]}get colorType(){return G.FREETEXT_COLOR}#o(t){let e=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--total-scale-factor))`,this.translate(0,-(i-this.#s)*this.parentScale),this.#s=i,this.#a()},s=this.#s;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:G.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#n(t){let e=i=>{this.color=i,this.onUpdatedColor()},s=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:G.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-a._internalPadding*t,-(a._internalPadding+this.#s)*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"),this.#i=new AbortController;let t=this._uiManager.combinedSignal(this.#i);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(){return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#e),this._isDraggable=!0,this.#i?.abort(),this.#i=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){this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),this._initialOptions?.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()}#r(){let t=[];this.editorDiv.normalize();let e=null;for(let s of this.editorDiv.childNodes)e?.nodeType===Node.TEXT_NODE&&s.nodeName==="BR"||(t.push(a.#h(s)),e=s);return t.join(`
@@ -10,4 +10,4 @@
10
10
  `)){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#u(){return this.#t.replaceAll("\xA0"," ")}static#d(t){return t.replaceAll(" ","\xA0")}get contentDiv(){return this.editorDiv}getPDFRect(){let t=a._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,s){let i=null;if(t instanceof ai){let{data:{defaultAppearanceData:{fontSize:r,fontColor:o},rect:l,rotation:h,id:c,popupRef:d,richText:u,contentsObj:f,creationDate:g,modificationDate:p},textContent:b,textPosition:m,parent:{page:{pageNumber:y}}}=t;if(!b||b.length===0)return null;i=t={annotationType:B.FREETEXT,color:Array.from(o),fontSize:r,value:b.join(`
11
11
  `),position:m,pageIndex:y-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:d,comment:f?.str||null,richText:u,creationDate:g,modificationDate:p}}let n=await super.deserialize(t,e,s);return n.#s=t.fontSize,n.color=k.makeHexColor(...t.color),n.#t=a.#d(t.value),n._initialData=i,t.comment&&n.setCommentData(t),n}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let e=tt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),s=Object.assign(super.serialize(t),{color:e,fontSize:this.#s,value:this.#u()});return this.addComment(s),t?(s.isCopy=!0,s):this.annotationElementId&&!this.#f(s)?null:(s.id=this.annotationElementId,s)}#f(t){let{value:e,fontSize:s,color:i,pageIndex:n}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==e||t.fontSize!==s||t.color.some((r,o)=>r!==i[o])||t.pageIndex!==n}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(!e)return null;let{style:s}=e;s.fontSize=`calc(${this.#s}px * var(--total-scale-factor))`,s.color=this.color,e.replaceChildren();for(let i of this.#t.split(`
12
12
  `)){let n=document.createElement("div");n.append(i?document.createTextNode(i):document.createElement("br")),e.append(n)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#t}}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}},R=class{static PRECISION=1e-4;toSVGPath(){Q("Abstract method `toSVGPath` must be implemented.")}get box(){Q("Abstract getter `box` must be implemented.")}serialize(t,e){Q("Abstract method `serialize` must be implemented.")}static _rescale(t,e,s,i,n,r){r||=new Float32Array(t.length);for(let o=0,l=t.length;o<l;o+=2)r[o]=e+t[o]*i,r[o+1]=s+t[o+1]*n;return r}static _rescaleAndSwap(t,e,s,i,n,r){r||=new Float32Array(t.length);for(let o=0,l=t.length;o<l;o+=2)r[o]=e+t[o+1]*i,r[o+1]=s+t[o]*n;return r}static _translate(t,e,s,i){i||=new Float32Array(t.length);for(let n=0,r=t.length;n<r;n+=2)i[n]=e+t[n],i[n+1]=s+t[n+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,s,i,n){switch(n){case 90:return[1-e/s,t/i];case 180:return[1-t/s,1-e/i];case 270:return[e/s,1-t/i];default:return[t/s,e/i]}}static _normalizePagePoint(t,e,s){switch(s){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,s,i,n,r){return[(t+5*s)/6,(e+5*i)/6,(5*s+n)/6,(5*i+r)/6,(s+n)/2,(i+r)/2]}},di=class a{#t;#e=[];#i;#s;#o=[];#n=new Float32Array(18);#r;#a;#h;#l;#u;#d;#f=[];static#m=8;static#p=2;static#c=a.#m+a.#p;constructor({x:t,y:e},s,i,n,r,o=0){this.#t=s,this.#d=n*i,this.#s=r,this.#n.set([NaN,NaN,NaN,NaN,t,e],6),this.#i=o,this.#l=a.#m*i,this.#h=a.#c*i,this.#u=i,this.#f.push(t,e)}isEmpty(){return isNaN(this.#n[8])}#g(){let t=this.#n.subarray(4,6),e=this.#n.subarray(16,18),[s,i,n,r]=this.#t;return[(this.#r+(t[0]-e[0])/2-s)/n,(this.#a+(t[1]-e[1])/2-i)/r,(this.#r+(e[0]-t[0])/2-s)/n,(this.#a+(e[1]-t[1])/2-i)/r]}add({x:t,y:e}){this.#r=t,this.#a=e;let[s,i,n,r]=this.#t,[o,l,h,c]=this.#n.subarray(8,12),d=t-h,u=e-c,f=Math.hypot(d,u);if(f<this.#h)return!1;let g=f-this.#l,p=g/f,b=p*d,m=p*u,y=o,A=l;o=h,l=c,h+=b,c+=m,this.#f?.push(t,e);let w=-m/g,v=b/g,E=w*this.#d,_=v*this.#d;return this.#n.set(this.#n.subarray(2,8),0),this.#n.set([h+E,c+_],4),this.#n.set(this.#n.subarray(14,18),12),this.#n.set([h-E,c-_],16),isNaN(this.#n[6])?(this.#o.length===0&&(this.#n.set([o+E,l+_],2),this.#o.push(NaN,NaN,NaN,NaN,(o+E-s)/n,(l+_-i)/r),this.#n.set([o-E,l-_],14),this.#e.push(NaN,NaN,NaN,NaN,(o-E-s)/n,(l-_-i)/r)),this.#n.set([y,A,o,l,h,c],6),!this.isEmpty()):(this.#n.set([y,A,o,l,h,c],6),Math.abs(Math.atan2(A-l,y-o)-Math.atan2(m,b))<Math.PI/2?([o,l,h,c]=this.#n.subarray(2,6),this.#o.push(NaN,NaN,NaN,NaN,((o+h)/2-s)/n,((l+c)/2-i)/r),[o,l,y,A]=this.#n.subarray(14,18),this.#e.push(NaN,NaN,NaN,NaN,((y+o)/2-s)/n,((A+l)/2-i)/r),!0):([y,A,o,l,h,c]=this.#n.subarray(0,6),this.#o.push(((y+5*o)/6-s)/n,((A+5*l)/6-i)/r,((5*o+h)/6-s)/n,((5*l+c)/6-i)/r,((o+h)/2-s)/n,((l+c)/2-i)/r),[h,c,o,l,y,A]=this.#n.subarray(12,18),this.#e.push(((y+5*o)/6-s)/n,((A+5*l)/6-i)/r,((5*o+h)/6-s)/n,((5*l+c)/6-i)/r,((o+h)/2-s)/n,((l+c)/2-i)/r),!0))}toSVGPath(){if(this.isEmpty())return"";let t=this.#o,e=this.#e;if(isNaN(this.#n[6])&&!this.isEmpty())return this.#b();let s=[];s.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;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]}`);this.#y(s);for(let i=e.length-6;i>=6;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]}`);return this.#A(s),s.join(" ")}#b(){let[t,e,s,i]=this.#t,[n,r,o,l]=this.#g();return`M${(this.#n[2]-t)/s} ${(this.#n[3]-e)/i} L${(this.#n[4]-t)/s} ${(this.#n[5]-e)/i} L${n} ${r} L${o} ${l} L${(this.#n[16]-t)/s} ${(this.#n[17]-e)/i} L${(this.#n[14]-t)/s} ${(this.#n[15]-e)/i} Z`}#A(t){let e=this.#e;t.push(`L${e[4]} ${e[5]} Z`)}#y(t){let[e,s,i,n]=this.#t,r=this.#n.subarray(4,6),o=this.#n.subarray(16,18),[l,h,c,d]=this.#g();t.push(`L${(r[0]-e)/i} ${(r[1]-s)/n} L${l} ${h} L${c} ${d} L${(o[0]-e)/i} ${(o[1]-s)/n}`)}newFreeDrawOutline(t,e,s,i,n,r){return new ui(t,e,s,i,n,r)}getOutlines(){let t=this.#o,e=this.#e,s=this.#n,[i,n,r,o]=this.#t,l=new Float32Array((this.#f?.length??0)+2);for(let d=0,u=l.length-2;d<u;d+=2)l[d]=(this.#f[d]-i)/r,l[d+1]=(this.#f[d+1]-n)/o;if(l[l.length-2]=(this.#r-i)/r,l[l.length-1]=(this.#a-n)/o,isNaN(s[6])&&!this.isEmpty())return this.#x(l);let h=new Float32Array(this.#o.length+24+this.#e.length),c=t.length;for(let d=0;d<c;d+=2){if(isNaN(t[d])){h[d]=h[d+1]=NaN;continue}h[d]=t[d],h[d+1]=t[d+1]}c=this.#w(h,c);for(let d=e.length-6;d>=6;d-=6)for(let u=0;u<6;u+=2){if(isNaN(e[d+u])){h[c]=h[c+1]=NaN,c+=2;continue}h[c]=e[d+u],h[c+1]=e[d+u+1],c+=2}return this.#_(h,c),this.newFreeDrawOutline(h,l,this.#t,this.#u,this.#i,this.#s)}#x(t){let e=this.#n,[s,i,n,r]=this.#t,[o,l,h,c]=this.#g(),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(e[2]-s)/n,(e[3]-i)/r,NaN,NaN,NaN,NaN,(e[4]-s)/n,(e[5]-i)/r,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,(e[16]-s)/n,(e[17]-i)/r,NaN,NaN,NaN,NaN,(e[14]-s)/n,(e[15]-i)/r],0),this.newFreeDrawOutline(d,t,this.#t,this.#u,this.#i,this.#s)}#_(t,e){let s=this.#e;return t.set([NaN,NaN,NaN,NaN,s[4],s[5]],e),e+=6}#w(t,e){let s=this.#n.subarray(4,6),i=this.#n.subarray(16,18),[n,r,o,l]=this.#t,[h,c,d,u]=this.#g();return t.set([NaN,NaN,NaN,NaN,(s[0]-n)/o,(s[1]-r)/l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,d,u,NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-r)/l],e),e+=24}},ui=class extends R{#t;#e=new Float32Array(4);#i;#s;#o;#n;#r;constructor(t,e,s,i,n,r){super(),this.#r=t,this.#o=e,this.#t=s,this.#n=i,this.#i=n,this.#s=r,this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],this.#a(r);let[o,l,h,c]=this.#e;for(let d=0,u=t.length;d<u;d+=2)t[d]=(t[d]-o)/h,t[d+1]=(t[d+1]-l)/c;for(let d=0,u=e.length;d<u;d+=2)e[d]=(e[d]-o)/h,e[d+1]=(e[d+1]-l)/c}toSVGPath(){let t=[`M${this.#r[4]} ${this.#r[5]}`];for(let e=6,s=this.#r.length;e<s;e+=6){if(isNaN(this.#r[e])){t.push(`L${this.#r[e+4]} ${this.#r[e+5]}`);continue}t.push(`C${this.#r[e]} ${this.#r[e+1]} ${this.#r[e+2]} ${this.#r[e+3]} ${this.#r[e+4]} ${this.#r[e+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,e,s,i],n){let r=s-t,o=i-e,l,h;switch(n){case 0:l=R._rescale(this.#r,t,i,r,-o),h=R._rescale(this.#o,t,i,r,-o);break;case 90:l=R._rescaleAndSwap(this.#r,t,e,r,o),h=R._rescaleAndSwap(this.#o,t,e,r,o);break;case 180:l=R._rescale(this.#r,s,e,-r,o),h=R._rescale(this.#o,s,e,-r,o);break;case 270:l=R._rescaleAndSwap(this.#r,s,i,-r,-o),h=R._rescaleAndSwap(this.#o,s,i,-r,-o);break}return{outline:Array.from(l),points:[Array.from(h)]}}#a(t){let e=this.#r,s=e[4],i=e[5],n=[s,i,s,i],r=s,o=i,l=s,h=i,c=t?Math.max:Math.min,d=new Float32Array(4);for(let f=6,g=e.length;f<g;f+=6){let p=e[f+4],b=e[f+5];isNaN(e[f])?(k.pointBoundingBox(p,b,n),o>b?(r=p,o=b):o===b&&(r=c(r,p)),h<b?(l=p,h=b):h===b&&(l=c(l,p))):(d[0]=d[1]=1/0,d[2]=d[3]=-1/0,k.bezierBoundingBox(s,i,...e.slice(f,f+6),d),k.rectBoundingBox(d[0],d[1],d[2],d[3],n),o>d[1]?(r=d[0],o=d[1]):o===d[1]&&(r=c(r,d[0])),h<d[3]?(l=d[2],h=d[3]):h===d[3]&&(l=c(l,d[2]))),s=p,i=b}let u=this.#e;u[0]=n[0]-this.#i,u[1]=n[1]-this.#i,u[2]=n[2]-n[0]+2*this.#i,u[3]=n[3]-n[1]+2*this.#i,this.firstPoint=[r,o],this.lastPoint=[l,h]}get box(){return this.#e}newOutliner(t,e,s,i,n,r=0){return new di(t,e,s,i,n,r)}getNewOutline(t,e){let[s,i,n,r]=this.#e,[o,l,h,c]=this.#t,d=n*h,u=r*c,f=s*h+o,g=i*c+l,p=this.newOutliner({x:this.#o[0]*d+f,y:this.#o[1]*u+g},this.#t,this.#n,t,this.#s,e??this.#i);for(let b=2;b<this.#o.length;b+=2)p.add({x:this.#o[b]*d+f,y:this.#o[b+1]*u+g});return p.getOutlines()}},ls=class{#t;#e;#i;#s=[];#o=[];constructor(t,e=0,s=0,i=!0){let n=[1/0,1/0,-1/0,-1/0],o=10**-4;for(let{x:b,y:m,width:y,height:A}of t){let w=Math.floor((b-e)/o)*o,v=Math.ceil((b+y+e)/o)*o,E=Math.floor((m-e)/o)*o,_=Math.ceil((m+A+e)/o)*o,S=[w,E,_,!0],x=[v,E,_,!1];this.#s.push(S,x),k.rectBoundingBox(w,E,v,_,n)}let l=n[2]-n[0]+2*s,h=n[3]-n[1]+2*s,c=n[0]-s,d=n[1]-s,u=i?-1/0:1/0,f=1/0,g=this.#s.at(i?-1:-2),p=[g[0],g[2]];for(let b of this.#s){let[m,y,A,w]=b;!w&&i?y<f?(f=y,u=m):y===f&&(u=Math.max(u,m)):w&&!i&&(y<f?(f=y,u=m):y===f&&(u=Math.min(u,m))),b[0]=(m-c)/l,b[1]=(y-d)/h,b[2]=(A-d)/h}this.#t=new Float32Array([c,d,l,h]),this.#e=[u,f],this.#i=p}getOutlines(){this.#s.sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);let t=[];for(let e of this.#s)e[3]?(t.push(...this.#l(e)),this.#a(e)):(this.#h(e),t.push(...this.#l(e)));return this.#n(t)}#n(t){let e=[],s=new Set;for(let r of t){let[o,l,h]=r;e.push([o,l,r],[o,h,r])}e.sort((r,o)=>r[1]-o[1]||r[0]-o[0]);for(let r=0,o=e.length;r<o;r+=2){let l=e[r][2],h=e[r+1][2];l.push(h),h.push(l),s.add(l),s.add(h)}let i=[],n;for(;s.size>0;){let r=s.values().next().value,[o,l,h,c,d]=r;s.delete(r);let u=o,f=l;for(n=[o,h],i.push(n);;){let g;if(s.has(c))g=c;else if(s.has(d))g=d;else break;s.delete(g),[o,l,h,c,d]=g,u!==o&&(n.push(u,f,o,f===l?l:h),u=o),f=f===l?h:l}n.push(u,f)}return new ur(i,this.#t,this.#e,this.#i)}#r(t){let e=this.#o,s=0,i=e.length-1;for(;s<=i;){let n=s+i>>1,r=e[n][0];if(r===t)return n;r<t?s=n+1:i=n-1}return i+1}#a([,t,e]){let s=this.#r(t);this.#o.splice(s,0,[t,e])}#h([,t,e]){let s=this.#r(t);for(let i=s;i<this.#o.length;i++){let[n,r]=this.#o[i];if(n!==t)break;if(n===t&&r===e){this.#o.splice(i,1);return}}for(let i=s-1;i>=0;i--){let[n,r]=this.#o[i];if(n!==t)break;if(n===t&&r===e){this.#o.splice(i,1);return}}}#l(t){let[e,s,i]=t,n=[[e,s,i]],r=this.#r(i);for(let o=0;o<r;o++){let[l,h]=this.#o[o];for(let c=0,d=n.length;c<d;c++){let[,u,f]=n[c];if(!(h<=u||f<=l)){if(u>=l){if(f>h)n[c][1]=h;else{if(d===1)return[];n.splice(c,1),c--,d--}continue}n[c][2]=l,f>h&&n.push([e,h,f])}}}return n}},ur=class extends R{#t;#e;constructor(t,e,s,i){super(),this.#e=t,this.#t=e,this.firstPoint=s,this.lastPoint=i}toSVGPath(){let t=[];for(let e of this.#e){let[s,i]=e;t.push(`M${s} ${i}`);for(let n=2;n<e.length;n+=2){let r=e[n],o=e[n+1];r===s?(t.push(`V${o}`),i=o):o===i&&(t.push(`H${r}`),s=r)}t.push("Z")}return t.join(" ")}serialize([t,e,s,i],n){let r=[],o=s-t,l=i-e;for(let h of this.#e){let c=new Array(h.length);for(let d=0;d<h.length;d+=2)c[d]=t+h[d]*o,c[d+1]=i-h[d+1]*l;r.push(c)}return r}get box(){return this.#t}get classNamesForOutlining(){return["highlightOutline"]}},hs=class extends di{newFreeDrawOutline(t,e,s,i,n,r){return new fr(t,e,s,i,n,r)}},fr=class extends ui{newOutliner(t,e,s,i,n,r=0){return new hs(t,e,s,i,n,r)}},fi=class a extends tt{#t=null;#e=0;#i;#s=null;#o=null;#n=null;#r=null;#a=0;#h=null;#l=null;#u=null;#d=!1;#f=null;#m=null;#p=null;#c="";#g;#b="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=B.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=a.prototype;return U(this,"_keyboardManager",new pe([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||a._defaultColor,this.#g=t.thickness||a._defaultThickness,this.opacity=t.opacity||a._defaultOpacity,this.#i=t.boxes||null,this.#b=t.methodOfCreation||"",this.#c=t.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(this.#d=!0,this.#y(t),this.#E()):this.#i&&(this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#r=t.focusNode,this.#a=t.focusOffset,this.#A(),this.#E(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:this.#d?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#g,methodOfCreation:this.#b}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#A(){let t=new ls(this.#i,.001);this.#l=t.getOutlines(),[this.x,this.y,this.width,this.height]=this.#l.box;let e=new ls(this.#i,.0025,.001,this._uiManager.direction==="ltr");this.#n=e.getOutlines();let{firstPoint:s}=this.#l;this.#f=[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height];let{lastPoint:i}=this.#n;this.#m=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#y({highlightOutlines:t,highlightId:e,clipPathId:s}){this.#l=t;let i=1.5;if(this.#n=t.getNewOutline(this.#g/2+i,.0025),e>=0)this.#u=e,this.#s=s,this.parent.drawLayer.finalizeDraw(e,{bbox:t.box,path:{d:t.toSVGPath()}}),this.#p=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#n.box,path:{d:this.#n.toSVGPath()}},!0);else if(this.parent){let d=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#u,{bbox:a.#S(this.#l.box,(d-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#p,{bbox:a.#S(this.#n.box,d),path:{d:this.#n.toSVGPath()}})}let[n,r,o,l]=t.box;switch(this.rotation){case 0:this.x=n,this.y=r,this.width=o,this.height=l;break;case 90:{let[d,u]=this.parentDimensions;this.x=r,this.y=1-n,this.width=o*u/d,this.height=l*d/u;break}case 180:this.x=1-n,this.y=1-r,this.width=o,this.height=l;break;case 270:{let[d,u]=this.parentDimensions;this.x=1-r,this.y=n,this.width=o*u/d,this.height=l*d/u;break}}let{firstPoint:h}=t;this.#f=[(h[0]-n)/o,(h[1]-r)/l];let{lastPoint:c}=this.#n;this.#m=[(c[0]-n)/o,(c[1]-r)/l]}static initialize(t,e){tt.initialize(t,e),a._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case G.HIGHLIGHT_COLOR:a._defaultColor=e;break;case G.HIGHLIGHT_THICKNESS:a._defaultThickness=e;break}}translateInPage(t,e){}get toolbarPosition(){return this.#m}get commentButtonPosition(){return this.#f}updateParams(t,e){switch(t){case G.HIGHLIGHT_COLOR:this.#x(e);break;case G.HIGHLIGHT_THICKNESS:this.#_(e);break}}static get defaultPropertiesToUpdate(){return[[G.HIGHLIGHT_COLOR,a._defaultColor],[G.HIGHLIGHT_THICKNESS,a._defaultThickness]]}get propertiesToUpdate(){return[[G.HIGHLIGHT_COLOR,this.color||a._defaultColor],[G.HIGHLIGHT_THICKNESS,this.#g||a._defaultThickness],[G.HIGHLIGHT_FREE,this.#d]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#u,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#o?.updateColor(this.color),super.onUpdatedColor()}#x(t){let e=(n,r)=>{this.color=n,this.opacity=r,this.onUpdatedColor()},s=this.color,i=this.opacity;this.addCommands({cmd:e.bind(this,t,a._defaultOpacity),undo:e.bind(this,s,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:G.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}#_(t){let e=this.#g,s=i=>{this.#g=i,this.#w(i)};this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:G.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",this.#o=new ns({editor:this})]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#R())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#R())}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){this.#C(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#E(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#C():t&&(this.#E(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#w(t){this.#d&&(this.#y({highlightOutlines:this.#l.getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims(this.width,this.height))}#C(){this.#u===null||!this.parent||(this.parent.drawLayer.remove(this.#u),this.#u=null,this.parent.drawLayer.remove(this.#p),this.#p=null)}#E(t=this.parent){this.#u===null&&({id:this.#u,clipPathId:this.#s}=t.drawLayer.draw({bbox:this.#l.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#d},path:{d:this.#l.toSVGPath()}},!1,!0),this.#p=t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#d},bbox:this.#n.box,path:{d:this.#n.toSVGPath()}},this.#d),this.#h&&(this.#h.style.clipPath=this.#s))}static#S([t,e,s,i],n){switch(n){case 90:return[1-e-i,t,i,s];case 180:return[1-t-s,1-e-i,s,i];case 270:return[e,1-t-s,i,s]}return[t,e,s,i]}rotate(t){let{drawLayer:e}=this.parent,s;this.#d?(t=(t-this.rotation+360)%360,s=a.#S(this.#l.box,t)):s=a.#S([this.x,this.y,this.width,this.height],t),e.updateProperties(this.#u,{bbox:s,root:{"data-main-rotation":t}}),e.updateProperties(this.#p,{bbox:a.#S(this.#n.box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let t=super.render();this.#c&&(t.setAttribute("aria-label",this.#c),t.setAttribute("role","mark")),this.#d?t.classList.add("free"):this.div.addEventListener("keydown",this.#k.bind(this),{signal:this._uiManager._signal});let e=this.#h=document.createElement("div");return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#s,this.setDims(this.width,this.height),Do(this,this.#h,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{hovered:!1}})}#k(t){a._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#P(!0);break;case 1:case 3:this.#P(!1);break}}#P(t){if(!this.#t)return;let e=window.getSelection();t?e.setPosition(this.#t,this.#e):e.setPosition(this.#r,this.#a)}select(){super.select(),this.#p&&this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#p&&(this.parent?.drawLayer.updateProperties(this.#p,{rootClass:{selected:!1}}),this.#d||this.#P(!1))}get _mustFixPosition(){return!this.#d}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(this.#u,{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(this.#p,{rootClass:{hidden:!t}}))}#R(){return this.#d?this.rotation:0}#F(){if(this.#d)return null;let[t,e]=this.pageDimensions,[s,i]=this.pageTranslation,n=this.#i,r=new Float32Array(n.length*8),o=0;for(let{x:l,y:h,width:c,height:d}of n){let u=l*t+s,f=(1-h)*e+i;r[o]=r[o+4]=u,r[o+1]=r[o+3]=f,r[o+2]=r[o+6]=u+c*t,r[o+5]=r[o+7]=f-d*e,o+=8}return r}#L(t){return this.#l.serialize(t,this.#R())}static startHighlighting(t,e,{target:s,x:i,y:n}){let{x:r,y:o,width:l,height:h}=s.getBoundingClientRect(),c=new AbortController,d=t.combinedSignal(c),u=f=>{c.abort(),this.#B(t,f)};window.addEventListener("blur",u,{signal:d}),window.addEventListener("pointerup",u,{signal:d}),window.addEventListener("pointerdown",ot,{capture:!0,passive:!1,signal:d}),window.addEventListener("contextmenu",Lt,{signal:d}),s.addEventListener("pointermove",this.#I.bind(this,t),{signal:d}),this._freeHighlight=new hs({x:i,y:n},[r,o,l,h],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static#I(t,e){this._freeHighlight.add(e)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static#B(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(t,e,s){let i=null;if(t instanceof hi){let{data:{quadPoints:g,rect:p,rotation:b,id:m,color:y,opacity:A,popupRef:w,richText:v,contentsObj:E,creationDate:_,modificationDate:S},parent:{page:{pageNumber:x}}}=t;i=t={annotationType:B.HIGHLIGHT,color:Array.from(y),opacity:A,quadPoints:g,boxes:null,pageIndex:x-1,rect:p.slice(0),rotation:b,annotationElementId:m,id:m,deleted:!1,popupRef:w,richText:v,comment:E?.str||null,creationDate:_,modificationDate:S}}else if(t instanceof as){let{data:{inkLists:g,rect:p,rotation:b,id:m,color:y,borderStyle:{rawWidth:A},popupRef:w,richText:v,contentsObj:E,creationDate:_,modificationDate:S},parent:{page:{pageNumber:x}}}=t;i=t={annotationType:B.HIGHLIGHT,color:Array.from(y),thickness:A,inkLists:g,boxes:null,pageIndex:x-1,rect:p.slice(0),rotation:b,annotationElementId:m,id:m,deleted:!1,popupRef:w,richText:v,comment:E?.str||null,creationDate:_,modificationDate:S}}let{color:n,quadPoints:r,inkLists:o,opacity:l}=t,h=await super.deserialize(t,e,s);h.color=k.makeHexColor(...n),h.opacity=l||1,o&&(h.#g=t.thickness),h._initialData=i,t.comment&&h.setCommentData(t);let[c,d]=h.pageDimensions,[u,f]=h.pageTranslation;if(r){let g=h.#i=[];for(let p=0;p<r.length;p+=8)g.push({x:(r[p]-u)/c,y:1-(r[p+1]-f)/d,width:(r[p+2]-r[p])/c,height:(r[p+1]-r[p+5])/d});h.#A(),h.#E(),h.rotate(h.rotation)}else if(o){h.#d=!0;let g=o[0],p={x:g[0]-u,y:d-(g[1]-f)},b=new hs(p,[0,0,c,d],1,h.#g/2,!0,.001);for(let A=0,w=g.length;A<w;A+=2)p.x=g[A]-u,p.y=d-(g[A+1]-f),b.add(p);let{id:m,clipPathId:y}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:h.color,"fill-opacity":h._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:b.toSVGPath()}},!0,!0);h.#y({highlightOutlines:b.getOutlines(),highlightId:m,clipPathId:y}),h.#E(),h.rotate(h.parentRotation)}return h}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();let e=tt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),s=super.serialize(t);return Object.assign(s,{color:e,opacity:this.opacity,thickness:this.#g,quadPoints:this.#F(),outlines:this.#L(s.rect)}),this.addComment(s),this.annotationElementId&&!this.#N(s)?null:(s.id=this.annotationElementId,s)}#N(t){let{color:e}=this._initialData;return this.hasEditedComment||t.color.some((s,i)=>s!==e[i])}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}},pi=class{#t=Object.create(null);updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(let[e,s]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,s)}updateSVGProperty(t,e){this.#t[t]=e}toSVGProperties(){let t=this.#t;return this.#t=Object.create(null),{root:t}}reset(){this.#t=Object.create(null)}updateAll(t=this){this.updateProperties(t)}clone(){Q("Not implemented")}},gi=class a extends tt{#t=null;#e;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static#i=null;static#s=null;static#o=null;static#n=NaN;static#r=null;static#a=null;static#h=NaN;static _INNER_MARGIN=3;constructor(t){super(t),this.#e=t.mustBeCommitted||!1,this._addOutlines(t)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(t){t.drawOutlines&&(this.#l(t),this.#f())}#l({drawOutlines:t,drawId:e,drawingOptions:s}){this.#t=t,this._drawingOptions||=s,this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),e>=0?(this._drawId=e,this.parent.drawLayer.finalizeDraw(e,t.defaultProperties)):this._drawId=this.#u(t,this.parent),this.#c(t.box)}#u(t,e){let{id:s}=e.drawLayer.draw(a._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return s}static _mergeSVGProperties(t,e){let s=new Set(Object.keys(t));for(let[i,n]of Object.entries(e))s.has(i)?Object.assign(t[i],n):t[i]=n;return t}static getDefaultDrawingOptions(t){Q("Not implemented")}static get typesMap(){Q("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){let s=this.typesMap.get(t);s&&this._defaultDrawingOptions.updateProperty(s,e),this._currentParent&&(a.#i.updateProperty(s,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){let s=this.constructor.typesMap.get(t);s&&this._updateProperty(t,s,e)}static get defaultPropertiesToUpdate(){let t=[],e=this._defaultDrawingOptions;for(let[s,i]of this.typesMap)t.push([s,e[i]]);return t}get propertiesToUpdate(){let t=[],{_drawingOptions:e}=this;for(let[s,i]of this.constructor.typesMap)t.push([s,e[i]]);return t}_updateProperty(t,e,s){let i=this._drawingOptions,n=i[e],r=o=>{i.updateProperty(e,o);let l=this.#t.updateProperty(e,o);l&&this.#c(l),this.parent?.drawLayer.updateProperties(this._drawId,i.toSVGProperties()),t===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:r.bind(this,s),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,a._mergeSVGProperties(this.#t.getPathResizingSVGProperties(this.#p()),{bbox:this.#g()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,a._mergeSVGProperties(this.#t.getPathResizedSVGProperties(this.#p()),{bbox:this.#g()}))}_onTranslating(t,e){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#g()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,a._mergeSVGProperties(this.#t.getPathTranslatedSVGProperties(this.#p(),this.parentDimensions),{bbox:this.#g()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#e&&(this.#e=!1,this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){this.#d(),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#f(),this.#c(this.#t.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),this.#d()):t&&(this._uiManager.addShouldRescale(this),this.#f(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),e&&this.select()}#d(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#f(t=this.parent){if(!(this._drawId!==null&&this.parent===t)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=this.#u(this.#t,t)}}#m([t,e,s,i]){let{parentDimensions:[n,r],rotation:o}=this;switch(o){case 90:return[e,1-t,s*(r/n),i*(n/r)];case 180:return[1-t,1-e,s,i];case 270:return[1-e,t,s*(r/n),i*(n/r)];default:return[t,e,s,i]}}#p(){let{x:t,y:e,width:s,height:i,parentDimensions:[n,r],rotation:o}=this;switch(o){case 90:return[1-e,t,s*(n/r),i*(r/n)];case 180:return[1-t,1-e,s,i];case 270:return[e,1-t,s*(n/r),i*(r/n)];default:return[t,e,s,i]}}#c(t){[this.x,this.y,this.width,this.height]=this.#m(t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#g(){let{x:t,y:e,width:s,height:i,rotation:n,parentRotation:r,parentDimensions:[o,l]}=this;switch((n*4+r)/90){case 1:return[1-e-i,t,i,s];case 2:return[1-t-s,1-e-i,s,i];case 3:return[e,1-t-s,i,s];case 4:return[t,e-s*(o/l),i*(l/o),s*(o/l)];case 5:return[1-e,t,s*(o/l),i*(l/o)];case 6:return[1-t-i*(l/o),1-e,i*(l/o),s*(o/l)];case 7:return[e-s*(o/l),1-t-i*(l/o),s*(o/l),i*(l/o)];case 8:return[t-s,e-i,s,i];case 9:return[1-e,t-s,i,s];case 10:return[1-t,1-e,s,i];case 11:return[e-i,1-t,i,s];case 12:return[t-i*(l/o),e,i*(l/o),s*(o/l)];case 13:return[1-e-s*(o/l),t-i*(l/o),s*(o/l),i*(l/o)];case 14:return[1-t,1-e-s*(o/l),i*(l/o),s*(o/l)];case 15:return[e,1-t,s*(o/l),i*(l/o)];default:return[t,e,s,i]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,a._mergeSVGProperties({bbox:this.#g()},this.#t.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#c(this.#t.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,e;this._isCopy&&(t=this.x,e=this.y);let s=super.render();s.classList.add("draw");let i=document.createElement("div");return s.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),s}static createDrawerInstance(t,e,s,i,n){Q("Not implemented")}static startDrawing(t,e,s,i){let{target:n,offsetX:r,offsetY:o,pointerId:l,pointerType:h}=i;if(a.#r&&a.#r!==h)return;let{viewport:{rotation:c}}=t,{width:d,height:u}=n.getBoundingClientRect(),f=a.#s=new AbortController,g=t.combinedSignal(f);if(a.#n||=l,a.#r??=h,window.addEventListener("pointerup",p=>{a.#n===p.pointerId?this._endDraw(p):a.#a?.delete(p.pointerId)},{signal:g}),window.addEventListener("pointercancel",p=>{a.#n===p.pointerId?this._currentParent.endDrawingSession():a.#a?.delete(p.pointerId)},{signal:g}),window.addEventListener("pointerdown",p=>{a.#r===p.pointerType&&((a.#a||=new Set).add(p.pointerId),a.#i.isCancellable()&&(a.#i.removeLastElement(),a.#i.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener("contextmenu",Lt,{signal:g}),n.addEventListener("pointermove",this._drawMove.bind(this),{signal:g}),n.addEventListener("touchmove",p=>{p.timeStamp===a.#h&&ot(p)},{signal:g}),t.toggleDrawing(),e._editorUndoBar?.hide(),a.#i){t.drawLayer.updateProperties(this._currentDrawId,a.#i.startNew(r,o,d,u,c));return}e.updateUIForDefaultProperties(this),a.#i=this.createDrawerInstance(r,o,d,u,c),a.#o=this.getDefaultDrawingOptions(),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(a.#o.toSVGProperties(),a.#i.defaultSVGProperties),!0,!1)}static _drawMove(t){if(a.#h=-1,!a.#i)return;let{offsetX:e,offsetY:s,pointerId:i}=t;if(a.#n===i){if(a.#a?.size>=1){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,a.#i.add(e,s)),a.#h=t.timeStamp,ot(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,a.#i=null,a.#o=null,a.#r=null,a.#h=NaN),a.#s&&(a.#s.abort(),a.#s=null,a.#n=NaN,a.#a=null)}static _endDraw(t){let e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),t?.target===e.div&&e.drawLayer.updateProperties(this._currentDrawId,a.#i.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){let s=a.#i,i=this._currentDrawId,n=s.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,s.setLastElement(n))},undo:()=>{e.drawLayer.updateProperties(i,s.removeLastElement())},mustExec:!1,type:G.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(G.DRAW_STEP),!a.#i.isEmpty()){let{pageDimensions:[s,i],scale:n}=e,r=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:a.#i.getOutlines(s*n,i*n,n,this._INNER_MARGIN),drawingOptions:a.#o,mustBeCommitted:!t});return this._cleanup(!0),r}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,s,i,n,r){Q("Not implemented")}static async deserialize(t,e,s){let{rawDims:{pageWidth:i,pageHeight:n,pageX:r,pageY:o}}=e.viewport,l=this.deserializeDraw(r,o,i,n,this._INNER_MARGIN,t),h=await super.deserialize(t,e,s);return h.createDrawingOptions(t),h.#l({drawOutlines:l}),h.#f(),h.onScaleChanging(),h.rotate(),h}serializeDraw(t){let[e,s]=this.pageTranslation,[i,n]=this.pageDimensions;return this.#t.serialize([e,s,i,n],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}},pr=class{#t=new Float64Array(6);#e;#i;#s;#o;#n;#r="";#a=0;#h=new be;#l;#u;constructor(t,e,s,i,n,r){this.#l=s,this.#u=i,this.#s=n,this.#o=r,[t,e]=this.#d(t,e);let o=this.#e=[NaN,NaN,NaN,NaN,t,e];this.#n=[t,e],this.#i=[{line:o,points:this.#n}],this.#t.set(o,0)}updateProperty(t,e){t==="stroke-width"&&(this.#o=e)}#d(t,e){return R._normalizePoint(t,e,this.#l,this.#u,this.#s)}isEmpty(){return!this.#i||this.#i.length===0}isCancellable(){return this.#n.length<=10}add(t,e){[t,e]=this.#d(t,e);let[s,i,n,r]=this.#t.subarray(2,6),o=t-n,l=e-r;return Math.hypot(this.#l*o,this.#u*l)<=2?null:(this.#n.push(t,e),isNaN(s)?(this.#t.set([n,r,t,e],2),this.#e.push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(this.#t[0])&&this.#e.splice(6,6),this.#t.set([s,i,n,r,t,e],0),this.#e.push(...R.createBezierPoints(s,i,n,r,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){let s=this.add(t,e);return s||(this.#n.length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,s,i,n){this.#l=s,this.#u=i,this.#s=n,[t,e]=this.#d(t,e);let r=this.#e=[NaN,NaN,NaN,NaN,t,e];this.#n=[t,e];let o=this.#i.at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),this.#i.push({line:r,points:this.#n}),this.#t.set(r,0),this.#a=0,this.toSVGPath(),null}getLastElement(){return this.#i.at(-1)}setLastElement(t){return this.#i?(this.#i.push(t),this.#e=t.line,this.#n=t.points,this.#a=0,{path:{d:this.toSVGPath()}}):this.#h.setLastElement(t)}removeLastElement(){if(!this.#i)return this.#h.removeLastElement();this.#i.pop(),this.#r="";for(let t=0,e=this.#i.length;t<e;t++){let{line:s,points:i}=this.#i[t];this.#e=s,this.#n=i,this.#a=0,this.toSVGPath()}return{path:{d:this.#r}}}toSVGPath(){let t=R.svgRound(this.#e[4]),e=R.svgRound(this.#e[5]);if(this.#n.length===2)return this.#r=`${this.#r} M ${t} ${e} Z`,this.#r;if(this.#n.length<=6){let i=this.#r.lastIndexOf("M");this.#r=`${this.#r.slice(0,i)} M ${t} ${e}`,this.#a=6}if(this.#n.length===4){let i=R.svgRound(this.#e[10]),n=R.svgRound(this.#e[11]);return this.#r=`${this.#r} L ${i} ${n}`,this.#a=12,this.#r}let s=[];this.#a===0&&(s.push(`M ${t} ${e}`),this.#a=6);for(let i=this.#a,n=this.#e.length;i<n;i+=6){let[r,o,l,h,c,d]=this.#e.slice(i,i+6).map(R.svgRound);s.push(`C${r} ${o} ${l} ${h} ${c} ${d}`)}return this.#r+=s.join(" "),this.#a=this.#e.length,this.#r}getOutlines(t,e,s,i){let n=this.#i.at(-1);return n.line=new Float32Array(n.line),n.points=new Float32Array(n.points),this.#h.build(this.#i,t,e,s,this.#s,this.#o,i),this.#t=null,this.#e=null,this.#i=null,this.#r=null,this.#h}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}},be=class extends R{#t;#e=0;#i;#s;#o;#n;#r;#a;#h;build(t,e,s,i,n,r,o){this.#o=e,this.#n=s,this.#r=i,this.#a=n,this.#h=r,this.#i=o??0,this.#s=t,this.#d()}get thickness(){return this.#h}setLastElement(t){return this.#s.push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#s.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let t=[];for(let{line:e}of this.#s){if(t.push(`M${R.svgRound(e[4])} ${R.svgRound(e[5])}`),e.length===6){t.push("Z");continue}if(e.length===12&&isNaN(e[6])){t.push(`L${R.svgRound(e[10])} ${R.svgRound(e[11])}`);continue}for(let s=6,i=e.length;s<i;s+=6){let[n,r,o,l,h,c]=e.subarray(s,s+6).map(R.svgRound);t.push(`C${n} ${r} ${o} ${l} ${h} ${c}`)}}return t.join("")}serialize([t,e,s,i],n){let r=[],o=[],[l,h,c,d]=this.#u(),u,f,g,p,b,m,y,A,w;switch(this.#a){case 0:w=R._rescale,u=t,f=e+i,g=s,p=-i,b=t+l*s,m=e+(1-h-d)*i,y=t+(l+c)*s,A=e+(1-h)*i;break;case 90:w=R._rescaleAndSwap,u=t,f=e,g=s,p=i,b=t+h*s,m=e+l*i,y=t+(h+d)*s,A=e+(l+c)*i;break;case 180:w=R._rescale,u=t+s,f=e,g=-s,p=i,b=t+(1-l-c)*s,m=e+h*i,y=t+(1-l)*s,A=e+(h+d)*i;break;case 270:w=R._rescaleAndSwap,u=t+s,f=e+i,g=-s,p=-i,b=t+(1-h-d)*s,m=e+(1-l-c)*i,y=t+(1-h)*s,A=e+(1-l)*i;break}for(let{line:v,points:E}of this.#s)r.push(w(v,u,f,g,p,n?new Array(v.length):null)),o.push(w(E,u,f,g,p,n?new Array(E.length):null));return{lines:r,points:o,rect:[b,m,y,A]}}static deserialize(t,e,s,i,n,{paths:{lines:r,points:o},rotation:l,thickness:h}){let c=[],d,u,f,g,p;switch(l){case 0:p=R._rescale,d=-t/s,u=e/i+1,f=1/s,g=-1/i;break;case 90:p=R._rescaleAndSwap,d=-e/i,u=-t/s,f=1/i,g=1/s;break;case 180:p=R._rescale,d=t/s+1,u=-e/i,f=-1/s,g=1/i;break;case 270:p=R._rescaleAndSwap,d=e/i+1,u=t/s+1,f=-1/i,g=-1/s;break}if(!r){r=[];for(let m of o){let y=m.length;if(y===2){r.push(new Float32Array([NaN,NaN,NaN,NaN,m[0],m[1]]));continue}if(y===4){r.push(new Float32Array([NaN,NaN,NaN,NaN,m[0],m[1],NaN,NaN,NaN,NaN,m[2],m[3]]));continue}let A=new Float32Array(3*(y-2));r.push(A);let[w,v,E,_]=m.subarray(0,4);A.set([NaN,NaN,NaN,NaN,w,v],0);for(let S=4;S<y;S+=2){let x=m[S],T=m[S+1];A.set(R.createBezierPoints(w,v,E,_,x,T),(S-2)*3),[w,v,E,_]=[E,_,x,T]}}}for(let m=0,y=r.length;m<y;m++)c.push({line:p(r[m].map(A=>A??NaN),d,u,f,g),points:p(o[m].map(A=>A??NaN),d,u,f,g)});let b=new this.prototype.constructor;return b.build(c,s,i,1,l,h,n),b}#l(t=this.#h){let e=this.#i+t/2*this.#r;return this.#a%180===0?[e/this.#o,e/this.#n]:[e/this.#n,e/this.#o]}#u(){let[t,e,s,i]=this.#t,[n,r]=this.#l(0);return[t+n,e+r,s-2*n,i-2*r]}#d(){let t=this.#t=new Float32Array([1/0,1/0,-1/0,-1/0]);for(let{line:i}of this.#s){if(i.length<=12){for(let o=4,l=i.length;o<l;o+=6)k.pointBoundingBox(i[o],i[o+1],t);continue}let n=i[4],r=i[5];for(let o=6,l=i.length;o<l;o+=6){let[h,c,d,u,f,g]=i.subarray(o,o+6);k.bezierBoundingBox(n,r,h,c,d,u,f,g,t),n=f,r=g}}let[e,s]=this.#l();t[0]=_t(t[0]-e,0,1),t[1]=_t(t[1]-s,0,1),t[2]=_t(t[2]+e,0,1),t[3]=_t(t[3]+s,0,1),t[2]-=t[0],t[3]-=t[1]}get box(){return this.#t}updateProperty(t,e){return t==="stroke-width"?this.#f(e):null}#f(t){let[e,s]=this.#l();this.#h=t;let[i,n]=this.#l(),[r,o]=[i-e,n-s],l=this.#t;return l[0]-=r,l[1]-=o,l[2]+=2*r,l[3]+=2*o,l}updateParentDimensions([t,e],s){let[i,n]=this.#l();this.#o=t,this.#n=e,this.#r=s;let[r,o]=this.#l(),l=r-i,h=o-n,c=this.#t;return c[0]-=l,c[1]-=h,c[2]+=2*l,c[3]+=2*h,c}updateRotation(t){return this.#e=t,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#t.map(R.svgRound).join(" ")}get defaultProperties(){let[t,e]=this.#t;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${R.svgRound(t)} ${R.svgRound(e)}`}}}get rotationTransform(){let[,,t,e]=this.#t,s=0,i=0,n=0,r=0,o=0,l=0;switch(this.#e){case 90:i=e/t,n=-t/e,o=t;break;case 180:s=-1,r=-1,o=t,l=e;break;case 270:i=-e/t,n=t/e,l=e;break;default:return""}return`matrix(${s} ${i} ${n} ${r} ${R.svgRound(o)} ${R.svgRound(l)})`}getPathResizingSVGProperties([t,e,s,i]){let[n,r]=this.#l(),[o,l,h,c]=this.#t;if(Math.abs(h-n)<=R.PRECISION||Math.abs(c-r)<=R.PRECISION){let p=t+s/2-(o+h/2),b=e+i/2-(l+c/2);return{path:{"transform-origin":`${R.svgRound(t)} ${R.svgRound(e)}`,transform:`${this.rotationTransform} translate(${p} ${b})`}}}let d=(s-2*n)/(h-2*n),u=(i-2*r)/(c-2*r),f=h/s,g=c/i;return{path:{"transform-origin":`${R.svgRound(o)} ${R.svgRound(l)}`,transform:`${this.rotationTransform} scale(${f} ${g}) translate(${R.svgRound(n)} ${R.svgRound(r)}) scale(${d} ${u}) translate(${R.svgRound(-n)} ${R.svgRound(-r)})`}}}getPathResizedSVGProperties([t,e,s,i]){let[n,r]=this.#l(),o=this.#t,[l,h,c,d]=o;if(o[0]=t,o[1]=e,o[2]=s,o[3]=i,Math.abs(c-n)<=R.PRECISION||Math.abs(d-r)<=R.PRECISION){let b=t+s/2-(l+c/2),m=e+i/2-(h+d/2);for(let{line:y,points:A}of this.#s)R._translate(y,b,m,y),R._translate(A,b,m,A);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${R.svgRound(t)} ${R.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let u=(s-2*n)/(c-2*n),f=(i-2*r)/(d-2*r),g=-u*(l+n)+t+n,p=-f*(h+r)+e+r;if(u!==1||f!==1||g!==0||p!==0)for(let{line:b,points:m}of this.#s)R._rescale(b,g,p,u,f,b),R._rescale(m,g,p,u,f,m);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${R.svgRound(t)} ${R.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,e],s){let[i,n]=s,r=this.#t,o=t-r[0],l=e-r[1];if(this.#o===i&&this.#n===n)for(let{line:h,points:c}of this.#s)R._translate(h,o,l,h),R._translate(c,o,l,c);else{let h=this.#o/i,c=this.#n/n;this.#o=i,this.#n=n;for(let{line:d,points:u}of this.#s)R._rescale(d,o,l,h,c,d),R._rescale(u,o,l,h,c,u);r[2]*=h,r[3]*=c}return r[0]=t,r[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${R.svgRound(t)} ${R.svgRound(e)}`}}}get defaultSVGProperties(){let t=this.#t;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${R.svgRound(t[0])} ${R.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}},mi=class a extends pi{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:tt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){t==="stroke-width"&&(e??=this["stroke-width"],e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){let t=new a(this._viewParameters);return t.updateAll(this),t}},gr=class a extends gi{static _type="ink";static _editorType=B.INK;static _defaultDrawingOptions=null;constructor(t){super({...t,name:"inkEditor"}),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,e){tt.initialize(t,e),this._defaultDrawingOptions=new mi(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return U(this,"typesMap",new Map([[G.INK_THICKNESS,"stroke-width"],[G.INK_COLOR,"stroke"],[G.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,s,i,n){return new pr(t,e,s,i,n,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,s,i,n,r){return be.deserialize(t,e,s,i,n,r)}static async deserialize(t,e,s){let i=null;if(t instanceof as){let{data:{inkLists:r,rect:o,rotation:l,id:h,color:c,opacity:d,borderStyle:{rawWidth:u},popupRef:f,richText:g,contentsObj:p,creationDate:b,modificationDate:m},parent:{page:{pageNumber:y}}}=t;i=t={annotationType:B.INK,color:Array.from(c),thickness:u,opacity:d,paths:{points:r},boxes:null,pageIndex:y-1,rect:o.slice(0),rotation:l,annotationElementId:h,id:h,deleted:!1,popupRef:f,richText:g,comment:p?.str||null,creationDate:b,modificationDate:m}}let n=await super.deserialize(t,e,s);return n._initialData=i,t.comment&&n.setCommentData(t),n}get toolbarButtons(){return this._colorPicker||=new ii(this),[["colorPicker",this._colorPicker]]}get colorType(){return G.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:t,_drawingOptions:e,parent:s}=this;e.updateSVGProperty("stroke-width"),s.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){let t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:e,opacity:s}){this._drawingOptions=a.getDefaultDrawingOptions({stroke:k.makeHexColor(...t),"stroke-width":e,"stroke-opacity":s})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:e,points:s}=this.serializeDraw(t),{_drawingOptions:{stroke:i,"stroke-opacity":n,"stroke-width":r}}=this,o=Object.assign(super.serialize(t),{color:tt._colorManager.convert(i),opacity:n,thickness:r,paths:{lines:e,points:s}});return this.addComment(o),t?(o.isCopy=!0,o):this.annotationElementId&&!this.#t(o)?null:(o.id=this.annotationElementId,o)}#t(t){let{color:e,thickness:s,opacity:i,pageIndex:n}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((r,o)=>r!==e[o])||t.thickness!==s||t.opacity!==i||t.pageIndex!==n}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let{points:e,rect:s}=this.serializeDraw(!1);return t.updateEdited({rect:s,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}},cs=class extends be{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},Is=8,We=3,Jt=class{static#t={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static#e(t,e,s,i){return s-=t,i-=e,s===0?i>0?0:4:s===1?i+6:2-i}static#i=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static#s(t,e,s,i,n,r,o){let l=this.#e(s,i,n,r);for(let h=0;h<8;h++){let c=(-h+l-o+16)%8,d=this.#i[2*c],u=this.#i[2*c+1];if(t[(s+d)*e+(i+u)]!==0)return c}return-1}static#o(t,e,s,i,n,r,o){let l=this.#e(s,i,n,r);for(let h=0;h<8;h++){let c=(h+l+o+16)%8,d=this.#i[2*c],u=this.#i[2*c+1];if(t[(s+d)*e+(i+u)]!==0)return c}return-1}static#n(t,e,s,i){let n=t.length,r=new Int32Array(n);for(let c=0;c<n;c++)r[c]=t[c]<=i?1:0;for(let c=1;c<s-1;c++)r[c*e]=r[c*e+e-1]=0;for(let c=0;c<e;c++)r[c]=r[e*s-1-c]=0;let o=1,l,h=[];for(let c=1;c<s-1;c++){l=1;for(let d=1;d<e-1;d++){let u=c*e+d,f=r[u];if(f===0)continue;let g=c,p=d;if(f===1&&r[u-1]===0)o+=1,p-=1;else if(f>=1&&r[u+1]===0)o+=1,p+=1,f>1&&(l=f);else{f!==1&&(l=Math.abs(f));continue}let b=[d,c],m=p===d+1,y={isHole:m,points:b,id:o,parent:0};h.push(y);let A;for(let C of h)if(C.id===l){A=C;break}A?A.isHole?y.parent=m?A.parent:l:y.parent=m?l:A.parent:y.parent=m?l:0;let w=this.#s(r,e,c,d,g,p,0);if(w===-1){r[u]=-o,r[u]!==1&&(l=Math.abs(r[u]));continue}let v=this.#i[2*w],E=this.#i[2*w+1],_=c+v,S=d+E;g=_,p=S;let x=c,T=d;for(;;){let C=this.#o(r,e,x,T,g,p,1);v=this.#i[2*C],E=this.#i[2*C+1];let I=x+v,O=T+E;b.push(O,I);let L=x*e+T;if(r[L+1]===0?r[L]=-o:r[L]===1&&(r[L]=o),I===c&&O===d&&x===_&&T===S){r[u]!==1&&(l=Math.abs(r[u]));break}else g=x,p=T,x=I,T=O}}}return h}static#r(t,e,s,i){if(s-e<=4){for(let _=e;_<s-2;_+=2)i.push(t[_],t[_+1]);return}let n=t[e],r=t[e+1],o=t[s-4]-n,l=t[s-3]-r,h=Math.hypot(o,l),c=o/h,d=l/h,u=c*r-d*n,f=l/o,g=1/h,p=Math.atan(f),b=Math.cos(p),m=Math.sin(p),y=g*(Math.abs(b)+Math.abs(m)),A=g*(1-y+y**2),w=Math.max(Math.atan(Math.abs(m+b)*A),Math.atan(Math.abs(m-b)*A)),v=0,E=e;for(let _=e+2;_<s-2;_+=2){let S=Math.abs(u-c*t[_+1]+d*t[_]);S>v&&(E=_,v=S)}v>(h*w)**2?(this.#r(t,e,E+2,i),this.#r(t,E,s,i)):i.push(n,r)}static#a(t){let e=[],s=t.length;return this.#r(t,0,s,e),e.push(t[s-2],t[s-1]),e.length<=4?null:e}static#h(t,e,s,i,n,r){let o=new Float32Array(r**2),l=-2*i**2,h=r>>1;for(let p=0;p<r;p++){let b=(p-h)**2;for(let m=0;m<r;m++)o[p*r+m]=Math.exp((b+(m-h)**2)/l)}let c=new Float32Array(256),d=-2*n**2;for(let p=0;p<256;p++)c[p]=Math.exp(p**2/d);let u=t.length,f=new Uint8Array(u),g=new Uint32Array(256);for(let p=0;p<s;p++)for(let b=0;b<e;b++){let m=p*e+b,y=t[m],A=0,w=0;for(let E=0;E<r;E++){let _=p+E-h;if(!(_<0||_>=s))for(let S=0;S<r;S++){let x=b+S-h;if(x<0||x>=e)continue;let T=t[_*e+x],C=o[E*r+S]*c[Math.abs(T-y)];A+=T*C,w+=C}}let v=f[m]=Math.round(A/w);g[v]++}return[f,g]}static#l(t){let e=new Uint32Array(256);for(let s of t)e[s]++;return e}static#u(t){let e=t.length,s=new Uint8ClampedArray(e>>2),i=-1/0,n=1/0;for(let o=0,l=s.length;o<l;o++){let h=s[o]=t[o<<2];i=Math.max(i,h),n=Math.min(n,h)}let r=255/(i-n);for(let o=0,l=s.length;o<l;o++)s[o]=(s[o]-n)*r;return s}static#d(t){let e,s=-1/0,i=-1/0,n=t.findIndex(l=>l!==0),r=n,o=n;for(e=n;e<256;e++){let l=t[e];l>s&&(e-r>i&&(i=e-r,o=e-1),s=l,r=e)}for(e=o-1;e>=0&&!(t[e]>t[e+1]);e--);return e}static#f(t){let e=t,{width:s,height:i}=t,{maxDim:n}=this.#t,r=s,o=i;if(s>n||i>n){let u=s,f=i,g=Math.log2(Math.max(s,i)/n),p=Math.floor(g);g=g===p?p-1:p;for(let m=0;m<g;m++){r=Math.ceil(u/2),o=Math.ceil(f/2);let y=new OffscreenCanvas(r,o);y.getContext("2d").drawImage(t,0,0,u,f,0,0,r,o),u=r,f=o,t!==e&&t.close(),t=y.transferToImageBitmap()}let b=Math.min(n/r,n/o);r=Math.round(r*b),o=Math.round(o*b)}let h=new OffscreenCanvas(r,o).getContext("2d",{willReadFrequently:!0});h.fillStyle="white",h.fillRect(0,0,r,o),h.filter="grayscale(1)",h.drawImage(t,0,0,t.width,t.height,0,0,r,o);let c=h.getImageData(0,0,r,o).data;return[this.#u(c),r,o]}static extractContoursFromText(t,{fontFamily:e,fontStyle:s,fontWeight:i},n,r,o,l){let h=new OffscreenCanvas(1,1),c=h.getContext("2d",{alpha:!1}),d=200,u=c.font=`${s} ${i} ${d}px ${e}`,{actualBoundingBoxLeft:f,actualBoundingBoxRight:g,actualBoundingBoxAscent:p,actualBoundingBoxDescent:b,fontBoundingBoxAscent:m,fontBoundingBoxDescent:y,width:A}=c.measureText(t),w=1.5,v=Math.ceil(Math.max(Math.abs(f)+Math.abs(g)||0,A)*w),E=Math.ceil(Math.max(Math.abs(p)+Math.abs(b)||d,Math.abs(m)+Math.abs(y)||d)*w);h=new OffscreenCanvas(v,E),c=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),c.font=u,c.filter="grayscale(1)",c.fillStyle="white",c.fillRect(0,0,v,E),c.fillStyle="black",c.fillText(t,v*(w-1)/2,E*(3-w)/2);let _=this.#u(c.getImageData(0,0,v,E).data),S=this.#l(_),x=this.#d(S),T=this.#n(_,v,E,x);return this.processDrawnLines({lines:{curves:T,width:v,height:E},pageWidth:n,pageHeight:r,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,e,s,i,n){let[r,o,l]=this.#f(t),[h,c]=this.#h(r,o,l,Math.hypot(o,l)*this.#t.sigmaSFactor,this.#t.sigmaR,this.#t.kernelSize),d=this.#d(c),u=this.#n(h,o,l,d);return this.processDrawnLines({lines:{curves:u,width:o,height:l},pageWidth:e,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:s,rotation:i,innerMargin:n,mustSmooth:r,areContours:o}){i%180!==0&&([e,s]=[s,e]);let{curves:l,width:h,height:c}=t,d=t.thickness??0,u=[],f=Math.min(e/h,s/c),g=f/e,p=f/s,b=[];for(let{points:y}of l){let A=r?this.#a(y):y;if(!A)continue;b.push(A);let w=A.length,v=new Float32Array(w),E=new Float32Array(3*(w===2?2:w-2));if(u.push({line:E,points:v}),w===2){v[0]=A[0]*g,v[1]=A[1]*p,E.set([NaN,NaN,NaN,NaN,v[0],v[1]],0);continue}let[_,S,x,T]=A;_*=g,S*=p,x*=g,T*=p,v.set([_,S,x,T],0),E.set([NaN,NaN,NaN,NaN,_,S],0);for(let C=4;C<w;C+=2){let I=v[C]=A[C]*g,O=v[C+1]=A[C+1]*p;E.set(R.createBezierPoints(_,S,x,T,I,O),(C-2)*3),[_,S,x,T]=[x,T,I,O]}}if(u.length===0)return null;let m=o?new cs:new be;return m.build(u,e,s,1,i,o?0:d,n),{outline:m,newCurves:b,areContours:o,thickness:d,width:h,height:c}}static async compressSignature({outlines:t,areContours:e,thickness:s,width:i,height:n}){let r=1/0,o=-1/0,l=0;for(let A of t){l+=A.length;for(let w=2,v=A.length;w<v;w++){let E=A[w]-A[w-2];r=Math.min(r,E),o=Math.max(o,E)}}let h;r>=-128&&o<=127?h=Int8Array:r>=-32768&&o<=32767?h=Int16Array:h=Int32Array;let c=t.length,d=Is+We*c,u=new Uint32Array(d),f=0;u[f++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*c)*h.BYTES_PER_ELEMENT,u[f++]=0,u[f++]=i,u[f++]=n,u[f++]=e?0:1,u[f++]=Math.max(0,Math.floor(s??0)),u[f++]=c,u[f++]=h.BYTES_PER_ELEMENT;for(let A of t)u[f++]=A.length-2,u[f++]=A[0],u[f++]=A[1];let g=new CompressionStream("deflate-raw"),p=g.writable.getWriter();await p.ready,p.write(u);let b=h.prototype.constructor;for(let A of t){let w=new b(A.length-2);for(let v=2,E=A.length;v<E;v++)w[v-2]=A[v]-A[v-2];p.write(w)}p.close();let m=await new Response(g.readable).arrayBuffer(),y=new Uint8Array(m);return xo(y)}static async decompressSignature(t){try{let e=pl(t),{readable:s,writable:i}=new DecompressionStream("deflate-raw"),n=i.getWriter();await n.ready,n.write(e).then(async()=>{await n.ready,await n.close()}).catch(()=>{});let r=null,o=0;for await(let A of s)r||=new Uint8Array(new Uint32Array(A.buffer,0,4)[0]),r.set(A,o),o+=A.length;let l=new Uint32Array(r.buffer,0,r.length>>2),h=l[1];if(h!==0)throw new Error(`Invalid version: ${h}`);let c=l[2],d=l[3],u=l[4]===0,f=l[5],g=l[6],p=l[7],b=[],m=(Is+We*g)*Uint32Array.BYTES_PER_ELEMENT,y;switch(p){case Int8Array.BYTES_PER_ELEMENT:y=new Int8Array(r.buffer,m);break;case Int16Array.BYTES_PER_ELEMENT:y=new Int16Array(r.buffer,m);break;case Int32Array.BYTES_PER_ELEMENT:y=new Int32Array(r.buffer,m);break}o=0;for(let A=0;A<g;A++){let w=l[We*A+Is],v=new Float32Array(w+2);b.push(v);for(let E=0;E<We-1;E++)v[E]=l[We*A+Is+E+1];for(let E=0;E<w;E++)v[E+2]=v[E]+y[o++]}return{areContours:u,thickness:f,outlines:b,width:c,height:d}}catch(e){return H(`decompressSignature: ${e}`),null}}},mr=class a extends pi{constructor(){super(),super.updateProperties({fill:tt._defaultLineColor,"stroke-width":0})}clone(){let t=new a;return t.updateAll(this),t}},br=class a extends mi{constructor(t){super(t),super.updateProperties({stroke:tt._defaultLineColor,"stroke-width":1})}clone(){let t=new a(this._viewParameters);return t.updateAll(this),t}},yr=class a extends gi{#t=!1;#e=null;#i=null;#s=null;static _type="signature";static _editorType=B.SIGNATURE;static _defaultDrawingOptions=null;constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"}),this._willKeepAspectRatio=!0,this.#i=t.signatureData||null,this.#e=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,e){tt.initialize(t,e),this._defaultDrawingOptions=new mr,this._defaultDrawnSignatureOptions=new br(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return U(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#e}}static computeTelemetryFinalData(t){let e=t.get("hasDescription");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,e,{_isCopy:s}=this;if(s&&(this._isCopy=!1,t=this.x,e=this.y),super.render(),this._drawId===null)if(this.#i){let{lines:i,mustSmooth:n,areContours:r,description:o,uuid:l,heightInPage:h}=this.#i,{rawDims:{pageWidth:c,pageHeight:d},rotation:u}=this.parent.viewport,f=Jt.processDrawnLines({lines:i,pageWidth:c,pageHeight:d,rotation:u,innerMargin:a._INNER_MARGIN,mustSmooth:n,areContours:r});this.addSignature(f,h,o,l)}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:this.#e||""}));return s&&(this._isCopy=!0,this._moveAfterPaste(t,e)),this.div}setUuid(t){this.#s=t,this.addEditToolbar()}getUuid(){return this.#s}get description(){return this.#e}set description(t){this.#e=t,this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(e=>{e?.updateEditSignatureButton(t)}))}getSignaturePreview(){let{newCurves:t,areContours:e,thickness:s,width:i,height:n}=this.#i,r=Math.max(i,n),o=Jt.processDrawnLines({lines:{curves:t.map(l=>({points:l})),thickness:s,width:i,height:n},pageWidth:r,pageHeight:r,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e});return{areContours:e,outline:o.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,e,s,i){let{x:n,y:r}=this,{outline:o}=this.#i=t;this.#t=o instanceof cs,this.description=s;let l;this.#t?l=a.getDefaultDrawingOptions():(l=a._defaultDrawnSignatureOptions.clone(),l.updateProperties({"stroke-width":o.thickness})),this._addOutlines({drawOutlines:o,drawingOptions:l});let[,h]=this.pageDimensions,c=e/h;c=c>=1?.5:c,this.width*=c/this.height,this.width>=1&&(c*=.9/this.width,this.width=.9),this.height=c,this.setDims(),this.x=n,this.y=r,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(i),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!i,hasDescription:!!s}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:e,pageHeight:s},rotation:i}=this.parent.viewport;return Jt.process(t,e,s,i,a._INNER_MARGIN)}getFromText(t,e){let{rawDims:{pageWidth:s,pageHeight:i},rotation:n}=this.parent.viewport;return Jt.extractContoursFromText(t,e,s,i,n,a._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:e,pageHeight:s},rotation:i}=this.parent.viewport;return Jt.processDrawnLines({lines:t,pageWidth:e,pageHeight:s,rotation:i,innerMargin:a._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:e}){t?this._drawingOptions=a.getDefaultDrawingOptions():(this._drawingOptions=a._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":e}))}serialize(t=!1){if(this.isEmpty())return null;let{lines:e,points:s}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":i}}=this,n=Object.assign(super.serialize(t),{isSignature:!0,areContours:this.#t,color:[0,0,0],thickness:this.#t?0:i});return this.addComment(n),t?(n.paths={lines:e,points:s},n.uuid=this.#s,n.isCopy=!0):n.lines=e,this.#e&&(n.accessibilityData={type:"Figure",alt:this.#e}),n}static deserializeDraw(t,e,s,i,n,r){return r.areContours?cs.deserialize(t,e,s,i,n,r):be.deserialize(t,e,s,i,n,r)}static async deserialize(t,e,s){let i=await super.deserialize(t,e,s);return i.#t=t.areContours,i.description=t.accessibilityData?.alt||"",i.#s=t.uuid,i}},Ar=class extends tt{#t=null;#e=null;#i=null;#s=null;#o=null;#n="";#r=null;#a=!1;#h=null;#l=!1;#u=!1;static _type="stamp";static _editorType=B.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#s=t.bitmapUrl,this.#o=t.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){tt.initialize(t,e)}static isHandlingMimeForPasting(t){return Hs.includes(t)}static paste(t,e){e.pasteEditor({mode:B.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(t){let e=t.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}#d(t,e=!1){if(!t){this.remove();return}this.#t=t.bitmap,e||(this.#e=t.id,this.#l=t.isSvg),t.file&&(this.#n=t.file.name),this.#p()}#f(){if(this.#i=null,this._uiManager.enableWaiting(!1),!!this.#r){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(t=null,e=!0){if(this.hasAltTextData())return null;let{mlManager:s}=this._uiManager;if(!s)throw new Error("No ML.");if(!await s.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");let{data:i,width:n,height:r}=t||this.copyCanvas(null,null,!0).imageData,o=await s.guess({name:"altText",request:{data:i,width:n,height:r,channels:i.length/(n*r)}});if(!o)throw new Error("No response from the AI service.");if(o.error)throw new Error("Error from the AI service.");if(o.cancel)return null;if(!o.output)throw new Error("No valid response from the AI service.");let l=o.output;return await this.setGuessedAltText(l),e&&!this.hasAltTextData()&&(this.altTextData={alt:l,decorative:!1}),l}#m(){if(this.#e){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#e).then(s=>this.#d(s,!0)).finally(()=>this.#f());return}if(this.#s){let s=this.#s;this.#s=null,this._uiManager.enableWaiting(!0),this.#i=this._uiManager.imageManager.getFromUrl(s).then(i=>this.#d(i)).finally(()=>this.#f());return}if(this.#o){let s=this.#o;this.#o=null,this._uiManager.enableWaiting(!0),this.#i=this._uiManager.imageManager.getFromFile(s).then(i=>this.#d(i)).finally(()=>this.#f());return}let t=document.createElement("input");t.type="file",t.accept=Hs.join(",");let e=this._uiManager._signal;this.#i=new Promise(s=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let i=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#d(i)}s()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),s()},{signal:e})}).finally(()=>this.#f()),t.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#r?.remove(),this.#r=null,this.#h&&(clearTimeout(this.#h),this.#h=null)),super.remove()}rebuild(){if(!this.parent){this.#e&&this.#m();return}super.rebuild(),this.div!==null&&(this.#e&&this.#r===null&&this.#m(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(this.#i||this.#t||this.#s||this.#o||this.#e||this.#a)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;return this._isCopy&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#a||(this.#t?this.#p():this.#m()),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,e){let{id:s,bitmap:i}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),s&&this._uiManager.imageManager.isValidId(s)&&(this.#e=s,i&&(this.#t=i),this.#a=!1,this.#p())}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;this.#h!==null&&clearTimeout(this.#h);let t=200;this.#h=setTimeout(()=>{this.#h=null,this.#g()},t)}#p(){let{div:t}=this,{width:e,height:s}=this.#t,[i,n]=this.pageDimensions,r=.75;if(this.width)e=this.width*i,s=this.height*n;else if(e>r*i||s>r*n){let l=Math.min(r*i/e,r*n/s);e*=l,s*=l}this._uiManager.enableWaiting(!1);let o=this.#r=document.createElement("canvas");o.setAttribute("role","img"),this.addContainer(o),this.width=e/i,this.height=s/n,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),this.#g(),this.#u||(this.parent.addUndoableEditor(this),this.#u=!0),this._reportTelemetry({action:"inserted_image"}),this.#n&&this.div.setAttribute("aria-description",this.#n),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}copyCanvas(t,e,s=!1){t||(t=224);let{width:i,height:n}=this.#t,r=new qt,o=this.#t,l=i,h=n,c=null;if(e){if(i>e||n>e){let E=Math.min(e/i,e/n);l=Math.floor(i*E),h=Math.floor(n*E)}c=document.createElement("canvas");let u=c.width=Math.ceil(l*r.sx),f=c.height=Math.ceil(h*r.sy);this.#l||(o=this.#c(u,f));let g=c.getContext("2d");g.filter=this._uiManager.hcmFilter;let p="white",b="#cfcfd8";this._uiManager.hcmFilter!=="none"?b="black":Xi.isDarkMode&&(p="#8f8f9d",b="#42414d");let m=15,y=m*r.sx,A=m*r.sy,w=new OffscreenCanvas(y*2,A*2),v=w.getContext("2d");v.fillStyle=p,v.fillRect(0,0,y*2,A*2),v.fillStyle=b,v.fillRect(0,0,y,A),v.fillRect(y,A,y,A),g.fillStyle=g.createPattern(w,"repeat"),g.fillRect(0,0,u,f),g.drawImage(o,0,0,o.width,o.height,0,0,u,f)}let d=null;if(s){let u,f;if(r.symmetric&&o.width<t&&o.height<t)u=o.width,f=o.height;else if(o=this.#t,i>t||n>t){let b=Math.min(t/i,t/n);u=Math.floor(i*b),f=Math.floor(n*b),this.#l||(o=this.#c(u,f))}let p=new OffscreenCanvas(u,f).getContext("2d",{willReadFrequently:!0});p.drawImage(o,0,0,o.width,o.height,0,0,u,f),d={width:u,height:f,data:p.getImageData(0,0,u,f).data}}return{canvas:c,width:l,height:h,imageData:d}}#c(t,e){let{width:s,height:i}=this.#t,n=s,r=i,o=this.#t;for(;n>2*t||r>2*e;){let l=n,h=r;n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2)),r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));let c=new OffscreenCanvas(n,r);c.getContext("2d").drawImage(o,0,0,l,h,0,0,n,r),o=c.transferToImageBitmap()}return o}#g(){let[t,e]=this.parentDimensions,{width:s,height:i}=this,n=new qt,r=Math.ceil(s*t*n.sx),o=Math.ceil(i*e*n.sy),l=this.#r;if(!l||l.width===r&&l.height===o)return;l.width=r,l.height=o;let h=this.#l?this.#t:this.#c(r,o),c=l.getContext("2d");c.filter=this._uiManager.hcmFilter,c.drawImage(h,0,0,h.width,h.height,0,0,r,o)}#b(t){if(t){if(this.#l){let i=this._uiManager.imageManager.getSvgUrl(this.#e);if(i)return i}let e=document.createElement("canvas");return{width:e.width,height:e.height}=this.#t,e.getContext("2d").drawImage(this.#t,0,0),e.toDataURL()}if(this.#l){let[e,s]=this.pageDimensions,i=Math.round(this.width*e*Qt.PDF_TO_CSS_UNITS),n=Math.round(this.height*s*Qt.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(i,n);return r.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,i,n),r.transferToImageBitmap()}return structuredClone(this.#t)}static async deserialize(t,e,s){let i=null,n=!1;if(t instanceof ci){let{data:{rect:p,rotation:b,id:m,structParent:y,popupRef:A,richText:w,contentsObj:v,creationDate:E,modificationDate:_},container:S,parent:{page:{pageNumber:x}},canvas:T}=t,C,I;T?(delete t.canvas,{id:C,bitmap:I}=s.imageManager.getFromCanvas(S.id,T),T.remove()):(n=!0,t._hasNoCanvas=!0);let O=(await e._structTree.getAriaAttributes(`${_r}${m}`))?.get("aria-label")||"";i=t={annotationType:B.STAMP,bitmapId:C,bitmap:I,pageIndex:x-1,rect:p.slice(0),rotation:b,annotationElementId:m,id:m,deleted:!1,accessibilityData:{decorative:!1,altText:O},isSvg:!1,structParent:y,popupRef:A,richText:w,comment:v?.str||null,creationDate:E,modificationDate:_}}let r=await super.deserialize(t,e,s),{rect:o,bitmap:l,bitmapUrl:h,bitmapId:c,isSvg:d,accessibilityData:u}=t;n?(s.addMissingCanvas(t.id,r),r.#a=!0):c&&s.imageManager.isValidId(c)?(r.#e=c,l&&(r.#t=l)):r.#s=h,r.#l=d;let[f,g]=r.pageDimensions;return r.width=(o[2]-o[0])/f,r.height=(o[3]-o[1])/g,u&&(r.altTextData=u),r._initialData=i,t.comment&&r.setCommentData(t),r.#u=!!i,r}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let s=Object.assign(super.serialize(t),{bitmapId:this.#e,isSvg:this.#l});if(this.addComment(s),t)return s.bitmapUrl=this.#b(!0),s.accessibilityData=this.serializeAltText(!0),s.isCopy=!0,s;let{decorative:i,altText:n}=this.serializeAltText(!1);if(!i&&n&&(s.accessibilityData={type:"Figure",alt:n}),this.annotationElementId){let o=this.#A(s);return o.isSame?null:(o.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=this._initialData.structParent??-1,s.id=this.annotationElementId,delete s.bitmapId,s)}if(e===null)return s;e.stamps||=new Map;let r=this.#l?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!e.stamps.has(this.#e))e.stamps.set(this.#e,{area:r,serialized:s}),s.bitmap=this.#b(!1);else if(this.#l){let o=e.stamps.get(this.#e);r>o.area&&(o.area=r,o.serialized.bitmap.close(),o.serialized.bitmap=this.#b(!1))}return s}#A(t){let{pageIndex:e,accessibilityData:{altText:s}}=this._initialData,i=t.pageIndex===e,n=(t.accessibilityData?.alt||"")===s;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&i&&n,isSameAltText:n}}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}},bi=class a{#t;#e=!1;#i=null;#s=null;#o=null;#n=new Map;#r=!1;#a=!1;#h=!1;#l=null;#u=null;#d=null;#f=null;#m=null;#p=-1;#c;static _initialized=!1;static#g=new Map([dr,gr,Ar,fi,yr].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:s,structTreeLayer:i,accessibilityManager:n,annotationLayer:r,drawLayer:o,textLayer:l,viewport:h,l10n:c}){let d=[...a.#g.values()];if(!a._initialized){a._initialized=!0;for(let u of d)u.initialize(c,t)}t.registerEditorTypes(d),this.#c=t,this.pageIndex=e,this.div=s,this.#t=n,this.#i=r,this.viewport=h,this.#d=l,this.drawLayer=o,this._structTree=i,this.#c.addLayer(this)}get isEmpty(){return this.#n.size===0}get isInvisible(){return this.isEmpty&&this.#c.getMode()===B.NONE}updateToolbar(t){this.#c.updateToolbar(t)}updateMode(t=this.#c.getMode()){switch(this.#w(),t){case B.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case B.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case B.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===B.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let s of a.#g.values())e.toggle(`${s._type}Editing`,t===s._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===this.#d?.div}setEditingState(t){this.#c.setEditingState(t)}addCommands(t){this.#c.addCommands(t)}cleanUndoStack(t){this.#c.cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#i?.div.classList.toggle("disabled",!t)}get#b(){return this.#n.size!==0?this.#n.values():this.#c.getEditors(this.pageIndex)}async enable(){this.#h=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#m?.abort(),this.#m=null;let t=new Set;for(let s of this.#b)s.enableEditing(),s.show(!0),s.annotationElementId&&(this.#c.removeChangedExistingAnnotation(s),t.add(s.annotationElementId));let e=this.#i;if(e)for(let s of e.getEditableAnnotations()){if(s.hide(),this.#c.isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;let i=await this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}this.#h=!1,this.#c._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#a=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#d&&!this.#m){this.#m=new AbortController;let s=this.#c.combinedSignal(this.#m);this.#d.div.addEventListener("pointerdown",i=>{let{clientX:r,clientY:o,timeStamp:l}=i,h=this.#p;if(l-h>500){this.#p=l;return}this.#p=-1;let{classList:c}=this.div;c.toggle("getElements",!0);let d=document.elementsFromPoint(r,o);if(c.toggle("getElements",!1),!this.div.contains(d[0]))return;let u,f=new RegExp(`^${Ke}[0-9]+$`);for(let p of d)if(f.test(p.id)){u=p.id;break}if(!u)return;let g=this.#n.get(u);g?.annotationElementId===null&&(i.stopPropagation(),i.preventDefault(),g.dblclick(i))},{signal:s,capture:!0})}let t=this.#i;if(t){let s=new Map,i=new Map;for(let r of this.#b){if(r.disableEditing(),!r.annotationElementId){r.updateFakeAnnotationElement(t);continue}if(r.serialize()!==null){s.set(r.annotationElementId,r);continue}else i.set(r.annotationElementId,r);this.getEditableAnnotation(r.annotationElementId)?.show(),r.remove()}let n=t.getEditableAnnotations();for(let r of n){let{id:o}=r.data;if(this.#c.isDeletedAnnotationElement(o)){r.updateEdited({deleted:!0});continue}let l=i.get(o);if(l){l.resetAnnotationElement(r),l.show(!1),r.show();continue}l=s.get(o),l&&(this.#c.addChangedExistingAnnotation(l),l.renderAnnotationElement(r)&&l.show(!1)),r.show()}}this.#w(),this.isEmpty&&(this.div.hidden=!0);let{classList:e}=this.div;for(let s of a.#g.values())e.remove(`${s._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#a=!1}getEditableAnnotation(t){return this.#i?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#c.getActive()!==t&&this.#c.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#d?.div&&!this.#f){this.#f=new AbortController;let t=this.#c.combinedSignal(this.#f);this.#d.div.addEventListener("pointerdown",this.#A.bind(this),{signal:t}),this.#d.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#d?.div&&this.#f&&(this.#f.abort(),this.#f=null,this.#d.div.classList.remove("highlighting"))}#A(t){this.#c.unselectAll();let{target:e}=t;if(e===this.#d.div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&this.#d.div.contains(e)){let{isMac:s}=dt.platform;if(t.button!==0||t.ctrlKey&&s)return;this.#c.showAllEditors("highlight",!0,!0),this.#d.div.classList.add("free"),this.toggleDrawing(),fi.startHighlighting(this,this.#c.direction==="ltr",{target:this.#d.div,x:t.x,y:t.y}),this.#d.div.addEventListener("pointerup",()=>{this.#d.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#c._signal}),t.preventDefault()}}enableClick(){if(this.#s)return;this.#s=new AbortController;let t=this.#c.combinedSignal(this.#s);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});let e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){this.#s?.abort(),this.#s=null}attach(t){this.#n.set(t.id,t);let{annotationElementId:e}=t;e&&this.#c.isDeletedAnnotationElement(e)&&this.#c.removeDeletedAnnotationElement(t)}detach(t){this.#n.delete(t.id),this.#t?.removePointerInTextLayer(t.contentDiv),!this.#a&&t.annotationElementId&&this.#c.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#c.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#c.addDeletedAnnotationElement(t.annotationElementId),tt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),this.#c.addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!this.#h),this.#c.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!this.#o&&(t._focusEventsAllowed=!1,this.#o=setTimeout(()=>{this.#o=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#c._signal}),e.focus())},0)),t._structTreeParentId=this.#t?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){let e=()=>t._uiManager.rebuild(t),s=()=>{t.remove()};this.addCommands({cmd:e,undo:s,mustExec:!1})}getEditorByUID(t){for(let e of this.#n.values())if(e.uid===t)return e;return null}getNextId(){return this.#c.getId()}get#y(){return a.#g.get(this.#c.getMode())}combinedSignal(t){return this.#c.combinedSignal(t)}#x(t){let e=this.#y;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#y?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await this.#c.updateMode(t.mode);let{offsetX:s,offsetY:i}=this.#_(),n=this.getNextId(),r=this.#x({parent:this,id:n,x:s,y:i,uiManager:this.#c,isCentered:!0,...e});r&&this.add(r)}async deserialize(t){return await a.#g.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#c)||null}createAndAddNewEditor(t,e,s={}){let i=this.getNextId(),n=this.#x({parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:this.#c,isCentered:e,...s});return n&&this.add(n),n}get boundingClientRect(){return this.div.getBoundingClientRect()}#_(){let{x:t,y:e,width:s,height:i}=this.boundingClientRect,n=Math.max(0,t),r=Math.max(0,e),o=Math.min(window.innerWidth,t+s),l=Math.min(window.innerHeight,e+i),h=(n+o)/2-t,c=(r+l)/2-e,[d,u]=this.viewport.rotation%180===0?[h,c]:[c,h];return{offsetX:d,offsetY:u}}addNewEditor(t={}){this.createAndAddNewEditor(this.#_(),!0,t)}setSelected(t){this.#c.setSelected(t)}toggleSelected(t){this.#c.toggleSelected(t)}unselect(t){this.#c.unselect(t)}pointerup(t){let{isMac:e}=dt.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!this.#r||(this.#r=!1,this.#y?.isDrawer&&this.#y.supportMultipleDrawings))return;if(!this.#e){this.#e=!0;return}let s=this.#c.getMode();if(s===B.STAMP||s===B.SIGNATURE){this.#c.unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(this.#c.getMode()===B.HIGHLIGHT&&this.enableTextSelection(),this.#r){this.#r=!1;return}let{isMac:e}=dt.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(this.#r=!0,this.#y?.isDrawer){this.startDrawingSession(t);return}let s=this.#c.getActive();this.#e=!s||s.isEmpty()}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),this.#l){this.#y.startDrawing(this,this.#c,!1,t);return}this.#c.setCurrentDrawingSession(this),this.#l=new AbortController;let e=this.#c.combinedSignal(this.#l);this.div.addEventListener("blur",({relatedTarget:s})=>{s&&!this.div.contains(s)&&(this.#u=null,this.commitOrRemove())},{signal:e}),this.#y.startDrawing(this,this.#c,!1,t)}pause(t){if(t){let{activeElement:e}=document;this.div.contains(e)&&(this.#u=e);return}this.#u&&setTimeout(()=>{this.#u?.focus(),this.#u=null},0)}endDrawingSession(t=!1){return this.#l?(this.#c.setCurrentDrawingSession(null),this.#l.abort(),this.#l=null,this.#u=null,this.#y.endDrawing(t)):null}findNewParent(t,e,s){let i=this.#c.findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}commitOrRemove(){return this.#l?(this.endDrawingSession(),!0):!1}onScaleChanging(){this.#l&&this.#y.onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),this.#c.getActive()?.parent===this&&(this.#c.commitOrRemove(),this.#c.setActiveEditor(null)),this.#o&&(clearTimeout(this.#o),this.#o=null);for(let t of this.#n.values())this.#t?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#n.clear(),this.#c.removeLayer(this)}#w(){for(let t of this.#n.values())t.isEmpty()&&t.remove()}render({viewport:t}){this.viewport=t,ae(this.div,t);for(let e of this.#c.getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){this.#c.commitOrRemove(),this.#w();let e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,ae(this.div,{rotation:s}),e!==s)for(let i of this.#n.values())i.rotate(s)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#c.viewParameters.realScale}},yi=class a{#t=null;#e=new Map;#i=new Map;static#s=0;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(!this.#t){this.#t=t;return}if(this.#t!==t){if(this.#e.size>0)for(let e of this.#e.values())e.remove(),t.append(e);this.#t=t}}static get _svgFactory(){return U(this,"_svgFactory",new ge)}static#o(t,[e,s,i,n]){let{style:r}=t;r.top=`${100*s}%`,r.left=`${100*e}%`,r.width=`${100*i}%`,r.height=`${100*n}%`}#n(){let t=a._svgFactory.create(1,1,!0);return this.#t.append(t),t.setAttribute("aria-hidden",!0),t}#r(t,e){let s=a._svgFactory.createElement("clipPath");t.append(s);let i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");let n=a._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i}#a(t,e){for(let[s,i]of Object.entries(e))i===null?t.removeAttribute(s):t.setAttribute(s,i)}draw(t,e=!1,s=!1){let i=a.#s++,n=this.#n(),r=a._svgFactory.createElement("defs");n.append(r);let o=a._svgFactory.createElement("path");r.append(o);let l=`path_p${this.pageIndex}_${i}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e&&this.#i.set(i,o);let h=s?this.#r(r,l):null,c=a._svgFactory.createElement("use");return n.append(c),c.setAttribute("href",`#${l}`),this.updateProperties(n,t),this.#e.set(i,n),{id:i,clipPathId:`url(#${h})`}}drawOutline(t,e){let s=a.#s++,i=this.#n(),n=a._svgFactory.createElement("defs");i.append(n);let r=a._svgFactory.createElement("path");n.append(r);let o=`path_p${this.pageIndex}_${s}`;r.setAttribute("id",o),r.setAttribute("vector-effect","non-scaling-stroke");let l;if(e){let d=a._svgFactory.createElement("mask");n.append(d),l=`mask_p${this.pageIndex}_${s}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");let u=a._svgFactory.createElement("rect");d.append(u),u.setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","white");let f=a._svgFactory.createElement("use");d.append(f),f.setAttribute("href",`#${o}`),f.setAttribute("stroke","none"),f.setAttribute("fill","black"),f.setAttribute("fill-rule","nonzero"),f.classList.add("mask")}let h=a._svgFactory.createElement("use");i.append(h),h.setAttribute("href",`#${o}`),l&&h.setAttribute("mask",`url(#${l})`);let c=h.cloneNode();return i.append(c),h.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(i,t),this.#e.set(s,i),s}finalizeDraw(t,e){this.#i.delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;let{root:s,bbox:i,rootClass:n,path:r}=e,o=typeof t=="number"?this.#e.get(t):t;if(o){if(s&&this.#a(o,s),i&&a.#o(o,i),n){let{classList:l}=o;for(let[h,c]of Object.entries(n))l.toggle(h,c)}if(r){let h=o.firstChild.firstChild;this.#a(h,r)}}}updateParent(t,e){if(e===this)return;let s=this.#e.get(t);s&&(e.#t.append(s),this.#e.delete(t),e.#e.set(t,s))}remove(t){this.#i.delete(t),this.#t!==null&&(this.#e.get(t).remove(),this.#e.delete(t))}destroy(){this.#t=null;for(let t of this.#e.values())t.remove();this.#e.clear(),this.#i.clear()}};globalThis._pdfjsTestingUtils={HighlightOutliner:ls};globalThis.pdfjsLib={AbortException:Ut,AnnotationEditorLayer:bi,AnnotationEditorParamsType:G,AnnotationEditorType:B,AnnotationEditorUIManager:le,AnnotationLayer:Ne,AnnotationMode:Ht,AnnotationType:ht,applyOpacity:Ro,build:Uo,ColorPicker:ns,createValidAbsoluteUrl:wr,CSSConstants:Us,DOMSVGFactory:ge,DrawLayer:yi,FeatureTest:dt,fetchData:Oe,findContrastColor:ko,getDocument:_i,getFilenameFromUrl:To,getPdfFilenameFromUrl:Co,getRGB:Fe,getUuid:Er,getXfaPageViewport:Po,GlobalWorkerOptions:Xt,ImageKind:qe,InvalidPDFException:De,isDataScheme:fs,isPdfFile:vi,isValidExplicitDest:Lo,MathClamp:_t,noContextMenu:Lt,normalizeUnicode:So,OPS:ke,OutputScale:qt,PasswordResponses:Eo,PDFDataRangeTransport:is,PDFDateString:Me,PDFWorker:Ie,PermissionFlag:vo,PixelsPerInch:Qt,RenderingCancelledException:Le,renderRichText:Sr,ResponseException:fe,setLayerDimensions:ae,shadow:U,SignatureExtractor:Jt,stopEvent:ot,SupportedImageMimeTypes:Hs,TextLayer:he,TouchManager:ts,updateUrlHash:vr,Util:k,VerbosityLevel:ds,version:Ho,XfaLayer:Je};var Be=F(ft(),1),it=F(ut(),1);var jo=Object.prototype.hasOwnProperty;function $o(a,t,e){for(e of a.keys())if(Ae(e,t))return e}function Ae(a,t){var e,s,i;if(a===t)return!0;if(a&&t&&(e=a.constructor)===t.constructor){if(e===Date)return a.getTime()===t.getTime();if(e===RegExp)return a.toString()===t.toString();if(e===Array){if((s=a.length)===t.length)for(;s--&&Ae(a[s],t[s]););return s===-1}if(e===Set){if(a.size!==t.size)return!1;for(s of a)if(i=s,i&&typeof i=="object"&&(i=$o(t,i),!i)||!t.has(i))return!1;return!0}if(e===Map){if(a.size!==t.size)return!1;for(s of a)if(i=s[0],i&&typeof i=="object"&&(i=$o(t,i),!i)||!Ae(s[1],t.get(i)))return!1;return!0}if(e===ArrayBuffer)a=new Uint8Array(a),t=new Uint8Array(t);else if(e===DataView){if((s=a.byteLength)===t.byteLength)for(;s--&&a.getInt8(s)===t.getInt8(s););return s===-1}if(ArrayBuffer.isView(a)){if((s=a.byteLength)===t.byteLength)for(;s--&&a[s]===t[s];);return s===-1}if(!e||typeof a=="object"){s=0;for(e in a)if(jo.call(a,e)&&++s&&!jo.call(t,e)||!(e in t)||!Ae(a[e],t[e]))return!1;return Object.keys(t).length===s}}return a!==a&&t!==t}function $t(a){let t=!1;return{promise:new Promise((s,i)=>{a.then(n=>!t&&s(n)).catch(n=>!t&&i(n))}),cancel(){t=!0}}}var Ol=["onCopy","onCut","onPaste"],Fl=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],Bl=["onFocus","onBlur"],Hl=["onInput","onInvalid","onReset","onSubmit"],Ul=["onLoad","onError"],jl=["onKeyDown","onKeyPress","onKeyUp"],$l=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],Gl=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],zl=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],Vl=["onSelect"],Wl=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],Xl=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],ql=["onScroll"],Yl=["onWheel"],Kl=["onAnimationStart","onAnimationEnd","onAnimationIteration"],Zl=["onTransitionEnd"],Jl=["onToggle"],Ql=["onChange"],th=[...Ol,...Fl,...Bl,...Hl,...Ul,...jl,...$l,...Gl,...zl,...Vl,...Wl,...Xl,...ql,...Yl,...Kl,...Zl,...Ql,...Jl];function gs(a,t){let e={};for(let s of th){let i=a[s];i&&(t?e[s]=(n=>i(n,t(s))):e[s]=i)}return e}var eh=!0,Tr="Invariant failed";function V(a,t){if(!a){if(eh)throw new Error(Tr);var e=typeof t=="function"?t():t,s=e?"".concat(Tr,": ").concat(e):Tr;throw new Error(s)}}var He=F(ce(),1);var Wo=F(ut(),1),ih=(0,Wo.createContext)(null),Si=ih;var nh="noopener noreferrer nofollow",ms=class{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return V(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){V(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}addLinkAttributes(t,e,s){t.href=e,t.rel=this.externalLinkRel||nh,t.target=s?"_blank":this.externalLinkTarget||""}goToDestination(t){return new Promise(e=>{V(this.pdfDocument,"PDF document not loaded."),V(t,"Destination is not specified."),typeof t=="string"?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(e=>{V(Array.isArray(e),`"${e}" is not a valid destination array.`);let s=e[0];new Promise(i=>{V(this.pdfDocument,"PDF document not loaded."),s instanceof Object?this.pdfDocument.getPageIndex(s).then(n=>{i(n)}).catch(()=>{V(!1,`"${s}" is not a valid page reference.`)}):typeof s=="number"?i(s):V(!1,`"${s}" is not a valid destination reference.`)}).then(i=>{let n=i+1;V(this.pdfViewer,"PDF viewer is not initialized."),V(n>=1&&n<=this.pagesCount,`"${n}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:i,pageNumber:n})})})}goToPage(t){let e=t-1;V(this.pdfViewer,"PDF viewer is not initialized."),V(t>=1&&t<=this.pagesCount,`"${t}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(t){this.goToDestination(t)}};var Xo=F(ft(),1);function ee({children:a,type:t}){return(0,Xo.jsx)("div",{className:`react-pdf__message react-pdf__message--${t}`,children:a})}var rh={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Cr=rh;var qo=F(ut(),1);function oh(a,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return a}}function Ft(){return(0,qo.useReducer)(oh,{value:void 0,error:void 0})}var Pr=F(ce(),1),bs=typeof window<"u",Yo=bs&&window.location.protocol==="file:";function ah(a){return typeof a<"u"}function de(a){return ah(a)&&a!==null}function lh(a){return typeof a=="string"}function Ko(a){return a instanceof ArrayBuffer}function Zo(a){return V(bs,"isBlob can only be used in a browser environment"),a instanceof Blob}function xi(a){return lh(a)&&/^data:/.test(a)}function Rr(a){V(xi(a),"Invalid data URI.");let[t="",e=""]=a.split(",");return t.split(";").indexOf("base64")!==-1?atob(e):unescape(e)}function Jo(){return bs&&window.devicePixelRatio||1}var Qo="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function kr(){(0,Pr.default)(!Yo,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${Qo}`)}function ta(){(0,Pr.default)(!Yo,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${Qo}`)}function Mt(a){a?.cancel&&a.cancel()}function ys(a,t){return Object.defineProperty(a,"width",{get(){return this.getViewport({scale:t}).width},configurable:!0}),Object.defineProperty(a,"height",{get(){return this.getViewport({scale:t}).height},configurable:!0}),Object.defineProperty(a,"originalWidth",{get(){return this.getViewport({scale:1}).width},configurable:!0}),Object.defineProperty(a,"originalHeight",{get(){return this.getViewport({scale:1}).height},configurable:!0}),a}function Ti(a){return a.name==="AbortException"||a.name==="RenderingCancelledException"}function ea(a){return new Promise((t,e)=>{let s=new FileReader;s.onload=()=>{if(!s.result)return e(new Error("Error while reading a file."));t(s.result)},s.onerror=i=>{if(!i.target)return e(new Error("Error while reading a file."));let{error:n}=i.target;if(!n)return e(new Error("Error while reading a file."));switch(n.code){case n.NOT_FOUND_ERR:return e(new Error("Error while reading a file: File not found."));case n.SECURITY_ERR:return e(new Error("Error while reading a file: Security error."));case n.ABORT_ERR:return e(new Error("Error while reading a file: Aborted."));default:return e(new Error("Error while reading a file."))}},s.readAsArrayBuffer(a)})}var{PDFDataRangeTransport:hh}=jt,ch=(a,t)=>{switch(t){case Cr.NEED_PASSWORD:{let e=prompt("Enter the password to open this PDF file.");a(e);break}case Cr.INCORRECT_PASSWORD:{let e=prompt("Invalid password. Please try again.");a(e);break}default:}};function sa(a){return typeof a=="object"&&a!==null&&("data"in a||"range"in a||"url"in a)}var dh=(0,it.forwardRef)(function({children:t,className:e,error:s="Failed to load PDF file.",externalLinkRel:i,externalLinkTarget:n,file:r,inputRef:o,imageResourcesPath:l,loading:h="Loading PDF\u2026",noData:c="No PDF file specified.",onItemClick:d,onLoadError:u,onLoadProgress:f,onLoadSuccess:g,onPassword:p=ch,onSourceError:b,onSourceSuccess:m,options:y,renderMode:A,rotate:w,scale:v,...E},_){let[S,x]=Ft(),{value:T,error:C}=S,[I,O]=Ft(),{value:L,error:j}=I,P=(0,it.useRef)(new ms),D=(0,it.useRef)([]),N=(0,it.useRef)(void 0),X=(0,it.useRef)(void 0);r&&r!==N.current&&sa(r)&&((0,He.default)(!Ae(r,N.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),N.current=r),y&&y!==X.current&&((0,He.default)(!Ae(y,X.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),X.current=y);let mt=(0,it.useRef)({scrollPageIntoView:W=>{let{dest:st,pageNumber:nt,pageIndex:Et=nt-1}=W;if(d){d({dest:st,pageIndex:Et,pageNumber:nt});return}let Rt=D.current[Et];if(Rt){Rt.scrollIntoView();return}(0,He.default)(!1,`An internal link leading to page ${nt} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});(0,it.useImperativeHandle)(_,()=>({linkService:P,pages:D,viewer:mt}),[]);function Tt(){m&&m()}function J(){C&&((0,He.default)(!1,C.toString()),b&&b(C))}function q(){x({type:"RESET"})}(0,it.useEffect)(q,[r,x]);let vt=(0,it.useCallback)(async()=>{if(!r)return null;if(typeof r=="string")return xi(r)?{data:Rr(r)}:(kr(),{url:r});if(r instanceof hh)return{range:r};if(Ko(r))return{data:r};if(bs&&Zo(r))return{data:await ea(r)};if(V(typeof r=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),V(sa(r),"Invalid parameter object: need either .data, .range or .url"),"url"in r&&typeof r.url=="string"){if(xi(r.url)){let{url:W,...st}=r;return{data:Rr(W),...st}}kr()}return r},[r]);(0,it.useEffect)(()=>{let W=$t(vt());return W.promise.then(st=>{x({type:"RESOLVE",value:st})}).catch(st=>{x({type:"REJECT",error:st})}),()=>{Mt(W)}},[vt,x]),(0,it.useEffect)(()=>{if(!(typeof T>"u")){if(T===!1){J();return}Tt()}},[T]);function bt(){L&&(g&&g(L),D.current=new Array(L.numPages),P.current.setDocument(L))}function yt(){j&&((0,He.default)(!1,j.toString()),u&&u(j))}(0,it.useEffect)(function(){O({type:"RESET"})},[O,T]),(0,it.useEffect)(function(){if(!T)return;let st=y?{...T,...y}:T,nt=_i(st);f&&(nt.onProgress=f),p&&(nt.onPassword=p);let Et=nt;return Et.promise.then(Rt=>{Et.destroyed||O({type:"RESOLVE",value:Rt})}).catch(Rt=>{Et.destroyed||O({type:"REJECT",error:Rt})}),()=>{Et.destroy()}},[y,O,T]),(0,it.useEffect)(()=>{if(!(typeof L>"u")){if(L===!1){yt();return}bt()}},[L]),(0,it.useEffect)(function(){P.current.setViewer(mt.current),P.current.setExternalLinkRel(i),P.current.setExternalLinkTarget(n)},[i,n]);let Y=(0,it.useCallback)((W,st)=>{D.current[W]=st},[]),M=(0,it.useCallback)(W=>{delete D.current[W]},[]),$=(0,it.useMemo)(()=>({imageResourcesPath:l,linkService:P.current,onItemClick:d,pdf:L,registerPage:Y,renderMode:A,rotate:w,scale:v,unregisterPage:M}),[l,d,L,Y,A,w,v,M]),lt=(0,it.useMemo)(()=>gs(E,()=>L),[E,L]);function St(){function W(nt){return!!nt?.pdf}if(!W($))throw new Error("pdf is undefined");let st=typeof t=="function"?t($):t;return(0,Be.jsx)(Si.Provider,{value:$,children:st})}function K(){return r?L==null?(0,Be.jsx)(ee,{type:"loading",children:typeof h=="function"?h():h}):L===!1?(0,Be.jsx)(ee,{type:"error",children:typeof s=="function"?s():s}):St():(0,Be.jsx)(ee,{type:"no-data",children:typeof c=="function"?c():c})}return(0,Be.jsx)("div",{className:oe("react-pdf__Document",e),ref:o,...lt,children:K()})}),Dr=dh;var ia=F(ut(),1);function As(){return(0,ia.useContext)(Si)}var Gt=F(ft(),1),zt=F(ut(),1);function ws(){for(var a=[],t=0;t<arguments.length;t++)a[t]=arguments[t];var e=a.filter(Boolean);if(e.length<=1){var s=e[0];return s||null}return function(n){for(var r=0,o=e;r<o.length;r++){var l=o[r];typeof l=="function"?l(n):l&&(l.current=n)}}}var ya=F(ce(),1);var oa=F(ft(),1),ie=F(ut(),1);var Pi=F(ce(),1);var ra=F(ut(),1);var na=F(ut(),1),uh=(0,na.createContext)(null),Ci=uh;function se(){return(0,ra.useContext)(Ci)}function Lr(){let a=As(),t=se();V(t,"Unable to find Page context.");let e={...a,...t},{filterAnnotations:s,imageResourcesPath:i,linkService:n,onGetAnnotationsError:r,onGetAnnotationsSuccess:o,onRenderAnnotationLayerError:l,onRenderAnnotationLayerSuccess:h,page:c,pdf:d,renderForms:u,rotate:f,scale:g=1}=e;V(d,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),V(c,"Attempted to load page annotations, but no page was specified."),V(n,"Attempted to load page annotations, but no linkService was specified.");let[p,b]=Ft(),{value:m,error:y}=p,A=(0,ie.useRef)(null);(0,Pi.default)(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function w(){m&&o&&o(m)}function v(){y&&((0,Pi.default)(!1,y.toString()),r&&r(y))}(0,ie.useEffect)(function(){b({type:"RESET"})},[b,c]),(0,ie.useEffect)(function(){if(!c)return;let T=$t(c.getAnnotations()),C=T;return T.promise.then(I=>{b({type:"RESOLVE",value:I})}).catch(I=>{b({type:"REJECT",error:I})}),()=>{Mt(C)}},[b,c]),(0,ie.useEffect)(()=>{if(m!==void 0){if(m===!1){v();return}w()}},[m]);function E(){h&&h()}function _(x){(0,Pi.default)(!1,`${x}`),l&&l(x)}let S=(0,ie.useMemo)(()=>c.getViewport({scale:g,rotation:f}),[c,f,g]);return(0,ie.useEffect)(function(){if(!d||!c||!n||!m)return;let{current:T}=A;if(!T)return;let C=S.clone({dontFlip:!0}),I={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:d.annotationStorage,commentManager:null,div:T,l10n:null,linkService:n,page:c,structTreeLayer:null,viewport:C},O={annotations:s?s({annotations:m}):m,annotationStorage:d.annotationStorage,div:T,imageResourcesPath:i,linkService:n,page:c,renderForms:u,viewport:C};T.innerHTML="";try{new Ne(I).render(O),E()}catch(L){_(L)}return()=>{}},[m,s,i,n,c,d,u,S]),(0,oa.jsx)("div",{className:oe("react-pdf__Page__annotations","annotationLayer"),ref:A})}var Br=F(ft(),1),Yt=F(ut(),1);var fa=F(ce(),1);var ca=F(ft(),1),ki=F(ut(),1);var da=F(ce(),1);var Nr=F(ft(),1),Or=F(ut(),1);var Mr={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},aa=/^H(\d+)$/;function fh(a){return a in Mr}function vs(a){return"children"in a}function Ir(a){return vs(a)?a.children.length===1&&0 in a.children&&"id"in a.children[0]:!1}function ph(a){let t={};if(vs(a)){let{role:e}=a,s=e.match(aa);if(s)t.role="heading",t["aria-level"]=Number(s[1]);else if(fh(e)){let i=Mr[e];i&&(t.role=i)}}return t}function la(a){let t={};if(vs(a)){if(a.alt!==void 0&&(t["aria-label"]=a.alt),a.lang!==void 0&&(t.lang=a.lang),Ir(a)){let[e]=a.children;if(e){let s=la(e);return{...t,...s}}}}else"id"in a&&(t["aria-owns"]=a.id);return t}function ha(a){return a?{...ph(a),...la(a)}:null}function Ri({className:a,node:t}){let e=(0,Or.useMemo)(()=>ha(t),[t]),s=(0,Or.useMemo)(()=>!vs(t)||Ir(t)?null:t.children.map((i,n)=>(0,Nr.jsx)(Ri,{node:i},n)),[t]);return(0,Nr.jsx)("span",{className:a,...e,children:s})}function Fr(){let a=se();V(a,"Unable to find Page context.");let{onGetStructTreeError:t,onGetStructTreeSuccess:e}=a,[s,i]=Ft(),{value:n,error:r}=s,{customTextRenderer:o,page:l}=a;function h(){n&&e&&e(n)}function c(){r&&((0,da.default)(!1,r.toString()),t&&t(r))}return(0,ki.useEffect)(function(){i({type:"RESET"})},[i,l]),(0,ki.useEffect)(function(){if(o||!l)return;let u=$t(l.getStructTree()),f=u;return u.promise.then(g=>{i({type:"RESOLVE",value:g})}).catch(g=>{i({type:"REJECT",error:g})}),()=>Mt(f)},[o,l,i]),(0,ki.useEffect)(()=>{if(n!==void 0){if(n===!1){c();return}h()}},[n]),n?(0,ca.jsx)(Ri,{className:"react-pdf__Page__structTree structTree",node:n}):null}var ua=Ht;function Hr(a){let t=se();V(t,"Unable to find Page context.");let e={...t,...a},{_className:s,canvasBackground:i,devicePixelRatio:n=Jo(),onRenderError:r,onRenderSuccess:o,page:l,renderForms:h,renderTextLayer:c,pageColors:d,rotate:u,scale:f}=e,{canvasRef:g}=a;V(l,"Attempted to render page canvas, but no page was specified.");let p=(0,Yt.useRef)(null);function b(){l&&o&&o(ys(l,f))}function m(v){Ti(v)||((0,fa.default)(!1,v.toString()),r&&r(v))}let y=(0,Yt.useMemo)(()=>l.getViewport({scale:f*n,rotation:u}),[n,l,u,f]),A=(0,Yt.useMemo)(()=>l.getViewport({scale:f,rotation:u}),[l,u,f]);(0,Yt.useEffect)(function(){if(!l)return;l.cleanup();let{current:E}=p;if(!E)return;E.width=y.width,E.height=y.height,E.style.width=`${Math.floor(A.width)}px`,E.style.height=`${Math.floor(A.height)}px`,E.style.visibility="hidden";let _={annotationMode:h?ua.ENABLE_FORMS:ua.ENABLE,canvas:E,canvasContext:E.getContext("2d",{alpha:!1}),pageColors:d,viewport:y};i&&(_.background=i);let S=l.render(_),x=S;return S.promise.then(()=>{E.style.visibility="",b()}).catch(m),()=>Mt(x)},[i,l,d,h,y,A]);let w=(0,Yt.useCallback)(()=>{let{current:v}=p;v&&(v.width=0,v.height=0)},[]);return(0,Yt.useEffect)(()=>w,[w]),(0,Br.jsx)("canvas",{className:`${s}__canvas`,dir:"ltr",ref:ws(g,p),style:{display:"block",userSelect:"none"},children:c?(0,Br.jsx)(Fr,{}):null})}var pa=F(ft(),1),It=F(ut(),1);var Di=F(ce(),1);function gh(a){return"str"in a}var mh=new Set(["base","embed","iframe","link","meta","object","script","style","template"]),bh=new Set(["action","formaction","href","poster","src","xlink:href"]);function yh(a){let t="";for(let e of a){let s=e.charCodeAt(0);s<=32||s===127||(t+=e.toLowerCase())}return t.startsWith("javascript:")||t.startsWith("vbscript:")}function Ah(a){return a.nodeType===Node.ELEMENT_NODE}function ga(a){return Ah(a)&&a instanceof HTMLElement}function wh(a){return ga(a)&&mh.has(a.tagName.toLowerCase())}function vh(a){let t=document.createElement(a.tagName.toLowerCase());return Array.from(a.attributes).forEach(e=>{let s=e.name.toLowerCase();s.startsWith("on")||s==="srcdoc"||bh.has(s)&&yh(e.value)||t.setAttribute(e.name,e.value)}),Array.from(a.childNodes).forEach(e=>{t.append(ma(e))}),t}function ma(a){var t;return ga(a)&&!wh(a)?vh(a):document.createTextNode((t=a.textContent)!==null&&t!==void 0?t:"")}function Eh(a,t){let e=document.createElement("template");e.innerHTML=t;let s=document.createDocumentFragment();Array.from(e.content.childNodes).forEach(i=>{s.append(ma(i))}),a.replaceChildren(s)}function Ur(){let a=se();V(a,"Unable to find Page context.");let{customTextRenderer:t,onGetTextError:e,onGetTextSuccess:s,onRenderTextLayerError:i,onRenderTextLayerSuccess:n,page:r,pageIndex:o,pageNumber:l,rotate:h,scale:c}=a;V(r,"Attempted to load page text content, but no page was specified.");let[d,u]=Ft(),{value:f,error:g}=d,p=(0,It.useRef)(null);(0,Di.default)(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function b(){f&&s&&s(f)}function m(){g&&((0,Di.default)(!1,g.toString()),e&&e(g))}(0,It.useEffect)(function(){u({type:"RESET"})},[r,u]),(0,It.useEffect)(function(){if(!r)return;let S=$t(r.getTextContent()),x=S;return S.promise.then(T=>{u({type:"RESOLVE",value:T})}).catch(T=>{u({type:"REJECT",error:T})}),()=>Mt(x)},[r,u]),(0,It.useEffect)(()=>{if(f!==void 0){if(f===!1){m();return}b()}},[f]);let y=(0,It.useCallback)(()=>{n&&n()},[n]),A=(0,It.useCallback)(_=>{Ti(_)||((0,Di.default)(!1,_.toString()),i&&i(_))},[i]);function w(){let _=p.current;_&&_.classList.add("selecting")}function v(){let _=p.current;_&&_.classList.remove("selecting")}let E=(0,It.useMemo)(()=>r.getViewport({scale:c,rotation:h}),[r,h,c]);return(0,It.useLayoutEffect)(function(){if(!r||!f)return;let{current:S}=p;if(!S)return;S.innerHTML="";let x=r.streamTextContent({includeMarkedContent:!0}),T={container:S,textContentSource:x,viewport:E},C=new he(T),I=C;return C.render().then(()=>{let O=document.createElement("div");O.className="endOfContent",S.append(O);let L=S.querySelectorAll('[role="presentation"]');if(t){let j=0;f.items.forEach((P,D)=>{if(!gh(P))return;let N=L[j];if(!N)return;let X=t({pageIndex:o,pageNumber:l,itemIndex:D,...P});Eh(N,X),j+=P.str&&P.hasEOL?2:1})}y()}).catch(A),()=>Mt(I)},[t,A,y,r,o,l,f,E]),(0,pa.jsx)("div",{className:oe("react-pdf__Page__textContent","textLayer"),onMouseUp:v,onMouseDown:w,ref:p})}var ba=1;function Li(a){let e={...As(),...a},{_className:s="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:n,canvasRef:r,children:o,className:l,customRenderer:h,customTextRenderer:c,devicePixelRatio:d,error:u="Failed to load the page.",filterAnnotations:f,height:g,inputRef:p,loading:b="Loading page\u2026",noData:m="No page specified.",onGetAnnotationsError:y,onGetAnnotationsSuccess:A,onGetStructTreeError:w,onGetStructTreeSuccess:v,onGetTextError:E,onGetTextSuccess:_,onLoadError:S,onLoadSuccess:x,onRenderAnnotationLayerError:T,onRenderAnnotationLayerSuccess:C,onRenderError:I,onRenderSuccess:O,onRenderTextLayerError:L,onRenderTextLayerSuccess:j,pageColors:P,pageIndex:D,pageNumber:N,pdf:X,registerPage:mt,renderAnnotationLayer:Tt=!0,renderForms:J=!1,renderMode:q="canvas",renderTextLayer:vt=!0,rotate:bt,scale:yt=ba,unregisterPage:Y,width:M,...$}=e,[lt,St]=Ft(),{value:K,error:W}=lt,st=(0,zt.useRef)(null);V(X,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");let nt=de(N)?N-1:D??null,Et=N??(de(D)?D+1:null),Rt=bt??(K?K.rotate:null),Bt=(0,zt.useMemo)(()=>{if(!K)return null;let ne=1,ve=yt??ba;if(M||g){let re=K.getViewport({scale:1,rotation:Rt});M?ne=M/re.width:g&&(ne=g/re.height)}return ve*ne},[g,K,Rt,yt,M]);(0,zt.useEffect)(function(){return()=>{de(nt)&&i&&Y&&Y(nt)}},[i,X,nt,Y]);function Ya(){if(x){if(!K||!Bt)return;x(ys(K,Bt))}if(i&&mt){if(!de(nt)||!st.current)return;mt(nt,st.current)}}function Ka(){W&&((0,ya.default)(!1,W.toString()),S&&S(W))}(0,zt.useEffect)(function(){St({type:"RESET"})},[St,X,nt]),(0,zt.useEffect)(function(){if(!X||!Et)return;let ve=$t(X.getPage(Et)),re=ve;return ve.promise.then(Bi=>{St({type:"RESOLVE",value:Bi})}).catch(Bi=>{St({type:"REJECT",error:Bi})}),()=>Mt(re)},[St,X,Et]),(0,zt.useEffect)(()=>{if(K!==void 0){if(K===!1){Ka();return}Ya()}},[K,Bt]);let Fi=(0,zt.useMemo)(()=>de(nt)&&Et&&de(Rt)&&de(Bt)?{_className:s,canvasBackground:n,customTextRenderer:c,devicePixelRatio:d,filterAnnotations:f,onGetAnnotationsError:y,onGetAnnotationsSuccess:A,onGetStructTreeError:w,onGetStructTreeSuccess:v,onGetTextError:E,onGetTextSuccess:_,onRenderAnnotationLayerError:T,onRenderAnnotationLayerSuccess:C,onRenderError:I,onRenderSuccess:O,onRenderTextLayerError:L,onRenderTextLayerSuccess:j,page:K,pageColors:P,pageIndex:nt,pageNumber:Et,renderForms:J,renderTextLayer:vt,rotate:Rt,scale:Bt}:null,[s,n,c,d,f,y,A,w,v,E,_,T,C,I,O,L,j,K,P,nt,Et,J,vt,Rt,Bt]),Za=(0,zt.useMemo)(()=>gs($,()=>K&&(Bt?ys(K,Bt):void 0)),[$,K,Bt]),_s=`${nt}@${Bt}/${Rt}`;function Ja(){switch(q){case"custom":return V(h,'renderMode was set to "custom", but no customRenderer was passed.'),(0,Gt.jsx)(h,{},`${_s}_custom`);case"none":return null;default:return(0,Gt.jsx)(Hr,{canvasRef:r},`${_s}_canvas`)}}function Qa(){return vt?(0,Gt.jsx)(Ur,{},`${_s}_text`):null}function tl(){return Tt?(0,Gt.jsx)(Lr,{},`${_s}_annotations`):null}function el(){function ne(re){return!!re?.page}if(!ne(Fi))throw new Error("page is undefined");let ve=typeof o=="function"?o(Fi):o;return(0,Gt.jsxs)(Ci.Provider,{value:Fi,children:[Ja(),Qa(),tl(),ve]})}function sl(){return Et?X===null||K===void 0||K===null?(0,Gt.jsx)(ee,{type:"loading",children:typeof b=="function"?b():b}):X===!1||K===!1?(0,Gt.jsx)(ee,{type:"error",children:typeof u=="function"?u():u}):el():(0,Gt.jsx)(ee,{type:"no-data",children:typeof m=="function"?m():m})}return(0,Gt.jsx)("div",{className:oe(s,l),"data-page-number":Et,ref:ws(p,st),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${Bt}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:n||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...Za,children:sl()})}ta();Xt.workerSrc="pdf.worker.mjs";var _h="kanorio:client-error";function Aa(a,t,e){typeof window>"u"||window.dispatchEvent(new CustomEvent(_h,{detail:{error:a,context:t,tags:e}}))}var Mi=[.5,.75,1,1.25,1.5,2],Ii=2,wa=1,va=3,Ni=1.414,jr=10,Es=140,Ea="600px 0px",_a=2,Sa=4194304,xa=16777216,Ta=.5,Ca=500,Pa=24,Ra=32,ka=16,Da=16,La=48,Ma=960,Ia="(min-width: 768px)";function Na(a,t){return a[t-1]??a[0]??Ni}function Oa(a,t,e){if(!a||a<=0)return null;let i=Math.max(a-(t?La:Da),120),n=t?Math.min(i,Ma):i;return Math.floor(n*e)}function Fa(a,t,e){let s=ka;for(let i=1;i<a;i++)s+=t(i)+e;return s}function Ba(a){let{cssWidth:t,cssHeight:e,basePixelRatio:s,isDesktop:i}=a;if(t<=0||e<=0)return s;let r=Math.sqrt((i?xa:Sa)/(t*e));return Math.max(Ta,Math.min(s,r))}function Ha(a,t,e){let s=e?va:wa;return Math.abs(a-t)<=s}var ja=F(ut());var $r=F(ut());var Ua=F(ft());function Oi({pdf:a,pageNumber:t,width:e,devicePixelRatio:s,memory:i,purpose:n,className:r,renderTextLayer:o,renderAnnotationLayer:l,loading:h}){let c=`${n}:${t}:${e}:${s}`;return(0,$r.useEffect)(()=>(i.renderStarted(c),()=>i.renderSettled(c)),[i,c]),(0,$r.useEffect)(()=>()=>i.releasePage(t),[i,t]),(0,Ua.jsx)(Li,{...a?{pdf:a}:{},pageNumber:t,width:e,devicePixelRatio:s,className:r,renderTextLayer:o,renderAnnotationLayer:l,loading:h,onRenderSuccess:()=>i.renderSettled(c),onRenderError:()=>i.renderSettled(c)})}var Ue=F(ft()),$a=(0,ja.memo)(function({pageNumber:t,width:e,height:s,shouldRender:i,devicePixelRatio:n,memory:r,setRef:o}){return(0,Ue.jsx)("div",{ref:l=>o(t,l),"data-page-number":t,className:"shrink-0",style:{width:e,minHeight:s},children:i?(0,Ue.jsx)(Oi,{purpose:"page",pageNumber:t,width:e,devicePixelRatio:n,memory:r,className:"shadow-2xl bg-white !max-w-full",loading:(0,Ue.jsx)("div",{className:"flex items-center justify-center bg-zinc-800/80 text-white/40 text-sm",style:{width:e,height:s},children:(0,Ue.jsx)($e,{className:"h-6 w-6 animate-spin"})})}):(0,Ue.jsx)("div",{className:"flex items-center justify-center bg-zinc-800/60 text-white/30 text-sm shadow-2xl",style:{width:e,height:s},"aria-hidden":!0,children:t})})});var we=F(ut());var Kt=F(ft());function Ga({pdf:a,numPages:t,currentPage:e,devicePixelRatio:s,getPageAspect:i,memory:n,onSelectPage:r}){let{ui:o}=_e(),l=(0,we.useRef)(null),[h,c]=(0,we.useState)(()=>new Set);return(0,we.useEffect)(()=>{let d=l.current;if(!d)return;let u=new IntersectionObserver(f=>{c(g=>{let p=new Set(g);for(let b of f){let m=Number(b.target.dataset.thumbPage);m&&(b.isIntersecting?p.add(m):p.delete(m))}return p})},{root:d,rootMargin:Ea});return d.querySelectorAll("[data-thumb-page]").forEach(f=>u.observe(f)),()=>u.disconnect()},[t]),(0,we.useEffect)(()=>{l.current?.querySelector(`[data-thumb-page="${e}"]`)?.scrollIntoView({block:"nearest",behavior:"smooth"})},[e]),(0,Kt.jsx)("aside",{ref:l,onScroll:n.noteActivity,className:"flex w-48 shrink-0 flex-col overflow-y-auto border-r border-white/10 bg-black/80","aria-label":o.pdfThumbnails,children:(0,Kt.jsx)("div",{className:"flex flex-col items-center gap-3 py-4 px-2",children:Array.from({length:t},(d,u)=>{let f=u+1,g=f===e,p=Es*i(f);return(0,Kt.jsxs)("button",{type:"button","data-thumb-page":f,onClick:()=>r(f),className:Ee("flex flex-col items-center gap-1.5 w-full rounded-md p-1.5 transition-colors","hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/40",g&&"bg-white/10"),"aria-label":Ss(o.pdfGoToPage,{page:String(f)}),"aria-current":g?"page":void 0,children:[(0,Kt.jsx)("div",{className:Ee("overflow-hidden rounded shadow-md bg-white",g?"ring-2 ring-[var(--brand-color,#60a5fa)] ring-offset-1 ring-offset-black":"ring-1 ring-white/20"),children:h.has(f)?(0,Kt.jsx)(Oi,{purpose:"thumb",pdf:a,pageNumber:f,width:Es,devicePixelRatio:s,memory:n,renderTextLayer:!1,renderAnnotationLayer:!1,loading:(0,Kt.jsx)("div",{className:"bg-zinc-200 animate-pulse",style:{width:Es,height:p}})}):(0,Kt.jsx)("div",{className:"bg-zinc-200",style:{width:Es,height:p},"aria-hidden":!0})}),(0,Kt.jsx)("span",{className:Ee("text-xs tabular-nums",g?"text-white font-medium":"text-white/50"),children:f})]},f)})})})}var Gr=F(ut());var et=F(ft());function za({fileName:a,pageNumber:t,numPages:e,isLoading:s,zoomPercent:i,canZoomIn:n,canZoomOut:r,isDefaultZoom:o,onZoomIn:l,onZoomOut:h,onResetZoom:c,onJumpToPage:d,onDownload:u,onClose:f}){let{ui:g}=_e(),[p,b]=(0,Gr.useState)(!1),[m,y]=(0,Gr.useState)(""),A=e||0,w=()=>{b(!1);let E=parseInt(m,10);e&&Number.isFinite(E)&&E>=1&&E<=e&&d(E)};return(0,et.jsxs)("div",{className:"absolute top-0 left-0 right-0 z-20 flex items-center justify-between px-4 py-4 bg-gradient-to-b from-black/50 to-transparent pointer-events-none",children:[(0,et.jsxs)("div",{className:"flex items-center gap-3 min-w-0 text-white/80 text-sm font-medium pointer-events-auto",children:[p?(0,et.jsxs)("span",{className:"flex items-center gap-1 tabular-nums shrink-0",children:[(0,et.jsx)("input",{type:"text",inputMode:"numeric",value:m,onChange:E=>y(E.target.value.replace(/\D/g,"")),onBlur:w,onKeyDown:E=>{E.key==="Enter"?(E.preventDefault(),w()):E.key==="Escape"&&(E.preventDefault(),b(!1))},autoFocus:!0,className:"w-10 h-8 text-center text-[length:var(--site-input-text,16px)] rounded bg-white/10 text-white border border-white/20 focus:outline-none focus:ring-1 focus:ring-white/40","aria-label":g.pdfJumpToPage}),(0,et.jsxs)("span",{children:["/ ",A]})]}):(0,et.jsx)("button",{type:"button",onClick:()=>{y(String(t)),b(!0)},className:"tabular-nums shrink-0 hover:text-white transition-colors px-1 py-0.5 rounded hover:bg-white/10",title:g.pdfEnterPage,"aria-label":Ss(g.pdfPageStatus,{page:String(t),total:String(A)}),children:s?"...":`${t} / ${A}`}),a&&(0,et.jsx)("span",{className:"truncate max-w-[40vw] hidden sm:inline text-white/60 font-normal",children:a})]}),(0,et.jsxs)("div",{className:"flex items-center gap-1 md:gap-2 shrink-0 pointer-events-auto",children:[(0,et.jsx)("button",{type:"button",onClick:h,disabled:!r||s,className:xs,"aria-label":g.zoomOut,children:(0,et.jsx)(qr,{className:"w-5 h-5 md:w-6 md:h-6 text-white"})}),(0,et.jsxs)("button",{type:"button",onClick:c,disabled:o||s,className:Zr,title:o?void 0:g.resetZoom,"aria-label":`${i}% \xB7 ${g.resetZoom}`,children:[i,"%"]}),(0,et.jsx)("button",{type:"button",onClick:l,disabled:!n||s,className:xs,"aria-label":g.zoomIn,children:(0,et.jsx)(Xr,{className:"w-5 h-5 md:w-6 md:h-6 text-white"})}),u&&(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)("div",{className:"w-px h-6 md:h-8 bg-white/20 mx-1 md:mx-2"}),(0,et.jsx)("button",{type:"button",onClick:u,disabled:s,className:xs,title:g.download,"aria-label":g.download,children:(0,et.jsx)(zr,{className:"w-5 h-5 md:w-6 md:h-6 text-white"})})]}),f&&(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)("div",{className:"w-px h-6 md:h-8 bg-white/20 mx-1 md:mx-2"}),(0,et.jsx)("button",{type:"button",onClick:f,className:Kr,title:g.close,"aria-label":g.close,children:(0,et.jsx)(Wr,{className:"w-5 h-5 md:w-6 md:h-6 text-white"})})]})]})]})}var pt=F(ut());async function Va(a,t){let s=(await a.getPage(t)).getViewport({scale:1});return s.height/s.width}function Sh(){return new Promise(a=>{typeof window.requestIdleCallback=="function"?window.requestIdleCallback(()=>a(),{timeout:500}):setTimeout(a,50)})}function Wa(a){let{scrollContainerRef:t,scale:e}=a,[s,i]=(0,pt.useState)(null),[n,r]=(0,pt.useState)(!1),[o,l]=(0,pt.useState)([]),h=(0,pt.useRef)({id:0});(0,pt.useEffect)(()=>{let y=t.current;if(!y)return;let A=()=>{let v=y.clientWidth;v>0&&i(v)};A();let w=new ResizeObserver(A);return w.observe(y),()=>w.disconnect()},[t]),(0,pt.useEffect)(()=>{let y=window.matchMedia(Ia),A=()=>r(y.matches);return A(),y.addEventListener("change",A),()=>y.removeEventListener("change",A)},[]),(0,pt.useEffect)(()=>{let y=h.current;return()=>{y.id++}},[]);let c=(0,pt.useCallback)(async y=>{let A=++h.current.id,w=Ni;try{w=await Va(y,1)}catch(v){console.error("[PDFViewerFull] Failed to read page aspect:",v)}A===h.current.id&&(l([w]),(async()=>{let v=[w];for(let E=2;E<=y.numPages;E+=jr){if(await Sh(),A!==h.current.id)return;let _=Math.min(E+jr-1,y.numPages);for(let S=E;S<=_;S++)try{v.push(await Va(y,S))}catch{if(A!==h.current.id)return;v.push(w)}if(A!==h.current.id)return;l([...v])}})())},[]),d=typeof window>"u"?1:Math.min(window.devicePixelRatio||1,_a),u=n?Ra:Pa,f=(0,pt.useMemo)(()=>Oa(s,n,e),[s,n,e]),g=(0,pt.useCallback)(y=>Na(o,y),[o]),p=(0,pt.useCallback)(y=>f?f*g(y):400,[f,g]),b=(0,pt.useCallback)(y=>Fa(y,p,u),[p,u]),m=(0,pt.useCallback)(y=>f?Ba({cssWidth:f,cssHeight:p(y),basePixelRatio:d,isDesktop:n}):d,[f,p,d,n]);return{isDesktop:n,pageWidth:f,basePixelRatio:d,getPageAspect:g,getPageHeight:p,getPageOffset:b,pixelRatioForPage:m,loadPageAspects:c}}var je=F(ut());function Xa(a){let{cleanupDocument:t,idleMs:e}=a,s=new Set,i=null,n=!1,r=!1,o=!1,l=()=>{i&&(clearTimeout(i),i=null)},h=()=>{i=null,!(o||r||!n||s.size>0)&&(r=!0,n=!1,t().catch(()=>{n=!0}).finally(()=>{r=!1}))},c=()=>{o||(l(),i=setTimeout(h,e))};return{renderStarted(d){o||(s.add(d),n=!0,l())},renderSettled(d){o||!s.delete(d)||s.size===0&&n&&c()},noteActivity(){o||(n=!0,s.size===0&&c())},dispose(){o=!0,l(),s.clear()}}}function qa(a){let t=(0,je.useRef)(null);return(0,je.useEffect)(()=>()=>{t.current?.scheduler.dispose()},[a]),(0,je.useMemo)(()=>{let e=()=>a?(t.current?.pdf!==a&&(t.current?.scheduler.dispose(),t.current={pdf:a,scheduler:Xa({cleanupDocument:()=>a.cleanup(!0),idleMs:Ca})}),t.current.scheduler):null;return{renderStarted:s=>e()?.renderStarted(s),renderSettled:s=>e()?.renderSettled(s),noteActivity:()=>e()?.noteActivity(),releasePage:s=>{a&&a.getPage(s).then(i=>{i.cleanup()}).catch(()=>{})}}},[a])}var gt=F(ft());to(jt);function xh({src:a,fileName:t,allowDownload:e=!1,downloadUrl:s,onClose:i,className:n}){let{ui:r}=_e(),[o,l]=(0,Z.useState)(null),[h,c]=(0,Z.useState)(1),[d,u]=(0,Z.useState)(Ii),[f,g]=(0,Z.useState)(!0),[p,b]=(0,Z.useState)(null),[m,y]=(0,Z.useState)(null),A=(0,Z.useRef)(null),w=(0,Z.useRef)(new Map),v=(0,Z.useRef)(null),E=(0,Z.useRef)(new Map),_=(0,Z.useRef)(!1),S=(0,Z.useRef)(null),x=Mi[d],T=Wa({scrollContainerRef:A,scale:x}),{isDesktop:C,pageWidth:I,getPageHeight:O,getPageOffset:L,pixelRatioForPage:j,loadPageAspects:P}=T,D=qa(m),N=C&&(o??0)>1&&!f&&!!m,X=(0,Z.useMemo)(()=>({cMapUrl:Jr(jt.version),cMapPacked:!0,standardFontDataUrl:Qr(jt.version),disableAutoFetch:!0,disableStream:!0}),[]),mt=(0,Z.useCallback)(async M=>{y(M),await P(M),l(M.numPages),c(1),g(!1),b(null)},[P]),Tt=(0,Z.useCallback)(M=>{console.error("[PDFViewerFull] Load error:",M.message),Aa(M,"pdf-viewer"),y(null),g(!1),b(r.pdfLoadFailed)},[r.pdfLoadFailed]),J=(0,Z.useCallback)(()=>{u(M=>Math.min(M+1,Mi.length-1))},[]),q=(0,Z.useCallback)(()=>{u(M=>Math.max(M-1,0))},[]),vt=(0,Z.useCallback)(()=>{u(Ii)},[]),bt=(0,Z.useCallback)(M=>{let $=A.current;if(!$||!I||!o||M<1||M>o)return;c(M),_.current=!0,S.current&&clearTimeout(S.current);let lt=L(M);requestAnimationFrame(()=>{requestAnimationFrame(()=>{$.scrollTo({top:lt,behavior:"smooth"}),S.current=setTimeout(()=>{_.current=!1,S.current=null},500)})})},[I,o,L]),yt=(0,Z.useCallback)(()=>{let M=document.createElement("a");s?M.href=s:(M.href=a,M.download=t||"document.pdf",M.target="_blank"),document.body.appendChild(M),M.click(),document.body.removeChild(M)},[a,t,s]);(0,Z.useEffect)(()=>{let M=Yr();return()=>{M(),S.current&&clearTimeout(S.current)}},[]),(0,Z.useEffect)(()=>{let M=$=>{$.target instanceof HTMLInputElement||($.key==="+"||$.key==="="?($.preventDefault(),J()):$.key==="-"?($.preventDefault(),q()):$.key==="Escape"&&i&&($.preventDefault(),$.stopPropagation(),i()))};return window.addEventListener("keydown",M,!0),()=>window.removeEventListener("keydown",M,!0)},[J,q,i]),(0,Z.useEffect)(()=>{let M=A.current;if(!M||!o)return;E.current=new Map;let $=new IntersectionObserver(lt=>{if(_.current)return;for(let W of lt){let st=Number(W.target.dataset.pageNumber);st&&E.current.set(st,W.isIntersecting?W.intersectionRatio:0)}let St=1,K=0;for(let[W,st]of E.current)st>K&&(K=st,St=W);K>0&&c(W=>W===St?W:St)},{root:M,threshold:[0,.25,.5,.75,1]});v.current=$;for(let lt of w.current.values())$.observe(lt);return()=>{$.disconnect(),v.current=null}},[o,f]);let Y=(0,Z.useCallback)((M,$)=>{let lt=w.current.get(M);lt&&lt!==$&&v.current?.unobserve(lt),$?(w.current.set(M,$),v.current?.observe($)):w.current.delete(M)},[]);return(0,gt.jsxs)("div",{id:"pdf-viewer-full-root",className:Ee("fixed inset-0 z-[9999] flex flex-col bg-black/95 overflow-hidden",n),role:"dialog","aria-modal":"true","aria-label":t||r.pdfViewer,children:[(0,gt.jsx)(za,{fileName:t,pageNumber:h,numPages:o,isLoading:f,zoomPercent:Math.round(x*100),canZoomIn:d<Mi.length-1,canZoomOut:d>0,isDefaultZoom:d===Ii,onZoomIn:J,onZoomOut:q,onResetZoom:vt,onJumpToPage:bt,onDownload:e?yt:void 0,onClose:i}),(0,gt.jsxs)("div",{className:"flex-1 min-h-0 flex pt-16",children:[N&&m&&o&&(0,gt.jsx)(Ga,{pdf:m,numPages:o,currentPage:h,devicePixelRatio:T.basePixelRatio,getPageAspect:T.getPageAspect,memory:D,onSelectPage:bt}),(0,gt.jsx)("div",{ref:A,id:"pdf-viewer-full-container",className:"flex-1 min-w-0 overflow-auto",onScroll:D.noteActivity,onClick:M=>{M.target===M.currentTarget&&i&&i()},children:(0,gt.jsx)("div",{className:"flex flex-col items-center gap-6 md:gap-8 py-4 px-2 md:px-6 min-h-full",children:p?(0,gt.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 text-white/70 py-20",children:[(0,gt.jsx)("p",{className:"text-sm",children:p}),(0,gt.jsxs)("button",{type:"button",onClick:()=>{b(null),g(!0)},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-md border border-white/20 hover:bg-white/10 transition-colors",children:[(0,gt.jsx)(Vr,{className:"h-3.5 w-3.5"}),r.retry]})]}):I?(0,gt.jsx)(Dr,{file:a,onLoadSuccess:mt,onLoadError:Tt,options:X,className:"flex flex-col items-center gap-6 md:gap-8 w-full",loading:(0,gt.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,gt.jsx)($e,{className:"h-8 w-8 animate-spin text-white/50"})}),children:o&&Array.from({length:o},(M,$)=>{let lt=$+1;return(0,gt.jsx)($a,{pageNumber:lt,width:I,height:O(lt),shouldRender:Ha(lt,h,C),devicePixelRatio:j(lt),memory:D,setRef:Y},lt)})}):(0,gt.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,gt.jsx)($e,{className:"h-8 w-8 animate-spin text-white/50"})})})})]})]})}export{xh as default};
13
- //# sourceMappingURL=PDFViewerFull-CB44M7GW.js.map
13
+ //# sourceMappingURL=PDFViewerFull-P3HCVGDZ.js.map